Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Hexadecimal conversion

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
CICS fan

New User


Joined: 03 Apr 2008
Posts: 82
Location: United States

PostPosted: Mon Dec 21, 2009 12:43 pm    Post subject: Hexadecimal conversion
Reply with quote

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
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Dec 21, 2009 2:22 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Dec 21, 2009 2:25 pm    Post subject:
Reply with quote

What have you done so far? Have you tried searching forum. similar was discussed around month back.
Back to top
View user's profile Send private message
CICS fan

New User


Joined: 03 Apr 2008
Posts: 82
Location: United States

PostPosted: Mon Dec 21, 2009 2:38 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Mon Dec 21, 2009 3:56 pm    Post subject:
Reply with quote

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
View user's profile Send private message
CICS fan

New User


Joined: 03 Apr 2008
Posts: 82
Location: United States

PostPosted: Mon Dec 21, 2009 3:59 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Mon Dec 21, 2009 5:07 pm    Post subject: Reply to: Hexadecimal conversion
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Dec 21, 2009 5:25 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Mon Dec 21, 2009 8:24 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Conversion of a VB file to FB. isssal DFSORT/ICETOOL 1 Mon Oct 31, 2016 10:23 pm
No new posts EBCDIC to ASCII conversion using OCOPY mistah kurtz All Other Mainframe Topics 5 Tue Sep 06, 2016 2:26 pm
No new posts Comparex utility to Syncsort conversion mistah kurtz SYNCSORT 11 Fri Jul 22, 2016 1:53 pm
No new posts changing z/os unicode conversion service meykh2014 All Other Mainframe Topics 0 Tue Jul 12, 2016 10:49 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us