[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

501.0. "Mailing a Batch job's Log" by AIMHI::SMITH (Never say never, I always say.) Thu Jun 18 1987 14:37

    
    	Can any of you Super-Hacks out there think of a way for a Batch
    	job to mail out a copy of it own Log to a specific person, no
    	matter who submits it? The main dilemma for me, is if I try to
    	have the Mail command at the end of the Batch job, it won't
    	work, because the Log is "currently locked by another user",
    	the Batch job itself. Input from any DCL hacks/geniuses would
    	be greatly appreciated. Thanks.
    
    								   Mike
    
T.RTitleUserPersonal
Name
DateLines
501.1A very simple kludge...ALBANY::KOZAKIEWICZYou can call me Al...Thu Jun 18 1987 16:232
Submit another batch job at exit which runs in a minute or so (to ensure 
that the log file gets closed) and have it do the mailing.
501.2Another possiblity...QBUS::MITCHAMAndy in AtlantaThu Jun 18 1987 19:4010
  Have your command file write and submit another command file that simply
  mails the log file to yourself...
  
  	$ OPEN/WRITE FILE BAR.COM
	$ SELF = F$EDIT(F$GETJPI("","USERNAME"),"TRIM")
    	$ WRITE FILE "$MAIL FOO.LOG ''self'"
	$ CLOSE FILE
  	$ SUBMIT BAR.COM

-Andy
501.31+ERIS::CALLASCO in the war between the sexesFri Jun 19 1987 15:495
    If you use another batch job, have it SYNCHRONIZE with the first
    one so that you don't get errors from that. It should also probably
    delete itself.
    
    	Jon
501.4Synchronizing and such...QBUS::MITCHAMAndy in AtlantaFri Jun 19 1987 17:085
Re:  < Note 501.3 by ERIS::CALLAS "CO in the war between the sexes" >
  
  Jon, I'm not familiar with this.  Would you mind posting an example?

-Andy
501.5Facile ...VISA::BIJAOUITomorrow Never KnowsMon Jun 22 1987 10:4123
    Re: .0

    Aow, come on, don't bother with another batch job.
    I already had to cope with the problem, and this is the way I solved
    it:
    
    At the beginning of your command procedure, set the output rate
    to 1 second:
    
    $ SET OUTPUT_RATE = ::1    
    
    Just before your mail, do :
                                         
    $ WAIT ::2   			  ! To have the log file written
    $ CONVERT/SHARE 'Your_log_file' X.DAT ! To avoid the $%&#@ error
    					  ! 'File currently ...'
    $ MAIL X.DAT NOEUD::MACHIN		  ! Mail your file.
    
    
    And that's it !
    Let me know if you have any problem,
    
    Pierre.
501.6Stream is used on different jobsPSGMKH::SMITHNever say never, I always say.Mon Jun 22 1987 13:1514
	The Base Note was submitted on behalf of another person, and they
	hadn't given me all the facts the first time. Here's the scoop :

	They have a need for a Com Stream, which they will insert, or not
	insert, in any given Production Job as needed, that will mail a
	copy of the Log to whomever they specify in a parameter of the
	Com Stream. Since this Stream will not always be used in the same
	Job, it needs to be able to determine what the name of the Job it
	was inserted in, so it can mail the correct Log. I hope this is a
	little clearer than before. Thanks.

								     Mike

501.7ERIS::CALLASCO in the war between the sexesMon Jun 22 1987 14:5521
    re .4:
    
    From the help files:
    
SYNCHRONIZE

    Places the process issuing this command in  a  wait  state  until  a
    specified job completes execution.

    Format:


      SYNCHRONIZE  [job-name]


  Additional information available:

  Parameters Command_Qualifiers
  /ENTRY     /QUEUE
  Examples

501.8f$pid, f$environment, show dev/fileVIDEO::OSMANtype video::user$7:[osman]eric.sixMon Jun 22 1987 19:0428
If I understand your latest questions correctly, you now understand how
to mail your own .LOG file *once* you know what it's called, and you're
stuck on how to figure out what your log file is called.

This has been discussed before, and the method involves combining
the following pieces of information:

o	F$GETJPI("","PID")

   Find out what your process id is.

o	F$ENVIRONMENT("PROCEDURE")

   Find out what your command procedure name is.  But don't be mislead
   by this!  You might have been @'ed from another procedure.

o	SHOW DEVICE/FILE/OUT=filespec

   Find out list of open files and process id's.  The sought .LOG filename
   is one of the ones labelled with your process id.

o	SHOW QUEUE/BATCH/FULL/ALL/OUT=filespec

   Find out what log file the batch job is writing to.

"The rest is left as an exercise for the student".

/Eric
501.9Done! (for many cases...)LEDS::BECKERTue Jun 30 1987 14:2821
$ !   
$ !	This command file finds the LOG output file name for Batch Jobs.
$ !
$ !	It assumes:  1) Current job has opened no other *.log files
$ !		     2) LOG file is on the default disk i.e. same as login.com
$ !		     3) The Log file is a *.log file
$ !
$ !	Disadvantages:  1) Not exactly fast.
$ !
$ set verify
$ pid = f$getjpi ("","pid")
$ show device/file/out=open_files.dat
$ search open_files.dat 'pid' , ".log"/match=and/output=log_info_file.dat
$ open/read log_info_file log_info_file.dat
$ read log_info_file log_info_record
$ log_file_path == f$parse ( "[" + f$element (1,"[",log_info_record))
$ write sys$output "And the anser is.... ''log_file_path'"
$ close log_info_file
$ delete log_info_file.dat.*
$ delete open_files.dat.*
$ exit