• Aucun résultat trouvé

RECORD-ORIENTED TRANSMISSION

UN BUr ERE 0

SECTION 10: RECORD-ORIENTED TRANSMISSION

4. CONSECUTIVE files can have the BUF-FERED or UNBUFBUF-FERED attribute.

5. CONSECUTIVE BUFFERED files can be used for data sets having either virtual sequential (VS) or physical sequential

(PS) organization. The organization must be specified in the DSORG sequential (VI) organization.

8. INDEXED files that are given the

SEQUENTIAL attribute are automatically given the BUFFERED attribute: hence.

both move- and locate-mode I/O state-ments can be used.

9. INDEXED files that are given the DIRECT attribute are automatically given the UNBUFFERED attribute; hence.

they can use only the move mode of Sharing System: Data Management Facili-ties. GC28-2056.) The following pages dis-cuss the use of CONSECUTIVE files to

access:

• Virtual Sequential Data Sets

• Physical sequential Data Sets VIRTUAL SEQUENTIAL DATA SETS

Virtual sequential data sets are the simplest and most efficient way of storing Part II: Using All the Facilities of the PL/I Compiler 73

Table 14. Characteristics of CONSECUTIVE Files

r---T---T---~---T---T---T---~---,

I I I I I I I Access I Record I

(Organization I Access IBuffering I Mode I Statement I Options I Method I Formats I

~---+---+---+---t---+---+---t---~

I I I I I I

INTO

i I I

I I I I

INPUT

I

READ

I

IGNORE

I I I

( I I I I I

SET

I I I

I I I

t---t---t---~

I I

! I I I !

WRITE

I

FROM

I I I

I I I I

OUTPUT t---t---~ VSAM IF, V or

I

j

I I

BUFFERED

I I

LOCATE

I

SET

I

or

I

D, U

I

I I I

t---t---+---~ QSAM

I

F, V, U

I

I I I I I I

INTO

I I

FB, VB

I

I I I I I

READ

I

IGNORE

I I

or DB

I

! I I I I I

S E T !

I I

I I I I

UPDATE t---+---~

I I

I

ENVIRONMENT

I

SEQUENTIAL

I I I

REWRITE

I

FROM

I I I

I (CONSECUTIVE) I t---+---t---·---t---f---t---i

I I

!

I I

IINTO

I I I

I I I I

INPUT

I

READ

I

IGNORE

t I I

I I I I I I

EVENT

I I I

I I I

t---+---t---·~

I I

I I I I

OUTPUT

I

WRITE

I

FROM

I I I

I I I I I I

EVENT

I

BSAM

I I

I I I

UNBUFFEREDt---t---t---i IF, V or

I

I I I I i I

INTO

I

only

I

D, U

I

I I I I I READ I IGNORE I I I

I I I I I I

EVENT

I I I

. , I I

UPDATE ~---t---i

I I

, I I I

REWRITE

I

FROM

I I I

I I I I ! I

EVENT

I I I

t---~---~---~---~---~---~---~---~

INote: The D and DB record formats are for tapes in ASCII format (see Appendix D). I

L _________________________________________ .. ___________________________________________ J

data in TSS/360. Records are automatically blocked into page-size physical records and there is no need for the user to provide blocking information. They are stored on public volumes and cataloged automatically at creation time. When you have them read or updated, you supply the data set name

(DSNAME) and data definition name (DDNAME).

Example 12 in ·Part III: Examples·

0hows the creation of a VS data set.

creating a Virtual Sequential Data Set To create a VS data set using record-oriented transmission, certain essential information must be supplied to the sys-tem's data management routines. This information is taken from the following sources:

• The PL/I program (the ENVIRONMENT option of the file declaration).

• The DDEF command.

• By default, if not specified in the program or in the DDEF command.

Default values may not always be adequate for correct execution of the PL/I program.

74 Section 10: Record-Oriented Transmission

Table 15 details the parameters which are always required for a new VS data set a.nd lists alternative ways they may be

supplied.

Table 15. Specification of VS Data Set Characteristics

r---T---T---T---,

IRequired IDDEF !PL/I IDefault I

I

Parameter

I

Command IProgram IValue

I

~---+---·---+---t---~

IDDNAME Ifile-name tfile-name

I I

I Ititle-nameltitle-name Inone I

I I I I I

i

DSORG=

I

VS

I I

none

I

! i

I I ,

I DSNAME= IDATA SET I I I

I I

NAME

I I

none

I

I I I I I

I

DISP=

I

NEW

I I

See Note

I

I I I I I

I DCB= I I I I

i RECFM==\F, V. or UIENVIRONMENTIV I

i

LRECL= j length I option 1132 I

t---~---~---~---i

I~: DISP= defaults to OLD if DSNAME I I is in catalog. to NEW if DSNAME is not I

I in catalog. I

I. ________________ •• _________________________ J

Accessing a Virtual Sequential Data Set

The remaining information that is required by the data management routines is obtained

PHYSICAL SEQUENTIAL DATA SETS

Physical sequential data sets can reside on tape or disk devices and are always private and non-sharable. They can be accessed using either the Queued Sequential Access Method (QSAM) or the Basic Sequen-tial Access Method (BSAM), depending upon 'Whether the associated files are given tbe BUFFERED or UNBUFFERED attribute. When QSAM is used, the records are blocked and deblocked automatically cy the data manage-ment routines; hence, the PL/I program is follo'Wing paragraphs discuss the creation and accessing of PS data sets using QSAM.

Most of the information given also applies when using BSAM; for a discussion of the

special considerations concerning BSAH. see

·Physical Sequential Data Sets (BSAM Access) •• in this twction. For fUrther discussion of QSAM and BSAM, see IBM

Systern/360 ·rim~. Sharing System: Data Mana-gement Faciliti~~. GC28-2056.

cxeation of PhY3ical Sequential Data Sets Tbe information required for the crea-tion of a PS data set is more extensive than for a VS data set. The user must supply information concerning

II Device Type essential information required for the creation of a liE''W PS data set using QSAM.

For a complete discussion of the DDEF com-mand, see Appendix D.

Accessin~:L.Q--,Physical Sequential Data Set (QSAM)

The data management information required for accessing a PS data set is considerably simplified if the data set is cataloged after creation. Cataloging a data set pre-serves information concerning:

• Device Type

Table 16. Specification of PS (QSAM) Data Set Characteristics

r---T----~~---T---T---·---,

I ! DOEI' I PL/I I Default. I

ICharacteristicl Command I Program Ivalue I

r---·---+---t---t---~

Further information is then required only in the case of unlabeled tapes. Data sets on direct access devices or labeled tapes have format information contained in con-trol blocks (DSCBs or header labels) kept reopened for input, the BACKWARDS att,ribute must be specified. This method of tape

76 Section 10: Record-Oriented Transmission

~: For tape data sets. only the last fil.e on the 'tape can be extended in this manner. Otherwise any following file becomes unreadable.

UPDATE: Only data sets on direct access devices can be opened for update. The records must be read and rewritten without changing their length.

Track Overflow

RECF'M=UT format-U with track overflow RECFM=FBT format-FB with track overflow

lfthe blocksize is smaller than the track size. the use of track overflow is optional.

Accessing a Physis:al~uential Data Set

(BSA.~) other processing. See ·Synchronous I/O USing BSAM," iII this section. Except for Lan-guage Reference Manual.) The maximum num-ter of I/O events that can be outstanding for a filE: at any instant must be supplied as an additional data management parameter.

This value is called NCP (number of channel

parame-ter. This specifies the number of buffers allocated to the file. like NCP, this value must not be less than the maximum number of outstanding I/O events that can occur. BUFNO can be specified in the ENVIRONMENT attribute, in the form BUFFERS

(n), or in the DDEF command, in the form BUFNQ=n.

INDEXED FILES

Table 17 shows the types of INDEXED files that you can specify and the I/O statements that can you can use with them.

A RECORD file declared to have INDEXED organization can only be used to access VI

(virtual indexed sequential) data sets.

Each record in the data_ set is identified by a key that is recorded with i t . A key is a string of not more than 255 charac-ters; all the keys in a data set must have the same length and the same relative posi-tion in the record. The records are

arranged according to the collating sequence of their keys, which facilitate Table 17. Characteristics of Indexed Files

the direct (nonsequential) retrieval, addi-tion. and delet~on of the records.

INDEXED files can be accessed by the PL/I program in two alternative modes, SEQUENTIAL or CIRECT. SEQUENTIAL proces-sing of INDEXED fi.les is similar to the

~rocessing for CONSECUTIVE files. Records can be read in ascending key sequence from the first record onwards without specifying any key information; or the data set can be Fositioned to a Farticular record (using tbe KEY option) and then further records read in sequence. To update an INCEXEC file sequentially, eacb record must first be read and then rewritten. There is no restriction for format-V records that the new record must be the same size as the old record. For DIRECT processing of an IN-DEXED file, there are no restrictions on the use of I/O statements; records can be added using the WRITE statement or replaced using the REWRITE statement~ without pre-vious issuance of a READ statement. To simplify programming for INDEXED files, the PL/I library routines treat indexed files

r---T---T---~---T---T---T---T---,

I I I I i I I

Access

I

Record

I

IOrganization\ Access

I

Buffering

I

Mode

I

Statement

I

Options

I

Method

I

Format

I

t---+---+---+---+---+---+---+~---~

I I I I I I

INTO

I

SET

I I I

I I I I

INPUT

!

READ

I

IGNORE

I I I

I

I I I I I

KEY

I

KETIO I I I

I I I

~---+---+---~

I I

! I I I I

!

FROM I I

I I I I I

WRITE

I

KEYFROM

I I

I I I I OUTPUT t---+---~ I

I I I I I I SET I I

I I I I I

LOCATE

I

KEYFROM

I I

I I SEQUENTIAL I BUFFERED ~---+---+---~ I

I I I I t I INTO I SET I I

I I I I I

READ

I

IGNORE

I I

I I I I I , KEY I REYTO I I

I I I I UPDATE t---+---~ I

I I I I I REWRITE I FROM I I

I I I I ~---+---~ I

I ENV IRONMENT I I I I DELETE I I VISAM F. V I

I

(INDEXED) t---+---+---+---+---.~ only

I

I I I I I I INTO I I

I I I I

INPUT

I

READ

I

KEY

I I

I I I ~---+---t·--·---·---~ I

! I I I I I FROM I I

!

I I

10UTPUT

I

WRITE

I

KEYFROM

I !

! I I t---+---+---~ I

! I I I I I INTO I I

I I I I I READ I KEY I I

I I DIRECT I UNBUFFERED I t---+---~ I

I I I I I I FROM I I

I I I I I WRITE I KEYFROM I I

I I I IUPDATE

t---t---·i

I

I I I I I I FROM I I

I I I I I REWRITEI:KEY I I

I I I I t---+---~ I

I I I I I DELETE I KEY I I I

l ____________ J. ___________ J. ____________ J. _______ J. ___________ .L __________ L - ________ J. ________ J

Part II: Usin9 All the Facilities of the PL/I compiler 17

having initial keys (see Appendix D. record format diagrams) as different from files having embedded keys.

Initial and Embedded Keys

When the keys are positioned at the beginning of the record (i.e., RKP=O for format-F records or RKP==4 for format-V records), they are initial keys. In all other cases, they are embedded keys.

INITIAL KEYS: On output the PLiI library routines automatically concatenate the key variable (KEYFORM option) and the data variable (FROM option) before the record is

~ritten out to the data set. Thus. you can consider the key and data as completely independent variables. Conversely, on input, t.he data section of the record is assigned to the data variable (INTO or SET option) and the key is assigned to the key variable (KEYTO option).

EMBEDDED KEYS: For this form of proces-sing, you are responsible for inserting the key at the appropriate position in the rec-ord before issuing a ~rite statement. The PL/I library routines then compare the in-sertion ~ith the specified key (KEYFROM option). InequaJi+v results in a KEY

d.or. 0~'· KEYTO option can be used to €}. _ .. ~L d copy of the key.

Creating an Indexed Data Set

The associated file can be opened for SEQUENTIAL OUTPUT or DIRECT OUTPUT.

sequential proceSSing is more efficient than DIRECT, but the records must be pre-sented in ascending key sequence. Failure to do this raises the KEY condition. For DIRECT OUTPUT proceSSing, the records can be presented in any order; the only error that can occur, besides a key-specification error, is supplying of a duplicate key.

The data ITlanagement parameters required

~hen creating a new VI data set are shown in T-,hl p 18.

78 st:!ct.ion 10: Record-Oriented Trdnsmission

Table 18. Specification of VI Data Set Characteristics

r-·---~---_,~---T---

..

I I DOEF I PL/I I Default I

I Characteristic I Command I Program I Value I t---+---+---t---~

i DDNAME= I file-name I file-name I None I

! ! title-name I title-name I I

I I I I I

I DSORG= i VI I I See Note I

I I I I

I DSNAME= I Data Set I None I

I ! name I I

! I I I

I DCB= I I I

I I I I

I RECFM= I F,V ENVIRONMENT! V I

t LRECL= I value option I 132(V) 128(F) I

I RIll'=' I value I q (V) 0 (F) I

I KEYLEN= I value I 7 tv or F) !

I I I I

I DISP= I NEW I I See Note I

~---L---L---~--- ~ I Note: DSORG defaults to OLD if the DSNAME is in the I I system catalog, and to NEW if the DSNAME is not I

I in the system catalog. I

L _________________________________________________________ J

Accessing an Indexed Data Set

The data management information required for accessing an existing indexed data set is

DDNAME = file or title-name DSNAME = data set name DISP = OLD (optional)

No further information need be supplied.

If other data management parameters are supplied, they must be the same as the existing values; no change can be made to the values set at creation time.

Example of Indexed DataSet

Examples 14 and 15 in ·Part III:

Examples· illustrate the creation and updating of an INDEXED data set.

Programs can be checked out using the program control system or the debugging facilities provided by PL/I.

PROGRAM CONTROL SYSTEM

The program control system (PCS) is a subset of the TSS/360 command system.

Table 19 summarizes the PCS facilities available to the PL/I user.

Table 20 lists the restrictions on using PCS that apply only to you as a PL/I user or are of special interest to you. For further information, see command System User's Guide.

Example:

LOAD SIMPLE

Documents relatifs