Report expired calendars in Workload Scheduler

Sometimes your IBM Workload Scheduler job streams suddenly quit running. Maybe it's because the calendars that are used to schedule them have no future dates in them.

This short shell script (run as the "tws user") shows a list of calendars that have no future days, the last date contained in the calendar, and which job streams refer to the calendar.

#!/bin/sh
# Print a list of job streams using expired calendars
# Assumes you have "composer" and "datecalc" in your PATH
TODAY=`datecalc today pic mm/dd/yyyy`
echo "Expired calendar report for $TODAY"
for c in `composer 'list calendars' | awk '/^IBM/,/---/ { next } /^AWSBIA291I/ {next} {print $1}'`
do
  datecalc today + 1 $c >/dev/null 2>&1
  RC=$?
  if [ $RC -ne 0 ]
  then
    EXPIRED=`datecalc today - nearest $c pic MM/DD/YYYY`
    echo " "
    echo "Job streams using calendar $c (expired $EXPIRED)"
    echo " "
    composer 'list js=@#@;filter calendar='$c | awk '/^IBM/,/^ $/ {next} {print}'
  fi
done

When you run the script, it looks like this.

 ./expired_calendars
Expired calendar report for 11/19/2015
Job streams using calendar ASNEEDED (expired 01/01/2014)
Workstation       Job Stream Name   Valid From  Updated On  Locked By
----------------  ----------------  ----------  ----------  ----------------
SLA_POOL          SX7ATL_001        -           11/19/2015  -
AWSBIA291I Total objects: 1 

Job streams using calendar HEBREW (expired 08/05/2014)
AWSJCL017W No objects have been found that match the criteria in the command.
AWSBIA287W Total warnings: 1.

Job streams using calendar OUTAGE (expired 07/06/2014)

AWSJCL017W No objects have been found that match the criteria in the command.
AWSBIA287W Total warnings: 1.
Tags: