


Setting A_MSSQL_USE_DROPDOWN_QUERIES to a non-zero value causes selects sent to the database to be of the drop-down variety, instead of a single large query.
For example, if you have a file with 3 fields in the primary key, (keyseg1, keyseg2, keyseg3), and your COBOL program does a START, the following query is sent to the database:
select (columns) from (table) where ((keyseg1 = value1 and keyseg2 = value2 and keyseg3 > value3) or (keyseg1 = value1 and keyseg2 > value2) or (keyseg1 > value1)) order by keyseg1, keyseg2, keyseg3
If you use drop-down queries, the following collection of queries is sent instead:
select (columns) from (table) where (keyseg1 = value1 and keyseg2 = value2 and keyseg3 > value3) order by keyseg1, keyseg2, keyseg3
When that set is finished, we then send:
select (columns) from (table) where (keyseg1 = value1 and keyseg2 > value2) order by keyseg1, keyseg2, keyseg3
And when that set is finished, we then send:
select (columns) from (table) where (keyseg1 > value1) order by keyseg1, keyseg2, keyseg3
There are advantages and disadvantages to each method. If you use the A4GL_WHERE_CONSTRAINT variable, you should probably set A_MSSQL_USE_DROPDOWN_QUERIES to 0, since the WHERE constraint will limit the result set sufficiently that the larger query will be more efficient.
If you usually START files, and read to the end, you should set A_MSSQL_USE_DROPDOWN_QUERIES to 0, since a fewer number of queries need to be sent to the database. On the other hand, if you START files, and stop reading after some condition, but haven't used the WHERE constraint, you may get more efficient access by setting this variable to 1, and using the drop-down style of query. In either case, it is recommended that you run some tests to see which value of this variable makes the most sense for your application.
This variable is accessed only during a positioning operation, so you can set it at different times for different tables.
While the default value is "0" (off, false, no), this configuration variable can also take values of "On" (true, yes).
Example
A_MSSQL_USE_DROPDOWN_QUERIES number
where number can be a zero or non-zero value.