//S10DEFVS JOB (TESTING),'S10',CLASS=A, // MSGCLASS=H,MSGLEVEL=(1,1),NOTIFY=&SYSUID //DEFVSAM EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DEFINE CLUSTER ( + NAME(S10.VS) + RECSZ(80 80) + RECORDS(1000 2) + KEYS(2 0) + VOL(DMTD04)) /*
//S10INIT JOB (TESTING),'S10',CLASS=A, // MSGCLASS=H,MSGLEVEL=(1,1),NOTIFY=&SYSUID //SORTVSAM EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD * 00 WU QIN FEI /* //SORTOUT DD DSN=S10.VS,DISP=OLD //SYSIN DD * SORT FIELDS=COPY OUTREC FIELDS=(1,80) /*
//S10INIT2 JOB (TESTING),'S10',CLASS=A, // MSGCLASS=H,MSGLEVEL=(1,1),NOTIFY=&SYSUID //**************************************************** //* INIT VSAM file with other file (S10.BPG.FILE1) //**************************************************** //STEP01 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* REPRO + INDATASET(S10.BPG.FILE1) + OUTDATASET(S10.VS) /*
//S10DEL JOB (TESTING),'S10',CLASS=A, // MSGCLASS=H,MSGLEVEL=(1,1),NOTIFY=&SYSUID //DEFVSAM EXEC PGM=IDCAMS //DD1 DD VOL=SER=DMTD04,UNIT=3390,DISP=OLD //SYSPRINT DD SYSOUT=* //SYSIN DD * DELETE - S10.VS - FILE(DD1) - PURGE - ERASE /*
//S10PRINT JOB (TESTING),'S10',CLASS=A, // MSGCLASS=H,MSGLEVEL=(1,1),NOTIFY=&SYSUID //PRITVS EXEC PGM=IDCAMS //FILE1 DD DSN=S10.VS,DISP=SHR //SYSPRINT DD SYSOUT=* //SYSIN DD * PRINT INFILE(FILE1) CHAR /*
IDENTIFICATION DIVISION. PROGRAM-ID. VSREAD. * ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT IN-FILE ASSIGN INDD RECORD KEY IS IN-ID ORGANIZATION IS INDEXED ACCESS MODE IS RANDOM FILE STATUS IS IN-FILE-STATUS. * DATA DIVISION. FILE SECTION. FD IN-FILE. 01 IN-RECORD. 03 IN-ID PIC X(02). 03 IN-NAME PIC X(18). 03 FILLER PIC X(60). WORKING-STORAGE SECTION. 77 IN-FILE-STATUS PIC XX. * PROCEDURE DIVISION. OPEN INPUT IN-FILE. DISPLAY "OPEN STATUS: " IN-FILE-STATUS. 100-READ. MOVE '00' TO IN-ID. * READ IN-FILE INTO IN-RECORD ***WARN READ IN-FILE KEY IS IN-ID INVALID KEY DISPLAY "INVALID KEY" GO TO 100-END NOT INVALID KEY DISPLAY "READ ID ", IN-ID IF IN-ID = '00' THEN DISPLAY 'ID ', IN-ID, ' NAME IS ', IN-NAME GO TO 100-END END-IF END-READ. 100-END. CLOSE IN-FILE. DISPLAY "CLOSE STATUS: " IN-FILE-STATUS. STOP RUN.
//S10RJ JOB (TESTING),'S10',CLASS=A, // MSGCLASS=H,MSGLEVEL=(1,1),NOTIFY=&SYSUID //STEP001 EXEC PGM=VSREAD //STEPLIB DD DSN=S10.LOADLIB,DISP=SHR //INDD DD DSN=S10.VS,DISP=SHR //SYSPRINT DD SYSOUT=* //SYSOUT DD SYSOUT=*
IDENTIFICATION DIVISION. PROGRAM-ID. VSWRITE. * ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT IN-FILE ASSIGN INDD RECORD KEY IS IN-ID ORGANIZATION IS INDEXED ACCESS MODE IS RANDOM FILE STATUS IS IN-FILE-STATUS. * DATA DIVISION. FILE SECTION. FD IN-FILE. 01 IN-RECORD. 03 IN-ID PIC X(02). 03 IN-NAME PIC X(18). 03 FILLER PIC X(60). WORKING-STORAGE SECTION. 77 IN-FILE-STATUS PIC XX. * PROCEDURE DIVISION. OPEN I-O IN-FILE. DISPLAY "OPEN STATUS: " IN-FILE-STATUS. 100-READ. MOVE '01' TO IN-ID MOVE 'ZHANGSAN' TO IN-NAME . WRITE IN-RECORD INVALID KEY DISPLAY "INVALID KEY, WRITE ERROR" GO TO 100-END NOT INVALID KEY DISPLAY "ID :" IN-ID " NAME:" IN-NAME END-WRITE. 100-END. CLOSE IN-FILE. DISPLAY "CLOSE STATUS: " IN-FILE-STATUS. STOP RUN.
IDENTIFICATION DIVISION. PROGRAM-ID. VSREWRIT. * ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT IN-FILE ASSIGN INDD RECORD KEY IS IN-ID ORGANIZATION IS INDEXED ACCESS MODE IS RANDOM FILE STATUS IS IN-FILE-STATUS. * DATA DIVISION. FILE SECTION. FD IN-FILE. 01 IN-RECORD. 03 IN-ID PIC X(02). 03 IN-NAME PIC X(18). 03 FILLER PIC X(60). WORKING-STORAGE SECTION. 77 IN-FILE-STATUS PIC XX. * PROCEDURE DIVISION. OPEN I-O IN-FILE. DISPLAY "OPEN STATUS: " IN-FILE-STATUS. 100-READ. MOVE '00' TO IN-ID. READ IN-FILE KEY IS IN-ID INVALID KEY DISPLAY "INVALID KEY" GO TO 100-END NOT INVALID KEY DISPLAY "READ ID ", IN-ID IF IN-ID = '00' THEN DISPLAY 'ID ', IN-ID, ' NAME IS ', IN-NAME MOVE 'MARK' TO IN-NAME REWRITE IN-RECORD INVALID KEY DISPLAY "INVALID KEY" GO TO 100-END NOT INVALID KEY DISPLAY "REWRITE OK" END-REWRITE END-IF END-READ. 100-END. CLOSE IN-FILE. DISPLAY "CLOSE STATUS: " IN-FILE-STATUS. STOP RUN.
IDENTIFICATION DIVISION. PROGRAM-ID. vsdelete. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT IN-FILE ASSIGN INDD RECORD KEY IS IN-ID ORGANIZATION IS INDEXED ACCESS MODE IS RANDOM FILE STATUS IS IN-FILE-STATUS. DATA DIVISION. FILE SECTION. FD IN-FILE. 01 IN-RECORD. 03 IN-ID PIC X(02). 03 IN-NAME PIC X(18). 03 FILLER PIC X(60). WORKING-STORAGE SECTION. 77 IN-FILE-STATUS PIC XX. PROCEDURE DIVISION. OPEN I-O IN-FILE. DISPLAY "OPEN STATUS: " IN-FILE-STATUS. 100-READ. MOVE '00' TO IN-ID. READ IN-FILE KEY IS IN-ID INVALID KEY DISPLAY "INVALID KEY" GO TO 100-END NOT INVALID KEY DISPLAY "READ ID ", IN-ID IF IN-ID = '00' THEN DISPLAY 'ID ', IN-ID, ' NAME IS ', IN-NAME MOVE 'MARK' TO IN-NAME DELETE IN-FILE INVALID KEY DISPLAY "INVALID KEY" GO TO 100-END NOT INVALID KEY DISPLAY "DELETE OK" END-DELETE END-IF END-READ. 100-END. CLOSE IN-FILE. DISPLAY "CLOSE STATUS: " IN-FILE-STATUS. STOP RUN.
IDENTIFICATION DIVISION. PROGRAM-ID. vsstart. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT IN-FILE ASSIGN INDD RECORD KEY IS IN-ID ORGANIZATION IS INDEXED ACCESS MODE IS DYNAMIC FILE STATUS IS IN-FILE-STATUS. DATA DIVISION. FILE SECTION. FD IN-FILE. 01 IN-RECORD. 03 IN-ID PIC X(02). 03 IN-NAME PIC X(18). 03 FILLER PIC X(60). WORKING-STORAGE SECTION. 77 IN-FILE-STATUS PIC XX. PROCEDURE DIVISION. OPEN I-O IN-FILE. DISPLAY "OPEN STATUS: " IN-FILE-STATUS. 100-START. display "start at 01". MOVE '01' TO IN-ID START IN-FILE KEY >= IN-ID INVALID KEY DISPLAY "INVALID KEY" GO TO 100-END NOT INVALID KEY DISPLAY "START OK" END-START. 100-READ. READ IN-FILE NEXT RECORD AT END DISPLAY "FILE IS END" GO TO 100-END NOT AT END DISPLAY 'ID ', IN-ID, ' NAME IS ', IN-NAME GO TO 100-READ END-READ. 100-END. CLOSE IN-FILE. DISPLAY "CLOSE STATUS: " IN-FILE-STATUS. STOP RUN.