Hexadecimal Text to Alphanumeric problem



Unicenter CA-Easytrieve Plus Report Generator: CA's information retrieval and data management tool

Hexadecimal Text to Alphanumeric problem

Postby Zemyree42 » Wed Nov 09, 2016 8:55 am

I have a flatfile input that has several fields which I should reformat.
For instance, a packed decimal which consumes 7 bytes(the input is numeric) must be transformed into a 15-byte alphanumeric with a sign and decimal point, etc.
At this point there is no issue because the input can be declared as packed decimal, store it in a numeric field and then pass it to a alphanumeric field including the sign and decimal point. Let me state it as a Hexadecimal Number.
The problem is I have a certain char input field, for example a period(.) and I need to extract its hexadecimal value, 2E.
Basically, if the input is period, the output should be 2E. Let me call it Hexadecimal Text.

The input cannot be declared as packed decimal as it will abend, it worked if I declare it as binary to alphanumeric but I am getting its decimal value, which in this example is 46.
Is there a way I can convert a Hexadecimal Text to alphanumeric?

P.S. I know there are ways to do this in other languages but I need to do it in Easytrieve only.
Zemyree42
 
Posts: 2
Joined: Tue Nov 08, 2016 3:43 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Hexadecimal Text to Alphanumeric problem

Postby Robert Sample » Wed Nov 09, 2016 9:08 am

The problem is I have a certain char input field, for example a period(.) and I need to extract its hexadecimal value, 2E.
You are wrong -- a period in EBCDIC (which is what the mainframe uses) is X'4B', not X'2E' -- ASCII uses X'2E' for the period. So you either have not completely explained what you are doing, or you do not understand ASCII / EBCDIC collating sequences, or you do not understand the mainframe's use of EBCDIC. If you are converting from ASCII to EBCDIC as part of your process, you need to state this -- we are not mind readers and have no idea what you are doing other than what you post.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Hexadecimal Text to Alphanumeric problem

Postby Zemyree42 » Thu Nov 10, 2016 8:34 am

Sorry, Please let me correct it.
I am trying to extract EBCDIC value of a string to Alphanumeric. And I apologize again for using the wrong example above.
Here is a sample of the actual input, where YDDA is the string and its EBCDIC value is below(correct me if I am wrong again).
The EBCDIC value which I extracted is 03E8 which when declared as binary and passed to an alphanumeric output will be converted to 1000.


YDDA
------
ECCC
8441
Zemyree42
 
Posts: 2
Joined: Tue Nov 08, 2016 3:43 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Hexadecimal Text to Alphanumeric problem

Postby BillyBoyo » Thu Nov 10, 2016 12:55 pm

EBCDIC is a character-coding convention. E8 is the EBCDIC for Y, C1 the EBCDIC for A. In other contexts a byte which happens to contain either of those values can mean something else entirely.

You have shown the EBCDIC values of the four character-positions in your example. I don't know what you mean by "the EBCDIC value which I extracted is 03E8". If you don't yet understand the terms, just don't use them, explain what you mean in just ordinary words with no jargon. How do you map YDDA, or E8C4C4C1, to 03E8?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Hexadecimal Text to Alphanumeric problem

Postby steve-myers » Thu Nov 10, 2016 5:17 pm

OR How can I translate a 4 byte character data area containing E8C4C4C1 to an 8 byte character data area containing E8C4C4C1?

By the way, you should learn phBB markup so that

YDDA
------
ECCC
8441

will reliably display as

YDDA
----
ECCC
8441


Use Google to search for bbcode guide.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times


Return to CA-Easytrieve

 


  • Related topics
    Replies
    Views
    Last post