👁 0
Q: What is UDF (User Defined Function)?
Answer:
UDF extends SQL with custom functions. CREATE FUNCTION name(params) RETURNS type AS BEGIN logic END. Scalar returns single value. Table function returns rows. Use in SELECT, WHERE like built-in functions.
👁 0
Q: How to create image copy?
Answer:
COPY utility creates backup. COPY TABLESPACE db.ts. FULL or INCREMENTAL. SHRLEVEL REFERENCE or CHANGE. Store in GDG for versions. Regular copies essential for recovery. COPYTOCOPY duplicates copies.
👁 0
Q: What is RENAMES clause?
Answer:
RENAMES (66-level) creates alternative groupings of elementary items. 01 REC. 05 FIELD-A PIC X(5). 05 FIELD-B PIC X(5). 05 FIELD-C PIC X(5). 66 FIELDS-AB RENAMES FIELD-A THRU FIELD-B. Provides different data views without memory overhead.
👁 0
Q: What is dynamic SQL?
Answer:
Dynamic SQL constructed at runtime. PREPARE creates executable. EXECUTE runs it. EXECUTE IMMEDIATE for one-time. DECLARE CURSOR for queries. More flexible but less efficient than static. Security concerns (injection).
👁 0
Q: Explain VIEW creation
Answer:
VIEW is saved query. CREATE VIEW name AS SELECT... WITH CHECK OPTION enforces WHERE on updates. Can be updatable if simple. Views for security, simplification. Materialized views (MQT) store data.
👁 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.
👁 0
Q: What is referential integrity?
Answer:
RI ensures foreign key values exist in parent. CREATE TABLE child ... REFERENCES parent(key). ON DELETE CASCADE/SET NULL/RESTRICT. DB2 enforces automatically. Constraint violations return -530/-531. Design carefully.
👁 0
Q: What is tablespace?
Answer:
Tablespace is storage container for tables. CREATE TABLESPACE name IN database USING STOGROUP. Contains one or more tables. Segmented/universal tablespace types. Management at tablespace level (REORG, COPY, RECOVER).
👁 0
Q: What is VSAM catalog?
Answer:
ICF catalog stores VSAM metadata. Aliases point to catalogs. DEFINE USERCATALOG creates. LISTCAT shows entries. Recovery important - losing catalog is disaster. BCS (Basic Catalog Structure) and VVDS on volume.
👁 0
Q: How to create VSAM backup?
Answer:
REPRO to sequential file: REPRO INFILE(vsam) OUTFILE(backup). Or EXPORT for full backup with catalog info. Can also use DFSMS backup. REPRO most common for simple backup.
👁 0
Q: What is XML GENERATE?
Answer:
XML GENERATE creates XML from data. XML GENERATE output FROM data-item. Optional: COUNT IN length, WITH ENCODING, WITH XML-DECLARATION. Generates element for each field. Names from data names. COBOL 5+ feature.
👁 0
Q: How to pass data between steps?
Answer:
Use DISP=PASS to pass datasets. Receiving step references same DSN. Or use symbolic parameters. GDG allows relative references (+1 created, 0 passed). Temporary datasets (&& prefix) auto-pass. SYSIN instream data copied to subsequent steps.
👁 0
Q: How to define GDG in JCL?
Answer:
Create GDG base with IDCAMS DEFINE GDG. Reference generations: DSN=MY.GDG(+1) for new, DSN=MY.GDG(0) for current, DSN=MY.GDG(-1) for previous. DISP=(NEW,CATLG) for +1. Model DSCB needed for SMS-managed datasets.
👁 0
Q: What is BMS?
Answer:
BMS (Basic Mapping Support) handles screen I/O. Map defines screen layout. DFHMSD macro creates mapset. SEND MAP displays screen. RECEIVE MAP gets input. Symbolic map in COBOL copybook. Physical map in load library.
👁 0
Q: Explain CICS task and transaction
Answer:
Transaction is unit of work started by TRANSID. Task is CICS execution instance. One transaction may create multiple tasks. Task has TCA (Task Control Area). EIBTRNID has transaction ID. Concurrent tasks share resources.
👁 0
Q: What is JESDS parameter?
Answer:
JESDS specifies JES dataset for OUTPUT. JESDS=ALL creates JESMSGLG, JESJCL, JESYSMSG. JESDS=LOG for JESMSGLG only. On OUTPUT statement. Controls system output generation. Used for output management.
👁 0
Q: How to define VSAM in JCL?
Answer:
//DD DD DSN=VSAM.CLUSTER,DISP=SHR for existing. New cluster needs IDCAMS DEFINE CLUSTER. JCL references cluster, not data/index. AMP parameter for VSAM options: AMP=(BUFNI=8,BUFND=4). Cannot create VSAM with JCL alone.
👁 0
Q: What is PPT?
Answer:
PPT (Processing Program Table) defines programs. Now RDO PROGRAM definition. Contains: program name, language, resident status. CEDA DEFINE PROGRAM creates entry.
👁 0
Q: How to reference PDS member?
Answer:
DSN=PDS.NAME(MEMBER). Direct member reference. DISP must allow access. For input, member must exist. For output, overwrites or creates. IEBCOPY for multiple members. Member name 1-8 characters.
👁 0
Q: What is SEGMENT parameter?
Answer:
SEGMENT limits output lines per dataset. On OUTPUT statement. SEGMENT=nnn pages per segment. JES creates multiple output datasets. Helps with huge print files. Easier to handle smaller pieces.
👁 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.
👁 0
Q: What is clustered index?
Answer:
Clustered index determines physical row order. Only one per table. Other indexes are secondary. CLUSTER keyword on CREATE INDEX. Good for range queries on cluster key. REORG restores clustering after updates.
👁 0
Q: Explain RANK vs DENSE_RANK
Answer:
RANK() creates gaps for ties: 1,2,2,4. DENSE_RANK() no gaps: 1,2,2,3. ROW_NUMBER() no ties: 1,2,3,4. RANK useful for competition ranking. DENSE_RANK for level assignment. Choose based on need.
👁 0
Q: What is stored procedure?
Answer:
Stored procedure is saved SQL code. CREATE PROCEDURE name(params) BEGIN SQL statements END. CALL name(values) executes. Can have IN/OUT/INOUT parameters. Reduces network traffic. Logic in database. Security benefits.
👁 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.
👁 0
Q: What is DCLGEN?
Answer:
DCLGEN generates COBOL declarations from table. DCLGEN TABLE(name) LIBRARY(dataset) STRUCTURE(host-struct-name). Creates copybook with field definitions. Essential for maintaining table-program consistency.
👁 0
Q: What is VOLATILE table?
Answer:
VOLATILE TABLE hints optimizer to expect different row counts. Useful for varying cardinality. CREATE TABLE ... VOLATILE CARDINALITY. Or ALTER TABLE ... VOLATILE. Helps when statistics mislead optimizer.
👁 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.
👁 0
Q: How to use OCCURS DEPENDING ON?
Answer:
OCCURS DEPENDING ON creates variable-length tables. 01 WS-TABLE. 05 WS-COUNT PIC 99. 05 WS-ITEM OCCURS 1 TO 100 DEPENDING ON WS-COUNT. Only variable entries allocated based on counter. Used with variable length records.
👁 0
Q: What is table compression?
Answer:
Compression reduces storage. Huffman encoding in dictionary. CREATE TABLE ... COMPRESS YES. REORG to compress existing. CPU trade-off for I/O savings. Good for read-heavy, large tables.
👁 0
Q: What is ALIAS?
Answer:
ALIAS is alternate name for table. CREATE ALIAS alias FOR table. Useful for cross-subsystem access. Synonym is similar. PUBLIC alias visible to all. ALIAS can point to table in different schema.
👁 0
Q: Explain storage group
Answer:
Storage group defines volumes for data. CREATE STOGROUP name VOLUMES(vol1, vol2). Tablespaces assigned to stogroups. DB2 manages space within. PRIQTY/SECQTY control allocation. Foundation of storage management.
👁 0
Q: What is OPEN mode options?
Answer:
OPEN INPUT for read, OUTPUT for write (creates), I-O for read/update, EXTEND for append. Multiple files per OPEN. OPEN OUTPUT deletes existing file! EXTEND preserves and adds. File must be closed before reopening in different mode.
👁 0
Q: Explain ENTRY statement
Answer:
ENTRY creates alternate entry point in subprogram. ENTRY 'ALTNAME' USING params. Called program appears under different name. Useful for multiple functions in one load module. Each ENTRY has own parameters. Not standard-use carefully.
👁 0
Q: Explain EXPORT utility
Answer:
EXPORT creates portable copy with catalog info. IDCAMS EXPORT ds.name OUTFILE(dd). Includes cluster definition. IMPORT recreates on target system. Good for migration.
👁 0
Q: Explain JSON GENERATE
Answer:
JSON GENERATE creates JSON from data. JSON GENERATE output FROM data-item. NAME clause for custom keys. SUPPRESS clause omits fields. COUNT IN length. COBOL V6+ feature. Generates name-value pairs from structure.
👁 0
Q: How does DISP parameter work?
Answer:
DISP=(status,normal-end,abnormal-end). Status: NEW/OLD/SHR/MOD. Normal-end: DELETE/KEEP/PASS/CATLG/UNCATLG. Abnormal-end: same options. Example: DISP=(NEW,CATLG,DELETE) creates new, catalogs if OK, deletes if abend. MOD appends or creates if not exists.
👁 0
Q: How to create temporary VSAM?
Answer:
Use REUSE attribute. Or define/delete in same job. Or use GDG-like naming. JCL doesn't support && for VSAM. IDCAMS DELETE at job end. Cannot be truly temporary like sequential.
👁 0
Q: What is IEFBR14?
Answer:
IEFBR14 is null program (Branch to Register 14 = return). Returns immediately. Used for dataset management: create, delete, catalog datasets. //DELETE EXEC PGM=IEFBR14 //DD DD DSN=name,DISP=(MOD,DELETE). Common for housekeeping.
👁 0
Q: What is IDCAMS utility?
Answer:
IDCAMS manages VSAM and catalog. Commands: DEFINE CLUSTER, DELETE, REPRO, LISTCAT, ALTER, PRINT. //SYSIN DD * has commands. REPRO copies VSAM files. DEFINE creates VSAM clusters. IF/THEN/ELSE for conditional processing.
👁 0
Q: How does IEFBR14 delete work?
Answer:
//DEL EXEC PGM=IEFBR14 //DD DD DSN=file,DISP=(MOD,DELETE). If file exists, DISP=(MOD,DELETE) deletes. If not exists, MOD creates then deletes (empty). Or DISP=(OLD,DELETE) fails if not exists. Common pattern for cleanup.
👁 0
Q: How to allocate PDSE?
Answer:
DSNTYPE=LIBRARY creates PDSE. Better than PDS: dynamic directory, member-level sharing, no compression needed. Or DATACLAS with PDSE attribute. Cannot convert back to PDS easily. Recommended for new PDSes.
👁 0
Q: What is FCT?
Answer:
FCT (File Control Table) defines files. Now RDO FILE. Maps name to VSAM cluster. Status, options, recovery. CEDA DEFINE FILE creates. LSR/NSR buffering options.
👁 0
Q: What is QIDERR?
Answer:
QIDERR is queue ID error. TS/TD queue not found. Check queue name. May need to create first (TS) or define (TD). Spelling error common.
👁 0
Q: What is DOCUMENT?
Answer:
DOCUMENT builds dynamic content. CREATE, SET, INSERT commands. For web responses. Template-based output. Modern CICS web support. Replace BMS for web.
👁 0
Q: How to use DOCTEMPLATE?
Answer:
DOCTEMPLATE defines dynamic content. Create template with symbols. Insert data at runtime. EXEC CICS DOCUMENT SET/INSERT. For generating responses.
👁 0
Q: What is BIND command?
Answer:
BIND creates plan/package from DBRM. BIND PLAN(name) MEMBER(dbrm). Options: ISOLATION, VALIDATE, EXPLAIN. REBIND updates existing. BIND PACKAGE for packages. Precompile creates DBRM, BIND makes executable.
👁 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.
👁 0
Q: How to split VSAM file?
Answer:
REPRO with FROMKEY/TOKEY extracts range. Create multiple target clusters. REPRO ranges to each. Or program logic to split. Consider partitioning design.