0% found this document useful (0 votes)
42 views

Algorithm

The document describes several programs for processing indexed student files. Program 1 allows creating or extending a student file by inputting student data fields. Program 2 is similar but includes handling duplicate student numbers. Program 3 retrieves student records sequentially from a file. Program 4 also retrieves records sequentially but uses dynamic access.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

Algorithm

The document describes several programs for processing indexed student files. Program 1 allows creating or extending a student file by inputting student data fields. Program 2 is similar but includes handling duplicate student numbers. Program 3 retrieves student records sequentially from a file. Program 4 also retrieves records sequentially but uses dynamic access.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 33

PROGRAM NO.

1: INDEXED FILE PROCESSING

CREATION / EXTENSION OF FILE

1. Display [C] Create / [E] Extend a file.


2. Accept RESP.
3. If RESP = “C”
3a. Open the OUTPUT STUDFILE.
4. If RESP = “E”
4a. Open the I-O STUDFILE.
5. Perform the routine DATA-ENTRY.
6. Close STUDFILE.
7. End.

DATA-ENTRY.
1. Move zero to SW.
2. Display “< (***** STUDENT INFORMATION *****)>”.
3. Display “Student Number: ” .
4. Accept W-STUDNUM.
5. Display “Student Name: ” .
6. Accept W-STUDNAME.
7. Display “Course & Year: ”.
8. Accept W-STUDCRSYR.
9. Display “Standing : “.
10. Accept W-STUDSTAND.
11. Move the data from W-STUD-REC to STUD-REC.
12. Move the data from W-STUD-REC to STUD-REC and use it as an output
invalid key move 1 to SW.
13. If SW = 0
13a. Display “MORE RECORDS (Y/N ): ? ”.
14. Accept RESP.
15. If RESP = “Y” or “y”
15a. Perform again the DATA-ENTRY routine.
16. If RESP = “N” or “n”
16a. End.
17. If SW is NOT EQUAL to 0
17a. Display “Student Number Existing !!!”.
17b. Display “ “.
17c. Display “REPEAT THE PROCESS...”.
18. Return the value to DATA-ENTRY.
PROGRAM NO. 2: INDEXED FILE PROCESSING

CREATION / EXTENSION OF FILE

WITH ALTERNATIVE RECORD KEY

1. Display [C] Create / [E] Extend a file.


2. Accept RESP.
3. If RESP = “C”
3a. Open the OUTPUT STUDFILE.
4. If RESP = “E”
4a. Open the I-O STUDFILE.
5. Perform the routine DATA-ENTRY.
6. Close STUDFILE.
7. End.

DATA-ENTRY .
1. Move zero to SW.
2. Display “<(***** STUDENT INFORMATION *****)>” .
3. Display “Student Number: ”.
4. Accept W-STUDNUM.
5. Display “Student Name: ” .
6. Accept W-STUDNAME.
7. Display “ Course & Year : ”.
8. Accept W-STUDCRSYR.
9. Display “Standing : “.
10. Accept W-STUDSTAND.
11. Move the data from W-STUD-REC to STUD-REC.
12. Move the data from W-STUD-REC to STUD-REC and use it as an output
invalid key move 1 to SW.
13. If SW = 0
13a. Display “ MORE RECORDS (Y/N) ? : ”.
14. Accept RESP.
15. If RESP = “Y” or “y”
15a. Perform again the DATA-ENTRY routine.
16. If RESP = “N” or “n”
16a. End.
17. If SW is NOT EQUAL to 0
17a. Display “Student Number Existing !!!”.
17b. Display “ “.
17c. Display “REPEAT THE PROCESS...”.
18. Return the value to DATA-ENTRY .
PROGRAM NO. 2: INDEXED FILE PROCESSING

CREATION / EXTENSION OF FILE

WITH ALTERNATIVE RECORD KEY

1. Display [C] Create / [E] Extend a file.


8. Accept RESP.
9. If RESP = “C”
3a. Open the OUTPUT STUDFILE.
10. If RESP = “E”
4a. Open the I-O STUDFILE.
11. Perform the routine DATA-ENTRY.
12. Close STUDFILE.
13. End.

DATA-ENTRY .
19. Move zero to SW.
20. Display “<(***** STUDENT INFORMATION *****)>” .
21. Display “Student Number: ”.
22. Accept W-STUDNUM.
23. Display “Student Name: ” .
24. Accept W-STUDNAME.
25. Display “ Course & Year : ”.
26. Accept W-STUDCRSYR.
27. Display “Standing : “.
28. Accept W-STUDSTAND.
29. Move the data from W-STUD-REC to STUD-REC.
30. Move the data from W-STUD-REC to STUD-REC and use it as an output
invalid key move 1 to SW.
31. If SW = 0
13a. Display “ MORE RECORDS (Y/N) ? : ”.
32. Accept RESP.
33. If RESP = “Y” or “y”
15a. Perform again the DATA-ENTRY routine.
34. If RESP = “N” or “n”
16a. End.
35. If SW is NOT EQUAL to 0
17a. Display “Student Number Existing !!!”.
17b. Display “ “.
17c. Display “REPEAT THE PROCESS...”.
36. Return the value to DATA-ENTRY .
PROGRAM NO. 3: INDEXED FILE PROCESSING

