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: 6966
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: 6966
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: 6966
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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