View previous topic :: View next topic |
Author |
Message |
issac1029 Intermediate

Joined: 10 Dec 2005 Posts: 159 Topics: 75
|
Posted: Wed Apr 15, 2009 10:54 am Post subject: How to convert C to HEX? Not C->Binary |
|
|
As subject/
For example:
record 1: 1234
record 2: in hex
13
24
I can do a conversion from hex to c, but how to do a reversal? |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Apr 15, 2009 11:04 am Post subject: |
|
|
issac1029,
DFSORT has the capability of converting strings to hex. Check this . The outrec statement puts the hex value of string pos 1 for 4 in pos 20
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
1234
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC OVERLAY=(20:1,4,HEX)
//* |
will produce
Code: |
----+----1----+----2----+----3
1234 F1F2F3F4
|
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
issac1029 Intermediate

Joined: 10 Dec 2005 Posts: 159 Topics: 75
|
Posted: Wed Apr 15, 2009 11:02 pm Post subject: |
|
|
I want to do a reverse of this, can I ? |
|
Back to top |
|
 |
issac1029 Intermediate

Joined: 10 Dec 2005 Posts: 159 Topics: 75
|
Posted: Wed Apr 15, 2009 11:04 pm Post subject: |
|
|
convert to
|
|
Back to top |
|
 |
Bill Dennis Advanced

Joined: 03 Dec 2002 Posts: 579 Topics: 1 Location: Iowa, USA
|
Posted: Thu Apr 16, 2009 8:06 am Post subject: |
|
|
From your first example it appears you want to PACK the numbers but without a sign. Correct?
c'1234' four bytes
to
x'1234' two bytes _________________ Regards,
Bill Dennis
Disclaimer: My comments on this foorum are my own and do not represent the opinions or suggestions of any other person or business entity. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
Frank Yaeger Sort Forum Moderator

Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
|
Posted: Thu Apr 16, 2009 10:15 am Post subject: |
|
|
Issac,
If you're only dealing with 'F0'-'F9' (0-9), then you can use a DFSORT job like the following to do what you asked for:
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
F1F2F3F4
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,8,UFF,TO=ZD,LENGTH=4)
/*
|
Of course, that won't work for 'C1'-'C6' (A-F). _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort |
|
Back to top |
|
 |
|
|