> -----Original Message-----
> From: CMSTSO Pipelines Discussion List 
> [mailto:cms-pipeli...@vm.marist.edu] On Behalf Of Paul Gilmartin
> Sent: Thursday, November 25, 2010 10:12 AM
> To: CMS-PIPELINES@VM.MARIST.EDU
> Subject: Converting an EXEC to a stage
> 
> I have been bestowed (long ago) a sizable (over 1000 lines) 
> EXEC. I'm considering converting it to a REXX stage so I can 
> use plumbing; avoid use of temporary files and the dreadful 
> CMS console stack, replace some EXECIO 1 DISKR with READTO 
> (or even PEEKTO!), etc.  But I'd like to avoid changing code 
> where it's unnecessary.
> 
> I have a POC:
> 
>     /* REXX tiny_2Erexx Thu Nov 25 10:43:48 MST 2010 */ 
> signal on novalue;
>     trace R
> 
>     parse source sys invoked exfn exft exfm cmd env
> 
>     STAGE = address()
>     say c2x( STAGE ) STAGE
>     address 'COMMAND'
> 
>     'IDENTIFY'
> 
>     address value STAGE
>         'addpipe < PROFILE EXEC A | CONSOLE'
>     address
> 
>     say address()
>     return( RC )
> 
> o Seems to work.  But what are the pitfalls?
> 
> o the PIPE command has no syntactic objections to a single-stage
>   pipeline.  Nice.
> 
> o ADDRESS VALUE environment command isn't allowed, so I must use
>   three instructions instead of one.  Rexx limitation.  Nuisance.
> 
> o PARSE SOURCE won't return a useful subcommand environment name;
>   I must use address().  Silly.
> 
> Thanks,
> gil
>

I like to use a construct like this (I will leave coding the syntax, novalue 
and error routines to the individual):

/* */                             
signal on syntax                  
signal on novalue                 
parse source . . myn myt . . how .
if how = '?' then signal filter  
Signal on error 
address command                   
. . .                             
'PIPE (end \ name' myn')',        
'\ preliminary stages',           
   '| rexx ('myn myt')',          
   '| following stages'           
exit rc                           
                                  
filter:                           
   signal on error name eof       
                                  
   (do the real work)                  
                                  
eof: exit rc * (rc ¬= 12)          

Note that you do not need to worry about the addressing environment. If you 
have to use 'address command' for some reason, either do it on the individual 
commands as in 

        address command 'CP do something' 

or you enter a naked 'address' command to return to the previous environment as 
in:

        address command
        'command 1'
        'command 2'
           . . .
        'command n'
        address 

The advantage of doing it like this is that you only have one program that you 
have to update.


Regards, 
Richard Schuh 

Reply via email to