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:
Syntax Element | Description |
---|---|
(rep) |
Report Specification:
The notation
A value in the range 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 Report Format and Control (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 , / |
Field Positioning, Text, Attribute Assignment:
|
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 |
EMU |
Unicode Edit Mask | E |
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.
DEFINE DATA LOCAL 1 VARI (A4) INIT <'1234'> /* Output END-DEFINE /* Produced * /* --------- PRINT 'Text' VARI /* Text 1234 PRINT (PM=I) 'Text' VARI /* Text 4321 PRINT 'Text' (PM=I) VARI (PM=I) /* txeT 4321 PRINT 'Text' (PM=I) VARI /* txeT 1234 END
nX
|
'text' [(attributes)] | |||||||
nT
|
'c' ( n ) [(attributes)] | |||||||
/ | ['='] operand1 [(parameters)] |
Syntax Element | Description |
---|---|
'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 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 |
parameters
|
Parameter Definition at Element (Field) Level:
One or more parameters (see table above), enclosed within parentheses, may be specified
immediately after 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 can be:
ad-value |
Where:
ad-value
,
cd-value
and
pm-value
denote the possible values of
the corresponding session parameters AD
, CD
and
PM
described
in the relevant sections of the Parameter Reference
documentation.
The compiler actually accepts more than one attribute value for an output
field. For example, you can specify: AD=BDI
. In such a case,
however, only the last value applies. In the given example, only the value
I
becomes effective and the output field is displayed
intensified.
For an alphanumeric/Unicode constant (Natural data format A or U), you can
specify ad-value
and/or
cd-value
without preceding
CD=
or AD=
, respectively. The single value entered is
then checked against all possible CD
values first. For
example: a value of IRE
will be interpreted as intensified/red but
not as intensified/right-justified/mandatory. You cannot combine a single
cd-value
or
ad-value
with a value preceded by
CD=
or AD=
.
** 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