Here 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.

Don Higgins
d...@higgins.net 

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN

Reply via email to