REXX procedure ERBCSGUI

/* REXX **************************************************************/
/*                                                                   */
/*01* MODULE-NAME: ERBCSGUI                                          */
/*                                                                   */
/*01* DESCRIPTIVE-NAME: Setup for RMFCS GUI connection               */
/*                                                                   */
/*01* FUNCTION:                                                      */
/*       ERBCSGUI sets up the GUI connection and issues the          */
/*       connection request                                          */
/*                                                                   */
/*01* NOTES:                                                         */
/*       None.                                                       */
/*                                                                   */
/*01* OPERATION:                                                     */
/*       1. retrieves the system name from CVT                       */
/*       2. builds the GUI command string from the input             */
/*          parameter or from default                                */
/*       3. issues the ISPSTART command for the GUI connection       */
/*                                                                   */
/*01* RECOVERY-OPERATION: None                                       */
/*                                                                   */
/*01* DEPENDENCIES: ISPF 4.2.0 environment (or higher)               */
/*                                                                   */
/*01* INVOCATION:                                                    */
/*       1. ERBCSGUI LU:NET_id.LU_id                                 */
/*       2. ERBCSGUI IP:IP_address                                   */
/*       3. ERBCSGUI                                                 */
/*                                                                   */
/*01* CALLER: ERBCSCTL                                               */
/*                                                                   */
/*********************************************************************/
Trace O
Parse Upper Arg guiaddr .

home_lu = "LU:NET_id.LU_id"         /* Provide your default LU here  */
home_ip = "IP:IP_address"           /* Provide your default IP here  */
error_rc = 985                      /* Invalid connection attempt    */
/*-------------------------------------------------------------------*/
/* Selections for GUI session entry                                  */
/*-------------------------------------------------------------------*/
m0parm = "PANEL(ISR@PRIM)"
m1parm = "CMD(RMF)"
m2parm = "CMD(RMF 2)"
m3parm = "CMD(RMF 3)"
wfparm = "CMD(ERBRMF MON3 PARM(WFEX))"
siparm = "CMD(ERBRMF MON3 PARM(SYSINFO))"

stdparm = m0parm                    /* ISPF primary selection menu   */
/*-------------------------------------------------------------------*/
/* Use internal default, if input parameter is empty                 */
/*-------------------------------------------------------------------*/
If guiaddr = "" Then
Do
  If home_lu \= "" Then guiparm = "GUI("home_lu")"
    Else guiparm = "GUI("home_ip")"
End
  Else guiparm = "GUI("guiaddr")"
/*-------------------------------------------------------------------*/
/* Setup the GUI request string and issue the connection request     */
/*-------------------------------------------------------------------*/
cvt = c2x(storage('10',4))
cvtsname = storage(d2x(x2d(cvt)+x2d('154')),8)
title = "TITLE(RMFCS_"cvtsname")"
guiscrw = "GUISCRW(121)"
guiscrd = "GUISCRD(32)"
newappl = "NEWAPPL(ISR)"

"ISPSTART" stdparm guiparm title guiscrw guiscrd newappl
/*-------------------------------------------------------------------*/
/* Try TCP/IP alternatively, if first try was unsuccessful           */
/*-------------------------------------------------------------------*/
If (rc = error_rc) &,
   (home_ip \= "") &,
   (home_lu \= "") Then
Do
  guiparm = "GUI("home_ip")"
  "ISPSTART" stdparm guiparm title guiscrw guiscrd newappl
End

Exit rc