Re: EBCDIC to HEX translation in Assembler?

2007-07-23 Thread Gray, Larry - Larry A
NOTICE:
All information in and attached to the e-mail(s) below may be proprietary, 
confidential, privileged and otherwise protected from improper or erroneous 
disclosure.  If you are not the sender's intended recipient, you are not 
authorized to intercept, read, print, retain, copy, forward, or disseminate 
this message.  If you have erroneously received this communication, please 
notify the sender immediately by phone (704-758-1000) or by e-mail and destroy 
all copies of this message (electronic, paper, or otherwise).  Thank you.

Wouldn't this just be the PACK command?  Are you needing it in binary or
Packed Decimal? 


Larry Gray
Large Systems Engineering
Lowe's Companies
336-658-7944

-Original Message-
From: IBM Mainframe Discussion List [mailto:[EMAIL PROTECTED] On
Behalf Of Phil Kingston
Sent: Monday, July 23, 2007 10:06 AM
To: IBM-MAIN@BAMA.UA.EDU
Subject: EBCDIC to HEX translation in Assembler?

Hi all,

Does anyone have a quick assembler routine to convert a hexadecimal
number represented in EBCDIC into the real hex number?
 

Phil.



 

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.476 / Virus Database: 269.10.14/912 - Release Date:
22/07/2007 19:02

--
For IBM-MAIN subscribe / signoff / archive access instructions, send
email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search
the archives at http://bama.ua.edu/archives/ibm-main.html

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: EBCDIC to HEX translation in Assembler?

2007-07-23 Thread Binyamin Dissen
On Mon, 23 Jul 2007 15:06:00 +0100 Phil Kingston
[EMAIL PROTECTED] wrote:

:Does anyone have a quick assembler routine to convert a hexadecimal
:number represented in EBCDIC into the real hex number?

TR followed by PACK.

--
Binyamin Dissen [EMAIL PROTECTED]
http://www.dissensoftware.com

Director, Dissen Software, Bar  Grill - Israel


Should you use the mailblocks package and expect a response from me,
you should preauthorize the dissensoftware.com domain.

I very rarely bother responding to challenge/response systems,
especially those from irresponsible companies.

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: EBCDIC to HEX translation in Assembler?

2007-07-23 Thread Steve Comstock

Phil Kingston wrote:

Hi all,

Does anyone have a quick assembler routine to convert a hexadecimal
number represented in EBCDIC into the real hex number?
 


Phil.


Depends what you mean.

x'FACE' is a hexadecimal number, right? (= 64206 in decimal,
if an unsigned number).

c'FACE' is one way of representing it in EBCDIC

So you want to convert c'FACE' to x'FACE'?

Or are you talking zoned decimal, packed decimal,
or floating point numbers?

Give us some info on the parameters that bound your
problem.

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-393-8716
http://www.trainersfriend.com

  z/OS Application development made easier
* Our classes include
   + How things work
   + Programming examples with realistic applications
   + Starter / skeleton code
   + Complete working programs
   + Useful utilities and subroutines
   + Tips and techniques

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: EBCDIC to HEX translation in Assembler?

2007-07-23 Thread john gilmore
You need a trivial table and a TROT (TRanslate One to Two) instruction loop. 
 See p. 7-202 of the current Principles of Operation.


John Gilmore
Ashland, MA 01721-1817
USA

_
http://im.live.com/messenger/im/home/?source=hmtextlinkjuly07

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: EBCDIC to HEX translation in Assembler?

2007-07-23 Thread Bill Wilkie
Do you mean taking in something like parm= F5 which is internally xC6F5 
and making it xF5 ?


Bill





From: Phil Kingston [EMAIL PROTECTED]
Reply-To: IBM Mainframe Discussion List IBM-MAIN@BAMA.UA.EDU
To: IBM-MAIN@BAMA.UA.EDU
Subject: EBCDIC to HEX translation in Assembler?
Date: Mon, 23 Jul 2007 15:06:00 +0100

Hi all,

Does anyone have a quick assembler routine to convert a hexadecimal
number represented in EBCDIC into the real hex number?


Phil.





No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.476 / Virus Database: 269.10.14/912 - Release Date:
22/07/2007 19:02

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


_
Need a brain boost? Recharge with a stimulating game. Play now!  
http://club.live.com/home.aspx?icid=club_hotmailtextlink1


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: EBCDIC to HEX translation in Assembler?

2007-07-23 Thread (IBM Mainframe Discussion List)
 
 
In a message dated 7/23/2007 9:11:16 A.M. Central Daylight Time,  
[EMAIL PROTECTED] writes:
Wouldn't this just be the PACK command?
 
Not sufficient.
 
Are you needing it in binary or Packed Decimal?
 
OP wants it translated to the real hex number.  Without any further  
technical specifications, I would assume, e.g., that EBCDIC A3 should be  
translated into X'A3'.  In this case two input bytes result in one output  
byte.  
There are other possibilities where the output is not exactly  one-half the 
length 
of the input.  This string is really X'C1F3'.  If  you PACK it you will end 
up with X'013F' which is not the same as X'A3'.   First translate every byte 
into its hex equivalent, then pack with one extra  byte on the right that you 
plan to throw away.
   TR STRING,TABLE
* STRING now contains X'0A03'.
   PACK   OUTPUT(2),STRING(3)
* OUTPUT now contains X'A3yx', where yx is the inverse of whatever was in  
the first byte of OUTPUT before the PACK executes.  I assumed it contained  
X'xy', so after the PACK the right-most byte has its two nibbles reversed into  
X'yx'.
* You now have the real hex number in the first byte of OUTPUT.
 ... 
STRING   DCC'A3'
OUTPUT   DS XL2   
*
TABLEDC256X'00'
   ORG   TABLE+C'A'
   DCX'0A0B0C0D0E0F'
   ORG   TABLE+C'0'
   DCX'00010203040506070809'
   ORG   ,
 
You might also want to add code to validate the input string before  
translating; i.e., each byte must be between C'A' and C'F' or between C'0' and  
C'9'.  
You can play tricky games to reduce the size of the translate table  
considerably.
 
Bill  Fairchild
Plainfield, IL





** Get a sneak peek of the all-new AOL at 
http://discover.aol.com/memed/aolcom30tour

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: EBCDIC to HEX translation in Assembler?

2007-07-23 Thread Phil Kingston
 
Bill,

That’s exactly what I was after. thanks :-)

