15 pts.
 Check expiry date of tape (using iSeries and BRMS)
I am chasing a simple CL program to check if the currently loaded tape has the data as *expired so it can be written to under BRMS. It shouldn't be that hard but I've searched for literally days and can't find anyone to help.

Software/Hardware used:
ASKED: February 11, 2009  12:52 AM
UPDATED: February 13, 2009  3:58 AM

Answer Wiki:
I'm not sure if there's a better solution with BRMS since I haven't used it, but here's a quick off the cuff idea - You could direct the output of the DSPTAP command to an output file, and then read that file in the CL to see what the expiration date of the file(s) on the tape is - then you could proceed accordingly. CWC ----------------------------------- First off - BRMS woun't use the volume if it is not expired.. If you are running a library, you just need to make sure you have expired tapes in the lib.. But, if you really want to check the BRMS database - <b>QUSRBRM / QA1AMM</b> is the file you probably want to look at.. Select records where the "Vault" is your tape device and that should give you what you want.. Regards Mike
Last Wiki Answer Submitted:  February 11, 2009  6:49 pm  by  Cwc   4,275 pts.
All Answer Wiki Contributors:  Cwc   4,275 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Thanks for the responses.
Unfortunately BRMS tags ALL files as *perm expiry and keeps track of the tape expiration date in the file QUSRBRM/QAIAMM. This means that a DSPTAP can’t display the expiry date.
I thought about writing to the tape to verify it could accept data. The problem was that you had to add at least one day the the current retention date effectively un-expiring the tape.
I did manage to build a solution – thanks to other contributers who snippets of code I borrowed.

/* Run a query over file QAIAMM and extract a list of all BRMS media with */

/* expired flag = Y. Insert each Vol_id into file BRMSEXP. Get the Vol-id */

/* of the currently loaded tape and compare to each Vol_id in file BRMSEXP */

/* If no match is found then the media is not expired so generate an error */

PGM

DCL VAR(&VOLNAME) TYPE(*CHAR) LEN(6)

DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(300)

DCL VAR(&MSGID) TYPE(*CHAR) LEN(7)

DCL VAR(&REPLY) TYPE(*CHAR) LEN(1)

DCLF FILE(GARRYS/BRMSEXP)

/* Query BRMS file QA1AMM to load new file BRMSEXP with vol-ids of exp media */

RUNQRY QRY(GARRYS/BRMSEXP) QRYFILE((*SAME))

/* Get Vol_id of currently loaded tape on TAP01 */

CHKTAP DEV(TAP01)

RCVMSG MSGTYPE(*LAST) RMV(*NO) MSGDTA(&MSGDTA) MSGID(&MSGID)

IF (&MSGID *NE ‘CPC6778′) THEN(DO)

SNDPGMMSG MSGID(CPF9897) MSGF(QCPFMSG) +

MSGDTA(‘Unable to retrieve Volume_Id!’)

ENDDO

CHGVAR VAR(&VOLNAME) VALUE(%SST(&MSGDTA 11 6))

/* Compare Currently loaded Vol_id to list of BRMS expired media */

LOOP: RCVF

MONMSG MSGID(CPF0864) EXEC(GOTO EOF)

IF (&TMCVSR *EQ &VOLNAME) DO

SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA+

(‘Loaded volume ‘ *CAT &TMCVSR *CAT ‘is Expired’) +

TOUSR(*SYSOPR) MSGTYPE(*INFO)

GOTO END

ENDDO

GOTO LOOP

EOF: SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA(‘Tape loaded +

is NOT expired – Action required!’) +

TOUSR(*SYSOPR) MSGTYPE(*INQ)

END: ENDPGM

 15 pts.