Someone in a LinkedIn group I manage recommended calling BPXWDYN (obfuscated
SVC 99) as a solution for retrieving allocation information (see
linkd.in/2CRCw87 ).
Looking into it, I found some tantalizing references, but *everything* I could
find was either inaccurate or misleading.
So, by trial and error, I worked up the following simple example of how to
obtain the DSNAME for a given DDNAME by calling BPXWDYN in Assembler:
GETDSN AMODE 31
GETDSN RMODE ANY
GETDSN CSECT
SAVE (14,12) SAVE CALLER REGS
LR 12,15 R12 = BASE
USING GETDSN,12
LA 1,RSA R1 -> NEW REG SAVE AREA
ST 13,4(,1) CHAIN BACK
LR 13,1 R13 -> RSA
LOAD EP=BPXWDYN
LR 15,0 R15 -> BPXWDYN
SR 0,0 R0 = 0
CALL (15),(INFODD,INRTDSN),VL
L 13,4(,13) R13 -> OLD REG SAVE AREA
RETURN (14,12),RC=(15)
INFODD DC C'INFO DD(DDNAME)',X'00'
INRTDSN DC AL2(45),C'INRTDSN',XL38'00'
RSA DS 18F
Setting R0 = 0 is essential!
Sample JCL for use with above:
/ EXEC PGM=GETDSN
//DDNAME DD DISP=SHR,DSN=<dsname>
On return, the allocated DSN is returned at INRTDSN+2, with the halfword length
at INRTDSN+0.
Documentation (such as there is) for calling BPXDYN is found here:
http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/bpxzb6a0/6.0 - "BPXWDYN:
a Text Interface to Dynamic Allocation and Dynamic Output"
http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/bpxzb6a0/6.9 -
"Requesting Allocation Information"
But the only actual example of information retrieval is in REXX:
http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/bpxzb6a0/6.12 -
"Examples: Calling BPXWDYN From a REXX Program"
I'm quite familiar with how to do this using SVC 99 and would prefer to, given
the excellent documentation for it:
http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/IEA2A8C1/25.0 - "Dynamic
Allocation"
http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/IEA2A8C1/26.0 -
"Requesting Dynamic Allocation Functions"
... but thought I'd publish this as it's the only clear example I know of
anywhere showing how to call BPXWDYN from Assembler for information retrieval.