Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

DCL Command procedure output

 
Gilbert Pereira
Occasional Advisor

DCL Command procedure output

I have a command procedure that creates a file. It runs every 15 min each time it appends to the file. What I like to do is have the file type to my term when completed rather than email it as I do now.

Is there a way to type this file from a procedure running in batch mode to the screen?

I tried to define sys$output to sys$input or sys$command and was not successful. I evne thought of read/sys$command, however I am not sure that will work. Please help. Here is part of the procedure:
$chk_file_and_delete:
$! DELETE THE WORK FILES
$
$ if hour .eq. 07 .and. min .eq. 00
$ then
$ delete idxdailyrpts:cache_license_usage_pmca1*.rpt;*
$ endif
$
$ delete dsa0:[cachesys.pmca1.mgr]all.dmp;*
$ delete idxdailywrks:cache_license_pmca1.tmp;*
$ purge/keep=2 idxdailylogs:cache_license_usage.log
$
$!-----------------------------------------------------------------------------
$
$ open/write/error=write_err fil1 idxdailywrks:cache_license_pmca1.tmp
$ wf1 = "write fil1"
$
$ wf1 "$ CACHE -"""U""" """%SYS""""
$ wf1 "SET SECID="""OPERATOR""""
$ wf1 "Do $System.License.DumpLocalAll()"
$ wf1 "H"
$ close fil1
$
$ @idxdailywrks:cache_license_pmca1.tmp
$
$!-----------------------------------------------------------------------------
$! CREATE FILE WITH CURRENT DATA
$
$ if f$search("idxdailyrpts:cache_license_usage_pmca1_''date'.rpt") .eqs. ""
$ then
$ goto first_run
$ else
$ goto not_first_run
$ endif
$
$!-----------------------------------------------------------------------------
$
$first_run:
$
$ open/write/error=write_err outfil idxdailyrpts:cache_license_usage_pmca1_'dat
e'.rpt
$ open/read/error=read_err infil DSA0:[CACHESYS.PMCA1.MGR]all.dmp
$ wo = "write outfil"
$
$! TITLE INFORMATION
$
$ wrd1 = "CACHE"
$ wrd2 = "LICENSE"
$ wrd3 = "USAGE"
$ wrd4 = "FOR"
$ wrd5 = "PMCA1"
$ wrd6 = "''wkday',"
$ wrd7 = "''mdy'"
$
$! HEADER INFORMATION
$
$ wrd9 = "Time"
$ wrd10= "Current Use"
$ wrd11= "License Capacity"
$ wrd12= "Units Remaining"
$
$ txt1 = f$fao("!20* !5AS !7AS !5AS !3AS !5AS !10AS !12AS" ,wrd1,wrd2,wrd3,wrd
4,wrd5,wrd6,wrd7)
$ txt2 = f$fao("!17AS !17AS !17AS !17AS",wrd9,wrd10,wrd11,wrd12)
$ wo "''txt1'"
$ wo ""
$ wo "''txt2'"
$ wo ""
$
$ read/end=endit infil line
$ lic_cap = f$elem(1,"=",line)
$ lic_cap = f$edit(f$ext(0,f$loc(",",lic_cap),lic_cap),"trim")
$ cur_use = f$elem(2,"=",line)
$ cur_use = f$edit(f$ext(0,f$loc(",",cur_use),cur_use),"trim")
$ unit_remain = f$edit(f$elem(3,"=",line),"trim")
$
$ txt3 = f$fao("!17AS !17AS !17AS !17AS",hrmin,cur_use,lic_cap,unit_remain)
$ wo "''txt3'"
$
$ close infil
$ close outfil
$ goto mail_it
$
$!----------------------------------------------------------------------------
$
$not_first_run:
$
$ open/append/error=write_err outfil idxdailyrpts:cache_license_usage'date'.rpt
$ open/read/error=read_err infil DSA0:[CACHESYS.PMCA1.MGR]all.dmp
$ wo = "write outfil"
$
$ read/end=endit infil line
$ lic_cap = f$elem(1,"=",line)
$ lic_cap = f$edit(f$ext(0,f$loc(",",lic_cap),lic_cap),"trim")
$ cur_use = f$elem(2,"=",line)
$ cur_use = f$edit(f$ext(0,f$loc(",",cur_use),cur_use),"trim")
$ unit_remain = f$edit(f$elem(3,"=",line),"trim")
$
$ txt3 = f$fao("!17AS !17AS !17AS !17AS",hrmin,cur_use,lic_cap,unit_remain)
$ wo "''txt3'"
$
$ close infil
$ close outfil
$ goto mail_it
$!----------------------------------------------------------------------------
$mail_it:
$
$ if hour .eq. 17
$ then
$ mail_time = f$ext(0,5,f$cvt("","absolute","time"))
$ mail/subject="Cache license Usage PMCA1 on ''mdy' ''mail_time'" -
idxdailyrpts:cache_license_usage_pmca1_'date'.rpt "''maildis'"
$ else
$ mail_time = f$ext(0,5,f$cvt("","absolute","time"))
$ mail/subject="Cache license Usage PMCA1 on ''mdy' ''mail_time'" -
idxdailyrpts:cache_license_usage_pmca1_'date'.rpt "''gildis'"
$ endif
$ set noverify
$ exit
$

12 REPLIES 12
Jan van den Ende
Honored Contributor

Re: DCL Command procedure output

Gilbert,

>>>
Is there a way to type this file from a procedure running in batch mode to the screen?
<<<

Is the job really running in batch mode?
How do you even know your terminal is online & logged-in?

But if you do get around that:
determine the device name of the intended terminal, and

$ TYPE /output=
should do the trick.

hth

Proost.

Have one on me.

jpe


Don't rust yours pelled jacker to fine doll missed aches.
Gilbert Pereira
Occasional Advisor

Re: DCL Command procedure output

I am running Reflections and the window is open all day. I used the submit command to execute the job.
In a batch job , is the sys$output the command procedure's log file?
So how would I determine the terminal?
Hein van den Heuvel
Honored Contributor

Re: DCL Command procedure output

Hmmm, I can not imagine that you really would want every window you are using to receive that license stuff all the time.

So you want to identify the 'terminal' for
the window to receive the message and provide that to the job. Yuck.

My preference would be to select a window to run receive the output and just spawn a job to get teh data in a loop, or type the file create by the batch job.

Something simple like

$ spaw/nowait/inpu=nl:/proc=license_watch @license_watch.com

Where license_watch.com looks something like:

$loop:
$type license.tmp
$wait 0:5:0 ! Every 5 minutes?
$goto loop
$crash system if we get here

If you really want the data to go to all logged in terminal and really want an Email all teh time, then you can be 'cute' and use the Email personal name to convey the data:

$MAIL/PERS="your text here"

Maybe

$ mail/subject="Cache license Usage PMCA1 on ''mdy' ''mail_time'" -
/pers="''txt3' -
idxdailyrpts:cache_license_usage_pmca1_'date'.rpt "''maildis'"

[fwiw... What a horrible script, and what a horrible task it is trying to do ]

Enjoy,
Hein.



Jim_McKinney
Honored Contributor

Re: DCL Command procedure output

> If you really want the data to go to all logged in terminal

How about

$ reply/user=xxxxxx "your text"

?
Highlighted
Steven Schweda
Honored Contributor

Re: DCL Command procedure output

> In a batch job , is the sys$output the
> command procedure's log file?

The batch job's log file.

> So how would I determine the terminal?

From a batch job? I don't see how, but you
could tell it. Instead of submitting the
batch job directly, run another procedure
which does f$trnlnm( "sys$command"), and then
submits the batch job, passing the terminal
name to the batch job (/PARAMETERS = ...),
which can then write whatever it wants to
that terminal (if it has permission).

You really wish to do this?
Paul Beaudoin
Regular Advisor

Re: DCL Command procedure output

Gilbert
Not sure why you would want to but this should work:

In your (terminal) login set a system wide logical to point to your terminal:

Something like:

def/sys term_outp 'f$getjpi("","terminal")

In your batch job:

Copy file ''term_outp'

Not reliable (will only type to last term logged in and if terminal is still logged in)
Not considered good practice putting extra stuff in system log tables but having said that should give you what you asked for.

Regards

Paul

Hoff
Honored Contributor

Re: DCL Command procedure output

Um, you're not looking for batch here. Batch provides offline and unattended processing, throw-and-go processing. You clearly want "online".

Run the procedure directly from your Reflections X Window system session; from an X terminal login.

You might need to toss the procedure into the 15 minute loop or such, but that's easier than making batch interactive.

As an enhancement here, I'd tend to automate whatever secondary eye-ball or manual processing is needed here (monitoring Cache license units?), and run this entirely offline; whether via batch job or as a daemon. Or (for an interactive display) I'd run it behind a web server CGI or such, and particular run with graphical displays. I'd get out of the business of having to look at a local terminal display or the mail every fifteen minutes. (Or the data could be pulled via RSS or such as required.)


Thomas Ritter
Respected Contributor

Re: DCL Command procedure output

Why not just write to a file and then $ tail /f the file ?
If auditors are interested in the output then better maybe to keep records.
Gilbert Pereira
Occasional Advisor

Re: DCL Command procedure output

Paul
I have been task to monitor our Cache license usage during the day at some perticular interval and be aware of this through out the day and at end of of the day send a report of all the times to management. This will help to determine if we need to increase our licenses, since are are adding users at once a month, sometimes more.

So I wanted a way in which I can run a command procedure that will display the usage to my Reflection window rather than have to read an email with the current usage.
Paul if I open one window and run my procedure under a perticular username will that be ok since every window creates a unique terminal ID. ?