VMS Help  —  RDML72  Statements  ERASE  Examples
    The following programs demonstrate the use of the ERASE statement
    to delete records from a relation. These programs:

    o  Start a READ_WRITE transaction

    o  Find the records in COLLEGES with the college code "PURD"

    o  Delete those records from the COLLEGES relation

1  –  C Example

    #include <stdio.h>
    DATABASE PERS = FILENAME "PERSONNEL";

    main()
    {
    READY PERS;
    START_TRANSACTION READ_WRITE;

    FOR C IN COLLEGES WITH C.COLLEGE_CODE = "PURD"
       ERASE C;
    END_FOR;

    ROLLBACK;
    FINISH;
    }

2  –  Pascal Example

    program erase_record (input,output);
    DATABASE PERS = FILENAME 'PERSONNEL';

    begin
    READY PERS;
    START_TRANSACTION READ_WRITE;

    FOR C IN COLLEGES WITH C.COLLEGE_CODE = 'PURD'
       ERASE C;
    END_FOR;

    ROLLBACK;
    FINISH;
    end.
Close Help