Re: Macros: sublists question

2023-08-02 Thread Steve Smith
Just because a positional sublist parameter works for one (or two) thing
doesn't mean you're limited to using only positional sublist parameters.
Maybe add a keyword TYPE=EQ, or whatever makes sense?

Much more typically, the blinders are on the other side, and people forget
that a positional parameter would be much better than a required keyword of
FUNCTION=foo|baz

sas

On Wed, Aug 2, 2023 at 2:55 AM Rene BRANDT <
14a2846c6667-dmarc-requ...@listserv.uga.edu> wrote:

>  Hi David,
>
> I don't understand your need of the = sign, and a question comes to me :
> why not using a 3rd parameter ?
>
> René
>
>


Re: Macros: sublists question

2023-08-02 Thread Seymour J Metz
Maybe. Have you tried a solution using AINSERT? Or would that get too messy?


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


From: IBM Mainframe Assembler List [ASSEMBLER-LIST@LISTSERV.UGA.EDU] on behalf 
of Rene BRANDT [14a2846c6667-dmarc-requ...@listserv.uga.edu]
Sent: Wednesday, August 2, 2023 2:54 AM
To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
Subject: Re: Macros: sublists question

 Hi David,

I don't understand your need of the = sign, and a question comes to me : why 
not using a 3rd parameter ?

René


 Le mardi 1 août 2023 à 23:12:07 UTC+2, David Eisenberg 
 a écrit :

 Thank you very much, everyone, for these rapid and helpful replies!

I hear you all loud and clear... my concept is apparently wishful thinking. I 
will put the equals sign inside the parentheses so that the parameter is 
treated as a sublist.

David


Re: Macros: sublists question

2023-08-02 Thread Rene BRANDT
 Hi David,

I don't understand your need of the = sign, and a question comes to me : why 
not using a 3rd parameter ?

René


 Le mardi 1 août 2023 à 23:12:07 UTC+2, David Eisenberg 
 a écrit :  
 
 Thank you very much, everyone, for these rapid and helpful replies!

I hear you all loud and clear... my concept is apparently wishful thinking. I 
will put the equals sign inside the parentheses so that the parameter is 
treated as a sublist.

David
  


Re: Macros: sublists question

2023-08-01 Thread David Eisenberg
Thank you very much, everyone, for these rapid and helpful replies!

I hear you all loud and clear... my concept is apparently wishful thinking. I 
will put the equals sign inside the parentheses so that the parameter is 
treated as a sublist.

David


Re: Macros: sublists question

2023-08-01 Thread Bill Hitefield
In my quick playing with it, the assembler treats it as a character string.
I tried to do something like what David did. When I parsed a  value of 
=(2021,01,31), the assembler returned the entire character string for the value 
of (1).
I stripped off the leading '=' and tried to pass the remaining value, the 
'(2021,01,31)' to another macro which attempted to break it down as 
(1), (2), and (3).
(1) was assigned the value of '(2021,01,31)'. The other two were null.

In the past, when I have had a list like that and it was converted to a 
character string, I have had to write a mini-parser to look for the commas and 
pull out the data I wanted.

Not sure if this helps, but it has been my experience.

Bill Hitefield
Dino-Software Corporation
800.480.DINO
www.dino-software.com

