You are on page 1of 40

File Handling in

COBOL
Topics covered in the Session
(1) Introduction to File handling.
(2) File ORGANIATION and A!!"SS #ethods.
($) File handling ver%s.

&'(2)(12 &'(2)(12 &)*$' A+ &)*$' A+ In,os-s Technologies .i#ited In,os-s Technologies .i#ited

COBOL is generally used in


COBOL is generally used in
situations where the volume of
situations where the volume of
data to be processed is large.
data to be processed is large.

These systems are sometimes


These systems are sometimes
referred to as data intensive
referred to as data intensive
systems.
systems.
Introduction to File processing

Field Field type and Field sie.

!ecord !ecord"#ie$ Fi%ed length records and


&ariable length records.

File 'aster files$ Transaction files$ File


organiation and File access method.
/asic Ter#inologies
&'(2)(12 &'(2)(12 &)*$' A+ &)*$' A+ In,os-s Technologies .i#ited In,os-s Technologies .i#ited
Files$ !ecords$
Files$ !ecords$
Fields.
Fields.

0e use the ter# FI".1 to descri%e an ite# o, 0e use the ter# FI".1 to descri%e an ite# o,
in,or#ation 2e are recording a%out an o%3ect in,or#ation 2e are recording a%out an o%3ect
(e.g. StudentNa#e4 1ateO,/irth4 !ourse!ode). (e.g. StudentNa#e4 1ateO,/irth4 !ourse!ode).

0e use the ter# R"!OR1 to descri%e the collection o, 0e use the ter# R"!OR1 to descri%e the collection o,
,ields 2hich record in,or#ation a%out an o%3ect ,ields 2hich record in,or#ation a%out an o%3ect
(e.g. a StudentRecord is a collection o, ,ields (e.g. a StudentRecord is a collection o, ,ields
recording in,or#ation a%out a student). recording in,or#ation a%out a student).

0e use the ter# FI." to descri%e a collection o, one or 0e use the ter# FI." to descri%e a collection o, one or
#ore occurrences (instances) o, a record t-pe #ore occurrences (instances) o, a record t-pe
(te#plate). (te#plate).

It is i#portant to distinguish %et2een the record It is i#portant to distinguish %et2een the record
occurrence (i.e. the values o, a record) and the record occurrence (i.e. the values o, a record) and the record
t-pe (i.e. the structure o, the record). t-pe (i.e. the structure o, the record).
"ver- record in a ,ile has a di,,erent value %ut the sa#e "ver- record in a ,ile has a di,,erent value %ut the sa#e
structure. structure.
&'(2)(12 &'(2)(12 &)*$' A+ &)*$' A+ In,os-s Technologies .i#ited In,os-s Technologies .i#ited
Files$ !ecords$
Files$ !ecords$
Fields.
Fields.
StudId StudName DateOfBirth StudId StudName DateOfBirth
9723456 COUGHLAN 191961
9724567 !"AN 31121976
953411# CO$$%" 2361964
942345# O&B!I%N 3111979
9312#76 S'I(H 12121976
StudId StudName DateOfBirth StudId StudName DateOfBirth
9723456 COUGHLAN 191961
9724567 !"AN 31121976
953411# CO$$%" 2361964
942345# O&B!I%N 3111979
9312#76 S'I(H 12121976
S(UD%N(S S(UD%N(S
DA(A DI)ISION*
$IL% S%C(ION*
$D Stude+t$i,e*
1 Stude+tDetai,-*
2 StudId .IC 9/70*
2 StudName .IC 1/#0*
2 DateOfBirth .IC 1/#0*
DA(A DI)ISION*
$IL% S%C(ION*
$D Stude+t$i,e*
1 Stude+tDetai,-*
2 StudId .IC 9/70*
2 StudName .IC 1/#0*
2 DateOfBirth .IC 1/#0*
occurrences occurrences
Record Type Record Type
(Template) (Template)
(Structure) (Structure)
"5a#ple
!()*O *+'( +)(
6A1&1 78OT9I 1:
6A1&2 ANIR;19 2&
6A1&$ SRI19AR 1)
Field<1 File Field<2 Field<$
Record<1
Record<2
Record<$
#T,-(*T
&'(2)(12 &'(2)(12 &)*$' A+ &)*$' A+ In,os-s Technologies .i#ited In,os-s Technologies .i#ited
!ecord
!ecord
Buffers
Buffers

To process a file records are read from the


To process a file records are read from the
file into the computer.s memory one record
file into the computer.s memory one record
at a time.
at a time.

The computer uses the programmers


The computer uses the programmers
description of the record /i.e. the record
description of the record /i.e. the record
template0 to set aside sufficient memory to
template0 to set aside sufficient memory to
store one instance of the record.
store one instance of the record.

'emory allocated for storing a record is


'emory allocated for storing a record is
usually called a record buffer
usually called a record buffer

The record buffer is the only connection


The record buffer is the only connection
between the program and the records in the
between the program and the records in the
file.
file.
!ecord
!ecord
Buffers
Buffers
IDENTIFICATION DIVISION.
etc.
ENVIRONMENT DIVISION.
etc.
DATA DIVISION.
FIE SECTION.
!ro"ram !ro"ram
Record#u$$er Record#u$$er
Declarat%on Declarat%on
ST&DENTS
-1#2
Record Instance
1escription o, a Record %u,,er ,or a ,ile containing
Single record t-pe
-+T+ -1&1#1O*.
F1L( #(CT1O*.
F- #T,-F1L(.
34 #T,-"!(C.
35 !()*O 61C 7/50.
35 *+'( 61C +/450.
35 +)( 61C 8/90.
Record /u,,er and its i#plications
&'(2)(12 &'(2)(12 &)*$' A+ &)*$' A+ In,os-s Technologies .i#ited In,os-s Technologies .i#ited
-escribing the record buffer in
-escribing the record buffer in
COBOL
COBOL

The record type:template:buffer of The record type:template:buffer of every every file used in a file used in a
program program must must be described in the F1L( #(CT1O* by be described in the F1L( #(CT1O* by
means of an F- /file description0 entry. means of an F- /file description0 entry.

The F- entry consists of the letters F- and an internal file The F- entry consists of the letters F- and an internal file
name. name.
DA(A DI)ISION*
$IL% S%C(ION*
$D Stude+t$i,e*
1 Stude+tDetai,-*
2 Stude+tId .IC 9/70*
2 Stude+tName*
3 Sur+ame .IC 1/#0*
3 I+itia,- .IC 11*
2 DateOfBirth*
3 "OBirth .IC 9/20*
3 'OBirth .IC 9/20*
3 DOBirth .IC 9/20*
2 C2ur-eC2de .IC 1/40*
2 Gra+t .IC 9/40*
2 Ge+der .IC 1*
DA(A DI)ISION*
$IL% S%C(ION*
$D Stude+t$i,e*
1 Stude+tDetai,-*
2 Stude+tId .IC 9/70*
2 Stude+tName*
3 Sur+ame .IC 1/#0*
3 I+itia,- .IC 11*
2 DateOfBirth*
3 "OBirth .IC 9/20*
3 'OBirth .IC 9/20*
3 DOBirth .IC 9/20*
2 C2ur-eC2de .IC 1/40*
2 Gra+t .IC 9/40*
2 Ge+der .IC 1*
&'(2)(12 &'(2)(12 &)*$' A+ &)*$' A+ In,os-s Technologies .i#ited In,os-s Technologies .i#ited
1mplications of
1mplications of
;Buffers.
;Buffers.

1f your program processes more than one file you 1f your program processes more than one file you
will have to describe a record buffer for each file. will have to describe a record buffer for each file.

To process all the records in an 1*6,T file each To process all the records in an 1*6,T file each
record instance must be copied /read0 from the file record instance must be copied /read0 from the file
into the record buffer when re<uired. into the record buffer when re<uired.

To create an O,T6,T file containing data records To create an O,T6,T file containing data records
each record must be placed in the record buffer each record must be placed in the record buffer
and then transferred /written0 to the file. and then transferred /written0 to the file.

To transfer a record from an input file to an output To transfer a record from an input file to an output
file we will have to file we will have to

read the record into the input record buffer read the record into the input record buffer

transfer it to the output record buffer transfer it to the output record buffer

write the data to the output file from the write the data to the output file from the
output record buffer output record buffer
1escription o, a Record %u,,er ,or a ,ile containing
+ultiple record t-pes
-+T+ -1&1#1O*.
F1L( #(CT1O*.
F- T!+*#"F1L(.
34 1*#"!(C.
35 T"CO-( 61C 7.
35 !()*O 61C 7/50.
35 *+'( 61C +/450.
35 +)( 61C 8/90.
34 -(L"!(C.
35 T"CO-( 61C 7.
35 !()*O 61C 7/50.
34 ,6-"!(C.
35 T"CO-( 61C 7.
35 !()*O 61C 7/50.
35 +)( 61C 8/90.
Record /u,,er and its i#plications
Organiation and
Organiation and
+ccess
+ccess

Two important characteristics of files are Two important characteristics of files are

-+T+ O!)+*1=+T1O* -+T+ O!)+*1=+T1O*

'(T>O- OF +CC(## '(T>O- OF +CC(##

-ata organiation refers to the way the records of the file are -ata organiation refers to the way the records of the file are
organied on the bac?ing storage device. organied on the bac?ing storage device.
COBOL recognies three main file organiations@ COBOL recognies three main file organiations@

#e<uential #e<uential " !ecords organied serially. " !ecords organied serially.

!elative !elative " !elative record number based " !elative record number based
organiation. organiation.

1nde%ed 1nde%ed " 1nde% based organiation. " 1nde% based organiation.

The method of access refers to the way in which records are The method of access refers to the way in which records are
accessed. accessed.

+ file with an organiation of 1nde%ed or !elative may + file with an organiation of 1nde%ed or !elative may
still have its records accessed se<uentially. still have its records accessed se<uentially.

But records in a file with an organiation of #e<uential But records in a file with an organiation of #e<uential
can not be accessed directly. can not be accessed directly.
#e<uential
#e<uential
Organiation
Organiation

The simplest COBOL file organiation is #e<uential. The simplest COBOL file organiation is #e<uential.

1n a #e<uential file the records are arranged serially$ one 1n a #e<uential file the records are arranged serially$ one
after another$ li?e cards in a dealing show. after another$ li?e cards in a dealing show.

1n a #e<uential file the only way to access any particular 1n a #e<uential file the only way to access any particular
record is to@ record is to@
#tart at the first record and read all the succeeding #tart at the first record and read all the succeeding
records until you find the one you want or reach the end records until you find the one you want or reach the end
of the file. of the file.

#e<uential files may be #e<uential files may be


Ordered
Ordered
or
or
&nordered
&nordered
/these should be
/these should be
called #erial files0
called #erial files0

The ordering of the records in a file has a significant impact The ordering of the records in a file has a significant impact
on the way in which it is processed and the processing that on the way in which it is processed and the processing that
can be done on it. can be done on it.
Se=uential ,ile organi>ation

#implest and least fle%ible of all types of file


organiations.

Can only be accessed se<uentially.

!ecords can be only added to the end of the file.

-oes not provide means to insert or delete records.

'ost storage efficient.


FI."<!ONTRO. paragraph ,or se=uential ,iles
#(L(CT file"name +##1)* TO implementor"name
A O!)+*1=+T1O* 1# #(B,(*T1+L C
A +CC(## 'O-( 1# #(B,(*T1+LC
A F1L( #T+T,# 1# identifier C.
&'(2)(12 &'(2)(12 &)*$' A+ &)*$' A+ In,os-s Technologies .i#ited In,os-s Technologies .i#ited
ST&DENTS
The #elect and +ssign
The #elect and +ssign
Clause.
Clause.

The internal ,ile na#e used in the F1 entr- is


The internal ,ile na#e used in the F1 entr- is
connected to an e5ternal ,ile (on dis? or tape) %-
connected to an e5ternal ,ile (on dis? or tape) %-
#eans o, the Select and Assign clause.
#eans o, the Select and Assign clause.
%N)I!ON'%N( DI)ISION*
IN.U(3OU(.U( S%C(ION*
$IL%3CON(!OL*
S%L%C( Stude+t$i,e
ASSIGN (O 4S(UD%N(S5*
DA(A DI)ISION*
$IL% S%C(ION*
$D Stude+t$i,e*
1 Stude+tDetai,-*
2 Stude+tId .IC 9/70*
2 Stude+tName*
3 Sur+ame .IC 1/#0*
3 I+itia,- .IC 11*
2 DateOfBirth*
3 "OBirth .IC 9/20*
3 'OBirth .IC 9/20*
3 DOBirth .IC 9/20*
2 C2ur-eC2de .IC 1/40*
2 Gra+t .IC 9/40*
2 Ge+der .IC 1*
%N)I!ON'%N( DI)ISION*
IN.U(3OU(.U( S%C(ION*
$IL%3CON(!OL*
S%L%C( Stude+t$i,e
ASSIGN (O 4S(UD%N(S5*
DA(A DI)ISION*
$IL% S%C(ION*
$D Stude+t$i,e*
1 Stude+tDetai,-*
2 Stude+tId .IC 9/70*
2 Stude+tName*
3 Sur+ame .IC 1/#0*
3 I+itia,- .IC 11*
2 DateOfBirth*
3 "OBirth .IC 9/20*
3 'OBirth .IC 9/20*
3 DOBirth .IC 9/20*
2 C2ur-eC2de .IC 1/40*
2 Gra+t .IC 9/40*
2 Ge+der .IC 1*
-1#2
F1 entries ,or Fi5ed length records
F- file"name
A !(CO!- CO*T+1*# integer"4 C>+!+CT(!# C
A BLOC2 CO*T+1*# integer"9 D !(CO!-#$
C>+!+CT(!# EC
A L+B(L D !(CO!- 1#$ !(CO!-# +!( E
D #T+*-+!-$ O'1TT(- EC
A -+T+ D !(CO!- 1#$ !(CO!-# +!( E identifier"4$
identifier"9$ . . . C
F1 entries ,or @aria%le length records
F- file"name

A !(CO!- CO*T+1*# integer"4 TO integer"9
C>+!+CT(!# C

A BLOC2 CO*T+1*# integer"F TO integer"G
C>+!+CT(!# C
A L+B(L D !(CO!- 1#$ !(CO!-# +!( E
D #T+*-+!-$ O'1TT(- EC
A -+T+ D !(CO!- 1#$ !(CO!-# +!( E identifier"4$
identifier"9$ . . . C
File handling ver%s

OA"N

R"A1

0RIT"

R"0RIT"

!.OS"
&'(2)(12 &'(2)(12 &)*$' A+ &)*$' A+ In,os-s Technologies .i#ited In,os-s Technologies .i#ited
COBOL file handling
COBOL file handling
&erbs
&erbs

O6(* O6(*
Before your program can access the data in an input file or Before your program can access the data in an input file or
place data in an output file you must ma?e the file available to place data in an output file you must ma?e the file available to
the program by O6(*ing it. the program by O6(*ing it.

!(+- !(+-
The !(+- copies a record occurrence:instance from the file The !(+- copies a record occurrence:instance from the file
and places it in the record buffer. and places it in the record buffer.

H!1T( H!1T(
The H!1T( copies the record it finds in the record buffer to The H!1T( copies the record it finds in the record buffer to
the file. the file.

CLO#( CLO#(
Iou must ensure that /before terminating0 your program Iou must ensure that /before terminating0 your program
closes all the files it has opened. Failure to do so may result in closes all the files it has opened. Failure to do so may result in
data not being written to the file or users being prevented data not being written to the file or users being prevented
from accessing the file. from accessing the file.
&'(2)(12 &'(2)(12 &)*$' A+ &)*$' A+ In,os-s Technologies .i#ited In,os-s Technologies .i#ited
O6(* and CLO#( verb
O6(* and CLO#( verb
synta%
synta%

Hhen you open a file you have to indicate to the Hhen you open a file you have to indicate to the
system what how you want to use it /e.g. 1*6,T$ system what how you want to use it /e.g. 1*6,T$
O,T6,T$ (7T(*-0 so that the system can manage O,T6,T$ (7T(*-0 so that the system can manage
the file correctly. the file correctly.

Opening a file does not transfer any data to the Opening a file does not transfer any data to the
record buffer$ it simply provides access. record buffer$ it simply provides access.
OA"N InternalFileNa#e ...
INA;T
O;TA;T
"BT"N1

'

'

OA"N ver%

S-nta5
OA"N CINA;T4 O;TA;T4 I<O4 "BT"N1D Filena#e<1 .
. .
OA"N +O1"
STAT"+"NT INA;T O;TA;T I<O "BT"N1
R"A1
0RIT"
R"0RIT"
&'(2)(12 &'(2)(12 &)*$' A+ &)*$' A+ In,os-s Technologies .i#ited In,os-s Technologies .i#ited
The !(+- verb
The !(+- verb

Once the s-ste# has opened a ,ile and #ade it


Once the s-ste# has opened a ,ile and #ade it
availa%le to the progra# it is the progra##ers
availa%le to the progra# it is the progra##ers
responsi%ilit- to process it correctl-.
responsi%ilit- to process it correctl-.

Re#e#%er4 the ,ile record %u,,er is our onl-


Re#e#%er4 the ,ile record %u,,er is our onl-
connection 2ith the ,ile and it is onl- a%le to
connection 2ith the ,ile and it is onl- a%le to
store a single record at a ti#e.
store a single record at a ti#e.

To process all the records in the ,ile 2e have to


To process all the records in the ,ile 2e have to
trans,er the#4 one record at a ti#e4 ,ro# the ,ile
trans,er the#4 one record at a ti#e4 ,ro# the ,ile
to the %u,,er.
to the %u,,er.

!O/O. provides the R"A1 ver% ,or this


!O/O. provides the R"A1 ver% ,or this
purpose.
purpose.
&'(2)(12 &'(2)(12 &)*$' A+ &)*$' A+ In,os-s Technologies .i#ited In,os-s Technologies .i#ited
!(+- verb
!(+- verb
synta%
synta%

The 1nternalFilename specified must be a file that has The 1nternalFilename specified must be a file that has
been O6(*ed for 1*6,T. been O6(*ed for 1*6,T.

The *(7T !(CO!- clause is optional and generally The *(7T !(CO!- clause is optional and generally
not used. not used.

,sing 1*TO 1dentifier clause causes the data to be ,sing 1*TO 1dentifier clause causes the data to be
read into the record buffer and then copied from there read into the record buffer and then copied from there
to the specified 1dentifier in one operation. to the specified 1dentifier in one operation.

Hhen this option is used there will be two copies Hhen this option is used there will be two copies
of the data. 1t is the e<uivalent of a !(+- of the data. 1t is the e<uivalent of a !(+-
followed by a 'O&(. followed by a 'O&(.

[ ]
[ ]
R"A1 InternalFilena#e N"BT R"!OR1
INTO Identi,ier
AT "N1 State#ent/loc?
"N1< R"A1
0or?ing o, the R"A1 state#ent
#T,-"!(C
1 & 1 7
8 O T 9 I
2 E / ;
!()*O *+'( +)(
1 $ A 9 N 2 /
(OF
1 2 I 9 A 2 /
& R ! A & ;
& N T 8 2 ;
A
#T,-(*T
A"RFOR+ ;NTI. ST;1<R"! F 9IG9<@A.;"S
R"A1 ST;1FI."
AT "N1 +O@" 9IG9<@A.;"S TO ST;1<R"!
"N1<R"A1
"N1<A"RFOR+.
0or?ing o, the R"A1 state#ent
#T,-"!(C
1 & 1 7
8
O T 9 I 2 E / ;
!()*O *+'( +)(
1 $ A 9 N 2 /
(OF
1 2 I 9 A 2 /
& R ! A & ;
& N T 8 2 ;
A
#T,-(*T
1 & 1 7
8
O
T 9
I 2 E / ;
A"RFOR+ ;NTI. ST;1<R"! F 9IG9<@A.;"S
R"A1 ST;1FI."
AT "N1 +O@" 9IG9<@A.;"S TO ST;1<R"!
"N1<R"A1
"N1<A"RFOR+.
0or?ing o, the R"A1 state#ent
1 & 1 7 8 O T 9 I 2 E / ;
!()*O *+'( +)(
1 $ A 9 N 2 /
(OF
& R ! A & ; A
1 & 2 N I T 9 8 A 2 2 / ;
1 & 2 N I T 9 8 A 2 2 / ;
A"RFOR+ ;NTI. ST;1<R"! F 9IG9<@A.;"S
R"A1 ST;1FI."
AT "N1 +O@" 9IG9<@A.;"S TO ST;1<R"!
"N1<R"A1
"N1<A"RFOR+.
#T,-"!(C
#T,-(*T
0or?ing o, the R"A1 state#ent
1 & 1 7 8 O T 9 I 2 E / ;
!()*O *+'( +)(
(OF
1 & $ R A ! 9 A N 2 & / ;
1 & 2 N I T 9 8 A 2 2 / ;
A
1 & $ R A ! 9 A N 2 & / ; A
A"RFOR+ ;NTI. ST;1<R"! F 9IG9<@A.;"S
R"A1 ST;1FI."
AT "N1 +O@" 9IG9<@A.;"S TO ST;1<R"!
"N1<R"A1
"N1<A"RFOR+.
#T,-"!(C
#T,-(*T
0or?ing o, the R"A1 state#ent
1 & 1 7
8 O
T 9 I 2 E / ;
!()*O *+'( +)(
(OF

1 & 2 N I T 9 8 A 2 2 / ;

1 & $ R A ! 9 A N 2 & / ; A

A"RFOR+ ;NTI. ST;1<R"! F 9IG9<@A.;"S
R"A1 ST;1FI."
AT "N1 +O@" 9IG9<@A.;"S TO ST;1<R"!
"N1<R"A1
"N1<A"RFOR+.
#T,-"!(C
#T,-(*T
&'(2)(12 &'(2)(12 &)*$' A+ &)*$' A+ In,os-s Technologies .i#ited In,os-s Technologies .i#ited
H!1T(
H!1T(
#ynta%.
#ynta%.

To 0RIT" data to a ,ile #ove the data


To 0RIT" data to a ,ile #ove the data
to the record %u,,er (declared in the F1
to the record %u,,er (declared in the F1
entr-) and then 0RIT"
entr-) and then 0RIT"
the contents o,
the contents o,
record %u,,er to the ,ile.
record %u,,er to the ,ile.
[ ] 0RIT"
A1@AN!ING
AdvanceNu#
+ne#onicNa#e
AAG"
RecordNa#e FRO+ Identi,ier

/"FOR"
AFT"R

.IN"
.IN"S

'

1
]
1

'

1
]
1
1
1
1
1
1
F F r r a a n n ' ' C C u u r r t t a a % % n n ( ( ) ) ) ) * * + + , , - - M M . . + + / /
StudentID StudentName
Course.
StudentRecord
F F r r a a n n ' ' C C u u r r t t a a % % n n ( ( ) ) ) ) * * + + , , - - M M . . + + / /
EOF
>ow the H!1T(
>ow the H!1T(
wor?s
wor?s

O.%N OU(.U( Stude+t$i,e*
'O)% 69334567$ra+7 Curtai+ L'516 (O Stude+tDetai,-*
8!I(% Stude+tDetai,-*
'O)% 693#3715(h2ma- Hea,9 L'6#6 (O Stude+tDetai,-*
8!I(% Stude+tDetai,-*
CLOS% Stude+t$i,e*
S(O. !UN*

O.%N OU(.U( Stude+t$i,e*
'O)% 69334567$ra+7 Curtai+ L'516 (O Stude+tDetai,-*
8!I(% Stude+tDetai,-*
'O)% 693#3715(h2ma- Hea,9 L'6#6 (O Stude+tDetai,-*
8!I(% Stude+tDetai,-*
CLOS% Stude+t$i,e*
S(O. !UN*
Students
0or?ing o, the 0RIT" state#ent
#T,-"!(C
1 & 1 7 8 O T 9 I 2 E / ;
!()*O *+'( +)(
(OF
1 & 1 7 8 O T 9
I
2 E ;
+O@" G/;1&178OT9I 2EH TO ST;1<R"!.
0RIT" ST;1<R"!.
+O@" G/;1&2NIT98A 22H TO ST;1<R"!.
0RIT" ST;1<R"!.
/
#T,-(*T
0or?ing o, the 0RIT" state#ent
!()*O *+'( +)(
(OF
1 & 2 N I T 9 8 A 2 2 / ;
1 & 2 N I T 9 8 A 2 2 / ;
1 & 1 7 8 O T
9
I 2 E ; /
#T,-"!(C
#T,-(*T
+O@" G/;1&178OT9I 2EH TO ST;1<R"!.
0RIT" ST;1<R"!.
+O@" G/;1&2NIT98A 22H TO ST;1<R"!.
0RIT" ST;1<R"!.
R"0RIT" ver%
I
R"0RIT" is used to update an e5isting record in
the ,ile
S-nta5
!(H!1T( record"name A F!O' identifier"4 C
*oteJ
I
The !(H!1T( statement can only be used if the file is
opened in the 1"O mode and its e%ecution must be
preceded by the successful !(+- statement on the file.
I
The !(H!1T( statement replaces last read record

!.OS" ver%

S-nta5
CLO#( filename4

!eleases the named files from the program.

1f a file is stored on a magnetic tape$ after the


e%ecution
of the CLO#( statement the tape is rewound.

1s optional for COBOL" K5.


Se=uential ,iles < A Final Look
Advantages
#low " when the hit rate is low.
Complicated to change /insert$ delete0.
Fast " when the hit rate is high.
'ost storage efficient.
#imple organiation.
1is<advantages
+ny
+ny
Buestions LLLL
Buestions LLLL
Than? you
Than? you

You might also like