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
 

 

Delete VSAM or flat file using a single rexx command

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Vinay N.G

New User


Joined: 15 Sep 2008
Posts: 36
Location: Bangalore

PostPosted: Tue May 12, 2009 9:12 pm    Post subject: Delete VSAM or flat file using a single rexx command
Reply with quote

Hi,

1) Please let me know if we can delete any VSAM or Flat file using the same command in REXX.

2) Is it possible for a REXX program to differentiate the input files
between VSAM and a flat file. If so how to find out whether the input file is a VSAM file or flat file(PS).
Back to top
View user's profile Send private message

Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2038
Location: Silicon Valley

PostPosted: Tue May 12, 2009 9:34 pm    Post subject: Reply to: Delete VSAM or flat file using a single rexx comma
Reply with quote

Use the LISTDSI built-in function to check the DSORG. Read Rexx Reference manual for more information.

And to delete a dataset, use the delete command
Code:
Address TSO 'DELETE ...'


I am not sure what you mean by 'using the same command in REXX.'
Back to top
View user's profile Send private message
Vinay N.G

New User


Joined: 15 Sep 2008
Posts: 36
Location: Bangalore

PostPosted: Tue May 12, 2009 9:43 pm    Post subject:
Reply with quote

Is it possible to track whether the delete is successful or not.. If so how to track it.

What if dataset is not present and we are trying to delete it.

I mean, in JCL if it happens like that, then we will set maxcc=0 right , in the same way can we don anything here in REXX so that it doesnt throw any error message if it tries to delete the dataset which is not catalouged.
Back to top
View user's profile Send private message
acs_amit

New User


Joined: 30 Apr 2009
Posts: 14
Location: Noida

PostPosted: Tue May 12, 2009 11:45 pm    Post subject:
Reply with quote

Suppose your dataset is:
DSN.A = 'A.B.C'

/*then to delete the dataset.. use*/

Address TSO
"delete '"||DSN.A||"'"


/*Now to check whether delete is successful use SYSDSN command..foe ex..*/

if sysdsn("'"||DSN.A||"'") = 'OK' THEN
SAY 'PROBLEM WITH DELETING THE DATASET'
Else
SAY 'DATASET HAS BEEN DELETED'

/* search for SYSDSN command in manuals.. */

I hope this will solve your query...
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed May 13, 2009 12:03 am    Post subject:
Reply with quote

Hello,

I believe that will not work if the dataset does not exist at the beginning. . . The delete will fail. . .
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2038
Location: Silicon Valley

PostPosted: Wed May 13, 2009 12:58 am    Post subject: Reply to: Delete VSAM or flat file using a single rexx comma
Reply with quote

use SYSDSN first to make sure it exits.

After DELETE, check the return code.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1228
Location: Israel

PostPosted: Wed May 13, 2009 1:27 am    Post subject:
Reply with quote

acs_amit wrote:
Suppose your dataset is:
DSN.A = 'A.B.C'

/*then to delete the dataset.. use*/

Address TSO
"delete '"||DSN.A||"'"


/*Now to check whether delete is successful use SYSDSN command..foe ex..*/

if sysdsn("'"||DSN.A||"'") = 'OK' THEN
SAY 'PROBLEM WITH DELETING THE DATASET'
Else
SAY 'DATASET HAS BEEN DELETED'

/* search for SYSDSN command in manuals.. */

I hope this will solve your query...


I use a different logic (one that hopefully works):
Code:
DSN.A = "'A.B.C'"

/* If the file is here, remove it */
/* If the delete fails, the program is ended */

If SYSDSN(DSN.A) = 'OK' Then
   Address TSO "DELETE "DSN.A
Isn't it easier?
The error can be trapped to allow housekeeping and a proper message.
Code:
SIGNAL ON ERROR
DSN.A = "'A.B.C'"

/* If the file is here, remove it */
/* If the delete fails, send appropriate message */

If SYSDSN(DSN.A) = 'OK' Then Do
   Address TSO "DELETE "DSN.A
   Say 'File 'DSN.A' has been deleted'
End

ERROR:
Say 'The return code from the command on line 'Sigl' is 'RC
Say 'Command is: 'SourceLine(Sigl)
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 -> CLIST & REXX 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. Need help on If condition continuatio... ashok_uddaraju CLIST & REXX 4 Fri May 19, 2017 8:55 am
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am


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