With SAS ability to access your DB2 table, I recommend building a SAS file from the table, selecting only the columns needed. Then, perform your SQL code to identify the rows needing update, then follow that code with a DB2 table update, considering any table/column serialization necessary to execute the entire process. Also, have you considered any performance impact when there are multiple rows meeting the sub-query " select 1 from", such that you may not need to process each row from mytemp.table - possibly to consider DISTINCT in a select, for efficiency (a consideration since we do not see the code used to build mytemp.table)?
Bottom-line - suggest you re-think the problem and your intended solution to derive a more efficient processing flow, only accessing DB2 resources minimally when necessary, while performing as much processing within the SAS environment.
Also, your TSO (mainframe - interactive) session will likely not be getting the expected service, and so you should consider converting the task to a batch TSO request instead, if the processing time duration is a factor when accessing the DB2 resources for serialization.
Scott Barry
SBBWorks, Inc.