View previous topic :: View next topic
Author
Message
radhakrishnan82 Active User Joined: 31 Mar 2005Posts: 435 Location: chennai, India
HI,
My requirement is to hve a summary file containing only total number of record counts including header and trailer and put in the output file having filename and its total record count. can anyone tell me how to write it in the output file for multiple record counts.
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19244 Location: Inside the Matrix
Hello,
Post some sample input and the output you want when this sample input is processed.
Mention the recfm and lrecl of the files.
Explain the rules for getting from the input to the output.
Back to top
radhakrishnan82 Active User Joined: 31 Mar 2005Posts: 435 Location: chennai, India
Please find below my reqmt:
Input files :LRECL 133 FB
XXXX.file1.data
XXXX.file2.data
XXXX.file3.data
XXXX.file4.data
XXXX.file5.data
XXXX.file6.data
XXXX.file7.data
XXXX.file8.data
XXXX.file9.data
XXXX.fileA.data
Output file :
LRECL 80 FB
File name Rec count
XXXX.file1.data - 901
XXXX.file2.data - 108
XXXX.file3.data - 011
XXXX.file4.data - 101
XXXX.file5.data - 987
XXXX.file6.data - 1011
XXXX.file7.data - 1298
XXXX.file8.data - 09
XXXX.file9.data - 0
XXXX.fileA.data -1009
Back to top
vasanthz Global Moderator Joined: 28 Aug 2007Posts: 1742 Location: Tirupur, India
Hi,
Search for "smart dfsort tricks pdf" on google, that PDF has many handy programs and a good tutorial for ICETOOL.
If my understanding of ur requirement is right,
You could use the below job,
Code:
//JS020 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SORTIN1 DD DISP=SHR,DSN=WELLS.file1.data
//SORTIN2 DD DISP=SHR,DSN=WELLS.file2.data
.
.
.
//SORTOUT DD DSN=WELLS.OUTFILE,DISP=MOD
//SYSOUT DD SYSOUT=*
//TOOLIN DD *
COUNT FROM(SORTIN1) WRITE(SORTOUT) TEXT('WELLS.FILE1.DATA -') -
DIGITS(8) WIDTH(80)
COUNT FROM(SORTIN2) WRITE(SORTOUT) TEXT('WELLS.FILE2.DATA -') -
DIGITS(8) WIDTH(80)
.
.
/*
//SYSUDUMP DD SYSOUT=*
/*
The outputfile is being used as DISP=MOD, so you may want to delete the data inside the file in previous step.. maybe using IDCAMS and copying a DD DUMMY file.
Hope it helps.
Back to top
radhakrishnan82 Active User Joined: 31 Mar 2005Posts: 435 Location: chennai, India
Thanks. I tried SORT for single file count. Can we use SORT for the same purpose.
Back to top
vasanthz Global Moderator Joined: 28 Aug 2007Posts: 1742 Location: Tirupur, India
Hi,
Why would you want to do this with SORT? when ICETOOL is also DFSORT and does the same.
See the below link to know about ICETOOL
ibmmainframes.com/post-257777.html
Hope it helps.
Back to top
radhakrishnan82 Active User Joined: 31 Mar 2005Posts: 435 Location: chennai, India
yes, vasanth. I do understand. Its old client standards, they dont want to change for the timebeing. Even they write cobol code for this. May be I should convince them with surprises. Thank you all.
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
radhakrishna82,
Use the following DFSORT JCL which will give you the desired results
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
//SORTOUT DD DSN=&&HDR,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REMOVECC,NODETAIL,BUILD=(133X),HEADER1=('$$$')
//*
//STEP0200 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
DSN01,C'XXXX.FILE1.DATA'
DSN02,C'XXXX.FILE2.DATA'
DSN03,C'XXXX.FILE3.DATA'
DSN04,C'XXXX.FILE4.DATA'
DSN05,C'XXXX.FILE5.DATA'
DSN06,C'XXXX.FILE6.DATA'
DSN07,C'XXXX.FILE7.DATA'
DSN08,C'XXXX.FILE8.DATA'
DSN09,C'XXXX.FILE9.DATA'
DSN10,C'XXXX.FILEA.DATA'
//*
//SORTIN DD DSN=&&HDR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT
// DD DISP=SHR,DSN=XXXX.FILE1.DATA
// DD DSN=&&HDR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT
// DD DISP=SHR,DSN=XXXX.FILE2.DATA
// DD DSN=&&HDR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT
// DD DISP=SHR,DSN=XXXX.FILE3.DATA
// DD DSN=&&HDR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT
// DD DISP=SHR,DSN=XXXX.FILE4.DATA
// DD DSN=&&HDR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT
// DD DISP=SHR,DSN=XXXX.FILE5.DATA
// DD DSN=&&HDR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT
// DD DISP=SHR,DSN=XXXX.FILE6.DATA
// DD DSN=&&HDR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT
// DD DISP=SHR,DSN=XXXX.FILE7.DATA
// DD DSN=&&HDR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT
// DD DISP=SHR,DSN=XXXX.FILE8.DATA
// DD DSN=&&HDR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT
// DD DISP=SHR,DSN=XXXX.FILE9.DATA
// DD DSN=&&HDR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT
// DD DISP=SHR,DSN=XXXX.FILEA.DATA
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(1,3,80:X)),
IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'$$$'),PUSH=(4:ID=2)),
IFTHEN=(WHEN=(4,2,ZD,EQ,01),OVERLAY=(6:DSN01)),
IFTHEN=(WHEN=(4,2,ZD,EQ,02),OVERLAY=(6:DSN02)),
IFTHEN=(WHEN=(4,2,ZD,EQ,03),OVERLAY=(6:DSN03)),
IFTHEN=(WHEN=(4,2,ZD,EQ,04),OVERLAY=(6:DSN04)),
IFTHEN=(WHEN=(4,2,ZD,EQ,05),OVERLAY=(6:DSN05)),
IFTHEN=(WHEN=(4,2,ZD,EQ,06),OVERLAY=(6:DSN06)),
IFTHEN=(WHEN=(4,2,ZD,EQ,07),OVERLAY=(6:DSN07)),
IFTHEN=(WHEN=(4,2,ZD,EQ,08),OVERLAY=(6:DSN08)),
IFTHEN=(WHEN=(4,2,ZD,EQ,09),OVERLAY=(6:DSN09)),
IFTHEN=(WHEN=(4,2,ZD,EQ,10),OVERLAY=(6:DSN10))
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(4,2,
TRAILER3=(6,44,C' - ',COUNT-1=(M10,LENGTH=8)))
//*
Back to top
radhakrishnan82 Active User Joined: 31 Mar 2005Posts: 435 Location: chennai, India
Thanks, Skolusu. Its returning only one row. 10 record counts should be displayed for the jcl. I am not sure where I can correct it.
Back to top
Guest
Hi Radhakrishnan82,
I tried executing the same jcl and i got the desired output.
Code:
XXXX.FILE1.DATA - 25
XXXX.FILE2.DATA - 25
for two files in the input.
Kindly display the jcl you have used.
And also check if you have written the sortin of step0200 correctly.
devil13
There is always a better solution
Back to top
radhakrishnan82 Active User Joined: 31 Mar 2005Posts: 435 Location: chennai, India
Pls find the JCL below.
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
//SORTOUT DD DSN=&&HDR,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REMOVECC,NODETAIL,BUILD=(133X),HEADER1=('$$$')
//*
//STEP0200 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
DSN01,C'XXXX.RPTA1.DATE311'
DSN02,C'XXXX.RPTA2.DATE311'
//*
//SORTIN DD DSN=&&HDR,VOL=REF=*.STEP0100.SORTOUT
// DD DISP=SHR,DSN=XXXX.RPTA1.DATE311
// DD DSN=&&HDR,VOL=REF=*.STEP0100.SORTOUT
// DD DISP=SHR,DSN=XXXX.RPTA2.DATE311
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(1,3,80:X)),
IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'$$$'),PUSH=(4:ID=2)),
IFTHEN=(WHEN=(4,2,ZD,EQ,01),OVERLAY=(6:DSN01)),
IFTHEN=(WHEN=(4,2,ZD,EQ,02),OVERLAY=(6:DSN02))
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(4,2,
TRAILER3=(6,44,C' - ',COUNT-1=(M10,LENGTH=8)))
/*
//
Back to top
radhakrishnan82 Active User Joined: 31 Mar 2005Posts: 435 Location: chennai, India
Job card below .
Code:
//V***** JOB (1,XXXX0),'XXX-999991',MSGCLASS=Y,
// CLASS=A,USER=&SYSUID,NOTIFY=&SYSUID
//CA11 EXEC CA11,PARM=F
Abend
IAT6108 JOB V****** (JOBxxx) FAILED BY INITIATOR CN(INTERNAL)
IAT6108 JOB V****** STEP=STEP0200,PROC=NONE CN(INTERNAL)
***
Before I didnt use STEP100, I directly tried to use step200. hence one record was written. Now I gave as per the code here. CA11 didnt allowing me.
Back to top
radhakrishnan82 Active User Joined: 31 Mar 2005Posts: 435 Location: chennai, India
why cant we give directly like below by eliminating step100. I dont know about it.
Code:
//STEP0200 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
DSN01,C'XXXX.RPTA1.DATE311'
DSN02,C'XXXX.RPTA2.DATE311'
//*
//SORTIN DD DISP=SHR,DSN=XXXX.RPTA1.DATE311
// DD DISP=SHR,DSN=XXXX.RPTA2.DATE311
//SORTOUT DD SYSOUT=*
//SYSIN DD *
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(1,3,80:X)),
IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'$$$'),PUSH=(4:ID=2)),
IFTHEN=(WHEN=(4,2,ZD,EQ,01),OVERLAY=(6:DSN01)),
IFTHEN=(WHEN=(4,2,ZD,EQ,02),OVERLAY=(6:DSN02))
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(4,2,
TRAILER3=(6,44,C' - ',COUNT-1=(M10,LENGTH=8)))
/*
//
Back to top
Guest
Hi,
Using step100 we create a demarcator and this helps us in counting the number of records for each file.
step100:
output: only one record
Step200:
we merge the files.
intermediate output:
Code:
$$$
file1data1
file1data2
$$$
file2data1
file2data2
The following line inserts ID for a group of record begining with $$$
Code:
IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'$$$'),PUSH=(4:ID=2)),
intermediate output:
Code:
$$$01
fil01Filename
fil01Filename
$$$02
fil02Filename
fil02Filename
The sections command along with the count finds the count for these subsections.
Kindly get back to me incase of any concern.
devil13
There is always a better solution.
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
radhakrishnan82 wrote:
Before I didnt use STEP100, I directly tried to use step200. hence one record was written. Now I gave as per the code here. CA11 didnt allowing me.
radhakrishnan82 wrote:
why cant we give directly like below by eliminating step100. I dont know about it.
radhakrishnan82,
Well I wouldn't post an unnecessary step if I didn't need to. As devil13 already explained , it is to create the unique separator for each file. When you concatenate files together there is no way to distinguish as to which file the record came from.
As for abend, You need to show us the complete JES messages which indicate what exactly the error is. I am guessing that your shop does not allow referback on temp datasets.
Back to top
Please enable JavaScript!