|
|
![]() |
|
|
|
|
||
|
Did OPNQRYF Retrieve Records? Hey, Ted: Here is a tip you may want to print. Sometimes I need to find out if an Open Query File (OPNQRYF) selection contains any records. For instance, I may want certain programs to run only if OPNQRYF did not select any records. I run the following commands after OPNQRYF runs: /* Copy 1 record for testing purposes */ CPYFRMQRYF FROMOPNID( IVRPTHDQ ) + TOFILE( QTEMP/@DUMMY ) MBROPT( *REPLACE ) + CRTFILE( *YES ) + NBRRCDS( 1 ) RTVMBRD FILE( QTEMP/@DUMMY ) + NBRCURRCD( &RCNT ) IF ( &RCNT *GT 0 ) THEN( DO ) POSDBF IVRPTHDQ *Start CALL Program ENDDO
Of course, this code won't tell you how many records were retrieved, but knowing that at least one record was retrieved or that none were retrieved is sufficient for the vast majority of the cases. -- Mark Thanks for the tip, Mark. This is the best solution I've ever found, and it's the one I've used through the years. -- Ted
|
Editors
Contact the Editors |
|
Last Updated: 7/24/02 Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved. |