1831306 Members
3087 Online
110023 Solutions
New Discussion

F$mode() info required

 
SOLVED
Go to solution
Shashikant_B
Occasional Advisor

F$mode() info required

Hi All,

We need urgent help regarding f$mode() on open VMS.
Need to know
1) How this gets set as BATCH/INTERACTIVE?
2) If i want to run a application in batch always, how do i set it?

Please reply back.

Thanks and Regards,
Rajni.
9 REPLIES 9
Kris Clippeleyr
Honored Contributor
Solution

Re: F$mode() info required

Rajni,

The lexical function F$MODE() returns as a character string the mode in which the process is executing ( INTERACTIVE, BATCH, NETWORK, OTHER ). It cannot set this mode.
See the Help topic "Lexicals".
If you want to run an app in BATCH always, you will have to create a command procedure that invokes this app, and SUBMIT this procedure to a batch queue for execution.

Please see
http://h71000.www7.hp.com/doc/731FINAL/6489/6489pro_contents_005.html#toc_chapter_16
for further reading.

Regards,
Kris (aka Qkcl)
I'm gonna hit the highway like a battering ram on a silver-black phantom bike...
XMAN_1
Advisor

Re: F$mode() info required

Hi! Rajni,

Try the following:

$ IF F$MODE() .NES. "INTERACTIVE" THEN GOTO ENDINTER
$ IF F$MODE() .NES. "BATCH" THEN GOTO ENDBATCH

You can also use GOSUB with RETURN as well

XMAN
Duncan Morris
Honored Contributor

Re: F$mode() info required

Hi Rajni,

Welcome to the ITRC OpenVMS forum!

The lexical function f$mode()returns a character string showing the mode in which a process is executing.

It does not set an application or process to batch/interactive mode. The bit(s) which are read by f$mode() are set up in the process header at the time of process creation.

To run a process in batch mode, submit a command procedure to a previously defined batch queue (e.g. sys$batch).

Duncan
Shashikant_B
Occasional Advisor

Re: F$mode() info required

Hi Duncan,

Thanks for your reply.
Since in our case, we need to have this job run immediately i.e. it can not be queued in with SUBMIT command.
So could you please let us know is there any alternative to set f$mode() to batch.

Is it possible if I run my script using PIPE (.....)& ??

Since am very new to VMS, so may be the questions are quite like a learner.
Please let me know.

Thanks and Regards,
Rajni.
XMAN_1
Advisor

Re: F$mode() info required

Hi! Rajni,

F$MODE() is a lexical function and can be tested against
"OTHER", "NETWORK", "INTERACTIVE" & "BATCH" modes.

you can also assign it to a variable and then test that variable like:

$ X = f$mode()

and then test "X" or you can use it directly like:

$ If F$MODE() .EQS. "OTHER" THEN GOTO/GOSUB YOUR_WORKPARA
$ IF F$MODE() .EQS. "NETWORK" THEN GOTO/GOSUB YOUR_WORKPARA
$ IF F$MODE() .EQS. "INTERACTIVE" THEN GOTO/GOSUB YOUR_WORKPARA
$ IF F$MODE() .EQS. "BATCH" THEN GOTO/GOSUB YOUR_WORKPARA

Hope this helps.

XMAN
Duncan Morris
Honored Contributor

Re: F$mode() info required

Rajni,

"Since in our case, we need to have this job run immediately i.e. it can not be queued in with SUBMIT command.
So could you please let us know is there any alternative to set f$mode() to batch."

As you say, you are new to OpenVMS. ALL batch jobs run in a batch queue. You can have the job start immediately within the queue. If you are thinking of a "background" task, then you could consider using SPAWN/NOWAIT - but please be careful! This is a very different environment to Unix.

Duncan
Duncan Morris
Honored Contributor

Re: F$mode() info required

Rajni,

please read chapter 16 of the OpenVMS user guide for a good description of batch jobs, subprocesses and similar.

I am sure that you will find the information that you need in this link

http://h71000.www7.hp.com/doc/731FINAL/6489/6489pro_contents_005.html#toc_chapter_16


Duncan
Shashikant_B
Occasional Advisor

Re: F$mode() info required

Thanks for the replies
Duncan Morris
Honored Contributor

Re: F$mode() info required

Hi Rajni,

hopefully these answers will help you, and if you need more information on any OpenVMS topic, feel free to opena new topic.

Once you have had time to go through the answers, maybe you can find some time to do some assigning?

http://forums1.itrc.hp.com/service/forums/helptips.do?#33

Mind, I do not say you necessarily need to give lots of points. It is fully up to _YOU_ to decide how many. If you consider an answer is not deserving any points, you can also assign 0 ( = zero ) points, and then that answer will no longer be counted as unassigned.

Consider, that every poster took at least the trouble of posting for you!

Thanks on behalf of your Forum colleagues.

Duncan