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: 1529
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: 1610
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: 1610
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 Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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