1 / 36

This is It!

This is It!. It’s been a pleasure!. Final Exam. Short answer question format 6 short answer questions 2 programs. 5 reference sheets. Review. 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.

leekelly
Télécharger la présentation

This is It!

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. This is It! It’s been a pleasure!

  2. Final Exam • Short answer question format • 6 short answer questions • 2 programs. • 5 reference sheets

  3. Review

  4. 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.

  5. Types of Variables • Arrays 01 ws-array. 05 ws-array-entry occurs 9 times. 10 array-a pic x(3). 10 array-b pic x(3).

  6. Conditions 01 ws-indicator-list. 05 IN90 indicator 90 pic 1. 88 no-error value B’0’. 88 has-error value B’1’.

  7. Parts of a COBOL Program • Identification Division • Environment Division • Data Division • Procedure Division

  8. Area A • Division Names • Section Names • Paragraph Names

  9. Area B • Everything else

  10. Editing Functions

  11. 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.

  12. 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.

  13. 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?

  14. STRING Statement STRING Variable/Constant DELIMITED BY {Variable/Constant/SIZE) INTO variable END-STRING

  15. UNSTRING Statement UNSTRING Variable DELIMITED BY Variable/Constant/SIZE INTO variable1 variable2 variable3 END-UNSTRING

  16. INSPECT Statement INSPECT variable REPLACING {ALL} {LEADING} var/lit by var/lit {FIRST}

  17. 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.

  18. 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.

  19. 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.

  20. 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.

  21. COMPUTE Statement COMPUTE variable ROUNDED = Arithmetic Statement ON SIZE ERROR PERFORM ERROR-HANDLING-ROUTINE

  22. Initialize Verb INITIALIZE variable1 variable2 variable3 … ALPHABETIC REPLACING ALPHANUMERIC NUMERIC ALPHANUMERIC-EDITED NUMERIC-EDITED BY Variable4 literal-1

  23. 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

  24. Set Verb 01 ARE-THERE-MORE-RECORDS 88 THERE-ARE-MORE-RECORDS VALUE ‘YES’. 88 END-OF-FILE VALUE ‘NO’. SET END-OF-FILE TO TRUE. SET SUB UP BY 1. SET SUB TO SOME-NUMBER.

  25. START Statement START file-name KEY condition INVALID KEY Perform Invalid-Logic NOT INVALID KEY Perform valid-logic END-START.

  26. REWRITE REWRITE record-name (FROM variable-name) INVALID KEY perform error-rtn NOT INVALID KEY perform continue-rtn END-REWRITE.

  27. DELETE • DELETE file-name RECORD • INVALID KEY perform error-rtn • NOT INVALID KEY perform continue-rtn • END-DELETE.

  28. Selection IF Condition THEN Statement(s) ELSE Statement(s) END-IF

  29. 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.

  30. 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

  31. 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.

  32. 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

  33. 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.

  34. 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

  35. 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?

  36. Any Questions?

More Related