/***************************  GUIAPPC  ********************************/
/*  (C) International Business Machines Corporation 1996              */
/*      Alan Altmark, VM and VM TCP/IP Development                    */
/**********************************************************************/
/* GUIAPPC EXEC - Starts the CMS Desktop via remote APPC request,     */
/*                automatically issuing the SET WORKSTATION command.  */
/*                                                                    */
/* This program is invoked by CMS APPC Private Server support, so you */
/* need to have                                                       */
/*     SET FULLSCREEN OFF                                             */
/*     SET AUTOREAD OFF                                               */
/*     SET SERVER ON   <--- very important!                           */
/**********************************************************************/
address command
arg symdest .
Call Apiload(CMREXX)
 
address CPICOMM
'CMACCP convid cmrc'
if cmrc <> 0 then
  do
    say 'This program must be invoked as a CMS Private Server'
    exit 88
  end
'CMEPLN convid plu plu_len cmrc'
length = 0
Do until cmrc <> CM_OK
  'CMRCV convid buffer length data',
        'received_length status rts cmrc'
 
  if cmrc = CM_OK & status = CM_CONFIRM_RECEIVED then
    'CMCFMD convid cfm_rc'
End
 
parse value left(plu,plu_len) with avs remote
say 'Remote LU' remote 'has requested the CMS Desktop ('symdest')'
address command
'SET WORKSTAT LU' avs remote
 
address command 'CMSDESK'
if rc = -3 then
  say 'but the desktop is not available on this release of CMS'
exit rc