Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential VSAM.

Similar presentations


Presentation on theme: "Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential VSAM."— Presentation transcript:

1 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential VSAM

2 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential Overview VSAM is a high performance access method It is used to organize, store, catalog, retrieve and delete datasets Portable & OS independent Integrity of VSAM Datasets in cross system or cross region needs to be controlled

3 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential Advantages Data can be accessed faster Records can be inserted in an efficient manner. There is less reorganization after insertion of data Deletion of records results in them being physically removed from the disk. Records can be accessed sequentially and randomly JCL required to access VSAM data sets are much simpler

4 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential Disadvantages VSAM data sets require more storage space than other types of datasets. This is because we carry control information in them in addition to the actual data that they are comprised of VSAM data sets require additional storage due to free space that must be embedded in them This free space results in more efficient management of the data contained in them when records are added, deleted or changed

5 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential Catalog Two types – Master & User User catalogs could be unlimited Intention of VSAM catalog is to replace VTOC. For this VSAM Catalogs contain descriptive file information as well as allocation information. VSAM makes an entry in volumes VTOC’s for space. To avoid Duplicate allocation information, ICF is used from 1980’s. Space allocation for VSAM & non VSAM stored in VTOC.

6 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential ACCESS METHOD SERVICES CREATE VSAM OBJECTS LOADING UNLOADING LIST CATALOG INFORMATION MODIFY DATA SET ATTRIBUTES COPYING DELETE VSAM OBJECTS LIST DATA SETS IDCAMS

7 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential LR Logical Record LR C1 LR CA VSAM Building Block

8 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential LR1LR2LRnUnused space R D Fn Format R D F2 R D F1 C1 DF 100 Bytes Free Space R D Fn R D Fn R D Fn R D Fn Example 100 Bytes 150 Bytes C1 DF Logical Record areaControl Field Unused Space Control Interval Format

9 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential Control Interval Unit of data vsam transfers – 512K – 32K CONTROL FIELD -RDF – RECORD DESCRIPTION FIELD – contains information about the Record. Fixed or Variable length etc. 3 bytes long.A CI can have one or more RDFs(fixed, variable) -CIDF – CONTROL INTERVAL DEFINITION FIELD – contains information about the free space within the CI – 4 bytes DATA - LOGICAL RECORD AREA -Logical records -Unused space -Free space

10 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential Control Area Format LR1LR2LRnUnused space R D Fn R D F2 R D F1 C1 DF LR R D F2 R D F1 C1 DF LR R D F2 R D F1 C1 DF LR C1 DF Unused Space C1 DF Unused Space controlareacontrolarea LR

11 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential VSAM Cluster Types Linear Data SetLDS Relative Record Data SetRRDS Entry Sequenced Data SetESDS Key Sequenced Data SetKSDS

12 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential KSDS KSDS records are organized by a unique key field. KSDS records can be accessed randomly, if the value of the key field is known KSDS records can also be searched sequentially. KSDS datasets contain 2 parts. -The first part contains information relating to the index component. It contains an entry with the key field and a pointer to the location of its corresponding record. - The second part contains the data component, the data component contains the individual records belonging to that dataset, in addition to the key field.

13 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential KSDS KSDS dataset can include alternative index in addition to the primary index Alternative indexes need not be unique KSDS records are inserted in ascending order of the prime key field. When they are deleted, they are physically removed from the device, resulting in space being freed up for other insertions

14 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential Data/Index Relationship Cl 1 Cl 2 Cl 3 Cl 4 CA 1 Cl 1 Cl 2 CA 2 Cl 1 Cl 2 CA 3 Cl 1 Cl 2 CA 4 Cl 1 Cl 2 CA 5 Cl 1 Cl 2 CA 6 Data Component IS 1 IS 2IS 3 SS 1SS 2 SS 3 SS 4SS 5 SS 6 Index Component

15 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential KSDS Access 079236 007021079FS099124238FS Index Component 001002004007 008012018021 087079 084087099 111124 238 Data Component Control Areas

16 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential Loading A KSDS 403740654077FS 4012402340344037Free Space 4041405040524065Free Space 4072407340754077Free Space Cl 0 Cl 1 Cl 2 Cl 3 DATA CADATA CA Sequence Set CI

