Prerequisite:
A sorted input dataset with record length 100 contains at least one record for all the values '1', '2', '3' in
the first byte. The applied sort criteria is 1,100,ch,a.
Requirements:
1 .) All records with '1' in the first byte must be ignored.
2 .) All records with '2' in the first byte must be written to the output dataset.
3 .) If there is a '3' in the first byte, the program must not read more records.
4 .) The program must not abend or loop infinitely.
If the following code does not fulfill the requirements above, which would be the reason, if any?
DCL DDIN FILE RECORD INPUT;
DCL DDOUT FILE RECORD OUTPUT;
DCL 1 INSTRUC,
3 A CHAR(1),
3 * CHAR(99);
DCL EOF_IN BIT(1) INIT('0'B);
DCL (Z1,Z2,Z3,ZO) BIN FIXED(31) INIT(0);
ON ENDFILE(DDIN) EOF IN = '1'B;
READ FILE(DDIN) INTO (INSTRUC);
IF EOF_IN THEN LEAVE;
SELECT(INSTRUC .A);
WHEN('1') DO;
Z1 += Z1;
ITERATE LAB;
END;
WHEN('3') DO;
Z3 = Z3 + 1;
LEAVE;
END;
WHEN('2') DO;
Z2 = Z2 + 1;
WRITE FILE(DDOUT) FROM(INSTRUC);
END;
OTHER DO;
ZO = ZO + 1;
PUT SKIP LIST(INSTRUC.A);
END; END;/*SELECT*/
END;/*LOOP*/
- A. The code does not fulfill the requirement, because the READ iteration will not be left when the first
record with '3' in the first byte appears.
- B. The code fulfills the requirement.
- C. The code does not fulfill the requirement, because not all records with '2' in the first byte will be written
to the output dataset.
- D. The code does not fulfill the requirement, because the program will loop infinitely.
Reveal Solution
Discussion