Given a USS file utf16.txt containing 6 UTF-16 characters, 12 bytes:

>od -tx1 -An utf16.txt
    00  28  20  1C  00  61  20  1D  00  29  00  0A

U+0028 is left parenthesis
U+201C is left double quotation mark
U+0061 is small letter "a"
U+201D is right double quotation mark
U+0029 is right parenthesis

There are no correstponding quotation marks in EBCDIC 1047.
The iconv command converts them to hex 3F.

>iconv -f 1200 -t ibm-1047 <utf16.txt | od -tx1 -tc -An
    4D  3F  81  3F  5D  15
     ( 077   a 077   )  \n

The EDCICONV program, using data sets, produces the same results, with return 
code 0 and no message.

Bill

On Sat, 8 Feb 2020 16:44:50 -0600, Paul Gilmartin <[email protected]> wrote:

>On Sat, 8 Feb 2020 16:31:56 -0500, Phil Smith III wrote:
>>
>>>How does it handle characters absent from IBM-037?
>>
>>I expect it will throw an error. This is, as you (Gil) know, one of the 
>>problems with OP’s query: you can’t stuff thousands of pounds of potatoes 
>>into a 256-pound sack. (OK, characters, not potatoes.)  ...
>>
>The Command Ref. says:
>    If the input contains a character that is not valid in the destination 
> code set, behavior
>    depends on the system's iconv() function. See z/OS XL C/C++ Runtime 
> Library Reference
>    for more information about the character that is used for converting 
> incorrect characters.
>Which says:
>    If iconv() encounters a character in the input buffer that is valid, but 
> for which
>    a conversion is not defined in the conversion descriptor, cd, then iconv() 
> performs
>    a nonidentical conversion on this character. The conversion is 
> implementation-defined.
>
>But no indication that it throws an error.  Of course the iconv utility could 
>check
>the output of iconv() and report its own error.
>
>"implementation-defined"?  This is the document that's supposed to provide that
>definition.  I'll submit an RCF.  And a minor one.  "nonidentical" is invented 
>nonsense.
>the correct term is "injective:"  
>https://en.wikipedia.org/wiki/Injective_function
>
>> ...
>>>I wonder what was the motivation to require preallocated data set
>>>names rather than the more flexible alternative of DDNAMEs?
>>
>>I believe it’s using ICONV on the USS side under the covers, which takes a 
>>data set name.
>> 
>Appendix K of the Command Ref. does not list iconv as among the
>utilities that accept data set names.  Of course, IBM is allowed to use
>non-GUPI interfaces internally.
>
>-- gil
>
>----------------------------------------------------------------------
>For IBM-MAIN subscribe / signoff / archive access instructions,
>send email to [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to