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

Count of no of records in a dataset


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
veena_nagesh2002
Warnings : 1

Active User


Joined: 07 May 2005
Posts: 110
Location: hyderabad

PostPosted: Fri Nov 02, 2007 1:26 pm
Reply with quote

Hi all,

can any one assist me is it possible to count no of records in a dataset through IDCAMS utility or some other utility.

my requirement is : At first step my utility pgm must check no of records in a dataset, if it is more than one than only next step must execute. so kindly assist me.
Back to top
View user's profile Send private message
murmohk1

Senior Member


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

PostPosted: Fri Nov 02, 2007 1:42 pm
Reply with quote

Veena,

Following step returns '4', if the no of records are greater than 1 and '0' if the record count is equal to 1.

Code:
//STEP1     EXEC PGM=ICETOOL               
//TOOLMSG DD SYSOUT=*                     
//DFSMSG DD SYSOUT=*                       
//INPUT DD *          <-- I/P file                     
004102007 PGM1                             
004102007 PGM1                             
/*                                         
//TOOLIN DD *                             
  COUNT FROM(INPUT) HIGHER(1) RC4         
/*                                         
Back to top
View user's profile Send private message
veena_nagesh2002
Warnings : 1

Active User


Joined: 07 May 2005
Posts: 110
Location: hyderabad

PostPosted: Fri Nov 02, 2007 2:38 pm
Reply with quote

First I would like to thanks for reply, can we set multiple conditions in this (TOOLIN DD *) for ex: empty, single record & and with mandatory record types with different Return codes. Kindly help me in this regard

//TOOLIN DD *
COUNT FROM(INPUT) HIGHER(1) RC4
/*
Back to top
View user's profile Send private message
murmohk1

Senior Member


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

PostPosted: Fri Nov 02, 2007 2:49 pm
Reply with quote

Veena,
Quote:

empty, single record & and with mandatory record types with different Return codes

We can verify empty file. Single you know it already. What do you mean by mandatory record types?
Back to top
View user's profile Send private message
veena_nagesh2002
Warnings : 1

Active User


Joined: 07 May 2005
Posts: 110
Location: hyderabad

PostPosted: Fri Nov 02, 2007 2:55 pm
Reply with quote

murali,

could you please tell me for the condition on empty and for single record, In the mean time i will draft details indetail. Note : all these conditions must be executed in the single step with return codes
Back to top
View user's profile Send private message
murmohk1

Senior Member


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

PostPosted: Fri Nov 02, 2007 3:44 pm
Reply with quote

Veena,

Your requirement is not clear. Is it like verify the same file for EMPTY, ONE record.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Nov 02, 2007 3:44 pm
Reply with quote

Check the "Set RC=12 or RC=4 if file is empty, has more than n records,etc" Smart DFSORT Trick at:

www.ibm.com/servers/storage/support/software/sort/mvs/tricks/
Back to top
View user's profile Send private message
veena_nagesh2002
Warnings : 1

Active User


Joined: 07 May 2005
Posts: 110
Location: hyderabad

PostPosted: Fri Nov 02, 2007 3:50 pm
Reply with quote

yes murali exactly

with in the same toolin dd * can i write more than on condition like below with different return code.

COUNT FROM(INPUT) HIGHER(1) RC4

if so kindly provide me the details and also can you pleas give me best & fast reference material in ICETOOL
Back to top
View user's profile Send private message
murmohk1

Senior Member


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

PostPosted: Fri Nov 02, 2007 3:54 pm
Reply with quote

Veena,

Quote:
with in the same toolin dd * can i write more than on condition like below with different return code.

File empty and non-empty conditions are contradicting. Its a bad idea to verify same file for these conditions.

Anyways Krisprems had given the link. Verify that.

Quote:
so kindly provide me the details and also can you pleas give me best & fast reference material in ICETOOL

Sticky's are available in DFSORT forum for ref materials.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Nov 02, 2007 4:33 pm
Reply with quote

Code:
//******************************************************* 
//STEP1     EXEC PGM=ICETOOL                               
//TOOLMSG DD SYSOUT=*                                     
//DFSMSG DD SYSOUT=*                                       
//INPUT DD *                                               
DAFDF                                                     
DAFDF                                                     
/*                                                         
//TOOLIN DD *                                             
*SET RC=12 IF I/P IS EMPTY                                 
  COUNT FROM(INPUT) EMPTY                                 
*SET RC=04 IF I/P HAS MORE THAN ONE RECORD                 
  COUNT FROM(INPUT) HIGHER(1) RC4                         
/*                                                         
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Nov 02, 2007 8:16 pm
Reply with quote

veena_nagesh2002,

Note that DFSORT's ICETOOL will return the highest return code it sets as the return code of the job. So if it sets RC=12 for one operator and RC=4 for another operator, the return code for the job will be 12. Also note that once ICETOOL sets RC=12 for an operator it will stop executing the remaining operators unless you use MODE CONTINUE.

It's still not clear to me exactly what you want to do. Perhaps if you explained it in more detail, I could help you figure out how to do what you want to do.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Nov 05, 2007 4:32 pm
Reply with quote

veena_nagesh2002 wrote:
my requirement is : At first step my utility pgm must check no of records in a dataset, if it is more than one than only next step must execute. so kindly assist me.

This quote from your first post suggest that you want to check for empty/non-empty file.

But this
Quote:
could you please tell me for the condition on empty and for single record,

is bit confusing..one record or many..file is not empty, what are you lokking for?

I think, you need to do somthing like:

Code:
if one-record-in-input
 do this
else-if two-records
 do this
else-if
 do this
end-if.


If so..don't you think that it's a bit prgramatic approach rather than JCL one.
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: Mon Nov 05, 2007 9:02 pm
Reply with quote

Hello,

FWIW, i'd suggest looking at the design and implementing a consistent procedure that is not sensitive to zero, one, many, or record-types in "the file".

Even when this is all "working", i suspect it will be met with problems when it is in maintenance or needs to be "enhanced". I'm also not sure if there might be restart "opportunities" as well.

Many systems have met whatever this business requirement is without needing to use this method.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Nov 05, 2007 9:41 pm
Reply with quote

dick scherrer wrote:
Many systems have met whatever this business requirement is without needing to use this method.

I suspect that it can be a business requirement , however if yes..would like to know a bit about such a system, even via PM.
Back to top
View user's profile Send private message
ayansau

New User


Joined: 22 Jun 2007
Posts: 42
Location: Chennai

PostPosted: Mon Dec 10, 2007 12:24 pm
Reply with quote

I want number of records present in a file.. Not to check an empty file... icon_rolleyes.gif
Back to top
View user's profile Send private message
murmohk1

Senior Member


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

PostPosted: Mon Dec 10, 2007 12:27 pm
Reply with quote

ayansau,


Quote:
I want number of records present in a file.. Not to check an empty file...

Any reason for not starting a 'new topic'.
This was discussed earlier. Search DFSORT forum.

Clue: Searchword - 'trailer1'.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Dec 10, 2007 9:56 pm
Reply with quote

Quote:
I want number of records present in a file.. Not to check an empty file.


You should have started a new topic.

You can use the technique shown in the "Display the number of input or output records" Smart DFSORT Trick at:

www.ibm.com/servers/storage/support/software/sort/mvs/tricks/
Back to top
View user's profile Send private message
pdevidas12

New User


Joined: 28 Feb 2010
Posts: 3
Location: Pune

PostPosted: Tue Aug 31, 2010 6:56 pm
Reply with quote

Me too have same requirment, please let me know if you have got the solition?
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Tue Aug 31, 2010 7:11 pm
Reply with quote

pdevidas12,
Quote:
Me too have same requirment
Please define/provide your requirements clearly.

If its the "same" requirement then the "same" solution should work for you. Above comments from Frank applies to you as well, you should have started new topic.

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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top