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

Need to count the number of records thru JCL


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
anandkumarrn

New User


Joined: 06 Feb 2009
Posts: 23
Location: India

PostPosted: Sat May 23, 2009 11:57 pm
Reply with quote

Hi,

I have a requirement where i need to count the number of records in a VSAM file where the status is 'Active' and i will specify the starting postition from where the JCL should start counting the number of records which are in Active status thru JCL parm card or thru SET statement.


my VSAM file will be like this

s.no Name roll# status
1 aaa 001 Active
2 bbbb 002 Not Active
3 cccc 003 Active
4 aaa 004 active
5 aaa 005 Active
6 bbbb 006 Not Active
7 cccc 007 Active
8 aaa 008 active


Say for example, i need to get the no. of records which are in active status and my read should start from 4th position.

And for this example my output should be 4.

Thanks in advance,
Regards,
Anand
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: Sun May 24, 2009 12:03 am
Reply with quote

Hello,

Quote:
And for this example my output should be 4.
Why?

What is "from 4th position"?

Are these records "freeform" or are the field displacements fixed in the records?
Back to top
View user's profile Send private message
anandkumarrn

New User


Joined: 06 Feb 2009
Posts: 23
Location: India

PostPosted: Sun May 24, 2009 12:11 am
Reply with quote

Quote:
And for this example my output should be 4.
Why?

What is "from 4th position"?

Hi d.sch. thanks for your quick reply,

The output i said was for the above example, where there are 4 active records after my 4th(s.no).
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: Sun May 24, 2009 1:37 am
Reply with quote

Hello,

Show the actual format of the records (this probably means you need to use the "Code" tag to preserve alignment). Does "A/active" always appear at the same displacement?

It is a fairly bad idea to provide sample data where the "answer" is used in the question (i.e. "4").

What determines the starting s.no?
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Sun May 24, 2009 1:07 pm
Reply with quote

Hi Anand,

From the data
Code:
1 aaa 001 Active
2 bbbb 002 Not Active
3 cccc 003 Active
4 aaa 004 active
5 aaa 005 Active
6 bbbb 006 Not Active
7 cccc 007 Active
8 aaa 008 active
this
Quote:
4 aaa 004 active
seems to be the fourth position and if this is true, if we count from this position (including 4th) there are total "4 occurences" of word "active" till we reach "8th position" and 8th position in exapmle is
Quote:
8 aaa 008 active


Now how this
Quote:
my read should start from 4th position
is decided? What are the other possibe values "to start"?
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: Sun May 24, 2009 11:11 pm
Reply with quote

Hi Anuj,

My goal was to get the TS to do a better job of posting a requirement - there was no question of the meaning. It was simply poorly done. What you "coded" may or may not be the way the data is actually present in the file. . . Which is why i questioned the format/displacement of the data.

Whatever lead to posting an example where the 4th record, the 4th field in the data, and a desired output of 4 is a mystery.

[PesonalBelief]
One of the most valuable things we can do for the forum members is to guide in how to properly post a question/requirement. If we encourage people to refine their posts we do them a service. If we flail away at ambiguous questions with best-guess "solutions" we do them a disservice (not counting usually wasting a lot of time to get to a solution they can use).
[/PersonalBelief]
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon May 25, 2009 1:56 am
Reply with quote

I've stopped suggesting people read the manual (even provide a link),
'cause someone always comes along and uses forum space to quote the manual,
or
provide an answer to a syntax question.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts To get the count of rows for every 1 ... DB2 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
Search our Forums:

Back to Top