That will work if &P1 is a relocatable expression, but not if it's base(reg) or (reg).
-- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 עַם יִשְׂרָאֵל חַי נֵ֣צַח יִשְׂרָאֵ֔ל לֹ֥א יְשַׁקֵּ֖ר ________________________________________ From: IBM Mainframe Assembler List <[email protected]> on behalf of Binyamin Dissen <[email protected]> Sent: Monday, February 26, 2024 2:14 PM To: [email protected] Subject: Re: Macro parameters: parsing a relocatable address What I meant was: MACRO , MYCLC &P1,&P2 LCLC &C &C SETC '&SYSNDX' DSECT , MY&C DS CL2 &SYSECT CSECT , PUSH USING USING MY&C,&P1 CLC MY&C,&P2 POP USING MEND , However, it fails on 46 MYCLC 24(R3),ZERO 000006 00000 00008 47+ DSECT , 000006 48+MY0004 DS CL2 000024 00000 00034 49+ CSECT , 50+ PUSH USING 51+ USING MY0004,24(R3) ** ASMA145E Operator, right parenthesis, or end-of-expression expected - (R3) Not sure why the assembler doesn't accept this relocatable expression. On Mon, 26 Feb 2024 10:55:31 -0500 David Eisenberg <[email protected]> wrote: :>Benjamin, :> :>I'm really struggling to understand... how would I use a DSECT and USING to solve this? I can certainly generate those in the macro, but I don't see the technique in this case. :> :>David :> :>On Mon, 26 Feb 2024 17:14:19 +0200, Binyamin Dissen <[email protected]> wrote: :> :>>Generate a DSECT and USING. :>> :>>On Mon, 26 Feb 2024 08:22:00 -0500 David Eisenberg <[email protected]> :>>wrote: :>> :>>:>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 :>> :>>-- :>>Binyamin Dissen <[email protected]> :>>http://secure-web.cisco.com/12D8uQ01ccp0utIHmjacXYXOu5jNYmttF4njp0GLIXLsq-2i6Es4u1iAr4UqCqWTDUSila2VZc28J1aqf-6n5Yv7TLe2ppeDlTlf_TomL8QrqkdJz4rN8WjjdSCh4PSjY-kALmBvtsFBP8NkMh-zVvN85q5bzVhCNO23vM3Gwg21DQnsaGlavs7u_9xS-KRjXKOKiTZiijOF0rnqKIFUGSCyNBKJHtav5Ag8Oq9zHIrbQMJalrvmYQN9pRew-3-zPGt45nCU1ZtDTNJ5bmyjf964mM4tpeWA8VLfFq8q1qE0nemML4RN07iat19zGpZd4DZ2qOmcQhggeOJIv0cZXKNL5XJvo8SY8gM67Ai0ler-eNZ4gcPChKyFauKCmJhBmH-jCgMvJVyZWmxAXEp9ddlrg1nTB9YHjsuHG0atiwBk/http%3A%2F%2Fwww.dissensoftware.com :>> :>>Director, Dissen Software, Bar & Grill - Israel -- Binyamin Dissen <[email protected]> http://secure-web.cisco.com/12D8uQ01ccp0utIHmjacXYXOu5jNYmttF4njp0GLIXLsq-2i6Es4u1iAr4UqCqWTDUSila2VZc28J1aqf-6n5Yv7TLe2ppeDlTlf_TomL8QrqkdJz4rN8WjjdSCh4PSjY-kALmBvtsFBP8NkMh-zVvN85q5bzVhCNO23vM3Gwg21DQnsaGlavs7u_9xS-KRjXKOKiTZiijOF0rnqKIFUGSCyNBKJHtav5Ag8Oq9zHIrbQMJalrvmYQN9pRew-3-zPGt45nCU1ZtDTNJ5bmyjf964mM4tpeWA8VLfFq8q1qE0nemML4RN07iat19zGpZd4DZ2qOmcQhggeOJIv0cZXKNL5XJvo8SY8gM67Ai0ler-eNZ4gcPChKyFauKCmJhBmH-jCgMvJVyZWmxAXEp9ddlrg1nTB9YHjsuHG0atiwBk/http%3A%2F%2Fwww.dissensoftware.com Director, Dissen Software, Bar & Grill - Israel
