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

Author Message
ziddiguy

New User

Joined: 20 Jul 2007
Posts: 14
Location: Germany

 Posted: Tue Oct 04, 2011 6:07 am    Post subject: Display 1123.34 as 00112324 Hi, Variable A is Pic9(4)V9(2) Value 1123.34 Variable B is Pic9(8) Need to move the conents of A to B I want the leading zeros so output B should look like 00112324 thanks for help

Robert Sample

Global Moderator

Joined: 06 Jun 2008
Posts: 8152
Location: East Dubuque, Illinois, USA

 Posted: Tue Oct 04, 2011 7:30 am    Post subject: This is a simple question, easily answered in the manuals for which there is a link at the top of the page. So why do you expect us to read the manual for you? And a simple move will not change 1123.34 to 00112324, no matter what you do -- 3 does not change to 2 just from a move.
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7315

 Posted: Tue Oct 04, 2011 11:48 am    Post subject: You have been on this forum since 2007. You are a "Software Analyst". It is diffiult to believe how much confusion you got into one short post. In any Cobol Picture with a "V", the decimal-point is implied only. There is no actual decimal-point in your field. Any plain Cobol Picture with "9"s will have leading zeros for all those leading 9s that do not contain 1-9. Look in the manuals for how to use REDEFINES. Then either redefine the first without the implied decimal-point, or the second with the implied decimal-point. Do a MOVE. From the first to the second. Job done. I even suspect the whole lot is unnecessary, because you don't understand the definitions anyway and won't really know if you need it or not. And note Robert's point. Next time, consult manuals/colleagues - even your old training materials in this case - before posting. You got an answer so that any failure to understand the simplicity of the question is kept away from here.
ziddiguy

New User

Joined: 20 Jul 2007
Posts: 14
Location: Germany

 Posted: Tue Oct 04, 2011 3:11 pm    Post subject: Reply to: Display 1123.34 as 00112324 Thanks for your reply, Yes I did check manual. May be i have asked the question wrongly. Variable A can have value as 11.22 or 1111.22 or 111.33 so I can not just simply Move using Redefines as one way is to find the length of record using INSPECT but I am wondering if there is any way to accompolish above task using INSPECT REPLACING or something. Because to remove the leading zeros looks simple but in adding leading zeros I am finding complicated Many Thanks for your replies
dbzTHEdinosauer

Global Moderator

Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

 Posted: Tue Oct 04, 2011 3:34 pm    Post subject: you are never going to be able to suppress leading zeroes in a numeric field. check the manual again, only this time read it.
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7315

 Posted: Tue Oct 04, 2011 4:12 pm    Post subject: Reply to: Display 1123.34 as 00112324 With the definitons that you posted, you do not have a physical decimal point and you do have at least two leading zeros in the field which is bigger, if you do a move. OK, so you could get a "." into the field, but what use would it be? Have done with it. If you think you have a "." in there, just use NUMVAL (intrinsic function).
dick scherrer

Site Director

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

Posted: Tue Oct 04, 2011 8:33 pm    Post subject:

Hello,

 Quote: Variable A can have value as 11.22 or 1111.22 or 111.33
Why do you believe this? As defined, the field CANNOT contain an actual decimal point. It contains only an implied decimal point.

If you have an actual decimal point in a field, it cannot be defined as you have variableA.

Once we know what you are really working with, we whould be able to make more useful suggestons.
mmwife

Super Moderator

Joined: 30 May 2003
Posts: 1592

Posted: Thu Oct 13, 2011 6:55 am    Post subject: Reply to: Display 1123.34 as 00112324

Hi ziddiguy,

Using the PICs of your original post, the following should work:
 Quote: A PIC 9(4)V99. B PIC 9(8). MOVE ZEROS TO B MOVE A(1:6) TO B(3:6)

I haven't tested it; no M/F access.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Binary to display characters Roy Ware SYNCSORT 3 Tue Sep 19, 2017 8:46 pm DB2 NULL Values display V S Amarendra Reddy DB2 3 Thu Sep 07, 2017 6:59 pm Suppress value reported by BREAK in D... Learncoholic DFSORT/ICETOOL 3 Wed Aug 16, 2017 6:03 pm Display upon console bipinpeter COBOL Programming 1 Thu Jun 22, 2017 12:35 am Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm

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