Resuming after Qaction_program()

Having called a QA Build program, if you wish to resume with calls to DP4 screen functions, you must reload the mapset. Additionally, it is advisable to call db_open() again.

To reload a mapset, use the DP4 function map_load() after calling Qaction_program(), for example: map_load("CPROG");

Although it is not always necessary to call db_open(), there may be times when the QA Build program opens the database in a different mode from the C code. To avoid hard coding the database generation number and the open mode you can to use the following scheme:

/* Headers and Definitions */
...
void process()
{
  int ret_code; 
  int save_db_generation = db_generation; 
  int save_db_open_flags = db_open_flags;
  /* C application code */
  ... 
  Qab_init(); 
  ret_code = Qaction_program("QABPROG"):
  db_open("MYDB",save_db_generation,save_db_open_flags);
  map_load("CPROG");
  /* test the return value from Qaction_program */ 
  if (ret_code!=0) 
  {
    /* Warning that call to QA Build was unsuccessful */
    map_pause(2);
  }
  /* Additional C application code */
  ...
}

An even simpler alternative is simply to call the LIBMAKE generated init() again.

Screen Handling in C Programs

You are recommended to use different mapsets for the QA Build and C parts of the program. If you use the same mapset for both, the QABUTIL Weed operation (see Deleting Programs ) would remove any maps used exclusively by the C exits because it recognises (quite correctly) that these maps are not used by any QA Build procedures.

If you want to preserve the screen before calling the QA Build program and recover the screen on return to the C code, you can use map_new_window() and map_old_window() as shown below.

  map_new_window();
  Qaction_program("QABPROG");
  map_old_window();