Need help updating my AIX shell script that uses IBM tape tool.

I have a shell script that interfaces with our tape library using IBM's Tape Diagnostic tool called "itdt".

The script does some basic stuff, it queries the tape library, loads tape to/from drive; it knows which inventory slot to pick the tape from based on SLOT=$(($BASESLOT + $TODAY)).

The problem is, this only ever interacts with the first 7 tapes in a 24 tape library because TODAY=`date +%w` is going to return values from 1-7 depending on the day of the week the script runs.

Using $TODAY is not ideal because it only ever loads/unloads the first 7 tapes in a 23 tape library.

Anyone able to give some pointers as to how I would update this script so that it fully utilizes all 23 tape slots. What other method could I use instead of..

Is that a 23 or 24 tape library? But, anyhow, 24 tape don't cover an entire month - what pattern do you want applied? Workdays? Continuous running days?