COBOL S0C7 ⭐ Featured
👁 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:

  1. Uninitialized numeric fields (contains spaces/garbage)
  2. Moving alphanumeric data to numeric field
  3. Reading file with wrong record layout
  4. Array subscript accessing wrong memory

How to Fix:

  1. Initialize all numeric fields to ZEROS
  2. Validate input before arithmetic
  3. Check file layouts match
  4. 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.
DB2 ⭐ Featured
👁 0

Q: What is CTE (Common Table Expression)?

Answer:
CTE defines temporary result set. WITH cte_name AS (SELECT...) SELECT * FROM cte_name. Improves readability. Can be recursive for hierarchies. Multiple CTEs comma-separated. Referenced in main query. Scope is single statement.
CICS ⭐ Featured
👁 0

Q: What is pseudo-conversational programming in CICS?

Answer:

Pseudo-conversational programming is a technique where the program ends between user interactions, freeing system resources.

How it works:

  1. Program sends screen to user and ends (RETURN TRANSID)
  2. User enters data and presses Enter
  3. CICS starts a new task with same program
  4. Program retrieves saved data from COMMAREA
  5. Process continues

Benefits:

  • Efficient resource usage
  • Better response times
  • More concurrent users

Implementation:

* End task, wait for user
EXEC CICS RETURN
    TRANSID('MENU')
    COMMAREA(WS-COMM)
    LENGTH(100)
END-EXEC.

* On return, check EIBCALEN
IF EIBCALEN = 0
    PERFORM FIRST-TIME
ELSE
    MOVE DFHCOMMAREA TO WS-COMM
    PERFORM PROCESS-INPUT
END-IF.
COBOL ⭐ Featured
👁 0

Q: What is the difference between SECTION and PARAGRAPH in COBOL?

Answer:

SECTION:

  • Contains one or more paragraphs
  • Ends with next SECTION or end of program
  • Used for logical grouping
  • Can be performed as a unit

PARAGRAPH:

  • Basic unit of code
  • Named block of statements
  • Ends at next paragraph name or SECTION

PERFORM SECTION-NAME executes all paragraphs in the section.

PERFORM PARA-NAME executes only that paragraph.

DB2 ⭐ Featured
👁 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.
COBOL ⭐ Featured
👁 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.

DB2 ⭐ Featured
👁 0

Q: Explain the difference between INNER JOIN and LEFT OUTER JOIN.

Answer:

INNER JOIN:

  • Returns only matching rows from both tables
  • If no match, row is excluded

LEFT OUTER JOIN:

  • Returns all rows from left table
  • Matching rows from right table
  • NULL for right table if no match
-- INNER JOIN
SELECT E.NAME, D.DEPT_NAME
FROM EMPLOYEE E
INNER JOIN DEPARTMENT D
ON E.DEPT_ID = D.DEPT_ID;

-- LEFT OUTER JOIN
SELECT E.NAME, D.DEPT_NAME
FROM EMPLOYEE E
LEFT OUTER JOIN DEPARTMENT D
ON E.DEPT_ID = D.DEPT_ID;

Use LEFT JOIN when you want all employees even those without department.

COBOL ⭐ Featured
👁 0

Q: What is the difference between COMP and COMP-3?

Answer:
COMP (Binary) stores data in binary format, taking 2, 4, or 8 bytes. COMP-3 (Packed Decimal) stores two digits per byte with the sign in the last nibble, more efficient for decimal arithmetic. COMP is faster for calculations while COMP-3 saves space for large decimal numbers.
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.
DB2 ⭐ Featured
👁 0

Q: How to handle large objects (LOB)?

Answer:
BLOB/CLOB/DBCLOB for large data. Stored in auxiliary tablespace. Use LOB locators for efficiency. FETCH with INTO :lobvar. INSERT with CLOB(text). LOG NO for LOB tablespace optional.
COBOL ⭐ Featured
👁 0

Q: Explain REDEFINES clause usage

