F$GETQUI("DISPLAY_JOB","LOG_SPECIFICATION",,"THIS_JOB")

F$GETQUI("DISPLAY_JOB","LOG_SPECIFICATION",,"THIS_JOB")

Post by Terry Marosite » Sat, 05 Aug 2000 04:00:00



Hello all,

   I want to mail the log file to a user if the a job fails.
I can't seem to get the lexical to work. Below is a snippet
from the log. I know it has to be something simple :)
TIA
Terry

$ JNAME = F$GETQUI("DISPLAY_JOB","JOB_NAME",,"THIS_JOB")
$ JPID  = F$GETQUI("DISPLAY_JOB","JOB_PID",,"THIS_JOB")
$ WRITE SYS$OUTPUT "JNAME = TEST_OF_GETQUI , JPID = 00025C66"
JNAME = TEST_OF_GETQUI , JPID = 00025C66
$!
$ JLOG  = F$GETQUI("DISPLAY_JOB","LOG_SPECIFICATION",,"THIS_JOB")
$ WRITE SYS$OUTPUT "JLOG= ||"
JLOG= ||
$!

*****************************************************

*****************************************************
Any views or opinions are solely those of the author
and do not necessarily represent those of
United Advertising Media.
*****************************************************
The information transmitted is intended only for the
person or entity to which it is addressed and may
contain confidential and/or privileged material. If
you are not the intended recipient of this message,
please do not read, copy, use or disclose this
communication and notify the sender immediately. It
should be noted that any review, retransmission,
dissemination or other use of, or taking action in
reliance upon, this information by persons or
entities other than the intended recipient is
prohibited.
*****************************************************
**

 
 
 

F$GETQUI("DISPLAY_JOB","LOG_SPECIFICATION",,"THIS_JOB")

Post by David J. Dachter » Sat, 05 Aug 2000 04:00:00



> Hello all,

>    I want to mail the log file to a user if the a job fails.
> I can't seem to get the lexical to work. Below is a snippet
> from the log. I know it has to be something simple :)
> TIA
> Terry

> $ JNAME = F$GETQUI("DISPLAY_JOB","JOB_NAME",,"THIS_JOB")
> $ JPID  = F$GETQUI("DISPLAY_JOB","JOB_PID",,"THIS_JOB")
> $ WRITE SYS$OUTPUT "JNAME = TEST_OF_GETQUI , JPID = 00025C66"
> JNAME = TEST_OF_GETQUI , JPID = 00025C66
> $!
> $ JLOG  = F$GETQUI("DISPLAY_JOB","LOG_SPECIFICATION",,"THIS_JOB")
> $ WRITE SYS$OUTPUT "JLOG= ||"
> JLOG= ||
> $!

You won't be able to get he EXACT version of the log file. However, the
following code tacked onto your existing code will get you the highest
version of the log:

$ DFLT = F$TRNLNM( "SYS$LOGIN" )
$ LOG_FILE = F$PARSE( JLOG, JNAME + ".LOG", DFLT )

--
David J. Dachtera
dba DJE Systems
http://www.djesys.com/

Unofficial Affordable OpenVMS Home Page and Message Board:
http://www.djesys.com/vms/soho/

 
 
 

F$GETQUI("DISPLAY_JOB","LOG_SPECIFICATION",,"THIS_JOB")

Post by Dave Cant » Sun, 06 Aug 2000 04:00:00



Quote:>    I want to mail the log file to a user if the a job fails.
> I can't seem to get the lexical to work. Below is a snippet
> from the log. I know it has to be something simple :)
> TIA
> Terry
> $ JNAME = F$GETQUI("DISPLAY_JOB","JOB_NAME",,"THIS_JOB")
> $ JPID  = F$GETQUI("DISPLAY_JOB","JOB_PID",,"THIS_JOB")
> $ WRITE SYS$OUTPUT "JNAME = TEST_OF_GETQUI , JPID = 00025C66"
> JNAME = TEST_OF_GETQUI , JPID = 00025C66
> $!
> $ JLOG  = F$GETQUI("DISPLAY_JOB","LOG_SPECIFICATION",,"THIS_JOB")
> $ WRITE SYS$OUTPUT "JLOG= ||"
> JLOG= ||

