×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
On 05-Aug-2015 12:22 -0600, Charles Wilt wrote:
On Wed, Aug 5, 2015 at 1:28 PM, CRPence wrote:
• cast(cast(test as char(6) ccsid 37)
as graphic(6) ccsid 13488 )
Doesn't seem that will actually work if the CCSID 65535 field actually
contains 16-bit characters...like x'004100530044'
When I tried
hex(cast(cast(substr(test,1,6) as char(6) CCSID 37) as graphic (6)
ccsid 13488))
I saw:
000000A0000000EB000000E0
Exactly. That is consistent with why the casting into the EBCDIC
encoding from effective BINARY is /given a pass/ but casting into ASCII
encoding is not, on the EBCDIC OS; the doubly-cast result /assumes/ the
original data is EBCDIC, naturally. And exemplifies why the lack of a
DMAP [direct mapping] scalar function that mimics the CAST scalar
function is lamentable. Ideally one would be able to, instead of CAST
from a properly-typed scalar, DMAP from some untyped data of a given
length, such that the desired effect would be achieved with:
DMAP(substr(test, 1, 6) as graphic (3) ccsid 13488)
I did not locate my RPGLE source for the Raw2VG1K
[RawToVarGraphicUCS2_1Kinput] UDF I offer in the following link, but the
code was quite trivial:
[
http://archive.midrange.com/midrange-l/201203/msg00829.html]
How nice to have been able to have written the query shown in the
above link, as the much more succinct request; eliminating innumerable
UDFs written [often incorrectly and\or narrowly] to achieve the same but
typically only when also embedded within an additional CAST:
select
dmap(substr(s, 1, 3) as char(3) ccsid 37) as c3
, dmap(substr(s, 4, 6) as graphic(3)) as u3
, dmap(substr(s, 10, 3) as dec(5, 0)) as p5
from raw
As an Amazon Associate we earn from qualifying purchases.