Download presentation
Presentation is loading. Please wait.
Published byLora Janis Ward Modified over 8 years ago
1
Sequential Update Assignment Notes Please use speaker notes for additional information!
2
Sequential Old Master (SEQMST99.DAT) 1 - 8 Identification Number 9 - 10 Title Code 11 - 32 Name (last/first m) 33 - 54 Street Address 55 - 72 City 73 - 74 State 75 - 79 ZIP 80 - 85 Total amount due 86 - 91 Total amount paid 92 - 93 Major 94 Number of Courses 95 - 99 Course 1 100 - 104 Course 2 105 - 109 Course 3 110 - 114 Course 4 115 - 119 Course 5 120 - 124 Course 6 125 - 129 Course 7 SEQMST99.DAT 1111222201Doe/John R 123 Elm Street Braintree MA02184200000050000CI5ACC11CIS11ENG11MTH31HST21 First record on the file.
3
1111222201Doe/John R 123 Elm Street Braintree MA02184200000050000CI5ACC11CIS11ENG11MTH31HST21 1212121202Richards/Mary 15 West Street Braintree MA02184145098025075BU2ENG11CIS10 1234567803Anderson/Susan 345 Main St Hingham MA02143300000150000CI4CIS51CIS61CIS53MTH31 1245678901Brooks/William 43 Elsbree Street Fall River MA02177120000100000CI3CIS61CIS53MTH31 1256789003Ames/Jennifer 57 Avenue F Hingham MA02043000000000000LN4CIS11RUS11ANT11LIN31 1267890001Daniels/Stephen 345 Gales Lan Hingham MA02043000000000000PL3POL31CIS11HST21AMC11 1288990005Grant/Martha 5325 Elm St New Bedford MA02188050000000000CI7CIS07CIS51CIS61CIS53MTH31ENG11ACC51 1555555504Sousa, Linda 352 Durfee St Fall River MA02177045000025000CI1CIS53 1567890001Fox/William 34 East River Rd Fall River MA02177000000000000CI5CIS51CIS61CIS53CIS07ACC51 1712345601Rogers/Matthew 32 Main St Hingham MA02043134598015000BU3ACC11CIS11ENG11 1724689905Turner/Kathleen 34 East St Weymouth MA02188000000000000CI4CIS61ACC11ENG11CIS53 1788888804Brown/Emily 23 Pleasant St Weymouth MA02555500000300000CI5CIS51CIS61ACC11ENG11MTH31 1799999903Stretton/Mary 134 Pleasant St Stoughton MA02111000000000000LB2ENG11MTH07 1888888801Richardson/Al 324 Oak St Fall River MA02177000000000000ET6ETK11CIS11ENG11MTH31PHY01CHM11 2000000006Adams/John 23 Presidents Rd Quincy MA02118025000100000PL1HST21 2121212104Gardner/Susan 43 Peach St Fall River MA02779250000150000CI4CIS11ENG11MTH31ACC11 SEQMST99.DAT
4
121212121 ACC11 4C 12121212 139 Tremont St Weymouth MA02987 1C 123456781 ENG11 4C 123456783MTH31 4C 123456782CIS61CIS56 4C 123458881CIS10 4C 1245678902Bryant/Linda 12 Main St Hingham MA02043050000030000CI2CIS11ACC11 A 12498888 D 12678900122500122500 2C 126789001 CIS11 4C 1288888804West/Ann 45 Pleasant St Fall River MA02770100000050000CI5CIS56CIS22CIS12ENG12ACC12 A 1288889904Jameson/Sandra 345 East St Weymouth MA02111000000000000CI3CIS12CIS22CIS07 A 15678900 D 17123456CI3CIS61CIS53ENG11 3C 171234561 HST20 4C 178888881 HST20 4C 178888881 SCI17 4C 178888881 SPH11 4C 179999992ENG12CIS11 4C 188888883CIS56 4C 20000000 Adams/Jonathan 1C 200000001 SPH11 4C TRANS99.DAT
5
ADD Transaction TRANS99.DAT ADD Transaction Transaction - ADD TRANSACTION LAYOUT 1 - 8 Identification Number 9 - 10 Title Code 11 - 32 Name (last/first m) 33 - 54 Street Address 55 - 72 City 73 - 74 State 75 - 79 ZIP 80 - 85 Total amount due 86 - 91 Total amount paid 92 - 93 Major 94 Number of Courses 95 - 99 Course 1 100 - 104 Course 2 105 - 109 Course 3 110 - 114 Course 4 115 - 119 Course 5 120 - 124 Course 6 125 - 129 Course 7 130 Blank 131 Record Action Code 1288888804West/Ann 45 Pleasant St Fall River MA02770100000050000CI5CIS56CIS22CIS12ENG12ACC12 A Sample add transaction.
6
TRANS99.DAT DELETE Transaction TRANS99.DAT DELETE Transaction Transaction - DELETE TRANSACTION LAYOUT 1 - 8 Identification Number 9 - 130 Blank 131 Record Action Code 15678900 D The sample delete transaction has only an identification number and a record action code in 131 that contains a D.
7
Transaction - CHANGE 1 TRANSACTION LAYOUT 1 - 8 Identification Number 9 - 10 Title Code 11 - 32 Name (last/first m) 33 - 54 Street Address 55 - 72 City 73 - 74 State 75 - 79 ZIP 80 - 129 Blank 130 Transaction Code 131 Record Action Code TRANS99.DAT CHANGE 1 Transaction TRANS99.DAT CHANGE 1 Transaction 12121212 139 Tremont St Weymouth MA02987 1C Sample Change 1 transaction.
8
Transaction - CHANGE 2 TRANSACTION LAYOUT 1 - 8 Identification Number 9 - 14 Total amount due 15 - 20 Total amount paid 21 - 129 Blank 130 Transaction Code 131 Record Action Code TRANS99.DAT CHANGE 2 Transaction TRANS99.DAT CHANGE 2 Transaction 12678900122500122500 2C Type 2 transaction.
9
Transaction - CHANGE 3 TRANSACTION LAYOUT 1 - 8 Identification Number 9 - 10 Major 11 Number of Courses 12 - 16 Course 1 17 - 21 Course 2 22 - 26 Course 3 27 - 31 Course 4 32 - 36 Course 5 37 - 41 Course 6 42 - 46 Course 7 47 - 129 Blank 130 Transaction Code 131 Record Action Code TRANS99.DAT CHANGE 3 Transaction TRANS99.DAT CHANGE 3 Transaction 17123456CI3CIS61CIS53ENG11 3C This is transaction 3 which is used to change the major and the schedule. } OR } 12 - 46 ALL -CRS }
10
TRANS99.DAT CHANGE 4 Transaction TRANS99.DAT CHANGE 4 Transaction Transaction - CHANGE 4 TRANSACTION LAYOUT 1 - 8 Identification Number 9 Course Action Code 10 - 14 Old Course 15 - 19 New Course 20 - 129 Blank 130 Transaction Code 131 Record Action Code 123456781 ENG11 4C 123456783MTH31 4C 123456782CIS61CIS56 4C Change 4 transactions are used when a student adds, drops or changes an individual course.
11
Describing the transactions Alternative #2: FD TRANS-FILE… 01 ADD-TRANS. 05 TID 05 … 05 TRAN-CD… 05 REC-ACT-CD… 01 CHANGE1-TRANS. 05 … 01 CHANGE2-TRANS. 05 … ETC. Alternative #1: FD TRANS-FILE… 01 TRANS-REC. 05 TID PIC X(8). 05 FILLER PIC X(121). 05 TRAN-CD PIC X. 05 REC-ACT-CD PIC X. … WORKING-STORAGE SECTION. 01 ADD-TRANS. 05 … 01 CHANGE1-TRANS. 05 … 01 CHANGE2-TRANS. 05 … ETC.
12
Describing the master work area 1 - 8 Identification Number 9 - 10 Title Code 11 - 32 Name (last/first m) 33 - 54 Street Address 55 - 72 City 73 - 74 State 75 - 79 ZIP 80 - 85 Total amount due 86 - 91 Total amount paid 92 - 93 Major 94 Number of Courses 95 - 99 Course 1 100 - 104 Course 2 105 - 109 Course 3 110 - 114 Course 4 115 - 119 Course 5 120 - 124 Course 6 125 - 129 Course 7 In designing the master work area, be careful to layout the information so it can be used effective.y. The main consideration should be the layout of the seven courses. If you name them individually then you are constantly going to have to refer to them by their individual name. This can be very cumbersome if you develop any logic where you want to loop through the courses to check their contents. You will probably want to be able to access the full 35 characters of the courses with a change 3. With a change 4 you are going to need to check each of the course fields individually so you might consider setting them up as a table.
13
Logic flowchart of loop Loop MID < TID Write routine Read old master YN MID =TID Change Routine Read transaction Y Y Y N N Delete Note Delete Read transaction Add Error Read transaction Read old master YN Add Routine Read transaction Change Error Read transaction Delete Error Read transaction Y N N
14
Change 1 & 2 For change 1 and change 2, you are doing classic changes similar to the routine in the sample program. If there is data in the field, the change should be made. I did not put in any sample records that included a hyphen in the last character of the field calling for the data in the field to be deleted. However, for extra credit, you can include this code even though there is no sample data to use to test it. Example: IF NAME-TRAN NOT = SPACES NEXT SENTENCE ELSE IF LAST-CHAR-NAME-TRAN = “-” MOVE SPACES TO MSTR-NAME-WS ELSE MOVE NAME-TRAN TO MSTR-NAME-WS END-IF
15
Change 3: In change 3, you are checking major, number of courses and the group of courses. If a transaction 3 has been submitted it can change the major, the number of courses or all of the courses (the entire schedule). Think about this when you are defining the course part of this layout. Transaction - CHANGE 3 TRANSACTION LAYOUT 1 - 8 Identification Number 9 - 10 Major 11 Number of Courses 12 - 16 Course 1 17 - 21 Course 2 22 - 26 Course 3 27 - 31 Course 4 32 - 36 Course 5 37 - 41 Course 6 42 - 46 Course 7 47 - 129 Blank 130 Transaction Code 131 Record Action Code } OR } 12 - 46 ALL -CRS }
16
Change 4: Transaction - CHANGE 4 TRANSACTION LAYOUT 1 - 8 Identification Number 9 Course Action Code 10 - 14 Old Course 15 - 19 New Course 20 - 129 Blank 130 Transaction Code 131 Record Action Code Examples: 123456781 ENG11 4C 123456783MTH31 4C 123456782CIS61CIS56 4C Course Action Code 1 means that the course to be added should be in the new course field. Course Action Code 3 means that the course to be delete should be in the old course field. Course Action Code 2 means that the course needs to be changed. The current course that is to be replaced should be in the old course field and the new course that will replace it should be in the new course field.
17
123456781 ENG11 4C Transaction - Change 4: Master work area: 1234567803Anderson/Susan (after) CI5CIS51CIS61CIS53MTH31ENG11 1234567803Anderson/Susan (before) CI4CIS51CIS61CIS53MTH31 Change 4: Course Action Code = 1 Change 4: Course Action Code = 1 ENG11 must be compared with each of the courses in the master work area. If a match is discovered then ENG11 is already there and the course could not be added to the list. If no match is found, the course can be added. In this example ENG11 was added as the fifth course - note that the number of courses was changed to 5. Once the number of courses has been increased (in this case to 5), the number of courses can be used as the subscript to move ENG11 into the the appropriate slot.
18
Master work area: 1234567803Anderson/Susan (after) CI4CIS51CIS56CIS53MTH31 1234567803Anderson/Susan (before) CI4CIS51CIS61CIS53MTH31 Change 4: Course Action Code = 2 Change 4: Course Action Code = 2 123456782CIS61CIS56 4C In this example, the Course Action Code = 2 which means that we want to change the old course to the new course. CIS61 is the old course and CIS56 is the new course. I need to search and find CIS61 - if it is not there, I cannot do the change. Once I have found it, I need to remember the location so I can do the replacement. However, first I have to make sure that the student is not already taking CIS56. Once this has been determined, I can do the replacement. The remembered location of CIS61 is where CIS56 is placed. There is no change to the number of courses.
19
Master work area: 1234567803Anderson/Susan (after) CI3CIS51CIS61CIS53 1234567803Anderson/Susan (before) CI4CIS51CIS61CIS53MTH31 Change 4: Course Action Code = 3 Change 4: Course Action Code = 3 123456783MTH31 4C In this example, the Course Action Code = 3 which means that we want to delete a course. First we have to find MTH31 and then we have to space it out and decrease the number of courses by 3. This becomes a trickier problem if MTH31 is not the last course because you do not want to leave embedded spaces in the course list. I will deal with this on the next slide. MTH31 has been replaced by spaces and the number of courses has been reduced to 3.
20
Examples: 123456781 ENG11 (add a course) 4C 123456783MTH31 (delete a course) 4C 123456782CIS61CIS56 (change a course) 4C Master work area: 1234567803Anderson/Susan (after change) CI4CIS51CIS56CIS53ENG11 1234567803Anderson/Susan (after delete) CI4CIS51CIS61CIS53ENG11 1234567803Anderson/Susan (after add) CI5CIS51CIS61CIS53MTH31ENG11 1234567803Anderson/Susan (before) CI4CIS51CIS61CIS53MTH31 Change 4 All three transactions Change 4 All three transactions First ENG11 was added and the number of courses was increased to 4. Then MTH31 was deleted and the number of courses went back to 4 and finally CIS61 was changed to CIS56 and the number of courses stayed the same. The addition of ENG11 happened first. The next transaction was read which called for MTH31 to be deleted from the same record. I do not want to leave the spaces in the slot so I move ENG11 to where MTH31 was when I do the delete. Finally the next transaction is read and CIS61 is located and replaced by CIS56.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.