Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
mpriya_r

New User

Joined: 25 Jul 2006
Posts: 6
Location: bangalore

 Posted: Wed May 16, 2007 2:05 pm    Post subject: Want to unpack an 01 A S9(3) comp-3 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: 3158
Location: Tucson AZ

Posted: Wed May 16, 2007 3:16 pm    Post subject: Re: Unpacking COMP-3

 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    Post subject: Re: Unpacking COMP-3 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    Post subject: 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    Post subject: Re: Unpacking COMP-3

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: 3158
Location: Tucson AZ

 Posted: Wed May 16, 2007 4:09 pm    Post subject: 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    Post subject: Re: Unpacking COMP-3 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    Post subject: 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: 3158
Location: Tucson AZ

Posted: Wed May 16, 2007 5:20 pm    Post subject:

 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

Site Director

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

 Posted: Wed May 16, 2007 8:06 pm    Post subject: 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    Post subject: Hello dick, Thanx for the suggestion.This is the one I was looking for.Thanks a lot.
dick scherrer

Site Director

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

 Posted: Fri May 18, 2007 7:41 pm    Post subject: You're welcome
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics COMP Variables Mismatch gayu7 COBOL Programming 5 Wed Dec 20, 2017 5:06 pm Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm CONDITIONAL USING COMP-2 WITH PROBLEMS. JOSUEGENTIL COBOL Programming 7 Wed Nov 08, 2017 11:13 pm how can i move s9(9) to s9(9) usage comp HARENDRA CHOUDHARY COBOL Programming 3 Mon Nov 06, 2017 12:10 am SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us