DB2 ⭐ Featured
👁 0

Q: When should I use COMMIT in DB2?

Answer:

COMMIT saves all changes since the last COMMIT and releases locks.

When to COMMIT:

  • After processing a logical unit of work
  • Periodically in long-running batch (every N records)
  • Before ending the program successfully

Frequency Guidelines:

  • Too frequent: Performance overhead
  • Too rare: Lock contention, large log
  • Typical: Every 100-1000 records in batch

Best Practice:

MOVE 0 TO WS-COMMIT-COUNT.

PERFORM PROCESS-RECORD.

ADD 1 TO WS-COMMIT-COUNT.
IF WS-COMMIT-COUNT >= 500
    EXEC SQL COMMIT END-EXEC
    MOVE 0 TO WS-COMMIT-COUNT
END-IF.

Note: In CICS, syncpoint (COMMIT) happens automatically at task end. Explicit SYNCPOINT is rarely needed.

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: Explain predicate types

Answer:
Stage 1 predicates evaluated by storage engine. Stage 2 evaluated by DB2 (more expensive). Indexable predicates can use index. Non-indexable force scan. Design for stage 1/indexable predicates. EXPLAIN shows predicate staging.
DB2 ⭐ Featured
👁 0

Q: What is index-only access?

Answer:
Index-only access retrieves data from index without table access. All needed columns in index (including by include clause). Best performance. EXPLAIN shows INDEXONLY=Y. Design indexes for common queries.
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: What is USAGE clause?

Answer:
USAGE specifies internal data representation. DISPLAY (default)=character, COMP/BINARY=binary, COMP-3/PACKED-DECIMAL=packed, COMP-1=single float, COMP-2=double float. Affects storage size and arithmetic performance.
DB2 ⭐ Featured
👁 0

Q: What is MQT?

Answer:
MQT (Materialized Query Table) stores computed results. CREATE TABLE name AS (SELECT...) DATA INITIALLY DEFERRED REFRESH DEFERRED. Improves query performance. REFRESH TABLE updates. Use for aggregations, joins.
DB2 ⭐ Featured
👁 0

Q: Explain database design normalization

Answer:
1NF: atomic values, no repeating groups. 2NF: 1NF + no partial dependencies. 3NF: 2NF + no transitive dependencies. BCNF: stricter 3NF. Higher forms reduce redundancy. Denormalize for performance. Balance is key.
DB2 ⭐ Featured
👁 0

Q: What is XML support in DB2?

Answer:
DB2 stores XML natively. XMLTYPE column. XMLPARSE, XMLSERIALIZE for conversion. XQuery for querying. XMLTABLE extracts relational from XML. XML indexes for performance. Powerful for document storage.
VSAM ⭐ Featured
👁 0

Q: What is CI and CA in VSAM?

Answer:
CI (Control Interval) is I/O unit, like block. Contains records, free space, control info. CA (Control Area) is group of CIs. CISIZE affects performance. CI split when full. CA split more expensive.
VSAM ⭐ Featured
👁 0

Q: What is SPANNED record?

Answer:
Spanned records exceed CI size, span multiple CIs. DEFINE CLUSTER ... RECORDSIZE(avg max) SPANNED. CI too small for max record. Performance impact. Use appropriately sized CI when possible.
COBOL ⭐ Featured
👁 0

Q: How to handle binary data?

Answer:
COMP/BINARY stores binary. PIC S9(4) COMP is halfword (2 bytes). PIC S9(9) COMP is fullword (4 bytes). PIC S9(18) COMP is doubleword (8 bytes). SYNC aligns for performance. Value range limited by bytes, not picture.
VSAM ⭐ Featured
👁 0

Q: How to improve KSDS performance?

Answer:
Appropriate CISIZE, FREESPACE. Adequate buffers (BUFND/BUFNI). Index in cache if possible. IMBED obsolete. Keep file organized (REORG). Monitor CA/CI splits. Sequential access for bulk.
VSAM ⭐ Featured
👁 0

