Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us