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

Counting the number of records in PS file


IBM Mainframe Forums -> CA Products
Post new topic   Reply to topic
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
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: 355
Location: New York

PostPosted: Thu Sep 20, 2007 12:34 pm
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
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
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: 1436
Location: Bangalore,India

PostPosted: Thu Sep 20, 2007 12:43 pm
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
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: 1436
Location: Bangalore,India

PostPosted: Thu Sep 20, 2007 12:57 pm
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: 355
Location: New York

PostPosted: Thu Sep 20, 2007 12:57 pm
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: 1436
Location: Bangalore,India

PostPosted: Thu Sep 20, 2007 1:02 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Thu Sep 20, 2007 1:07 pm
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: 1436
Location: Bangalore,India

PostPosted: Thu Sep 20, 2007 1:15 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Thu Sep 20, 2007 1:19 pm
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

Superior Member


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

PostPosted: Thu Sep 20, 2007 1:25 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Thu Sep 20, 2007 1:43 pm
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
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
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
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
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: 1436
Location: Bangalore,India

PostPosted: Thu Sep 20, 2007 2:53 pm
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
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
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Thu Sep 20, 2007 4:05 pm
Reply with quote

Quote:
I cannot do it using a JCL(though i know it can be done) as my requirements does not allows me to do so.


If it is not "homework" You should explain to Your manager/coordinator/...
that for simple tasks it much more productive and safe to use standard utilities
rather than write a program (which has to be documented, mantained, and so on)

regards

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

New User


Joined: 29 Jul 2007
Posts: 8
Location: noida

PostPosted: Thu Sep 20, 2007 4:11 pm
Reply with quote

if appropriate, you can sort the file and get the count .
Back to top
View user's profile Send private message
murmohk1

Senior Member


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

PostPosted: Thu Sep 20, 2007 4:14 pm
Reply with quote

Rich,

Quote:
you can sort the file

I hope you are suggesting to use SORT utility and not really sorting the file.
Back to top
View user's profile Send private message
richa gupta

New User


Joined: 29 Jul 2007
Posts: 8
Location: noida

PostPosted: Thu Sep 20, 2007 4:42 pm
Reply with quote

Yes Murali,

I was referring to SORT utility. SORT=COPY, will give the exact number of records sorted in the spool.
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 -> CA Products

 


Similar Topics
Topic Forum Replies
No new posts Unable to interpret a hex value to De... COBOL Programming 7
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts how to eliminate null indicator value... DB2 7
No new posts To Omit records based n SORT condition DFSORT/ICETOOL 6
No new posts Format Binary file to EBCDIC JCL & VSAM 4
Search our Forums:

Back to Top