The problem with this is that you're assuming that the LOG_SPECIFICATION is
the NAME of the logfile (and I'm assuming _that_).  It isn't.  It's the
specification against which the job name is parsed to form filename of the log
file.

Just do the same thing that the batch software does to produce the filename:

$ job_name = f$getqui("display_job","job_name",,"this_job")
$ logspec = f$getqui("display_job","log_specification",,"this_job")
$ if logspec .eqs. "" then logspec = "sys$login:.log"
$ defi/user 'job_name' 'job_name'/trans=terminal
$ logfilespec = f$parse(logspec,job_name)
$! Perhaps it should be   f$parse(logspec,job_name,"syslogin:.log")
$!    or maybe           f$parse(logspec,"syslogin:.log",job_name)
$ write sys$output f$fao("!/Parsed log file spec. is ""!AS"".",logfilespec)
$ deassign/user 'job_name' /nolog

The DEFINE/USER is required in case you've named your job with a word that
happens to be a logical name.  

Dave C.

Dave C.

 
 
 

F$GETQUI("DISPLAY_JOB","LOG_SPECIFICATION",,"THIS_JOB")

Post by Terry Marosite » Tue, 08 Aug 2000 04:00:00


Thanks Dave and David,

   I see now that there is only something in LOG_SPECIFICATION is the
submitter specifies a log file and that the version is not specified

   But since
    * More than one user runs this job
    * a 3rd party application submits it for them
    * several of the users may be running the job at the same time.
    * all users use the same directory for their logs.
   does this me that I am Out of luck for using a call to get the actual log
that I want .
   I think what I will do is get to a point where I get the
path:filename.log then do a search
   on path:filename.log;* /out = x.x  ,  open the file and get the 3rd line
, this assumes that
   is sylogin I have show proc. The only problem here is that some of the
logs can be vary big.
   maybe looking for open files ???    Any better thoughts are always
welcome.

Terry  

-----Original Message-----


Sent: Friday, August 04, 2000 7:20 PM

Subject: Re: F$GETQUI("DISPLAY_JOB","LOG_SPECIFICATION",,"THIS_JOB")

In article


>    I want to mail the log file to a user if the a job fails.
> I can't seem to get the lexical to work. Below is a snippet
> from the log. I know it has to be something simple :)
> TIA
> Terry

> $ JNAME = F$GETQUI("DISPLAY_JOB","JOB_NAME",,"THIS_JOB")
> $ JPID  = F$GETQUI("DISPLAY_JOB","JOB_PID",,"THIS_JOB")
> $ WRITE SYS$OUTPUT "JNAME = TEST_OF_GETQUI , JPID = 00025C66"
> JNAME = TEST_OF_GETQUI , JPID = 00025C66
> $!
> $ JLOG  = F$GETQUI("DISPLAY_JOB","LOG_SPECIFICATION",,"THIS_JOB")
> $ WRITE SYS$OUTPUT "JLOG= ||"
> JLOG= ||

