Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

setcode - Change character set conversion (CCSN)

&pagelevel(4)&pagelevel

The setcode command controls the character set conversion the FTP client performs when the transfer type ascii is used (see type command). Beside the conversion between an 8 bit EBCDIC and an 8 bit ISO-8859 character set (extended ASCII character set) also Unicode is supported with some restrictions. In any case the services of XHCS are utilized, so only character sets (CCSN = Coded Character Set Names in XHCS' idiom) can be specified, which are entered as compatible into XHCS (see the “XHCS” user guide). If a connection is set up between two BS2000 systems, it is important that both partners use suitable CCSNs, e.g. the same CCSN settings.

Regarding the used language: With the introduction of Unicode support the conversion isn't anymore based only on tables with 256 bytes, which map one byte of the source character set onto a byte of the target character set. In addition it isn't anymore always an EBCDIC character set involved. Therefore in many places of the user guide and the output of the FTP client or server "table" is replaced with "CCSN". Furthermore "EBCDIC" is replaced or complemented with "Host" to express that that is the character set to store data on the host, even when it is not an EBCDIC character set. Accordingly "ISO" is replaced or complemented with "Net" to express that a character set is meant, which is used for encoding data on the network, even when it is not an ISO character set, but an Unicode encoding.

With Unicode in principle the encodings UTF8, UTF16 (alternative CCSN: UNICODE) and UTFE are supported, depending on the context some restrictions exist. With the data transported over the network (Net CCSN) only UTF8 is supported, because only this Unicode encoding uses the same control characters as ASCII and is therefore compatbile with the FTP standard RFC 959. When storing data (Host CCSN) into BS2000 SAM files all three encodings UTF8, UTF16/UNICODE and UTFE are supported. When storing into POSIX files only UTFE is supported. Not all existing Unicode characters are supported, but only the ones currently supported by XHCS-SYS (XHCS-SYS V21.0A supports since Service Pack 22.2 the DIN SPEC 91379); for closer and up-to-date information consult the XHCS-SYS documentation.

Further restrictions applying to Unicode are transfer structure file, transfer mode stream and processing type textbin. Also restart of transfers (reget/reput) is not supported.

The current CCSN settings can be checked with the status command.

One can advise the FTP client (and also the BS2000 FTP server) to assign automatically the used Host CCSN to the written files as COD-CH-SET file attribute. For this see the variable assignCCSNtoFile.


setcode

<Host CCSN> <Net CCSN>


<Host CCSN> <Net CCSN>

When sending (put) a file the FTP client converts the characters read from the file from <Host CCSN> to <Net CCSN>, when receiveing (get) a file the data is converted from <Net CCSN> to <Host CCSN> and stored into the file. It is allowed to use UTF8 simultaneously as <Host CCSN> and <Net CCSN>, i.e. the data is not converted, but read from or written to the file with UTF8 encoding. The default setting is EDF041 as <Host CCSN> and NEW88591 as <Net CCSN>.

CAUTION!

The CCSN must not at all be specified in reverse order, because then false conversions are performed and thus no reasonable file transfer is possible.


Examples

setcode EDF045 ISO88595

When saving a SAM file (get) the data sent by the server will be interpreted according to character set ISO88595 (due to modifications of the conversion tables implicitely performed by the FTP client there is actually no difference between ISO8859x and NEW8859x) and converted to character set EDF045, before the data is written to a SAM file. Similarly, when reading a SAM file (put) the data is converted from EDF045 to ISO88595 and then sent to the FTP server.

setcode UTF16 UTF8

Written to the SAM file or read from it are two-byte Unicode characters. When exchanging data with an FTP server the characters are UTF8 encoded.

setcode UTF8 UTF8

No character set conversion is performed, but beside some control characters the data is byte-identically transferred between file and network.

setcode UTFE UTF8

The characters are stored UTFE encoded in the file and transferred UTF8 encoded over the network. This setting has to be used especially when one wants to store Unicode data in a POSIX file.


With the BS2000 FTP server the counterpart to the setcode client command is the proprietary SITE SETC FTP protocol command, It can be issued from the FTP client as follows:

quote SITE SETC <Host CCSN> <Net CCSN>

Regarding Unicode the same restrictions apply to the server as to the client. With the following command combination one can exchange data between local UTFE and remote UTF16 files:

setcode UTFE UTF8
quote SITE SETC UTF16 UTF8

In principle one can also use an Unicode encoding together with an 8 bit EBCDIC or ISO character set. But this leads to errors, when the Unicode source data contains characters not representable in the 8 bit target character set. Therefore it is advised against using an 8 bit target character set together with an Unicode source.