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 &DATE2 value of 
=(2021,01,31), the assembler returned the entire character string for the value 
of &DATE2(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 
&OPERAND(1), &OPERAND(2), and &OPERAND(3).
&OPERAND(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 <[email protected]>
> On Behalf Of Steve Thompson
> Sent: Tuesday, August 01, 2023 4:51 PM
> To: [email protected]
> 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:
> >
> > &TAG     MYMAC &DATE1,&DATE2
> >
> > 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, &DATE1 and &DATE2 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, &DATE2 is no longer a sublist. This instruction:
> >
> > &YMD2    SETC  '&DATE2'(2,*)
> >
> > sets &YMD2 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 &DATE2 so that
> I can reference them separately.
> >
> > I apologize if this is basic stuff... I would really appreciate the help!
> >
> > Thanks,
> >
> > David

Reply via email to