> -Original Message-
> From: IBM Mainframe Assembler List 
> On Behalf Of Steve Thompson
> Sent: Tuesday, August 01, 2023 4:51 PM
> To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
> Subject: Re: Macros: sublists question
> 
> I haven't been dealing with HLASM for a few years, and I know that the new 
> kids
> wanted certain new features
> 
> But look at this from the Macro Processor's viewpoint:
> 
>     AAA m=(1,2,,3),=(a,b,c)
> 
> Which one is a "macro" name (or mnemonic) and then which is a keyword and
> which one is positional?
> 
> The second one "=(a,b,c)" is missing the keyword.
> 
> So that statement should be flagged with an error. At least, I would expect 
> that.
> 
> Steve Thompson
> 
> 
> 
> On 8/1/2023 4:39 PM, David Eisenberg wrote:
> > I hope someone can help me; I have a macro assembler question.
> >
> > Suppose I write a macro MYMAC receiving two positional parameters:
> >
> >  MYMAC ,
> >
> > The macro will do some date arithmetic. If I invoke the macro this way:
> >
> >   MYMAC (2023,7,31),(2024,1,15)two dates (year,month,day)
> >
> > then IIUC,  and  are both sublists. I therefore have no trouble
> coding SETA statements so that I can reference the year, month, and day values
> individually.
> >
> > Now suppose I wish to modify the macro parameter syntax by requiring an
> equals sign in front of one of the dates (because I need to handle certain 
> dates
> differently). E.g.:
> >
> >   MYMAC (2023,7,31),(=,2024,1,15)
> >
> > Again, this is simple: I can check for the equals sign and extract the 
> > numeric
> values from the appropriate positions in each sublist.
> >
> > However... suppose I want to allow this syntax:
> >
> >   MYMAC (2023,7,31),=(2024,1,15)
> >
> > in which the equals sign precedes a date, but is *outside* of the 
> > parentheses.
> Now IIUC,  is no longer a sublist. This instruction:
> >
> > SETC  ''(2,*)
> >
> > sets  to the string (2024,1,15) which *looks* like a sublist, but of 
> > course
> it’s not. Maybe I'm on the wrong track. Bottom line: in my last example, I 
> can’t
> figure out how to extract the year, month, and day values from  so that
> I can reference them separately.
> >
> > I apologize if this is basic stuff... I would really appreciate the help!
> >
> > Thanks,
> >
> > David


Re: Macros: sublists question

2023-08-01 Thread Abe Kornelis
Hi David,

As you stated, the parameter is no longer regarded as a sublist by HLASM.
Therefore you'll have to do all the parsing yourself. You'll probably
have to rely
heavily on INDEX, FIND, and substring notation.

Depending on the quality and detail of error messages you might want to
produce,
that could result in a significant amount of code.

From what you wrote it appears you have freedom to choose your own syntax.
If that is correct, why not choose something that aligns better with HLASM
predefined macro invocation behaviour?
Your own suggestion was to use:

 MYMAC (2023,7,31),(=,2024,1,15)

I guess you might also choose to keep sublist  positions compatible:

 MYMAC (2023,7,31),(=2024,1,15)

Kind regards,
Abe Kornelis
===



Op 01/08/2023 om 22:39 schreef David Eisenberg:
> I hope someone can help me; I have a macro assembler question.
>
> Suppose I write a macro MYMAC receiving two positional parameters:
>
>  MYMAC ,
>
> The macro will do some date arithmetic. If I invoke the macro this way:
>
>  MYMAC (2023,7,31),(2024,1,15)two dates (year,month,day)
>
> then IIUC,  and  are both sublists. I therefore have no trouble 
> coding SETA statements so that I can reference the year, month, and day 
> values individually.
>
> Now suppose I wish to modify the macro parameter syntax by requiring an 
> equals sign in front of one of the dates (because I need to handle certain 
> dates differently). E.g.:
>
>  MYMAC (2023,7,31),(=,2024,1,15)
>
> Again, this is simple: I can check for the equals sign and extract the 
> numeric values from the appropriate positions in each sublist.
>
> However... suppose I want to allow this syntax:
>
>  MYMAC (2023,7,31),=(2024,1,15)
>
> in which the equals sign precedes a date, but is *outside* of the 
> parentheses. Now IIUC,  is no longer a sublist. This instruction:
>
> SETC  ''(2,*)
>
> sets  to the string (2024,1,15) which *looks* like a sublist, but of 
> course it’s not. Maybe I'm on the wrong track. Bottom line: in my last 
> example, I can’t figure out how to extract the year, month, and day values 
> from  so that I can reference them separately.
>
> I apologize if this is basic stuff... I would really appreciate the help!
>
> Thanks,
>
> David


