[Info-vax] how to do a search for just today's info

Stephen Hoffman seaohveh at hoffmanlabs.invalid
Wed Jan 28 13:44:43 EST 2015


On 2015-01-28 17:59:51 +0000, pcoviello at gmail.com said:

> I have a constantly growing log file.
> 
> I put together a command procedure to do 2 searches, I need to have the 
> second search only for what is new or what is only today.
> 
> here is the first search
> 
> 01/21/15-01:09:49:245 (20f4e4b7) 0 Starting Expansion for database 
> _DSA316:[CACHESYS.APL.GBDEBT28K]. 2000 MB requested.
> 01/21/15-10:41:23:539 (20f4e4b7) 0 Starting Expansion for database 
> _DSA310:[CACHESYS.SUBCOM]. 1000 MB requested.
> 01/22/15-10:59:40:048 (20f4e4b7) 0 Starting Expansion for database 
> _DSA304:[CACHESYS.PL.GBDEBT68K]. 5000 MB requested.
> 01/25/15-15:42:22:716 (20f4e4b7) 0 Starting Expansion for database 
> _DSA317:[CACHESYS.CABLE.GBDEBT38K]. 5000 MB requested.
> 01/27/15-09:44:10:310 (20f4e4b7) 0 Starting Expansion for database 
> _DSA311:[CACHESYS.CJVA1]. 1000 MB requested.
> 
> 
> in this case I would not see any today. I'll be running this 24/7 and 
> 30 minute intervals
> 
> $ TIME_STAMP=F$TIME()
> $ TODAY=F$TIME()
> $!
> $ sea cachesys:cconsole.log "expansion for"/out=sys$scratch:cconsole.TMP
> $!
> $ if time_stamp .eqs. today
> $ then goto NEXT
> $ NEXT:
> $ Search sys$scratch:cconsole.tmp today /out=temp:cconsole_log.TXT
> $ IF F$FILE_ATTRIBUTES("temp:cconsole_log.txt","EOF") .EQ. 0 THEN GOTO EXIT
> $  mail/subject="***** CACHE Monitor *****" temp:cconsole_log.TXT 
> "pcoviello at someplace.com"
> $ DELETE SYS$SCRATCH:cconsole.tmp;*
> $ DELETE temp:cconsole_log.txt;*
> $ EXIT:
> FACS1>

So to try to summarize the question here as I (mis?)understand it, the 
Caché discussion and the posted search procedure can be ignored, and it 
appears that you're looking for some help with a DCL SEARCH command 
that can find today's date within within the specified-format data?

OK.  If those assumptions of mine are correct, then this should get you 
close to where you want:

$ slashes = f$cvtime(,,"MONTH") + "/" + f$cvtime(,,"DAY") + "/" + 
f$extract(2,2,f$cvtime(,,"YEAR"))
$ show symbol slashes
  SLASHES = "01/28/15"
$

This probably used with something like the following command:

$ PIPE SEARCH sys$scratch:cconsole.tmp today | search sys$pipe 
"''slashes'" /output=sys$scratch:cconsole-today.tmp

If you're using a crappy font, that's a vertical bar in there, and then 
there's a double quote, and two single quotes, the symbolname slash, a 
single quote, and a double quote.

The quoting is used as DCL treats the slash as a special character.

#########

Comments and FWIW...

1: if you're going to obfuscate your domain, please consider using the 
RFC-reserved example.com domain, and not a real and registered domain 
like someplace.com.
2: using two-digit years fried more than a few folks just a little over 
fifteen years ago; Y2K.  Best to avoid that.
3: consider rotating the logs on a daily basis?  Ever-growing logs are 
easier to manage and to archive when they're consistently managed and 
restarted.
4: DCL is somewhat gnarly, and what I'd consider the best book on the 
subject is out of print, but there's the user's guide, the DCL 
dictionary, and a whole lot of previous discussions around the 'net, 
and particularly in the comp.os.vms archives.  If you're interested in 
learning more about DCL, that is.
5: the above solution completely ignores timezones, and also ignores 
whether whether you need to look for, say, yesterday's data.  Yesterday 
is pretty easy to find automatically, though.  Something like this:
slashes = f$cvtime("YESTERDAY",,"MONTH") + "/" + 
f$cvtime("YESTERDAY",,"DAY") + "/" + 
f$extract(2,2,f$cvtime("YESTERDAY",,"YEAR"))
6: I'd probably use something similar to this same symbol processing 
and symbol substitution to insert the year, month and day — no slashes, 
of course — into the output filename, and probably also into the 
rotating log file filenames.
6: I'd probably spell out commands to at least four characters ("SEAR", 
not "SEA") and preferably to the full verbs or keyword names, as 
anything less than four characters risks colliding with some other 
current or future command.  As a rule of thumb, DCL verbs are usually 
unique to four characters; best to use at least that if not spelling 
out the commands within any command procedure.




-- 
Pure Personal Opinion | HoffmanLabs LLC




More information about the Info-vax mailing list