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

Q: How to use STRING with POINTER?

Answer:
STRING uses POINTER to track position: STRING field-1 DELIMITED SIZE INTO output WITH POINTER pos-var. Pointer shows next available position. Initialize before first STRING. Check for overflow. Continue STRING in multiple statements.
JCL ⭐ Featured
👁 0

Q: What causes S0C4 in batch?

Answer:
S0C4 is protection exception - addressing unallocated memory. Causes: uninitialized pointer, subscript out of range, incorrect LINKAGE SECTION. Check CEEDUMP for offset. Likely program bug. Use debugger to trace.
COBOL
👁 0

Q: What is POINTER data type?

Answer:
USAGE POINTER stores memory addresses. SET ptr TO ADDRESS OF data. Used with SET ADDRESS OF linkage-item TO ptr. CALL with BY REFERENCE returns addresses. Supports dynamic memory and chained structures.
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.
COBOL
👁 0

Q: What is PROCEDURE-POINTER?

Answer:
USAGE PROCEDURE-POINTER stores program addresses. SET proc-ptr TO ENTRY 'PROGNAME'. CALL proc-ptr. Enables dynamic program selection. Similar to function pointers. Used in table-driven designs. Check ADDRESS OF for validity.
CICS
👁 0

Q: What is GETMAIN?

Answer:
GETMAIN allocates temporary storage. EXEC CICS GETMAIN SET(pointer) LENGTH(size) INITIMG(X'00'). Returns pointer. Use for dynamic memory. FREEMAIN releases. SHARED for multi-task access. Automatic cleanup on task end.