IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Convert six bytes CHAR value to 3 bytes using REXX


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Mon Jul 26, 2010 12:07 pm
Reply with quote

Hi,

My requirement is I have an input file with six byte character value as a key and that six byte character value need to convert 3 bytes and the converted value should be writen to output file.

I have planned to do this using rexx. Could anyone suggest me which functions I should use to convert six byte value to 3 bytes?

Please guide me in this regard.

Sample input:

Code:

A2567C
A2748C


Expected output is (In hexa format):


Code:

----+----1----+
sî@
A57444444444444
26C000000000000
---------------
sÈð
A78444444444444
24C000000000000
Back to top
View user's profile Send private message
senjay

Active User


Joined: 10 May 2007
Posts: 147
Location: India

PostPosted: Mon Jul 26, 2010 4:09 pm
Reply with quote

Hi,
You may want to refer X2C, Built in function. Refer in 'TSO/E Rexx Reference' for detailed info. Hope your input file is not huge.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Mon Jul 26, 2010 4:38 pm
Reply with quote

I believe you meant "C2X"?

Bill
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Jul 26, 2010 5:47 pm
Reply with quote

X2C is the correct function, as it will take a HEX representation and convert it to characters.
Code:
INP = '1A2576F' 
OUT = X2C(INP)   

Results in
Code:
 sï?         
0A56444444444
127F000000000
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Mon Jul 26, 2010 6:11 pm
Reply with quote

Expat,

After further review, you're right. However, a quick glance seems to suggest the OP needs to go from 6-bytes CHAR to 3-bytes HEX.

Read it too fast.... icon_redface.gif

Bill
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Jul 26, 2010 6:22 pm
Reply with quote

I've been caught out by that in the past. C2X just seems the logical function to use. Took me ages to finally get my head around it. A bit like COND= in its own little way icon_confused.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jul 26, 2010 8:11 pm
Reply with quote

Hello,

What happens when there is a G in the input key. . .? Or an R. . .?
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Tue Jul 27, 2010 2:47 pm
Reply with quote

All you you thank you very much.

It is working fine with "X2C" function.

Hi Bill & Expat,

I also did same mistake by using "C2X" function.

Hi Senjay,

Thanks for your quick reply.

Hi Dick,

It is confirmed that A to F only the possible values.

Thank you once again for all your kind support and guidance.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
Search our Forums:

Back to Top