Tables Assignment:

Assume that you own 5 apartment complexes. They are:

Apt Bldg Code

Apartment Name

1

Garden Oaks

2

Pine Meadows

3

Ocean View

4

Lakeside

5

Forest Lane

The apartment code will come in on the input record with the information about the tenant:

1-5

Tenant Identification Number

6 - 30

Tenant Name

31

Apartment Building Code (1, 2, 3, 4, or 5)

32 - 36

Apartment Number

37 - 94

Other information

The COBOL to describe the input is:

FD  TENANT-FILE
    DATA RECORD IS TENANT-REC.
01  TENANT-REC.
    05  TENANT-ID          PIC 9(5).
    05  TENANT-NAME        PIC X(25).
    05  APT-BLDG-CODE      PIC 9.
    05  APT-NUM            PIC X(5).
    05  FILLER             PIC X(58).

Question #1:

Set up the table in WORKING-STORAGE that will contain the names of the apartments.

Question #2:

Write the line in the PROCEDURE DIVISION to move the name of the apartment building that the apartment building code points to, to a field on the print line called APT-BLDG-NAME-PR.

Question #3:

Assuming that you are not sure the APT-BLDG-CODE is 1,2,3,4,5 you would need an IF statement to decide whether to use the table to move the name to the print line or whether to move an error message to the print line. Write the PROCEDURE DIVISON lines to check the code and move the apartment building that the code is pointing to only if the code is valid. If the code is not valid move an error message to APT-BLDG-NAME-PR.