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 Field with Leading Zeros.

 
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: Thu Oct 23, 2008 6:55 pm    Post subject: Padding Field with Leading Zeros.
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 Moderator


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

PostPosted: Thu Oct 23, 2008 9:33 pm    Post subject:
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    Post subject:
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: 1703
Location: Australia

PostPosted: Mon Oct 27, 2008 3:14 am    Post subject:
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    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 INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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