View previous topic :: View next topic
Author
Message
socker_dad Active User Joined: 05 Dec 2006Posts: 177 Location: Seattle, WA
I have a very large file with the record type in column 89 length of 2. There are 65 different record types on this file. I want a count of each type:
Record Type 00 = 2 records
Record Type 01 = 175415 records
and so forth. I can count one type at a time using this JCL:
Code:
//DD01 DD DISP=OLD,DSN=MVD.MV603.DLAUDIT.NEW694
//DD01O DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSLIST DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//SYSIN DD *
$$DD01 COPY IF=(89,EQ,C' '),OUT=0
However, I don't want to run this job 65 times. Or 65 iterations within the same job.
There is not a field I can use with the ACCUM function.
Any suggestions?
Back to top
Robert Sample Global Moderator Joined: 06 Jun 2008Posts: 8696 Location: Dubuque, Iowa, USA
If SAS is available, this is a PROC FREQ or PROC TABULATE -- very short bit of code. Pre-selecting File Aid for your tool, however, may make it impossible to generate the results you want without multiple runs against the data.
Back to top
socker_dad Active User Joined: 05 Dec 2006Posts: 177 Location: Seattle, WA
Nope - no SAS available.
Darn it.
Back to top
Robert Sample Global Moderator Joined: 06 Jun 2008Posts: 8696 Location: Dubuque, Iowa, USA
Use COBOL or another language and create a table of record counts. At least you're only making one pass through the file then.
Back to top
socker_dad Active User Joined: 05 Dec 2006Posts: 177 Location: Seattle, WA
OK. Easytrieve Plus it is.......
Back to top
Terry Heinze JCL Moderator Joined: 14 Jul 2008Posts: 1249 Location: Richfield, MN, USA
I believe this can be easily done with either of the major sort products. Maybe you post this in that forum?
Back to top
gcicchet Senior Member Joined: 28 Jul 2006Posts: 1702 Location: Australia
Hi,
you can try FILEAID like this
Code:
//STEP0001 EXEC PGM=FILEAID
//SYSPRINT DD SYSOUT=*
//DD01 DD DSN=INPUT-FILE
//OUT01 DD DUMMY
//OUT02 DD DUMMY
//OUT03 DD DUMMY
//OUT04 DD DUMMY
//OUT05 DD DUMMY
//OUT06 DD DUMMY
//OUT07 DD DUMMY
//OUT08 DD DUMMY
//OUT09 DD DUMMY
//OUT10 DD DUMMY
//OUT11 DD DUMMY
//OUT12 DD DUMMY
//OUT13 DD DUMMY
//OUT14 DD DUMMY
//OUT15 DD DUMMY
//OUT16 DD DUMMY
//OUT17 DD DUMMY
//OUT18 DD DUMMY
//OUT19 DD DUMMY
//OUT20 DD DUMMY
//OUT21 DD DUMMY
//OUT22 DD DUMMY
//OUT23 DD DUMMY
//OUT24 DD DUMMY
//OUT25 DD DUMMY
//OUT26 DD DUMMY
//OUT27 DD DUMMY
//OUT28 DD DUMMY
//OUT29 DD DUMMY
//OUT30 DD DUMMY
//OUT31 DD DUMMY
//OUT32 DD DUMMY
//OUT33 DD DUMMY
//OUT34 DD DUMMY
//OUT35 DD DUMMY
//OUT36 DD DUMMY
//OUT37 DD DUMMY
//OUT38 DD DUMMY
//OUT39 DD DUMMY
//OUT40 DD DUMMY
//OUT41 DD DUMMY
//OUT42 DD DUMMY
//OUT43 DD DUMMY
//OUT44 DD DUMMY
//OUT45 DD DUMMY
//OUT46 DD DUMMY
//OUT47 DD DUMMY
//OUT48 DD DUMMY
//OUT49 DD DUMMY
//OUT50 DD DUMMY
//OUT51 DD DUMMY
//OUT52 DD DUMMY
//OUT53 DD DUMMY
//OUT54 DD DUMMY
//OUT55 DD DUMMY
//OUT56 DD DUMMY
//OUT57 DD DUMMY
//OUT58 DD DUMMY
//OUT59 DD DUMMY
//OUT60 DD DUMMY
//OUT61 DD DUMMY
//OUT62 DD DUMMY
//OUT63 DD DUMMY
//OUT64 DD DUMMY
//OUT65 DD DUMMY
//SYSIN DD *
*** COPY OCCURRENCES OF
$$DD01 USER OUT=0,MAXOUT=99,
IF=(89,EQ,C'01'),WRITE=OUT01,
IF=(89,EQ,C'02'),WRITE=OUT02,
IF=(89,EQ,C'03'),WRITE=OUT03,
IF=(89,EQ,C'04'),WRITE=OUT04,
IF=(89,EQ,C'05'),WRITE=OUT05,
IF=(89,EQ,C'06'),WRITE=OUT06,
IF=(89,EQ,C'07'),WRITE=OUT07,
IF=(89,EQ,C'08'),WRITE=OUT08,
IF=(89,EQ,C'09'),WRITE=OUT09,
IF=(89,EQ,C'10'),WRITE=OUT10,
IF=(89,EQ,C'11'),WRITE=OUT11,
IF=(89,EQ,C'12'),WRITE=OUT12,
IF=(89,EQ,C'13'),WRITE=OUT13,
IF=(89,EQ,C'14'),WRITE=OUT14,
IF=(89,EQ,C'15'),WRITE=OUT15,
IF=(89,EQ,C'16'),WRITE=OUT16,
IF=(89,EQ,C'17'),WRITE=OUT17,
IF=(89,EQ,C'18'),WRITE=OUT18,
IF=(89,EQ,C'19'),WRITE=OUT19,
IF=(89,EQ,C'20'),WRITE=OUT20,
IF=(89,EQ,C'21'),WRITE=OUT21,
IF=(89,EQ,C'22'),WRITE=OUT22,
IF=(89,EQ,C'23'),WRITE=OUT23,
IF=(89,EQ,C'24'),WRITE=OUT24,
IF=(89,EQ,C'25'),WRITE=OUT25,
IF=(89,EQ,C'26'),WRITE=OUT26,
IF=(89,EQ,C'27'),WRITE=OUT27,
IF=(89,EQ,C'28'),WRITE=OUT28,
IF=(89,EQ,C'29'),WRITE=OUT29,
IF=(89,EQ,C'30'),WRITE=OUT30,
IF=(89,EQ,C'31'),WRITE=OUT31,
IF=(89,EQ,C'32'),WRITE=OUT32,
IF=(89,EQ,C'33'),WRITE=OUT33,
IF=(89,EQ,C'34'),WRITE=OUT34,
IF=(89,EQ,C'35'),WRITE=OUT35,
IF=(89,EQ,C'36'),WRITE=OUT36,
IF=(89,EQ,C'37'),WRITE=OUT37,
IF=(89,EQ,C'38'),WRITE=OUT38,
IF=(89,EQ,C'39'),WRITE=OUT39,
IF=(89,EQ,C'40'),WRITE=OUT40,
IF=(89,EQ,C'41'),WRITE=OUT41,
IF=(89,EQ,C'42'),WRITE=OUT42,
IF=(89,EQ,C'43'),WRITE=OUT43,
IF=(89,EQ,C'44'),WRITE=OUT44,
IF=(89,EQ,C'45'),WRITE=OUT45,
IF=(89,EQ,C'46'),WRITE=OUT46,
IF=(89,EQ,C'47'),WRITE=OUT47,
IF=(89,EQ,C'48'),WRITE=OUT48,
IF=(89,EQ,C'49'),WRITE=OUT49,
IF=(89,EQ,C'50'),WRITE=OUT50,
IF=(89,EQ,C'51'),WRITE=OUT51,
IF=(89,EQ,C'52'),WRITE=OUT52,
IF=(89,EQ,C'53'),WRITE=OUT53,
IF=(89,EQ,C'54'),WRITE=OUT54,
IF=(89,EQ,C'55'),WRITE=OUT55,
IF=(89,EQ,C'56'),WRITE=OUT56,
IF=(89,EQ,C'57'),WRITE=OUT57,
IF=(89,EQ,C'58'),WRITE=OUT58,
IF=(89,EQ,C'59'),WRITE=OUT59,
IF=(89,EQ,C'60'),WRITE=OUT60,
IF=(89,EQ,C'61'),WRITE=OUT61,
IF=(89,EQ,C'62'),WRITE=OUT62,
IF=(89,EQ,C'63'),WRITE=OUT63,
IF=(89,EQ,C'64'),WRITE=OUT64,
IF=(89,EQ,C'65'),WRITE=OUT65
//*
//**********************************************************************
If you have DFSORT/ICETOOL you can use the following
Code:
//STATS EXEC PGM=ICETOOL
//IN1 DD DSN=INPUT-FILE
//LISTING DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TOOLIN DD *
OCCUR FROM(IN1) LIST(LISTING) -
DATE(DMY.) TITLE('STATS PAGE') PAGE -
HEADER('RECORD TYPE') ON(89,2,CH) -
HEADER('OCCURRENCES ') ON(VALCNT)
/*
Gerry
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Or you can use this as well.
Code:
//STEP01 EXEC PGM=SORT
//SORTIN DD DSN=INPUT-FILE
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,NODETAIL,SECTIONS=(89,2,
TRAILER3=(C'Record Type ',89,2,COUNT,C' records'))
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
socker_dad,
The above sort assumes the input file to be sorted on "Record type". If it is not, you should replace
as
Code:
SORT FIELDS=(89,2,CH,A)
Back to top
socker_dad Active User Joined: 05 Dec 2006Posts: 177 Location: Seattle, WA
Thanks everyone! My favourite was arcvns' Sort solution. Very fast, very accurate.
Back to top
Please enable JavaScript!