View previous topic :: View next topic
|
Author |
Message |
Samantha Chelikani
New User
Joined: 11 Apr 2007 Posts: 10 Location: India
|
|
|
|
My input field is declared as 9(13)V9(3). Is there a possibility to convert this to a S9(13).9(5) field using the outrec statement (Product in use is Syncsort).
The input field is at offset 95 and the output field offset is 120.
Also, we are moving it to a signed variable only for consistency with someother file with which we would be merging this output file. But the input file value will always be positive.
So I could think of the below approach
Code: |
OUTREC FIELDS=(120:C' ',
121:95,13,
133:C'.',
134:108,3,
137:C'00')
|
But i feel the above is too crude and just wanted to know if there is a better way to achieve this. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Code: |
//*******************************************************
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
1234567890123123
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(20:10,16,ZD,EDIT=(STTTTTTTTTTTTT.TTT),SIGNS=(,))
/*
|
SORTOUT
|
|
Back to top |
|
|
Samantha Chelikani
New User
Joined: 11 Apr 2007 Posts: 10 Location: India
|
|
|
|
Hi Krisprems,
Thanks a lot.
But if the input is
I need the output as (Yes i need the zeroes at the end)
Code: |
1234567890123.12300
|
Also, if the input is
I need the output as
Code: |
0000067890123.12300
|
Can this be done?
Sorry for not making this clear in the first post. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Code: |
//*******************************************************
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
1234567890123123
0000067890123123
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(20:10,16,ZD,EDIT=(STTTTTTTTTTTTT.TTT),SIGNS=(,),C'000')
/*
|
SORTOUT
Code: |
1234567890123.123000
0000067890123.123000
|
|
|
Back to top |
|
|
Samantha Chelikani
New User
Joined: 11 Apr 2007 Posts: 10 Location: India
|
|
|
|
Thanks Krisprems... It worked....
I wanted only 5 digits after the decimal so i replaced
with
|
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Samantha Chelikani
Good that you found it yourself |
|
Back to top |
|
|
Samantha Chelikani
New User
Joined: 11 Apr 2007 Posts: 10 Location: India
|
|
|
|
hmm.... well i thought i'd b considered reaaallly dumb if i couldnt figure atleast that out |
|
Back to top |
|
|
Samantha Chelikani
New User
Joined: 11 Apr 2007 Posts: 10 Location: India
|
|
|
|
hi,
My requirement has now changed and they are going to send me the input field as S9(13)V999 COMP-3. I need to change this to S9(13).9(5). Can you please suggest me an outrec statement to achieve this. |
|
Back to top |
|
|
Ajay Baghel
Active User
Joined: 25 Apr 2007 Posts: 206 Location: Bangalore
|
|
|
|
Hi Samantha,
It requires a small modification to previous code. ZD needs to be replaced by PD and byte length will change to 9. S9(13)V999 COMP-3 requires 9 bytes.
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=....
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(20:Startcol,9,PD,
EDIT=(STTTTTTTTTTTTT.TTT),SIGNS=(,),C'00')
/*
Let me know if it works.....
-Ajay |
|
Back to top |
|
|
|