I don't understand what the point of this code is?

&thread_ptr->buffer[0]

All references to arrays in C decay to a pointer so just use the much simpler 
form:

thread_ptr->buffer

2020-04-29 2:27 PM, retired mainframer wrote:

The LY instruction is picking up the file descriptor (think DD name) so the
IO accesses the correct file.

The memcpy statement doesn't care what file the data came from.   You are
copying whatever is currently in the buffer to reclen and it is obvious that
the buffer is at the start of your structure/class.

-----Original Message-----
From: IBM Mainframe Discussion List <[email protected]> On
Behalf Of Joseph Reichman
Sent: Tuesday, April 28, 2020 6:44 PM
To: [email protected]
Subject: Strange code Generation from XL\C Metal C

I am using a pointer to buffer to read in data the data name is
thread_ptr->buffer buffer is define char[2100]



Here is code when I call the read  notice it bumps register 4 21000 bytes
to
get the address of buffer

_read(thread_ptr->fh, &thread_ptr->buffer[0], reclen);

      L     2,@113thread_ptr

      LY    4,21000(0,2)            (*)threadstor.threadstor.fh

      LLH   14,@123reclen

"IBMUSER.DBGR.SERVER(OPENFILE)"                           Page   68

R14

rce Statement                          HLASM R6.0  2020/04/28 21.34

      L     0,#WSA_1

      L     15,=V(@READ)

      LA    1,224(,13)              #MX_TEMP1

      ST    4,224(,13)              #MX_TEMP1

      ST    2,228(,13)              #MX_TEMP1

      ST    14,232(,13)             #MX_TEMP1

      MVC   8(4,13),#NAB_1+4

      SAC   0

      BASR  14,15

      SAC   512



Here is code where I am trying to copy pos 10 of buffer for 2 bytes notice
there is no LY for 21000 to get to buffer ?



memcpy(&reclen, &thread_ptr->buffer[10],2);

   L     14,@113thread_ptr

   CPYA  2,14

   MVC   @123reclen,10(14)






----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to