Need help with sort/icetool - Update the header Record

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

Moderators: Frank Yaeger, Moderator Group

Post Reply
anshathilakan
Member
Posts: 2
Joined: Mon Dec 26, 2011 2:15 pm

Need help with sort/icetool - Update the header Record

Post by anshathilakan » Mon Dec 26, 2011 9:36 am

I have a file with record size 350.The file contains detail records and a Header record.There are some duplicates and I need to eliminate them.Also since the header record is having the record count,I need to update that count too after the duplicate elimination.
The file is used in a daily job and the sequence number in the file will get incremented by by +1 everyday.

Record sample given below.



D003677100420DO014299801142014299801001CPCO 1DEC
D003677100420DO014299801153014299801001CPCO 1CEC
D003677100420DO014299801153014299801001CPCO 1CEC
D003677100420DO015591871053015591871053NMSOM 1AEC
H0036771004200000004


In this header ,003677100420 is the sequence number which will get incremented every day and it is a part of every detail record too.The second and third records are duplicates.So once after I eliminate the duplicates,I need the header to be rewritten as
H0036771004200000003 as the count is 3 after duplicate removal.
(The last 7 bytes is for count).

We are having DFSORT V1R5.
Any help would be highly appreciated. :)
Thank You,
Ansha

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue Dec 27, 2011 1:29 am

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code: Select all

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file (FB/350)
//OUT DD DSN=...  output file (FB/350)
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,350,CH) FIRST USING(CTL1)
/*
//CTL1CNTL DD *
  OMIT COND=(1,1,CH,EQ,C'H')
  OUTFIL FNAMES=OUT,REMOVECC,
    TRAILER1=(C'H',2,12,COUNT=(M11,LENGTH=7))
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

anshathilakan
Member
Posts: 2
Joined: Mon Dec 26, 2011 2:15 pm

Post by anshathilakan » Tue Dec 27, 2011 6:09 am

Thank you so much Frank :)

Wish you a happy New Year !!!
Thank You,
Ansha

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