Resolving error 37 of the Vsam alternate index
Whenever we define Vsam Alternate Index File we might face error 37 when we use to process the file via JCL first time:
The solution mentioned to resolve this is to initialize Vsam file once before directly opening in the program. But still many times you must have faced same error again and again whenever you try to read alternate index vsam file via a cobol program and through JCL.
Whenever we define VSAM alternate index file we have following components:
Cluster: OLDMF.DATA.KSDALT
Data: OLDMF.DATA.KSDALT.DAT
INDEX: OLDMF.DATA.KSDALT.INX
AIX : OLDMF.DATA.KSDALT1
PATH: OLDMS.DATA.KSDALT.PATH
This filename and alternate index is used in the JCL to read the Cobol program and in JCL it is placed with its logical name as:
//OLDMF DD DSN= OLDMF.DATA.KSDALT,DISP=OLD//OLDMFD DD DSN=OLDMF.DATA.KSDALT1,DISP=OLDThe problem is in the way we write our logical name. Even if you try to initialize file and you may still face the error. It will be resolved by the way we write logical name for the alternate index in the JCLs.Correct declaration://OLDMF DD DSN= OLDMF.DATA.KSDALT,DISP=OLD
//OLDMF1 DD DSN=OLDMF.DATA.KSDALT1,DISP=OLDAlways the logical name will be appended with the next sequence number starting from 1.