On 2018-02-05 17:23, Bernd Oppolzer wrote:
IIRC, I had a similar problem once, when trying to retrieve
the DS name from a 3 byte item which was located in the TIOT
near the DD name. This was not possible to do using pure C, because
the 3 byte item (which was an address in early stages of MVS) now
is a sort of handle to an area which has moved above the line,
and to translate this handle to an address, you need the SWAREQ macro.
I ended up writing a wrapper for SWAREQ, usable from C, in ASSEMBLER.
Look here:
CSWAREQ CSECT
*
*-----------------------------------------------------------
*
* int cswareq (char *psva, char **ppjfcb);
*
* PSVA IST DER ZEIGER AUF EIN SVA-HANDLE
* (Z.B. DER JFBC-POINTER AUS DER TIOT).
*
* ZU DIESEM SVA-HANDLE LIEFERT SWAREQ
* DIE ECHTE ADRESSE (DER JFCB LIEGT IN DER SWA -
* SCHEDULER WORK AREA -, DESHALB IST DAS ETWAS
* KOMPLIZIERTER).
*
* DIE ADRESSE DES JFCB WIRD IM ERFOLGSFALL AN
* DEN AUFRUFER ALS 2. PARAMETER ZURUECKGEGEBEN.
*
*-----------------------------------------------------------
*
STM 14,12,12(13)
LR 11,15
USING CSWAREQ,11
LA 15,SAVEAREA
ST 15,8(13)
ST 13,4(15)
LR 13,15
*
L 4,0(1) ADRESSE SVA
L 5,4(1) ADRESSE DES JFCB-POINTERS
*
LA 6,EPA ADRESSE EPA NACH AEPA
ST 6,AEPA
USING ZB505,6
XC SWAEPAX,SWAEPAX EPA INITIALISIEREN
*
MVC SWVA,0(4)
SWAREQ FCODE=RL,EPA=AEPA,UNAUTH=YES,MF=(E,SWAPARMS)
*
LTR 15,15
BZ RETOK
*
XC 0(4,5),0(5)
B RET
*
RETOK DS 0H
MVC 0(4,5),SWBLKPTR
*
RET DS 0H
L 13,4(13)
L 14,12(13)
LM 0,12,20(13)
BR 14
*
*-----------------------------------------------------------
*
SAVEAREA DS 18F
*
AEPA DS A
EPA DS CL28
*
SWAPARMS SWAREQ MF=L
*
CVT DSECT=YES
*
IEFJESCT
*
IEFZB505 LOCEPAX=YES
*
END
The following snippet of REXX came from an exec by Frank Clarke, it should be
fairly easy to translate it to C(++):
ptr: return c2d(storage(d2x(arg(1)), 4))
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 = c2d(storage(21c, 4)) /* TCB PSATOLD */
tcb = ptr(540) /* TCB PSATOLD */
jscb = ptr(tcb + 180) /* JSCB TCBJSCB */
qmpl = ptr(jscb + 244) /* QMPL JSCBQMPI */
qmat = ptr(qmpl + 24) /* QMAT QMADD */
do while sva > 65536
qmat = ptr(qmat + 12) /* next QMAT QMAT + 12 */
sva = sva - 65536 /* 010006F -> 000006F */
end
return ptr(qmat + sva + 1) + 16
--
Robert AH Prins
robert.ah.prins(a)gmail.com
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN