Calling bpxwdyn from C



Help for C/C++ for MVS, OS/390 C/C++, z/OS C/C++ and C/C++ Productivity Tools for OS/390

Calling bpxwdyn from C

Postby sulmi » Wed Oct 03, 2012 1:51 pm

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
sulmi
 
Posts: 2
Joined: Wed Oct 03, 2012 1:30 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Calling bpxwdyn from C

Postby NicC » Wed Oct 03, 2012 2:24 pm

The documentation for BPXWDYN should explain everything. It is available - just Google.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Calling bpxwdyn from C

Postby enrico-sorichetti » Wed Oct 03, 2012 2:54 pm

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
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Calling bpxwdyn from C

Postby sulmi » Wed Oct 03, 2012 4:44 pm

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
sulmi
 
Posts: 2
Joined: Wed Oct 03, 2012 1:30 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Calling bpxwdyn from C

Postby enrico-sorichetti » Wed Oct 03, 2012 5:14 pm

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
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times


Return to C, C++

 


  • Related topics
    Replies
    Views
    Last post