You are on page 1of 27

File Handling & Temporary

Storage
Day4
2
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
Objectives

Access Methods

!SAM

"DAM

!SAM #onsiderations

$andom access

Se%&ential access

Temporary Storage #ontrol

#ommands to read' (rite and delete

Design considerations

)*amples

Transient Data #ontrol

+ntrapartition TD %&e&es

)*trapartition TD %&e&es

#ommands to read' (rite and delete

)*amples
!
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
#+#S File #ontrol

!SAM

Allo(s read' bro(se' &pdate and delete operations

"DAM

Allo(s read' bro(se and &pdate only

They are less e,,icient than !SAM

#an be replaced by a relative record !SAM dataset or )SDS addressed by


$"A
&
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
Types o, !SAM Files

)SDS - )ntry Se%&enced Data Set

.SDS - .ey Se%&ential Data Set

$$DS - $elative $ecord Data Set


5
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
Alternate +nde*es in !SAM

Accessing same set o, records in di,,erent (ays

Any n&mber o, alternate /eys

Alternate /eys need not be &ni%&e

Only .SDS and )SDS can have alternate /eys


'
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
$andom access - $)AD
MO!) 012 TO 3S-)M4-$)#-5)67
MO!) 892222: TO 3S-)M4-$)#-.);7
MO!) < TO 3S-)M4-.);-5)67
)=)# #+#S $)AD
F+5) >8)M4F+5)9:?
+6TO >3S-)M4-$)#?
5)6@TH >3S-)M4-$)#-5)6?
$+DF5D >3S-)M4-$)#-.);?
.);5)6@TH >3S-)M4-.);-5)6?
)6D-)=)#7

4laces the record in 3S-)M4-$)#


(
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
@)6)$+# $)AD
MO!) 012 TO 3S-)M4-$)#-5)67
MO!) 892: TO 3S-)M4-$)#-.);7
MO!) A TO 3S-)M4-.);-5)67
)=)# #+#S $)AD
F+5) >8)M4F+5)9:?
+6TO >3S-)M4-$)#?
5)6@TH >3S-)M4-$)#-5)6?
$+DF5D >3S-)M4-$)#-.);?
.);5)6@TH >3S-)M4-.);-5)6?
@)6)$+#
)6D-)=)#7
)
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
$)AD #ontin&es777

$)AD #OMMA6D O4T+O6S

)BCA5

@T)B

C4DAT)

$)AD-C4DAT)D$)3$+T)

Maintains e*cl&sive control on the reso&rce>on #+ in case o,


!SAM ,ile? &ntil

$)3$+T) is done

Transaction ends normally or abnormally

#ontrol over reso&rce is released by program &sing C65O#. command7


*
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
$)3$+T)

To re(rite records into ,ile7


)=)# #+#S $)3$+T)
F+5) >8)M4F+5):?
F$OM >3S-)M4-$)#?
5)6@TH >3S-)M4-$)#-5)6?
)6D-)=)#7

This command &pdates a record7

4rior to this command the record m&st be read


(ith a $)AD C4DAT) command7
0
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
3$+T)

To (rite records into ,ile7


MO!) 012 TO 3S-)M4-$)#-5)67
MO!) 899222: TO 3S-)M4-$)#-.);7
MO!) < TO 3S-)M4-.);-5)67
)=)# #+#S 3$+T)
F+5) >8)M4F+5):?
F$OM >3S-)M4-$)#?
5)6@TH >3S-)M4-$)#-5)6?
$+DF5D >3S-)M4-$)#-.);?
.);5)6@TH >3S-)M4-.);-5)6?
)6D-)=)#7

Copyright 2005, Infosys


Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
D)5)T)

$ead the record (ith C4DAT) option and then


delete it (ith the ,ollo(ing command7
)=)# #+#S D)5)T)
F+5)>8)M4F+5):?
)6D-)=)#7

Cse the ,ollo(ing command to delete the record


directly7
MO!) 89AE4<: TO )M4-$)#-.);7
)=)# #+#S D)5)T)
F+5)>8)M4F+5):?
$+DF5D >)M4-$)#-.);?
)6D-)=)#7
2
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
@$OC4 D)5)T)

MO!) 899: TO 3S-)M4-$)#-.);7

