home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / db22re.zip / MON_LOGS.CMD < prev    next >
OS/2 REXX Batch file  |  1993-03-09  |  7KB  |  174 lines

  1. /*
  2.  ┌──────────────────────────────────────────────────────────────────┐
  3.  │  Name       : mon_logs.cmd                                       │
  4.  │  Purpose    : Monitor log files for FRDEMO                       │
  5.  │  Platform   : DB2/2                                              │
  6.  │  Author     : Jeff Fisher                                        │
  7.  │               IBM Toronto Development Lab                        │
  8.  │  Disclaimer : This "sample" code is for demonstrations only, no  │
  9.  │               warrenties are made or implied as to correct       │
  10.  │               function. You should carefully test this code in   │
  11.  │               your own environment before using it.              │
  12.  │                                                                  │
  13.  └──────────────────────────────────────────────────────────────────┘
  14. */
  15.  
  16. call ProgramInitialize
  17. call DIRlogs
  18. call EndProg
  19.  
  20. DIRlogs:
  21. /*
  22.  ┌──────────────────────────────────────────────────────────────────┐
  23.  │    DIRlogs                                                       │
  24.  │                                                                  │
  25.  │    Do a DIR on the active log files - helps find out what logs   │
  26.  │  are left/active.                                                │
  27.  │                                                                  │
  28.  └──────────────────────────────────────────────────────────────────┘
  29. */
  30.     tod = time()
  31.     say c.yellow  '---> Active log files at' tod c.itgreen
  32.  
  33.     step = 'dir the LOG files'
  34.     address cmd 'dir d:\sql00002\sqlogdir\*.log'
  35.     if RC = 3 then
  36.         do
  37.             say c.itred
  38.             say c.itred '---> There are no log files at' tod
  39.             say c.itred
  40.         end
  41.     else
  42.         if RC \= 0 then signal ErrorRC
  43.  
  44.     say c.itblue 'press <enter> to continue;  <X> to end'
  45.     pull nullinput
  46.     if nullinput = 'X' then return
  47.  
  48.     signal DIRlogs
  49.  
  50.  
  51.  
  52. EndProg:
  53. /*
  54.  ┌──────────────────────────────────────────────────────────────────┐
  55.  │    EndProg                                                       │
  56.  │                                                                  │
  57.  │                                                                  │
  58.  └──────────────────────────────────────────────────────────────────┘
  59. */
  60.     say c.reset
  61.  
  62.     'exit'
  63.  
  64.  
  65.  
  66.  
  67. ErrorRC:
  68. /*
  69.  ┌──────────────────────────────────────────────────────────────────┐
  70.  │    ErrorRC                                                       │
  71.  │                                                                  │
  72.  │    RC Error routine - handles CMD.EXE return code                │
  73.  │                                                                  │
  74.  └──────────────────────────────────────────────────────────────────┘
  75. */
  76.     tod = time()
  77.     call beep 100,200
  78.     say c.itred
  79.     say '        >>>  OS/2 has returned a fatal condition code'
  80.     say '             abending step = ' step
  81.     say '             source line   = ' sourceline(sigl)
  82.     say '                      time = ' tod
  83.     say '                        RC = ' RC
  84.     say '                    RESULT = ' RESULT
  85.     say
  86.     pause
  87.     signal EndProg
  88.  
  89.  
  90. Error:
  91. /*
  92.  ┌──────────────────────────────────────────────────────────────────┐
  93.  │    Error                                                         │
  94.  │                                                                  │
  95.  │    Rexx Error handling routine                                   │
  96.  │                                                                  │
  97.  └──────────────────────────────────────────────────────────────────┘
  98. */
  99.     tod = time()
  100.     call beep 220,1000
  101.     say c.itred
  102.     say '        >>>  Rexx has returned a signal on error'
  103.     say '             abending step = ' step
  104.     say '             source line   = ' sourceline(sigl)
  105.     say '                        RC = ' RC
  106.     say '                      time = ' tod
  107.     say
  108.     pause
  109.     signal EndProg
  110.  
  111.  
  112. Syntax:
  113. /*
  114.  ┌──────────────────────────────────────────────────────────────────┐
  115.  │    Syntax                                                        │
  116.  │                                                                  │
  117.  │    Rexx Error handling routine                                   │
  118.  │                                                                  │
  119.  └──────────────────────────────────────────────────────────────────┘
  120. */
  121.     call beep 220,1000
  122.     say c.itred
  123.     say '        >>>  Rexx has returned a signal on syntax'
  124.     say '             abending step = ' step
  125.     say '             source line   = ' sourceline(sigl)
  126.     say
  127.     pause
  128.     signal EndProg
  129.  
  130.  
  131. ProgramInitialize:
  132. /*
  133.  ┌──────────────────────────────────────────────────────────────────┐
  134.  │    ProgramInitialize                                             │
  135.  │                                                                  │
  136.  │    Setup all of the variables used in the program, also calls    │
  137.  │  the SetColor routine to setup colors.                           │
  138.  │                                                                  │
  139.  └──────────────────────────────────────────────────────────────────┘
  140. */
  141.     address cmd '@ECHO OFF'
  142.     address cmd 'CLS'
  143.     call SetColor
  144.  
  145.     return
  146.  
  147.  
  148. SetColor:
  149. /*
  150.  ┌──────────────────────────────────────────────────────────────────┐
  151.  │    SetColor                                                      │
  152.  │                                                                  │
  153.  │    This paragragh sets the colors used in the program.           │
  154.  │                                                                  │
  155.  └──────────────────────────────────────────────────────────────────┘
  156. */
  157.     ansii.esc      = '1B'x
  158.     c.normal       = ansii.esc || '[0m'
  159.     c.highlite     = ansii.esc || '[1m'
  160.     c.blackback    = ansii.esc || '[40m'
  161.     c.green        = c.normal || ansii.esc || '[32m'
  162.     c.grey         = c.normal || ansii.esc || '[37m'
  163.     c.red          = c.normal || ansii.esc || '[31m'
  164.     c.itred        = c.highlite || ansii.esc || '[31m'
  165.     c.itgreen      = c.highlite || ansii.esc || '[32m'
  166.     c.yellow       = c.highlite || ansii.esc || '[33m'
  167.     c.itblue       = c.highlite || ansii.esc || '[34m'
  168.     c.itmagenta    = c.highlite || ansii.esc || '[35m'
  169.     c.itcyan       = c.highlite || ansii.esc || '[36m'
  170.     c.white        = c.highlite || ansii.esc || '[37m'
  171.     c.std          = c.normal || c.itcyan || c.blackback
  172.     c.reset        = c.normal || c.grey || c.blackback
  173.     return 0
  174.