IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Suppress trailing zeroes in CH field and divide by 100


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
zh_lad

Active User


Joined: 06 Jun 2009
Posts: 115
Location: UK

PostPosted: Tue Feb 11, 2014 4:59 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Feb 11, 2014 5:28 pm
Reply with quote

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
View user's profile Send private message
zh_lad

Active User


Joined: 06 Jun 2009
Posts: 115
Location: UK

PostPosted: Tue Feb 11, 2014 5:37 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Feb 11, 2014 6:03 pm
Reply with quote

Have a look at JFY and SQZ, and use which is most suitable to your output.
Back to top
View user's profile Send private message
zh_lad

Active User


Joined: 06 Jun 2009
Posts: 115
Location: UK

PostPosted: Tue Feb 11, 2014 7:03 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Feb 11, 2014 8:10 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Feb 11, 2014 11:13 pm
Reply with quote

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
View user's profile Send private message
zh_lad

Active User


Joined: 06 Jun 2009
Posts: 115
Location: UK

PostPosted: Wed Feb 12, 2014 2:44 pm
Reply with quote

Thanks Skolusu. It worked. Excellent!
Back to top
View user's profile Send private message
zh_lad

Active User


Joined: 06 Jun 2009
Posts: 115
Location: UK

PostPosted: Wed Feb 12, 2014 3:16 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Feb 12, 2014 11:51 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Feb 13, 2014 2:43 pm
Reply with quote

No, you've not missed anything. I got the mistaken idea that the input was 10 digits,
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Remove leading zeroes SYNCSORT 4
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts S0C7 - Field getting overlayed COBOL Programming 2
Search our Forums:

Back to Top