Count number of records of several files



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

Count number of records of several files

Postby LACPTN » Sun Apr 27, 2014 3:35 pm

Hi all,

I want to count the number of records of several files and generate a file with the output. For example:
File 1:
A
B
File 2:
C
D
E
Output:
File1: 2
File2: 3

I'm doing this:
//SORT1 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=F1,DISP=SHR
//SORTOUT  DD DSN=FOUTPUT,
//            DISP=(,CATLG,DELETE),
//            DCB=(RECFM=FB,LRECL=33,BLKSIZE=0,DSORG=PS),
//            SPACE=(CYL,(10,10),RLSE),UNIT=SYSALLDA
//SYSIN DD *
  SORT FIELDS=COPY
  OUTFIL REMOVECC,NODETAIL,
  TRAILER1=('F1:',COUNT=(M11,LENGTH=8))
/*

//SORT2 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=F2,DISP=SHR
//SORTOUT  DD DSN=FOUTPUT,
//            DISP=(MOD,CATLG,DELETE),
//            DCB=(RECFM=FB,LRECL=33,BLKSIZE=0,DSORG=PS),
//            SPACE=(CYL,(10,10),RLSE),UNIT=SYSALLDA
//SYSIN DD *
  SORT FIELDS=COPY
  OUTFIL REMOVECC,NODETAIL,
  TRAILER1=('F2:',COUNT=(M11,LENGTH=8))
/*


That is working fine if the files have the same length (33 in this case). But I get the next error when F1 has a length of 33 and F2 has 32:
32 BYTE FIXED RECORD LENGTH IS NOT EQUAL TO 33 BYTE LRECL FOR SORTOUT


I also tried deleting "LRECL=33" but the problem is the same. I want to count the number of several records with different lengths and without set the length.

What can I do?

Thanks!
LACPTN
 
Posts: 1
Joined: Sun Apr 27, 2014 3:20 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Count number of records of several files

Postby NicC » Sun Apr 27, 2014 5:32 pm

create individual output files for each file and, once all have been created, concatenate them into one.
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


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post