Q: Explain MASSINSERT?

Answer:
MASSINSERT optimizes bulk sequential inserts. System defers CI splits. Better performance for loads. Implicit with REPRO. COBOL can hint with APPLY WRITE-ONLY style.
VSAM ⭐ Featured
👁 0

Q: What is STORAGECLASS?

Answer:
SMS STORAGECLASS for VSAM placement. STORCLAS on DEFINE. Controls performance, availability. ACS routines may assign. Modern storage management. Replaces explicit volume specifications.
VSAM ⭐ Featured
👁 0

Q: What is SPANNED records impact?

Answer:
Spanned records span CIs. More I/O for spanned record access. CI header overhead per CI. Avoid if possible by larger CI. Performance degradation for random access.
JCL ⭐ Featured
👁 0

Q: Explain BUFNO parameter

Answer:
BUFNO sets number of I/O buffers. DCB=(BUFNO=5). More buffers improve sequential performance but use memory. System default often 5. VSAM uses different buffering (BUFNI, BUFND). Too many can waste memory.
DB2 ⭐ Featured
👁 0

Q: How does REORG work?

Answer:
REORG physically reorganizes tablespace or index. Eliminates fragmentation, reclaims space, restores clustering. REORG TABLESPACE db.ts. Options: SHRLEVEL (REFERENCE/CHANGE), LOG (YES/NO). Schedule during low activity. Run RUNSTATS after.
CICS ⭐ Featured
👁 0

Q: What is CICS monitoring?

Answer:
CICS monitoring facilities. SMF 110 records. CICS statistics. Transaction analysis. Performance data. OMEGAMON for real-time. Capacity planning.
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.
VSAM ⭐ Featured
👁 0

Q: What is maximum VSAM key length?

Answer:
Maximum key length is 255 bytes. KEYS(255 offset). Practical limits lower for performance. Index size grows with key. Keep keys reasonably sized.
DB2 ⭐ Featured
👁 0

Q: Explain CREATE INDEX

Answer:
CREATE INDEX creates index on table. CREATE INDEX idx ON table(col1, col2). UNIQUE prevents duplicates. CLUSTER determines physical order. Include columns for index-only access. Drop unused indexes for insert performance.
DB2
👁 0

Q: Explain DB2 triggers

Answer:
Trigger fires automatically on INSERT/UPDATE/DELETE. CREATE TRIGGER name AFTER/BEFORE/INSTEAD OF event ON table FOR EACH ROW/STATEMENT. Use for audit, validation, derived columns. Can impact performance.
DB2
👁 0

Q: Explain sequence objects

Answer:
SEQUENCE generates unique numbers. CREATE SEQUENCE name START WITH 1 INCREMENT BY 1. NEXT VALUE FOR sequence-name gets next. Used for keys. Cached for performance. No gaps guaranteed.
COBOL
👁 0

Q: What is CORRESPONDING in COBOL?

Answer:
CORRESPONDING (CORR) operates on fields with matching names. MOVE CORRESPONDING record-1 TO record-2 moves all matching fields. ADD CORRESPONDING does arithmetic. Reduces code but requires careful naming. Not recommended for performance-critical code.
DB2
👁 0

Q: How to monitor DB2 performance?

Answer:
Use OMEGAMON, DB2PM, or built-in monitor. Check: buffer pool hit ratios, lock waits, CPU time, elapsed time. DISPLAY commands show real-time. Statistics trace for analysis. EXPLAIN for query level.
DB2
👁 0

Q: What is REBIND and when needed?

Answer:
REBIND updates access path without precompile. REBIND PACKAGE after RUNSTATS, index changes. REBIND PLAN for plan-level changes. Can improve or degrade performance - test first. EXPLAIN before/after.
COBOL
👁 0

Q: How to define and use indexes?

