Using VSAM Macros in Programs

At this point it is important to see how all of these macros work together in a program. Figure 1 shows the relationship between JCL and the VSAM macros in a program.
Figure 1. VSAM Macro Relationships
Figure 2 is a skeleton program that shows the relationship of VSAM macros to each other and to the rest of the program.
Figure 2. Skeleton VSAM Program
START  CSECT
         SAVE(14,12)                      Standard entry code
         .
         B      INIT                      Branch around file specs
 
MASACB   ACB    DDNAME=MASDS,AM=VSAM,     File specs                 X
                MACRF=(KEY,SEQ,OUT),                                 X
                EXLST=EXITS,                                         X
                RMODE31=ALL
 
MASRPL   RPL    ACB=MASACB,                                          X
                OPTCD=(KEY,SEQ,NUP,MVE,SYN),                         X
                AREA=WA,                                             X
                AREALEN=80,                                          X
                RECLEN=80
 
EXITS    EXLST  LERAD=LOGER,                                         X
                JRNAD=JOURN
 
TRANDCB  DCB    DDNAME=TRANDS,                                       X
                DSORG=PS,                                            X
                MACRF=GM,                                            X
                EODAD=EOTRF,                                         X
                LRECL=80,                                            X
                BLKSIZE=80,                                          X
                RECFM=F
INIT     .                                Program initialization
         .
         OPEN   (MASACB,,TRANDCB)         Connect data sets
         .
         GET    TRANDCB,WA                Processing loop
         .
         PUT    RPL=MASRPL
         .
EOTRF    CLOSE  (MASACB,,TRANDCB)         Disconnect data sets
         .
         RETURN (14,12)                   Return to calling routine
LOGER    Exit routines
         .
JOURN    .
         .
WA       DS     CL80                      Work area
         END