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

How to delete a VSAM dataset from inside a program


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Mike.Fulton

New User


Joined: 11 Jun 2014
Posts: 22
Location: Canada

PostPosted: Fri Feb 15, 2019 5:58 am
Reply with quote

Hi

I know someone will say 'RTFM' but Miss Google has been unable to help me find the right manual... I want to delete a VSAM cluster from inside a program without resorting to calling IDCAMS - seems like a lot of overhead.
I know in C, I can just call 'remove' for standard datasets, but it doesn't support deleting VSAM datasets.
I'm happy to drive the right assembler macro if someone can point me to the right book...
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 870
Location: The Universe

PostPosted: Fri Feb 15, 2019 7:27 am
Reply with quote

You have two choices:
  • You can run IDCAMS from your program. See Appendix D: Invoking Access Method Services from Your Program in DFSMS Access Method Services Commands. I know that will work as I have done it myself.
  • This is less complicated, but I think this will work most of the time. Use MVS dynamic allocation to allocate the cluster. Specify the equivalent of OLD in the DALSTATS key and DELETE in the DALNDISP key. After you have allocated the cluster use MVS dynamic allocation the free the allocation. That will delete the cluster.
Back to top
View user's profile Send private message
Mike.Fulton

New User


Joined: 11 Jun 2014
Posts: 22
Location: Canada

PostPosted: Fri Feb 15, 2019 7:28 am
Reply with quote

Some more digging...
It looks like SVC99 with KEY 5 and/or KEY 7 -might- do the trick. I'll try it. If folks that know more have advice, I'd love it...
Back to top
View user's profile Send private message
Mike.Fulton

New User


Joined: 11 Jun 2014
Posts: 22
Location: Canada

PostPosted: Fri Feb 15, 2019 7:30 am
Reply with quote

thanks steve ... just saw your post after i put mine up... will give it a shot
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 870
Location: The Universe

PostPosted: Fri Feb 15, 2019 11:08 am
Reply with quote

Dead minimum program to delete data set specified in parm text. No validation of any sort. Ends with RC=0, data set deleted, RC=12 delete failed, RC=16 allocation failed.
Code:
KILLVSAM CSECT
         USING *,12
         SAVE  (14,12),,*
         LR    12,15
         LA    15,SAVEAREA
         ST    13,4(,15)
         ST    15,8(,13)
         LR    13,15
         L     2,0(,1)             LOAD ADDRESS OF THE PARM TEXT
         LH    1,0(,2)             LOAD LENGTH OF PARM TEXT
         LA    0,2(,2)             COMPUTE ADDRESS OF THE PARM TEXT
         LR    15,1                COPY LENGTH TO REG 15
         LA    14,ADSN             COMPUTE DATA SET NAME ADDRESS
         MVCL  14,0                COPY PARM TEXT TO DATA SET NAME
         LA    1,A                 ALLOCATE THE DATA SET
         DYNALLOC ,
         LTR   15,15               RC OK
         BZ    FREE                YES
         MVI   RC,16               SET RC = 16
         B     EXIT
FREE     MVC   UDDN,ADDN           COPY DD NAME TO UDDN
         LA    1,U                 UNALLOCE THE DATA SET
         DYNALLOC ,
         LTR   15,15               OK?
         BZ    EXIT                YES
         MVI   RC,12               SET RC = 12
EXIT     L     13,4(,13)           LOAD ADDRESS OF THE HIGHER SAVE AREA
         SR    15,15               LOAD THE RETURN CODE
         IC    15,RC
         RETURN (14,12),RC=(15)    RETURN
* DYNAMIC ALLOCATION PARAMETERS TO ALLOCATE A DATA SET
A        DC    A(X'80000000'+ARB)
ARB      DC    AL1(S99RBEND-S99RB,S99VRBAL,0,0)
         DC    2AL2(*-*),A(ATXTPP,0,0)
ATXTPP   DC    A(ATXT01,ATXT02,ATXT03,X'80000000'+ATXT04)
ATXT01   DC    AL2(DALDSNAM,1,L'ADSN)
ADSN     DC    CL44' '
ATXT02   DC    AL2(DALRTDDN,1,L'ADDN)
ADDN     DC    CL8' '
ATXT03   DC    AL2(DALSTATS,1,1),X'01'
ATXT04   DC    AL2(DALNDISP,1,1),X'04'
* DYNAMIC ALLOCATION PARAMETERS TO FREE A DATA SET
U        DC    A(X'80000000'+URB)
URB      DC    AL1(S99RBEND-S99RB,S99VRBUN,0,0)
         DC    2AL2(*-*),A(UTXTPP,0,0)
UTXTPP   DC    A(X'80000000'+UTXT01)
UTXT01   DC    AL2(DUNDDNAM,1,L'UDDN)
UDDN     DC    CL8' '
RC       DC    FL1'0'
SAVEAREA DC    9D'0'
         LTORG
         IEFZB4D0 ,
         IEFZB4D2 ,
         END   KILLVSAM
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8794
Location: Welsh Wales

PostPosted: Fri Feb 15, 2019 12:59 pm
Reply with quote

Or maybe calling through to BPXWDYN
Back to top
View user's profile Send private message
Mike.Fulton

New User


Joined: 11 Jun 2014
Posts: 22
Location: Canada

PostPosted: Fri Feb 15, 2019 9:46 pm
Reply with quote

icon_biggrin.gif
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Capture GDG Dataset Name JCL & VSAM 10
No new posts Checking the total counts inside a re... JCL & VSAM 5
This topic is locked: you cannot edit posts or make replies. Passing a field name to COBOL program COBOL Programming 10
No new posts FILE STATUS - 39 ON VARIABLE LENGTH V... COBOL Programming 2
This topic is locked: you cannot edit posts or make replies. Sample CICS Webservices Program CICS 1
Search our Forums:

Back to Top