Answer:
REDEFINES allows multiple data descriptions for same memory. 01 WS-DATE PIC 9(8). 01 WS-DATE-R REDEFINES WS-DATE. 05 WS-YEAR PIC 9(4). 05 WS-MONTH PIC 99. 05 WS-DAY PIC 99. Cannot redefine with larger size. Useful for different views of data.
COBOL ⭐ Featured
👁 0

Q: Explain SECTION vs PARAGRAPH

Answer:
SECTION groups related paragraphs, terminated by next SECTION or end of program. PARAGRAPH is a named block of code, terminated by next paragraph/section. PERFORM SECTION executes all paragraphs within. SECTION needed for segmentation, PARAGRAPH for simple procedures.
COBOL ⭐ Featured
👁 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.
DB2 ⭐ Featured
👁 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.
DB2 ⭐ Featured
👁 0

Q: What is GRANT and REVOKE?

Answer:
GRANT gives privileges: GRANT SELECT ON table TO user. REVOKE removes: REVOKE SELECT ON table FROM user. Privileges: SELECT, INSERT, UPDATE, DELETE, EXECUTE. WITH GRANT OPTION allows re-granting. Essential for security.
COBOL ⭐ Featured
👁 0

Q: How to use CONTINUE statement?

Answer:
CONTINUE is a no-operation placeholder. Useful in EVALUATE when certain conditions need no action: WHEN 'X' CONTINUE. In IF: IF condition CONTINUE ELSE action. Maintains structure without dummy statements. Not a GOTO target.
COBOL ⭐ Featured
👁 0

Q: What is GLOBAL clause?

Answer:
GLOBAL makes data available to nested programs. 01 WS-COUNTER PIC 9(5) GLOBAL. Nested programs can reference without passing as parameters. Use sparingly; explicit passing preferred. File definitions can also be GLOBAL.
COBOL ⭐ Featured
👁 0

Q: What is MOVE CORRESPONDING?

Answer:
MOVE CORRESPONDING moves all fields with matching names between groups. MOVE CORR INPUT-REC TO OUTPUT-REC. Only moves if names match exactly. Moves all matches, not just first. Useful for record transformations. Debug carefully-silent partial moves.
COBOL ⭐ Featured
👁 0

Q: Explain EXTERNAL clause

Answer:
EXTERNAL allows data sharing between separately compiled programs. 01 WS-SHARED PIC X(100) EXTERNAL. All programs with same EXTERNAL name share same storage. Use for global data without passing parameters. Be careful with initialization.
COBOL ⭐ Featured
👁 0

Q: How to use EXIT PERFORM?

Answer:
EXIT PERFORM immediately exits current PERFORM loop. EXIT PERFORM CYCLE skips to next iteration. COBOL 2002+ feature. Previously used GO TO with OUT-OF-PARAGRAPH technique. Makes loop control cleaner without extra flags.
VSAM ⭐ Featured
👁 0

Q: How to handle file status 23?

Answer:
Status 23 is record not found for random READ or START. Key doesn't exist. Check key value, spelling. May be legitimate (check if exists logic). START with EQUAL, GTEQ, LTEQ options.
VSAM ⭐ Featured
👁 0

Q: What causes file status 97?

Answer:
Status 97 indicates OPEN problem, often password or integrity. May be: dataset locked, open elsewhere without sharing, damaged dataset. Check SHAREOPTIONS, verify cluster status, recovery may be needed.
VSAM ⭐ Featured
👁 0

Q: Explain REUSE parameter

Answer:
REUSE allows reloading without delete/define. DEFINE CLUSTER ... REUSE. OPEN OUTPUT resets to empty. Like scratch and rewrite. Good for temporary work files. Cannot be UNIQUE.
COBOL ⭐ Featured
👁 0

Q: How to use STRING with POINTER?

Answer:
STRING uses POINTER to track position: STRING field-1 DELIMITED SIZE INTO output WITH POINTER pos-var. Pointer shows next available position. Initialize before first STRING. Check for overflow. Continue STRING in multiple statements.
VSAM ⭐ Featured
👁 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.
COBOL ⭐ Featured
👁 0