SEQUENTIAL RETRIEVAL OF INDEXED FILE

USING SEQUENTIAL ACCESS MODE

1. Open INPUT STUDFILE.


(*INPUT STUDFILE – revised data)

2. Move “N” to NO-MORE-RECORD.

3. Move the stored data from STUDFILE to W-STUD-REC until the value of NO-MORE-RECORD is

“Y”.

4. Perform the routine DATA-DISP-RTN.

5. Close STUDFILE.

6. End.

DATA-DISP-RTN.

1. Display “<<****** STUDENT INFORMATION *****>>”.


2. Display “ Student Number : “ W-STUDNUM.
3. Display “ Student Name : ” W-STUDNAME.
4. Display “ Course & Year : ” W-STUDCRSYR.
5. Display “Academic Standing : ” W-STUDSTAND.
6. Display “ “.
7. Display “PRESS <ENTER > TO CONTINUE ...”.
8. Accept RESP.
9. If RESP = <ENTER>
9a. Copy the data from STUDFILE to W-STUD-REC.
10. Move “Y” to NO-MORE-RECORD.
11. Return the value of DATA-DISP-RTN.
PROGRAM NO. 4: INDEXED FILE PROCESSING

SEQUENTIAL RETRIEVAL OF INDEXED FILE

USING DYNAMIC ACCESS MODE

1. Open INPUT STUDFILE.

(*INPUT STUDFILE – revised data )

2. Move “N” to NO-MORE-RECORD.

3. Move the stored data on the next record of STUDFILE into W-STUD-REC until the
value of NO-MORE-RECORD is “Y”.

4. Perform the routine DATA-DISP-RTN.

5. Close STUDFILE.

6. End.

DATA-DISP-RTN.

1. Display “<<***** STUDENT INFORMATION *****>>”.


2. Display “Student Number : “ W-STUDNUM.
3. Display “Student Name : ” W-STUDNAME.
4. Display “ Course & Year : ” W-STUDCRSYR.
5. Display “Academic Standing : ” W-STUDSTAND.
6. Display “ “.
7. Display “PRESS <ENTER > TO CONTINUE ...”.
8. Accept RESP.
9. If RESP = <ENTER>
9a. Copy the stored data on the next record of STUDFILE into W-STUD-REC until
the value of NO-MORE-RECORD is “Y”.
10. Return the value of DATA-DISP-RTN.
PROGRAM NO. 5: INDEXED FILE PROCESSING
RETRIEVAL OF INDIVIDUAL RECORD
USING SEQUENTIAL ACCESS MODE

1. Open INPUT STUDFILE.


2. Move “Y” to STUDFILE.
3. Perform the routine VIEW-DATA-RTN.
4. Close STUDFILE.
5. End.

VIEW-DATA-RTN.
1. Move zero to SW.
2. Display “[***** RETRIEVAL OF RECORD *****]”.
3. Display “ “.
4. Display “Student Number : ”.
5. Accept W-STUDNUM.
6. Move the data from W-STUDNUM to STUD-NUM.
7. Start STUDFILE INVALID KEY
7a. Display “RECORD NOT FOUND !!!”.
8. Move 1 to SW.
9. If SW = 0
9a. Transfer the data from STUDFILE into W-STUD-REC.
9b. Display “<<===== STUDENT INFORMATION =====>>”.
9c. Display “Student Number : “ W-STUDNUM.
9d. Display “Student Name : ” W-STUDNAME.
9e. Display “Course & Year: ” W-STUDCRSYR.
9f. Display “Academic Standing: ” W-STUDSTAND.
9g. Display “ “.
9h. Display “VIEW ANOTHER RECORD (Y/N) ? :”.
10. Accept RESP.
11. If RESP = “Y” or “y”
11a. Perform the VIEW-DATA-RTN routine.
12. If RESP = “Y” or “y”
12a. End.
13. Return the value of VIEW-DATA-RTN.
PROGRAM NO. 6: INDEXED FILE PROCESSING
RETRIEVAL OF INDIVIDUAL RECORD
USING RANDOM ACCESS MODE

1. Open INPUT STUDFILE


2. Move “Y” to RESP.
3. Perform the routine VIEW-DATA-RTN.
4. Close STUDFILE.
5. End.

