Page 1 of 1

ARG not working in Edit Macro

PostPosted: Fri Dec 30, 2022 2:57 am
by Jeff R
I'm trying to get an Edit Macro to accept ARG...Edit Macro is manually entered by user from within an active REXX.
Rexx invokes ISPEXEC View session of a PDS member
User enters Edit Macro "GENCHK x" (where x = a line # within the PDS member)
Edit Macro doesn't accept ARG 'x'

/* REXX */

ADDRESS ISREDIT
"MACRO"

ARG RSTRSTEP
SAY RSTRSTEP
EXIT

(EXIT added just for testing ARG)...RSTRSTEP is blanks

Re: ARG not working in Edit Macro

PostPosted: Fri Dec 30, 2022 4:10 am
by willy jensen
No, EDIT macro parms are accessed like this:

 Address Isredit "MACRO NOPROCESS (P)"  
 if rc=0 then exit EditMac(p)          
 /* regular pgm starts */
 arg name,opts                          
  . . .
 exit 0
 /* edit macro section */
EditMac:                                
 Address Isredit                        
 parse upper var p what .  
  . . .
 exit 0   

where 'p' contains the parm. This also demonstrates how you can use one REXX pgm as both an EDIT macro and a regular pgm.

Re: ARG not working in Edit Macro

PostPosted: Fri Dec 30, 2022 5:48 am
by Jeff R
tried your suggestion and nothing happens (that I'm aware of)

changed
ADDRESS ISREDIT
"MACRO"
to
ADDRESS ISREDIT "MACRO NOPROCESS (RSTRSTEP)"
IF RC=0 THEN EXIT EDITMAC(RSTRSTEP)

added
EDITMAC:
ADDRESS ISREDIT
PARSE UPPER VAR RSTRSTEP
EXIT

not sure what you meant by "arg name,opts" but left in
ARG STRTSTEP
SAY STRTSTEP
EXIT

when i execute REXX (am already in VIEW session of PDS member) by entering "GENCHK 39"...'39' would be the desired input to REXX "GENCHK" and should be the value of STRTSTEP, my SAY STRTSTEP should display '39'
it displays nothing...and I don't hit the EXIT...I am somewhere still in the REXX

Re: ARG not working in Edit Macro

PostPosted: Fri Dec 30, 2022 6:30 pm
by willy jensen
I need to see your pgm to determine why it's not working, but lets keep it really simple then.
Edit macro sample named EM1:
/*    ISPF edit macro       rexx */
 Address Isredit "MACRO PROCESS (p)"
 Address Isredit                    
 say 'parm->' p                

When in edit, issue EM1 Kilroy was here
shows message: parm-> Kilroy was here

Re: ARG not working in Edit Macro

PostPosted: Fri Dec 30, 2022 8:51 pm
by Jeff R
ok, now that worked...thanks !