Count of records in the trailer sentence to be changed

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

Moderators: Frank Yaeger, Moderator Group

Post Reply
sathesh
Member
Posts: 2
Joined: Thu Sep 25, 2008 5:27 pm

Count of records in the trailer sentence to be changed

Post by sathesh » Thu Sep 25, 2008 8:02 pm

Can anyone help on the below requirement be achieved in only one step using JCL....

SORTIN - File format

1003
1005
1000
1006
1002
1002
1005
92008092500007 ---> Trailer count is 7


SORTOUT - File format (Expected)

1000
1005
1005
92008092500003 --> Trailer count should be 3 as per the condition in JCL

The trailer should be not generated in the JCL, it should be used as it is and only the count should be changed as per the condition in JCL, since there are lots of information available in trailer which is generated by the program.


I used the following JCL, but it shows syntax error on OVERLAY..... that the COUNT function is not possible with OVERLAY

Code: Select all

//SORT1   EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DISP=SHR,DSN=XXXX.XXXX.XXXX
//SORTOUT  DD DSN=YYYY.YYYY.YYYY,
//            DISP=(OLD,CATLG,CATLG),
//            UNIT=DISK,
//            SPACE=(CYL,(2,1),RLSE),
//            DCB=*.SORTIN
//SYSIN    DD *
   SORT FIELDS=COPY
   INCLUDE COND=(((2,3,CH,EQ,C'005'),OR,(2,3,CH,EQ,C'000')),
   OR,(1,1,CH,NE,C'1'))
   INREC IFTHEN=(WHEN=(1,1,CH,NE,C'1'),
                OVERLAY=(10:COUNT-1=(ZD,LENGTH=5))

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

Post by Frank Yaeger » Thu Sep 25, 2008 8:28 pm

COUNT can only be used in TRAILERx.

Here's a DFSORT job that will do what you asked for. I assumed your input file has RECFM=FB and LRECL=80 but the job can be changed appropriately for other attributes.

Code: Select all

//SORT1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN DD *
  SORT FIELDS=COPY
  INCLUDE COND=(2,3,SS,EQ,C'005,000',OR,1,1,CH,NE,C'1')
  OUTREC IFOUTLEN=80,
    IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,5,ZD)),
    IFTHEN=(WHEN=(1,1,CH,NE,C'1'),
      OVERLAY=(10:81,5,ZD,SUB,+1,TO=ZD,LENGTH=5))
/*
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

sathesh
Member
Posts: 2
Joined: Thu Sep 25, 2008 5:27 pm

Post by sathesh » Fri Sep 26, 2008 1:24 pm

Hi Frank,

Thanks a lot for reverting back quickly,,,, the solution which you gave is working fine as per my requirement and solved the purpose in time,,,,,

Have a nice day..
Sathesh

academyindia4

Topic deleted by Admin

Post by academyindia4 » Mon Jan 25, 2016 10:36 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