View previous topic :: View next topic
|
Author |
Message |
Harold Barnes
New User
Joined: 27 Oct 2015 Posts: 33 Location: United States
|
|
|
|
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 |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1315 Location: Vilnius, Lithuania
|
|
|
|
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 |
|
|
Harold Barnes
New User
Joined: 27 Oct 2015 Posts: 33 Location: United States
|
|
|
|
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 |
|
|
|