Nadya,
You could have only one program and pass a parameter to define the query type. Based on the parameter, you could define fieldnames, selection criteria, etc. Then, in your SQL SELECT you use these values. Here's the basic approach:
LPARAMETER tcQueryType
DO CASE
CASE tcQueryType == "S"
lcFieldName = "nAmount"
lcFieldNameAs = "nAmountPur"
lcWhere = " WHERE cSource = 'S' "
CASE tcQueryType == "M"
lcFieldName = "nAmount"
lcFieldNameAs = "nAmountRef"
lcWhere = " WHERE cSource = 'M' "
OTHERWISE
lcFieldName = "nAmount"
lcFieldNameAs = "nAmountAll"
lcWhere = ""
ENDCASE
SELECT nAmount AS (lcFieldNameAs);
FROM MyTable;
&lcWhere;
INTO MyCursor
*-- or if you have different input fields:
SELECT &lcFieldName AS (lcFieldNameAs);
FROM MyTable;
&lcWhere;
INTO MyCursor
Hope this helps.
Daniel