Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sort - Put zeros before actual value

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Sort - Put zeros before actual value
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

Moderator


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

PostPosted: Wed Mar 12, 2014 1:06 pm    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 1652
Location: NY,USA

PostPosted: Wed Mar 12, 2014 1:49 pm    Post subject:
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    Post subject: Reply to: Sort - Put zeros before actual value
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

Senior Member


Joined: 21 Sep 2010
Posts: 1652
Location: NY,USA

PostPosted: Wed Mar 12, 2014 2:39 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm
No new posts JCL sort Match and NoMatch rakeshsekar1987 SYNCSORT 2 Thu Feb 02, 2017 10:26 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us