CSCI 320 Lab 1
COBOL Programming on the VAX
Today we will be typing in and running our first program, the sample program found in Chapter 1, page 23, also found on 30.
Log onto Windows using your normal user id and the initial password, your birthdate (if you had a Linux account, your former password will still be preserved). Immediately change your password to a six to eight letter password of your choice. If you pick something with a number in it, the same password can also be used in the LINUX system and also on the VAX
Telnet to cluster (pathname is cluster.edinboro.edu). You should click on the TeraTerm icon for "cluster." Here you should log on using your normal id and the initial password made from your birthdate, mmddyy. You may again be asked to change your password. (It is possible that you may still have a former VAX account. In this case use your old password).
Start the editor with
$ EDIT/EDT SAMPLE.COB
At the * type the letter ‘C’ then press enter.
Type in the program in figure 1.10 (page 23) making the following changes as you type.
Omit the first 7 columns. The A margin can begin in the 1st column and the B margin can begin in column 5. (This eliminates the sequence number.) These margins are important, but the other spacing is arbitrary. For example, on lines 9 and 14 (see columns marked serial), the FD must start in column 1, and PAYROLL-LISTING in or after column 5, but other statements within the paragraph can start anywhere.
You will get tired of typing PICTURE. The abbreviation PIC is acceptable.
After PROGRAM-ID. SAMPLE. add
In FILE-CONTROL use your actual file names, e.g.,
SELECT EMPLOYEE-DATA ASSIGN TO ‘SAMPLE.DAT’.
SELECT PAYROLL-LISTING ASSIGN TO ‘REPORT.DAT’.
Close the editor with cntl/z (then type) EXIT. This will quit and save. [If you wanted to quit without saving your would type cntl/z QUIT.]
Make a data file. Start the editor again with $ EDIT/EDT SAMPLE.DAT type
QUINN, FRANK 10450 ( the 10450 must start in column 21)
MARSALES, WINTON 06550
WHETHER, STORMY 33990
Exit with cntl/z EXIT
Compile your program with
$ COBOL/LIS/WARNINGS=ALL SAMPLE.COB
You may have lots of errors. You can ignore warnings. Fix the errors by returning to the editor and saving again. Use the up arrow key to get Alpha to cycle through the last few commands you have typed. This will save you having to retype the compile command. Repeat this cycle until no serious errors come up.
Link the program.
$ LINK SAMPLE
Run the program.
$ RUN SAMPLE
Your output is going to a file. You may view it by typing,
$ EDIT/EDT REPORT.DAT
Retrieving and printing your results.
Printing in the Dundee lab may be an issue. You probably have your default printer set to Doucette 222. We can work on how to change it for Dundee.
$ PRINT SAMPLE.COB (to print your program)
$ PRINT REPORT.DAT (to print your results)
If you can't print do the following so you can print elsewhere.
[Your results can also be retrieved and printed to remote locations (such as Doucette or Hamilton Labs) by clicking on the MSDOS (command) prompt then typing
C:> A: change to the flash drive (S: can also be used for temporary storage)
E:> ftp cluster.edinboro.edu
ftp> get sample.cob (verify that transmission occurred) this is your program listing
ftp> get report.dat this is your output listing
These files come to your local diskette and can then be sent to our printer. Exit with
Start up WordPad ( start -> programs -> accessories -> wordpad)
Open your file (E: SAMPLE.COB)
Choose file -> print
Repeat to print REPORT.DAT
Using this method, you will frequently alter your line spacing, both horizontal and vertical.]
To Finish - Log out of the VAX