• Aucun résultat trouvé

RECORD I/O ROUTINES

Dans le document Program PL/I (Page 43-48)

The resident library contains one module concerned with RECORD I/O:

IEMDRIC. This module provides an interface between compiled code and the DOS PL/I Transient Library. The transient library is described in DOS PL/I Transient Library: Program Logic.

MODULE DESCRIPTIONS

IBMDRIC - Record I/O Interface Module Function

To act as an interface between the record I/O transmitter modules and the calling programs and to load record I/O error modules. ihe module has four entry points:

IBMBRIOA: Check the validity of the I/O statement and call the transmitter.

IBMBRIOB: Load a record I/O error module and branch to it.

IBMBRIOC: Raise ERROR for invalid statements.

IBMBRIOD: Interface between record I/O statements implemented by in-line cede and the record I/O error module.

Method

Entry Point IBMBRIOA: IBMBRIOA loads the parameters required by the record I/O transmitters into registers (see Linkage below) and then tests the validity of the information in the request control block (RCB>

by executing a test under mask instruction in the RCB. If the

information is valid, the routine branches to an address held in field FATM in the file control block (FCB). This field holds the address of the appropriate transmitter if the file is open, or the address of the implicit open routine IBMBOCLE if It is not. If the information in the RCB is invalid, the routine branches to the address held in field .FAIS in the FCB. This field holds the address of entry point IBMBRIOC if the file is open, or the address of the implicit open routine IBMBOCLB if it is not.

Entrx point IBMBRIOB : IBMBRIOB creates the name of the required error module by inserting the 7th letter, obtained from the FeB, into the skeleton name IBMDRE*A. The routine then scans the the transmitter chain, searching for the required module. If the module is found, its responsibility count is incremented by one~ otherwise, IBMBRIOB obtains storage, loads the error module, and adds it to the chain. Finally, IBMBRIOB loads the address of the error module into the FCB and branches to it.

Entry point IBMBRIOC: IBMBRIOC branches to the error handler IBMBERRB, passing the address of the file name and the ·unsupported op· error code.

Licensed Material

-property of IBM Chapter 4: Record I/O Routines 41

Entry Foint IBMBRIOD: This entry point is entered when compiled code is executing a record I/O statement in-line and a condition is to be

raised.

If the required record I/O error module is already loaded, i t is entered using the address in the FCB. Otherwise, the error module is loaded and entered as described for entry point IBMBRIOB above.

Linkage

Entry Peint IBMBRIOA:

Input:

Rl

=

A (PLIST)

PLIST

=

A(FCB)

A(RCB)

A(RD) or A(ignore factor) or A(target for buffer address in READ SET statements)

A(KD) or zero A(EV) or zero

A(abnormal locate return address for LOCATE statements)

Output to transmitter:

Rl

=

A (PLIST) (see above) R2

=

A(FCB)

R5

=

A(RCB)

R6 = A(RD) or A(ignore factor) or A(target for buffer address in READ SET statements)

R7

=

A(RD)

R8

=

A(EV)

Entry Foints IBMBRIOB,~and D:

R2 = A(FCB)

Calls

IBMDERR - Error handler.

IEMDOCL - Open/close bootstrap (implicit open).

IBMDR** - RECORD 1/0 transa.itter.

IBMDRE* - RECORD I/O error module.

Called By Compiled code

IBMDJWT - WAIT module.

IEMGJWT - WAIT module.

CHAPTER 5: STREAM I/O ROUTINES

Communication between compiled code and the library is via a STREAM I/O control block (SIOCB), which exists for the duration of a single GE~ or PUT statement and is situated in the compiled code DSA. A full

discussion of the organization of S~REAM I/O and a description of the SIOCB are given in DOS PL/I Optimizing Compiler: Execution Logic. ~he

use of the SIOCB in stream input/output is shown in Figure 5.1

The resident library modules used fer STREAM I/O may be divided into the fellowing categories:

1. Initialization modules.

2. Input/output director modules.

3. Conversion director modules.

4. Format and option modules.

5. Transmitter modules.

In the execution of a GET FILE or PUT FILE statement, the first call from ccm~iled code is to an initialization module. The initialization modules are:

IBMDSII - GET FILE initialization.

IBMDSIL - GET and PUT FILE initialization.

IBMDSIO - PUT FILE initialization.

The initialization module tests the validity of the I/O statement, opens the file if necessary by a call te Utodule IEMDOCL, and completes the SIOCB. If the statement contains the PAGE, LINE, or SKIP option, the initialization module calls the appropriate option module to handle it.

A fourth initialization module, IBMDSIS, is provided to handle GET and PUT STRING statements.

The movement of data items between external media and PL/I variables involves two separate processes: the moven-ent of records between the external medium and an internal buffer, and the movement of data items between the buffer and the PL/I variable. There is not necessarily a one-to-one correspondance between these moves, since a record may ccntain more than one data item, and a data item may span one or more record boundaries.

In general, the movement of data is controlled by input/output director modules. These modules are:

IBMDSDI - Data-directed input.

IBMDSDO - Data-directed output.

IBMDSEI - Edit-directed input.

IBMDSED - Edit-directed input/output.

IBMDSEO - Edit-directed output.

IBMDSLI - List-directed input.

Licensed Material -Property of IBM

Chapter 5: Stream I/O Routines 43

IBMDSLC - List-directed output.

IBMDSEE - Edit-directed combination module.

IBMDSEH - Edit-directed combination subset module.

IEMDSDJ - Data-directed input (restricted conversions).

IBMDSLJ - List-directed input (restricted conversions).

The edit-directed modules IBMDSEI and IEMtSEO are called only when a director modules which select the appropriate conversion modules in the conversion package (chapter 6). The conversion director modules are:

IBMBSAI - Input conversion director

(A, character-P, and B formats) IBMBSAO - Output conversion director

(A format)

IBMBSBO - Output Conversion director (character-P and B formats) IBMBSCI - Input conversion director

(C format)

IBMBSCO - output conversion director (C format)

IBMBSFI - Input convErsion director (F and E formats)

IBMBSFO - Output conversion director (F and E formats)

IBMB5PI - Input conversion director (arithmetic-P format) IBMBSPO - Output conversion director

(arithmetic-p format)

Licensed Material -Property of IBM

Chapter 5: Stream I/O Routines 45

module I SIOCB Fields co«~ents address of sutscripts string locator

Fields STRG and STDD are used only data-directed output (including I

1 CHECK) of program control data. I

Dans le document Program PL/I (Page 43-48)

Documents relatifs