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 -> JCL & VSAM
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 10:55 am
Reply with quote

Hi all,

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:

Code:
----+----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:

Code:
000001111111111aaaaaaaaa      bbbbb           000000000022222000000012345678

I am running on SYNCSORT FOR Z/OS 1.3.0.2R.

Thanks!
Rashmi

Edited: Please use BBcode when You post some code/error, that's rather readable, Thanks... Anuj
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

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

rashmi123 wrote:
the first, third?? and fourth fields contain numeric values whereas the second and third contain alphabetic values.

From the sample data you posted, I assumed the numeric fields as 1st,4th, and 5th fields. You can use the below SyncSort job to achieve this. Good luck
Code:
//STEP1    EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+
1111111111     aaaaaaaaa      bbbbb          22222          12345678
444            aaaaaaaaa      bbbbb          664            12     
5              aaaaaaaaa      bbbbb          9              6666   
//SYSOUT   DD SYSOUT=*                                             
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                     
  OPTION COPY                                                       
  INREC OVERLAY=(01:01,15,UFF,ZD,LENGTH=15,                         
                 46:46,15,UFF,ZD,LENGTH=15,                         
                 61:61,15,UFF,ZD,LENGTH=15)
SORTOUT
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+
000001111111111aaaaaaaaa      bbbbb          000000000022222000000012345678
000000000000444aaaaaaaaa      bbbbb          000000000000664000000000000012
000000000000005aaaaaaaaa      bbbbb          000000000000009000000000006666
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:29 pm
Reply with quote

Thanks...it worked!
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Feb 11, 2009 11:18 am
Reply with quote

Quote:
third??
Congratulations Arun - You are getting Intuitive..!
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Feb 11, 2009 1:00 pm
Reply with quote

Thanks Anuj icon_smile.gif
Back to top
View user's profile Send private message
Ajay Baghel

Active User


Joined: 25 Apr 2007
Posts: 206
Location: Bangalore

PostPosted: Wed Feb 11, 2009 8:39 pm
Reply with quote

hi Arun,

Can you please expalin about UFF data format? why did you not use CH?

Thanks,
Ajay
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
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
No new posts Cobol COMP-2 fields getting scrambled... Java & MQSeries 6
Search our Forums:

Back to Top