[Info-vax] Command Procedure - FORTRAN

Arne Vajhøj arne at vajhoej.dk
Wed Aug 12 13:03:31 EDT 2020


On 8/12/2020 12:50 PM, HCorte wrote:
> 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.
> 
> But when reachs the line:
>     FORTRAN FILENAME+".F"
> instead of replacing the variable for the inputed value that the user inserted it tries to run FORTRAN FILENAME.F instead, is there a way to make it replace the variable for its values before it runs the command: FORTRAN ???
> 
> $ !compile and link script example to later on
> $ !change make a double of dfor and dlink with flag for debug mode
> $ INQUIRE DEBUG-
>    "enter command to compile and link with debug mode on or off (yes or `
> $ INQUIRE FILENAME-
>    "enter the file name to compile and link?"
> $ IF DEBUG .EQS. "YES"
> $    THEN
> $        WRITE SYS$OUTPUT "DEBUG MODE ON"
> $        WRITE SYS$OUTPUT FILENAME+".TXT"
> $        EXIT
> $    ELSE
> $        IF DEBUG .EQS. "NO" THEN
> $           WRITE SYS$OUTPUT "DEBUG MODE OFF:"+FILENAME
> $           FORTRAN FILENAME+".F"
> $           LINK/EXE=FILENAME+".EXE" FILENAME+".OBJ"
> $           EXIT
> $        ENDIF
> $ ENDIF
> $ WRITE SYS$OUTPUT "Invalid option only yes or no repeat the process"-
> $ +" again"

There are a few ways to do that.

I would probably go for:

$ src = filename + ".f"
$ obj = filename + ".obj"
$ exe = filename + ".exe"
$ fortran 'src'
$ link/exe='exe' 'obj'

or maybe just rely on defaults:

$ fortran 'filename'
$ link 'filename'

Arne





More information about the Info-vax mailing list