The UPDATE Statement

Syntax

            UPDATE filename [RESETFUNCTION | CANCEL]

 

RESETFUNCTION is only valid in CICS programs

Usage – in Batch Programs

In batch programs records are updated with

            PROCESS file WHERE(condition) UPDATE;

or

            GET file WHERE(condition) UPDATE;

Because of these UPDATE options Jazz will include statements to update the record before the next record is read (or at end of program).  You do not need to write an UPDATE statement anywhere in the program.  In the case of GETUPDATE, “UPDATE” means “Update or insert”, as the update logic will create a new record if GET failed to find a record satisfying the condition.

 

You can use

            UPDATE filename CANCEL;

to turn updating off.  For example, suppose that you don’t want to update some records: -

GET Vfile WHERE (Vfile.charfield = r2.charfield) UPDATE;

IF Vfile.Region = 5;

    UPDATE Vfile CANCEL;

END IF;

 

Usage – in CICS Programs

In a CICS program updating takes place at the END GET statement.  For example: -

        GET custf WHERE(CustF.Account=CICS3C.Save.Account) UPDATE CHECKCOPY(CICS3C.SAVE);

            ACCEPT (CICS3S.Region,CICS3S.District,CICS3S.Name,CICS3S.SalesThisMonth,

                                CICS3S.SalesYTD,CICS3S.Billingcycle,CICS3S.DateCommenced);

        END GET custf UPDATE RESETFUNCTION;

 

You can use UPDATE filename CANCEL; to turn updating off, as in batch programs