APPX Software Library

Section 12: Query Processes

Query Processes

(from SP2 Sort Functions)

Item 12.1

Bug (FYI): In APPX 1.8.4 Application Design when changing Runtime Editability on the Sort Order screen, incorrect values for Subheading or Subtotal could appear and inadvertently cause the design to be changed.

Item 12.2

Bug (flagged in V05): In APPX 1.8.4, if a job file is created by the CREATE statement (as opposed to created implicitly) within an APPX query process, it will not be used by a later job step. Also, in APPX 3.0, a permanent file created via CREATE in Query Execution could not be found until the CREATE was moved to Query Setup. (See items 7.19 & 12.11.)

Item 12.3

Bug (fixed in APPX 3.0.0): In APPX 1.8.4, record selections that compare a field in the PCF file to a corresponding field in another file are not handled properly, such as:

CIC PRODWARE ACTIVE               CIC PRODUCT ACTIVE

This construct allows the operand to be filled in by the operator at runtime, for instance, "NE" to select records where these flags do not agree. One bug is that APPX either selects no records or an incomplete set of records when this selection is activated. Another bug is that just the presence of this selection can cause the query to misbehave, even when it is not activated. If the selection is deleted from the query, the problems go away.

Item 12.4

Bug (flagged in V05): An APPX 2.3 bug will not allow a query to run in background if there are no enduser selections and no designer selections. The easiest solution is to add a designer selection testing a field EQ itself. It may be necessary to have no enduser selections in order to suppress the display (since the Display Sort flag only affects the sort order display). However, it is also permissible to not have a QUERY job step and still use the query; nothing is displayed and it behaves as though the operator just pressed return thru the screens with the only exception that End of Process for Query Setup is not executed. (Note: A QUERY job step with enduser selections can follow the disposition and run OK in background without displaying record selection screens, but if run in foreground it will still display screens.)

Item 12.5

Difference (FYI): APPX differs from SP2 in its definition of INCLUDE RECORD. APPX defines INCLUDE RECORD as follows:

"0" - Do not include this record (used in both Pre-User & Post User Selections)
"1" - Include this record (used in Pre-User Selection to force record inclusion
          EVEN IF IT FAILS Enduser or Designer selections; N/A in Post User)
" " - Let inclusion depend upon meeting Enduser and Designer selections
          (used in Pre-User Selection but N/A in Post User)

Note that APPX resets INCLUDE RECORD to " " before each record is presented to query selection.

Since SP2 code to set (INCLUDE) to 1 is converted to set INCLUDE RECORD to " " in APPX, this difference does not normally cause a problem. The conversion log will flag (INCLUDE) for inspection if it is not used on the left side of a SET command with a constant of 0 or 1 on the right side.

Item 12.6

Difference (compile error): SP2 ignores invalid date constants in record selections but this causes a compile error in APPX. Remove the constant.

Item 12.7

Note (compile error): If you encounter an invalid frame type compile error creating the EM for a query with designer selections, try using Invoke A Process to run Update Process "FRAME (UPD OPTS)" in Application 0AD 00.

Item 12.8

Note (flagged in V05): If AND's and OR's are used in SP2 record selections, the Enduser Selection Expression or Designer Selection Expression generated may be incomprehensible or wrong. Any AND's for fields with no OR's can be ignored (unless parentheses were used in SP2). For fields with both AND's and OR's, consider the following example:

   100     CIC PRODUCT NO                 GE
   200     CIC PRODUCT NO                 LE
   300     CIC PRODUCT NO                 EQ
   400     CIC PRODUCT NO                 EQ
   500     CIC PRODUCT DESCRIPTION        GE
   600     CIC PRODUCT DESCRIPTION        LE
where Enduser Selection Expression = ((100 AND 200) OR 300 OR 400)

Item 12.9

Bug (fixed in APPX 3.0.0): In APPX 1.8.4, the only way to tell if an Enduser Selection Expression exists is to select the option for the pop-up screen (i.e., the option is not highlighted).

Item 12.10

Note (flagged in V05): The conversion utility splits displayed & non-displayed record selection criteria into enduser & designer selections in APPX. This may cause problems for any SP2 sort which OR's displayed with non-displayed selections. The conversion log will flag any OR's on non-displayed selections.

