Data alignment



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Data alignment

Postby jvinoth » Mon Apr 23, 2012 2:48 pm

Hi i need to align my fileds from left to right alignment,

Please tell me how to do that

my unload sort card

SELECT A.UN_NO,               CHAR('|'),         
 A.ID_NO,                      CHAR('|'),         
 B.LST_NM,                     CHAR('|'),         
 SUBSTR(CHAR(COUNT(*)),1,3),   CHAR('|')         
 FROM table1 a , table2 b           
 WITH UR;

and the formatting sort card


    SORT FIELDS=COPY                             
    OUTREC FIELDS=(01:01,08,09:09,08,17:17,17,   
          34:34,3)

in this the position i need to change is that 34:34,3



output data

0004000|000000.|............    |8 
0004000|000000.|............    |82
0004000|000000.|............    |823
0004000|000000.|............    |8
0004000|000000.|............    |564
0004000|000000.|............    |5



thanks
jvinoth
 
Posts: 132
Joined: Fri Nov 18, 2011 3:13 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Data alignment

Postby BillyBoyo » Mon Apr 23, 2012 3:19 pm

You could try applying this:

//EDITNUM  EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTOUT  DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  INREC OVERLAY(1:1,3,UFF,EDIT=(TTT))
//SORTIN DD *
1
12
123


Gives:

001
012
123


OUTREC FIELDS=(01:01,08,09:09,08,17:17,17,   
          34:34,3)


The above is much easier to follow as:

OUTREC FIELDS=(01:01,08,09,08,17,17,   
          34,3)


Other than the first column number, all the column numbers you are specifying at at the point where the next data would go anyway, so are not needed, are confusing if used because not needed, are more difficult to read, and introduce another element of potential error through typo.

Taking them all out, you realise more easily that you are just copying the data that is already there to the same positions.

OUTREC FIELDS=(34:34,3,UFF,EDIT=(TTT))


is probably all you need.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Data alignment

Postby jvinoth » Mon Apr 23, 2012 5:25 pm

thank you so much billy for your quik reply
jvinoth
 
Posts: 132
Joined: Fri Nov 18, 2011 3:13 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Data alignment

Postby BillyBoyo » Mon Apr 23, 2012 11:33 pm

Jeepers. Just noticed you have FIELDS. From all the columns I just thought it was an OVERLAY. There we go.

You probably want to use OVERLAY instead of the FIELDS for this anyway, but the FIELDS= I gave will not give you what you want. As far as I understand it, FIELDS and BUILD are the same in this context. If you just want to change part of the data you have, OVERLAY will do that without having to be concerned about the other data on the record.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post