Q: Explain DEBUGGING declarative

Answer:
USE FOR DEBUGGING enables debug procedures. Requires WITH DEBUGGING MODE. Triggers on: ALTER, PERFORM, GO TO, or reference to debug item. Displays data values and flow. Object code excluded unless compiled with DEBUG option.
VSAM ⭐ Featured
👁 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.
COBOL ⭐ Featured
👁 0

Q: What is READY TRACE?

Answer:
READY TRACE turns on paragraph tracing. Shows paragraph names as executed. RESET TRACE turns off. Must compile with debugging option. Output goes to SYSOUT. Replaced by better debuggers but useful for quick flow analysis.
COBOL ⭐ Featured
👁 0

Q: How to use UNSTRING with TALLYING?

Answer:
UNSTRING field-1 DELIMITED BY ',' INTO field-2 field-3 TALLYING IN count-var. Count-var shows how many receiving fields got data. With COUNT IN, tracks characters per field. ALL delimiter allows multiple consecutive delimiters as one.
COBOL ⭐ Featured
👁 0

Q: How to use FUNCTION CURRENT-DATE?

Answer:
FUNCTION CURRENT-DATE returns 21-char timestamp. Format: YYYYMMDDHHMMSSDHHMM (D=hundredths, HH=GMT offset). MOVE FUNCTION CURRENT-DATE TO WS-TIMESTAMP. Parse components with reference modification or REDEFINES.
VSAM ⭐ Featured
👁 0

Q: How to handle variable length KSDS?

Answer:
Define with RECORDSIZE(avg max). Read/write variable length records. COBOL RECORD VARYING clause. Key position fixed. Read returns actual length. Write length implicit from record.
COBOL ⭐ Featured
👁 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.
VSAM ⭐ Featured
👁 0

Q: How to compress VSAM?

Answer:
DFSMS compression via DATACLAS. Or EXTENDED FORMAT with compression. Not native VSAM feature. Reduces space, adds CPU overhead. Good for large, read-heavy files.
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.
JCL ⭐ Featured
👁 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.
VSAM ⭐ Featured
👁 0

Q: Explain LOG parameter

Answer:
LOG(NONE/UNDO/ALL) specifies recovery logging. UNDO for backward recovery. ALL for forward and backward. NONE for no logging. Used with transactional systems. Most batch uses NONE.
VSAM ⭐ Featured
👁 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.
JCL ⭐ Featured
👁 0

Q: What is symbolic parameter?

Answer:
Symbols are variables: SET symbol=value or &symbol on JOB/PROC. Reference: DSN=&HLQ..DATA. Resolved at job entry. EXEC proc,symbol=value overrides. SET statement defines. Symbols start with & and up to 8 characters.
JCL ⭐ Featured
👁 0

Q: What causes S0C7 in batch?

Answer:
S0C7 is data exception - non-numeric in numeric field. Check: input file data quality, initialize variables, correct REDEFINES, field alignment. Use OFFSET in dump to find statement. LE CEEDUMP shows data values. Common with new programs.
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.
JCL ⭐ Featured
👁 0

Q: What is IEBGENER utility?

Answer:
IEBGENER copies sequential datasets. SYSUT1=input, SYSUT2=output, SYSIN=control. Simple copy needs only SYSUT1/SYSUT2/SYSIN DD DUMMY. Can reformat, generate, edit records with SYSIN statements. Being replaced by ICEGENER.
VSAM ⭐ Featured
👁 0

Q: What is ERASE on DELETE?

Answer:
ERASE overwrites data with binary zeros. Physical erase before space release. Security requirement for sensitive data. Takes time. Without ERASE, data remains until overwritten.
CICS ⭐ Featured
👁 0

Q: What is EXEC CICS READ?

Answer:
READ retrieves VSAM record. EXEC CICS READ FILE(name) INTO(area) RIDFLD(key) LENGTH(len). Optionally: UPDATE for update intent, KEYLENGTH for partial key. Generic key with GENERIC/KEYLENGTH. Returns NOTFND if missing.
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.
JCL ⭐ Featured
👁 0

