To create a data set, you must give the operating system certain information either in your PL/I program or in the DD statement that defines the data set. For z/OS UNIX, use one of the following to provide the additional information:
The following paragraphs indicate the essential information, and discuss some of the optional information you can supply.
When your application creates a STREAM file, PL/I will derive a line-size value for that file from one of the following sources in order of declining precedence.
If a LINESIZE value is supplied, but a RECSIZE valus is not, then PL/I derives the record-length value as follows:
If a LINESIZE value is not supplied, but a RECSIZE value is, then PL/I derives the line-size value from RECSIZE as follows:
If neither LINESIZE nor RECSIZE is supplied, then PL/I determines a default line-size value based on the attributes of the file and the type of associated data set. In cases where PL/I cannot supply an appropriate default line size, the UNDEFINEDFILE condition is raised.
A default line-size value is supplied for an OUTPUT file when:
Note that if the LINESIZE option is specified (on the OPEN statement) and RECSIZE is also specified (in the ENVIRONMENT attribute, the TITLE option or the DD statement), if the record size value is too small to hold the LINESIZE (taking into account the record format and appropriate control byte overhead), then
For DD SYSOUT= files, the LINESIZE option will be used to determine a new record size that matches the given LINESIZE. For DD DSN= files and all other files, the UNDEFINEDFILE condition will be raised.
The UNDEFINEDFILE condition will be raised for all files
The use of edit-directed stream-oriented data transmission to create a data set on a direct access storage device is shown in Figure 24. The data read from the input stream by the file SYSIN includes a field VREC that contains five unnamed 7-character subfields; the field NUM defines the number of these subfields that contain information. The output file WORK transmits to the data set the whole of the field FREC and only those subfields of VREC that contain information.
//EX7#2 JOB
//STEP1 EXEC IBMZCBG
//PLI.SYSIN DD *
PEOPLE: PROC OPTIONS(MAIN);
DCL WORK FILE STREAM OUTPUT,
1 REC,
2 FREC,
3 NAME CHAR(19),
3 NUM CHAR(1),
3 PAD CHAR(25),
2 VREC CHAR(35),
EOF BIT(1) INIT('0'B),
IN CHAR(80) DEF REC;
ON ENDFILE(SYSIN) EOF='1'B;
OPEN FILE(WORK) LINESIZE(400);
GET FILE(SYSIN) EDIT(IN)(A(80));
DO WHILE (¬EOF);
PUT FILE(WORK) EDIT(IN)(A(45+7*NUM));
GET FILE(SYSIN) EDIT(IN)(A(80));
END;
CLOSE FILE(WORK);
END PEOPLE;
/*
//GO.WORK DD DSN=HPU8.PEOPLE,DISP=(NEW,CATLG),UNIT=SYSDA,
// SPACE=(TRK,(1,1))
//GO.SYSIN DD *
R.C.ANDERSON 0 202848 DOCTOR
B.F.BENNETT 2 771239 PLUMBER VICTOR HAZEL
R.E.COLE 5 698635 COOK ELLEN VICTOR JOAN ANN OTTO
J.F.COOPER 5 418915 LAWYER FRANK CAROL DONALD NORMAN BRENDA
A.J.CORNELL 3 237837 BARBER ALBERT ERIC JANET
E.F.FERRIS 4 158636 CARPENTER GERALD ANNA MARY HAROLD
/*Figure 25 shows an example of a program using list-directed output to write graphics to a stream file. It assumes that you have an output device that can print graphic data. The program reads employee records and selects persons living in a certain area. It then edits the address field, inserting one graphic blank between each address item, and prints the employee number, name, and address.
//EX7#3 JOB
//STEP1 EXEC IBMZCBG
//PLI.SYSIN DD *
% PROCESS GRAPHIC;
XAMPLE1: PROC OPTIONS(MAIN);
DCL INFILE FILE INPUT RECORD,
OUTFILE FILE OUTPUT STREAM ENV(GRAPHIC);
/* GRAPHIC OPTION MEANS DELIMITERS WILL BE INSERTED ON OUTPUT FILES. */
DCL
1 IN,
3 EMPNO CHAR(6),
3 SHIFT1 CHAR(1),
3 NAME,
5 LAST G(7),
5 FIRST G(7),
3 SHIFT2 CHAR(1),
3 ADDRESS,
5 ZIP CHAR(6),
5 SHIFT3 CHAR(1),
5 DISTRICT G(5),
5 CITY G(5),
5 OTHER G(8),
5 SHIFT4 CHAR(1);
DCL EOF BIT(1) INIT('0'B);
DCL ADDRWK G(20);
ON ENDFILE (INFILE) EOF = '1'B;
READ FILE(INFILE) INTO(IN);
DO WHILE(¬EOF);
DO;
IF SUBSTR(ZIP,1,3)¬='300'
THEN LEAVE;
L=0;
ADDRWK=DISTRICT;
DO I=1 TO 5;
IF SUBSTR(DISTRICT,I,1)= < >
THEN LEAVE; /* SUBSTR BIF PICKS 3P */
END; /* THE ITH GRAPHIC CHAR */
L=L+I+1; /* IN DISTRICT */
SUBSTR(ADDRWK,L,5)=CITY;
DO I=1 TO 5;
IF SUBSTR(CITY,I,1)= < >
THEN LEAVE;
END;
L=L+I;
SUBSTR(ADDRWK,L,8)=OTHER;
PUT FILE(OUTFILE) SKIP /* THIS DATA SET */
EDIT(EMPNO,IN.LAST,FIRST,ADDRWK) /* REQUIRES UTILITY */
(A(8),G(7),G(7),X(4),G(20)); /* TO PRINT GRAPHIC */
/* DATA */
END; /* END OF NON-ITERATIVE DO */
READ FILE(INFILE) INTO (IN);
END; /* END OF DO WHILE(¬EOF) */
END XAMPLE1;
/*
//GO.OUTFILE DD SYSOUT=A,DCB=(RECFM=VB,LRECL=121,BLKSIZE=129)
//GO.INFILE DD *
ABCDEF<
>300099< 3 3 3 3 3 3 3 >
ABCD <
>300011< 3 3 3 3 >
/*