Item 12.11

Action/Note (updating in query flagged in V05): APPX handles queries differently than SP2 handles sorts and such differences can cause problems at runtime. In APPX a query does not get executed until an output/update process is invoked which "uses" that query. If the SP2 sort does any updating of any kind, including setting (FUNCTION CODE), an update or subroutine should be added to the APPX job to perform this code and it should be removed from the query. Remember to check the SP2 Sort X-Ref for all jobs using the SP2 sort. (See item 7.19.)

If such updating is not removed from the query, it may not be completed before the process using the query starts. Also, if a temporary job file is being updated in the query, another copy of this file will be created by the process using the query which will not have the updated values. While a dummy update could be inserted to run the query and solve these problems now, this approach runs the risk of not working later if APPX ever changes query functioning to agree with its documentation.

If the APPX query is setting PROCESS CODE in End of Process, you could add a SUBROUTINE job step prior to the process using the query. The new subroutine could be a do-nothing subroutine named "*SET* PROCESS CODE" with a single comment line (see item 7.11). Post Invocation of the new SUBROUTINE job step should contain the appropriate code from the query End of Process (use Xcopy to copy code). Then this code should be deleted from the query End of Process.

If you decide to add an update, avoid the use of CREATE on temporary job files in the new update (see item 12.2). Also, both the new update and the process already using the query should have query update type 1 (normal). In certain cases you might find that the query is no longer needed and the new update can simply replace it (for example, where the query is sorting on primary key and the operator cannot change the sort or impose record selections). If so, remember to remove the query from UQ besides deleting the query job step.

Beware a query which has a temporary file as its PCF (this condition is not currently flagged). If the temporary file is populated in the job after the QUERY job step, the output/update using the query may not find the populated file whether or not the job is run in background. This may be a valid difference in behavior since the temporary file will be created during query setup by virtue of being the PCF file. Then, when the query is used, the status at query setup is restored. One solution is to invoke the output/update as SUBPROCESS but this may not work if there are other job steps following the output/update since work fields, etc., will be shared; also, this solution may not work in a split job. Another solution is to set 'Separate Task OK?' to "N" in the job. To find such queries plus the jobs that use them, run the APPX Software, Inc. UTL CS utility "QUERY'S with Temporary PCF" and enter "Y" to 'Complete Job?'. Also, check the SP2 X-Ref for the use of queries from cross-applications. (See items 10.30 & 11.5.)

If desired, the APPX Software, Inc. UTL CS utilities can also be used to list updating in QUERY processes (be sure to enter "QUERY" as process type). Use the "APPX STMT I/O List" to list desired I/O commands and use the "APPX STMT 'Format 5' List" to list SET commands on PROCESS CODE.

Item 12.12

Note (FYI): A query will not behave as expected if it comes up in mode other than ADD. The mode is specified in the Override Default Mode field in the job step.

Item 12.13

Difference (FYI): The option to provide for "Continued" subheading messages has not been implemented in APPX.

Item 12.14

Conversion Bug (fixed and flagged in V05): If any SP2 record selection has a non-editable component, the conversion utility may improperly set the 'Editable at Runtime?' flag to "N" for the Enduser Selection Expression. (See item 12.15.)

Item 12.15

Bug (FYI): APPX 3.0.0 does not enforce the 'Editable at Runtime?' flag for the Enduser Selection Expression. If "N", the operator may still edit the expression at runtime.

Item 12.16

Bug?/Difference: In APPX, bogus blank lines may appear in the output if inappropriate subtotals (or subheadings?) are specified in the associated query but not defined in the output. (See item 10.16.)

Item 12.17

Difference (compile error): At runtime SP2 ignores a record selection which references an invalid field (for instance, field does not exist) whereas APPX gets a compile error. Delete the record selection and remove it from the expression if any.

Item 12.18

