> -----Original Message-----
> From: IBM Mainframe Discussion List 
> [mailto:[EMAIL PROTECTED] On Behalf Of spachfr
> Sent: Monday, September 03, 2007 9:27 AM
> To: IBM-MAIN@BAMA.UA.EDU
> Subject: BPXBATCH utility, how to access to PDS member ?
> 
> 
> Hello,
> 
> I have write a pgm in C language. This PGM access in read 
> mode to a member
> of a PDS.
> When the pgm run by JCL (like //STEP1   PGM=myprog) is worked find.
> 
> I want to use it under Unix services with BPXBATCH utility, 
> but when the PGM
> try to  access to the member it failed with a return code 
> (errno) 129 "no
> such file or directory".
> The code is the same !(?) 
> 
> My JCL:
> //RUNSHELL EXEC PGM=BPXBATCH,                       
> //  PARM='PGM /u/myprog'                             
> //STDOUT DD PATH='/u/resul',                        
> // PATHOPTS=(OCREAT,OTRUNC,OWRONLY)                 
> //SYSRPM DD DSN=USER1.PDS.PARMLIB(CMDPRM00),DISP=SHR
> //*                                                 
> //SYSOUT DD SYSOUT=*                                
> //SYSPRINT DD SYSOUT=*     
> 
> A part of my code
> FILE *fparm;                   
> fparm = fopen("dd:SYSPRM","r");
> if (fparm != NULL)  {
>     }
> 
> The chmod has been set to 777
> Could you help me to find what is wrong ?

I think that the problem may be that the BPXBATCH program is 
fork()ing to run your program. That means it runs in a separate address
space and the DD:SYSRPM is not propogated to the fork()'ed address
space. This is a real problem with UNIX program which try to access DD
statements. They must run in the same address space because fork() only
copies file descriptors (to UNIX files) and not DD statements.

what you might want to do is to set an environment variable to point to
the DSN that you want. Your C code would then need to retrieve that
variable and do a slightly different open. I don't have a C compiler, so
I cannot test this, but I think it would be something like:

FILE *fparm;                   
char *dsn;
dsn=getenv("SYSPRM");
if (dsn==null) {
// write error message
        exit 1; // exit with rc=1 to indicate failure
}
char fopen_parm[61];
strcpy(fopen_parm,"dd://'");
strncat(fopen_parm,dsn,54); // dsn max is 54 chars==44 dsn+ open paren
+8 member+ close paren
strcat(fopen_parm,"'"); // ending quote
fparm = fopen(fopen_parm,"r");
if (fparm != NULL)  {
    }

//RUNSHELL EXEC PGM=BPXBATCH,                       
//  PARM='SH export SYSPRM=USER1.PDS.PARMLIB(CMDPRM00); /u/myprog'

//STDOUT DD PATH='/u/resul',                        
// PATHOPTS=(OCREAT,OTRUNC,OWRONLY)                 
//*SYSRPM DD DSN=USER1.PDS.PARMLIB(CMDPRM00),DISP=SHR
//*                                                 
//SYSOUT DD SYSOUT=*                                
//SYSPRINT DD SYSOUT=*   

I cannot guarantee that this is correct, of course.  

--
John McKown
Senior Systems Programmer
HealthMarkets
Keeping the Promise of Affordable Coverage
Administrative Services Group
Information Technology

The information contained in this e-mail message may be privileged
and/or confidential.  It is for intended addressee(s) only.  If you are
not the intended recipient, you are hereby notified that any disclosure,
reproduction, distribution or other use of this communication is
strictly prohibited and could, in certain circumstances, be a criminal
offense.  If you have received this e-mail in error, please notify the
sender by reply and delete this message without copying or disclosing
it.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to