• Aucun résultat trouvé

OPEN Statement

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

For an OPEN statement, the compiler generates a call to the open/close bootstrap routine" IBMBOCL, and an open control block (OCB). The OCB holds any attributes that are declared in the OPEN statement.

More than one file may be passed to the open routines. The last file has its last parameter flagged with its first bit set to

'1' .

For an explicit open, a call is made to the open/close bootstrap routine, IBMBOCL. For each file to be opened, the following

information is passed to IBMBOCL:

The address of the DCLCB

The address of the aCB, (or zero, if no OCB exists)

The address of the TITLE, (or zero if none is specified)

IBMBOCL has four entry points:

IBMBOCLA explicit open

IBMBOCLB implicit open for library call I/O

IBMBOCLC explicit close IBMBCCLD implicit close

When called by entry point A, IaMBOCL invokes -the transient library open routines to open the file. If the environment option TOTAL has not been used in the file

declaration, i t will be necessary to determine the attributes of the file by merging the attributes in the file declaration with those used in the OPEN statement. Attributes in the file

declaration are held in the ENVB and DCLCB.

Attributes used in the OPEN statement are held in the OCB. If the TOTAL option has been used, attributes are taken from the declaration. and any contradictory

attributes in the OPEN statement result in the raising of the ERROR condition.

The open modules build an FCB and DCB from the information in the control blocks, initialize the pseudo-register vector to point to the FCB, load the PL/I and data management transmitters, and return to compiled code. Five transient open modules are used. Their functions are summarized below and are described in detail in the licensed publication OS/360 f~Ll I~ansi~~

The transient open routines perform the following major functions when opening a file:

1. Build the file control block (FCB) and data control block (DCB), or, for VSAM the access method control block (ACB) for the file. The FCB is a PL/I control block used to access all file information. lhe DCB is a data

management control block used to describe the data set. The ACB is the equivalent of the DCB for VSAM files.

2. Issue the data management OPEN macro instruction to associate the file with the data set.

3. Obtain and initialize buffers and any other blocks required for the file.

4. Determine which statement types are valid for the file, and store this information as a set of flags held in the FCB.

5. select the appropriate PL/I transmitter, and load i t for use during transmission statements~

6. Check for errors, and raise the UNDEFINEDFILE condition if any are found.

7. Place the address of the FCB in the correct pseudo-register vector o~fset.

The execution of an OPEN statement is summarized in figure 8.6.

VSAM data sets both KSDS and ESDS are normally accessed by PL/I using VSAM Racro instructions, however, in certain

circumstances the data sets are accessed through the compatibility interface~ If the file is declared with ENV (VSAM) the VSAM macro instructions will automatically be used. Even i f i t is not so declared, the PL/I open modules will normally detect that a VSAM data set is being accessed. To do this they issue an RDJFCB macro

instruction. However this action is not effective if the ALLOCATE command is being used under TSO to provide DD information,

DCl FI FilE UNBUFFERED RECORD INPUT ENVIRONMENT (RECSIZE (80) );

+

DCLCB

0000000002010200 0106190000000018 00000014000206F1

0000000000000000 ENVB

0000000200000040 0000004400000040 00000040'00000040 0000004000000040

Figure 8.5. Information in the file declaration is held in the ENVB and the DCLCB until the file is opened

Chapter 8: Record-oriented Input/Output 131

CD

DCLCB identifies file

--- ® ®

Title held in static

/

Open control block

(OCB) holds options in OPEN

OPEN FILE (F2) OUTPUT TITLE ('OUTFILE');

---=--Executable instructions call to Open close bootstrap module passing parameter list

®

containing addresses etc

for

@

®and@

G)

DCLCB set up during file declaration see figure 8.5

® Open control block in static. See Appendix A for Format:

000048 0020000000D00800 CONSTANT 00000000

® Tit~e

(held in static internal) is addressed via locator (also in static internal) Title

OOOOAO D6E4E3C6C9D3C5 Locator

000020 000000A000070000

@)

Machine Instructions

000088 41 10 3 064 LA 1,100(0,3) Point R 1 at P-lists

00008C 58 FO 3 OOC L 15,A .. IBMBOCLA} Branch to open/close bootstrap 000090 05 EF BALR 14,15

®

Parameter list 000064 00000044 000068 00000000 00006C 00000048 000070 00000020 000074 00000000 000078 80000000

From To

compiled compiled code

,

code

t

IBMBOCL Loads transient open modules.

Calls I BMBOPA

A .. CONSTANT A .. DCLCB A .. CONSTANT A .. CONSTANT A .. NULL ARGUMENT A .. NULL ARGUMENT

No. of files to be opened A ... OCB

A ... LOCATOR for TITLE } Used for print files only

EXECUTION

~

IBMBOPA IBMBOPB

...

---Open Phase I Open Phase II

t ~ 1 1

IBMBOPE IBMBOPZ

Open Phase II Formatting VSAM files (direct output

only)

IBMBOPC Open Phase III

J

IBMBOPD

---

Open Phase I V

~~ \~---~v~---~/

RESIDENT LIBRARY TRANSIENT LIBRARY

Figure 8.6. Open statement

because, in this case, the RDJFCB macro instruction cannot determine that a VSAM data set is being accessed. In this

situation the compatibility interface will be used. It is possible for the user to statement with file declaration and check for validity. RECSIZE" KEYLENGTH, and KEYLOC options against any values specified in the ENVIRONMENT option. Check that NCP/STRNO is merges the other options according to statement type. The OPTCD

Load the approptriate library transmitter as follows:

ESDS IBMBRVAA

KSDS SEQUENTIAL OUTPUT IBMBRVGA

KSDS SEQUENTIAL INFUT/UPDATE IBMBRVHA addressed directly by compiled code.

Instead, compiled code obtains from the allows separately compiled programs to refer to the same FCB for an external file, even though the address of the FCB cannet be known until execution. An explanation of the use of the pseudo-register vector is given in chapter 2, under the heading "Use of the pseudo-Register Vector."

Chapter 8: Record-oriented Input/Output 133

R12

-

TCA

Address of PRV

DClCB for file C

--

...

PRV offset = 8

PL/I statement: DCl (A,B,C) FilE;

The address of the FCB for the file is obtained by adding the offset in the DClCB to the PRV address which is held in the TCA

Figure 8.7. Addressing files via DeLeB and PRV

~

I

~ PRV

U

Address of FCB for file A Address of FCB for file B Address of FCB for file C

)

FCB for file C

Transmission Statements (Library-Call

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