home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_03_05
/
3n05018a
< prev
next >
Wrap
Text File
|
1992-03-04
|
1KB
|
46 lines
Listing 1
Sample program
. Simple List Program.
.
FILENAME DIM 30
DATAFILE FILE
SEQ FORM "-1"
RECORD DIM 133
COUNTER FORM 5
STATE DIM 2
STATE1 INIT "AL"
STATE2 INIT "AK"
STATE3 INIT "AR"
STATE4 INIT "AZ"
INDEX FORM 2
.
. Start of the program.
.
DISPLAY *ES,"SIMPLE LIST ":
"PROGRAM"
REENTER KEYIN "ENTER FILE NAME: ":
*ESCON,FILENAME
STOP IF ESCAPE
TRAP ERROR IF IO
OPEN DATAFILE,FILENAME
MOVE "0",COUNTER
LOOP
FILEPI 1;DATAFILE
READ DATAFILE,SEQ;INDEX,RECORD
LOAD STATE FROM INDEX OF STATE1,STATE2,STATE3,STATE4
WHILE NOT OVER
PRINT STATE,RECORD
ADD "1",COUNTER
DISPLAY *P1:4,"RECORDS: ",COUNTER
REPEAT
KEYIN "Listing finished. ":
"Tap enter. ",ANS
STOP
ERROR NORETURN
KEYIN *B,*HD,"FILE NOT FOUND. ":
" TAP ENTER. ",*HD,*EL
GOTO REENTER