MF 

Pointer Dereferencing

Syntax Format 1

Pointer dereferencing format 1

Syntax Format 2

Syntax Rules Format 1

  1. The :: syntax allows for multiple operands to be chained together (whereas Format 2 is restricted to one AT clause).
  2. pointer-1 must be typed unless used with the DATA keyword. If pointer-1 is typed, typedef-name-1 or typedef-component-1 must be the type or sub-typedef component of the pointer type.
  3. typedef-component-1 can be qualified with :: qualification but not with the OF keyword.

Syntax Rules Format 2

  1. pointer-2 must be typed if used with the DATA keyword which has no reference modification specified. If pointer-2 is typed, typedef-name-2 or typedef-component-2 must be of the same type or component of the pointer type.
  2. typedef-component-2 cannot be qualified.

Syntax Rules All Formats

  1. Use of :: for dereferencing and the AT keyword in the same operand is not allowed.
  2. Reference modification can only follow directly after the DATA keyword.
  3. Subscript references must follow after typedef-component-1 or typedef-component-2; reference modification can then be specified after the subscript; for example, ptr1::array1(2)(2:1). For a more detailed example, see Pointer Examples.

General Rules Format 2

  1. If typedef-name-2 or typedef-component-2 are of usage pointer, you can also use :: for further dereferencing.

General Rules All Formats

  1. Untyped pointers that specify the DATA keyword must also specify reference modification; for example, ptr1::DATA(1:10) or DATA(1:10) AT ptr1.
  2. For typed pointers, DATA without a reference modification expression refers to the complete data held by the pointer.
  3. In general, if a receiving operand and sending operand are typed, then the types must match. However, format 1 does allow pointer coercion: the AS clause allows the non matching type to be coerced to the other. Coercion can also be used to change the type of the pointer to match the typedef-component. If the underlying data does not match the coerced type then the behavior is undefined.
  4. An exception to the previous rule is that if a pointer points to a type of PIC X, that pointer can point to any data defined as PIC X(n), and vice versa.