Portal | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
EBCDIC (0037) to/from UTF-8 (1208)

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Harold Barnes

New User


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

PostPosted: Tue Sep 22, 2020 9:11 pm    Post subject: EBCDIC (0037) to/from UTF-8 (1208)
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

Senior Member


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

PostPosted: Tue Sep 22, 2020 10:16 pm    Post subject: Re: EBCDIC (0037) to/from UTF-8 (1208)
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: 30
Location: United States

PostPosted: Wed Sep 23, 2020 12:19 am    Post subject: EBCDIC (0037) to/from UTF-8 (1208)
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts EBCDIC to ASCII conversion help t_bt2 All Other Mainframe Topics 1 Wed Sep 23, 2020 6:34 pm
No new posts Regarding the EBCDIC CCSID mapping. sakthikumarT DB2 3 Wed Jan 10, 2018 4:45 pm
No new posts Conversion of UTF-8 to EBCDIC muralikrishnan_new COBOL Programming 1 Tue Nov 21, 2017 5:33 pm
No new posts Can EDCICONV convert EBCDIC to ASCII... natt.sut IBM Tools 3 Fri Nov 17, 2017 8:46 pm
No new posts PC (UTF-8) -> z/OS (EBCDIC) -> ... prino All Other Mainframe Topics 4 Fri Sep 01, 2017 1:47 am

Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us