VIEW-DATA-RTN.
1. Move zero to SW.
2. Display “[***** RETRIEVAL OF RECORD *****]”.
3. Display “ “.
4. Display “Student Number :”.
5. Accept W-STUDNUM.
6. Move the data from W-STUDNUM to STUDNUM.
7. Move the data from STUDFILE to W-STUD-REC INVALID KEY
7a. Display “RECORD NOT FOUND !!!”.
8. If SW = 0
8a. Transfer the data from STUDFILE into W-STUD-REC.
8b. Display “<<===== STUDENT INFORMATION =====>>”.
8c. Display “Student Number : “ W-STUDNUM.
8d. Display “Student Name : ” W-STUDNAME.
8e. Display “Course & Year: ” W-STUDCRSYR.
8f. Display “Academic Standing: ” W-STUDSTAND.
8g. Display “ “.
8h. Display “VIEW ANOTHER RECORD (Y/N) ? :”.
9. Accept RESP.
10. If RESP = “Y” or “y”
10a. Perform the VIEW-DATA-RTN routine.
11. If RESP = “Y” or “y”
11a. End.
12. Return the value of VIEW-DATA-RTN.
PROGRAM NO. 7: INDEXED FILE PROCESSING
RETRIEVAL OF INDIVIDUAL RECORD
USING DYNAMIC ACCESS MODE

1. Open INPUT STUDFILE.


2. Move “Y” to RESP.
3. Display “PRESS [S] FOR SEQUENTIAL MODE VIEWING “.
4. Display “PRESS [R] FOR RANDOM MODE VIEWING “.
5. Accept ANS.
6. If ANS = “S” or “s”
6a. Perform SEQ-DATA-RTN routine.
7. If ANS = “R“ or “r”
7a. Perform RDM-DATA-RTN routine.
8. Close STUDFILE.
9. End.

SEQ-DATA-RTN.
1. Move 0 to SW.
2. Display “[***** RETRIEVAL OF RECORD *****]”.
3. Display “ “.
4. Display “Student Number :”.
5. Accept W-STUDNUM.
6. Move the data from W-STUDNUM to STUDNUM.
7. Move the data from STUDFILE to W-STUD-REC INVALID KEY
7a. Display “RECORD NOT FOUND !!!”.
8. If SW = 0
8a. Transfer the data from STUDFILE into W-STUD-REC.
9. Perform DISP-RTN routine.
10. Return the value of SEQ-DATA-RTN.

RDM-DATA-RTN.

1. Move 0 to SW.
2. Display “[***** RETRIEVAL OF RECORD *****]”.
3. Display “ “.
4. Display “Student Number :”.
5. Accept W-STUDNUM.
6. Move the data from W-STUDNUM to STUDNUM.
7. Read the data from STUFILE into W-STUD-REC INVALID KEY.
7a. Display “RECORD NOT FOUND !!!”.
8. If SW = 0
8a. Perform the routine DISP-RTN.
9. Return the value of RDM-DATA-RTN.

DISP-RTN.

1. Display “<<===== STUDENT INFORMATION =====>>”.


2. Display “Student Number : “ W-STUDNUM.
3. Display “Student Name : ” W-STUDNAME.
4. Display “Course & Year: ” W-STUDCRSYR.
5. Display “Academic Standing: ” W-STUDSTAND.
6. Display “ “.
7. Display “VIEW ANOTHER RECORD (Y/N) ? :”.
8. Accept RESP.
9. If RESP = “Y” or “y”
9a. Perform again the DISP-RTN routine.
10. If RESP = “N” or “n”
10a. End.
11. Return the value of DISP-RTN.
PROGRAM NO. 8: INDEXED FILE PROCESSING
RETRIEVAL OF INDIVIDUAL RECORD
DYNAMIC WITH ALTERNATIVE KEY

1. Open INPUT STUDFILE.


2. Move “Y to RESP.
3. Perform the RDM-DATA-RTN routine.
4. Close STUDFILE.
5. End.

RDM-DATA-RTN.
1. Move 0 to SW.
2. Display “[***** RETRIEVAL OF RECORD *****]”.
3. Display “ “.
4. Display “Student Name :”.
5. Accept W-STUDNAME .
6. Move the data from W-STUDNAME to STUDNAME.
7. Read the data stored into STUDFILE to W-STUD-REC using STUDNAME key.
8. If key is INVALID, display “RECORD NOT FOUND !!!”.
8a. Move 1 to SW.
9. If SW = 0
9a. Move “ Y” to NO-MORE-record.
10. Perform the DISP-RTN routine.
11. Return the value of RDM-DATA-RTN.

DISP-RTN.

1. Display “<<===== STUDENT INFORMATION =====>>”.


2. Display “Student Number : “ W-STUDNUM.
3. Display “Student Name : ” W-STUDNAME.
4. Display “Course & Year: ” W-STUDCRSYR.
5. Display “Academic Standing: ” W-STUDSTAND.
6. Display “ “.
7. Display “VIEW ANOTHER RECORD (Y/N) ? :”.
8. Accept RESP.
9. If RESP = “Y” or “y”
9a. Perform again the DISP-RTN routine.
10. If RESP = “N” or “n”
10a. End.
11. Return the value of DISP-RTN.
PROGRAM NO. 9: INDEXED FILE PROCESSING
UPDATING OF INDIVIDUAL RECORD
USING SEQUENTIAL ACCESS MODE

1. Open I-O STUDFILE.


2. Move “Y” to RESP1.
3. Perform EDIT-RTN routine.
4. Close STUDFILE.
5. End.

