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

Delete Empty file in Jcl


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

New User


Joined: 26 Jun 2007
Posts: 7
Location: Chennai

PostPosted: Fri Jan 21, 2011 9:08 pm
Reply with quote

Hello All,

Could you please help me here to delete a empty file in a JCL. My requirement is a GDG flat file is created in STEP1 and i want to delete the same if the file is empty without changing the condtion code in the next step STEP2.

I tried to use the IDCAMS to check wheather the file is empty and i can delete it in the next step as i was not able to delete in IDCAMS because i do not know how to instruct the IDCAMS about the latest GDG version. If i delete the file in next step, the job ends with Maxcc 4.

I cannot go with this approach as this will affect the OPC scheduling.

Many thanks in advance for your help.

Thanks,
Sangeeth.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Jan 21, 2011 9:22 pm
Reply with quote

If you raise a MAXCC=4, then use the following in the same step just after the DELETE -
Code:

SET MAXCC=0

This should override the MAXCC=4, but give it a try and let us know....

Bill
Back to top
View user's profile Send private message
rsangeeth

New User


Joined: 26 Jun 2007
Posts: 7
Location: Chennai

PostPosted: Fri Jan 21, 2011 9:37 pm
Reply with quote

Hello Bill,

Thanks for the response. I have tried this if it is in the same step i can delete it and it will work fine. I can delete the GDG file in there and i use the same in the next step it doesnt work.

Code:
PRINT INFILE(IN1) COUNT(1)                                 
IF LASTCC=4 THEN DO                                         
  DELETE IN1                                               
  SET MAXCC=0                                               
END


This works perfectly fine when file is a normal flat file. But here i cannot instruct to delete a GDG file.

Sangeeth.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Jan 21, 2011 9:48 pm
Reply with quote

Hello,

You might consider creating a non-gdg file and then copy this to a new generation when it is not empty.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Jan 21, 2011 10:06 pm
Reply with quote

Also, to avoid any potential security issues, COUNT(0) will work. If the file is empty, the MAXCC will still be 4. This way, there's no hardcopy if the file contained live data and the security folks won't raise a stink....

Bill
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri Jan 21, 2011 10:16 pm
Reply with quote

dick scherrer wrote:
Hello,

You might consider creating a non-gdg file and then copy this to a new generation when it is not empty.


Bingo! Do it the right way and avoid the problems completely.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Sat Jan 22, 2011 1:56 pm
Reply with quote

Or even
Code:
//STEP0010 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//FILEOUT  DD DSN=&&TESTFILE,DISP=(,DELETE,DELETE),
//            SPACE=(TRK,5),RECFM=VB,LRECL=32756
//FILEIN   DD DSN=gdg.base(0),DISP=SHR
//SYSIN    DD *
 REPRO IFILE(FILEIN) OFILE(FILEOUT) COUNT(1)
 the rest of your IDCAMS statements
Back to top
View user's profile Send private message
rsangeeth

New User


Joined: 26 Jun 2007
Posts: 7
Location: Chennai

PostPosted: Mon Jan 24, 2011 9:17 pm
Reply with quote

Hi All,

Sorry i could not follow the logic described by you. Even if i try to use a flat file instead of a GDG the problem will not be solved i guess. As the final file has to be a GDG. Even if i follow the logic like given below, i am not sure if that will solve the problem. The problem is eiether deleing the gdg file in the idcams or overrding the MAXCC thrown by the JCL.

Code:
//STEP0010 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//FILEOUT  DD DSN=&&TESTFILE,DISP=(,DELETE,DELETE),
//            SPACE=(TRK,5),RECFM=VB,LRECL=32756
//FILEIN   DD DSN=gdg.base(0),DISP=SHR
//SYSIN    DD *
 REPRO IFILE(FILEIN) OFILE(FILEOUT) COUNT(1)
 the rest of your IDCAMS statements


Many thanks.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Jan 25, 2011 12:58 am
Reply with quote

Hello,

Quote:
Even if i try to use a flat file instead of a GDG the problem will not be solved i guess.
You guess wrong. . .

If you do what i suggested, it will do just what you want.

Post the jcl you used to do what i suggested that does not work and the diagnostic information generated and someone will be able to help.
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 FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts DELETE SPUFI DB2 1
Search our Forums:

Back to Top