👁 0
Q: What is the difference between COND and IF/THEN/ELSE in JCL?
Answer:
COND Parameter:
- Tests return codes from previous steps
- Bypasses step if condition is TRUE
- Works opposite to programming logic!
- COND=(4,LT) means: Skip if 4 < any previous RC
IF/THEN/ELSE:
- More intuitive programming-like syntax
- Executes steps when condition is TRUE
- Supports AND, OR operators
- Can check ABEND conditions
Example:
// Using COND (skip if RC < 4) //STEP2 EXEC PGM=PROG2,COND=(4,LT) // Using IF/THEN/ELSE // IF STEP1.RC = 0 THEN //STEP2 EXEC PGM=PROG2 // ELSE //ERROR EXEC PGM=ERRPROC // ENDIF
👁 0
Q: What is 88-level condition name?
Answer:
88-level defines condition names for field values. 01 WS-STATUS PIC X. 88 VALID-STATUS VALUE 'Y'. 88 INVALID-STATUS VALUE 'N'. Use in IF: IF VALID-STATUS. Set using SET VALID-STATUS TO TRUE. Makes code self-documenting.
👁 0
Q: How to use CONTINUE statement?
Answer:
CONTINUE is a no-operation placeholder. Useful in EVALUATE when certain conditions need no action: WHEN 'X' CONTINUE. In IF: IF condition CONTINUE ELSE action. Maintains structure without dummy statements. Not a GOTO target.
👁 0
Q: What is USE BEFORE REPORTING?
Answer:
In Report Writer, USE BEFORE REPORTING procedure runs before printing. USE BEFORE REPORTING report-group-name. Allows dynamic modification of report data. Can suppress or modify lines based on runtime conditions.
👁 0
Q: What is the difference between COND and IF/THEN/ELSE?
Answer:
COND tests return codes to skip steps (negative logic - skips IF true). IF/THEN/ELSE tests conditions to execute steps (positive logic). IF supports complex expressions, COND is simpler but confusing. IF preferred for readability. COND on JOB affects all steps; on EXEC affects that step.
👁 0
Q: How to use //IF statement?
Answer:
//IF (condition) THEN executes following steps if true. Conditions: RC, ABEND, ABENDCC, RUN, STEP.RC. Example: //IF (STEP1.RC = 0) THEN ... //ENDIF. Can nest. ELSE available. Clearer than COND parameter.
👁 0
Q: What is NOHANDLE option?
Answer:
NOHANDLE suppresses condition handling. EXEC CICS command NOHANDLE RESP(ws-resp). Program handles all conditions. No HANDLE CONDITION invoked. Cleaner error handling. Recommended approach.
👁 0
Q: What is EVALUATE statement and when to use it?
Answer:
EVALUATE is COBOL's case/switch construct. Syntax: EVALUATE TRUE WHEN condition-1 statement WHEN OTHER default END-EVALUATE. More readable than nested IF for multiple conditions. Can evaluate multiple subjects and use THRU for ranges.
👁 0
Q: What is DECLARATIVES section?
Answer:
DECLARATIVES contains USE procedures for exception handling. USE AFTER ERROR PROCEDURE ON file-name handles file errors. USE AFTER EXCEPTION handles specific conditions. Must be first in PROCEDURE DIVISION. END DECLARATIVES marks end.
👁 0
Q: What is ON SIZE ERROR?
Answer:
ON SIZE ERROR traps arithmetic overflow. COMPUTE X = A + B ON SIZE ERROR PERFORM error-handler END-COMPUTE. Also NOT ON SIZE ERROR for success. Must be enabled (TRUNC option). Prevents abends from overflow conditions.
👁 0
Q: Explain CICS event processing
Answer:
CICS events for complex situations. WAIT EVENT for multiple conditions. Posted externally. WAIT EXTERNAL alternative. Modern: EVENT binding for async.