multiple record types in a file



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

multiple record types in a file

Postby veronikaluv » Sat Feb 16, 2008 10:37 pm

I have a file with 2 types of records both starting with 01 and 02 respectivelly.
There can be one record of the following structure> 01 FILI CONT (01 x(2) FILI X(5) CONT X(12))
with n different records with the structure> 02 CAUS IMPO (02 x(2) CAUS X (30) IMPO S9(13)V9(2) COMP-3)

How I need to define the file in FD and how to operate with it.
Thank in advance!
veronikaluv
 
Posts: 7
Joined: Sat Feb 16, 2008 10:26 pm
Has thanked: 0 time
Been thanked: 0 time

Re: multiple record types in a file

 

Re: multiple record types in a file

Postby dick scherrer » Sun Feb 17, 2008 7:06 am

Hello veronikaluv and welcome to the forum,

Code the FD as though it had only one record type. This would be the FD, a level-01 for the first recored type, and the elementary items.

Then, add a seond level-01 for the second record type and add those elementary items.

If the procedure division, read the file and if the record is an 01 process the 01 fields and if the record is an 02, process those fields.

When you have questions or something does not compile or does not work, post your question and/or any diagnostic info from the compiler or some run-time error.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: multiple record types in a file

Postby veronikaluv » Fri Feb 22, 2008 1:47 pm

Thanks for the reply it was very usefull.
veronikaluv
 
Posts: 7
Joined: Sat Feb 16, 2008 10:26 pm
Has thanked: 0 time
Been thanked: 0 time

Re: multiple record types in a file

Postby dick scherrer » Fri Feb 22, 2008 8:47 pm

You're welcome - good luck :)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post