IBM 1130 User Manual page 643

Computing system
Hide thumbs Also See for 1130:
Table of Contents

Advertisement

Section
Subsections
Page
85
10
I
20
03
Searching the Index
Figure 85.1 illustrates a typical method of search-
ing an index.
Unlike pure sequential organization, which is
searched on the disk, indexed sequential gives an
index to search in core storage. The simplest
approach is to search the table sequentially, one
entry at a time, starting at the top. When you find
an equal-or-less-than condition, you have found
what you are looking for.
The subroutine shown in
You would CALL the subroutine FINDM with the
known values of:
ITEM -- the item you are searching for
ITABL -- the name of the index table
LTABL --
the length of the index table
ISS -- the index table step size
NFILE -- the number of the file
Figure 85. 1.
1/
FOR
*EXTENDED PRECISION
*TRANSFER TRACE
*ONE WORD INTEGERS
*LIST ALL
*ARITHMETIC TRACE
SU8ROUTIN~
FINDM(NREC,ITEM,NFILE,ITABL,LTABL,ISS,IER)
DIMENSION ITABL(l)
IER
=
1
DO 1 N
=
1 , LTABL
IF ( ITEM - ITABL(N) )
2 ,
2 ,
1
1
CONTINUE
C
ITEM IS LARGER THAN THE
LARG~ST
VALUE IN THE INDEX TABLE
IER
=
2
RETURN
2
NREC
=
ISS
*
N
DO
3 N
=
1 ,
ISS
READ ( NFILE
t
NREC
KEY
IF ( KEY - ITEM) 4 , 5 , 6
6
NREC
=
NREC -
1
3
CONTINUE
C
ITEM IS NOT IN THE FILE
IN THE AREA WHERE IT SHOULD BE
4
IER
=
3
5
RETURN
END
VARIABLE ALLOCATIONS
N (I ) =0000
KEY (I ) =0001
STATEMENT ALLOCATIONS
1
=0033
2
=0042
6
FEATURES SUPPORTED
TRANSFER TRACE
ARITHMETIC TRACE
ONE WORD INTEGERS
EXTENDED PRECISION
CALLED SUBPROGRAMS
=005B
3
SIAR
SIIF
SUBSC
SUBIN
SDRED
INTEGER CONSTANTS
1=0004
2=0005
3=0006
CORE REQUIREMENTS FOR FINDM
COMMON
0
VARIABLES
4
PROGRAM
END OF
CCMPI~ATION
=0001
4
=006A
5
SDI
108
=006E

Advertisement

Table of Contents
loading

Table of Contents