Previous Topic: PERFORM CommandNext Topic: PROC Command


PRINT Command

(Area 4A)

The PRINT command specifies the fields that are to be printed on each detail line within a specific report. The command also provides several options that control the format of the output report.

The PRINT command does the following:

The format of the PRINT command is as follows:

►►─ PRINT ─┬───────────────┬─┬─────────────────────────┬──────────────────────►
           └─ TOTALS ONLY ─┘ └─┬─ DOUBLE ─┬ ─ SPACING ─┘
                               ├─ TRIPLE ─┤
                               └─ TREBLE ─┘

 ►─┬────────────────────────────┬─────────────────────────────────────────────►
   ├─ spacingvalue ─────────────┤
   ├─ @location ────────────────┤
   └─┬────────────────────────┬─┘
     └─ @fieldname ─┬─ + n ─┬─┘
                    └─ - n ─┘

 ►─┬───────────────────────────────────────────────────┬──────────────────────►◄
   │                                                   │
   └─┬─────┬─┬─────────┬─┬─ fieldname ───┬───┬─────┬───┘
     └─ ( ─┘ └─ tags: ─┘ ├─ #fieldname ──┤   └─ ) ─┘
                         └─ &fieldname. ─┘
TOTALS ONLY

Specifies print of a summary report. You can generate a report where detail lines are suppressed and only totals appear at each control break level. This parameter, when specified, must immediately follow the keyword PRINT on the first PRINT command of a group and can appear only once within a report group. The only fields that print on a total line are accumulated fields (fields enclosed in parentheses), control break fields, and fields prefixed with an ampersand (&).

DOUBLE|TRIPLE|TREBLE SPACING

Specifies the vertical line spacing for the report. Normal spacing between lines (or groups of lines with multiple PRINT commands) is single spacing. This parameter, if specified, must be on the first PRINT command of a particular group and must precede any field name specifications. It provides optional spacing only for the first print line of a group of lines if multiple PRINT commands are used.

spacingvalue

Is an unsigned numeric constant specifying the number of blanks to be inserted before the next field on the line (or at the end of the line if no further fields are specified).

@location

Is an unsigned numeric constant immediately preceded by the at-sign (@), with no intervening blanks, specifying the location to print the subsequent field name. Numeric fields align on the rightmost character (inclusive of any sign) and alphanumeric fields align on the leftmost character.

The size of a field is determined by the longest of the field width, its accumulator (if accumulated), or the edit pattern (or length of the heading if the field is specified on the first PRINT command).

If an accumulated value is to be printed, the first field must begin at least 13 bytes into the print line to allow for the legend "Grand Total".

@fieldname with + n or - n

Is to be aligned with the identified field specified in a previous print line. If you specified the field (@fieldname) more than once on a previous PRINT command, the system uses the first occurrence.

The optional parameter n specifies the number of positions to align to the left (- n) or to the right (+ n) of the field name specified. When the minus or plus sign is used, there must be a space both before and after the sign.

Numeric fields align on the rightmost character (inclusive of the sign) and alphanumeric fields align on the leftmost character.

( )

Parentheses surrounding the field and its associated parameters indicate that the field is to be accumulated and printed as part of the total line when a control break occurs.

tags:

Specifies that the subsequent field is to be printed only if certain selection criteria are met. Valid entries are A—Z. The SELECT command has the ability to assign specific tag characters prior to the record being selected for printing. The PRINT command has the ability to conditionally print specific fields based on those tag characters.

fieldname

Specifies the name from the Hit File record assigned a predefined scalar variable or array element to be printed. The size of the print window necessary to print the field is based on the largest of the following four variables:

#fieldname

Specifies the same basic processing as with the field name described above except instead of the value of the field, a running accumulation of the field is printed on each detail line.

If the #fieldname is enclosed in parentheses, the running total prints on each detail line only until a control break occurs, at which time the accumulator prints and the system resets the running total to zero before accumulation continues.

&fieldname

Specifies the same basic processing as with the field name described above except that the value to be printed is taken directly from the General Storage Area (GSA) rather than from the Hit File.

Note the following:

Example

  PRINT NameA 1 FldA 3 FldB

Note the following: