IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sort - Put zeros before actual value


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ramas.kamal

New User


Joined: 03 Mar 2014
Posts: 22
Location: India

PostPosted: Wed Mar 12, 2014 12:54 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Mar 12, 2014 1:06 pm
Reply with quote

If SYNCSORT supports UFF

You could try this

Code:
  INREC  FIELDS=(1:1,7,UFF,EDIT=(TTTTTTT))
  SORT FIELDS=COPY
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Wed Mar 12, 2014 1:49 pm
Reply with quote

Or you can try,

Code:
INREC BUILD=(1,7,UFF,M7,LENGTH=7)
SORT FIELDS=COPY
Back to top
View user's profile Send private message
ramas.kamal

New User


Joined: 03 Mar 2014
Posts: 22
Location: India

PostPosted: Wed Mar 12, 2014 2:37 pm
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Wed Mar 12, 2014 2:39 pm
Reply with quote

ah.. thanks for correcting the Mask #..glad it worked.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top