• Aucun résultat trouvé

PRINT tl~ CHR$(128%t19%);

Dans le document RSTS/E Programming Manual (Page 58-62)

This statement causes the system to evaluate the difference between 147 and 128. If the difference is greater than the page length specified in the MODE value or more than 66 when no page length is specified, the system ignores it. Ifthe.difference is less than the page length in effect but greater than the current line number, the printer skips to that line number on the current page. If the difference is less than or equal to the number of the current line, the system skips the printer to the appropriate line on the next page.

NOTE

To enable the program to properly perform software for-matting of print lines using special characters, the user must load the paper in the line printer with the top of form at the arrows and with the tractors set at their top of form position.

The system treats characters whose values lie between 0 and 127 as the standard ASCII equivalents. If MODE 512%

is not specified in the OPEN statement, characters whose values lie in the range 128% to 255% are treated as

3.2.2 Hardware Form Feed - MODE 4096%

A LF character sent to the printer advances the form to the first print position of the next line (i.e., LF implies CR).

If a form length other than 66 is specified but MODE 4096% is not specified, a form feed CHR${l2) in the data passed by the program to the line printer translates to a sufficient number of line feed characters to move the page to the top of (software) form. If the form length is 66 or zero (the default value which results in 66) or MODE 4096%

is specified, CHR${l2) remains untranslated and positions the printer paper at the top of the hardware form.

NOTE

If both 4096% and 512% values are included in the MODE option, a form feed (FF) character sent to the line printer remains untranslated. The form feed causes the top of hardware form. This action results in unpredictable out-put because the line counting done by the MODE 512%

processing does not take into account the movement of the paper to the top of hardware form.

3.2.3 Translating Numeric 0 To Literal 0 - MODE 128%

A value of 128 in the MODE specification causes the system to print all 0 characters as

a

characters. This feature is valuable in commercial applications, where there can be no possibility for confusion. For example,

1 ()

OPF:N" LPO :

H

AS

F J:

LE 1

%,

MODE

512%+ 128%+66/.

The statement indicates software formatting (512%) and translation of 0 to

a

(l28%) is to be performed on line printer unit 0 with a form length of 66.

3.2.4 Truncating Long Lines - MODE 256%

To truncate lines greater than the width of the line printer, the user program includes 256% in the MODE value. For example,

10

OPEN "LPO:" AS FILE

1%,

MODE

512%+256/.+128%+66%

The statement implements the MODE value of 66%, 128%,256% and 512%, on line printer unit 0 and discards ex-cess characters from each line printed (MODE 256%). Without 256% in MODE, the system prints exex-cess characters on a second phYSical line.

3.2.5 Translating Lower Case to Upper Case - MODE 1024%

To translate lower case characters to upper case characters, the user program includes 1024 in MODE. For example,

10 OPEN "LPO:" AS FILE 1%, MODE

1024%+512/'+256%+128~+66%

This statement implements the MODE values 66%, 128%,256% and 512% and, in addition, causes the system to translate all characters with representations between CHR$(96) and CHR${l26) to their equivalents between CHR$( 64) and CHR$(94). This feature is always set for an upper case only printer.

3.2.6 Skipping Lines at Perforation - MODE 2048%

To skip six lines at the bottom of each form, the user program includes 2048 in MODE. For example, 10

OPEN "LPO:" AS FILE 1/., MODE

4034%

The statement implements the MODE values 66%, 128%,256%,512%, 1024%, and also skips six lines when the sys-tem advances the page to top of form. With this value in effect, the syssys-tem does not print on the last six lines of each form. This feature is useful when generating continuous listings to be placed in horizontal binders. If the user loads the line printer as such that the top of form is the fourth physical line on the page, the system leaves three blank lines at the beginning of the next page. When the listings are subsequently placed in binders, printed material is located three lines from the perforations of the page to facilitate easy access.

3-4

3.2.7 Suppressing Form Feed on CLOSE - MODE 8192%

For certain applications, it is necessary to maintain the current print position on the line printer during a CLOSE operation. Normally, the system automatically generates a form feed on either an implicit CLOSE (as in a CHAIN operation) or an explicit CLOSE. By specifying MODE 8192% in the OPEN statement, the program tells RSTS/E not to generate the form feed when the CLOSE operation is performed on the channel open for the line printer.

The following statement shows the procedure.

10 OPEN 'LPO:' AS FILE 1%, MODE 8192% + N%

The value N% can be any other combination of MODE values valid for line printer operation.

3.3 UNE PRINTER CONTROL VIA RECORD OPTION

The RECORD option in a PUT or PRINT statement modifies the operation of the line printer and enables discrete control of individual output steps. Table 3-3 lists the values allowed in the option.

