VSAM INFORMATION INFORMATION TAKEN FROM: VSAM ACCESS METHOD SERVICES AND PROGRAMMING TECHNIQUES, BY JAMES MARTIN.... . VSAM - VERY POPULAR ACCESS METHOD .. INTRODUCED BY IBM IN THE 1970S ALONG WITH THE IBM SERIES 370 MACHINES. .. REPLACED OLDER ACCESS METHODS (ISAM, BDAM, AND VIRTUAL COUNTERPARTS.) .. IS THE UNDERLYING DATA MANAGEMENT ACCESS METHOD THAT MOST HIGH PERFORMANCE DATA BASE SYSTEMS FOR IBM USE. .. A THOROUGH KNOWLEDGE OF VSAM IS REQUIRED. .. WIDELY USED FOR MANY FORMS OF FILE ACCESS .. MOST MAINFRAME IBM USERS STILL USE VSAM. .. YOUR KNOWLEDGE OF VSAM WILL SUPPORT YOUR STUDIES IN DATABASE PROCESSING AND ALL DIRECT FILE ACCESSING USING IBM MAINFRAMES.... 1 VSAM DATA SET STRUCTURE: . VSAM DATA SET IS OFTEN CALLED A "CLUSTER." . A KSDS CLUSTER CONSISTS OF A .. DATA COMPONENT OF CONTROL INTERVALS CONTAINING RECORDS, FREE SPACE, CONTROL INFORMATION, .. INDEX COMPONENT USED TO LOCATE RECORDS. . ESDS & RRDS CONSISTS OF DATA COMPONENT ONLY. .. KSDS = KEY SEQUENCED DATA SET(INDEXED FILE) .. RRDS = RELATIVE RECORD DATA SET (RELATIVE I/O) .. ESDS = ENTRY SEQUENCED DATA SET (SEQUENTIAL FILE) . VSAM KSDS FACILITY PROVIDES THE WIDEST RANGE OF FEATURES AND CAPABILITIES, AND KSDS CLUSTERS ARE MORE WIDELY USED THAN EITHER DSDS OR RRDS CLUSTERS. . WILL DISCUSS RRDS CLUSTERS LATER 2 ACCESS METHOD SERVICES (AMS) . SUPPLIED WITH VSAM . IS A GENERAL-PURPOSE UTILITY PROGRAM . USED for WIDE RANGE OF FUNCTIONS TO SUPPORT VSAM DATA SETS AND THEIR APPLICATIONS. SUCH FUNCTIONS INCLUDE: 1. DEFINING, ALTERING, AND DELETING VSAM DATA SETS 2. LISTING AND MAINTAINING VSAM CATALOG ENTRIES 3. LOADING, COPYING, AND PRINTING VSAM DATA SETS 4. CONSTRUCTING ALTERNATE INDEXES 5. RECOVERING FROM VARIOUS TYPES OF ERRORS 6. PORTING DATA SETS BETWEEN OPERATING SYSTEMS THE JCL SUPPORTING VSAM ACTIVITIES IS COMPLEX. VSAM TRIES TO SIMPLIFY THE JCL AND CREATES MANY OF THE SUPPORT UNDERLYING DATA STRUCTURES (LIKE CATALOGS, INDEXES, AS NEEDED FOR VSAM) AS WELL AS PROVIDING SEVERAL UTILITY PROGRAMS THAT ARE DESIGNED TO ACCESS VSAM FILES, SUCH AS VSAM PRINT, VSAM REPRO, AND MORE. BUT, IN ORDER FOR VSAM TO DO THESE THINGS FOR YOU, YOU MUST SET UP YOUR OWN VSAM ENVIRONMENT, WHICH INCLUDES FORMATTING YOUR OWN ADISK@ IN A MANNER THAT IS ACCESSIBLE BY THE SERVICES PROVIDED BY VSAM. YOU MUST THEN DEFINE YOUR MASTER CATALOG, SO VSAM CAN FIND YOUR FILES. 3 YOU MUST ALLOCATE THE PHYSICAL SPACE ON DISK FOR YOUR CLUSTER (DATA PORTION AND INDEX PORTION). YOU MUST NAME THESE FILES AND REQUEST A CERTAIN AMOUNT OF DISK SPACE. YOU MUST TELL THE VSAM UTILITIES (THAT DEFINE YOUR CLUSTER FOR YOU) YOUR RECORD SIZE, HOW MANY TRACKS OF DISK TO ALLOCATE FOR YOUR FILE, THE LOCATION AND SIZE OF YOUR RECORD KEY, THE NAMES OF YOUR DATA AND INDEX FILES, AND MORE. GIVEN THAT YOU HAVE A CATALOG, HAVE ALLOCATED SPACE, HAVE DESCRIBED SEVERAL OF YOUR RECORD AND FILE PARAMETERS, THEN, UPON REQUEST, VSAM CAN CREATE A VSAM FILE DIRECTLY FOR YOU FROM YOUR SORTED SEQUENTIAL FILE. (YOU MAY CREATE YOUR OWN FILE VERY EASILY TOO WITHOUT THE VSAM REPRO BY SIMPLY CREATING THE FILE (AFTER SPACE, ...., HAS BEEN NAMED) VIA A COBOL PROGRAM. REMEMBER: ACCESS IS SEQUENTIAL, OPEN FOR OUTPUT, ORG IS INDEXED, RECORD KEY IS WHATEVER....(AND ALTERNATE KEYS SPECIFIED, IF ANY). ONCE THIS FILE IS CREATED, YOU ARE ON YOUR WAY WITH THE COBOL INSTRUCTIONS AND TECHNIQUES DISCUSSED IN CLASS AND IN YOUR TEXTBOOK. BUT, IN ITS INFINITE KINDNESS, VSAM ALSO GIVES YOU MANY UTILITIES THAT YOU MAY USE AS NEEDED. A FEW INCLUDE: A PRINT FACILITY, A DELETE FACILITY, A LIST CATALOG FACILITY, A VERIFY FACILITY, AND OTHERS. 4 VSAM STORAGE STRUCTURES . KSDS HAS AN INDEX COMPONENT AND A DATA COMPONENT . PHYSICAL I/Os DONE WITH BLOCKS IN CONVENTIONAL ACCESS METHODS. IN VSAM, PHYSICAL I/O DONE IN CONTROL INVERVALS. . A CONTROL INTERVAL CONTAINS 1. RECORDS 2. CONTROL INFORMATION (record descriptors) 3. FREE SPACE (FOR EXPANSION) R E C 1 RE C 2 R E C 3 R E C 4 FREE SPACE C T L I N F O CONTROL INTERVAL AT LOAD TIME: CONTROL INTERVALS ARE CREATED RECORDS WRITTEN INTO THEM. CONTROL INTERVALS GROUPED INTO CONTROL AREAS. CONSIDER THE FOLLOWING DRAWING: 5 INDEX COMPONENT … INDEX SET SEQUENCE SET . . . DATA COMPONENT CONTROL INTERVALS . . . CONTROL AREA CONTROL AREA 6 CONTROL AREA . THE INDEX IS USED TO LOCATE RECORDS IN THE DATA COMPONENT. . INDEX COMPONENT CONSISTS OF: .. INDEX SET AND .. SEQUENCE SETS . ONE SEQUENCE SET IS NEEDED FOR EACH CONTROL AREA . ONE ENTRY WITHIN EACH SEQUENCE SET FOR EACH CONTROL INTERVAL WITHIN THAT CONTROL AREA. . THE RECORDS IN EACH CONTROL INTERVAL ARE MAINTAINED IN PHYSICAL SEQUENCE BY KEY VALUE, AND SEQUENCE SET ENTRIES MAINTAIN THE LOGICAL SEQUENCE OF THE CONTROL INTERVALS WITHIN EACH CONTROL AREA. . CONTROL INTERVALS IN A CONTROL AREA ARE NOT NECESSARILY IN PHYSICAL SEQUENCE ACCORDING TO THE KEY VALUES OF THE RECORDS CONTAINED IN THEM. THE SEQUENCE SETS ORDER THE CONTROL INTERVALS WITHIN CONTROL AREAS. . IF THERE IS MORE THAN ONE CONTROL AREA, THEN THERE IS AN INDEX SET IN ADDITION TO THE SEQUENCE SETS. . AN ENTRY IN THE INDEX SET POINTS TO EACH SEQUENCE SET. SO ONCE THERE IS MORE THAN ONE CONTROL AREA, THERE IS MORE THAN ONE SEQUENCE SET. . THUS WE HAVE THE INDEX SET TO MANAGE THE SEQUENCE SETS. . THUS TO ACCESS RECORDS, WE HAVE A TREE STRUCTURE, INDEX SET => SEQUENCE SET => CONTROL INTERVAL (TWO LEVELS OF INDICES) THIS HIERARCHY GENERALIZES.... CAN HAVE MULTIPLE INDEX SETS FOR EXTREMELY LARGE KSDSs. 7 PLEASE NOTE (TO KEEP THINGS IN PERSPECTIVE) THAT KSDS CONTROL AREAS ARE QUITE LARGE AND MAY CONTAIN THOUSANDS OF RECORDS. A KSDS WOULD HAVE TO BE VERY LARGE TO REQUIRE TWO LEVELS OF INDEX SET RECORDS AND WOULD HAVE TO CONTAIN LITERALLY MILLIONS OF RECORDS BEFORE THREE LEVELS OF INDEX SET RECORDS WOULD BE REQUIRED. MORE NOTES: . ONE SEQUENCE SET PER CONTROL AREA . SEQUENCE SET ENTRY POINTS TO HIGHEST RECORD IN CONTROL INTERVAL . FREE SPACE IN CONTROL INTERVALS (FOR DATA AND SEQUENCE SETS TOO.) . CAN ALSO HAVE FREE CONTROL INTERVALS IN A CONTROL AREA (FOR GROWTH AND CONTROL INTERVAL SPLITTING) THINK: (WHILE NOT ABSOLUTELY TRUE, THIS MAY HELP...) CONTROL INTERVALS: RECORDS IN BLOCK OR TRACK CONTROL AREAS: TRACKS (NOT NECESSARILY CONTIGUOUS) IN A CYLINDER. . CONTROLLED/ACCESSED BY SEQUENCE SETS INDEX SETS: POINT TO DIFFERENT CYLINDERS.... CONSIDER THE EXERCISE FOR THE NEXT DRAWING.... 8 KEY VALUES EXTREMELY EXAGGERATED!! I1 INDEX SET SEQUENCE S1 62 9/S1 S2 FREE SETS S2 3 9 D1 D2 D1 1 I2 36 62 D3 D4 FREE D2 3 FREE S3 5 FREE D3 9 FREE 35 36 CONTROL INTERVALS D4 FREE 42 43 62 FREE CONTROL INTERVALS CONTROL AREAS 9 ADD REC6 (MOVED IN PLACE WITHIN CONTROL INTERVAL SEQUENCE SET UNCHANGED DELETE REC 1 REC 3 AMOVED@ ONTO REC 1 SEQUENCE SET UNCHANGED DELETE REC 3 CONTROL INTERVAL RETURNED TO AVAILABLE SPACE SEQUENCE SET ENTRY MODIFIED. ADD REC 7 AND REC8 (NO ROOM) CONTROL INTERVAL SPLIT . A CONTROL INTERVAL IS ALLOCATED . ROUGHLY HALF RECORDS GO INTO EACH SEQUENCE SET ALTERED (TO REFLECT HIGHEST RECORDS IN THE TWO CONTROL INTERVALS.) 10 S1 7 9 D2 D5 FREE D2 5 D5 7 FREE 8 11 9 FREE ADDITIONAL FACTS: ISAM: ISAM WAS A STATIC WAY OF DOING THINGS USED LOGICAL DELETES REQUIRED AREORGANIZATION@ PERIODICALLY VERY HARDWARE DEPENDENT DOWNTIME DURING REORGANIZATION VSAM: DYNAMIC AND FLEXIBLE AUTOMATICALLY REORGANIZES ITSELF DON=T TALK ABOUT ATRACKS@ AND ACYLINDERS@ ON SURFACE - JUST CLUSTERS OR Cis DISK SPACE CAN BE FRAGMENTED NO REASON FOR ADOWN TIME@ FOR REORGANIZATION 12