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

Finding Empty dataset in SORT utility


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

New User


Joined: 02 Mar 2007
Posts: 35
Location: Pennsylvania, US

PostPosted: Mon Apr 02, 2007 12:55 pm
Reply with quote

Hi all,

I want to know whether the input dataset given in SORT step is empty or not.

If PGM=SORT is used, it would return 0 even if input is empty.
If PGM=FILEAID is used, it would return 8 for empty input.

Is it possible to check input empty or not, before executing SORT/FILEAID?

Thanks in advance!!!
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Mon Apr 02, 2007 1:02 pm
Reply with quote

Shobana,

Code:

//CHKEMPTY EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=YOUR.FILE,DISP=SHR   
//TOOLIN DD *
  COUNT FROM(IN1) NOTEMPTY RC4
/*


Above step throws RC=0 when the file is empty and RC=4 if the file is a non-empy file.

Change NOTEMPTY to EMPTY and you get RC vice-versa.
Back to top
View user's profile Send private message
Shobana Bhaskar

New User


Joined: 02 Mar 2007
Posts: 35
Location: Pennsylvania, US

PostPosted: Mon Apr 02, 2007 1:16 pm
Reply with quote

Thanks a lot.. Working fine icon_smile.gif
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Mon Apr 02, 2007 1:23 pm
Reply with quote

Shobana,

U have to use one Step before ur actual sort to identify whether the input is empty or not..

U can use Murmokh's idea to do this or u can use this using IDCAMS also.

give this in the Control card for IDCAMS.

Code:
PRINT                 -       
   INFILE(INPUT1)        -   
   COUNT(1)               


U will get a return code of 0 for Non-empty files and a return code of 4 for empty files.

Based on this return code, u can decide whether to do ur actual sort or not...
Back to top
View user's profile Send private message
Shobana Bhaskar

New User


Joined: 02 Mar 2007
Posts: 35
Location: Pennsylvania, US

PostPosted: Thu Apr 05, 2007 10:41 am
Reply with quote

Thanks a lot raak. I gained one more way!! icon_smile.gif
Back to top
View user's profile Send private message
pcoreddy

New User


Joined: 14 Mar 2007
Posts: 24
Location: Mysore

PostPosted: Thu Apr 05, 2007 8:23 pm
Reply with quote

You can find by using SORT


after running sort see in the spool . In the spool

RED IN = 0 means that file is empty ,if RED IN show other than 0 means file is not empty
Back to top
View user's profile Send private message
paray2x

New User


Joined: 28 Dec 2005
Posts: 21

PostPosted: Fri Apr 06, 2007 11:15 pm
Reply with quote

Hi All.

You may be aware of this. You can also use a utility called COPYANY which gives RC 08 when no records are copied.

You can copy the i/p file before sorting, into a temp file with COPYANY, Check for RC08 and decide to continue.

Thanks,
Para
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Apr 06, 2007 11:39 pm
Reply with quote

Hello,

Most sites do not have the utility COPYANY.

When site specific solutions are posted, it is a good idea to mention that in the post.
Back to top
View user's profile Send private message
Shobana Bhaskar

New User


Joined: 02 Mar 2007
Posts: 35
Location: Pennsylvania, US

PostPosted: Mon Apr 09, 2007 10:31 am
Reply with quote

Hi Paray2x,
My client system will not support COPYANY and COPYMANY.

Hello Pcoreddy,
I searched a solution that should indicate empty record through return code so that it can be used as reference to another step in JCL.

The ideas from murmohk1 and raak are fine and helpful. Thanks.
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts VB to FB - Finding LRECL SYNCSORT 4
No new posts JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top