Mainframe Utility: KEYCOUNT

Return to Mainframe Utilities Page

Module


ISREDIT MACRO (COL1,COL2,BATCH)
ISPEXEC CONTROL ERRORS RETURN
/**** SET MESSAGE DISPLAY ON/OFF BASED ON THE DEBUG SWITCH ***/
ISPEXEC VGET (DBGSWTCH) PROFILE
IF &DBGSWTCH = &STR(ON) THEN CONTROL MSG LIST CONLIST SYMLIST NOFLUSH
ELSE CONTROL NOMSG NOLIST NOFLUSH NOPROMPT
/******************************************************************/
/* 'KEYCOUNT' EDIT MACRO. CALL THE COUNTKEY CLIST TO COUNT UNIQUE */
/* KEY VALUES WITHIN THE FILE.                                    */
/* AUTHOR : DAVID LEIGH    DATE : 6-1-89                          */
/******************************************************************/

IF &COL1 = &STR(HELP) THEN GOTO HELPSEC

SET MBR =
ISREDIT (MBR) = MEMBER
ISREDIT (DSN) = DATASET
IF &LENGTH(&STR(&MBR)) > 0 THEN SET DSN = &STR(&DSN.(&MBR))
SET ZEDSMSG = &STR(PROBLEM WITH DATASET)
SET ZEDLMSG = &STR(&DSN PROBLEM : &SYSDSN('&DSN'))
IF &SYSDSN('&DSN') = OK OR +
   &STR(&SWITCH) = ON THEN +
    DO
        SET INVOKE = KEYCOUNT
        ISPEXEC VPUT (INVOKE) SHARED
        IF &COL1 >    AND &COL2 >     THEN +
            ISPEXEC SELECT CMD(%COUNTKEY DSN(&DSN) +
                               COL1(&COL1) COL2(&COL2) &BATCH)
        IF &COL1 >    AND &COL2 =     THEN +
            ISPEXEC SELECT CMD(%COUNTKEY DSN(&DSN) COL1(&COL1) &BATCH)
        IF &COL1 =    AND &COL2 =     THEN +
            ISPEXEC SELECT CMD(%COUNTKEY DSN(&DSN) &BATCH)
    END

EXIT

HELPSEC: +
CLEAR
WRITE *** HELP FOR EDIT MACRO 'KEYCOUNT' ***
WRITE
WRITE THE KEYCOUNT EDIT MACRO ALLOWS THE USER TO SEARCH THROUGH
WRITE SPECIFIED COLUMNS WITHIN THE DATASET BEING EDITED AND COUNT
WRITE THE NUMBER OF OCCURANCES OF EACH UNIQUE STRING FOUND WITHIN THE
WRITE SPECIFIED COLUMNS.  THE RESULTS ARE PLACED IN A FILE AND THE USER
WRITE IS THEN TAKEN INTO THAT FILE.
WRITE
WRITE BASIC SYNTAX :
WRITE
WRITE COMMAND ===> KEYCOUNT
WRITE
WRITE THIS EXAMPLE WILL TAKE YOU INTO AN ISPF PANEL WHERE YOU MAY ENTER
WRITE TWO COLUMN NUMBERS AND CHANGE OR LEAVE THE DEFAULT VALUES FOR THE
WRITE OUTPUT DATASET AND HOW OR IF YOU WANT TO AUTOMATICALLY VIEW THE
WRITE OUTPUT FROM THE UTILITY.  YOU MAY ALSO SPECIFY THE COLUMNS WHEN
WRITE CALLING THE UTILITY.  THIS WOULD BE DONE AS FOLLOWS:
WRITE
WRITE COMMAND ===> KEYCOUNT COL1(1) COL2(2)
WRITE
WRITE THIS EXAMPLE WILL INVOKE THE UTILITY WITHOUT THE ISPF PANEL.  IN
WRITE THIS MODE, YOU WILL HAVE NO CHOICE AS TO THE OUTPUT VIEWING MODE,
WRITE OR THE OUTPUT DATASET.
WRITE
WRITE IF A DATASET CONTAINED THE FOLLOWING AND YOU INVOKED KEYCOUNT :
WRITE
WRITE EDIT ---- XXXXX.XXX.XXXXXX(XXXXXX) - 01.01 ------- COLUMNS 001 015
WRITE COMMAND ===> KEYCOUNT 1 5                         SCROLL ===> CSR
WRITE =COLS> ----+----1----+
WRITE 000001 A9999BBBC888
WRITE 000002 A9999BBBC888
WRITE 000003 A9999BCBC888
WRITE 000004 A9999BDBC888
WRITE 000005 B9999BEBC888
WRITE 000006 B9999BFBC888
WRITE 000007 B9999BBBC888
WRITE 000008 B9999BABC888
WRITE 000009 C9999BSBC888
WRITE 000010 D9999BEBC888
WRITE 000011 D9999BSBC888
WRITE 000012 E9999BBBC888
WRITE
WRITE THIS IS WHAT YOU WOULD GET :
WRITE
WRITE EDIT ---- &SYSUID.TEMP.COUNTKEY.OUTPUT - 01.01 --- COLUMNS 001 072
WRITE COMMAND ===>                                      SCROLL ===> CSR
WRITE 000001 KEY VALUE           NUMBER OF OCCURANCES
WRITE 000002 ---------           --------------------
WRITE 000003 A9999               0000000000000004
WRITE 000004 B9999               0000000000000004
WRITE 000005 C9999               0000000000000001
WRITE 000006 D9999               0000000000000002
WRITE 000007 E9999               0000000000000001
WRITE 000008 ----------------------------------------
WRITE 000009 TOTAL               0000000000000011
WRITE
WRITE FOR HELP WITH THE PANEL, EXECUTE KEYCOUNT IN SUCH A WAY AS TO
WRITE ACCESS THE ISPF PANEL AND THEN TYPE "HELP" IN THE COMMAND
WRITE LINE.
WRITE
WRITE YOU MAY ALSO EXECUTE THIS FUNCTION AS A CLIST NAMED "COUNTKEY".
WRITE "TSO COUNTKEY HELP" ON ANY COMMAND LINE FOR HELP IN HOW TO USE IT.
WRITE
WRITE *** END OF HELP *** NO PROCESSING PERFORMED ***
EXIT
            


Documentation


 This utility allows you to count the occurances of each unique string within
 two column boundries in a file that you are editing.  To do so, you type
 "keycount c1 c2" where "c1" = the beginning column of the "key", and "c2" is
 the ending column of the "key".  This information is passed to the COUNTKEY
 utility along with the dataset name.  The results are passed back to you by
 taking you into an edit of a dataset where the report of the results has been
 stored.
            


Leave a Reply

Your email address will not be published. Required fields are marked *