Scenario: You're validating data in changed records of a subfile, but you need to keep those records in a changed...
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
status to be processed by a future readc operation.
When you set up a readc loop to read changed records, after every readc operation the record will no longer be a "changed" record and therefore will not be processed by a future readc loop (writing, deleting or updating the record in the database.)You will need to use the sflnxtchg function in Visual Age RPG (VARPG) to "mark" a record changed after it has been read by a readc operation.
/free //position the VARPG pointer to the top of the subfile (equivalent to a SETLL *LOVAL on a file) %setatr('LinerOrder':'linerdet':'startat')=1; readc linerdet; dow not %eof; //if the quantity field in the subfile is zero, display an error message and set the gui focus to the subfile if qty = 0; dsply *msg0005; %setatr('Linerorder':'linerdet':'Focus')=1; //set the record to be a changed record for future processing %setatr('LinerOrder':'linerdet':'sflnxtchg')=1; //leave the routine so the user can correct the error return; endif; //otherwise the record has changed and passes the validation, so set it to be read as a changed record //but start the processing on the next record. (This prevents an endless loop). sflx = %getatr('Linerorder':'linerdet':'index'); %setatr('LinerOrder':'linerdet':'sflnxtchg')=1; sflx = sflx + 1; %setatr('LinerOrder':'linerdet':'startat')=sflx; readc linerdet; enddo; /end-free