IBM Support

How to transfer file as text from Sterling Connect:Direct z/OS to Sterling Connect:Direct Windows & convert to UTF-16

Question & Answer


Question

How to transfer file as text from Sterling Connect:Direct z/OS to Sterling Connect:Direct Windows & convert to UTF-16?

Answer

Sterling Connect:Direct Windows will add single byte Carriage Return Line Feed x'OD0A' to a text transfer from zOS to Windows. To produce a UTF-16 file containing double byte Carriage Return Line feed i.e. x'000D000A' (big endian) or x'0D000A00' (little Endian) the following Processes can be used.

On the mainframe

UTF16SND PROCESS SNODEID=(userid,password)     -                
                 SNODE=cd.Windows.Nodename                              
*                                                                  
COPY01   COPY  FROM (                                            -  
                      DSN=source.dataset..CODEPAGE.IBM-037           -  
                      DISP=SHR                                   -  
                     )                                           -  
               TO   (                                            -  
                      DSN='C:\temp\UTF16_TEST_INTERMEDIATE.txt'  -  
                      DISP=RPL                                   -  
                     )                                              
*                                                                  
     IF       (COPY01 EQ 0) THEN                                    
*                                                                  
STEP01   SUBMIT  SUBNODE=SNODE                                    -
                 dsn='c:\temp\utf16.CDP'                      -
                 &TEMPFILE='C:\temp\UTF16_TEST_INTERMEDIATE.txt'  -
                 &FINALFIL='C:\temp\UTF16_TEST_FINAL2.txt'          
*

The mainframe Process copies the file to the Windows system and then submits the following C:D Windows Process which converts the file to UTF-16. Use 1201 for UTF-16 Big Endian or 1200 for UTF-16 little Endian:

/*Notes:
  1201 unicodeFFFE Unicode UTF-16, big endian byte order; UTF-16BE
  (e.g. LineFeed = x'000A')
  1200 Unicode-16, little endian, UTF-16LE (e.g. LineFeed =x'0A00')

*/

/*BEGIN_REQUESTER_COMMENTS
    $PNODE$="cd.Windows.Nodename" $PNODE_OS$="Windows"
    $SNODE$="cd.Windows.Nodename" $SNODE_OS$="Windows"
    $OPTIONS$="WDOS"
  END_REQUESTER_COMMENTS*/

UTF16 PROCESS
 &TEMPFILE='c:\temp\default1.txt'
 &FINALFIL='c:\temp\default2.txt'
 SNODE=cd.Windows.Nodename

COPY01 COPY
 FROM (
  FILE="&TEMPFILE"
  SYSOPTS="codepage(437,65001)"
 )
 TO (
  FILE="&FINALFIL"
  DISP=RPL
  SYSOPTS="codepage(65001,1200)"
 )

PEND

For converting to a CODEPAGE other than UTF-16, for example UTF-8, please refer to COPY Statement Examples in Sterling Connect:Direct Process Examples
CODEPAGE Conversion During a File Copy (z/OS to Microsoft Windows)

[{"Product":{"code":"SSRRVY","label":"IBM Sterling Connect:Direct for Microsoft Windows"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Not Applicable","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}},{"Product":{"code":"SSFGBN","label":"IBM Sterling Connect:Direct for z\/OS"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Not Applicable","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Historical Number

HTG1730

Document Information

Modified date:
24 July 2020

UID

swg21563896