The problem with this is that you're assuming that the LOG_SPECIFICATION is
the NAME of the logfile (and I'm assuming _that_).  It isn't.  It's the
specification against which the job name is parsed to form filename of the
log
file.

Just do the same thing that the batch software does to produce the filename:

$ job_name = f$getqui("display_job","job_name",,"this_job")
$ logspec = f$getqui("display_job","log_specification",,"this_job")
$ if logspec .eqs. "" then logspec = "sys$login:.log"
$ defi/user 'job_name' 'job_name'/trans=terminal
$ logfilespec = f$parse(logspec,job_name)
$! Perhaps it should be   f$parse(logspec,job_name,"syslogin:.log")
$!    or maybe           f$parse(logspec,"syslogin:.log",job_name)
$ write sys$output f$fao("!/Parsed log file spec. is ""!AS"".",logfilespec)
$ deassign/user 'job_name' /nolog

The DEFINE/USER is required in case you've named your job with a word that
happens to be a logical name.  

Dave C.

Dave C.

*****************************************************

*****************************************************
Any views or opinions are solely those of the author
and do not necessarily represent those of
United Advertising Media.
*****************************************************
The information transmitted is intended only for the
person or entity to which it is addressed and may
contain confidential and/or privileged material. If
you are not the intended recipient of this message,
please do not read, copy, use or disclose this
communication and notify the sender immediately. It
should be noted that any review, retransmission,
dissemination or other use of, or taking action in
reliance upon, this information by persons or
entities other than the intended recipient is
prohibited.
*****************************************************
**

 
 
 

F$GETQUI("DISPLAY_JOB","LOG_SPECIFICATION",,"THIS_JOB")

Post by Dave Greenwo » Tue, 08 Aug 2000 04:00:00



> Thanks Dave and David,

>    I see now that there is only something in LOG_SPECIFICATION is the
> submitter specifies a log file and that the version is not specified

>    But since
>     * More than one user runs this job
>     * a 3rd party application submits it for them
>     * several of the users may be running the job at the same time.
>     * all users use the same directory for their logs.
>    does this me that I am Out of luck for using a call to get the actual log
> that I want .
>    I think what I will do is get to a point where I get the
> path:filename.log then do a search
>    on path:filename.log;* /out = x.x  ,  open the file and get the 3rd line
> , this assumes that
>    is sylogin I have show proc. The only problem here is that some of the
> logs can be vary big.
>    maybe looking for open files ???    Any better thoughts are always
> welcome.

You could approach the problem of getting the actual file version by
using SHOW DEVICE/FILE.  Given that the logfile is on device DEV and you
only have one file with extension .LOG open, something like the following
should work (given a recent enough version of VMS):

  $ pipe (show dev/file 'dev' | -
        search sys$pipe 'f$getjpi("","master_pid")',.LOG;/match=and | -
        ( read sys$pipe tmp ; define/job $tmp &tmp) ) ; -
       logfile = f$element(2," ",f$edit(f$trnlnm("$tmp"),"compress"))
  $ write sys$output logfile

You can improve the SEARCH command by using the techniques given by
Dave Cantor earlier in this thread to replace the ".LOG;" with a more
complete file specification.

Btw, credit for the basic pipe command goes to Brian Schenkenberger and
John Briggs.

Dave
--------------

Oak Ridge National Lab        %STD-W-DISCLAIMER, I only speak for myself

 
 
 

F$GETQUI("DISPLAY_JOB","LOG_SPECIFICATION",,"THIS_JOB")

Post by bri.. » Tue, 15 Aug 2000 04:00:00


In article <CRKi5.11083$f_5.58...@news1.rdc1.ct.home.com>, DCan...@remove.three.words.shore.net (Dave Cantor) writes:

> In article <1137A4A23A51D311B2D600105A1D5213026FD...@seantexch.unitedad.com>, Terry Marosites <TMarosi...@unitedad.com> wrote:
>>    I want to mail the log file to a user if the a job fails.
>> I can't seem to get the lexical to work. Below is a snippet
>> from the log. I know it has to be something simple :)

Back from vacation and replying to a reply.  The following code should
do what you need done.  I prefer it greatly to any F$GETQUI approach.

        John Briggs                     bri...@eisner.decus.org

; PPF translate specified PPF logical name to file specification
; This is based on code posted on comp.os.vms by John Briggs
; on 19 Nov 1996, message-id <1996Nov19.110...@alpha.vitro.com>
; Modified by Jon Pinkley to accept a logical name so we can
; get the actual file name of a file opened by DCL.
; This also sets three local symbols, instead of only one.
;
; First delete local symbols PHY_FILE_NAME, ORG_FILE_NAME,
; and FID_FILE_NAME.   These will be recreated when we can
; successfully determine them.
;
; PHY_FILE_NAME
;   This is the unconcealed name of the file at the time
;   it was opened.  If it has been renamed, this will
;   not be correct.
;
;   PHY_FILE_NAME is set as follows:
;   If it's a PPF, then do a $DISPLAY with nop=<noconceal>
;     and save the resulting file name.
;     If it is a record oriented device, (you can't trust
;     fab$l_dev for this, you must ask $getdvi), instead
;     of using the rsa returned by $display, use the
;     nam$t_dvi value.
;     (this is the name it had when it was opened.)
;     if the device is a terminal, then save only the
;     device name.  Set FILE_NAME to the saved string.
;   If it's not a PPF, exit with warning status CLI$_UNDFIL
;   This is after all, meant to be used with PPF's
;
; ORG_FILE_NAME
;   This is the concealed name of the file at the time
;   it was opened.  If it has been renamed, this will
;   not be correct.
;
;   ORG_FILE_NAME is set as follows:
;   If it's a record oriented device
;     set ORG_FILE_NAME to nam$l_dev
;   otherwise
;     do another $DISPLAY, this time displaying
;     the concealed name, and set
;     ORG_FILE_NAME to the concealed file name.
;
; FID_FILE_NAME is set as follows:
;   If nam$l_fid is non zero
;     determine the current file name by using lib$fid_to_name.
;     Set FID_FILE_NAME to this value.  Note that this file
;     name will be correct if the file was renamed using the RENAME
;     command (but not necessarily if the FID is entered
;     multiple times).
;
; Usage: $ ppf :== $some_dir:ppf
;        $ ppf [logical_name]
;
;        if no logical is specified, then sys$output is assumed
;        i.e. the following three are equivalent:
;        $ ppf sys$output
;        $ ppf
;        $ run some_dir:ppf ! foreign command not necessary here
;
;        The reason the this is the default is that it is very
;        useful to allow a batch process to determine the exact
;        filename and version of its log file.
;
;        PPF can also be used to determine the version of file
;        opened by DCL.  Example follows:
;        $ open/read foo sys$login:login.com
;        $ ppf foo
;        $ show symbol/local *_file_name
;          FID_FILE_NAME = "DISK$USER1:[USERS.JON]LOGIN.COM;181"
;          ORG_FILE_NAME = "ROOT$USERS:[JON]LOGIN.COM;181"
;          PHY_FILE_NAME = "$4$DKA200:[USERS.][JON]LOGIN.COM;181"
;        $ close/nolog foo
;
;  example where file gets renamed while it is open
;
;        $ open/write foo test.dat
;        $ ppf foo
;        $ sho sym /loc *_file_name
;          FID_FILE_NAME = "DISK$JSCRATCH:[JON.PPF]TEST.DAT;1"
;          ORG_FILE_NAME = "DISK$JSCRATCH:[JON.PPF]TEST.DAT;1"
;          PHY_FILE_NAME = "$4$DKC204:[JON.PPF]TEST.DAT;1"
;        $ ren test.dat; jons.data;100
;        $ ppf foo
;        $ sho sym /loc *_file_name
;          FID_FILE_NAME = "DISK$JSCRATCH:[JON.PPF]JONS.DATA;100"
;          ORG_FILE_NAME = "DISK$JSCRATCH:[JON.PPF]TEST.DAT;1"
;          PHY_FILE_NAME = "$4$DKC204:[JON.PPF]TEST.DAT;1"
;        $ close/nolog foo

        .psect  data,quad,noexe
        $LNMDEF
        $FABDEF
        $NAMDEF
        $DEVDEF
        $DVIDEF
        $CLIMSGDEF

        .macro  errchk, ?skip           ; check for error
        blbs    r0, skip                ; on success skip this
        pushl   r0                      ; push offending status
        calls   #1, g^lib$stop          ; and kill this thing
