Chapter Contents

Previous

Next
remove

remove



Delete a File

Portability: ISO/ANSI C conforming


SYNOPSIS
DESCRIPTION
RETURN VALUE
CAUTION
IMPLEMENTATION
EXAMPLE
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

#include <stdio.h>

int remove(const char *name);


DESCRIPTION

Under OS/390, remove deletes the OS/390 disk file, PDS member, or hierarchical file specified by name .

Under CMS, remove deletes the CMS disk file specified by the filename that is pointed to by name .


RETURN VALUE

The remove function returns 0 if the file is deleted. If the file cannot be deleted or name is invalid, -1 is returned.


CAUTION

OS/390
For ddn style filenames that refer to an OS/390 sequential file, remove means to make empty. Other style filenames are deleted and uncataloged.

VSAM data sets cannot be deleted by remove .

CMS
If the fileid has a blank filemode, it defaults to A1 . The string pointed to by name should not contain wildcard values such as * or = .

If the filename is in xed style, and XEDIT is not active or the file is not found in XEDIT, the file is searched for on disk. You cannot remove a file found in XEDIT. However, if an xed style file is not found in XEDIT but is found on disk, the file is removed. VSAM data sets cannot be deleted by remove .


IMPLEMENTATION

Under OS/390, remove can issue STOW, SCRATCH, CATALOG, OPEN, and CLOSE SVCs. For an HFS file, remove calls unlink . Under CMS, remove performs a CMS FSERASE or invokes the callable service library routine DMSERASE.


EXAMPLE

/* for MVS systems */

int rc;

   /* Delete a member of the TSO file USELESS.DATA  */
rc = remove("tso:useless.data(removeme)");

   /* Delete a member of the data set pointed to by */
   /*  ddname DATA1 */
rc = remove("ddn:data1(obs11)");

   /* Empty the data set pointed to by ddname DATA1 */
rc = remove("ddn:data1");

/* for CMS systems */

int rc;

rc = remove("cms:oldprog c a");

/* or */

rc = remove("ddn:data1");


RELATED FUNCTIONS

rename , rmdir


SEE ALSO


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.