IBM Natural Question:
Download Questions PDF

Suppose You are processing an input file in a Natural program and you want the program to fail if the file is empty. What command you use in Natural to force it to fail?

IBM Natural Interview Question
IBM Natural Interview Question

Answers:

Answer #1
You use the following steps to check whether the input file
is empty

Step A. Read work file #WK-Number once #WK-Record
Step B. At End of File
Write "Input file is Empty"
End-Endfile

The first step will read the first record in the file and
the next step will see the End of File condition. If the
File is empty, the program will write that we have an Empty
input file to spool.

Answer #2
If you want force the fail if file empty you must use statment TERMINATE and any response code
example
Read Work File 1 File-Name once
add to to rec-read
at end of file
if rec-read = 0
TERMINATE 99
end if

Download IBM Natural Interview Questions And Answers PDF

Previous QuestionNext Question
Explain the difference between External subroutine and
subprogram?
What happens when you issue a ESCAPE ROUTINE in a program?
Will there be any compilation /Run time erro?