logo

CST8283 Final Exam Winter 2022 Question Answer 2022

Draft code responses for two questions related to COBOL programming.

7 Pages948 Words21 Views
   

Added on  2022-09-26

CST8283 Final Exam Winter 2022 Question Answer 2022

Draft code responses for two questions related to COBOL programming.

   Added on 2022-09-26

ShareRelated Documents
CST8283 FINAL EXAM WINTER 2020
STUDENT NAME ___________________________________ STUDENT NUMBER ____________
( type in your name and student number)
INSTRUCTIONS
Draft your code responses to these questions directly in this WORD document. You
do not need to use Eclipse or the COBOL software. This document is a WORD
document so code your responses in text.
==================================================
===================================
Question 1
Write the Data Division code that would declare a subscripted Table for 300 courses
where each record has the structure described below.
a) Draft the Procedure Division code that would load the table from the file called
CRS-FILE. The module that would load the individual record into the table will be
called LOAD-CRS-RECORD. Code both that module and the statements controlling
(performing) that module.
b) Code the search module and the code that would control (perform) the search
module given a search argument (value) that is already in the field called CRS-ID.
The description of the record on the file (CRS-FILE)
01 COURSE-RECORD.
05 COURSE--ID PIC X(7).
05 COURSE-NAME PIX X(25).
05 PROGRAM-ID PIC X(5).
Program:
DATA DIVISION.
FILE SECTION.
FD CRS-FILE.
RECORD CONTAINS 37 CHARACTERS
DATA RECORD IS LOAD-CRS-RECORD.
01 LOAD-CRS-RECORD.
05 COURSE--ID PIC X(07).
05 COURSE-NAME PIC X(25).
CST8283  Final Exam  Winter 2022 Question Answer 2022_1
CST8283 FINAL EXAM WINTER 2020
STUDENT NAME ___________________________________ STUDENT NUMBER ____________
( type in your name and student number)
05 PROGRAM-ID PIC X(5).
PROCEDURE DIVISION.
Begin.
OPEN INPUT CRS-FILE.
READ CRS-FILE
AT END MOVE HIGH-VALUES TO LOAD-CRS-RECORD
END-READ
PERFORM UNTIL LOAD-CRS-RECORD = HIGH-VALUES
IF COURSE—ID= CRS-ID
DISPLAY “RECORD FOUND”
END-IF
READ CRS-FILE
AT END MOVE HIGH-VALUES TO LOAD-CRS-RECORD
END-READ
END-PERFORM
CST8283  Final Exam  Winter 2022 Question Answer 2022_2
CST8283 FINAL EXAM WINTER 2020
STUDENT NAME ___________________________________ STUDENT NUMBER ____________
( type in your name and student number)
Question 2
Draft the Data Division Screen Section code that will allow the entry of data at the
keyboard for two fields (Student Number and a Student Course). Code an
appropriate prompt message for each field.
The data on the screen needs to be stored in fields already described in Working-
Storage as
STUDENT-NUMBER PIC 9(9) and STUDENT-COURSE PIC X(7).
Program:
DATA DIVISION.
FILE SECTION.
FD STUDENT-RECORD.
RECORD CONTAINS 16 CHARACTERS
DATA RECORD IS LOAD-STUDENT-RECORD.
01 LOAD-STUDENT-RECORD.
05 STUDENT-NUMBER-IN PIC 9(09).
05 STUDENT-COURSE-IN PIC X(7).
WORKING-STORAGE SECTION.
01 STUDENT-NUMBER PIC 9(9).
01 STUDENT-COURSE PIC X(7).
PROCEDURE DIVISION.
DISPLAY “ENTER STUDENT ID”
ACCEPT STUDENT-NUMBER
DISPLAY “ENTER STUDENT COURSE”
ACCEPT STUDENT-COURSE
CST8283  Final Exam  Winter 2022 Question Answer 2022_3

End of preview

Want to access all the pages? Upload your documents or become a member.