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

Space in PIC ZZ.99


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
chhabraravneet

New User


Joined: 04 Oct 2007
Posts: 49
Location: Mumbai

PostPosted: Thu Apr 02, 2009 4:24 pm
Reply with quote

Hi,

Refer the lines:

FILLER PIC X '('
S1-Amount PIC ZZ.99
FILLER PIC X ')'


My value is 5.99. i want to display (5.99) , but it is coming ( 5.99). A space is coming after the opening bracket.

Can anybody please suggest how can i do this directy using the PIC clause or the simplest way?
Back to top
View user's profile Send private message
himanshu7

Active User


Joined: 28 Aug 2007
Posts: 131
Location: At Desk

PostPosted: Thu Apr 02, 2009 4:44 pm
Reply with quote

This is because you are using ZZ which is zero supressing.


Plz try with z.99 if your value will always be 9.99.
Back to top
View user's profile Send private message
chhabraravneet

New User


Joined: 04 Oct 2007
Posts: 49
Location: Mumbai

PostPosted: Thu Apr 02, 2009 5:22 pm
Reply with quote

Thanks Rajveer for your suggestion.

But i cannot use Z.99 because the value can also be greater than 9.
I just wanted to know that whether in Zero suppression, is there any way that solve my purpose i.e. i want (5.99)...

Hope you understand what want to say......

Thanks once again...

Your suggestion are always welcome.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Thu Apr 02, 2009 5:27 pm
Reply with quote

You'll need to use REDEFINES to define the field as (Z.99) if less than 10 and (ZZ.99) if greater than 10.
Back to top
View user's profile Send private message
chhabraravneet

New User


Joined: 04 Oct 2007
Posts: 49
Location: Mumbai

PostPosted: Thu Apr 02, 2009 5:42 pm
Reply with quote

k....
I also thought the same way......means there is no way we can change using the PIC clause...
We have to use REDIFINES...and in the code we have to write the logic for it.

Am i Correct?????
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Thu Apr 02, 2009 5:54 pm
Reply with quote

Yes ... if you define the PIC as ZZ.99 it has 5 bytes and that cannot be changed dynamically. You'll have to use REDEFINES and code for which variable to use.
Back to top
View user's profile Send private message
rkyzhu

New User


Joined: 08 Feb 2009
Posts: 1
Location: shanghai of china

PostPosted: Thu Apr 02, 2009 6:01 pm
Reply with quote

the easiest way is to define two fields:
FILLER PIC X '('
S1-Amount PIC ZZ.99
FILLER PIC X ')'

and

FILLER PIC X '('
S1-Amount PIC Z.99
FILLER PIC X ')'


then evaluate which one will be used in your program
Back to top
View user's profile Send private message
chhabraravneet

New User


Joined: 04 Oct 2007
Posts: 49
Location: Mumbai

PostPosted: Thu Apr 02, 2009 7:22 pm
Reply with quote

Thanks all for your valuable suggesstion.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Apr 03, 2009 2:55 pm
Reply with quote

Hi,

If you share the final solution used, it might help others, Thanks.

Ad
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts Merge 2 lines based on Space from a S... DFSORT/ICETOOL 5
No new posts Allocated space calculation from DCOL... PL/I & Assembler 3
No new posts split a name based on space in ASM PL/I & Assembler 9
No new posts Adding space to a dataset - getting D37 ABENDS & Debugging 10
Search our Forums:

Back to Top