>>  Asserting that the register always points to that DSECT is another
example of telling a lie to the Assembler

Not to me.  To me, "USING TXTINPT,R10" tells the assembler that it is to
establish a "using" range, from the current location and onward (until a
DROP location, if any) such that whenever a reference is made (within that
range) to storage from the specified location and onward (through the base
addressing boundary of said storage; and this is one way that runtime
storage violations can occur--if references are attempted beyond the length
of a DSECT, e.g., by wild indexing) that it should use R10 as the base
register of said reference -- and that is all completely true.  The
assembler doesn't care what is in the register.  All it cares about is
being able to insert a base register reference into a machine instruction.

However, note that *none* of my DSECT base registers are ever DROP'd.  This
entire subroutine constantly refers to fields in all three DSECTs -- all
the time.  The following is the beginning of the subroutine (which contains
18 different function or operations that it can perform):

* =================================================================== *
TXTMAN   HEADER VERSION='1.2',AUTHOR='DLC',DATE='(C)DEC89',            X
               BASE=R11
* ------------------------------------------------------------------- *
         IF    0(R1),(O,TM),X'80',OR,       PARM LIST CAN'T END        X
               4(R1),(O,TM),X'80'           WITH PARM 1 OR 2
           MVI TXTRETN,C'L'       SIGNAL PARMLIST LENGTH ERROR
           B   RETURN             GO RETURN TO CALLER
         ENDIF
*
         LM    R8,R9,0(R1)        GET ADDR. OF FIRST 2 PARAMETERS
         LA    R1,4(,R1)          INCREMENT TO LAST PARM REFERENCED
         ST    R1,SAVEPTR         SAVE PARAMETER ADDRESSES POINTER
* ------------------------------------------------------------------- *
SETUP    EQU   *                  LOOP TIL ALL PARM STRINGS PROCESSED
         BAS   R2,GETSTRG         GET (NEXT) STRING PARAMETER ADDRESS
...etc...

Obviously, R8 and R9 are set out in the open here and the USING for those
two could certainly go here, too.  But R10 is set/reset/adjusted inside of
that BAS call -- and that same BAS call is made in two other places in the
subroutine.

Certainly, the USING for R10 could be put in that subroutine.  But, then it
would be buried and there is executable code that exists after the point
showed, above, and before where the target of that BAS code is further
down in the source.

Then every other function, besides the two I just hinted at, loops back to
the SETUP label, above, to get the next string parameter to process.  Here
is that BAS target.

* ------------------------------------------------------------------- *
GETSTRG  EQU   *   GET THE NEXT STRING PARAMETER ADDRESS (IF ANY)
* ------------------------------------------------------------------- *
         MVI   TXTRETN,X'40'      CLEAR RETURN CODE FIELD
         L     R1,SAVEPTR         GET PARAMETER ADDRESS POINTER
         L     R10,0(,R1)         GET ADDRESS OF PREV PARAMETER
         ST    R10,SAVEADDR       STORE FOR TESTING (DUAL USE)
         IF    SAVEADDR,(O,TM),X'80',BC,RETURN   IF LAST PARM PROCESSED
         ENDIF                                   RETURN TO ORIG CALLER
         L     R10,4(,R1)         GET ADDRESS OF NEXT PARAMETER
         LA    R10,0(,R10)        CLEAR LAST PARM INDICATOR (IF ANY)
         LA    R1,4(,R1)          INCREMENT TO LAST PARM REFERENCED
         ST    R1,SAVEPTR         SAVE PARAMETER ADDRESSES POINTER
         IF    TXTREQU,EQ,C'S'    IF IN SCRIPTING MODE
          LA   R10,2(,R10)         POINT TO LEGACY LENGTH AND STRING
         ENDIF                    ENDIF
         BR    R2                 RETURN TO CALLER

Now, if you've read this far, I'd also like to ask about testing a register
for the 0-bit setting (instead of having to store an address and use TM
with X'80').  Would the following statement be fine to use for that?

         IF    R10,(M,LTR),R10,BC,RETURN   IF LAST PARM PROCESSED

Sincerely,

Dave Clark
--
int.ext: 91078
direct: (937) 531-6378
home: (937) 751-3300

Winsupply Group Services
3110 Kettering Boulevard
Dayton, Ohio  45439  USA
(937) 294-5331


On Wed, Feb 11, 2026 at 3:21 PM Jonathan Scott <
[email protected]> wrote:

> Putting the USING with the DSECT is not very good practice.  USING and
> DROP statements should normally be used at the start and end of ranges of
> source statements where it is valid for the assembler to use the relevant
> mapping, so that the assembler has specific information to check against,
> and can detect errors, for example where a DSECT field is referenced before
> the register is set up or after it is no longer valid.  Asserting that the
> register always points to that DSECT is another example of telling a lie to
> the Assembler, which is generally a bad idea.
>
> Jonathan Scott
>
>

Reply via email to