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 does INSPECT work?

Answer:
INSPECT examines/modifies string contents. INSPECT field TALLYING counter FOR ALL 'X'. INSPECT field REPLACING ALL 'A' BY 'B'. INSPECT field CONVERTING 'abc' TO '123'. Useful for data validation, transformation, and counting characters.
COBOL ⭐ Featured
👁 0

Q: Explain JUSTIFIED RIGHT clause

Answer:
JUSTIFIED RIGHT aligns alphanumeric receiving field contents to right. 05 WS-NAME PIC X(10) JUSTIFIED RIGHT. MOVE 'ABC' TO WS-NAME gives ' ABC'. Default is left justified. Only for alphanumeric elementary items.
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.
COBOL ⭐ Featured
👁 0

Q: How to use UNSTRING with TALLYING?

Answer:
UNSTRING field-1 DELIMITED BY ',' INTO field-2 field-3 TALLYING IN count-var. Count-var shows how many receiving fields got data. With COUNT IN, tracks characters per field. ALL delimiter allows multiple consecutive delimiters as one.
JCL ⭐ Featured
👁 0

Q: Explain PARM parameter

Answer:
PARM passes data to program. EXEC PGM=PROG,PARM='value'. Max 100 characters. Program receives length prefix. PARM='abc,xyz' passes as one string. Program parses. Special chars need quotes. Alternative: SYSIN for larger data.
CICS ⭐ Featured
👁 0

Q: How to use temporary storage?

Answer:
TS queue stores data across tasks. EXEC CICS WRITEQ TS QUEUE(name) FROM(data). READQ retrieves. DELETEQ removes. ITEM number for multiple items. MAIN/AUXILIARY for storage type. Named by string.
COBOL
👁 0

Q: What is reference modification?

Answer:
Reference modification extracts substring: WS-FIELD(start:length). WS-NAME(1:3) gets first 3 characters. Can use in MOVE, IF, DISPLAY. Start position is 1-based. Length optional (to end). More flexible than REDEFINES for variable positions.
VSAM
👁 0

Q: How to handle multi-string access?

Answer:
STRNO parameter defines concurrent requests. More strings for high-activity files. Costs memory per string. JCL: AMP='STRNO=5'. Default usually 1. Batch usually needs 1-2.
COBOL
👁 0

Q: Explain ALPHABET clause

Answer:
ALPHABET defines custom collating sequence. ALPHABET MY-SEQ IS 'A' THRU 'Z' 'a' THRU 'z'. Or ALPHABET ASCII IS STANDARD-1. Use with COLLATING SEQUENCE. Affects string comparisons and SORT. Define in SPECIAL-NAMES.
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.
JCL
👁 0

Q: How to use DYNAM in JCL?

Answer:
Dynamic allocation via BPXWDYN or TSO ALLOC. From program: call BPXWDYN with parm string. JCL can't do dynamic allocation itself. Programs allocate as needed. More flexible than static JCL allocation.
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.
DB2
👁 0

Q: What is SUBSTR function?

Answer:
SUBSTR extracts substring. SUBSTR(string, start, length). SUBSTR(name, 1, 3) gets first 3 chars. Position starts at 1. Length optional (to end). Can use in WHERE for pattern matching.