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
 
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 How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
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

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