GET_FORM_MESSAGE Function

RAMP-TS

GET_FORM_MESSAGE Function

Get the 5250 message text at a specified row number and optionally route as a Framework message.

Syntax

var bMoreRecords = GET_FORM_MESSAGE([iRow,] [sMoreIndicator,][bRoute]) 

Parameters

iRow

Optional. An integer specifying the message row number. Defaults to the last row.

sMoreIndicator

Optional. The string used by the Application to denote whether there are more messages available. Defaults to "+".

bRoute

Optional. A Boolean to specify whether the message is to be routed to the Framework message area. When true, the text of the message in the screen will be removed. Defaults to true.

 

 

Return Value

Boolean. Returns one of the following possible values:

true

The more indicator was found in an element displayed on the message line

false

The more indicator was not found in an element displayed on the message line

 

 

Remarks

Additionally, RAMP will set a property called vLastMessage in the current form object that will contain the text of the last message retrieved. To use this property in your script use:

 

var sLastMsg = this.vLastMessage;

 

Note that the use of the this pointer is only valid within the current script.

 

Examples

GET_FORM_MESSAGE(22);    /* Extract messages and hide the message line  */

if (this.vLastMessage != "") ALERT_MESSAGE("ERROR:" + this.vLastMessage);

GET_FORM_MESSAGE(22, "More");  

  

The following example shows using GET_FORM_MESSAGES in an Arrival Script to rout all 5250 messages to the Framework

The GET_FORM_MESSAGE retrieves the text visible on the 5250 screen at the nominated line.

If the 5250 screen indicates that there are more messages available the function will return a result of true. For the other messages to be read they must be made visible. This is achieved by setting the cursor to the line displaying the message and sending a Page Down key to the 5250 screen. When the 5250 screen arrives the new message is retrieved. Note that this is an expensive exercise.

 

   /* ====================================================== */
   /* ==================  vHandle_ARRIVE  ================== */
   /* ====================================================== */
   /* Handle arrival at this Destination */
   /* oPayload: The payload supplied by the event initiator */
   /* oPreviousForm: Reference to previous object Form*/

 

   vHandle_ARRIVE: function(oPayload, oPreviousForm)
   {
     var bReturn = true;

 

     SHOW_CURRENT_FORM(true);
     HIDE_5250_BUTTONS();
     SETBUSY(false); /* Turn off the busy state to allow user interaction */

 

     /* Get the 5250 message text from the message area */
     var flagMoreRecords = GET_FORM_MESSAGE(22);

 

    /* If there are more messages */

     if (flagMoreRecords == true)
     {

 

        /* Move the cursor to the line displaying the Messages */
        SETCURSORTOROW(22);

 

        /* Bring up the next message */
        SENDKEY(KeyPageDown);

 

     }

 

    /* <ARRIVE /> - Do not remove or alter this line */

 

     return(bReturn);
   },