z390development / z390

z390 Portable Mainframe Assembler and Emulator Project
GNU General Public License v2.0
39 stars 15 forks source link

AINSERT statement not shown on listing and ampersand issue #546

Open abekornelis opened 3 months ago

abekornelis commented 3 months ago

z390 has two issues with AINSERT processing:

  1. for each AINSERT statement, HLASM shows the AINSERT statement as a generated statement (preceded by + sign) on the listing, but z390 processes the AINSERT without reporting. Current PRINT settings might need to be taken in to account.
  2. When performing an AINSERT, the specified text argument has its content analyzed and any variables are substituted. Double ampersands and double apostrophes are deduplicated. However, when they occur within a substituted variable, they are not deduplicated. Please change logic to first substitute variables, then deduplicate ' and & characters
abekornelis commented 3 months ago

Here's from a TRACE(M) listing:

AINSERT PUSH=    GBLC &TSTSVAR                                                               
Z4THPCHK    103                  AINSERT '    GBLC &KEY      ',BACK
AINSERT PUSH=    GBLC &&z4thParm_CELLSIZE                                                    
<other code>
AINSERT POP =    GBLC &TSTSVAR
OPEN CODE     0             GBLC &TSTSVAR
AINSERT POP =    GBLC &&z4thParm_CELLSIZE
OPEN CODE     0             GBLC &&z4thParm_CELLSIZE
OPEN CODE     0         0 * MZ390E error  37         (1/0)0 invalid expression variable - &&

As you can see the literal &&TSTVAR gets deduplicated and processed corretly, but the &KEY gets replaced by its value without having its ampersands deduplicated. Please adjust AINSERT behaviour to be better compatible with HLASM