|  |     I have spent some time trying to run a report ONLY once and then
    depending on whether there are records found or not, print out a
    message if not or the records if they are found.  But alas, with
    no luck.
    
    The method we currently use is to use the same IF selection on a
    TABLE FILE with IF RECORDLIMIT EQ 1 test. This test will run pretty
    quickly, and then you'll know to run the full report or TYPE/CRTFORM
    a message to the user.
 | 
|  | Hello,
Thank you for all your responses. Based on what you told us, we did a
couple of experiments. We find that &RECORDS and &LINES can both be
used as described, but that &LINES is generally more useful. 
This is because &RECORDS gives the number of records processed by the
last 'READ-type' operation while &LINES gives the number of records by
the last 'WRITE-type' operation. Thus there's not much difference when
doing a simple TABLE with no selection criteria, but it becomes
significant when doing MATCH's.
For example:
    MATCH FILE x
    ...
    IF selection criteria 1
    RUN
    FILE y
    ...
    IF selection criteria 2
    AFTER MATCH HOLD OLD-OR-NEW
                         ^^
If selection criteria 1 result in some records found, and 
selection criteria 2 result in no records found, then &LINES is
non-zero, but &RECORDS is. ie. &LINES gives the correct result.
Conversely:
    MATCH FILE x
    ...
    IF selection criteria 1
    RUN
    FILE y
    ...
    IF selection criteria 2
    AFTER MATCH HOLD OLD-AND-NEW
                         ^^^
If both selection criteria 1 AND 2 result in some records found, 
but they don't overlap, then &RECORDS is non-zero, but &LINES 
is. Again, &LINES gives the correct result.
Regards to all, Sim & Andr�.
 |