Converting alphanumeric or national to UTF-8 (MOVE)

You can use a MOVE statement to implicitly convert data to UTF-8 representation.

About this task

You can move the following kinds of data to category UTF-8, and thus convert the data to UTF-8 representation:

  • Alphabetic
  • Alphanumeric
  • Alphanumeric-edited
  • Numeric-edited
  • National
  • National-edited
  • Numeric-edited of USAGE NATIONAL

For complete rules about moves to UTF-8 data, see MOVE statement (Enterprise COBOL for z/OS® Language Reference) .

For example, the following MOVE statement moves the alphanumeric literal "AB" to the UTF-8 data item UTF8-Data:


01  UTF8-Data  Pic U(2) Usage UTF-8.
    . . . 
    Move "AB" to UTF8-Data

After the previous MOVE statement, UTF8-Data contains UX'4142', the UTF-8 representation of the alphanumeric characters 'AB'.

If padding is required in a receiving data item that has USAGE UTF-8, the default UTF-8 space character (UX'20') is used. If truncation is required, it occurs at the boundary of a UTF-8 character position.

Related references  
MOVE statement (Enterprise COBOL for z/OS Language Reference)