Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 10327
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: 10327
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: 8165
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: 8165
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: 8165
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
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us