The KICKS KooKbooK is a newsletter of tasty recipes to help you get the most from KICKS. Got your own recipe you’d like to share? Send it to mikenoel137@gmail.com

Today's recipe - VSAM in the VM/370 SixPack (1.2) system

KICKS for CMS support for VSAM requires some infrastructure in the VM system it runs on. Namely DOS and VSAM systems installed, access to DOS disks (or minidisks) for VSAM catalogs and data, and of course the VSAM catalog(s) and spaces. With those in place you can use AMSERV (aka IDCAMS) to define and load your VSAM clusters, build alternate indexes, etc.

The VM/370 SixPack system (release 1.2) (http://games.groups.yahoo.com/group/H390-VM/message/8113) comes with DOS and VSAM support built in, but (with due respect to those who gave us the SixPacks) without much describing how to use them. This recipe is intended to fill that gap.

Instructions in this recipe assume a newly installed SixPack 1.2 with the 6th volume as distributed (ie, not copied with your stuff from a previous release or elsewhere).

 

1. How to obtain a DOS disk or minidisk? Most KICKS users won't need a whole pack for VSAM use (at least not right away) so let's focus on making a DOS minidisk. It turns out the CMSUSER account has several CMS formatted but empty minidisks (192, 193, 194) so let's use one of those. Picking 192 - how do we make that a DOS minidisk? By using the IBCDASDI utility, documented in IBM Virtual Machine Facility: Operator's Guide (GC20-1806).

Defining a full pack DOS disk is similar (except no CYLNO= on the DADEF card) but of course involves the additional steps of putting the new volume online, making sure the VM sysgen has it correctly defined, and adding it to the appropriate DIRECT entry, all of which are beyond the scope of this recipe.

 

2. With a DOS minidisk available a VSAM catalog. and space can be defined. Before doing so a few words about VSAM catalogs and space:

MVS requires VSAM for its own operation (for example paging) and in MVS there must always be a master catalog, but very few non-system files are defined in it. It is usually password protected to prevent accidently defining files there, and it's used mostly for user catalog definitions and for aliases associated with those user catalogs. It is possible to have other 'master' catalogs (accessed with JOBCAT or STEPCAT jcl) but that is uncommon and highly discouraged in most shops.

VM by contrast does not use VSAM itself and in fact some shops don't install it at all! User catalogs are not required and in many cases more trouble than they're worth, especially when the VSAM files concerned will only be used by a few. Multiple 'master' catalogs are the rule, with every user (or small group of users) having their own with all their files in it.

For that reason we will define a 'master' catalog but not bother with associating any 'user' catalogs with it.

A similar situation governs use of 'unique' and 'suballocated' space for VSAM files. The pros&cons of these two space allocation schemes vary by file and by operating system. One major issue is that in MVS disk placement for 'unique' files is handled by MVS, but in VM such placement is manual, via DLBL extents. Skipping the other details of these pros&cons, in MVS the balance seem to favor 'unique', so in most MVS shops 'suballocated' VSAM space is almost unheard of. In VM it seems to be the other way around, with 'suballocated' being more common.

That said, let's build our 'master' catalog and a pool of space for our files suballocation. A good reference for this is in IBM Virtual Machine Facility: CMS User's Guide (GC20-1819).

Starting with the define of the catalog:,

   DEFINE MASTERCATALOG -
     (NAME(MASTCAT ) -
      VOLUME(CMS192) -
      CYL(10) -
      FILE(IJSYSCT) )

   ACC 192 D

   SET DOS ON (VSAM

   ASSGN SYSCAT D

   DLBL IJSYSCT D DSN MASTCAT (SYSCAT PERM EXTENT

and see

DMSDLB331R ENTER EXTENT SPECIFICATIONS:

reply by typing

30 300

and press enter twice (ie, enter a blank line after 30 300)

   AMSERV MCAT

Next provide the suballocation space for the catalog:,

   DEFINE SPACE -
     (VOLUME(CMS192) -
      TRACKS(3000) -
      FILE(SPACE) )

   ASSGN SYS001 D

   DLBL SPACE D (SYS001 EXTENT

and see

DMSDLB331R ENTER EXTENT SPECIFICATIONS:

reply by typing

330 3000

and press enter twice (ie, enter a blank line after 330 3000)

   AMSERV SPACE

 

3. With our DOS pack, VSAM master catalog and space defined we can now define and load some user VSAM files. The following KICKS for CMS file -  LOADMUR EXEC A  - is simply a 'translation' of the KICKS for TSO sample data load job KICKS.V1R1M3.INSTLIB(LOADMUR). It does a delete/define of 4 VSAM clusters, then loads test data into them, and finally builds an alternate index over one of them.

You will note several references to 'EXEC DODOS', a simple EXEC, as below to establish the DOS environment.

&CONTROL OFF NOMSG
ACC 192 D
SET DOS ON (VSAM
DLBL * CLEAR
ASSGN SYSCAT D
DLBL IJSYSCT D DSN MASTCAT (SYSCAT PERM

Store this file as DODOS EXEC A but don't run it right now.

You will also note several references to STKCARDS, a simple GCCCMS program that concatenates card images to form longer records that can be loaded into VSAM files via REPRO. This program, as below, is unchanged from that distributed with KICKS for TSO in KICKSSYS.V1R1M3.INSTLIB(STKCARDS).

#include <stdio.h>                                                              
#include <string.h>                                                            
int main (int argc, char *argv[]) {                                             
int i, j, k=0, maxcols=80, numcards=1;                                               
char card[90], out[900];                                                        
 // obtain number of cards to stack                                             
 memset(&card, 0, 90);                                                          
 strcpy(card, argv[1]);                                                         
 k=strtol(card);                                                                
 if ((k>0) && (k<10)) numcards=k;                                               
 fprintf(stderr,                                                                
  "stkcards will concat %d cards per output record\n",                          
  numcards);                                                                    
 // obtain number of columns per card                                           
 memset(&card, 0, 90);                                                          
 strcpy(card, argv[2]);                                                         
 k=strtol(card);                                                                
 if ((k>0) && (k<80)) maxcols=k;                                                
 fprintf(stderr,                                                                
  "stkcards will concat %d columns per card\n\n",                               
  maxcols);                                                                     
 // stack the cards                                                             
 while (!feof (stdin)) {                                                        
  memset(&out, 0, 900);                                                         
  // get cards                                                                  
  for (i=0; i<numcards; i++) {                                                  
   memset(&card, 0, 90);                                                        
   fgets (card, 85, stdin);                                                     
   if(feof(stdin)) break;                                                       
   j = strlen(card);                                                            
   if (j > 0) if (card[j-1] == '\n') card[j-1] = 0;                             
   while (j < maxcols) {                                                        
    strcat(card, " ");                                                          
    j = strlen(card);                                                           
    }                                                                           
   strncat(out, card, maxcols);                                                 
   }                                                                            
  // write output                                                               
  if (i > 0) {                                                                  
   fputs(out, stdout);                                                          
   fputc('\n', stdout);                                                         
   }                                                                            
  }                                                                                                                                                             
}

Store this file as STKCARDS C on your A disk and compile it by typing

GCCE STKCARDS

which may fail with complaints about the non-ANSI comments. If so either fix my '//' style comments or make your own local copy (ie, on the A disk) of the GCC PARM file, deleting the '-ANSI'. When the compile comes back good type

LOAD STKCARDS

then type

GENMOD STKCARDS

That said, here is   LOADMUR EXEC A

&CONTROL
* 
* FIRST DELETE/DEFINE CUSTMAS, PRODUCT, INVOICE & INVCTL                      
*                                                                             
SET DOS OFF
-DELDEF
ERASE    LOADMDD AMSERV A
FILEDEF  INMOVE  TERM ( RECFM F BLOCK 80 LRECL 80
FILEDEF  OUTMOVE DISK LOADMDD AMSERV A ( RECFM F BLOCK 80 LRECL 80
&BEGSTACK
 DELETE CMSUSER.KICKS.MURACH.CUSTMAS                                             
 DELETE CMSUSER.KICKS.MURACH.PRODUCT                                             
 DELETE CMSUSER.KICKS.MURACH.INVOICE                                             
 DELETE CMSUSER.KICKS.MURACH.INVCTL                                              
 SET MAXCC = 0                                                                  
 DEFINE CLUSTER                                       -                         
      (NAME(CMSUSER.KICKS.MURACH.CUSTMAS) VOLUMES(CMS192) -                      
       TRACKS(15 15)  INDEXED                         -                         
       SHAREOPTIONS(1 3)                              -                         
       RECORDSIZE(118 118)                            -                         
       KEYS(6 0)                                      -                         
      )                                               -                         
     DATA ( NAME(CMSUSER.KICKS.MURACH.CUSTMAS.DATA))  -                         
    INDEX ( NAME(CMSUSER.KICKS.MURACH.CUSTMAS.INDEX))                            
 DEFINE CLUSTER                                       -                         
      (NAME(CMSUSER.KICKS.MURACH.PRODUCT) VOLUMES(CMS192) -                      
       TRACKS(15 15)  INDEXED                         -                         
       SHAREOPTIONS(1 3)                              -                         
    /* RECORDSIZE(39 39)     REC W/COMP-3  */         -                         
       RECORDSIZE(46 46)                              -                         
       KEYS(10 0)                                     -                         
      )                                               -                         
     DATA ( NAME(CMSUSER.KICKS.MURACH.PRODUCT.DATA))  -                         
    INDEX ( NAME(CMSUSER.KICKS.MURACH.PRODUCT.INDEX))                            
 DEFINE CLUSTER                                       -                         
      (NAME(CMSUSER.KICKS.MURACH.INVOICE) VOLUMES(CMS192) -                      
       TRACKS(15 15)  INDEXED                         -                         
       SHAREOPTIONS(1 3)                              -                         
    /* RECORDSIZE(275 275)   REC W/COMP-3  */         -                         
       RECORDSIZE(389 389)                            -                         
       KEYS(6 0)                                      -                         
      )                                               -                         
     DATA ( NAME(CMSUSER.KICKS.MURACH.INVOICE.DATA))  -                         
    INDEX ( NAME(CMSUSER.KICKS.MURACH.INVOICE.INDEX))                            
 DEFINE CLUSTER                                       -                         
      (NAME(CMSUSER.KICKS.MURACH.INVCTL) VOLUMES(CMS192)  -                       
       TRACKS(15 15)  INDEXED                         -                         
       SHAREOPTIONS(1 3)                              -                         
       RECORDSIZE(7 7)                                -                         
       KEYS(1 0)                                      -                         
      )                                               -                         
     DATA ( NAME(CMSUSER.KICKS.MURACH.INVCTL.DATA))   -                         
    INDEX ( NAME(CMSUSER.KICKS.MURACH.INVCTL.INDEX))
&END                             
&STACK
MOVEFILE
EXEC  DODOS
AMSERV   LOADMDD
SET DOS OFF
ERASE    LOADMDD AMSERV
*                                                                             
* LOAD 118 BYTE RECORDS (2 CARDS PER) INTO CUSTMAS                            
*                                                                             
-LOAD1A
ERASE    LOADM1A DATA   A
FILEDEF  SYSIN    TERM ( RECFM F BLOCK 80 LRECL 80
FILEDEF  SYSTERM  TERM ( RECFM F BLOCK 80 LRECL 80
FILEDEF  SYSPRINT DISK LOADM1A DATA A ( RECFM FB BLOCK 1180 LRECL 118
&BEGSTACK ALL
400001KIETH               MCDONALD                      4501 W MOCKINGBIRD      
      DALLAS              TX75209                                               
400002ARREN               ANELLI                        40 FORD RD              
      DENVILLE            NJ07834                                               
400003SUSAN               HOWARD                        1107 SECOND AVE #312    
      REDWOOD CITY        CA94063                                               
400004CAROLANN            EVENS                         74 SUTTON CT            
      GREAT LAKES         IL60088                                               
400005ELAINE              ROBERTS                       12914 BRACKNELL         
      CERRITOS            CA90701                                               
400006PAT                 HONG                          73 HIGH ST              
      SAN FRANCISCO       CA94114                                               
400007PHIL                ROACH                         25680 ORCHARD           
      DEARBORN HTS        MI48125                                               
400008TIM                 JOHNSON                       145 W 27TH ST           
      SO CHICAGO HTS      IL60411                                               
400009MARIANNE            BUSBEE                        3920 BERWYN DR #199     
      MOBILE              AL36608                                               
400010ENRIQUE             OTHON                         BOX 26729               
      RICHMOND            VA23261                                               
400011WILLIAM C           FERGUSON                      BOX 1283                
      MIAMI               FL34002-1283                                          
400012S D                 HEOHN                         PO BOX 27               
      RIDDLE              OR97469                                               
400013DAVID R             KEITH                         BOX 1266                
      MAGNOLIA            AR71757-1266                                          
400014R                   BINDER                        3425 WALDEN AVE         
      DEPEW               NY14043                                               
400015VIVIAN              GEORGE                        229 S 18TH ST           
      PHILADELPHIA        PA19103                                               
400016J                   NOETHLICH                     11 KINGSTON CT          
      MERRIMACK           NH03054                                               
&END
&STACK
STKCARDS 2
ERASE    LOADM1A AMSERV A
FILEDEF  INMOVE  TERM ( RECFM F BLOCK 80 LRECL 80
FILEDEF  OUTMOVE DISK LOADM1A AMSERV A ( RECFM F BLOCK 80 LRECL 80
&BEGSTACK
 REPRO INFILE ( INDS ENV ( RECFM(FB) BLKSZ(1180) RECSZ(118) ) ) -
      OUTFILE (OUTDS)                                   
&END                 
&STACK
MOVEFILE
EXEC  DODOS
ASSGN SYS001 A
DLBL  INDS A CMS LOADM1A DATA (SYS001
DLBL OUTDS D DSN CMSUSER KICKS MURACH CUSTMAS (SYSCAT VSAM
AMSERV   LOADM1A
SET DOS OFF
ERASE    LOADM1A DATA
ERASE    LOADM1A AMSERV
*                                                                             
* LOAD 46 BYTE RECORDS (1 CARD PER) INTO PRODUCT                              
*                                                                             
-LOAD2A
ERASE    LOADM2A DATA   A
FILEDEF  SYSIN    TERM ( RECFM F BLOCK 80 LRECL 80
FILEDEF  SYSTERM  TERM ( RECFM F BLOCK 80 LRECL 80
FILEDEF  SYSPRINT DISK LOADM2A DATA A ( RECFM FB BLOCK 460 LRECL 46
&BEGSTACK ALL
0000000001PENNY               0000000010010000                                  
0000000005NICKEL              0000000050002000                                  
0000000010DIME                0000000100001000                                  
0000000025QUARTER             0000000250000250                                  
0000000100DOLLAR              0000001000000050                                  
0000000500FIVE                0000005000000020                                  
0000001000TEN                 0000010000000020                                  
0000002000TWENTY              0000020000000020                                  
0000010000CNOTE               0000100000000010                                  
&END
&STACK
STKCARDS 1
ERASE    LOADM2A AMSERV A
FILEDEF  INMOVE  TERM ( RECFM F BLOCK 80 LRECL 80
FILEDEF  OUTMOVE DISK LOADM2A AMSERV A ( RECFM F BLOCK 80 LRECL 80
&BEGSTACK
 REPRO INFILE ( INDS ENV ( RECFM(FB) BLKSZ(460) RECSZ(46) ) ) -
      OUTFILE (OUTDS)                                   
&END           
&STACK
MOVEFILE
EXEC  DODOS
ASSGN SYS001 A
DLBL  INDS A CMS LOADM2A DATA (SYS001
DLBL OUTDS D DSN CMSUSER KICKS MURACH PRODUCT (SYSCAT VSAM
AMSERV   LOADM2A
SET DOS OFF
ERASE    LOADM2A DATA
ERASE    LOADM2A AMSERV
*                                                                             
* LOAD 389 BYTE RECORDS (5 CARDS PER) INTO INVOICE                            
*                                                                             
-LOAD3A
ERASE    LOADM3A DATA   A
FILEDEF  SYSIN    TERM ( RECFM F BLOCK 80 LRECL 80
FILEDEF  SYSTERM  TERM ( RECFM F BLOCK 80 LRECL 80
FILEDEF  SYSPRINT DISK LOADM3A DATA A ( RECFM FB BLOCK 3890 LRECL 389
&BEGSTACK ALL
00358491-07-23400015PROM1     00000010000000005000001000000005000000000010000000
0100000010000000010000000000250000003000000025000000075          000000000000000
0000000000          0000000000000000000000000          0000000000000000000000000
          0000000000000000000000000          0000000000000000000000000          
0000000000000000000000000          0000000000000000000000000000005175           
00358591-07-23400003PROM1               0000000000000000000000000          00000
00000000000000000000          0000000000000000000000000          000000000000000
0000000000          0000000000000000000000000          0000000000000000000000000
          0000000000000000000000000          0000000000000000000000000          
0000000000000000000000000          0000000000000000000000000000029283           
00358691-07-23400007PROM1               0000000000000000000000000          00000
00000000000000000000          0000000000000000000000000          000000000000000
0000000000          0000000000000000000000000          0000000000000000000000000
          0000000000000000000000000          0000000000000000000000000          
0000000000000000000000000          0000000000000000000000000000006887           
00358791-07-23400005PROM1               0000000000000000000000000          00000
00000000000000000000          0000000000000000000000000          000000000000000
0000000000          0000000000000000000000000          0000000000000000000000000
          0000000000000000000000000          0000000000000000000000000          
0000000000000000000000000          0000000000000000000000000000002209           
00358891-07-23400004PROM1               0000000000000000000000000          00000
00000000000000000000          0000000000000000000000000          000000000000000
0000000000          0000000000000000000000000          0000000000000000000000000
          0000000000000000000000000          0000000000000000000000000          
0000000000000000000000000          0000000000000000000000000000005763           
00358991-07-23400016PROM1               0000000000000000000000000          00000
00000000000000000000          0000000000000000000000000          000000000000000
0000000000          0000000000000000000000000          0000000000000000000000000
          0000000000000000000000000          0000000000000000000000000          
0000000000000000000000000          0000000000000000000000000000071105           
00359091-07-23400003PROM1               0000000000000000000000000          00000
00000000000000000000          0000000000000000000000000          000000000000000
0000000000          0000000000000000000000000          0000000000000000000000000
          0000000000000000000000000          0000000000000000000000000          
0000000000000000000000000          0000000000000000000000000000011049           
&END
&STACK
STKCARDS 5
ERASE    LOADM3A AMSERV A
FILEDEF  INMOVE  TERM ( RECFM F BLOCK 80 LRECL 80
FILEDEF  OUTMOVE DISK LOADM3A AMSERV A ( RECFM F BLOCK 80 LRECL 80
&BEGSTACK
 REPRO INFILE ( INDS ENV ( RECFM(FB) BLKSZ(3890) RECSZ(389) ) ) -
      OUTFILE (OUTDS)                                   
&END           
&STACK
MOVEFILE
EXEC  DODOS
ASSGN SYS001 A
DLBL  INDS A CMS LOADM3A DATA (SYS001
DLBL OUTDS D DSN CMSUSER KICKS MURACH INVOICE (SYSCAT VSAM
AMSERV   LOADM3A
SET DOS OFF
ERASE    LOADM3A DATA
ERASE    LOADM3A AMSERV
*                                                                             
* LOAD 7 BYTE RECORDS (1 CARD PER) INTO INVCTL                                
*                                                                             
-LOAD4A
ERASE    LOADM4A DATA   A
FILEDEF  SYSIN    TERM ( RECFM F BLOCK 80 LRECL 80
FILEDEF  SYSTERM  TERM ( RECFM F BLOCK 80 LRECL 80
FILEDEF  SYSPRINT DISK LOADM4A DATA A ( RECFM FB BLOCK 70 LRECL 7
&BEGSTACK ALL
0003591                                                                         
&END
&STACK
STKCARDS 1
ERASE    LOADM4A AMSERV A
FILEDEF  INMOVE  TERM ( RECFM F BLOCK 80 LRECL 80
FILEDEF  OUTMOVE DISK LOADM4A AMSERV A ( RECFM F BLOCK 80 LRECL 80
&BEGSTACK
 REPRO INFILE ( INDS ENV ( RECFM(FB) BLKSZ(70) RECSZ(7) ) ) -
      OUTFILE (OUTDS)                                   
&END            
&STACK
MOVEFILE
EXEC  DODOS
ASSGN SYS001 A
DLBL  INDS A CMS LOADM4A DATA (SYS001
DLBL OUTDS D DSN CMSUSER KICKS MURACH INVCTL (SYSCAT VSAM
AMSERV   LOADM4A
SET DOS OFF
ERASE    LOADM4A DATA
ERASE    LOADM4A AMSERV
*                                                                             
* DEFINE & BUILD THE INVOICE ALTERNATE INDEX                                  
*                                                                             
-BLDIDX
ERASE    LOADBLD AMSERV A
FILEDEF  INMOVE  TERM ( RECFM F BLOCK 80 LRECL 80
FILEDEF  OUTMOVE DISK LOADBLD AMSERV A ( RECFM F BLOCK 80 LRECL 80
&BEGSTACK
 DEFINE ALTERNATEINDEX                                 -                         
      (NAME(CMSUSER.KICKS.MURACH.INVOICE.AIX)          -                         
       RELATE(CMSUSER.KICKS.MURACH.INVOICE)            -                         
       VOLUMES(CMS192)                                 -                         
       TRACKS(15 15)  NONUNIQUEKEY UPGRADE             -                         
       KEYS(6 14)                                      -                         
       SHAREOPTIONS(1 3)                               -                         
       RECORDSIZE(17 411) /* MAX 100 DUPS */           -                         
      )                                                -                         
     DATA ( NAME(CMSUSER.KICKS.MURACH.INVOICE.AIX.DATA)) -                       
    INDEX ( NAME(CMSUSER.KICKS.MURACH.INVOICE.AIX.INDEX))                        
 DEFINE PATH                                           -                         
      (NAME(CMSUSER.KICKS.MURACH.INVOICE.PATH)         -                         
       PATHENTRY(CMSUSER.KICKS.MURACH.INVOICE.AIX)     -                         
      )                                                                         
 BLDINDEX INFILE (INDS )   OUTFILE ( OUTDS )                        
&END                        
&STACK
MOVEFILE
EXEC  DODOS
DLBL  INDS D DSN CMSUSER KICKS MURACH INVOICE (SYSCAT VSAM
DLBL OUTDS D DSN CMSUSER KICKS MURACH INVOICE AIX (SYSCAT VSAM
AMSERV   LOADBLD
SET DOS OFF
ERASE    LOADBLD AMSERV
*
&EXIT
ERASE    LOADMDD  LISTING A
ERASE    LOADM1A  LISTING A
ERASE    LOADM2A  LISTING A
ERASE    LOADM3A  LISTING A
ERASE    LOADM4A  LISTING A
ERASE    LOADBLD  LISTING A
Store this file as LOADMUR EXEC A and run it by typing LOADMUR. Observe the condition codes & review the   LOAD* LISTING A  files to ensure they all worked. It's normal for the various ERASE's to complain the files being erased do not exist. At some point I need to fix that. It's also normal to get condition code 8's from the DELETE's the first time they run since the clusters to be deleted do not exist at that point (that's the reason for the SET MAXCC = 0 that follows).

 

4. With VSAM files defined and loaded, multiple users could access and update the files online with KICKS for CMS. But since KICKS uses dynamic link/access/detach to 'share' files that will only work if you either (a) logoff CMSUSER or (b) detach 192 so that KICKS users can obtain access. Probably the best way to handle this is to detach 192 in the PROFILE EXEC, then LINK to it (ie, "LINK * 192 192 W") when necessary.

 

5. If you get tired of playing with this VSAM stuff you can safely disappear it all by typing

   FORMAT 192 D

    which puts the disk back into CMS mode.