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
 

 

Count of no of records in a dataset

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Count of no of records in a dataset
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: 1439
Location: Bangalore,India

PostPosted: Fri Nov 02, 2007 1:42 pm    Post subject:
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    Post subject: Reply to: Count of no of records in a dataset
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: 1439
Location: Bangalore,India

PostPosted: Fri Nov 02, 2007 2:49 pm    Post subject:
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    Post subject: Reply to: Count of no of records in a dataset
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: 1439
Location: Bangalore,India

PostPosted: Fri Nov 02, 2007 3:44 pm    Post subject:
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    Post subject:
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:

http://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    Post subject: Reply to: Count of no of records in a dataset
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: 1439
Location: Bangalore,India

PostPosted: Fri Nov 02, 2007 3:54 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Fri Nov 02, 2007 8:16 pm    Post subject:
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

Senior Member


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

PostPosted: Mon Nov 05, 2007 4:32 pm    Post subject: Re: Count of no of records in a dataset
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

Site Director


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

PostPosted: Mon Nov 05, 2007 9:02 pm    Post subject:
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

Senior Member


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

PostPosted: Mon Nov 05, 2007 9:41 pm    Post subject:
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    Post subject: Not to check an empty file.
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: 1439
Location: Bangalore,India

PostPosted: Mon Dec 10, 2007 12:27 pm    Post subject:
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 Moderator


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

PostPosted: Mon Dec 10, 2007 9:56 pm    Post subject:
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:

http://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    Post subject: Reply to: Count of no of records in a dataset
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: 578
Location: USA

PostPosted: Tue Aug 31, 2010 7:11 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 1 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 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 How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 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