EDIT-RTN.

1. Move “N” to RESP2.


2. Perform EDIT-RTN routine.
3. Perform REWRITE-DATA-RTN routine.
4. Return the value of EDIT-RTN.

EDIT-RECORD.

1. Move 0 to SW.
2. Display “[***** EDITING OF RECORD *****]”.
3. Display “ “.
4. Display “Student Number :”.
5. Accept W-STUDNUM.
6. Move the data from W-STUDNUM to STUDNUM.
7. Start STUDFILE INVALID KEY.
7a. Display “RECORD NOT FOUND !!”.
7b. Display “ “.
7c. Display “TRY AGAIN ...”
7d. Move 1 to SW.
8. If SW = 0
8a. Read the data from STUDFILE into W-STUD-REC.
8b. Display “<<===== STUDENT INFORMATION =====>>”.
8c. Display “Student Name : ” W-STUDNAME.
8d. Display “Course & Year: ” W-STUDCRSYR.
8e. Display “Academic Standing: ” W-STUDSTAND.
8f. Display “ “.
8g. Display “[** UPDATE VALUES **]”.
8h. Display “Student Name: ” .
8i. Accept W-STUDNAME.
8j. Display “ Course & Year : ”.
8k. Accept W-STUDCRSYR.
8l. Display “Standing : “.
8m. Accept W-STUDSTAND.
8n. Display “ARE ALL THE ENTRIES CORRECT (Y/N) ? : “.
9. Accept RESP2.
10. If RESP2 = “Y” or “y”
10a. Perform again the EDIT-RECORD routine.
11. If RESP2 = “N” or “n”
11a.End.
12. Return the value of EDIT-RECORD.

REWRITE-DATA-RTN.

1. Rewrite the data from W-STUD-REC to STUD-REC.


2. Display “EDIT ANOTHER RECORD (Y/N) ?: “.
3. Accept RESP1.
4. If RESP1 = “Y” or “y”
4a. Perform again the REWRITE-DATA-RTN routine.
5. If RESP2 = “N” or “n”
5a.End.
6. Return the value of REWRITE-DATA-RTN.
PROGRAM NO. 10: INDEXED FILE PROCESSING

UPDATING OF INDIVIDUAL RECORD

USING RANDOM ACCESS MODE

1. Open I-O STUDFILE.


2. Move “Y” to RESP1.
3. Perform EDIT-RTN routine.
4. Close STUDFILE.
5. End.

EDIT-RTN.

1. Move “N” to RESP2.


2. Perform EDIT-RECORD routine.
3. Perform REWRITE-DATA-RTN routine.
4. Return the value of EDIT-RTN.

EDIT-RECORD.

1. Move 0 to SW.
2. Display “[***** EDITING OF RECORD *****]”.
3. Display “ “.
4. Display “Student Number :”.
5. Accept W-STUDNUM.
6. Move the data from W-STUDNUM to STUDNUM.
7. Read STUDFILE into W-STUD-REC INVALID KEY.
7a. Display “RECORD NOT FOUND !!”.
7b. Display “ “.
7c. Display “TRY AGAIN ...”
7d. Move 1 to SW.
8. If SW = 0
8a. Read tha data from STUDFILE into W-STUD-REC.
8b. Display “<<===== STUDENT INFORMATION =====>>”.
8c. Display “Student Name : ” W-STUDNAME.
8d. Display “Course & Year: ” W-STUDCRSYR.
8e. Display “Academic Standing: ” W-STUDSTAND.
8f. Display “ “.
8g. Display “[** UPDATE VALUES **]”.
8h. Display “Student Name: ” .
8i. Accept W-STUDNAME.
8j. Display “ Course & Year : ”.
8k. Accept W-STUDCRSYR.
8l. Display “Standing : “.
8m. Accept W-STUDSTAND.
8n. Display “ARE ALL THE ENTRIES CORRECT (Y/N) ? : “.
9. Accept RESP2.
10. If RESP2 = “Y” or “y”
10a. Perform again the EDIT-RECORD routine.
11. If RESP2 = “N” or “n”
11a.End.
12. Return the value of EDIT-RECORD.

REWRITE-DATA-RTN.

1. Rewrite the data from W-STUD-REC to STUD-REC.


2. Display “EDIT ANOTHER RECORD (Y/N) ?: “.
3. Accept RESP1.
4. If RESP1 = “Y” or “y”
4a. Perform again the REWRITE-DATA-RTN routine.
5. If RESP2 = “N” or “n”

5a.End.

6. Return the value of REWRITE-DATA-RTN.


PROGRAM NO. 11: INDEXED FILE PROCESSING
DELETION OF INDIVIDUAL RECORD
USING SEQUENTIAL ACCESS MODE

1. Open I-O STUDFILE.


2. Move “Y” to RESP.
3. Perform DELETE-DATA-RTN routine.
4. Close STUDFILE.
5. End.

DELETE-DATA-RTN.

