Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

moving a value to a file record variable before opning File

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: moving a value to a file record variable before opning File
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    Post subject: hi
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    Post subject:
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: 6968
Location: porcelain throne

PostPosted: Wed Jul 16, 2008 1:55 pm    Post subject:
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    Post subject:
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    Post subject: Reply to: moving a value to a file record variable before op
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: 6968
Location: porcelain throne

PostPosted: Wed Jul 16, 2008 2:38 pm    Post subject:
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: 6968
Location: porcelain throne

PostPosted: Wed Jul 16, 2008 2:41 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 5 Wed Jul 26, 2017 7:35 pm
No new posts Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us