Using a vHandle_DEPART function

RAMP-TS

Using a vHandle_DEPART function

You are probably familiar with screen scripts containing a vHandle_ARRIVE function that is executed when a 5250 screen arrives.

Any screen script can also, optionally, contain a vHandle_DEPART function.

If it exists it will be invoked when a screen is being departed from, which is usually caused by a SENDKEY operation.

If you need to use one, add it to your screen’s script like this example:

 

   vHandle_DEPART: function()

   {

      var bReturn = true;

 

      //  your departure logic goes here

 

      return(bReturn); /* ß Remember to return a Boolean success/fail value */ 

 

   },  /* ß Remember to separate this function from the others with a comma */

 

There are some things you should know about using vHandle_DEPART functions:

  • Using them is unusual. If you are using them a lot then it could be you are solving a problem using the wrong approach.
  • They are invoked when the current 5250 screen is submitted to server, usually as the result of SENDKEY operation. This means that they may activate when one of your other scripts is active (eg: the one that did the SENDKEY).
  • Using a SENDKEY operation in a departure script would be expected to fail or cause strange results. You should not do this. 
  • They cannot cancel the submission of the screen. They are being informed that the screen is being submitted and allowed to perform any relevant close or cleanup actions. Returning false indicates that the vHandle_DEPART script failed. It does not indicate that the screen submission should be cancelled.
  • They are invoked every time a screen is submitted.