1752577 Members
4875 Online
108788 Solutions
New Discussion юеВ

VAX PASCAL

 
Sunil_uk
Frequent Advisor

VAX PASCAL

Hello,

Can some one give me an idea on how to insert a simple DCL script within a VAX pascal porgram. I want to execute a script A.COM when the program actually starts up.
3 REPLIES 3
Wim Van den Wyngaert
Honored Contributor

Re: VAX PASCAL

LIB$SPAWN ( Command_string := '$ @test.com' , flags := CLI$M_NOWAIT )

Wim
Wim
John Gillings
Honored Contributor

Re: VAX PASCAL

Sunil,

You're sure you want to execute the script from inside the program? It may be better to execute it first:

$ @A.COM
$ RUN MY_PASCAL_PROGRAM

You should also investigate what your procedure is doing to see if it might be better implemented in Pascal, calling system services or library routines.

Executing a procedure from within the program will require either a SPAWNed subprocess (LIB$SPAWN) or chaining (LIB$DO_COMMAND). Note that DO_COMMAND terminates the running program.

LIB$SPAWN can either be synchronous (ie: your program waits for the subprocess to terminate before proceeding), or asynchronous. Wim's suggestion "flags := CLI$M_NOWAIT" makes it asynchronous.

To use either routine, you should inherit the LIB$ module:

[INHERIT ('SYS$SHARE:PASCAL$LIB_ROUTINES')]

See: HP OpenVMS RTL Library (LIB$) Manual for details.

http://h71000.www7.hp.com/doc/82final/5932/5932PRO.HTML

To see the Pascal definition:

$ SEARCH SYS$SHARE:PASCAL$LIB_ROUTINES.LIS LIB$SPAWN /WINDOW=30

A crucible of informative mistakes
Arch_Muthiah
Honored Contributor

Re: VAX PASCAL

Sunil,

I am not sure how much you familier using LIB$SPAWN RTL routines, but as you mentioned you want execute A.com when program actually starts run ( is it before pascal start run ?), then I would like to suggest you better include $RUN PasProg.exe command line inside A.com at the end. Like
A.com
=====
$define....
$assign....
$dclsym=="JOBName"
...
...
$run PasProg.exe
$deassign...
$exit

Or if you want to execute A.com in the middle of your pascal program, then as Mr.WIM said, LIB$SPAWN is the next easiest way in VMS.

Also if you require to pass/process any DCL symbol from DCL and pascal back and forth, you can use LIB$GET_SYMBOL and LIB$DELETE_SYMBOL routines.

there is little more related info in this link under "Why do lib$spawn, lib$set_symbol fail in detached
processes?"
http://www.levitte.org/~ava/txt/vmsfaq.txt


Archunan
Regards
Archie