View previous topic :: View next topic
|
Author |
Message |
mpriya_r
New User
Joined: 25 Jul 2006 Posts: 6 Location: bangalore
|
|
|
|
I want to unpack an 01 A S9(3) comp-3
For ex. A holds 01j,after unpacking I must get only-11 and it must apply for 3 digit also(ex.-161).
I tried the following options :
Trail 1 : If I use -99,it works fine for 2 digit numbers hence I get proper value i.e., -11.But this does not work well for 9(3) cases.
Trail 2 : When I use -Z99,result is - 11(ie., - followed by a space and then 11
Trail 3 : When I use --99,result is -11(i.e, a space folowed by -11).Is there a way to pad leading spaces(b4 - sign)?
Guyz, can you tell me if you have other suggestions? |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
mpriya_r wrote: |
Is there a way to pad leading spaces(b4 - sign)? |
Is this the question? #3 gave it to you, what else are you looking for?
Have you tried to digest the section on PICTURE clause editing? |
|
Back to top |
|
|
ramfrom84
New User
Joined: 23 Aug 2006 Posts: 93 Location: chennai
|
|
|
|
Hi,
Can u try giving Like this
Example:
declare as -999 for s9(3) result would be -011
declare as -z99 for s9(3) result would be -11
Since Z(-) would supress zero. |
|
Back to top |
|
|
mpriya_r
New User
Joined: 25 Jul 2006 Posts: 6 Location: bangalore
|
|
|
|
Its true that -z99 gives u -11,but if u notice the result will -(space)11.i.e., a space gets inserted between - and 11.The problem is I need to overcome that space and get it as a whole number i.,e. -11(I can get it fine with pic -99, but I face the problem for 3 digits,say -161) |
|
Back to top |
|
|
mpriya_r
New User
Joined: 25 Jul 2006 Posts: 6 Location: bangalore
|
|
|
|
William Thompson wrote: |
mpriya_r wrote: |
Is there a way to pad leading spaces(b4 - sign)? |
Is this the question? #3 gave it to you, what else are you looking for?
Have you tried to digest the section on PICTURE clause editing? |
I need to get similar results for 3 digits , say, -161 |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
How is #3 not giving you that? |
|
Back to top |
|
|
ramfrom84
New User
Joined: 23 Aug 2006 Posts: 93 Location: chennai
|
|
|
|
I can't understand ur question,
If u defined as s9(3), Then 3 bytes is allocated. So u can get the output as
-(Space)11 , I think there is no way to supress space, Instead of Zero we make it as Space using Edit character, If u supress the space then ur record lenght will vary . It would be better if u give me ur requriment .
Thanks.
Ram |
|
Back to top |
|
|
mpriya_r
New User
Joined: 25 Jul 2006 Posts: 6 Location: bangalore
|
|
|
|
Ok, see I have a variable: A S9(3) comp-3 and now I have to unpack it and get a whole number which does not have any spaces in beween or leading spaces because I need to use it for further processing.
So the pic clause I use must give me -11(if actual digits are 2) or -111(if actual digits are 3) |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Again, your #3,
will produce '-111' and 'b-11' where b is a space. The edit picture is four bytes, something has to occupy the leading byte.
If this isn't what you want, you will have to explain it more clearly. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
What you want is not a standard edited output.
Is there some real reason the output must be left-aligned with one minus sign and no blanks?
If you really have to present the result in this fashion, redefine the output field and move the meaningful data to the left one position and move a space to right-most byte. |
|
Back to top |
|
|
mpriya_r
New User
Joined: 25 Jul 2006 Posts: 6 Location: bangalore
|
|
|
|
Hello dick,
Thanx for the suggestion.This is the one I was looking for.Thanks a lot. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
You're welcome |
|
Back to top |
|
|
|