Describe the function(s) or purpose of each of these cobol statements. COBOL Key
ID: 3857247 • Letter: D
Question
Describe the function(s) or purpose of each of these cobol statements.
COBOL Keyword
Function or Purpose
MOVE NAME-IN TO NAME-OUT
PIC S9999V99.
FILE-CONTROL
INPUT-OUTPUT SECTION
05 CUSTOMER-NAME
FD
WORKING-STORAGE SECTION
PROGRAM-ID
SELECT THIS-FILE ASSIGN RF17
LABEL RECORDS ARE STANDARD
PERFORM
PERFORM THAT UNTIL EOF="YES".
300-PROCESS-REPORT
FILE SECTION
CONFIGURATION SECTION
OPEN INPUT CUSTOMER-FILE
CLOSE CUSTOMER-FILE
STOP RUN.
COBOL Keyword
Function or Purpose
MOVE NAME-IN TO NAME-OUT
PIC S9999V99.
FILE-CONTROL
INPUT-OUTPUT SECTION
05 CUSTOMER-NAME
FD
WORKING-STORAGE SECTION
PROGRAM-ID
SELECT THIS-FILE ASSIGN RF17
LABEL RECORDS ARE STANDARD
PERFORM
PERFORM THAT UNTIL EOF="YES".
300-PROCESS-REPORT
FILE SECTION
CONFIGURATION SECTION
OPEN INPUT CUSTOMER-FILE
CLOSE CUSTOMER-FILE
STOP RUN.
Explanation / Answer
MOVE NAME-IN TO NAME-OUTMOVE --> This instruction moves source data to target data.
PIC S9999V99 --> This represents signed number, consisting of total 6 decimal digits of which 4 digits followed by a decimal point then followed by 2 digits. V represents a decimal point in the numeric representation.
FILE-CONTROL --> In a program, if a file is going to be used, then it should be declared in FILE-CONTROL section.
INPUT-OUTPUT SECTION --> FILE-CONTROL and IO-CONTROL paragraph comes under INPUT-OUTPUT SECTION. The identifiers in the program is linked to the external program using INPUT-OUTPUT SECTION.
05 CUSTOMER-NAME --> 05 represents the level in COBOL lay out. Level ranges from 01 to 49. Here CUSTOMER-NAME represents the field name.
FD --> This keyword is a file description level indicator that wiill explain the layout of the defined file.
WORKING-STORAGE SECTION --> WORKING-STORAGE SECTION is used as temporary storage when the program is executing. This section is deallocated when the program exits.
PROGRAM-ID --> PROGRAM-ID specifies the program name. The program name is specified and assigns selected program attributes to that program. It is a mandatory field, which can consits of 1 to 30 characters.
SELECT THIS-FILE ASSIGN RF17 --> The ASSIGN in the SELECT statement is used to mention whether the physical file name or the logical name, which can be mapped to physical name at runtime.
LABEL RECORDS ARE STANDARD --> The details about the data stored in the disk is present in the 'LABEL RECORDS ARE STANDARD', which is present in the first and last record of disk file. When a program access a particular disk, it checks if the file is correct by reading LABEL RECORDS.
PERFORM --> Used to execute a series of paragraph. It acts similar to GOTO statement and it returns the control back to the next executable statement after executing the specific statement.
PERFORM THAT UNTIL EOF="YES" --> In PERFORM UNTIL, a subsequent statements are executed until the give condition is satisfied. Here the condition is End of file.
300-PROCESS-REPORT --> This keyword processes the report.
FILE SECTION --> FILE SECTION points the data that is sent to or comes from files and other computer peripherals. It describes the fields within the record of each file that uses the program.
CONFIGURATION SECTION --> CONFIGURATION SECTION can describe the computer environment on which the program or class is compiled and executed and it is an optional section for programs and classes. CONFIGURATION SECTION can be specified only in the environment division of the outermost program of a COBOL program.
OPEN INPUT CUSTOMER-FILE --> This keyword is used to open a customer file in read only mode.
CLOSE CUSTOMER-FILE --> This keyword is used to close the customer file, once the processing of the file is completed.
STOP RUN --> This keyword word is written at the end of the main program that will return the control back to the OS. If there is any file opened by program, it will be closed by STOP RUN.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.