merging multiple record of same record length into one



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

merging multiple record of same record length into one

Postby ranisupriya » Fri Sep 18, 2009 8:32 pm

Hi ,

I have various records eg.

Rec1 f1 f2 f4 f6
Rec2 f3 f5
Rec3 f7

where f1..f7 are unique fields. We know the length of each field. Whats the easiest way to merge all the records into one Rec as

REC f1 f2 f3 f4 f5 f6 f7
ranisupriya
 
Posts: 2
Joined: Fri Sep 18, 2009 8:24 pm
Has thanked: 0 time
Been thanked: 0 time

Re: merging multiple record of same record length into one

Postby dick scherrer » Sat Sep 19, 2009 1:38 am

Hello and welcome to the forum,

Will that grouping of data always be consistent (3 records per set with the same fields in each record)?

One way to do what you want is to read each of the 3 records into working-storage areas and after the 3rd record is read, STRING together the fields into the output area and write.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post