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
 

 

Counting the number of records in PS file
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products
View previous topic :: :: View next topic  
Author Message
Kumail Fazal

New User


Joined: 29 May 2007
Posts: 12
Location: Mysore

PostPosted: Thu Sep 20, 2007 12:21 pm    Post subject: Counting the number of records in PS filex
Reply with quote

Hi,
Could somebody please assist me in writing a small EZT + pgm, where in i need to count the number of records in the input PS(sequential) file,

I dont want to read the entire file for getting the number of records in it as the file contains more than a billion records

Thanks
Back to top
View user's profile Send private message

ksk

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

PostPosted: Thu Sep 20, 2007 12:34 pm    Post subject:
Reply with quote

Hi,

If my undersatnding is correct, following solution may solve ur problem. Otherwise please post ur requirment with example.

READ the file and set the COUNTER. Do this until u get required number of records. SET a FLAG with the number of records u want to read in READ statement.

If this won't resolve ur problem please give the detaild informaion on ur query.

KSK
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Thu Sep 20, 2007 12:39 pm    Post subject: Re: Counting the number of records in PS file
Reply with quote

I'm afraid that solution won't solve the problem as the OP doesn't want to read the entire file

Kumail Fazal wrote:

I dont want to read the entire file for getting the number of records in it as the file contains more than a billion records




icon_sad.gif
Back to top
View user's profile Send private message
Kumail Fazal

New User


Joined: 29 May 2007
Posts: 12
Location: Mysore

PostPosted: Thu Sep 20, 2007 12:41 pm    Post subject: Reply to: Counting the number of records in PS file
Reply with quote

Hi,
See the the file details are LRECL(record length)=80,RECFM=FB.
The file is a flat file.
Please let me know if u need other details
Back to top
View user's profile Send private message
murmohk1

Senior Member


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

PostPosted: Thu Sep 20, 2007 12:43 pm    Post subject:
Reply with quote

Kumail,

Quote:
Could somebody please assist me in writing a small EZT/COBOL + pgm

You could use ezt's RECORD-COUNT for your req.

Also what is that EZT/COBOL + pgm?
Back to top
View user's profile Send private message
Kumail Fazal

New User


Joined: 29 May 2007
Posts: 12
Location: Mysore

PostPosted: Thu Sep 20, 2007 12:46 pm    Post subject: Reply to: Counting the number of records in PS file
Reply with quote

Hi,
EZT/COBOL means writing the code in either Easytrive or COBOL would solve the purpose.
Also could please elaborate a bit more on your solution?
Thanks
Back to top
View user's profile Send private message
murmohk1

Senior Member


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

PostPosted: Thu Sep 20, 2007 12:57 pm    Post subject:
Reply with quote

Kumail,

Quote:
CA-Easytrieve automatically provides the special data fields for each of your files. These fields are stored as part of working
storage but can be qualified by file-name. As working storage fields,
they are not subject to invalid file reference errors.


RECORD-COUNT

RECORD-COUNT is a read-only field that contains the number of logical
input operations performed to the file.

For CA-IDMS and IMS/DLI files, only automatic input increments
RECORD-COUNT.


For more info, search the net.


Quote:

EZT/COBOL means writing the code in either Easytrive or COBOL would solve the purpose.

I got this. But what COBOL + stand for?
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

PostPosted: Thu Sep 20, 2007 12:57 pm    Post subject:
Reply with quote

Acevedo,

I am not asking him to read bellion of records. If he knows number of records he wants to read, he can provide that value in his procedure division statements.

E.g.,

Main-Para.

PERFORM Read-Para UNTIL FLAG1='Y'.

Main-Para-Exit.
Exit.


Read-Para.
MOVE 0 TO COUNTER1.
READ FILE1.
IF EOF (another flag need to be declared)
Perform Main-para-exit.
END-IF.
ADD 1 TO COUNTER1.
IF COUNTER1 = 10000 (If he watns to read Ten Thousand Records)
MOVE 'Y' TO FLAG1
ELSE
PERFORM READ-PARA
END-IF.

Please note that I have consider only counting the number of records in the above logic.

KSK
Back to top
View user's profile Send private message
murmohk1

Senior Member


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

PostPosted: Thu Sep 20, 2007 1:02 pm    Post subject:
Reply with quote

KSK,

Quote:
If he knows number of records he wants to read, he can provide that value in his procedure division statements.

Kumail wants know how many records present in the file. He doesn't have prior info.

Kumail,
You could use UTILITIES for getting the # of records (if you want it thru JCL).
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Sep 20, 2007 1:07 pm    Post subject: Reply to: Counting the number of records in PS file
Reply with quote

I am always puzzled by this kind of questions...
I cannot think of them as "IT real world examples"

counting the number of records in a sequential file is usually one of the first programming samples/exercises given in a programming course ( for any language )

- no structured I/O area needed,
- a simple counter,
- basic end of file handling,
- at the end a display of the counter

