Admin Production rocket
Current Publication

Using the TYPE Attribute

Enterprise Developer for Visual Studio 2017 V7.0
Rocket® Enterprise Developer (formerly a product of Micro Focus or formerly a product of Open Text) documentation, created before Rocket Software acquired certain products from OpenText, may include outdated references to "Micro Focus" or "OpenText", both of which are trademarks of OpenText or its affiliates. Rocket Software is not affiliated with Micro Focus or OpenText and has since rebranded these products as Rocket® products. You may also encounter outdated links in this documentation. If you do, please contact Rocket Support (support@rocketsoftware.com) for assistance.

Using the TYPE Attribute

The reference in TYPE(reference) cannot:

  • Be pointer-qualified
  • Be a constant
  • Possess a subscript list or argument list

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:

  • A parameter
  • A member
  • Any structure declared with the TYPE attribute.

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 */