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

Right justifying and adjusting numeric fields


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

New User


Joined: 04 Jun 2007
Posts: 25
Location: Pune

PostPosted: Tue Feb 10, 2009 8:00 pm
Reply with quote

Hi Frank,

I have a flat file, 75 bytes in length.
The file contains 5 fields each 15 bytes in length, the first, third and fourth fields contain numeric values whereas the second and third contain alphabetic values. Each field is left justified with padded spaces in case the value of that field is less than the whole 15 bytes.
Following is a sample record:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+
1111111111 aaaaaaaaa bbbbb 22222 12345678

My requirement is right justify the numeric fields with leading zeroes and retain the alphabetic fields as they are.

I want my output formatted in the following way:

000001111111111aaaaaaaaa bbbbb 000000000022222000000012345678

Thanks!
R
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: Tue Feb 10, 2009 10:16 pm
Reply with quote

You can use a DFSORT job like the following to do what you asked for:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
1111111111     aaaaaaaaa      bbbbb          22222            12345678
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC OVERLAY=(1:1,15,UFF,M11,LENGTH=15,
    46:46,15,UFF,M11,LENGTH=15,
    61:61,15,UFF,M11,LENGTH=15)
/*
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Feb 10, 2009 11:05 pm
Reply with quote

Rashmi,
Did your shop trade in Syncsort for DFSORT?
Back to top
View user's profile Send private message
rashmi123

New User


Joined: 04 Jun 2007
Posts: 25
Location: Pune

PostPosted: Tue Feb 10, 2009 11:15 pm
Reply with quote

THanks Frank!
And ya no such luck...we still have Syncsort was just wondering how it can be done using DFSort

Thanks!
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Feb 10, 2009 11:21 pm
Reply with quote

rashmi123 wrote:
we still have Syncsort was just wondering how it can be done using DFSort
Does it have OVERLAY?
Back to top
View user's profile Send private message
rashmi123

New User


Joined: 04 Jun 2007
Posts: 25
Location: Pune

PostPosted: Tue Feb 10, 2009 11:27 pm
Reply with quote

Thankfully it does...and it works too!!!
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 Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Quantifying/Justifying CPU savings All Other Mainframe Topics 2
No new posts Convert HEX to Numeric DB2 3
No new posts Find a record count/numeric is multip... COBOL Programming 1
No new posts Concatenate 2 fields (usage national)... COBOL Programming 2
Search our Forums:

Back to Top