• Aucun résultat trouvé

Transmission Statements (Library-Call I/O)

Dans le document OS PL/I (Page 149-152)

For transmission statements the compiler generates a call to the PL/I transmitter interface module, IBMBRIO. IBMBRIO has the following parameter list passed to i t :

Address of DCLCB

Address of request control block (RCB) Address of record descriptor (RD); 2f,

address ignore factor; Qf, address at which to set pointer Address of key descriptor (KD); or,

zero if no key descriptor

Address of event variable (EV); Qf"

zero if no event variable

Abnormal locate return address (LOCATE statements only)

The DCLCB is generated from the file

declaration~ as described earlier in the chapter. The remainder of the control blocks in the parameter list are generated for the transmission statement.

The ~~~~~2ntrQ~bloc~-1BCBl defines the staterr.ent type. It consists of two words. The first is a fullword of flags that define the statement type and option, indicating whether the statement is READ SET" READ INTO, WRITE FROM" etc. The second word is a test-under-mask (TM) instruction that is executed by IBMBRIO to check

whether the statement is valid. The flags in the RCB are tested against flags in the FCB or dummy FCB. If the statement is invalid" a branch is made to an address held in either the FCB or the dummy FCB.

If the file is not open, the dummy FCB will be accessedl and the branch will be made to the open/close bootstrap to open the file.

If the file is open, a real FCB will be accessed, and the branch will be via a bootstrap to the error handler. The RCB is set up in static internal storage. The format is shown in appendix B.

