Submitting Instructions on web site CS 1024 students Read guide Download the EAGS Client Configuration Tool for Fall 1999 Save as box Save it somewhere Start, run, browse, double click on it Installs quickly Go to C:\TEMP and run CuratorSetup.exe
Now get the java runtime 1.2.2 http://java.sun.com/products//jdk/1.2/jre/download-windows.html US English version One large bundle Click on continue Accept Download from java.sun.com http download Save as, save Start,run,browse, double click… Go through the instructions Now use the submit link Association with data names
Chapter 4 COBOL notation Identification Division Syntax and notational conventions - optional, required,lower & upper case Relevant to the book Identification Division Position in program Purpose and syntax provide identifying info - author,dates division and up to 6 paragraphs PROGRAM-ID & header are required 5 others are optional
Environment Division CONFIGURATION SECTION (Optional Entries) Identifies the computer SOURCE-COMPUTER OBJECT-COMPUTER INPUT-OUTPUT SECTION Associates the files in the program with the files known to the OS FILE-CONTROL SELECT statement ASSIGN clause
Data Division FILE SELECTION LABEL RECORDS statement (optional) FD (File Description) statement Size and type of each field Order in which the fields appear relationship of the fields LABEL RECORDS statement (optional) RECORD CONTAINS (record description) statement (optional) DATA RECORD IS statement (optional) documentation only
Figure 4.7 Development of a COBOL Program (File Section) CREDITS UNION MEMBER INITIALS SCHOLARSHIP STUDENT NAME GPA LAST 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 (a) Program Specifications (b) COBOL Entries FD STUDENT-FILE RECORD CONTAINS 27 CHARACTERS. 01 STUDENT-RECORD. 05 STU-NAME. 10 STU-LAST-NAME PIC X(15). 10 STU-INITIALS PIC XX. 05 STU-CREDITS PIC 9(2). 05 STU-UNION-MEMBER PIC X. 05 STU-SCHOLARSHIP PIC 9(4). 05 STU-GPA PIC 9V99.
Data Division PICTURE CLAUSE PICTURE IS, PICTURE, PIC IS, PIC Size Number of characters, positions Type 9 - numeric, 0-9 999 same as 9(3) Assumed decimal point Use of a V, PIC 9V99 can hold 1.23 X - alphanumeric, all characters including numbers as characters XXXXXX same as X(6)
Figure 4.3 Student Exam Record STUDENT-NAME EXAM-SCORES SS-NUM LAST NAME FIRST NAME INIT MATH ENGLISH ALG GEO READ VOC LIT 1 15 16 30 31 32 40 41 45 46 50 51 55 56 60 61 65 ALPHANUMERIC NUMERIC
DATA DIVISION RECORD DESCRIPTION Figure 4.5 Assumed Decimal Point INCOMING RECORD DATA DIVISION RECORD DESCRIPTION VALUES 01 INCOMING-DATA-RECORD. 05 STUDENT-NAME PIC 9V99. 05 STUDENT-NAME PIC 99V9. 05 STUDENT-NAME PIC 9. 05 STUDENT-NAME PIC V999. 9.87 65.4. 3 .210 v v v 9 87|65 4|3 | 210
Data Division Level numbers Describe the relationship between the fields in the record Elementary Item - cannot be further divided Group Item - can be further divided Use 01 to 49 01 denotes a record as a whole 02 -49 used for fields within a record Elementry numbers must have picture clauses groups cannot have picture clauses
Data Division WORKING-STORAGE SECTION defines any data name that does not appear in a file stores results of calculations, flags, switch control, constants Used to define print lines Intermediate data storage Filler - can use as a field name, not referenced anywhere else typically holds spaces or constants
Figure 4.4 Level Numbers and PICTURE Clauses 01 STUDENT-EXAM-RECORD. 05 STUDENT-NAME. 10 LAST-NAME PICTURE IS X(15). 10 FIRST-NAME PICTURE IS X(15). 10 MID-INITIAL PICTURE IS X. 05 SOC-SEC-NUM PICTURE IS 9(9). 05 EXAM-SCORES. 10 MATH. 15 ALGEBRA PICTURE IS 9(5). 15 GEOMETRY PICTURE IS 9(5). 10 ENGLISH. 15 READING PICTURE IS 9(5). 15 VOCABULARY PICTURE IS 9(5). 15 LITERATURE PICTURE IS 9(5). 01 STUDENT-EXAM-RECORD. 04 STUDENT-NAME. 08 LAST-NAME PIC X(15). 08 FIRST-NAME PIC X(15). 08 MID-INITIAL PIC X. 04 SOC-SEC-NUM PIC 9(9). 04 EXAM-SCORES. 08 MATH. 12 ALGEBRA PIC 99999. 12 GEOMETRY PIC 99999.. 08 ENGLISH. 12 READING PIC 99999. 12 VOCABULARY PIC 99999. 12 LITERATURE PIC 99999. (a) Initial Coding (b) Alternative Specification
VALUE clause initializes contents of a field (Literals) Numeric literals , VALUE 3.00 Non-numeric literals, VALUE ‘ENGINEERING’ Figurative constants (zero or space), VALUE SPACES
Figure 4.8 Development of a COBOL Program (Constants and Rates) 1. Calculate tuition due at the rate of $200 per credit. 2. The union fee is $25. 3. Compute the activity fee based on the number of credits taken; $25 for 6 credits or less, $50 for 7 to 12 credits, and $75 for more than 12 credits. 4. Award a scholarship equal to the amount in the incoming record if, and only if, the GPA is greater than 2.5. (a) Excerpt from the Program Specifications WORKING-STORAGE SECTION. 01 CONSTANTS-AND-RATES. 05 PRICE-PER-CREDIT PIC 9(3) VALUE 200. 05 UNION-FEE PIC 9(2) VALUE 25. 05 ACTIVITY-FEES. 10 1ST-ACTIVITY-FEE PIC 99 VALUE 25. 10 1ST-CREDIT-LIMIT PIC 99 VALUE 6. 10 2ND-ACTIVITY-FEE PIC 99 VALUE 50. 10 2ND-CREDIT-LIMIT PIC 99 VALUE 12. 10 3RD-ACTIVITY-FEE PIC 99 VALUE 75. 05 MINIMUM-SCHOLARHSIP-GPA PIC 9V9 VALUE 2.5. (b) COBOL Entries
Figure 4.9 Development of a COBOL Program (Print Lines) (a) Report Layout
Figure 4.9 Development of a COBOL Program (Print Lines) 01 HEADING-LINE. 05 FILLER PIC X VALUE SPACES. 05 FILLER PIC X(12) VALUE ‘STUDENT NAME’. 05 FILLER PIC X(10) VALUE SPACES. 05 FILLER PIC X(7) VALUE ‘CREDITS’. 05 FILLER PIC X(2) VALUE SPACES. 05 FILLER PIC X(7) VALUE ‘TUITION’. 05 FILLER PIC X(2) VALUE SPACES. 05 FILLER PIC X(9) VALUE ‘UNION FEE’. 05 FILLER PIC X(2) VALUE SPACES. 05 FILLER PIC X(7) VALUE ‘ACT FEE’. 05 FILLER PIC X(2) VALUE SPACES. 05 FILLER PIC X(11) VALUE ‘SCHOLARSHIP’. 05 FILLER PIC X(2) VALUE SPACES. 05 FILLER PIC X(10) VALUE ‘TOTAL BILL’. 05 FILLER PIC X(48) VALUE SPACES. 01 DETAIL-LINE. 05 FILLER PIC X VALUE SPACES. 05 DET-LAST-NAME PIC X(15). 05 FILLER PIC X(2) VALUE SPACES. 05 DET-INITIALS PIC X(2). 05 FILLER PIC X(5) VALUE SPACES. 05 DET-CREDITS PIC 9(2). 05 FILLER PIC X(2) VALUE SPACES. 05 DET-TUITION PIC 9(6). 05 FILLER PIC X(7) VALUE SPACES. 05 DET-UNION-FEE PIC 9(3). 05 FILLER PIC X(8) VALUE SPACES. 05 DET-SCHOLARSHIP PIC 9(5). 05 FILLER PIC X(6) VALUE SPACES. 05 DET-IND-BILL PIC 9(6). 05 FILLER PIC X(49) VALUE SPACES. (b) COBOL Entries