View previous topic :: View next topic
|
Author |
Message |
ramas.kamal
New User
Joined: 03 Mar 2014 Posts: 22 Location: India
|
|
|
|
Hi,
I want to put zeros before numbers coming from input file so that all of them look aligned and make readable. I have tried below sort after searching here but unable to get desired output.
Code: |
//STEP0001 EXEC PGM=SORT
//SORTIN DD *
006
010008
0001265
03
2048
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC BUILD=(1,7,ZD,TO=ZDF,LENGTH=7)
//*
|
Present output: Here the zeros are coming to the right of actual value.
Code: |
0060000
0100080
0001265
0300000
2048000
|
Desired Output:
Code: |
0000006
0010008
0001265
0000003
0002048
|
Please help me to get desired output.
Thanks. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
If SYNCSORT supports UFF
You could try this
Code: |
INREC FIELDS=(1:1,7,UFF,EDIT=(TTTTTTT))
SORT FIELDS=COPY |
|
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3053 Location: NYC,USA
|
|
|
|
Or you can try,
Code: |
INREC BUILD=(1,7,UFF,M7,LENGTH=7)
SORT FIELDS=COPY |
|
|
Back to top |
|
|
ramas.kamal
New User
Joined: 03 Mar 2014 Posts: 22 Location: India
|
|
|
|
Hi Pandora-Box, I got desired output with you code. Thanks a lot.
Hi Rohit Umarjikar, I got below output with your suggestion.
Code: |
00-0006
01-0008
00-1265
00-0003
00-2048
|
After searching here, I modified M7 to M11 and got right output. Thanks a lot. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3053 Location: NYC,USA
|
|
|
|
ah.. thanks for correcting the Mask #..glad it worked. |
|
Back to top |
|
|
|