Create New trailer with count as per the detail record type

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

Moderators: Frank Yaeger, Moderator Group

Post Reply
jaya1512
Member
Posts: 1
Joined: Sun Sep 04, 2011 8:26 pm
Location: Chennai

Create New trailer with count as per the detail record type

Post by jaya1512 » Sun Sep 04, 2011 8:51 pm

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!
Last edited by jaya1512 on Mon Sep 05, 2011 6:44 pm, edited 1 time in total.

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

Post by Frank Yaeger » Wed Sep 07, 2011 12:51 am

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))
/*
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

sucho
Member
Posts: 1
Joined: Wed Feb 11, 2015 5:04 pm

Write trailer having count of each gruop based on record key

Post by sucho » Wed Feb 11, 2015 5:57 pm

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

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

Post by William Collins » Wed Feb 11, 2015 10:05 pm

You should ask as a new question, not continue an old topic. Have you looked at TRLUPD?

academyindia4

Topic deleted by Admin

Post by academyindia4 » Mon Jan 25, 2016 9:34 pm

<< Content deleted By Admin >>

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