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

Appending Zeros to Input


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

New User


Joined: 17 Feb 2007
Posts: 39
Location: Chennai

PostPosted: Mon Jan 10, 2011 12:26 pm
Reply with quote

Hi all,

Hope all are doing good and (belated) Happy New Year to all. icon_biggrin.gif

I have the following sample input.

bytes: 1-9
Code:
----------
123456789
1234567
12345678
----------


I am looking for the below output, where zeros are appending in the front if the length is not equal to 9.

bytes: 1-11
Code:
-----------
123-45-6789
001-23-4567
012-34-5678
-----------


I tried the below code:

Code:
INREC BUILD=(1,9,ZD,EDIT=(TTTTTTTTT))


But I could see that zeros are appended only the end as below.

bytes: 1-11
Code:
-----------
123-45-6789
123-45-6700
123-45-6780
-----------
Back to top
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Mon Jan 10, 2011 6:48 pm
Reply with quote

Please try this
Code:
 
OPTION COPY                                   
  INREC IFTHEN=(WHEN=(1,3,CH,NE,C'---'),       
      BUILD=(1,9,SQZ=(SHIFT=RIGHT)))           
 OUTREC FINDREP=(INOUT=(C' ',C'0'))           
 OUTFIL FILES=OUT,BUILD=(1,3,C'-',4,2,C'-',6,4)
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Jan 10, 2011 11:02 pm
Reply with quote

purusothaman,

Use the following DFSORT JCL which will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                   
//SYSOUT   DD SYSOUT=*                     
//SORTIN   DD *                             
123456789                                   
1234567                                     
12345678                                   
//SORTOUT  DD SYSOUT=*                     
//SYSIN    DD *                             
  SORT FIELDS=COPY                         
  INREC OVERLAY=(1,9,UFF,EDIT=(TTT-TT-TTTT))
/*


The output is

Code:

123-45-6789
001-23-4567
012-34-5678
Back to top
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Mon Jan 10, 2011 11:24 pm
Reply with quote

Wasn't the 'Hyphed' line appearing as the header and trailer also part of the requirement? Please correct my understanding..
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Jan 10, 2011 11:57 pm
Reply with quote

hailashwin wrote:
Wasn't the 'Hyphed' line appearing as the header and trailer also part of the requirement? Please correct my understanding..


Ashwin,

I don't think so. It is just to show the top of the data line and Bottom of data lines.

Even if they are indeed actual data line , UFF will translate them to zeroes.
Back to top
View user's profile Send private message
purusothaman

New User


Joined: 17 Feb 2007
Posts: 39
Location: Chennai

PostPosted: Tue Jan 11, 2011 10:00 am
Reply with quote

Dear Ashwin,
The hypens are not part of data. As Kolusu mentioned, it was used to show the boundary of the data.

Kolusu,
Thanks a lot. I will try this one and let you know the result.
Back to top
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Tue Jan 11, 2011 10:37 am
Reply with quote

I have indeed made it look complicated then.. icon_rolleyes.gif

Thanks Kolusu and purusothaman.
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 force tablespace using LISTDEF input DB2 1
No new posts Two input files & writing counter... DFSORT/ICETOOL 12
No new posts Use input file with OMIT rcd keys? DFSORT/ICETOOL 15
No new posts replace word 'MONTH' with current mon... SYNCSORT 11
Search our Forums:

Back to Top