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

Padding Numbers with Zeros on Left.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
genesis786

Active User


Joined: 28 Sep 2005
Posts: 210
Location: St Katherine's Dock London

PostPosted: Fri Feb 20, 2009 10:23 pm
Reply with quote

Hi,

I am trying to pad numbers (aligned left in the input) with left zeros and numbers right aligned.

Code:

//SORTIN DD *         
ABC1                 
BDJ233               
JFK3                 
KDK43                 
DK 54321             
//SORTOUT DD SYSOUT=*
//SYSIN    DD *                                                     
  SORT FIELDS=COPY                                                 
  OUTREC FIELDS=(1,3,(+99999,SUB,(+99999,SUB,4,5,ZD)),M11,LENGTH=5)
/*                                                                 


i am thinking too loud with this sort instruction - it's not giving desired results.

I want output as

Code:

ABC00001                 
BDJ00233               
JFK00003                 
KDK00043                 
DK 54321           


can u please help. thanks in advance.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Feb 20, 2009 10:47 pm
Reply with quote

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
ABC1
BDJ233
JFK3
KDK43
DK 54321
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC OVERLAY=(4:4,5,UFF,M11,LENGTH=5)
/*
Back to top
View user's profile Send private message
genesis786

Active User


Joined: 28 Sep 2005
Posts: 210
Location: St Katherine's Dock London

PostPosted: Fri Feb 20, 2009 11:42 pm
Reply with quote

thanks Frank
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Shift left VB record without x00 endi... DFSORT/ICETOOL 11
No new posts How to display the leading zeros of a... DB2 7
This topic is locked: you cannot edit posts or make replies. Suppressing only leading zeros (not s... DFSORT/ICETOOL 9
Search our Forums:

Back to Top