I’m assuming you’re using RPG.
If you have an exact key, you can use SETLL and check the equal indicator returned. Or you can use an sql SELECT COUNT(*) FROM FILE INTO :COUNT and check whether :COUNT isn’t zeros (although I wouldn’t go down this route unless you need SQL in your program for something else).
Use SETLL in conjunction with %EQUAL built in function
Key SETLL file
* a matching record has found
Hi from PGMBOB
If you do not care about keys and have a CLP program running before your RPG.
RTVMBRD – Retrieve member description can return the record count in the file.
check the value and skip the program if it is zero.
the file informational data structure has informatiooon but you might need to read a record before the statistics are available in the program. Check the specifications. The information for different file types is in different locations.