• Aucun résultat trouvé

EVENT Option

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

When the EVENT option is used, transmission statements are always handled by library call. The compiler generates a call to IBMBRIO in the usual manner, except that the address of an event variable is passed 1n the parameter l~st.

The associated WAIT statement is compiled as a call to one of the library wait modules. The module called depends on whether or not the program is multitasking.

The execution of an I/O statement with the EVENT option and its associated WAIT

statement is shown in figure 8.9.

P:P ROC;

H

READ .... EVENT (E);

:...

.,

~ ....

r - --<]

¢ IBMBRIO

V"

i

'r

I I

PL/I TRANSMITTER I

L - f > - +

ISSUE DATA MANAGEMENT-MACRO

RETURN IF EVENT I/O

ISSUE CHECK MACRO· ---<] - -

f-I

1

I I

I

TEST FOR ERRORS

IF NONE RETUR'N TO WAIT MODULE I I

I 1

--'--,

--1 I I V I I I

1

1

I I I

6.

I I 6. I

I I I 1 I

I

I l:1

I

I

I I

"y I

L _ _ _ _ _ _ _ _ _ -, I WAIT (E);

: . 4- - - - - - - - t > - - - ,

- I ~---..II..---, 1 I

'----. I

I

I I

WAIT MODULE : 1

I IF EVENT I/O

C~:L.-!~M!~I.:> -=--=-= ~-=-}[>

---RETURN IF NO MORE EVENTS TO WAIT ON

I I

L _ _ _ _ _ _ _ _ -' I

END P; Key

.. READ EVENT statement

- - - I> - - - WAIT statement . . . . . . . . . . . . Further PL/I statements

Figure 8.9. Handling the EVENT option

Chapter 8: Record-oriented Input/Output 139

The principle used in event I/O is that the PL/I transmitter returns to compiled code as soon as the data management macro instruction has initiated the I/O.

When I/O with the EVENT option is being executed, the event variable associated with the event is set active and flagged to indicate that the event is an I/O event.

When the WAIT statement is reached, the library wait module is entered. when the event is an I/O event~ the PL/I library wait routine passes control to IBMBRIO.

From information in the event variable, IBMBRIO locates the I/O operation

associated with the event, and calls the transmitter. The transmitter then issues a CHECK macro instruction, and waits until the operation is complete. When control returns after the CHECK macro instruction, the transmitter assigns the transmitted data, and either returns to the wait module, or, if any errors are detected, enters one of the error routines. (For further details, see "ERROR CONDITIONS IN TRANSMISSION STATEMENTS" later in this chapter.)

When the transmitter assigns the data, i t is necessary for the address and length of the record variable, and certain other

information~ to be available. This

information is retained in the input/output control block (IOCB).

The IOCB is chained to the event variable so that the I/O routines can access the statement when control is returned to them during execution of the WAIT statement.

To associate the PL/I statement with the data management operation~ the DECB for the operation is included in the IOCB. (The DECB is a record held by the data

management routines so that the operation can be posted complete.)

For certain types of PL/I files, the IOCB also contains the data management buffer to or from which the transmission will be made.

For direct access files, IOCBs are allocat,ed as they are required by the transmitter.

For sequential access files, the IOCEs are generated by the open routines. The number of IOCBs requested corresponds to the number specified in the NCP

subparameter or option.

In event I/O, the 'existence of a dummy record may not be discovered until after a read has commenced on the record following the dummy. When this happens, the DECE and IOCB pointers are reset appropriately.

Because the CHECK macro instruction is not issued until the WAIT statement is

executed, PL/I conditions raised in event I/O are handled during execution of the WAIT statement. The implications of this are discussed in the section on the WAIT statement in chapter 11 for

non-multitasking programs, and chapter 14 for multitasking programs.

In exclusive I/O, records are protected from simultaneous updates from different tasks by use of the ENQ and DEQ macro instructions.

When a READ statement for an exclusive file is being executed, an ENQ rracro instruction is issued. Unless NOLOCK is specified, the DEQ macro instruction is net issued until a REWRITE, DELETE, or UNLOCK statement is executed. For unblocked records, the ENQ and DEQ instructions are issued on one record only. For blocked records, they are issued on the data set.

Eight PL/I transmitter modules are used to handle exclusive files: they are shown in figure 8.2. The ENQ and DEQ macro instructions are issued by calling the resident library routine IBMBPDQ, which is addressed from the TCA.

The protection of the data set depends on all files that access the data set having the EXCLUSIVE attribute. If the data set is accessed by a file that does not have the EXCLUSIVE attribute, the data set will not be protected.

IFor VSAM files the EXCLUSIVE attribute is ignored and the NOLOCK option and UNLOCK

G)

OCLCB identifies file to be closed

1

CLOSE FILE (F2)

® ~

Executable instructions consist of a call to the open/close bootstrap module passing parameter list

®

CD

®

OCLCB set up for file declaration see figure 8.5

Executable instructions

* STATEMENT NUMBER 5 OOOOAC 41 10 3 094 OOOOBO 58 FO 3 010 0000B4 05 EF

LA 1,148(0,3) Place address OCLCB in p-list

Parameter list 000094 00000044 000098 00000000 00009C 80000000

CLOSE FILE (F1);

L 15,A. .1 BMBOCLC } Call open/close toolstrap BALR 14,15

A. .CONSTANT A .. OCLCB

A. .NULL ARGUMENT

Address of constant showing number of files to be closed Address OCLCB

Used for disposition options, flagged in first bit to indicate last argument

COMPILATION

L 7,FO

ST 7,2528(0,3) LA 1,2524(0,3) L 15,A. .IBMBOCLC BALR 14,15

EXECUTION

Pass address of constant with number of files to be closed Pass address of OCLCB of file

Point R1 at parameter list Branch to open/close bootstrap

Call from compiled code Return to compiled code IBMBOCL

Entry point C

Resident library open/close bootstrap routine. Calls the close routine

IBMBOCA

Transient library close routine. Calls transmitter to complete I/O if necessary.

Calls data management to close the data set. Removes FCB from Open File Chain. Restores PRV offset to p'oint to dummy FCB.

DATA MANAGEMENT Disassociates file from data set.

PUI TRANSMITTER Transient library routine. Calls data management to complete I/O Figure 8.10. The execution of an explicit CLOSE statement

Chapter 8: Record-oriented Input/Output 141

OCLCB

... ..

PRV

a ••

a--____ f_f_se_t_w_i_th_i_n_P_R_V _ _ _ -i •••• •

Initialized to dummy FCB Changed to real FCB when file is opened

"

,

I

+OUMMY FCB

Address of open/close bootstrap routine

Address of open/close bootstrap routine

KEY

- - - - . Address contained in PRV when file open

. - - ~ Address contained in PRV when file closed

••••••••• Connection between OCLCB and PRV field.

The OCLCB contains the offset filled in by the linkage editor. The PRV itself is addressed from the TCA.

FCB

Figure 8.11. The addressing mechanism used during implicit open

Address of error handling module

Address of data management routine

Istatement will have no effect (except that Ifor UNLOCK, the key specification is

I checked.) Data set protection is provided by VSAM itself.

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