View previous topic :: View next topic
Author
Message
jacobdng New User Joined: 27 Aug 2006Posts: 51 Location: Taiwan
The input content :
Code:
A 900100000006
A 900300000006
A 900600000013
A OTHER00000037
I want to SUM fields=(8,8),and expect the output:
Code:
A 900100000006
A 900300000006
A 900600000013
A OTHER00000037
00000062
But, I can't get the summarized record.
The output file is the same as the input file.
The code I used:
Code:
//SYSIN DD *
SORT FIELDS=(3,5,CH,A)
SUM FIELDS=(8,8,BI)
* OUTREC FIELDS=(8,8)
/*
Please help.
Back to top
chandan.inst Active User Joined: 03 Nov 2005Posts: 275 Location: Mumbai
Hi,
SUM function does not work as you are expecting.
SUM fuctions adds the SUM fields only for the duplicate keys and your output will have only one record.
Here you are sort keys are (3,5) means from your input records values are
' 9001', ' 9003',' 9006' and 'OTHER' which don't have any duplicatekeys.
Regards,
Chandan
Back to top
jacobdng New User Joined: 27 Aug 2006Posts: 51 Location: Taiwan
I changed the sort key to (1,1) as the following
Code:
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
A 900100000006
A 900300000006
A 900600000013
A OTHER00000037
/*
//SORTOUT DD DSN= <output file name>
//SYSIN DD *
SORT FIELDS=(1,1,CH,A)
SUM FIELDS=(8,8,BI)
/*
The outcome is still the same!
Please help.
Back to top
mistah kurtz Active User Joined: 28 Jan 2012Posts: 316 Location: Room: TREE(3). Hilbert's Hotel
You need TOT and TRAILER1 to get the desired output. Try the below SORT Card:
Code:
OPTION COPY
OUTFIL REMOVECC,
TRAILER1=(08:TOT=(8,8,ZD,TO=ZD,LENGTH=8))
Back to top
jacobdng New User Joined: 27 Aug 2006Posts: 51 Location: Taiwan
To Mistah, Thank you for the information.
I can get the total right now.
Code:
//SYSIN DD *
*OPTION COPY
SORT FIELDS=(1,1,CH,A)
OUTFIL REMOVECC,
TRAILER1=(08:TOT=(8,8,ZD,TO=ZD,LENGTH=8))
/*
But, what is the reason that the SUM operator doesn't work in my code?
Can anyone care to explain?
Jacob
Back to top
chandan.inst Active User Joined: 03 Nov 2005Posts: 275 Location: Mumbai
Hi,
SUM function used for summing up the fields given for similar keys and create one record which will have summed value at given position
for example of you having 10 records of same key like yopu have 5 records with same key at (1,1,CH,A), then in output you will get only 1 record with value summed for 5 records.
Hope this is clear
Please refer below link chapter 4
publibz.boulder.ibm.com/epubs/pdf/ice2cg00.pdf
regards,
Chandan
Back to top
jacobdng New User Joined: 27 Aug 2006Posts: 51 Location: Taiwan
Hello Chandan,
I can't find the very one record generated by SUM in the output file!!!
After changed the SORT FIELD to (1,1,CH,A), the SUM operator should add the value in field(8,8) of the input records.
Did I misunderstand your saying?
Jacob
Back to top
Bill Woodger Moderator Emeritus Joined: 09 Mar 2011Posts: 7309 Location: Inside the Matrix
Post the sysout from the step which didn't work (the SUM) and the step which did (the OUTFIL). Both should work, so let's find out why and why not.
Back to top
jacobdng New User Joined: 27 Aug 2006Posts: 51 Location: Taiwan
SYSOUT which didn't work(the SUM)
Code:
********************************* TOP OF DATA **********************************
ICE201I H RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE751I 0 C5-I12416 C6-K90026 C7-K94453 C8-K94453 E9-K60824 C9-BASE E5-K80744
ICE143I 0 BLOCKSET SORT TECHNIQUE SELECTED
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 15:43 ON FRI JA
SORT FIELDS=(1,1,CH,A)
SUM FIELDS=(8,8,BI)
ICE193I 0 ICEAM1 INVOCATION ENVIRONMENT IN EFFECT - ICEAM1 ENVIRONMENT SELECTED
ICE252I 1 PARMLIB OPTIONS WERE MERGED WITH INSTALLATION MODULE DEFAULTS
ICE088I 1 DEGNSRXX.S1 . , INPUT LRECL = 80, BLKSIZE = 80, TYPE = FB
ICE093I 0 MAIN STORAGE = (MAX,6291456,6278238)
ICE156I 0 MAIN STORAGE ABOVE 16MB = (6217712,6217712)
ICE127I 0 OPTIONS: OVFLO=RC0 ,PAD=RC0 ,TRUNC=RC0 ,SPANINC=RC16,VLSCMP=N,SZERO=Y,
ICE128I 0 OPTIONS: SIZE=6291456,MAXLIM=1048576,MINLIM=450560,EQUALS=N,LIST=Y,ERE
ICE129I 0 OPTIONS: VIO=N,RESDNT=ALL ,SMF=SHORT,WRKSEC=Y,OUTSEC=Y,VERIFY=N,CHALT=
ICE130I 0 OPTIONS: RESALL=4096,RESINV=0,SVC=109 ,CHECK=Y,WRKREL=Y,OUTREL=Y,CKPT=
ICE131I 0 OPTIONS: TMAXLIM=6291456,ARESALL=0,ARESINV=0,OVERRGN=65536,CINV=Y,CFW=
ICE132I 0 OPTIONS: VLSHRT=N,ZDPRINT=Y,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE ,EXITC
ICE133I 0 OPTIONS: HIPRMAX=OPTIMAL,DSPSIZE=MAX ,ODMAXBF=0,SOLRF=Y,VLLONG=N,VSAMI
ICE235I 0 OPTIONS: NULLOUT=RC0
ICE236I 0 OPTIONS: DYNAPCT=10 ,MOWRK=N
ICE084I 0 EXCP ACCESS METHOD USED FOR SORTOUT
ICE084I 0 BSAM ACCESS METHOD USED FOR SORTIN
ICE750I 0 DC 500000 TC 0 CS DSVUU KSZ 1 VSZ 1
ICE752I 0 FSZ=6250 RC IGN=0 E AVG=80 0 WSP=650 C DYN=0 0
ICE751I 1 DE-K83743 D5-K91600 D9-K61787 E8-I12416
ICE090I 0 OUTPUT LRECL = 80, BLKSIZE = 27920, TYPE = FB (SDB)
ICE152I 0 OVERFLOW DURING SUMMATION - RC=0
ICE080I 0 IN MAIN STORAGE SORT
ICE055I 0 INSERT 0, DELETE 0
ICE054I 0 RECORDS - IN: 4, OUT: 4
ICE134I 0 NUMBER OF BYTES SORTED: 320
ICE253I 0 RECORDS SORTED - PROCESSED: 4, EXPECTED: 6250
ICE199I 0 MEMORY OBJECT USED AS MAIN STORAGE = 0M BYTES
ICE299I 0 MEMORY OBJECT USED AS WORK STORAGE = 0M BYTES
ICE180I 0 HIPERSPACE STORAGE USED = 0K BYTES
ICE188I 0 DATA SPACE STORAGE USED = 0K BYTES
ICE052I 0 END OF DFSORT
******************************** BOTTOM OF DATA ********************************
Back to top
jacobdng New User Joined: 27 Aug 2006Posts: 51 Location: Taiwan
SYSOUT which worked(the OUTFIL)
Code:
********************************* TOP OF DATA **********************************
ICE201I H RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE751I 0 C5-I12416 C6-K90026 C7-K94453 C8-K94453 E4-K58148 C9-BASE E5-K80744
ICE143I 0 BLOCKSET SORT TECHNIQUE SELECTED
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 15:46 ON FRI JA
SORT FIELDS=(1,1,CH,A)
OUTFIL REMOVECC,
TRAILER1=(08:TOT=(8,8,ZD,TO=ZD,LENGTH=8))
ICE193I 0 ICEAM1 INVOCATION ENVIRONMENT IN EFFECT - ICEAM1 ENVIRONMENT SELECTED
ICE252I 1 PARMLIB OPTIONS WERE MERGED WITH INSTALLATION MODULE DEFAULTS
ICE088I 1 DEGNSRXX.S1 . , INPUT LRECL = 80, BLKSIZE = 80, TYPE = FB
ICE093I 0 MAIN STORAGE = (MAX,6291456,6266880)
ICE156I 0 MAIN STORAGE ABOVE 16MB = (6209520,6209520)
ICE127I 0 OPTIONS: OVFLO=RC0 ,PAD=RC0 ,TRUNC=RC0 ,SPANINC=RC16,VLSCMP=N,SZERO=Y,
ICE128I 0 OPTIONS: SIZE=6291456,MAXLIM=1048576,MINLIM=450560,EQUALS=N,LIST=Y,ERE
ICE129I 0 OPTIONS: VIO=N,RESDNT=ALL ,SMF=SHORT,WRKSEC=Y,OUTSEC=Y,VERIFY=N,CHALT=
ICE130I 0 OPTIONS: RESALL=4096,RESINV=0,SVC=109 ,CHECK=Y,WRKREL=Y,OUTREL=Y,CKPT=
ICE131I 0 OPTIONS: TMAXLIM=6291456,ARESALL=0,ARESINV=0,OVERRGN=65536,CINV=Y,CFW=
ICE132I 0 OPTIONS: VLSHRT=N,ZDPRINT=Y,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE ,EXITC
ICE133I 0 OPTIONS: HIPRMAX=OPTIMAL,DSPSIZE=MAX ,ODMAXBF=2097152,SOLRF=Y,VLLONG=N
ICE235I 0 OPTIONS: NULLOUT=RC0
ICE236I 0 OPTIONS: DYNAPCT=10 ,MOWRK=N
ICE084I 0 BSAM ACCESS METHOD USED FOR SORTIN
ICE750I 0 DC 500000 TC 0 CS DSVVV KSZ 1 VSZ 1
ICE752I 0 FSZ=6250 RC IGN=0 E AVG=80 0 WSP=650 C DYN=13 56648
ICE231I 0 STORAGE USED FOR OUTFIL : BELOW 16M = 20480, ABOVE 16M = 2121728
ICE210I 0 SORTOUT : EXCP USED, LRECL = 80, BLKSIZE = 27920, TYPE = FB (SDB)
ICE751I 1 DE-K83743 D5-K91600 D9-K61787 CB-K64632 E8-I12416
ICE080I 0 IN MAIN STORAGE SORT
ICE055I 0 INSERT 0, DELETE 0
ICE054I 0 RECORDS - IN: 4, OUT: 4
ICE227I 0 SORTOUT : DELETED = 0, REPORT = 1, DATA = 4
ICE228I 0 SORTOUT : TOTAL IN = 4, TOTAL OUT = 5
ICE134I 0 NUMBER OF BYTES SORTED: 320
ICE253I 0 RECORDS SORTED - PROCESSED: 4, EXPECTED: 6250
ICE165I 0 TOTAL WORK DATA SET TRACKS ALLOCATED: 15 , TRACKS USED: 0
ICE199I 0 MEMORY OBJECT USED AS MAIN STORAGE = 0M BYTES
ICE299I 0 MEMORY OBJECT USED AS WORK STORAGE = 0M BYTES
ICE180I 0 HIPERSPACE STORAGE USED = 0K BYTES
ICE188I 0 DATA SPACE STORAGE USED = 0K BYTES
ICE052I 0 END OF DFSORT
******************************** BOTTOM OF DATA ********************************
Back to top
chandan.inst Active User Joined: 03 Nov 2005Posts: 275 Location: Mumbai
Hi,
you are using ZD in outfil step so its working fine
If you change card to
Code:
SUM FIELDS=(8,8,ZD)
you will get the desired result of 1 record in 1st case as well
Regards,
Chandan
Back to top
jacobdng New User Joined: 27 Aug 2006Posts: 51 Location: Taiwan
Yes, indeed.
Thank you very much.
Back to top
Please enable JavaScript!