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

Want to delete some flat files through the JCL


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

New User


Joined: 15 Feb 2006
Posts: 18

PostPosted: Wed Sep 13, 2006 10:40 am
Reply with quote

I want to delete some flat files through the JCL. But I only know the highest level qualifiers i.e E4MA.CP000000.E3TA.FFB.*. The file names may contain more that 5 qualifiers. I want to make JCL so that it will delete all the files having highest qualifier E4MA.CP000000.E3TA.FFB. I tried to do it by IDCAMS using wild card E4MA.CP000000.E3TA.FFB.** but I am getting error message E4MA.CP000000.E3TA' DOES NOT ADHERE TO RESTRICTIONS. Can you please help me with this? Thanks
Back to top
View user's profile Send private message
IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Wed Sep 13, 2006 3:15 pm
Reply with quote

you could try this

do a LISTCAT of the HLQ that you need and
write the output to a file

//S01 EXEC PGM=IDCAMS
//SYSPRINT DD DSN=TTT.IDCLIST,
// DISP=SHR
//SYSIN DD *
LISTCAT LEVEL(YOUR.LOWEST.LEVEL.DSN) -
NONVSAM -
NAME
//*

the data I created looks like this ;

IDCAMS SYSTEM SERVICES

LISTCAT LEVEL(YOUR.LOWEST.LEVEL.DSN) -
NONVSAM -
NAME
NONVSAM ------- YOUR.LOWEST.LEVEL.DSN.TTT.Z01
IN-CAT --- CATALOG.ICF.VLIB001
NONVSAM ------- YOUR.LOWEST.LEVEL.DSN.TTT.Z02
IN-CAT --- CATALOG.ICF.VLIB001
NONVSAM ------- YOUR.LOWEST.LEVEL.DSN.TTT.Z03
IN-CAT --- CATALOG.ICF.VLIB001
NONVSAM ------- YOUR.LOWEST.LEVEL.DSN.Z04.X01.Y01
IN-CAT --- CATALOG.ICF.VLIB001
NONVSAM ------- YOUR.LOWEST.LEVEL.DSN.TTT.Z05.X02
IN-CAT --- CATALOG.ICF.VLIB001

select the dataset names from the output (assuming they are all NONVSAM here, yours may be different so tailor the select command) and build a series of DELETE commands into another file

//S02 EXEC PGM=SORT
//SORTIN DD DSN=TTT.IDCLIST,DISP=SHR
//SORTOUT DD DSN=YYY.IDCLIST.DELETE,
// DISP=SHR
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(6,07,CH,EQ,C'NONVSAM')
OUTFIL OUTREC=(C' DELETE ',12:21,36),CONVERT
//*

The aim is to create a DELETE file now like this

DELETE YOUR.LOWEST.LEVEL.DSN.TTT.Z01
DELETE YOUR.LOWEST.LEVEL.DSN.TTT.Z02
DELETE YOUR.LOWEST.LEVEL.DSN.TTT.Z03
DELETE YOUR.LOWEST.LEVEL.DSN.Z04.X01.Y01
DELETE YOUR.LOWEST.LEVEL.DSN.TTT.Z05.X02

now execute IDCAMS deletes using file above

//S03 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD DSN=YYY.IDCLIST.DELETE,DISP=SHR
//*********************************
final check to confirm all deleted

//S04 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
LISTCAT LEVEL(YOUR.LOWEST.LEVEL.DSN) -
NONVSAM -
NAME
//*

hope this helps
Back to top
View user's profile Send private message
kgumraj

Active User


Joined: 01 May 2006
Posts: 151
Location: Hyderabad

PostPosted: Wed Sep 13, 2006 8:35 pm
Reply with quote

Use the ISPF command
in 3.4 with the qualifiers

issue SAVE list

open userid.list.datasets and edit it

use the JCL you are using earlier to delete entire dataset, with little modifications.
Back to top
View user's profile Send private message
rgarg

New User


Joined: 15 Feb 2006
Posts: 18

PostPosted: Thu Sep 14, 2006 10:04 pm
Reply with quote

Hi Gerbil,

When i tried the following step

//S02 EXEC PGM=SORT
//SORTIN DD DSN=TTT.IDCLIST,DISP=SHR
//SORTOUT DD DSN=YYY.IDCLIST.DELETE,
// DISP=SHR
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(6,07,CH,EQ,C'NONVSAM')
OUTFIL OUTREC=(C' DELETE ',12:21,36),CONVERT
//*

i am not getting anythin in the output file. I don't want the delete statement in the output file. My JCL is as follows

//SORTIN DD DSN=TRY.LISTCAT,
// DISP=SHR
//*
//SORTOUT DD DSN=TRY.OUTPUT,
// DISP=(NEW,CATLG,DELETE),SPACE=(TRK,(2,1)),
// DCB=(DSORG=PS,LRECL=125,RECFM=FB,BLKSIZE=0),
// UNIT=SYSDA
//*
//SYSIN DD *
SORT FIELDS=COPY -
INCLUDE COND=(2,7,CH,EQ,C'NONVSAM') -
OUTREC FIELDS=(1:18,45),CONVERT
/*
//*


I am getting follwoing message in the spool

WER146B 20K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I SORTIN : RECFM=VBA ; LRECL= 125; BLKSIZE= 27998
WER237I OUTREC RECORD LENGTH = 45
WER110I SORTOUT : RECFM=FB ; LRECL= 125; BLKSIZE= 27875
WER462I OUTPUT LRECL DIFFERS FROM SORTOUT LRECL
WER055I INSERT 0, DELETE 86
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
WER416B SORTIN: EXCP'S=1,UNIT=3390,DEV=532C,CHP=(B1B5B9BDBFC5C9CD,2),VOL=
WER416B SORTOUT: EXCP'S=0,UNIT=3390,DEV=F105,CHP=(B5B9BDB1C1C5C9,2),VOL=DH
WER416B TOTAL OF 1 EXCP'S ISSUED FOR COPYING
WER054I RCD IN 86, OUT 0
WER169I RELEASE 1.1D BATCH 0426 TPF LEVEL 3A
WER052I END SYNCSORT -

I am gettin MAXCC = 0 but output file is empty. Can you help me in that
Back to top
View user's profile Send private message
IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Fri Sep 15, 2006 12:39 am
Reply with quote

What does the data in your infile look like?

the message

WER055I INSERT 0, DELETE 86

suggests that all 86 input records have been bypassed

also I was using DFSORT not Syncsort so the command syntax may be different.
Back to top
View user's profile Send private message
rgarg

New User


Joined: 15 Feb 2006
Posts: 18

PostPosted: Fri Sep 15, 2006 9:53 am
Reply with quote

Hi Gerbil,

I got it, i was giving parameters wrong. Thank you so much for your help. Your JCL saved me a lot of time. I really appreciate your help. Thanks
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts DELETE SPUFI DB2 1
No new posts DSNTIAUL driven delete IBM Tools 0
No new posts Write line by line from two files DFSORT/ICETOOL 7
Search our Forums:

Back to Top