?TACL ROUTINE #FRAME #PUSH jehutils { The volume.subvol of the MCGUTILS library. } #PUSH process { The process name used during various processing stages.} #PUSH term { The hometerm for processes. } #PUSH date^start { The date specified in YYMMDD format. } #PUSH time^start { The time specified in HHMMSS format. } #PUSH date^time^start { The specified start date and time with century. } #PUSH date^time^end { The specified end date and time with century. } #PUSH date^end { The end date for retrieving data. } #PUSH time^end { The end time for retrieving data. } #PUSH period { The period specified. } #PUSH interval { The interval specified. } #PUSH command { The JLIST command. } #PUSH template^stack { A stack of templates containing log files to search. } #PUSH file^stack { A stack of log files to search. } #PUSH file { A file name. } #PUSH eof { The EOF of a file. } #PUSH rec { A record number in the file. Records start with 1. } #PUSH rec^low { The starting record we examine in a file. } #PUSH rec^high { The ending record we examine in a file. } #PUSH rec^len { The record length of a single record in a log file. } #PUSH stack { A work stack. } #PUSH date^col { The column in the log record where the date begins. } #PUSH date^time { The date and time for any arbitrary record in the file.} #PUSH date^time^1st { The date and time of the 1st record in the file. } #PUSH date^time^last { The date and time of the last record in the file. } #PUSH key { The current key. } #PUSH key^start { Low key in a range. } #PUSH key^end { High key in a range. } #PUSH trace^y^n { Used for debugging this routine. } =============================================================================== #SET jehutils $DISK1.MCGUTILS #SET term $NULL #SET rec^len 159 #SET date^col 83 #APPEND template^stack $DISK1.MCGDATA.VTERMLOG #APPEND template^stack $DISK1.VTERMLOG.F* =============================================================================== [#DEF display^help MACRO |BODY| #OUTPUT #OUTPUT VTERMLOG routine. #OUTPUT #OUTPUT Displays data from a series of VTERM log files starting at the #OUTPUT user specified date and time, continuing for the time period #OUTPUT specified, with optional JLIST commands applied. #OUTPUT #OUTPUT & FORMAT: VTERMLOG ~[JLIST ~] #OUTPUT EXAMPLE: VTERMLOG 990413 110000 5 minutes #OUTPUT EXAMPLE: VTERMLOG 990413 110000 5 minutes wh = "AB" #OUTPUT #OUTPUT #OUTPUT The start date. #OUTPUT The start time. #OUTPUT The number of time periods. #OUTPUT Minutes, Hours, Days, or Months. #OUTPUT ] [#DEF STOPPROC ROUTINE |BODY| #FRAME #PUSH #BREAKMODE #SET #BREAKMODE DISABLE #PUSH process [#CASE [#ARGUMENT/TEXT process/PROCESSNAME TEXT END] |1| SINK [#STOP [process]] |OTHERWISE| ] #UNFRAME ] [#DEF clean ROUTINE |BODY| #FILTER _ERROR [#CASE [#EXCEPTION] |_CALL| STOPPROC [process] :utils.1:dp:undp * |_ERROR| #OUTPUT Severe error. #PUSH error^text #ERRORTEXT/CAPTURE error^text/ OUTVAR error^text #POP error^text #RESET FRAMES #RETURN ] ] { Epands to the date-time for the current value of KEY } [#DEF record^date^time ROUTINE |BODY| #SET stack JL/OUTV stack/[file],COUNT 1,NOTARG,RECIN [rec^len],KEY [key] #LINEJOIN stack 1 #RESULT & [#CHARGET stack [date^col] FOR 4]& { year } { continued }[#CHARGET stack [#COMPUTE [date^col]+5] FOR 2]& { month } { continued }[#CHARGET stack [#COMPUTE [date^col]+8] FOR 2]& { day } { continued }[#CHARGET stack [#COMPUTE [date^col]+11] FOR 2]& { hour } { continued }[#CHARGET stack [#COMPUTE [date^col]+14] FOR 2]& { minute } { continued }[#CHARGET stack [#COMPUTE [date^col]+17] FOR 2] { second } ] { Date and time of 1st record in the file } [#DEF get^date^time^1st^rec MACRO |BODY| #SET key 0 #SET date^time^1st [record^date^time] ] { Date and time of last record in the file } [#DEF get^date^time^last^rec MACRO |BODY| #SET key [#COMPUTE [eof] - [rec^len]] #SET date^time^last [record^date^time] ] [#DEF check^file ROUTINE |BODY| SINK [#ARGUMENT/VALUE file/FILENAME] #OUTPUT [file] ... #SET eof [#FILEINFO/EOF/[file]] [#IF [eof] |THEN| |ELSE| #RETURN { no data in the file } ] get^date^time^1st^rec get^date^time^last^rec { First record in file is past our end date? } [#IF date^time^1st > date^time^end |THEN| #RETURN ] { Last record in file is before our start date? } [#IF date^time^last < date^time^start |THEN| #RETURN ] { The file spans a time period within our date/time range } #APPENDV file^stack file ] [#DEF build^file^stack MACRO |BODY| [#LOOP |WHILE| NOT [#EMPTYV/BLANK/template^stack] |DO| [mcgutils].TEMPLATE check^file [#EXTRACT template^stack] ] ] { Edit the entries, add century, combine date and time together } [#DEF process^date^time MACRO |BODY| [#IF [[mcgutils].DATEEDIT [date^start]] |THEN| #OUTPUT Invalid date: [date^start] #OUTPUT Date must be in YYMMDD format. #RETURN ] [#IF [[mcgutils].TIMEEDIT [time^start]] |THEN| #OUTPUT Invalid time: [time^start] #OUTPUT Time must be in HHMMSS format. #RETURN ] #SET date^end & [[mcgutils].DATETIME [date^start] [time^start] [interval] [period]] [#IF [#EMPTYV/BLANK/date^end] |THEN| #RETURN ] #SET time^end [#CHARGET date^end 8 FOR 6] #SET date^end [#CHARGET date^end 1 FOR 6] { Add century } [#IF date^start < 900000 |THEN| #SET date^start 20[date^start] |ELSE| #SET date^start 19[date^start] ] [#IF date^end < 900000 |THEN| #SET date^end 20[date^end] |ELSE| #SET date^end 19[date^end] ] #SET date^time^start [date^start][time^start] #SET date^time^end [date^end][time^end] ] [#DEF determine^start^key ROUTINE |BODY| #SET rec^low 1 #SET rec^high [#COMPUTE eof / rec^len] [#LOOP |WHILE| -1 |DO| #SET rec [#COMPUTE (rec^low + rec^high)/2] [#IF rec = rec^low |THEN| { If our record is before the time specified, go to next } #SET key [#COMPUTE (rec - 1) * rec^len] #SET date^time [record^date^time] [#IF date^time < date^time^start |THEN| #SET rec [#COMPUTE rec + 1] ] #SET key^start [#COMPUTE (rec - 1) * rec^len] #RETURN ] #SET key [#COMPUTE (rec - 1) * rec^len] #SET date^time [record^date^time] [#IF date^time >= date^time^start |THEN| #SETV rec^high rec ] [#IF date^time < date^time^start |THEN| #SETV rec^low rec ] ] ] [#DEF determine^end^key ROUTINE |BODY| #SET rec^low [#COMPUTE (key^start / rec^len) + 1] #SET rec^high [#COMPUTE eof / rec^len] [#LOOP |WHILE| -1 |DO| #SET rec [#COMPUTE (rec^low + rec^high + 1)/2] [#IF rec = rec^high |THEN| { If our record is after the time specified, go to previous } #SET key [#COMPUTE (rec - 1) * rec^len] #SET date^time [record^date^time] [#IF date^time > date^time^end |THEN| #SET rec [#COMPUTE rec - 1] ] #SET key^end [#COMPUTE (rec - 1) * rec^len] #RETURN ] #SET key [#COMPUTE (rec - 1) * rec^len] #SET date^time [record^date^time] [#IF date^time > date^time^end |THEN| #SETV rec^high rec ] [#IF date^time <= date^time^end |THEN| #SETV rec^low rec ] ] ] [#DEF process^file MACRO |BODY| #SET key^start 0 #SET eof [#FILEINFO/EOF/[file]] get^date^time^1st^rec [#IF date^time^1st < date^time^start |THEN| determine^start^key ] #SET key^end [#COMPUTE eof - rec^len] get^date^time^last^rec [#IF date^time^last > date^time^end |THEN| determine^end^key ] #OUTPUT & ------------------------------------------------------------------------------- #OUTPUT/HOLD/[file] #OUTPUT/HOLD,COLUMN 37/START: [key^start] #OUTPUT/HOLD,COLUMN 53/END: [key^end] #OUTPUT/ COLUMN 67/COUNT: [#COMPUTE (key^end-key^start)/rec^len+1] #OUTPUT & ------------------------------------------------------------------------------- JL [file],KEY [key^start],NOTARG,RECIN [rec^len],OUTSIZE 80,& COUNT [#COMPUTE (key^end-key^start)/rec^len+1],[command] ] [#DEF process^file^stack MACRO |BODY| [#LOOP |WHILE| NOT [#EMPTYV/BLANK/file^stack] |DO| #EXTRACTV file^stack file process^file ] ] [#DEF start^jlist MACRO |BODY| #SET process [#CREATEPROCESSNAME] DP [mcgutils].JLIST/PNAME JL,QUIET,TERM [term]/ ] [#DEF do^work MACRO |BODY| process^date^time start^jlist build^file^stack process^file^stack clean ] [#DEF do^work^filter ROUTINE |BODY| #FILTER _ERROR _BREAK [#CASE [#EXCEPTION] |_CALL| do^work |_ERROR| #OUTPUT Routine error! #PUSH error^text #ERRORTEXT/CAPTURE error^text/ OUTVAR error^text #POP error^text clean #RESET FRAMES #RETURN |_BREAK| #OUTPUT detected. clean #RESET FRAMES #RETURN |OTHERWISE| #OUTPUT Otherwise!!?? ] ] [#CASE [#ARGUMENT/TEXT date^start/NUMBER END] |1| SINK [#ARGUMENT/TEXT time^start/NUMBER] SINK [#ARGUMENT/TEXT interval/NUMBER] SINK [#ARGUMENT/TEXT period/ KEYWORD/WORDLIST MINUTE MINUTES HOUR HOURS DAY DAYS MONTH MONTHS/] SINK [#ARGUMENT/TEXT command/TEXT END] do^work^filter |2| display^help ] #UNFRAME