Operating System - OpenVMS

Re: DEC C++ question

 
SOLVED
Go to solution
FOX MULDER_2
Frequent Advisor

DEC C++ question

Hi,

Is it possible to call DCL commands or a .com file,from DEC C/C++.

I donot have much programming skills on C/C++ except the basic ones.

Pls also suggest how to compile.

Thanks
6 REPLIES 6
Duncan Morris
Honored Contributor

Re: DEC C++ question

Hi Fox,

have a look at the library routines LIB$DO_COMMAND and LIB$SPAWN to see if they are suitable for what you want.

http://h71000.www7.hp.com/doc/82final/5932/5932pro_014.html#do_command

The link below will take you to the User Guide for C. It sounds as though you need to go through a few of the overview chapters to familiarise yourself with compiling C programs,

http://h71000.www7.hp.com/commercial/c/docs/5492profile_contents.html#toc_chapter_1


Regards,

Duncan
Steven Schweda
Honored Contributor

Re: DEC C++ question

HELP CRTL SYSTEM
Hein van den Heuvel
Honored Contributor

Re: DEC C++ question

[Hi Duncan]

Fox,

Many (but not all) DCL commands are available as functions and thus are more efficiently done directly from a program than from DCL... as far as the execution is concerned.

Granted, For many if us writing the code is actually more efficiently done in DCL.

If this is about a once and hour/once a day task, then by certainly just SPAWN a command(file. Just use the C build in 'system' call (or fork where appropriate).

But if you need to do something every minute or faster, or while holding a critical lock, then you may want to use a calleable interface.

Like LIB$GETJPI or CONV$CONVERT or LIB$RENAME or SYS$OPEN + XAB's to get RMS details, SYS$SNDJBC and so on.

So to help you better, you may want to provide details on what such command file is likely have to do.

Hope this helps some,
Hein van den Heuvel (at gmail dot com)
HvdH Performance Consulting



Guy Peleg
Respected Contributor
Solution

Re: DEC C++ question

Here is a simple example:

$ ty fox.c
#include

void main()
{
system ("show time");
}
$ cc fox
$ link fox
$ r fox
13-NOV-2007 00:28:08
$

Note there is a performance cost associated
with frequent system()calls.

Guy Peleg
BRUDEN-OSSG
http://www.brudenossg.com
FOX MULDER_2
Frequent Advisor

Re: DEC C++ question

Sorry for replying lately...
Thanks to all for providing the info.

Is there any C++ functions to call a DCL .com
file and execute accordingly...

An example would be very helpful.

Cheers
Steven Schweda
Honored Contributor

Re: DEC C++ question

> An example would be very helpful.

Apparently not. Try the example you already
got. If that works, try changing:
system ("show time");
to something like:
system ("@ DCL.com");