Q: What is PRTY parameter?

Answer:
PRTY sets selection priority. PRTY=15 on JOB card. Values 0-15 (15 highest). Affects when job selected from queue. JES2 processes higher PRTY first within class. Different from PERFORM (execution priority).
JCL ⭐ Featured
👁 0

Q: Explain generation data groups

Answer:
GDG maintains versions. Base defined with IDCAMS: DEFINE GDG NAME(base) LIMIT(10) SCRATCH. Reference: base(+1) new, base(0) current, base(-1) previous. LIMIT controls kept generations. NOEMPTY/EMPTY for empty condition.
CICS ⭐ Featured
👁 0

Q: What is ABEND command?

Answer:
ABEND deliberately terminates. EXEC CICS ABEND ABCODE('XXXX'). Causes transaction abend with code. NODUMP suppresses dump. CANCEL removes HANDLE ABEND first. Use for unrecoverable errors.
JCL ⭐ Featured
👁 0

Q: Explain AVGREC parameter

Answer:
AVGREC specifies space in record units. AVGREC=U (units), K (thousands), M (millions). SPACE=(80,(100,10),,,ROUND) with AVGREC=K means 100,000 records. Easier than calculating tracks. System converts to tracks.
CICS ⭐ Featured
👁 0

Q: How to WRITEQ with REWRITE?

Answer:
WRITEQ TS with REWRITE updates existing item. EXEC CICS WRITEQ TS QUEUE(name) FROM(data) REWRITE ITEM(n). Without REWRITE, adds new item. ITEM must exist for REWRITE.
JCL ⭐ Featured
👁 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.
CICS ⭐ Featured
👁 0

Q: How to do interval control?

Answer:
START with INTERVAL/AFTER for delayed execution. EXEC CICS START TRANSID(xx) INTERVAL(001000). Or AFTER HOURS(1) MINUTES(30). For scheduled background work. Data via FROM or CHANNEL.
CICS ⭐ Featured
👁 0

Q: What is IMMEDIATE option?

Answer:
IMMEDIATE on RETURN returns without COMMAREA. EXEC CICS RETURN IMMEDIATE. Next input starts fresh - no continuation. Use when pseudo-conv not needed.
JCL ⭐ Featured
👁 0

Q: What is FREE parameter?

Answer:
FREE specifies when to release allocation. FREE=END (default) at step end. FREE=CLOSE when file closed. FREE=CLOSE allows reuse within step. Reduces concurrent allocations. Helps resource-constrained systems.
CICS ⭐ Featured
👁 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.
JCL ⭐ Featured
👁 0

Q: Explain NULLFILE keyword?

Answer:
NULLFILE is alternate for DUMMY. //DD DD NULLFILE. Discards output, provides EOF for input. DSN=NULLFILE equivalent. No actual dataset. Useful for testing without actual files.
JCL ⭐ Featured
👁 0

Q: What causes S222 abend?

Answer:
S222 is job cancelled by operator or system. S222-02 means JOB CANCEL command. S222-04 means TSO CANCEL. S222-08 means FORCE. Not program error - external intervention. Check with operations if unexpected.
JCL ⭐ Featured
👁 0

Q: What is PATHDISP parameter?

Answer:
PATHDISP=(normal,abnormal) for USS files. Options: KEEP, DELETE. PATHDISP=(KEEP,DELETE). Used with PATH parameter. Similar to DISP for MVS datasets. Controls USS file retention.
JCL ⭐ Featured
👁 0

Q: How to code symbolic override?

Answer:
EXEC proc,SYM1=value1,SYM2=value2. Symbols defined in PROC with SET or & default. Override replaces default. Multiple overrides comma-separated. Must match PROC symbols. Case sensitive.
JCL ⭐ Featured
👁 0

Q: What causes INVALID DATA SET NAME?

