{"id":717,"date":"2015-12-07T23:33:59","date_gmt":"2015-12-07T18:03:59","guid":{"rendered":"http:\/\/ibm-mainframes.com\/blog\/?p=717"},"modified":"2023-06-13T23:09:51","modified_gmt":"2023-06-13T17:39:51","slug":"delete-content-of-a-sequential-data-set-on-mainframe","status":"publish","type":"post","link":"https:\/\/zmainframes.com\/zlog\/delete-content-of-a-sequential-data-set-on-mainframe\/","title":{"rendered":"Delete content of sequential dataset on mainframe."},"content":{"rendered":"<h3 style=\"text-align: center;\"><span style=\"text-decoration: underline;\">Delete content of sequential dataset on mainframe<\/span><\/h3>\n<p>While working with mainframes there will be times when you&#8217;d like to delete all the records from a file but want to keep the data set <em>intact<\/em>. Mostly you&#8217;ll see such a situation when you are testing some condition; I doubt you&#8217;d ever do it in production but hey! if you do it &#8211; well, you are in a situation.<\/p>\n<p>There are many ways to&nbsp;delete content of sequential data set on mainframe and we&#8217;ll discuss couple of them here. If you know more, please share them and I&#8217;ll update original post with the credits to original poster. Or I&#8217;ll add in more as and when I find them.<\/p>\n<p>We can&nbsp;delete content of a sequential data set on mainframe using &#8211;<\/p>\n<ol>\n<li>IDCAMS<\/li>\n<li>SORT<\/li>\n<li>COBOL<\/li>\n<\/ol>\n<ol>\n<li><span style=\"text-decoration: underline;\"><strong>IDCAMS<\/strong><\/span>: &nbsp;The following JCL will delete content of sequential dataset on mainframe&nbsp;without deleting it using the IDCAMS utility:<\/li>\n<\/ol>\n<pre class=\"theme:cisco-router lang:default decode:true\">\/\/STEP100&nbsp; EXEC PGM=IDCAMS&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \n\/\/DDDMMY&nbsp; &nbsp;DD DUMMY&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \n\/\/DDOUT&nbsp; &nbsp; DD DSN=...input file \n\/\/&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DISP=SHR&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \n\/\/SYSIN&nbsp; &nbsp; DD *&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \n&nbsp; REPRO IFILE(DDDMMY) OFILE(DDOUT)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \n\/\/SYSPRINT DD SYSOUT=*&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \n\/\/SYSOUT&nbsp; &nbsp;DD SYSOUT=*&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \n\/\/*&nbsp;\n<\/pre>\n<p>In above JCL,&nbsp;STEP100 is the step which executes the IDCAMS program.<\/p>\n<p>2. <span style=\"text-decoration: underline;\"><strong>SORT<\/strong><\/span>: The following JCL will Delete content of sequential dataset on mainframe&nbsp;without deleting it using the SORT:<\/p>\n<pre class=\"theme:cisco-router lang:default decode:true\">\/\/EMPTY EXEC PGM=SORT \n\/\/SORTIN DD DISP=SHR,DSN=&lt;dataset&gt; \n\/\/SORTOUT DD DISP=SHR,DSN=&lt;dataset&gt; \n\/\/SYSOUT DD SYSOUT=* \n\/\/SYSIN DD * \nOPTION COPY \nOMIT COND=ALL \n\/*\n<\/pre>\n<p><span style=\"line-height: 1.5;\">3. <span style=\"text-decoration: underline;\"><strong>COBOL<\/strong><\/span><strong>&nbsp;<\/strong>: read the file using COBOL &amp; don&#8217;t write anything into it, give your output file DSN with DISP=OLD.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Delete content of sequential dataset on mainframe While working with mainframes there will be times when you&#8217;d like to delete [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,27,28,32],"tags":[97,45,48,46,37],"class_list":["post-717","post","type-post","status-publish","format-standard","hentry","category-mainframes","category-cobol","category-jcl","category-sort","tag-delete","tag-ibm","tag-iceman","tag-jcl","tag-mainframes"],"amp_enabled":true,"rttpg_featured_image_url":null,"rttpg_author":{"display_name":"Anuj Dhawan","author_link":"https:\/\/zmainframes.com\/zlog\/author\/anuj-dhawan\/"},"rttpg_comment":5,"rttpg_category":"<a href=\"https:\/\/zmainframes.com\/zlog\/mainframes\/\" rel=\"category tag\">Mainframes<\/a> <a href=\"https:\/\/zmainframes.com\/zlog\/mainframes\/cobol\/\" rel=\"category tag\">Cobol<\/a> <a href=\"https:\/\/zmainframes.com\/zlog\/mainframes\/jcl\/\" rel=\"category tag\">JCL<\/a> <a href=\"https:\/\/zmainframes.com\/zlog\/mainframes\/sort\/\" rel=\"category tag\">sort<\/a>","rttpg_excerpt":"Delete content of sequential dataset on mainframe While working with mainframes there will be times when you&#8217;d like to delete [&hellip;]","_links":{"self":[{"href":"https:\/\/zmainframes.com\/zlog\/wp-json\/wp\/v2\/posts\/717","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zmainframes.com\/zlog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zmainframes.com\/zlog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zmainframes.com\/zlog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zmainframes.com\/zlog\/wp-json\/wp\/v2\/comments?post=717"}],"version-history":[{"count":5,"href":"https:\/\/zmainframes.com\/zlog\/wp-json\/wp\/v2\/posts\/717\/revisions"}],"predecessor-version":[{"id":1302,"href":"https:\/\/zmainframes.com\/zlog\/wp-json\/wp\/v2\/posts\/717\/revisions\/1302"}],"wp:attachment":[{"href":"https:\/\/zmainframes.com\/zlog\/wp-json\/wp\/v2\/media?parent=717"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zmainframes.com\/zlog\/wp-json\/wp\/v2\/categories?post=717"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zmainframes.com\/zlog\/wp-json\/wp\/v2\/tags?post=717"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}