Bug?/Difference (flagged in V05 after 08/27/96): At runtime SP2 offers the flag 'Print Totals Only (No Detail)?' on the sort selection screen which, if selected, suppresses detail lines on the associated report. APPX provides the same capability but in a different place; at runtime it offers the flag 'Print Summary Only' on the disposition screen. If a SP2 sort is programmed with this flag set to "Y", the conversion utility generates code in Start of Process (Query Setup) to set --- PRINT SUMMARY ONLY = 1 (Yes). This allows the disposition screen to default the flag at "Y". Unless the disposition overrides this value, it should work properly as converted provided there is only one output in the job and provided the job is not used as a job step on another job. However, since PRINT SUMMARY ONLY is only changed by commands or disposition entry, it will remain set throughout the job which can cause subsequent outputs to behave differently. The safest thing to do is to add a job step following the output using the query and have the job step set --- PRINT SUMMARY ONLY = 0 (No). Consider using a subroutine named "*TURN OFF* PRINT SUMMARY ONLY". To find queries setting PRINT SUMMARY ONLY plus the jobs using those queries, run the APPX Software, Inc. UTL CS utility "QUERY's with PRINT SUMMARY ONLY" and enter "Y" to 'Complete Job?'. Also, check the SP2 X-ref for the use of queries from cross-applications.

Item 12.19

Difference (flagged in V05): At runtime SP2 offers the option to specify 'Maximum No. of Records to Print' on the sort selection screen which, if entered, determines the maximum number of records from the sorted file to be included in the report. All records must still meet all sort selection criteria and are sorted in the correct order. Subtotals and grand totals include only those records that actually print. When implemented, APPX will provide the same capability but in a different place; at runtime it offers the option to specify 'Record Limit' on the disposition screen but this currently has no effect (since PRINT RECORD LIMIT has not been implemented).

If a SP2 sort is programmed with 'Maximum No. of Records to Print' set, the conversion utility generates code in Start of Process (Query Setup) to set PRINT RECORD LIMIT accordingly. This allows the disposition screen to default the proper value (unless overridden by the disposition job definition). However, the job will still not work properly in APPX unless and until PRINT RECORD LIMIT is implemented. The conversion log flags this condition.

Until PRINT RECORD LIMIT is implemented, there does not appear to be an easy way to address this problem short of adding an update following the query which will build a job file of pointers with the proper number of records. The new update could then be followed by a new query which used the pointer job file to determine which records to include. The new query would have no enduser selections, a designer selection to avoid the BG bug (see item 12.4), the same sort order as the original query, and would not display to the user. The output would also have to be changed to use the new query.

Item 12.20

Difference (flagged in V05): SP2 allows record selections to have relations for which there is no counterpart in APPX. For example, the SP2 relation 'BW' (Beginning With) on a user-specified selection can be modified in APPX to use 'GE/LE' but the user specification must be entered differently to behave the same way. The conversion log will flag these conditions with the message "Revise Relation".

Item 12.21

Conversion Bug (fixed in V05): Default mode for query processes should be set to ADD (1).

Item 12.22

Action/Bug (all designer selection expressions flagged in V05): In APPX 3.0, if a designer record selection has nothing on the right side of the selection and if it is included in a designer selection expression, APPX will treat the selection as though comparing to blanks (rather than ignoring it). Delete the selection and remove it from the expression.

Although the problem only exists if there is a designer selection expression, all 'do nothing' designer record selections should probably be deleted. To find such selections, run the APPX Software, Inc. UTL CS utility "APPX SELECT File List" and enter process type "QUERY", frame class "QUERY-SLCT-HIDE", and right basic field type "BLANK".

Item 12.23

Action/Bug: In APPX 3.0, if a record selection has a field with right-alignment and/or padding on the left and a constant hard-coded on the right without the corresponding alignment or padding, the record will not be selected. In the case of an end user selection, the proper alignment and padding will be displayed at runtime but it will not be honored unless the user changes something on the record selection screen. In application design, hard code the constant with the proper alignment or padding.

To find such selections, run the APPX Software, Inc. UTL CS utility "APPX SELECT File List" and enter process type "QUERY", 'Check Left for Pad Char?'="Y", 'or Alignment?' ="Y", and right basic field type "CONSTANT". To see the field formats for any selections found, run the "APPX FIELD File Col Hdg List" and name the desired fields as record selections. (Alignment code values are: 0=None, 1=Left, 2=Justified, 3=Right, 4=Centered.)