Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, 言語解説書

TYPE 属性

構文図を読む構文図をスキップする>>-TYPE--+-defined-type-name---+-------------------------------><
         '-(defined-type-name)-'
 
defined-type-name
直前の定義済み別名、 定義済み構造体、または序数タイプの名前を指定します。

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

TYPE 属性を DEFINE ALIAS ステートメントで指定して、 直前の DEFINE ALIAS ステートメントで定義されたタイプのための 別名を指定することができます。 以下に例を示します。

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

以下の例は、いくつかの名前付きタイプ、 構造体タイプ (tm) を定義し、このタイプ付き構造体への ハンドルを取得する C 関数を宣言しています。

   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)