When were DCLEN and DEQUOTE introduced?

On Mon, Jun 10, 2024 at 10:58 AM Willy Jensen <[email protected]>
wrote:

> Jon's suggestion of using the DCLEN built-in seems the way to go, maybe
> together with the DEQUOTE built-in.
>
> Quick test:
> Stmt   Source Statement
>    1 T        CSect
>    2          using t,15
>    4          Macro
>    5          testk &t
>    6 &l       seta  dclen('&t')
>    7          mnote *,'len=&l'
>    8          mend
>   10          testk 'Testing an unquoted string'
>   11+*,len=28
>   13          testk 'Testing a ''quoted'' string'
>   14+*,len=27
>   16          testk  Testing_a_non_en_closed_string
>   17+*,len=30
>   19          end
>
> Willy
>
>
> -----Oprindelig meddelelse-----
> Fra: IBM Mainframe Assembler List <[email protected]> På
> vegne af Jon Perryman
> Sendt: 10. juni 2024 07:36
> Til: [email protected]
> Emne: Re: Count attribute (K’)
>
> On Sun, 9 Jun 2024 17:29:22 -0500, Janko Kalinic <
> [email protected]> wrote:
>
> >   3 &NAME    M$TX  &TEXT
>
> Handling of variables on the macro prototype statement is different than
> SETC. Quoting is one of the peculiarities.
>
> >   6 &NAME    DC    AL2(&A,0),C&TEXT
> >  11+USFG81   DC    AL2(25,0),C'X''08'' PDSE DATA SET'
>
> You know that &TEXT is not considered a quoted variable because C&TEXT
> retained the leading/trailing quotes instead of dropping them.
>
> >   5 &A       SETA  K'&TEXT-2+4
>
> Using K' is not an acceptable solution for this problem because the count
> does not always match the length of the constant. There are multiple
> solutions. If I remember correctly, you can use DCLEN(C&TEXT) but when
> dealing with less experienced programmers, I suggest using something like
> the following because your intentions are obvious in the listing & it
> guarantees you are not impacted by MACRO quirks.
>
> &NAME    M$TX  &TEXT
> &NAME    DC    AL2(&NAME._E-&NAME,0),C&TEXT
> &NAME._E EQU *
>

Reply via email to