MO!) A TO 3S-)M4-.);-5)67
)=)# #+#S D)5)T)
F+5) >8)M4F+5):?
$+DF5D >3S-)M4-$)#-.);?
.);5)6@TH >3S-)M4-.);-5)6?
@)6)$+#
6CM$)# >3S-6CM-$)#-D)5?
)6D-)=)#7
!
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
Transaction deadloc/s

)*cl&sive control on #+7

)*cl&sive control may ca&se transaction


deadloc/s7 Ma/e s&re to &se C65O#. (hen
yo& are not re(riting

+n pse&do-conversation' at the end o,


transaction' all loc/s are released7
&
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
Se%&ential access - "ro(sing

STA$T"$

$)AD6)=T

$)AD4$)!

$)S)T"$

)6D"$
5
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
STA$T"$

This establishes a bro(se session7


)=)# #+#S STA$T"$
F+5) >8)M4F+5):?
$+DF5D >)M4-$)#-.);?
.);5)6@TH>.);-5)6?
@T)BD)BCA5D@)6)$+#
)6D-)=)#7
'
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
$)AD6)=TD$)AD4$)!
)=)# #+#S $)AD6)=TD$)AD4$)!
F+5) >8)M4F+5):?
+6TO >)M4-$)#?
5)6@TH >)M4-$)#-5)6?
$+DF5D >)M4-$)#-.);?
)6D-)=)#7
(
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
$)S)T"$

)stablish a ne( bro(sing position (ith in the


same bro(se7
MO!) 89AE4<: TO )M4-$)#-.);7
)=)# #+#S $)S)T"$
F+5) >8)M4F+5):?
$+DF5D >)M4-$)#-.);?
@T)B
)6D-)=)#7
)
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
)6D"$

)nd bro(se operation


)=)# #+#S )6D"$
F+5) >8)M4F+5):?
)6D-)=)#7
*
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
Se%&ential access !SAM )SDS
Move 5o(-val&es to !SAM-)SDS-$"A
)=)# #+#S STA$T"$
DATAS)T >8,ilename:?
$+DF5D>)SDS-$"A?
$"A
)BCA5
)6D-)=)#
)=)# #+#S $)AD6)=T
DATAS)T >8,ilename:?
+6TO>F+5)-A$)A?
$+DF5D>)SDS-$"A?
5)6@TH>3S-5)6?
$"A
)6D-)=)#
20
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
Temporary Storage

#OMMA$)A >#omm&nication Area?

#3A >#ommon 3or/ Area?

T3A >Transaction 3or/ Area?

TSB >Temporary Storage B&e&e?

TDB >Transient Data B&e&e?


2
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
TSB #ommands

3$+T)B TS
)=)# #+#S 3$+T)B TS
BC)C) >%name?
F$OM >recarea?
5)6@TH >length?
option >option?F
)6D-)=)#7
22
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
TSB #ommands

$)ADB TS
)=)# #+#S $)ADB TS
BC)C) >%name?
+6TO >recarea?
5)6@TH >length?
option
)6D-)=)#
2!
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
TSB #ommands

D)5)T)B TS
)=)# #+#S D)5)T)B TS
BC)C) >%name?
)6D-)=)#7
2&
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
Transient Data B&e&e

A types o, TDB

+ntra-partition

)*tra-partition

Di,,erence bet(een TDB and TSB

TDB to be de,ined in D#T

6o modi,y or $e(rite option in TDB

TDB can be read only se%&entially

A destr&ctive read is per,ormed on TDB

A trigger can be set on +ntrapartition TDB

6o co&nterpart to the MA+6 option available in TSB


25
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
TDB #ommands
)=)# #+#S 3$+T)B TD
BC)C) >%name?
F$OM >recarea?
5)6@TH >length?
)6D-)=)#
)=)# #+#S $)ADB TD
BC)C) >%name?
+6TO >recarea?
5)6@TH >length?
)6D-)=)#
)=)# #+#S D)5)T)B TD
BC)C) >%name?
)6D-)=)#
DFHD#T entry
T;4)G+6T$A
D)ST+DG%name
T$A6S+DG)M45
T$+@5)!GA222
2'
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
S&mmary

3hat is !SAMH

3hat are the types o, !SAM ,ilesH

3hen do transaction deadloc/s happen and ho(


to avoidH

3hat are the commands ,or se%&ential accessH

Ho( is se%&ential access o, )SDS doneH

3hat is the di,,erence bet(een TSB and TDBH

3hat are the commands &sed to access TSB and


TDBH
2(
Copyright 2005, Infosys
Technologies Ltd
ER/CORP/CRS/TP0/00!
"ersion #o$ %0
Than/ ;o&I

You might also like