|
View previous topic :: View next topic
|
| Author |
Message |
Deepakgoyal2005
New User

Joined: 22 Mar 2007 Posts: 57 Location: India
|
|
|
|
I am in need to add numeric-edited fields via JCL.
Input:
| Code: |
11111 $ 1,111,11.11
11111 $ 2,222,22.22
22222 $ 3,333,33.33
22222 $ 4,444,44.44
33333 $ 5,555,55.55
|
Expected output:
| Code: |
11111 $ 3,333,33.33
22222 $ 7,777,77.77
33333 $ 5,555,55.55
|
For numeric input, I would have used,
| Code: |
OPTION ZDPRINT
SORT FIELDS=(1,5,CH,A)
SUM FIELDS=(9,14,ZD) |
I am not sure about handling numeric-edited field. Can someone please help? |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
| Sorry, but JCL does not do arithmetic - check the JCL Language Reference Manual. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Get out your manual and look up field formats. You should find UFF (unsigned free format) which should be a definition of what you want.
If you can't use UFF in SUM (your docs will tell you) you'd have to convert it first.
To get the output back into your format, use an EDIT. |
|
| Back to top |
|
 |
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1056 Location: Richmond, Virginia
|
|
|
|
I do not see how we can keep telling folks that JCL does not do this or do that, but then have all questions for one of the sort programs go the the JCL section.
Why is there not a special section for either all or each sort program(s)?
This has been on my mind for years. Whew - glad to finally get it out! |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
It varies from forum to forum - one has a section title DFSORT but the sub-heading includes SYNCSORT - another has one for each - by far the best arrangement.
But this is the 'experts' forum and they should be able to type sort control cards instead of JCL. Mind you, 'cards' is a bit of a mis-nomer! Should be records/data/info. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Deepakgoyal2005,
Use the following DFSORT JCL which will give you the desired results
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
11111 $ 1,111,11.11
11111 $ 2,222,22.22
22222 $ 3,333,33.33
22222 $ 4,444,44.44
33333 $ 5,555,55.55
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC OVERLAY=(81:9,14,UFF,PD,LENGTH=7)
SORT FIELDS=(1,5,CH,A)
SUM FIELDS=(81,7,PD)
OUTREC BUILD=(1,8,81,7,PD,EDIT=(III,III,III.TT))
//* |
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|