Thanks for your help.  Is this in the line of what you are thinking?
Note that I split the macro out into LNKREUS and then LINKOPT, which is called 
by LNKREUS or can be called by itself.

         MACRO ,
&LABEL   LNKREUS &P1,&P2
         AIF   ('&P1' EQ '').DEFAULT
&REUSOPT SETC  '&P1'
         AIF   ('&P2' EQ 'FORCE').SETREUS     IF 'FORCE', IGNORE ERRORS
         AIF   ('&REUSOPT' EQ 'RENT').RENT
         AIF   ('&REUSOPT' EQ 'NONE').SETREUS
         AIF   ('&REUSOPT' EQ 'SERIAL').SETREUS
         AIF   ('&REUSOPT' EQ 'REFR').RENT
         MNOTE 8,'INVALID PARAMETER #1: &REUSOPT'
         MNOTE ,'VALID OPTIONS ARE SAME AS BINDER REUS OPTIONS:'
         MNOTE ,'    NONE, SERIAL, RENT, REFR'
         MNOTE ,'LEAVE BLANK TO DEFAULT BASED ON RENT/NORENT'
         MEXIT ,
.RENT    AIF   (&SYSOPT_RENT EQ 1).SETREUS
         MNOTE 8,'REUS=&REUSOPT; MUST USE RENT ASSEMBLER OPTION'
         MEXIT ,
.DEFAULT ANOP  ,         SET &REUSOPT DEPENDING ON &SYSOPT_RENT VALUE
&REUSOPT SETC  'NONE'
         AIF   (&SYSOPT_RENT EQ 0).SETREUS    DEFAULT NONE IF NORENT
&REUSOPT SETC  'RENT'                         MUST BE RENT
.SETREUS LINKOPT (REUS=&REUSOPT)
.EXIT    MEXIT ,
         MEND  ,

         MACRO ,
&LABEL   LINKOPT &OPTION
         AIF   ('&SYSECT' NE '').BADC
         AIF   ('&SYSLOC' NE '').BADL
         AIF   ('&OPTION' EQ '').BADP1
         AIF   ('&OPTION'(1,1) NE '(').BADP1A
         PUNCH ' SETOPT PARM&OPTION'
         MEXIT ,
.BADC    MNOTE 8,'MUST BE SPECIFIED BEFORE ANY NAMED CTRL SECT'
         MEXIT ,
.BADL    MNOTE 8,'MUST BE SPECIFIED BEFORE ANY LOCTR INSTRUCTION'
         MEXIT ,
.BADP1   MNOTE 8,'MISSING PARAMETER'
         MEXIT ,
.BADP1A  MNOTE 8,'PARAMETER MUST BE IN PARENTHESES'
.SHOWP1  MNOTE ,'PARAMETER IS:  &OPTION'
         MEXIT ,
         MEND  ,

Usage examples:

*PROCESS RENT
         LNKREUS
         LINKOPT (LET=4)
TEST1    CSECT ,
Will punch " SETOPT PARM(REUS=RENT)" and "SETOPT PARM(LET=4)" as the first 
output, causing them to become input to the binder.

*PROCESS RENT
         LNKREUS REFR
TEST1    CSECT ,
Will punch " SETOPT PARM(REUS=REFR)".

*PROCESS NORENT
         LNKREUS
TEST1    CSECT ,
Will punch " SETOPT PARM(REUS=NONE)".

Frank

-----Original Message-----
From: IBM Mainframe Assembler List [mailto:[email protected]] On 
Behalf Of John P. Hartmann
Sent: Monday, February 15, 2016 10:37 AM
To: [email protected]
Subject: Re: Using macro to set assembler option

I'm afraid you're snookered as far as specifying the RENT option dynamically.  
The ACONTROL statement, which can modify some of the assembler options, does 
not include a way to set RENT on or off.

I see not reason why this should be so, particularly since the RSECT 
instruction does just that, but you may not wish to wait for it to happen.

Another matter is whether you can sense that RENT was specified for the 
assembly.  &SYSOPT_RENT is the boolean system set symbol that indicates this.  
Perhaps you can turn the problem on its head?  After all, your macro must be 
issued before the first section is started to get ahead of the ESDs, right?


On 02/15/2016 06:16 PM, Swarbrick, Frank wrote:
> I don't see how this might be possible, but no harm in asking.  I am writing 
> a simple macro which can be used to insert an appropriate SETOPT line to set 
> the link/bind REUS attribute:
>
>           MACRO ,
> &LABEL   REUS  &REUSOPT
>           AIF   ('&REUSOPT' EQ 'RENT').OPTRENT
>           AIF   ('&REUSOPT' EQ 'NONE').SETREUS
>           AIF   ('&REUSOPT' EQ 'SERIAL').SETREUS
>           AIF   ('&REUSOPT' EQ 'REFR').OPTRENT
>           MNOTE 8,'INVALID PARAMETER #1'
>           MNOTE 0,'VALID OPTIONS ARE SAME AS BINDER REUS OPTIONS:'
>           MNOTE 0,'    NONE, SERIAL, RENT, REFR'
>           AGO   .EXIT
> .OPTRENT ANOP  ,
> * something here to turn on ASM RENT option...
> .SETREUS PUNCH ' SETOPT PARM(REUS=&REUSOPT)'
> .EXIT    MEXIT ,
>           MEND  ,
>
> Ideally after the .OPTRENT label there would be something that would also set 
> the assembler RENT option.  But since a *PROCESS option must occur in the 
> source before any other source statements (other than ICTL) I don't see how I 
> can do it.  Any thoughts?
>
> Thanks,
> Frank


The information contained in this electronic communication and any document 
attached hereto or transmitted herewith is confidential and intended for the 
exclusive use of the individual or entity named above. If the reader of this 
message is not the intended recipient or the employee or agent responsible for 
delivering it to the intended recipient, you are hereby notified that any 
examination, use, dissemination, distribution or copying of this communication 
or any part thereof is strictly prohibited. If you have received this 
communication in error, please immediately notify the sender by reply e-mail 
and destroy this communication. Thank you.

Reply via email to