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.
JCL ⭐ Featured
👁 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
/*
COBOL ⭐ Featured
👁 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.
COBOL ⭐ Featured
👁 0

Q: How does INSPECT work?

Answer:
INSPECT examines/modifies string contents. INSPECT field TALLYING counter FOR ALL 'X'. INSPECT field REPLACING ALL 'A' BY 'B'. INSPECT field CONVERTING 'abc' TO '123'. Useful for data validation, transformation, and counting characters.
DB2 ⭐ Featured
👁 0

Q: What is dynamic SQL?

Answer:
Dynamic SQL constructed at runtime. PREPARE creates executable. EXECUTE runs it. EXECUTE IMMEDIATE for one-time. DECLARE CURSOR for queries. More flexible but less efficient than static. Security concerns (injection).
COBOL ⭐ Featured
👁 0

Q: What is USAGE clause?

Answer:
USAGE specifies internal data representation. DISPLAY (default)=character, COMP/BINARY=binary, COMP-3/PACKED-DECIMAL=packed, COMP-1=single float, COMP-2=double float. Affects storage size and arithmetic performance.
DB2 ⭐ Featured
👁 0

Q: Explain database design normalization

Answer:
1NF: atomic values, no repeating groups. 2NF: 1NF + no partial dependencies. 3NF: 2NF + no transitive dependencies. BCNF: stricter 3NF. Higher forms reduce redundancy. Denormalize for performance. Balance is key.
DB2 ⭐ Featured
👁 0

Q: What is encoding scheme?

Answer:
Encoding defines character representation. EBCDIC for mainframe. ASCII for open systems. Unicode for international. CCSID specifies exact encoding. Mixed encoding needs careful handling. TRANSLATE for conversion.
DB2 ⭐ Featured
👁 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.
DB2 ⭐ Featured
👁 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.
COBOL ⭐ Featured
👁 0

Q: What is PIC clause editing?

Answer:
Picture editing characters: Z=zero suppress, *=check protect, +=sign, -=negative, CR/DB=credit/debit, $=currency, .=decimal, ,=comma, B=blank. Example: PIC ,ZZ9.99- displays $ 123.45-. Insertion characters add to display.
VSAM ⭐ Featured
👁 0

Q: What is KSDS key format?

Answer:
Keys defined by KEYS(length offset). Offset is 0-based. Key extracted from record at offset for length bytes. Alphanumeric comparison. Numeric keys need proper format. Key must be contiguous.
COBOL ⭐ Featured
👁 0

Q: Explain DE-EDIT function

Answer:
FUNCTION DE-EDIT converts edited numeric back to numeric. Original: '1,234.56-'. DE-EDIT result: -1234.56. Removes edit characters, preserves numeric value and sign. Useful when receiving edited display data needing calculation.
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: Explain SYMBOLIC CHARACTERS

Answer:
SPECIAL-NAMES. SYMBOLIC CHARACTERS NULL-CHAR IS 1. Assigns name to ordinal position in collating sequence. Position 1 is X'00' in EBCDIC. Use: MOVE NULL-CHAR TO field. Define non-printable characters readably.
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.
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: Explain PARM parameter

Answer:
PARM passes data to program. EXEC PGM=PROG,PARM='value'. Max 100 characters. Program receives length prefix. PARM='abc,xyz' passes as one string. Program parses. Special chars need quotes. Alternative: SYSIN for larger data.
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).
CICS ⭐ Featured
👁 0

Q: What is SYSID?

Answer:
SYSID identifies CICS system. 4-character name. EXEC CICS ASSIGN SYSID(ws-sysid). Or in RDO definitions. Used for MRO routing, function shipping. Remote file/program SYSID option.
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 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: What is attribute byte?

Answer:
Attribute byte controls field display. In BMS: ATTRB=(PROT,BRT). Protected, unprotected. Bright, normal, dark. MDT (Modified Data Tag) for transmission. Set in map or program.
JCL ⭐ Featured
👁 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.
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.
DB2 ⭐ Featured
👁 0

Q: How to handle -904 SQLCODE?

Answer:
-904 is resource unavailable. Tablespace/index in restricted state, stopped, or unavailable. Check display status. May need START DATABASE command. Check for REORG, RECOVER, LOAD running. Wait and retry.
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.
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 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.
COBOL
👁 0

Q: Explain SPECIAL-NAMES paragraph

Answer:
SPECIAL-NAMES maps system names to COBOL names. DECIMAL-POINT IS COMMA for European notation. CURRENCY SIGN IS '$'. SYMBOLIC CHARACTERS name = value. ALPHABET for custom collating. CLASS for character groups.
VSAM
👁 0

Q: Explain IDCAMS PRINT utility

Answer:
PRINT displays VSAM contents. PRINT INFILE(dd) CHARACTER/HEX/DUMP. FROMKEY/TOKEY limits range. COUNT limits records. Useful for debugging, verification. Output to SYSPRINT.
COBOL
👁 0

Q: What is BLOCK CONTAINS clause?

Answer:
BLOCK CONTAINS defines blocking factor. BLOCK CONTAINS 10 RECORDS or BLOCK CONTAINS 800 CHARACTERS. 0 RECORDS means system-determined. Affects I/O performance-larger blocks fewer I/Os. Must match JCL/VSAM definition.
COBOL
👁 0

Q: What is CLASS condition?

Answer:
CLASS tests character content. IF field IS NUMERIC/ALPHABETIC/ALPHABETIC-LOWER/ALPHABETIC-UPPER. Custom classes in SPECIAL-NAMES: CLASS VOWELS IS 'A' 'E' 'I' 'O' 'U'. Then IF char IS VOWELS. Useful for validation.
COBOL
👁 0

Q: How to handle negative numbers?

Answer:
Sign stored in PIC S9. SIGN IS LEADING/TRAILING SEPARATE CHARACTER for explicit sign byte. COMP-3 sign in low nibble. Display: S9(5)- shows trailing minus. +9(5) shows sign always. DB/CR for accounting format.
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.
JCL
👁 0

Q: What is CLASS parameter?

Answer:
CLASS assigns job to execution class. CLASS=A on JOB card. Initiators start jobs by class. Determines execution priority, resources. Installations define class characteristics. Multiple classes: CLASS=AB (not common). JES2/JES3 interpret differently.
JCL
👁 0

Q: What is DFSMS?

Answer:
DFSMS (Data Facility Storage Management Subsystem) automates storage management. Components: SMS, HSM (migration), DFRMM (tape). ACS routines assign classes. Reduces JCL complexity. DATACLAS defines data characteristics.
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.
CICS
👁 0

Q: What is BIF DEEDIT?

Answer:
BIF DEEDIT removes edit characters. EXEC CICS BIF DEEDIT FIELD(data) LENGTH(len). Converts edited numeric to raw. Removes $, commas, etc. Useful for BMS numeric input.
JCL
👁 0

Q: Explain STORCLAS parameter?

Answer:
STORCLAS assigns SMS storage class. STORCLAS=classname. Determines placement, management, backup. ACS routines may assign. Defines performance characteristics. Installation-defined classes.
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.
CICS
👁 0

Q: How to set field attributes?

Answer:
Modify A field in symbolic map. DFHBMUNP=unprotected, DFHBMPRO=protected, DFHBMBRY=bright. Move to field-A before SEND. Dynamic attribute control.
DB2
👁 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.
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.