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

Is there any syntax in COBOL to find the record count of a P


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
i_mishra

New User


Joined: 25 Aug 2006
Posts: 1

PostPosted: Fri Aug 25, 2006 11:15 am
Reply with quote

Is there any syntax in COBOL to find the record count of a PS file without reading it?
Back to top
View user's profile Send private message
shreevamsi

Active User


Joined: 23 Feb 2006
Posts: 305
Location: Hyderabad,India

PostPosted: Fri Aug 25, 2006 12:18 pm
Reply with quote

hi,

There is no way to read the record count in cobol unless you go thru the entire file.

But there should be a way to calculate the number of records in the file by its size divided by the record lenght.
Guys any idea??

~Vamsi
Back to top
View user's profile Send private message
annujp

New User


Joined: 31 Aug 2005
Posts: 39
Location: St Paul,MN

PostPosted: Fri Aug 25, 2006 12:37 pm
Reply with quote

The number of records of a file in DASD is calculated by the following formula
(no: of tracks * 56664)/LRECL of the file = number of records.
No: of tracks allocated to the file can be found out by giving an S next to the dataset in the selection panel
56664 is the number of bytes in a Track
LRECL is the record length of the file.

If the file is in TAPE, then
number of records = (block size * block count)/LRECL
This is an approximate number because the last block mite not be full.

Hope this is helpful... icon_wink.gif
Back to top
View user's profile Send private message
kondakonda

New User


Joined: 20 Mar 2006
Posts: 34

PostPosted: Fri Aug 25, 2006 2:40 pm
Reply with quote

This formula will give only how many records the ps file can accomodate, not the actual number of records in the file.

The number of records of a file in DASD is calculated by the following formula
(no: of tracks * 56664)/LRECL of the file = number of records.
Back to top
View user's profile Send private message
pretty
Currently Banned

New User


Joined: 13 Mar 2006
Posts: 6

PostPosted: Fri Aug 25, 2006 3:15 pm
Reply with quote

can anyone send me quick reply i am waiting for your reply

yours
siva
Back to top
View user's profile Send private message
annujp

New User


Joined: 31 Aug 2005
Posts: 39
Location: St Paul,MN

PostPosted: Fri Aug 25, 2006 5:05 pm
Reply with quote

Another method is to write a sort and sort the file by one of the fields in the file. The number of records input and output from the sort step will be mentioned in the sort message.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts To get the count of rows for every 1 ... DB2 3
Search our Forums:

Back to Top