Hi,
I have a file in which data is in the Hex format as below.
?..%.?..........?......@...
And when i give a command 'HEX ON' then the data in the file is converted as below.
?..%.?..........?......@...
A00608020002013040000007300
A93C9C3C200C00C953C05C2C4CC
Now i want to read the file in the HEX format and want to bring some data in to some variables.
Eg: Varable A must be equal to 09036C.
Can anyone please help me with that.
How to read HEX file and convert it into decimal in REXX.
Moderators: Veera, Moderator Group
How to read HEX file and convert it into decimal in REXX.
Thanks & Regards
M Pawan
M Pawan
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
lookat 4.3.14 C2X (Character to Hexadecimal)
here is a REXX (or routine) that you can CALL:
here is a REXX (or routine) that you can CALL:
Code: Select all
/* REXX CONVERT PACKED DECIMAL TO NUMBER */
PARSE ARG PACK_NUM
HEX_NUM = C2X(PACK_NUM)
SIGN = RIGHT(HEX_NUM,1)
NUMBER = LEFT(HEX_NUM,LENGTH(HEX_NUM)-1)
IF SIGN = 'D' THEN
RETURN '-'| |NUMBER
ELSE
RETURN NUMBER
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
-
- Member
- Posts: 1
- Joined: Tue Nov 02, 2010 12:07 am
REXX CONVERT PACKED DECIMAL routine is great!
hey Dick... your solution works like a champ... thanks very much!
here is a REXX (or routine) that you can CALL:
Code:
/* REXX CONVERT PACKED DECIMAL TO NUMBER */
PARSE ARG PACK_NUM
HEX_NUM = C2X(PACK_NUM)
SIGN = RIGHT(HEX_NUM,1)
NUMBER = LEFT(HEX_NUM,LENGTH(HEX_NUM)-1)
IF SIGN = 'D' THEN
RETURN '-'| |NUMBER
ELSE
RETURN NUMBER
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
actually the routine came from someone else, and can't remember who I stole it from,
but here is a list of Sites that you should visit if you want to add to your tools:
Doug Nadel's site a must see
lionel B dyck's site visit this also
Rexx Examples old but useful
Dave's MVS Freeware - Rexx
and the american programmer has a lot of useful info
but here is a list of Sites that you should visit if you want to add to your tools:
Doug Nadel's site a must see
lionel B dyck's site visit this also
Rexx Examples old but useful
Dave's MVS Freeware - Rexx
and the american programmer has a lot of useful info
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page