Download presentation
Presentation is loading. Please wait.
Published byVanessa Nichols Modified over 9 years ago
2
This is It! It’s been a pleasure!
3
Final Exam – format True / false 5 Multiple choice 5 Short answers10 Data manipulation10 SQL 3 Array’s12 File processing25 Calling programs 5 Total 75 Crib sheetsAllowed 2 sheet 8 ½ * 11, hand written, 2 sided, NO photocopies, handed in with exam
4
Review
5
Types of Variables Elementary Items. 01 ws-field pic x(3). 77 ws-field2 pic x(3). 01 ws-test pic 1. Group Items 01 ws-group. 05 ws-grp1 pic 9(3). 05 ws-grp2 pic 9(3) comp-3.
6
Types of Variables Arrays 01 ws-array. 05 ws-array-entry occurs 9 times. 10 array-a pic x(3). 10 array-bpic x(3).
7
Conditions 01 ws-indicator-list. 05 IN90 indicator 90 pic 1. 88 no-error value B’0’. 88 has-error value B’1’.
8
Parts of a COBOL Program Identification Division Environment Division Data Division Procedure Division
9
Area A Division Names Section Names Paragraph Names
10
Area B Everything else
11
Editing Functions FunctionCharacter Printing of a / as a separator/ Printing of Decimal Point in an integer. Suppress Leading Zeros in an integerZ Print a Dollar Sign in front of an integer$ Print a Comma in an integer, Printing of + or – signs+ or - Printing of ‘Debit’ or ‘Credit’ symbolsDB or CR Printing of Spaces as separatorsB or b Printing of Zeros as separators0 Print Leading asterix*
12
READ Statement READ Employee-File (RECORD) (NEXT RECORD) AT END PERFORM 500-End-Of-File-Routine NOT AT END PERFORM 300-Process-Employee INVALID KEY PERFORM 200-Invalid-Key-Logic NOT INVALID KEY PERFORM 220-Valid-Key-Logic END-READ.
13
Write Statement WRITE record-name FROM Field-name AFTER ADVANCING 9 LINES/PAGE BEFORE ADVANCING 9 LINES/PAGE INVALID KEY PERFORM 300-Invalid-Key-Rtn NOT INVALID KEY PERFORM 310-Valid-Key-Rtn FORMAT IS record-format name INDICATORS ARE variable-name END-WRITE.
14
Move Statement MOVE Identifier/Variable or Literal/Constant TO (Indentifier/Variable)s Alphanumeric Move? Numeric Move? Group Item Move? Group Item that contains Packed Decimal Data values?
15
STRING Statement STRING Variable/Constant DELIMITED BY {Variable/Constant/SIZE) INTO variable END-STRING
16
UNSTRING Statement UNSTRING Variable DELIMITED BY Variable/Constant/SIZE INTO variable1 variable2 variable3 END-UNSTRING
17
INSPECT Statement INSPECT variable REPLACING {ALL} {LEADING} var/lit by var/lit {FIRST}
18
Add Statement ADD variable/constant TO variable ROUNDED ON SIZE ERROR PERFORM ERROR-HANDLING-ROUTINE. ADD variable/constant, variable/constant, … GIVING variable ROUNDED ON SIZE ERROR PERFORM ERROR-HANDLING-ROUTINE. ADD variable/constant TO variable/constant GIVING variable ROUNDED ON SIZE ERROR PERFORM ERROR-HANDLING-ROUTINE.
19
SUBTRACT Statement SUBTRACT Variable/Constant Variable/Constant... FROM Variable ROUNDED ON SIZE ERROR PERFORM ERROR-HANDLING-ROUTINE. SUBTRACT Variable/Constant Variable/Constant … FROM Variable GIVING Variable ROUNDED ON SIZE ERROR PERFORM ERROR-HANDLING-ROUTINE.
20
MULTIPLY Statement MULTIPLY variable/constant BY variable ROUNDED ON SIZE ERROR PERFORM ERROR-HANDLING-ROUTINE. MULTIPLY variable/constant BY variable/constant GIVING variable ROUNDED ON SIZE ERROR PERFORM ERROR-HANDLING-ROUTINE.
21
DIVIDE Statement DIVIDE variable/constant INTO variable REMAINDER variable ROUNDED ON SIZE ERROR PERFORM ERROR-HANDLING-ROUTINE. DIVIDE variable/constant INTO variable/constant GIVING variable REMAINDER variable ROUNDED ON SIZE ERROR PERFORM ERROR-HANDLING-ROUTINE. DIVIDE variable/constant BY variable/constant GIVING variable REMAINDER variable ROUNDED ON SIZE ERROR PERFORM ERROR-HANDLING-ROUTINE.
22
COMPUTE Statement COMPUTE variable ROUNDED = Arithmetic Statement ON SIZE ERROR PERFORM ERROR-HANDLING-ROUTINE
23
Initialize Verb INITIALIZE variable1 variable2 variable3 … ALPHABETIC REPLACING ALPHANUMERIC NUMERIC ALPHANUMERIC-EDITED NUMERIC-EDITED BY Variable4 literal-1
24
Set Verb Used to initialize fields to a Condition- Name. Used to initialize/increment indexes for arrays Used to store contents on an index in a variable
25
Set Verb 01 ARE-THERE-MORE-RECORDS 88 THERE-ARE-MORE-RECORDS VALUE ‘YES’. 88 END-OF-FILEVALUE ‘NO’. SET END-OF-FILE TO TRUE. SET SUB UP BY 1. SET SUB TO SOME-NUMBER.
26
START Statement START file-name KEY condition INVALID KEY Perform Invalid-Logic NOT INVALID KEY Perform valid-logic END-START.
27
REWRITE REWRITE record-name (FROM variable-name) INVALID KEY perform error-rtn NOT INVALID KEY perform continue-rtn END-REWRITE.
28
DELETE DELETE file-name RECORD INVALID KEY perform error-rtn NOT INVALID KEY perform continue-rtn END-DELETE.
29
Selection IF Condition THEN Statement(s) ELSE Statement(s) END-IF
30
Evaluate Statements EVALUATE TRUE WHEN MARKS >= 80 MOVE ‘A’ TO GRADE WHEN MARKS >= 70 AND MARKS < 80 MOVE ‘B’ TO GRADE WHEN MARKS >= 60 AND MARKS < 70 MOVE ‘C’ TO GRADE WHEN MARKS >= 55 AND MARKS < 60 MOVE ‘D’ TO GRADE WHEN OTHER MOVE ‘F’ TO GRADE END-EVALUATE.
31
Perform Statement PERFORM (paragraph-name) PERFORM paragraph-name UNTIL Condition PERFORM (paragraph-name) THROUGH/THRU (paragraph-name) (integer/variable) TIMES PERFORM (paragraph-name) THROUGH/THRU (paragraph-name) WITH TEST AFTER UNTIL Condition
32
Select Statement SELECT Cobol-file-name ASSIGN TO DISK/DATABASE/PRINTER/WORKSTATION actual-file-name FILE STATUS IS variable-name ORGANIZATION IS INDEXED ACCESS MODE IS SEQUENTIAL/RANDOM/DYNAMIC/TRANSACTION RECORD KEY is data-element/EXTERNALLY DESCRIBED KEY CONTROL-AREA IS variable-name.
33
Search Array must have an index. Must set the index to where you want to start the search from (usually 1) SEARCH array-entries AT END WHEN END-Search
34
Search All Array must have an ascending or descending key and be indexed. No need to set the index before the search SEARCH ALL array-entries AT END WHEN END-SEARCH.
35
CALL (linkage type is Procedure/Program) ‘program-name’ USING parm1 parm2 END-CALL. CALL (linkage type is Procedure/Program) ‘program-name’ USING BY CONTENT parm1 parm2 END-CALL. CALL Statement
36
SQL How to embed SQL statements in COBOL programs? Replace Read/Delete COBOL Statements? Replace Read/Rewrite COBOL Statements? Replace Read/Write COBOL Statements? Replace Sequential COBOL Statements? What do you need in the working storage section?
37
Any Questions?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.