Ü UPDATE (Modify Existing Record)

·         Update operation modifies the latest read record in the program.

·         Before the Update operation is performed the record should be perform valid input operation like READ, READC, READE, READP, READPE, CHAIN on the file. If it doesn’t it gets an error “Update operation before any prior input operation.

·         Update operation should be performed on a record format name.

·         Update operation puts a lock on the record which it is trying to modify, after the UPDATE operation the record is automatically unlocked.

·         Update operation on a subfile is performed to update the subfile with changes in the subfile attribute e.g. change in display attribute/indicators.

·         For partial updating a file, we can use %FIELDS or EXCEPT.

·         If we use a data structure in result field then the file is directly updated from the data structure.

Factor 1


Factor 2

Result Field

Resulting Indicators

       HI                            LO                      EQ


File/Record format

Data structure




Columns . . . :    6  80              Edit                                    AMINEM/QRPGLESRC
SEU==>                                                                             OP_UPDATE1
FMT H  HKeywords++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*************** Beginning of data ****************************************************
0001.00 HOPTION(*NODEBUGIO)                                                             130131
0002.00 FMASTER    UF A E           K DISK    USROPN                                    130130
0003.00  *                                                                              130124
0004.00 C                   OPEN      MASTER                                            130130
0005.00 C     *LOVAL        SETLL     REC1                                              130131
0006.00 C                   READ(N)   MASTER                                            130131
0007.00 C                   DOW       NOT %EOF(MASTER)                                  130131
0008.00 C                   IF        ACC='A00000000002'                                130131
0009.00 C                   EVAL      CCY='USD'                                         130131
0010.00 C                   UPDATE    REC1                                              130130
0013.00 C                   ENDIF                                                       130131
0014.00 C                   READ(N)   MASTER                                            130131
0015.00 C                   ENDDO                                                       130131
0016.00  *                                                                              130123
0017.00 C                   SETON                                        LR             130123
****************** End of data *******************************************************



User Comments:

Copyright © www.go4as400.com, 2013-2023. Copyright notice   Terms of services   Privacy policy