Answer:
Dataset name violates rules: 44 char max, qualifier 8 max, start with letter/national, periods separate qualifiers, no double periods, no special characters. Check spelling, length, valid characters.
JCL ⭐ Featured
👁 0

Q: What is LRECL=X?

Answer:
LRECL=X means system-determined length. Usually for RECFM=U or special files. System calculates based on BLKSIZE or file characteristics. Not common for normal datasets. Used with certain utilities.
CICS ⭐ Featured
👁 0

Q: How to check EIBAID?

Answer:
EIBAID shows attention key pressed. Compare with DFHENTER, DFHPF1-24, DFHCLEAR, DFHPA1-3. Example: IF EIBAID = DFHPF3 do-exit. Determines user action on screen.
CICS ⭐ Featured
👁 0

Q: What is FRSET?

Answer:
FRSET (Field Reset) resets MDTs. EXEC CICS SEND MAP FRSET. Only changed fields transmitted back. Efficiency. Without FRSET, all unprotected transmitted. Use for repeat maps.
JCL ⭐ Featured
👁 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.
CICS ⭐ Featured
👁 0

Q: Explain symbolic map structure

Answer:
Symbolic map copybook. Field name with L (length), F (flag), A (attribute), I (input), O (output). Set -1 in length for cursor. Check flag for modified. Program data area.
CICS ⭐ Featured
👁 0

Q: What is OVERFLOW condition?

Answer:
OVERFLOW when output exceeds page. During SEND with paging. Handle to manage paging. RESP check. Terminal specific limits. May need to restructure output.
DB2 ⭐ Featured
👁 0

Q: What is a DB2 plan vs package?

Answer:
Plan is executable form of program's SQL, bound from DBRM. Package is independent unit, can be shared. Plans contain packages or direct SQL. Packages allow separate rebind. Modern approach: package collections with small plans.
CICS ⭐ Featured
👁 0

Q: What is CICS Liberty?

Answer:
CICS Liberty embeds Java server. Run Java apps in CICS. RESTful services. Modern application development. Coexists with COBOL. Container environment.
VSAM ⭐ Featured
👁 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.
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.
CICS ⭐ Featured
👁 0

Q: What is ISSUE ABEND?

Answer:
ISSUE ABEND requests dump without termination. EXEC CICS ISSUE ABEND. Diagnostic snapshot. Continue execution. Alternative to full ABEND. Debug technique.
DB2 ⭐ Featured
👁 0

Q: What is BETWEEN operator?

Answer:
BETWEEN tests range inclusively. WHERE col BETWEEN 1 AND 100. Equivalent to col >= 1 AND col <= 100. Works with dates, times. Can use NOT BETWEEN for exclusion. Index can be used for BETWEEN.
DB2 ⭐ Featured
👁 0

Q: Explain UPDATE with JOIN

Answer:
UPDATE table SET col = value FROM table t1 INNER JOIN table t2 ON... WHERE condition. Or: UPDATE t1 SET col = (SELECT col FROM t2 WHERE t2.key = t1.key). Merge statement is alternative.
DB2 ⭐ Featured
👁 0

Q: How to delete with JOIN?

Answer:
DELETE FROM table WHERE key IN (SELECT key FROM other WHERE condition). Or: DELETE FROM t1 WHERE EXISTS (SELECT 1 FROM t2 WHERE t1.key = t2.key). Correlated subquery common for conditional delete.
DB2
👁 0

Q: What is FETCH FIRST?

Answer:
FETCH FIRST n ROWS ONLY limits result set. SELECT * FROM t ORDER BY col FETCH FIRST 10 ROWS ONLY. Optimizes query - doesn't retrieve all. OFFSET for paging. WITH TIES includes equal values.
DB2
👁 0

Q: How to use window functions?

Answer:
ROW_NUMBER() OVER (PARTITION BY col ORDER BY col2). RANK, DENSE_RANK for rankings. SUM/AVG/COUNT OVER for running totals. PARTITION BY groups within result. ORDER BY within partition. Powerful analytics.
DB2
👁 0

