Macro compound symbols
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
Re: Macro compound symbols
You didn't set or define variable P1. Message ASMA300E tells you that variable P1 is not set (notice the TESTM/P1) Regards, Jon. From: Hardee, Chuck chuck.har...@thermofisher.com To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Sent: Sun, April 1, 2012 10:07:23 AM Subject: Macro compound symbols 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
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
Re: Macro compound symbols
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
Re: Macro compound symbols
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: 00(1/1)1 MACRO 00(1/2)2 TESTPN 00(1/3)3 I SETA 1 00(1/4)4 .AWH_1_T ANOP 00(1/4)5 AIF (NOT(I LE N'SYSLIST)).AWH_1_E 00(1/5)6 PNV SETC 'SYSLIST (I)' 00(1/6)7 J SETA ('PNV' FIND '=') 00(1/7)8 AIF (NOT(J GT 0)).AIF_1_1 00(1/8)9 PN SETC 'PNV'(1,J- 1) 00 (1/9)10 PV SETC 'PNV'(J+1,*) 00 (1/10)11 (PN) SETC 'PV' 00 (1/11)12 .AIF_1_1 ANOP 00 (1/12)13 I SETA I+1 00 (1/13)14 AGO .AWH_1_T 00 (1/13)15 .AWH_1_E ANOP 00 (1/14)16 MNOTE 'P1=P1' 00 (1/15)17 MNOTE 'P10=P10' 00 (1/16)18 MNOTE 'P1000=P1000' 00 (1/17)19 MEND 00 (1/18)20 TESTPN P1=V1,P10=V10,P1000=V1000 00 (1/14)21+ MNOTE 'P1=V1' 00 (1/15)22+ MNOTE 'P10=V10' 00 (1/16)23+ MNOTE 'P1000=V1000' 00 (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
Re: Macro compound symbols
We've already moved the OP once. I am happy to have further discussion of his problem stay here on the ASSEMBLER-LIST, but I am not yet clear what exactly that problem is. He now presumably knows how to construct compound' set-symbol identifiers, as in |atomic0 setc 'H2' |atomic1 setc 'O' |compound setc 'atomic0'.'atomic1' What did/does he want to do with these admittedly wondrous things? John Gilmore, Ashland, MA 01721 - USA
Re: Macro compound symbols
This is a bug in HLASM that IBM refuses to fix. Actually, they did agree to fix it but wanted money to do so. A performance improvement in macro processing broke the ability to use created set symbols to reference macro parameters a long time ago. Now it is a feature. I call it broken as designed. David Bond On Apr 1, 2012, at 10:07 AM, Hardee, Chuck chuck.har...@thermofisher.com 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
Re: Macro compound symbols
Several posters have mentioned the correct solution (which in your case isn't a solution); you can't create the name of a positional or keyword parameter, nor the name of a HLASM system variable symbol., The reason is that HLASM compiles those names into a special pre-defined dictionary during macro encoding, so that the macro can be expanded more rapidly. (You can see the approximate format of that dictionary when you specify an appropriate MHELP directive inside a macro.) An alternative (and much slower) implementation could parse the macro definition anew for each call. However, this could allow setting new values for parameters that differ from the argument values passed by the caller, or to system variable symbols whose values are (supposed to be) owned by HLASM.