Text preview for : GC21-7571-3_IBM_System3_DiskConceptsAndPlanningGuide_Dec75.pdf part of IBM GC21-7571-3 IBM System3 DiskConceptsAndPlanningGuide Dec75 IBM system3 GC21-7571-3_IBM_System3_DiskConceptsAndPlanningGuide_Dec75.pdf



Back to : GC21-7571-3_IBM_System3_D | Home

IBMSystem/3
DiskConcepts Planning
and Guide
Fourth Edition (December 1975)


r h i s i s a r e p r i n r o f G c 2 1 ' 7 s 7 1 - 2 , i n c o r p o r a t i n gt e c h n i c a r
n e w s r e t t e rG N 2 r - 5 2 9 3
dared 17 Aprit 1975.

I n f o r m a t i o n c o n c e r n i n gi n q u i r y a n d d u a r p r o g r a m m i n gf o r t h e M o d e r 1 0 D i s k
Sys-
tem has been removed from this manuar and can now be found in the tBM
system/3
Disk system contror Programming Raference Manuar, GC21-75i2; inforrnation
concerning inquiry for Model 6 can now be found in the lgM system/3
Modet 6
operation contror Languqe and Disk lJtirity programs Reference Manual.
GC21-
7 5 1 6 ; i n f o r m a t i o n c o n c e r n i n gi n q u i r y a n d r o l l o u t / r o l l i n f o r M o d e r 1 5 c a n b e f o u n o
in the /EMSystemlS Moder r5 system contor prognmming Raference
Manuar,
GC21-5077.

C h a n g e s r e p e r i o d i c a l l y m a d e t o t h e i n f o r m a t i o n h e r e i n ;b e f o r e u s i n g t h i s p u b l i c a _
a
tion in connection with the operation of rgM systems, refer to the ratest rBM
System/3 Bibliography, GC2oO8O, for the edirions that are applicable and
current.

Requests for copies of rBM pubtications shourd be made to your rBM representative
o r t o t h e I B M b r a n c h o f f i c e s e r v i n gy o u r l o c a l i t y .

A Reader',scomment Form is at the back of this publication. lf the form has been
removed, comments may be addressedto IBM corporation. pubrications,
Depart-
ment 245, Rochester, Minnesota 55901.

@ C o p y r i g h t I n t e r n a t i o n a l B u s i n e s s a c h i n e sC o r p o r a t i o n 1 g 71 , 1 9 7 2 , 1 9 7 4
M
PREFACE




T h i sm a n u ad i s c u s s eh e d i s kc o n c e p t a n d p l a n n i n gn f o r m a t i o n o u n e e dt o
l ts s i y
k n o w t o d e s i g n o m p u t e a p p l i c a t i o n s r t h e I B M S y s t e m / 3 o d e l6 , M o d e l
c r fo M
1 0 D i s kS y s t e ma r r dM o d e l1 5 . T h e b o o k i s i n t e n d e do r p r o g r a m m e w h o d e s i g n
, f rs
a p p l i c a t i o n s r t h e i rc o m p a n y .
fo

The System/3 Model8 is supported System/3Model10 DiskSystemcontrol
by
g
p r o g r a m m i na n d p r o g r a m r o d u c t s . h e f a c i l i t i e d e s c r i b e id t h i s p u b l i c a t i o no r
p T s n f
the Model 10 arealsoapplicable the Model8, although
to the Model8 is not referred to.
I t s h o u l db e n o t e dt h a t n o t a l l d e v i c ea n d f e a t u r e t h a t a r ea v a i l a b lo n t h e M o d e l1 0
s s e
a r ea v a i l a b lo n t h e M o d e l8 . T h e r e f o r e , o d e l8 u s e r s h o u l d e f a m i l i a r w i t h
e M b
the contentsot IBM System/3Model 8 lntroduction,GC2l-5114.


T h i s m a n u aa p p l i e so t h e s e r o g r a m r o d u c t s :
l t p p

o System/3 Model l0 Disk RPG ll (5702-RGl )

o System/3Model6 RPG ll (5703-RGl)

. System/3Model l5 RPG ll (5704-RGl)

. System/3Model l0 SubsefANS COBOL (5702-CBl)

. System/sModel l5 ANS COBOL (5704-CBl)

. System/3Model l0 Disk FORTRAN lV (5702-F0l)

o System/3Mooel l5 FORTRAN lV (5704-F0l)

. system/3 Modet6 Disk F}RTRAN tv (5703-F0l)


Differences
between theseRPGll, COBOL,and FORTRANprograms noted
are
when applicable, references madeto related
and are publications.

The chapters this manual
of sequence, described
shouldbe readin a specific as
in How to Use ThisPublicationwhich follows.

