👁 0
Q: What is the difference between COND and IF/THEN/ELSE in JCL?
Answer:
COND Parameter:
- Tests return codes from previous steps
- Bypasses step if condition is TRUE
- Works opposite to programming logic!
- COND=(4,LT) means: Skip if 4 < any previous RC
IF/THEN/ELSE:
- More intuitive programming-like syntax
- Executes steps when condition is TRUE
- Supports AND, OR operators
- Can check ABEND conditions
Example:
// Using COND (skip if RC < 4) //STEP2 EXEC PGM=PROG2,COND=(4,LT) // Using IF/THEN/ELSE // IF STEP1.RC = 0 THEN //STEP2 EXEC PGM=PROG2 // ELSE //ERROR EXEC PGM=ERRPROC // ENDIF
👁 0
Q: What is SQLCODE and what are common values?
Answer:
SQLCODE is a return code in SQLCA indicating the result of SQL execution.
Common SQLCODE values:
| 0 | Successful execution |
| 100 | No data found / End of cursor |
| -803 | Duplicate key on insert |
| -811 | Multiple rows returned for singleton SELECT |
| -904 | Unavailable resource |
| -911 | Deadlock/timeout |
| -922 | Authorization failure |
| -927 | DB2 not available |
Negative = Error, 0 = Success, 100 = No data
👁 0
Q: How to handle SQLCODE 100?
Answer:
SQLCODE 100 means not found or end of data. For SELECT INTO: no matching row. For FETCH: no more rows. For UPDATE/DELETE: no rows affected. Check context - may be normal condition, not error.
👁 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.
👁 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.
👁 0
Q: How to handle file status 22?
Answer:
Status 22 is duplicate key on WRITE or REWRITE attempt. KSDS primary key must be unique. Check program logic. May indicate data error. Use DUPLICATES option on AIX only if needed.
👁 0
Q: What is file status 39?
Answer:
Status 39 is file attribute mismatch. JCL attributes don't match cluster. Check: RECFM, LRECL in JCL vs cluster. May need to omit DCB parameters. VSAM doesn't use standard DCB.
👁 0
Q: What is PERFORM recursion limit?
Answer:
COBOL doesn't traditionally support recursion; same paragraph in PERFORM stack causes error. RECURSIVE clause in PROGRAM-ID enables it. Recursive programs need local storage. Stack depth limited by system resources. Usually avoid in COBOL.
👁 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 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: 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.
👁 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.
👁 0
Q: What is COND CODE?
Answer:
Programs return condition/return code in register 15. COND parameter tests: COND=(4,LT) skips if 4 < any prior return code. Values 0-4095. Convention: 0=success, 4=warning, 8=error, 12+=severe. Used for job flow control.
👁 0
Q: How to handle CICS RESP codes?
Answer:
RESP and RESP2 capture command results. EXEC CICS command RESP(ws-resp) RESP2(ws-resp2). Check DFHRESP(NORMAL) for success. RESP contains condition. RESP2 has additional info. Always check after commands.
👁 0
Q: How to check job status?
Answer:
SDSF DA/ST panels show jobs. TSO STATUS command. JES2 J'jobname'. JESMSGLG shows JCL, allocation. JESYSMSG has error details. Return code in JESMSGLG. Condition codes per step. Check SYSOUT for program output.
👁 0
Q: What causes JCL ERROR?
Answer:
JCL ERROR means syntax error or invalid combination. Check: missing commas, unmatched quotes/parentheses, misspelled keywords, invalid parameter values. JES message indicates line and error. JESYSMSG has details.
👁 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.
👁 0
Q: What is NOHANDLE option?
Answer:
NOHANDLE suppresses condition handling. EXEC CICS command NOHANDLE RESP(ws-resp). Program handles all conditions. No HANDLE CONDITION invoked. Cleaner error handling. Recommended approach.
👁 0
Q: How to handle DUPKEY?
Answer:
DUPKEY on WRITE means key exists. Check: IF ws-resp = DFHRESP(DUPKEY). Handle appropriately - maybe update instead. Or error to user. Common for insert logic.
👁 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.
👁 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.
👁 0
Q: Explain EROPT parameter?
Answer:
EROPT specifies error handling. DCB=(EROPT=ABE/ACC/SKP). ABE=abend on error, ACC=accept and continue, SKP=skip block. For tape I/O errors. Program may handle differently. Default is ABE.
👁 0
Q: Explain INVREQ condition
Answer:
INVREQ is invalid request. Command invalid for situation. Check: command syntax, option combinations, resource state. EIBRESP2 may have more info. Common programming error.
👁 0
Q: How to handle CICS timeout?
Answer:
Set RTIMOUT on transaction. EXEC CICS HANDLE CONDITION ERROR. DTIMOUT for deadlock. Program design for cleanup. TIMEOUT condition raised.
👁 0
Q: What is FILE STATUS and common codes?
Answer:
FILE STATUS is a 2-byte field capturing I/O operation results. 00=success, 10=end-of-file, 22=duplicate key, 23=record not found, 35=file not found, 39=file attribute mismatch, 41=file already open, 47=not opened input. Essential for error handling.
👁 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.
👁 0
Q: What is DECLARATIVES section?
Answer:
DECLARATIVES contains USE procedures for exception handling. USE AFTER ERROR PROCEDURE ON file-name handles file errors. USE AFTER EXCEPTION handles specific conditions. Must be first in PROCEDURE DIVISION. END DECLARATIVES marks end.
👁 0
Q: What causes VSAM file status 35?
Answer:
Status 35 is file not found. Check: DSN spelling, catalog entry exists, IDCAMS LISTCAT confirms. JCL DD name matches program. May need to define cluster first. Common for new programs.
👁 0
Q: What is ON SIZE ERROR?
Answer:
ON SIZE ERROR traps arithmetic overflow. COMPUTE X = A + B ON SIZE ERROR PERFORM error-handler END-COMPUTE. Also NOT ON SIZE ERROR for success. Must be enabled (TRUNC option). Prevents abends from overflow conditions.
👁 0
Q: How to use SUBTRACT CORRESPONDING?
Answer:
SUBTRACT CORRESPONDING subtracts matching fields. SUBTRACT CORR group-1 FROM group-2. Each matching numeric field in group-2 decreased by corresponding group-1 value. Use ROUNDED and SIZE ERROR options. Limited to numeric fields.
👁 0
Q: What causes file status 34?
Answer:
Status 34 is boundary violation or record too large. Record exceeds defined maximum. Check RECORDSIZE definition. May have wrong record format. Truncation not automatic.
👁 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: What is file status 47?
Answer:
Status 47 is READ attempted but file not open input. OPEN mode doesn't match operation. Must OPEN INPUT or I-O for READ. Check file OPEN statement and mode.
👁 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.
👁 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.
👁 0
Q: Explain HANDLE CONDITION
Answer:
HANDLE CONDITION sets error label. EXEC CICS HANDLE CONDITION NOTFND(para-notfnd). Jumps to label on condition. PUSH/POP HANDLE for nesting. Obsolete - prefer RESP option. Still seen in old code.
👁 0
Q: What is HANDLE ABEND?
Answer:
HANDLE ABEND traps abends. EXEC CICS HANDLE ABEND PROGRAM(abend-prog) or LABEL(abend-para). Allows cleanup before termination. CANCEL removes handler. Use for graceful error handling.
👁 0
Q: How to handle NOTFND condition?
Answer:
NOTFND means record not found. Check RESP: IF ws-resp = DFHRESP(NOTFND). Or HANDLE CONDITION NOTFND(para). Common for READ/DELETE. Handle gracefully - display message, take action.
👁 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.
👁 0
Q: What causes IEF452I error?
Answer:
IEF452I is symbolic substitution error. Symbol not defined or wrong format. Check SET statements, PROC defaults. Verify symbol names match. May be missing &. Case matters for some systems.
👁 0
Q: What is LENGERR?
Answer:
LENGERR is length error. Data too large for area, or length specification wrong. Check LENGTH values. Common on RECEIVE. Ensure adequate receiving field.
👁 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: 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: Explain ITEMERR condition
Answer:
ITEMERR is item error in TS. Item number invalid. Out of range or doesn't exist. ITEM 1 is first. Check NUMITEMS. Common in READQ TS.
👁 0
Q: What is PGMIDERR?
Answer:
PGMIDERR is program not found. LINK/XCTL to undefined program. Check RDO PROGRAM definition. Or spelling. Must be defined and installed.
👁 0
Q: What is SQLCA structure?
Answer:
SQLCA (SQL Communication Area) contains execution results. SQLCODE for return code. SQLERRM for message. SQLERRD(3) for rows affected. SQLWARN for warnings. INCLUDE SQLCA in WORKING-STORAGE. Check after each SQL statement.