MVS Appendix 3: Printing Graphs | |
This appendix steps you through the task of customizing the printing of graphs interactively and from a batch job.
The examples in this appendix should work for most monitors and printer/plotters. If the examples do not work for your equipment, see SAS/GRAPH Software: Using Graphics Devices in the MVS Environment, Version 6, First Edition for your specific environment or equipment. Another source of information is the help windows for the SAS GDEVICE procedure (see below). You can access them from within GDEVICES or by issuing the HELP GDEVICES command at a command line.
If you have questions, ask your SAS Software Representative to call SAS Technical Support.
This section describes one method. For others, see the references in the introduction to this appendix.
See Shared Appendix 2: Navigating SAS Windows. Note that cycle implies that the windows remain open. By cycling, you are simply changing the window that is displayed while the others are hidden.
You need to know at least the name, destination, and appropriate SYSOUT class of your printer/plotter.
Cycle to your PROGRAM EDITOR window. If the window has pull-down menus, switch to a command line by selecting Globals, Command, and Command line.
proc gdevice; run;
SUBMIT
at the command line's prompt and press
ENTER or RETURN. Note: If you need more help selecting a driver, ask your SAS Software Representative to call SAS Technical Support.
In the PROGRAM EDITOR window, type these statements starting at the first line in the body of the window:
filename fileref sysout=a dest=jes-destination-node; %put sysfilrc= &sysfilrc ; run;
where fileref is a valid name that you choose, the %PUT statement prints the FILENAME statement's return code to the SAS log, and the RUN statement is not required in this case (but it is required in other programs in this appendix; using it does not hurt and is a good habit). (The name must be a valid SAS name; that is, it must start with a letter or underscore; have only letters, underscores, and numbers; and have fewer than or equal to eight characters.) jes-destination-node is a JES node to which your printer/plotter is attached.
For instance, if your
printer/plotter is associated with a JES2 address
of RMT176
and you choose a fileref
of grafout
, the program would look
like this:
filename grafout sysout=a dest=RMT176; %put sysfilrc= &sysfilrc ; run;
In the PROGRAM EDITOR
window, type SUBMIT
on the command
line and press ENTER or RETURN.
Cycle to the LOG window and
check whether you have an ERROR message. (A
non-zero value of SYSFILRC also represents an
error.) If you do, cycle to the PROGRAM EDITOR
window, type RECALL
at the command
line's prompt, and press ENTER or RETURN. Then
correct the program and re-submit it.
Cycle to the CPE window. From the IT Service Vision server's main menu, follow this path:
Reports -> Supplied Rpts
Select a report definition with a RptType of CPPLOT1, CPPLOT2, CPCHART, CPCCHRT, CPG3D, or CPSPEC. Then select ItemActions and Run Report. IT Service Vision displays the graph in the GRAPH window.
Cycle to the PROGRAM EDITOR window. Type this program starting at the first line in the body of the window (note that a copy of this program is available in electronic form in Issue 6 of the newsletter):
%macro savegopt(opt); %global cpgoptn ; %let cpgoptn = %eval(&cpgoptn + 1) ; %global cpgopt&cpgoptn; %let cpgopt&cpgoptn = %sysfunc( getoption( &opt, KEYWORD )); %mend savegopt; %let cpgoptn = 0; %savegopt(DEVICE); %savegopt(TARGETDEVICE); %savegopt(HPOS); %savegopt(VPOS); %savegopt(CBACK); %savegopt(CTEXT); %savegopt(CPATTERN); %savegopt(CSYMBOL); %savegopt(COLORS); %savegopt(GCLASS); %savegopt(GCOPIES); %savegopt(GDDMCOPY); %savegopt(GDDMNICKNAME); %savegopt(GDDMTOKEN); %savegopt(GDEST); %savegopt(GFORMS); %savegopt(GWRITER); %savegopt(DEVADDR); %savegopt(GSFLEN); %savegopt(GSFNAME); %savegopt(GSFMODE); %savegopt(GPROTOCOL); %savegopt(TRANTAB); run;
The program saves the most commonly used SAS graphics options to temporary macro variables. (For more about the SAS graphics options, see the "Graphics Options and Device Parameters Dictionary," in the Reference documentation for SAS/GRAPH for your current level of SAS. If, in a later step, you find that you need to change an option not saved by this program, restore the original monitor settings of the options (a later step describes how to do the restore), and then modify this program (by adding a %savegopt(option_name); line) so that it also saves that option.
At the PROGRAM EDITOR window's
command line prompt, type SUBMIT
and
then press ENTER or RETURN.
Cycle to the LOG window and check whether there is an ERROR message. If so, cycle to the PROGRAM EDITOR window, recall the program, correct the error, and re-submit.
Cycle to the PROGRAM EDITOR window. Submit this program from the PROGRAM EDITOR window:
goptions cback=white ctext=black gsflen=80 gsfmode=replace gsfname=fileref targetdevice=SAS-device-driver-for-your-printer-plotter ; run;
where the name of the device driver is from the prerequisites for this task, and fileref is the same fileref that you used above. These are the most common graphics options that need to be changed for a printer/plotter. (You need to set the CBACK and CTEXT options because in some situations IT Service Vision must hard-code them.)
For example, suppose that the
SAS device driver for the printer/plotter is IBM3816
and the fileref is GRAFOUT
. Then the
program would be
goptions cback=white ctext=black gsflen=80 gsfmode=replace gsfname=grafout targetdevice=ibm3816 ; run;
Cycle to the LOG window. Check whether there is an ERROR message. If so, cycle to the PROGRAM EDITOR window, recall the program, correct it, and re-submit it.
Note: If, in a later step, you find that you need to change more options than these, first be sure the current setting is saved by step b above.
Cycle to the GRAPH window, select File, Print, and OK. IT Service Vision queues the graph to the destination that you specified.
Cycle to the PROGRAM EDITOR window. Submit this program from the PROGRAM EDITOR window:
filename fileref clear; run;
where fileref is the fileref that you have been using. This statement frees your queued print request so that the graph can print.
Cycle to the LOG window. Check whether there is an ERROR message. If so, cycle to the PROGRAM EDITOR window, recall the program, correct it, and re-submit it.
Cycle to the GRAPH window. Compare the graph in the window to the graph from the printer/plotter to see whether they match. In this context, the word match means that the same information (perhaps at a different scale) is on the hardcopy as is on the display. For instance, if your printer/plotter uses black and white, the gray scale values on the paper should correspond to the color values on your monitor.
Note: If any information is "missing" from the graph, the "missing" information may be printed in the same color as the background color. In that case, cycle to the PROGRAM EDITOR window and submit this program:
proc goptions; run;
Cycle to the LOG window. Check
the value of the CBACK= graphics option and the
values of the CTEXT= and CTITLE= graphics options
for the duplicate color. Cycle to the PROGRAM
EDITOR window. Recall this goptions program (by,
several times, typing RECALL
at the
PROGRAM EDITOR window's command line prompt and
pressing ENTER or RETURN),
goptions cback=white ctext=black gsflen=80 gsfmode=replace gsfname=fileref targetdevice=SAS-device-driver-for-your-printer-plotter ; run;
and specify a different color for the appropriate goption, re-submit the program, recheck the log, and re-print the graph.
If you have a printer/plotter
that prints in gray scale, sometimes it is
difficult to distinguish the various shades of
gray. In this case, you may want to specify the
graphics option COLORS=(BLACK)
,
which causes SAS to use different line types or
patterns instead of different shades of gray.
If you cannot get an acceptable printed graph, ask your SAS Software representative to call SAS Technical Support for help.
Cycle to the PROGRAM EDITOR window. Type this program starting at the first line in the body of the window (note that a copy of this program is available in electronic form in Issue 6 of the newsletter):
%macro restgopt(); %do i = 1 %to &cpgoptn; goptions &&cpgopt&i; %end; %mend restgopt; %restgopt;
The program restores the original graphics options settings for your monitor that were saved in an earlier step.
Cycle to the LOG window and check whether there is an ERROR message. If so, cycle to the PROGRAM EDITOR window, recall the program, correct the error, and re-submit.
Cycle to the GRAPH window. Select File and End.
Create a file of any name (for instance,
userid
.cpe.preprint
).
In the file, put the FILENAME statement and the
statements that prepare to print. For example
include here the program that saves the current values of goptions filename grafout sysout=a dest=jes-destination-node ; goptions cback=white ctext=black gsflen=80 gsfmode=replace gsfname=grafout targetdevice=ibm3816 ; run;
Create a file of any name (for instance,
userid
.cpe.postprnt
).
In the file, put the statements that restore
after printing. For example,
filename grafout clear; include here the program that restores the original values of goptions run;
See above.
On the PROGRAM EDITOR window's command line, issue this command
include 'pre-printing-file'
where pre-printing-file is the full pathname of the file that contains the FILENAME statement and the goptions that prepare to print.
On the PROGRAM EDITOR window's
command line, type SUBMIT
and then
press ENTER or RETURN.
See above.
On the PROGRAM EDITOR window's command line, issue this command
include 'post-printing-file'
where post-printing-file is the full pathname of the file that contains the post-print goptions and the FILENAME statement that clears the fileref.
On the PROGRAM EDITOR window's
command line, type SUBMIT
and then
press ENTER or RETURN.
Select File and End.
See above.
To print graphs from within a batch job, you do not need the examples of code used in the previous section. Instead, ensure that you have a GOPTIONS statement that includes a DEVICE= goption, and set the DEVICE= goption to the same device driver that you used in the TARGETDEVICE= option in the previous section. You do not need to specify the TARGETDEVICE= option. Nor do you need to set any of the GSFxxxx goptions.
Specify settings by means of OUTxxxx parameters on the IT Service Vision reporting macros. For example, to route the graphs to the same printer/plotter as in the interactive example, you would use these parameters on each of the reporting macros:
OUTLOC=SYSOUT=A OUTMODE=GSF OUTNAME=DEST=RMT176
For example, here is what the report definition in the original 'quick-start' job (CMQSTART in CPMISC PDS) looks like after conversion:
/*---------------------------------------------------------------* | IT Service Vision Design Report | Report Name: PAGRD | Dataset: XTY71 | Generated: Saturday, May 28, 1994 at 13:15 *---------------------------------------------------------------*/ GOPTIONS reset=title reset=footnote DEVICE=IBM3816 COLORS=(WHITE RED BLUE); TITLE1 "Demand paging rate during day"; %CPPLOT1(XTY71,DPR,Demand paging ,STAT=MEAN ,PERIOD=24HOUR ,BY=MACHINE ,WEIGHT=DURATION ,XVAR=DATETIME ,XLAB=Date ,TYPE=STACK ,REDLVL=DETAIL ,OUTLOC=SYSOUT=A ,OUTMODE=GSF ,OUTNAME=DEST=RMT176);