• Aucun résultat trouvé

NAME CHAR(8), TTR CH)\R(3),

Dans le document It System/360 (Page 159-163)

REGIO:NrAL Data Sets

Chapter 12: Libraries of Data Sets

2 NAME CHAR(8), TTR CH)\R(3),

2 INDIC,

3 ALIAS BIT(l), 3 TTRS BIT(2), 3 USERCT BIT(5), (LEN,PTR) FIXED BIN(31);

ON ENDFILE(LINK) GO TO FINISH;

OPEN FILE(LINK);

NEXTBLK: READ FILECLINK) INTO(DIRBLK);

LEN=COUNT;

PTR=l;

NEXTENT: A=ADDR(ENTRIES(PTR»;

PUT FILE(SYSPRINT) SKIP LIST(NAME);

PTR=PTR+12+2*USERCT;

IF PTR+2>LEN THEN GO TO NEXTBLK;

GO TO NEXTENT;

FINISH: CLOSE FILE(LINK);

END MNAME;

/*

//LKED.SYSLMOD DD UNIT=2311,VOLUME=SER=D186,DSNAME=FLM(DIRLIST),

// DISP=OLD

Figure 12-5. Placing a Load Module in an Existing Library PROCESSING WITH PL/I

You can use a PL/I program to write a member into a partitioned data set, or to read or update a member. In each case, you must identify the member in an appropriate DD statement and process it as a

CONSECUTIVE data set.

Creating a Member

The members of a partitioned data set must have identical characteristics. This is necessary because the volume table of contents (VTOC) will contain only one data set control block (DSCB) for the data set, and not one for each member. Although it is possible to place members 'with different characteristics into a partitioned data set, you may subsequently have difficulty in retrieving them. Note that, when you use a PL/I program to create a member, the operating system creates the directory entry; you cannot place information in the user data field.

When. you create a member in a new

partitioned data set, the DD statement that defines the data set must include all the

parameters listed under the heading 'Creating a Partitioned Data set,' above (although you can omit the DISP parameter if the data set is temporary). You must also describe the characteristics of the member (record format, etc.) either in the DCB parameter or in your PL/I program;

these characteristics will also apply to other members added to the data set.

However, if the partitioned data set already exists, you will not need the SPACE parameter; the original space allocation applies to the data set and not to an individual member. Furthermore, you will not need to describe the characteristics of the member, since these are already

recorded in the DSCB for the data set.

If you want to add two or more me~bers

to a partitioned data set in one job step, you must include a DD statement for each member, and you must close one file that refers to the data set before you open another.

Figure 12-6 illustrates the use of a PL/I program to create a CONSECUTIVE data set and place it in a new library.

Chapter 12: Libraries of Data sets 159

//J059PGEX JOB

//COLEEX EXEC PL1LFCLG,PARM.PL1L='SIZE=999999',PARM.LKEO=·' //PL1L.SYSIN DD

*

NMEM: PROC OPTIONS(MAIN);

DCL IN FILE RECORD SEQUENTIAL INPUT, OUT FILE RECORD SEQUENTIAL OUTPUT, IOFIELD CHAR(80) BASED(A);

OPEN FILE(IN),FILE(OUT);

ON ENDFILE(IN) GO TO FINISH;

I

NEXT: READ FILE(IN) SET(A)i

WRITE FILE(OUT) FROM(IOFIELD);

GO TO NEXT;

FINISH: CLOSE FILE(IN),FILE(OUT)i END NMEM;

/*

//GO.OUT / /

DD UNIT=2311,VOLUME=SER=0186,DSNAME=ALIB(NMEM), OISP=(,KEEP),SPACE=(CYL, (10,1,1»,

/ / //GO.IN

DCB= (RECFM=FB,BLKSIZE=3600, LRECL=80) DD

*

Insert here data to be placed in member /*

• Figure 12-6. Using a PL/I Program to Create a Member of a Partitioned Data Set

//J060PGEX JOB

//COLEEX EXEC PL1LFCLG,PARM.PL1L=1 SIZE=999999' , PARM.LKED=,1 , //PL1L.SYSIN DD

*

UPDTM: PROC OPTIONS(MAIN)i

DCL (OLD, NEW) FILE RECORD SEQUENTIAL, DATA CHAR(80):

ON ENDFILE(OLD) GO TO FINISH:

OPEN FILE(OLO) INPUT,FILE(NEW) OUTPUT TITLE('OLO')i NEXi': READ FILE(OLD) INTO(OATA)i

IF DATA=' , THEN GO TO NEXT:

WRITE FILE (NEW) FROM (DATA) ; GO TO NEXT:

FINISH: CLOSE FILE(OLD),FILE(NEW)i END UPOTMi

/*

//GO.OLD DD UNIT=2311,VOLUME=SER=D186,DSNAME=ALIB(NMEM),DISP=OLD Figure 12-7. Updating a Member of a Partitioned Data Set

Updating a Member

To use a PL/I program to update one or more records within a member of a partitioned data set, you must rewrite the entire member in another part of the data set;

this is rarely an economic proposition, since the space originally occupied by the member cannot be used again. You must use two files in your PL/I program, but, both can be associated with the same DD

statement. Figure 12-7 is a program that updates the member created in Figure 12-6;

i t copies all the records of the original member except those that contain only blanks.

Operating System Utility Programs

The operating system includes several utility programs that are useful for processing partitioned data sets. ~

System/360 Operating system: Utilities describes all these utility programs and explains how to use them,. The facilities offered by the utility programs include moving, copying, and merging the contents of partitioned data sets, updating members in place, and listing the contents of directories.

System. Libraries

LINK LIBRARY

The link library (SYS1.LINKLIB) is a system library that houses frequently used

programs. Any program that you name in the

provide~s the necessary data control block and establishes the logical relationship between your program and the library, library subroutines use these macro instructions to call other library subroutines.

PROCEDURE LIBRARY

The procedure library (SYS1.PROCLIB) is a system library that houses cataloged procedures. It is normally accessed only by the control program or by the utility program IEBUPDTE, which may be used for adding or changing cataloged procedures.

Chapter 8 discusses cataloged procedures and the procedure library.

PL/I SUBROUTINE LIBRARY

The PL/I subroutine library (SYS1.PL1LIB) is a system library that houses a set of load mo.dules that, during execution of a PL/I program, supplement the machine instructi.ons generated by the compiler.

These modules can be divided into two groups:

1. Modules that serve as an interface between compiled code and the

facilities of the operating system.

These modules are concerned primarily wi"th input and output, storage

ma.nagement, and error and interrupb:

ha.ndling.

2. Modules that perform data processing operations during program execution .•

These modules handle, for example, input/output editing, data conversion, and many of the PL/I built-in

functions.

Certain modules are loaded dynamically during the execution of a program. These modules reside in the link library

(SYS1.LINKLIB): they are transient modules and are loaded, when required, by the macro instructions LINK, LOAD and XCTL. The link library modules comprise:

1. The print and message modules of the error and interrupt-handling

subroutines.

2. The modules for opening and closing files.

3. The record-oriented transmission modules. identify the private library that contains them as a job library by naming i t in a

DISP="(NEW, PASS), DISP= (OLD,PASS), or DISP=(SHR,PASS) to ensure that the job library remains available throughout the job; however, if you code DISP=OLD or

the volume that contains the libra~y, and the unit that will process i t (UNIT and VOLUME parameters).

You can concatenate two or more private libraries in a single job library by

pefining them in separate DD statements and leaving the name field of all but the first statement blank. The control program will search these libraries in the order of appearance of the DD statements that define them.

Figure 12-8 illustrates the execution of the load module created in Figure 12-5 from the private library FLMi in this example, //J062PGE3 JOB

the program lists the names of the members of the link library~

STEP LIBRARY

You can identify a private library as a step library in a similar manner to that described above for a job library. A STEPLIB DO statement applies to a job step only and overrides any JOBLIB OD statement for the duration of the job step. You can also specify a step library (but not a job library) in a cataloged procedure.

//JOBLIB DD UNIT=2311,VOLUME=SER=D186,DSNAME=FLM,DISP=OLO / / EXEC PGM=OIRLIST

//LINK DD DSNAME=SYS1.LINKLIB,OISP=SHR //SYSPRINT DO SYSOUT=A

Figure 12-8. Use of JOBLIB statement

Introduction

Mul ti ta~sking is the term used in PL/I to describe the concurrent existence of several tasks within the execution job step. Multitasking should not be confused with multiprogramming, which is the control of indE!pendent' jobs running concurrently.

PL/I m'tLl ti tasking can be used only under an MVT sys·tem whilst multiprogramming can be run under MFT or MVT controlled systems.

A multitasking program will usually contain one or more procedures within a main pI:ocedure, each of which can have a di.fferE!nt priority, each identified by differe!nt task names and each capable of callingr or being called by each other. For eXamplE!:

Dans le document It System/360 (Page 159-163)