1. Move 0 to SW.
2. Display “[***** DELETION OF RECORD *****]”.
3. Display “ “.
4. Display “Student Number :”.
5. Accept W-STUDNUM.
6. Move the data from W-STUDNUM to STUDNUM.
7. Start STUDFILE INVALID KEY.
7a. Display “RECORD NOT FOUND !!!”.
7b. Move 1 to SW.
8. If SW = 0
8a. Read the data from STUDFILE to W-STUD-REC.
8b.Display “<<===== STUDENT INFORMATION =====>>”.
8c. Display “Student Number : “ W-STUDNUM.
8d. Display “Student Name : ” W-STUDNAME.
8e. Display “Course & Year: ” W-STUDCRSYR.
8f. Display “Academic Standing: ” W-STUDSTAND.
8f. Display “ “.
8g. Display “DELETE ANOTHER RECORD (Y/N) ? :”.
9. Accept RESP.
10. If RESP = “Y” or “y”
10a. Perform again DELETE-DATA-RTN routine.
11. If RESP = “N” or “n”
11a. End.
12. Return the value of DELETE-DATA-RTN.
PROGRAM NO. 12: INDEXED FILE PROCESSING
DELETION OF INDIVIDUAL RECORD
USING RANDOM ACCESS MODE

1. Open I-O STUDFILE.


2. Move “Y” to RESP.
3. Perform DELETE-DATA-RTN routine.
4. Close STUDFILE.
5. End.

DELETE-DATA-RTN.

1. Move 0 to SW.
2. Display “[***** DELETION OF RECORD *****]”.
3. Display “ “.
4. Display “Student Number :”.
5. Accept W-STUDNUM.
6. Move the data from W-STUDNUM to STUDNUM
7. Read the data from the STUDFILE into W-STUD-REC INVALID KEY.
7a. Display “RECORD NOT FOUND !!!”.
7b. Move 1 to SW.
8. If SW = 0
8a. Read the data from STUDFILE to W-STUD-REC.
8b.Display “<<===== STUDENT INFORMATION =====>>”.
8c. Display “Student Number : “ W-STUDNUM.
8d. Display “Student Name : ” W-STUDNAME.
8e. Display “Course & Year: ” W-STUDCRSYR.
8f. Display “Academic Standing: ” W-STUDSTAND.
8f. Display “ “.
8g. Display “DELETE ANOTHER RECORD (Y/N) ? :”.
9. Accept RESP.
10. If RESP = “Y” or “y”
10a. Perform again DELETE-DATA-RTN routine.
11. If RESP = “N” or “n”
11a.. End.
12. Return the value of DELETE-DATA-RTN.
PROGRAM NO. 3: INDEXED FILE PROCESSING

SEQUENTIAL RETRIEVAL OF INDEXED FILE

USING SEQUENTIAL ACCESS MODE

2. Open INPUT STUDFILE.


(*INPUT STUDFILE – revised data)

2. Move “N” to NO-MORE-RECORD.

3. Move the stored data from STUDFILE to W-STUD-REC until the value of NO-MORE-RECORD is

“Y”.

4. Perform the routine DATA-DISP-RTN.

5. Close STUDFILE.

6. End.

DATA-DISP-RTN.

12. Display “<<****** STUDENT INFORMATION *****>>”.


13. Display “ Student Number : “ W-STUDNUM.
14. Display “ Student Name : ” W-STUDNAME.
15. Display “ Course & Year : ” W-STUDCRSYR.
16. Display “Academic Standing : ” W-STUDSTAND.
17. Display “ “.
18. Display “PRESS <ENTER > TO CONTINUE ...”.
19. Accept RESP.
20. If RESP = <ENTER>
9a. Copy the data from STUDFILE to W-STUD-REC.
21. Move “Y” to NO-MORE-RECORD.
22. Return the value of DATA-DISP-RTN.

PROGRAM NO. 4: INDEXED FILE PROCESSING

SEQUENTIAL RETRIEVAL OF INDEXED FILE

USING DYNAMIC ACCESS MODE

2. Open INPUT STUDFILE.

(*INPUT STUDFILE – revised data )

2. Move “N” to NO-MORE-RECORD.

3. Move the stored data on the next record of STUDFILE into W-STUD-REC until the
value of NO-MORE-RECORD is “Y”.

4. Perform the routine DATA-DISP-RTN.

5. Close STUDFILE.

6. End.

DATA-DISP-RTN.

11. Display “<<***** STUDENT INFORMATION *****>>”.


12. Display “ Student Number : “ W-STUDNUM.
13. Display “ Student Name : ” W-STUDNAME.
14. Display “ Course & Year : ” W-STUDCRSYR.
15. Display “Academic Standing : ” W-STUDSTAND.
16. Display “ “.
17. Display “PRESS <ENTER > TO CONTINUE ...”.
18. Accept RESP.
19. If RESP = <ENTER>
9a. Copy the stored data on the next record of STUDFILE into W-STUD-REC until
the value of NO-MORE-RECORD is “Y”.
20. Return the value of DATA-DISP-RTN.

