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
 

 

Padding Numbers with Zeros on Left.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Padding Numbers with Zeros on Left.
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 Moderator


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

PostPosted: Fri Feb 20, 2009 10:47 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Incorrect output when trying to add n... monica1 PL/I & Assembler 10 Fri Jan 13, 2017 5:02 pm
No new posts Row-Numbers of distinct rows? Auryn DB2 1 Thu Oct 20, 2016 4:38 pm
No new posts Coverting PD to FS and also left just... Atul Banke DFSORT/ICETOOL 6 Wed Aug 24, 2016 4:31 pm
No new posts comparing comp-3 and unpacked numbers juares castro COBOL Programming 3 Mon May 30, 2016 6:46 pm
No new posts Join key - Populate Zeros when Unpair... rexx77 DFSORT/ICETOOL 6 Thu May 12, 2016 12:22 am


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