skip:   .endm   errchk                  ; and that's errchk!

fab:    $FAB    nam=nam
nam:    $NAM    rsa=buffer,-
                rss=buffer_size,-
                nop=<noconceal>

itemlist:
        .word   buffer_size
        .word   lnm$_string
        .address        buffer
        .address        file_name_desc
        .long   0

        .align quad
buffer: .blkb   255
buffer_size=.-buffer
        .align quad
buffer1:        .blkb   255
buffer1_size=.-buffer1
        .align quad
buffer2:        .blkb   16
buffer2_size=.-buffer2
        .align quad
recdev: .blkl   1
dvirec: .long   DVI$_REC
return_length:
        .blkw   1

sysout: .ascid  /SYS$OUTPUT/
tabnam: .ascid  /LNM$FILE_DEV/
phynam: .ascid  /PHY_FILE_NAME/         ; name file was originally opened with
orgnam: .ascid  /ORG_FILE_NAME/         ; same as file_name, concealed
fidnam: .ascid  /FID_FILE_NAME/         ; name determined by lib$fid_to_name
input:  .long   lnm$c_namlength         ; make a descr for
        .address 2$                     ; lib$get_foreign
2$:     .blkb   lnm$c_namlength         ; the buffer itself

file_name_desc:
        .blkw   1
        .word   0
        .address buffer

fid_name_desc:
        .blkw   1
        .word   0
        .address buffer1

dvi_name_desc:
        .blkw   1
        .word   0
        .address buffer2

        .psect  code,exe
        .entry  MAIN,^m<>
        ; Get logical file name of PPF
        pushal  input                   ; set the length to the length returned
        pushl   #0                      ; noprompt
        pushal  input                   ; write the rec'd data here
        calls   #3, g^lib$get_foreign   ; get a command
        errchk                          ; check for error

        cmpw    input, #0               ; no input logical specified?
        bneq    5$
        movc3   sysout,@sysout+4,@input+4 ; input = "SYS$OUTPUT"
        movw    sysout,input
5$:
        ; Delete the symbols we are going to set (ignore errors)
        pushaq  fidnam                  ; "FID_FILE_NAME"
        calls   #1,g^lib$delete_symbol
        pushaq  orgnam                  ; "ORG_FILE_NAME"
        calls   #1,g^lib$delete_symbol
        pushaq  phynam                  ; "PHY_FILE_NAME"
        calls   #1,g^lib$delete_symbol

        ; Translate specified logical name in LNM$FILE_DEV
        pushal  itemlist
        pushl   #0
        pushaq  input
        pushaq  tabnam
        pushl   #0
        calls   #5,g^sys$trnlnm
        blbs    r0,10$
        brw     99$                     ; error? bail

        ; Is it a PPF logical name?
