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

delete contents of file when no records


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

New User


Joined: 29 Jun 2007
Posts: 2
Location: INDIA

PostPosted: Wed Jul 16, 2008 6:30 pm
Reply with quote

I have one file/report with following format:
first 3 lines are for information then records are printed from fourth line:

line 1: Cycle date:mm/dd/yyyy report id:ABC
line 2: name of report
line 3: empid emp name emp dept
line 4: record1 abc test
and so on...

my requirement is if there are no records in file i.e only line 1,2 and 3 are present the same file should be emptied or first three lines to be removed.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Wed Jul 16, 2008 6:32 pm
Reply with quote

ICEGENER with the dataset defined to SYSUT2 and use SYSUT1 DD DUMMY
Back to top
View user's profile Send private message
anand.dale

New User


Joined: 29 Jun 2007
Posts: 2
Location: INDIA

PostPosted: Wed Jul 16, 2008 7:35 pm
Reply with quote

but how will I check whether fourth record is there or not........if there is no fourth record i can do that
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Wed Jul 16, 2008 7:41 pm
Reply with quote

Look at the IDCAMS PRINT command using the COUNT parameter and it will become clear grasshopper.
Back to top
View user's profile Send private message
Prasanthhere

Active User


Joined: 03 Aug 2005
Posts: 306

PostPosted: Thu Jul 17, 2008 12:00 pm
Reply with quote

PRINT IFILE (DISK1) COUNT(4) shoul be fine

Not tested
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Thu Jul 17, 2008 12:06 pm
Reply with quote

Prasanthhere wrote:
PRINT IFILE (DISK1) COUNT(4) shoul be fine
Not tested


Yes, but don't forget to add the rather important following information ......

If there are 4 or more records in the file the return code will be zero, if not, the return code will be nonzero
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 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
Search our Forums:

Back to Top