Q: How to write recursive CTE?

Answer:
WITH RECURSIVE cte AS (base-case UNION ALL recursive-case referencing cte) SELECT * FROM cte. For hierarchies: start with root, join to find children. DEPTH limit prevents infinite recursion.
DB2
👁 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.
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.
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.
COBOL
👁 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.
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.
DB2
👁 0

Q: Explain host variable rules

Answer:
Host variables prefixed with : in SQL. Declare in WORKING-STORAGE. Must be compatible types. Use indicator for NULL. Cannot use in dynamic object names. VARCHAR needs two-part structure in COBOL.
DB2
👁 0

Q: How to prevent SQL injection?

Answer:
Use parameter markers (?), not concatenation. PREPARE stmt FROM 'SELECT * FROM t WHERE c = ?'. EXECUTE stmt USING :hostvar. Never build SQL with user input directly. Validate input. Use static SQL when possible.
COBOL
👁 0

Q: Explain COMPUTE statement

Answer:
COMPUTE performs arithmetic with expression syntax. COMPUTE RESULT = (A + B) * C / D. Supports + - * / ** operators. ROUNDED option rounds result. ON SIZE ERROR handles overflow. Clearer than separate ADD/SUBTRACT/MULTIPLY/DIVIDE for complex formulas.
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.
COBOL
👁 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.
DB2
👁 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.
COBOL
👁 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.
COBOL
👁 0

Q: How to use intrinsic functions?

Answer:
COBOL-85 intrinsic functions: FUNCTION LENGTH(field), FUNCTION CURRENT-DATE, FUNCTION UPPER-CASE(field), FUNCTION NUMVAL(field), FUNCTION MOD(a,b), FUNCTION INTEGER-OF-DATE(date). Use in expressions or with COMPUTE. Return values only, no side effects.
COBOL
👁 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.
COBOL
👁 0

Q: What is VALUE clause?

Answer:
VALUE initializes data items. 05 WS-FLAG PIC X VALUE 'Y'. 05 WS-COUNT PIC 9(3) VALUE ZEROS. 05 WS-TABLE OCCURS 5 VALUE 'INIT'. Figurative constants: SPACES, ZEROS, LOW-VALUES, HIGH-VALUES, QUOTES. Cannot use with REDEFINES target.
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 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.
COBOL
👁 0

Q: What is REPLACE statement?

Answer:
REPLACE substitutes text during compilation. REPLACE ==OLD-TEXT== BY ==NEW-TEXT==. Active until REPLACE OFF or next REPLACE. Useful with copybooks for site-specific modifications. Different from COPY REPLACING-more global.
COBOL
👁 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.
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.
VSAM
👁 0

Q: How to delete records from KSDS?

Answer:
READ record with key. DELETE record-name. Status 00 if successful. In COBOL, DELETE uses primary key. Can delete current record after READ. Cannot delete from ESDS.
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).
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 ERASE parameter?

Answer:
ERASE overwrites data on delete. DELETE CLUSTER ERASE. Security feature - data unrecoverable. Without ERASE, space released but data remains. Use for sensitive data.
COBOL
👁 0

Q: How to define OCCURS ASCENDING?

Answer:
05 TABLE OCCURS 100 ASCENDING KEY IS CODE-FIELD INDEXED BY IDX. 10 CODE-FIELD PIC X(5). 10 DATA-FIELD PIC X(20). ASCENDING means lower values first. Required for SEARCH ALL. DESCENDING also available. Key must be within occurrence.
VSAM
👁 0

Q: Explain UNIQUE vs SUBALLOCATION

Answer:
UNIQUE cluster gets own VSAM dataspace. SUBALLOCATION shares space with others. SUBALLOCATION deprecated, use UNIQUE. Modern systems prefer UNIQUE for isolation.
VSAM
👁 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.
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.
COBOL
👁 0

Q: Explain FUNCTION LENGTH

