View previous topic :: View next topic
|
Author |
Message |
CICS fan
New User
Joined: 03 Apr 2008 Posts: 82 Location: United States
|
|
|
|
I have a input field PIC X(3) with hexadecimal values like X'256A40'.
The requirement is to have it noutput as PIC X(7) where the value will be 2452032. The input can be any hexadecimal value and this is just one example.
Please suggest the shortest possible code in cobol. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
what you are talking about is Binary to Decimal conversion.
now that you have the correct terms, you can research in the manuals (Application programmers guide).
By the way:
Pic x(03) can contain up to and including x'FFFFFF', which is decimal 16777215 or PIC x(08).
So if you want your display to be as inaccurate as your description, leave it at Pic x(07). |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
What have you done so far? Have you tried searching forum. similar was discussed around month back. |
|
Back to top |
|
|
CICS fan
New User
Joined: 03 Apr 2008 Posts: 82 Location: United States
|
|
|
|
Binary and hex are the same in this case? I mean the inputis defined as X(3), but binary is numeric right? I am sorry if I have asked something stupid.
But I would be very thankful if someone can give me the solution. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Binary is base two. Hex (hexadecimal) groups 4 binary digits together to create base 16 values, primarily to reduce the length of the data representations (sets of 32 1's and 0's -- or sets of 64 -- are hard to read, hard to interpret, and easy to get messed up).
Quote: |
But I would be very thankful if someone can give me the solution. |
This is a HELP forum, not a DO-YOUR-JOB-FOR-YOU forum. However, there are a number of people willing to provide you a solution should you pay them the appropriate fee. |
|
Back to top |
|
|
CICS fan
New User
Joined: 03 Apr 2008 Posts: 82 Location: United States
|
|
|
|
didnt mean to offend anyone, just was trying to see if someone can direct me to the solution. I could not understand it yet |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Being that your name suggests interest in CICS, how could you convert EIBCALEN (two-bytes binary) to display-numeric, so that it can be viewed in readable format?
Bill |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
CICS fan,
one way, which has been repeatedly provided as a solution in other threads,
is to define a binary field so that it can be redefined with elementary elements of pic x(01) value low values and a pic x(03).
move your pic x(03) to the elementary element, move the Binary defined field to a display numeric. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
When you think of Binary numeric values, think of COMPutational "PICtures". . .
Also, at the top of the page is a link to "IBM Manuals". The first group is for COBOL. In the Language Reference is a comprehensive explanatoin of numeric data formats.
Those manuals are among your best resources and are both free and always available (especially if you download them to your local environment periodically). |
|
Back to top |
|
|
|