17 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential Updating A KSDS 403740654077FS 4012402340344037Free Space 40414050405240584065 4072407340754077Free Space Cl 0 Cl 1 Cl 2 Cl 3 DATA CADATA CA Sequence Set CI Insert 4058

18 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential Control Interval Split 4037405040654077... 4012402340344037Free Space 404140464050Free Space 4072407340754077Free Space Cl 0 Cl 1 Cl 2 Cl 3 DATA CADATA CA Sequence Set CI Insert 4046 405240584065Free Space

19 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential Control Area Split 4037405040654077 4012402340344037Free Space 404140464050Free Space 4072407340754077Free Space Cl 0 Cl 1 Cl 2 Cl 3 Sequence Set CI Insert 4074 405240584065Free Space BEFOREAFTER Cl 0 Cl 1 Cl 2 Cl 3 Cl 0 Cl 1 Cl 2 Cl 3 CA1 CA2 Sequence Set CIs Index Set CIs

20 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential RECORDS TRACKS CYLINDERS (primary, [secondary]) EXAMPLES: RECORDS(2000,5) TRACKS(100, 3) CYLINDERS(10,1) CYLINDERS(1) Data Set Space Allocation

21 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential DETERMINED BY VSAM: ALLOCATION CA SIZE CYLINDERS1 CYLINDER TRACKS/RECORD Smaller of primary & secondary, not to exceed 1 cylinder EXAMPLES: ALLOCATION CA SIZE TRACKS(100,3) RECORDS(2000,5) CYLINDERS(10,1) CYLINDERS (1) CONTROL AREA & SIZE

22 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential AMS COMMANDS DEFINE CLUSTER – Define data set NAME(name.type) – Specification of the name and the type of the data set. VOLUMES(volume-no), CYLINDERS(primary, secondary) – Specification of volume for its storage CISZ – Specification of the size of the CI for the data component of the file FREESPACE(CIPERCENT, CAPERCENT) - Specification of free space between CI and within CA