PROGRAM NO. 5: INDEXED FILE PROCESSING


RETRIEVAL OF INDIVIDUAL RECORD
USING SEQUENTIAL ACCESS MODE

6. Open INPUT STUDFILE.


7. Move “Y” to STUDFILE.
8. Perform the routine VIEW-DATA-RTN.
9. Close STUDFILE.
10. End.

VIEW-DATA-RTN.
14. Move zero to SW.
15. Display “[***** RETRIEVAL OF RECORD *****]”.
16. Display “ “.
17. Display “Student Number : ”.
18. Accept W-STUDNUM.
19. Move the data from W-STUDNUM to STUD-NUM.
20. Start STUDFILE INVALID KEY
7a. Display “RECORD NOT FOUND !!!”.
21. Move 1 to SW.
22. If SW = 0
9a. Transfer the data from STUDFILE into W-STUD-REC.
9b. Display “<<===== STUDENT INFORMATION =====>>”.
9c. Display “Student Number : “ W-STUDNUM.
9d. Display “Student Name : ” W-STUDNAME.
9e. Display “Course & Year: ” W-STUDCRSYR.
9f. Display “Academic Standing: ” W-STUDSTAND.
9g. Display “ “.
9h. Display “VIEW ANOTHER RECORD (Y/N) ? :”.
23. Accept RESP.
24. If RESP = “Y” or “y”
11a. Perform the VIEW-DATA-RTN routine.
25. If RESP = “Y” or “y”
12a. End.
26. Return the value of VIEW-DATA-RTN.

PROGRAM NO. 6: INDEXED FILE PROCESSING


RETRIEVAL OF INDIVIDUAL RECORD
USING RANDOM ACCESS MODE

6. Open INPUT STUDFILE


7. Move “Y” to RESP.
8. Perform the routine VIEW-DATA-RTN.
9. Close STUDFILE.
10. End.

VIEW-DATA-RTN.
13. Move zero to SW.
14. Display “[***** RETRIEVAL OF RECORD *****]”.
15. Display “ “.
16. Display “Student Number :”.
17. Accept W-STUDNUM.
18. Move the data from W-STUDNUM to STUDNUM.
19. Move the data from STUDFILE to W-STUD-REC INVALID KEY
7a. Display “RECORD NOT FOUND !!!”.
20. If SW = 0
8a. Transfer the data from STUDFILE into W-STUD-REC.
8b. Display “<<===== STUDENT INFORMATION =====>>”.
8c. Display “Student Number : “ W-STUDNUM.
8d. Display “Student Name : ” W-STUDNAME.
8e. Display “Course & Year: ” W-STUDCRSYR.
8f. Display “Academic Standing: ” W-STUDSTAND.
8g. Display “ “.
8h. Display “VIEW ANOTHER RECORD (Y/N) ? :”.
21. Accept RESP.
22. If RESP = “Y” or “y”
10a. Perform the VIEW-DATA-RTN routine.
23. If RESP = “Y” or “y”
11a. End.
24. Return the value of VIEW-DATA-RTN.

PROGRAM NO. 7: INDEXED FILE PROCESSING


RETRIEVAL OF INDIVIDUAL RECORD
USING DYNAMIC ACCESS MODE

10. Open INPUT STUDFILE.


11. Move “Y” to RESP.
12. Display “PRESS [S] FOR SEQUENTIAL MODE VIEWING “.
13. Display “PRESS [R] FOR RANDOM MODE VIEWING “.
14. Accept ANS.
15. If ANS = “S” or “s”
6a. Perform SEQ-DATA-RTN routine.
16. If ANS = “R“ or “r”
7a. Perform RDM-DATA-RTN routine.
17. Close STUDFILE.
18. End.

SEQ-DATA-RTN.
11. Move 0 to SW.
12. Display “[***** RETRIEVAL OF RECORD *****]”.
13. Display “ “.
14. Display “Student Number :”.
15. Accept W-STUDNUM.
16. Move the data from W-STUDNUM to STUDNUM.
17. Move the data from STUDFILE to W-STUD-REC INVALID KEY
7a. Display “RECORD NOT FOUND !!!”.
18. If SW = 0
8a. Transfer the data from STUDFILE into W-STUD-REC.
19. Perform DISP-RTN routine.
20. Return the value of SEQ-DATA-RTN.

RDM-DATA-RTN.

10. Move 0 to SW.


11. Display “[***** RETRIEVAL OF RECORD *****]”.
12. Display “ “.
13. Display “Student Number :”.
14. Accept W-STUDNUM.
15. Move the data from W-STUDNUM to STUDNUM.
16. Read the data from STUFILE into W-STUD-REC INVALID KEY.
7a. Display “RECORD NOT FOUND !!!”.
17. If SW = 0
8a. Perform the routine DISP-RTN.
18. Return the value of RDM-DATA-RTN.

DISP-RTN.

12. Display “<<===== STUDENT INFORMATION =====>>”.


