👁 0
Q: How do I fix S0C7 Data Exception ABEND?
Answer:
S0C7 occurs when the program tries to perform arithmetic on non-numeric data.
Common Causes:
- Uninitialized numeric fields (contains spaces/garbage)
- Moving alphanumeric data to numeric field
- Reading file with wrong record layout
- Array subscript accessing wrong memory
How to Fix:
- Initialize all numeric fields to ZEROS
- Validate input before arithmetic
- Check file layouts match
- Use DISPLAY to debug field contents
* Always initialize
INITIALIZE WS-RECORD.
MOVE ZEROS TO WS-AMOUNT.
* Validate before use
IF WS-INPUT IS NUMERIC
COMPUTE WS-RESULT = WS-INPUT * 2
END-IF.
👁 0
Q: What is the difference between KSDS and ESDS?
Answer:
KSDS (Key Sequenced Data Set):
- Records accessed by unique key
- Records stored in key sequence
- Has both data and index components
- Supports random and sequential access
- Can delete and reinsert records
- Most commonly used VSAM type
ESDS (Entry Sequenced Data Set):
- Records stored in arrival order
- Accessed by RBA (Relative Byte Address)
- No index component
- Cannot delete records (only mark inactive)
- Similar to sequential files
- Good for logs, audit trails
Use KSDS when: You need key-based access, updates, deletes
Use ESDS when: Sequential processing only, append-only data
👁 0
Q: Explain REDEFINES clause with an example.
Answer:
REDEFINES allows the same storage area to be referenced by different data names with different definitions.
Rules:
- Must be at same level as item being redefined
- Cannot redefine item with OCCURS
- Redefined item must appear first
- Lengths should match or redefining should be shorter
01 WS-DATE. 05 WS-DATE-NUM PIC 9(8). 01 WS-DATE-X REDEFINES WS-DATE. 05 WS-YEAR PIC 9(4). 05 WS-MONTH PIC 9(2). 05 WS-DAY PIC 9(2).
Same 8 bytes can be accessed as single number or individual components.
👁 0
Q: What is the difference between PARM and SYSIN for passing parameters?
Answer:
PARM (EXEC statement):
- Limited to 100 characters
- Passed in memory to program
- Accessed via LINKAGE SECTION
- Good for small, simple parameters
SYSIN (DD statement):
- No practical size limit
- Read as a file by program
- Can contain multiple records
- Good for control cards, complex input
// PARM example //STEP1 EXEC PGM=MYPROG,PARM='PARAM1,PARAM2' // SYSIN example //SYSIN DD * CONTROL OPTION1 DATE=20231215 LIMIT=1000 /*
👁 0
Q: How to handle variable length records?
Answer:
Use RECORD CONTAINS min TO max CHARACTERS clause in FD. Define RECORD-LENGTH field in the record. For VSAM, use RECORD VARYING IN SIZE. Access actual length via LENGTH OF or special register. Handle both fixed and variable portions appropriately.
👁 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.
👁 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.
👁 0
Q: How to use EXPLAIN tables?
Answer:
PLAN_TABLE primary output. DSN_STATEMNT_TABLE for cost. DSN_FUNCTION_TABLE for functions. INSERT EXPLAIN before statement. Query tables after. PLANNO, ACCESSTYPE, MATCHCOLS important columns.
👁 0
Q: What is Distributed Data Facility (DDF)?
Answer:
DDF enables remote DB2 access. TCP/IP and SNA connectivity. DRDA protocol. Location name identifies target. Three-part names: location.schema.table. Network security considerations.
👁 0
Q: What is OPTIMIZE FOR n ROWS?
Answer:
OPTIMIZE FOR n ROWS hints expected rows. SELECT * FROM t ORDER BY c OPTIMIZE FOR 1 ROW. Influences access path. Low n favors index. High n may favor scan. Use when you know actual row count.
👁 0
Q: What is RRDS in VSAM?
Answer:
RRDS (Relative Record Dataset) accesses by relative record number (slot). Fixed length slots numbered 1, 2, 3... Can be empty slots. Good for direct access by position. Less common than KSDS/ESDS.
👁 0
Q: What is ORGANIZATION clause?
Answer:
ORGANIZATION specifies file structure: SEQUENTIAL (default), INDEXED (VSAM KSDS), RELATIVE (RRDS). Determines access methods available. INDEXED requires RECORD KEY. ACCESS MODE can be SEQUENTIAL, RANDOM, or DYNAMIC.
👁 0
Q: What is alternate index?
Answer:
AIX provides secondary access path. DEFINE AIX over base cluster. Different key. DEFINE PATH to access. BLDINDEX populates. UPGRADE option maintains AIX on base updates. Multiple AIX per cluster.
👁 0
Q: What is RBA?
Answer:
RBA (Relative Byte Address) is byte offset from dataset start. ESDS uses RBA for access. KSDS index points to RBA. Changed by REORG. Use key for KSDS, RBA only when necessary.
👁 0
Q: What causes file status 48?
Answer:
Status 48 is OPEN failure, file already open. Check logic - may have duplicate OPEN. CLOSE before re-OPEN. COBOL FILE-STATUS check important. May be another job has exclusive access.
👁 0
Q: What is IMBED option?
Answer:
IMBED places sequence set (lowest index level) in data CA. Reduces I/O for index access. Uses more data space. Obsolete with modern systems - use defaults. May still see in old definitions.
👁 0
Q: What is file status 92?
Answer:
Status 92 is logic error. Conflicting operation for file state. Examples: READ before OPEN, WRITE to INPUT file, wrong ACCESS MODE for operation. Check program logic carefully.
👁 0
Q: How to access RRDS?
Answer:
ACCESS MODE IS RANDOM. Use RELATIVE KEY for slot number. READ/WRITE by slot. STATUS 23 if slot empty. Can have empty slots. Record size fixed for RRDS.
👁 0
Q: How to update KSDS record?
Answer:
READ record (optionally FOR UPDATE). Modify record area. REWRITE record. Key cannot change on REWRITE. Status 00 if successful. ACCESS MODE must allow updates.
👁 0
Q: What is KEYRANGES?
Answer:
KEYRANGES distributes KSDS across volumes by key value. KEYRANGES((low1 high1) (low2 high2)). Each range on different volume. Improves parallel access. Rarely used now.
👁 0
Q: How to define FILE-CONTROL?
Answer:
SELECT file-name ASSIGN TO ddname. ORGANIZATION IS INDEXED. ACCESS MODE IS DYNAMIC. RECORD KEY IS key-field. ALTERNATE RECORD KEY IS alt-key. FILE STATUS IS ws-status. Maps COBOL file to physical dataset.
👁 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.
👁 0
Q: How to handle VSAM in batch?
Answer:
Define cluster with IDCAMS. JCL DD statement references cluster. COBOL SELECT maps to DD. ACCESS MODE matches operations. Close properly. STATUS check after operations.
👁 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.
👁 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.
👁 0
Q: How to force uncataloged?
Answer:
VOL=SER=volume forces uncataloged access. DISP=(OLD,KEEP). System searches specified volume, not catalog. UNIT required. Bypasses catalog entirely. Useful for specific volume access. Security still applies.
👁 0
Q: How to use ENQ/DEQ?
Answer:
ENQ serializes resources. EXEC CICS ENQ RESOURCE(name) LENGTH(len). DEQ releases. Prevents concurrent access. NOSUSPEND returns immediately if busy. Use for data integrity.
👁 0
Q: What is KEYLENGTH option?
Answer:
KEYLENGTH specifies key portion for generic access. EXEC CICS READ FILE RIDFLD(partial) KEYLENGTH(4) GENERIC. Finds first matching prefix. Use with GTEQ for range.
👁 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 RUNSTATS and when to use it?
Answer:
RUNSTATS collects table/index statistics for optimizer. Run after significant data changes (loads, deletes). Updates catalog tables (SYSTABLES, SYSINDEXES). Optimizer uses for access path selection. RUNSTATS TABLESPACE db.ts INDEX(ALL).
👁 0
Q: What is DB2 subsystem?
Answer:
Subsystem is DB2 instance. Has unique name (4 chars). Multiple subsystems on same LPAR. Each has own catalog, logs, data. SSID in application connection. Data sharing allows multi-subsystem access.
👁 0
Q: How to handle RLS (Record Level Sharing)?
Answer:
RLS allows VSAM access without exclusive control. Define with SHAREOPTIONS and LOG. Enable RLS at VSAM level. CF lock structure coordinates. Better than old batch/CICS conflicts.
👁 0
Q: What is IMBEDDED index?
Answer:
IMBEDDED places sequence set in data CA. Reduces I/O for index access. Obsolete - modern systems don't benefit. Use system defaults. May see in old definitions.
👁 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 data sharing?
Answer:
Data sharing allows multiple DB2s to access same data. Group of subsystems share data. Uses Coupling Facility for coordination. Provides availability, scalability. Complex but powerful for high availability.
👁 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.
👁 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: 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.
👁 0
Q: What are nested programs?
Answer:
Nested programs are contained within another COBOL program. Defined between IDENTIFICATION DIVISION and END PROGRAM. Can access outer program's data with GLOBAL clause. COMMON attribute allows access from sibling programs. Promotes modular design.
👁 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.
👁 0
Q: How to work with OCCURS indexed tables?
Answer:
Define: 01 WS-TABLE. 05 WS-ENTRY OCCURS 100 INDEXED BY WS-IDX. 10 WS-NAME PIC X(20). 10 WS-VALUE PIC 9(5). Access: MOVE WS-NAME(WS-IDX) TO output. Search: SEARCH WS-ENTRY WHEN WS-NAME(WS-IDX) = 'VALUE' perform action.
👁 0
Q: Explain thread management
Answer:
Thread is DB2 connection. Allied thread for TSO/batch. DBAT (database access thread) for DDF. Pool thread for efficient reuse. Max threads controlled by zparm. Monitor active threads.
👁 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.
👁 0
Q: Explain ALTERNATE RECORD KEY
Answer:
ALTERNATE RECORD KEY defines secondary indexes for INDEXED files. SELECT file-name ALTERNATE RECORD KEY IS ALT-KEY WITH DUPLICATES. Allows access by multiple keys. DUPLICATES permits non-unique values. Define path in VSAM cluster.
👁 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.
👁 0
Q: What is OPTIONAL file clause?
Answer:
OPTIONAL allows missing files: SELECT OPTIONAL input-file. OPEN succeeds even if file absent. READ immediately gets end-of-file. Useful for conditional processing. FILE STATUS 35 if accessed without OPTIONAL.
👁 0
Q: How to write VSAM random?
Answer:
ACCESS MODE IS RANDOM or DYNAMIC. WRITE record writes at key position. For KSDS, key must not exist (status 22). For ESDS, writes at end. RANDOM/DYNAMIC MODE required.
👁 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.
👁 0
Q: What is DEFINE PATH?
Answer:
PATH associates AIX for access. DEFINE PATH(NAME(path.name) PATHENTRY(aix.name)). Required to access via AIX. Open PATH in program, not AIX directly. UPDATE option allows updates via path.
👁 0
Q: How to access AIX?
Answer:
Open PATH to AIX, not base cluster. READ via alternate key. Can browse by alternate key sequence. Updates depend on PATH UPDATE option. Non-unique AIX returns first, then READ NEXT for others.
👁 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.
👁 0
Q: What is LINEAR dataset?
Answer:
LINEAR VSAM is byte-addressable. No record structure. Used by DB2 tablespaces, system software. DEFINE CLUSTER LINEAR. Accessed via DIV (Data-in-Virtual) or memory mapping.
👁 0
Q: What causes JCL error S013-14?
Answer:
S013-14 is member not found in PDS. Check: DD name matches program expectation, member name spelled correctly, library in concatenation contains member, DISP allows access. Use LISTDS or ISPF 3.4 to verify member exists.
👁 0
Q: How to handle concurrent access?
Answer:
Use appropriate SHAREOPTIONS. Multiple readers OK with SHAREOPTIONS(2). Writers need coordination. LSR (Local Shared Resources) for same address space. Consider file status checks.
👁 0
Q: How to access VSAM via CICS?
Answer:
Define FILE in CICS FCT (File Control Table). Or RDO DEFINE FILE. EXEC CICS READ FILE. VSAM must be closed to batch when CICS owns. NSRV or LSR buffering. BROWSE for sequential.
👁 0
Q: How to define ESDS?
Answer:
DEFINE CLUSTER(NAME(ds.name) NONINDEXED RECORDSIZE(avg max)) DATA(NAME(ds.data) CYLINDERS(10 2)). NONINDEXED means ESDS. No KEYS or INDEX components. Access by RBA only.
👁 0
Q: What causes S913 abend?
Answer:
S913 is security violation. Not authorized to dataset or resource. Check: RACF/ACF2/TopSecret permissions, dataset profile, user authority level. S913-38 means insufficient access. Contact security administrator.
👁 0
Q: What is UNIT parameter?
Answer:
UNIT specifies device type. UNIT=SYSDA (direct access), UNIT=TAPE, UNIT=3390. UNIT=AFF=ddname shares device. UNIT=(SYSDA,2) allocates 2 volumes. SMS may override. UNIT=VIO for virtual I/O (memory only).
👁 0
Q: What is GETMAIN?
Answer:
GETMAIN allocates temporary storage. EXEC CICS GETMAIN SET(pointer) LENGTH(size) INITIMG(X'00'). Returns pointer. Use for dynamic memory. FREEMAIN releases. SHARED for multi-task access. Automatic cleanup on task end.
👁 0
Q: Explain RRN in CICS
Answer:
RRN (Relative Record Number) for RRDS files. RIDFLD contains RRN, not key. Numeric 1-based slot number. RRN option on file commands. Access by position not content.
👁 0
Q: Explain DEFINE PATH for VSAM?
Answer:
PATH provides alternate access to VSAM cluster via alternate index. IDCAMS: DEFINE PATH NAME(path.name) PATHENTRY(aix.name). Reference PATH in JCL, not AIX directly. Allows secondary key access.
👁 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.
👁 0
Q: How to handle ILLOGIC?
Answer:
ILLOGIC is VSAM logic error. Unusual error in file access. Check file status elsewhere. May indicate file corruption. Rare - investigate thoroughly.
👁 0
Q: Explain DB2 isolation levels
Answer:
UR (Uncommitted Read) reads dirty data. CS (Cursor Stability) locks current row. RS (Read Stability) locks all accessed rows. RR (Repeatable Read) locks range, prevents phantom. Higher isolation = more consistency but more locking. CS most common.
👁 0
Q: How to handle CICS security?
Answer:
RACF/ACF2 integration. EXEC CICS QUERY SECURITY. SIGNON establishes identity. VERIFY checks resource access. XFCT/XPPT exits. Secure by default.
👁 0
Q: What is BDAM conversion to VSAM?
Answer:
BDAM is block-oriented, VSAM is record-oriented. Convert: analyze BDAM access, choose KSDS/RRDS/ESDS. REPRO or IDCAMS copy. Program changes for VSAM access. Test thoroughly.
👁 0
Q: What is EXEC CICS SPOOLOPEN?
Answer:
SPOOLOPEN accesses JES spool. SPOOLREAD/SPOOLWRITE for data. SPOOLCLOSE ends. Process job output. Modern batch integration. Requires authorization.
👁 0
Q: Explain NOFOR option in SELECT?
Answer:
NOFOR prevents FOR UPDATE locking. SELECT ... NOFOR. Read-only access without lock overhead. For display-only queries. Cannot UPDATE WHERE CURRENT OF cursor with NOFOR.