XL Fortran for AIX 8.1
Language Reference
Purpose
The PRINT statement is a data transfer output statement.
Format
>>-PRINT--+-name----------------------------+------------------><
'-format--+---------------------+-'
'-,--output_item_list-'
|
- name
- is a namelist group name
- output_item
- is an output list item. An output list specifies the data to be
transferred. An output list item can be:
- A variable. An array is treated as if all of its elements were
specified in the order they are arranged in storage.
A pointer must be associated with a target, and an allocatable object must be allocated. A derived-type object cannot have any
ultimate component that is outside the scoping unit of this statement.
The evaluation of output_item cannot result in a derived-type object
that contains a pointer. The structure components of a structure in a
formatted statement are treated as if they appear in the order of the
derived-type definition; in an unformatted statement, the structure
components are treated as a single value in their internal representation
(including padding).
- An expression.
- An implied-DO list, as described under Implied-DO List.
- format
- is a format specifier that specifies the format to be used in the output
operation. format is a format identifier that can be:
- The statement label of a FORMAT statement. The
FORMAT statement must be in the same scoping unit.
- The name of a scalar INTEGER(4) or INTEGER(8) variable
that was assigned the statement label of a FORMAT statement.
The FORMAT statement must be in the same scoping unit.
+---------------------------------Fortran 95---------------------------------+
Fortran 95 does not permit assigning of a statement
label.
+-----------------------------End of Fortran 95------------------------------+
- A character constant. It cannot be a Hollerith constant. It
must begin with a left parenthesis and end with a right parenthesis.
Only the format codes described in the FORMAT statement can be used
between the parentheses. Blank characters can precede the left
parenthesis, or follow the right parenthesis.
- A character variable that contains character data whose leftmost character
positions constitute a valid format. A valid format begins with a left
parenthesis and ends with a right parenthesis. Only the format codes
listed under FORMAT can be used between the parentheses. Blank characters
can precede the left parenthesis, or follow the right parenthesis.
- An array of noncharacter intrinsic type.
- Any character expression, except one involving concatenation of an operand
that specifies inherited length, unless the operand is the name of a
constant.
- An asterisk, specifying list-directed formatting.
- A namelist specifier that specifies the name
of a namelist list that you have previously defined.
Specifying the -qport=typestmt compiler option enables the
TYPE statement which has identical functionality to the
PRINT statement.
>>-(--do_object_list-- , --------------------------------------->
>--do_variable = arith_expr1, arith_expr2----------------------->
>--+---+--+-------------+--)-----------------------------------><
'-,-' '-arith_expr3-'
|
- do_object
- is an output list item
- do_variable
- is a named scalar variable of type integer or real
- arith_expr1, arith_expr2, and
arith_expr3
- are scalar numeric expressions
The range of an implied-DO list is the list
do_object_list. The iteration count and the values of the
DO variable are established from arith_expr1,
arith_expr2, and arith_expr3, the same as for a DO
statement. When the implied-DO list is executed, the items in
the do_object_list are specified once for each iteration of the
implied-DO list, with the appropriate substitution of values for any
occurrence of the DO variable.
Examples
PRINT 10, A,B,C
10 FORMAT (E4.2,G3.2E1,B3)
Related Information
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]