Page 1 of 1

Create New trailer with count as per the detail record type

Posted: Sun Sep 04, 2011 8:51 pm
by jaya1512
Hi ,

I have a requirement in which i have two types of detail record, i need to create a trailer with with the counts of each detail record and also the total count.

Original file :

1XXXXX22434
2XXXA dsfdaf gfgdfgh
2XXXA dsfdaf gfgdfgh
2XXXA dsfdaf gfgdfgh
2XXXA dsfdaf gfgdfgh
3XXXA dsfdaf gfgdfgh
3XXXA dsfdaf gfgdfgh
3XXXA dsfdaf gfgdfgh

Expected Output :

1XXXXX22434 --> Header
2XXXA dsfdaf gfgdfgh -->Detail record with indicator 2
2XXXA dsfdaf gfgdfgh
2XXXA dsfdaf gfgdfgh
2XXXA dsfdaf gfgdfgh
3XXXA dsfdaf gfgdfgh -->Detail record with indicator 3
3XXXA dsfdaf gfgdfgh
3XXXA dsfdaf gfgdfgh
4000000004000000003000000007 --- > trailer should start with 4


The trailer should have the count of each type ( type 2 and type 3)detail record separately and also the total count of the detail record (type2 +type 3).

Header record will start with 1,the first set of detail records with 2 , next set of detail records will start with 3 and the trailer will be 4.

I was able to bring the total count in the trailer.. but i am not sure about bringing the separate count as per the detail record.Could someone please help me with this.

Thanks!

Posted: Wed Sep 07, 2011 12:51 am
by Frank Yaeger
You can use a DFSORT job like the following. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code: Select all

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
1XXXXX22434
2XXXA dsfdaf gfgdfgh
2XXXA dsfdaf gfgdfgh
2XXXA dsfdaf gfgdfgh
2XXXA dsfdaf gfgdfgh
3XXXA dsfdaf gfgdfgh
3XXXA dsfdaf gfgdfgh
3XXXA dsfdaf gfgdfgh
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'00')),
        IFTHEN=(WHEN=(1,1,CH,EQ,C'2'),OVERLAY=(81:C'1')),
        IFTHEN=(WHEN=(1,1,CH,EQ,C'3'),OVERLAY=(82:C'1'))
  OUTFIL REMOVECC,
    BUILD=(1,80),
    TRAILER1=('4',TOT=(81,1,ZD,TO=ZD,LENGTH=9),
                  TOT=(82,1,ZD,TO=ZD,LENGTH=9),
                  COUNT-1=(TO=ZD,LENGTH=9))
/*

Write trailer having count of each gruop based on record key

Posted: Wed Feb 11, 2015 5:57 pm
by sucho
Hello,

I have the following requirement -

Input file has the structure -
1 header(first 2 characters are '10'),
some detail records(first 2 characters act as KEY - '21', '22', '23', etc),
1 trailer(first 2 characters '90') - total count,count of key 1 records, count of key 2 records, count of key 3 records and so on.

I have to filter out all records that have 'JD' at a particular position(position depends on record key) and write the records to a new file and also update the counts in the trailer.

Input file
10APPLIDDMMYYYY
21ABC J
21ABC JD
21ABC J
22ABC J
22ABC J
22ABC JD
22ABC JD
23ABC JD
23ABC JD
23ABC J
90000000010000000003000000004000000003

Output file
10APPLIDDMMYYYY
21ABC JD
22ABC JD
22ABC JD
23ABC JD
23ABC JD
90000000005000000001000000002000000002

I have written the following sort card that filters out the desired records. But was unable to come up with a solution for the trailer -

OPTION COPY
INCLUDE COND=((1,2,CH,EQ,C'21',AND,9,2,CH,EQ,C'JD'),OR,
(1,2,CH,EQ,C'22',AND,7,2,CH,EQ,C'JD'),OR,
(1,2,CH,EQ,C'23',AND,12,2,CH,EQ,C'JD'),OR,
1,2,CH,EQ,C'10',OR,
1,2,CH,EQ,C'90')

Could you please suggest how I may modify the sort card for getting the new trailer with correct counts. I would prefer just DFSORT without ICETOOL.

Thanks,
Sucho

Posted: Wed Feb 11, 2015 10:05 pm
by William Collins
You should ask as a new question, not continue an old topic. Have you looked at TRLUPD?

Topic deleted by Admin

Posted: Mon Jan 25, 2016 9:34 pm
by academyindia4
<< Content deleted By Admin >>