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
 

 

Empty File check

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
chandracdac

New User


Joined: 15 Jun 2007
Posts: 87
Location: bangalore

PostPosted: Tue Jun 12, 2012 10:46 am    Post subject: Empty File check
Reply with quote

I have a PS which has more than 1000 file names inside the PS. I need a JCL to read this file line by line and check if the file is empty. If the file is empty, then delete those files.

Can this be achieved thru JCL??
Back to top
View user's profile Send private message

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Tue Jun 12, 2012 10:51 am    Post subject:
Reply with quote

I believe this can be achieved better in REXX and you can execute it via JCL
Back to top
View user's profile Send private message
chandracdac

New User


Joined: 15 Jun 2007
Posts: 87
Location: bangalore

PostPosted: Tue Jun 12, 2012 10:56 am    Post subject: Reply to: Empty File check
Reply with quote

I have no idea on REXX.. Do u have any sample code for the same ??
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Tue Jun 12, 2012 11:08 am    Post subject: Reply to: Empty File check
Reply with quote

when replying I have the habit of looking at the TS profile to find out how to word the answer!
but in this case I am at loss ....

from the TS profile
Quote:
Mainframe Skills: surfing

posting silly info will lower the chances of getting good answers
Back to top
View user's profile Send private message
chandracdac

New User


Joined: 15 Jun 2007
Posts: 87
Location: bangalore

PostPosted: Tue Jun 12, 2012 11:21 am    Post subject: Reply to: Empty File check
Reply with quote

enrico-sorichetti
After doing all my search only i posted here :-)..
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Tue Jun 12, 2012 11:27 am    Post subject: Reply to: Empty File check
Reply with quote

Your question can be split in two ...

1) how to check for an empty file ...
the question belongs to the off topic category ( asked and answered too many times )

2) how to generate the above automatically from a list
in the dfsort section there are zillions of examples on how to do it
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Tue Jun 12, 2012 11:29 am    Post subject:
Reply with quote

Alloc your input file
read your input file till finis and store the records in stem
free input file

suppose if your stem variable is Ps

Ps.0 will have total count

so in rexx you just need to have a loop like

Do i = 1 to Ps.0
Ps.i will have your record
Ps.i=strip(Ps.i) this will just remove extra spaces so your variable Ps.i would contain the values
Allocate Ps.i
Read Ps.i have stem = Ps2.i
check for Ps2.0=0
If yes Then do
Free file ps2.i
Delete Ps2.i
End
Else
Do
Free file Ps2.i
End
End
Exit

For Actual syntax you can Surf icon_smile.gif
Back to top
View user's profile Send private message
chandracdac

New User


Joined: 15 Jun 2007
Posts: 87
Location: bangalore

PostPosted: Tue Jun 12, 2012 11:36 am    Post subject: Reply to: Empty File check
Reply with quote

pandora

Thanks i can do that
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Tue Jun 12, 2012 11:39 am    Post subject: Reply to: Empty File check
Reply with quote

using rexx ( or anything else ) there is no need to read all the records
for <emptyness> checking reading one record is more than enough icon_wink.gif


for idcams the usual approach is something along the lines of ...
PRINT INDATASET(xxxxx) COUNT(1)
IF LASTCC = 0 THEN
not empty
ELSE
empty and ...
DELETE INDATSET(xxxxx)
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Tue Jun 12, 2012 11:40 am    Post subject:
Reply with quote

Argh thanks Enrico
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 Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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