View previous topic :: View next topic |
Author |
Message |
js01 Beginner
Joined: 13 Oct 2005 Posts: 84 Topics: 32 Location: INDIA
|
Posted: Thu May 18, 2006 7:31 am Post subject: how to check the record count |
|
|
can you please help me to solve my problem
my job is getting abend when file is having only headre and trailer(means no deatiled records , we treat it as a empty file) i want to send a rectrun code when empty file comes in , so that i can force complete the job
rgds
vasu |
|
Back to top |
|
 |
hariavinash Beginner
Joined: 21 Jan 2005 Posts: 52 Topics: 7
|
Posted: Thu May 18, 2006 7:40 am Post subject: |
|
|
STEP010 EXEC PGM=IDCAMS
SYSPRINT DD SYSOUT=*
SYSIN DD *
PRINT INDATASET(dataset.name) COUNT(2)
this jcl will check for maximum 2 records in the file assuming its header and trailer.
if its more than 2, this will give a non-zero return code (RC 4 if i am not mistaken).
but if u wanna make sure that the 2 records are actually hdr and trlr, strip the records using sort and then do the count.
cheers |
|
Back to top |
|
 |
js01 Beginner
Joined: 13 Oct 2005 Posts: 84 Topics: 32 Location: INDIA
|
Posted: Thu May 18, 2006 8:49 am Post subject: |
|
|
i have tried with above slotuion but i am getting rc=0 |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Thu May 18, 2006 9:29 am Post subject: |
|
|
js01,
You need to check for count of 3 in the idcams step as your header and trailer constitue the 2 records. so change your sysin cards to the following
Code: |
//SYSIN DD *
PRINT INDATASET(dataset.name) COUNT(3)
//*
|
Also check this link for various ways of checking empty files.
http://mvsforums.com/helpboards/viewtopic.php?t=5319
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
hariavinash Beginner
Joined: 21 Jan 2005 Posts: 52 Topics: 7
|
Posted: Thu May 18, 2006 10:12 am Post subject: |
|
|
oops, i should have tested. thanks for correcting it kolusu.
cheers |
|
Back to top |
|
 |
js01 Beginner
Joined: 13 Oct 2005 Posts: 84 Topics: 32 Location: INDIA
|
Posted: Tue May 23, 2006 1:59 am Post subject: |
|
|
thank you kolusu/hari for your help |
|
Back to top |
|
 |
Frank Yaeger Sort Forum Moderator

Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
|
Posted: Tue May 23, 2006 10:23 am Post subject: |
|
|
For more information on using DFSORT/ICETOOL to check the record count, see the "Set RC=12 or RC=4 if file is empty, has more than n records, etc" Smart DFSORT Trick at:
http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/ _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort |
|
Back to top |
|
 |
|
|