23 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential AMS COMMANDS KEYS(N1, N2) – Size of key (n1 is length and n2 is starting bit position RECORDSIZE(N1, N2) – Specification of record type and size. N1 specifies the average record length and N2 specifies the max record length. DATA(NAME(DATA-NAME)) – Specification of name for data component of file INDEX(NAME(C-NAME)) – Specification of name for index component of file

24 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential EXAMPLE //SYSIN DD * DEFINE CLUSTER- (NAME (KRV1158.KSDS2)- INDEXED- VOLUME (*)- RECORDSIZE (80, 80)- KEYS (5, 1) )- DATA- (NAME (KRV1158.KSDS2.DATA)- CISZ(4096)- RECORD(300 100) )- INDEX- (NAME(KRV1158.KSDS2.INDEX)- IMBED) //* IMBED – SS is copied in first track of CA access is fast -

25 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential ESDS ESDS have the data component only and do not have a prime key index component. They do not have a embedded free space Records can be fixed or variable record length. ESDS records are always added at the end of the dataset. On deletion they continue to reside on the disk that they were originally stored, and are not physically removed ESDS will result in waste space when there are multiple record deletes

26 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential ESDS Defining ESDS is similar to KSDS, but with the following differences -Parameters related to the Key field are not coded when defining an ESDS -An ESDS can have only data component, so parameters related to the index component are not coded. -The INDEXED parameter is replaced by NONINDEXED parameter -The FREESPACE parameter is not coded, since an ESDS has no embedded free space between records.

27 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential EXAMPLE //* TO CREATE A ENTRY SEQUENTIAL DS … // KRV1158A JOB IRBR212B000T, ’KARTREX ‘, // MSGLEVEL=(1,1) //SYSIN DD * DEFINE CLUSTER- (NAME (TSOJAYA.TEST.ESDS)- NIXD- VOLUME(*)- RECORDSIZE(80,80)- CISZ(4096) )- )- DATA- (- NAME(TSOJAYA.ESDS.DATA)- )

28 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential Relative Record Data Set (RRDS) SLOT1SLOT2SLOT3SLOT4SLOT5 C10 SLOT6SLOT7SLOT8SLOT9SLOT10 C10 SLOT11SLOT12SLOT13SLOT14SLOT15 C10 SLOT16SLOT17SLOT18SLOT19SLOT20 C10 DATACADATACA SLOT21SLOT22SLOT23SLOT24SLOT25 C10 SLOT26SLOT27SLOT28SLOT29SLOT30 C10 SLOT31SLOT32SLOT33SLOT34SLOT35 C10 SLOT36SLOT37SLOT38SLOT39SLOT40 C10 DATACADATACA

29 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential RRDS An RRDS consists of fixed length slots. Records are accesses by their position in the file relative to the first slot. The relative position of each slot is called the RRN (Relative record number). RRDS can be retrieved randomly by RRN or sequentially They are always of a fixed length. RRDS data sets contain data component only. There is no index component

30 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential RRDS RRDS records may be retrieved, inserted, deleted, updated randomly or sequentially On deletion the record is removed from its slot, but the slot continues to exist for subsequent insertions. On defining an RRDS -Parameters related to the key field are not coded -FREESPACE parameter is not coded. -The keyword NUMBERED IS CODED TO indicate that this is an RRDS -The RECORDSIZE parameter should be identical

31 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential EXAMPLE //*TO CREATE A RELATIVE RECORE DS … //EXAM EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSINDD* DEFINE CLUSTER (NAME (TSOJAYA.TEST.RRDS) NUMBERED VOLUME(*) RECORDSIZE(180,180) CISZ(4096) ) DATA (NAME(TSOJAYA.RRDS.DATA) RECORDS(50000 1000) )

32 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential Loading VSAM Datasets After a dataset has been defined successfully, records can be loaded into it. There are two ways to accomplish this Code REPRO command in the SYSIN statement of IDCAMS utility Code COBOL programs to read records from an input dataset and write them to an output dataset.

33 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential REPRO The input file must be a KSDS, ESDS, RRDS, physical sequential file The output file should also be KSDS, ESDS, RRDS, physical sequential file The input file should be sorted on the primary key using SORT command The following is specified in the command -The name of the input dataset -The name of the output data set. FORMAT REPRO INFILE(DD name of input file/ Input dataset) OUTFILE(DD name of output file/ Output dataset)

34 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential REPRO //* TO COPY FROM VSAM TO SEQUENTIAL DS USING REPRO //EXAM EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //MASTER DD DSN=TSOJAYA.TEST.KSDS,DISP=OLD //BKUP DD DSN=TSOJAYA.TEST.DATA,DISP=(NEW,CATLG) //SYSIN DD* REPRO INFILE(MASTER) OUTFILE(BKUP) /* //

35 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential REPRO - Options SKIP(n) – Skips selected records from the input file. n is the number of records from the start of the file which are to be skipped in copy COUNT(n) - n is the number of records that are to be copied FROMKEY(n1) TOKEY(n2) – Copy records between two keys (KSDS only) FROMNUMBER(N1) TONUMBER(N2) – Copy records between two relative record numbers

36 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential Printing VSAM datasets The PRINT command can be coded on the SYSIN statement of the IDCAMS utility to print both VSAM and Non-VSAM dataset Printouts can be obtained in any of the formats -Hexadecimal (HEX) -Character(CHAR) FORMAT -PRINT INFILE( DD name of the dataset) -PRINT INFILE( data-set-name) The same key words in REPRO command can be coded with the PRINT command to print the selected records.

37 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential PRINT //TSOSHANX JOB (N189),'XXX', CLASS=D, MSGCLASS=X, NOTIFY=TSOJAYA //STEP01 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * PRINT INDATASET('TSOJAYA.TRG.KSDS') CHAR /* //

38 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential Creation of an Alternate Index The IDCAMS utility is used to create an alternate index for an existing base cluster. Once the index has been identified, records have to be loaded into it. But before it can be defined, the following items must be specified to the operating system: -The name of the alternate index -Name of the base cluster that it relates to -Key size (length) and starting location in the base cluster record -The size and type of the individual records that the alternate index will contain

39 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential Creation of an Alternate Index How much space should be allocated to it. Whether the alternate index key will contain unique values only or duplicates Whether or not the alternate index is to be updated each time its corresponding base cluster is updated How much free space should be allocated to its control intervals

40 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential //ALT1JOB(A123), ‘C. CHASE’ //STEP1EXECPGM=IDCAMS //SYSPRINTDDSYSOUT = A //SYSINDD* DEFINE AIX (NAME (BOOKS.KSDS.AIDX.CLUSTER) RELATE (BOOKS.KSDS.CLUSTER) KEYS (84,36) CYLINDERS (2,1) NONUNIQUEKEY UPGRADE RECORDSIZE (!24, 124) FREESPACE (20, 20) DATA ( NAME(BOOKS.KSDS.AIDX.DATA) ) INDEX ( NAME (BOOKS.KSDS.AIDX.INDEX) ) /* //

41 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential EXAMPLE //JOBCARD //S1 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DEFINE AIX (NAME( )- RELATE(BC)- KEYS(6,3)- CYLINDERS(2,1)- UPGRADE- NONUNIQUEKEY- RECORDSIZE(20,20)- DATA- ( NAME( )) INDEX (NAME( )) /* //

42 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential Building an Index The DEFINE PATH command is used to define a path. Here’s the JCL: //JOB1JOBA123, ‘J FARREL’ //STEP1EXECPGM = IDCAMS //SYSPRINTDDSYSOUT = A //SYSINDD* DEFINE PATH ( NAME (BOOKS.KSDS.PATH1) PATHENTRY (BOOKS.KSDS.AIDX.CLUSTER) UPDATE ) /* //

43 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential PATH provides a logical link between AI & base Index. If DS is accessed via PATH both Alternate & BC indexes are open & system finds Primary key value based ON AI without any coding by the programmer. When AI is updated automatically based on addition, deletion etc in BC, it is classified under the upgrade set of BC. The update parameter in the PATH indicates that BC & upgrade set should be opened automatically. If NOUPDATE is mentioned only the BC would be opened & not its upgrade set.

44 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential LOADING RECORDS BLDINDEX //JOBCARD //BC DD DSN= ….KSDS,DISP=SHR //AI DD DSN=……AIX,DISP=OLD //SYSIN DD * BLDINDEX INFILE(BC)- OUTFILE(AI) /* //

45 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential Listcat LISTCAT ENTRIES(TSOSHAN.TRG.KSDS) OR LISTCAT ENTRIES(TSOSHAN.TRG.KSDS – TSOSHAN.TRG.KSDS1 ) Options History Allocation ALL

46 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential ALTER ALTER TSOSHAN.TRG.KSDS4 – NEWNAME(TSOSHAN.TRG.KSDS5) ALTER TSOSHAN.TRG.KSDS5 – ADDVOLUMES(VOL18,VOL12) ALTER TSOSHAN.TRG.KSDS5 – FREESPACE(10 10)

47 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential Keylength / offset cannot be changed, if records are loaded into it. Average or maximum record size cannot be changed. WRITEPROTECT DS //SYSIN DD * ALTER TSOSHAN.TRG.KSDS9.DATA INHIBIT TSOSHAN.TRG.KSDS9.INDEX INHIBIT /*

48 Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential SHAREOPTIONS 1.CROSSREGION 2.CROSSSYSTEM (3 OR 4) 1 TWO OR MORE JOBS CAN SHARE AFILE 2. JOBS ON A DIFFERENT SYSTEM SHARE FILES CROSSREGION 1 MULTIPLE JOBS CAN ACCESS FILE FOR INPUT AS LONG AS ALL JOBS USE IT FOR INPUT. IF A JOB OPENS IT FOR O/P OTHER JOBS CANNOT ACCESS 2 MULTIPLE JOBS CAN ACCESS FILE AS LONG AS ONLY ONE JOB OPENS THE FILE FOR O/P. OTHER JOBS USE THE SAME FOR I/P ONLY 3 NO INTEGRITY 4 MULTIPLE JOBS PROCESS FILES FOR I/P OR O/P.BUT DATA MAY NOT BE ADDED TO EOF & CI SPLIT NOT ALLOWED


Download ppt "Ver 1.0/ 3 rd Sep 2001 Classification : InternalProprietary & Confidential VSAM."

Similar presentations


Ads by Google