View previous topic :: View next topic
|
Author |
Message |
purusothaman
New User
Joined: 17 Feb 2007 Posts: 39 Location: Chennai
|
|
|
|
Hi all,
Hope all are doing good and (belated) Happy New Year to all.
I have the following sample input.
bytes: 1-9
Code: |
----------
123456789
1234567
12345678
---------- |
I am looking for the below output, where zeros are appending in the front if the length is not equal to 9.
bytes: 1-11
Code: |
-----------
123-45-6789
001-23-4567
012-34-5678
----------- |
I tried the below code:
Code: |
INREC BUILD=(1,9,ZD,EDIT=(TTTTTTTTT)) |
But I could see that zeros are appended only the end as below.
bytes: 1-11
Code: |
-----------
123-45-6789
123-45-6700
123-45-6780
----------- |
|
|
Back to top |
|
|
hailashwin
New User
Joined: 16 Oct 2008 Posts: 74 Location: Boston
|
|
|
|
Please try this
Code: |
OPTION COPY
INREC IFTHEN=(WHEN=(1,3,CH,NE,C'---'),
BUILD=(1,9,SQZ=(SHIFT=RIGHT)))
OUTREC FINDREP=(INOUT=(C' ',C'0'))
OUTFIL FILES=OUT,BUILD=(1,3,C'-',4,2,C'-',6,4)
|
|
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
purusothaman,
Use the following DFSORT JCL which will give you the desired results
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
123456789
1234567
12345678
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC OVERLAY=(1,9,UFF,EDIT=(TTT-TT-TTTT))
/* |
The output is
Code: |
123-45-6789
001-23-4567
012-34-5678
|
|
|
Back to top |
|
|
hailashwin
New User
Joined: 16 Oct 2008 Posts: 74 Location: Boston
|
|
|
|
Wasn't the 'Hyphed' line appearing as the header and trailer also part of the requirement? Please correct my understanding.. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
hailashwin wrote: |
Wasn't the 'Hyphed' line appearing as the header and trailer also part of the requirement? Please correct my understanding.. |
Ashwin,
I don't think so. It is just to show the top of the data line and Bottom of data lines.
Even if they are indeed actual data line , UFF will translate them to zeroes. |
|
Back to top |
|
|
purusothaman
New User
Joined: 17 Feb 2007 Posts: 39 Location: Chennai
|
|
|
|
Dear Ashwin,
The hypens are not part of data. As Kolusu mentioned, it was used to show the boundary of the data.
Kolusu,
Thanks a lot. I will try this one and let you know the result. |
|
Back to top |
|
|
hailashwin
New User
Joined: 16 Oct 2008 Posts: 74 Location: Boston
|
|
|
|
I have indeed made it look complicated then..
Thanks Kolusu and purusothaman. |
|
Back to top |
|
|
|