You should be familiar with the IBM System/3 DiskSystemlntroduction,
GC21-7510, l8M System/3
the ModelS lntroduction,GC21-5114, l8M System/3
the
Model 6 I ntroduction, G A21-9122, or the I BM System Model 15 I ntroduction,
/3
GC21-5094, depending the system
on you have.


After completing this manual, you shouldbe ableto write basicprogramswith
the aid of various reference manuals.For additionalinformation processing
on
disk files using RPG ll, seethe l8M System/3RPG ll Disk File ProcesingPro-
grammer'sGuide, GC21 -7566.
HOWTO USETHISPUBLICATION




This publication eightchapters two appendixes;
has and

o Chapters through5 discuss basic
1 the characteristics the IBM 5444 Disk Storage
of
D r i v ea n d t h e I B M 5 4 4 5 D i s kS t o r a g e . n dd e s c r i b t h e f o l l o w i n gb a s i c i l e o r g a n i z a t i o n s
a e f


Sequential
files

I n d e x e di l e s
f

Direct iles
f

Recordaddress
files

o Chapters through8 discuss considerations selecting particular
6 the for a file organiza-
tion, how to plan the filesto be created,and how to storeprograms
and procedures
on disk. lnformationin thesechapters basically samefor the 5444 andS44E,
is the
but specificdifferences noted.
are

o Appendix4 describes calculations the necessary determine
to how much
d i s ks p a c e f i l e w i l l r e q u i r e .
a

' Appendix I describes
someperformance
factors to considerwhen using in-
dexedfiles.

Chapters through5 of this manualarefor users
1 who needa basic knowledge how to
of
usedisk files. Chapters throughI can be readafter the reader
6 thoroughlyunderstands
the basicconcepts discussed chapters1 through5. AppendixA shouldbe readfor
in
informationabout how to calculate space.AppendixB will helpthosewho planto
file
useindexed files.
CONTENTS