13. Display “Student Number : “ W-STUDNUM.
14. Display “Student Name : ” W-STUDNAME.
15. Display “Course & Year: ” W-STUDCRSYR.
16. Display “Academic Standing: ” W-STUDSTAND.
17. Display “ “.
18. Display “VIEW ANOTHER RECORD (Y/N) ? :”.
19. Accept RESP.
20. If RESP = “Y” or “y”
9a. Perform again the DISP-RTN routine.
21. If RESP = “N” or “n”
10a. End.
22. Return the value of DISP-RTN.
PROGRAM NO. 8: INDEXED FILE PROCESSING
RETRIEVAL OF INDIVIDUAL RECORD
DYNAMIC WITH ALTERNATIVE KEY

6. Open INPUT STUDFILE.


7. Move “Y to RESP.
8. Perform the RDM-DATA-RTN routine.
9. Close STUDFILE.
10. End.

RDM-DATA-RTN.
12. Move 0 to SW.
13. Display “[***** RETRIEVAL OF RECORD *****]”.
14. Display “ “.
15. Display “Student Name :”.
16. Accept W-STUDNAME .
17. Move the data from W-STUDNAME to STUDNAME.
18. Read the data stored into STUDFILE to W-STUD-REC using STUDNAME key.
19. If key is INVALID, display “RECORD NOT FOUND !!!”.
8a. Move 1 to SW.
20. If SW = 0
9a. Move “ Y” to NO-MORE-record.
21. Perform the DISP-RTN routine.
22. Return the value of RDM-DATA-RTN.

DISP-RTN.

12. Display “<<===== STUDENT INFORMATION =====>>”.


13. Display “Student Number : “ W-STUDNUM.
14. Display “Student Name : ” W-STUDNAME.
15. Display “Course & Year: ” W-STUDCRSYR.
16. Display “Academic Standing: ” W-STUDSTAND.
17. Display “ “.
18. Display “VIEW ANOTHER RECORD (Y/N) ? :”.
19. Accept RESP.
20. If RESP = “Y” or “y”
9a. Perform again the DISP-RTN routine.
21. If RESP = “N” or “n”
10a. End.
22. Return the value of DISP-RTN.

PROGRAM NO. 9: INDEXED FILE PROCESSING


UPDATING OF INDIVIDUAL RECORD
USING SEQUENTIAL ACCESS MODE

6. Open I-O STUDFILE.


7. Move “Y” to RESP1.
8. Perform EDIT-RTN routine.
9. Close STUDFILE.
10. End.

EDIT-RTN.

5. Move “N” to RESP2.


6. Perform EDIT-RTN routine.
7. Perform REWRITE-DATA-RTN routine.
8. Return the value of EDIT-RTN.

EDIT-RECORD.

13. Move 0 to SW.


14. Display “[***** EDITING OF RECORD *****]”.
15. Display “ “.
16. Display “Student Number :”.
17. Accept W-STUDNUM.
18. Move the data from W-STUDNUM to STUDNUM.
19. Start STUDFILE INVALID KEY.
7a. Display “RECORD NOT FOUND !!”.
7b. Display “ “.
7c. Display “TRY AGAIN ...”
7d. Move 1 to SW.
20. If SW = 0
8a. Read the data from STUDFILE into W-STUD-REC.
8b. Display “<<===== STUDENT INFORMATION =====>>”.
8c. Display “Student Name : ” W-STUDNAME.
8d. Display “Course & Year: ” W-STUDCRSYR.
8e. Display “Academic Standing: ” W-STUDSTAND.
8f. Display “ “.
8g. Display “[** UPDATE VALUES **]”.
8h. Display “Student Name: ” .
8i. Accept W-STUDNAME.

8j. Display “ Course & Year : ”.


8k. Accept W-STUDCRSYR.
8l. Display “Standing : “.
8m. Accept W-STUDSTAND.
8n. Display “ARE ALL THE ENTRIES CORRECT (Y/N) ? : “.
21. Accept RESP2.
22. If RESP2 = “Y” or “y”
10a. Perform again the EDIT-RECORD routine.
23. If RESP2 = “N” or “n”
11a.End.
24. Return the value of EDIT-RECORD.

REWRITE-DATA-RTN.

7. Rewrite the data from W-STUD-REC to STUD-REC.


8. Display “EDIT ANOTHER RECORD (Y/N) ?: “.
9. Accept RESP1.
10. If RESP1 = “Y” or “y”
4a. Perform again the REWRITE-DATA-RTN routine.
11. If RESP2 = “N” or “n”
5a.End.
12. Return the value of REWRITE-DATA-RTN.
PROGRAM NO. 10: INDEXED FILE PROCESSING

UPDATING OF INDIVIDUAL RECORD

USING RANDOM ACCESS MODE

6. Open I-O STUDFILE.


7. Move “Y” to RESP1.
8. Perform EDIT-RTN routine.
9. Close STUDFILE.
10. End.

EDIT-RTN.

5. Move “N” to RESP2.


6. Perform EDIT-RECORD routine.
7. Perform REWRITE-DATA-RTN routine.
8. Return the value of EDIT-RTN.

