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

Zero suppression of a variable declared as Z9(09)


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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
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: 3156
Location: Tucson AZ

PostPosted: Wed Jul 11, 2007 12:51 pm
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Duplicate transid's declared using CEDA CICS 3
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
Search our Forums:

Back to Top