Page 1 of 1

How to use sum fields for this case?

PostPosted: Sun Nov 28, 2010 3:16 am
by uday123
I have some records , which have data in this format.

450010002001234N
450029999005678}
450022843949237{

i want to add last 5 digits of each record.

In first record N means -5 shud be taken for calculation
} means + 0 and { means - 0 shud be taken.


Please advise , hw we can do this using SUM FIELDS option or any other procedure.
Any way we can do the conversion automatically? like N means -5 ?? because when i edit the data set in FILE AID , it converts automatically and shows N as 5.

Please advice. Thanks.

Re: How to use sum fields for this case?

PostPosted: Sun Nov 28, 2010 9:37 am
by dick scherrer
Hello,

Just define this field as ZD (zoned-decimal) and the sort will do what you have asked for.

Re: How to use sum fields for this case?

PostPosted: Mon Nov 29, 2010 1:33 am
by uday123
Hi Dick ,

Thanks for your reply..
Could you please give me the sort card how to do conversion from EBCDIC to ZD , as i did not find it anywhere? Or link to that also wud help me.
After tat i will sum up the ZD fields. Thanks

Regards
Uday

Re: How to use sum fields for this case?

PostPosted: Mon Nov 29, 2010 6:26 am
by dick scherrer
Hello,

There is no conversion needed. All that is needed is the proper definition as the data posted is zoned-decimal.

Modify this for your use:
SUM FIELDS=(start,end,ZD)

Re: How to use sum fields for this case?

PostPosted: Mon Nov 29, 2010 10:19 pm
by uday123
Thanks Dick, how ever i have another problem here ..


I need to merge two files , side by side

Input 1 : 23456 6789
Input 2 : 63639

O/p : 23456 6789 63639

Please advise or help me out by providing link to the same. Thanks.

Re: How to use sum fields for this case?

PostPosted: Tue Nov 30, 2010 1:53 am
by dick scherrer
Hello,

Is DFSORT used on your system (the top of the output from an execution will show which sort product is in use) or Syncsort or ?

I seem to recall this being originally posted in the JCL part of the forum?

Re: How to use sum fields for this case?

PostPosted: Tue Nov 30, 2010 2:22 am
by Frank Yaeger
uday123,

Does each input file only have one record? If not, show a better example with multiple records in each input file.

What is the RECFM and LRECL of the input files? What is the expected RECFM and LRECL of the output file? What is the starting position, length and format of each relevant field? What are the rules for joining the records - is it record-by-record (F1R1 with F2R1, F1R2 with F2R2, etc) or something else?