IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

remove( ) DELETE FILE..


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
zanyzap4u

New User


Joined: 13 Dec 2008
Posts: 38
Location: Mexico City

PostPosted: Mon Jan 12, 2009 3:57 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Jan 12, 2009 3:59 pm
Reply with quote

You will be stuck until ...
You will post the sysout of Your <RUN>
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Jan 12, 2009 5:21 pm
Reply with quote

follow on...
check how to use the errno external variable to find out more
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/edclb180/3.8?ACTION=MATCHES&REQUEST=errno&TYPE=FUZZY&SHELF=CBCBS180&DT=20070725234036&CASE=&searchTopic=TOPIC&searchText=TEXT&searchIndex=INDEX&rank=RANK&ScrollTOP=FIRSTHIT#FIRSTHIT
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Jan 12, 2009 5:56 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Jan 12, 2009 10:14 pm
Reply with quote

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
View user's profile Send private message
zanyzap4u

New User


Joined: 13 Dec 2008
Posts: 38
Location: Mexico City

PostPosted: Tue Jan 13, 2009 10:32 am
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Jan 13, 2009 5:40 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts DELETE SPUFI DB2 1
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top