A REXX example of using an INTERACT l'QMF720oop

Normally, when your callable interface program issues an INTERACT command and the user issues the END command, QMF immediately returns control to your program. However, interactive QMF allows the user to issue the END command to return to the QMF Home panel. Issuing the END command a second time ends the QMF session.

By adding the following logic to your program, you can make the END command in an interactive session started by the INTERACT command from a callable interface program behave similarly to the way END behaves in interactive QMF.

This program uses dsq_message_id to determine how to proceed. These values can change from one release to the next.

This program is not distributed with QMF.

Figure 69. REXX program that uses an INTERACT loop
 /*REXX*************************************************************/
 /* Sample Program: Using INTERACT loop                            */
 /******************************************************************/
 /******************************************************************/
 /* Start an interactive QMF session                               */
 /******************************************************************/
 trace error
 
 parms = "START (DSQSMODE=INTERACTIVE"
 call dsqcix parms
 if dsq_return_code = dsq_severe then exit dsq_return_code
 /******************************************************************/
 /* SET GLOBAL to show panel IDs                                   */
 /******************************************************************/
 call dsqcix "SET GLOBAL (DSQDC_SHOW_PANID=1"
 if dsq_return_code = dsq_severe then exit dsq_return_code
 /******************************************************************/
 /* Issue message                                                  */
 /******************************************************************/
 call dsqcix "MESSAGE (TEXT='Ok, You may enter a command.')"
 if dsq_return_code = dsq_severe then exit dsq_return_code
 /******************************************************************/
 /* INTERACT loop                                                  */
 /******************************************************************/
 Continue = "yes"
 Do while continue = "yes"
   call DSQCIX "INTERACT"
   Select
     When (dsq_return_code = dsq_severe) Then  /* Severe Error */
           Continue = "no"
     When (dsq_message_id = "DSQ21869")  Then  /* END from HOME panel */
           Continue = "no"
     When (dsq_message_id = "DSQ90557")  Then  /* User issued EXIT    */
           Continue = "no"
     Otherwise nop                             /* OK continue session */
   End
 End
 /******************************************************************/
 /* End the session                                                */
 /******************************************************************/
 if dsq_message_id <> "DSQ90557" then   /* EXIT not issued         */
   call dsqcix "EXIT"                   /* Issue EXIT              */
 
 exit dsq_return_code
[ Previous Page | Next Page | Contents | Index ]