Ref:  Your note of Mon, 11 Nov 2019 11:08:39 -0500

The USING 0 case used to occur from time to time by accident
when using PL/S, PL/X or similar compilers which generate
assembler as an intermediate step, if the programmer switched
into assembler temporarily.  This was because the programmers
often failed to realise that the compiler translated a structure
to a set of equates for offsets, not a DSECT.

So a programmer might code something like the following within
the assembler fragment:

         USING STRUCT1,R9
         L     R10,FIELD1
         ...
         DROP  R9

where the compiler had generated something like:

STRUCT1  EQU   0
FIELD1   EQU   8
         ...

This actually appeared to work correctly for the simplest cases,
but produced very unexpected results when a macro was used
within the scope of the USING which used LA 0,number to set up a
macro parameter.

In theory, one could protect against this by specifying a zero or
omitted base register:

         LA    0,1(0,0)
or
         LA    0,1(,0)

However, specifying an index register is not enough:

         LA    0,1(0)
is no safer than
         LA    0,1

But I would not recommend doing anything fancy here; warning
message ASMA306W already calls attention to this problem, and
anyone who suppresses the warning using FLAG(NOUSING0) or the
relevant USING(WARN(n)) option can expect to enjoy the weird
consequences.

Jonathan Scott, HLASM
IBM Hursley, UK

Reply via email to