PRINT [(rep)] [NOTITLE ]
[NOHDR ] [(statement-parameters)]
|
|||||||||||
nX
|
'text' ' [(attributes)] | ||||||||||
nT
|
'c'(n) [(attributes )] | ||||||||||
/ | ['='] operand1 [(parameters)] |
This document covers the following topics:
For an explanation of the symbols used in the syntax diagram, see Syntax Symbols.
Related Statements: AT END OF PAGE | AT TOP OF PAGE | CLOSE PRINTER | DEFINE PRINTER | DISPLAY | EJECT | FORMAT | NEWPAGE | SKIP | SUSPEND IDENTICAL SUPPRESS | WRITE | WRITE TITLE | WRITE TRAILER
Belongs to Function Group: Creation of Output Reports
The PRINT
statement is used to produce output in free
format.
The PRINT
statement differs from the
WRITE
statement in the
following aspects:
The output for each operand is written according to the value content
rather than the length of the operand. Leading zeros for numeric values and
trailing blanks for alphanumeric values are suppressed. The session parameter
AD
defines
whether numeric values are printed left or right justified. With
AD=L
, the trailing blanks of a numeric value are
suppressed. With AD=R
, the leading blanks of a numeric
value are printed.
If the resulting output exceeds the current line size (LS
parameter), the
output is continued on the next line as follows: An alphanumeric constant or
the content of an alphanumeric variable (without edit mask) is split at the
rightmost blank or character which is neither a letter nor a numeric character
contained on the current line. The first part of the split value is output to
the current line, and the second part is written to the next line. Leading
blanks in the second part are removed. As a consequence, empty lines are
suppressed.
For all other operands, the entire value is written to the next line.
Operand Definition Table:
Operand | Possible Structure | Possible Formats | Referencing Permitted | Dynamic Definition | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
operand1 | S | A | G | N | A | U | N | P | I | F | B | D | T | L | G | O | yes | no |
Syntax Element Description:
(rep) |
Report Specification:
The notation
A value in the range 0 - 31 or a logical name which has been
assigned using the If If this printer file is defined to Natural as PC, the report will be downloaded to the PC, see Example 2. For information on how to control the format of an output report created with Natural, see Controlling Data Output (in the Programming Guide). |
---|---|
NOTITLE |
Default Page Title Suppression:
Natural generates a single title line for each page resulting from
a
If the |
NOHDR |
Column Header Suppression:
The Without the |
statement-parameters |
Parameter Definition at Statement Level:
One or more parameters, enclosed within parentheses, may be
specified at statement level, that is, immediately after the Each parameter specified in this manner will override any previous
parameter specified in a The parameter settings applied here will only be regarded for variable fields, but they have no effect on text-constants. If you would like to set field attributes for a text-constant, they have to be set explicitly for this element, see Parameter Definition at Element (Field) Level. See also: |
nX, nT, / | See Field Positioning, Text, Attribute Assignment below. |
Parameters that can be specified with the PRINT statement | Specification (S = at statement level, E = at element level) | |
---|---|---|
AD | Attribute Definition | SE |
AL | Alphanumeric Length for Output | SE |
CD | Color Definition | SE |
CV | Control Variable | SE |
DF | Date Format | SE |
DL | Display Length for Output | SE |
DY | Dynamic Attributes | SE |
EM | Edit Mask | SE |
FL | Floating Point Mantissa Length | SE |
MC | Multiple-Value Field Count | S |
MP | Maximum Number of Pages of a Report | S |
NL | Numeric Length for Output | SE |
PC | Periodic Group Count | S |
PM | Print Mode | SE |
SG | Sign Position | SE |
ZP | Zero Printing | SE |
The individual session parameters are described in the Parameter Reference.
nX
|
'text' [(attributes)] | |||||||
nT
|
'c' ( n ) [(attributes)] | |||||||
/ | ['='] operand1 [(parameters)] |
'text' |
Text Assignment:
The character string enclosed by single quotes is displayed. PRINT 'EMPLOYEE' NAME 'MARITAL/STATUS' MAR-STAT |
---|---|
'c' (n) |
Character Repetition:
The character enclosed by single quotes is displayed n times immediately before the field value. PRINT '*' (5) '=' NAME |
'=' |
Field Content Positioned behind Field Heading:
When placed before a field, the equal sign PRINT '=' NAME |
operand1 |
Field to be Printed:
As operand1 you specify the field to be printed. |
parameters |
Parameter Definition at Element (Field) Level:
One or more parameters (see table above), enclosed within parentheses, may be specified immediately after operand1. Each parameter specified in this manner will override any
previous parameter specified at statement level or in a
If more than one parameter is specified, one or more blanks must be placed between each entry. An entry must not be split between two statement lines. See also: |
attributes indicates the output attributes to be used for text display. Attributes may be:
|
||||
AD-value
|
For the possible session parameter values, refer to the corresponding sections in the Parameter Reference documentation:
Note:
The compiler actually accepts more than one attribute value for
an output field. For example, you may specify: AD=BDI
. In such a
case, however, only the last value applies. In the given example, only the
value I
will become effective and the output field will be
displayed intensified.
** Example 'PRTEX1': PRINT ************************************************************************ DEFINE DATA LOCAL 1 EMPLOY-VIEW VIEW OF EMPLOYEES 2 NAME 2 FIRST-NAME 2 CITY 2 JOB-TITLE 2 ADDRESS-LINE (2) END-DEFINE * LIMIT 1 READ EMPLOY-VIEW BY CITY /* WRITE NOTITLE 'EXAMPLE 1:' // 'RESULT OF WRITE STATEMENT:' WRITE / NAME ',' FIRST-NAME ':' JOB-TITLE '*' (30) WRITE / 'RESULT OF PRINT STATEMENT:' PRINT / NAME ',' FIRST-NAME ':' JOB-TITLE '*' (30) /* WRITE // 'EXAMPLE 2:' // 'RESULT OF WRITE STATEMENT:' WRITE / NAME 60X ADDRESS-LINE (1:2) WRITE / 'RESULT OF PRINT STATEMENT:' PRINT / NAME 60X ADDRESS-LINE (1:2) /* END-READ END
EXAMPLE 1: RESULT OF WRITE STATEMENT: SENKO , WILLIE : PROGRAMMER ****************************** RESULT OF PRINT STATEMENT: SENKO , WILLIE : PROGRAMMER ****************************** EXAMPLE 2: RESULT OF WRITE STATEMENT: SENKO 2200 COLUMBIA PIKE #914 RESULT OF PRINT STATEMENT: SENKO 2200 COLUMBIA PIKE #914
** Example 'PCPIEX1': PRINT to PC ** ** NOTE: Example requires that Natural Connection is installed. ************************************************************************ DEFINE DATA LOCAL 01 PERS VIEW OF EMPLOYEES 02 PERSONNEL-ID 02 NAME 02 CITY END-DEFINE * FIND PERS WITH CITY = 'NEW YORK' /* Data selection PRINT (7) 5T CITY 20T NAME 40T PERSONNEL-ID /* (7) designates /* the output file /* (here the PC). END-FIND END