pascalsrc PASCAL — VMS Pascal_3.8
VAX PASCAL is an extended implementation of the PASCAL language
that has been developed for use under the VAX/VMS operating
system.
The command, PASCAL, invokes the VAX PASCAL compiler to compile
one or more source programs.
Format:
PASCAL file-spec[,...]
Additional information available:
ParametersQualifiersLexical ElementsData TypesExpressionsDeclaration Section
StatementsPredeclared RoutinesInput OutputCompilation UnitsAttributes
MiscellaneousRelease Notes
/ANALYSIS_DATA/CHECK/CROSS_REFERENCE/DEBUG/DIAGNOSTICS
/ENVIRONMENT/ERROR_LIMIT/G_FLOATING/LIBRARY
/LIST/MACHINE_CODE/OBJECT/OLD_VERSION/OPTIMIZE
/SHOW/STANDARD/TERMINAL/USAGE/WARNINGS
Parameters
file-spec[,...] Specifies one or more VAX PASCAL source files to be compiled. If you do not specify a file type for an input file, the default file type PAS is used. You can specify more than one input file. If you separate the file specifications with commas (,), each file is compiled separately. If you separate the file specifications with plus signs (+), the files are concatenated and compiled as a single input file, producing single object and listing files. If you specify SYS$INPUT as the file-spec parameter, the source program must follow the command in the input stream. In this case, both the object module file (specified by the /OBJECT qualifier) and the listing file (specified by the /LIST qualifier) must be explicitly named.
Qualifiers
Indicate special actions to be performed by the compiler on the file(s) listed. Compiler qualifiers can apply to either the PASCAL command or to the specification of the file being compiled. When a qualifier follows the PASCAL command, it applies to all files listed. When a qualifier follows the file specification, it applies only to the file immediately preceding it.
/ANALYSIS_DATA[=file-spec] D=/NOANALYSIS_DATA
/NOANALYSIS_DATA Creates a file containing source code analysis information. If the file-spec is omitted, the default file name is the same as the source program; the default file type is ANA. The analysis file is reserved for use with Digital layered products, such as, but not limited to, the VAX Source Code Analyzer.
/CHECK[=(option[,...])] D=/CHECK=BOUNDS
/NOCHECK
Directs the compiler to generate code to perform run-time checks
indicated by the chosen options.
ALL Generates checking code for all options
NONE Suppresses all checking code
[NO]BOUNDS Checks that index values are contained in the
index type and that character string sizes
are compatible
[NO]CASE_SELECTORS Checks for the case selector in the case
label list
[NO]OVERFLOW Checks for integer overflow
[NO]POINTERS Checks whether a pointer value is NIL
[NO]SUBRANGE Checks that values assigned to subrange
variables are within the subrange type
BOUNDS is the only checking option enabled by default. The
/CHECK qualifier without options is equivalent to /CHECK=ALL.
The negation /NOCHECK is equivalent to /CHECK=NONE.
The CHECK attribute in the source program or module overrides
the /CHECK qualifier.
/CROSS_REFERENCE D=/NOCROSS_REFERENCE
/NOCROSS_REFERENCE Controls whether the compiler creates a cross-reference listing of all identifiers. The compiler generates separate cross-references for each routine. Note that this qualifier is ignored if the /LIST qualifier is disabled. By default, /NOCROSS_REFERENCE is enabled.
/DEBUG[=(option[,...])] D=/DEBUG=TRACEBACK
/NODEBUG
Controls whether the compiler makes the information specified by
the options available to the VAX Symbolic Debugger and the
run-time error-reporting mechanism.
ALL Includes symbol table and traceback
information in the object module
NONE No debugging information is available
[NO]SYMBOLS Includes only symbol table information
[NO]TRACEBACK Includes only traceback information
/DEBUG=TRACEBACK is enabled by default. The /DEBUG qualifier
without options is equivalent to /DEBUG=ALL. The /NODEBUG
qualifier is equivalent to /DEBUG=NONE.
/DIAGNOSTICS[=file-spec] D=/NODIAGNOSTICS
/NODIAGNOSTICS Creates a file containing compiler messages and diagnostic information. If the file-spec is omitted, the default file name is the same as the source program; the default file type is DIA. The diagnostics file is reserved for use with Digital layered products, such as, but not limited to, the VAX Language-Sensitive Editor.
/ENVIRONMENT[=file-spec] D=/NOENVIRONMENT
/NOENVIRONMENT Controls whether the compiler produces an environment file in which declarations and definitions made at the outermost level of a compilation unit are saved. If the file-spec is omitted, the default file name is the same as the source program; the default file type is PEN. The /ENVIRONMENT qualifier overrides the ENVIRONMENT attribute in the source program or module. You can use the /ENVIRONMENT qualifier to suppress the creation of an environment file dictated by an ENVIRONMENT attribute, or to change the name of an environment file specified by an ENVIRONMENT attribute. By default, the attributes in the source file determine whether an environment file is produced; however, if the /ENVIRONMENT qualifier is specified at compile time, an environment file will always be created.
/ERROR_LIMIT[=n] D=/ERROR_LIMIT=30
/NOERROR_LIMIT Indicates whether compilation should terminate after the occurrence of a specified number of errors, excluding warnings and informational messages. If you specify /NOERROR_LIMIT, the compilation continues until 500 errors are detected. By default, /ERROR_LIMIT=30 is enabled.
/G_FLOATING D=/NOG_FLOATING
/NOG_FLOATING Controls whether the compiler uses G_floating or D_floating representation and instructions for values of type DOUBLE. Routines and compilation units between which double-precision quantities are passed should not mix the G_floating and D_floating types. Not all VAX processors support the G_floating type. If this qualifier conflicts with a double-precision attribute in the source program, a warning occurs. By default, /NOG_FLOATING is enabled.
/LIBRARY D=/NOLIBRARY
/NOLIBRARY Indicates that an input file is a text library. The default file type for a text library is TLB. The %INCLUDE directive in a Pascal program allows you to extract modules from text libraries. The /LIBRARY qualifier can appear on one or more of the files in a list of files separated by plus signs. At least one of the files in the list must be a non-library file.
/LIST[=file-spec] D=/NOLIST
/NOLIST Controls whether the compiler creates a listing file. If you omit the file specification, the compiler defaults to the name of the first source file, your default directory, and a file type of LIS. The compiler does not produce a listing file in interactive mode unless you specify the /LIST qualifier. In batch mode, the compiler produces a listing file by default. To suppress the listing file, use the /NOLIST qualifier. In either mode, the listing file is not automatically printed. You must use the PRINT command to obtain a line printer copy of the listing file.
/MACHINE_CODE D=/NOMACHINE_CODE
/NOMACHINE_CODE Specifies whether the listing file should include a representation of the object code generated by the compiler. If no listing file is being generated, this qualifier is ignored. No machine code is generated if errors are detected in the source program or module. By default, /NOMACHINE_CODE is enabled.
/OBJECT[=file-spec] D=/OBJECT
/NOOBJECT Controls whether the compiler creates an object module. The /NOOBJECT qualifier is useful when you want to test the source program for compilation errors. By default, /OBJECT is enabled; the compiler produces an object module with the same file name as the first source file and a file type of OBJ.
/OLD_VERSION D=/NOOLD_VERSION
/NOOLD_VERSION Specifies which VAX PASCAL language definition the compiler should use to resolve conflicts. When /OLD_VERSION is enabled, the compiler uses the Version 1 language definition. See the VAX PASCAL Language Reference Manual for a complete description of the language differences resolved by /OLD_VERSION. By default, /NOOLD_VERSION is enabled so that differences are resolved using the language definition of VAX PASCAL Version 2 and subsequent versions.
/OPTIMIZE[=(option[,...])] D=/OPTIMIZE=ALL
/NOOPTIMIZE
Controls whether the compiler optimizes the code for the program
or module being compiled. Optimization results in the
production of more efficient object code. The option list lists
the optimization to be performed during compilation.
ALL Enables all /OPTIMIZE options
NONE Disables all /OPTIMIZE options
[NO]INLINE Enable inline expansion of user-defined routines
By default, /OPTIMIZE=ALL is enabled. The /OPTIMIZE qualifier
without options is equivalent to /OPTIMIZE=ALL. The /NOOPTIMIZE
qualifier is equivalent to /OPTIMIZE=NONE.
Some VAX PASCAL Version 1 programs may require the use of
/NOOPTIMIZE in order to execute properly with Version 3. In
addition, /NOOPTIMIZE can be useful in conjunction with /CHECK
or /DEBUG because optimization can make checking and debugging
more difficult.
The optimization attributes in the source program override the
/OPTIMIZE and /NOOPTIMIZE qualifiers.
/SHOW[=(option[,...])] D=/SHOW=(DICT,HEAD,INCL,NOINL,SOUR,STAT,TABLE)
/NOSHOW
Indicates a list of items to be included in the listing file.
ALL Enable listing for all options
NONE Disables all /SHOW options
[NO]DICTIONARY Enable listing of %DICTIONARY files
[NO]INCLUDE Enable listing of %INCLUDE files
[NO]INLINE Enable listing of inline summary
[NO]HEADER Enable listing of page headers
[NO]SOURCE Enable listing of source program
[NO]STATISTICS Enable listing of compiler statistics
[NO]TABLE_OF_CONTENTS Enable listing of table of contents page
The compiler ignores the /SHOW qualifier if the /LIST qualifier
is not enabled. By default for the /SHOW qualifier is
/SHOW=(DICTIONARY,INCLUDE,NOINLINE,HEADER,SOURCE,STATISTICS,
TABLE_OF_CONTENTS). The negation /NOSHOW is equivalent to
/SHOW=NONE.
/STANDARD[=option] D=/NOSTANDARD
/NOSTANDARD
Indicates whether the compiler should print informational
messages if nonstandard PASCAL features are used in the source
program. Nonstandard PASCAL features are the extensions to the
PASCAL language that are incorporated in VAX PASCAL. Standard
features fall under either the ISO standard (ISO 7185-1983(E))
or the ANSI standard (ANSI/IEEE770X3.97-1983.)
NONE Disable standards checking
ANSI Use the rules of the ANSI standard
ISO Use the rules of the ISO standard
[NO]VALIDATION Perform validation for the given standard
Note /STANDARD only allows for two options. The first, selects
the standard to be used, ANSI or ISO. The second, determines
whether the "strict" validation rules are to be enforced,
[NO]VALIDATION. Therefore, the following is NOT allowed
/STANDARD=(ANSI,ISO,VALIDATION) since both ANSI and ISO are
specified.
The default is /NOSTANDARD. The /STANDARD qualifier without
options is equivalent to /STANDARD=(ANSI,NOVALIDATION).
/STANDARD=VALIDATION is equivalent to /STANDARD=(ANSI,
VALIDATION). The negation /NOSTANDARD is equivalent to
/STANDARD=NONE.
/TERMINAL[=(option[,...])] D=/NOTERMINAL
/NOTERMINAL
Indicates a list of items to be displayed on the terminal.
ALL Enable displaying of all options
NONE Disables all /TERMINAL options
[NO]FILE_NAME Enable displaying of file names
[NO]ROUTINE_NAME Enable displaying of routine names
[NO]STATISTICS Enable displaying of compiler statistics
By default, /NOTERMINAL is enabled. The /TERMINAL qualifier
without options is equivalent to /TERMINAL=ALL. The negation
/NOTERMINAL is equivalent to /TERMINAL=NONE.
/USAGE[=(option[,...])] D=/USAGE=(NOUNCERT,UNINIT,NOUNUSED)
/NOUSAGE
Directs the compiler to perform compile-time checks indicated by
the chosen options.
ALL Enable checking of all options
NONE Disables all /USAGE options
[NO]UNCERTIAN Checks for variables that may be uninitialized
depending on program flow
[NO]UNINITIALIZED Check for variables that are known to be
uninitialized
[NO]UNUSED Check for variables that are declared but never
referenced
By default, /USAGE=(NOUNCERTAIN,UNINITIALIZED,NOUNUSED) is
enabled. /USAGE without options is equivalent to /USAGE =ALL.
The negation /NOUSAGE is equivalent to /USAGE=NONE.
/WARNINGS D=/WARNINGS
/NOWARNINGS Controls whether the compiler issues warning-level diagnostic messages in response to warning-level errors. A warning message indicates that the compiler has detected acceptable but unorthodox syntax or that it has performed some corrective action. In either case, unexpected results may occur. Note that messages generated when the /STANDARD qualifier is enabled appear even if /WARNINGS is disabled. By default, /WARNING is enabled; use the /NOWARNINGS qualifier to suppress these messages.
Lexical Elements
A PASCAL program is composed entirely of lexical elements. These elements are individual symbols, such as arithmetic operators, or they may be words that have special meanings in PASCAL. The basic unit of any lexical element is a character, which must be a member of the ASCII character set. The words used in a PASCAL program are combinations of alphabetic and numeric characters and occasionally a dollar sign ($), an underscore (_), or a percent sign (%). Some words are reserved for the names of executable statements, operations, and predefined data structures. Other words in a PASCAL program are identifiers. Predeclared identifiers represent routines and data types provided by VAX PASCAL. Other identifiers are created by the use to name programs, symbolic constants, variables, and any necessary program elements that have not already been named.
Additional information available:
Character SetSpecial SymbolsReserved WordsIdentifiers
Character Set
VAX PASCAL uses an extended ASCII character set. It contains 256 characters, each of which corresponds to a numeric value (for a complete listing of the ASCII character set, see Appendix A in the Programming in VAX PASCAL Manual).
Special Symbols
Special symbols represent delimiters, operators, and other
syntactic elements. Notes that in symbols composed of more that
one character, the characters cannot be separated by spaces.
Examples of special symbols include apostrophe ('), the
assignment operator (:=) and the not equal sign (<>).
Reserved Words
Reserved words are words that are reserved for the names of statements, data types, and operators in the PASCAL language. They can be used in a program only in the contexts for which they are defined. You cannot redefine a reserved word for use as an identifier. Examples of reserved words include AND, END, NOT, IF, and WHILE.
Identifiers
Identifiers are used to name programs, modules, symbolic constants, data types, variables, procedures, functions, and program sections.
Additional information available:
Predeclared IdentifiersUser Defined Identifiers
Predeclared Identifiers
Predeclared identifiers in VAX PASCAL are words reserved for names of procedures, functions, data types, symbolic constants and file variables. They can be redefined to denote some other item. Once a predefined identifier is redefined, it can no longer be used for its usual purpose within the block in which it is redefined. Examples of predeclared identifiers include ADDRESS, COS, INTEGER, SQR and TRUE.
User Defined Identifiers
User identifiers denote the names of programs, modules, symbolic constants, variables, procedures, functions, program sections, and user-defined types. They represent significant data structures, or values and actions that are not represented by reserved words, predeclared identifiers, or special symbols. An identifier is a combination of letters, digits, dollar signs ($), and underscores (_). Note that an identifier cannot start with a digit, cannot contain any space or special symbols and must in the first 31 characters denote a unique name within the block in which the identifier is declared.
Data Types
A data type determines both the range of values a data item can have and the operations that can be performed on it. It also determines the storage space required for all of the data item's possible values. There are four categories of data types: ordinal, real, structured, and pointer. Ordinal and real types are fundamental types which serve as building blocks for the structured types. The pointer type lets a user refer to dynamically allocated variables.
Additional information available:
OrdinalRealStructured TypesPointer Types
Ordinal
The values in an ordinal type have a one-to-one correspondence with the set of positive integers. Each has a unique ordinal value that indicates its position in a list of all the values of the type.
Additional information available:
INTEGER
The INTEGER data type denotes positive and negative integer values ranging from -2**31+1 through 2**31-1 (numbers -2,147,483,647 -> 2,147,483,647). The largest possible value of the INTEGER type is represented by the constant identifier MAXINT.
Additional information available:
Int Radix
Integers can also be specified in binary, octal or hexadecimal
notation. These forms can be used anywhere decimal integers can
be used, except as labels. To specify an integer in one of
these notations, place a percent sign (%) and a letter in front
of a number enclosed in apostrophes. The appropriate letters,
which may be either upper- or lowercase are B (binary), O
(octal) and X (hexadecimal). Inside the apostrophes, you can
include spaces and tabs to make the notation easy to read. Note
that regardless of which notation you use, the integer value
specified within the quotes may not be greater than MAXINT nor
less than 0. For example:
%b'1000 0011'
%o'7712'
%x'DEC'
Since the integer value specified always creates a nonnegative
constant, the sign bit cannot be set (or cleared) by setting (or
clearing) the high order bit. To specify a signed integer,
precede the percent sign (%) with the desired unary plus
operator (+) or the unary minus operator (-). This allows you
to specify a constant integer expression whose value is between
-MAXINT and MAXINT, inclusively. For example, to specify
-MAXINT, the following notation can be used:
-X%'7FFF FFFF'
UNSIGNED
The UNSIGNED data type denotes nonnegative integer values from 0 through 2**32-1. The largest possible value of this data type is 4,294,967,295, which is more than twice as large as the value of MAXINT (the largest integer value).
Additional information available:
Uns Radix When a VAX PASCAL program contains an integer
Uns Radix When a VAX PASCAL program contains an integer
constant greater than MAXINT, the constant is treated as being of
type UNSIGNED. Unsigned integers can be written in decimal,
binary, octal and hexadecimal notations. For example, to
indicate that value MAXINT+1 and the largest unsigned value
respectively, you could specify the following:
%X'8000 0000'
%X'FFFF FFFF'
Note, however that integer expressions whose constant value is
not greater than MAXINT and not less than -MAXINT are always
treated as being of type INTEGER. To force an integer constant
to become UNSIGNED rather than INTEGER, use the UINT predeclared
function. For example, to force MAXINT and -MAXINT to be treated
as the UNSIGNED type, you should specify the following:
UINT( %x'7FFF FFFF' )
UINT(-%x'7FFF FFFF' )
CHAR
The CHAR data type consists of single character values from the
ASCII character set. To specify a character constant, enclose a
printable ASCII character in apostrophes. The apostrophe
character itself must be typed twice within apostrophes. Each
of the following is a valid character constant:
'A'
'0' {This is character 0, not the integer value 0}
'''' {The apostrophe character}
Nonprinting characters, such as a control-character, can be
specified by writing an empty string, '', followed by the
ordinal value of the character in the ASCII character set,
enclosed in parentheses. For example:
''(7) {This represents the control character that
corresponds to the bell character}
BOOLEAN
The elements of the BOOLEAN data type are the two predeclared identifiers FALSE and TRUE ordered so that FALSE is less than TRUE. Boolean values are the result of testing relationships for truth or validity.
Enumerated
An enumerated type is an ordered set of constant values denoted
by identifiers. The enumerated type syntax requires that all
constant identifiers of the type be listed in order and enclosed
in parentheses. It has the following form:
({identifier},...)
An 'IDENTIFIER' is a constant value of the type.
Example: X : (spring, summer, fall, winter)
This defines 'X' to be of the enumerated type (spring, summer,
fall, winter). The values of an enumerated type follow a left
to right order such that any identifier in the list has an
ordinal value greater than the ordinal values of all identifiers
to its left and less than the ordinal values of all identifiers
to its right. Thus, 'spring' is less than 'fall' and 'fall' is
less than 'winter' and 'winter is greater than 'summer'. A
maximum of 65,535 identifiers can be listed in an enumerated
type.
Subrange
A subrange type specifies a limited portion of another ordinal
type (called the base type) for use as a distinct type. The
subrange syntax indicates the lower and upper limits of the
type.
lower-bound .. upper-bound
The 'LOWER-BOUND' is a constant expression that establishes the
lower limit of the subrange.
The 'UPPER-BOUND' is a constant expression that establishes the
upper limit of the subrange.
Example: '0' .. '9' { single digit numbers }
'A' .. 'M' { the first half of the alphabet }
1 .. 31 { the days of a month }
If (Jan, Feb, March, April) is an enumerated type then
Jan..March is a subrange of the enumerated type which
contains Jan, Feb, and March.
Real
Real types allow the expression of real-number values with different degrees of precision.
Additional information available:
REAL
The REAL type denotes single-precision real values.
Example: 2.4
2.3e2 { exponential notation }
SINGLE
The SINGLE type denotes single-precision real values.
Example: 2.4
2.3e2 { exponential notation }
DOUBLE
The DOUBLE type denotes double-precision real values. To
indicate a double-precision real number, you must use
exponential notation using the letter D to indicate the
exponent.
Example: 0D0
4.371528665D-3
DOUBLE exists in two formats, G_Floating and D_Floating, which
allow you to choose whether double-precision values will express
a very wide range (G_Floating) or a more limited range with
somewhat greater precision (D_Floating). You should not use
both formats of DOUBLE in the same compilation unit. To specify
with DOUBLE is desired use either the [NO]G_Floating attribute
or command line qualifier.
QUADRUPLE
The QUADRUPLE type denotes quadruple-precision real values. To
indicate a quadruple-precision real number, you must use
exponential notation using the letter Q to indicate the
exponent.
Example: 0.11435Q3
3362Q2
0.11825q-4
Structured Types
A structured type is a type that can contain more than one component at a time. Components can be of ordinal, real, structured or pointer type. You can either access individual components of the type or process the entire structure.
Additional information available:
RECORDARRAYPACKEDVARYING_OF_CHARSET
RECORD
A RECORD is a group of components called fields which may be of
different types and which may contain one or more data items.
The record type has the following form:
[[PACKED]] RECORD
field-list
END
The following is an example of a record type:
RECORD
Part : INTEGER;
Received : RECORD
Month : (Jan, Feb, Mar, Apr, May, June,
Jul, Aug, Sep, Oct, Nov, Dec);
Day : 1..31;
Year : INTEGER;
END;
END;
Additional information available:
Field list
The syntax for a field list is:
[[ [[ {{field-id},... : [[attribute-list]] type};... [;] ]]
[[ variant-clause [;] ]] [;] ]]
The 'FIELD-ID' is the name of a field. No field identifiers
need to be specified, thus making the field list empty.
An 'ATTRIBUTE-LIST' is one or more optional identifiers that
provide additional information about the field(s) (see help
under 'PASCAL Attributes').
The 'TYPE' is the type of the corresponding field(s). A field
may be of any type.
A 'VARIANT-CLAUSE' is the variant part of a record. A variant
can contain different types or different amounts of data at
different times during program execution. The syntax for a
variant clause is as follows:
CASE [[tag-id : ]] [[attribute-list]] tag-type-id OF
{{case-label-list} : (field-list)};...
[[ [;] OTHERWISE
(field-list); ]]
The 'TAG-ID' defines the name of the tag field. The tag field
is all of the elements between the reserved words CASE and OF.
The 'TAG-TYPE-ID' defines the type of the tag field. The tag
type identifier must denote an integer, unsigned, char, boolean,
enumerated or subrange type.
The 'CASE-LABEL-LIST' consists of one or more constant values of
the tag field type either separated by commas or specified in a
range of ordinal values.
The following is an example of a variant record:
RECORD
Part : 1..9999;
CASE Onorder : BOOLEAN OF
TRUE : (Order_Quantity : INTEGER;
Price : REAL);
FALSE : (Rec_Quantity : INTEGER;
Cost : REAL);
END;
In this example, the last two field in the record vary depending
on whether the part is on order. Records for which the value of
the tag identifier Onorder is TRUE will contain information
about the current order; those for which it is FALSE, about the
previous shipment.
Record constructor
In a record constructor, constant values of the appropriate
types are listed within parentheses in the same order as the
corresponding fields appear in the record type definition.
Constructors for nested records are enclosed in nested
parentheses. Record constructors are used in the following
three ways:
1. in CONST sections to define symbolic constants
2. in VAR and VALUE sections to initialize variables of record
type
3. in executable sections to pass parameters to PASCAL routines
Additional information available:
Example
The following is an example of a record variable and a possible
record constructor:
Rec : RECORD
Person : VARYING [30] OF CHAR;
Address : RECORD
Number : INTEGER;
Street : VARYING [30] OF CHAR;
Zip : 0..9999;
END;
Age : 0..150:
END;
('Blaise Pascal', (1623, 'Pensees Street', 91662), 39)
ARRAY
An ARRAY is a group of components of the same type which share a
common identifier. The array type definition specifies its
dimensions, the bounds of each dimension and the types of its
indexes and components. It has the form:
[[PACKED]] ARRAY [ {[[attribute-list]] index-type},... ] OF
[[attribute-list]] component-type
An 'ATTRIBUTE-LIST' is one or more optional identifiers that
provide information about the index type or the component type
(see help under 'PASCAL Attributes').
The 'INDEX-TYPE' is the type of the index, which can be any
ordinal type.
The 'COMPONENT-TYPE' is the type of the array components, which
can be any type.
Example: ARRAY [0..4] OF INTEGER
An array whose components are themselves arrays is
multidimensional because it has more than one index. An array
can have any number of dimensions, and each dimension can have a
different index type.
Example: ARRAY [0..4, 'A'..'D'] OF INTEGER
This array is declared as two-dimensional. To refer to a
component of this two-dimensional array, specify the variable
name followed by the two bracketed index values. For example
X[0,'A'] or X[0]['A'] specify the component in 'X' at position
'0', 'A''.
Additional information available:
Array constructor
In an array constructor, a constant value of the appropriate
type for every component is listed within parentheses. To
specify the same value for consecutive components, you can use a
repetition factor of either of the two following forms:
n OF value
REPEAT value
The integer n denotes the number of consecutive components that
are to receive the same value; n must be a constant expression
of type INTEGER.
REPEAT initializes all remaining components to the same value.
In both repetition forms, the value specified can be either a
signed constant or another constructor of the component type.
Constructors for nested arrays are enclosed in nested
parentheses. Array constructors are used in the following three
ways:
1. in CONST sections to define symbolic constants
2. in VAR and VALUE sections to initialize variables of array
type
3. in executable sections to pass parameters to PASCAL routines
Additional information available:
Example
The following is an example of an array variable and a possible
array constructor:
Result : ARRAY [1..2, 0..4] OF INTEGER;
((0,1,2,3,4),(5,6,7,8,9))
PACKED
The PACKED attribute applied to an array variable allows the definition of fixed length character strings. A PACKED ARRAY must have a lower bound of 1. The length of the string is established by the array's upper bound. The PACKED attribute forces the size of variables to be represented in bits. The PACKED size of a variable is the minimum number of bits required to represent all values of the variable's type.
VARYING_OF_CHAR
The VARYING OF CHAR type denotes a string of character
components. The maximum length of the string is established by
the VARYING OF CHAR type definition. It can have values of any
length, from zero to the maximum specified. It has the form:
VARYING [upper-bound] OF [[attribute-list]] CHAR
The 'UPPER-BOUND' is an integer in the range from 1 through
65,535 that indicates the length of the longest possible string.
An 'ATTRIBUTE-LIST' is one or more optional identifiers that
provide additional information about the VARYING string
components (see help under 'PASCAL Attributes').
Although a VARYING OF CHAR is a distinct type, it possesses some
of the properties of both record and array types. A VARYING
string is actually stored as though it were a record with two
fields, LENGTH and BODY. LENGTH and BODY are predeclared field
identifiers in VAX PASCAL. The LENGTH field contains the length
of the current character string; the BODY field contains the
string. Either field can be accessed in the same way record
fields are accessed (VARY.LENGTH, VARY.BODY).
Example: VARYING [25] OF CHAR
This VARYING OF CHAR type could have the following values:
'Wolfgang Amadeus Mozart'
'Bach'
SET
A set is a collection of data items of the same ordinal type.
The set type definition specifies the values that can be
elements of a variable of that type. It has the following form:
[[PACKED]] SET OF [[attribute-list]] base-type
An 'ATTRIBUTE-LIST' is one or more optional identifiers that
provide additional information about the base type of a set (see
help under 'PASCAL Attributes').
The 'BASE-TYPE' is the ordinal type identifier or type
definition from which the set elements are selected. Note that
real numbers cannot be elements of a set type.
Example: SET OF CHAR
Some possible set constructors for this set type are:
['A, 'E', 'I', 'O', 'U']
['B'..'D', 'F'..'H', 'J'..'N', 'P'..'T', 'V'..'Z']
Additional information available:
Set constructor
A set constructor expresses a constant value of the set type. To form a set constructor, enclose within brackets one or more constant values selected from the list of set elements. You can indicate consecutive values that appear in the set definition by using the subrange (..) symbol.
Additional information available:
Example
For example, a constructor for a SET OF 35..115 can look like
this:
[39, 67, 95, 110..115]
A set having no elements is called an empty set and is written
[].
File
A file is a sequence of components of the same type. The number
of components is not fixed, so a file can be any length. The
file type definition identifies the component type. It has the
form:
[[PACKED]] FILE OF [[attribute-list]] component-type
An 'ATTRIBUTE-LIST' is one or more optional identifiers that
provide additional information about the file components (see
help under 'PASCAL Attributes').
The 'COMPONENT-TYPE' is the type of the file components which
can be any ordinal, real, pointer, or structured type, except a
file type or a structured type with a file component.
Example: FILE OF BOOLEAN
This example shows a file of BOOLEAN values. If a variable,
'TRUTHS', is declared of this type, the file buffer is denoted by
TRUTHS^.
Additional information available:
Text FileExternal and Internal Files
Text File
VAX PASCAL supplies a predefined file type called TEXT. Variables of this type are called text files and have components of type CHAR. a text file differs from a file of type FILE OF CHAR in that it is divided into lines. Each line in a text file is a sequence of characters terminated by an end-of-line marker. You can refer to the marker indirectly through the predeclared procedure READLN and WRITELN and the predeclared function EOLN. The predeclared file variables INPUT and OUTPUT are files of type TEXT. They refer to the standard input and output files.
External and Internal Files
A file that has a name in a directory and exists outside the context of a VAX PASCAL program is known to the VAX Record Management Services as an external file. A file that has no name and is not retained after the program finishes execution is known as an internal file. A file declared in the program heading is external by default. A file declared in a nested block is internal by default.
Pointer Types
The pointer type definition identifies the type identifier of a
dynamic variable. Dynamic variables are allocated in heap
storage as they are needed during program execution. Since
dynamic variables do not have identifiers, they must be referred
to indirectly using pointers. The pointer type definition
identifies the type identifier of the dynamic variable, and has
the following syntax:
^[[attribute-list]] base-type-identifier
An 'ATTRIBUTE-LIST' is one or more optional identifiers that
provide additional information about the base type (see help
under 'PASCAL Attributes').
The 'BASE-TYPE-IDENTIFIER' is the type identifier of the dynamic
variable to which the pointer type refers. The base type can be
any type.
Example: TYPE
Reservation = RECORD
Name : VARYING[30] OF CHAR;
Class : (standby, coach, first);
Flight_number : INTEGER;
Next_passenger : ^reservation;
END;
VAR
Ticket : Reservation;
In this example, 'next_passenger' is a pointer to the record
type 'reservation'. The variable 'ticket' is declared as type
'reservation'. By manipulating the pointer variable,
'ticket.next_passenger', a linked list of records can be created
using these definitions.
Expressions
An expression denotes a value. It may be the value of a
constant, variable, or function designator, or may involve the
values of one or more such data items combined with one or more
operators.
An expression is either 'run-time' or 'compile-time'. A
run-time expression includes at least one operand whose value
cannot be determined until execution of the program. A
compile-time expression consists entirely of operands whose
values can be determined when the program is compiled. The
simplest compile-time expression is a single constant or
constant identifier. Compile-time expressions include combining
constants and constant identifiers with operators and the
predeclared functions (see help under 'PASCAL
Predeclared_Routines').
Syntax:
simple-expression [[ {<> | < | <= | = | > | >= | IN}
simple-expression ]]
The syntax for a simple expression is:
{+ | -} term [[ {{+ | - | OR} term}... ]]
The syntax for a term is:
primary [[ {{* | / | DIV | REM | MOD | AND} primary}... ]]
The syntax for a primary is:
factor [[ {** factor}... ]]
A factor can be any of the following:
array-type-identifier array-constructor
constant-identifier
(expression) [[ :: type-identifier ]]
function-identifier [[ actual-parameter-list ]]
NOT factor
numeric-constant
real-constant
record-type-identifier record-constructor
[[ set-type-identifier ]] set-constructor
string-constant
variable
Additional information available:
simple expressiontermprimaryfactorOperators
simple expression
The syntax for a simple expression is:
{+ | -} term [[ {{+ | - | OR} term}...]]
The syntax for a term is:
primary [[ {{* | / | DIV | REM | MOD | AND} primary}... ]]
The syntax for a primary is:
factor [[ {** factor}... ]]
A factor can be any of the following:
array-type-identifier array-constructor
constant-identifier
(expression) [[ :: type-identifier ]]
function-identifier [[ actual-parameter-list ]]
NOT factor
numeric-constant
real-constant
record-type-identifier record-constructor
[[ set-type-identifier ]] set-constructor
string-constant
variable
term
The syntax for a term is:
primary [[ {{* | / | DIV | REM | MOD | AND} primary}... ]]
The syntax for a primary is:
factor [[ {** factor}... ]]
A factor can be any of the following:
array-type-identifier array-constructor
constant-identifier
(expression) [[ :: type-identifier ]]
function-identifier [[ actual-parameter-list ]]
NOT factor
numeric-constant
real-constant
record-type-identifier record-constructor
[[ set-type-identifier ]] set-constructor
string-constant
variable
primary
The syntax for a primary is:
factor [[ {** factor}... ]]
A factor can be any of the following:
array-type-identifier array-constructor
constant-identifier
(expression) [[ :: type-identifier ]]
function-identifier [[ actual-parameter-list ]]
NOT factor
numeric-constant
real-constant
record-type-identifier record-constructor
[[ set-type-identifier ]] set-constructor
string-constant
variable
factor
A factor can be any of the following:
array-type-identifier array-constructor
constant-identifier
(expression) [[ :: type-identifier ]]
function-identifier [[ actual-parameter-list ]]
NOT factor
numeric-constant
real-constant
record-type-identifier record-constructor
[[ set-type-identifier ]] set-constructor
string-constant
variable
Examples:
1. VARIABLES
A variable can be in an expression:
foo -'foo' is a predefined variable of some type
new[1] -the first position of array 'new'
rec.field -a field of record 'rec'
pointer^ -the pointer variable of the pointer type 'pointer'
cast::INTEGER -the variable 'cast' type cast as an integer
2. STRING CONSTANTS
A string constant can have the following forms:
name-string
or
{name-string ({constant-expression},...)}... [[name-string]]
A 'name-string' is a quoted sequence of spaces, tabs, and any
other printing characters. An apostrophe is expressed as ''.
For example, 'hello there' is a name-string.
A '{name-string ({constant-expressions},...)}...
[[name-string]]' is a sequence that makes up a name-string. For
example, the list ('bell ' (7) 'character') will, when output to
the terminal, write the string 'bell character' and the bell
will ring, as indicated by the constant expression '(7)'.
3. CONSTANT IDENTIFIER
A constant identifier is an identifier of a type that can be
determined at compile time. The following are examples of
constant identifiers:
CONST
foo = 3;
exp = 8 * 9;
func = MAX(3, 2, 4);
4. EXPRESSION IDENTIFIER
An expression identifier is an expression in parentheses
optionally followed by a type cast structure. Examples are:
(a + b) -'a' and 'b' are predeclared variable identifiers
(foo)::INTEGER -expression 'foo' type cast as an integer
5. FUNCTION IDENTIFIER
A function identifier is the name of a predeclared function. If
the function has formal parameters, the function identifier must
be followed by one actual parameter for each formal parameter
listed. For example:
FUNCTION foo (VAR n : INTEGER; start : BOOLEAN) : REAL;
a call to function 'foo' could look like:
foo(bar, TRUE)
Function 'foo' returns a REAL value.
Operators
PASCAL provides several classes of operators. Complex compile-time and run-time expressions can be formed using operators to combine constants, constant identifiers, variables, and function designators.
Additional information available:
Arithmetic OperatorsRelational OperatorsLogical OperatorsString Operators
Set OperatorsType Cast Operator
Arithmetic Operators
An arithmetic operator usually provides a formula for
calculating a value. To perform arithmetic operations, numeric
data items are combined with one or more of the arithmetic
operators.
Arithmetic Operators:
operator | example | result
--------------------------------------------
+ A + B Sum of A and B
- A - B B subtracted from A
* A * B Product of A and B
** A**B A raised to the power of B
/ A / B A divided by B
DIV A DIV B Result of A divided by B,
truncated toward zero
REM A REM B Remainder of A divided by B
MOD A MOD B Modulus of A with respect to B
Relational Operators
A relational operator tests the relationship between two
ordinal, real, string, or set expressions and returns a Boolean
result. If the relationship holds, the result is TRUE;
otherwise the result is FALSE. Relational operators can also be
applied to string operands and set operators.
Relational Operators:
operator | example | result
--------------------------------------------
= A = B TRUE if A is equal to B
<> A <> B TRUE if A is not equal to B
< A < B TRUE if A is less than B
<= A <= B TRUE if A is less than or equal to B
> A > B TRUE if A is greater than B
>= A >= B TRUE if A is greater than or equal to B
Logical Operators
A logical operator evaluates one or more Boolean expressions and
returns a Boolean result.
Logical Operators:
operator | example | result
--------------------------------------------
AND A AND B TRUE if both A and B are TRUE
OR A OR B TRUE if either A or B is TRUE
(or if both are TRUE)
NOT NOT A TRUE if A is FALSE (FALSE if A is TRUE)
String Operators
A string operator concatenates or compares character-string
expressions. The result is either a string or a Boolean value.
String Operators:
operator | example | result
--------------------------------------------
+ A + B String that is the concatenation of strings
= A = B TRUE if strings A and B have equal ASCII values
<> A <> B TRUE if strings A and B have unequal ASCII
values
< A < B TRUE if the ASCII value of string A is less
than that of string B
<= A <= B TRUE if the ASCII value of string A is less
than or equal to that of string B
> A > B TRUE if the ASCII value of string A is greater
than that of string B
>= A >= B TRUE if the ASCII value of string A is greater
than or equal to that of string B
Set Operators
A set operator forms the union, intersection, difference, or
exclusive or (XOR) of two sets, compares two sets, or tests an
ordinal value for inclusion in a set. Its result is either a
set or a Boolean value.
Set Operators:
operator | example | result
--------------------------------------------
+ A + B Set that is the union of sets A and B
* A * B Set that is the intersection of sets A
and B
- A - B Set of those elements in set A that are
not also in set B
= A = B TRUE if set A is equal to set B
<> A <> B TRUE if set A is not equal to set B
<= A <= B TRUE if set A is a subset of set B
>= A >= B TRUE if set B is a subset of set A
IN C IN B TRUE if C is an element of set B
Type Cast Operator
The type cast operator changes the context in which a variable
or an expression of a certain data type can be used. The actual
representation of the object being cast is not altered by the
type cast operator but simply overridden for the duration of one
operation. It has the form:
variable-identifier :: type-identifier
or
(expression) :: type-identifier
The type cast operator (::) separates the name of the variable
or an expression in parentheses from its target type, the type
to which it is being cast.
Example:
TYPE
F_Float = PACKED RECORD
frac1 : 0..127;
expo : 0..255;
sign : BOOLEAN;
frac2 : 0..65535;
END;
VAR
A : REAL;
A :: F_Float.expo := A :: F_Float.expo + 1;
The record type 'F_Float' illustrates the layout of an
F_floating real number. The real variable 'A' is cast as a
record of this type, allowing access to the fields containing
the mantissa, exponent, sign, and fraction of 'A'. Adding 1 to
the field containing the exponent would give the same result as
multiplying 'A' by 2.0.
Declaration Section
The declaration section contains sections that declare labels, variables, procedures, and functions. Each section is introduced by an appropriate reserved word - LABEL, CONST, TYPE, VAR, VALUE, PROCEDURE, or FUNCTION.
Additional information available:
Label DeclarationConst DeclarationType DeclarationVariable Declaration
Value DeclarationRoutine Declaration
Label Declaration
A LABEL declaration defines labels that make statements
accessible by a GOTO statement. The form of the LABEL
declaration is:
LABEL {label},...;
A 'LABEL' is a decimal integer between 0 and MAXINT or a
symbolic constant. When several labels are being declared, they
can be specified in any order.
Example:
LABEL 0, 6656, 778, 4352;
Const Declaration
A CONST section defines symbolic constants by associating
constant identifiers with compile-time expressions. The CONST
section has the following form:
CONST
{constant-identifier = constant-expression};...
A 'CONSTANT-IDENTIFIER' is a user-defined identifier of the
symbolic constant being defined.
A 'CONSTANT-EXPRESSION' is any legal compile-time expression.
The VAX PASCAL compiler must be able to evaluate all of the
components of a compile-time expression when it compiles the
program.
Example:
CONST
year = 1981;
month = 'January'
almost_pi = 22.0/7.0;
lie = FALSE;
untruth = lie;
This CONST section defines five symbolic constants. 'Year' is
declared to be the numeric value '1981'; 'Month' is declared to
be the string constant 'January'; 'Almost_Pi' is declared to be
the result of '22.0' divided by '7.0'; Lie is declared to be the
boolean value 'FALSE'; and 'Untruth' is declared to be of type
'Lie.'
Type Declaration
A TYPE section introduces the name and set of values for a
user-defined type and follows the form:
TYPE
{type-identifier = [attribute-list] type};...
A 'TYPE-IDENTIFIER' is the user-defined identifier of the type
being defined.
An 'ATTRIBUTE-LIST' is one or more optional identifiers that
provide additional information for use when the type identifier
appears in a declaration (see help under 'PASCAL Attributes').
A 'TYPE' is any legal PASCAL type syntax.
Example:
TYPE
entertainment = (dinner, movie, theater, concert);
days_of_week = (sun, mon, tues, wed, thurs, fri, sat);
hours_worked = ARRAY[mon .. fri] OF INTEGER;
salary = ARRAY[1 .. 50] OF REAL;
pay = salary;
ptr_to_hits = ^hits;
hits = RECORD
title, artist, composer : VARYING[30] OF CHAR;
weeks_on_chart : INTEGER;
first_version : BOOLEAN;
END;
This TYPE definition defines seven types and their identifiers.
Both 'entertainment' and 'days_of_week' are enumerated types;
'hours_worked' is an array type of five integer components as
described by the index which is a subrange of the enumerated
type 'days_of_week'; 'salary' and 'pay' are identical array
types of 50 real numbers each; 'ptr_to_hits' is defined as a
pointer to the type 'hits', which is a record with five fields.
Variable Declaration
A VAR section declares variables and associates with each
variable an identifier, a type, and optionally an initial value.
It has the form:
VAR
{{variable-identifier},... : [[attribute-list]] type
[[:= value]]};...
A 'VARIABLE-IDENTIFIER' is a user-defined identifier of the
variable being declared.
An 'ATTRIBUTE-LIST' is one or more optional identifiers that
provide additional information about the variable (see help
under 'PASCAL Attributes').
A 'TYPE' is any legal PASCAL type syntax.
The 'VALUE' is any assignment compatible compile-time
expression. This 'value' becomes the initial value of the
declared variable.
Example:
TYPE
entertainment = (dinner, movie, theater, concert);
days_of_week = (sun, mon, tues, wed, thurs, fri, sat);
hours_worked = ARRAY[mon .. fri] OF INTEGER;
salary = ARRAY[1 .. 50] OF REAL;
pay = salary;
ptr_to_hits = ^hits;
hits = RECORD
title, artist, composer : VARYING[30] OF CHAR;
weeks_on_chart : INTEGER;
first_version : BOOLEAN;
END;
VAR
choice : entertainment := dinner;
answer, rumor : BOOLEAN;
temp : INTEGER := 60;
grade : 'A'..'D';
next_song : ptr_to_hits := NIL;
weekly_hours : hours_worked := (7,8,7,9,6);
This VAR section declares seven variables, a few of which are
initialized, and some of which are of the types defined in the
TYPE section preceding the VAR section. The variable 'choice'
is of the user-defined type 'entertainment' and is initialized
with the constant identifier 'dinner'; 'answer' and 'rumor' are
both boolean variables; 'temp' is an integer variable
initialized with the value '60'; 'grade' is of a character
subrange type consisting of the characters 'A', 'B', 'C', and
'D'; 'next_song' is a pointer variable to the record type 'hits'
and is initialized to the constant identifier 'NIL';
'weekly_hours' is declared to be of the user-defined array type
'hours_worked' and is initialized with a constructor of
integers.
Value Declaration
A VALUE declaration is used to initialize ordinal, real, and
structured variables. Unlike the CONST, TYPE and VAR
declaration section, the VALUE section can appear only in the
main program declaration section, that is, you cannot use the
VALUE declaration section in procedures, functions or modules.
The description below presents general information on VALUE
initializations. The exact format of an initialization depends
on the type of the variable being initialized. The VALUE
section has the form:
VALUE
{variable-identifier := value};...
The 'VARIABLE-IDENTIFIER' is the name of the variable to be
initialized. You cannot specify a list of variable identifiers.
The 'VALUE' is a constant of the same type as the variable,
record field or array element, or a constructor for a record,
array or set variable.
Example:
VAR
School : Record
Class : Record
Grades : Char;
Order : Integer;
End;
Passed : Boolean;
End;
VALUE
School := (('B', 14), TRUE);
The constructor of School specifies a constant value of the
correct type for each field in the record.
In addition to complete initialization, VAX PASCAL also allows
you to do partial initialization in the VALUE section; that is,
you can assign values to specific elements of a structured
variable. Using the above example of complete initialization,
you could initialize the nested record Class by using constants:
VALUE
School.Class.Grades := 'A';
School.Class.Order := 1;
or, you could perform the same initialization by using a
constructor such as:
VALUE
School.Class := ('A', 1);
Routine Declaration
The basic algorithm for a program can usually be divided into
relatively simple, repetitive tasks. In PASCAL, you can code
each task separately as a routine; that is, as either a
procedure or a function.
Both procedures and functions associate a set of statements with
an identifier; the statements are executed as a group when the
routine is called. In addition, a function returns a value of
its declared type to the calling program or routine. You may
call a function anywhere that an expression of its result type
is allowed.
The format of a procedure declaration is:
[[attribute-list]] PROCEDURE procedure-id [[formal-parameter-list]];
block-or-directive;
The format of a function declaration is:
[[attribute-list]] FUNCTION function-id [[formal-parameter-list]]
: [[attribute-list]] result-type-id;
block-or-directive;
An 'ATTRIBUTE-LIST' is one or more optional identifiers that
provide additional information about the procedure, function, or
function result.
The 'PROCEDURE-ID' and 'FUNCTION-ID' are the identifiers that
name the routine and, in the case of functions, name the
function result.
The 'RESULT-TYPE-ID' is the type identifier of the function
result. It can denote any type except a file type or a
structured type with a file component.
Example:
PROCEDURE READ_WRITE( VAR A : INTEGER );
This declares a procedure, 'READ_WRITE', which takes one
variable parameter, 'A'.
Example:
FUNCTION COUNTER( VAR instring, outstring : VARYING[10] OF CHAR;
VAR valid : BOOLEAN ) : INTEGER;
This declares a function, 'COUNTER', which takes three variable
parameters, 'INSTRING', 'OUTSTRING', and 'VALID' and returns an
INTEGER value.
Additional information available:
formal parameter listblockdirective
formal parameter list
Formal parameters consist of input parameters, output
parameters, and routine parameters. A routine uses input
parameters to obtain values; it uses output parameters to return
values; and it uses routine parameters to call another routine
named by a formal parameter.
There are five types of formal parameters: VALUE, VARIABLE,
PROCEDURE, FUNCTION, and foreign.
A formal VALUE parameter represents a local variable within the
called routine. An actual value parameter is passed to the
called routine. The called routine uses a copy of the actual
value parameter to initialize the formal parameter. The copy is
not retained when control returns to the calling block.
Therefore, if the called routine assigns a new value to the
formal parameter, the change it not reflected in the calling
block. A value parameter follows the form:
{identifier},... : [[attribute-list]] {type-id | conformant-schema}
[[:= [[mechanism-specifier]] default]]
A formal VARIABLE parameter represents another name for a
variable in the calling block. It is preceded by the reserved
word VAR. The routine directly accesses the actual parameter
that corresponds to a formal variable parameter, rather than
accessing a copy. Any change done to the formal parameter
effects the actual parameter passed from the calling block. It
follows the form:
VAR {identifier},... : [[attribute-list]]
{type-id | conformant-schema}
[[:= [[mechanism-specifier]] initial-value]]
In the event that you wish to write a routine which invokes
another routine whose effect is not determined until the program
is executed, a PROCEDURE or FUNCTION parameter may be used. To
declare a procedure or a function as a formal parameter to
another routine, you must include a complete routine heading in
the formal parameter list. It follows the form:
[[attribute-list]] PROCEDURE procedure-id [[formal-parameter-list]]
[[ := [[mechanism-specifier]] initial-value ]]
or
[[attribute-list]] FUNCTION function-id [[formal-parameter-list]]
: [[attribute-list]] result-type-id
[[ := [[mechanism-specifier]] initial-value ]]
A foreign mechanism specifier on a formal parameter is used when
declaring an external routine that is called by a PASCAL
routine. The mechanism specifier or passing mechanism attribute
forces the use of mechanisms defined in the VAX Procedure
Calling Standard and also implies certain semantics.
Additional information available:
identifierattribute listmechanism specifiertype idconformant schema
initial value
identifier
An 'IDENTIFIER' is the name of the formal parameter variable.
attribute list
An 'ATTRIBUTE-LIST' is one or more optional identifiers which provide information about the formal parameter.
mechanism specifier
VAX PASCAL provides the foreign mechanism specifiers %IMMED, %REF, %DESCR, and %STDESCR, which can precede a formal parameter in the declaration of an external routine. In addition, it is possible to use the passing mechanism attributes [IMMEDIATE] and [REFERENCE] in a formal parameter's attribute list to obtain the same behavior as %IMMED or %REF, respectively. A %REF or [REFERENCE] formal parameter requires actual parameters to be passed using the 'by-reference' mechanism. Variable semantics are implied unless the actual parameter is an expression, in which case foreign value semantics are implied. A %IMMED or [IMMEDIATE] formal parameter requires the actual parameters to be passed using the 'by-immediate-value' mechanism. Value semantics are implied. Note neither %IMMED or [IMMEDIATE] can be used on formal parameters of type VARYING, or conformant array and conformant VARYING parameters. A %DESCR formal parameter requires actual parameters to be passed using the 'by-descriptor' mechanism and interprets the semantics as %REF or [REFERENCE] does. A %STDESCR formal parameter requires actual parameters to be passed using the 'by-string-descriptor' mechanism. An actual parameter variable of type PACKED ARRAY OF CHAR implies variable semantics. An actual parameter expression of either PACKED ARRAY OF CHAR or VARYING OF CHAR type implies foreign value semantics. Note you cannot use %STDESCR on formal procedure and function parameters.
type id
A type identifier is the declared type identifier of the parameters in this parameter section.
conformant schema
A conformant schema is a syntax that represents a set of types
that are identical except for their bounds. The bounds of a
conformant parameter are determined each time a corresponding
actual parameter is passed. The bounds of an actual parameter
are available within the routine through identifiers declared in
the schema. A conformant schema can only appear within a formal
parameter list. The schema applies to arrays and VARYING OF
CHAR strings.
Conformant Array Schema
ARRAY [{lower-bound .. upper-bound :
[[attribute-list]] index-type-id};...]
OF [[attribute-list]] {type-id | conformant-schema}
PACKED ARRAY [lower-bound .. upper-bound :
[[attribute-list]] index-type-id]
OF [[attribute-list]] type-id
Conformant VARYING Schema
[[attribute-list]] VARYING [upper-bound] OF [[attribute-list]] CHAR
A 'LOWER-BOUND' is an identifier that represents the lower bound
of the conformant array's index.
An 'UPPER-BOUND' is an identifier that represents the upper
bound of the conformant's index.
An 'ATTRIBUTE-LIST' is one or more optional identifiers that
provide additional information about the conformant structure.
An 'INDEX-TYPE-ID' is the type identifier of the index, which
must denote an ordinal type.
A 'TYPE-ID' is the type identifier of the array components,
which can denote any type.
initial value
An initial value is a default value for the parameter. To
declare a default value, you append information to the parameter
declaration by using the following format:
:= [[mechanism-specifier]] constant-expression
The 'MECHANISM-SPECIFIER' is one of the foreign specifiers (see
help under 'PASCAL Declaration_Section Routine_Declaration
formal_parameter_list mechanism_specifier').
The 'CONSTANT-EXPRESSION' is a constant value of the type. It
is evaluated when the routine is declared. This default value
must be a legal actual parameter for the kind of formal
parameter with which the default is associated.
block
A block contains a declaration section and an executable
section.
The declaration section declares labels and identifiers that are
available within the block (see help under 'PASCAL
Declaration_Section'). The labels and identifiers declared
inside of a block are local to that block and are unknown
outside the scope of the routine.
The executable section of the block contains the statements that
perform its actions.
It has the following form:
[[declaration-section]]
BEGIN
{statement};...
END
directive
A directive is the alternative to a block in a routine declaration. A directive provides the compiler with information about either a routine whose heading is declared separately from its body (indicated by the FORWARD directive) or a routine that is external to the PASCAL program (indicated by the EXTERNAL, EXTERN or FORTRAN directives). To specify a directive, include it immediately after the routine heading and follow it with a semicolon. The following describes the two classes of directives. The FORWARD directive allows a routine to refer to another routine whose block has not yet been specified. A forward declaration consists of the routine heading followed by the FORWARD directive. When the block of a forward-declared routine is specified, the routine heading is not repeated. Only the routine type (PROCEDURE or FUNCTION) and routine name are specified. The EXTERNAL, EXTERN and FORTRAN directives indicate that a routine is external to a PASCAL program. They are used to declare independently compiled PASCAL routines written in other languages. For portability reasons, the FORTRAN directive should only be used for external routines written in FORTRAN.
Statements
Statements control the actions performed in a program. They are classified as either simple or structured. The simple statements are the assignment, empty, GOTO and the procedure call. The structured statements are the compound, conditional (CASE, IF-THEN[-ELSE]), repetitive (FOR, REPEAT, WHILE), and WITH statements.
Additional information available:
CASEIF_THEN_ELSEFORREPEATWHILEWITH
GOTO
CompoundAssignmentEmpty StmtRoutine Call
Compound
The compound statement groups a series of statements so that
they can be executed sequentially as though they were a single
statement. It has the syntax:
BEGIN
{statement};...
END
A 'STATEMENT' is any simple or structured statement.
Assignment
An assignment statement assigns a value to a variable or
function identifier. It follows the form:
identifier := expression
An 'IDENTIFIER' is the name of a function or any variable except
a file variable.
An 'EXPRESSION' is a run-time expression whose type is
assignment compatible with the type of the variable.
Additional information available:
Examples
X := 1; {variable 'X' is assigned the value 1}
T := A < B; {value of BOOLEAN expression 'A < B' is assigned to 'T'}
Vowels := ['A', 'E', 'I', 'O', 'U']
{set variable 'VOWELS' is assigned the set
constructor ['A', 'E', 'I', 'O', 'U']}
Empty Stmt
The empty statement causes no action to occur other than the advancement of program flow to the next statement. An empty statement can be represented by two consecutive semicolons. A common use of this is in nested IF-THEN-ELSE statements.
CASE
The CASE statement causes one of several statements to be
executed, depending on the value of a case selector. The CASE
statement has the format:
CASE case-selector OF
{{case-label-list},... : statement};...
[[ [;] OTHERWISE
{statement};...]]
[;]
END
A 'CASE-SELECTOR' is an expression of an ordinal type.
A 'CASE-LABEL-LIST' is one or more constant values of the same
ordinal type as the case selector either separated by commas or
specified in a range. Each case label specifies the statement
to be executed if the value of the case selector is equal to the
case label.
The 'OTHERWISE' clause is executed if the value of the case
selector does not appear in the case label list. This is an
optional clause, but if it is omitted, the value of the case
selector must be equal to one of the case labels.
Additional information available:
Examples
CASE CH OF
' ',TAB : WRITELN('Found a space');
'0'..'9': WRITELN('Found a digit');
'A'..'Z': WRITELN('Found a capital letter');
OTHERWISE
WRITELN('Illegal character');
END;
At run time, the system evaluates the case selector 'CH' and
executes the corresponding statement. If the value of 'CH' is
not equal to ' ', '0'..'9' or 'A'..'Z', the statement in the
'OTHERWISE' clause is executed.
IF_THEN_ELSE
The IF-THEN-ELSE statement causes execution of a statement if
the value of a boolean expression is TRUE. Otherwise, program
control is passed to the statement following the IF-THEN-ELSE
statement. The IF statement has the form:
IF expression
THEN
statement
[[ELSE statement]]
An 'EXPRESSION' is any boolean expression.
The 'THEN' statement is the statement to be executed if the
value of the Boolean expression is TRUE.
The 'ELSE' statement is the statement to be executed if the
value of the Boolean expression is FALSE.
Additional information available:
Examples
IF A = 1
THEN
IF B <> 1
THEN
C := 1
ELSE
D := 1;
If 'A = 1' is TRUE, the 'THEN' clause is executed. Otherwise
nothing is executed. The 'THEN' clause consists of an
'IF-THEN-ELSE' statement. If 'B <> 1' is TRUE, the 'THEN'
clause is executed. If 'B <> 1' is FALSE, the 'ELSE' clause is
executed. An 'ELSE' clause is always considered part of the
closest previous 'IF-THEN' statement.
FOR
The FOR statement specifies the repetitive execution of a
statement based on the value of an automatically incremented or
decremented control variable. It has the form:
FOR control-variable := initial {TO | DOWNTO} final DO
statement
The 'CONTROL-VARIABLE' is the name of a previously declared
variable of an ordinal type. The value of the control variable
is incremented or decremented in units of the appropriate type.
For control variables of type INTEGER or UNSIGNED, one is added
or subtracted to the value upon each iteration. For other
types, the control variable takes on the successor (or
predecessor) value of the type.
The 'INITIAL' is an expression whose type is assignment
compatible with the type of the control variable. It
establishes the initial value of the control variable, which is
the value the loop begins iteration on.
The 'FINAL' is an expression whose type is assignment compatible
with the type of the control variable. It establishes the final
value of the control variable. When the control variable
exceeds the final value, the loop terminates.
The 'TO | DOWNTO' directives determine whether loop iteration
will be incremental or decremental, respectively.
Additional information available:
Examples
FOR I := 1 TO 10 DO
FOR J := 1 TO 10 DO
A[I,J] := 0;
This example shows how you can nest FOR loops. For each value
of I, the executing program steps through all 10 values of the
array J and assigns the value 0 to each component.
REPEAT
The REPEAT statement executes one or more statements until a
specified condition is true. Several statements can be combined
between the reserved words REPEAT and UNTIL without the
BEGIN/END syntax. The control expression is evaluated after the
statements are executed at least once. The statements must
change the value of the expression or an infinite loop will be
created. It has the form:
REPEAT
{statements};...
UNTIL expression
The 'EXPRESSION' is any boolean expression. The loop terminates
when this expression is TRUE.
Additional information available:
Examples
REPEAT
READ (x);
IF (x IN ['0'..'9'])
THEN
BEGIN
digit_count := digit_count + 1;
digit_sum := digit_sum + ORD (x) - ORD ('0');
END
ELSE
char_count := char_count + 1;
UNTIL EOLN (INPUT);
Assume that the variable 'x' is of type CHAR and the variables
'digit_count', 'digit_sum', and 'char_count' denote integers.
The example reads a character (x). If the value of 'x' is a
digit, the count of digits is incremented by one and the sum of
digits is increased by the value of 'x', as computed by the ORD
function. If the value of 'x' is not a digit, the variable
'char_count' is incremented by one. The REPEAT loop continues
processing characters until it reaches an end-of-line condition.
WHILE
The WHILE statement executes a statement while a specified
condition is TRUE. The boolean expression is evaluated before
the statement is executed for the first time. The repeated
statement must change the value of the boolean expression or an
infinite loop will be created. It has the form:
WHILE expression DO
statement
The 'EXPRESSION' is any boolean expression.
Additional information available:
Examples
WHILE NOT EOLN (INPUT) DO
BEGIN
READ (x);
IF NOT (x IN ['A'..'Z', 'a'..'z', '0'..'9'])
THEN
err := err + 1;
END;
This example reads an input character (x) from the current line.
If the character is not a digit or letter, the error count,
'err', is incremented by one. The loop terminates when an
end-of-line on the INPUT is reached.
WITH
The WITH statement provides an abbreviated notation for
references to the fields of a record variable. It eliminates
the need for specifying the name of a given record when
accessing fields. Just the field names need to be specified.
It follows the form:
WITH {record-variable},... DO
statement
A 'RECORD-VARIABLE' is the name of the record to which the
statement refers. Specifying more than one record variable has
the same effect as nesting WITH statements.
Additional information available:
Examples
Example:
WITH cat, dog DO
bills := bills + catvet + dogvet;
where 'CAT' and 'DOG' are records and 'CATVET' is a field of
'CAT' and 'DOGVET' is a field of 'DOG'.
GOTO
The GOTO statement causes an unconditional branch to a statement
prefixed with a predeclared label. The GOTO statement must be
within the scope of the label declaration. It has the form:
GOTO label
A 'LABEL' is a predeclared unsigned decimal integer or symbolic
constant that represents a statement label. It identifies the
statement branched to when the GOTO statement is executed.
Additional information available:
Examples
FOR i := 1 TO 10 DO
BEGIN
IF real_array[i] = 0.0
THEN
BEGIN
result := 0.0;
GOTO 10;
END;
result := result + 1.0/real_array[i];
END;
10: invertsum := result;
This example shows how to use a GOTO statement to exit from a
loop. The loop computes the sum of the inverses of the
components of the variable 'real_array'. If the value of one of
the components is 0.0, the sum is set to 0.0 and the GOTO
statement forces an exit from the loop.
Routine Call
A routine call specifies the actual parameters to be passed to a
routine and executes the routine. When the routine finishes
executing, control returns to the next executable statement in
the calling block that follows the routine call. A routine call
has the format:
routine-identifier [[ ({actual-parameter-list},...) ]]
The 'ROUTINE-IDENTIFIER' is the name of a procedure or function.
The 'ACTUAL-PARAMETER-LIST' is one or more run-time expressions
of an appropriate type, or the name of a procedure or function.
The appropriate type is determined by the corresponding formal
parameter. Depending of the types of the formal parameters,
that actual parameters can be constants, variables, expressions,
or routine identifiers.
Actual parameters have the following syntax:
({ [[mechanism-specifier]] procedure-identifier
[[mechanism-specifier]] function-identifier
[[mechanism-specifier]] expression
type-identifier
write-list-element },...)
A 'MECHANISM-SPECIFIER' is any one of the foreign specifiers
(see help under 'PASCAL Declaration_Section Routine_Declaration
formal_parameter_list mechanism_specifier').
A 'PROCEDURE-IDENTIFIER' is the name of a predeclared procedure.
A 'FUNCTION-IDENTIFIER' is the name of a predeclared function.
An 'EXPRESSION' is any compile-time or run-time expression (see
help under 'PASCAL Expressions').
A 'TYPE-IDENTIFIER' is a predeclared identifier of any type.
A 'WRITE-LIST-ELEMENT' has the format:
expression[[:expression[[:expression]]]]
Example:
tollbooth (change, 0.25, lane[1]);
This statement calls the procedure 'tollbooth', and passes the
variable change, the real constant '0.25', and the first
component of the array 'lane' as actual parameters.
taxes (rate*income, 'pay');
This statement calls the procedure 'taxes', with the expression
'rate*income' and the string constant 'pay' as actual
parameters.
Predeclared Routines
VAX PASCAL supplies predeclared procedures and functions that perform various commonly used operations.
Additional information available:
AllocationArithmeticChar StrngDyn AllocLow LevelOrdinalParameter
TransferMisc
Allocation
The allocation size functions provide information about the amount of storage allocated for variables and components of various types. The parameters may be in the form of variable or type identifiers. Each function returns an integer value that represents the allocation size of the given parameter.
Additional information available:
BITNEXT
The BITNEXT function returns an integer value that indicates the
number of bits that would be allocated for one component of type
x in a packed array. BITNEXT has the form:
BITNEXT(x)
The parameter x can be of any type.
BITSIZE
The BITSIZE function returns an integer value that indicates the
number of bits that would be allocated for one field of type x
in a packed record. BITSIZE has the form:
BITSIZE(x)
The parameter x can be of any type.
BIT OFFSET(x)
The BIT_OFFSET function returns an integer value that represents
the bit-position of a field of type f in a record of type t.
BIT_OFFSET has the form:
BIT_OFFSET(t,f)
Parameter t can be of any record type, and the parameter f can
be any field contained in that record.
BYTE OFFSET(x)
The BYTE_OFFSET function returns an integer value that
represents the byte-position of a field of type f in a record of
type t.
BYTE_OFFSET(t,f)
Parameter t can be of any record type, and the parameter f can
be any field contained in that record.
NEXT
The NEXT function returns an integer value that indicates the
number of bytes that would be allocated for one component of the
type x in an unpacked array. NEXT has the form:
NEXT(x)
The parameter x can be of any type. If x represents a formal
parameter; however, a warning occurs because the alignment of
the corresponding actual parameter cannot be determined.
SIZE
The SIZE function returns various results, depending on the
value of the parameter x. The SIZE function has the following
form:
SIZE(x [[,t1,...,tn]])
The parameter x can be a type identifier or a variable. If x is
a type identifier, then SIZE returns an integer value which
indicates the number of bytes that would be allocated for a
variable or record field of type x.
If x is a variable, then SIZE returns an integer value that
indicates the number of bytes that are allocated for that
variable.
In the case where the parameter x is a variant record variable
or variant type identifier, SIZE returns an integer value that
indicates the number of bytes that are (for a variant record
variable) or would be (for a variant type identifier) allocated
for both the fixed portion of the record and the largest
variant. In addition you can supply additional parameter, t1
through tn that correspond to the case labels of the record.
The SIZE routine returns an integer value that indicates the
number of bytes that would be allocated by the NEW procedure for
a dynamic variable of the specified variant.
Arithmetic
Arithmetic functions perform mathematical computations. Actual parameters to the arithmetic functions can be of any arithmetic type.
Additional information available:
ABSARCTANCOSEXPLNMAXMIN
SINSQRSQRTUANDUNOTUORUXOR
XOR
ABS
The ABS function has the form:
ABS(x) ABS computes the absolute value of the parameter x,
where x can be of any arithmetic type. The ABS function returns
a value of type x.
ARCTAN
The ARCTAN function is of the form:
ARCTAN(x)
ARCTAN computes the arc tangent of the parameter x, where x can
be an INTEGER or REAL type. The ARCTAN function returns a REAL
value expressed in radians.
COS
The COS function is of the form:
COS(x)
COS computes the cosine of the parameter x, where x can be an
INTEGER or REAL type, and is expressed in radians. The COS
function returns a value of type REAL.
EXP
The EXP function has the format:
EXP(x)
EXP computes the exponential of the parameter x; that is, e**x,
where x can be an INTEGER or REAL type. The EXP function
returns a value of type REAL.
LN
The LN function follows the form:
LN(x)
LN computes the natural logarithm of the parameter x, where x
can be an INTEGER or REAL type. The value of x must be greater
than zero. The LN function returns a value of type REAL.
MAX
The MAX function is of the form:
MAX(x1,...xn)
MAX returns the maximum value of a list of parameters x1,...,xn,
where the parameters can be any arithmetic type, but must all be
of the same type. The MAX function returns a value of the same
type as the parameters.
MIN
The MIN function is of the form:
MIN(x1,...,xn)
MIN returns the minimum value of a list of parameters x1,...,xn,
where the parameters can be any arithmetic type, but must all be
of the same type. The MIN function returns a value of the same
type as the parameters.
SIN
The SIN function has the form:
SIN(x)
SIN computes the sine of the parameter x, where x can be an
INTEGER or REAL type, and is expressed in radians. The SIN
function returns a value of type
SQR
The SQR function is of the form:
SQR computes the square of the parameter x, where x can be of
any arithmetic type. The SQR function returns a value of type
x.
SQRT
The SQRT function has the format:
SQRT(x)
SQRT computes the square root of the parameter x, where x can be
an INTEGER or REAL type. If the value of x is less than zero;
however, an error occurs. The SQRT function returns a value of
type REAL.
UAND
The UAND function has the form:
UAND(u1,u2)
UAND performs a binary logical AND on each corresponding pair of
bits of the two parameters u1 and u2, which must be of type
UNSIGNED. UAND returns a value of type UNSIGNED.
UNOT
The UNOT function is of the form:
UNOT(u1)
UNOT performs a binary logical NOT on each bit of the parameter
u, where u is an expression of type UNSIGNED. UNOT returns a
value of type UNSIGNED.
UOR
The UOR function has the form:
UOR(u1,u2)
UOR performs a binary logical OR on the corresponding pair of
bits of two parameter u1 and u2, which must be of type UNSIGNED.
UOR returns a value of unsigned.
UXOR
The UXOR function follows the form:
UXOR(u1,u2)
UXOR performs a binary logical exclusive OR on the corresponding
pairs of bits of two parameter u1 and u2, which must be of type
UNSIGNED. UXOR returns a value of UNSIGNED.
XOR
The XOR function is of the form:
XOR(p1,p2)
XOR performs a binary logical exclusive OR on two sets or
boolean values. Depending on the types of parameters passed,
XOR returns either the set of elements that do not appear in
both sets, or a Boolean value.
Char Strng
VAX PASCAL supplies predeclared routines that manipulate character strings.
Additional information available:
BINDECHEXINDEXLENGTHOCTPAD
READVSTATUSVSUBSTRUDECWRITEV
BIN
The BIN function converts the value of the parameter x to its
binary equivalent. It has the following form:
BIN(x [[, length[[, digits]]]])
The parameter x is the expression to be converted; this
parameter can be of any type except VARYING OF CHAR, a
conformant array schema, or a conformant VARYING schema.
The BIN function returns the binary digits in a string of type
VARYING OF CHAR. Two optional integer parameters specify the
length of the resulting string and the minimum number of
significant digits to be returned. If you specify a length that
is too short to hold the converted value, the resulting string
is truncated on the left.
If the optional parameters are omitted, the bit width of the
converted parameter value determines the string length and the
number of significant digits.
DEC
The DEC function converts the parameter x to its decimal
equivalent. It has the form:
DEC(x [[, length[[, digits]]]])
The parameter x is the expression to be converted. DEC can take
a parameter of any type except VARYING, conformant array or
conformant VARYING; however, the parameter x must be 32 bits or
less in length.
The DEC function returns the decimal digits in a string of type
VARYING OF CHAR. Two optional integer parameters specify the
length of the resulting string and the minimum number of
significant digits to be returned. If you specify a length that
is too short to hold the converted value, the resulting string
is truncated on the left.
If the optional parameters are omitted, the bit width of the
converted parameter value determines the string length and the
number of significant digits.
HEX
The HEX function converts the parameter x to its hexadecimal.
It follows the format:
HEX(x [[, length[[, digits]]]])
The parameter x is the expression to be converted; this
parameter can be of any type except VARYING OF CHAR or a
conformant array or a conformant VARYING.
The HEX function returns the hexadecimal digits in a string of
type VARYING OF CHAR. Two optional integer parameters specify
the length of the resulting string and the minimum number of
significant digits to be returned. If you specify a length that
is too short to hold the converted value, the resulting string
is truncated on the left.
If the optional parameters are omitted, the bit width of the
converted parameter value determines the string length and the
number of significant digits.
INDEX
The INDEX function locates the first occurrence of a pattern
string within an object string. INDEX has the form:
INDEX(object,pattern)
INDEX requires two character-string expressions as parameters:
an object string to be searched and a pattern string to be
found.
The INDEX function returns an integer value that specifies the
position where the leftmost component of the pattern string was
located in the object string. The search ends as soon as the
first occurrence of the pattern string is located. If the
pattern string is not found, the value 0 is returned. If the
pattern string is an empty string, the value 1 is returned. If
the object string is an empty string, the value 0 is returned
unless the pattern string is also empty, in which case a 1 is
returned.
LENGTH
The LENGTH function determines the length of a string
expression. It has the form:
LENGTH(str)
LENGTH requires a character-string expression as a parameter.
It returns an integer value which specifies the length of the
character-string expression.
OCT
The OCT function converts the value of the parameter x to its
octal equivalent. OCT has the form:
OCT(x [[, length[[, digits]]]])
The parameter x is the expression to be converted; this
parameter can be of any type except VARYING OF CHAR, a
conformant array schema or a conformant VARYING schema.
The OCT function returns the octal digits is a string of type
VARYING OF CHAR. Two optional integer parameters specify the
length of the resulting string and the minimum number of
significant digits to be returned. If you specify a length that
is too short to hold the converted value, the resulting string
is truncated on the left.
If the optional parameters are omitted, the bit width of the
converted parameter value determines the string length and the
number of significant digits.
PAD
The PAD function appends a fill character to a character string
as many times as is necessary to extend the string to its
specified size. It has the form:
PAD(str,fill,size)
You must pass three parameters to PAD: a character string
expression to be padded, an expression of type CHAR to be used
as the fill character, and an integer expression indicating the
size of the final string.
The function returns a character string of the desired size.
READV
The READV procedure reads characters from a character-string
expression and assigns them to the variables listed as
parameters in the READV procedure call. READV behaves like
READLN and the character-string is analogous to a one-line file.
READV follows the following form:
READV(string, {variable-id[[:radix-specifier]]},...
[[, error := {CONTINUE | MESSAGE}]])
READV reads characters from the parameters string and assigns
them to the list of variables named in the variable-id
parameters list. Each variable-id parameter may optionally have
a radix specifier. The radix specifiers are BIN, OCT, and HEX.
You can read a variable of any type by using a radix specifier
except a type that contains a file component.
An error occurs at run-time if values have not been assigned to
all the parameter listed in the READV procedure call before the
end of the character string is reached. The error-recovery
parameter indicates the action to be taken if an error occurs
while the READV procedure is executing.
STATUSV
The STATUSV routine returns an integer value which specifies the
status of the last READV or WRITEV completed. It does not have
any parameters. It has the form:
STATUSV
Note that if you have an Asynchronous Trap routine condition-
handler written in your program which uses READV and WRITEV, the
call of STATUSV in your main program may not return the results
you expected if an AST occurred between the READV/WRITEV and
STATUS.
SUBSTR
The SUBSTR function extracts a substring from another character
string. It has the format:
SUBSTR(str,start,length)
SUBSTR requires three parameters: a character string to be
taken apart, an integer expression that indicates the starting
position of the substring, and an integer expression that
indicates the length of the substring.
SUBSTR returns a varying string of the length specified,
starting at the specified position.
UDEC
The UDEC function converts the parameter x to its unsigned
decimal equivalent. It has the form:
UDEC(x [[, length[[, digits]]]])
The parameter x is the expression to be converted. UDEC can
take a parameter of any type except VARYING, conformant array
schema or conformant VARYING schema; however, parameter x must
be 32 bits or less in length.
The UDEC function returns the unsigned decimal digits in a
string of type VARYING OF CHAR. Two optional parameters specify
the length of the resulting string and the minimum number of
significant digits to be returned. If you specify a length that
is too short to hold the converted value, the resulting string
is truncated on the left.
If the optional parameters are omitted, the bit width of the
converted parameter value determines the string length and the
number of significant digits.
WRITEV
The WRITEV procedure writes characters to a character-string
variable of type VARYING OF CHAR by converting values of the
parameters listed in the procedure call to textual
representations. The behavior of WRITEV is analogous to that of
WRITELN and the character-string is comparable to a one-line
file. WRITEV has the form:
WRITEV(string, parameter-list
[[,error := {CONTINUE | MESSAGE}]])
WRITEV writes the variables appearing in the parameter-list
parameter into the string parameter.
An error occurs if WRITEV reaches the maximum length of the
character-string before the values of all the parameters in the
procedure call have been written into the string. The
error-recovery parameter indicates the action to be taken if an
error occurs while the WRITEV procedure is executing.
Note you may not use a destination-string variable in the
parameter list of the WRITEV statement. For example:
WRITEV(mystring,mystring).
Dyn Alloc
VAX PASCAL provides dynamic allocation routines for the creation of pointer variables. Using pointer variables and dynamic allocation routines, you can create linked data structures.
Additional information available:
ADDRESS
The ADDRESS function returns a pointer value that refers to the
parameter x. ADDRESS has the form:
ADDRESS(x)
The parameter x may be a variable of any type except a component
of a packed structure type. A compile-time warning results if x
is a formal VAR parameter, a component of a formal VAR
parameter, or a variable that does not have the READONLY or
VOLATILE attribute.
The VAX PASCAL compiler assumes that all pointers refer either
to dynamic variables allocated by the NEW procedure or to
variables that have the VOLATILE attribute; a pointer cannot
refer to a nonvolatile variable unless the variable is allocated
in heap storage by the NEW procedure.
DISPOSE
The DISPOSE procedure deallocates memory for a dynamic variable
p^. It has the form:
DISPOSE(p)
You refer to this variable using a pointer value. For example,
if the parameter, 'p', is a pointer, then the dynamic variable
pointed to by 'p' is referred to as 'p^'. When the memory is
deallocated, the variable is destroyed. The value of the
pointer to the dynamic variable becomes undefined.
The DISPOSE procedure can also be used when manipulating dynamic
variables of a record type with variants. The parameter to
DISPOSE is a pointer expression of a type that refers to a
record type with variants. The optional t parameters must be
constant expressions of an ordinal type. They represent nested
tag field values, where t1 is the outermost variant. The record
with variant form of DISPOSE has the following form:
DISPOSE(p[[,t1,...tn]])
The DISPOSE procedure call releases memory occupied by p^. The
tag field values t1 through tn must be identical to those
specified when memory was allocated with NEW.
IADDRESS
The IADDRESS function is similar to the ADDRESS function, except
that it returns an integer value that refers to parameter x,
instead of returning a pointer value, and unlike the ADDRESS
function, IADDRESS will not cause any compile-time warnings.
IADDRESS follows the form:
IADDRESS(x)
The parameter x may be of any type except a component of a
packed structured type.
The VAX PASCAL compiler automatically assumes that all pointers
refer either to dynamic variables allocated by the NEW procedure
or to variables that have the VOLATILE attribute; therefore, you
should use utmost caution when using the IADDRESS function.
The IADDRESS function is commonly used for constructing
arguments for system services.
NEW
The NEW procedure sets aside memory for p^, that is, the dynamic
variable to which the pointer variable p refers. The value of
this newly allocated variable (p^) is undefined. NEW has the
form:
NEW(p)
The NEW procedure can also be used when manipulating dynamic
variables of a record type with variants. The parameter to NEW
is a pointer variable of a type that refers to a record type
with variants. The optional t parameters must be constant
expressions of an ordinal type. They represent nested tag field
values, where t1 is the outermost variable. The record with
variants form of NEW has the following form:
NEW(p[[,t1,...tn]])
If you create a dynamic variable without specifying the tag
field values, enough memory is allocated to hold any of the
variants in the record. Sometimes, however, a dynamic variable
will take values of only a particular variant. If that variant
requires less memory than NEW(p) would normally allocate, you
can use the NEW(p,t1,...tn) form.
Low Level
The low-level functions allow parallel processes and asynchronous routines to operate in a real-time or multi-tasking environment.
Additional information available:
ADD_INTERLOCKEDCLEAR_INTERLOCKEDFIND_FIRST_BIT_CLEAR
FIND_FIRST_BIT_SETFIND_MEMBERFIND_NONMEMBERSET_INTERLOCKED
ADD_INTERLOCKED
The ADD_INTERLOCKED function adds the value of an expression to
the value of a variable, using the VAX Add Aligned Word
Interlocked (ADAWI) instruction and stores the newly computed
value in the variable. ADD_INTERLOCKED has the following form:
ADD_INTERLOCKED(e, v)
The type of the expression e must be assignment compatible with
that of the variable v. The variable v must be an integer or
unsigned subrange; v must have an allocation size of two bytes
and must be aligned on a word boundary. The function returns
the integer value -1 if the new value of v is negative, 0 if it
is zero, and +1 if it is positive.
CLEAR_INTERLOCKED
The CLEAR_INTERLOCKED function assigns the value FALSE to b and
returns the original value of b, using the VAX Branch on Bit
Clear and Clear Interlocked (BBCCI) instruction.
CLEAR_INTERLOCKED has the form:
CLEAR_INTERLOCKED(b)
The parameter b must be a variable of type BOOLEAN. It does not
have to be aligned so can therefore be a field of a packed
record.
FIND_FIRST_BIT_CLEAR
The FIND_FIRST_BIT_CLEAR function locates the first bit in a
PACKED ARRAY OF BOOLEAN whose value is 0. FIND_FIRST_BIT_CLEAR
has the form:
FIND_FIRST_BIT_CLEAR(vector [[, start_index]])
Vector is a variable of type PACKED ARRAY OF BOOLEAN with an
INTEGER index type. The optional start_index argument must be
an integer expression that indexes the element at the point at
which the search should start. If omitted, the starting index
defaults to the vector's first element.
The result of FIND_FIRST_BIT_CLEAR is an INTEGER indexing the
first element containing the value 0. If not bit is 0, the
result is 1 plus the vector's upper bound. If the vector or the
indexed part of the vector has a size of 0, the result is
start_index.
FIND_FIRST_BIT_SET
The FIND_FIRST_BIT_SET function locates the first bit in a
PACKED ARRAY OF BOOLEAN whose value is 1. FIND_FIRST_BIT_SET
has the form:
FIND_FIRST_BIT_SET(vector [[, start_index]])
Vector is a variable of type PACKED ARRAY OF BOOLEAN with an
INTEGER index type. The optional start_index argument must be
an integer expression that indexes the element at the point at
which the search should start. If omitted, the starting index
defaults to the vector's first element.
The result of FIND_FIRST_BIT_SET is an INTEGER indexing the
first element containing the value 1. If no bit is 1, the
result is 1 plus the vector's upper bound. If the vector or the
indexed part of the vector has a size of 0, the result is
start_index.
FIND_MEMBER
The FIND_MEMBER function locates the first character in a string
that is a member of a specified set. FIND_MEMBER has the form:
FIND_MEMBER(string, charset)
String supplies a string value and charset supplies a SET OF
CHAR.
The result of FIND_MEMBER is an INTEGER indicating the position
in the string of the first character that is also a member of
charset. The value 1 indicates the first character in the
string; the value 0 indicates that none of the string's
characters are members of the set.
FIND_NONMEMBER
The FIND_NONMEMBER function locates the first character in a
string that is not a member of a specified set. FIND_NONMEMBER
has the form:
FIND_NONMEMBER(string, charset)
String supplies a string value and charset supplies a SET OF
CHAR.
The result of FIND_NONMEMBER is an INTEGER indicating the
position in the string of the first character that is not a
member of charset. The value 1 indicates the first character in
the string; the value 0 indicates that all of the string's
characters are members of the set.
SET_INTERLOCKED
The SET_INTERLOCKED function assigns the value TRUE to a
variable and returns its original value, using the VAX Branch on
Bit Set and Set Interlocked (BBSSI) instruction.
SET_INTERLOCKED has the form:
SET_INTERLOCKED(b)
The parameter b must be a variable of type BOOLEAN. It does not
have to be aligned, and can therefore be a field of a packed
record.
Ordinal
Ordinal functions require an actual parameter of an ordinal type and return a value of the same type.
Additional information available:
PRED
The PRED function has the form:
PRED(x)
PRED returns the value that immediately precedes the parameter x
in the ordered sequence of values of its type. There must be a
predecessor value for x in the type.
SUCC
The SUCC function has the form:
SUCC(x)
SUCC returns the value that immediately succeeds the parameter x
in the ordered sequence of values of its type. There must be a
successor value for x in the type.
Parameter
VAX PASCAL provides parameter passing routines to allow for the easy input and output of parameters in a routine where the parameter list length is varied.
Additional information available:
ARGUMENTARGUMENT_LIST_LENGTHPRESENT
ARGUMENT
The ARGUMENT function specifies an argument which corresponds to
a function or procedure parameter with the LIST attribute.
ARGUMENT follows the form:
ARGUMENT(parameter-name, n)
The parameter-name parameter specifies the name of a parameter
declared with the LIST attribute. The parameter n specifies a
positive integer value identifying the argument. The first
argument in a list is always 1. An error occurs if the value
specified for n is less than 1, or exceeds the
ARGUMENT_LIST_LENGTH parameter (indicates the total number of
arguments).
ARGUMENT_LIST_LENGTH
The ARGUMENT_LIST_LENGTH function returns an integer value
representing the number of parameter corresponding to a
parameter with the LIST attribute. ARGUMENT_LIST_LENGTH as the
form:
ARGUMENT_LIST_LENGTH(parameter-name)
The parameter-name parameter supplies the name of a LIST
parameter.
PRESENT
The PRESENT function indicates whether the actual argument list
of the routine contains an argument which corresponds to the
formal parameter. PRESENT is usually used to supply a default
value or take a default action when the argument for a parameter
is omitted. PRESENT has the form:
PRESENT(parameter_name)
The parameter-name parameter supplies the name of a parameter
with the TRUNCATE attribute. PRESENT's result is a Boolean
value indicating whether or not the argument list of the
containing routine specifies an actual argument corresponding to
an optional parameter.
Transfer
Transfer routines take an actual parameter of one type and convert it to another type.
Additional information available:
CHRDBLEINTORDPACKQUADROUND
SNGLTRUNCUINTUNPACKUROUNDUTRUNC
CHR
The CHR function returns a value of type CHAR whose ordinal
value in the ASCII character set is the parameter x, provided
such a character exists. CHR has the form:
CHR(x)
The parameter x must be an INTEGER or UNSIGNED type and have a
value from 0 to 255.
DBLE
The DBLE function converts the value of the parameter x to its
double-precision equivalent and returns a value of type DOUBLE.
DBLE has the form:
DBLE(x)
The parameter x must be of an arithmetic type. The value of its
parameter must not be too large to be represented by a
double-precision number.
INT
The INT function converts the value of the parameter x to its
integer equivalent and returns a value of type INTEGER. It has
the form:
INT(x)
The parameter must be an ordinal type.
ORD
The ORD function returns as an integer the position of the
parameter x in the ordered sequence of values of x's type. ORD
has the form:
ORD(x)
The parameter x must be of an ordinal type. If the parameter is
of type UNSIGNED, its value must not be greater than MAXINT.
PACK
The PACK procedure copies components of an unpacked array
variable to a packed array variable. PACK has the following
format:
PACK(unpacked-var, start-index, packed-var)
The 'UNPACKED-VAR' is an unpacked array variable. Components
are copied from this array variable.
The 'START-INDEX' is the value indicating the starting value of
the unpacked array variable's index. Copying starts from this
index position in the unpacked array variable.
The 'PACKED-VAR' is a packed array variable. It is of the same
component type as the unpacked array variable. Components are
copied into this array variable from the unpacked array
variable.
QUAD
The QUAD function converts the value of the parameter x to its
quadruple-precision equivalent and returns a value of type
QUADRUPLE. QUAD has the following form:
QUAD(x)
The parameter must be of an arithmetic type.
ROUND
The ROUND function converts the value of the parameter x to its
integer equivalent by rounding the fractional part of the value.
ROUND has the form:
ROUND(r)
The parameter x must be of a real type. The value returned is
of type INTEGER. The parameter value must not be too large to
be represented by an integer value.
SNGL
The SNGL function rounds the value of the parameter x to its
single-precision equivalent and returns a value of type SINGLE.
SNGL has the form:
SNGL(x)
The parameter must be of an arithmetic type. The value of the
parameter must not be too large to be represented by a
single-precision number.
TRUNC
The TRUNC function converts the value of the parameter x to its
integer equivalent by truncating the fractional part of the
value. TRUNC has the form:
TRUNC(r)
The parameter must be of a real type. The value returned is of
type INTEGER. The value of the parameter must not be too large
to be represented by an integer.
UINT
The UINT function converts the value of the parameter x to its
equivalent as an unsigned integer and returns a value of type
UNSIGNED. UINT has the form:
UINT(x)
The parameter x must be of an ordinal type.
UNPACK
The UNPACK procedure copies components of a packed array
variable to an unpacked array variable. UNPACK has the format:
UNPACK(packed-var, start-index, unpacked-var)
The 'PACKED-VAR' is a packed array variable. Components are
copied from this array variable.
The 'START-INDEX' is the value indicating the starting value of
the packed array variable's index. Copying starts from this
index position in the packed array variable.
The 'UNPACKED-VAR' is an unpacked array variable. It is of the
same component type as the packed array variable. Components of
the packed array variable are copied into this array variable.
UROUND
The UROUND function converts the value of the parameter x to its
unsigned integer equivalent by rounding the fractional part of
the value and returns a value of type UNSIGNED. UROUND has the
form:
UROUND(x)
The parameter x must be of a real type.
UTRUNC
The UTRUNC function converts the value of the parameter x to its
equivalent as an unsigned integer by truncating the fractional
part of the value. UTRUNC has the form:
UTRUNC(x)
The parameter x must be a real type. The value returned is of
type UNSIGNED.
Misc
The miscellaneous routines include routines that determine the amount of time a process uses, record the system date and time, control error handling of a program, and perform miscellaneous calculations.
Additional information available:
CARDCLOCKCREATE_DIRECTORYDATETIMEDELETE_FILE
ESTABLISHEXPOHALTODDRENAME_FILEREVERT
UNDEFINEDZERO
CARD
The CARD function returns an integer value indicating the number
of components that are currently elements of the set expression
s. CARD has the form:
CARD(s)
CLOCK
The CLOCK function returns an integer value indicating the
amount of central processor time, in milliseconds, used by the
current process. The result includes the amount of central
processor time allocated to all previously executed images.
CLOCK has the form:
CLOCK
CREATE_DIRECTORY
The CREATE_DIRECTORY procedure creates a new VMS directory or
subdirectory. CREATE_DIRECTORY has the following form:
CREATE_DIRECTORY(file_name [, error_return])
The file name must be a directory name and optionally can
contain a device name. The error return parameter is optional,
and will return a VMS error recovery code if specified.
DATE
The DATE procedure assigns the current date to a string
variable. DATE has the form:
DATE(string)
The parameter string must be of type PACKED ARRAY[1..11] OF
CHAR.
TIME
The TIME procedure assigns the current time to a string
variable. TIME has the form:
TIME(string)
The parameter string must be of type PACKED ARRAY[1..11] OF
CHAR.
DELETE_FILE
The DELETE_FILE procedure deletes one or more VMS files.
DELETE_FILE has the form:
DELETE_FILE(file_name [, error_return])
The first file specification must contain an explicit directory
name, plus a file name, a file type and a version number. If
you omit either the directory or device name, the current
default device and directory are used. The error return
parameter is optional, and will return a VMS error recovery code
is specified.
ESTABLISH
The ESTABLISH procedure establishes a VAX condition handler that
processes errors and reports the status of exceptions and
conditions. ESTABLISH has the following form:
ESTABLISH(function-identifier)
The function identifier parameter must be the name of a routine
that has the ASYNCHRONOUS attribute (see help under 'PASCAL
Attributes').
EXPO
The EXPO function returns the integer-valued exponent of the
floating-point representation of its parameter. EXPO has the
form:
EXPO(r)
The parameter r must be a real type. When it is of type REAL,
SINGLE, or D-floating DOUBLE, the exponent is an integer value
in the range from -128 to 127. When r is of type G-floating
DOUBLE, the exponent is an integer value between -1024 and 1023.
When r is of type QUADRUPLE, the exponent is an integer value
between -16,384 and 16,383.
HALT
The HALT procedure calls the VAX Run-Time Library procedure
LIB$STOP with the condition value PAS$HALT. Without an
appropriate condition handler, HALT terminates execution of the
program. HALT has the form:
HALT
ODD
The ODD function tests whether the value of parameter x is odd.
ODD has the form:
ODD(x)
The parameter x must be of type INTEGER or UNSIGNED. The
function returns TRUE if the value of x is odd and FALSE if the
value of x is even.
RENAME_FILE
The RENAME_FILE procedure renames a VMS file. RENAME_FILE has
the form:
RENAME_FILE(old_file_name, new_file_name [, error_return])
The parameter old_file_name specifies the names of one or more
files whose specifications are to be changed. New_file_name
provides the new file specification to be applied. The error
return parameter is optional, and will return a VMS error
recovery code if specified.
REVERT
The REVERT procedure cancels a condition handler activated by
the ESTABLISH procedure. REVERT has the form:
REVERT
UNDEFINED
The UNDEFINED function tests whether x contains a reserved
operand. UNDEFINED has the form:
UNDEFINED(x)
The parameter x must be a variable of a real type. The function
returns TRUE if the parameter contains a value that has been
reserved by VAX/VMS and returns FALSE if not.
ZERO
The ZERO function is used in assignment statements and
initializers to set a variable to binary zero. It is compatible
with any data types. ZERO has the form:
ZERO
Input Output
VAX PASCAL includes an extensive set of predeclared routines governing input/output (I/O) processing. The routines enable you to establish files with sequential, relative, or indexed organization and process them by sequential, direct, or keyed access.
Additional information available:
GeneralSeq Access InputSeq Access OutputMiscText File
Direct AccessKeyed Access
General
Additional information available:
OPEN
The OPEN procedure opens a file, defines the file access method,
and allows specification of file parameters.
Syntax:
1. Positional Syntax
OPEN (file-variable
,[[file-name]]
,[[file-history]]
,[[record-length]]
,[[access-method]]
,[[record-type]]
,[[carriage-control]]
,[[organization]]
,[[disposition]]
,[[file-sharing]]
,[[user-action]]
,[[default]]
,[[ERROR := error-recovery]])
2. Non-Positional Syntax
OPEN (FILE_VARIABLE := file-variable
[[,FILE_NAME := file-spec]]
[[,HISTORY := file-history]]
[[,RECORD_LENGTH := record-length]]
[[,ACCESS_METHOD := access-method]]
[[,RECORD_TYPE := record-type]]
[[,CARRIAGE_CONTROL := carriage-control]]
[[,ORGANIZATION := organization]]
[[,DISPOSITION := disposition]]
[[,SHARING := file-sharing]]
[[,USER_ACTION := user-action]]
[[,DEFAULT := file-spec]]
[[,ERROR := error-recovery]])
If the parameter names (such as RECORD-TYPE) are not used, as in
the first syntax, the parameters must be listed in the specified
order. If parameter names are used, as in the second syntax,
the parameters can be specified in any order. The use of
positional and nonpositional parameters can be mixed, but once a
nonpositional parameter name has been used, all of the following
parameter values must be nonpositional.
Additional information available:
File VariableFile NameHistoryRecord LengthAccess Method
Record TypeCarriage ControlOrganizationDispositionSharingUser Action
DefaultError Recovery
File Variable
'FILE-VARIABLE' is the only required parameter. It is the name of the file variable associated with the file to be opened.
File Name
'FILE-NAME' is information about the file for the operating system. This must be quoted. It designates the file to be opened.
History
'HISTORY' indicates whether the specified file exists or must be created. A history of NEW indicates that a new file must be created. This is the default value except when the file has been opened with the RESET procedure. A history of OLD indicates that an existing file is being opened. A history of READONLY indicates that an existing file is being opened only for reading, and a history of UNKNOWN indicates that an old file should be opened; if an old file does not exist, a new file is created.
Record Length
'RECORD-LENGTH' is a positive integer that specifies the file's maximum component size in bytes. The default for a VAX PASCAL text file is 133 bytes. For other file types, the maximum size of the file component is used.
Access Method
'ACCESS-METHOD' specifies the method of access for components in the file. SEQUENTIAL access allows access to files that have fixed or variable-length records. The default access method is SEQUENTIAL. The GET, PUT, READ, RESET, REWRITE, and WRITE procedures can be used to access files with any organization. If it has sequential organization, the TRUNCATE procedure can also be used. The 'DIRECT' access method allows use of the FIND and LOCATE procedures to access files with relative organization and files with sequential organization and fixed-length records. The 'KEYED' access method allows access of indexed files by using the FINDK and RESETK procedures to locate a specific component. Text files cannot be opened for KEYED access.
Record Type
'RECORD-TYPE' specifies the structure of the RMS records in the file. A value of FIXED indicates that all file components have the same length. A value of VARIABLE indicates that the length of the file components can vary. Each record of this type is stored with a word preceding it specifying the length of the record. VARIABLE is the default for a new file of type TEXT or VARYING OR CHAR; other new files use FIXED as the default. For an existing file, the default is the record type associated with the file at its creation. STREAM format specifies that records in a file are delimited by special characters or character sequences called terminators. The special characters are FF (form feed), VT (vertical tab), LF (line feed), or CR LF (carriage return followed by line feed). STREAM_CR format specifies that records in a file are delimited by a CR character (carriage return). STREAM_LF indicates that records in a file are delimited by LF (line feed). All of the STREAM formats are supported for sequential files only.
Carriage Control
'CARRIAGE-CONTROL' specifies the carriage-control format for the file. A value of LIST indicates that each file component is preceded by a line feed and followed by a carriage-return when the file is output to a terminal or line printer. The CARRIAGE or FORTRAN option indicates that the first byte of each component contains a carriage-control character. The NOCARRIAGE or NONE option indicates that the component contains no carriage-control information. NONE is the default, except for files of type TEXT or VARYING OF CHAR for which the default is LIST.
Organization
'ORGANIZATION' specifies file organization. The default is SEQUENTIAL. If the organization is omitted when opening an existing file, the organization specified when the file was created is used. RELATIVE or INDEXED can also be specified for a text file. Components of a SEQUENTIAL file are ordered in physical sequence. This order is identical to the order in which the components are written to the file. Components of a RELATIVE file consist of a specified number of fixed-length cells ordered in physical sequence. The cells are numbered from 1 (the first) to n (the last) with each number representing the location of a component relative to the beginning of the file. Specific components in the file are referred to by cell number (component number). Components of an INDEXED file are ordered on the basis of certain data fields, called keys, that are contained in each component. The contents of fields in the file components that are the keys are used to identify specific components in subsequent operations.
Disposition
'DISPOSITION' specifies what is to be done with the file when it is closed. If SAVE is specified, the file is retained. This is the default value for files named by the FILE-NAME parameter. An unnamed file is automatically deleted. If DELETE is specified, the file is deleted. If PRINT is specified, the file is spooled to the system line printer and is not deleted. If PRINT_DELETE is specified, the file is deleted after it is printed. If SUBMIT is specified, the file is submitted to the batch job queue and is not deleted. SUBMIT_DELETE causes the file to be deleted after being processed.
Sharing
'SHARING' specifies whether other programs can access the file while it is open. A value of READONLY indicates that other programs can read the file while it is open, but cannot write to it. This is the default value for files with a history of READONLY. READWRITE indicates that other programs can read and write to the file when it is open. NONE denies any access to the file while it is open. This is the default value for all other files.
User Action
'USER-ACTION' allows a user access to RMS facilities not explicitly available in the VAX PASCAL language by writing a function that controls the opening or closing of a file. Inclusion of the user-action parameter causes the Run-Time Library to call this function to open or close the file instead of calling RMS to do it according to its normal defaults.
Default
'DEFAULT' specifies that there are components defined in the specified default file which are not in the file specified in the OPEN procedure. The default file specification is primarily used when accepting file specifications interactively.
Error Recovery
'ERROR-RECOVERY' specifies the action the program should take if the procedure called fails to execute successfully. If ERROR := CONTINUE is specified, the program continues to execute regardless of any error condition. If ERROR := MESSAGE is specified, the appropriate error message will be printed and execution will cease if the procedure results in an error. By default, the error message is printed and execution is ceased after the first error is encountered.
CLOSE
The CLOSE procedure closes an open file.
Syntax:
1. Positional
CLOSE (file-variable
,[[disposition]]
,[[user-action]]
,[[ERROR := error-recovery]])
2. Nonpositional
CLOSE (FILE_VARIABLE := file-variable
[[,DISPOSITION := disposition]]
[[,USER_ACTION := user-action]]
[[,ERROR := error-recovery]])
Except for the file variable parameter, all other parameters are
optional. If the nonpositional parameter names are not used, as
in the first syntax, the parameters must be in the order
specified. If nonpositional parameter names are used, as in the
second syntax, the parameters can be specified in any order.
Additional information available:
File VariableDispositionUser ActionError Recovery
File Variable
'FILE-VARIABLE' is the name associated with the file to be closed.
Disposition
'DISPOSITION' specifies what is to be done with the file when it is closed. If SAVE is specified, the file is retained. This is the default value for files named by the FILE-NAME parameter. If DELETE is specified, the file is deleted. If PRINT is specified, the file is spooled to the system line printer and is not deleted. If PRINT_DELETE is specified, the file is deleted after it is printed. If SUBMIT is specified, the file is submitted to the batch job queue and is not deleted. SUBMIT_DELETE causes the file to be deleted after being processed.
User Action
'USER-ACTION' allows a user access to RMS facilities not explicitly available in the VAX PASCAL language by writing a function that controls the closing of a file. Inclusion of the user-action parameter causes the Run-Time Library to call this function to close the file instead of calling RMS to close it according to its normal defaults.
Error Recovery
'ERROR-RECOVERY' specifies the action the program should take if the CLOSE procedure fails to execute successfully. If ERROR := CONTINUE is specified, the program continues to execute regardless of any error condition. If ERROR := MESSAGE is specified, the appropriate error message will be printed and execution will cease if the CLOSE procedure results in an error. By default, the error message is printed and execution is ceased after the first error is encountered.
Seq Access Input
The sequential access input procedures are procedures used on files opened for sequential access, but can also be used on files opened for direct and keyed access.
Additional information available:
GET
The GET procedure advances the file position and reads the next
component of the file into the file buffer variable. If the
file has relative or indexed organization, the component is also
locked. The file must be in Inspection mode before the GET
procedure is used for the first time to read one or more file
components.
Syntax:
GET(file-variable [[,ERROR := error-recovery]])
The 'FILE-VARIABLE' is the name associated with the input file.
'ERROR-RECOVERY' specifies the action the program should take if
the GET procedure fails to execute successfully. If ERROR :=
CONTINUE is specified, the program continues to execute
regardless of any error condition. If ERROR := MESSAGE is
specified, the appropriate error message will be printed and
execution will cease if the GET procedure results in an error.
By default, the error message is printed and execution is ceased
after the first error is encountered.
READ
The READ procedure reads file components into one or more
variables.
Syntax:
READ ([[file-variable,]] {variable-identifier},...[[, ERROR
:= error-recovery]])
The 'FILE-VARIABLE' is the name associated with the input file.
If the file-variable is omitted, the default is INPUT.
The 'VARIABLE-IDENTIFIER' is the name of the variable into which
a file component will be read; multiple identifiers are
separated by commas. The variables can have an optional
qualifier:
var [[: BIN | HEX | OCT]]
This qualifier allows reading in any type of value except a file
type. The variable will be read in using the specified format.
'ERROR-RECOVERY' specifies the action the program should take if
the READ procedure fails to execute successfully. If ERROR :=
CONTINUE is specified, the program continues to execute
regardless of any error condition. If ERROR := MESSAGE is
specified, the appropriate error message will be printed and
execution will cease if the READ procedure results in an error.
By default, the error message is printed and execution is ceased
after the first error is encountered.
RESET
The RESET procedure readies a file for reading.
Syntax:
RESET(file-variable [[, ERROR := error-recovery]])
The 'FILE-VARIABLE' is the name associated with the input file.
'ERROR-RECOVERY' specifies the action the program should take if
the RESET procedure fails to execute successfully. If ERROR :=
CONTINUE is specified, the program continues to execute
regardless of any error condition. If ERROR := MESSAGE is
specified, the appropriate error message will be printed and
execution will cease if the RESET procedure results in an error.
By default, the error message is printed and execution is ceased
after the first error is encountered.
Seq Access Output
The sequential access output procedures apply primarily to files opened for sequential access; but can also be used on direct and keyed access files.
Additional information available:
EXTEND
The EXTEND procedure opens an existing file for write access and
positions the file pointer at the end of the file.
Syntax:
EXTEND (file-variable [[, ERROR := error-recovery]])
'FILE-VARIABLE' is the name associated with the file to be
opened.
'ERROR-RECOVERY' is the parameter value that indicates the
action to be taken if an error occurs during execution of the
EXTEND procedure (see help on 'error-recovery' under 'PASCAL
Input_Output General OPEN Error_Recovery').
PUT
The PUT procedure adds a new component to a file. The file must
be in Generation mode. PUT places the new component at the end
of the file.
Syntax:
PUT(file-variable [[, ERROR := error-recovery]])
The 'FILE-VARIABLE' specifies the name associated with the
output file.
'ERROR-RECOVERY' specifies the action the program should take if
the PUT procedure fails to execute successfully. If ERROR :=
CONTINUE is specified, the program continues to execute
regardless of any error condition. If ERROR := MESSAGE is
specified, the appropriate error message will be printed and
execution will cease if the PUT procedure results in an error.
By default, the error message is printed and execution is ceased
after the first error is encountered.
REWRITE
The REWRITE procedure readies a file for output. The file can
be in any mode before REWRITE is called to set the node to
Generation. The REWRITE procedure truncates the specified file
to length zero and sets EOF and UFB to TRUE.
Syntax:
REWRITE(file-variable [[,ERROR := error-recovery]])
'FILE-VARIABLE' is the name associated with the output file.
'ERROR-RECOVERY' indicates the action to be taken should an
error be produced during execution of the REWRITE procedure (see
help on 'error-recovery' under 'PASCAL Input_Output General OPEN
Error_Recovery').
WRITE
The WRITE procedure assigns data to an output file. The file
(unless it is a keyed-access file) must be in Generation mode
before WRITE is called.
Syntax:
WRITE([[file-variable]] {expression},... [[,ERROR :=
error-recovery]])
'FILE-VARIABLE' is the name associated with the output file. If
this is omitted, the default is OUTPUT.
'EXPRESSION' is a compile-time or run-time expression whose
value is to be written. Multiple output values must be
separated by commas. An output value must have the same type as
the file components, but values written to a text file can also
be expressions of any integer, unsigned, char, boolean,
enumerated, subrange, real, or string type. Each expression can
be written in a binary, hexadecimal, or octal form by using a
predeclared function BIN, HEX, or OCT.
Syntax: Expression in BIN, HEX, or OCT form
FUNC(expression[[, length[[, digits]]]])
where FUNC is BIN, HEX or OCT and 'expression' is the
expression value to be converted (see help on the predeclared
functions, BIN, HEX, and OCT).
Also, a field width for each variable can be specified. This
specifies the minimum number of characters to be written for the
value. If a field width is not specified, the default field
width for the type is used.
Syntax:
expression:minimum[[:fraction]]
Both 'MINIMUM' and 'FRACTION' represent integer expressions with
positive or zero values. 'MINIMUM' indicates the minimum number
of characters to be written for the value. 'FRACTION',
permitted only for values of real types, indicates the number of
digits to be written to the right of the decimal point.
'ERROR-RECOVERY' indicates the action to be taken should an
error occur during execution of the WRITE procedure (see help on
'error-recovery' under 'PASCAL Input_Output General OPEN
Error_Recovery').
Misc
The miscellaneous routines are generally used when dealing with sequential access files. In some cases, they can be used on direct or keyed access files.
Additional information available:
EOF
The EOF (end of file) function indicates whether the file
pointer is positioned after the last component in a file. The
file may be in either Inspection or Generation mode before EOF
is called. TRUE is returned when the file pointer is positioned
after the last component in a file. FALSE is returned as long
as components can be read from the input file.
Syntax:
EOF [[ (file-variable) ]]
'FILE-VARIABLE' is the name associated with the input file. If
the file variable is omitted, the default is INPUT.
STATUS
The STATUS function indicates the status of a file following the
last operation performed on it.
Syntax:
STATUS (file-variable)
'FILE-VARIABLE' is the name associated with the file to be
tested.
TRUNCATE
The TRUNCATE procedure indicates that the current file component
and all components following it are to be deleted. The file
must be in Inspection mode before TRUNCATE is called. The file
mode is Generation after the TRUNCATE operation is complete and
both EOF and UFB are set to TRUE. This can only be used on a
file that has sequential organization.
Syntax:
TRUNCATE (file-variable [[, ERROR := error-recovery]])
'FILE-VARIABLE' is the name associated with the file to be
truncated.
'ERROR-RECOVERY' indicates the action to be taken should an
error occur during execution of the TRUNCATE procedure (see help
on 'error-recovery' under 'PASCAL Input_Output General OPEN
Error_Recovery').
UFB
The UFB (undefined file buffer) function returns a boolean value
that indicates whether the last file operation gave the file
buffer an undefined status. The file can be in any mode before
UFB is called. If the file buffer is undefined, TRUE is
returned, FALSE is returned otherwise.
Syntax:
UFB (file-variable)
'FILE-VARIABLE' is the name associated with the file whose
buffer is being tested.
UNLOCK
The UNLOCK procedure releases the current file component for
access by other processes. The file must be in Inspection mode
before UNLOCK is called.
Syntax:
UNLOCK (file-variable [[, ERROR := error-recovery]])
'FILE-VARIABLE' is the name associated with the file whose
component is to be unlocked.
'ERROR-RECOVERY' indicates the action to be taken should an
error occur during execution of the UNLOCK procedure (see help
on 'error-recovery' under 'PASCAL Input_Output General OPEN
Error_Recovery').
Text File
Text file manipulation routines apply only to text files (including INPUT and OUTPUT).
Additional information available:
EOLNLINELIMITPAGEREADLNWRITELN
EOLN
The EOLN (end of line) function tests for the end-of-line marker
within a text file. The file must be in Inspection mode and EOF
must be FALSE before EOLN is called. TRUE is returned when the
file pointer is positioned after the last character in a line.
FALSE is returned when the last component in the line is read
into the file buffer.
Syntax:
EOLN [[ (file-variable) ]]
'FILE-VARIABLE' is the name associated with a text file. The
default is INPUT.
LINELIMIT
The LINELIMIT procedure terminates execution of a program after
a specified number of lines has been written into a text file.
The file may be in any mode before LINELIMIT is called.
Syntax:
LINELIMIT (file-variable, n [[, ERROR := error-recovery]])
'FILE-VARIABLE' is the name associated with the text file to
which the limit applies.
'N' is a positive integer expression that indicates the number
of lines that are to be written to the file before execution
terminates.
'ERROR-RECOVERY' is the parameter value that indicates the
action to be taken if an error occurs while the LINELIMIT
procedure is executing (see help on 'error-recovery' under
'PASCAL Input_Output General OPEN Error_Recovery').
PAGE
The PAGE procedure skips from the current page to the next page
of a text file. The file must be in Generation mode before the
PAGE command is called.
Syntax:
PAGE (file-variable [[, ERROR := error-recovery]])
'FILE-VARIABLE' is the name associated with a text file.
'ERROR-RECOVERY' is the parameter value that indicates the
action to be taken if an error occurs while the PAGE procedure
is executing (see help on 'error-recovery' under 'PASCAL
Input_Output General OPEN Error_Recovery').
READLN
The READLN procedure reads lines of data from a text file. The
file must be in Inspection mode before READLN is called. After
reading values for all listed variables, the READLN procedure
skips over any characters remaining on the current line and
positions the file at the beginning of the next line.
Syntax:
READLN ([[file-variable,]] {variable-identifier},... [[,
ERROR := error-recovery]])
'FILE-VARIABLE' is the name associated with the text file to be
read. The default is INPUT.
The 'VARIABLE-IDENTIFIER' is the name of the variable into which
a file component will be read; multiple identifiers are
separated by commas. The variables can have an optional
qualifier:
var [[: BIN | HEX | OCT]]
This qualifier allows reading in any type of value except a file
type. The variable will be read in using the specified format.
If no variable names are specified, READLN simply skips a line
in the specified file.
'ERROR-RECOVERY' is the parameter value that indicates the
action to be taken if an error occurs during execution of the
READLN procedure (see help on 'error-recovery' under 'PASCAL
Input_Output General OPEN Error_Recovery ').
WRITELN
The WRITELN procedure writes a line of data to a text file. The
file must be in Generation mode before WRITELN is called. The
WRITELN procedure writes the specified values into the text
file, inserts an end-of-line marker after the end of the current
line, and then positions the file at the beginning of the next
line.
Syntax:
WRITELN ([[file-variable,]] [[carr-ch,]] {expression},...
[[, ERROR := error-recovery]])
'FILE-VARIABLE' is the name associated with the output file. If
this is omitted, the default is OUTPUT.
'CARR-CH' is a carriage control character which can be specified
if a text file or file of type VARYING OF CHAR is opened with
the CARRIAGE or FORTRAN value for the 'carriage-control'
parameter. It specifies how output is directed to
carriage-control devices, such as a terminal or a line printer.
If output is directed elsewhere, the character is written into
the file and will be read back when the file is opened for
input.
Carriage-Control Characters
Character | Meaning
----------------------------------------------------------------------------
'+' Overprinting: starts output at the beginning of the current line
' ' Single spacing: starts output at the beginning of the next line
'0' Double spacing: skips a line before starting output
'1' Paging: starts output at the top of a new page
'$' Prompting: starts output at the beginning of the next line and
suppresses carriage return at the end of the line
''(0) Prompting with overprinting: suppresses line feed at the beginning
of the line and carriage return at the end of the line
'EXPRESSION' is a compile-time or run-time expression whose
value is to be written. Multiple output values must be
separated by commas. An output value must have the same type as
the file components, but values written to a text file can also
be expressions of any integer, unsigned, char, boolean,
enumerated, subrange, real, or string type. Each expression can
be written in a binary, hexadecimal, or octal form by using one
of the predeclared functions BIN, HEX, or OCT.
Syntax: Expression in BIN, HEX, or OCT form
FUNC(expression[[, length[[, digits]]]])
where FUNC is BIN, HEX or OCT and 'expression' is the
expression value to be converted (see help on the predeclared
functions, BIN, HEX, and OCT).
Also, a field width for each variable can be specified. This
specifies the minimum number of characters to be written for the
value. If a field width is not specified, the default field
width for the type is used.
Syntax:
expression:minimum[[:fraction]]
Both 'MINIMUM' and 'FRACTION' represent integer expressions with
positive or zero values. 'MINIMUM' indicates the minimum number
of characters to be written for the value. 'FRACTION',
permitted only for values of real types, indicates the number of
digits to be written to the right of the decimal point.
'ERROR-RECOVERY' is an error-recovery syntax (see help on
'error-recovery' under 'PASCAL Input_Output General OPEN
Error_Recovery').
Direct Access
Direct access procedures are generally legal only on files opened for direct access. In some cases, procedures apply to keyed access files as well.
Additional information available:
DELETE
The DELETE procedure deletes the current file component. The
file must be in Inspection mode before DELETE is called. When
the DELETE procedure is called, the current component, as
indicated by the file buffer, must have already been locked by a
successful FIND, FINDK, GET, RESET, or RESETK procedure before
it can be deleted. After deletion, the component is unlocked
and UFB is TRUE. DELETE can be used on files with relative or
indexed organization opened for direct or keyed access.
Syntax:
DELETE (file-variable [[, ERROR := error-recovery]])
'FILE-VARIABLE' is the name associated with the file from which
a component is to be deleted.
'ERROR-RECOVERY' is the parameter value that indicates the
action to be taken if an error occurs during execution of the
DELETE procedure (see help on 'error-recovery' under 'PASCAL
Input_Output General OPEN Error_Recovery').
FIND
The FIND procedure positions the file at a specified file
component. It allows direct access to components of a file.
The file may be in any mode before a call to FIND. After
execution of the FIND procedure, the file is positioned at the
specified component and the file buffer variable assumes the
value of the component. The file mode is set to Inspection.
After a call to FIND, the value of EOF is undefined.
Syntax:
FIND (file-variable, component-number [[, ERROR :=
error-recovery]])
'FILE-VARIABLE' is the name associated with a file that is open
for direct access with fixed length records.
'COMPONENT-NUMBER' is a positive integer expression that
indicates the component at which the file is to be positioned.
'ERROR-RECOVERY' is the parameter value indicating the action to
be taken if an error should occur during execution of the FIND
procedure (see help on 'error-recovery' under 'PASCAL
Input_Output General OPEN Error_Recovery').
LOCATE
The LOCATE procedure positions a direct-access file at a
particular component so that the next PUT procedure will write
the contents of the file buffer into the selected component.
The file can be in any mode before LOCATE is called. After
LOCATE has been performed, UFB is TRUE and EOF in undefined.
Syntax:
LOCATE (file-variable, component-number [[, ERROR :=
error-recovery]])
'FILE-VARIABLE' is the name associated with the file to be
positioned.
'COMPONENT-NUMBER' is a positive integer expression indicating
the relative component number of the component to be found.
'ERROR-RECOVERY' is the parameter value indicating the action to
be taken should an error occur during execution of the LOCATE
procedure (see help on 'error-recovery' under 'PASCAL
Input_Output General OPEN Error_Recovery ').
UPDATE
The UPDATE procedure writes the contents of the file buffer into
the current component. The file must be in Inspection mode
before UPDATE is called. The UPDATE procedure is legal only for
files with relative or indexed organization that have been
opened for direct or keyed access. The current component must
have already been locked by a successful FIND, FINDK, GET,
RESET, or RESETK operation. After the UPDATE has taken place,
the component is unlocked and UFB is TRUE.
Syntax:
UPDATE (file-variable [[, ERROR := error-recovery]])
'FILE-VARIABLE' is the name associated with the file whose
component is to be updated.
'ERROR-RECOVERY' is the parameter value indicating the action to
be taken should an error occur during execution of the UPDATE
procedure (see help on 'error-recovery' under 'PASCAL
Input_Output General OPEN Error_Recovery').
Keyed Access
Keyed access procedures are legal only on files opened for keyed access.
Additional information available:
FINDK
The FINDK procedure searches the index of an indexed file opened
for keyed access and locates a specific component. This can be
called for any indexed file opened for keyed access regardless
of the mode of the file. If the component described exists, the
file buffer is filled with that component and UFB and EOF both
become FALSE. The mode is set to Inspection and the component
is locked. If no component is found, UFB becomes TRUE and EOF
becomes undefined. The mode is then set to Undefined.
Syntax:
FINDK (file-variable, key-number, key-value [[, match-type]]
[[, ERROR := error-recovery]])
'FILE-VARIABLE is the name associated with the file to be
searched.
'KEY-NUMBER' is a positive integer expression that indicates the
key position. Key numbers represent the priority of fields.
For example, a field labeled key 0 represents the mandatory
primary key of the file.
'KEY-VALUE' is an expression that indicates the key to be found.
It must be assignment compatible with the key field in the
specified key position.
'MATCH-TYPE' is an optional identifier that indicates the
relationship between the key value in the FINDK procedure call
and key value of a component. It must be one of EQL (equal),
NXT (next in collating sequence), or NXTEQL (next in collating
sequence or equal).
'ERROR-RECOVERY' represents the action to be taken should the
FINDK procedure produce an error during execution (see help on
'error-recovery' under 'PASCAL Input_Output General OPEN
Error_Recovery').
RESETK
The RESETK procedure readies a file for reading. The file can
be in any mode before RESETK is called to set the mode to
Inspection. It can be applied only to indexed files opened for
keyed access.
Syntax:
RESETK (file-variable, key-number [[, ERROR :=
error-recovery]])
'FILE-VARIABLE' is the name associated with the input file.
'KEY-NUMBER' is a positive integer expression that indicates the
key position. The file is searched for the component with the
lowest value in the specified key number. This component
becomes the current component in the file and is locked. The
value of the current component is copied into the file buffer,
and EOF and UFB become TRUE. A RESETK on key number 0 is
equivalent to a RESET.
'ERROR-RECOVERY' is the parameter value that indicates the
action to be taken should an error be produced during execution
of the RESETK procedure (see help on 'error-recovery' under
'PASCAL Input_Output General OPEN Error_Recovery ').
Compilation Units
A compilation unit is either a program or a module. Both programs and modules have declaration sections but only programs have executable sections. A program can be compiled, linked, and run by itself, but a module cannot be executed unless it is linked with a main program written in PASCAL, or another language. A module may contain routine declarations but these cannot be executed independently of a program.
Additional information available:
PROGRAM
A PROGRAM can be compiled, linked, and executed by itself.
Syntax:
[[attribute-list]]
PROGRAM identifier [[ ({file-variable},...) ]];
block.
The 'ATTRIBUTE-LIST' is one or more identifiers that provide
additional information about the program unit (see help under
'PASCAL Attributes').
The 'IDENTIFIER' is the name of the program. It only appears in
the program heading and has no other purpose within the program
unit.
The 'FILE-VARIABLE' is the name or names of the file variables
associated with the external file(s) used by the program unit.
This includes INPUT, OUTPUT, and any other file variables
representing external files used in the program unit.
A 'BLOCK' contains a declaration section and an executable
section (see help under 'PASCAL Declaration_Section
Routine_Declaration block').
MODULE
A MODULE is a unit that cannot be executed unless linked with a
main program unit. It can contain routine declarations but has
no executable section. Modules are used combined with other
separately compiled, but logically coordinated programs and
modules for execution as a single unit, or they can be developed
independently from other programs or modules, but used as
library modules bound into larger systems at link time.
Syntax:
[[attribute-list]]
MODULE identifier [[ ({file-variable},...) ]];
declaration-section
END.
The 'ATTRIBUTE-LIST' is one or more identifiers that provide
additional information about the module unit (see help under
'PASCAL Attributes').
The 'IDENTIFIER' is the name of the module. It only appears in
the module heading and has no other purpose within the module
unit.
The 'FILE-VARIABLE' is the name or names of the file variables
associated with the external file(s) used by the module unit.
This includes INPUT, OUTPUT, and any other file variables
representing external files used in the module unit.
The 'DECLARATION-SECTION' section contains sections that declare
labels, variables, procedures, and functions (see help under
'PASCAL Declaration_Section').
Attributes
An attribute is an identifier that directs the VAX PASCAL
compiler to change its behavior in some way. It allows
additional control over the properties of data items, routines,
and compilation units. A list of attributes enclosed in
brackets can appear anywhere in a program that a type, a type
identifier, or the heading of a routine or compilation unit is
allowed. Only one attribute from a particular class can appear
in a given attribute list.
Syntax of an Attribute List:
[ {attribute},... ]
Additional information available:
ASYNCHRONOUSCHECKENVIRONMENTHIDDENIDENT
INHERITINITIALIZEKEYLISTOVERLAIDPOSREADONLY
TRUNCATEUNBOUNDUNSAFEVALUEVOLATILEWRITEONLY
AlignmentAllocationDoubleOptimizeParameterSizeVisibility
Alignment
Alignment attributes can be applied to variables, the base types of pointer variables, components of structured variables, and function results. They indicate whether the object should be aligned on a specific addressing boundary in memory.
Additional information available:
ALIGNED
ALIGNED [[(n)]]
The ALIGNED attribute specifies that an object be aligned on the
memory boundary indicated by the constant expression represented
by its parameter.
ALIGNED(0) -- byte ALIGNED(3) -- quadword
ALIGNED(1) -- word ALIGNED(4) -- octaword
ALIGNED(2) -- longword ALIGNED(9) -- page
UNALIGNED
The UNALIGNED attribute specifies that an object may be aligned on any bit boundary. An UNALIGNED variable cannot have an allocation size greater than 32 bits.
Allocation
Allocation attributes can be applied to variables, routines, and compilation units. They indicate the form of storage that the object should occupy.
Additional information available:
STATIC
Storage for a STATIC variable is allocated only once. A STATIC variable exists only for as long as the executable image in which it was allocated remains active.
AUTOMATIC
Storage for an AUTOMATIC variable is allocated each time the program enters the routine in which the variable was declared. An AUTOMATIC variable exists as long as the declaring routine remains active.
AT
AT (n) No storage is allocated for a variable having the AT attribute. The variable is assumed to reside at the exact address specified by the constant expression 'N'. Variables representing machine-dependent entities are frequently given this attribute.
COMMON
COMMON [[(identifier)]] Storage for a COMMON variable is allocated in an overlaid program section called a common block. This allows sharing of variables with other languages (such as FORTRAN). If you include an 'IDENTIFIER', it indicates the name of the common block. If you omit the 'IDENTIFIER', the name of the variable is used as the name of the common block. This attribute can only be applied to variables.
PSECT
PSECT (identifier) The 'IDENTIFIER' parameter designates the program section in which storage for an object is to be allocated. This storage remains active for as long as the executable image in which the object was declared remains active. This attribute can be applied to routines and compilation units.
ASYNCHRONOUS
The ASYNCHRONOUS attribute can be applied to routines and routine parameters declared in external routines to indicate that the routine may be called by an asynchronous event.
CHECK
CHECK [[({option},...)]]
The CHECK attribute can be applied to routines and compilation
units. It directs the compiler to generate code to perform
run-time checks indicated by the chosen options.
ALL Generates checking code for all options
NONE Suppresses all checking code
[NO]BOUNDS Checks that index values are contained in the
index type and that character string sizes
are compatible
[NO]CASE_SELECTORS Checks for the case selector in the case
label list
[NO]OVERFLOW Checks for integer overflow
[NO]POINTERS Checks whether a pointer value is NIL
[NO]SUBRANGE Checks that values assigned to subrange
variables are within the subrange type
Double
The double precision attributes can be applied to compilation units to indicate which format should be used to represent double-precision real numbers.
Additional information available:
G Floating
Double-precision variables and expressions in the compilation unit are represented in G_Floating format.
NOG Floating
Double-precision variables and expressions in the compilation unit are represented in D_Floating format. This is the default double-precision attribute.
ENVIRONMENT
ENVIRONMENT [[(file-name-string)]] The ENVIRONMENT attribute can be applied to compilation units and causes the unit's program- or module-level declarations and definitions to be saved. If the 'FILE-NAME-STRING' is omitted, the name of the source file is used as the environment file name with the default file type PEN.
HIDDEN
The HIDDEN attribute prevents information concerning a type definition or a constant, variable, procedure or function declaration declared at the outermost level of a compilation unit from being included in an environment file.
IDENT
IDENT (name-string) The IDENT attribute can be used to qualify the name of a compilation unit.
INHERIT
INHERIT ({file-name-string},...)
The INHERIT attribute is used to indicate the environment files
to be inherited by a compilation unit. A program or module uses
inherited files to share the definitions and declarations
defined in other previously compiled compilation units.
If the 'FILE-NAME-STRING' is omitted, the name of the source
file is used as the environment file name with the default file
type PEN.
INITIALIZE
The INITIALIZE attribute can be applied to procedures to indicate that the procedure is to be called before the main program is entered. Any number of INITIALIZE procedures can be included in a compilation unit. These procedures will be called in an unspecified order before the main program is entered.
KEY
KEY [[(n)]] KEY [[({n},{options},...)]] KEY [[({options},...)]]
The KEY attribute can be applied to record fields. KEY
indicates that the field is to be used as a key field when the
record is part of an indexed sequential file.
The key number 'N' must be a constant expression that denotes an
integer value in the range from 0 through 254. If you omit the
key number, the default value is 0.
In addition, if you are using VAX/VMS Version 4.6 or higher, you
can specify certain characteristics of the record key by listing
the desired options on the KEY attribute.
Additional information available:
Options
The KEY attribute options allow you to modify the defaults used by the Pascal Run-Time Library when creating or opening an keyed file. You can control the order of the collating sequence and you can allow changes or duplicates on a key. These options require VAX/VMS Version 4.6 or higher.
Additional information available:
ASCENDING
This option, along with DESCENDING, allows you to control the collating order for the key field. By default, the key is ASCENDING. When creating a new file, Pascal will create the key with the collating order specified. When opening an existing file, the Run-Time Library will verify that the existing key matches the collating order specified. If neither ASCENDING or DESCENDING is specified when opening an existing file, both types will be accepted. These options require VAX/VMS Version 4.6 or higher.
CHANGES
This option allows you to specify that changes are allowed on the key. The default for the primary key is NOCHANGES and the default for alternate keys is CHANGES. You can override the CHANGES on alternate keys with NOCHANGES. It is illegal to specify CHANGES on the primary key. When opening an existing file, the Pascal Run-Time Library ignores this option. This option require VAX/VMS Version 4.6 or higher.
DUPLICATES
This option allows you to specify that duplicates are allowed on the key. The default for the primary key is NODUPLICATES and the default for alternate keys is DUPLICATES. When opening an existing file, the Pascal Run-Time Library ignores this option. This option require VAX/VMS Version 4.6 or higher.
LIST
The LIST attribute can be applied to a formal parameter of a routine to indicate that the routine may be called with multiple actual parameters that correspond to the last formal parameter named in the routine heading.
Optimize
The optimization attributes can be applied to routines and compilation units to indicate whether the VAX PASCAL compiler should optimize code.
Additional information available:
OPTIMIZE
OPTIMIZE [[({option},...)]]
The OPTIMIZE attribute specifies optimization options that are
to be enabled during program execution. All options are on by
default.
ALL Enables all OPTIMIZE options
NONE Disables all OPTIMIZE options
[NO]INLINE Enable inline expansion of user-defined routines
NOOPTIMIZE
The NOOPTIMIZE attribute specifies that the compiler is prohibited from optimizing the code for the object. This insures that expressions will be evaluated left to right; however, as with OPTIMIZE the expressions may be partially evaluated. That is some subexpressions may not be evaluated at all if the value of the expression can be determined by partial evaluation.
OVERLAID
The OVERLAID attribute can be applied to compilation units to indicate how storage should be allocated for variables declared within the unit. If this attribute is specified, the variables declared at the program or module level will overlay the storage of static variables in all other OVERLAID compilation units, except when the variables have the STATIC or PSECT attribute. This is only intended for use only with programs using decommitted separate compilation facility provided by Version 1 of VAX PASCAL.
Parameter
The parameter passing attributes can be applied to formal parameters of an external routine declaration. They provide access to VAX descriptor types and cause the address of the specified descriptor to be passed to the routine.
Additional information available:
CLASS_ACLASS_NCACLASS_SIMMEDIATEREFERENCE
CLASS_A
The CLASS_A attribute specifies an array descriptor is to be generated. This type of descriptor is used to describe contiguous arrays of atomic data types or contiguous arrays of fixed-length strings.
CLASS_NCA
The CLASS_NCA attribute specifies an array descriptor is to be generated. This type of descriptor is used to describe non-contiguous arrays.
CLASS_S
The CLASS_S attribute specifies a single descriptor which can be used to describe scalar data and fixed-length strings.
IMMEDIATE
The IMMEDIATE attribute causes the formal parameter value in the routine declaration to be passed by immediate value.
REFERENCE
The REFERENCE attribute causes the formal parameter in the routine declaration to be passed by reference.
POS
POS (n) The POS attribute can be applied to a field of a packed or an unpacked record. POS forces the field to a specific bit position within the record. The constant expression 'N' specified the bit location, relative to the beginning of the record, at which the field begins.
READONLY
The READONLY attribute can be applied to variables, formal parameters, the base-types of pointer variables, and components of structured variables. READONLY specifies that an object can be read by a program but cannot have values assigned to it.
Size
Size attributes can be applied to variables, formal parameters, base-types of pointer variables, components of structured variables, and function results. They specify the amount of storage to be reserved for the object.
Additional information available:
BIT
BIT [[(n)]] The BIT attribute specifies that the amount of storage for an object, designated in bits. The constant expression 'N' indicates the number of storage units. It must denote a positive integer. The default value is 1.
BYTE
BYTE [[(n)]] The BYTE attribute specifies that the amount of storage for an object, designated in bytes. The constant expression 'N' indicates the number of storage units. It must denote a positive integer. The default value is 1.
WORD
WORD [[(n)]] The WORD attribute specifies that the amount of storage for an object, designated in words. The constant expression 'N' indicates the number of storage units. It must denote a positive integer. The default value is 1.
LONG
LONG [[(n)]] The LONG attribute specifies that the amount of storage for an object, designated in longwords. The constant expression 'N' indicates the number of storage units. It must denote a positive integer. The default value is 1.
QUAD
QUAD [[(n)]] The QUAD attribute specifies that the amount of storage for an object, designated in quadwords. The constant expression 'N' indicates the number of storage units. It must denote a positive integer. The default value is 1.
OCTA
OCTA [[(n)]] The OCTA attribute specifies that the amount of storage for an object, designated in octawords. The constant expression 'N' indicates the number of storage units. It must denote a positive integer. The default value is 1.
TRUNCATE
The TRUNCATE attribute can be applied to a formal parameter in a routine declaration. TRUNCATE indicates that an actual parameter list for a routine can be truncated at the point that it was specified. TRUNCATE can be used with the predeclared routine PRESENT.
UNBOUND
The UNBOUND attribute can be applied to routines and formal routine parameters. An UNBOUND routine does not access automatic variables in the scope in which it is declared. The bound procedure value of an UNBOUND routine does not include the static scope pointer.
UNSAFE
The UNSAFE attribute can be applied to variables, formal parameters, the base-types of pointer variables, components of structured variables, function results, array indexes, tag fields of variant records, and base types of sets. It indicates that an object can accept values of any type without type checking.
VALUE
The VALUE attribute may be used only on a variable with either the EXTERNAL or GLOBAL attribute. VALUE causes the variable to be a reference to an external constant or be the defining point of a global constant.
Visibility
The visibility attributes can be applied to variables, routines, and compilation units. They control the sharing of an object between independently compiled units and indicate the name by which the object is known outside the unit that declares it.
Additional information available:
LOCALGLOBALEXTERNALWEAK_GLOBALWEAK_EXTERNAL
LOCAL
The LOCAL attribute indicates that an object is unavailable to other independently compiled units. Only compilation units that have access to the environment in which the object was declared can refer to the object.
GLOBAL
GLOBAL [[(identifier)]] The GLOBAL attribute provides a strong definition of an object so that other independently compiled units can refer to it. The 'IDENTIFIER' parameter indicates the name by which the corresponding object is known to the VAX Linker. Normally, this identifier is not included, so the linker recognizes the same object name as the declaring compilation unit.
EXTERNAL
EXTERNAL [[(identifier)]] The EXTERNAL attribute indicates a variable or routine that is assumed to be GLOBAL in another independently compiled unit. The 'IDENTIFIER' parameter indicates a name to supply to the VAX Linker rather than the name of the identifier being declared. The names available to the linker for corresponding GLOBAL and EXTERNAL variables and routines must be identical.
WEAK_GLOBAL
WEAK_GLOBAL [[(identifier)]] The WEAK_GLOBAL attribute is similar to the GLOBAL attribute except that a WEAK_GLOBAL object is linked only when it is specifically included in the linking operation. The 'IDENTIFIER' parameter indicates the name by which the corresponding object is known to the VAX Linker. Normally, this identifier is not included, so the linker recognizes the same object name as the declaring compilation unit.
WEAK_EXTERNAL
WEAK_EXTERNAL [[(identifier)]] The WEAK_EXTERNAL attribute is similar to the EXTERNAL attribute except that a WEAK_EXTERNAL object is not critical to the linking operation. The 'IDENTIFIER' parameter indicates a name to supply to the VAX Linker rather than the name of the identifier being declared. The names available to the linker for corresponding GLOBAL and EXTERNAL variables and routines must be identical.
VOLATILE
The VOLATILE attribute can be applied to variables, formal parameters, the base-types of pointer variables, components of structured variables, and function results. It indicates the assumptions that the compiler can legally make about the value of an object. Normally the compiler assumes that an object's value will not be subject to unusual side effects. The VOLATILE attribute informs the compiler that the object's value will be subject to unusual side effects during execution.
WRITEONLY
The WRITEONLY attribute can be applied to variables, formal parameters, the base-type of pointer variables, and components of structured variables. WRITEONLY specifies that an object can have values assigned to it but cannot be read by a program.
Miscellaneous
Additional information available:
Listing DirectivesInclude DirectiveCDD DirectiveList Qualifier
Comments
Listing Directives
The %TITLE and %SUBTITLE directives allow specification of any
arbitrary compile-time string for the listing title and subtitle
lines. The format is as follows:
%TITLE 'character-string'
%SUBTITLE 'character-string'
If %TITLE appears on the first line of a page, it sets the title
are for the current page. If %TITLE does not appear on the
first line of a page, then the title area is not set until the
next page. If no %TITLE is active, the field is filled with
blanks.
%SUBTITLE works in a similar way. If %SUBTITLE appears on the
first or second line of a page, then the subtitle area is set
for the current page. If the %SUBTITLE does not appear in the
first two lines of a page, then the subtitle area is not set
until the next page. If no %SUBTITLE is active, the field is
filled with "Source Listing." Note that %SUBTITLE does not
affect the subtitle area for listing phases other than the
source listing section.
Include Directive
The %INCLUDE directive incorporates the contents of a specified
file or a module from a text library into the PASCAL source
program immediately following the %INCLUDE directive. The file
or module must include valid PASCAL source. Statement formats:
%INCLUDE 'file-spec [[ /[NO]LIST ]]'
1. Incorporates the contents of the specified file
%INCLUDE '[file-spec] (module-name) [[ /[NO]LIST ]]'
2. Incorporates the contents of the specified module. The file
must be the name of the text library which contains the
module. If the file-spec is omitted, the specified module
name must reside in a user-specified default library.
The 'file-spec' is the name of the file to be included.
The 'module-name' is an unquoted name of a text module in the
library.
The '/[NO]LIST' qualifier is an option that indicates that the
included file should be printed in the listing of the program if
a listing is being generated. /LIST is the default.
CDD Directive
The %DICTIONARY directive allows access to a Common Data
Dictionary (CDD) record description during the compilation of a
PASCAL program. The directive is useful when the same record or
data definition is used by other VAX languages and VAX data
management products and has been stored in the CDD. The
contents of the 'included' record description are converted into
PASCAL type definition which is then inserted at the point where
the compiler encountered the %DICTIONARY directive. The
%DICTIONARY directive can only appear in a type declaration.
Syntax:
%DICTIONARY 'cdd-pathname [[ /[NO]LIST ]]'
The 'CDD-PATHNAME' is a character string which represents the
path name of the CDD record description which is to be
extracted.
The '/LIST' option indicates that the 'included' declaration
should be printed in the listing of the program if a listing is
being generated. /LIST is the default.
Example:
TYPE
%DICTIONARY 'CDD$TOP.CORPORATE.SALARY_RANGE'
The definition of 'CDD$TOP.CORPORATE.SALARY_RANGE' is placed in
a program at the position of the TYPE declaration.
A dictionary directive can also appear inside of a record
definition.
Syntax:
type-id = [[PACKED]] RECORD
{ field-list | %DICTIONARY 'cdd-pathname [[ /[NO]LIST ]]' }...
END
Example:
A = RECORD
B : INTEGER;
%DICTIONARY 'CDD$TOP.CORPORATE.PERSONNEL'
END;
List Qualifier
LIST
The '/LIST' qualifier is an option that indicates that the
included information be printed in the listing of the
program if a listing is being generated. This is the
default.
NOLIST
The '/NOLIST' qualifier is an option that indicates that
the included information not be printed in the listing of
the program. The line containing the directive (%INCLUDE
or %DICTIONARY) does appear in the program listing if one
is generated.
Comments
Comments are words or phrases that record important information
about a program. The compiler ignores the text of a comment
when processing a program. A comment can contain any ASCII
character, except a nonprinting control character, and can
appear anywhere a space is legal.
A comment is designated by either text enclosed in brackets ( {}
) or text enclosed in a left-parenthesis/asterisk text
right-parenthesis/asterisk format ( (* *) ).
Example:
{ This is a comment }
(* This is also a comment *)
The special symbols that delimit a comment are equivalent. VAX
PASCAL does not allow nesting comments. One comment cannot be
included inside of another.
Example
The following is illegal:
(* Comments can not be nested { in VAX PASCAL } within
a program *)
Release Notes
Please refer to SYS$HELP:PASCAL%%%.RELEASE_NOTES for VAX PASCAL
release notes.
Program PascTest(Output);
VAR Listing_File : TEXT;
Header_Line : PACKED ARRAY [1..133] OF Char;
Version : Integer;
BEGIN
Open( File_Variable := Listing_File,
File_Name := 'PASCTEST.LIS',
History := Old );
Reset ( Listing_File );
ReadLn( Listing_File, Header_Line );
Version := 35;
WHILE Header_Line[Version+88] = ' ' DO
Version := Version - 1;
WriteLn(
'** Successful Installation of ',
Substr( Header_Line, 89, Version ),
' on ',
Substr( Header_Line, 65, 11 ),
' at ',
Substr( Header_Line, 77, 5 ),
' **' );
END.
(* PASDEF.PAS - VAX Pascal V3 Condition Code Definitions *)
(****************************************************************************)
(* *)
(* COPYRIGHT (c) 1982, 1984, 1985 BY *)
(* DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS. *)
(* ALL RIGHTS RESERVED. *)
(* *)
(* THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED *)
(* ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE *)
(* INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER *)
(* COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY *)
(* OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY *)
(* TRANSFERRED. *)
(* *)
(* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE *)
(* AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT *)
(* CORPORATION. *)
(* *)
(* DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS *)
(* SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL. *)
(* *)
(****************************************************************************)
(* Note: This file is designed to be included as part of a CONST section. *)
PAS$_FILALROPE = %X'0021864C'; (* file is already open *)
PAS$_ERRDUROPE = %X'00218654'; (* error during OPEN *)
PAS$_FILNOTFOU = %X'0021865C'; (* file not found *)
PAS$_INVFILSYN = %X'00218664'; (* invalid filename syntax *)
PAS$_ACCMETINC = %X'0021866C'; (* ACCESS_METHOD specified is incompatible with this file *)
PAS$_RECLENINC = %X'00218674'; (* RECORD_LENGTH specified is inconsistent with this file *)
PAS$_RECTYPINC = %X'0021867C'; (* RECORD_TYPE specified is inconsistent with this file *)
PAS$_ORGSPEINC = %X'00218684'; (* ORGANIZATION specified is inconsistent with this file *)
PAS$_INVKEYDEF = %X'0021868C'; (* invalid key definition *)
PAS$_KEYDEFINC = %X'00218694'; (* KEY(<n>) definition is inconsistent with this file *)
PAS$_KEYNOTDEF = %X'0021869C'; (* KEY(<n>) is not defined in this file *)
PAS$_INVRECLEN = %X'002186A4'; (* invalid record length of <n> *)
PAS$_TEXREQSEQ = %X'002186AC'; (* textfiles require sequential organization and access *)
PAS$_FILNAMREQ = %X'002186B4'; (* FILE_NAME required for this HISTORY or DISPOSITION *)
PAS$_FILALRCLO = %X'002186BC'; (* file is already closed *)
PAS$_ERRDURCLO = %X'002186C4'; (* error during CLOSE *)
PAS$_AMBVALENU = %X'00218734'; (* "<string>" is an ambiguous value for enumerated type "<type>" *)
PAS$_INVSYNENU = %X'0021873C'; (* "<string>" is invalid syntax for an enumerated value *)
PAS$_INVSYNINT = %X'00218744'; (* "<string>" is invalid syntax for an integer value *)
PAS$_INVSYNREA = %X'0021874C'; (* "<string>" is invalid syntax for a real value *)
PAS$_INVSYNUNS = %X'00218754'; (* "<string>" is invalid syntax for an unsigned value *)
PAS$_NOTVALTYP = %X'0021875C'; (* "<string>" is not a value of type "<type>" *)
PAS$_ERRDURPRO = %X'00218764'; (* error during prompting *)
PAS$_INVSYNBIN = %X'0021876C'; (* "<string>" is invalid syntax for a binary value *)
PAS$_INVSYNHEX = %X'00218774'; (* "<string>" is invalid syntax for a hexadecimal value *)
PAS$_INVSYNOCT = %X'0021877C'; (* "<string>" is invalid syntax for an octal value *)
PAS$_ERRDURWRI = %X'002187D4'; (* error during WRITELN *)
PAS$_INVFIESPE = %X'002187DC'; (* invalid field specification for WRITE *)
PAS$_LINTOOLON = %X'002187E4'; (* line is too long, exceeded record length by <n> character(s) *)
PAS$_NEGWIDDIG = %X'002187EC'; (* negative Width or Digits specification is not allowed *)
PAS$_WRIINVENU = %X'002187F4'; (* WRITE of an invalid enumerated value *)
PAS$_KEYVALINC = %X'00218874'; (* key value is incompatible with this file's key <n> *)
PAS$_KEYDUPNOT = %X'0021887C'; (* key field duplication is not allowed *)
PAS$_KEYCHANOT = %X'00218884'; (* key field change is not allowed *)
PAS$_CURCOMUND = %X'0021888C'; (* current component is undefined for DELETE or UPDATE *)
PAS$_FAIGETLOC = %X'00218894'; (* failed to GET locked component *)
PAS$_DELNOTALL = %X'00218964'; (* DELETE is not allowed for a sequential organization file *)
PAS$_ERRDURDEL = %X'0021896C'; (* error during DELETE *)
PAS$_ERRDURFIN = %X'00218974'; (* error during FIND or FINDK *)
PAS$_ERRDURGET = %X'0021897C'; (* error during GET *)
PAS$_ERRDURPUT = %X'00218984'; (* error during PUT *)
PAS$_ERRDURRES = %X'0021898C'; (* error during RESET or RESETK *)
PAS$_ERRDURREW = %X'00218994'; (* error during REWRITE *)
PAS$_ERRDURTRU = %X'0021899C'; (* error during TRUNCATE *)
PAS$_ERRDURUNL = %X'002189A4'; (* error during UNLOCK *)
PAS$_ERRDURUPD = %X'002189AC'; (* error during UPDATE *)
PAS$_FILNOTDIR = %X'002189B4'; (* file is not opened for direct access *)
PAS$_FILNOTGEN = %X'002189BC'; (* file is not in Generation mode *)
PAS$_FILNOTINS = %X'002189C4'; (* file is not in Inspection mode *)
PAS$_FILNOTKEY = %X'002189CC'; (* file is not opened for keyed access *)
PAS$_FILNOTOPE = %X'002189D4'; (* file is not open *)
PAS$_FILNOTSEQ = %X'002189DC'; (* file is not sequential organization *)
PAS$_FILNOTTEX = %X'002189E4'; (* file is not a textfile *)
PAS$_GENNOTALL = %X'002189EC'; (* Generation mode is not allowed for a READONLY file *)
PAS$_GETAFTEOF = %X'002189F4'; (* GET attempted after end-of-file *)
PAS$_INSNOTALL = %X'002189FC'; (* Inspection mode is not allowed for a WRITEONLY file *)
PAS$_INSVIRMEM = %X'00218A04'; (* insufficient virtual memory *)
PAS$_INVARGPAS = %X'00218A0C'; (* invalid argument to Pascal Run-Time Library *)
PAS$_LINVALEXC = %X'00218A14'; (* LINELIMIT value exceeded *)
PAS$_REWNOTALL = %X'00218A1C'; (* REWRITE is not allowed for a shared file *)
PAS$_RESNOTALL = %X'00218A24'; (* RESET is not allowed on an unopened internal file *)
PAS$_TRUNOTALL = %X'00218A2C'; (* TRUNCATE is not allowed for a shared file *)
PAS$_UPDNOTALL = %X'00218A34'; (* UPDATE is not allowed for a sequential organization file *)
PAS$_ERRDUREXT = %X'00218A3C'; (* error during EXTEND *)
PAS$_EXTNOTALL = %X'00218A44'; (* EXTEND is not allowed for a shared file *)
PAS$_INVFILVAR = %X'00219F44'; (* invalid file variable at location <n> *)
PAS$_FILALRACT = %X'00219F4C'; (* file "<file>" is already active *)
PAS$_ERRDURNEW = %X'00219F54'; (* error during NEW *)
PAS$_ERRDURDIS = %X'00219F5C'; (* error during DISPOSE *)
PAS$_ERRDURMAR = %X'00219F64'; (* error during MARK *)
PAS$_ERRDURREL = %X'00219F6C'; (* error during RELEASE *)
PAS$_HALT = %X'00219F84'; (* HALT procedure called *)
PAS$_BUGCHECK = %X'00219F8C'; (* internal consistency failure <n> in Pascal Run-Time Library *)
PAS$_NEGDIGARG = %X'00219F94'; (* negative Digits argument to BIN, HEX or OCT is not allowed *)
PAS$_BADBITARG = %X'00219FA4'; (* bad argument to DEC *)
PAS$_CANCNTERR = %X'00219FAC'; (* cannot continue from a severe error *)
PAS$_ARRINDVAL = %X'0021BE84'; (* array index value is out of range *)
PAS$_ARRNOTCOM = %X'0021BE8C'; (* conformant array is not compatible *)
PAS$_ARRNOTSTR = %X'0021BE94'; (* conformant array is not a string *)
PAS$_CASSELVAL = %X'0021BE9C'; (* CASE selector value is out of range *)
PAS$_CONCATLEN = %X'0021BEA4'; (* string concatenation has more than 65535 characters *)
PAS$_PADLENERR = %X'0021BEAC'; (* PAD length error *)
PAS$_PTRREFNIL = %X'0021BEB4'; (* pointer reference to NIL *)
PAS$_SETASGVAL = %X'0021BEBC'; (* set assignment value has element out of range *)
PAS$_SETCONVAL = %X'0021BEC4'; (* set constructor value is out of range *)
PAS$_STRASGLEN = %X'0021BECC'; (* string assignment length error *)
PAS$_STRCOMLEN = %X'0021BED4'; (* strings comparison length error *)
PAS$_SUBASGVAL = %X'0021BEDC'; (* subrange assignment value is out of range *)
PAS$_SUBSTRSEL = %X'0021BEE4'; (* SUBSTR selection error *)
PAS$_VARINDVAL = %X'0021BEEC'; (* varying index value is greater than current length *)
PAS$_ORDVALOUT = %X'0021BEF4'; (* ordinal value is out of range *)
PAS$_NOACTUAL = %X'0021BEFC'; (* no actual parameter passed *)
PAS$_MODNEGNUM = %X'0021BF04'; (* modulus of a negative number has no mathematical definition *)
(* End of PASDEF.PAS *)
(* PASSTATUS.PAS - VAX Pascal V3 STATUS Function Value Definitions *)
(****************************************************************************)
(* *)
(* COPYRIGHT (c) 1982, 1984, 1985 BY *)
(* DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS. *)
(* ALL RIGHTS RESERVED. *)
(* *)
(* THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED *)
(* ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE *)
(* INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER *)
(* COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY *)
(* OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY *)
(* TRANSFERRED. *)
(* *)
(* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE *)
(* AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT *)
(* CORPORATION. *)
(* *)
(* DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS *)
(* SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL. *)
(* *)
(****************************************************************************)
(* These values are returned by the predefined STATUS function. *)
PAS$K_EOF = -1; (* file is at end-of-file *)
PAS$K_SUCCESS = 0; (* last operation successful *)
PAS$K_FILALROPE = 1; (* file is already open *)
PAS$K_ERRDUROPE = 2; (* error during OPEN *)
PAS$K_FILNOTFOU = 3; (* file not found *)
PAS$K_INVFILSYN = 4; (* invalid filename syntax *)
PAS$K_ACCMETINC = 5; (* ACCESS_METHOD specified is incompatible with this file *)
PAS$K_RECLENINC = 6; (* RECORD_LENGTH specified is inconsistent with this file *)
PAS$K_RECTYPINC = 7; (* RECORD_TYPE specified is inconsistent with this file *)
PAS$K_ORGSPEINC = 8; (* ORGANIZATION specified is inconsistent with this file *)
PAS$K_INVKEYDEF = 9; (* invalid key definition *)
PAS$K_KEYDEFINC = 10; (* KEY(<n>) definition is inconsistent with this file *)
PAS$K_KEYNOTDEF = 11; (* KEY(<n>) is not defined in this file *)
PAS$K_INVRECLEN = 12; (* invalid record length of <n> *)
PAS$K_TEXREQSEQ = 13; (* textfiles require sequential organization and access *)
PAS$K_FILNAMREQ = 14; (* FILE_NAME required for this HISTORY or DISPOSITION *)
PAS$K_FILALRCLO = 15; (* file is already closed *)
PAS$K_ERRDURCLO = 16; (* error during CLOSE *)
PAS$K_AMBVALENU = 30; (* "<string>" is an ambiguous value for enumerated type "<type>" *)
PAS$K_INVSYNENU = 31; (* "<string>" is invalid syntax for an enumerated value *)
PAS$K_INVSYNINT = 32; (* "<string>" is invalid syntax for an integer value *)
PAS$K_INVSYNREA = 33; (* "<string>" is invalid syntax for a real value *)
PAS$K_INVSYNUNS = 34; (* "<string>" is invalid syntax for an unsigned value *)
PAS$K_NOTVALTYP = 35; (* "<string>" is not a value of type "<type>" *)
PAS$K_ERRDURPRO = 36; (* error during prompting *)
PAS$K_INVSYNBIN = 37; (* "<string>" is invalid syntax for a binary value *)
PAS$K_INVSYNHEX = 38; (* "<string>" is invalid syntax for a hexadecimal value *)
PAS$K_INVSYNOCT = 39; (* "<string>" is invalid syntax for an octal value *)
PAS$K_ERRDURWRI = 50; (* error during WRITELN *)
PAS$K_INVFIESPE = 51; (* invalid field specification for WRITE *)
PAS$K_LINTOOLON = 52; (* line is too long, exceeded record length by <n> character(s) *)
PAS$K_NEGWIDDIG = 53; (* negative Width or Digits specification is not allowed *)
PAS$K_WRIINVENU = 54; (* WRITE of an invalid enumerated value *)
PAS$K_KEYVALINC = 70; (* key value is incompatible with this file's key <n> *)
PAS$K_KEYDUPNOT = 71; (* key field duplication is not allowed *)
PAS$K_KEYCHANOT = 72; (* key field change is not allowed *)
PAS$K_CURCOMUND = 73; (* current component is undefined for DELETE or UPDATE *)
PAS$K_FAIGETLOC = 74; (* failed to GET locked component *)
PAS$K_DELNOTALL = 100; (* DELETE is not allowed for a sequential organization file *)
PAS$K_ERRDURDEL = 101; (* error during DELETE *)
PAS$K_ERRDURFIN = 102; (* error during FIND or FINDK *)
PAS$K_ERRDURGET = 103; (* error during GET *)
PAS$K_ERRDURPUT = 104; (* error during PUT *)
PAS$K_ERRDURRES = 105; (* error during RESET or RESETK *)
PAS$K_ERRDURREW = 106; (* error during REWRITE *)
PAS$K_ERRDURTRU = 107; (* error during TRUNCATE *)
PAS$K_ERRDURUNL = 108; (* error during UNLOCK *)
PAS$K_ERRDURUPD = 109; (* error during UPDATE *)
PAS$K_FILNOTDIR = 110; (* file is not opened for direct access *)
PAS$K_FILNOTGEN = 111; (* file is not in Generation mode *)
PAS$K_FILNOTINS = 112; (* file is not in Inspection mode *)
PAS$K_FILNOTKEY = 113; (* file is not opened for keyed access *)
PAS$K_FILNOTOPE = 114; (* file is not open *)
PAS$K_FILNOTSEQ = 115; (* file is not sequential organization *)
PAS$K_FILNOTTEX = 116; (* file is not a textfile *)
PAS$K_GENNOTALL = 117; (* Generation mode is not allowed for a READONLY file *)
PAS$K_GETAFTEOF = 118; (* GET attempted after end-of-file *)
PAS$K_INSNOTALL = 119; (* Inspection mode is not allowed for a WRITEONLY file *)
PAS$K_INSVIRMEM = 120; (* insufficient virtual memory *)
PAS$K_INVARGPAS = 121; (* invalid argument to Pascal Run-Time Library *)
PAS$K_LINVALEXC = 122; (* LINELIMIT value exceeded *)
PAS$K_REWNOTALL = 123; (* REWRITE is not allowed for a shared file *)
PAS$K_RESNOTALL = 124; (* RESET is not allowed on an unopened internal file *)
PAS$K_TRUNOTALL = 125; (* TRUNCATE is not allowed for a shared file *)
PAS$K_UPDNOTALL = 126; (* UPDATE is not allowed for a sequential organization file *)
PAS$K_ERRDUREXT = 127; (* error during EXTEND *)
PAS$K_EXTNOTALL = 128; (* EXTEND is not allowed for a shared file *)
(* End of PASSTATUS.PAS *)
(* File: SYS$LIBRARY:SIGDEF.PAS--PASCAL INCLUDE file
to define System signaling and condition handling symbols.
COPYRIGHT (c) 1981,1985 BY
DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE
INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER
COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY
TRANSFERRED.
THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE
AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT
CORPORATION.
DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS
SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.
*)
SS$_ACCVIO = %X000C; (* ACCESS VIOLATION *)
SS$_OPCCUS = %X0434; (* OPCODE RESERVED TO CUSTOMER *)
SS$_OPCDEC = %X043C; (* OPCODE RESERVED TO DIGITAL *)
SS$_RADRMOD = %X044C; (* RESERVED ADDRESSING MODE *)
SS$_ROPRAND = %X0454; (* RESERVED OPERAND *)
SS$_FAIL = %X045C; (* SYSTEM SERVICE FAILURE *)
SS$_TBIT = %X0464; (* T-BIT TRAP *)
SS$_INTOVF = %X047C; (* INTEGER OVERFLOW *)
SS$_INTDIV = %X0484; (* INTEGER DIVIDE BY ZERO *)
SS$_FLTOVF = %X048C; (* FLOATING OVERFLOW *)
SS$_FLTDIV = %X0494; (* FLOATING/DECIMAL DIVIDE BY ZERO *)
SS$_FLTUND = %X049C; (* FLOATING UNDERFLOW *)
SS$_DECOVF = %X04A4; (* DECIMAL OVERFLOW *)
SS$_SUBRNG = %X04AC; (* SUBSCRIPT OUT OF RANGE *)
SS$_FLTOVF_F = %X04B4; (* ARITHMETIC FAULT, FLOATING OVERFLOW *)
SS$_FLTDIV_F = %X04BC; (* ARITHMETIC FAULT, FLOATING DIVIDE BY ZERO *)
SS$_FLTUND_F = %X04C4; (* ARITHMETIC FAULT, FLOATING UNDERFLOW *)
SS$_NORMAL = %X0001; (* NORMAL COMPLETION *)
SS$_CONTINUE = %X0001; (* CONTINUE EXECUTION AT POINT OF EXCEPTION *)
SS$_RESIGNAL = %X0918; (* RESIGNAL CONDITION TO NEXT HANDLER *)
SS$_UNWIND = %X0920; (* UNWIND CONDITION *)
(* End of file SIGDEF.PAS *)