Page 1 of 1

Modifying only Trailer record count

PostPosted: Thu Jul 05, 2012 8:14 pm
by ragsara
Hi All,

Really sorry i went through numerous posts but cannot fit in my requirement.

My requirement :
Input file doesn't come with correct number of detail records which is present as Trailer record count. Need to calculate the number of details records and replace it as Trailer record count.

Input file :

AB 001 2012-07-07 ------------ Header
AB 100 2012-07-07 ------------ Detail record
AB 200 2012-07-07 ------------ Detail record
AB 002 2012-07-07 0000000005 ---------- Trailer record

Output file :

AB 001 2012-07-07 ------------ Header
AB 100 2012-07-07 ------------ Detail record
AB 200 2012-07-07 ------------ Detail record
AB 002 2012-07-07 0000000002 ---------- Trailer record

Thanks in advance

Re: Modifying only Trailer record count

PostPosted: Thu Jul 05, 2012 9:33 pm
by skolusu
ragasara,

Assuming that your trailer record can be identified with 'AB 002' in the first 6 bytes the following DFSORT JCL will give you the desired results
//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                         
AB 001 2012-07-07 ------------ HEADER                   
AB 100 2012-07-07 ------------ DETAIL RECORD             
AB 200 2012-07-07 ------------ DETAIL RECORD             
AB 002 2012-07-07 0000000005 ---------- TRAILER RECORD   
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                       
  OUTFIL IFTRAIL=(HD=YES,TRLID=(1,6,CH,EQ,C'AB 002'),   
  TRLUPD=(19:COUNT=(M11,LENGTH=10)))                     
//*                                                     


For complete details on the new functions for DFSORT and DFSORT's ICETOOL available with the Oct, 2010 PTF, see:

http://www.ibm.com/support/docview.wss? ... g3T7000242

Re: Modifying only Trailer record count

PostPosted: Thu Jul 05, 2012 9:56 pm
by ragsara
Hi skolusu,

I tried your solution but its shows me the below error

PARAMETER 'IFTRAIL' IS UNIDENTIFIED

I checked my DFSORT function level and its ICE201I H which is up to date i guess.

Please find my below code :

//STEP01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=F6435T.UHD.SELECT.A2120504.FB,DISP=SHR
//SORTOUT DD DSN=F6435T.UHD.SELECT.D2120503.FB,
// DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(150,150),RLSE),
// UNIT=SYSDA,DCB=(RECFM=FB,LRECL=2000,BLKSIZE=0)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL IFTRAIL=(HD=YES,TRLID=(63,3,EQ,C'001'),
TRLUPD=(236:COUNT=(M11,LENGTH=10)))
/*

Re: Modifying only Trailer record count

PostPosted: Thu Jul 05, 2012 10:12 pm
by NicC
The real solution is to get the trailer created properly - not do this bodge (fix-up). One day the difference may be due to a real processing failure which you are now going to hide.

Re: Modifying only Trailer record count

PostPosted: Thu Jul 05, 2012 10:17 pm
by skolusu
ragsara wrote:Hi skolusu,

I tried your solution but its shows me the below error

PARAMETER 'IFTRAIL' IS UNIDENTIFIED

I checked my DFSORT function level and its ICE201I H which is up to date i guess.


You need to show me the complete sysout. Did you run the JCL ? or did you just did a JCL CHECK? If so ignore the JCL CHECKER messages as they don't keep up with the latest features of DFSORT.

Re: Modifying only Trailer record count

PostPosted: Thu Jul 05, 2012 10:46 pm
by ragsara
Hi skolusu,

You are correct, i just ignored it and all went fine.

One small clarrificiation, How does it calculates the number of detail records. Because total record count was 4 including Header and Trailer. But it perfectly says detail record count as 2. I mean nowhere i can see this being used "COUNT-2" ... I may be silly but please forgive :)

Re: Modifying only Trailer record count

PostPosted: Thu Jul 05, 2012 11:01 pm
by skolusu
ragsara wrote:Hi skolusu,

You are correct, i just ignored it and all went fine.

One small clarrificiation, How does it calculates the number of detail records. Because total record count was 4 including Header and Trailer. But it perfectly says detail record count as 2. I mean nowhere i can see this being used "COUNT-2" ... I may be silly but please forgive :)


Did you read the PDF documentation I posted in my original post? You need to understand why HD=yes is coded and the documentation explains everything in detail.

Re: Modifying only Trailer record count

PostPosted: Thu Jul 05, 2012 11:45 pm
by ragsara
Thanks skolusu for your kind help