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

Padding Field with Leading Zeros.


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: Thu Oct 23, 2008 6:55 pm
Reply with quote

Hi,

I need to sort an input file which has somewhat following structure:

Code:

Jack Nicholsan     3
Mathew Perry       1
Tom Hanks          6


I need to get the second field from '3 ' and so on to '03' and so on by padding leading zeros to it.

Is there a way to do it sing SORT.

Regards
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: Thu Oct 23, 2008 9:33 pm
Reply with quote

It's not clear what you want to do exactly. Show the output records you expect for your input records example. Give the RECFM and LRECL of the input file. Give the starting position, length and format for your input and output fields.

Is the second field always just 1 digit? If not, show a better example of your input records with the relevant variations (e.g. 1 digit, 2 digits, etc).
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: Mon Oct 27, 2008 2:50 am
Reply with quote

Hi Frank, sorry abt being unclear...

the situation is something like this: whenever i read a '3 ' in a PIC 9(2) variable of cobol it stores it as 30...

so my input file brings me the problematic field '3 ', '1 ' and '6 ' as follows... with pos 1-19 as the name, and 20-21 as number of visits...

lrecl of the input/output file is 21

Code:

Jack Nicholsan     3
Mathew Perry       1
Tom Hanks          6


and i want the output as....

Code:

Jack Nicholsan     03
Mathew Perry       01
Tom Hanks          06
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Mon Oct 27, 2008 3:14 am
Reply with quote

Hi,

try this
Code:
  OPTION COPY                               
  INREC OVERLAY=(20:20,2,UFF,M11,LENGTH=2)   



Gerry
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 Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
No new posts Remove leading zeroes SYNCSORT 4
No new posts leading spaces can be removed in trai... DFSORT/ICETOOL 1
No new posts Join 2 files according to one key field. JCL & VSAM 3
Search our Forums:

Back to Top