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

EBCDIC (0037) to/from UTF-8 (1208)


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Harold Barnes

New User


Joined: 27 Oct 2015
Posts: 33
Location: United States

PostPosted: Tue Sep 22, 2020 9:11 pm
Reply with quote

On my previous post I received fantastic support in my enlightenment of using translate() to convert EBCDIC to/from ASCII,

I'm assuming I need to write/plagiarize a codepage table for 0037/1208.

Since this is for tcp/ip communication between a TSO client (rexx) and a pc server (c# gui) I need the conversion to be part of the rexx script instead of a batch iconv file conversion.

Maybe there is a better way to do this instead of using translate()?
Back to top
View user's profile Send private message
prino
Warnings : 1

Senior Member


Joined: 07 Feb 2009
Posts: 1263
Location: Vilnius, Lithuania

PostPosted: Tue Sep 22, 2020 10:16 pm
Reply with quote

Harold Barnes wrote:
On my previous post I received fantastic support in my enlightenment of using translate() to convert EBCDIC to/from ASCII,

I'm assuming I need to write/plagiarize a codepage table for 0037/1208.

Since this is for tcp/ip communication between a TSO client (rexx) and a pc server (c# gui) I need the conversion to be part of the rexx script instead of a batch iconv file conversion.

Maybe there is a better way to do this instead of using translate()?

You cannot use translate(), as it only translates single bytes. Some of your 0037 characters will need to be translated to 2(+) byte characters in 1208, and some 2(+) byte characters in 1208 might not be translateable to a single character in 0037.

And you can call iconv from REXX...
Back to top
View user's profile Send private message
Harold Barnes

New User


Joined: 27 Oct 2015
Posts: 33
Location: United States

PostPosted: Wed Sep 23, 2020 12:19 am
Reply with quote

Quote:

And you can call iconv from REXX...


This is what I came up with.
Thanks prino for the shove in the right direction!

It looks like iconv puts a new-line character '0A'x at the end of the stdout.

Code:

/* REXX  */
trace o

in.1 = "This is line 1."
in.2 = "This is line 2."
in.0 = 2

do i = 1 to in.0
 say "in: " in.i
end

call bpxwunix 'iconv -f IBM-037 -t UTF8' ,in., out., err.

do i = 1 to out.0
 say "out: " c2x(out.i)
end

do i = 1 to err.0
 say "err: " err.i
end

call bpxwunix 'iconv -t IBM-037 -f UTF8' ,out., outx., err.

do i = 1 to outx.0
 say "outx: " outx.i
 say "outx hex " c2x(outx.i)
end

do i = 1 to err.0
 say "err: " err.i
end

exit 0
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 XYplorer - EBCDIC to ASCII translatio... All Other Mainframe Topics 0
No new posts EBCDIC to ASCII conversion help All Other Mainframe Topics 1
No new posts Regarding the EBCDIC CCSID mapping. DB2 3
No new posts Conversion of UTF-8 to EBCDIC COBOL Programming 1
No new posts Can EDCICONV convert EBCDIC to ASCII... IBM Tools 3
Search our Forums:

Back to Top