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

IDCAMS to check for an empty file in PDS


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

New User


Joined: 04 Aug 2008
Posts: 46
Location: Chennai

PostPosted: Tue Nov 24, 2009 6:42 pm
Reply with quote

Can we use IDCAMS to check for an empty file if the file in question is a PDS?

Please let me know if there are any other means to do this excluding PDSFAST.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Nov 24, 2009 6:56 pm
Reply with quote

DFSORT
REXX
Back to top
View user's profile Send private message
VVRAVINDRA

New User


Joined: 04 Aug 2008
Posts: 46
Location: Chennai

PostPosted: Tue Nov 24, 2009 6:59 pm
Reply with quote

Thanks Expat,

so your answer means that we cannot check if a PDS is empty using IDCAMS??

Sorry to bother you...
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Nov 24, 2009 7:25 pm
Reply with quote

Sorry about that, misread you original post.

Yes, you can use IDCAMS. PRINT parameter, will return 4 if no records in file.
Back to top
View user's profile Send private message
VVRAVINDRA

New User


Joined: 04 Aug 2008
Posts: 46
Location: Chennai

PostPosted: Tue Nov 24, 2009 7:34 pm
Reply with quote

Thanks Expat,

I tried giving the following JCL

//IDCCHEK2 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSDBOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//DDIN DD DISP=SHR,DSN=TEST.PDS.TEST
//SYSIN DD *
PRINT INFILE(DDIN)
/*

but got a RC=12 and with the following messages

IDC3302I ACTION ERROR ON KDRV00.PDS.TEST
IDC3313I ** ,JOBC1,IDCCHEK2,BBA3,D,DDIN ,
READ ,WRNG.LEN.RECORD,0000019B000000,BSAM

Could you let me know if I coded the PRINT command correctly
Back to top
View user's profile Send private message
VVRAVINDRA

New User


Joined: 04 Aug 2008
Posts: 46
Location: Chennai

PostPosted: Tue Nov 24, 2009 7:37 pm
Reply with quote

To add more to my note
I tried to use the same JCL to print a sequential dataset and my job ran fine.

Could you please let me know if I'm doing this right
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8651
Location: Dubuque, Iowa, USA

PostPosted: Tue Nov 24, 2009 7:49 pm
Reply with quote

If you're going to use IDCAMS to check a PDS, you must be checking a member -- not the PDS. The wrong length record comes about when IDCAMS attempts to read the data set, finds the first directory record (which is 256 bytes) and discovers the LRECL is not the same length as the data read.

What would it mean for a PDS to be empty? No members? If so, you'll need some other way besides IDCAMS to check it since IDCAMS needs a member name.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Nov 24, 2009 7:49 pm
Reply with quote

I would use the COUNT(1) so that if there is 1 or more records in the file the RC will be 0, and if none the RC will be 4

Looks like you are trying to print a PDS, you need to specify a member name if it is a PDS.
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: Tue Nov 24, 2009 7:54 pm
Reply with quote

IIRC, if you need to suppress all printing, specify COUNT(0), then there aren't any security issues raised if the data contains sensitive/proprietary information.

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

New User


Joined: 04 Aug 2008
Posts: 46
Location: Chennai

PostPosted: Tue Nov 24, 2009 7:57 pm
Reply with quote

Thank you both, I agree with you that we cannot check if a PDS file is empty until and unless if we check for a particular member in the PDS in IDCAMS....

but if you find any new way of doing this thru IDCAMS please let me know and I would be the happiest person.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8651
Location: Dubuque, Iowa, USA

PostPosted: Tue Nov 24, 2009 7:59 pm
Reply with quote

If you limit yourself to IDCAMS, you cannot check whether the entire PDS is empty. IDCAMS was not really designed to handle PDS files, so it is not a very good choice of tool for manipulating a PDS.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Nov 24, 2009 8:04 pm
Reply with quote

Maybe if you gave a little more information on exactly what you want to achieve, then maybe we could be more helpful
Back to top
View user's profile Send private message
VVRAVINDRA

New User


Joined: 04 Aug 2008
Posts: 46
Location: Chennai

PostPosted: Tue Nov 24, 2009 8:06 pm
Reply with quote

Sure, but what amazes me is that I've an entire occean but still thirsting for a single drop

Once again my sincere thanks to one and all, sorry to bother you much....

Regards,
Ravi
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10833
Location: italy

PostPosted: Tue Nov 24, 2009 8:07 pm
Reply with quote

Quote:
Can we use IDCAMS to check for an empty file if the file in question is a PDS?


You can use IDCAMS/SORT to check for an empty member
not for an empty PDS directory!
Back to top
View user's profile Send private message
VVRAVINDRA

New User


Joined: 04 Aug 2008
Posts: 46
Location: Chennai

PostPosted: Tue Nov 24, 2009 8:08 pm
Reply with quote

Hi Expat,

Well we had a scenario where we need to check if the incoming PDS file is empty .....

We mentioned other aleternatives like IEBCOPY, ICETOOL, PDSFAST but the client wants to know whether we could achieve it thru IDCAMS and thus began the story.....
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Nov 24, 2009 8:23 pm
Reply with quote

Clarify empty.

PDS has no members or PDS has members but all are empty
Back to top
View user's profile Send private message
VVRAVINDRA

New User


Joined: 04 Aug 2008
Posts: 46
Location: Chennai

PostPosted: Tue Nov 24, 2009 8:29 pm
Reply with quote

We need to check if the PDS has no members or containing some memebers in it
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Nov 24, 2009 9:04 pm
Reply with quote

Easy peasy in REXX
Code:
/* REXX *** LIST PDS AND SEE IF MEMBERS EXIST             */
 ADDRESS ISPEXEC "CONTROL ERRORS RETURN"                               
 "FREE  FI(SYSPRINT)"                                                   
 "ALLOC FI(SYSPRINT) SYSOUT(Z)"                                         
 PDS = "Pds Name"                                                   
 X = MSG('OFF')                                                         
 X=OUTTRAP(LIST.)                                                       
 "LISTDS '"PDS"' MEM "                                                 
 X=OUTTRAP(OFF)                                                         
 IF LIST.0 <= 6
   THEN EXIT  0
   ELSE EXIT 16
Back to top
View user's profile Send private message
VVRAVINDRA

New User


Joined: 04 Aug 2008
Posts: 46
Location: Chennai

PostPosted: Thu Nov 26, 2009 12:26 pm
Reply with quote

Thanks All, I gave all these options to my client and I need to wait for his choice, Once again I'm very grateful to each one of you for your wonderful suggestions
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10833
Location: italy

PostPosted: Thu Nov 26, 2009 3:37 pm
Reply with quote

Quote:
I gave all these options to my client


looks like the forums are getting more and more like some kind of ..
sub-outsourcing and even free of charge icon_evil.gif
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 Selecting the max value from a file. DFSORT/ICETOOL 3
No new posts Change history of vsam file. JCL & VSAM 3
No new posts Split large FB file based on Key coun... DFSORT/ICETOOL 4
No new posts EMPTY file check scenario JCL & VSAM 6
No new posts SORT deletes the SORTOUT file DFSORT/ICETOOL 8
Search our Forums:

Back to Top