Page 1 of 1

Need help with sort/icetool - Update the header Record

Posted: Mon Dec 26, 2011 9:36 am
by anshathilakan
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. :)

Posted: Tue Dec 27, 2011 1:29 am
by Frank Yaeger
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))
/*

Posted: Tue Dec 27, 2011 6:09 am
by anshathilakan
Thank you so much Frank :)

Wish you a happy New Year !!!