View previous topic :: View next topic
|
Author |
Message |
chhabraravneet
New User
Joined: 04 Oct 2007 Posts: 49 Location: Mumbai
|
|
|
|
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 |
|
|
himanshu7
Active User
Joined: 28 Aug 2007 Posts: 131 Location: At Desk
|
|
|
|
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 |
|
|
chhabraravneet
New User
Joined: 04 Oct 2007 Posts: 49 Location: Mumbai
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
chhabraravneet
New User
Joined: 04 Oct 2007 Posts: 49 Location: Mumbai
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
rkyzhu
New User
Joined: 08 Feb 2009 Posts: 1 Location: shanghai of china
|
|
|
|
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 |
|
|
chhabraravneet
New User
Joined: 04 Oct 2007 Posts: 49 Location: Mumbai
|
|
|
|
Thanks all for your valuable suggesstion. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hi,
If you share the final solution used, it might help others, Thanks.
Ad |
|
Back to top |
|
|
|