Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

TYPE attribute

Read syntax diagramSkip visual syntax diagram>>-TYPE--+-defined-type-name---+-------------------------------><
         '-(defined-type-name)-'
 
defined-type-name
Specifies the name of a previously defined alias, defined structure, or ordinal type.

Examples

define alias Name char(31) varying;
               /* Name has attributes char(31) varying */
dcl Employee_Name type Name;
               /* Employee_Name type char(31) varying */
define alias Rate fixed dec(3,2);
               /* Rate has attributes fixed dec real */

define structure
1 Payroll,
2 Name,
3 Last  type Name,
3 First type Name,
2 Hours,
3 Regular  fixed dec(5,2),
3 Overtime fixed dec(5,2),
2 Rate,
3 Regular  type Rate,
3 Overtime type Rate;

dcl Non_Exempt type Payroll;     /* Has Payroll structure type */
dcl Exempt     type Payroll;     /* Has Payroll structure type */

The TYPE attribute can be used in a DEFINE ALIAS statement to specify an alias for a type defined in a previous DEFINE ALIAS statement. For example:

  define alias Word fixed bin(31);
  define alias Short type word;

The following example defines several named types, a structure type (tm), and declares the C function that gets a handle to this typed structure:

   define alias int     fixed bin(31);
   define alias time_t  fixed bin(31);
   define structure
     1 tm
      ,2 tm_sec   type int    /* seconds after the minute (0-61)     */
      ,2 tm_min   type int    /* minutes after the hour (0-59)       */
      ,2 tm_hour  type int    /* hours since midnight (0-23)         */
      ,2 tm_mday  type int    /* day of the month (1-31)             */
      ,2 tm_mon   type int    /* months since January (0-11)         */
      ,2 tm_year  type int    /* years since 1900                    */
      ,2 tm_wday  type int    /* days since Sunday (0-6)             */
      ,2 tm_yday  type int    /* days since January 1 (0-365)        */
      ,2 tm_isdst type int    /* Daylight Saving Time flag           */
      ;

   dcl localtime    ext('localtime')
               entry( nonasgn byaddr type time_t )
               returns( byvalue handle tm );

   dcl time    ext('time')
               entry( byvalue pointer )
               returns( byvalue type time_t );

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)