Answer:
FUNCTION LENGTH returns byte count. FUNCTION LENGTH(field-name). For group items, includes all subordinates. For variable OCCURS, actual current length. Use in COMPUTE, MOVE, comparisons. Often used with STRING pointer initialization.
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 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.
VSAM
👁 0

Q: How to switch file for restart?

Answer:
IDCAMS DELETE/DEFINE or REUSE attribute. REUSE allows OPEN OUTPUT reset. Alternative: JCL with DISP=(NEW,CATLG,DELETE) pattern. Checkpoints may need restart considerations.
JCL
👁 0

Q: What is TYPRUN parameter?

Answer:
TYPRUN options: SCAN (syntax check, no execution), HOLD (submit but hold), COPY (copy JCL to SYSOUT), JCLHOLD (hold with JCL). TYPRUN=SCAN validates JCL without running. Useful for testing complex JCL before production.
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)
VSAM
👁 0

Q: What is LSR?

Answer:
LSR (Local Shared Resources) pool shares buffers across VSAM files. Efficient memory use. MACRF=LSR in JCL or ACB. CICS uses LSR. Define pool with BLDVRP macro.
JCL
👁 0

Q: What is EXEC PGM vs PROC?

Answer:
EXEC PGM=name executes program directly. EXEC procname or EXEC PROC=procname invokes cataloged procedure. EXEC name where 'name' exists as PROC takes precedence. Procedures can be overridden with PROC.STEP.DD syntax.
VSAM
👁 0

Q: What is REPLICATE option?

Answer:
REPLICATE duplicates sequence set on each track. Each track has own copy of sequence set index. Reduces contention. Obsolete with modern systems. Uses more space.
CICS
👁 0

Q: How to SEND MAP to terminal?

Answer:
EXEC CICS SEND MAP(mapname) MAPSET(mapsetname) FROM(symbolic-map) ERASE. CURSOR option positions cursor. FREEKB unlocks keyboard. ALARM sounds alarm. MAPONLY sends without data. DATAONLY sends only modified fields.
CICS
👁 0

Q: What is RECEIVE MAP?

Answer:
EXEC CICS RECEIVE MAP(name) MAPSET(mapset) INTO(symbolic-map). Gets terminal input. Modified fields only (MDT). Check EIBAID for key pressed. MAPFAIL if no data. Symbolic map populated with input.
CICS
👁 0

Q: How to handle MAPFAIL?

Answer:
MAPFAIL occurs when RECEIVE MAP finds no modified data. Handle: EXEC CICS RECEIVE MAP ... RESP(resp). IF resp = DFHRESP(MAPFAIL). User pressed Enter without typing. May need to redisplay or handle appropriately.
JCL
👁 0

Q: Explain JES2 control cards

