FORTRAN on HAL Or Some Other DEC ALPHA Machine Running OPEN/VMS

Total Page:16

File Type:pdf, Size:1020Kb

FORTRAN on HAL Or Some Other DEC ALPHA Machine Running OPEN/VMS

FORTRAN on OPEN/VMS machines such as HAL

The discussion below uses two generic file names:

MyProg.FOR your FORTRAN source code file MyId.COM command file for batch submission

1. LOG IN to HAL. Your instructor will request that ids and passwords be created for you on the designated machine. Everyplace is shown below you will always type your id instead. In the same manner, every below will be typed by you using your actual program name prefix instead.

Access to HAL is typically obtained from a PC on the Lamar network from the START icon on the lower left of the screen: Start -> run -> telnet hal

Another alternative is to activate a terminal emulation program installed on the computer such as SmartTerm or NetTerm. Away from the Lamar campus, the more complete name

Start -> run ->hal.lamar.edu will be required.

“telnet” and “NetTerm” are free software, and can be downloaded from the internet. Note that under these generic terminal emulators, there may be key mapping anomalies that programs designed to emulate Dec terminals will not exhibit. One example is that sometimes “backspace” will delete the entire line, while “delete” will perform the backspace task by deleting the previous character.

2. EDIT/CREATE your SOURCE FILE. After logging in, you will need to use the editor to create both the files mentioned above (MyProg.FOR and MyId.COM). The command to enter the editor is given below. If the file does not exist, it will be created. (You do not actually type the $, it will normally be displayed for you as the command prompt.) $ EDIT / EDT MyFile.FOR

The computer will respond with an asterisk (*) command prompt. Many commands are available here, but only rarely are they used. The list of available commands can be obtained by typing “HELP” at the command prompt. The usual procedure instead is to type the letter “c”. This will tell the editor that you want to work in “change” mode rather than “command” mode. In “change” mode you can simply type in the program, move around the program using the arrows and make changes, just like most other editors. When the file is complete and correct, enter “CTRL / Z” to leave change mode. Back at the command prompt, enter “EXIT” to save the file and exit the editor. If you need to leave the editor without saving, the command is “QUIT”.

You should be given a screen capture page that shows a layout of the keys to the left of the main keyboard. This shows a number of special “EDT” commands that are available if you are emulating a Digital terminal. The actual mapping of the commands on the keys may not match that shown on the screen capture. The actual layout on your terminal can be determined if you can find the “HELP” key. “HELP” is usually either F2 or the second key from the left on the top row of the numeric keypad. (“/” on my keyboard). Many of these commands, such as CUT, PASTE, FIND, DEL Line, UND Line are very useful, and it is recommended you learn how to use them if you will be working for an extended period in VMS.

3. EDIT or CREATE the MyId.COM FILE in the same way. All lines other than data lines begin with “$” as it is the default command prompt. These dollar signs are typed. “!” signals the beginning of a comment on a command line. It will be necessary to modify this file for each program if it is to contain the program data. Your file should contain the following:

$ TYPE MyId.COM ! change this line to include your actual Id $ TYPE ‘P1’.FOR ! LIS can be used rather than FOR if you prefer $ RUN ‘P1’ ! these are single quotes. P1 stands for parameter 1 ! your data goes here and these two lines, including the !s, are removed. ! Note that no $ or ! is allowed on data lines. Data only. $ EXIT 4. COMPILE the PROGRAM. At the command prompt ($) you type:

$ FOR / LIS MyProg Note: no “.FOR”

If compilation is unsuccessful, errors will appear on the screen, and a file called MyProg.LIS will created containing the same error messages. This listing file, or any file, can be displayed on the screen one page at a time by entering the command below. If the file is very short, leave off the /PAGE qualifier.

$ TYPE / PAGE MyProg.LIS

Unfortunately, the listing is designed to be printed on a large line printer rather than displayed on an 80 column screen, so it may be difficult to view this file on the terminal. To remedy this, try

$ SET TERM / WIDTH = 132 before entering the TYPE command. It works with most terminal emulators. When ready to go back to normal mode, the command is:

$ SET TERM / WIDTH = 80

If compilation is unsuccessful, reenter the editor, make your changes, exit then try to compile again.

If compilation is successful (i.e. no error messages are displayed), in addition to the listing, and object file called MyProg.OBJ will be created.

5. LINK the program. Enter the command below to link the object file with library files and create an executable file:

$ LINK MyProg Note: no “.OBJ”

If this command generates errors, the most likely culprit is that you called a function using the wrong name. If successful, a file called MyProg.EXE will be created. 6. EXECUTE or RUN the program. There are three basic ways of running a program that has been successfully compiled and linked:

a. RUN on the terminal in time sharing mode. Type

$ RUN MyProg

This will run the program (MyProg.EXE) on the terminal. You will have to enter any data at the terminal, and the output will be displayed on the terminal.

b. RUN on the terminal using the MyId.COM command file. Type

$ @MyId MyProg

The @ tells VMS to run the command file MyId.COM with MyProg as the parameter (P1). Everything MyProg.COM says to do will be displayed on the screen. Note that the data will come from MyProg.COM and you will not have to type it in again.

c. Submit the program as a batch job that will be run, then automatically printed. Type

$ SUBMIT MyId / PARA = MyProg

This will do the exact same thing as @MyId, but everything that would have been displayed on the screen will instead go to the printer. You will have to go to the window at the computer center and present your student id to collect the printout.

7. A FEW OTHER USEFUL COMMANDS.

$ PRINT MyProg.FOR ! Sends the file specified to the printer

$ HELP ! lists all the commands

$ DIR ! lists all the files in your directory

$ DIR *.FOR ! lists all the FORTRAN source files.

Recommended publications