Table Assignment:
Problem #1: Tell which procedure PROCEDURE DIVISION statement(s) will MOVE the job and salary to separate fields. Explain problems!
Input: 05 JOB-CD-IN PIC 9. Table in WORKING-STORAGE: 01 PAYROLL-TABLE. 05 FILLER PIC X(15) VALUE "OPERATOR 30000". 05 FILLER PIC X(15) VALUE "PROGRAMMER40000". 05 FILLER PIC X(15) VALUE "ANALYST 50000". 01 RDF-PAYROLL-TABLE REDEFINES PAYROLL-TABLE. 05 PAY-INFO OCCURS 3 TIMES. 10 JOB PIC X(10). 10 SALARY PIC 9(5). |
|
Try #1: |
MOVE JOB(JOB-CD-IN) TO JOB-PR. |
Try #2: |
MOVE PAY-INFO(JOB-CD-IN) TO JOB-PR, SALARY-PR. |
Try #3: |
MOVE JOB TO JOB-PR (JOB-CD-IN). |
Try #4: |
MOVE SALARY(JOB) TO SALARY-PR. |
Problem #2: Which table(s) meets these specifications? Explain problems!
You have a donation system that includes drive name, the amount contributed to the drive this year and the goal. Which of the following sets up this table accurately. |
|
Try #1: |
01 DONATION-TABLE. 05 FILLER PIC X(22) VALUE "CANCER 145000200000". 05 FILLER PIC X(22) VALUE "HEART CURE123000250000". 05 FILLER PIC X(22) VALUE "SAVE KIDS 245000350000". 05 FILLER PIC X(22) VALUE "PET ADOPT 090000100000". 01 RDF-DONATION-TABLE REDEFINES DONATION-TABLE. 05 DRIVE-NAME PIC X(10) OCCURS 4 TIMES. 05 CONTRIB PIC 9(6) OCCURS 4 TIMES. 05 YRGOAL PIC 9(6) OCCURS 4 TIMES. |
Try #2: |
01 DONATION-TABLE. 05 FILLER PIC X(22) VALUE "CANCER 145000200000". 05 FILLER PIC X(22) VALUE "HEART CURE123000250000". 05 FILLER PIC X(22) VALUE "SAVE KIDS 245000350000". 05 FILLER PIC X(22) VALUE "PET ADOPT 090000100000". 01 RDF-DONATION-TABLE REDEFINES DONATION-TABLE. 05 DONOR-INFO OCCURS 4 TIMES. 10 DRIVE-NAME PIC X(10). 10 CONTRIB PIC 9(6). 10 YRGOAL PIC 9(6). |
|
01 DONATION-TABLE. 05 FILLER PIC X(18) VALUE "CANCER145000200000". 05 FILLER PIC X(22) VALUE "HEART CURE123000250000". 05 FILLER PIC X(21) VALUE "SAVE KIDS245000350000". 05 FILLER PIC X(20) VALUE "PET ADOPT90000100000". 01 RDF-DONATION-TABLE REDEFINES DONATION-TABLE. 05 DONOR-INFO OCCURS 4 TIMES. 10 DRIVE-NAME PIC X(10). 10 CONTRIB PIC 9(6). 10 YRGOAL PIC 9(6). |
Problem #3: You have STATE-CD on your input that has PIC 9. You have a field on the print line called STATE-NAME-PR where you want to print the state name. You need to set up a TABLE in WORKING-STORAGE for the six state names.
Problem #4: Assume that you cannot be sure that STATE-CD only contains the numbers 1, 2, 3, 4, 5, 6. Write the PROCEDURE DIVISION code to make sure that STATE-CD is within the valid range.
Problem #5: Set up a two dimension table to contain the cost of tickets in a theater. The two variables are seating on the floor (code 1) or in the balcony (code 2) and they type of product. Productions are assigned codes of 1, 2 and 3. The cost of the tickets is shown below.
|
|
Production type 1 |
Production type 2 |
Production type 3 |
|
Floor = Code 1 |
50.00 |
35.75 |
25.95 |
|
Balcony = Code 2 |
35.00 |
19.75 |
15.95 |
Problem #6: (Refering to #5 above) Set up the input record which should contain a seating code and a production code. Set up a field on the print line to print the cost of the ticket. Code the MOVE statement to move the cost of the ticket to the field on the print line that you set up.