Earler today, I responded to orginal question on the IBM-MAIN list which
was this:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> I am in the process of doing some work in a macro written years ago.
>
> The problem I am faced with is that the parameter list is something like
the following:
>
> LABEL   MACNAME  P1=X,P2=Y,P3=Z,...  Where the parameters can go out to
p24.
> And, unfortunately, there are 4 sets of parameters of this nature, not
to mention a few "unique" parameters on the list (not suffixed with a
number).
>
> My question is, does the macro assembly language allow for compound
variable names?
> So far, everything I have tried has met with resistance from the
assembler.
>
> Thanks,
> Chuck
>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

I responded with the following on IBM-MAIN:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Here is a short example of how to use conditional macro assembler to
handle an arbitary number of macro parameters of the form X=Y where X is
the variable name without & and Y is the character value.  The technique
is to omit the variable names from the explicit keyword parameters for the
macro and then process all the positional parms to find the ones of the
form X=Y. The technigue also uses created macro variables support of of
the form &(...) to create the macro variables from the positional parms.
Here is z390 source assembler TESTPN.MLC assembled with command ASM TESTPN:

         MACRO
         TESTPN
         :&I SETA 1
         AWHILE (&I LE N'&SYSLIST)
             :&PNV SETC '&SYSLIST(&I)'
             :&J SETA ('&PNV' FIND '=')
             AIF (&J GT 0)
                 :&PN SETC '&PNV'(1,&J-1)
                 :&PV SETC '&PNV'(&J+1,*)
                 :&(&PN) SETC '&PV'
             AEND
             :&I SETA &I+1
         AEND
         MNOTE 'P1=&P1'
         MNOTE 'P10=&P10'
         MNOTE 'P1000=&P1000'
         MEND
         TESTPN P1=V1,P10=V10,P1000=V1000
         END

Here is the z390 TESTPN.PRN output assembler listing for the avove source
code:

 000000                                        (1/1)1          MACRO
000000                                        (1/2)2          TESTPN
000000                                        (1/3)3 &I SETA 1
000000                                        (1/4)4 .AWH_1_T ANOP
000000                                        (1/4)5  AIF (NOT(&I LE
N'&SYSLIST)).AWH_1_E
000000                                        (1/5)6 &PNV SETC '&SYSLIST
(&I)'
000000                                        (1/6)7 &J SETA ('&PNV'
FIND '=')
000000                                        (1/7)8  AIF (NOT(&J GT
0)).AIF_1_1
000000                                        (1/8)9 &PN SETC '&PNV'(1,&J-
1)
000000                                       (1/9)10 &PV
SETC '&PNV'(&J+1,*)
000000                                      (1/10)11 &(&PN) SETC '&PV'
000000                                      (1/11)12 .AIF_1_1 ANOP
000000                                      (1/12)13 &I SETA &I+1
000000                                      (1/13)14  AGO .AWH_1_T
000000                                      (1/13)15 .AWH_1_E ANOP
000000                                      (1/14)16
MNOTE 'P1=&P1'
000000                                      (1/15)17
MNOTE 'P10=&P10'
000000                                      (1/16)18
MNOTE 'P1000=&P1000'
000000                                      (1/17)19          MEND
000000                                      (1/18)20          TESTPN
P1=V1,P10=V10,P1000=V1000
000000                                      (1/14)21+         MNOTE 'P1=V1'
000000                                      (1/15)22+
MNOTE 'P10=V10'
000000                                      (1/16)23+
MNOTE 'P1000=V1000'
000000                                      (1/19)25          END

Note the z390 structured conditional macro assembler code used to make the
example more readable is expanded into standard HLASM macro assembler
which is listed as inline macro in the output.

Hope this helps.  This discussion probably does belong on the ASM390 list.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

It does help focus the discussion when the original problem is define
along with assembler question.

Don Higgins
d...@higgins.net

Reply via email to