IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

moving a value to a file record variable before opning File


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
arunpvarier

New User


Joined: 07 Nov 2006
Posts: 16
Location: banglore

PostPosted: Wed Jul 16, 2008 11:10 am
Reply with quote

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
View user's profile Send private message
somnath.barik

New User


Joined: 16 Aug 2007
Posts: 8
Location: mumbai

PostPosted: Wed Jul 16, 2008 1:17 pm
Reply with quote

hi.........i am not sure........it might give file not open eror.
Back to top
View user's profile Send private message
radha reddy

New User


Joined: 15 May 2008
Posts: 9
Location: hyderabad

PostPosted: Wed Jul 16, 2008 1:29 pm
Reply with quote

Hi Arun,

It gives file open error.

Thanks,
Radha
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 16, 2008 1:55 pm
Reply with quote

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
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Wed Jul 16, 2008 2:12 pm
Reply with quote

As dick stated it will give SOC4 on the move .... there wont be any file open error ...
Back to top
View user's profile Send private message
mytags

New User


Joined: 28 Apr 2008
Posts: 63
Location: US

PostPosted: Wed Jul 16, 2008 2:27 pm
Reply with quote

Hi Arun,
Its not possible to send any data to before opening a file.
Thanks,
Tags,
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 16, 2008 2:38 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 16, 2008 2:41 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top