When the SAVE macro splits the string into 8-byte pieces, it does not handle 
the presence of double apostrophes or double ampersands correctly. It counts 
them as 2 characters when determining the total length, and if they happen to 
occur straddling an 8-byte boundary, it splits them between two generated 
statements, resulting in "No ending apostrophe" or "Illegal use of ampersand".

In the following examples, the string is supposed to be 8 bytes long, but are 
coded with 9 bytes because of the double apostrophes or ampersands, and the 
string is incorrectly treated the same as a 9-byte string. I'm pretty sure the 
SAVE macro has always done this.

When writing macros in the past that dealt with quoted strings, going back even 
to older assemblers, I always had to have logic to handle the double 
apostrophes and ampersands.

000000                00000 0000A     1 TEST     CSECT
                                      2          SAVE  (14,12),,'ABCDEFG'''
000000 47F0 F00E            0000E     4+         B     14(0,15)
000004 09                             5+         DC    AL1(9)
000005                                6+         DC    CL8'ABCDEFG''
** ASMA063E No ending apostrophe - ABCDEFG'
** ASMA435I Record 62 in SYS1.MACLIB(SAVE)
000005                                7+         DC    CL1'''
** ASMA063E No ending apostrophe - '
** ASMA435I Record 58 in SYS1.MACLIB(SAVE)
000005 00                              +
000006 90EC D00C            0000C     8+         STM   14,12,12(13)

000000                00000 0000A     1 TEST     CSECT
                                      2          SAVE  (14,12),,'ABCDEFG&&'
000000 47F0 F00E            0000E     4+         B     14(0,15)
000004 09                             5+         DC    AL1(9)
000005                                6+         DC    CL8'ABCDEFG&'
** ASMA127S Illegal use of ampersand
** ASMA435I Record 62 in SYS1.MACLIB(SAVE)
000005                                7+         DC    CL1'&'
** ASMA127S Illegal use of ampersand
** ASMA435I Record 58 in SYS1.MACLIB(SAVE)
000005 00                              +
000006 90EC D00C            0000C     8+         STM   14,12,12(13)

Bill   

On Wed, 27 Feb 2013 10:18:14 -0800, Phil Smith wrote:

>Elardus Engelbrecht wrote:
>>Which leads me to wonder, after reading all subsequent replies, what was the 
>>content of &SYSPARM? Was it empty (spaces) or not?
>
>It contained six non-blank characters. The original value before I tinkered 
>was seven bytes. Ah, and if I put a seventh in, it works. So the sample wasn't 
>entirely broken, just over-coded - it works equally well with the extra quotes 
>removed.
>
>Well, my problem is solved and I feel a wee bit better about the 
>sample...thanks all!
>
>...phsiii
>From: Phil Smith
>Sent: Wednesday, February 27, 2013 10:09 AM
>To: [email protected]
>Subject: RE: SAVE macro
>
>Thanks, Steve. I had searched for that book but somehow wound up in the 
>Assembler Services Guide, which of course wasn't as helpful.
>
>Removing the extra quotes seems to have fixed it:
>         SAVE  (14,12),,'&SYSPARM &SYSDATE &SYSTIME'
>
>Am I unreasonable to be vaguely horrified that the samples don't even work?
>
>...phsiii

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to