Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Delete Empty file in Jcl

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Delete Empty file in Jcl
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Fri Jan 21, 2011 9:22 pm    Post subject: Reply to: Delete Empty file in Jcl
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    Post subject:
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

Site Director


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

PostPosted: Fri Jan 21, 2011 9:48 pm    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Fri Jan 21, 2011 10:06 pm    Post subject: Reply to: Delete Empty file in Jcl
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

Moderator Team Head


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

PostPosted: Fri Jan 21, 2011 10:16 pm    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Sat Jan 22, 2011 1:56 pm    Post subject:
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    Post subject: Reply to: Delete Empty file in Jcl
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

Site Director


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

PostPosted: Tue Jan 25, 2011 12:58 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 0 Wed Jul 26, 2017 2:10 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us