# Want to unpack an 01 A S9(3) comp-3

Author Message
mpriya_r

New User

Joined: 25 Jul 2006
Posts: 6
Location: bangalore

 Posted: Wed May 16, 2007 2:05 pm 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?
William Thompson

Global Moderator

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

Posted: Wed May 16, 2007 3:16 pm

 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?
ramfrom84

New User

Joined: 23 Aug 2006
Posts: 93
Location: chennai

 Posted: Wed May 16, 2007 3:42 pm 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.
mpriya_r

New User

Joined: 25 Jul 2006
Posts: 6
Location: bangalore

 Posted: Wed May 16, 2007 4:01 pm 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)
mpriya_r

New User

Joined: 25 Jul 2006
Posts: 6
Location: bangalore

Posted: Wed May 16, 2007 4:04 pm

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
William Thompson

Global Moderator

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

 Posted: Wed May 16, 2007 4:09 pm How is #3 not giving you that?
ramfrom84

New User

Joined: 23 Aug 2006
Posts: 93
Location: chennai

 Posted: Wed May 16, 2007 4:21 pm 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
mpriya_r

New User

Joined: 25 Jul 2006
Posts: 6
Location: bangalore

 Posted: Wed May 16, 2007 4:50 pm 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)
William Thompson

Global Moderator

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

Posted: Wed May 16, 2007 5:20 pm

 Code: --99
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.
dick scherrer

Moderator Emeritus

Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

 Posted: Wed May 16, 2007 8:06 pm 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.
mpriya_r

New User

Joined: 25 Jul 2006
Posts: 6
Location: bangalore

 Posted: Fri May 18, 2007 2:19 pm Hello dick, Thanx for the suggestion.This is the one I was looking for.Thanks a lot.
dick scherrer

Moderator Emeritus

Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

 Posted: Fri May 18, 2007 7:41 pm You're welcome
 View Bookmarks All times are GMT + 6 Hours

 Topic Forum Replies Similar Topics Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2 Interviewers are surprised with my an... Mainframe Interview Questions 6 Cobol COMP-2 fields getting scrambled... Java & MQSeries 3 convert alphanumeric PIC X(02) to hex... COBOL Programming 3 How to add 2 digits to COMP-3 file? DFSORT/ICETOOL 11
Search our Forums:

 IBMMainframes.com is not an official and/or affiliated with IBM® in anyway Board Rules | FAQ | Downloads | Wiki | SiteMap | Contact Us