👁 0
Q: What is the difference between COMP and COMP-3 in COBOL?
Answer:
COMP (COMPUTATIONAL) - Pure binary format
- Stored in binary (base-2)
- Used for subscripts and counts
- Efficient for arithmetic operations
- PIC S9(4) COMP = 2 bytes
- PIC S9(9) COMP = 4 bytes
COMP-3 (PACKED DECIMAL)
- Each digit takes 4 bits (nibble)
- Last nibble holds sign
- Used for business calculations
- PIC S9(5) COMP-3 = 3 bytes
- Formula: (n+1)/2 rounded up
When to use:
- COMP - Array subscripts, counters, loops
- COMP-3 - Money, quantities, business data
👁 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.
👁 0
Q: What is UNLOAD utility?
Answer:
UNLOAD extracts data to sequential file. UNLOAD FROM TABLE name. Output format matches LOAD input. Used for data migration, backup, extract. Can include WHERE clause for filtering.
👁 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.
👁 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.
👁 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: 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.
👁 0
Q: Explain WRITE BEFORE/AFTER ADVANCING
Answer:
ADVANCING controls line spacing for print files. WRITE rec AFTER ADVANCING 2 LINES skips 2 lines first. WRITE rec BEFORE ADVANCING PAGE starts new page after. WRITE rec AFTER PAGE goes to new page first. Controls report formatting.
👁 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.
👁 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.
👁 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.
👁 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.
👁 0
Q: How to load VSAM from sequential?
Answer:
REPRO INFILE(seqfile) OUTFILE(vsamfile). REPLACE option to overwrite existing. Records must match VSAM format. For KSDS, records must be sorted by key. IDCAMS job.
👁 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.
👁 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: Explain ASKTIME/FORMATTIME
Answer:
ASKTIME gets current time. EXEC CICS ASKTIME ABSTIME(ws-abstime). FORMATTIME converts to readable. FORMATTIME ABSTIME(ws-abstime) DATESEP('/') TIMESEP(':'). Formatting options available.
👁 0
Q: Explain DATAONLY option
Answer:
DATAONLY sends only changed data. EXEC CICS SEND MAP DATAONLY FROM(data). No map formatting. Faster for updates. Fields must exist on screen. Use after initial MAPONLY.
👁 0
Q: How to use TRANSFORM?
Answer:
TRANSFORM converts data format. EXEC CICS TRANSFORM DATATOXML. XML/JSON transformations. Modern data exchange. Requires definitions. Simplifies integration.
👁 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.
👁 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: Explain JSON GENERATE
Answer:
JSON GENERATE creates JSON from data. JSON GENERATE output FROM data-item. NAME clause for custom keys. SUPPRESS clause omits fields. COUNT IN length. COBOL V6+ feature. Generates name-value pairs from structure.
👁 0
Q: Explain DFSORT utility
Answer:
DFSORT sorts/merges files. SYSIN has SORT FIELDS=(1,10,CH,A). SORTIN=input, SORTOUT=output. Options: INCLUDE/OMIT for filtering, OUTREC/INREC for reformatting, SUM for summarization. ICETOOL provides extended functions.
👁 0
Q: What is ACCTRG parameter?
Answer:
ACCT (accounting) provides billing information. On JOB card: ACCT=(account-number,additional-info). Installation-defined format. Passed to SMF for accounting records. May affect job processing priority.
👁 0
Q: Explain ASKTIME ABSTIME
Answer:
ABSTIME is packed decimal timestamp. Microseconds since 1/1/1900. ASKTIME returns current. FORMATTIME converts to readable. Use for calculations, comparisons. Full precision timing.
👁 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: 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.
👁 0
Q: What is CASE expression?
Answer:
CASE provides if-then logic. CASE WHEN cond1 THEN val1 WHEN cond2 THEN val2 ELSE default END. Simple CASE: CASE col WHEN 'A' THEN 'Active' END. Use in SELECT, WHERE, ORDER BY. Powerful for transformations.