Purpose
Specifies a name that can be used as a synonym for the set of data type attributes you give to the alias.
Syntax
DEFINE ALIAS [alias-name, attribute,];
Parameters
-
alias-name
- Specifies the name that can be used wherever the explicit data type defined by the specified attributes is allowed.
- attributes
- The specified attributes that define the alias. Separate each attribute with a comma(,). The attributes that can be specified are any of the attributes for variables that can be returned by a function (for example, those attributes valid in the RETURNS option and attribute). Therefore, you cannot specify an alias for an array or a structured attribute list. However, you can specify an alias for a type that is defined:
- in a DEFINE ORDINAL statement
- in a DEFINE STRUCTURE statement
- in another DEFINE ALIAS statement.
- Also, as in the RETURNS option and attribute, any string lengths or area sizes must be restricted expressions.
Missing data attributes are supplied using PL/I defaults.
Example
define alias Name char(31) varying;
define alias Salary fixed dec(7); /* real by default */
define alias Zip char(5) /* nonvarying by default */
Note: Whenever Name is used in a DECLARE statement, it has the attributes
char(31) varying.
Description
An alias can be used wherever an explicit data type can be used. Using DEFINE ALIAS, you can define an alias for a collection of data attributes. This lets you assign meaningful names to data types, which can make a program easier to understand. Aliases also let you provide a shorter notation for a set of data attributes, which can decrease typographical errors.