Charles Mills wrote:
While we're here, I would like to politely dispute the IBMer's implication
(and I apologize for forgetting his name and for paraphrasing) that all you
have to do is code the macros as documented and all will be well. I would
suggest that one cannot write reentrant or otherwise "special" assembler
code (and if you're not writing "special" code -- why are you writing in
assembler rather than COBOL or the like to begin with?) without sometimes
using hand-coded assembler rather than macros, or at least without carefully
checking the PRINT GEN output, rather than just coding macros "as
documented" in COBOL-like bliss that all will be well. In many cases one
must do both: code the macros, check the PRINT GEN output to reverse
engineer how the interface works, and then hand-code equivalent assembler
that will actually assemble without error and/or work.

One GREAT example is the IBM macros' use of branch rather than jump
instructions. Yes, they work as documented, but they conflict with the
exploitation of the (wonderful!) new base-register-constraint-relief jump
instructions.

Characterizing the problem as branch vs jump is gross oversimplification Many of the macros have addressability needs beyond simple branches. For example, the following PGSER invocation:

|    PGSER R,PROTECT,
|          A=(5),
|          EA=(15)

generates this:

+         B     IHB0355A         GENERATE BRANCH AROUND CONSTANT
+IHB0355Z DC    A(X'7FFFFFFF')   CONSTANT TO TURN OFF BIT0 IN A REG
+IHB0355A DS    0H               LABEL FOR TARGET OF BRANCH AROUND
+                                  CONSTANT
+         SLR   0,0              NO ECB --- FORCE REG 0 TO EQUAL ZERO
+         LR    1,(5)            LOAD POINTER TO START OF VIRTUAL
+                                  ADDRESS RANGE INTO PARAMETER REG
+         N     1,IHB0355Z       FORCE BIT0 TO ZERO
+         LA    14,X'0700'+B''00000000'(0,0)
+                                   SET FUNCTION CODE AND OPTION FLAG
+         SVC   138              INVOKE PAGE SERVICE PROCESSOR SVC

Even if the problem with the branch can be mitigated, the AND (N) instruction requires addressability to IHB0355Z in the code generated by PGSER.

Because of this, I have coded the following in at least one program:

|   ********************************************************
|   *                                                      *
|   * PGSER R,PROTECT,              Protect guard page     *
|   *       A=(5),                  - Start address        *
|   *       EA=(15)                 - End address          *
|   *                                                      *
|   * The above macro requires a base register. Defining   *
|   * a temporary base is slow, ugly, and will generate    *
|   * ASMA303W unless we denote a USING range using labels.*
|   * Rather than deal with all that ugliness, we simply   *
|   * "hard-code" the expansion here:                      *
|   *                                                      *
|     LR    1,5                     Start of range         *
|     SLR   0,0                     Indicate no ECB        *
|     N     1,=A(X'7FFFFFFF')       Turn off high bit      *
|     LHI   14,X'0700'              Function code & opts   *
|     SVC   138                     Page Services SVC      *
|   *                                                      *
|   ********************************************************

When IBM "fixes" the PGSER macro, I'll be happy change the code back.

--
Edward E Jaffe
Phoenix Software International, Inc
5200 W Century Blvd, Suite 800
Los Angeles, CA 90045
310-338-0400 x318
[EMAIL PROTECTED]
http://www.phoenixsoftware.com/

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to