SELECT DATABASE


Used in conjunction with the NEXT DATABASE predefined field, this subroutine process accesses a different database. This database becomes the current database and is used by any subsequent detached child processes.

To use this subroutine, set the NEXT DATABASE field to the new database ID, then call the SELECT DATABASE predefined subroutine as a subprocess.

          SET      --- NEXT DATABASE              =      TST
          SUBR     --- SELECT DATABASE                  SUBPROCESS   END? N  FAIL 0

Another method of changing databases based on user selection is the use of designer-defined subroutines. These subroutines can be executed from menus when a user makes a selection to change from one database to another. For example, if a menu contains an option for a user to change from the current database to database ABC, the corresponding optional child would be a subroutine called, perhaps, SELECT DATABASE ABC. You can create a subroutine for every database defined for your installation and allow users to select them via menu options. These subroutines can also be executed from jobs or other processes when navigation between multiple databases is required.

The aforementioned subroutine would consist of these ILF statements:

          SET      --- NEXT DATABASE              =      ABC
          SUBR     TSY SELECT DATABASE ABC              SUBPROCESS   END? N  FAIL 0