CUCO flashcards
CUCO · Build recall with a focused review session.
36 cards. Read the term and the definition here. The deck at the top of this page is optional.
- Four divisions of COBOL
- IDENTIFICATION, ENVIRONMENT, DATA, PROCEDURE - in that order. Only IDENTIFICATION is technically required by the standard, but a runnable program needs all four.
- Area A and Area B
- Fixed-format source areas: columns 8-11 (Area A) hold division, section, paragraph names and 01/77 levels; columns 12-72 (Area B) hold statements and other level numbers.
- Comment indicator column 7
- In fixed format, an asterisk in column 7 marks a comment line, a slash causes a page eject, a hyphen continues the previous line, and D marks a debugging line.
- Figurative constants
- Reserved words representing literal values: ZERO, SPACE, HIGH-VALUE, LOW-VALUE, QUOTE, NULL. ALL literal repeats a literal to fill the receiving item.
- Period and scope
- A period ends a sentence and terminates the scope of all open IF, PERFORM, and EVALUATE statements. A misplaced period silently changes control flow.
- COBOL word rules
- A user-defined word may contain letters, digits, and hyphens, must contain at least one letter, cannot start or end with a hyphen, and cannot be a reserved word.
- LOCAL-STORAGE vs WORKING-STORAGE
- WORKING-STORAGE is allocated and initialized once per run unit; LOCAL-STORAGE is allocated and initialized on every invocation of the program or subprogram.
- PICTURE S and V
- S declares a sign and V an implied decimal point; neither occupies a character position. PIC S9(3)V99 occupies 5 bytes in DISPLAY usage.
- COMP-3 byte size formula
- Packed decimal size in bytes equals INT((digits + 1) / 2) rounded up, where the +1 accounts for the sign nibble. PIC S9(5) COMP-3 is 3 bytes.
- Level 88 condition-name
- A level 88 attaches a condition-name to a data item with VALUES ARE ... THRU ... ranges. SET condition-name TO TRUE moves the associated value into the item.
- REDEFINES rules
- REDEFINES must immediately follow the redefined item at the same level, cannot change the item's size in a file record, and does not initialize storage.
- Group item usage
- A group item has no PICTURE and no USAGE clause. Its usage is DISPLAY unless all subordinate elementary items share a usage, and moves into it are alphanumeric.
- Level 66 RENAMES
- Level 66 regroups previously defined elementary items in the same record. It cannot overlap other 66 entries and cannot rename an item containing an OCCURS.
- PERFORM WITH TEST AFTER
- PERFORM ... UNTIL tests before execution and may run zero times; WITH TEST AFTER tests after each execution and guarantees at least one execution.
- EVALUATE TRUE
- EVALUATE TRUE evaluates each WHEN as a condition rather than comparing values, making it the standard replacement for nested IF/ELSE chains.
- GO TO DEPENDING ON
- Branches to the nth procedure named in the statement, where n is the value of the identifier. Values outside 1 through n cause no branch.
- CALL BY REFERENCE vs CONTENT
- BY REFERENCE (the default) passes a pointer to the caller's item; BY CONTENT passes a copy the subprogram cannot use to change the caller's data.
- INITIAL clause
- The INITIAL clause on a subprogram resets WORKING-STORAGE and internal state on every CALL. Without it, WORKING-STORAGE retains values between calls.
- NEXT SENTENCE vs CONTINUE
- CONTINUE is a no-op statement. NEXT SENTENCE jumps to the next period, which differs from CONTINUE when inline scope terminators such as END-IF are used.
- File OPEN modes
- OPEN INPUT reads; OUTPUT creates or overwrites; EXTEND appends; I-O allows read, rewrite, and delete. REWRITE and DELETE require the file opened I-O.
- FILE STATUS codes
- Two-character status: 00 success, 10 end of file, 22 duplicate key, 23 record not found, 35 file not found on OPEN.
- DYNAMIC access mode
- DYNAMIC allows both sequential and random access on the same file in one run. It requires a RECORD KEY or RELATIVE KEY in the SELECT statement.
- START statement
- START positions an indexed or relative file at a key value. The following READ NEXT retrieves records from that position onward.
- OCCURS and INDEXED BY
- OCCURS n TIMES defines a table with 1-relative subscripts. INDEXED BY creates an index usable only with SET, SEARCH, and relative subscripting.
- SEARCH ALL requirements
- SEARCH ALL performs a binary search and requires the table to be sorted ascending or descending on the key, with the key as the first or only item.
- OCCURS DEPENDING ON
- ODO makes a table variable length. The ODO object must be an integer defined before the table, and the table must be last in a file record.
- Nested OCCURS subscripts
- A nested table requires one subscript per dimension, listed outermost first. T(I,J) is defined by OCCURS at level 05 followed by OCCURS at level 10.
- RECURSIVE clause
- The RECURSIVE clause permits a subprogram to call itself. LOCAL-STORAGE is then allocated per invocation, keeping each recursion level independent.
- S0C7 abend
- A data exception caused by nonnumeric data in a numeric field, often from an uninitialized COMP-3 item or a bad move into a packed field.
- S0C4 abend
- A protection exception caused by an invalid address, typically a bad CALL USING parameter, an out-of-range subscript, or a mismatched LINKAGE SECTION.
- WITH DEBUGGING MODE
- When debugging mode is active, lines with D in column 7 are compiled. The DEBUG-ITEM special register exposes the last debug line processed.
- COPY statement
- COPY inserts copybook source at compile time. Changing a copybook requires recompiling every program that copies it, a common maintenance defect.
- JSON GENERATE and PARSE
- COBOL 2014 statements that convert between COBOL data structures and JSON text, complementing XML GENERATE and XML PARSE for web integration.
- GnuCOBOL
- An open-source COBOL compiler supporting most COBOL 85 and many 2002+ features. It translates COBOL to C and runs on Linux, Windows, and containers.
- Object-oriented COBOL
- COBOL 2002 introduced CLASS-ID and METHOD-ID for object-oriented programming, along with user-defined functions and free-format source.
- EXEC CICS END-EXEC
- Embedded transaction commands in the PROCEDURE DIVISION used to run COBOL programs under CICS on z/OS, delimited by EXEC CICS and END-EXEC.