I have a condition. I have a CL where I override a table(TabA) with Qtemp version(QTEMP/TabA). Then I call a RPG program. Now in the RPG program, I do an update to TabA. So the Qtemp version is getting updated but I wanted the actual version to be updated. So basically, just in this update, I dont want my override to work. One way is to delete the override and then , after the update, override it back. Is there a better way?
It sounds, to me, like you have a single F spec in your program for TABA. If this is the case you cannot change the observed behavior without modifying the program, but your modifications can be limited in scope by creating a new logical and a subprocedure like this:
dcl-proc UpdateTABA;
dcl-pi *n Ind;
record LikeRec(TABAREC:*output) const;
end-pi;
dcl-f tabanewlf disk keyed usage(*update);
chain (key) tabanewlf
if %found(tabanewlf);
update tabanewlf record;
return *On;
endif;
return *Off;
end-proc;
Then wherever you have an update opcode, you can call this sub-procedure. Since it is using a different file name, it will be unaffected by the override.
Given that you are using SQL, you could also create an alias and update that. The alias is not affected by the override. It would look like this:
create alias qtemp/taba_alias for taba;
I just tested this in the presence of an override that overrides a file to an empty duplicate in a different library.
select * from taba;
returns an empty data set while :
select * from taba_alias;
returns a dataset with the expected data. Then just drop your alias when you are finished with it. Notice that I created the alias in QTEMP. This way multiple users can run your program without recreating or dropping the alias on each other.
So use a view if you don't mind an extra artifact out there, or an alias if you just want to create a pointer.