Merge two files data nd update trailer count

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
mandia
Member
Posts: 3
Joined: Tue Jan 15, 2013 7:27 am

Merge two files data nd update trailer count

Post by mandia » Thu Feb 26, 2015 4:55 pm

Hi ,

I have a requirement to combine records of two input files and write into one single file.In addition to this i need to update the trailer count.

The two input files AAA and BBB are of record length 799 and FB.
The output file is also of same format and length

AAA file will have 1-n records .It has only detail records indicated by record code (REC-CD) = 10 in first two positions

BBB file can have details records but will always have header record and trailer record indicated by record code(REC-CD) = 0 and 9 respectively in first position.


Example:

Lets say if i have 5 records in input file AAA .

AAA file :

10ACCOUNTNUM:123451
10ACCOUNTNUM:123452
10ACCOUNTNUM:123453
10ACCOUNTNUM:123454
10ACCOUNTNUM:123455

And lets say if i have 2 records in input file BBB with just one header and trailer record

BBB File:

020152602SYSCD
912000000

There is a count field in trailer record which occupies position 2-9 with length 8 .
I need to append the records of both files and also I need to add the number 12000000 in BBB file with the number of records present in AAA file
and update trailer count in output.
The data records and header record are copied as it is but the trailer record count needs to be updated.

So the output file CCC should have the following data

10ACCOUNTNUM:123451
10ACCOUNTNUM:123452
10ACCOUNTNUM:123453
10ACCOUNTNUM:123454
10ACCOUNTNUM:123455
020152602SYSCD
912000005

Could you please guide me on how to achieve this using SYNCSORT/ICETOOL ?

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Thu Feb 26, 2015 5:48 pm

Concatenate the two DSNs to the SORTIN DD in a COPY operation.

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others