American Standards Association (ASA) control characters were defined by ANSI. For PL/I, there are five distinct values for the first byte of each record transmitted by a PRINT file.
Character | Action |
---|---|
(space) | Space 1 line (blank character) before printing |
0 | Space 2 lines before printing |
â | Space 3 lines before printing |
+ | No space before printing |
1 | Start new page |
Open PL/I only generates ASA control characters for programs run under Enterprise Server, for which the DD is:
Open PL/I generates ASA control characters for STREAM files that have been designated as having a CTLASA attribute (internally). The CTLASA attribute is turned on by a variety of combinations:
Open PL/I only supports ASA control character generation for STREAM IO against files with the PRINT/CTLASA attribute. When PRINT is specified, the first data byte of each record of a PRINT file is reserved for an American National Standard (ANS) printer control character. Open PL/I then inserts the control characters. Data values transmitted by list-directed and data-directed data transmission align on the left margin and on implementation-defined preset tab positions.
You can control the layout of a PRINT file by using these options and format items:
Statement | Statement Option | Edit Directed Format Item | Effect |
---|---|---|---|
OPEN | LINESIZE(n) | - | Established line width |
OPEN | PAGESIZE(n) | - | Establishes page length |
PUT | PAGE | PAGE | Skip to new page |
PUT | LINE(n) | LINE(n) | Skip to the specified line |
PUT | SKIP(n) | SKIP(n) | Skip specified number of lines |
PUT | - | COLUMN(n) | Skip to specified character position |
PUT | - | X(n) | Places black characters in line to establish position |
LINESIZE and PAGESIZE establish print area dimensions, excluding footers.
The LINESIZE option specifies the maximum number of characters included in each printed line. If not specified, 120 characters is used for a PRINT file. There is no default for a non-PRINT file.
The PAGESIZE option specifies the maximum number of lines on each printed page. If not specified, 60 lines is used.
This shows an example of controlling the layout of a file.
open file(ASAFILE) output stream print PAGESIZE(55) LINESIZE(110); on endpage(ASAFILE) begin; put file(ASAFILE) skip list (Footer); put file(ASAFILE) page list (âPg: â|| Pageno(ASAFILE)); put file(ASAFILE) skip (3); end;
The OPEN statement opens the file Report as a PRINT file. The specification PAGESIZE(55) indicates that each page contains a maximum of 55 lines. An attempt to write on a page after 55 lines have already been written (or skipped) raises the ENDPAGE condition. The implicit action for the ENDPAGE condition is to skip to a new page, but you can establish your own action using the ON statement, as shown in the example.
Using the example, LINESIZE(110) indicates that each line on the page can contain a maximum of 110 characters. An attempt to write a line greater than 110 characters places the excess characters on the next line. An attempt to write to line 56 (or to skip beyond line 55), raises an ENDPAGE condition, and the begin-block shown executes. The ENDPAGE condition can be raised only once per page. This means printing can be continued beyond the specified PAGESIZE after the ENDPAGE condition has been raised. This can be useful for writing a footer at the bottom of each page.
The first PUT statement specifies that a line is skipped, and the value of Footer, presumably a character string, is printed on line 57 (when ENDPAGE is raised, the current line is always PAGESIZE+1). The file ASAFILE is set to the next page, and the character constant 'Page' is concatenated with the page number and printed. The final PUT statement skips three lines, so that the next printing is on line 4. Control returns from the begin-block to the PUT statement that raised the ENDPAGE condition. However, any SKIP or LINE option specified in that statement has no further effect.