Cynthia has a link to the documentation and it's good and you should read it, but here is something to play with while you are reading. This job creates a VSAM file and populates it with two records. And reads them back. Successfully. I get a condition code of zero, but I also get a diagnostic in SYSLOG and I'm not entirely sure what it is telling me:
ALL RECORDS READ
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+
3 0
GENKEY= FDBK=4 _RBA_=80 _FDBK_=4 _RRN_=0 KEYIN=22345 DATAN=SECOND RECORD _
NOTE: 2 records were read from the infile VSAMFILE.
In any case, if I can figure out what causes the diagnostic I'll be back. I haven't used VSAM in years.
//ESIRJHM6 JOB (6021,JHM,125,1500),CSECT,MSGCLASS=R,CLASS=4,
// TIME=NOLIMIT TYPRUN=SCAN
//IDCAMS EXEC PGM=IDCAMS
//REPRO DD *
12345 FIRST RECORD
22345 SECOND RECORD
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DELETE 'ESIRJHM.VSAM.DATA'
DEFINE CLUSTER -
(NAME('ESIRJHM.VSAM.DATA') -
STORCLAS(ADVANCED) -
MGMTCLAS(STANDARD) -
CYL(2 1) -
KEYS(05 0)-
RECSZ(80 80))
REPRO ODS(ESIRJHM.VSAM.DATA) IFILE(REPRO)
VERIFY DATASET(ESIRJHM.VSAM.DATA)
SET MAXCC = 0
//SAS EXEC SAST
//VSAMFILE DD DISP=SHR,DSN=ESIRJHM.VSAM.DATA
//SYSIN DD *
OPTIONS NOCENTER;
DATA _NULL_;
LENGTH GENKEY $5;
FDBK = 0;
GENKEY = ' ';
INFILE VSAMFILE VSAM FEEDBACK=FDBK KEY=GENKEY GENKEY SKIP
KEYGE;
DO WHILE (FDBK = 0);
INPUT @;
IF FDBK = 0 THEN DO;
INPUT @01 KEYIN $5.
@06 DATAN $75.;
PUTLOG _INFILE_;
END;
END;
PUTLOG 'ALL RECORDS READ';
STOP;
RUN;
... View more