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
 

 

Read File & Write Record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
suzeet

New User


Joined: 16 May 2005
Posts: 54

PostPosted: Mon Jul 25, 2005 5:24 pm    Post subject: Read File & Write Record
Reply with quote

Recently someone has asked me, Why we read a file and write a record in Cobol? Can anybody put some light on this topic
Back to top
View user's profile Send private message

priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Mon Jul 25, 2005 5:57 pm    Post subject: Re: Read File & Write Record
Reply with quote

Hi suzeet,

Quote:
Why we read a file and write a record in Cobol?


It is something like why we code IDENTIFICATION DIVISION first.

It is simply because of Data Processing thru programming.
You write a File in order to get an output and since you may need an input for that you need to READ a file...

Please make ur question more clear...If I dont answer ur question....

Regards,

Priyesh.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Tue Jul 26, 2005 6:46 am    Post subject:
Reply with quote

Hi Suzeet,

You write a record because variable length recs can be chosen, so you need a way to choose.

Reading a rec doesn't afford you that kind of choice. Usually the I/P recs are defined w/multiple 01 levels in the FD and each usually contains an id field. You just do a read of the file and then determine from the id what kind of rec you just read.
Back to top
View user's profile Send private message
Rameshs

New User


Joined: 15 Jun 2005
Posts: 53
Location: India, Chennai

PostPosted: Tue Jul 26, 2005 10:29 am    Post subject: Re: Read File & Write Record
Reply with quote

Hai,

icon_confused.gif Can you give me an example for multiple 01 levels in FD entry

i couldn't able to understand what you are telling
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Jul 27, 2005 5:47 am    Post subject:
Reply with quote

Hi Rameshs,

Just define the file as you usually do (the FD). Define the rec as you usually do (01... 05... etc.). Then just define another 01, 05, etc., then another and another if you want to.

Each 01 will describe a different type of rec. One of the fields in each rec would define the rec-type.

If the file is fixed format all the defs would be of equal lengths. If variable format the defs would be of UNequal lengths.

You would READ the file and, depending on the rec-type, process the rec just read. If you defined multi def O/P recs you would select the appropriate rec to WRITE.

HTH
Back to top
View user's profile Send private message
suzeet

New User


Joined: 16 May 2005
Posts: 54

PostPosted: Wed Jul 27, 2005 11:07 am    Post subject: Re: Read File & Write Record
Reply with quote

Priyesh,
I mean to say while reading we read a file not reading it record by record. While writing we write it record by record not write that file. I mean write <file-name>
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
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
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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