JCL ⭐ Featured
👁 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
JCL ⭐ Featured
👁 0

Q: What causes S222 abend?

Answer:
S222 is job cancelled by operator or system. S222-02 means JOB CANCEL command. S222-04 means TSO CANCEL. S222-08 means FORCE. Not program error - external intervention. Check with operations if unexpected.
DB2 ⭐ Featured
👁 0

Q: What is BETWEEN operator?

Answer:
BETWEEN tests range inclusively. WHERE col BETWEEN 1 AND 100. Equivalent to col >= 1 AND col <= 100. Works with dates, times. Can use NOT BETWEEN for exclusion. Index can be used for BETWEEN.
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.
DB2
👁 0

Q: How to concatenate strings?

Answer:
Use CONCAT(str1, str2) or || operator. CONCAT('Hello', ' ', 'World'). || works same: col1 || col2. Handles VARCHAR properly. NULL concatenation yields NULL (use COALESCE). RTRIM to remove trailing spaces.