Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

BIGENDIAN and LITTLEENDIAN attributes

The BIGENDIAN and LITTLEENDIAN attributes specify whether the associated variable is stored with the most or least significant digits first. The BIGENDIAN and LITTLEENDIAN attributes are ignored except for FIXED BINARY, ORDINAL, OFFSET, POINTER, and AREA variables and VARYING string variables.

Read syntax diagramSkip visual syntax diagram   .-BIGENDIAN----.
>>-+-LITTLEENDIAN-+--------------------------------------------><
 

Default: BIGENDIAN except on Intel where the default is LITTLEENDIAN

BIGENDIAN indicates that the variable (for varying strings, the length prefix part of the variable) is stored with its most significant bytes first. This format is the native style for z/OS and RS/6000.

LITTLEENDIAN indicates that the variable is stored in the opposite format: with its least significant bytes first. This format is the native style for Windows.

When the LITTLEENDIAN or BIGENDIAN attribute is applied to an AREA, it affects only the format in which the control values managed by the compiler and library are held. It has no effect on user variables stored in the AREA or on user offset variables used to point to the user variables in the AREA.

The following example illustrates how BIGENDIAN and LITTLEENDIAN variables are stored. The built-in function HEXIMAGE shows how X and Y are actually stored.

  dcl X fixed bin(15) bigendian;
  dcl Y fixed bin(15) littleendian;

 
  X = 258;
  Y = 258;

 
  display( heximage( addr(X), stg(X) ) );     /* displays 0102 */
  display( heximage( addr(Y), stg(Y) ) );     /* displays 0201 */

In contrast, the HEX built-in function would show for X and Y as given above:

  display (hex(X));                             /* displays 0102   */
  display (hex(Y));                             /* displays 0102   */

BIGENDIAN and LITTLEENDIAN have no effect on the semantics of any operations, or on the storage requirements for any variables.

The BIGENDIAN and LITTLEENDIAN attributes are propagated to members of structures or unions.

For more information on using BIGENDIAN and LITTLEENDIAN, refer to the Programming Guide.

The NATIVE and NONNATIVE attributes are synonyms for BIGENDIAN and LITTLEENDIAN, but their meanings can vary across different systems:


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)