500 likes | 683 Views
Using SAS/Graph on z/OS to Display Performance and Capacity Data. Richard S. Ralston Humana, Inc. What You Need. SAS Base SAS Graph IBM HTTP Server Patience Patricia Wingfield’s CMG2003 paper: No More Downloading
E N D
Using SAS/Graph on z/OS to Display Performance and Capacity Data Richard S. Ralston Humana, Inc.
What You Need • SAS Base • SAS Graph • IBM HTTP Server • Patience • Patricia Wingfield’s CMG2003 paper: No More Downloading • Online Resources: SAS – Michael Hines, Richard S. Ralston - http://www.cmg.org/measureit/issues/mit35/m_35_11.html
HFS/ZFS vs. PDSE • PDSE • Like other systems the last qualifier identifies type of contents .HTML, .GIF, .JPG • Allocated in JCL or SAS statements • Sharable across LPARs • HFS • Preallocated • Directory structure • May not be able to share HFS across LPARs • Security and sharing issues • ZFS • Same concerns as HFS
Allocating PDSE Files %MACRO dsalloc (prefix=,timepd=,disp=); %GLOBAL htmlds gifds; DATA _NULL_; LENGTH dsname $44; %IF &timepd='D' | &timepd=D | &timepd=d %THEN %DO; date=_rptdate; dsname="&prefix" || '.D' || PUT(date,JULIAN5.) || '.HTML'; CALL SYMPUT("htmlds",TRIM(dsname)); dsname="&prefix" || '.D' || PUT(date,JULIAN5.) || '.GIF'; CALL SYMPUT("gifds",TRIM(dsname)); %END; %IF &timepd='M' | &timepd=M | &timepd=m %THEN %DO; date=_rptmth; dsname="&prefix" || '.M' || PUT(date,yymmdd4.) || '.HTML'; CALL SYMPUT("htmlds",TRIM(dsname)); dsname="&prefix" || '.M' || PUT(date,yymmdd4.) || '.GIF'; CALL SYMPUT("gifds",TRIM(dsname)); %END; %IF &timepd='MTD' | &timepd=MTD | &timepd=mtd %THEN %DO; date=_rptmth; dsname="&prefix" || '.MTD' || '.HTML'; CALL SYMPUT("htmlds",TRIM(dsname)); dsname="&prefix" || '.MTD' || '.GIF'; CALL SYMPUT("gifds",TRIM(dsname)); %END; %IF &timepd='N' | &timepd=N | &timepd=n %THEN %DO; dsname="&prefix" || '.HTML'; CALL SYMPUT("htmlds",TRIM(dsname)); dsname="&prefix" || '.GIF'; CALL SYMPUT("gifds",TRIM(dsname)); %END; %IF &timepd='W' | &timepd=W | &timepd=w %THEN %DO; IF WEEKDAY(_rptdate) = 7 THEN date=rptdate-6 ELSE date=_rptdate-WEEKDAY(_rptdate)-6; dsname="&prefix" || '.W' || PUT(date,YYMMDD6.) || '.HTML'; CALL SYMPUT("htmlds",TRIM(dsname)); dsname="&prefix" || '.W' || PUT(date,YYMMDD6.) || '.GIF'; CALL SYMPUT("gifds",TRIM(dsname)); %END; RUN; %IF &disp='NEW' | &disp=NEW | &disp=new %THEN %DO; %delds; FILENAME sasrpt "'&htmlds'" DSNTYPE=LIBRARY DSORG=PO RECFM=VB LRECL=512 BLKSIZE=0 SPACE=(CYL,(1,1,15)) DISP=(NEW,CATLG,DELETE); FILENAME sasgif "'&gifds'" DSNTYPE=LIBRARY DSORG=PO RECFM=VB LRECL=512 BLKSIZE=0 SPACE=(CYL,(1,1,15)) DISP=(NEW,CATLG,DELETE); %END; %ELSE %DO; FILENAME sasrpt "'&htmlds'" DISP=OLD WAIT=60; FILENAME sasgif "'&gifds'" DISP=OLD WAIT=60; %END; %MEND dsalloc;
Deleting PDSE Datasets %MACRO delds; %* Delete HTML and GIF Dataset libraries if they exist from prior run.; %IF %SYSFUNC(FILEEXIST(&htmlds)) %THEN %DO; FILENAME sasrpt "&htmlds" DISP=(OLD,DELETE) WAIT=60; FILENAME sasrpt CLEAR; %end; %IF %SYSFUNC(FILEEXIST(&gifds)) %THEN %DO; FILENAME sasgif "&gifds" DISP=(OLD,DELETE) WAIT=60; FILENAME sasgif CLEAR; %END; %MEND delds;
ODS (Output Delivery System) • Provides enhanced formatting capability for SAS output • Part of SAS base • Version 7 and earlier was all printer oriented • Started in SAS version 8 • Build Web output (HTML, Java, etc.)
Setting Up ODS for PDSE & GIF %MACRO odshtml (report=,graph=,label=,title=HTML); ODS HTML BODY="&report" (URL="'&htmlds(&report)'") CONTENTS="&report.C" (URL="'&htmlds(&report.C)'") FRAME="&report.F" (URL="'&htmlds(&report.F)'" TITLE="&label") PATH=sasrpt %IF &graph=YES | &graph=Y | &graph=y | &graph=yes %THEN GPATH=sasgif (URL="'&gifds(&report)'"); ANCHOR='ANCHOR' RECORD_SEPERATOR=NONE %LET title=%UPCASE(&title); %IF &title=GRAPH %THEN GTITLE; %ELSE NOGTITLE; STYLE=styles.test; ODS LISTING CLOSE; ODS PROCLABEL "<b>&label</b>"; %MEND odshtml;
Style Templates • Define the style (look) of the output • Handful of predefined Styles • Not well documented • PROC TEMPLATE used to create/modify styles • http://support.sas.com/rnd/base/topics/templateFAQ/Template.html • Output Delivery System: The Basics, Lauren E. Haworth, SAS Publishing, 2001 • Instant ODS: Style Templates for the SAS Output Delivery System, Bernadette Johnson, SAS Publishing, 2003 • Web Development with SAS by Example, Frederick E. Pratter, SAS Publishing, 2003
Graphics Options %MACRO gopts (x=1000,y=620); %* Establish std. Humana GOPTIONS.; GOPTIONS RESET=ALL; GOPTIONS DEVICE=GIF NOCHARACTERS GUNIT=PT AUTOSIZE=OFF BORDER CTEXT = BLUE CBACK = WHITE XPIXELS=&x YPIXELS=&y HTEXT = 10 HTITLE = 16 COLORS=(BLACK RED GREEN BLUE PURPLE VIOLET ORANGE YELLOW PINK CYAN MAGENTA BROWN GOLD LIME GRAY LILAC MAROON SALMON TAN CREAM LTGRAY VILG /*vivid yellow green*/ VIG /*vivid green*/ STR /*strong red*/ MOOL /*moderate olive*/ VIB /*vivid blue*/ BIP /*brilliant purple*/ VIY /*vivid yellow*/ VIBG /*vivid bluish green*/ BIV /*brilliant violet*/ VIYPK /*vivid yellowish pink*/ VIRO); /*vivid reddish orange*/ %MEND gopts;
ODS LISTING CLOSE; %gopts; %odshtml (report=MSULP,graph=y,label=MSU Usage,title=GRAPH); TITLE1 COLOR=BLUE HEIGHT=14 'MSU Usage'; TITLE2 COLOR=BLUE HEIGHT=11 "&daydate"; FOOTNOTE1 JUSTIFY=LEFT COLOR=BLUE HEIGHT=8 FONT=SWISS 'Source: SMF/MICS DETAIL2.HARCPUnn Data'; SYMBOL1 COLOR=MAGENTA INTERPOL=JOIN HEIGHT=5 VALUE=DOT; SYMBOL2 COLOR=GREEN INTERPOL=JOIN HEIGHT=5 VALUE=DIAMOND; SYMBOL3 COLOR=ORANGE INTERPOL=JOIN WIDTH=2 VALUE=NONE; SYMBOL4 COLOR=RED INTERPOL=JOIN WIDTH=3 VALUE=NONE; AXIS1 LABEL=(ANGLE=90 HEIGHT=12 FONT=SWISSB 'MSU Consumption') VALUE=(FONT=SWISS HEIGHT=9); AXIS2 ORDER=('00:00:00'T TO '24:00:00'T BY '01:00:00'T) VALUE=(ANGLE=90 FONT=SWISS HEIGHT=9) LABEL=(FONT=SWISSB HEIGHT=12 'Time of Day'); LEGEND1 FRAME CBORDER=BLUE LABEL=NONE VALUE=(HEIGHT=8 FONT=SWISSB); PROC GPLOT DATA=lpar; PLOT (lparlac lparused lpardef lparmsu)*time / NAME='MSULP' DES='#BYVAL(lparname)' OVERLAY HAXIS=AXIS2 VAXIS=AXIS1 HMINOR=3 VMINOR=9 VZERO AUTOVREF LVREF=1 CVREF=BLUE CAXIS=BLUE CTEXT=BLUE LEGEND=LEGEND1; BY lparname; RUN; QUIT; ODS HTML CLOSE; ODS LISTING; /* fix stuff */ %fixhtml (report=MSULP); %bnote (report=MSULP,program=TSTGRAPH,title=MSU Usage Graphs); Generating a Graph
Graphics Web Page 1 http://mvs.humana.com/MVSDS/'RSR1413.CPCMXG2.HTML(MSULPF)'
SAS Generates Bad HTML for PDSE! <div class="branch"> <a name="ANCHOR"></a> <div> <div class="c"> <table frame="box" border="1px" bordercolor="#000000" cellspacing="1" cellpadding="0" bgcolor="#FFFFFF" summary="Page Layout"> <tr> <td> <div align="center"> <img alt="SYSA" src="'RSR1413.CPCMXG2.GIF(MSULP)'msulp.gif" border="0" class="c"> </div> </td> </tr> </table> </div> </div> <br> <p style="page-break-after: always;"><br></p><hr size="3"> <a name="ANCHOR1"></a> <div> <div class="c"> <table frame="box" border="1px" bordercolor="#000000" cellspacing="1" cellpadding="0" bgcolor="#FFFFFF" summary="Page Layout"> <tr> <td> <div align="center"> <img alt="SYSD" src="'RSR1413.CPCMXG2.GIF(MSULP)'msulp1.gif" border="0" class="c"> </div> </td> </tr> </table> </div> </div> <br> Patricia Wingfield’s paper presents a fix, code to scan and correct the error.
Colors • GIF defaults to Black, Red, Green, Blue, Cyan, Magenta, Gray, Pink, Orange, Brown, White • Broad spectrum of colors available • Specify the ones you want in GOPTIONS • http://support.sas.com/onlinedoc/913/getDoc/en/graphref.hlp/colors-specify-color.htm • http://ftp.sas.com/techsup/download/sample/graph/other-colors.html • Program to display a palette of colors - FULLPALT • Autolib member COLORMAC – Macros to custom define colors
FULLPALT - Output 16 pages of output, PC SAS
COLORMAC - Color Definition Macros • Define custom colors • Macro is in SAS Autolib • Contains many macros to help define colors • One line of source code is > 72 characters • Use the following code to load it: %LET OPT_S2= %SYSFUNC(GETOPTION(S2)); /* GET CURRENT S2= OPTION */ OPTIONS S2=0; /* RESET TO ZERO */ %INCLUDE 'SAS.AUTOLIB(COLORMAC)'; OPTIONS S2=&OPT_S2; /* RESTORE OPTION */ /* now you can invoke macros from COLORMAC member */ Thanks to Scott Barry – SBBWorks, Inc.
Heat Chart! Visualization of Performance Data – James Holtman, CMG2005 Used without permission
How Do You Make a Heat Chart? • 8 months of research and trial and error • Not a lot of documentation available • Weather temperature maps • Started with PROC GCONTOUR • Doesn’t work right • SAS problem • Tips and Tricks: Using SAS/Graph Effectively • A. Darrell Massengill, SAS • http://www2.sas.com/proceedings/sugi30/090-30.pdf • http://support.sas.com/rnd/papers/sugi30/sasgraph_src.zip - source code for graphs in paper
GCONTOUR Sample PROC GCONTOUR example 4.
GOPTIONS DEV=gif COLORS=(BWH /*bluish white*/ VPAB /*very pale blue*/ VLIB /*very light blue*/ LIB /*light blue*/ STB /*strong blue*/ PALG /*pale yellow green*/ LILG /*light yellow green*/ BILG /*brilliant yellow green*/ VILG /*vivid yellow green*/ GREEN %cns (light yellow) GOLD %cns (yellowish orange) ORANGE %cns (reddish orange) LIYPK /*Light yellowish pink*/ STYPK /*strong yellowish pink*/ VIYPK /*vivid yellowish pink*/ RED STR /*strong red*/ WHITE BLACK); Heat Range Colors The %cns macro is defined in the COLORMAC macro definitions. The best usage documentation is inside COLORMAC.
Building Heat Charts • Customized ranges for each chart requires a separate invocation of PROC GPLOT for each chart. • Build a macro to generate heat charts, customizing the axis's and legend (ranges) • Using PROC GPLOT • Assume each range is a separate line • Plotting 20 lines maximum • No connecting line between points
Code 1 Determine level PROC SUMMARY DATA=cpusage; VAR hwmsu; BY sysname; OUTPUT MAX(hwmsu)=maxhwmsu OUT=maxmsu; DATA cpusage2; MERGE cpusage maxmsu; BY sysname; level=INT(usedmsu/(maxhwmsu/20))+1; incr=maxhwmsu/20; *level=INT(usedmsu/ROUND(maxhwmsu/20))+1; IF level=21 THEN level=20;
Code 2 Graphics Setup FOOTNOTE1 JUSTIFY=LEFT COLOR=BLUE HEIGHT=8 FONT=SWISS 'Source: SMF/MICS DETAIL2.HARCPU99/WLMSEC99 Data'; AXIS1 LABEL=(HEIGHT=12 FONT=SWISSB 'Time of Day') ORDER=('00:00:00'T TO '24:00:00'T BY '1:00:00'T) MINOR=(NUMBER=3 COLOR=BLUE) MAJOR=(COLOR=BLUE) VALUE=(ANGLE=90 FONT=SWISS HEIGHT=9); AXIS2 VALUE=(FONT=SWISS HEIGHT=8) MAJOR=(COLOR=BLUE) ORDER=("&sdate"D TO "&edate"D) MINOR=NONE LABEL=(ANGLE=90 HEIGHT=12 FONT=SWISSB 'Date'); TITLE1 COLOR=BLUE HEIGHT=16 FONT=SWISSB 'Monthly Plot of MSU Usage'; TITLE2 COLOR=BLUE HEIGHT=14 FONT=SWISSB "For the Month of &month &year"; SYMBOL1 INTERPOL=NONE VALUE=U FONT=MARKER H=8.5; %MACRO lgnd; %DO i=1 %TO 20; &&lval&i %END; %MEND lgnd;
Code 3 %MACRO heat (system=); DATA plot2; SET cpusage2 END=eof; IF sysname=:"&system" THEN OUTPUT; IF eof THEN DO; date="&edate"D; time=.; sysname="&system"; DO level = 1 to 20; OUTPUT; END; END; DATA _NULL_; SET plot2; BY date; IF onetime THEN DO; RETAIN onetime 1; onetime=0; CALL SYMPUT('maxmsu',PUT(maxhwmsu,6.)); CALL SYMPUT('sysname',PUT(sysname,$4.)); incr=maxhwmsu/20; DO i = 1 to 20; CALL SYMPUT('lval'||LEFT(i), "'"||'< '||TRIM(LEFT(PUT(ROUND(i*incr),COMMA6.)))||"'"); END; END; RUN; Build Chart Macro
Code 4 LEGEND1 FRAME CBORDER=BLUE VALUE=(HEIGHT=9 FONT=SWISS %lgnd) LABEL=(HEIGHT=9 FONT=SWISSB 'Used HW MSUs'); TITLE3 COLOR=BLUE HEIGHT=12 FONT=SWISSB "&sysname"; %LET days=%SYSEVALF("&edate"D-"&sdate"D+1); %LET note=1; %IF &days<31 & &maxmsu<1000 %THEN %DO; %LET loop=%SYSEVALF(31-&days); %DO i=1 %TO &loop; %LET note=%EVAL(¬e+1); FOOTNOTE¬e FONT=SWISS HEIGHT=9 ' '; %END; %END; %IF &days<30 & &maxmsu>1000 %THEN %DO; %LET loop=%SYSEVALF(30-&days); %DO i=1 %TO &loop; %LET note=%EVAL(¬e+1); FOOTNOTE¬e FONT=SWISS HEIGHT=9 ' '; %END; %END;
Code 5 PROC GPLOT DATA=plot2; PLOT date*time=level / SKIPMISS AUTOVREF VZERO NAME='MHEAT' DES="&sysname" /*DES='#BYVAL(sysname)'*/ HAXIS=AXIS1 VAXIS=AXIS2 LVREF=1 CVREF=WHITE CAXIS=BLUE CTEXT=BLUE LEGEND=LEGEND1; RUN;QUIT; %IF ¬e>1 %THEN %DO; FOOTNOTE2; /*Remove extra footnotes */ %END; %MEND heat;
Code 6 ODS LISTING CLOSE; /* SYSA */ %heat (system=SYSA); /* SYSD */ ODS PROCLABEL=' '; %heat (system=SYSD); /* SYSF */ ODS PROCLABEL=' '; %heat (system=SYSF); /* SYSI */ ODS PROCLABEL=' '; %heat (system=SYSI); /* SYSS */ ODS PROCLABEL=' '; %heat (system=SYSS); /*wrap up*/ ODS HTML CLOSE; ODS LISTING; %fixhtml (report=MHEAT); %bnote (report=MHEAT,program=MHEAT); Invoke macro for each chart
Disk Code 1 drive= devaddr || '-' || volser; .... PROC SORT DATA=dvamax; BY sysname drive; DATA dvamax; RETAIN ricknum; SET dvamax; BY sysname drive; IF FIRST.sysname THEN ricknum=0; ricknum+1; .... %MACRO value; %DO i=1 %TO &tot; &&val&i %END; %MEND value; ....
Disk Code 2 DATA _NULL_; SET plot2 END=eof; BY ricknum; IF onetime THEN DO; RETAIN onetime 1; onetime=0; CALL SYMPUT('sysname',PUT(sysname,$4.)); incr=maxsscrt/20; DO i = 1 to 20; CALL SYMPUT('lval'||LEFT(i), "'"||'< '||TRIM(LEFT(PUT(ROUND(i*incr),COMMA6.)))||"'"); END; END; IF FIRST.ricknum THEN CALL SYMPUT('val'||LEFT(ricknum),"'"||TRIM(LEFT(drive))||"'"); IF eof THEN DO; CALL SYMPUT('tot',LEFT(ricknum)); END; RUN; ....
Disk Code 3 LEGEND1 FRAME CBORDER=BLUE VALUE=(HEIGHT=9 FONT=SWISS %lgnd) LABEL=(HEIGHT=9 FONT=SWISSB 'Start IOs per Second'); AXIS2 VALUE=(FONT=SWISS HEIGHT=8 %value) ORDER=(1 TO &tot BY 1) MINOR=NONE MAJOR=(COLOR=BLUE) LABEL=(ANGLE=90 HEIGHT=10 FONT=SWISSB 'Disk Drive'); .... Similar PROC GPLOT code goes here
X Axis code %MACRO xaxis; %DO i=1 %TO 124; &&laxis&i %END; %MEND xaxis; DATA _NULL_; DO i = 1 to 124; IF MOD(i,4) = 0 THEN DO; q=i/4; IF q>24 THEN q=q-24; CALL SYMPUT('laxis‘ || LEFT(i),"'“ || TRIM(LEFT(PUT(q,2.))) || "'"); END; ELSE CALL SYMPUT('laxis‘ || LEFT(i),"'“ || ' ‘ || "'"); END; AXIS2 ORDER=("&begxg"DT TO "&endx"DT BY '00:15:00'T) LABEL=(HEIGHT=10 FONT=SWISSB 'Time of Day') VALUE=(HEIGHT=7 FONT=SWISS %xaxis);
Next Steps • Templates • Migration to HFS • Keep refining heat range colors & ranges • Monthly & MTD views of various applications • WLM classes • CICS & DB2 transaction volumes • Daily – top 30 Transactions • Monthly & MTD usage patterns • Response time? • Temp/workspace usage? • Develop Crystal Reports code to do same for Wintel Servers
Thanks! • Patricia Wingfield • Scott Barry • Al Sherkow • James Holtman • Various SAS support people
Richard S. Ralston RRalston@humana.com Cyclotourist@bellsouth.net Contact info