Page 1 of 1

how to get the summation using dfsort?...

PostPosted: Sat Dec 10, 2011 3:49 pm
by mainframemunic
000100 //xxxxxxx JOB NOTIFY=&SYSUID,MSGCLASS=A,MSGLEVEL=(1,1)
000200 //STEP1 EXEC PGM=SORT
000500 //SORTIN DD DSN=xxxxxxx.PANDS.NO1,DISP=SHR
000501 //SYSOUT DD SYSOUT=*
000510 //SYSPRINT DD SYSOUT=*
000600 //SORTXSUM DD DSN=xxxxxxx.PANDS.NO2,DISP=SHR
000610 //SORTOUT DD DSN=xxxxxxxx.PANDS.NO3,DISP=SHR
000700 //*SORTWK01 DD UNIT=SYSDA,SPACE=(TRK,(10,10),RLSE)
000800 //*SORTWK02 DD UNIT=SYSDA,SPACE=(TRK,(10,10),RLSE)
000900 //SYSIN DD *
001000 SORT FIELDS=(1,3,CH,A)
001120 SUM FIELDS=(11,5,ZD)
001200 /*
001300 //
the above program in jcl for sorting and adding the datas.
below given is my input file format.
000100 GOPISDFNN 10000
000200 XFCVFDGA 20000
000300 MOOSANISAR 30000
000400 SIVAGOPI 50000
000500 GOPINATH 80000
000600 PERCYBLK 93000
in the above input file i need to sum the ZD values and the output should be sent to sortxsum ddname...but the problem is i'm not getting the output of added values but the files are sorted.please tel how to solve this.............

Re: how to get the summation using dfsort?...

PostPosted: Sat Dec 10, 2011 4:12 pm
by BillyBoyo
Refer to your documentation to understand what the SORTXSUM ddname is.

I don't know what you are trying to sum, 11 as a start position looks not even close, but the result should be in SORTOUT where you should find one record that looks a bit odd. Post that record here.

Re: how to get the summation using dfsort?...

PostPosted: Sat Dec 10, 2011 9:21 pm
by NicC
If you are using DFSORT why are you posting in the JCL section of the forum? What do you think the DFSORT and SYNCSORT sections are for? Also, as mentioned in your other post re JCL in the COBOL forum - use code tags. The editor strips multiple spaces leaving things unaligned. Using the code tags allows the data etc to be displayed correctly.

Re: how to get the summation using dfsort?...

PostPosted: Sat Dec 10, 2011 10:35 pm
by Frank Yaeger
SORTOUT is used for the output of your job, not SORTXSUM.

SUM gives a separate sum for each key. Since you don't have any duplicate keys you will not get any summing. If you just want a total of all of the values, use a DFSORT job like the following:

//S1 EXEC PGM=SORT
//SORTIN DD DSN=...  input file
//SYSOUT DD DSN=...  output file
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  OUTFIL REMOVECC,NODETAIL,
    TRAILER1=(TOT=(11,5,ZD,TO=ZD,LENGTH=6))
/*


If that doesn't give you what you want, then you need to do a better job of explaining and showing what you do want.

Re: how to get the summation using dfsort?...

PostPosted: Mon Dec 12, 2011 10:16 am
by mainframemunic
please explain the above the example.. briefly

Re: how to get the summation using dfsort?...

PostPosted: Mon Dec 12, 2011 10:34 am
by dick scherrer
Hello,

OPTION COPY - this will be a copy operation (rather than a sort or something else)

OUTFIL REMOVECC,NODETAIL, - Remove the carriage control (cc) from the output and write no detail data.

TRAILER1=(TOT=(11,5,ZD,TO=ZD,LENGTH=6)) - Generate a Trailer record with the total - re-read Frank's post.

Re: how to get the summation using dfsort?...

PostPosted: Tue Dec 13, 2011 12:43 am
by Frank Yaeger
please explain the above the example.. briefly


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

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