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
 

 

Finding Empty dataset in SORT utility

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Finding Empty dataset in SORT utility
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: 1439
Location: Bangalore,India

PostPosted: Mon Apr 02, 2007 1:02 pm    Post subject:
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    Post subject: Re: Finding Empty dataset in SORT utility
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    Post subject:
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    Post subject: Re: Finding Empty dataset in SORT utility
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    Post subject: Re: Finding Empty dataset in SORT utility
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    Post subject:
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

Site Director


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

PostPosted: Fri Apr 06, 2007 11:39 pm    Post subject:
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    Post subject:
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    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 TAPE VERIFY utility?? MrExtraordinare JCL & VSAM 3 Fri Dec 09, 2016 10:57 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 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 FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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