Answer:
JES2 cards start with /*. /*JOBPARM limits resources. /*ROUTE sends output. /*OUTPUT JESDS specifies JES output. /*PRIORITY sets priority. Process by JES2, not passed to job. Position after JOB card before first EXEC.
JCL
👁 0

Q: What causes NOTCAT error?

Answer:
NOTCAT means dataset not in catalog. Check: correct DSN spelling, dataset was cataloged, catalog searched is correct. Use DISP=SHR only for cataloged datasets. DISP=OLD with VOL=SER for uncataloged. LISTCAT verifies catalog entry.
CICS
👁 0

Q: Explain REWRITE command

Answer:
REWRITE updates record. Must READ with UPDATE first. EXEC CICS REWRITE FILE(name) FROM(data) LENGTH(len). Changes record held from READ. Cannot change key. TOKEN matches UPDATE-READ.
CICS
👁 0

Q: What is SET command?

Answer:
SET modifies resource state. EXEC CICS SET FILE(name) OPEN/CLOSED. SET TRANSACTION ENABLED/DISABLED. Requires authority. Dynamic resource management. Change status without CEDA.
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: What is CNTL statement?

Answer:
CNTL groups control statements. //name CNTL establishes scope. //name ENDCNTL ends it. Used with OUTPUT or other complex statements. Provides modularity. Can be referenced by name from multiple DDs.
JCL
👁 0

Q: What causes S837 abend?

Answer:
S837 is end of volume and no more volumes available. Dataset needs more space. Solutions: allocate larger primary/secondary, increase volume count, extend dataset. IEFBR14 can extend with MOD DISP.
CICS
👁 0

Q: Explain recoverable resources

Answer:
Recoverable resources participate in syncpoint. File with RECOVERY(YES). TS MAIN with AUX. Changes backed out on rollback. Non-recoverable not protected. Define appropriate for data.
JCL
👁 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.
JCL
👁 0

Q: What is SPIN parameter?

Answer:
SPIN=UNALLOC releases output immediately on step/job end. SPIN=(UNALLOC,step) at step end. Without SPIN, output held until job completes. Allows viewing long job output early. On DD SYSOUT statement.
JCL
👁 0

Q: How to use JCLTEST?

Answer:
TYPRUN=JCLTEST validates JCL without execution. Checks syntax, dataset names, authorization. Some systems support TYPRUN=SCAN which is similar. Submit job and check messages. No resources actually allocated.
CICS
👁 0

Q: Explain CICS RECEIVE without MAP

Answer:
RECEIVE INTO without MAP gets raw terminal data. EXEC CICS RECEIVE INTO(area) LENGTH(len). For non-BMS screens. AID in EIBAID. Raw data stream. Lower level than BMS.
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.
JCL
👁 0

Q: What causes NOT DEFINED TO CATALOG?

Answer:
Dataset exists on volume but not cataloged. Solutions: DISP=OLD,VOL=SER=volume, or catalog with IDCAMS DEFINE NONVSAM. Check correct catalog alias. May need ICF catalog update.
CICS
👁 0

Q: What is MAPONLY?

Answer:
MAPONLY sends map without data. EXEC CICS SEND MAP MAPONLY. Displays initial screen. No symbolic map data. Fast initial display. Use when no data to populate.
JCL
👁 0

Q: How to use MODIFY parameter?

Answer:
MODIFY references FCB image. MODIFY=(fcb,trc) on OUTPUT. FCB controls forms. TRC is table reference character. For print formatting. Installation-defined FCBs. Used with special forms.
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.
CICS
👁 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.
DB2
👁 0

Q: How to do paging with DB2?

Answer:
Use FETCH FIRST n ROWS ONLY with OFFSET or ROW_NUMBER(). Modern: SELECT * FROM (SELECT ROW_NUMBER() OVER(ORDER BY col) AS rn, t.* FROM table t) WHERE rn BETWEEN start AND end. Or cursor with FETCH FIRST.
DB2
👁 0

Q: What is SPUFI?

Answer:
SPUFI (SQL Processing Using File Input) is TSO tool for interactive SQL. Input dataset with SQL statements. Output shows results. Good for testing queries, DDL, quick data checks. Not for production processing.
VSAM
👁 0

Q: What is CATALOG parameter in DEFINE?

Answer:
CATALOG(catalog.name) specifies which catalog to use. Without it, uses alias routing. Important for multi-catalog environments. Modern systems often rely on alias. Explicit better for clarity.
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.
VSAM
👁 0

Q: What is REUSE option purpose?

Answer:
REUSE allows OPEN OUTPUT to reset file. Like delete/define without overhead. Good for work files. DEFINE CLUSTER ... REUSE. Cannot be UNIQUE. Efficient for scratch files.
DB2
👁 0

Q: Explain EXISTS vs IN

Answer:
EXISTS checks for row existence: WHERE EXISTS (SELECT 1 FROM...). IN checks value in list: WHERE col IN (SELECT...). EXISTS usually faster with correlated subquery. IN better for small static lists. EXISTS stops at first match.
VSAM
👁 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.
CICS
👁 0

Q: How to use PUSH/POP HANDLE?

Answer:
PUSH HANDLE saves current handlers. POP HANDLE restores. EXEC CICS PUSH HANDLE. Allows nested handler management. Clean up with POP. For modular code.
DB2
👁 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.