👁 0
Q: What causes S0C7 abend and how to fix it?
Answer:
S0C7 (Data Exception) occurs when non-numeric data is used in numeric operations. Common causes: uninitialized fields, incorrect data from files, wrong REDEFINES. Fix by: initializing variables, validating input data, using INSPECT/NUMVAL functions, checking file data quality.
👁 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 RECORDING MODE for files?
Answer:
RECORDING MODE specifies record format: F=fixed, V=variable, U=undefined, S=spanned. RECORDING MODE IS V for variable records. Affects how records are blocked and how length is tracked. Must match JCL DCB specifications.
👁 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.
👁 0
Q: Explain RECORDSIZE parameter
Answer:
RECORDSIZE(average maximum). For variable length records. Average used for space calculation. Maximum is hard limit. Fixed length: same average and max. Space formula uses average.
👁 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.
👁 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.
👁 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.
👁 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.
👁 0
Q: Explain RECFM options
Answer:
RECFM defines record format. F=fixed, V=variable, U=undefined. B=blocked, A=ASA control, M=machine control, S=spanned. Combinations: FB=fixed blocked, VBS=variable blocked spanned. Match program expectations.
👁 0
Q: What is LENGTH in commands?
Answer:
LENGTH specifies data size. LENGTH(ws-len). Required for variable data. Set before RECEIVE. Check after READ for actual length. FLENGTH for fullword. Some commands have defaults.
👁 0
Q: Explain NULL handling in DB2
Answer:
NULL means unknown/missing value. NULL != NULL returns unknown. Use IS NULL, IS NOT NULL. COALESCE(col, default) substitutes. NULL in arithmetic yields NULL. Indicator variables detect NULL in COBOL. NVL function alternative.
👁 0
Q: What is indicator variable?
Answer:
Indicator variable detects NULL values. Declare: 01 col-var. 01 col-ind PIC S9(4) COMP. Use: INTO :col-var:col-ind. If col-ind < 0, value is NULL. Set indicator negative to insert NULL. Required for nullable columns.
👁 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: 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.
👁 0
Q: What is reference modification?
Answer:
Reference modification extracts substring: WS-FIELD(start:length). WS-NAME(1:3) gets first 3 characters. Can use in MOVE, IF, DISPLAY. Start position is 1-based. Length optional (to end). More flexible than REDEFINES for variable positions.
👁 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.
👁 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.