View previous topic :: View next topic
|
Author |
Message |
arunpvarier
New User
Joined: 07 Nov 2006 Posts: 16 Location: banglore
|
|
|
|
ID.
Environment division.
IO Section.
File-control Para.
select infile assign to dd1.
organisation is sequential.
Data Division.
File section.
Fd infile
01 inrec pic x(20).
PRocedure division.
Move 'first record' to inrec.
Open input infile.
In this case ie moving value to a file variable before the file opens what will happen?
1.whether the data will be deleted at the first read?
2. error? |
|
Back to top |
|
|
somnath.barik
New User
Joined: 16 Aug 2007 Posts: 8 Location: mumbai
|
|
|
|
hi.........i am not sure........it might give file not open eror. |
|
Back to top |
|
|
radha reddy
New User
Joined: 15 May 2008 Posts: 9 Location: hyderabad
|
|
|
|
Hi Arun,
It gives file open error.
Thanks,
Radha |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
why do you people post when you have no idea? this is not a chat room.
you will most probably receive a Soc4 on the MOVE. if not, there will be no error, and the open will be ok. the data (if you managed to get a move without a soc4) will be over written after the first read. |
|
Back to top |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
As dick stated it will give SOC4 on the move .... there wont be any file open error ... |
|
Back to top |
|
|
mytags
New User
Joined: 28 Apr 2008 Posts: 63 Location: US
|
|
|
|
Hi Arun,
Its not possible to send any data to before opening a file.
Thanks,
Tags, |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
mytags,
Quote: |
Its not possible to send any data to before opening a file
|
actually the problems lies in the fact that the record area defined in the FD area floats on a Register that is populated by the OPEN OUTPUT or READ instruction. As the Register will most probably contain low-values before the population by the OPEN or READ (re-populated by WRITE and READ), the address of the receiving field (the FD record area) will be x'00000000' which is a no-no - causing the soc4. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
best practices suggest always use the WORK-AREA option, thus pointing to WORKING-STORAGE. Populating the Working-Storage record-work-area is not dependent on the state of the FD entry.
Mytags, what you said in itself is true. Can't WRITE before you OPEN. |
|
Back to top |
|
|
|