Jump to content

REXX Tips & Tricks:Sample source code for Object REXX

From EDM2

This section contains sample Object REXX source code.

Check if the WPS support is installed

/* Check, if the WPS support for Object REXX is installed             */

   if WPSSupportInstalled() = 1 then
   do
     say 'The WPS support for Object REXX is installed.'
   end /* if */
   else
   do
     say 'The WPS support for Object REXX is not installed.'
     say '(Run "WPSINST + " to install the support)'
   end /* else */
exit

/* ------------------------------------------------------------------ */
/* function: Check if the WPS support for Object REXX is installed    */
/*                                                                    */
/* call:     thisRC = WPSSupportInstalled()                           */
/*                                                                    */
/* returns:  0 - the support is not installed                         */
/*           1 - the support is installed                             */
/*                                                                    */
/*                                                                    */
WPSSupportInstalled: PROCEDURE
  return ( .WPS \= '.WPS' )

Close a folder

/* Close a folder                                                     */

   folderID = '<WP_OS2SYS>'

   call CloseFolder folderID
exit

/* ------------------------------------------------------------------ */
/* function: Close a folder                                           */
/*                                                                    */
/* call:     call closeFolder folderID                                */
/*                                                                    */
/* where:    folderID - Object ID of the folder                       */
/*                                                                    */
/* returns:  -                                                        */
/*                                                                    */
/* note:     Works only with Object REXX; WPS support for Object      */
/*           REXX must be active.                                     */
/*           This routine closes all (!) open views of a folder.      */
/*                                                                    */
/*                                                                    */
CloseFolder: PROCEDURE
  parse arg folderObjectID
  .wpobject~wpclsQueryFolder( folderObjectID,1 )~wpClose
return