10$:    cmpw    buffer,#^X001b          ; Escape, null
        beql    11$
        brw     101$                    ; it's not a PPF, quit
11$:
        ; Use $DISPLAY to get PPF file name
        movw    buffer+2,fab+fab$w_ifi
        bisw2   #fab$m_ppf_ind,fab+fab$w_ifi
        $display        fab=fab         ; first with non-concealed name
        errchk                          ; check for error

        ; Determine if device is a record oriented device
        ; Note that network devices like node"user pass"::sys$login:login.com
        ; will have nam$t_dvi set to a null string.  In this case, just
        ; treat it like a non-record oriented device.  We will handle
        ; the lack of a FID at a later time.

        ; copy the nam$t_dvi name into the dvi_name string

        movzbw  nam+nam$t_dvi,dvi_name_desc
        bneq    12$
        brw     20$                     ; must be a decnet device name
12$:
        movc3   dvi_name_desc,nam+nam$t_dvi+1,@dvi_name_desc+4

        pushal  recdev                  ; boolean for record oriented device
        pushaq  dvi_name_desc           ; device name
        pushl   #0                      ; channel not specified
        pushal  dvirec                  ; address containing DVI$_REC
        calls   #4,g^lib$getdvi
        errchk

        tstl    recdev                  ; if record oriented device
        beql    20$                     ; then skip the following

        ; here we have a record oriented device.  Directory and
        ; file names really don't make a lot of sense.
        ; set PHY_FILE_NAME to nam$t_dvi and
        ;     ORG_FILE_NAME to nam$l_dev
        ; leave FID_FILE_NAME undefined

        pushaq  dvi_name_desc
        pushaq  phynam
        calls   #2,g^lib$set_symbol
        errchk

        ; copy the nam$l_dev name into the file_name string
        movzbw  nam+nam$b_dev,file_name_desc
        movc3   file_name_desc,@nam+nam$l_dev,@file_name_desc+4

        pushaq  file_name_desc
        pushaq  orgnam
        calls   #2,g^lib$set_symbol
        errchk

        brw     99$    

        ; Stuff file name length into descriptor
20$:    movzbw  nam+nam$b_rsl,file_name_desc

        ; The file name is all set up in file_name_desc
        ; Stuff it into the DCL symbol 'PHY_FILE_NAME'
30$:    pushaq  file_name_desc
        pushaq  phynam
        calls   #2,g^lib$set_symbol
        errchk

        ; Use $DISPLAY to get PPF file name concealed
        bicb2   #<nam$m_noconceal>, nam+nam$b_nop
        $display        fab=fab
        blbs    r0,40$
        ret                             ; If it fails, exit

        ; Stuff file name length into descriptor
40$:    movzbw  nam+nam$b_rsl,file_name_desc

        ; The file name is all set up in file_name_desc
        ; Stuff it into the DCL symbol 'ORG_FILE_NAME'
        pushaq  file_name_desc
        pushaq  orgnam
        calls   #2,g^lib$set_symbol
        errchk

        ; Now grab the FID from the NAM block and convert
        ; it to a filename using LIB$FID_TO_NAME, then
        ; stuff it into the DCL symbol 'FID_FILE_NAME'

        ; we're going to use buffer1, set the length in
        ; the descriptor to buffer_size
        movab   buffer1,fid_name_desc+4         ; make sure we have it
        movzbw  #buffer1_size, fid_name_desc
        ; we are going to reuse the descriptor for the
        ; nam$t_dvi counted string
        movzbw  nam+nam$t_dvi, file_name_desc
        beql    99$                             ; no FID, bail out
        movab   nam+nam$t_dvi+1, file_name_desc+4      

        pushaw  return_length
        pushaq  fid_name_desc
        pushaw  nam+nam$w_fid
        pushaq  file_name_desc
        calls   #4,g^lib$fid_to_name
        errchk

        ; Stuff file name length into descriptor
60$:    movzbw  return_length,fid_name_desc

        ; The file name is all set up in file_name_desc
        ; Stuff it into the DCL symbol 'FID_FILE_NAME'
70$:    pushaq  fid_name_desc
        pushaq  fidnam
        calls   #2,g^lib$set_symbol
99$:    ret
101$:   movl    #CLI$_UNDFIL,r0
        brb     99$

        .end    main