The purpose, as most know, is to generate the source for an MVCIN
instruction, which was recently discussed (maybe on IBM-MAIN?).

Turns out, I found a bug in it.  It drops characters when && or '' are in
the string.  So replace " &A       SETA  &L" with "&A       SETA  K'&ISTR ".

>From the corrected version:
                                            1954 TAMU     #REVSTR 'Texas
A&&M University'
000012A7 A8A389A29985A589                   1955+         DC
 C'ytisrevinU M&&A saxeT'
000012AF 95E440D450C140A2

000012B7 81A785E3

                        000012BA 00000014   1956+TAMU     EQU   *-1,20

DCLEN is correct for the EQU length.  N.B. In case it's not clear, the EQU
defines the address of the end of the string, with a length attribute.  It
might be handy for say,

         MVCIN  @PRTHDR,TAMU
...
@PRTHDR   DS    CL(L'TAMU)

sas


On Fri, Oct 23, 2020 at 8:06 AM Seymour J Metz <[email protected]> wrote:

> MVCIN is not a BIF in HLASM. Don't confuse what is available at run time
> with what is available at assembly time.
>
> Is there an RFE for a REVERSE BIF in HLASM? Is there a PL/I compile time
> REVERSE function?
>
>
> --
> Shmuel (Seymour J.) Metz
> http://mason.gmu.edu/~smetz3
>
> ________________________________________
> From: IBM Mainframe Assembler List [[email protected]] on
> behalf of [email protected] [[email protected]]
> Sent: Friday, October 23, 2020 12:57 AM
> To: [email protected]
> Subject: Re: Reversed string macro
>
> Have you tried MVCIN ?
>
> > Em qui, 22 de out de 2020 18:08, Steve Smith <[email protected]>
> > escreveu:
> >
> >> Submitted for your consideration...
> >>
> >>          MACRO
> >> &LABEL   #REVSTR &STR
> >> &ISTR    SETC  DEQUOTE('&STR')
> >> &L       SETA  DCLEN('&ISTR')
> >> .*
> >> &A       SETA  &L
> >> .LOOP    AIF   (&A LT 1).DONE
> >> &OSTR    SETC  '&OSTR'.'&ISTR'(&A,1)
> >> &A       SETA  &A-1
> >>          AGO   .LOOP
> >> .*
> >> .DONE    ANOP
> >>          DC    C'&OSTR'
> >> &LABEL   EQU   *-1,&L
> >>          MEND
> >>
> >> E.G.:
> >>
> >> 3161 *
> >> 3162 #TAG     #REVSTR 'IKJTCB'
> >> 3163+         DC    C'BCTJKI'
> >> 3164+#TAG     EQU   *-1,6
> >> 3165 #DOG     #REVSTR 'The quick brown fox jumped over the lazy dog.'
> >> 3166+         DC    C'.god yzal eht revo depmuj xof nworb kciuq ehT'
> >> 3167+#DOG     EQU   *-1,45
>

Reply via email to