Thanks to a previous post for a question I posted on IBM-Main, this code does, in fact, define and use a dynamically constructed variabl name:
&PREFIX SETC 'ETAOIN' &INFIX0 SETC 'ALFRED' &INFIX1 SETC 'PRUFROCK' &SUFFIX SETC 'SHRDLU' &SWITCHID SETC '&PREFIX'.'&INFIX0'.'&INFIX1'.'&SUFFIX' LCLB &(&SWITCHID) ---IDENTIFIER IS: .* 'ETAOINALFREDPRUFROCKSHRDLU' &(&SWITCHID) SETB (T'&P2 NE 'O') ---P2= VALUE CODED/PRESENT? MNOTE '======================' MNOTE '&SWITCHID:=&(&SWITCHID)' MNOTE '======================' And the output of the MNOTEs is: +====================== +ETAOINALFREDPRUFROCKSHRDLU:=1 +====================== However, when I apply the idea to accessing the variables defined on the macro template: MACRO &LABEL TESTMAC &P1=,&P2=,&P3=,&P4=,&P5=,&P6= The assembler complains that the variables, P1, P2, etc are undefined as evidenced by the error message. Unless someone offers further information, it appears the dynamically building the variable names for variables defined on the macro template is not something that can be done, but dynamically creating variables and defining them does work. C- Charles (Chuck) Hardee Senior Systems Engineer Database Administration Information Technology Services Thermo Fisher Scientific chuck.har...@thermofisher.com -----Original Message----- From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] On Behalf Of Art Celestini Sent: Sunday, April 01, 2012 2:30 PM To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: Re: Macro compound symbols I don't think you can dynamically construct a variable name and then expect the assembler to interpret it as a variable name. I'm still guessing at what you are trying to achieve, but consider this, assuming you have &P1=,&P2=,...&P23=,&P24= : LCLC PA(24) Define array with 24 elements &PA(1) SETC '&P1' &PA(2) SETC '&P2' . . . &PA(23) SETC '&P23' &PA(24) SETC '&P24' You can now reference &PA(&I), for example, to access all of the elements of the array. -- Art Celestini At 01:07 PM 4/1/2012, Hardee, Chuck wrote: >Hello, > >Thru the IBM Mainframe list I have been able to get the assembler to accept >the following as valid: > >&VARNAM SETC 'P'.'&I' >&XVAL SETC '&(&VARNAM)' > >&XVAL is defined as LCLC > >This statement: > MNOTE 'VARNAM=&VARNAM' >results in the following in the assembly listing: > +VARNAM=P1 >so it appears that the creation of the compound variable name is working >(compound being defined as the building of a variable name using two or more >parts at runtime.) > >However, this statement: >&XVAL SETC '&(&VARNAM)' >results in the following in the assembly listing: >** ASMA003E Undeclared variable symbol; default=0, null, or type=U - TESTM/P1 >** ASMA435I Record 44 in S01CH.MISC.MACLIB(TESTMAC) on volume: TECH27 >(and I might add that I get the same warning for the remaining variables, P2, >P3, P4 P5 and P6) > >Which makes no sense since the macro is defined: > MACRO >&LABEL TESTMAC &P1=,&P2=,&P3=,&P4=,&P5=,&P6= > >Which, unless I've missed something, defines P1, P2, etc. > >Can anyone shed some light on why the assembler would think that the variables >P1 thru P6 would be thought of as not defined when they are clearly defined in >the MACRO template? > >Thanks, >Chuck > >Charles (Chuck) Hardee >Senior Systems Engineer >Database Administration >Information Technology Services >Thermo Fisher Scientific >chuck.har...@thermofisher.com