Chapter Contents |
Previous |
Next |
SOURCE |
OS/390 specifics: | all |
Syntax |
PROC SOURCE
<options>;
|
Details |
Use PROC SOURCE to read PDS or PDSE libraries and produce sequential output.
You can use the SOURCE procedure to:
An advantage of having an unloaded data set is that one or more members can be retrieved without reloading the entire library.
PROC SOURCE has several advantages over IBM's IEBPTPCH utility. With PROC SOURCE you can
The model-control-statements in the FIRST, LAST, BEFORE, and AFTER statements are usually either utility or job control statements, depending on the destination given by the OUTDD= option in the PROC SOURCE statement.
PROC SOURCE Statement |
PROC SOURCE <options>; |
The following options are used in the PROC SOURCE statement:
Note: The
SELECT and EXCLUDE statements have no effect when the DIRDD= option is specified.
If OUTDD is specified, then the RECFM of the INDD file must be either F or FB. The fileref may not refer to a concatenation of data sets. If it does, then an error message is generated. If the member names in the INDD file are nonstandard, then specify FILEEXT=ASIS in an OPTIONS statement.
./ ALIAScards or alias BEFORE and AFTER cards.
Normally, PROC SOURCE processes (that is, unloads, writes to the SAS log, and so on) the PDS members in alphabetical order by member name.
SELECT Statement |
SELECT member-1 < . . . member-n >; |
Use a colon (:) to indicate that you want to select all members whose names begin with the characters that precede the colon. (See the second example below.)
You can include an alphabetic range of names in the SELECT statement by joining two names with a hyphen (-). The two hyphenated members and all members in between are processed. For example, if a library contains members called BROWN, GRAY, GREEN, RED, and YELLOW, and you want to process the first four members, use this SELECT statement:
select brown-red;
The colon (:) and hyphen (-) notation can be used together. For example, the following statement produces the same results as the previous SELECT statement:
select br:-gr: red;
EXCLUDE Statement |
EXCLUDE member-1 < . . . member-n > ; |
Use a colon (:) to indicate that you want to exclude all members whose names begin with the characters that precede the colon.
You can include an alphabetic range of names in the EXCLUDE statement by joining two names with a hyphen. The two hyphenated members and all members in between are excluded from processing. (See the SELECT examples in the SELECT statement description.)
The colon and hyphen notation can be used together.
Sometimes it is convenient to use SELECT and EXCLUDE statements together. For example, you can use the colon or hyphen notation in a SELECT statement to select many members, then use the EXCLUDE statement to exclude a few of the selected members. Suppose there are 200 members called SMC1 through SMC200, and you want to copy all of them except SMC30 through SMC34. You could use these statements:
select smc:; exclude smc30-smc34;
When you use both EXCLUDE and SELECT statements, the EXCLUDE statements should specify only members that are specified by the SELECT statements. However, excluding unselected members has no effect other than to generate warning messages.
FIRST Statement |
FIRST 'model-control-statement '; |
LAST Statement |
LAST 'model-control-statement '; |
BEFORE Statement |
BEFORE 'model-control-statement' <options>; |
By default, PROC SOURCE generates control statements for the IBM IEBUPDTE utility program before each member of an unloaded data set. You can use the BEFORE and AFTER statements to override the default and generate control statements for other utility programs. To prevent PROC SOURCE from generating these statements, use the BEFORE statement with no parameters.
Options for the BEFORE and AFTER statements are the same. A list of these options follows the description of the AFTER statement.
AFTER Statement |
AFTER 'model-control-statement' <options>; |
By default, PROC SOURCE generates control statements for the IBM IEBUPDTE utility program after each member of an unloaded data set. You can use the AFTER statement to override the default and generate control statements for other utility programs.
The following options are used in the BEFORE and AFTER statements:
name ,text text text
When NOBLANK is specified, the same record looks like this:
name,text text text
Output |
PROC SOURCE writes the following information to the SAS log:
Even when PRINT is not specified, some records may still be written to the log. The signal NAME: or ENTRY: or AUTHOR: beginning in column 5 of a record in the library starts the listing; the signal END beginning in column 5 stops it. If you do not want SAS to list this subset of records, specify the NOSUMMARY option.
Example of Printing Selected Members from a PDS |
proc source indd='userid.taste.test' print; select oranges4; run;
The log is shown in Selecting a Member from a Source Statement Library.
Selecting a Member from a Source Statement Library
19 proc source indd='userid.taste.test' print; 20 select oranges4; run; ORANGES4 data oranges; input variety $ flavor texture looks; total=flavor+texture+looks; datalines; navel 9 8 6 temple 7 7 7 valencia 8 9 9 mandarin 5 7 8 ; proc sort data=oranges; by descending total; proc print data=oranges; title 'Taste Test Result for Oranges'; 17 - RECORDS NOTE: INDD=SYS00158 data set is : Dsname=USERID.TASTE.TEST, Unit=3380,Volume=XXXXXX,Disp=SHR,Blksize=23055, Lrecl=259,Recfm=FB. 3348 Members defined in source library. 0 Aliases defined in source library. 1 Members selected. 17 Records read from source library. |
Example of Building and Submitting a Job to Assemble Programs |
The following PROC SOURCE program builds and submits a job to compile assembler programs. It writes the output directly to the internal reader so that the compile job can be executed.
filename out sysout=a pgm=intrdr lrecl=80 recfm=f; proc source indd='userid.asm.src' nodata outdd=out; first '//COMPILE JOB (0,ROOM),''DUMMY'','; first '// NOTIFY=,REGION=4M,TYPRUN=HOLD'; first '/*JOBPARM FETCH'; last '//'; before '//XXXXXXXX EXEC ASMHCL,' 3; before '// MAC2=''XXX.MACLIB'' '; before '//SYSIN DD DISP=SHR,'; before '// DSN=USERID.ASM.SOURCE(XXXXXXXX)' 26 NOBLANK; run;
The output that is written to the internal reader is shown below. Note that this output shows only the statements that are generated by PROC SOURCE, before they are executed.
Building and Submitting a Job to Assemble Programs
//COMPILE JOB (0,ROOM),'DUMMY', // NOTIFY=,REGION=4M,TYPRUN=HOLD /*JOBPARM FETCH //OUT1601 EXEC ASMHCL, // MAC2='XXX.MACLIB' //SYSIN DD DISP=SHR, // DSN=USERID.ASM.SRC(OUT1601) //OUT1602 EXEC ASMHCL, // MAC2='XXX.MACLIB' //SYSIN DD DISP=SHR, // DSN=USERID.ASM.SRC(OUT1602) //OUT1603 EXEC ASMHCL, // MAC2='XXX.MACLIB' //SYSIN DD DISP=SHR, // DSN=USERID.ASM.SRC(OUT1603) // |
Example of Producing Directory Records |
The following PROC SOURCE program produces directory records. The subsequent DATA step extracts the ISPF statistics, if any are present.
filename indd 'userid.sas.src' disp=shr; filename out '&temp'; /* Build directory records. */ proc source indd=indd nodata noprint dirdd=out; /* Read directory records and extract */ /* ISPF statistics. */ data test; infile out; file print header=h; input member $8. ttr pib3. ind pib1. @; datalen = 2*mod(ind,32); if (datalen = 30) then do; input ver pib1. mod pib1. blank pib2. ccreate pib1. create pd3. cchanged pib1. changed pd3. hh pk1. mm pk1. size pib2. init pib2. modl pib2. userid $8.; yyyydddc = (ccreate * 100000) + 1900000 + create; jcreate = datejul(yyyydddc); yyyydddx = (cchanged * 100000) + 1900000 + changed; jchange = datejul(yyyydddx); /* Print the results. */ put @4 member $8. @15 jcreate yymmdd10. @27 jchange yymmdd10. @39 hh 2. ':' mm 2. @48 userid; end; return; h: put @4 'NAME ' @15 'CREATED' @27 'CHANGED' @39 'TIME' @48 ' ID '; put; return; run;
The following output shows the results.
Producing Directory Records
The SAS System NAME CREATED CHANGED TIME ID OUT1601 1999-02-20 1999-02-20 10:50 USERID OUT1602 1999-02-20 1999-02-20 10:54 USERID OUT1603 1999-02-20 1999-02-20 10:59 USERID |
Example of Generating Control Cards for IEBCOPY |
This example first produces control statements for the IBM utility program, IEBCOPY. Then IEBCOPY executes, copying selected members.
//IEBPDS JOB (0,ROOM),'USERID', // NOTIFY= /*JOBPARM FETCH // EXEC SAS //IN DD DSN=XXX.SUBLIB,DISP=SHR //OUT DD DSN=&&TEMP,SPACE=(CYL,(1,2)), // DISP=(,PASS),UNIT=DISK //SYSIN DD * proc source indd=in outdd=out nodata noprint; select hc:; select lm:; select sasextrn; first ' COPY INDD=IN,OUTDD=NEWPDS'; before ' SELECT MEMBER=XXXXXXXX -----------' 17; before ' S M=XXXXXXXX ***ALIAS***' 17 ALIAS; //S1 EXEC PGM=IEBCOPY //SYSPRINT DD SYSOUT=A //IN DD DSN=XXX.SUBLIB,DISP=SHR //NEWPDS DD DSN=&&NEW,SPACE=(CYL,(20,10,20)), // UNIT=DISK //SYSUT1 DD UNIT=DISK,SPACE=(CYL,(2,3)) //SYSUT2 DD UNIT=DISK,SPACE=(CYL,(2,3)) //SYSUT3 DD UNIT=DISK,SPACE=(CYL,(2,3)) //SYSIN DD DSN=&&TEMP,DISP=(OLD,DELETE)
Producing Control Statements for the IEBCOPY Utility shows what is written to the SAS log after PROC SOURCE is run. IEBCOPY Output: Selected Members Copied shows the IEBCOPY output.
Producing Control Statements for the IEBCOPY Utility
1 proc source indd=in outdd=out nodata noprint; 2 select hc:; 3 select lm:; 4 select sasextrn; 5 first ' COPY INDD=IN,OUTDD=NEWPDS'; 6 before ' SELECT MEMBER=XXXXXXXX -----------' 17; 7 before ' S M=XXXXXXXX ***ALIAS***' 17 ALIAS; NOTE: INDD=IN data set is : Dsname=USERID.DATASET, Unit=3380,Volume=XXXXXX,Disp=SHR,Blksize=6160, Lrecl=80,Recfm=FB. NOTE: OUTDD=OUT data set is : Dsname=SYS96052.T131013.RA000.IEBPDS.TEMP, Unit=3390,Volume=,Disp=NEW,Blksize=27920, Lrecl=80,Recfm=FB. 9 Members defined in source library. 0 Aliases defined in source library. 6 Members selected. 0 Records read from source library. |
IEBCOPY Output: Selected Members Copied
IEBCOPY MESSAGES AND CONTROL STATEMENTS COPY INDD=IN,OUTDD=NEWPDS SELECT MEMBER=HCMEM1 ----------- SELECT MEMBER=HCMEM2 ----------- SELECT MEMBER=HCMEM3 ----------- SELECT MEMBER=LMMEM1 ----------- SELECT MEMBER=LMMEM2 ----------- SELECT MEMBER=SASEXTRN ----------- . . . IEB167I FOLLOWING MEMBER(S) COPIED FROM INPUT DATA SET REFERENCED BY IN IEB154I HCMEM1 HAS BEEN SUCCESSFULLY COPIED IEB154I HCMEM2 HAS BEEN SUCCESSFULLY COPIED IEB154I HCMEM3 HAS BEEN SUCCESSFULLY COPIED IEB154I LMMEM1 HAS BEEN SUCCESSFULLY COPIED IEB154I LMMEM2 HAS BEEN SUCCESSFULLY COPIED IEB154I SASEXTRN HAS BEEN SUCCESSFULLY COPIED IEB144I THERE ARE 239 UNUSED TRACKS IN OUTPUT DATA SET REFERENCED BY NEWPDS IEB149I THERE ARE 8 UNUSED DIRECTORY BLOCKS IN OUTPUT DIRECTORY IEB147I END OF JOB - 0 WAS HIGHEST SEVERITY CODE |
References |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.