View previous topic :: View next topic
|
Author |
Message |
zanyzap4u
New User
Joined: 13 Dec 2008 Posts: 38 Location: Mexico City
|
|
|
|
I am trying to delete a PS by using the remove function in C.
The C code I am using is
Code: |
#include<stdio.h>
#include<stdlib.h>
int main()
{
int i;
char *p="xxxxxx.TEST.TEST1"; /*the PS we want to delete*/
i=remove(p);
printf("%d",i);
}
|
The compile bind and run jcl
Code: |
//xxxxxxx JOB (DVLP,xxx),'xxx',USER=xxxxxx,CLASS=E,
// MSGCLASS=X,NOTIFY=&SYSUID
//*
//* COMPILE, BIND AND RUN
//*
//DOCLG EXEC CBCCBG,
// INFILE='xxxxxxx.NEW.BMS(REM)', -------->C CODE
// CPARM='OPTFILE(DD:CCOPT)'
//COMPILE.CCOPT DD *
LSEARCH('BMXSRP.HEADER')
SEARCH('CEE.SCEEH.+','CBC.SCLBH.+')
/* |
We are getting return code of the remove function -1..I am unable to understand where I am going wrong.Please help me out.I am stuck... |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
You will be stuck until ...
You will post the sysout of Your <RUN> |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Code: |
char *p="//'xxxxxx.TEST.TEST1'"; |
I'm assuming that xxxxxx.TEST.TEST1 is not a Unix System Services file and that you're using POSIX(OFF) on your C compile. As specified in your code, your program is looking for a Unix System Services file to remove; it's probably not finding it and returning an error code.
Read the sections of the C/C++ Programming Guide having to do with file references -- in general, z/OS file names require //'DSNAME' to designate their non-Unix nature. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
I have verified that changing the statement as indicated in my earlier post allows the program to run to zero completion code and deletes the z/OS file. |
|
Back to top |
|
|
zanyzap4u
New User
Joined: 13 Dec 2008 Posts: 38 Location: Mexico City
|
|
|
|
Hi Robert Sample,thanx a lot...your suggestion helped.I was able to solve it...
Instead of
Code: |
char *p="xxxxxx.TEST.TEST1";
|
I changed it to
Code: |
char *p="DD: file1";
|
And I provided the DSN name in the Run Jcl with "file1" as the DD name.
With remove I was able delete PDS,PS aswell as VSAM files.
But I have some doubt with POSIX option...can you please clarify me why and how this option is used..??waiting for your reply... |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Googling "posix" returns 5,360,000 hits. POSIX is an international standard for the API and utilities compatible with Unix. POSIX is defined in something like 17 different documents and provides portability for applications that code to its standards.
There is a run-time option in z/OS C for POSIX support; how certain functions (such as remove) work is impacted by whether POSIX(ON) or POSIX(OFF) is specified. The Programming Guide has details. |
|
Back to top |
|
|
|