Need to test for an active USING in a macro 
Author Message
 Need to test for an active USING in a macro

Hi,

I have a need to be able to test if an active using is current from
within a macro. I cannot see anything in the manual to help me. Can
anyone suggest a possible way to do this. Something like this would be
ideal -

        USING   BASE,R2
...
        MACRO
        AIF  (D'BASE).USEOK
        MNOTE *,'No active USING for BASE'
        MEXIT
.USEOK ANOP
        MNOTE *,'USING for BASE is active'
        MEND

D' is used to test if a field is defined, but doesn't work for usings.
The dsect itself is defined at the end of the module.

TIA
Peter

--
Posted via Mailgate.ORG Server - http://www.*-*-*.com/



Sat, 19 Nov 2005 14:40:35 GMT  
 Need to test for an active USING in a macro
Hi,

Quote:
> Hi,

> I have a need to be able to test if an active using is current from
> within a macro. I cannot see anything in the manual to help me. Can
> anyone suggest a possible way to do this. Something like this would be
> ideal -

> USING   BASE,R2
> ...
> MACRO
> AIF  (D'BASE).USEOK
> MNOTE *,'No active USING for BASE'
> MEXIT
> .USEOK ANOP
> MNOTE *,'USING for BASE is active'
> MEND

> D' is used to test if a field is defined, but doesn't work for usings.
> The dsect itself is defined at the end of the module.

> TIA
> Peter

> --
> Posted via Mailgate.ORG Server - http://www.Mailgate.ORG

that it not exactly what you ask for, but
1) If the expansion of your macro uses a field of the DSECT as an operand of
a machine instruction, the assembler will produce an error message
(something like "Adressability error")
2) You can have the listing show at the top of every page which using
instructions are in effect (PRINT USING).


Sat, 19 Nov 2005 23:04:57 GMT  
 Need to test for an active USING in a macro


Quote:
> Hi,

> I have a need to be able to test if an active using is current from
> within a macro. I cannot see anything in the manual to help me. Can
> anyone suggest a possible way to do this. Something like this would be
> ideal -

(snip)

Interesting idea.

So if one existed you would use it, and if it didn't create your own base
register and use that?

As far as I know, the usual system is to do one or the other.  Document that
the macro must be used in an active using range would be a common thing to
do.

-- glen



Sun, 20 Nov 2005 02:43:10 GMT  
 Need to test for an active USING in a macro

Quote:
> Hi,


> > Hi,

> > I have a need to be able to test if an active using is current from
> > within a macro. I cannot see anything in the manual to help me. Can
> > anyone suggest a possible way to do this. Something like this would be
> > ideal -

snip
> that it not exactly what you ask for, but
> 1) If the expansion of your macro uses a field of the DSECT as an operand of
> a machine instruction, the assembler will produce an error message
> (something like "Adressability error")
> 2) You can have the listing show at the top of every page which using
> instructions are in effect (PRINT USING).

Yes, I currently do get addressability error. I have changed a macro
which now
relies on an active using. There are however some instances where there
isn't
an active using. It would have been good to make the macro more
intelligent
and react to this. The alternative is to update all the one-off modules
that
call the macro and the macroi itself to handle the non using case.

Peter

--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG



Sun, 20 Nov 2005 06:59:08 GMT  
 Need to test for an active USING in a macro
Peter,

Quote:
> I have a need to be able to test if an active using is current from
> within a macro. I cannot see anything in the manual to help me. ...

Could you just PUSH the using state (maybe saving BASE ahead as well), and
then go ahead and use your own base regs, then POP the using stae back? Not
clear from your description about what this macro is for and constraints
upon it but this idea may work...

Chris



Sun, 20 Nov 2005 14:18:02 GMT  
 Need to test for an active USING in a macro





:>> > I have a need to be able to test if an active using is current from
:>> > within a macro. I cannot see anything in the manual to help me. Can
:>> > anyone suggest a possible way to do this. Something like this would be
:>> > ideal -

:>snip
:>> that it not exactly what you ask for, but
:>> 1) If the expansion of your macro uses a field of the DSECT as an operand of
:>> a machine instruction, the assembler will produce an error message
:>> (something like "Adressability error")
:>> 2) You can have the listing show at the top of every page which using
:>> instructions are in effect (PRINT USING).

:>Yes, I currently do get addressability error. I have changed a macro
:>which now
:>relies on an active using. There are however some instances where there
:>isn't
:>an active using. It would have been good to make the macro more
:>intelligent
:>and react to this. The alternative is to update all the one-off modules
:>that
:>call the macro and the macroi itself to handle the non using case.

Well, you could get tricky, keeping track of the USINGs, DROPs, PUSH USINGs
and POP USINGs and then stick a keyword on the specific macroes.

--

http://www.dissensoftware.com

Director, Dissen Software, Bar & Grill - Israel



Sun, 20 Nov 2005 14:55:52 GMT  
 Need to test for an active USING in a macro

Quote:

> Peter,

> > I have a need to be able to test if an active using is current from
> > within a macro. I cannot see anything in the manual to help me. ...

> Could you just PUSH the using state (maybe saving BASE ahead as well), and
> then go ahead and use your own base regs, then POP the using stae back? Not
> clear from your description about what this macro is for and constraints
> upon it but this idea may work...

> Chris

The "correct" way to handle this is to PUSH USING to save
the current USING context. Then generate a LABELED USING,
and refer to the dsect fields with the generated label.
When the macro is done, POP USING to restore the prior
USING context. You can use the &SYSNDX for generating
a unique label for the USING for each macro invocation.


Mon, 21 Nov 2005 01:28:51 GMT  
 Need to test for an active USING in a macro

Quote:
> Peter,

> > I have a need to be able to test if an active using is current from
> > within a macro. I cannot see anything in the manual to help me. ...

> Could you just PUSH the using state (maybe saving BASE ahead as well), and
> then go ahead and use your own base regs, then POP the using stae back? Not
> clear from your description about what this macro is for and constraints
> upon it but this idea may work...

> Chris

I did not want to use my own using in the macro. The macro's purpose is
to setup a parm list to call a different module. The macro was changed
to pass a new field addressed by an active using. This covered the case
for the majority of callers to the macro. For the other cases where
there is no active using, the macro is to pass a zero value. The only
alternative I can see is to update all the callers and the macro itself
to pass a parm on the macro indicating a zero value/"non using". It
just would have been nice for the macro to detect it.

Peter

--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG



Mon, 21 Nov 2005 10:22:34 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. A macro involving two sub-macros - where the 2nd macro needs results from the first

2. Need help with VHDL modeling using Active-HDL 3.3 on Warp 5.2 ( PC platform ) from Cypress

3. Need help using MACROS!!

4. using and active using range

5. Testing for active WinWord session (as DDE-Server)

6. Testing a Process to see if it's active in Win9x

7. test: is this group active

8. TSR: Test if dos-prompt is active

9. TSR: Test if dos-prompt is active

10. using test::unit for C++ unit tests

11. Active database objects and Active X

12. memory error using external MD5 Active-X component

 

 
Powered by phpBB® Forum Software