Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 92
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: 1555
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: 92
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

Senior Member


Joined: 14 Mar 2007
Posts: 10479
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: 92
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

Senior Member


Joined: 14 Mar 2007
Posts: 10479
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: 1555
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: 92
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

Senior Member


Joined: 14 Mar 2007
Posts: 10479
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: 1555
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 To remove spaces from a VB file using... Selvarajars DFSORT/ICETOOL 5 Thu Jun 21, 2018 6:57 pm
No new posts B059 PREMATURE END OF FILE mvmadhuvenkatesh CA Products 5 Tue Jun 19, 2018 10:50 am
No new posts Submit JCL to INTRDR and check the st... srajendran2 COBOL Programming 7 Sat Jun 16, 2018 1:30 am
No new posts Formating output file Niki DFSORT/ICETOOL 3 Fri Jun 15, 2018 3:27 pm
No new posts Need help on TDQ load from file using... subratarec CICS 4 Wed Jun 13, 2018 11:32 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us