CIIAPTER 1. DISK STORAGE 1 C H A P T E R7 . P L A N N I N G D I S K F I L E S . 41
I B M 5 4 4 4 D i s k S t o r a g eD r i v e 1 Designing Record a 41
I B M 5 4 4 5 D i s k S t o r a g e. Documenting Record Layout 44
S t o r a g eC h a r a c t e r i s t i c s5 4 4 4 a n d 5 4 4 5 ) .
( 5 D e t e r m i n i n g i z e a n d L o c a t i o no { a D i s k F i l e
S I
C o m p a r a t i v eA c c e s sT i m e s ( 5 4 4 4 a n d 5 4 4 5 ) S p l i t C y l i n d e rC a p a b i l i t y( 5 4 4 5 ) 53
Data FileSecurity 54
C I { A P T E R2 , S E O U E N T I A LF I L E S o
C r e a t i n g S e q u e n t i aF i l e
a l C H A P T E R 8 . S T O R I N G P R O G R A M SA N D
P r o c e s s i na S e q u e n t i a F i l e
g l b
PROCEDURES N DISK O 55
M a i n t a i n i n g S e q u e n t i aF i l e
a l A d v a n t a g e s f S t o r i n g P r o g r a m sa n d P r o c e d u r e s n
o o
Disk . 5 5
C H A P T E R3 . I N D E X E D F I L E S 9 L o c a t i o n o f L r b r a r i e so n D i s k . 5 6
C r e a t i n g n I n d e x e dF i l e
a I Source Libraries . . 5 7
P r o c e s s i na n I n d e x e dF i l e .
g 10 ObjectLibraries . 5 8
M a i n t a i n i n g n l n d e x e dF i l e
a lz i
S t o r i n g P r o g r a m sa n d P r o c e d u r e s n t o L i b r a r i e s , . 6 1

C H A P T E R4 . D I R E C T F I L E S tc A P P E N D I XA . C A L C U L A T I N G D I S K F I L E S I Z E . 6 3
R e l a t i v eR e c o r d N u m b e r 16 D e t e r m i n i n g u m b e r o f R e c o r d si n a F i l e
N . 6 3
Spill fechnique 21 C a l c u l a t i n gR e c o r d S p a c e . 6 4
Creating DirectFile
a 21 DeterminingHow Many Tracks are Needed- 5444. . 6 4
P r o c e s s i na D i r e c t F r l e .
g 23 D e t e r m i n i n g H o w M a n y T r a c k s a r e N e e d e d- 5 4 4 5 . 6 4
Maintaining Direct File
a 24 C a f c u l a t i n gI n d e x S p a c e - 5 4 4 4 . 6 5
Manipulating irectFile Data
D 25 C a l c u l a t i n gI n d e x S p a c e- 5 4 4 5 . 6 7
Accessing File Consecutively
a 26 FileSize . 6 8
L o a d i n g a n d R e t r i e v i n g R e c o r d si n t h e S a m e P r o g r a m 26 C a l c u l a t i n g i s k F i l e S i z e s- S u m m a r y
D aa

C o n r r e c t i n g t r i n g so f R e l a t e d R e c o r d s
S 26
Message ueuingin a System/3 Direct File
O 2a A P P E N D I XB . P E R F O R M A N C E O N S I D E R A T I O N S
C
U s i n Ea D i r e c t F i l e f o r L a r g e A r r a y s 29 F O R P R O C E S S I N GN D E X E O F I L E S .
I . 7 6
In d e x e s . t b
?n Type of Processing 7Q
C H A P T E R5 . R E C O R DA D D R E S SF I L E S .
F i l e sC o n t a i n i n gR e l a t i v eR e c o r d N u m b e r s H i g h e s tA d d e d K e y S a v e A r e a ( 5 4 4 5 O n l y I . 8 6
(ADDROUTFiles) 30 Model6 and 1O (5445 Only) . 4 7
R
F i l e sC o n t a i n i n g e c o r d K e y L i m i t s ?1 P r e - S o r t e dI n p u t . 8 8
Key Sort/Key Merge . 8 8
C H A P T E R6 . C H O O S I N G F I L E O R G A N I Z A T I O N
A Work File For Key Sort . 8 8
U s eo f t h e F i l e ?? M o d e l 15 ( 5 4 4 4 a n d 5 4 4 5 ) . 8 9
V o l a t i l i t yo f t h e F i l e J5 Keylength . 9 0
ol
Activitv of the File 36 Distribution of Added Records
S i z eo f r h e F i l e 3l I N D E X F i l e D e s c r i p t r o n n t r y ( M o d e l1 5 R P G l l l
E o1



I NDEX 92




ill
C H A P T E R . DISKSTORAGE
1




T h e I B M S y s t e m / 3 o d e l6 , M o d e l1 0 D i s kS y s t e ma n d M o d e l1 5 c a nu s et h e I B M
M ,
5444 Disk Storage Driveto storeinformationsuchasnraster, customer, and inventory
f i l e sa sw e l l a sp r o g r a m u s e d n t h e s y s t e m .I B M 5 4 4 5 D i s kS t o r a g e , n t h e o t h e rh a n d , .
s o o
c a nb e a t t a c h e do t h e I B M s y s t e m / 3 o d e l1 0 D i s ks y s t e ma n dt h e I B M s y s t e m / 3
t M
M o d e l1 5 t o p r o v i d e d d i t i o n as t o r a g c a p a c i t y ;n o l i b r a r i e c a n r e s i d e n t h e 5 4 4 5 .
a l e s o


The major advantages storinginformationon disk instead on cardsare:
of of

Large storage capacity. A5444 disk can hold asmuclr dataas25,60096-
c o l u m nc a r d s .A l s o ,a d i s k p a c ki s m o r ec o n v e n i e n t h a n d l e h a n l a r g e u m -
to t n
bersof cards.

Faster processing rate. A cardf ile must be processed its entirety.evenif all the
in
c a r d s r en o t n e e d e d A d i s kf i l e , o n t h e o t h e rh a n d ,c a nb e p r o c e s s erd n d o m l yt;h a t
a . a
is, only the records needed accessed processed.
are and


IBM 5444 DiskStorage
Drive

The IBM 5444 DiskstorageDriveconsists one drive,two disks, of ano an access
m e c h a n i s m i g u r e ) . T h e l o w e rd i s k i s m o u n t e d e r m a n e n t lo n t h e d r i v e .
(F 1 p y
The upperdisk is removable can be replaced
and with other disks. Eachdisk,
w h e t h e r i x e do r r e m o v a b l es c a l l e d v o l u m e .
f i. a

The access mechanism
contains four read/writeheads,one for eachsurface the
of
two disks. This mechanismmovesbackand forth across disk surfaces posi-
the to
tion the heads reador write data. Whenthe access
to m'chanism in any one
is
position, four heads positioned the same
all are in relativelocationon the four
disk surfaces.



Read/WriteHeads(4)




Figure 1. IBM 5444 Disk Storage Drive




Disk Storage 1
Eachsurface each5444 disk provides userwith 100 or 200 tracks,depend-
of the
i n go n w h i c hm o d e lo f t h e d i s ks t o r a g e r i v ey o u h a v e .T r a c k s r ed i v i d e d n t o
d a i
24 equalpartscalledsectors; eachsectorof a track hasits own uniqueaddress.
Eachsectorcancontain256 characters (bytes) data.
of




1 Sector
(256 characters)



Correspondingtracksfronr both surfaces one disk form a cylinder. Thesetwo
of
corresponding
trackscan be accessed a single
in positionof the read/write heads.


2 O 4c o n c e n t r i c c y l i n d e r s , 1 f o r e a c h
set of corresponding tracks on a disk




C y l i n d e r0 , T o p o f D i s k 1


Cylinder 0, Bottom of Disk 1



F o r t h i se x a m p l ec y l i n d e r s r en u m b e r e d t h r o u g h2 0 3 ,b e g i n n i nw i t h t h e
. a 0 g
outer cylinder. IBM cus,tomer engineers cylinder203 for diagnostic
use functions,
so this cylinderis not av;ailable permanent for storage.Tracksin cylinders
1 , 2 , a n d3 a r eu s e db y l l 3 M p r o g r a m m i na sa l t e r n a t e ' t r a c ws e n e v etrr a c k s n c y l i n d e r s
g kh i
1 through2O2arefound to be defective;therefore, IBM programming beingused, if is
cyfinders ,2 and3 are reserved useas alternate
1 for tracks. Cylinder0 is usedby
I B M - s u p p l i e d o g r a m m gs u p p o r t .
pr in


Althoughthereareactu4lly 1O4 2O4tracksper surface
or depending which on
m o d e ly o u h a v e o n l y 1 ( 1 0 r 2 0 0 a r ea v a i l a b lte t h e u s e r . I n t h i s m a n u a a n d
, o o l
elsewhere, capacityis referredto aseither 100 or 200 tracksper surface or
200 or 400 per disk pacl<.
The IBM 5444 DiskStorage
Driveis available these
in configurations:


Number o{ Number of Number of Storage
Configuration Drivss Disks Cylinders Capacity

1 1 100/disk' 2,457,600bytes

1 200/disk 4,915,200
bytes

J 3 200/disk 7,372,800
bytes

4 2 4 200/disk 9,830,400bytes

* M o d e l s6 a n d 1 0 o n l Y


IBM 5445 Disk Storage
IBM 5445 Disk Storage one or two drivesfor the Model 10 Disk Systemor from one
has
t o f o u r d r i v e s o r t h e M o d e l1 5 . E a c hd r i v eu s e s d i s kp a c kt h a t c o n t a i n s 1 d i s k s .T h e
f a 1
uppersurface the top disk and the lower surface the bottom disk are unused.There
of of
are,therefore, usable 20 surfaces. The disk pack is removable.

The access mechanismcontains read/write
20 heads the usable
for disk surfaces.
This mechanism movesbackand forth across disk surfaces positionthe
the to
heads reador write data. Whenthe access
to mechanism in any one position,
is
all 20 heads positioned the same
are in relativelocationon the 20 disk surfaces
(Figure ).
2

Eachsurface each5445 disk contains
of 200 tracks. Tracksaredividedinto 20
eachsectorhasa uniqueaddress, contains
sectors; and 256 characters(bytes)
of data.




Disk




Figure 2. IBM 5445 Disk Storage




Disk Storage 3
A 5 4 4 5c y l i n d e r o n s i s to f a l l t h e t r a c k s n a d i s k p a c ki n o n e v e r t i c ap l a n e
c s o l
( F i g u r e ) . S i n c e 0 d i s ks u r f a c ec a n b e a c c e s s ea c y l i n d e r
3 2 s d, i s m a d eu o o f 2 0
t r a c k s .T h e s a m e y l i n d e r d d r e sis u s e d o r a l l c o r r e s p o n d i nr a c k si n
c a s f tg
thecylinder.


|
l - . ' a r , i n d e r s - -tnn|
,



-
| \\:-
\ r
oo
I
I
I
I
Tracks in
a Cylinder

I
I
I


I
I
{
19




C y l i n d e r s3 - 5

Figure3. Cylinder Concept on the IBM 5445
Storage (5444 and 544b)
Gharacteristics

Figure4 showsthe relativestoragecharacteristics the IBM 5444 and IBM 5445
of
Disk Storage
drives.



5444 il45

Bytes per sector 256 256
Sectorsper track 24 20
Bytes per track 6144 5120
Tracksper cylinder 2 20
Bytesper cylinder 't2,288 102,400
Cylinders disk pack
per r 00/200 200
Bytes per disk pack 1,228,8001 20,480,000
2,457,600
Tracksper disk pack 200/400 4000
Sectorsper disk pack 4800/9600 80,000
Maximumnumberof disk files
stored per disk pack 50 50
Maximumnumberof usable
disk surfaces 8 4 0 ( M o d e l1 0 ) ; 8 0 ( M o d e l1 5 )

Maximumnumberof disk drives 2 ( M o d e1 0 ) ; 4 ( M o d e1 5 1
l l

Figure4. Charsctoristics the IBM 54F,4
of and5445 Disk Storage
Drives



Comparative
Access
Times 15444and il45)

Figure5 illustrates access
the timesavailable the IBM 5444 Disk Storage
on Drive (normal
and high speed)and the IBM 5445 Disk Storagedrive. For more information,seethe
IBM System/3 Model l0 ComponentsReferenceManual, (GA21-9103),the IBM System/3
Model 6 ComponentsReferenceManual, GA34-0001, or the l9M System/3 Model l5
ComponenBReference Manual (GA21-91 93).



5444 (normal) t 5444 (hiqh speedl 54t15
100 cyl 200cyl 100 cyl 200cyl

Minimumaccess
time 39 msec 39 msec 28 rnsec 28 msec 25 msec
Average
aocess
time 153 msec 269 msec 86 msec 126msec 60 msec
Maximumaccess
time 395 msec 750 msec 165 nsec 255msec 130msec
Datatransferrate 199,000
bytes/sec 199,000bytes/sec 312,000
bytes/sec
Rotationalspeed 15OORPM 15OORPM 24OORPM
Averagerotational 20 msec 20 msec 12.5msec
delay
'
Models and 10 only
6
Figure Comparative
5. Access
Timee(5444and5,4451


Dirk Storage 5
C H A P T E R . S E O U E N T I AF I L E S
2 L




A d i s k f i l e c a n b e o r g a n i z ea n d p r o c e s s e i k e a c a r df i l e . S u c ha d i s kf i l e i s
d ld
calleda sequential file. The sequence the file can be determined control
of by
fields, suchasan employee numberor a customer number,or the records may be
in no particular sequence. Consecutive processing means that the records are
processed after anotherin the physical
one order in which they occur.

An example a sequential is an employee
of file master ile arranged employee
f in
numberorderand containing informationabouteachemployee.Whenthis file is
usedfor processing, as payrollchecks, records processed
such the are consecutively.
The lowestemployee numberis processedfirstand so on until the lastrecord,
the highest
employee number,is processed.

A s e q u e n t i aill e m a y s p a nm u l t i p l e i s kv o l u m e s .( A v o l u m er e f e r so o n ed i s k
f d t
p a c k . A m u l t i v o l u m ei l e i s a f i l e t h a t i s c o n t a i n e d n m o r et h a no n ed i s k p a c k . )
f o
A multivolume file, however, affectsthe processing your file. For information
of
on processing considerations when usingmultivolume f
sequentialiles,seethe
discussion multivolume
on files in Chapter 6.


Creating Sequential
a File

You create file whenyou write the records
a onto a disk for the first time. The
records a sequential are placed the disk consecutively; is, they are
in file on that
written on the disk in the order in which they are read. All tracksin one cylinder
a r ef i l l e df i r s t ,t h e na l l t r a c k s n t h e n e x t c y l i n d e ra n d s o o n u n t i l t h e w h o l ef i l e
i ,
isplaced n thedisk.
o

Figure6 showsan example this process
of usinga5444. In this example,eachrecordis
128 positions (bytes)long. Sinceeachtrack can contain6144 bytesof data,48 records
can be written on eachtrack; 96 records
can be written on eachcylinder. The numbers
on the tracksin Figure6 correspond the numberand positionof eachrecord.
to


Processinga Sequential File

Sequential filescan be processed
consecutively randomlyby relative
or record
number. Normallythe file is processed
consecutively because sequential
a file
is usuallyusedwhen all the records the file areto be processed.
in

Sometimes, however, you may want to process
only certainrecords the file.
in
Consecutive processing be time-consuming this case,
can in because allthe records
must be processed at leastread. lt would be fasterto process recordsran-
or the
domly by a numberrelated the positionof the records the file. This number
to in
is calleda relativerecordnumber. lf your sequential is in order by control
file
fieldsand thereare no missing duplicate
or records, contents the control
the of
fieldscan be usedas relative recordnumbers.For more informationon this type
of processing, Random Processing Relative Record Number in Chapter 4.
see by
Top Tracks




nd Cylinder F i r s tC y l i n d e r




Bottom Tracks




= 124


F i g u r e 6 . W r i t i n g R e c o r d so n a D i s k




Maintaining a Sequential File

Onceyou create file. you must maintainit. File maintenance
a meansperforming
thosefunctionsthat keepa file currentfor daily processing
needs.Four file main-
tenancefunctionsaffect or apply to sequentialfiles:

1. Addingrecords

2. records deletion
Tagging for

3. Updatingrecords

4. Reorganizingfile
a



Adding Records

Records be addedto a file after the file hasbeencreated.Whenrecords
can are
addedto a sequential they arewritten at the end of the file. Thus,the file
file,
is extendedby the addedrecords.

Sometimes, however,the new recordsmust be mergedbetweenthe recordsal-
readyin the file. This may be necessary orderto keepthe file in a particular
in
orderwhenthe control fieldsof the new records not higherin sequence
are than
thosealready the file. In orderto put the new records the
in in propersequence,
you mustsort the file to create new file containing addedrecords.Another
a the
technique would be to merge the new recordsinto the properplacein the
originalfile duringa copy to a new file.

Note: Adding records a sequential is not supported COBOL. A FORTRAN
to file by
programmust readall existing first, and then beginwriting.
records

S e q u e n t i a lF i l e s 7
TaggingRecords Deletion
for

when a recordbecomes inactive,
you wiil no ronger want to process with the
it
other records.A recordcannotbe physically removed from the file duringregular
processing;therefore, is necessary identify or tag the recordso it
it to can be by-
passed. one way to tag sucha recordis to put a code,calred derete
a code,in a
particularlocationin the record. when the fire is processed,your program can check
for the derete
code;if the codeis present, program
the can bypass that record.


UpdatingRecords

when you updaterecords a fire,you can add or change
in somedataon the record.
For exampre, an inventoryfire you might want
in to add the quantity of itemsre-
ceived the previous
to quantityon hand. The recordto be updated
is readinto
storage,
changed, written backon the disk in its original
and rocation.


Reorganizing File
a

when several
records a fire havebeentagged deretion,
in for you shourdphysicaily
removethem from the file. This will free disk space.You can remove
the inactive
records copyingthe records be retained
by to onto anotherdisk area.
CHAPTER I N D E X E D I L E S
3. F




I n s o m e d a t a p r o c e s s i n g p p l i c a t i o n s o u m a y n o t w a n t t o p r o c e s s y o u rf i l e c o n -
a y
s e c u t i v e l y . C o n s e c u t i v e r o c e s s i n gs t i m e - c o n s u m i n g f y o u o n l y w a n t t o p r o c e s s
p i i
certain records in the file. lt is faster to skip the records not needed in a job and
p r o c e s s n l y t h e r e q u i r e do n e s . A n i n d e x e df i l e a l l o w s t h i s t y p e o f p r o c e s s i n g .
o

/Vote.' This chapter and any other discussions indexed files in this manual do
of
n o t a p p l y t o F O R T R A N ; i n d e x e d f i l e s a r e n o t s u p p o r t e db y F O R T R A N .



An indexed file is organized into two parts: an index and the data records. The
i n d e x c o n t a i n sa n e n t r y f o r e a c h r e c o r d i n t h e f i l e . Y o u c a n g o t o t h e i n d e x , f i n d
the location of the record, go to that location, and {ind the record you want.


Under certain conditions up to three types of indexes may be used. These index types
a r e g i v e n s p e c i f i cn a m e si n t h i s m a n u a l t o e l i m i n a t ec o n f u s i o n . T h e f i r s t , a n d m o s t u s e d ,
index is referred to as the file index. In some caseswhen using the 5445, the system
may generatean index (on disk) known as the drsk track index. Still another type of in-
dex, used to improve performance, isthecore index. For more information on these
three indexes, seeAppendix B.

E a c he n t r y i n t h e f i l e i n d e x d e s c r i b e s r e c o r d i n t h e f i l e . T h e r e i s a n e n t r y i n t h e f i l e
a
i n d e x f o r e a c h r e c o r d i n t h e f i l e . F o r e x a m p l e ,i f a f i l e i n d e x h a s 2 0 0 0 e n t r i e s ,t h e f i l e
contains 2000 records. The first part of the entry contains the record's key field.
E a c h e n t r y ( k e y ) i n t h e k e y f i e l d c o n t a i n sd a t a t h a t u n i q u e l y i d e n t i f i e st h e r e c o r d . F o r
example, the customer number may be the key field for a customer master record. The
second part of the f ile index entry contains the drsk addressof the record. The disk
addressrepresents the location on the disk where the record is stored. The file index is
arrangedin ascendingsequenceaccording to the key field in each record.

A n i n d e x e df i l e c a n b e a m u l t i v o l u m e f i l e . W h e n p r o c e s s i n g n i n d e x e df i l e . h o w e v e r ,
a
y o u m u s t c o n s i d e rt h e e f f e c t t h a t m u l t i v o l u m e f i l e s w i l l h a v eo n f i l e p r o c e s s i n g .F o r
i n f o r m a t i o n o n p r o c e s s i n g o n s i d e r a t i c l nw h e n u s i n g m u l t i v o l u m e i n d e x e d f i l e s .s e e
c s
t h e d i s c u s s i o n n m u l t i v o l u m e f i l e si n C h a p t e r 6 .
o



Creatingan lndexed File

you
When create indexed for RPGll, therecords thefile canbe in an
an file in
ordered or an unordered sequence;when creating an indexed file for COBOL,
however, the records must be in ascendingsequence, determined by their keys.
as
An ordered sequencemeansthe records are arranged in order according to some
major control field used as the key field. An unordered sequencemeans the
recordsare in no particular order.

An inventory file loaded according to frequency of use is an example of an unordered
file. The most active items are at the beginning of the file. When the file is used to
write customer orders, most of the records needed are located in a small area of the
file rather than scatteredthroughout the entire file. This reducesthe total time it
takes to process the records becausethe accessmechanism does not have to move
the required records.
back and forth acrossthe whole disk to access


lndexed Files I
W h e n a n i n d e x e df i l e i s c r e a t e d ,t h e f i l e i n d e x i s c r e a t e da s t h e r e c o r d sa r e w r i t t e n o n d i s k .
l f t h e f i l e i s a n o r d e r e df i l e , t h e f i l e i n d e x i s i n t h e c o r r e c t s e q u e n c e h e n t h e r e c o r d sa r e
w
w r i t t e n . l f t h e f i l e i s a n u n o r d e r e df i l e , t h e s y s t e ma u t o m a t i c a l l ys o r t s t h e f i l e i n d e x
into
ascendingsequenceafter all the records in the file have been loaded. (The time
r e q u i r e df o r s o r t c a n b e r e d u c e di f t h e s p e c i a l o r k f i l e $ l N D E X 4 4 o r $ l N D E X 4 5
w
is available.)

The file index area precedesthe area where records are placed on a disk. For example,
s u p p o s e h e f i l e i n d e x f o r a c e r t a i n f i l e r e q u i r e sf i v e t r a c k s . T h e ' f i l e i n d e x e n t r i e s
t
w o u l d b e w r i t t e n o n t h e f i r s t f i v e t r a c k s o f t h e f i l e . R e c o r d sw o u l d b e w r i t t e n b e g i n n i n g
i n t h e f i r s t s e c t o ro f t h e s i x t h t r a c k . B o t h t h e f i l e i n d e x a r e aa n d t h e r e c o r d a r e a m u s t
s t a r t a t t h e b e g i n n i n go f a t r a c k .




Top
Track
of First
Cylinder




Bottom
Track
of Third
Cylinder




For indexed fileson the 5445, anothertype of index is created when the file index uses
m o r et h a n 1 5 t r a c k s .T h i sa d d i t i o n ailn d e x . h i c h p r e c e d ets e f i l e i n d e x .i s k n o w na s
w h
the drbktrackindex. Eachentry in the disk track index refers one track of the file to
index. The disk track indexwill be usedby the systemonly if its usewill improveper-
formance.SeeAppendixB for more informationon this subject.




Processing Indexed File
an

Indexed filesare not limitedto consecutive
processing; can be processed
they
several
waysbecause file index provides
the several
waysto find records.


Sequential
Processing Key
by

Whenan indexedfile is processed sequentially key, the records processed the
by are in
orderof the key fields. This methodis usedto process records a file, regardless
all in
o f t h e i ro r d e r .




10
To illustrate this processingmethod, note the similari ties and differences between
F i l e A a n d F i l e B i n F i g u r e 7 . B o t h f i l e s c o n t a i n t h e s r a m e e c o r d s ,a n d b o t h f i l e
r
indexes are in order according to the key field. The dlifferencebetween the two
files is the order of the records. The records in File A, are in order according to
k e y f i e l d ; t h e r e c o r d si n F i l e B a r e u n o r d e r e d . A l l r e c ; o r d sn e i t h e r f i l e c a n b e
i
processed order if you specify the processingas secluentialby key.
in



File A


File lndex Records



10 I 20 | 3ol 40 I 50 | 60 | 70




Fiila B


Records



x
File Index



t0 n 30 40 50 60


Figure7. Example of an Orderedand an Unordered File



Within Limits
Sequential Processing

A n o t h e r w a y t o s e q u e n t i a l l y r o c e s s n i n d e x e df i l e i s s e q u e n t i a l l y i t h i n l i m i t s , a m e t h o d
p a w
in which records are processedin groups.

/ V o t e ; C O B O L s u p p o r t ss t a r t i n gk e y ( l o w e r l i m i t ) p r o c e s s i n g n l y . U p p e r l i m i t p r o c e s s i n g ,
o
i f d e s i r e d , m u s t b e p r o v i d e d i n y o u r C O B O L s o u r c e p r o g r a me l i m i t s f o r a n R P G l l
Th .
pro'
object program can be supplied by a limits iecord or the lower limit can be set in your
g r a m . F o r m u l t i v o l u m e f i l e s , t h i s t y p e o f p r o c e s s i n g lp p l i e so n l y
a to Model 15.


that a wholesale ompany c
A s a n e x a m p l eo f s e q u e n t i a p r o c e s s i n g i t h i n l i m i t s , s u p p o s e
l w
customer's charges. Each customer is assigned a
preparesmonthly statementsof each
t h e r e g i o n t h e c u s t o m e ri s i n a n d t h e r e m a i n i n g
5 - d i g i t n u m b e r ;t h e f i r s t d i g i t r e p r e s e n t s
four digits representthe customer's number. The company's customers are divided
into four regions.allowing monthly statementsto btr sent each week to the customers
i n o n e o f t h e r e g i o n s . R e g i o n 1 c u s t o m e r s( 1 0 0 0 0 - 1 1 1 9 9 9 )r e b i l l e d t h e f i r s t w e e k
a
of the month. region 2 customers (20000-29999) the second week, and so on. The
statements,therefore. are processed sequentially within limits'


F o r i n f o r m a t i o n o n p r o c e s s i n g n i n d e x e df i l e s e q u e n t i a l l y i t h i n l i m i t s , s e e
a w
Chapter 5 in this manual'




l n d e x e dF i l e s 1I
Random Processing


Indexed files can arso be processed randomry. This type of processing,cailed
random by key, permtts processingof one particular
record without regard to
i t s r e l a t i o nt o o t h e r r e c o r d s .


when you processa fire randomry by key, you
specify the key of the record you
w a n t . T h e k e y i s f o u n r Ji n t h e f i l e i n d e x ; t h e
disk address adjacento the key) is
( t
then used to rocate the record so the record
can be transferred to storagefor
processi ng.


Processing Indexed File Ocnsecutively
an

I n d e x e d f i l e s c a n b e p r o c e s s e d r e a d )c o n s e c u t i v e l y
( b y d e f i n i n g t h e i n d e x e df i l e a s
a s e q u e n t i a l n p u t f i l e i r nt h e F i l e D e s c r i p t i o n
i s p e c i f i c a t i o n s .w h e n a n i n d e x e d
file is processed consecutivery,the f ire index is bypassedand data records
are pro_
c e s s e d o n s e c u t i v e r yr o m t h e b e g i n n i n g f t h e
c f o fire to the end, asif it wasa se-
q u e n t i a l f i l e . N o t e t h a t i n d e x e df i r e s
c a n n o t b e c r e a t e d ,a d d e d t o , o r u p d a t e d
consecutively.


A n e x a m p l eo f u s i n gc o n s e c u t i v e r o c e s s i n g f
p o a n i n d e x e df i l e i s r e a d i n gr e c o r d s
f r o m a n i n d e x e df i r e w h e n t h e f i r e i n d e x i s u n u s a b r e
for somereason.


Maintaining IndexedFile
an

A f t e r t h e f i l e i s c r e a t e d ,y o u c a n u s e t h e s ef i r e m a i n t e n a n c e
f u n c t i o n st o k e e p t h e
file currentfor daily processing eeds: n

Adding records

2. Tagging recordsfor deletion

3. Updating records

4. Reorganizing f il,e
a



Adding Records


When a record is added to an indexed file, it is written at the end
of the records
a l r e a d yi n t h e f i l e . R e c o , r d s a n b e a d d e d e i t h e r s e q u e n t i a l l y
c by key or randomly
by key. When recordsare added randomly by key (the records
to be added need
not be in any particurar sequence)or sequentiaily by key, the
system checks to
ensure that the record is not a duplicate of a record already in
the file; if the record
i s n o t a d u p l i c a t e .i t w i l l b e a d d e d t o t h e f i r e .

The file index entry for the added record is written at the
end of tne current entries
in the index area. After all the records are added, the
keys of the added records and
the keys of the original records are sorted or merged, so that
the keys cf all records
i n t h e f i l e a r e i n a s c e n d i n g e q u e n c en t h e f i r e i n d e x .
s i asfoilows:




12
File Index Entry Before Additions
(key field and disk address) Key Fields




1 M 2 D3 J D5 D2 6 D1




During Additions




After Additions



1 Bl 2 D3 3 o5 4 D6 5 D2 6 D2



lf many records to be addedto the file, the time required the index sort/merge
are for
a
can be decreased allocating special
by no
work file. This requires special RPG ll
codingbut doesrequire in