Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 How to include a particular field val... sakrat DFSORT/ICETOOL 8 Fri Apr 06, 2018 8:27 pm
No new posts Extract the records with a PD field's... sudhakar84 DFSORT/ICETOOL 11 Mon Apr 02, 2018 7:26 pm
No new posts Searching a table for the field name? socker_dad COBOL Programming 8 Sat Mar 31, 2018 2:57 am
No new posts Inefficient BUILD - VB records paddin... Daniel Prosser SYNCSORT 9 Thu Dec 14, 2017 3:52 pm
This topic is locked: you cannot edit posts or make replies. Incrementing current time field by 30... arunsoods DFSORT/ICETOOL 11 Thu Oct 26, 2017 3:22 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us