Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Suppress trailing zeroes in CH field and divide by 100

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
zh_lad

New User


Joined: 06 Jun 2009
Posts: 79
Location: UK

PostPosted: Tue Feb 11, 2014 4:59 pm    Post subject: Suppress trailing zeroes in CH field and divide by 100
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Feb 11, 2014 5:28 pm    Post subject: Reply to: Suppress trailing zeroes in CH field and divide by
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

New User


Joined: 06 Jun 2009
Posts: 79
Location: UK

PostPosted: Tue Feb 11, 2014 5:37 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Feb 11, 2014 6:03 pm    Post subject: Reply to: Suppress trailing zeroes in CH field and divide by
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

New User


Joined: 06 Jun 2009
Posts: 79
Location: UK

PostPosted: Tue Feb 11, 2014 7:03 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Feb 11, 2014 8:10 pm    Post subject: Reply to: Suppress trailing zeroes in CH field and divide by
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    Post subject:
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

New User


Joined: 06 Jun 2009
Posts: 79
Location: UK

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

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

New User


Joined: 06 Jun 2009
Posts: 79
Location: UK

PostPosted: Wed Feb 12, 2014 3:16 pm    Post subject:
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    Post subject: Re: Reply to: Suppress trailing zeroes in CH field and divid
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Feb 13, 2014 2:43 pm    Post subject: Reply to: Suppress trailing zeroes in CH field and divide by
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts Amount field is getting corrupted whe... thesumitk SYNCSORT 5 Tue Oct 18, 2016 8:20 pm
No new posts Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us