How can i delete records form a VSAM file.
Moderator: Moderator Group
How can i delete records form a VSAM file.
Hi
I have a VSAM file, and i want to delete a record from it.
i don have File Aid.
Please tell me how can i do it.
Is there is any method to delete all the records of a VSAM without
deleting the VSAM..
Regards
Anu
I have a VSAM file, and i want to delete a record from it.
i don have File Aid.
Please tell me how can i do it.
Is there is any method to delete all the records of a VSAM without
deleting the VSAM..
Regards
Anu
You can use these statements:
Code: Select all
//RECOPY EXEC PGM=IDCAMS
//**********************************************************************
//INFILE DD DSN=DSN.OF.YOUR.FILE,DISP=SHR
//VSAMFILE DD DSN=DSN.OF.YOUR.VSAM,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOU=*
//SYSIN DD *
REPRO INFILE(INFILE) -
OUTFILE(VSAMFILE)
//
vsam cluster REPRO REUSE option
If you want to delete all the records in VSAM without deleting VSAM. Use following methods.
method 1) Use COBOL program to do this.
method 2) Define your VSAM file with REUSE option YES.
after that everytime you want to empty the the VSAM file. Use IDCAMS REPRO with REUSE option to copy empty file to VSAM file.
method 3) it is very similar to what is explained in method 2.
If your VSAM file already defined with RESUE option NO. Use ALTER command to make VSAM file reusable and use IDCAMS REPRO with REUSE option to copy empty file to VSAM file.
If required, you can ALTER back VSAM file to NOREUSE.
method 1) Use COBOL program to do this.
method 2) Define your VSAM file with REUSE option YES.
after that everytime you want to empty the the VSAM file. Use IDCAMS REPRO with REUSE option to copy empty file to VSAM file.
method 3) it is very similar to what is explained in method 2.
If your VSAM file already defined with RESUE option NO. Use ALTER command to make VSAM file reusable and use IDCAMS REPRO with REUSE option to copy empty file to VSAM file.
If required, you can ALTER back VSAM file to NOREUSE.
Natarajan
Chennai
Chennai
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page