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

Q: How to concatenate datasets?

Answer:
Stack DD statements: //INPUT DD DSN=FILE1,DISP=SHR // DD DSN=FILE2,DISP=SHR. No DD name on continuation. Read consecutively as one file. Different LRECL needs LRECL on first DD or DCB parameter. Concatenation limit varies by system.
DB2
👁 0

Q: How to prevent SQL injection?

Answer:
Use parameter markers (?), not concatenation. PREPARE stmt FROM 'SELECT * FROM t WHERE c = ?'. EXECUTE stmt USING :hostvar. Never build SQL with user input directly. Validate input. Use static SQL when possible.
JCL
👁 0

Q: What causes JCL error S013-14?

Answer:
S013-14 is member not found in PDS. Check: DD name matches program expectation, member name spelled correctly, library in concatenation contains member, DISP allows access. Use LISTDS or ISPF 3.4 to verify member exists.
JCL
👁 0

Q: What is STEPLIB vs JOBLIB?

Answer:
JOBLIB at job level provides program libraries for all steps. STEPLIB at step level overrides JOBLIB for that step. STEPLIB takes precedence. Both searched before LINKLIST. Multiple libraries concatenated. DDN must be STEPLIB/JOBLIB exactly.
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.