I took a quick look at the IHBIN* macros, they are as far as I can tell
undocumented.
I did a sample macro, as I can use it myself, It wasn't as bad as I thought it
might have been.
MyClc &f1,&f2
.*
.* handle addr
.* addr+nn
.* (reg)
.* nn+(reg)
.*
&f1l seta k'&f1
&p seta &f1l
&fe setc '0'
aif ('&f1'(&p,1) eq ')').reg
.* regular address
clc &f1.(2),&f2
mexit
.reg anop
&p seta &p-1
aif (&p le 0).badparm
aif ('&f1'(&p,1) ne '(').reg
&bl seta &f1l-&p-1 -> back-end length
&be setc '&f1'(&p+1,&bl) -> back-end
aif (&p eq 1).reg2 no increment from reg
&fe setc '&f1'(1,&p-1) -> front-end
.reg2 anop
clc &fe.(2,&be),&f2
mexit
.badparm mnote 'Bad parameter'
mend
*
MyClc fw,zero
clc fw(2),zero
*
MyClc fw+2,zero
clc fw+2(2),zero
*
MyClc (r3),zero
clc 0(2,r3),zero
*
MyClc 24(r3),zero
clc 24(2,r3),zero
-----Oprindelig meddelelse-----
Fra: IBM Mainframe Assembler List <[email protected]> På vegne af
David Eisenberg
Sendt: 26. februar 2024 16:53
Til: [email protected]
Emne: Re: SV: Macro parameters: parsing a relocatable address
Willy,
No... I think that would be the tail wagging the dog in this case. I'm looking
for the most reasonable way to do this by generating one (and only one) machine
instruction: CLC .
David
On Mon, 26 Feb 2024 15:40:44 +0000, Willy Jensen <[email protected]>
wrote:
>Would it be acceptable to use a wok register? Then you could have syntax
>(register) or something else for an address.
>So if &field1(1,1) is '(' then you generate LR R14,&FIELD1, else you generate
>LARL R14,&FIELD1 . Followed by CLC 0(2,R14),&FIELD2 .
>
>
>-----Oprindelig meddelelse-----
>Fra: IBM Mainframe Assembler List <[email protected]> På vegne
>af David Eisenberg
>Sendt: 26. februar 2024 16:33
>Til: [email protected]
>Emne: Re: Macro parameters: parsing a relocatable address
>
>Tom,
>
>IIUC, what you're suggesting is this:
>
> CLC &FIELD1(2),&FIELD2
>
>and that works if &FIELD1 is a relocatable symbol. But &FIELD1 might be a
>displacement and a base; e.g., 7(R3) , in which case this would be generated:
>
> CLC 7(R3)(2),<etc>
>
>Or &FIELD1 could be any other valid relocatable expression that would generate
>invalid syntax if I simply append (2) to the end of the string. That's my
>problem: the syntax of the explicit length insertion depends on the syntax of
>the relocatable expression used for &FIELD1.
>
>David
>
>On Mon, 26 Feb 2024 10:21:37 -0500, Tom Marchant <[email protected]>
>wrote:
>
>>Perhaps I'm being dense, but why not
>> CLC FIELD1(2),FIELD2
>>
>>--
>>Tom Marchant
>>
>>On Mon, 26 Feb 2024 09:47:29 -0500, David Eisenberg
>><[email protected]> wrote:
>>
>>>Well, it's a CLC (not an MVC)... but I understand your solution. With that
>>>approach, and PRINT NOGEN is in effect, I get this in the listing:
>>>
>>> Loc Object Code Addr1 Addr2
>>>0002AC D501 0000 0000 00000 00000
>>>
>>>and what I'm trying to do (if possible) is to show the relocatable addresses
>>>under Addr1 and Addr2 in the listing alongside the D501. I.e., I'd like to
>>>generate a single CLC instruction, so that it looks that way in the printed
>>>object code. (I realize that PRINT NOGEN would show the addresses in the
>>>expansion, but they still wouldn't appear on the same line as the CLC
>>>opcode.) So far, the best solution I've come up with is my approach # 2
>>>below (a single DC statement) which produces:
>>>
>>> Loc Object Code Addr1 Addr2
>>>0002AC D501BE65BE63
>>>
>>>That's not bad, but the assembler treats it like a DC (which it is), and not
>>>a machine instruction... and it looks like a DC in the object code.
>>>
>>>The reason I'm generating the CLC in a macro is because the macro is doing
>>>much more than this. There are various macro keyword parameters that I
>>>haven't bothered showing here, and lots of analysis going on with the
>>>comparands before I generate the CLC. I genuinely believe that showing all
>>>those things here would only serve to complicate my question.
>>>
>>>David
>>>
>>>On Mon, 26 Feb 2024 13:44:17 +0000, Seymour J Metz <[email protected]> wrote:
>>>
>>>>Why? What are you trying to solve by wrappng the MVC in a macro?
>>>>
>>>> MVC 0(2),0
>>>> ORG *-4
>>>> DC S(&OP1)
>>>> DC S(&OP2)
>>>>
>>>>but, again, why?
>>>>
>>>>--
>>>>Shmuel (Seymour J.) Metz
>>>>http://mason.gmu.edu/~smetz3
>>>>עַם יִשְׂרָאֵל חַי
>>>>נֵ֣צַח יִשְׂרָאֵ֔ל לֹ֥א יְשַׁקֵּ֖ר
>>>>
>>>>________________________________________
>>>>From: IBM Mainframe Assembler List <[email protected]> on
>>>>behalf of David Eisenberg <[email protected]>
>>>>Sent: Monday, February 26, 2024 8:22 AM
>>>>To: [email protected]
>>>>Subject: Macro parameters: parsing a relocatable address
>>>>
>>>>I’m seeking some guidance if anyone is able to help. I’d like to write a
>>>>macro like this:
>>>>
>>>>&NAME MYCLC &FIELD1,&FIELD2
>>>>
>>>>in which both &FIELD1 and &FIELD2 are relocatable addresses. It’s &FIELD1
>>>>that is of particular interest to me. &FIELD1 might be expressed as a
>>>>hard-coded displacement and base register, or a relocatable symbol… or it
>>>>could be an absolute symbol equivalent to a displacement, followed by a
>>>>base register… etc. I.e., it could be any valid relocatable address syntax.
>>>>What &FIELD1 will *not* have is an *explicit length.* The macro parameters
>>>>will specify valid relocatable addresses, and nothing more.
>>>>
>>>>My question: I’d like the MYCLC macro to generate a CLC instruction in
>>>>which the two parameters are compared to each other for a constant length
>>>>of 2. So far, the only ways I can think of to do this are:
>>>>
>>>>1. Parse &FIELD1 to figure out how the relocatable address is expressed,
>>>>and insert an explicit length of 2 to generate a valid CLC first operand. I
>>>>would do it that way, but (unless I'm missing something) it seems quite
>>>>complex to code.
>>>>2. Generate this DC statement: DC X’D501’,S(&FIELD1,&FIELD2) . This seems
>>>>to work, but it’s a bit unattractive in a PRINT GEN (and it looks a bit odd
>>>>in the assembly listing, because the assembler doesn't treat it like a
>>>>machine instruction in the object code on the left side of the listing).
>>>>
>>>>I’m wondering if anyone can suggest a reasonable way to code option 1
>>>>above. Can the macro assembler give me any help in parsing &FIELD1 so that
>>>>I can transform that parameter to insert an explicit length, regardless of
>>>>how &FIELD1 is expressed? Or is there some other approach that I haven’t
>>>>considered at all? Or should I just go with option 2 above?
>>>>
>>>>Please note that I don’t want the macro to generate more than one machine
>>>>instruction. One way or another, I just want the macro to generate a CLC
>>>>for a length of 2. (And I really do want the CLC located in the macro as
>>>>opposed to open code, because the macro does some analysis on the
>>>>comparands prior to generating the CLC.)
>>>>
>>>>Any advice would be appreciated... thank you!
>>>>
>>>>David