about sum fields



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

about sum fields

Postby cpzbn » Thu Jul 26, 2012 3:36 pm

Hi all
I met a problem when using DFSORT for 'sum fields', here is the my sample before.

File A includes the following records:
Line
Record 1: 23
Record 2: 456
Record 3: 1234
The file record length is 4 bytes(fill in space if the number not occupy all 4 bytes), i want to sum up all above records, then output to another file.

I use following syntax below first, but abend S0C7,
Method 1:
sum fields=(1,4,ZD)
then I tried following method, but the result seems not correct
Method 2:
sum fields=(1,4,BI)
cpzbn
 
Posts: 4
Joined: Thu Oct 15, 2009 9:47 pm
Has thanked: 0 time
Been thanked: 0 time

Re: about sum fields

Postby BillyBoyo » Thu Jul 26, 2012 5:31 pm

You first specified Zoned Decimal, but the spaces tripped you up. Specifying Binary won't help, as the numbers are in character format and BI will treat them as enormous (or negative and with no obvious relation to your input).

Consult the manual. You have a "free format numeric". Yours is unsigned, so UFF. Look for examples of its use.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: about sum fields

Postby skolusu » Thu Jul 26, 2012 11:37 pm

cpzbn,

Use the following DFSORT JCL which will give you the desired results
//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                                 
23                                                             
456                                                             
1234                                                           
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                                 
  OPTION COPY                                                   
  OUTFIL REMOVECC,NODETAIL,                                     
  TRAILER1=('SUM OF ALL RECORDS : ',TOT=(1,4,UFF,M10,LENGTH=8))
//*


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
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


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post