The MICS BATPGM file (also, it’s parallel / sibling files BAT_xx) are most often generated from SMF 30 subtype 2/3 (interval) records, with additional data-fields extracted from the SMF 30 subtype 4 and back-filled to BATPGM/BAT_xx in the last (termination-event) interval/observation. This situation can be verified with PROC FREQ against the MICS/SAS variable PGMINTVL, and review the MICS DICTIONARY info for PGMINTVL.
This condition creates a challenge at reporting-time when there is interest with reporting at the job-step execution summary (that being one detail report/row line per completed job-step), instead of reporting the MICS BATPGM detail / SMF-interval observations, which would likely be a mix of “nn” minute (SMFPRMxx member in your PARMLIB) interval records (where PGMINTVL=’SE22’) for longer-running jobs/tasks or step-termination records (PGMINTVL=’SE23’ and PGMCOUNT=1 conditions present).
The MICS/SAS reporting code below demonstrates how to create the job-step execution / completion summary observation, using key SAS variables: JOB RDRTS PGMSSTTS – where RDRTS is job-submit timestamp, PGMSSTTS is job-step execution start-timestamp (as compared to STARTTS which will be the interval start timestamp).
Productivity-Tip: When composing SAS batch jobstream code (or JCL jobstreams for that matter), consider activating ISPF EDIT/VIEW command “HILITE OTHER” for enhanced text/SAS statement display and interpretation on the screen - helps with desk-checking SAS code and/or JCL as well.
//STEP1 EXEC MICSSHR?
//SYSIN DD DATA,DLM=ZZ
OPTIONS SOURCE SOURCE2;
/* OPTIONS MGEN SGEN MPRINT; */
%LET CYCRANGE = 07-01;
/* SAS MACRO VARS BELOW REQUIRED FOR MICS FFFSUM MACRO */
%LET BY = JOB RDRTS PGMSSTTS;
%LET BREAK = %SCAN(&BY,-1,%STR( )); /* capture the last BY var */
/* WHERE input-side filter code goes here, if desired */
* WHERE PGMEXCTM GT 0; /* could only show executed steps */
/* USE CA-SUPPLIED MACRO FOR GENERATING SET STMT */
/* NOW SORT AND SUMMARIZE TO ONE OBS PER STEP-EXECUTION */
PROC SORT DATA=BATPGM;
/* OPTIONAL MICS-INVOKED MACRO FOR USER VARIABLE */
/* CALCULATIONS/DERIVATION. INVOKED WITHIN FFFSUM */
/* MACRO JUST PRIOR TO OUTPUT. */
/* CONSOLIDATE PROC-STEP AND JOB-STEP INFO INTO ONE VAR */
LENGTH STEPINFO $17;
STEPINFO = CATX('/',PGMPSNAM,STEPNAME);
/* Setup SAS numeric variable length definitions larger, */
/* also define FORMATs and LABELs if ESSENTIAL database */
/* with DERIVE COMPUTE. */
%MACRO NEGATE; %MEND NEGATE; /* RESET MACRO CONTENT AS HABIT */
/* YOUR REPORTING CODE GOES HERE – sample below. */
PROC PRINT U LABEL NOOBS DATA=BATPGM;
VAR SYSID JOB RDRTS JESJOBNO STEPINFO STEPNUM TERMCODE
PGMTCBSU PGMSRBSU PGMSERVU PGMEDASD PGMETAPE
PGMSYSAB PGMUSRAB PGMEXCTM PGMSSTTS ENDTS;
TITLE 'BATCH JOB-STEP EXECUTION SUMMARY STATS';