i had the same type of scenario some time back. You asked whether this can be achieved by using some db2 Table. Yes, we can, provided we have a table which can contain all the possible values for 'COMPANY' field.
Assume, we have a table "CODE_TABLE" with the following data :
WHERE NAME = :WS-NAME
AND COMPANY IN (SELECT CODE_VALUE
WHERE CODE_NAME = 'COMPANY');
The above query will serve as a solution to your Query.
Now, we no do not have to change the program. we just need add new values to the CODE_TABLE.
if you have any table like the above, it will be fine.
One more possible solution i can think of is Dynamic Queries.
we can have all the possible values for COMPANY in a File or we can send them thru PARM in the JCL. after reading these values in the program, we can create a query.
first of all thank you very much for your valuable suggestions and you are correct, if we use a DB2 table.
here my concers are
1)There is no DB2 table for this company code as of now. so is it proper way to create a DB2 table with these columns company code and compay indicator.
2) Currently we are using Corporate tables, which will store the above data but the problem is we can't use them as a db2 query. these corporate tables are called by a service(program) and finally it throws a record with all the values of a particular record in that table.
3) If you have any idea about coporate tables please provide me the suggestions and let me know...........