Mainframe Utility: STAMP

Return to Mainframe Utilities Page

Module


ISREDIT MACRO (OPT1 OPT2 OPT3 OPT4 OPT5 OPT6 OPT7 OPT8 OPT9 OPT10)
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
IF &OPT1 = HELP THEN GOTO HELPSEC
/**********************************************************************
/* EDIT MACRO : STAMP                                                 *
/* AUTHOR : DAVE LEIGH                                                *
/* FUNCTION : MARK LINES WITH A "DATE", "TIME" OR "DATE/TIME" STAMP   *
/**********************************************************************

/**********************************************************************
/* PARSE THE INPUT OF THE USER AND SET THE "STAMP TYPE"               *
/**********************************************************************
ISREDIT (LN,CL) = CURSOR
IF &STR(&OPT1) = DATE OR +
   &STR(&OPT1) = TIME OR +
   &STR(&OPT1) = DATETIME OR +
   &STR(&OPT1) = TIMEDATE THEN +
    DO
        SET STAMPTYPE = &STR(&OPT1)
        SET OPTIONS = &STR(&OPT2 &OPT3 &OPT4 &OPT5 &OPT6 +
                           &OPT7 &OPT8 &OPT9 &OPT10)
    END
ELSE  +
    DO
        SET STAMPTYPE = DATETIME                /* DEFAULT STAMP TYPE */
        SET OPTIONS = &STR(&OPT1 &OPT2 &OPT3 &OPT4 &OPT5 &OPT6 +
                           &OPT7 &OPT8 &OPT9 &OPT10)
    END

/**********************************************************************
/* MAKE THE USER PLACE THE CURSOR, OR SPECIFY THE CRITERIA.           *
/**********************************************************************
IF &CL = 0 AND &STR(&OPTIONS) =      THEN +
    DO
        SET ZEDLMSG = &STR(CURSOR MUST BE ON A DATA LINE OR +
                           "LINE QUALIFICATION CRITERIA" MUST +
                           BE SPECIFIED)
        ISPEXEC SETMSG MSG(UTLZ001W)
        EXIT CODE(8)
    END

/**********************************************************************
/* SET UP THE EDIT PICTURE STRING.                                    *
/**********************************************************************
SELECT(&STAMPTYPE)
    WHEN (DATE) DO
        SET EQUALS = &STR(========)
        SET STAMP = &STR(&SYSSDATE)
    END
    WHEN (TIME) DO
        SET EQUALS = &STR(========)
        SET STAMP = &STR(&SYSTIME)
    END
    WHEN (DATETIME) DO
        SET EQUALS = &STR(================)
        SET STAMP = &STR(&SYSSDATE&SYSTIME)
    END
    WHEN (TIMEDATE) DO
        SET EQUALS = &STR(================)
        SET STAMP = &STR(&SYSTIME&SYSSDATE)
    END
END

IF &STR(&OPTIONS) =     THEN SET OPTIONS = &STR(&CL .ZCSR .ZCSR)

/**********************************************************************
/* ACTUALLY MAKE THE CHANGE                                           *
/**********************************************************************
SET CHANGECC = 0
ISREDIT CHANGE P'&STR(&EQUALS)' '&STR(&STAMP)' &STR(&OPTIONS)
SET CHANGECC = &LASTCC
IF &CHANGECC > 0 THEN +
    DO
        SET ZEDLMSG = &STR(THE "STAMPING" PROCESS ENDED IN ERROR WITH +
                           A RETURN CODE OF "&CHANGECC".  CHECK FOR +
                           BAD LINE QUALIFICATION CRITERIA.)
        ISPEXEC SETMSG MSG(UTLZ001W)
    END

/**********************************************************************
/* RETURN THE USER TO WHERE THEY WERE                                 *
/**********************************************************************
ISREDIT CURSOR = &LN &CL
EXIT CODE(&CHANGECC)

HELPSEC: +
ISPEXEC SELECT PGM(ISPTUTOR) PARM(HELPSHEL)
SET ZEDLMSG = &STR(*** HELP DISPLAYED FOR STAMP UTILITY +
                   *** NO PROCESSING PERFORMED ***)
ISPEXEC SETMSG MSG(UTLZ000)
EXIT
            


Documentation


 The STAMP edit macro provides the user with a way to easily place a DATE/TIME,
 TIME/DATE, DATE, or TIME stamp on one, some, or all the lines in a file in what
 ever column the user chooses.

 By default, STAMP will place a DATE/TIME stamp in the format of
 YY/MM/DDHH:MM:SS where ever the user's cursor is when STAMP is invoked.  By
 using special keyword parameters and standard edit command parameters, you can
 change the type of stamp and process multiple lines at a time.

 The special keywords indicate the type of stamp you would like.  They are as
 follows:

 TIME - HH:MM:SS
 DATE - YY/MM/DD
 TIMEDATE - HH:MM:SSYY/MM/DD
 DATETIME - YY/MM/DDHH:MM:SS (this is the default)

 You may specify the column number where you want to begin the stamp text
 string, and/or the excluded status of the lines you want to process, and/or a
 label range of the lines you want to process.  For instance, if hou wanted to
 place a "TIMEDATE" stamp on all the lines beginning in column 30 which did not
 contain the string "XYZ" from where you are in the file to the end of it, you
 could type the following on the command line:

 COMMAND ===> x all 'xyz';stamp timedate 30 nx .zcsr .zlast
            


Leave a Reply

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