Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
******************************************************************
* Find Number of records in an indexed file *
******************************************************************
Identification Division.
Program-Id. Num-Of-Recs.
Author. Theophilos Kanoutas.
******************************************************************
* E N V I R O N M E N T D I V I S I O N *
******************************************************************
Environment Division.
Configuration Section.
Special-Names.
Decimal-Point Is Comma.
Input-Output Section.
File-Control.
Select Idx-Fil
Assign To Disk Idx-Path
Organization Binary Sequential Access Sequential
File Status FlSt.
******************************************************************
* D A T A D I V I S I O N *
******************************************************************
Data Division.
File Section.
Fd Idx-Fil.
1 Idx-Rec.
2 Pic x(50).
2 Idx-Num-Recs Pic 9(9) Binary(4).
2 Pic x(10).
*----------------------------------------------------------------*
Working-Storage Section.
1 Idx-Path Pic x(255).
1 FlSt Pic xx.
1 Pic x.
88 Error-On-File Value "Y" False "N".
1 Chr Pic x.
******************************************************************
* P R O C E D U R E D I V I S I O N *
******************************************************************
Procedure Division.
Declaratives.
Dcl-Idx-Section Section.
Use After Standard Error Procedure On Idx-Fil.
Dcl-Idx.
Set Error-On-File To True.
End Declaratives.
*----------------------------------------------------------------*
Main Section.
Procedure-Division.
Display Spaces Erase
Accept Idx-Path Tab Prompt No Beep
Set Error-On-File To False
Open Input Idx-Fil
If Error-On-File
Display "Error " FlSt " Opening File"
GoBack
End-If
Set Error-On-File To False
Read Idx-Fil
If Error-On-File
Display "Error " FlSt " Reading File"
GoBack
End-If
Close Idx-Fil
Display "Number Of Records:" Idx-Num-Recs Convert
Display "Press Enter"
Accept Chr Col 0
GoBack
.
End Program Num-Of-Recs.