ADSM-L

Re: A macro with background processes?

1997-12-17 17:30:35
Subject: Re: A macro with background processes?
From: "Nicholas, Murray, Haltek/AU" <MurrayNi AT HALTEK.COM DOT AU>
Date: Thu, 18 Dec 1997 09:30:35 +1100
Ingo,

I wrote three little bat and rexx files to start a dbbackup and wait
for it to complete.  These were for an NT platform but the concept
will work anywhere if you like to develop the following:

ADSMDBBKUP.REX
First program is a REXX exec to ask the operator which pre-labeled db
backup tape to use.  In my case I also want the operator to insert a
correspondingly labeled 3.5inch floppy in drive a: for the volhist and
devconfig file backups afterwards.  For simplicity, I gave the
operators an icon which simply runs this REXX to drive everything
else.  If you don't know REXX, these three lines simply put the
question on the screen and read the answer into a variable called
tapevol then invoke the .bat file with "tapevol" as a parameter.

Say 'Which tape are you going to use to backup the ADSM database?'
parse external tapevol
adsmdbbkup.bat tapevol


ADSMDBBKUP.BAT
The part you are interested in here is the part which does the dsmadmc
..... backup db command.  This starts a background process and then
continues to the next command.  The next command in the .bat file is
an ADSM console session but the output of it, instead of going to the
screen, is redirected to the CONMON.REX REXX program which monitors
the ADSM console messages to detect the end of the backup db process.
 When the process ends, CONMON.REX kills the console monitor session
allowing the .bat file to continue with its next command.

:begin
rem
rem   Script assumes an ADSM DB Backup set will use a labelled tape
for the
rem   dbbackup and a correspondingly labelled diskette for the
volhist
rem   and devconfig backup.  The diskette label consists of a file on
the
rem   diskette with the same name as the dbbackup tape and a ".lbl"
tail.
rem
if exist a:\%1.lbl goto disk_ok
net send <sid>adm The %1 diskette is not mounted.
pause Please mount the diskette labelled %1 in the a: drive before
proceeding.
goto begin
:disk_ok
cd c:\win32app\ibm\adsm\saclient
rem
rem   Start the database backup
dsmadmc -id=admin -pass=adminpw backup db type=full dev=dltclass
vol=%1
rem
rem   Launch a console session but pipe the output to a console
monitor program
dsmadmc -id=admin -pass=adminpw -consolemode | rexx
c:\users\<sid>adm\conmon.rex
rem
rem   The above console session is killed by conmon.rex upon detection
of the
rem   completion of the dbbackup.  This script then continues and
backs up the
rem   updated volhist and devconfig files.
dsmadmc -id=admin -pass=adminpw backup volhistory file=a:\volhist.out
dsmadmc -id=admin -pass=adminpw backup devconfig  file=a:\devcnfg.out
dsmadmc -id=admin -pass=adminpw delete volhist type=dbb
todate=today-5
rem
rem   Now the backup and cleanup is complete, list current tapes in
all
rem   storage pools and ask the operator to move tapes from the
storage pool
rem   rack to the scratch rack if they have expired.
dsmadmc -id=admin -pass=adminpw q vol
pause Please move any tapes **NOT** in the above list to the scratch
pool.


CONMON.REX
This console monitoring program receives message lines from the ADSM
console session.  The parse statements extract one word for each "."
and ignore those but then set the next word into a variable which is
named in the parse statement.  E.g., In the first statement the
incoming message is seperated into two parts: variable msgno is set to
the value of the first word in the message and msgtext is set to
contain the rest.  When handling ANR2280I, the parse statement takes
the seventh word (after the six "."s) and makes that the value of
procstrt; the rest of the message text is discarded with the trailing
dot.  When messageANR4550I (db backup complete) is detected, this
program kills the DSMADMC.EXE task.  It has been suggested to me, and
I plan to implement it in future, that the .bat file above should copy
DSMADMC.EXE to some other name and that CONMON.REX should kill this
name to avoid the possibility of killing off some other ADSM
administrative task.

Say 'Console monitor started.'
Do forever
parse external msgno msgtext
        select
        When msgno = 'ANR2280I' then do
                parse value msgtext with . . . . . . procstrt .
                end
        When msgno = 'ANR1360I' then do
                parse value msgtext with . . bkupvol .
                end
        When msgno = 'ANR1361I' then do
                parse value msgtext with . . closedvol .
                end
        When msgno = 'ANR8326I' then do
                "net send <sid>adm" msgtext
                end
        When msgno = 'ANR4550I' then do
                parse value msgtext with . . . . procend . stats
                leave
                end
        Otherwise
        end /* select section */
end /* do forever     */
kill DSMADMC.EXE      /* Kill the adsm console monitor feeding this
REXX */
Say 'The backup started on ' bkupvol ' and ended on ' closedvol '.'


I hope this example is some help to you and you are able to solve your
problem.  Feel free to email me if you need any further clarification
on the design or workings of the three programs.

Murray Nicholas
IT Systems Consultant
Galeforce Information Services Pty Ltd
email:  murray AT galeforce.bu.aust DOT com


<Prev in Thread] Current Thread [Next in Thread>