• Aucun résultat trouvé

205 PUT 11%, COUNT 76%

Dans le document RSTS/E Programming Manual (Page 45-49)

writes a 76 byte record. When COUNT is not used, PUT writes an entire buffer, regardless of whether the buffer con-tains data. A record must be at least 14 bytes (a hardware limitation) and no larger than the I/O buffer. If a record smaller than the buffer size is read, the RECOUNT system variable contains the number of bytes read. Every input operation on any channel (including channel 0) sets RECOUNT. Thus, the user program should test it immediately after each GET statement.

2.8 THE MAGTAPE FUNCTION IN NON-FILE STRUCTURED PROGRAMMING

The MAGTAPE function provides flexibility in non-me structured processing by permitting the program control over all magtape functions. The general form of the MAGTAPE function is as follows:

1%

=

MAGTAPE (F%,P%,U%) where:

F% is the function code (1 to 9)

2-12

P% is the integer parameter

U% is the internal channel number on which the selected magtape is open 1% is the value returned by the function

The effect of the MAGTAPE function is determined by the function code, F%. These functions are described in the sections that follow. In all examples in these sections, assume that magtape unit 1 has been opened on internal chan-nel 2. Unless otherwise stated, a MAGTAPE function works only in non-file structured operations. That is, prior to executing the MAGTAPE function, the following statement was executed.

100 OPEN "MT1:" AS FILE 2%

The following discussion of each of these functions includes the word IMMEDIATE or WAIT. IMMEDIATE indicates that the monitor initiates the action and returns control to the program immediately; WAIT indicates that the pro-gram must wait for the operation to be completed before continuing.

Table 2-5 summarizes the MAGTAPE function codes.

Table 2-5 MAGTAPE Function Summary Function

2.8.1 Off-Line (Rewind and Off-Line) Function

Function code

The Off-Line function causes the specified magtape to be rewound and set to OFF-LINE (thus clearing READY).

For example:

2.8.2 WRITE End-of-File Function

Function code Parameter Value returned

::2

= unused

=0

WAIT

The WRITE End-of-File function writes one EOF record at the current position of the magtape. For example:

200 1% = MAGTAPE(2%,0%,2%)

writes an EOF on the magtape that is open on internal channel 2.

2.8.3 Rewind Function

Function code Parameter Value returned

=3

= unused

=0

The Rewind function rewinds the selected magtape. For example:

200 1% =

MAGTAPE(3%,0%~2%)

IMMEDIATE

I

rewinds the magtape open on internal channel 2. (This function does not cause the magtape to be set to OFF-LINE.) 2.8.4 Skip Record Function

Function code Parameter Value returned

=4

= number of records to skip (1 to 32767)

= number of records not skipped

(0 unless EOF or physical EOT is encountered)

WAIT

The Skip Record function advances the magtape down the tape. The tape continues to advance until either the de-sired number of records is skipped (in which case the value returned by the function is 0) or an EOF re~ord is en-countere4- (in which case the value returned is the specified number of records to skip minus the number actually skipped).l For example, to skip from the current tape position to just past the next EOF, use the following func-tion:

This assumes there are fewer than 32767 records before the next EOF. In Section 2.8.7, a more complex example using the MAGTAPE function shows how to skip an entire lile regardless of the number of records.

IThe system COUllts the EOF record as a record skipped.

2-14

2.8.S Backspace Function

Function code Parameter Value returned

=5

= number of records to backspace (1 to 32767)

= number of records :not backspaced (0 unless EOF or beginning-of-tape is encountered)

WAIT

The Backspace function is similar to the Skip function, except that tape motion is in the opposite direction. The beginning-of-tape (BOT or Load Point) as well as EOF records can cause premature termination of the Backspace operation (in which case the value returned is the specified number of records to backspace minus the number actually backspaced).l The BOT is neither skipped nor counted as a skipped record. For example:

200 IX

~

MAGTAPE(S%,1%,2%)

backspaces one record on the magtape opened on internal channel 2, unless the tape was already at BOT.

2.8.6 Set Density and Parity Function

Function code Parameter Value returned

=6

= E+D*4+P+S

=0 where:

E = Phase Encoded

256 = 1600 BPI, phase encoded mode

o

= values of D and P (see below) D = Density

0= 200 BPI (7-track only) 1 = 556 BPI (7-track only) 2 = 800 BPI (7-track only) 3 = 800 BPI, dump mode P

=

Parity

S = Stay 0= odd 1 = even

o

IMMEDIATE (Insignificant)

A magtape drive is set to the system default for density and parity unless the default is changed when the unit is as-signed (with an ASSIGN statement) or when the unit is opened. This function changes the density and/or parity of a magtape drive according to the value given as the parameter. The function interprets the parameter exactly as MODE value (see Section 2.7). For example,

10 OPEN RMTO:

u

AS FILE 2%

changes the density and parity of the 7-track magtape drive open on channel 2 to 800 BPI, even parity, non-dump mode. The density and parity specified in the parameter is in effect until channel 2 is closed. The system sets 1%

to

a

to indicate successful completion. This function works for both non-file structured and file structured opera-tions.

By adding 8192% to the parameter value (making it 8192%+2%*4%+ 1 %, in the above example), the new density / parity setting is in effect even after the associated channel has been closed. A subsequent OPEN statement without a MODE option, associating any channel number with magtape unit 0, opens it with that new density/parity setting automatically. A DEASSIGN statement to a previously assigned unit reverts the density/parity setting for the mag-tape unit to the system default value. Specifying another parameter value also changes the density and parity setting.

The setting remains if ownership of the unit is passed to another job.

The sample routine shown below in immediate mode sets magtape unit 2 to 800 BPI, dump mode, odd parity, using DOS labels. Once channel 3 is closed, in this example, the new density/parity setting is now in effect and remains in effect until a DEASSIGN operation is executed on magtape unit 2.

Dans le document RSTS/E Programming Manual (Page 45-49)