COBOL ⭐ Featured
👁 0

Q: How does SEARCH ALL differ from SEARCH?

Answer:
SEARCH performs a sequential/linear search from the current index position. SEARCH ALL performs a binary search requiring the table to be sorted (ASCENDING/DESCENDING KEY clause) and indexed. SEARCH ALL is faster for large tables but requires sorted data.
DB2 ⭐ Featured
👁 0

Q: How to tune DB2 queries?

Answer:
Check EXPLAIN output. Look at: access type (index vs scan), join method, sort operations. Add indexes for predicates. Rewrite with hints. Update statistics. Check for full tablespace scans. Monitor actual execution.
COBOL ⭐ Featured
👁 0

Q: How to handle EBCDIC/ASCII conversion?

Answer:
COBOL on mainframe uses EBCDIC natively. For ASCII conversion: use INSPECT CONVERTING, or file translation (JCL), or LE functions. NATIONAL-OF and DISPLAY-OF for Unicode. Different collating sequences affect SORT and comparisons.
COBOL ⭐ Featured
👁 0

Q: What is OBJECT-COMPUTER paragraph?

Answer:
OBJECT-COMPUTER describes execution machine. OBJECT-COMPUTER. IBM-3090. MEMORY SIZE clause deprecated. PROGRAM COLLATING SEQUENCE for sort order. SEGMENT-LIMIT for overlay. Mostly documentation now; compiler usually ignores.
VSAM ⭐ Featured
👁 0

Q: How to load VSAM from sequential?

Answer:
REPRO INFILE(seqfile) OUTFILE(vsamfile). REPLACE option to overwrite existing. Records must match VSAM format. For KSDS, records must be sorted by key. IDCAMS job.
DB2 ⭐ Featured
👁 0

Q: How to use UNION?

Answer:
UNION combines SELECT results. UNION removes duplicates, UNION ALL keeps all. Column count and types must match. ORDER BY at end only. UNION expensive due to sort. Use UNION ALL if duplicates OK or impossible.
DB2 ⭐ Featured
👁 0

Q: What is DISTINCT keyword?

Answer:
DISTINCT eliminates duplicate rows. SELECT DISTINCT col FROM table. Applies to entire row, not single column. Causes sort for duplicate elimination. Performance impact. Avoid if possible. Sometimes indicates bad design.
COBOL
👁 0

Q: What is SORT and MERGE in COBOL?

Answer:
SORT orders records: SORT SORT-FILE ON ASCENDING KEY-FIELD USING INPUT-FILE GIVING OUTPUT-FILE. INPUT/OUTPUT PROCEDURE allows processing during sort. MERGE combines pre-sorted files: MERGE SORT-FILE ON KEY USING FILE-1 FILE-2 GIVING OUTPUT-FILE.
DB2
👁 0

Q: Explain access path selection

Answer:
Optimizer chooses access path based on statistics, predicates, indexes. Index scan vs tablespace scan. Join methods: nested loop, merge scan, hybrid. Sort operations. EXPLAIN reveals choice. Tuning influences path.
COBOL
👁 0

Q: How to define table with KEY?

Answer:
For binary search, tables need KEY: 05 WS-TABLE OCCURS 100 ASCENDING KEY WS-CODE INDEXED BY WS-IDX. 10 WS-CODE PIC X(5). 10 WS-DESC PIC X(20). SEARCH ALL requires sorted data per KEY. Multiple keys for complex sorts.
COBOL
👁 0

Q: What is COLLATING SEQUENCE?

Answer:
PROGRAM COLLATING SEQUENCE IS sequence-name. Affects comparisons and SORT order. Define custom alphabet in SPECIAL-NAMES. Standard is NATIVE (EBCDIC). ASCII for ASCII order. STANDARD-1 for ASCII collating.
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.
JCL
👁 0

Q: Explain DFSORT utility

Answer:
DFSORT sorts/merges files. SYSIN has SORT FIELDS=(1,10,CH,A). SORTIN=input, SORTOUT=output. Options: INCLUDE/OMIT for filtering, OUTREC/INREC for reformatting, SUM for summarization. ICETOOL provides extended functions.
JCL
👁 0

Q: How does MERGE work?

Answer:
DFSORT MERGE combines pre-sorted files. SORTIN01, SORTIN02, etc. inputs. MERGE FIELDS=(1,10,CH,A). Files must be sorted on merge key. Output one sorted file. Preserves input order for equal keys.
DB2
👁 0

Q: What is EXPLAIN and how to use it?

Answer:
EXPLAIN analyzes query access path. EXPLAIN PLAN SET QUERYNO=1 FOR SELECT... Results in PLAN_TABLE. Shows index usage, join method, sort operations. Use for performance tuning. Review ACCESSTYPE, MATCHCOLS, PREFETCH columns.
DB2
👁 0

Q: Explain DECLARE CURSOR syntax

Answer:
DECLARE cursor-name CURSOR FOR SELECT... WITH HOLD keeps open after COMMIT. WITH RETURN returns to caller. FOR UPDATE OF allows positioned update. FOR READ ONLY optimizes read. ORDER BY for sorting. Static or dynamic declaration.
VSAM
👁 0

Q: How to use BLDINDEX utility?

Answer:
BLDINDEX creates AIX entries from base. IDCAMS BLDINDEX INDATASET(base) OUTDATASET(aix). Reads base cluster, writes AIX. Required after AIX definition. EXTERNALSORT for large datasets.
DB2
👁 0

Q: Explain ORDER BY options

Answer:
ORDER BY sorts results. ORDER BY col1 ASC, col2 DESC. ASC default. NULLS FIRST/LAST controls NULL position. Ordinal: ORDER BY 1, 2 uses column positions. ORDER BY CASE for custom order. Affects performance.