That's why you will come across truckloads of

/***********************************************************************
* PTR & STG & SWAREQ:                                                  *
*                                                                      *
* Utility procedures to access z/OS control blocks                     *
***********************************************************************/
ptr: return c2d(storage(d2x(arg(1)), arg(2)))
stg: return storage(d2x(arg(1)), arg(2))

swareq: procedure
  if right(c2x(arg(1)), 1) \= 'F' then  /* SWA=BELOW ?                */
    return c2d(arg(1)) + 16             /* Yes, return SVA + 16       */

  sva  = c2d(arg(1))                    /* Convert to decimal         */
  tcb  = ptr(540, 4)                    /* TCB PSATOLD                */
  jscb = ptr(tcb + 180, 4)              /* JSCB TCBJSCB               */
  qmpl = ptr(jscb + 244, 4)             /* QMPL JSCBQMPI              */
  qmat = ptr(qmpl + 24, 4)              /* QMAT QMADD                 */
  do while sva > 65536
    qmat = ptr(qmat + 12, 4)            /* Next QMAT QMAT + 12        */
    sva  = sva - 65536                  /* 010006F -> 000006F         */
  end

return ptr(qmat + sva + 1) + 16

In many REXX routines...

Robert

On Mon, 19 Dec 2022 at 17:12, Rupert Reynolds <rreyno...@cix.co.uk> wrote:

> On Mon, 19 Dec 2022, 15:16 Paul Gorlinsky, <p...@atsmigrations.com> wrote:
>
> > Results from a zos 2.4 system
> >
> > /* */
> > Say c2x(Storage("10",8))
> > Say c2x(Storage(10+0,4))
> > Say c2x(Storage(10+4,4))
> > Z = c2x(Storage(10,4))
> > Say c2x(Storage(Z,8))
> >
> > Results:
> >
> > 00FD4EA800000000
> > 00FD4EA8
> > 00000000
> > 0000021800FED054
> >
> > Any comments?
> >
> > ----------------------------------
>
> From memory*, if you want 8 bytes at CVTPTR then that last line should be
> say c2x(storage(c2x(Z),8)).
>
> I'm thinking the return from storage is raw data, so to use it as a pointer
> represented in hex for storage() you need c2x().
>
> *memory is old, and there are more hex and bin functions available now than
> there were back in the '90s.
>
> Roops
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>


-- 
Robert AH Prins
robert(a)prino(d)org
The hitchhiking grandfather <https://prino.neocities.org/index.html>
Some REXX code for use on z/OS
<https://prino.neocities.org/zOS/zOS-Tools.html>

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to