VSAM KSDS and COBOL .


38 views
Uploaded on:
Category: Art / Culture
Description
2. Preparing a KSDS. KSDS can be prepared 3 waysSequentiallyRecords got to in key sequenceRandomlyRecords got to by means of a predetermined key valueDynamicallyRecords got to both successively and haphazardly. 3. Successively Processing a KSDS. Access records in climbing request on the file\'s key fieldUsually start with the first record and procedure to the end.
Transcripts
Slide 1

VSAM KSDS and COBOL Department of Computer Science Northern Illinois University August 2005 Some of the delineations are from VSAM: Access Method Services and Programming Techniques by James Martin

Slide 2

Processing a KSDS can be handled 3 ways Sequentially Records got to in key arrangement Randomly Records got to by means of a predetermined key esteem Dynamically Records got to both consecutively and arbitrarily

Slide 3

Sequentially Processing a KSDS Access records in rising request on the document\'s key field Usually start with the principal record and procedure to the end

Slide 4

File-Control for Sequential KSDS File-Control. SELECT record name ASSIGN to ddname ORGANIZATION is INDEXED ACCESS MODE is SEQUENTIAL RECORD KEY is information name-1 FILE STATUS is information name-2.

Slide 5

File-Control for Sequential KSDS File-Control. SELECT record name where document name is the name utilized for the file all through the program

Slide 6

File-Control for Sequential KSDS File-Control. Relegate to ddname where ddname is the ddname in the JCL used to allude to the KSDS document

Slide 7

File-Control for Sequential KSDS File-Control. Association is INDEXED where INDEXED determines that this record is a KSDS

Slide 8

File-Control for Sequential KSDS File-Control. Get to MODE is SEQUENTIAL where SEQUENTIAL indicates that the processing of the KSDS will be in order on the key field of the document

Slide 9

File-Control for Sequential KSDS File-Control. RECORD KEY is information name-1 where information name-1 is the document\'s key field and the records will be accessed rising on this field information name-1 must show up in the\'s record portrayal in the FILE SECTION

Slide 10

File-Control for Sequential KSDS File-Control. Document STATUS is information name-2 where information name-2 is a recorded you indicate in which VSAM gives data about every I/O operation VSAM places an arrival code in information name-2 for the application program to decide the aftereffect of the I/O operation

Slide 11

Common File Status for KSDS

Slide 12

FD Statement in KSDS FD KSDS-record LABEL RECORDS ARE [OMITTED or STANDARD]. Regarded as a remark however is required

Slide 13

Procedure Division in KSDS Sequential Processing OPEN articulation START explanation READ proclamation WRITE articulation REWRITE proclamation DELETE articulation CLOSE proclamation

Slide 14

KSDS OPEN Statement OPEN articulation (successively) Must open all documents Loading consecutively OPEN OUTPUT ksds-record. Recovering successively OPEN INPUT ksds-record.

Slide 15

KSDS START Statement START explanation Used to begin consecutive handling with a record other than the primary record in the document Use with a record that is opened as information or powerfully (I-O) and preparing successively To utilize, put an esteem in the record key zone

Slide 16

KSDS START Statement START articulation START vsam-record [KEY IS {EQUAL TO = GREATER THAN > NOT LESS THAN NOT < GREATER THAN OR EQUAL TO >= } record-key] [INVALID KEY basic 1] [NOT INVALID KEY basic 2] [END-START]

Slide 17

KSDS READ Statement READ proclamation (successive) To recover records in key arrangement, open KSDS for either INPUT or I-O

Slide 18

KSDS READ Statement READ explanation (successive) READ document name RECORD [INTO area] [AT END basic 1] NOT AT END basic 2] [END-READ]

Slide 19

KSDS READ Statement READ proclamation (consecutive) READ record name [NEXT] Specify NEXT on the READ proclamation to recover records consecutively when record is opened for I-O Omit NEXT when record is opened for I-O and the records will be recovered haphazardly in light of the esteem in the RECORD KEY field

Slide 20

KSDS READ Statement READ articulation (successive) The key utilizing dynamic get to is knowing how to change from successive to irregular get to. The position for successive recovery is changed just by a START or an irregular READ explanation.

Slide 21

KSDS READ Statement READ articulation (consecutive) An irregular READ explanation can be utilized to recover a particular record and after that can be trailed by a successive READ proclamation (utilizing the NEXT alternative)

Slide 22

KSDS WRITE Statement WRITE proclamation (successive) KSDS must be opened for OUTPUT for document creation (stacking of information) I-O for document increases An esteem must be put into the essential key field preceding the compose

Slide 23

KSDS WRITE Statement WRITE articulation (consecutive) WRITE record-name [FROM area] [INVALID-KEY basic 1] [NOT INVALID-KEY basic 2] [END-WRITE]

Slide 24

KSDS WRITE Statement WRITE explanation (consecutive) INVALID-KEY basic 1 is executed when the esteem put away in the essential key field preceding issuing the WRITE is equivalent to that of a record as of now in the record an endeavor is made to compose past the limits of the record the essential key is not more prominent than the essential key of the past record AND the document is opened for OUTPUT and successive getting to is determined

