[comp.lang.rexx] sharing external functions between cms rexx programs and xedit rex

jmsommer@miamiu.acs.muohio.edu (Jeff Sommer) (09/25/90)

In article <1990Sep21.154558.25058@wrkgrp.uucp>, ets@wrkgrp.uucp (Edward T
Spire) says:
>
>I'm writing a system using REXX and XEDIT.  I have several useful
>external functions written in REXX that are specific to my application,
>and I want to be able to use them from the REXX EXECs and the REXX
>XEDIT macros.  Yet I find that I need two versions of each of these
>functions, one named FUNCTION EXEC and another named FUNCTION XEDIT.
 
>Does anyone know a way around this redundancy?
 
In your PROFILE XEDIT, include the command 'COMMAND IMPCMSCP ON'.  This way,
when you type something on the XEDIT command line, if XEDIT doesn't know what
to do with it, it is passed to CMS for processing (and then to CP if CMS
doesn't know what to do with the command.)  So, you can have just one file
called FUNCTION EXEC, and when you type FUNCTION on the command line, or from
CMS, your program executes.
 
You can determine whether your EXEC is being called from CMS or from XEDIT
by including these lines in the EXEC:
 
'SUBCOM XEDIT'
if (rc=0) & ^CMSflag('SUBSET') then /* XEDIT stuff */
                               else /* CMS stuff   */
 
>Or would this question be more appropriate to some different list??
 
Is there another place to duscuss such things like comp.sys.vmcms or such?
This is the only place I know of...
 
   Jeff Sommer    Oxford, OH 45056 || jmsommer@miamiu.acs.muohio.edu
   714 S.Locust #13 (513) 523-7424 ||
  ------------------------------------------------------------------
   "Modesty is the art of drawing attention to whatever it is
    you're being humble about." - Alfred E. Neuman

akcs.erk@tronsbox.xei.com (09/29/90)

Author: [Erk]
References: <1990Sep21.154558.25058@wrkgrp.uucp> <90268.102821jmsommer@miamiu.acs.muohio.edu>
Lines: 47

Another suggestion:
 
Use one REXX exec that handles ANY console I/O.
 
Example follows:
------------------------------------------------------------------------
/*
SAMPLE EXEC A
*/
do i = 1 to 20
        call output('Printing #'i)
end
exit
------------------------------------------------------------------------
/*
OUTPUT EXEC A
*/
parse arg output_string
address command 'SUBCOM XEDIT'  ; in_xedit =(rc=0)
address command 'SUBCOM ISPEXEC'; in_ispf  =(rc=0)
                                  in_subset=(CMSflag('SUBSET'))
select
   when in_xedit & ^in_subset then do
           address XEDIT 'MSG' output_string
   end
   when in_ispf then do 
           LMSG=output_string
           address ISPEXEC 'VPUT LMSG'
   end
   otherwise do
           say output_string
   end
end
 
exit
------------------------------------------------------------------------
 
There are obviously limitless numbers of formatting options that could
be added. In the version that I use, I send carriage control and interpret
each of the carriage control characters. (A '1' clears the screen, '0' skips
a line, '-' skips 2 lines... you get the idea)
 
+----------------------------------------+------------------------------+
! Eric Glenn - akcs.erk@tronsbox.UUCP    ! VM/CMS  Unix   PC DOS        !
!              uunet!tronsbox!akcs.erk   ! Ramis   Focus  Rexx    ISPF  !
! Be alert!  The world needs more lerts. ! PL/I    Cobol  C       BASIC !
+----------------------------------------+--------/\YUK/\---------------+