A Swiss Army knife provides a variety of useful tools all in one place. In this installment of APIs by Example, I’ll present a similar toolset that helps database programmers get the job done efficiently: the Work with Database Files (WRKDBF2) command. The WRKDBF2 command is the result of me performing repetitive tasks against all sorts of database files whenever I was involved in research, design, or programming efforts. I eventually came to the conclusion that a single command offering shortcuts to all the database tools I used most often would be a great time saver; thus, the WRKDBF2 command was born.
WRKDBF2 Command Basics
The WRKDBF2 command is a simple list panel utility. I employ the Open List of Objects (QGYOLOBJ) API to retrieve all the file objects that meet the file criteria specified as the command’s primary parameter. For all physical files, the Retrieve Database File (QDBRTVFD) API is called to ensure that only database files are selected. The WRKDBF2 command’s list panel offers access to a variety of CL commands that specifically target database files.