On 9 October 2010 17:25, Robert A. Rosenberg <[email protected]> wrote:

> As I commented in a prior reply, you can use a TR (or later a MVCI)
> to reverse the order of the bytes (while copying into a workarea).
> Then using a TRT on the work area finds the last non-blank and you
> can then use the location to find the offset into the original
> version. This was, I think, the method used by HASP and JES2 to
> reduce print line lengths by stripping the trailing blanks.

You can see pretty much all the history of this in a not too huge JES2
module from 1975 or so. It's conveniently online at:
http://www.mainframe.eu/mvs38/asm/HASPSRC/HASPRTAM
and much of the code (including the "*-10" BCT target) survives in today's
JES2.

The basic trailing blank removal code is a CLI + BCT loop (sequence numbers
included for easy reference):

        LR    WA,R1               GENERATE ADDRESS
S0488500
        AR    WA,R0                OF LAST BYTE
 S0489000
        BCTR  WA,0                SCAN BACKWARDS
S0489500
        CLI   0(WA),C' '           ELIMINATING
S0490000
        BNE   MPUT                  TRAILING
S0490500
        BCT   R0,*-10                BLANKS
 S0491000
        SPACE 2
 S0491500

This code dates from the very early days of HASP, and was used only for
remote BSC devices. Even then, for shops with many remotes printing short
lines, the total CPU consumption in this tiny routine was claimed (at SHARE
and such places) to often hit several percent.

Later code (I mean later than the early days, but already present in the mid
1970s version) has much fancier code that includes TRT for SCS compression,
but still uses the CLI + BCT method, though with a supposed optimization
with a register target, for trailing blank removal:

        ALR   RSRCE,RLSRCE        GENERATE ADDRESS OF LAST BYTE + 1 R4
S1816000
        LA    RFEED,MVKDDATA      OPTIMIZE LOOP WITH ADDRESS IN REG R4
S1816500
SKIP310 BCTR  RSRCE,0             SCAN BACKWARDS                    R4
S1817000
        CLI   0(RSRCE),C' '        ELIMINATING                      R4
S1817500
        BNER  RFEED                 TRAILING                        R4
S1818000
        BCT   RLSRCE,SKIP310         BLANKS                         R4
S1818500

This too, survives in curent JES2, though it is amusing to note that the
coding style that promoted the use of symbolic register names like RSRCE and
WA has been thoroughly deprecated in favour of R6, R14, and the like.

Tony H.

Reply via email to