View previous topic :: View next topic
|
Author |
Message |
rahul_jot
New User
Joined: 17 Aug 2005 Posts: 22 Location: Pune
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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
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
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 |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
doesn't idcams have a count function? |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Steve Davies
New User
Joined: 15 Oct 2009 Posts: 32 Location: UK
|
|
|
|
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 |
|
|
rahul_jot
New User
Joined: 17 Aug 2005 Posts: 22 Location: Pune
|
|
|
|
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 |
|
|
|