MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

sort sum - expand output length

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
sub
Beginner


Joined: 30 Jan 2007
Posts: 20
Topics: 12

PostPosted: Fri Mar 05, 2010 1:24 pm    Post subject: sort sum - expand output length Reply with quote

Hi,
I have a input file which has 2 fields. The layout is
01 INPUT-REC
05 CUST-NO PIC X(9)
05 CUST-DESC PIC X(30)
05 CUST-QTY PIC S9(10)V999 COMP-3

The input file has many records for a single cust-no. I am trying to have only 1 record per cust-no and sum cust-qty to an output file.

I used the below given sortcard
SORT FIELDS=(1,9,CH,A)
SUM FIELDS=(40,7,PD)
OUTREC FIELDS=(1:1,9,10:40,7)

However, if the CUST-QTY for 2 records is already at the max for a single CUST-NO then the sort sum doesn't work and I get multiple records.
For eg., it doesn't work for the below condition.
Cust-NO CUST-QTY
XXXXXXX1X -4004000000.000
XXXXXXX1X -8000000000.000

I want to expand the CUST-QTY for the output record to avoid this issue. Can someone please advise how to resolve this using SORT.

Thanks,
Sub
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Mar 05, 2010 2:02 pm    Post subject: Reply with quote

This would exapnd the CUST-QTY to PIC S9(12)V999:

Code:

   INREC BUILD=(1,9,10:Z,40,7)
   SORT FIELDS=(1,9,CH,A)
   SUM FIELDS=(10,8,PD)


Z is used to insert X'00' before the PD value to expand it.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group