Page 1 of 1

Amount field to make it to right align from left align

PostPosted: Mon Jan 17, 2011 2:40 pm
by learner123
Hi,

-3----+----4----+----
1000.0000000000
150.0000000000
550.0000000000
1000.0000000000
300.0000000000
350.0000000000
350.0000000000
1200.0000000000
-100.0000000000

My requirement is that all my amount fields are left aligned and i have to make them right aligned, how to do this using jcl sort. The amount fields are from 29th to 49th bytes (total 21 bytes).

Let me know if anybody has idea on this.

Re: Amount field to make it to right align from left align

PostPosted: Mon Jan 17, 2011 10:05 pm
by Alissa Margulies
Here is an example that may help you:
//SORT  EXEC PGM=SORT 
//SYSOUT  DD SYSOUT=* 
//SORTIN  DD * 
1000.0000000000
150.0000000000
550.0000000000
1000.0000000000
300.0000000000
350.0000000000
350.0000000000
1200.0000000000
-100.0000000000   
//SORTOUT DD SYSOUT=* 
//SYSIN   DD *                 
  INREC BUILD=(1,15,JFY=(SHIFT=RIGHT))
  SORT FIELDS=COPY 
/*

If your input file is FB/80, then you should simply be able to modify the OUTREC statement as follows:
INREC BUILD=(1,28,29,21,JFY=(SHIFT=RIGHT),50,31)