Answer:
INDEX defined with OCCURS: 05 WS-TABLE OCCURS 10 INDEXED BY WS-IDX. SET WS-IDX TO 5 sets position. SET WS-IDX UP/DOWN BY 1 changes position. Use SEARCH verb with index. More efficient than subscripts for table access.
DB2
👁 0

Q: What is zparm?

Answer:
ZPARM (DSNZPARMs) are DB2 installation parameters. Control system behavior, limits, defaults. DSNZPARM module loaded at startup. Changes need restart usually. Critical for performance and security tuning.
COBOL
👁 0

Q: What is SYNCHRONIZED clause?

Answer:
SYNCHRONIZED aligns binary items on natural boundaries for efficient access. 01 WS-GROUP. 05 WS-CHAR PIC X. 05 WS-BINARY PIC S9(8) COMP SYNC. Adds slack bytes as needed. Can waste space but improves performance. RIGHT/LEFT options available.
VSAM
👁 0

Q: Explain BUFND and BUFNI

Answer:
BUFND is data buffer count, BUFNI is index buffer count. More buffers improve performance but use memory. JCL AMP='BUFNI=10,BUFND=20'. Default usually 2. Tune based on access pattern.
COBOL
👁 0

Q: What is APPLY WRITE-ONLY?

Answer:
APPLY WRITE-ONLY FOR file-name optimizes output buffer handling. System doesn't preserve record area after WRITE. Can't re-read just-written record. Improves I/O performance. Use when write-only access pattern is guaranteed.
COBOL
👁 0

Q: What is BLOCK CONTAINS clause?

Answer:
BLOCK CONTAINS defines blocking factor. BLOCK CONTAINS 10 RECORDS or BLOCK CONTAINS 800 CHARACTERS. 0 RECORDS means system-determined. Affects I/O performance-larger blocks fewer I/Os. Must match JCL/VSAM definition.
VSAM
👁 0

Q: What is WRITECHECK?

Answer:
WRITECHECK verifies writes by reading back. Extra I/O for verification. Rarely needed with modern hardware. Can slow performance. Default off. Use only if data corruption suspected.
COBOL
👁 0

Q: What is SERVICE RELOAD?

Answer:
SERVICE RELOAD refreshes segmented program overlays. Forces segment reload from disk. Rarely needed with virtual storage. From overlay management era. May affect performance. Better to restructure program than use frequently.
VSAM
👁 0

Q: What is ORDERED attribute?

Answer:
ORDERED on DEFINE allocates volumes in specified order. Without ORDERED, system chooses. ORDERED ensures predictable allocation. May be important for performance tuning.
VSAM
👁 0

Q: How to monitor VSAM performance?

Answer:
SMF records for I/O counts. LISTCAT for statistics (READS, WRITES, SPLITS). RMF reports. Third-party tools. Track CI/CA splits, EXCP counts, buffer hit ratios.
JCL
👁 0

Q: What is AMP parameter?

Answer:
AMP specifies VSAM buffer parameters. AMP='BUFNI=8,BUFND=4' for index/data buffers. AMP='AMORG' for VSAM organization. OPTCD for options. Overrides VSAM cluster definitions for this run. Affects performance.
JCL
👁 0

Q: Explain STORCLAS parameter?

Answer:
STORCLAS assigns SMS storage class. STORCLAS=classname. Determines placement, management, backup. ACS routines may assign. Defines performance characteristics. Installation-defined classes.
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: What is DB2 buffer pool?

Answer:
Buffer pool caches data/index pages in memory. BP0, BP1, etc. Hit ratio critical for performance. GETPAGE vs SYNCIO shows effectiveness. Size appropriately. Virtual buffer pool for each pool. Monitor with statistics.
DB2
👁 0

Q: What is FETCH SENSITIVE cursor?

Answer:
SENSITIVE cursor reflects concurrent changes by other processes. EXEC SQL DECLARE cursor SENSITIVE STATIC/DYNAMIC SCROLL CURSOR. INSENSITIVE does not see changes. Affects isolation behavior. Consider performance impact.
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.