Using the TYPE Attribute

The reference in TYPE(reference) cannot:

For example, the following declarations are invalid:

DECLARE MYFILE FILE STREAM OUTPUT PRINT;
DECLARE ZZZ TYPE( P -> Q );      /* INVALID -
                                 POINTER-QUALIFIED */
DECLARE URFILE TYPE( MYFILE );   /* INVALID - MYFILE IS
                                    CONSTANT */
DECLARE XXX TYPE( AAA(8) );      /* INVALID - HAS
                                    SUBSCRIPT LIST */ 
DECLARE YYY TYPE( FUN( ) );      /* INVALID -
                                    HAS ARGUMENT LIST */

The type definition cannot have the TYPE attribute, nor can it be any of the following:

For example, the following declarations are invalid:

EXPROC: PROCEDURE( XYZ );
   DECLARE XYZ FIXED BIN(15),
      AAA TYPE( XYZ );/* INVALID - XYZ IS A PARAMETER */


   DECLARE INT FIXED BIN(15),
      B TYPE(INT),
      Y TYPE(B); /* INVALID - B IS TYPED */

   DECLARE 1 STRUCA,
      2 PROG TYPE (INT),
      2 NAMES CHAR(80);
      STRUCT1 TYPE(STRUCA),
      STRUCT2 TYPE(STRUCT1.NAMES); /* INVALID - NAMES IS
                                 IN TYPED STRUCTURE */

The reference in TYPE(reference) must not directly or indirectly refer to the variable that is declared, because then a circular definition will be created.

For example, the following declarations are invalid:

DECLARE 1 PROG,
   2 MOD CHAR(80),
   2 INT FIXED BIN(15),
   2 STRUCZ TYPE(PROG);/* INVALID - DIRECTLY CIRCULAR */

DECLARE 1 STRUCA,
   2 MOD CHAR(80),
   2 INT FIXED BIN(15),
   2 STRUCA TYPE(STRUCB); /* INVALID - INDIRECTLY
                           CIRCULAR */

DECLARE 1 STRUCB, 
   2 MOD CHAR(80), 
   2 INT CHAR(80), 
   2 STRUCA TYPE(STRUCA); /*INVALID - INDIRECTLY
                           CIRCULAR */