Multiple choice technology mainframe

IF A = 1 OR 2 OR 3 NEXT SENTENCE ELSE MOVE A TO B. Which of the following describes the above sentence correctly.

  1. IF A NOT = 1 OR 2 OR 3 MOVE A TO B.

  2. IF NOT A = 1 AND 2 AND 3 MOVE A TO B.

  3. IF A NOT = 1 AND 2 AND 3 MOVE A TO B.

  4. IF A NOT = 1 OR A NOT = 2 OR A NOT = 3 MOVE A TO B.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The statement 'IF A = 1 OR 2 OR 3 NEXT SENTENCE ELSE MOVE A TO B' means: if A equals 1, 2, or 3, execute the next sentence (skip the ELSE part); otherwise (if A is NOT 1 AND NOT 2 AND NOT 3), move A to B. The NEXT SENTENCE modifier means the true condition does nothing and continues to the next sentence. The negation of 'A = 1 OR 2 OR 3' is 'A NOT = 1 AND 2 AND 3' in COBOL syntax. Option A incorrectly uses OR instead of AND in the negation.