Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts Moving UDB database to Db2 on z/OS Keith Hooley DB2 4 Wed Sep 27, 2017 12:38 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us