MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to convert C to HEX? Not C->Binary

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
issac1029
Intermediate


Joined: 10 Dec 2005
Posts: 159
Topics: 75

PostPosted: Wed Apr 15, 2009 10:54 am    Post subject: How to convert C to HEX? Not C->Binary Reply with quote

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
View user's profile Send private message Send e-mail MSN Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Apr 15, 2009 11:04 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
issac1029
Intermediate


Joined: 10 Dec 2005
Posts: 159
Topics: 75

PostPosted: Wed Apr 15, 2009 11:02 pm    Post subject: Reply with quote

I want to do a reverse of this, can I ?
Back to top
View user's profile Send private message Send e-mail MSN Messenger
issac1029
Intermediate


Joined: 10 Dec 2005
Posts: 159
Topics: 75

PostPosted: Wed Apr 15, 2009 11:04 pm    Post subject: Reply with quote

Quote:

F1F2F3F4



convert to
Quote:

1234
FFFF
1234
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Bill Dennis
Advanced


Joined: 03 Dec 2002
Posts: 579
Topics: 1
Location: Iowa, USA

PostPosted: Thu Apr 16, 2009 8:06 am    Post subject: Reply with quote

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


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Apr 16, 2009 10:13 am    Post subject: Reply with quote

issac1029,

you may want to check this topic

http://www.mvsforums.com/helpboards/viewtopic.php?t=2351&highlight=hex
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Apr 16, 2009 10:15 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group