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 Records in a file

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
rahul_jot

New User


Joined: 17 Aug 2005
Posts: 22
Location: Pune

PostPosted: Fri Oct 23, 2009 3:49 pm    Post subject: Count Records in a file
Reply with quote

Hi,

I want to count the number of records in a file and write the count into new output file. As per the requirement, I can not use tools like SORT, ICETOOL, FILEAID. I could do it with cobol, but I am looking for more efficient way. Can anyone help?

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

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Oct 23, 2009 4:04 pm    Post subject:
Reply with quote

Well, ICETOOL would be the most efficient way of doing it. What is the restriction on using the most efficient way of doing something ? These stupid requirements/limitations really get my goat icon_evil.gif

And another question is why do you need to have to count records, surely the creating program should be able to tell you this information rfather than wasting resource by reading a file just to count the number of records.

I guess it looks as though you are stuck with wasting time writing a program to do less efficiently than an already existing product.

Must be a really innovative place to work where you are icon_rolleyes.gif

But just in case you can wing it - maybe show the boss just how simple it really could be, here's the ICETOOL code.
Code:

//ICETOOL  EXEC PGM=ICETOOL                               
//TOOLMSG  DD SYSOUT=*                                     
//DFSMSG   DD SYSOUT=*                                     
//IN1      DD DSN=Input Data Set,DISP=SHR               
//OUT      DD DSN=&&TEMP01,DISP=(,PASS),                   
//            SPACE=(TRK,(15,15),RLSE),RECFM=FB,LRECL=80   
//OUFILE   DD SYSOUT=*                                     
//TOOLIN   DD *                                           
  COPY FROM(IN1) TO(OUT) USING(CTL1)                       
//CTL1CNTL   DD *                                         
  OPTION COPY                                             
  OUTFIL FNAMES=OUFILE,REMOVECC,NODETAIL,TRAILER1=(COUNT) 
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Fri Oct 23, 2009 4:19 pm    Post subject:
Reply with quote

Hi,

or even simpler
Code:
//STEP001  EXEC PGM=ICETOOL                         
//TOOLMSG  DD SYSOUT=*                             
//DFSMSG   DD SYSOUT=*                             
//IN       DD DSN=input-file                       
//CT       DD SYSOUT=*                             
//TOOLIN   DD *                                     
COUNT FROM(IN) WRITE(CT)                           
/*                                                 


Gerry
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Oct 23, 2009 4:45 pm    Post subject:
Reply with quote

doesn't idcams have a count function?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Oct 23, 2009 4:59 pm    Post subject:
Reply with quote

It does, but that is used to limit the number of records processed.

I suppose you could REPRO out the file and parse the output to get a count that way, but not as efficient as sort.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Oct 23, 2009 5:50 pm    Post subject:
Reply with quote

Expat,

I agree, Sort is probably the best solution.

But the TP/OP environment seems so backwards,
I was proposing an alternate (acceptable) solution.

But again, it seems that an important point is being missed:

WTF are they counting records anyway?
Back to top
View user's profile Send private message
Steve Davies

New User


Joined: 15 Oct 2009
Posts: 32
Location: UK

PostPosted: Fri Oct 23, 2009 7:56 pm    Post subject:
Reply with quote

For what it's worth - we use ICETOOL (in the way Gerry has posted). We have a product which is distributed on mainframe and UNIX platforms. To ensure a release is behaving as expected on both platforms we validate many things, and one of those things is the number of records in the output files. If the record counts match on both platforms then that's one box ticked. So to achieve this we use ICETOOL on the mainframe to count the records in files. That's why we do it.
Back to top
View user's profile Send private message
rahul_jot

New User


Joined: 17 Aug 2005
Posts: 22
Location: Pune

PostPosted: Sat Oct 24, 2009 10:01 am    Post subject: Reply to: Count Records in a file
Reply with quote

I appreciate all help from each one of you. I usually prefer SORT/ICETOOL over cobol to do the tasks. But as per the requirement I received, I can't use it. I don't know why the requirement is so. Anyway I will again try to go back and have the requirement changed to use ICETOOL.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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