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 

Sign Field considerations in SORT SUM - Syncsort

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


Joined: 22 Jun 2005
Posts: 41
Topics: 14

PostPosted: Tue Jul 19, 2005 8:19 pm    Post subject: Sign Field considerations in SORT SUM - Syncsort Reply with quote

Sign Field considerations in SORT SUM

Hi,

1. I have a cobol Pic clause for a file as follows
A-FIELD1 PIC X(02).
A-FIELD2 PIC X(02).
A-CURR-SIGN PIC X(01).
A-CURR-AMT PIC 9(11).
B-CURR-SIGN PIC X(01).
B-CURR-AMT PIC 9(11).
C-CURR-SIGN PIC X(01).
C-CURR-AMT PIC 9(11).
D-CURR-SIGN PIC X(01).
D-CURR-AMT PIC 9(11).

If I have to sort sum on these fields, assuming A-FIELD1 and A-FIELD2, Can I do that considering A-CURR-AMT with sign field as ZD ?
Or else do I need to convert this ? If so How do I convert ?
LRECL=229 and RECFM=FB

2. Another case, I have a cobol pic clause as
A-FIELD1 PIC X(02).
A-FIELD2 PIC X(02).
A-CURR-AMT PIC -9(13).
B-CURR-AMT PIC -9(13).
C-CURR-AMT PIC -9(13).
D-CURR-AMT PIC -9(13).

I am sort summing on the amount fields, A-FIELD1 and A-FIELD2 are key fields.

When I am summing, If the file has two records 1 with +ve amount and another with -ve amount, the output record on summing is adding instead of subtracting and I am getting zeroes in the sign field. I am using ZD as the format in sum.
LRECL=152 and RECFM=FB
Example
Input

Code:

01 25 0000000000000-0000000000003 0000000000001 0000000000000
01 25 0000000000000 0000000000001 0000000000001 0000000000000
01 50 0000000000000-0000000000001-0000000000001 0000000000000
01 50 0000000000000 0000000000001 0000000000001 0000000000000
01 75 0000000000000-0000000000001 0000000000001 0000000000000


Output
Code:

01 25 00000000000000000000000000400000000000002 0000000000000
01 50 00000000000000000000000000200000000000002 0000000000000
01 75 0000000000000-0000000000001 0000000000001 0000000000000


In the case where I am not summing the amount fields appear as they are. Is there any thing I am missing here ?

Thanks
Geetha
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12369
Topics: 75
Location: San Jose

PostPosted: Wed Jul 27, 2005 7:36 am    Post subject: Reply with quote

Quote:

If I have to sort sum on these fields, assuming A-FIELD1 and A-FIELD2, Can I do that considering A-CURR-AMT with sign field as ZD ?
Or else do I need to convert this ? If so How do I convert ?
LRECL=229 and RECFM=FB


Geetha,

You cannot use ZD for summing when the sign is seperate. you need to convert that field to a packed decimal field and then sum the values. so we convert the field and put it at the end of every record and then sum the value. Using OUTREC fields we can overlay the summed value on to the actual field.

ex:

Code:

 INREC FIELDS=(1,229,
               5,12,FS,PD,LENGTH=8)   $CONVERT A-CURR-AMT TO PD
 SORT FIELDS=(1,4,CH,A)
 SUM FIELDS=(230,8,PD)
 OUTREC FIELDS=(1,4,
                230,8,PD,EDIT=(STTTTTTTTTTT),SIGNS=(,,+,-),
                17,213)



Quote:

2. Another case, I have a cobol pic clause as


Same as above. you need to convert and then peform the sum sort.


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
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