Lab 1

 

Goals

Part A - The Unix Tutorial

Read and follow the directions found in the Unix Tutorial.

Part B - Your First Program

Enter, or copy, the Future Value Program (it can be found here).  Save this program with the filename lab1b.cob.  Once you have the program, you should compile it, and once you have a clean compile (i.e. no errors), execute the program.

At the terminal window (i.e. the % prompt), type ccbl lab1b.cob to compile and link the source code file. This will create an executable file with the name of the program plus the suffix .acu.  If you have compiler errors, go back to emacs to make corrections, save the file, and re-compile.  You must re-compile your program after every change.

When editing your code, you can end the emacs command with a space and ampersand (&). This will open emacs but also return your terminal window to the command prompt, so you can use it while emacs is open.

To get obtain a listing of your program with the error messages beneath the line flagged as the error (i.e if you have compiler errors), you need to add options to the compile command:

Run the program: runcbl lab1b

UNIX has an extensive, on-line reference manual. To get more information about a command, type "man" followed by the name of the command.  For example:  man ls.   For more information about man itself, type man man. "man" functions, just like "more" - use the space bar or the Enter key to scroll or Ctrl-C to cancel.

Part C - What If?

Type the answers to the following questions into a file you create named 'lab1c.txt' to be submitted with the rest of your lab. Restore the program to its original condition before going on to the next question.

Refer to program typed in for Part B of this lab:

1.           Delete the period at the end of the statement IDENTIFICATION DIVISION.  Recompile the program.  What happens?

2.           Replace one of the words DIVISION with DIVIDE.  Recompile the program.  What happens?

3.           Put the first paragraph name in all lower case.  Recompile the program.  What happens?

4.           Replace one of the 77 level numbers with 01.  Recompile the program.  What happens?

5.           Delete the periods at the end of all the statements in the 000-CALCULATE-FUTURE-VALUES paragraph.  Recompile the program.  What happens?

6.           Put a period after the first statement in the IF (the PERFORM statement).  Recompile the program.  What happens?  Run/Execute the program.  What happens?

7.           Comment out the following statement:  ENVIRONMENT DIVISION.  Recompile the program.  What happens?

8.           Comment out ENVIRONMENT DIVISION and INPUT-OUTPUT SECTION statements.  Recompile the program.  What happens?

9.           What are the first six statements that are executed when the program is run?  (just list the verbs of these statements in sequence)

10.        If the user enters a zero when the first Accept statement is run, what statements are run before the program ends?  (just list the verbs)

11.        If the user enters 2 when the first Accept statement is run, what statements are run before the Accept statement is run again?     (just list the verbs)

12.        What happens if the user enters 100000 and the entry is truncated?

13.        If the Value clause for the NUMBER-ENTERED mistakenly sets the value to 0 instead of 1, what statements will be executed before the program ends?

14.        If the investment amount that's entered by the user is $125, the number of years is 10 and the interest rate is 10 percent, what is the value of the FUTURE-VALUE field after procedure 120 has been executed one time?

15.        If the picture of the FUTURE-VALUE field is changed to S9(7), what does this field contain after procedure 120 has been executed one time? Use same inputs as #14.

 

The submit Command

When you are finished with a lab, you need to turn it in for grading. The submit command submits your lab electronically. You must use the submit command to turn in your labs; emails and printouts are not acceptable. The submit command also puts the time on the files that were submitted so that we know when the files were turned in.  The grader will be checking this time to determine if a lab was turned in "on-time" or "late".  The submit command is entered as follows:

submit classname labname files-to-submit

Where classname is the name of the CIS 314 section that you are enrolled in. Your classname is c314aa.

labname is the lab you are working on (lab1, lab2, etc.)

files-to-submit is a list of the files that make up the lab. These files include COBOL programs, input files, text files, and/or record definitions.

Note that all of the files in a lab must be submitted using one command. If you use two submit commands, the second submit erases the files from the first submit. Since the grader does not have the entire lab to grade you lose points.

Also, note that programs must be submitted in source code form. For example, if you submit "lab4.acu" instead of "lab4.cob", you will have, at a minimum, points equivalent deducted equivalent to submitting two days late (20%).

Each submit command must be entered on one line, without pressing Enter. If the line you are entering is too long, it wraps onto the next line.

Submitting Lab 1 for grading

submit c314aa lab1 lab1b.cob lab1c.txt

Deleting Unnecessary Files

As you work you create disk files, most of which do not need to be kept. These unnecessary files occupy disk space, and if not erased will eventually fill your disk quota. When this happens, you can not save any other files, no matter how important.

To help prevent this from occurring, there is a command called clean in the class directory (/usr/class/cis314/). Copy it in to your home directory using the UNIX cp command (see the tutorial), and every so often enter the command.

clean

This will delete any unnecessary files from your home directory, leaving you more disk space.