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.

CICS ⭐ Featured
👁 0

Q: What is the purpose of COMMAREA in CICS?

Answer:

COMMAREA (Communication Area) is used to pass data between programs or between transactions in pseudo-conversational programming.

Uses:

  • Pass data between LINK/XCTL programs
  • Save data between pseudo-conversational transactions
  • Maximum size: 32KB

How it works:

  1. Calling program: COMMAREA option on LINK/XCTL/RETURN
  2. Called program: DFHCOMMAREA in LINKAGE SECTION
  3. Check EIBCALEN for length (0 = no COMMAREA)
* Calling program
EXEC CICS LINK
    PROGRAM('SUBPROG')
    COMMAREA(WS-DATA)
    LENGTH(100)
END-EXEC.

* Called program
LINKAGE SECTION.
01 DFHCOMMAREA PIC X(100).

IF EIBCALEN > 0
    MOVE DFHCOMMAREA TO WS-DATA
END-IF.
DB2 ⭐ Featured
👁 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.
COBOL ⭐ Featured
👁 0

Q: Explain PROCEDURE DIVISION USING

Answer:
PROCEDURE DIVISION USING defines parameters for called program. Parameters match LINKAGE SECTION definitions. Order matches calling program's USING clause. Establishes addressability to passed data. BY REFERENCE/VALUE/CONTENT options inherited from CALL.
COBOL ⭐ Featured
👁 0

Q: Explain EXEC SQL statements

Answer:
EXEC SQL marks embedded DB2 SQL. EXEC SQL SELECT col INTO :host-var FROM table WHERE key = :key-var END-EXEC. Colon prefix for host variables. SQLCODE in SQLCA indicates result. Precompiler converts to COBOL calls.
COBOL ⭐ Featured
👁 0

Q: What is ALTER statement?

Answer:
ALTER changes GO TO target dynamically. ALTER para-1 TO PROCEED TO para-2. Obsolete-causes maintenance nightmares. Makes flow unpredictable. Use EVALUATE or SET/IF instead. Some shops prohibit. Still legal but strongly discouraged.
COBOL ⭐ Featured
👁 0

Q: How to use PERFORM EXIT?

Answer:
EXIT statement marks paragraph end. PERFORM PROCESS-DATA THRU PROCESS-EXIT. Process-exit paragraph contains only EXIT. Ensures consistent exit point. Can also GO TO exit paragraph. EXIT PROGRAM in subprogram returns to caller.
COBOL ⭐ Featured
👁 0

Q: What is EXEC CICS structure?

Answer:
EXEC CICS marks CICS commands. EXEC CICS READ FILE('name') INTO(area) RIDFLD(key) END-EXEC. Commands: READ, WRITE, SEND, RECEIVE, LINK, XCTL. RESP and RESP2 capture return codes. Translator converts to CALL.
VSAM ⭐ Featured
👁 0

Q: What is file status 41?

Answer:
Status 41 is file already open. Duplicate OPEN attempted. Check program flow. CLOSE before re-OPEN. May be logic error in nested calls. STATUS after OPEN shows this.
VSAM ⭐ Featured
👁 0

Q: What is EXAMINE utility?

Answer:
EXAMINE checks VSAM structural integrity. EXAMINE NAME(ds.name) INDEXTEST DATATEST. Finds problems in index, data. Run periodically or when problems suspected. Output shows errors.
VSAM ⭐ Featured
👁 0

Q: How to handle status 44?

Answer:
Status 44 is boundary violation on sequential WRITE. Record too large for file definition. Check RECORDSIZE parameter. May need variable length definition. Truncation doesn't happen automatically.
VSAM ⭐ Featured
👁 0

Q: Explain UPGRADE path AIX?

Answer:
UPGRADE AIX maintained automatically on base cluster changes. PATH allows access but not update. PATH with UPDATE allows updates via alternate key. UPGRADE adds overhead but keeps AIX current.
CICS ⭐ Featured
👁 0

Q: Explain LINK vs XCTL

Answer:
LINK calls program and returns. EXEC CICS LINK PROGRAM(name). Calling program resumes after LINK. XCTL transfers permanently - no return. EXEC CICS XCTL PROGRAM(name). Use LINK for subroutines, XCTL for navigation.
JCL ⭐ Featured
👁 0

Q: What is DD DATA statement?

