Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Programming Guide

Creating a REGIONAL(1) data set

You can create a REGIONAL(1) data set either sequentially or by direct access. Table 21 shows the statements and options for creating a regional data set.

When you use a SEQUENTIAL OUTPUT file to create the data set, the opening of the file causes all tracks on the data set to be cleared, and a capacity record to be written at the beginning of each track to record the amount of space available on that track. You must present records in ascending order of region numbers; any region you omit from the sequence is filled with a dummy record. If there is an error in the sequence, or if you present a duplicate key, the KEY condition is raised. When the file is closed, any space remaining at the end of the current extent is filled with dummy records.

If you use a DIRECT OUTPUT file to create the data set, the whole primary extent allocated to the data set is filled with dummy records when the file is opened. You can present records in random order; if you present a duplicate, the existing record will be overwritten.

For sequential creation, the data set can have up to 15 extents, which can be on more than one volume. For direct creation, the data set can have only one extent, and can therefore reside on only one volume.

Example

Creating a REGIONAL(1) data set is illustrated in Figure 32. The data set is a list of telephone numbers with the names of the subscribers to whom they are allocated. The telephone numbers correspond with the region numbers in the data set, the data in each occupied region being a subscriber's name.

Figure 32. Creating a REGIONAL(1) data set
 //EX9    JOB
 //STEP1  EXEC IBMZCBG,PARM.PLI='NOP,MAR(1,72)',PARM.BIND='LIST'
 //PLI.SYSIN  DD  *
  CRR1:   PROC OPTIONS(MAIN);
   /*  CREATING A REGIONAL(1) DATA SET  -  PHONE DIRECTORY     */

    DCL NOS FILE RECORD OUTPUT DIRECT KEYED ENV(REGIONAL(1));
    DCL  SYSIN FILE INPUT RECORD;
    DCL  SYSIN_REC BIT(1) INIT('1'B);
    DCL 1   CARD,
         2   NAME   CHAR(20),
         2   NUMBER CHAR( 2),
         2   CARD_1 CHAR(58);
    DCL IOFIELD CHAR(20);

       ON ENDFILE (SYSIN) SYSIN_REC = '0'B;
       OPEN FILE(NOS);
       READ FILE(SYSIN) INTO(CARD);

       DO WHILE(SYSIN_REC);
          IOFIELD = NAME;
          WRITE FILE(NOS) FROM(IOFIELD) KEYFROM(NUMBER);
          PUT FILE(SYSPRINT) SKIP EDIT (CARD) (A);
          READ FILE(SYSIN) INTO(CARD);
       END;

       CLOSE FILE(NOS);
   END CRR1;
 /*
 //GO.SYSLMOD DD DSN=&&GOSET,DISP=(OLD,DELETE)
 //GO.NOS     DD DSN=MYID.NOS,UNIT=SYSDA,SPACE=(20,100),
 //           DCB=(RECFM=F,BLKSIZE=20,DSORG=DA),DISP=(NEW,KEEP)
 //GO.SYSIN DD *
 ACTION,G.           12
 BAKER,R.            13
 BRAMLEY,O.H.        28
 CHEESNAME,L.        11
 CORY,G.             36
 ELLIOTT,D.          85
 FIGGINS,E.S.        43
 HARVEY,C.D.W.       25
 HASTINGS,G.M.       31
 KENDALL,J.G.        24
 LANCASTER,W.R.      64
 MILES,R.            23
 NEWMAN,M.W.         40
 PITT,W.H.           55
 ROLF,D.E.           14
 SHEERS,C.D.         21
 SURCLIFFE,M.        42
 TAYLOR,G.C.         47
 WILTON,L.W.         44
 WINSTONE,E.M.       37
 /*

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)