The f§£Qf~9~§£fiptQr (RQl contains the address, length and type of the record variable. (The record variable is the variable to or from which the record will be transmitted.) A record descriptor is generated only if a record variable is used. The format is shown in appendix B.

The ~~_9~§£fiRtQf-1!Ql contains the address and length of the key variable.

(The key variable is the variable to or from which the key will be transmitted.) It is generated only if a key variable is used. The format is shown in appendix B.

If the record variable or the key variable is STATIC INTERNAL, a complete RD or KD is set up and placed in static internal storage during compilation. In most other circumstances~ a skeleton RD or KD will be set up" and will be completed by the inclusion of the address during

execution. The completed descriptor may be moved into temporary storage. In certain conditions, no skeleton is produced;

instead, the complete descriptor is built in temporary storage by compiled code.

The event variable (EV) (if used) contains information-ibout the event that has been associated with the event I/O statement. (For format, see appendix B.) The implementation of event I/O is covered briefly at the end of this chapter, and further in chapter 11 for non-multitasking programs and chapter 14 for multitasking programs.

The abnormal locate return block is used only for-rOCATE-statementS7-It-Is the

address of a block containing ~he address to which control will be passed if an error is detected in a LOCATE statement and a normal return is made after execution of the on-unit. The abnormal-locate return address is usually the start of the next statement.

The code and control blocks generated for a transmission statement using a library call to the data management routines are shown in figure 8.8.

Chapter 8: Record-oriented Input/Output 135

COMPILATION ~ Record descriptor holds address and length

f'1) DCLCB of record variable ! ey descriptor

~identifies

file

4

holds address and length of key variable

®

®

REQUEST CONTROL BLOCK

WRITE h:~::~~ ~ KEYFROMJKI;

"~".""~"-"~~:;®

are a call to the PLII library module IBMBRIO completing and passing PARAMETER LIST

®

which holds addresses of 1, 2,3 and 4.

DCLCB, set up from file declaration holds address of FCB via pseudo register vector.

(See file declaration).

REQUEST CONTROL BLOCK holds record of statement type 000028 0880200091022001 CONSTANT

RECORD DESCRIPTOR holds address and length of record, set up as far as possible during compilation, completed during execution. For statement above set up in temporary storage during prologue code

KEY DESCRIPTOR holds address and length of key, set up as far as possible during compilation, but, for this statement, completely built by compiled code in temporary storage (see 5).

Executable instruction

* STATEMENT NUMBER 4

000092 41 90 D OB8 LA 9,184(0,13) Pick up address record descriptor 000096 50 90 3 084 ST 9,132(0,3) Place in parameter list

00009A 41 90 D OBO LA 9,176(0,13) Pick up address-key descriptor 00009E 50 90 3 088 ST 9,136(0,3) Place in parameter list 0000A2 41 10 3 07C LA 1,124(0,3) Point R 1 at parameter list 0000A6 58 FO 3 014 L 15,A .. IBMBRIOA

OOOOAA 05 EF BALR 14,15 Call1BMBRIO

Note: For this statement the record and key descriptors were stH up in temporary storage during prologue code.

®

PARAMETER LIST passed to IBMBRIO 00007C 00000000

000080 00000028 000084 00000000 000088 00000000 00008C 00000000 000090 80000000

A .. DCLCB A .. CONSTANT A .. RD

A. .KD

A .. NULL ARGUMENT A .. NULL ARGUMENT

Filled in by linkage editor Request control block (Record descriptor)

(Key descriptor (built during execution))

Figure 8.8. (Part 1 of 2). Handling a transmission statement

EXECUTION OF TRANSMISSION STATEMENT

Call from compiled code

IBMBRIO

(Resident library interface module) Loads parameters into registers.

Calls

pur

transient library transmitter whose address is placed in the FCB during the execution of the OPE N statement.

PUI TRANSMITTER (Transient library) Calls data management.

Checks for errors and moves record and key if necessary

DATA MANAGEMENT Handle the transfer of data

Return to compiled code

Figure 8.8. (part 2 of 2). Handling a transmission statement

Chapter 8: Record-oriented Input/Output 137

Compiled code calls the transmitter interface module, IBMBRIO, passing to i t the parameter list shown above under

"Compiler output".

The interface module, IBMBRIO, first acquires a DSA, which is used by IBMBRIO and by the transmitter. It then

initializes the registers for the transmitter, and executes the TM

instruction in the request control block

(~CB). This instruction tests a set of flags that are addressed by a pseudo-register offset contained in the DCLCB.

The contents of the pseudo-register offset depends on whether the file is open. If the file is not open, i t is opened and return made to this point to continue the statement. (See "IMPLICIT OPEN" later in this chapter.)

When the file is open, the TM

instruction tests the validity flags in the FCB. This establishes the validity of the statement. If the statement is not valid, a branch is made to the address held in the word in the FCB following the statement validity flags. This address is an entry point in IBMBRIO that calls the error handling module, IBMBERR, with an error code indicating an invalid statement.

If the statement is valid, a branch is made to the transmitter whose address is held in the FCB.

After the file is open and the statement validated, control is passed to the transmitter. which checks the record and key variables for errors, and issues the appropriate data management macro

instruction. After the data management macro instruction has been executed, control returns to the transmitter. The transmitter moves the data between the data management buffer and the record variable, or sets the pointer to the record, and checks to see whether any errors have

occurred.

Transmitter modules do not acquire separate DSAs, but use the DSA acquired by IBMBRIO.

If the statement is 'valid, control is returned to compiled code. The situation when an error has been detected is

described later in this chapter under the heading "ERROR CONDITIONS IN TRANSMISSION STATEMENTS."

In certain conditions, data managerrent will require a parameter list known as the data event control block (DECB). The PL/I library routines include this block in a PL/I control block known as the

input/output control block (IOCB). A number of IOCBs may be used. The number depends on the file type, and on the NCP subparameter in the DO statement or NCP option in the ENVIRONMENT attribute.

Depending on the file type, IaCBs may be generated during the execution of th~ open statement, or by the transmitters when they are required.

The format of the IOCB is shown in appendix A. The format of the DECB and a further description of its use is given in the publication 05/360 Supervisor and Data

M~n~g~m~nt_~~Q In2tr~ction2. IOCEs are further described tn the section "EVENT OPTION", below.

Dans le document OS PL/I (Page 149-152)