Answer:
DD DATA marks instream data with delimiter. DD DATA,DLM=XX...data...XX. Default delimiter is /*. DLM needed when data contains /*. Data physically follows DD in JCL stream. Alternative: DD * for default delimiter.
CICS ⭐ Featured
👁 0

Q: What is EIB?

Answer:
EIB (Execute Interface Block) contains execution info. EIBCALEN=COMMAREA length. EIBTRNID=transaction. EIBAID=attention key. EIBDATE/EIBTIME=date/time. EIBRESP/EIBRESP2=response codes. Automatically available in COBOL.
JCL ⭐ Featured
👁 0

Q: What is DATACLAS parameter?

Answer:
DATACLAS assigns SMS data class. DATACLAS=classname. Defines DCB attributes, space, data type. ACS routines may assign automatically. Overrides explicit DCB. Simplifies JCL. Installation-defined classes.
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 INVOKE SERVICE?

Answer:
INVOKE SERVICE calls web service. EXEC CICS INVOKE SERVICE. PIPELINE processing. SOAP/REST support. Modern integration. Requires CICS TS 3.1+.
VSAM ⭐ Featured
👁 0

Q: How to handle SMS conversion?

Answer:
SMS manages storage automatically. Migrate VSAM to SMS: DATACLAS, STORCLAS, MGMTCLAS. ACS routines for assignment. Remove explicit VOL/UNIT. Benefits: automation, management.
DB2
👁 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.
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: What is CHECK utility?

Answer:
CHECK validates data integrity. CHECK DATA TABLESPACE db.ts. Finds constraint violations, orphan rows. CHECK INDEX validates index structure. CHECK LOB for LOB issues. Run periodically or after issues.
COBOL
👁 0

Q: Explain PERFORM VARYING with example

Answer:
PERFORM VARYING executes a paragraph while incrementing a counter. Syntax: PERFORM para-name VARYING WS-IDX FROM 1 BY 1 UNTIL WS-IDX > 10. The counter is initialized, tested, and incremented automatically. Can have nested VARYING with AFTER clause.
COBOL
👁 0

Q: What is the purpose of COPY statement?

Answer:
COPY includes copybook members at compile time, promoting code reuse and standardization. Syntax: COPY copybook-name. REPLACING clause allows field substitution. Copybooks typically contain record layouts, working-storage definitions, and common routines.
COBOL
👁 0

Q: Explain CALL statement and parameters

Answer:
CALL invokes subprogram: CALL 'SUBPROG' USING param-1 param-2. BY REFERENCE (default) passes address. BY CONTENT passes copy. BY VALUE passes value (for C). ON EXCEPTION handles load failures. CANCEL releases memory.
COBOL
👁 0

Q: What is LINKAGE SECTION?

Answer:
LINKAGE SECTION defines parameters received from calling program. Items here have no memory until CALL provides addresses via USING clause. Address established at runtime. Used for both passed parameters and dynamically addressed data.
COBOL
👁 0

Q: What is GOBACK vs STOP RUN?

Answer:
STOP RUN terminates entire run unit (all programs). GOBACK returns to caller; if main program, acts like STOP RUN. Use GOBACK in subprograms to return control. STOP RUN from subprogram ends everything unexpectedly.
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.
VSAM
👁 0

Q: Explain UPGRADE attribute

Answer:
UPGRADE keeps AIX synchronized with base cluster. Changes to base automatically update upgraded AIX. Adds overhead to writes. Non-upgrade AIX needs manual BLDINDEX. Use UPGRADE for real-time currency.
COBOL
👁 0

Q: What is CURSOR IS clause?

Answer:
In Screen Section, CURSOR IS field-name positions cursor. ACCEPT screen-name WITH CURSOR. Runtime positions to specified field. Can set dynamically. Used in interactive COBOL (CICS typically handles cursor differently).
COBOL
👁 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.
COBOL
👁 0

Q: What is WORKING-STORAGE SECTION?

Answer:
WORKING-STORAGE SECTION declares program variables. Initialized at program load. Retains values between CALL invocations unless INITIAL program. Define all work areas, flags, counters, tables here. 01-49 levels for data, 77 for independent items.
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.
COBOL
👁 0

Q: What is RETURN-CODE register?

Answer:
RETURN-CODE sets program completion status. MOVE 0 TO RETURN-CODE (success). MOVE 8 TO RETURN-CODE (warning). Passed to caller/JCL. Check RETURN-CODE after CALL. LE uses CEE3STS for detailed status.
JCL
👁 0

Q: How to define temporary dataset?

Answer:
Temporary datasets: DSN=&&TEMP or omit DSN. Exist for job duration only. Not cataloged. Passed between steps with DISP=PASS. Automatically deleted at job end. Example: //WORK DD DSN=&&TEMP,UNIT=SYSDA,SPACE=(CYL,5)
JCL
👁 0

Q: What is INTRDR?

Answer:
SYSOUT=(class,INTRDR) submits output as new job. Internal reader. Programs can submit jobs dynamically. Class often B. Output must be valid JCL. Used for job scheduling, dynamic workflows.
CICS
👁 0

Q: Explain RETURN command

Answer:
RETURN ends program or task. EXEC CICS RETURN returns to caller. EXEC CICS RETURN TRANSID(next) COMMAREA(data) for pseudo-conv. IMMEDIATE for no COMMAREA. End of logical unit.
JCL
👁 0

Q: How to handle multivolume datasets?

Answer:
VOL=(,,,n) allows n volumes. SPACE with volume count. SMS handles multivolume automatically. DISP=MOD extends to new volume. DATACLAS can specify multivolume. Large datasets need multivolume planning.
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: 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: What is DEFINE ALTERNATEINDEX syntax?

Answer:
DEFINE AIX(NAME(aix.name) RELATE(base.cluster) KEYS(len offset)) DATA(NAME(aix.data)) INDEX(NAME(aix.index)). UNIQUEKEY or NONUNIQUEKEY. UPGRADE to maintain automatically. Must DEFINE PATH and BLDINDEX after.