Re: Macros: sublists question

2023-08-01 Thread Farley, Peter
I think you are SOL on that last argument format (“=(,mm,dd)”), it just 
isn’t kosher.  Use your second format (“(=,,mm,dd)”) if at all politically 
feasible.

Peter

From: IBM Mainframe Assembler List  On Behalf 
Of David Eisenberg
Sent: Tuesday, August 1, 2023 4:40 PM
To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
Subject: Macros: sublists question



I hope someone can help me; I have a macro assembler question.



Suppose I write a macro MYMAC receiving two positional parameters:



 MYMAC ,



The macro will do some date arithmetic. If I invoke the macro this way:



 MYMAC (2023,7,31),(2024,1,15)two dates (year,month,day)



then IIUC,  and  are both sublists. I therefore have no trouble 
coding SETA statements so that I can reference the year, month, and day values 
individually.



Now suppose I wish to modify the macro parameter syntax by requiring an equals 
sign in front of one of the dates (because I need to handle certain dates 
differently). E.g.:



 MYMAC (2023,7,31),(=,2024,1,15)



Again, this is simple: I can check for the equals sign and extract the numeric 
values from the appropriate positions in each sublist.



However... suppose I want to allow this syntax:



 MYMAC (2023,7,31),=(2024,1,15)



in which the equals sign precedes a date, but is *outside* of the parentheses. 
Now IIUC,  is no longer a sublist. This instruction:



SETC  ''(2,*)



sets  to the string (2024,1,15) which *looks* like a sublist, but of 
course it’s not. Maybe I'm on the wrong track. Bottom line: in my last example, 
I can’t figure out how to extract the year, month, and day values from  
so that I can reference them separately.



I apologize if this is basic stuff... I would really appreciate the help!



Thanks,



David

--

This message and any attachments are intended only for the use of the addressee 
and may contain information that is privileged and confidential. If the reader 
of the message is not the intended recipient or an authorized representative of 
the intended recipient, you are hereby notified that any dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please notify us immediately by e-mail and delete the message and any 
attachments from your system.


Re: Macros: sublists question

2023-08-01 Thread Steve Thompson
I haven't been dealing with HLASM for a few years, and I know 
that the new kids wanted certain new features


But look at this from the Macro Processor's viewpoint:

   AAA m=(1,2,,3),=(a,b,c)

Which one is a "macro" name (or mnemonic) and then which is a 
keyword and which one is positional?


The second one "=(a,b,c)" is missing the keyword.

So that statement should be flagged with an error. At least, I 
would expect that.


Steve Thompson



On 8/1/2023 4:39 PM, David Eisenberg wrote:

I hope someone can help me; I have a macro assembler question.

Suppose I write a macro MYMAC receiving two positional parameters:

 MYMAC ,

The macro will do some date arithmetic. If I invoke the macro this way:

  MYMAC (2023,7,31),(2024,1,15)two dates (year,month,day)

then IIUC,  and  are both sublists. I therefore have no trouble 
coding SETA statements so that I can reference the year, month, and day values 
individually.

Now suppose I wish to modify the macro parameter syntax by requiring an equals 
sign in front of one of the dates (because I need to handle certain dates 
differently). E.g.:

  MYMAC (2023,7,31),(=,2024,1,15)

Again, this is simple: I can check for the equals sign and extract the numeric 
values from the appropriate positions in each sublist.

However... suppose I want to allow this syntax:

  MYMAC (2023,7,31),=(2024,1,15)

in which the equals sign precedes a date, but is *outside* of the parentheses. Now 
IIUC,  is no longer a sublist. This instruction:

SETC  ''(2,*)

sets  to the string (2024,1,15) which *looks* like a sublist, but of course 
it’s not. Maybe I'm on the wrong track. Bottom line: in my last example, I can’t figure 
out how to extract the year, month, and day values from  so that I can 
reference them separately.

I apologize if this is basic stuff... I would really appreciate the help!

Thanks,

David