With TRUNC(STD), I put my money on the "SYSLIT AT +4" being a binary 
fullword with 10**8 since the ST into MYDATA is storing the remainder of 
the divide.

With TRUNC(BIN), this is consistent w/the behaviour of "IBM Enterprise 
COBOL for z/OS  3.4.1" not using any 64 bit-era instruction, e.g. relative 
addressing and halfword immediate.  Since you show only R7 being stored, 
the "A R6" is superfluous.

IBM Mainframe Discussion List <IBM-MAIN@BAMA.UA.EDU> wrote on 04/08/2008 
02:25:14 PM:

> I gotta ask this, hope you don't mind. Why is the code generation for
> fullword binary so weird? I have:

> 77 MYDATA PIC S9(8) BINARY.
> ..
> ADD +1 TO MYDATA

> The code generated is terrible (to me):

>           L     6,0(0,2)                MYDATA
>           SRDA  6,32(0)
>           LH    0,22(0,10)              PGMLIT AT +10
>           SRDA  0,32(0)
>           AR    6,0
>           ALR   7,1
>           BC    12,164(0,11)            GN=17(0002D8)
>           A     6,0(0,12)               SYSLIT AT +0
>  GN=17    EQU   *
>           ST    7,0(0,2)                MYDATA

> Why is COBOL doing 64 bit arithmetic? Why the BC around the A when the
> contents of register 6 are ignored?

> This is with TRUNC(BIN). With TRUNC(STD), I get:

>      LH    7,22(0,10)              PGMLIT AT +10 (halfword H'1')
>      A     7,0(0,2)                MYDATA
>      LR    6,7
>      SRDA  6,32(0)
>      D     6,4(0,12)               SYSLIT AT +4
>      ST    6,0(0,2)                MYDATA

> which is much better, but still confusing. In my own code, a simple:

>    L   6,MYDATA
>    A   6,PLUS1
>    ST   6,MYDATA

> suffices. Or, going with what would be more similar to COBOL's code:

>    LH   7,=H'+1'
>    A   7,MYDATA
>    ST   7,MYDATA

> what is with the SRDA and D? I cannot determine what SYSLIT+4 is because
> it looks like x'05F5E100' which makes NO sense to me.

> John McKown



-----------------------------------------
The information contained in this communication (including any
attachments hereto) is confidential and is intended solely for the
personal and confidential use of the individual or entity to whom
it is addressed. The information may also constitute a legally
privileged confidential communication. If the reader of this
message is not the intended recipient or an agent responsible for
delivering it to the intended recipient, you are hereby notified
that you have received this communication in error and that any
review, dissemination, copying, or unauthorized use of this
information, or the taking of any action in reliance on the
contents of this information is strictly prohibited. If you have
received this communication in error, please notify us immediately
by e-mail, and delete the original message. Thank you 

----------------------------------------------------------------------
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