[Info-vax] Command Procedure - FORTRAN

Stephen Hoffman seaohveh at hoffmanlabs.invalid
Wed Aug 12 13:33:04 EDT 2020


On 2020-08-12 16:50:00 +0000, HCorte said:

> Trying to create the following command procedure that accepts two 
> variables from the command line and compile .f and then link .obj for a 
> fortran program.

DCL translates the first thing on the command line as a symbol, or tries to.
Subsequent DCL symbols on the command line must be be demarcated with 
'symbol' or &symbol to be substituted.
Details on programming DCL are in the OpenVMS User's Guide manua;, 
among other places.
INQUIRE does far more than you want, and can introduce uexpected 
behaviors, Use of the READ /PROMPT="prompt" command is usually 
preferable.
You can also be a little more advanced, and use parameters on the 
command.  In thos case, P1 and P2 symbols for the filename and whether 
DEBUG is enabled.
I'd recommend not using a big IF block, and setting a symbol for debugging.
The f$parse lexical is another way to parse and generate filenames. In 
this case, fn = f$parse(".F",FILENAME)
The f$parse lexical also allows translations of logical names, which 
can be very handy for accepting defaults.
Set your terminal width wider. Most of us don't live by 80 columns in 
our text editors. Not any more...

Composed in the text editor, and untested...

$ fn = f$parse(p1,,,"NAME")
$ if f$locate(",DEBUG,",",''P1'") .ne. f$length(",''p2',")
$ then
$    forflags = "/DEBUG /NOOPTIMIZE"
$    linkflags = "/DEBUG"
$ else
$    forflags = "/NODEBUG /OPTIMIZE"
$    linkflags = "/NODEBUG"
$ endif
$ fortran 'fn' 'forflags
$ link 'fn' 'linkflags

Docs:
http://h30266.www3.hpe.com/odl/axpos/opsys/vmsos84/6489/6489pro_030.html#symbols_ch 

https://vmssoftware.com/docs/VSI_OpenVMS_compilers_and_lpd/fortran/VSI_Fortran_User_Manual.pdf 


Lots of examples here:
https://www.digiater.nl/openvms/freeware/v80/hoffman_examples/
https://www.digiater.nl/openvms/decus/
https://www.digiater.nl/openvms/freeware/


-- 
Pure Personal Opinion | HoffmanLabs LLC 




More information about the Info-vax mailing list