EDIT-RECORD.

13. Move 0 to SW.


14. Display “[***** EDITING OF RECORD *****]”.
15. Display “ “.
16. Display “Student Number :”.
17. Accept W-STUDNUM.
18. Move the data from W-STUDNUM to STUDNUM.
19. Read STUDFILE into W-STUD-REC INVALID KEY.
7a. Display “RECORD NOT FOUND !!”.
7b. Display “ “.
7c. Display “TRY AGAIN ...”
7d. Move 1 to SW.
20. If SW = 0
8a. Read tha data from STUDFILE into W-STUD-REC.
8b. Display “<<===== STUDENT INFORMATION =====>>”.
8c. Display “Student Name : ” W-STUDNAME.
8d. Display “Course & Year: ” W-STUDCRSYR.
8e. Display “Academic Standing: ” W-STUDSTAND.
8f. Display “ “.
8g. Display “[** UPDATE VALUES **]”.
8h. Display “Student Name: ” .
8i. Accept W-STUDNAME.

8j. Display “ Course & Year : ”.


8k. Accept W-STUDCRSYR.
8l. Display “Standing : “.
8m. Accept W-STUDSTAND.
8n. Display “ARE ALL THE ENTRIES CORRECT (Y/N) ? : “.
21. Accept RESP2.
22. If RESP2 = “Y” or “y”
10a. Perform again the EDIT-RECORD routine.
23. If RESP2 = “N” or “n”
11a.End.
24. Return the value of EDIT-RECORD.

REWRITE-DATA-RTN.

7. Rewrite the data from W-STUD-REC to STUD-REC.


8. Display “EDIT ANOTHER RECORD (Y/N) ?: “.
9. Accept RESP1.
10. If RESP1 = “Y” or “y”
4a. Perform again the REWRITE-DATA-RTN routine.
11. If RESP2 = “N” or “n”

5a.End.

12. Return the value of REWRITE-DATA-RTN.


PROGRAM NO. 11: INDEXED FILE PROCESSING
DELETION OF INDIVIDUAL RECORD
USING SEQUENTIAL ACCESS MODE

6. Open I-O STUDFILE.


7. Move “Y” to RESP.
8. Perform DELETE-DATA-RTN routine.
9. Close STUDFILE.
10. End.

DELETE-DATA-RTN.

13. Move 0 to SW.


14. Display “[***** DELETION OF RECORD *****]”.
15. Display “ “.
16. Display “Student Number :”.
17. Accept W-STUDNUM.
18. Move the data from W-STUDNUM to STUDNUM.
19. Start STUDFILE INVALID KEY.
7a. Display “RECORD NOT FOUND !!!”.
7b. Move 1 to SW.
20. If SW = 0
8a. Read the data from STUDFILE to W-STUD-REC.
8b.Display “<<===== STUDENT INFORMATION =====>>”.
8c. Display “Student Number : “ W-STUDNUM.
8d. Display “Student Name : ” W-STUDNAME.
8e. Display “Course & Year: ” W-STUDCRSYR.
8f. Display “Academic Standing: ” W-STUDSTAND.
8f. Display “ “.
8g. Display “DELETE ANOTHER RECORD (Y/N) ? :”.
21. Accept RESP.
22. If RESP = “Y” or “y”
10a. Perform again DELETE-DATA-RTN routine.
23. If RESP = “N” or “n”
11a. End.
24. Return the value of DELETE-DATA-RTN.

PROGRAM NO. 12: INDEXED FILE PROCESSING


DELETION OF INDIVIDUAL RECORD
USING RANDOM ACCESS MODE

6. Open I-O STUDFILE.


7. Move “Y” to RESP.
8. Perform DELETE-DATA-RTN routine.
9. Close STUDFILE.
10. End.

DELETE-DATA-RTN.

13. Move 0 to SW.


14. Display “[***** DELETION OF RECORD *****]”.
15. Display “ “.
16. Display “Student Number :”.
17. Accept W-STUDNUM.
18. Move the data from W-STUDNUM to STUDNUM
19. Read the data from the STUDFILE into W-STUD-REC INVALID KEY.
7a. Display “RECORD NOT FOUND !!!”.
7b. Move 1 to SW.
20. If SW = 0
8a. Read the data from STUDFILE to W-STUD-REC.
8b.Display “<<===== STUDENT INFORMATION =====>>”.
8c. Display “Student Number : “ W-STUDNUM.
8d. Display “Student Name : ” W-STUDNAME.
8e. Display “Course & Year: ” W-STUDCRSYR.
8f. Display “Academic Standing: ” W-STUDSTAND.
8f. Display “ “.
8g. Display “DELETE ANOTHER RECORD (Y/N) ? :”.
21. Accept RESP.
22. If RESP = “Y” or “y”
10a. Perform again DELETE-DATA-RTN routine.
23. If RESP = “N” or “n”
11a.. End.
24. Return the value of DELETE-DATA-RTN.

You might also like