👁 0
Q: Explain STRING and UNSTRING operations
Answer:
STRING concatenates multiple fields into one: STRING field-1 DELIMITED BY SPACE field-2 INTO output-field. UNSTRING splits one field into multiple: UNSTRING input-field DELIMITED BY ',' INTO field-1 field-2. Both support POINTER for position tracking and OVERFLOW handling.
👁 0
Q: What is encoding scheme?
Answer:
Encoding defines character representation. EBCDIC for mainframe. ASCII for open systems. Unicode for international. CCSID specifies exact encoding. Mixed encoding needs careful handling. TRANSLATE for conversion.
👁 0
Q: How to handle CLOB in COBOL?
Answer:
Declare: 01 CLOB-VAR SQL TYPE IS CLOB(1M). Or use LOB locator: 01 CLOB-LOC SQL TYPE IS CLOB_LOCATOR. FREE LOCATOR releases. DBMS_LOB procedures for manipulation. Large CLOBs need special handling.
👁 0
Q: How to handle CICS RESP codes?
Answer:
RESP and RESP2 capture command results. EXEC CICS command RESP(ws-resp) RESP2(ws-resp2). Check DFHRESP(NORMAL) for success. RESP contains condition. RESP2 has additional info. Always check after commands.
👁 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: Explain EROPT parameter?
Answer:
EROPT specifies error handling. DCB=(EROPT=ABE/ACC/SKP). ABE=abend on error, ACC=accept and continue, SKP=skip block. For tape I/O errors. Program may handle differently. Default is ABE.
👁 0
Q: Explain NULL handling in DB2
Answer:
NULL means unknown/missing value. NULL != NULL returns unknown. Use IS NULL, IS NOT NULL. COALESCE(col, default) substitutes. NULL in arithmetic yields NULL. Indicator variables detect NULL in COBOL. NVL function alternative.
👁 0
Q: Explain COALESCE function
Answer:
COALESCE returns first non-NULL argument. COALESCE(col1, col2, 'default'). Useful for NULL handling. VALUE is synonym. Common: COALESCE(nullable_col, 0) for calculations. Can chain multiple expressions.
👁 0
Q: What is FILE STATUS and common codes?
Answer:
FILE STATUS is a 2-byte field capturing I/O operation results. 00=success, 10=end-of-file, 22=duplicate key, 23=record not found, 35=file not found, 39=file attribute mismatch, 41=file already open, 47=not opened input. Essential for error handling.
👁 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 APPLY WRITE-ONLY?
Answer:
APPLY WRITE-ONLY FOR file-name optimizes output buffer handling. System doesn't preserve record area after WRITE. Can't re-read just-written record. Improves I/O performance. Use when write-only access pattern is guaranteed.
👁 0
Q: What is HANDLE ABEND?
Answer:
HANDLE ABEND traps abends. EXEC CICS HANDLE ABEND PROGRAM(abend-prog) or LABEL(abend-para). Allows cleanup before termination. CANCEL removes handler. Use for graceful error handling.