Reading and writing to and from a file to a form

Hi there
I would like somebody to send me a code example,
showing me how to reading records from a file to a form,
and writing records to the same file from the same form.
I know that I have to use sycronize, but I just have not been
successful. I can constract forms, go from form to a form,
do buttons, do text fields. I can even read and write from and
to files. However I cannot do is write from a file to a form and
from a form to a file.
could somebody please explain how this done, and could you
please give me a code example. All the books seem to either
deal with forms or with files. None seem to combine both.
I am sure it is very ease to do if ONLY I knew how!!!
thank you very much in advance for you help.

I understand that code and I have used it before, however thanks for
trying to help me, it is really appreciated. However, that is not my
problem. I can read and write from a file to the console and vice versa.
what I cannot do, no matter how hard I try, is to write from a file, and
output it in.
I will tell you how far I have got.
I have a MenuFrame class, this is the code for it:
package WorkflowApp;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
public class MenuFrame extends JFrame {
JMenuBar menuBar1 = new JMenuBar();
JMenu menuFile = new JMenu();
JMenuItem menuFileExit = new JMenuItem();
JMenu menuHelp = new JMenu();
JMenuItem menuHelpAbout = new JMenuItem();
JToolBar toolBar = new JToolBar();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JButton jButton3 = new JButton();
ImageIcon image1;
ImageIcon image2;
ImageIcon image3;
JLabel statusBar = new JLabel();
Button button2 = new Button();
Button button3 = new Button();
Button button4 = new Button();
Button button5 = new Button();
Button button6 = new Button();
Button button7 = new Button();
Button button1 = new Button();
//Construct the frame
public MenuFrame() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
catch(Exception e) {
e.printStackTrace();
//Component initialization
private void jbInit() throws Exception {
image1 = new ImageIcon(WorkflowApp.MenuFrame.class.getResource("openFile.gif"));
image2 = new ImageIcon(WorkflowApp.MenuFrame.class.getResource("closeFile.gif"));
image3 = new ImageIcon(WorkflowApp.MenuFrame.class.getResource("help.gif"));
this.getContentPane().setLayout(null);
this.setSize(new Dimension(400, 492));
this.setTitle("MenuFrame");
statusBar.setText(" ");
statusBar.setBounds(new Rectangle(0, 0, 3, 17));
menuFile.setText("File");
menuFileExit.setText("Exit");
menuFileExit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
fileExit_actionPerformed(e);
menuHelp.setText("Help");
menuHelpAbout.setText("About");
menuHelpAbout.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
helpAbout_actionPerformed(e);
jButton1.setIcon(image1);
jButton1.setToolTipText("Open File");
jButton2.setIcon(image2);
jButton2.setToolTipText("Close File");
jButton3.setIcon(image3);
jButton3.setToolTipText("Help");
toolBar.setBorder(null);
toolBar.setBounds(new Rectangle(2, 2, 389, 30));
button2.setBounds(new Rectangle(217, 62, 135, 44));
button2.setLabel("Staff Details");
button2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
button2_actionPerformed(e);
button3.setBounds(new Rectangle(26, 127, 135, 44));
button3.setLabel("Arange Viewing");
button3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
button3_actionPerformed(e);
button4.setBounds(new Rectangle(218, 127, 136, 41));
button4.setLabel("Valuation");
button4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
button4_actionPerformed(e);
button5.setBounds(new Rectangle(28, 196, 135, 41));
button5.setLabel("Schedule");
button6.setBounds(new Rectangle(221, 194, 133, 40));
button6.setName("button6");
button6.setLabel("Register Interest");
button7.setBounds(new Rectangle(31, 266, 133, 42));
button7.setLabel("Register Offers");
button1.setBounds(new Rectangle(27, 62, 131, 42));
button1.setLabel("New Client");
button1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
button1_actionPerformed(e);
menuFile.add(menuFileExit);
menuHelp.add(menuHelpAbout);
menuBar1.add(menuFile);
menuBar1.add(menuHelp);
this.setJMenuBar(menuBar1);
this.getContentPane().add(statusBar, null);
this.getContentPane().add(toolBar, null);
toolBar.add(jButton1);
toolBar.add(jButton2, null);
toolBar.add(jButton3, null);
this.getContentPane().add(button3, null);
this.getContentPane().add(button5, null);
this.getContentPane().add(button7, null);
this.getContentPane().add(button2, null);
this.getContentPane().add(button4, null);
this.getContentPane().add(button6, null);
this.getContentPane().add(button1, null);
//File | Exit action performed
public void fileExit_actionPerformed(ActionEvent e) {
System.exit(0);
//Help | About action performed
public void helpAbout_actionPerformed(ActionEvent e) {
MenuFrame_AboutBox dlg = new MenuFrame_AboutBox(this);
Dimension dlgSize = dlg.getPreferredSize();
Dimension frmSize = getSize();
Point loc = getLocation();
dlg.setLocation((frmSize.width - dlgSize.width) / 2 + loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y);
dlg.setModal(true);
dlg.show();
//Overridden so we can exit on System Close
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if(e.getID() == WindowEvent.WINDOW_CLOSING) {
fileExit_actionPerformed(null);
void button2_actionPerformed(ActionEvent e) {
StaffDetails myFrame = new StaffDetails();
myFrame.show();
void button3_actionPerformed(ActionEvent e) {
ArrangeViewing myFrame = new ArrangeViewing();
myFrame.show();
void button1_actionPerformed(ActionEvent e) {
NewClientFrame myFrame = new NewClientFrame();
myFrame.show();
// System.exit(1);
void button4_actionPerformed(ActionEvent e) {
Valuation myFrame = new Valuation();
myFrame.show();
then I have a new form class, this is the code for it
package WorkflowApp;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class NewClientFrame extends JFrame {
Label label1 = new Label();
Label label2 = new Label();
Label label3 = new Label();
Label label4 = new Label();
Label label5 = new Label();
Label label6 = new Label();
Label label7 = new Label();
Label label8 = new Label();
Label label9 = new Label();
Label label10 = new Label();
TextField textField1 = new TextField();
TextField textField2 = new TextField();
TextField textField3 = new TextField();
TextField textField4 = new TextField();
TextField textField5 = new TextField();
TextField textField6 = new TextField();
TextField textField7 = new TextField();
TextField textField8 = new TextField();
TextField textField9 = new TextField();
TextField textField10 = new TextField();
Button button1 = new Button();
Button button2 = new Button();
//Construct the frame
public NewClientFrame() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
catch(Exception e) {
e.printStackTrace();
//Component initialization
private void jbInit() throws Exception {
this.getContentPane().setLayout(null);
this.setSize(new Dimension(411, 488));
this.setTitle("NewClientFrame ");
this.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(WindowEvent e) {
this_windowClosing(e);
label1.setBounds(new Rectangle(21, 23, 110, 23));
label1.setAlignment(2);
label1.setText("Assign Number");
label2.setBounds(new Rectangle(23, 57, 108, 25));
label2.setAlignment(2);
label2.setText("Name");
label3.setBounds(new Rectangle(40, 91, 94, 24));
label3.setAlignment(2);
label3.setText("Address 1");
label4.setBounds(new Rectangle(21, 124, 112, 29));
label4.setAlignment(2);
label4.setText("Address 2");
label5.setBounds(new Rectangle(20, 159, 116, 29));
label5.setAlignment(2);
label5.setText("PoscCode");
label6.setBounds(new Rectangle(18, 197, 119, 26));
label6.setAlignment(2);
label6.setText("Telephone");
label7.setBounds(new Rectangle(25, 228, 112, 26));
label7.setAlignment(2);
label7.setText("Other Telephone");
label8.setBounds(new Rectangle(12, 261, 125, 24));
label8.setAlignment(2);
label8.setText("Email Address");
label9.setBounds(new Rectangle(6, 301, 138, 25));
label9.setAlignment(2);
label9.setText("Staff Assigned (Name)");
label10.setBounds(new Rectangle(22, 341, 124, 23));
label10.setAlignment(2);
label10.setText("Staff Assigned (No.)");
textField1.setBounds(new Rectangle(155, 19, 80, 26));
textField2.setBounds(new Rectangle(155, 58, 193, 24));
textField3.setBounds(new Rectangle(156, 90, 192, 25));
textField4.setBounds(new Rectangle(157, 126, 192, 23));
textField5.setBounds(new Rectangle(157, 159, 195, 25));
textField6.setBounds(new Rectangle(157, 194, 195, 26));
textField7.setBounds(new Rectangle(157, 230, 192, 24));
textField8.setBounds(new Rectangle(157, 263, 193, 25));
textField9.setBounds(new Rectangle(157, 303, 196, 24));
textField10.setBounds(new Rectangle(158, 337, 95, 24));
button1.setBounds(new Rectangle(23, 398, 144, 34));
button1.setLabel("Staff Available");
button2.setBounds(new Rectangle(211, 396, 148, 34));
button2.setLabel("Submit Record");
button2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
button2_actionPerformed(e);
this.getContentPane().add(label1, null);
this.getContentPane().add(label2, null);
this.getContentPane().add(label3, null);
this.getContentPane().add(label4, null);
this.getContentPane().add(label5, null);
this.getContentPane().add(label6, null);
this.getContentPane().add(label7, null);
this.getContentPane().add(label8, null);
this.getContentPane().add(label9, null);
this.getContentPane().add(label10, null);
this.getContentPane().add(textField1, null);
this.getContentPane().add(textField2, null);
this.getContentPane().add(textField3, null);
this.getContentPane().add(textField4, null);
this.getContentPane().add(textField5, null);
this.getContentPane().add(textField6, null);
this.getContentPane().add(textField7, null);
this.getContentPane().add(textField8, null);
this.getContentPane().add(textField9, null);
this.getContentPane().add(textField10, null);
this.getContentPane().add(button1, null);
this.getContentPane().add(button2, null);
public void fileExit_actionPerformed(ActionEvent e) {
System.exit(0);
// exit(this);
// close();
//Overridden so we can exit on System Close
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if(e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
void button2_actionPerformed(ActionEvent e) {
// myFrame.close();
this.dispose();
void this_windowClosing(WindowEvent e) {
this.dispose();
I also have an about box, staff details, and valuation forms.
what I am trying to do is for the New client form to be able to read and write from and to a file, and display the info.
I am working in JBuilder3, a bit out of date I know, but it is the best I can do. Any Ideas how to do this.

Similar Messages

  • How to read and write a data from extrenal file

    Hi..
    How to read and write a data from extrenal file using Pl/sql?
    Is it possible from Dyanamic Sql or any other way?
    Reagards
    Raju

    utl_file
    Re: How to Create text(dat) file.
    Message was edited by:
    jeneesh

  • I am batch processing in PS 2014 (watermark and saving as jpeg from ps file). I get the message for some but not all 'this file needs to be saved as a copy with this option'. And then I have to save it manually. Does anyone know why this happens? (It is j

    I am batch processing in PS 2014 (watermark and saving as jpeg from ps file). I get the message for some but not all 'this file needs to be saved as a copy with this option'. And then I have to save it manually. Does anyone know why this happens? (It is just a plain photoshop file, a watermark is added, then save as jpeg - the jpeg is saved to a different folder than the original photoshop file.)  It happens for about 10 of 30/40  files approximately . Thank you, Kathryn

    I believe I have figured it out - I need to flatten the image, even though there are no layers except for layer 0, first.

  • Since updating my iTunes I no longer have any controls.  iTune covers the entire desktop and I cannot add from my files.  Can anyone please advise me.

    Since updating my iTunes I no longer have any controls.  iTune covers the entire desktop and I cannot add from my files.  Prior to updating I had a perfectly good iTunes which would allow me to stories for including on a iPod. 
    Can anyone please advise me.

    From my post on what seems like the same issue (found here: https://discussions.apple.com/message/21087892#21087892)
    Take the following steps:
    1) while connected to wifi, toggle off then back on the Show All Music and iTunes Match options shown in my original post. Important: I did this step before, but wasn't connected to wifi, and my music disappeared. Subsequently, I connected to wifi and turned off and then back on those options and everything came back though it was grayed out and my only option was to download music.
    2) To get streaming over cellular back, go into Settings>General>Cellular and scroll down to the "Use Cellular Data for:" options and make sure the iTunes option is set to 'On'
    The above steps will bring back the streaming capability which seemed to go away when you update to 6.1. It didn't ACTUALLY go away, but something about the update toggled off the iTunes option in step 2 above.
    I did a final test by turning off wifi, opening Music app and selecting a song. It played successfully without downloading! Crossing my fingers, but I think I'm good to go!
    Hope this helps!

  • TS3899 I have an iphone5 and the reply, forward and writing a message from the mail app doesn't work. I can check my mail but can't reply to it. What's going on?

    I have an iphone5 and the reply, forward and writing a message from the mail app doesn't work. I can check my mail but can't reply to it. What's going on?

    Try a reset: hold down the home button along with the sleep/wake button until you see the apple, then let go. (No data loss)

  • SIU - Apply Computer Name and Local Hostname settings from a file

    I am setting up a workflow to image corporate computers and wanting to know how the "Apply Computer Name and Local Hostname settings from a file" works in the Apply System Configuration Settings task.
    We bind the computer to AD and OD and we have a specific naming convention for certain departments and trying to automate the entire imaging process.
    Would this be something that can be done with SIU?

    Well, maybe there's a bug in the latest version (10.5.3) of SIU as this is not what is happening.
    It doesn't seem to matter what I specify for the name parameters I end up with a Bonjour name of ".local".
    I put in a line of the form <Mac Address><TAB>tom<TAB>dick<TAB>harry into the text file used by the Apply System Configuration Settings Action.
    and end up with hostname = tom, Computer Name = dick and Bonjour Name = .local
    I'm building the NetInstall image on a new iMac running 10.5.3 booted out of a second partition and create the image from the main boot partition (also 10.5.3). I then copy the image to my server (10.5.3) and make a second iMac boot up from the NetInstall image.
    For what it is worth the Workflow Actions I am using are:
    Define Image Source
    + NetInstall
    Source: Macintosh HD
    Filter Clients by MAC Address
    + Allow
    <List of MAC Addresses>
    Enable Automated Installation
    + On Volume Named: Macintosh HD
    + Erase before installing
    + Primary Language: English
    Apply System Configuration Settings
    + Apply Computer Name and Local Hostname settings from a file: <FILE>
    Add Packages and Post-Install Scripts
    + Shell Script [Doesn't work - we're discussing in it in another thread]
    Create Image
    In: Public
    Named: NetInstall Classroom
    Volume Name: Classroom iMacs
    Index: 1

  • I updated Itunes today to the latest version. Windows 7 64bit. None of my drivers work and get an error when itunes starts, about registry setting for reading and writing dvds and cds missing. Anyone else have the same issue. I downloaded itunes again, re

    I updated Itunes today to the latest version. Windows 7 64bit. None of my drivers work and get an error when itunes starts, about registry setting for reading and writing dvds and cds missing. Anyone else have the same issue. I downloaded itunes again, reinstalled still have same issue.

    I'd start with the following document, with one modification. At step 12 after typing GEARAspiWDM press the Enter/Return key once prior to clicking OK. (Pressing Return adds a carriage return in the field and is important.)
    iTunes for Windows: "Registry settings" warning when opening iTunes

  • Gif - file help: i don't want to read the gif each time from the file.....

    Hello there guys,
    i'm making a game and therefor i need to read a gif file like 20 times.
    i don't want my program to read the gif each time from the file, but only once.
    so i load it into an image or something?
    cuz opening the gif 20 times from my hard disk is a lot of time loss....
    opening it once and store it is much more efficient
    thx in advance
    plz help me out, cuz i don't really know how to do it.
    (in Delphi it's easy, but Java......)
    greetz,
    SpeciesXX
    Ramon Ribbe

    yes, it works, i used this code, thx man
    void button1_ActionPerformed(java.awt.event.ActionEvent event)
              ImageIcon image = new ImageIcon("f:/a.gif");          
              JLabel label = new JLabel();          
              label.setIcon(image);                    
              this.getContentPane().add(label);
              label.setBounds(10,10,100,100);
    and there i see my image :-)
    but 1 more thing, should i display all those blocks (images) on an applet, or should i use something else? (like what??)
    a sort of frame?
    because later on i have the field where all the blocks are in, and i have an area surrounding it, displaying all kinda information about the game, like how many lives remaining....
    can i put 2 applets in eachother? like applet1 is the parent of applet2?
    or should i use something else?
    plz help me, cuz java is kinda new to me i see....
    in delphi i just used 2 forms, form 1 with the blocks, form2 with the rest of info, and also being the parent of form1
    thx again, soon i can help ya guys too, i hope..
    (im learning java at school, but way too slow and to ez)
    Ramon

  • Error 105, Could not read full block (2048 bytes) from checkpoint file ~/dirchk/sdfsdj.cpe

    Hi expert,
        i am getting below error in goldengate  due to mount point full and i released the space and still the same error for all gg processes. i can see the *cpe cpr file become 0 bytes. so i deleted and re added the extract and repliacat and while adding the replcat i used add replicat  checkpoint table because of that multiple entries of same replicat came in checkpoint table . my checkpoint details also  present in ./GLOBALS. now my doubt is if add  replicate with mentioning checkpoint table name  will duplicate entry will be created or what is the work around for this.
    MANAGER RUNNING
    Invalid checkpoint for EXTRACT  qqqq   (error 105, Could not read full block (2048 bytes) from checkpoint file XXXXXXXXX)
    Invalid checkpoint for EXTRACT  qqq(error 105, Could not read full block (2048 bytes) from checkpoint file XXXXXXXXXX)
    Invalid checkpoint for REPLICAT qqq  (error 105, Could not read full block (2048 bytes) from checkpoint file XXXXXXXXXXX)

    Hi Kariyath
    Increase the page size of your windows machine.Check for the recommanded page size.Remember that the recommanded page size should be the lower limit.If you have any issue feel free to ask.Your prob will be solved
    Award suitable points

  • Reading the data from 2 files and writing it into the 3rd file?

    Hi,
    I am reading datas from 2 files Say,
    Example1.txt Example2.txt
    Ashok ^data1^data2^data3
    Babu ^data1^data2^data3
    Chenthil ^data1^data2^data3
    Danny ^data1^data2^data3
    I want those data's to be written in a 3rd file. Say,
    Example3.txt
    Ashok^ data1^data2^data3
    Babu^ data1^data2^data3
    Chenthil^ data1^data2^data3
    Danny^ data1^data2^data3
    So that i can tokenize it with a delimeter(^) and get the values. Here how to append the datas in this form in Example3.txt. Eventhough u use FileWriter with append "true" as a parameter how they will apend like the Example3.txt file? Please do provide an answer for this..Since this is very urgent to be delivered...Expecting postive response.
    Thanx,
    JavaCrazyLover

    import java.io.*;
    import java.util.*;
    public class en
    public static void main(String args[]) throws IOException     
    {int data,data1,offset,offset1;
              FileOutputStream fos1=new FileOutputStream("c:/example3.txt");
              FileInputStream fis=new FileInputStream("c:/example1.txt");
              FileInputStream fis1=new FileInputStream("c:/example2.txt");
    while((data=fis.read())!=-1) 
         fos1.write(data);
    while((data=fis1.read())!=-1) 
    fos1.write(data);
    fis.close();
    fis1.close();
    fos1.close();
    }first create those 3 files in c:

  • Reading the Blob and writing it to an external file in an xml tree format

    Hi,
    We have a table by name clarity_response_log and content of the column(Response_file) is BLOB and we have xml file or xml content in that column. Most probably the column or table may be having more than 5 records and hence we need to read the corresponding blob content and write to an external file.
    CREATE TABLE CLARITY_RESPONSE_LOG
      REQUEST_CODE   NUMBER,
      RESPONSE_FILE  BLOB,
      DATE_CRATED    DATE                           NOT NULL,
      CREATED_BY     NUMBER                         NOT NULL,
      UPDATED_BY     NUMBER                         DEFAULT 1,
      DATE_UPDATED   VARCHAR2(20 BYTE)              DEFAULT SYSDATE
    )The xml content in the insert statement is very small because of some reason and cannot be made public and indeed we have a very big xml file stored in the BLOB column or Response_File column
    Insert into CLARITY_RESPONSE_LOG
       (REQUEST_CODE, RESPONSE_FILE, DATE_CRATED, CREATED_BY, UPDATED_BY, DATE_UPDATED)
    Values
       (5, '<?xml version="1.0" encoding="UTF-8"?><xml-response><phone-number>1212121212</tracking-number></xml-response>', TO_DATE('09/23/2010 09:01:34', 'MM/DD/YYYY HH24:MI:SS'), 1, 1, '23-SEP-10');
    Insert into CLARITY_RESPONSE_LOG
       (REQUEST_CODE, RESPONSE_FILE, DATE_CRATED, CREATED_BY, UPDATED_BY, DATE_UPDATED)
    Values
       (6, '<?xml version="1.0" encoding="UTF-8"?><xml-response><phone-number>1212121212</tracking-number></xml-response>', TO_DATE('09/23/2010 09:01:34', 'MM/DD/YYYY HH24:MI:SS'), 1, 1, '23-SEP-10');
    Insert into CLARITY_RESPONSE_LOG
       (REQUEST_CODE, RESPONSE_FILE, DATE_CRATED, CREATED_BY, UPDATED_BY, DATE_UPDATED)
    Values
       (7, '<?xml version="1.0" encoding="UTF-8"?><xml-response><phone-number>1212121212</tracking-number></xml-response>', TO_DATE('09/23/2010 09:01:34', 'MM/DD/YYYY HH24:MI:SS'), 1, 1, '23-SEP-10');
    Insert into CLARITY_RESPONSE_LOG
       (REQUEST_CODE, RESPONSE_FILE, DATE_CRATED, CREATED_BY, UPDATED_BY, DATE_UPDATED)
    Values
       (8, '<?xml version="1.0" encoding="UTF-8"?><xml-response><phone-number>1212121212</tracking-number></xml-response>', TO_DATE('09/23/2010 09:01:34', 'MM/DD/YYYY HH24:MI:SS'), 1, 1, '23-SEP-10');
    Insert into CLARITY_RESPONSE_LOG
       (REQUEST_CODE, RESPONSE_FILE, DATE_CRATED, CREATED_BY, UPDATED_BY, DATE_UPDATED)
    Values
       (9, '<?xml version="1.0" encoding="UTF-8"?><xml-response><phone-number>1212121212</tracking-number></xml-response>', TO_DATE('09/23/2010 09:01:34', 'MM/DD/YYYY HH24:MI:SS'), 1, 1, '23-SEP-10');THe corresponding proc for reading the data and writing the data to an external file goes something like this
    SET serveroutput ON
    DECLARE
       vstart     NUMBER             := 1;
       bytelen    NUMBER             := 32000;
       len        NUMBER;
       my_vr      RAW (32000);
       x          NUMBER;
       l_output   UTL_FILE.FILE_TYPE;
    BEGIN
    -- define output directory
       l_output :=
          UTL_FILE.FOPEN ('CWFSTORE_RESPONCE_XML', 'extract500.txt', 'wb', 32760);
       vstart := 1;
       bytelen := 32000;
    ---get the Blob locator
       FOR rec IN (SELECT response_file vblob
                     FROM clarity_response_log
                    WHERE TRUNC (date_crated) = TRUNC (SYSDATE - 1))
       LOOP
    --get length of the blob
    len := DBMS_LOB.getlength (rec.vblob);
          DBMS_OUTPUT.PUT_LINE (len);
          x := len;
    ---- If small enough for a single write
    IF len < 32760
          THEN
             UTL_FILE.put_raw (l_output, rec.vblob);
             UTL_FILE.FFLUSH (l_output);
          ELSE  
    -------- write in pieces
             vstart := 1;
             WHILE vstart < len AND bytelen > 0
             LOOP
                DBMS_LOB.READ (rec.vblob, bytelen, vstart, my_vr);
                UTL_FILE.put_raw (l_output, my_vr);
                UTL_FILE.FFLUSH (l_output);
    ---------------- set the start position for the next cut
                vstart := vstart + bytelen;
    ---------- set the end position if less than 32000 bytes
                x := x - bytelen;
                IF x < 32000
                THEN
                   bytelen := x;
                END IF;
                UTL_FILE.NEW_LINE (l_output);
             END LOOP;
    ----------------- --- UTL_FILE.NEW_LINE(l_output);
          END IF;
       END LOOP;
       UTL_FILE.FCLOSE (l_output);
    END;The above code works well and all the records or xml contents are being written simultaneously adjacent to each other but we each records must be written to a new line or there must be a line gap or a blank line between any two records
    the code which I get is as follow all all xml data comes on a single line
    <?xml version="1.0" encoding="ISO-8859-1"?><emp><empno>7369</empno><ename>James</ename><job>Manager</job><salary>1000</salary></emp><?xml version="1.0" encoding="ISO-8859-1"?><emp><empno>7370</empno><ename>charles</ename><job>President</job><salary>500</salary></emp>But the code written to an external file has to be something like this.
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <emp>
      <empno>7369</empno>
      <ename>James</ename>
      <job>Manager</job>
      <salary>1000</salary>
    </emp>
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <emp>
    <empno>7370</empno>
    <ename>charles</ename>
    <job>President</job>
    <salary>500</salary>
    </emp>Please advice

    What was wrong with the previous answers given on your other thread:
    Export Blob data to text file(-29285-ORA-29285: file write error)
    If there's a continuing issue, stay with the same thread, don't just ask the same question again and again, it's really Pi**es people off and causes confusion as not everyone will be familiar with what answers you've already had. You're just wasting people's time by doing that.
    As already mentioned before, convert your BLOB to a CLOB and then to XMLTYPE where it can be treated as XML and written out to file in a variety of ways including the way I showed you on the other thread.
    You really seem to be struggling to get the worst possible way to work.

  • How to read a file and pickup some information from  a file

    Hai all,
    I wrote a beloe program to read a file and write it into another file
    import java.io.*;
    public class Rdata {
    /** Creates a new instance of Rdata */
    public Rdata() {
    public static void main(String a[])throws Exception
    FileReader fr=new FileReader("c:\\java\\attach\\attach2\\resume1.doc");
    FileWriter fw=new FileWriter("C:\\java\\attach\\abc2.doc");
    char ch;
    int i;
    while((i=fr.read())!=-1)
    ch=(char)i;
    fw.write(ch);
    fw.close();
    This program reads the content from resume1.doc and write it into abc2.doc . But in my project I want to read the resume1.doc and and write only peace of information like "keyskills are java,jsp,javamail"
    I mean how to read the entaire file and how to write into another file whisc i require
    Thanks&regards
    radhs

    http://java.sun.com/docs/books/tutorial/essential/io/

  • Question around UTL_FILE and writing unicode data to a file.

    Database version : 11.2.0.3.0
    NLS_CHARACTERSET : AL32UTF8
    OS : Red Hat Enterprise Linux Server release 6.3 (Santiago)
    I did not work with multiple language characters and manipulating them. So, the basic idea is to write UTF8 data as Unicode file using UTL_FILE. This is fairly an empty database and does not have any rows in at least the tables I am working on. First I inserted a row with English characters in the columns.
    I used utl_file.fopen_nchar to open and used utl_file.put_line_nchar to write it to the file on the Linux box. I open the file and I still see English characters (say "02CANMLKR001".
    Now, I updated the row with some columns having Chinese characters and ran the same script. It wrote the file. Now when I "vi" the file, I see "02CANè¹æ001" (some Unicode symbols in place of the Chinese characters and the regular English.
    When I FTP the file to windows and open it using notepad/notepad++ it still shows the Chinese characters. Using textpad, it shows ? in place of Chinese characters and the file properties say that the file is of type UNIX/UTF-8.
    My question : "Is my code working and writing the file in unicode? If not what are the required changes?" -- I know the question is little vague, but any questions/suggestions towards answering my question would really help.
    sample code:
    {pre}
    DECLARE
       l_file_handle   UTL_FILE.file_type;
       l_file_name     VARCHAR2 (50) := 'test.dat';
       l_rec           VARCHAR2 (250);
    BEGIN
       l_file_handle := UTL_FILE.fopen_nchar ('OUTPUT_DIR', l_file_name, 'W');
       SELECT col1 || col2 || col3 INTO l_rec FROM table_name;
       UTL_FILE.put_line_nchar (l_file_handle, l_rec);
       UTL_FILE.fclose (l_file_handle);
    END;
    {/pre}

    Regardless of what you think of my reply I'm trying to help you.
    I think you need to reread my reply because I can't find ANY relation at all between what I said and what you responded with.
    I wish things are the way you mentioned and followed text books.
    Nothing in my reply is related to 'text books' or some 'academic' approach to development. Strictly based on real-world experience of 25+ years.
    Unfortunately lot of real world projects kick off without complete information.
    No disagreement here - but totally irrevelant to anything I said.
    Till we get the complete information, it's better to work on the idea rather than wasting project hours. I don't think it can work that way. All we do is to lay a ground preparation, toy around multiple options for the actual coding even when we do not have the exact requirements.
    No disagreement here - but totally irrevelant to anything I said.
    And I think it's a good practice rather than waiting for complete information and pushing others.
    You can't just wait. But you also can't just go ahead on your own. You have to IMMEDIATELY 'push others' as soon as you discover any issues affecting your team's (or your) ability to meet the requirements. As I said above:
    Your problems are likely:
    1. lack of adequate requirements as to what the vendor really requires in terms of format and content
    2. lack of appropriate sample data - either you don't have the skill set to create it yourself or you haven't gotten any from someone else.
    3. lack of knowledge of the character sets involved to be able to create/conduct the proper tests
    If you discover something missing with the requirements (what character sets need to be used, what file format to use, whether BOMs are required in the file, etc) you simply MUST bring that to your manager's attention as soon as you suspect it might be an issue.
    It is your manager's job, not yours, to make sure you have the tools needed to do the job. One of those tools is the proper requirements. If there is ANYTHING wrong, or if you even THINK something is wrong with those requirements it is YOUR responsibility to notify your manager ASAP.
    Send them an email, leave a yellow-sticky on their desk but notify them. Nothing in what I just said says, or implies, that you should then just sit back and WAIT until that issue is resolved.
    If you know you will need sample data you MUST make sure the project plan includes SOME means to obtain sample data witihin the timeline needed by your project. As I repeated above if you don't have the skill set to create it yourself someone else will need to do it.
    I did not work with multiple language characters and manipulating them.
    Does your manager know that? If the project requires 'work with multiple language characters and manipulating them' someone on the project needs to have experience doing that. If your manager knows you don't have that experience but wants you to proceed anyway and/or won't provide any other resource that does have that experience that is ok. But that is the manager's responsibility and that needs to be documented. At a minimum you need to advise your manager (I prefer to do it with an email) along the following lines:
    Hey - manager person - As you know I have little or no experience to 'work with multiple language characters and manipulating them' and those skills are needed to properly implement and test that the requirements are met. Please let me know if such a resource can be made available.
    And I'm serious about that. Sometimes you have to make you manager do their job. That means you ALWAYS need to keep them advised of ANY issue that might affect the project. Once your manager is made aware of an issue it is then THEIR responsibility to deal with it. They may choose to ignore it, pretend they never heard about it or actually deal with it. But you will always be able to show that you notified them about it.
    Now, I updated the row with some columns having Chinese characters and ran the same script.
    Great - as long as you actually know Chinese that is; and how to work with Chinese characters in the context of a database character set, querying, creating files, etc.
    If you don't know Chinese or haven't actually worked with Chinese characters in that context then the project still needs a resource that does know it.
    You can't just try to bluff your way through something like character sets and code conversions. You either know what a BOM (byte order mark) is or you don't. You have either learned when BOMs are needed or you haven't.
    That said, we are in process of getting the information and sample data that we require.
    Good!
    Now make sure you have notified your manager of any 'holes' in the requirements and keep them up to date with any other issues that arise.
    NONE of the above suggests, or implies, that you should just sit back and wait until that is done. But any advice offered on the forums about specifics of your issue (such as whether you need to even worry about BOMs) is premature until the vendor or the requirements actually document the precise character set and file format needed.

  • HUGE iTunes AND iPod ERRORS! From "missing files" to the "! Folder"...

    My video iPod (30GB) was bought only about a month ago. It was working fine until a few days ago, when the Music Store wouldn't work. I tried to update it, but it stayed the same. I also saw a message asking to update my iPod software (forgot version #, but it's the newest one), so I opted to update it. I don't know if what happened next is a result of this, or if it just happened, but here's what happened:
    I found my iPod off and when I turned it on, it shows the ! Folder and turns off. If I put it in disk mode, it is black and white and in smaller text (looks similar to the Mini rather than the Video). I couldn't get to anything else after turning it on besides disk mode and the folder. It makes that noise recognizing it, but it's not in My Computer either.
    I tried updating iTunes, but I get a message (this is after trying to restore the system back to before I updated) "iTunes cannot run because some of its required files are missing. Please reinstall iTunes." Of course I do about 5 times, but it does not work and I get the same message. Then I try to back up by using the CD given in the box to install it from there, but it says that there is already another version and I'd have to uninstall by the Control Panel. When I try, I press Change/Remove, but it only loads halfway and closes without doing anything. Therefore I can't get rid of my current iTunes. I see if I can update my iPod, but it says that there is an iPod Service error. It seems like Apple is out to get me or something. Please help, this was a "partial" gift (I paid half) that was pretty pricey for me also, since I am only 14. Any help would definitely be appreciated, and thank you all for your time.
      Windows XP  

    YES it WORKS!!! After almost a whole week!
    The help wasn't really on this site (mainly), but I'll tell how I got the life back in my iPod. Thanks for the reply though Hackstar18.
    I used a DIFFERENT COMPUTER though (we have two) for this since the first one had a corrupt iTunes. I went to My Computer to see if my iPod was listed under there. At first, I didn't see one, so I disconnected it, and noticed that something called "Removable Disk (G:)" (or something along those lines) was removed from the list. Then I reconnected my iPod and it came back, so I knew the (G:) disk was it. I clicked on it, and it said it wasn't formatted correctly, so I decided to format it. It took about an HOUR to do this, but it finally formatted it. I then tried to update/restore it with my 2005 updater (I uninstalled 2006 one). It said "iPod manager internal error" which is different than the "iPod Sevice error" I was getting. I thought I was getting somewhere and that I was onto something, so I went on iTunes (it works on this computer). It showed me the popup where it asks the name and to register, and I was RELIEVED. I installed the 1.1 version and tried it, and after having to close the iTunes window, it recognized it and gave me the option to restore. Of course, while being shocked, I did, and after the short wait, I noticed my screen was back to color, it was responding, and it was back to normal! The update removed some of the things like the backlight option people were talking about and I noticed the options on the main menu were less, but it was back. I'm glad I DIDN'T request to get it serviced/repaired and send it in, because I was so close to doing so. Now, I just gotta transfer my old songs from my defective iTunes on the other computer to this computer.

  • Need script can switch Offfice 365 plan E1 to E3 and enable litigation hold from CSV file

    Dear all,
    Currently, i need a script can switch Office 365 plan E1 to E3 and enbale litigation hold from the list email in CSV file. I don't know why Microsoft is not enable litigation hold for E3 user by default? Please help me.
    Many thanks.

    You should try like this
    $mbxs = Import-csv C:\Temp\Mailbox.csv
    foreach($mbx in $mbxs.UPN)
    Set-MsolUserLicense -UserPrincipalName $mbx -RemoveLicenses '<E1>' -AddLicenses '<E3>' -Verbose
    Set-Mailbox -Identity $mbx -LitigationHoldEnabled $true -WhatIf
    Please test with one test account and explore office 365 community as well.
    Regards Chen V [MCTS SharePoint 2010]

Maybe you are looking for

  • My mid 2010 iMac is running very slow.

    I have done all the usual things such as checking the disk is clean, closing unnecessary programmes etc.  I would rather not replace what seems to be a good machine.  Any ideas?  Below is an etrecheck report on the machine: Problem description: I hav

  • Error - Addition of Batch wise GRPO thru DI API

    Dear All, I am facing the error "Can not release the item with selection of Batch/Serial" while adding the GRPO thru DI API. When I add only 1 line in GRPO with Batch Details thru coding,GRPO added successfully. But when there are more than 1 line th

  • SD-basic doubt

    hi friends, 1)Based on which document we will be creating the invoice order in case of cross company stock transfer . 2)As i have not worked on cross company stock transfer order ,can any one tell me how we will be creating cross company stock transf

  • My illustrator CS won't open

    I have the first version, CS and am working on an older MacBook; it was working up until yesterday, and I have a big project to finish.

  • Having problems with ios6 for iPad

    Just recently installed ios6 to my iPad witht he following problems: Cannoct connect to itunes store Cannot download any apps The new Maps app is unable to locate my current location Some Facebook features are disabled. "Tap retry" doesn't respond So