home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
db22re.zip
/
MON_LOGS.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-03-09
|
7KB
|
174 lines
/*
┌──────────────────────────────────────────────────────────────────┐
│ Name : mon_logs.cmd │
│ Purpose : Monitor log files for FRDEMO │
│ Platform : DB2/2 │
│ Author : Jeff Fisher │
│ IBM Toronto Development Lab │
│ Disclaimer : This "sample" code is for demonstrations only, no │
│ warrenties are made or implied as to correct │
│ function. You should carefully test this code in │
│ your own environment before using it. │
│ │
└──────────────────────────────────────────────────────────────────┘
*/
call ProgramInitialize
call DIRlogs
call EndProg
DIRlogs:
/*
┌──────────────────────────────────────────────────────────────────┐
│ DIRlogs │
│ │
│ Do a DIR on the active log files - helps find out what logs │
│ are left/active. │
│ │
└──────────────────────────────────────────────────────────────────┘
*/
tod = time()
say c.yellow '---> Active log files at' tod c.itgreen
step = 'dir the LOG files'
address cmd 'dir d:\sql00002\sqlogdir\*.log'
if RC = 3 then
do
say c.itred
say c.itred '---> There are no log files at' tod
say c.itred
end
else
if RC \= 0 then signal ErrorRC
say c.itblue 'press <enter> to continue; <X> to end'
pull nullinput
if nullinput = 'X' then return
signal DIRlogs
EndProg:
/*
┌──────────────────────────────────────────────────────────────────┐
│ EndProg │
│ │
│ │
└──────────────────────────────────────────────────────────────────┘
*/
say c.reset
'exit'
ErrorRC:
/*
┌──────────────────────────────────────────────────────────────────┐
│ ErrorRC │
│ │
│ RC Error routine - handles CMD.EXE return code │
│ │
└──────────────────────────────────────────────────────────────────┘
*/
tod = time()
call beep 100,200
say c.itred
say ' >>> OS/2 has returned a fatal condition code'
say ' abending step = ' step
say ' source line = ' sourceline(sigl)
say ' time = ' tod
say ' RC = ' RC
say ' RESULT = ' RESULT
say
pause
signal EndProg
Error:
/*
┌──────────────────────────────────────────────────────────────────┐
│ Error │
│ │
│ Rexx Error handling routine │
│ │
└──────────────────────────────────────────────────────────────────┘
*/
tod = time()
call beep 220,1000
say c.itred
say ' >>> Rexx has returned a signal on error'
say ' abending step = ' step
say ' source line = ' sourceline(sigl)
say ' RC = ' RC
say ' time = ' tod
say
pause
signal EndProg
Syntax:
/*
┌──────────────────────────────────────────────────────────────────┐
│ Syntax │
│ │
│ Rexx Error handling routine │
│ │
└──────────────────────────────────────────────────────────────────┘
*/
call beep 220,1000
say c.itred
say ' >>> Rexx has returned a signal on syntax'
say ' abending step = ' step
say ' source line = ' sourceline(sigl)
say
pause
signal EndProg
ProgramInitialize:
/*
┌──────────────────────────────────────────────────────────────────┐
│ ProgramInitialize │
│ │
│ Setup all of the variables used in the program, also calls │
│ the SetColor routine to setup colors. │
│ │
└──────────────────────────────────────────────────────────────────┘
*/
address cmd '@ECHO OFF'
address cmd 'CLS'
call SetColor
return
SetColor:
/*
┌──────────────────────────────────────────────────────────────────┐
│ SetColor │
│ │
│ This paragragh sets the colors used in the program. │
│ │
└──────────────────────────────────────────────────────────────────┘
*/
ansii.esc = '1B'x
c.normal = ansii.esc || '[0m'
c.highlite = ansii.esc || '[1m'
c.blackback = ansii.esc || '[40m'
c.green = c.normal || ansii.esc || '[32m'
c.grey = c.normal || ansii.esc || '[37m'
c.red = c.normal || ansii.esc || '[31m'
c.itred = c.highlite || ansii.esc || '[31m'
c.itgreen = c.highlite || ansii.esc || '[32m'
c.yellow = c.highlite || ansii.esc || '[33m'
c.itblue = c.highlite || ansii.esc || '[34m'
c.itmagenta = c.highlite || ansii.esc || '[35m'
c.itcyan = c.highlite || ansii.esc || '[36m'
c.white = c.highlite || ansii.esc || '[37m'
c.std = c.normal || c.itcyan || c.blackback
c.reset = c.normal || c.grey || c.blackback
return 0