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:
>
> &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