there should not be any problem writing it.

As far as the other issue raised by the OP on the unwillingness to read all the file, he is out of luck, for the exact count he needs to read ALL the records.

So, why these questions?
It would be more confortable for the responders to see in the question
something like :
- I am learning
- it' s a programming test
- any lame excuse you like
- ...

And the replies would be more appropriate and helpful

regards

e.s
Back to top
View user's profile Send private message
murmohk1

Senior Member


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

PostPosted: Thu Sep 20, 2007 1:15 pm    Post subject:
Reply with quote

enrico-sorichetti,

Quote:
I cannot think of them as "IT real world examples"


I would not say that. We do use RECORD-COUNT option a lot before generating a report in my shop.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Sep 20, 2007 1:19 pm    Post subject: Reply to: Counting the number of records in PS file
Reply with quote

Quote:
I would not say that. We do use RECORD-COUNT option a lot before generating a report in my shop.


My comment was on the way the question was posed,
if a shop has the need/the habit of counting records it would be a standard
well documented procedure and should not be reinvented every time

regards

e.s
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Thu Sep 20, 2007 1:25 pm    Post subject:
Reply with quote

Hi Kumail Fazal,

REXX will suit better to your need. (Not sure though whether would you like to do it that way or not)
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Sep 20, 2007 1:43 pm    Post subject: Reply to: Counting the number of records in PS file
Reply with quote

What I would like to point out is the POOR organization of the shops many posters work for.

most of the shops I was consulting for usually had for the newcomers a printed/online document
( even be a simple text file produced using the ISPF editor )
containing a short description of the home grown small tools and standards being used like..

- user data set allocation ( naming, dcb, space )
- use of the most common utilities
- security issues
- TSO short primer
- JCL standards
- how to solve the most common abends ( SB37, SE37, -805, ... )
- THE TELEPHONE NUMBER OF THE TECHNICAL SUPPORT STAFF
- ... add as many as You want

and they usually had a library ( sample name )
"xxxxxx.sample.jcllib"
with jcl samples of the most common utilities customized for their
standards

I did not take an exact count but the forum traffic is about 50% due to the lack of this very simple items available.

I wonder how these IT shops got their ISO900x ( or equivalent ) certification

I firmly believe that the objective of these forums is to help the individuals,
but also to teach IT shops how to run their business.
But alas... if their organizations do not change their BAD habits
we will continue to give free training/consultancy to those IDtenS
( not the posters, but the organizations they work for and their managers )

regards

e.s
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Thu Sep 20, 2007 1:46 pm    Post subject:
Reply with quote

how could Rexx, Cobol or DFSORT know the total records of a flat file without reading the whole file? icon_question.gif
Back to top
View user's profile Send private message
Kumail Fazal

New User


Joined: 29 May 2007
Posts: 12
Location: Mysore

PostPosted: Thu Sep 20, 2007 2:11 pm    Post subject: Reply to: Counting the number of records in PS file
Reply with quote

Hi,
Thanks everyone for all your inputs.
I cannot do it using a JCL(though i know it can be done) as my requirements does not allows me to do so.
I also cannot write a rexx code again due to my requirement issues and code delivery deadline

I'll try using murmohk1 solution of using Record-count.

If anyone has some other way of dealing with this problem, please share your thoughts
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Thu Sep 20, 2007 2:23 pm    Post subject:
Reply with quote

BUT what about your original requirement?

I dont want to read the entire file for getting the number of records icon_question.gif

that's the KEY of this thread...do you think that using murmohk1 solution will avoid reading the whole file?
Back to top
View user's profile Send private message
Kumail Fazal

New User


Joined: 29 May 2007
Posts: 12
Location: Mysore

PostPosted: Thu Sep 20, 2007 2:34 pm    Post subject: Reply to: Counting the number of records in PS file
Reply with quote

Hi,
I am trying the solution given by murmohk1, but i see a very less possibility of that working out as even RECORD-COUNT defination says that
"RECORD-COUNT is a read-only four-byte binary field with zero decimal places that contains the number of logical I/O operations performed on a file".
and i am also not sure of the syntax. But at this moment i have only this solution so pinning all my hopes on it.
Back to top
View user's profile Send private message
murmohk1

Senior Member


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

PostPosted: Thu Sep 20, 2007 2:53 pm    Post subject:
Reply with quote

Kumail,

Quote:
i am also not sure of the syntax.

Its kind of KEYWORD..... doesn't have syntax. Search the net, you will get tonnes of info.
Back to top
View user's profile Send private message
Kumail Fazal

New User


Joined: 29 May 2007
Posts: 12
Location: Mysore

PostPosted: Thu Sep 20, 2007 3:06 pm    Post subject: Reply to: Counting the number of records in PS file
Reply with quote

Hi murmohk1,
iI have got the syntax and i am browsing the net for more information.
Hope to get the slotion using the keyword "Record Count"

Thanks once again for sharing this.
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 -> CA Products All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us