|
View previous topic :: View next topic
|
| Author |
Message |
Shobana Bhaskar
New User
Joined: 02 Mar 2007 Posts: 35 Location: Pennsylvania, US
|
|
|
|
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 |
|
 |
murmohk1
Senior Member
.jpg)
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
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 |
|
 |
Shobana Bhaskar
New User
Joined: 02 Mar 2007 Posts: 35 Location: Pennsylvania, US
|
|
|
|
Thanks a lot.. Working fine  |
|
| Back to top |
|
 |
raak
Active User

Joined: 23 May 2006 Posts: 166 Location: chennai
|
|
|
|
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 |
|
 |
Shobana Bhaskar
New User
Joined: 02 Mar 2007 Posts: 35 Location: Pennsylvania, US
|
|
|
|
Thanks a lot raak. I gained one more way!!  |
|
| Back to top |
|
 |
pcoreddy
New User
Joined: 14 Mar 2007 Posts: 24 Location: Mysore
|
|
|
|
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 |
|
 |
paray2x
New User
Joined: 28 Dec 2005 Posts: 21
|
|
|
|
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 |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
Shobana Bhaskar
New User
Joined: 02 Mar 2007 Posts: 35 Location: Pennsylvania, US
|
|
|
|
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 |
|
 |
|
|