User Tools

Site Tools

Navigation:  Language Reference > 5 - Declaration Attributes > Variable and Entity Attributes >====== TYPE (type definition) ====== Previous pageReturn to chapter overviewNext page



The TYPE attribute creates a type definition for a FILE, GROUP, QUEUE, or CLASS (a “named structure”). The label of the named structure can then be used as a data type to define other similar FILEs, GROUPs, QUEUEs, or CLASSes (or you can use LIKE). TYPE may also be used to define named structures passed to PROCEDUREs, allowing the receiving procedure to directly address components of the type definition using Field Qualification syntax.

A FILE, GROUP, QUEUE, or CLASS declaration with the TYPE attribute is not allocated any memory. While the data members of a CLASS with the TYPE attribute are not allocated memory, the methods prototyped in the CLASS must be defined for use by any subsequent objects declared as that type. EXTERNAL and DLL are irrelevant. The PRIVATE attribute is also allowed for TYPE declarations.

When a type definition is used to pass a named structure as a parameter to a PROCEDURE, the receiving procedure may directly address component fields in the passed QUEUE using the Field Qualification syntax. This is the preferred method of addressing the components of the passed structure.

There is also a legacy method of addressing the components of the passed structure. The named structure parameter declaration on the PROCEDURE definition statement (not the prototype) can instantiate a local prefix for the passed QUEUE as it names the passed QUEUE for the procedure. For example, PROCEDURE(LOC:PassedQueue) declares the procedure uses the LOC: prefix (along with the individual field names used in the type definition) to directly address component fields of the QUEUE passed as the parameter using the same type of syntax that the PRE attribute specifies. However, using Field Qualification syntax is preferable–locally instantiated prefixes are only maintained for backward compatibility.


The use of PRE with TYPE in a FILE structure is not supported.



MyProc1   PROCEDURE(PassQue) !Passes a QUEUE defined the same as PassGroup


PassQue QUEUE,TYPE           !Type-definition for passed QUEUE parameters

First    STRING(20)          !first name

Middle   STRING(1)           !middle initial

Last     STRING(20)          !last name


NameQue QUEUE(PassQue)       !Name queue– same structure as PassQue

       END                  !End queue declaration


MyProc1(NameQue)            !Call proc passing NameQue as parameter

MyProc1  PROCEDURE(PassedQue)!Proc to receive QUEUE parameter

LocalVar STRING(20)


LocalVar = PassedQue.First  !Assign NameQue.First to LocalVar from parameter

See Also:

Field Qualification

Prototype Parameters Lists




Scope of variables and type declarations

type_type_definition_.htm.txt · Last modified: 2021/04/15 15:57 by