Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

remove( ) DELETE FILE..

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
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    Post subject: remove( ) DELETE FILE..
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Mon Jan 12, 2009 3:59 pm    Post subject: Reply to: remove( ) DELETE FILE..
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Mon Jan 12, 2009 5:21 pm    Post subject: Reply to: remove( ) DELETE FILE..
Reply with quote

follow on...
check how to use the errno external variable to find out more
http://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: 8118
Location: East Dubuque, Illinois, USA

PostPosted: Mon Jan 12, 2009 5:56 pm    Post subject:
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: 8118
Location: East Dubuque, Illinois, USA

PostPosted: Mon Jan 12, 2009 10:14 pm    Post subject:
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    Post subject:
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: 8118
Location: East Dubuque, Illinois, USA

PostPosted: Tue Jan 13, 2009 5:40 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us