Slide 25

KSDS REWRITE Statement REWRITE articulation (consecutive) the KSDS must be opened for I-O the record to be modified should be the last record read from the document must read the record preceding revising it

Slide 26

KSDS REWRITE Statement REWRITE explanation (successive) REWRITE record-name [FROM area] [INVALID KEY basic 1] [NOT INVALID KEY basic 2] [END-REWRITE]

Slide 27

KSDS REWRITE Statement REWRITE proclamation (consecutive) [INVALID KEY basic 1] is executed when the record to be changed does not exist in the record consecutive get to is indicated and the esteem put in the essential key doesn\'t equivalent the essential key fo the already read record

Slide 28

KSDS DELETE Statement DELETE explanation (successive) KSDS opened as I-O erase the record read in the last READ proclamation the space in KSDS is instantly accessible for reuse

Slide 29

KSDS DELETE Statement DELETE proclamation (consecutive) DELETE document RECORD [INVALID-KEY basic 1] [NOT INVALID-KEY basic 2] [END-DELETE]

Slide 30

KSDS DELETE Statement DELETE proclamation (successive) [INVALID-KEY basic 1] is executed when an endeavor to erase a record that does not exist is put forth

Slide 31

KSDS CLOSE Statement CLOSE articulation (consecutive) list the KSDS that will be shut

Slide 32

KSDS Load Program in COBOL Go over present "COBOL JCL & Source Review for Loading KSDS"

Slide 33

KSDS Random Processing All I/O operations rely on the record key Before READ an esteem must be in the record key Before WRITE an esteem must be in the record key

Slide 34

File-Control for Random KSDS File-Control. SELECT document name ASSIGN to ddname ORGANIZATION is INDEXED ACCESS MODE is RANDOM RECORD KEY is information name-1 FILE STATUS is information name-2.

Slide 35

File-Control for Random KSDS File-Control. Get to MODE is RANDOM The main distinction in the SELECT proclamation for arbitrary preparing is the word RANDOM get to

Slide 36

Procedure Division in KSDS Random Processing OPEN articulation READ explanation WRITE explanation REWRITE explanation DELETE articulation CLOSE articulation

Slide 37

KSDS OPEN Statement OPEN proclamation (irregular) Must open all documents Retrieving arbitrarily OPEN INPUT ksds-record. Composing arbitrarily OPEN OUTPUT ksds-record. Perusing, reworking and erasing haphazardly OPEN I-O ksds-document.

Slide 38

KSDS READ Statement READ articulation (irregular) To recover records based upon esteem in the record key field, open KSDS for either INPUT or I-O

Slide 39

KSDS READ Statement READ explanation (arbitrary) To recover records based upon esteem in the record key field, open KSDS for either INPUT or I-O

Slide 40

KSDS READ Statement READ proclamation (arbitrary) READ document name RECORD [INTO area] [KEY IS information name-1] [INVALID KEY basic 1] NOT INVALID KEY basic 2] [END-READ]

Slide 41

KSDS READ Statement READ articulation (arbitrary) [KEY IS information name-1] The key estimation of the record that will be recovered from the KSDS must be set in information name-1 preceding issuing the READ articulation.

Slide 42

KSDS READ Statement READ explanation (irregular) when summoned examination is made between the estimation of the field determined in the RECORD KEY proviso of the SELECT articulation (known as "key of reference") and the key estimations of the KSDS records hunt is done through the file suitable control interim is perused into memory and successively looked

Slide 43

KSDS WRITE Statement WRITE proclamation (arbitrary) WRITE record-name [FROM area] [INVALID-KEY basic 1] [NOT INVALID-KEY basic 2] [END-WRITE]

Slide 44

KSDS WRITE Statement WRITE proclamation (arbitrary) used to add records to a document KSDS utilizes the RECORD KEY esteem to compose the record in its legitimate physical area

Slide 45

KSDS REWRITE articulation REWRITE proclamation (arbitrary) REWRITE record-name [FROM area] [INVALID KEY basic 1] [NOT INVALID KEY basic 2] [END-REWRITE]

Slide 46

KSDS REWRITE articulation REWRITE explanation (arbitrary) used to redesign a record in its unique physical area KSDS utilizes the RECORD KEY esteem to change the record in its appropriate physical area

Slide 47

KSDS DELETE Statement DELETE proclamation (irregular) DELETE RECORD [INVALID-KEY basic 1] [NOT INVALID-KEY basic 2] [END-DELETE]

Slide 48

KSDS DELETE Statement DELETE proclamation (irregular) used to erase a record from its physical area KSDS utilizes the RECORD KEY esteem to discover the record to erase

Slide 49

KSDS CLOSE Statement CLOSE explanation (irregular) list the KSDS that will be shut

Slide 50

KSDS Dynamic Processing can be a blend of consecutive and irregular All the announcements continue as before with the exception of the SELECT and the successive READ

Slide 51

KSDS Dynamic Processing Using dynamic preparing adequately is knowing how to change from consecutive to arbitrary get to position for successive recovery by a START or arbitrary READ issue READ utilizing NEXT for sequ

Recommended
View more...