Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Zero suppression of a variable declared as Z9(09)

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
lekshmi_ci

New User


Joined: 14 Mar 2007
Posts: 60
Location: Thiruvananthapuram

PostPosted: Wed Jul 11, 2007 12:05 pm    Post subject: Zero suppression of a variable declared as Z9(09)
Reply with quote

Hi,

My working storage contains a variable ws-aaa pic 9(09).
The value coming is 000000412. i would like to supress the zeroes and make it 412.
I have declared Z9(09). Will this work?
Please reply

LC
Back to top
View user's profile Send private message

sandeep1dimri

New User


Joined: 30 Oct 2006
Posts: 76

PostPosted: Wed Jul 11, 2007 12:10 pm    Post subject:
Reply with quote

hi plse try with
Z(8)9 so that u can have zero when data is 000000000

or if u dont need zero in upper case use
z(9)

sandeep
Back to top
View user's profile Send private message
lekshmi_ci

New User


Joined: 14 Mar 2007
Posts: 60
Location: Thiruvananthapuram

PostPosted: Wed Jul 11, 2007 12:10 pm    Post subject:
Reply with quote

I declared zzzzzzzz9. It worked. But is this the only way.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Wed Jul 11, 2007 12:51 pm    Post subject:
Reply with quote

For your original example of 000000412 to 412, Z(6)999, Z(7)99, Z(8)9 & Z(9) will work. Which one you use depends on what you want to see when the field contains only zero: 000, 00, 0 or just spaces.....
Back to top
View user's profile Send private message
ParagChouguley

Active User


Joined: 03 Feb 2007
Posts: 175
Location: PUNE(INDIA)

PostPosted: Wed Jul 11, 2007 1:39 pm    Post subject:
Reply with quote

Yes, this is the best way.
There are other ways to display sign of amount (+/-), or $ sign or * sign etc. But only for zero suppression, this one is best.

--Parag
Back to top
View user's profile Send private message
nagasri83

New User


Joined: 20 May 2005
Posts: 15
Location: chennai

PostPosted: Thu Jul 12, 2007 5:18 am    Post subject:
Reply with quote

Quote:

My working storage contains a variable ws-aaa pic 9(09).
The value coming is 000000412. i would like to supress the zeroes and make it 412.
I have declared Z9(09). Will this work?
Please reply


From the above coding, you will not get the expected result. You have declared as Z9(09) which means Z999999999. So only 0 in the 10th place will get suppressed.

Declaration can be done depending on the requirement. To get the expected result in your example, following way of declation will do

Z(06)9(03) or Z(06)999 --> ZZZZZZ999
Z(07)9(02) or Z(07)99 --> ZZZZZZZ99
Z(08)9(01) or Z(08)9 --> ZZZZZZZZ9
Z(09) --> ZZZZZZZZZ

Hope you understood the concept.
Back to top
View user's profile Send private message
ram prasad

New User


Joined: 28 May 2007
Posts: 17
Location: india

PostPosted: Thu Jul 12, 2007 4:07 pm    Post subject:
Reply with quote

use Z(8)9 it gives perfect result, when 000000000 it gives 0 only
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Move from Comp3 variable to Edited Va... sreekusr COBOL Programming 8 Thu Aug 10, 2017 4:20 pm
No new posts Can I traverse a STEM variable? chong.zhou CLIST & REXX 5 Wed May 31, 2017 3:54 pm
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us