COBOL S0C7 ⭐ Featured
👁 0

Q: How do I fix S0C7 Data Exception ABEND?

Answer:

S0C7 occurs when the program tries to perform arithmetic on non-numeric data.

Common Causes:

  1. Uninitialized numeric fields (contains spaces/garbage)
  2. Moving alphanumeric data to numeric field
  3. Reading file with wrong record layout
  4. Array subscript accessing wrong memory

How to Fix:

  1. Initialize all numeric fields to ZEROS
  2. Validate input before arithmetic
  3. Check file layouts match
  4. Use DISPLAY to debug field contents
* Always initialize
INITIALIZE WS-RECORD.
MOVE ZEROS TO WS-AMOUNT.

* Validate before use
IF WS-INPUT IS NUMERIC
    COMPUTE WS-RESULT = WS-INPUT * 2
END-IF.
DB2 ⭐ Featured
👁 0

Q: What is MQT?

Answer:
MQT (Materialized Query Table) stores computed results. CREATE TABLE name AS (SELECT...) DATA INITIALLY DEFERRED REFRESH DEFERRED. Improves query performance. REFRESH TABLE updates. Use for aggregations, joins.
COBOL ⭐ Featured
👁 0

Q: What is OBJECT-COMPUTER paragraph?

Answer:
OBJECT-COMPUTER describes execution machine. OBJECT-COMPUTER. IBM-3090. MEMORY SIZE clause deprecated. PROGRAM COLLATING SEQUENCE for sort order. SEGMENT-LIMIT for overlay. Mostly documentation now; compiler usually ignores.
COBOL
👁 0

Q: Explain COMPUTE statement

Answer:
COMPUTE performs arithmetic with expression syntax. COMPUTE RESULT = (A + B) * C / D. Supports + - * / ** operators. ROUNDED option rounds result. ON SIZE ERROR handles overflow. Clearer than separate ADD/SUBTRACT/MULTIPLY/DIVIDE for complex formulas.
COBOL
👁 0

Q: How to use intrinsic functions?

Answer:
COBOL-85 intrinsic functions: FUNCTION LENGTH(field), FUNCTION CURRENT-DATE, FUNCTION UPPER-CASE(field), FUNCTION NUMVAL(field), FUNCTION MOD(a,b), FUNCTION INTEGER-OF-DATE(date). Use in expressions or with COMPUTE. Return values only, no side effects.
COBOL
👁 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.
COBOL
👁 0

Q: Explain FUNCTION LENGTH

Answer:
FUNCTION LENGTH returns byte count. FUNCTION LENGTH(field-name). For group items, includes all subordinates. For variable OCCURS, actual current length. Use in COMPUTE, MOVE, comparisons. Often used with STRING pointer initialization.