Count the no. of records and update the trailer record



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Count the no. of records and update the trailer record

Postby Pratap metta » Thu Dec 13, 2012 3:18 pm

Hi All,
I have a file which contains header records , detail record and trailer record.15th position in the file contains 'A' for header record , 'L' for trailer record and 'M','V' or 'P' for detail records.
Now my requirement is to count the no. of records based up on 'M' ,'V' and 'P'( which is on 15th position) and update these counts on the trailer record.
My trailer record looks some thing like this

OT08LV12122012L8 00003400000000003200000000000000000000000000000200000

total four counts will be there in the triler record the first one from position 19 to 24 is the count of total no. of records i.e (count of 'M' + 'V' + 'P' records) and from position 31 to 36 is the count of 'V' records and from position 37 to 42 is the count of 'P' records and the last one from positon 61 to 66 is the count of 'M' records.

Please help me how can we acheive this using DFSORT or ICETOOL.
Thanks in advance !!!
Pratap metta
 
Posts: 3
Joined: Thu Dec 13, 2012 2:56 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Count the no. of records and update the trailer record

Postby dick scherrer » Thu Dec 13, 2012 8:34 pm

Hello and welcome to the forum,

What really needs to be done is to correct the process that creates the file to write the counts when the file is created. It is a complete waste of resources to proceed as you have been told to do . . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Count the no. of records and update the trailer record

Postby NicC » Thu Dec 13, 2012 9:32 pm

How does the 15th position of the FILE contain all those values at one time? Did you perhaps mean each record has a record type indicator in column 15?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Count the no. of records and update the trailer record

Postby dick scherrer » Thu Dec 13, 2012 9:40 pm

15th position in the file contains 'A' for header record , 'L' for trailer record and 'M','V' or 'P' for detail records.

Ahhh - i believe that is what was posted . . . :?

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Count the no. of records and update the trailer record

Postby skolusu » Thu Dec 13, 2012 10:07 pm

What is the LRECL and RECFM of the input and output dataset?

Please post the complete sysout of the following job which helps us to determine the level of DFSORT you have.
//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                           
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *                                           
  SORT FIELDS=COPY                                       
 //*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Count the no. of records and update the trailer record

Postby Pratap metta » Tue Dec 18, 2012 2:42 pm

Hi Skolusu/Nicc,
yes each record has different indicator in coloumn 15 ('A' for header record , 'L' for trailer record and 'M','V' or 'P' for detail records).
Now if I add detail records to the file then the corresponding counts in the trailer record should be updated.
Please find the below complete sysout...
H RECORD TYPE IS F - DATA STARTS IN POSITION 1                         
0 C5-K76982 C6-K90026 C7-K58148 C8-K67572 E9-K60824 C9-BASE   E5-K76585
0 BLOCKSET     COPY  TECHNIQUE SELECTED                                 
0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 10:06 ON TUE DE
    SORT FIELDS=COPY                                                   
H RECORD TYPE IS F - DATA STARTS IN POSITION 1                         
0 C5-K76982 C6-K90026 C7-K58148 C8-K67572 E9-K60824 C9-BASE   E5-K76585
0 ICEAM1 INVOCATION ENVIRONMENT IN EFFECT - ICEAM1 ENVIRONMENT SELECTED
1 PARMLIB OPTIONS WERE MERGED WITH INSTALLATION MODULE DEFAULTS         
0 BA5009ST.STEP0100.        , INPUT LRECL = 80, BLKSIZE = 80, TYPE = FB
0 MAIN STORAGE = (MAX,6291456,6278238)                                 
0 MAIN STORAGE ABOVE 16MB = (6217182,6200798)                           
0 OPTIONS: OVFLO=RC0 ,PAD=RC0 ,TRUNC=RC0 ,SPANINC=RC16,VLSCMP=N,SZERO=Y,
0 OPTIONS: SIZE=6291456,MAXLIM=6291456,MINLIM=450560,EQUALS=N,LIST=Y,ERE
0 OPTIONS: VIO=N,RESDNT=ALL ,SMF=FULL ,WRKSEC=Y,OUTSEC=Y,VERIFY=N,CHALT=
0 OPTIONS: RESALL=16384,RESINV=0,SVC=109 ,CHECK=N,WRKREL=Y,OUTREL=Y,CKPT
0 OPTIONS: TMAXLIM=6291456,ARESALL=16384,ARESINV=0,OVERRGN=65536,CINV=Y,
0 OPTIONS: VLSHRT=N,ZDPRINT=Y,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE    ,EXITC
0 OPTIONS: HIPRMAX=0      ,DSPSIZE=2500,ODMAXBF=0,SOLRF=Y,VLLONG=N,VSAMI
0 OPTIONS: NULLOUT=RC0                                                 
0 OPTIONS: DYNAPCT=10 ,MOWRK=Y                                         
ICE084I 0 BSAM ACCESS METHOD USED FOR SORTOUT         
ICE084I 0 BSAM ACCESS METHOD USED FOR SORTIN           
ICE751I 1 EF-BASE   F0-K66717 E8-K79103               
ICE090I 0 OUTPUT LRECL = 80, BLKSIZE = 80, TYPE = FB   
ICE055I 0 INSERT 0, DELETE 0                           
ICE054I 0 RECORDS - IN: 0, OUT: 0                     
ICE173I 0 NO RECORDS FOR THE SORTOUT DATA SET - RC=0   
ICE052I 0 END OF DFSORT


Code'd
Pratap metta
 
Posts: 3
Joined: Thu Dec 13, 2012 2:56 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Count the no. of records and update the trailer record

Postby BillyBoyo » Tue Dec 18, 2012 3:01 pm

Next time please ensure that the message references are included on all the pasted lines.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Count the no. of records and update the trailer record

Postby skolusu » Wed Dec 19, 2012 1:15 am

Pratap metta,

You did NOT answer my question about LRECL and RECFM. Assuming that your LRECL=80 and RECFM=FB, use the following DFSORT JCL which will give you the desired results.

//STEP0100 EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                         
----+----1----+----2----+----3----+----4----+----5----+-
              A                                         
              MA01                                     
              PA02                                     
              MA03                                     
              MA04                                     
              VA01                                     
              VA02                                     
              L                                         
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                     
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'1000')),       
  IFTHEN=(WHEN=(15,1,CH,EQ,C'M'),OVERLAY=(82:C'1')),   
  IFTHEN=(WHEN=(15,1,CH,EQ,C'P'),OVERLAY=(83:C'1')),   
  IFTHEN=(WHEN=(15,1,CH,EQ,C'V'),OVERLAY=(84:C'1'))     
                                                       
  OUTFIL BUILD=(1,80),                                 
  IFTRAIL=(HD=YES,TRLID=(15,1,CH,EQ,C'L'),             
  TRLUPD=(19:TOT=(81,1,ZD,M11,LENGTH=6),               
          31:TOT=(84,1,ZD,M11,LENGTH=6),               
          37:TOT=(83,1,ZD,M11,LENGTH=6),               
          61:TOT=(82,1,ZD,M11,LENGTH=6)))               
//*                                                     
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Count the no. of records and update the trailer record

Postby Pratap metta » Wed Dec 19, 2012 1:04 pm

Hi skolusu,

It worked exactly as it should have. Thanks a ton for your help.

Pratap Metta
Pratap metta
 
Posts: 3
Joined: Thu Dec 13, 2012 2:56 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post