View previous topic :: View next topic
Author
Message
zh_lad Active User Joined: 06 Jun 2009Posts: 115 Location: UK
Hi,
I have amount filed in CH format.
position 77, length 12, format CH
Code:
----8----+---
000000030101
How can I output this as 301.01 using (OUTREC, EDIT etc).
I tried to use below to suppress trailing zeroes:
Code:
OUTREC FIELDS=(5,16,C',',27,23,C',',77,12,CH,EDIT=(IIIIIIIIITTT))
But it gave syntax error:
Code:
OUTREC FIELDS=(5,16,C',',27,23,C',',77,12,CH,EDIT=(IIIIIIIIITTT))
£
ICE007A E SYNTAX ERROR
Can you please guide where my solution lies?
Thanks,
zh_lad
Back to top
Bill Woodger Moderator Emeritus Joined: 09 Mar 2011Posts: 7309 Location: Inside the Matrix
Use FS (or ZD) instead of CH.
Use BUILD instead of FIELDS.
No, BUILD is the same as FIELDS, but BUILD is not "overloaded", to answer your next question.
Back to top
zh_lad Active User Joined: 06 Jun 2009Posts: 115 Location: UK
Many thanks. It worked.
Code:
OUTREC BUILD=(5,16,C',',27,23,C',',77,12,ZD,EDIT=(IIIIIIIIIT.TT))
Output:
Code:
----+----1----+----2----+----3----+----4----+----5----
4622940011222228,74302973176060000148817, 301.01
Can I ask how can I suppress spaces as well to have output like:
Code:
4622940011222228,74302973176060000148817,301.01
Thanks.
Back to top
Bill Woodger Moderator Emeritus Joined: 09 Mar 2011Posts: 7309 Location: Inside the Matrix
Have a look at JFY and SQZ, and use which is most suitable to your output.
Back to top
zh_lad Active User Joined: 06 Jun 2009Posts: 115 Location: UK
Thanks. I have tried but its giving syntax error for JFY:
Code:
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 13:25 ON TUE FE
SORT FIELDS=COPY
INCLUDE COND=(1,4,CH,EQ,C'0500',&,5,6,CH,EQ,C'462294')
OUTREC BUILD=(5,16,C',',27,23,C',',
77,12,ZD,EDIT=(IIIIIIIIIT.TT),JFY=(SHIFT=LEFT))
£
ICE007A E SYNTAX ERROR
ICE751I 0 C5-K76982 C6-K90026 C7-K82419 C8-K67572 E7-K79990
Please advice.
Back to top
Bill Woodger Moderator Emeritus Joined: 09 Mar 2011Posts: 7309 Location: Inside the Matrix
JFY/SQZ are like this: p,m,JFY/SQZ.
Easiest may be to use IFTHEN=(WHEN=INIT for your BUILD, and then a second IFTHEN=(WHEN=INIT for a OVERLAY to do the JFY (specifying just the, fixed, position of your field).
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
try this
Code:
//SYSIN DD *
OPTION COPY
INCLUDE COND=(1,9,CH,EQ,C'0500462294')
INREC BUILD=(5,16,C',',27,23,C',',77,10,UFF,M10,LENGTH=10,X,87,2)
OUTREC OVERLAY=(42:42,13,SQZ=(SHIFT=LEFT,MID=C'.'))
//*
Back to top
zh_lad Active User Joined: 06 Jun 2009Posts: 115 Location: UK
Thanks Skolusu. It worked. Excellent!
Back to top
zh_lad Active User Joined: 06 Jun 2009Posts: 115 Location: UK
Code:
INREC BUILD=(5,16,C',',27,23,C',',77,10,UFF,M10,LENGTH=10,X,87,2)
This has created below record:
Code:
----+----1----+----2----+----3----+----4----+----5----
4622940011222228,74302973176060000148817, 301 01
You have splitted absolute and decimal parts. I was not aware of data type UFF.
Code:
OUTREC OVERLAY=(42:42,13,SQZ=(SHIFT=LEFT,MID=C'.'))
Later, you have overlaid the record at starting poisition (42) with SQZ SHIFT LEFT and also inserted a decimal using MID.
Code:
4622940011222228,74302973176060000148817,301.01
I have learnt few new things today. Thanks.
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
Bill Woodger wrote:
So test it. Make sure your code gives what you expect with values ending 099, 009 for instance.
Bill,
I may be missing something here , why do you think the values ending with 099 or 009 would make a difference? M10 Edit mask will put a 0 if the value is zero. The decimals are coded as is, so I am not sure what the issue is. The only issue I see if the value is a negative as we would ignore the sign.
Back to top
Bill Woodger Moderator Emeritus Joined: 09 Mar 2011Posts: 7309 Location: Inside the Matrix
No, you've not missed anything. I got the mistaken idea that the input was 10 digits,
Back to top
Please enable JavaScript!