Text preview for : GC21-7566-1_IBM_System3_RPGII_DiskFileProcessingProgrammersGuide_Jun78.pdf part of IBM GC21-7566-1 IBM System3 RPGII DiskFileProcessingProgrammersGuide Jun78 IBM system3 GC21-7566-1_IBM_System3_RPGII_DiskFileProcessingProgrammersGuide_Jun78.pdf
Back to : GC21-7566-1_IBM_System3_R | Home
IBMSystem/3
RPGll DiskFileProcessing
Programmer'sGuide
Pageof cC21 7566 1
lssued30 June 1978
Bv TN L: GN2 tr-5625
SecondEdition (July 1974)
T h i s i s e r m a j o r r e v i s i o n o f , a n d o b s o l e t e s ,G C 2 1 - 7 5 6 6 - 0 a n d T e c h n i c a l N e w s l e t t e r
G N 2 1 - 7 6 5 7 . T h i s m a n u a l h a s b e e n e x t e n s i v e l v r e v i s e da n d s h o u l d b e r e v i e w e d i n
rtsentrr{.'tY.
Information concerningIBM System/3 Model 15 hasbeenadded to the manual, The
entire section entitled Chapter 5. Using Console Devices has been removed from
t h i s m a n u a l . T h e K E Y ( M o d e l 6 o n l y ) a n d D S P L Y o p e r a t i o n c o d e s ,f o r m e r l y d e s c r i b e d
i n C h a p t e r5 , a r e d e s c r i b e d n y o u r R P G l l r e f e r e n c e a n u a l . F o r i n f o r m a t i o n
i m
c o n c e r n i n gt h e R P G l l l n q u i r y f a c i l i t y ( R o l l o u t / R o l l i n ) ,a l s o f o r m e r l y d e s c r i b e d n
i
Chapter 5.see Related Publications, listed in the Preface.
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 . n 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 t i o n
a
in connection with the operation of IBM systems, refer to the IBM System/3
B i b l i o g r a p h y , G C 2 0 - 8 O 8 Of,o r t h e e d i t i o n s t h a t a r e a p p l i c a b l ea n d c u r r e n t .
U s e t h i s p u b l i c i a t i o no n l V f o r t h e p u r p o s e ss t a t e d i n t h e P r e f a c e .
P u b l i c a l i o n s a r e n o t s t o c k e d a t t h e a d d r e s sb e l o w . R e q u e s t sf o r c o p i e s o f I B M
p u b l i c a t i o n sa n d f o r t e c h n i c a l i n f o r m a t i o n a b o u t t h e s y s t e m s h o u l d b e m a d e t o y o u r
I B M r e p , r e s e n t a t i vo 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 .
e
T h i s p u l l l i c a t i o n c o u l d c o n t a i n t e c h n i c a l i n a c c u r a c i e s r t y p o g r a p h i c a le r r o r s . U s e t h e
o
R e a d e r ' sC o m m e n t F o r m a t t h e b a c k o f t h i s p u b l i c a t i o n t o m a k e c o m m e n t s a b o u t t h i s
p u b l i c a t i o n . l f t h e f o r m h a s b e e n r e m o v e d ,a d d r e s sy o u r c o m m e n t s t o I B M C o r p o r a t i o n ,
P u b l i c a t i o n s ,D e p a r t m e n t 2 4 5 , R o c h e s t e r ,M i n n e s o t a 5 5 9 O 1 . C o m m e n t s b e c o m e t h e
p r o p e r t ' yo f l B M .
O C o p y r i g h t I n t e r n a t i o n a B u s i n e s M a c h i n e s o r p o r a t i o n1 9 7 1 , 1 9 7 4
l s C
P a g e o f G C 2 1, 7 5 6 6 - 1
lssued30 June 1978
By TNL: GN21-5625
Preface
This manualexplains the RPG ll specif ications necessarv RelatedPublications
t o p r o c e sd i s kf i l e su s i n g h e I B M S y s t e m / 3 o d e l6 ,
s t M
M o d e l1 0 D i s kS y s t e ma n d M o d e l1 5 . T h e f o l l o w i n g
. T h e s e u b l i c a t i o na r er e c o m m e n d e d r a d d i t i o n a l
p s fo
typesof f ilesarediscussed: reference:
o Sequential
GeneralSystem/3
o Indexed
. l8M System/3 Disk Conceptsand Planning Guide,
. Direct GC21.7571
o RecordAddress
RPG ll References
I n c l u d e d r ee x a m p l eo f c r e a t i n g n d m a i n t a i n i ne a c h
a s a g
f
o f t h e s e i l et y p e s . F o r i n f o r m a t i o n n h o w t h i s p u b -
o . IBM System/3 Model 6 RPG ll ReferenceManuar.
lication should be read, seeHow to Use This Publication, sc21-7517
t o l l o w i n g h e t a b l eo f c o n t e n t s .
t
. IBM System/3 RPG ll Reference
Manual SC21-7504
.
This manualis intended programmers for who havea
b a s i c n o w l e d g o f t h e R P Gl l l a n g u a g en c l u d i n gh e
k e i, t
a b i l i t yt o d e s c r i b s e q u e n t i a ln d i n d e x e di l e sa s
e a f OCL References
input f iles. The reader must be familiarwith the
information presented inthe IBM System/3 Disk Con- . IBM System/3 Models 8 and | 0 System Controt
ceptsand PlanningGuide, GC21-7571. Programming Reference Manual, GC2l-7512
. IBM System/3 Model l5 System Control programming
Note: lsy detailedinformationconcerning multi- ReferenceManual, GC21-5O77
volumedisk files - concepts; OperationControl Lan-
guage considerations; -
RPG I I processing seethe . IBM System/3 Models 4 and 6 Operation Control
publicationslisted under RelatedPublicationswhich Languageand Disk Utility ProgramsReference
areappropriate your System/3
for model. Manual. GC21-7516
. IBM System/3 Model l5 SystemControl programming
Conceptsand Reference Manual. GC21 5162
Contents
CHAPTER 1. SEOUENT]AL FILES. 1
C r e a t i n ga S e q u e n t i a lF i l e 1
Input Records 3
Output Record 3
M a i n t a i n i n g a S e q u e n t i a lF i l e 6
Adding Records 7
T a g g i n gR e c o r d sf o r D e l e t i o n 16
Updating Records 16
Reorganizing File a 22
CHAPTER 2. INDEXED FILES 26
C r e a t i n ga n I n d e x e d F i l e 26
C r e a t i n ga n O r d e r e d l n d e x e d F i l e . 27
C r e a t i n ga n U n o r d e r e d I n d e x e d F i l e 2a
Input Record N
Output Record 29
M a i n t a i n i n g n I n d e x e dF i l e
a 31
Updating Records 32
Adding Records 37
T a g g i n g R e c o r d sf o r D e l e t i o n 49
Reorganizing File a 49
O t h e r W a y s t o P r o c e s sI n d e x e d F i l e s 50
Processing n Indexed File Consecutively
a 50
Processing n lndexed File Randomly by
a
RelativeRecord Number 50
CHAPTER 3. DIRECT FILES 51
C r e a t i n ga D i r e c t F i l e 51
R?
C r e a t i n ga D i r e c t F i l e w i t h o u t S y n o n y m s
Input Record 54
OutDut Record 54
C r e a t i n ga D i r e c t F i l e w i t h S y n o n y m s 58
R e t r i e v a lo f R e c o r d si n a D i r e c t F i l e 60
C o n s e c u t i v eR e t r i e v a l 61
Random Retrieval 66
Maintaining DirectFile
a 70
Adding Records 70
T a g g i n gR e c o r d sf o r D e l e t i o n 70
t l
Updating Records
CHAPTER 4. RECORD ADDRESS FILES . 79
F i l e sC o n t a i n i n g R e l a t i v eR e c o r d N u m b e r s
(ADDROUT Files) 79
Creating n ADDROUT File
a 79
P r o c e s s i nb y a n A D D R O U T F i l e .
g 80
F i l e sC o n t a i n i n g R e c o r d K e y L i m i t s 83
C r e a t i n ga F i l e w i t h R e c o r d K e y L i m i t s 83
P r o c e s s i n g e q u e n t i a l l yw i t h i n L i m i t s
S 84
INDEX 89
How To Use This Publication
T h i s p u b l i c a t i o ni s d i v i d e d i n t o f o u r c h a p t e r s :
t. S e q u e n t i a lF i l e s
2. IndexedFiles
? Direct Files
4. Record Address Files
Each of the chapters discusses the RPG | | specificationsneededto create and
m a i n t a i n a c e r t a i nt y p e o f f i l e . S i n c et h e d i s c u s s i o n is e a c h c h a p t e r a p p l y t o
n
a p a r t i c u l a rf i l e o r g a n i z a t i o n y o u n e e d r e a d o n l y t h e c h a p t e r f o r t h e f i l e
.
organization ou will use.
y
T h i s m a n u a l i s d e s i g n e d o s h o w y o u t h e e n t r i e st h a t m u s f b e m a d e i n o r d e r f o r
t
t h e s y s t e mt o i d e n t i f y t h e f i l e a n d d e t e r m i n ew h a t f u n c t i o n s a r e t o b e d o n e . O t h e r
e n t r i e sw i l l b e n e e d e d ,b u t t h e y d e p e n do n t h e j o b y o u a r e d o i n g . R e f e r t o t h e r e f -
e r e n c em a n u a l f o r y o u r s y s t e m i f y o u n e e d i n f o r m a t i o n o n t h e s e a d d i t i o n a le n t r i e s .
Note Concerning Examples
M o s t o f t h e e x a m p l e si n t h i s m a n u a l u s e M F C U i n p u t f i l e s a n d u s e 9 6 - c o l u m n c a r d
i m a g e s o r e p r e s e n t n p u t r e c o r d s . T h i s d o e sn o t i m p l y t h a t e i t h e r t h e M F C U o r
t i
9 6 - c o l u m nc a r d sm u s t b e u s e df o r i n p u t ; a n y o f s e v e r a i n p u t d e v i c e s a n b e u s e d ,
l c
d e p e n d i n g n w h i c h S y s t e m / 3 m o d e l a n d c o n f i g u r a t i o ny o u h a v e .
o
l f y o u a r e a M o d e l 6 u s e r ,y o u w o u l d p r o b a b l y n o t u s e a c a r d f i l e f o r i n p u t , a l -
t h o u g h y o u m a y u s e a n o n l i n e d a t a r e c o r d e rf o r c a r d i n p u t . I n s t e a d ,y o u w o u l d
c r e a t es e q u e n t i a d i s k t r a n s a c t i o nf i l e s i n o n e o f t h e f o l l o w i n g w a y s :
l
o U s i n g t h e K e y b o a r d D a t a E n t r y c o n v e r s a t i o n au t i l i t y p r o g r a m ( s e eI B M
l
System/3 Model 6 Conversational lJtility Programs Reference Manual, SC21-75281
o U s i n ga n i n t e r a c t i v e P G l l , F O R T R A N , o r B A S I C p r o g r a mt o b u i l d t h e d i s k
R
f i l e f r o m k e y b o a r di n p u t
Page GC21-7566-1
of
lssued September
24 1976
By'TNL: GN21-5427
The disk transaction would then be usedto updatea disk master
file file in the
s a m e a y M F C Uf i l e sa r eu s e di n t h e e x a m p l eis t h i s m a n u a l .T h u s ,t h e M F c u
w n
f i l e si n t h e e x a m p l ec o u l db e r e p l a c e d y s e q u e n t i a li s kf i l e s . F o r e x a m p l e :
s b d
F i l e D e s c r i p t i o n S p e c i fi c a t i o n
D e p e n d i n go n t h e S y s t e m / 3 m o d e l a r r dt h e l / O d e v i c e s v a i l a b l e M F C U i n p u t f i l e s s h o w n
a ,
i n m o s t o f t h e e x a m p l e sc a n b e r e p l a c e db y 8 0 - c o l u m nc a r d f i l e s , c o n s o l ef i l e s ,t a p e f i l e s ,
5 4 4 5 d i s k f i l e s , o r o t h e r t y p e s o f i n p u t f i l e s . M o d e l s 1 0 , 1 2 , a n d 1 5 u s e r sc a n s u b s t i t u t e
DlSK45 (5445 disk) or DlSK40 (3340 disk) for the clevice ntry DISK (5444 disk) in the e
e x a m p l e s , e p e n d i n go n t h e e q u i p m e n t t h e y h a v e . M o d e l 6 u s e r ss h o u l d r e p l a c et h e d e v i c e
d
e n t r y P R I N T E R i n t h e e x a m p l e sw i t h t h e d e v i c ec n t r y T R A C T R l . a n d r e p l a c eB l o c l a n d R e c o r d L e n g t h e n t r i e sw i t h t h e b e g i n n i n ga n c le n d i n g p r i n t p o s i t i o n s .
Page GC21
of -7566-1
1976
lssued SePtember
24
ByTNL: GN21-5427
D I R E C T A C C E S SS T O R A G E F O R M O D E L S 1 2 A N D 1 5
The IBM 3340 Direct AccessStorage Facility attachesto System/3 Model 12, to System/3
M o d e l 1 5 ( 5 7 0 4 - R G 1 ) a n d t o S y s t e m / 3M o d e l ' l S ( 5 7 0 4 - R G 2 ) .
,
T h e I B M 3 3 4 4 D i r e c t A c c e s sS t o r a q eF a c i l i t y a l s o a t t a c h e s o S y s t e m / 3 M o d e l 1 5 ( 5 7 0 4 - R G 2 ) .
t
Certain areason the 3340 and 3344 disks are treated as5444 disks. These areas,known as
5 4 4 4 s i m u l a t i o na r e a s a r e u s e df o r t h e p r o g r a m l i b r a r i e s n d c a n b e a l s o u s e d f o r c e r t a i n
, a
d a t a f i l e s . T h e r e m a i n d e ro f t h e d i s k s p a c e ,l < n o w na s m a i n d a t a a r e a ,c a n o n l v b e u s e df o r
datafiles.
R e f e r e n c e sn t h i s m a n u a l t o D I S K , D l S K 4 0 , a n d D l S K 4 5 a r e t o b e i n t e r p r e t e da c c o r d i n g
i
t o w h i c h d i s k s t o r a g ed e v i c e ( s ) s a t t a c h e dt o t h e s y s t e m . T h e f o l l o w i n g t a b l e s h o u l d b e
i
u s e dt o d e t e r m i n et h e m e a n i n qo f t h e r e f e r e n c e :
Model 15 M o d e l1 2 o r 1 5 M o d e l1 5
Device Type (5704-RG1) (5704-RG1) (s704-RG2)
DISK 5444 Disk 5 4 4 4s i m u l a t i o n 5 4 4 4s i m u l a t i o n
Storage areaon 3340 areaon 3340 or
Drive 3344
DISK4O Not Main data area Main data area
applicable on 3340 on 3340 or 3344
D IS K 4 5 5 4 4 5D i s k Main data area Main dataarea
Storage on 3340 on 3340 or 3344
IBM System/35448 Disk Storage
Drive
The IBM System/3 5448 Disk Storage Driveorr System/3 Models and 10 uses same
8 the
program productsupportasthe I BM 5445 Disk Storage.However, separate a system
c o n t r o lp r o g r a me a t u r e s r e q u i r e do r t h e 5 4 4 8 . I n g e n e r a l ,e f e r e n c e o 5 4 4 5 i n t h i s
f i f r ts
m a n u aa l s oa p p l yt o 5 4 4 8 . F o r s p e c i f i cn f o r m a t i o n b o u t5 4 4 8 o p e r a t i n c h a r a c t e r i s t i c s
l I a g
and programming support, seeIBM System/35448 Disk StorageDrive ProgramReference
Manual,GC21 68. -51
P a g eo f G C 2 1 - 7 5 6 6 - 1
l s s u e d2 4 S e p t e m b e r 1 9 7 6
By TNL: GN2'l-5427
Chapter Sequential
1. Files
A s e c l u e n t i a l i s k f i l e i s a g r o u p o f r e c o r d sa r r a n g e di n a p a r t i c u l a rs e q u e n c e n o
d a
p r o c e s s e d o n s e c u t i v e l yo n e a f t e r a n o t h e r i n t h e o r d e r t h e v o c c u r .
c .
T h i s c h a p t e re x p l a i n sh o w t o u s e t h e R P G l l l a n g u a g eo c r e a t ea n d m a i n t a i n a
t
s e q u e n t i a f i l e . S a m p l ej o b s a r e u s e dt o i l l u s t r a t et h e s ef u n c t i o n s .
l
-fr:
u n d e r s t a n d h c s a m p l ej o b s , a b a s i ck n o w l e d g eo f R p G l l i s n e c e s s a r y .l f y o u
t
d o n o t f u l l y r e c a l ls o m e o f t h e c o r J i n g s e d i n t h e s a m p l ej o b s , y o u s h o u l d r e f e r
u
tothe IBM system/3 RPG ll ReferenceManual, sc21-7504 (for Model 10 Disk
System or Model 15), or the IBM System/3 Model 6 RPG ll Reference Manual,
S C 2 1- 7 5 17 , d e p e n d i n go n t h e s y s t e my o u h a v e .
CREATING A SEOUENTIAL FILE
T o c r e a t ea s e q u e r r t i afli l e , y o u m a k e c e r t a i n e r r t r i e s n t h e F i l e D e s c r i p t i o n
o
, ! e c . t . l h e l . , l o w i r : , re n t r i e s r e r e q u i r e d
a to describc arious haracteristics
v c of
t h e d i s kf i l r : :
F i le Description Specifications
T h e d i s k f i l e n a m em u s t b e e n t e r e di n c o l u m n s7 t h r o u g h 1 4 . C o l u m n 1 b m u s t
c i , r , i a r ia r r i ) t c rt n d i c a t e h e f i l c i s a n o u t o u t f i l e .
l t
A l l r e c o r d s n a i i l e m u s t b e t h e s a m el e n g t h . T h u s ,c o l u m n 1 9 m u s t c o n t a i na n
i
F t o s p e c i f yt h a t t h e r e c o r d l e n q t h i s f i x e d .
A n u r n b e rt h a t i s e q u a i t o o r . r m u l t i p l e o f t h e d i s k r e c o r d l e n g t h m u s t b e
e n t e r e dr r rc o l u m n s 2 0 t h r o u g h 2 3 . l t , i s e n t r y d e t e r m i n e s h e s i z eo f t h e i n p u t /
t
o u t p u t a r e aa l l o c a t e d y R P G l l . F o r a n e x p l a n a t i o n n b l o c k l e n g t hc a l c u l a t i o n ,
b o
seethe IBM Syste,n/3 Disk Conceptsand Planning Guide, GC21-757j. ii you
w a n l l ) l o c k l e n g t h c a l c u l a t e df o r y o u b y R P G l l , a s s i g n b l o c k l e n g t h e q u a l t o t h e
a
r e c o r d l e n g t h . B y b l o c k i n g d i s k r e c o r d sy o u c a n i n c r e a s eh e i n p u t / o u t p u t e f f i -
t
c i e n c y o f y o u r p r o g r a m b y r e d u c i n gt h e n u m b e r o f a c c e s s e sY o u m u s t D e s u r e ,
.
h o w e v e r ,t h a t e n o u g h m a i n s t o r a g ei s a v a i l a b l e o r y o u r i n p u t / o u t p u t a r e a .
f
C o l u m n s2 4 t h r o u g h 2 7 m u s t c o n t a i n t h e l e n g t ho f t h e d i s k r e c o r d . W h e n e v e r a
r J i : : 1< i , i s i r e i n g d e s c r i b e d ,I S K ( M o d e l6 , 1 0 , 1 5 ) , D l S K 4 0 ( M o d e l 1 2 o r 1 5 l,
! r : D
r r D l s K 4 5 ( M o d e l 1 0 , 1 2 , o r 1 5 ) i s r e q u i r e di n t h e D e v i c e o l u m n s .
c
Sequential Files
Example of Creatinga Se,quential
File
Suppose you want to createa customer on disk. Customerfile numbers to be are
d
a s s i g n eo n a s e q u e r n t ib a s i sn e wc u s t o m e ra r ea s s i g n etd e n e x t h i g h e r u m b e r .
al ; s h n
The file will be usedto producemonthly reports eachcustomer's of status.Thus,
a s e q u e n t i aill e w i I s e r v e o u r n e e d s .
f y
To create sequential you must first determine input recordformat and
the file, the
t h e o u t p u t r e c o r d ' o r m a(tF i g u r e ) . T h e f i l e i s c r e a t e d y w r i t i n gt h e c u s t o m e r
1 1 b
datafrom the input records onto disk. Noticethat space provided the outputis on
recordso additionalinformationcan be addedto the recordlater if necessary.
Basic informationabout eachcustomer the file is alsoprintodin the reportshown
in
in Figure . 2
F i g u r e s h o w s h e R P Gl l c o d i n g e c e s s a t o c r e a t eh e s e q u e n t i a lu s t o m efri l e
3 t n ry t c
a n dp r i n t t h e r e p o r t .
lnput Records
"'t"-"
M I TRANS
l4*l'*-
tl
Itlrl c H A R |G P A y | I :
lll I EI lcneorrlenll
l l l l l t t i
B Key
a
CODE Output code(CM)
2
l CUSTNO Customer number
B STATE State
a co C o un t y
CITY City
2
NAME C u s t o m e rn a m e
ADDR Customerstreetaddress
CITST City and state
CRLIM Creditlimit
STATUS S t a t us
Note: The lnput file need not be a card file. See TRANS N u m b e r o f t r a n s a c t i o nt h i s m o n t h
s
How to Use This Manual, Note Concerning Examples CHARGE Currentmonth charges
PAY C u r r e n tm o n t h p a y m e n t s
at the beginning f this manual.
o
CREDIT C u r r e n tm o n t h c r e d i t s
BAL B al an c e
YTDSLS Y e a r - t o - d a t e a l e sa m o u n t
s
YTDNO Y e a r - t o - d a t en u m b e r o f s a l e s
D EL E T E output record code
Output Record
U U
o F
CUSTNO
F
co CITY NAME ADDR CITST
U)
u
) z F
l F
CHARGE PAY CR E D I T Reserved space for UJ
E tr BAL YTDSLS YTDNO
- F record expansion ul
o
Figure l, Input Record and Output Record Formats
S e q u e n t i aF i l e s
l
r-r-_T
9 9 9 9 9 9 9 0
! 4 5 6 r E 9 0
JSTOMER NAME ADDRESS
136128 JONES VARIETY 14 s BEDROCK, TEX
301628 JIM'S 5 AND 10 1103 ST GLENCOII, MINN
795246 SCHMIDT HARDWARN 60(l HILL C1TY, MD
Figure ll Report of Customer Records
C o n t r o l C a r d S p e c i fi c a t i o n s
H ld,
;l
9
2A !
I* l: a l
E 9
a
)
'
9
a
!
i
:
: ;
!
-
!
a
"li
:I:
R e l . r r ) r l e r p e . 1 c S y i r 0 n r B e n r e n . e L r r r y t r r i r r r ' J1 o r r c l ! r ,rfrr lrs
a
J :
,l*
t
a c
!
: : q
t
E l :
:1:
F i l e D e s c r i p t i o n S p e c i fi c a t i o n
Lc.ltli ol KcV F,r,l o' E\reft Exri
oi R..o(l Adilr!s F.rd for DANI
I R e c o r d sa r e b l o c k e d
T 1128x2=2561
1 l
RPG INPUT SPECFICATIONS
I
I
1 I
Becof d ldentif icatlon Codes F i ed
I
,l !
! a
1 !
;l: : ll. To
1.1
a a
F
F
- :l:
i'l : ;
:l-
ia
"1"
.'1ffi.
D
tlll, , J l 1 i i
I
LWF,/.L t
I 7 iuslf ia
lr.'
"t-l I
34 vi,pe
Itl'
I
'i;llll: . 5 ! EqDR
j
, 7 f l t'rs,r
;' 1 l l:lf1 illt1
I
I
-'ADIT' 74 )nTa.4
I
lll . : .
)ud;rNa
I
I
I
l I , 4,1 ,izii
I
O n l i n e s0 1 a n d 0 7 , c o l u m n s1 5 - 1 7 c o n t a i n i n f o r m a t i o n u s e d , , ' 1
I t o s e q u e n c e h e c k t h e i n p u t r e c o r d . I n c o l u m n s1 5 a n d 1 6 , 0 1
c
I m e a n st h a t r e c o r d t y p e 2 m u s t b e f i r s t f o l l o w e d b y r e c o r d
.
t y p e 3 ( i d e n t i fe d b y 0 2 s e q u e n c e ) . h e 1 i n c o l u m n 1 7 m e a n s
i T
that one record type 2 and one record type 3 exists, l '
I
I
F i g u r e 3 { P a r t 1 o f 2 } . C r e a t i n ga S e q u e n t i a lC u s t o m e r F i l e
S e q u e n t i a lF i l e s 5
RPG OUTPUT SPECIFICATIONS
75 /6 77 78 /9 80
pr!.,m rl
tl l f l
,,"',.'.,1 I I i I I
1
Ortt)!l lf(licrlors
o I sK,
o C M i s a d d e dt o t h e d i s k r e c o r d . T h i s
o c o d e i s a r e c o r d c o d e t h a t c a n b e u s e dt o
o i d e n t i f y a c u s t o m e rm a s t e rr e c o r d i n o t h e r
o p r o g r am s .
o
o
o ' Cu'sr,91,1r4
'
!
-n
! o ,TlAilA'
, o ,ADDR'sis,
'
l l
,.,
t 3
'l'J
ri'1
r16
1 l
.i"l
l l
t 9
l l
2 a
F i g u r e 3 l P a r t 2 o f 2 1 . C r e a t i n ga S e q u e n t i a lC u s t o n t e r F i l e
MAINTAINING A SEOUENTIAL FILE
O n c e a f i l e h a s b e e nc n l a t e d ,i t u s u a l l y n e e d st o b e m a i n t a i n e d . F i l e m a i n t e n a n c e
m e a n sp e r f o r m i n gt h o s e f u n c t i o n s t h a t k e e p a f i l e c u r r e n t f o r d a i l y p r o c e s s r n g
n e e d s . F o u r c o r n m o n . ' i l em a i n t e n a n c e u n c t i o n s a p p l y t o s e q u e n t i a l i l e s :
f f
1. Adding records.
2. T a g g i n gr e c o r d sl o r d e l e t i o n .
3. U p d a t i n gr e c o r d s .
4. R e o r g a n i z i na f i l e .
g
Adding Records
After a file is created, vou can add records to it. Recordscan be added ro a
s e q u e n t i af i l e i n e i t h e r o f t w o w a v s :
l
1. A t t h e e n d o f r e c o r d si n t h e f i l e .
2. B e t w e e nr e c o r d si n t h e f i l e ( c r e a t i n ga n e w f i l e ) .
Adding Recordsat the End of Recordsin the File
T o a d d r e c o r d sa t t h e e n d o f t h e f i l e , e n t r i e sa r e r e q u i r e do n t h e F i l e D e s c r i p -
t i o n a n d O u t p u t - F o r m a ts h e e t s :
File Description Specifications
RPG O U T P U T .F O R M A TS P E C I
F
[,,..;" I;,""^a'r
['"""'-'i';"."i -
i i l i
S o m e o f t h e e n t r i e so n t h e F i l e D e s c r i o t i o ns h e e ta r e t h e s a m eo n e s n e e d e dt o
create a sequentialfile (seeCreating a Sequential File in this chapter).
T w o n e w d i s k e n t r i e sa r e a l s o n e e d e d ,o n e o n t h e F i l e D e s c r i p t i o ns h e e ta n d o n e
o n t h e O u t p u t - F o r m a t s h e e t . T h e s ee n t r i e sa r e c i r c l e d .
A n A i n c o l u m n 6 6 o n t h e F i l e D e s c r i p t i o ns h e e tt e l l s t h e s y s t e mt h a t r e c o r d s
w i l l b e a d d e dt o t h e f i l e d e s c r i b e d n t h i s l i n e .
o
T h e e n t r y o n t h e O u t p u t - F o r m a t s h e e ti s a n A D D i n c o l u m n s 1 6 t h r o u g h 1 8 .
T h i s e n t r y t e l l s t h e s y s t e mt h a t t h e f i e l d s d e f i n e d o n t h e f o l l o w i n g l i n e sc o n -
s t i t u t e t h e r e c o r d t o b e a d d e d t o t h e f i l e s p e c i f i e di n c o l u m n s 7 t h r o u g h 1 4 .
S e q u e n t i a lF i l e s
Example of Adding Recordsto the End of the File
As you get new customers, will want to add them to the sequential
you cus-
tomer f ile you createrlin the Exampleof Creating SequentialFile. Since a
c u s t o m en u m b e r s r r - ' a s s i g ns e q u e n t i a l l e , c hn e wc u s t o m e r e c o r d a n b e
r a ed ya c
added ollowinghe records ow in the file.
f t n
The input records and output records will be in the sameformat asthe records
u s e d o c r e a t e h e f i l e . A r e p o r tc a n b e p r i n t e dl i k e t h e o n e s h o w ni n F i g u r e
t t 4
to ensure that the nerrv records havebeenaddedto the file.
F i g u r e s h o w s h e R P Gl l c o d i n gn e c e s s a t o a d d r e c o r d so t h e c u s t o m efri l e
5 t ry t
a n dp r i n t t h e r e p o r t .
2 2 ? 2 2 2 2 ? 2 t
z r o,1 5 7 '.iirll' oL!r19-".'
I
T c []
NEW CUSTOMER LISTING
CUST,OI'IER CUSTOMI]R CRIDIT
NUIVIBER NP-ME ADDRESS C I TYlSTATE LIMI T
136728 JONES VARIITY l4 s; MAIr{ BEDROCK, TEX 1,000
301628 JIM'S 5 AND 1O I]O: FRANKLIN ST G L I ] N C O L ], M I N N 250
795246 SCHMIDTHARDWARE 600 IST ST NW IIILL CITY, MD 2,004
Figure 4. Report o{ New Customers Added to the Customer File
6 X 2 r 9 0 9 23 L r M i 0 5 0 '
R P G C O N T R O L A R DA N D F I L ED E S C R I P T I O N E C I F I C A T I O N S
C SP PtnredlrsAn
IBM,,"..",.., 3u,.e$M,.h,ndca,no,a,,o,
/5 16 11 7A /9 AO
-aT
u*ffi.' P,uqrdm t
r,r..ir'.a,rLrl I
f f T
I I
l
I
C o n t r o l C a r d S o e c i fi c a t i o n s
H Mode 2C !
il
E
a
E 9
9
! -
I
) a
!
a a 9
Hefer b the soec,lc Svsi.m Reierence L'brarv md.!ai ior aclual eritres
3 o 6 j E
6 .:
c
E
l - 3 a d
E
c
a
i 3 c
a f
: n !
6
a
7 3 9 62 63 64 65 66 6) 6n 6q
File DescriptionSpecification
I vpe
F
I Proce$rf!
L.nglh ol Key F!. d or
Extent Ex r
)i Record Address F'eld tor DAM
E
T ^ Sy!nlrol ic
lr Device Label Exrl
Devrc
Core I nder
l.
|ona area
-lo*'r U]U8
J
: : ill t--
F V,Ar tr,
ili w q
,l
Srnrtr.q
VECI,
I
I
,t,,,
0
)4, {, [t 1 t t'sl^ Il ' - i t i I
i
"a r l