Table 3-3 Line Printer RECORD Values

Value Meaning

2% Print over perforation (disables MODE 2048% for this output step) 4% Do not return control to the program until output is complete or until an

error is encountered

8% Clear pending output buffers before buffering characters for the request The general format of the RECORD option for line printer operation is shown below.

10 PUT tNX, RECORD R%, COUNT ex

or

10 PRINT tNX, RECORD R%, AS

The following sections describe the RECORD values.

3.3.1 Print Over Perforations - RECORD 2%

By specifying RECORD 2% in the PUT or PRINT statement, the program can temporarily override the effect of MODE 2048% on an output form. For example, an application program, which is usually skipping six lines at the bottom of forms, might need to print an identification or special page requiring all lines on the page. RECORD 2%

allows the program to print in the lines normally skipped.

3.3.2 Delay Return Until Output Complete - RECORD 4%

For line printer output, the system transfers data from program storage to the device by intermediate storage called small buffers. This intermediate buffering allows the faster computational process to continue unhindered by the slower output action at the line printer. For each output request, the system transfers the data to small buffers. At the same time, at its own speed, the line printer software extracts the data from the small buffers and performs the

The RECORD 4% option on an output request tells the sy.stem not to return control until the data is actually printed.

This mechanism allows a program greater control over error recovery. To use this mechanism, it is suggested that pro-grams print a NUL character with the RECORD 4% option. The following statement shows the procedure.

10 PRINT +1%, RECORD 4%, CHR$(O%);

The output operation has no effect on the line printer because the system software discards all NUL characters. The program maintains control of the output operation because the system does not complete the request until all previ-ously buffered characters are printed. If an error occurs, the program can take recovery action and resume at this op-eration. When control passes to the next statement, the output operation is complete.

3.3.3 Clear Buffers Before Returning Control - RECORD 8%

In certain circumstances, it is advantageous for a program to terminate printing of characters already buffered for output. Because characters to be printed on a line printer reside in intermediate buffers, mere interruption of the output routine only prevents additional characters from being buffered. Normally, characters already buffered for output by the system continue printing until the buffers are clear or until an error occurs.

With the RECORD 8% option on an output request, the program tells the system to terminate the print operation and clear all pending output buffers before buffering the characters of the request. The following statement shows the procedure.

10 PRINT +1%, RECORD 8%, CHR$(13%);

The system clears all pending output buffers and then sends the CR character to the printer. The CR character en-sures that any characters in the printer hardware buffers are flushed out (by forcing them to print). After the suc-cessful completion of this statement, the printer and its buffers are clear; and the vertical and horizontal positions have been reset respectively to top of forml and to the left margin.

3.4 OPERATION AND ERROR HANDLING

An error condition at the line printer causes the system to interrupt the transfer of data both from the buffers to the device and from the program to the buffers. Since any number of indeterminate events such as a ribbon jam or a paper tear can cause an error condition, the system retains the unprinted data in the buffers until either the error is cleared (the unit becomes ready again) or the user program executes a CLOSE operation.

The system checks the status of the line printer every ten seconds, and, upon detecting the ready condition again, continues output from the small buffers without loss of data. If the .user program closes the line printer while the error is still pending, the system returns the small buffers to me pool without printing their contents. The data trans-ferred from the program but not yet printed is lost.

If the user program disregards the error condition and continues processing, the system does not transfer more data to additional small buffers. No output occurs at the line printer while the error condition remains in effect.

To prevent loss of data, a user program must properly detect a line printer error condition and execute efficient error handling. The system indicates the line printer error by generating the DEVICE HUNG OR WRITE LOCKED error (ERR = 14). The first time this error is returned after an output request (e.g., PUT), the data is fully buffered by the monitor. No data is lost, but the buffered data cannot be sent to the printer due to the error condition.

Every 10 seconds the monitor checks the printer's status. It will resume printing when the error condition is recti-fied. To prevent f:Uling up monitor free space, subsequent output requests are returned immediately without any further data buffering and with ERR=14 while the error condition persists. When the output request returns with-out error, the printer error condition is cleared.

IThe drive's internal vertical form position counter is reset to top of form. Manual paper positioning may be needed to align the form itself to its top of form position.

3-6

The sample program shown below demonstrates code which performs the following actions:

1. opens the line printer, inputs a line from the disk file, and performs output to the line printer, and 2. performs efficient error handling as described above.

10 HOUSEKEEPING PRINT n?LINE PRINTER

ERROR?-ISLEEP 10%

IGOrO :1.40 DONE 410 CLOSE

32767 END

Dans le document RSTS/E Programming Manual (Page 58-62)