Viewing MVS multiple printouts

Debugging Technique

Verifying the successful completion of a program's objective at intermediate steps by generating printouts is an effective debugging technique. Viewing each printout separately with a JES2 Spooling display facility instead of killing trees by printing out hard copy is faster and environmentally sound. The SAS Proc Print statement can be placed at intermediate steps to generate a printout of every variable for every observation. But reviewing the varying size printouts can be an arduous task. The main problem of viewing the printouts is that all the printouts were written to the same file.

Easily selecting a specific printout

Easily selecting a specific printout can be accomplished with JCL and placing a Proc Printto statement before each Proc Print statement. It will require the user to have the Proc Printto statement associated with the correct DD statement. An output title to identify each printout is also helpful.

The JCL and SAS code necessary to easily select a specific printout

//* Specify msgclass=X and the job card
//* To prevent the output from being printed
//STEP1    EXEC SAS
//FT22F001 DD SYSOUT=*
//FT23F001 DD SYSOUT=*
//SYSOUT   DD *
 .
 PROC PRINTTO UNIT=22           ;
 PROC PRINT                     ; 
 TITLE identifying this printout;
 .
 PROC PRINTTO UNIT=23           ;
 PROC PRINT                     ; 
 TITLE identifying this printout;

SAS Fifth Dimension Macro-PRT is an easier way

An easier way to accomplish this technique is to use my PRT macro.

The SAS macro, PRT, will generate a sysout DD statement and a Proc Printto statement dynamically each time the macro is invoked. To activate the PRT macro requires including the code of the PRT macro at the beginning and replacing each Proc Print statement with %PRT.

This macro can be easily enhanced to include desired options. I hope this idea will assist you in your programming environment. SAS macros have the capability of creating a user friendly environment making SAS even easier to use.

The PRT macro is a front end to the SAS Proc Print statement to provide JES2 spooling facilities the capability to separate each printout by assigning a unique file reference (DD statement) for each execution of the Proc Print statement. This becomes vital for reviewing multiple printout including large files since viewing the next printout or selecting a specific printout becomes easy.

Details

Additional features include the following:

All parameters are options but the code of this macro is yours to change to accommodate your installation as necessary.

This macro is intended for the beginning programmers and should require little modification.

FT22F001 is the first DD name created. Each invocation uses a similar format with the number incrementing from 22. This enables the unit parameter of the Proc Printto statement to be used and it does allows 78 file references.

PRT macro:

%MACRO PRT(NUMBER,DATA=,PS=60,LS=133,ADDOPT=);
All parameters are options

Code to assign the first page number of each printout start with one:
OPTIONS PAGENO=1 ; /* Before each Proc Print statement */

Page size and line size is also included at point of invocation. Of course a title statement after the %PRT invocation will override the generated title allowing the user to define titles.

The PRT macro will also generate a title to identify each printout. Each title will include the input file name and the DD name the output has been written to. The same identifying information is placed in the SAS log at point of invocation.

Format of the generated title statement:

TITLE1 "Input SAS File DDNAME=<&DDNAME MEMBER=&MEMBER"
       " - Output DDNAME=FT&NUM.F001"             ;

Format of comment generated:

%PUT %STR(----------->FT&NUM.F001 &DATA PS=&PS LS=&LS) ;

Desired procedure to review the printouts

The PRT macro Parameters

NUM is used to specify the number in the DD statement
Default generates sequential numbers starting at 22
DATA= to select the SAS input file name
Default is the last file accessed
PS Page size Default=65
LS Line size Default=133
ADDOPT= Proc Print options

PC SAS

This macro executing on PC SAS will create multiple files with the name FTxxF001.LST Where xx=22,23,24... In addition the programmer may want to dynamically change the output directory for these files. But that will be discussed in later articles.

Additional Modification to this PRT macro

Limit the number of observations printed

Since the SAS OPTIONS statement is used before the Proc Print statement