Page 1 of 1

Calling bpxwdyn from C

PostPosted: Wed Oct 03, 2012 1:51 pm
by sulmi
Hi
I call an C program from a job step : //EXECSTEP EXEC PGM=MYPROG
In that job I defined DD statement : //IN DD DSN=...,DISP=SHR
Inside my C program I want to obtain Data Set Name from DD name using a call to bpxwdyn : int ret = bpxwdyn("INFO DD(IN) INRTDSN(buffer)");
How should i declare variable "buffer" and how should it be specyfied in bpxwdyn call to make it include Data Set Name after call to bpxwdyn ?
When I declare buffer variable as : char buffer[256]; then call to bpxwdyn mentioned above returns 0 so it seems it works but I don't get anything in "buffer" variable.

Best Regards
sulmi

Re: Calling bpxwdyn from C

PostPosted: Wed Oct 03, 2012 2:24 pm
by NicC
The documentation for BPXWDYN should explain everything. It is available - just Google.

Re: Calling bpxwdyn from C

PostPosted: Wed Oct 03, 2012 2:54 pm
by enrico-sorichetti
Sadly the BPXWDYN is pretty unclear on <return values> for HIGH Level Languages

what is passed to BPXWDYN is a char string whose content is transparent to the HLL used
at run time furthermore no way for an <external> function to access a variable by its <NAME> (rexx apart )


it would be interesting to see the return code You got from the call

Re: Calling bpxwdyn from C

PostPosted: Wed Oct 03, 2012 4:44 pm
by sulmi
I've choosen another way - http://publib.boulder.ibm.com/infocenter/zos/v1r12/topic/com.ibm.zos.r12.cbcpx01/fldbeh.htm#fldbeh
Function fldata retrieves dsname of the open file (field __dsname of the fldata_t structure) :D
But maybe someone has other idea.

Regards

Re: Calling bpxwdyn from C

PostPosted: Wed Oct 03, 2012 5:14 pm
by enrico-sorichetti
if it works for You, it is OK for me ... ;)

sincerely I think that such <queries> should be done without opening the file
opening a file has always some collaterals, and it is better to avoid them