Can we get data after writing in a file.



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Can we get data after writing in a file.

Postby Ramkumarsony » Tue Jul 29, 2008 12:24 pm

Usually after writing some data in a file the source(data area defined in the Fild Division FD) will not have the values. if i want to use the datas without using the file(where i wrote the record) what i have to do. I am asking whether there is any way to use that data without accessing the output file. :)
Ramkumarsony
 
Posts: 11
Joined: Wed Jun 25, 2008 10:12 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Can we get data after writing in a file.

Postby sachinji84 » Tue Jul 29, 2008 4:42 pm

Hi,
are you asking ,after writing into file. you want to use record area ?
sachinji84
 
Posts: 1
Joined: Tue Jul 29, 2008 4:27 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Can we get data after writing in a file.

Postby dick scherrer » Wed Jul 30, 2008 12:33 am

Hello,

If you want only data from the last record written and you write from working storage, the data for that record will still be in working storage.

If you want data from some previous record or several records, you will not have them available in the program any more.

If i've misunderstood, please clarify.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Can we get data after writing in a file.

Postby Ramkumarsony » Thu Jul 31, 2008 12:14 pm

Hi sachinji84,
I jus asked cani use the written data without accessing the file where i write. please refer the following code.

WRITE INDATA.
DISPLAY INDATA.

Where INDATA is the data area of a file that i have described it in the file division. When i code like this and during the result in sysout i got only low values(Hex '00') for the "DISPLAY INDATA" instead of written data.
Ramkumarsony
 
Posts: 11
Joined: Wed Jun 25, 2008 10:12 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Can we get data after writing in a file.

Postby Ramkumarsony » Thu Jul 31, 2008 12:25 pm

Thanks D.sch... :) so we cant get the some previously written records except the last one... thanks alot.
Ramkumarsony
 
Posts: 11
Joined: Wed Jun 25, 2008 10:12 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Can we get data after writing in a file.

Postby dick scherrer » Thu Jul 31, 2008 10:29 pm

Hello,

You're welcome, but i believe there is still a bit of misunderstanding.

so we cant get the some previously written records except the last one
You can only get the last one if you used "WRITE FROM" some WS variable. When you use only WRITE, that data is no longer available to the program because the pointer to the i/o buffer has been moved. If you refer to the record-area after the WRITE, the result is unpredictable.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Can we get data after writing in a file.

Postby Ramkumarsony » Fri Aug 01, 2008 5:41 pm

Ya dick.... Now I understood it correctly.. thank you.... :)
Ramkumarsony
 
Posts: 11
Joined: Wed Jun 25, 2008 10:12 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Can we get data after writing in a file.

Postby dick scherrer » Fri Aug 01, 2008 6:24 pm

You're welcome :)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post