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
 

 

Right justifying and adjusting numeric fields

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Right justifying and adjusting numeric fields
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: 2237
Location: @my desk

PostPosted: Tue Feb 10, 2009 8:31 pm    Post subject:
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    Post subject: Reply to: Right justifying and adjusting numeric fields
Reply with quote

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

Senior Member


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

PostPosted: Wed Feb 11, 2009 11:18 am    Post subject:
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: 2237
Location: @my desk

PostPosted: Wed Feb 11, 2009 1:00 pm    Post subject:
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: 205
Location: Bangalore

PostPosted: Wed Feb 11, 2009 8:39 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm
No new posts Sort two file having same field, one ... himanshu malik DFSORT/ICETOOL 7 Thu Feb 02, 2017 10:09 am
No new posts SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 7 Sat Jan 21, 2017 4:02 am
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am


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