From: lakia@ipact.com
Newsgroups: comp.os.vms
Subject: Re: Asynch. signal from VMS
Date: 24 Jul 92 17:23:04 CDT
Organization: IPACT, Valparaiso IN

In article <DB15A146AEA19B12@SCS.SLAC.STANFORD.EDU>, LEVITT@SLC.SLAC.STANFORD.EDU (Stevie Boy) writes:
> Does anyone know of a way to get some sort of asynchronous message from VMS
> when a file is written to a directory?
> 
> 
	You can turn on FAL$LOGGING and parse the resulting file.  The
following file is what we use for a PDP and other devices to direct
files to a printer on our VAX with diffrent forms.  The remote nodes
simply use the following command in DCL.

$COPY filename.ext  IPACT"RUNOFF"::filename.form

Where form is:  LM5 (portrait left margin 5)
		80  (portrait normal 80 character)
		LM5S (portrait left margin 5, 132 characters)
		  (you get the idea)

This is the actual login.com command file for the runoff
account on our VAX.  Note we use a lot of RUNOFF files from
old PDP systems too, we actually do the runoff and print the
resulting MEM file.

$!
$! File:  LOGIN.COM (user: RUNOFF)
$! Author:  Earl D. Lakia (IPACT)
$! Date of Last update:  16-NOV-1991
$!
$! Abstract:
$!
$! This account is designed to be used for remote runoff requests.
$!
$!
$IF F$MODE() .NES. "NETWORK" THEN GOTO INTER
$!
$! This command procedure is used to do a runoff of a file
$! sent from anywhere from the network.  In particular, 
$! this was written to get execute this from the non-vax
$! nodes.
$!
$! First turn on FAL logging, redirect sys$output, and
$! run FAL to recieve the file.
$!
$ DEFINE FAL$LOG 1
$ PID=F$PID(CONTEXT)  ! FIND OUT OUR PID
$ NAME= "TEMP"+PID+".LOG;"
$ OPEN/WRITE/ERROR=ERRR FLL 'NAME'
$ define netserver$timeout "0 0:0:0"
$ ASSIGN FLL SYS$OUTPUT
$!
$! Finally get the runoff or listing file
$!
$ RUN SYS$SYSTEM:FAL.EXE
$ CLOSE FLL
$ ASSIGN SYS$ERROR SYS$OUTPUT
$!
$! Now scan our temporary file FLL and get the file
$! that was just copied.
$!
$ OPEN/READ FLL 'NAME'
$ FIND:
$ READ/END_OF_FILE=DONE FLL REC
$ SIZE=F$LENGTH(REC)
$ IF SIZE .EQ. 0 THEN GOTO FIND
$ GET =F$LOCATE("Resultant file: ",REC)
$ IF GET .EQ. SIZE THEN GOTO FIND
$ SET VERIFY
$ ENDS=GET+16
$ LFS= SIZE-ENDS
$ INFILE=  F$EXTRACT(ENDS,LFS,REC)
$!
$! infile is our runoff, or print file 
$!
$SHOW SYM INFILE
$ TYPE =F$PARSE(INFILE,,,"TYPE")
$ IF TYPE .EQS. ".RNO" THEN GOTO RNOFIL
$ IF F$LENGTH(TYPE) .LT. 6 THEN GOTO OLDWAY
$ TYPE =F$EXTRACT(4,3, TYPE)
$SHOW SYM TYPE
$ LFS =F$LOCATE(";",INFILE) - 3
$OLDWAY:
$ OUTFILE =F$EXTRACT(0,LFS,INFILE)
$SHOW SYM OUTFILE
$ RENAME 'INFILE' 'OUTFILE'
$ SHOW SYM TYPE
$ IF TYPE .EQS. "132" THEN GOTO LST132
$ IF TYPE .EQS. "H32" THEN GOTO LSTH32
$ IF TYPE .EQS. "080" THEN GOTO LST080
$ IF TYPE .EQS. "H80" THEN GOTO LSTH80
$ IF TYPE .EQS. "LM5" THEN GOTO LSTLM5
$ IF TYPE .EQS. "L5S" THEN GOTO LSTL5S
$ IF TYPE .EQS. ".132" THEN GOTO LST132
$ IF TYPE .EQS. ".H32" THEN GOTO LSTH32
$ IF TYPE .EQS. ".080" THEN GOTO LST080
$ IF TYPE .EQS. ".H80" THEN GOTO LSTH80
$ IF TYPE .EQS. ".LM5" THEN GOTO LSTLM5
$ IF TYPE .EQS. ".L5S" THEN GOTO LSTL5S
$ PRINT/delete 'OUTFILE'
$ GOTO FIND
$!
$! Runoff file
$!
$RNOFIL:
$RUNOFF 'INFILE'
$LISTFILE= F$PARSE(INFILE,,,"NAME")
$PRINT/DELETE 'LISTFILE'.MEM
$DELETE 'INFILE'
$GOTO FIND
$!
$! 132 Character listing
$!
$LST132:
$PRINT/delete/form=land 'OUTFILE'
$GOTO FIND
$!
$! 132 Character listing
$!
$LSTH32:
$PRINT/delete/form=lm5s/header 'OUTFILE'
$GOTO FIND
$!
$! 80 Character listing
$!
$LST080:
$PRINT/delete 'OUTFILE'
$GOTO FIND
$!
$! 80 Character listing with header switch
$!
$LSTH80:
$PRINT/delete/form=lm5/header 'OUTFILE'
$GOTO FIND
$!
$! Output left margin five
$!
$LSTLM5:
$PRINT/delete/FORM=LM5 'OUTFILE'
$GOTO FIND
$!
$! Output left margin five 132 characters compressed print
$!
$LSTL5S:
$PRINT/delete/FORM=LM5S 'OUTFILE'
$GOTO FIND
$!
$! no more files
$!
$ DONE:
$ CLOSE FLL
$ DELETE 'NAME'
$ PURGE NETSERVER.LOG/KEEP=3
$ exit
$ERRR:
$ EXIT
$INTER: