DB2 ⭐ Featured
👁 0

Q: What is SQLCODE and what are common values?

Answer:

SQLCODE is a return code in SQLCA indicating the result of SQL execution.

Common SQLCODE values:

0Successful execution
100No data found / End of cursor
-803Duplicate key on insert
-811Multiple rows returned for singleton SELECT
-904Unavailable resource
-911Deadlock/timeout
-922Authorization failure
-927DB2 not available

Negative = Error, 0 = Success, 100 = No data

COBOL ⭐ Featured
👁 0

Q: What is PIC clause editing?

Answer:
Picture editing characters: Z=zero suppress, *=check protect, +=sign, -=negative, CR/DB=credit/debit, $=currency, .=decimal, ,=comma, B=blank. Example: PIC ,ZZ9.99- displays $ 123.45-. Insertion characters add to display.
JCL ⭐ Featured
👁 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.
DB2 ⭐ Featured
👁 0

Q: What is indicator variable?

Answer:
Indicator variable detects NULL values. Declare: 01 col-var. 01 col-ind PIC S9(4) COMP. Use: INTO :col-var:col-ind. If col-ind < 0, value is NULL. Set indicator negative to insert NULL. Required for nullable columns.
COBOL
👁 0

Q: How to handle negative numbers?

Answer:
Sign stored in PIC S9. SIGN IS LEADING/TRAILING SEPARATE CHARACTER for explicit sign byte. COMP-3 sign in low nibble. Display: S9(5)- shows trailing minus. +9(5) shows sign always. DB/CR for accounting format.