Phil.



-Original Message-
From: IBM Mainframe Discussion List [mailto:[EMAIL PROTECTED] On
Behalf Of (IBM Mainframe Discussion List)
Sent: 23 July 2007 15:38
To: IBM-MAIN@BAMA.UA.EDU
Subject: Re: EBCDIC to HEX translation in Assembler?

 
 
In a message dated 7/23/2007 9:11:16 A.M. Central Daylight Time,  
[EMAIL PROTECTED] writes:
Wouldn't this just be the PACK command?
 
Not sufficient.
 
Are you needing it in binary or Packed Decimal?
 
OP wants it translated to the real hex number.  Without any further  
technical specifications, I would assume, e.g., that EBCDIC A3 should
be  
translated into X'A3'.  In this case two input bytes result in one
output  byte.  
There are other possibilities where the output is not exactly  one-half
the length 
of the input.  This string is really X'C1F3'.  If  you PACK it you will
end 
up with X'013F' which is not the same as X'A3'.   First translate every
byte 
into its hex equivalent, then pack with one extra  byte on the right
that you 
plan to throw away.
   TR STRING,TABLE
* STRING now contains X'0A03'.
   PACK   OUTPUT(2),STRING(3)
* OUTPUT now contains X'A3yx', where yx is the inverse of whatever was
in  
the first byte of OUTPUT before the PACK executes.  I assumed it
contained  
X'xy', so after the PACK the right-most byte has its two nibbles
reversed into  
X'yx'.
* You now have the real hex number in the first byte of OUTPUT.
 ... 
STRING   DCC'A3'
OUTPUT   DS XL2   
*
TABLEDC256X'00'
   ORG   TABLE+C'A'
   DCX'0A0B0C0D0E0F'
   ORG   TABLE+C'0'
   DCX'00010203040506070809'
   ORG   ,
 
You might also want to add code to validate the input string before  
translating; i.e., each byte must be between C'A' and C'F' or between
C'0' and  C'9'.  
You can play tricky games to reduce the size of the translate table  
considerably.
 
Bill  Fairchild
Plainfield, IL
 

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.476 / Virus Database: 269.10.14/912 - Release Date:
22/07/2007 19:02

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: EBCDIC to HEX translation in Assembler?

2007-07-23 Thread Rick Fochtman

snip---


Hi all,

Does anyone have a quick assembler routine to convert a hexadecimal
number represented in EBCDIC into the real hex number?

 


unsnip---
 TR SOURCE,HEXTAB
  PACK  RESULT(L'RESULT+1),SOURCE(L'SOURCE+!)

HEXTAB  DC  256AL1(*-HEXTAB)
ORG HEXTAB+C'A' 
 DCX'FAFBFCFDFEFF'

ORG

Should do just fine. Be careful of length values in UNPK instruction.

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: EBCDIC to HEX translation in Assembler?

2007-07-23 Thread Chase, John
 -Original Message-
 From: IBM Mainframe Discussion List On Behalf Of (IBM Mainframe
Discussion List)
  
 In a message dated 7/23/2007 9:11:16 A.M. Central Daylight 
 Time, [EMAIL PROTECTED] writes:
 Wouldn't this just be the PACK command?
  
 Not sufficient.
  
 Are you needing it in binary or Packed Decimal?
  
 OP wants it translated to the real hex number.  Without any 
 further  
 technical specifications, I would assume, e.g., that EBCDIC 
 A3 should be  
 translated into X'A3'.  In this case two input bytes result 
 in one output  byte.  
 There are other possibilities where the output is not exactly 
  one-half the length 
 of the input.  This string is really X'C1F3'.  If  you PACK 
 it you will end 
 up with X'013F' which is not the same as X'A3'.   First 
 translate every byte 
 into its hex equivalent, then pack with one extra  byte on 
 the right that you 
 plan to throw away.
TR STRING,TABLE
 * STRING now contains X'0A03'.

Why is this necessary?

PACK   OUTPUT(2),STRING(3)
 * OUTPUT now contains X'A3yx', where yx is the inverse of 
 whatever was in  
 the first byte of OUTPUT before the PACK executes.

The result would be identical without the preliminary TR.

   -jc-

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: EBCDIC to HEX translation in Assembler?

2007-07-23 Thread Dave Reinken
 From: Chase, John [EMAIL PROTECTED]
  OP wants it translated to the real hex number.  Without any 
  further  
  technical specifications, I would assume, e.g., that EBCDIC 
  A3 should be  
  translated into X'A3'.  In this case two input bytes result 
  in one output  byte.  
  There are other possibilities where the output is not exactly 
   one-half the length 
  of the input.  This string is really X'C1F3'.  If  you PACK 
  it you will end 
  up with X'013F' which is not the same as X'A3'.   First 
  translate every byte 
  into its hex equivalent, then pack with one extra  byte on 
  the right that you 
  plan to throw away.
 TR STRING,TABLE
  * STRING now contains X'0A03'.
 
 Why is this necessary?
 
 PACK   OUTPUT(2),STRING(3)
  * OUTPUT now contains X'A3yx', where yx is the inverse of 
  whatever was in  
  the first byte of OUTPUT before the PACK executes.
 
 The result would be identical without the preliminary TR.

As stated above, without the TR to change c'A3' from x'C1F3' to x'0A03',
then result of the pack would be x'13yx', not x'A3yx' as desired.

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: EBCDIC to HEX translation in Assembler?

2007-07-23 Thread Rich Tabor

Maybe something like?

PACK wk1,parmfld+1
PACK wk2,wk1
UNPK outfld+1,wk2

On 7/23/07, Phil Kingston [EMAIL PROTECTED] wrote:

Hi all,

Does anyone have a quick assembler routine to convert a hexadecimal
number represented in EBCDIC into the real hex number?


Phil.





No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.476 / Virus Database: 269.10.14/912 - Release Date:
22/07/2007 19:02

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html



--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: EBCDIC to HEX translation in Assembler?

2007-07-23 Thread Chase, John
 -Original Message-
 From: IBM Mainframe Discussion List On Behalf Of Dave Reinken
 
 [ snip ]
 
 As stated above, without the TR to change c'A3' from x'C1F3' 
 to x'0A03', then result of the pack would be x'13yx', not 
 x'A3yx' as desired.

DUH.. (forest . trees)

I'll crawl back under my rock now..

-jc-

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: EBCDIC to HEX translation in Assembler?

2007-07-23 Thread Robert A. Rosenberg
At 10:38 -0400 on 07/23/2007, (IBM Mainframe Discussion List) wrote 
about Re: EBCDIC to HEX translation in Assembler?:




TABLEDC256X'00'
   ORG   TABLE+C'A'
   DCX'0A0B0C0D0E0F'


ORG   TABLE+C'a' or X'81' (just in case you get lower 
case input)

DCX'0A0B0C0D0E0F'


   ORG   TABLE+C'0'
   DCX'00010203040506070809'
   ORG   ,

You might also want to add code to validate the input string before
translating; i.e., each byte must be between C'A' and C'F' or 
between C'0' and  C'9'.


A TRT of the string using this table will do the job:


TRTTABLE  DC  256X'FF'
  ORG TRTTABLE+C'A'
  DC  6X'00'  A-F
  ORG TRTTABLE+C'a' or X'81' (just in case you get lower case input)
  DC  6X'00'  a-f
  ORG TRTTABLE+C'0'
  DC  10X'00' 0-9
  ORG TRTTABLE+256 (or just ORG)


Any non-HEX character will trigger the early termination of the TRT.

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html