The Historical Statistical Facility (HSF) provides the ability to record statistics related to the time spent in a COBOL program and the time that parts of that program spent in CICS API commands/tasks, SQL operations and JCL jobsteps, as well as associated file and TSQ accesses.
The records contain information such as the ID of a user that initiates the task, the response time, and names of any files accessed.
Information is provided for the following resources:
Not entirely happy with the reporting capability provided “Out of the box”, I banged this together to appease the management gods.
Script executed after Online region is brought down each night via Control-M.
Does the following;
#!/bin/bash``#``#AUTHOR: Alister Jupp``#SCRIPT: hsfReport.sh``#PURPOSE: Determine Average, Min, Max Response Times``#``smtp_address=smtp.xxxx``to_address=xxxxx``function init {``starttime=$(date +%s)``echo ``"**** Let the process begin ****"``#Get first character of hostname to determine region name``x=$(echohostname| cut -c1 | tr ``'[:lower:]' '[:upper:]'``)``rundate=$(date +%Y%m%d)``rundatex=$(date +%d-%m-%Y)``spoon=``'Min/Max/Avg figures quoted are in hundredths of a second.'``dontreply=``'This is an system generated email. Please do not reply to this email as responses will not be actioned.'``rm tempfile.csv``rm cicsAwk.tmp``#Copy to temp file``cp /var/mfcobol/es/``"ICCICS${x}1"``/cashsf-a.csv tempfile.csv``jobrc=``0``#Test that all the required vars have been set.``i=``0``for var in smtp_address to_address ; ``do`` ``if [ ! ``"${!var:-}" ] ; then`` ``echo ``"$var is not set"`` ``((i++))`` ``fi``done``if [ $i -eq ``0 ] ; then`` ``echo ``"**** All variables have been set. Continue."``else`` ``echo ``"**** Error in config - variables not set"`` ``jobrc=``4``fi``}``function emailServiceDesk {`` ``echo ``"**** Send Email to Service Desk"`` ``subject=``"Enterprise Server ICCICS${x}1 Stats Report: $rundatex"`` ``echo ``" " >> cicsAwk.tmp`` ``echo $spoon >> cicsAwk.tmp`` ``echo ``" " >> cicsAwk.tmp`` ``echo $dontreply >> cicsAwk.tmp`` ``cat cicsAwk.tmp | /bin/mail -S smtp=$smtp_address -s ``"$subject" -r ``"[email protected]" $to_address``}``###### Shall we play a game?``echo ``"Shall we play a game?"``# Start - Initialise``init``# Call awk script to sum, count and calc figures``echo ``"**** Count and Sum Transactions"``awk -f cicsStats.awk tempfile.csv > cicsAwk.tmp ``jobrc=$?``#Email Service Desk``if [ $jobrc -eq ``0 ] ; then`` ``emailServiceDesk`` ``jobrc=$?``fi``# End``if [ $jobrc -eq ``0 ] ; then`` ``echo ``"**** CICS Stats Report Complete ****"``else`` ``echo ``"**** CICS Stats Report Failed! ****"``fi``endtime=$(date +%s)``duration=$(($endtime - $starttime))``echo ``"Finished at : " date```echo"Elapsed time: "``date -d ``"1970-1-1 0:00 $duration seconds" "+%H:%M:%S"`````exit $jobrc
#``#AUTHOR: Alister Jupp``#SCRIPT: cicsStats.awk``#PURPOSE: Process the HSF file to get min, max and averages``# ``BEGIN {`` ``FS=``""*,"*"``;`` ``min=``10``;`` ``wmin=``10``;`` ``}``$``1 == ``"CICS" `{ x=$10+$11 { sum+=x count+=1 if(x>max) { max=x }; if(xwmax) { wmax=x }; if``(x