MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to check the record count

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
js01
Beginner


Joined: 13 Oct 2005
Posts: 84
Topics: 32
Location: INDIA

PostPosted: Thu May 18, 2006 7:31 am    Post subject: how to check the record count Reply with quote

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
View user's profile Send private message
hariavinash
Beginner


Joined: 21 Jan 2005
Posts: 52
Topics: 7

PostPosted: Thu May 18, 2006 7:40 am    Post subject: Reply with quote

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
View user's profile Send private message
js01
Beginner


Joined: 13 Oct 2005
Posts: 84
Topics: 32
Location: INDIA

PostPosted: Thu May 18, 2006 8:49 am    Post subject: Reply with quote

i have tried with above slotuion but i am getting rc=0
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu May 18, 2006 9:29 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
hariavinash
Beginner


Joined: 21 Jan 2005
Posts: 52
Topics: 7

PostPosted: Thu May 18, 2006 10:12 am    Post subject: Reply with quote

oops, i should have tested. thanks for correcting it kolusu.

cheers
Back to top
View user's profile Send private message
js01
Beginner


Joined: 13 Oct 2005
Posts: 84
Topics: 32
Location: INDIA

PostPosted: Tue May 23, 2006 1:59 am    Post subject: Reply with quote

thank you kolusu/hari for your help
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue May 23, 2006 10:23 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group