POS(starting-position)

The POS keyword is used in a free-form subfield definition to specify the starting position of the subfield in the data structure.

The starting-position parameter must be a value between 1 and the length of the data structure.

The parameter can be a literal or a named constant. If it is a named constant, the constant must be defined prior to the definition statement.

The following example is defining an INDDS data structure. It uses the POS keyword to place the indicators at specific positions in the data structure.

   DCL-DS indds LEN(99);
      exit IND POS(3);
      refresh IND POS(5);
      cancel IND pos(12);
      sflclr IND pos(55);
      sfldsp IND pos(56);
   END-DS;
The following example is defining a data structure to use with an API. It uses the POS keyword to place the subfields at the positions specified in the API documentation.

   DCL-DS Qwc JOBI0100_t QUALIFIED;
      Job_Type CHAR(1) POS(61);
      Job_Subtype CHAR(1) POS(62);
      Default_Wait INT(10) POS(73);
   END-DS;