Mainframe Utility: SETPFK

Return to Mainframe Utilities Page

Module


/******************************************************************/
/* 'SETPFK' CLIST       SET A SPECIFIED PF KEY STRING             */
/* AUTHOR : DAVID MONTGOMERY DATE : 12-21-89                      */
/******************************************************************/
PROC 1 PFKEY TO()
/*** CHECK THE DEBUG SWITCH ***/
ISPEXEC VGET DBGSWTCH PROFILE
IF &DBGSWTCH = ON THEN +
    CONTROL MSG LIST CONLIST SYMLIST NOFLUSH NOPROMPT ASIS END(ENDO)
ELSE +
    CONTROL NOMSG NOLIST NOFLUSH NOPROMPT ASIS END(ENDO)
  SET XPF = &STR(@@@)
  SET PERIODS  = &STR(..)
  ISPEXEC VGET ZDEL PROFILE
  IF &PFKEY = &STR(HELP) OR &PFKEY = &STR(?) THEN GOTO HELP
  SET PN  =
  SET COMMAND = &STR(&TO)
  SET L   = &LENGTH(&STR(&PFKEY))
  IF &SYSINDEX(PF,&STR(&PFKEY)) = 1 THEN -
     DO
       IF &L > 2 AND &L <= 4 THEN -
          SET PN = &SUBSTR(3:&L,&STR(&PFKEY))
     ENDO
  ELSE -
     IF &L = 1 OR &L = 2 THEN -
        SET PN = &STR(&PFKEY)

  IF &DATATYPE(&PN) = NUM THEN -
     IF &PN < 25 THEN -
        DO
          SET P = &SYSINDEX(&STR(&PERIODS),&STR(&COMMAND))
          DO WHILE &P > 0
             SET LC = &LENGTH(&STR(&COMMAND))
             IF &P > 1 THEN -
                DO
                  SET B = &P - 1
                  SET E = &P + 2
                ENDO
             ELSE -
                DO
                  SET B = &P
                  SET E = &P + 1
                ENDO
             SET PART1  = &SUBSTR(1:&B,&STR(&COMMAND))
             IF &E < &LC THEN -
                DO
                  SET PART2 = &SUBSTR(&E:&LC,&STR(&COMMAND))
                  SET COMMAND = &STR(&PART1&ZDEL&PART2)
                ENDO
             ELSE -
                SET COMMAND = &STR(&PART1)
             SET P  = &SYSINDEX(&STR(&PERIODS),&STR(&COMMAND))
          ENDO
          IF &PN < 10 THEN SET PN = &STR(0)&PN
          ISPEXEC VGET (ZPF&PN ZDEL) PROFILE
          SET OLDCMND = &&ZPF&PN
          SET OPF&PN  = &STR(&OLDCMND)
          ISPEXEC VPUT (OPF&PN) PROFILE
          SET ZPF&PN = &STR(&COMMAND)
          SET XPF = PF&PN
          ISPEXEC VPUT (ZPF&PN) PROFILE
        ENDO
     ELSE -
        SET PN =
  ELSE -
     SET PN =

  IF &PN =   THEN -
     SET ERRMSG = &STR(SETPFK : INVALID PF KEY SPECIFICATION -> &PFKEY)
  GOTO EXIT
/*
HELP: -
  CLEAR
  WRITE *** HELP FOR CLIST SETPFK ***
  WRITE
  WRITE THE "SETPFK" CLIST ALLOWS THE SE TO CHANGE THE DEFINITION OF A
  WRITE PROGRAM FUNCTION KEY VIA THIS ONE LINE COMMAND AS OPPOSED TO
  WRITE ENTERING THE "KEYS" COMMAND AND GOING TO THE IBM SUPPLIED SCREEN
  WRITE FOR CHANGING PF KEY DEFINITIONS.  IN ADDITION, THE OLD PF KEY
  WRITE DEFINITION IS SAVED IN THE SE'S PROFILE, SO THAT IT CAN BE
  WRITE RESTORED BY USE OF THE "RESETPFK" CLIST.
  WRITE
  WRITE COMMAND FORMAT:  SETPFK  TO()
  WRITE
  WRITE          - THE NUMERIC VALUE OF THE DESIRED FUNCTION
  WRITE                      KEY TO BE CHANGED (USUALLY 1 - 24)
  WRITE
  WRITE           - THE NEW COMMAND TO BE ASSIGNED TO THE
  WRITE                      PF KEY.
  WRITE
  WRITE                      IMPORTANT NOTE #1: IF THE COMMAND CONTAINS
  WRITE                      EMBEDDED BLANKS OR SPECIAL CHARACTERS, IT
  WRITE                      MUST BE ENCLOSED IN SINGLE QUOTES.
  WRITE
  WRITE                      IMPORTANT NOTE #2: IF THE COMMAND CONTAINS
  WRITE                      THE TSO COMMAND DELIMITER (USUALLY ";") IT
  WRITE                      MUST BE REPLACED BY DOUBLE PERIODS ("..")
  WRITE                      IN ORDER TO BE PROCESSED PROPERLY.
  WRITE
  SET &ERRMSG = &STR(NO SETPFK PROCESSING PERFORMED)
/*
EXIT: -
  IF &XPF = &STR(@@@) THEN -
      SET ZEDLMSG = &STR(&ERRMSG)
  ELSE -
      SET ZEDLMSG = &STR(SETPFK : &XPF SET TO "&COMMAND")
  ISPEXEC SETMSG MSG(ISRZ000)
/*
EXIT
            


Documentation


 This CLIST allows the user to change a Program Function Key definition via a
 one line command as opposed to using the KEYS command and going to IBM's screen
 utility for PF Key definition.  In addition, the "original" PF key definition
 is saved in the user's Profile, and may be restored using the RESETPFK Clist.
 Important: If the Command string includes a TSO command delimiter (usually ";")
 then that delimiter must be replaced by two periods (..) in the TO(command)
 clause, otherwise TSO will interpret it as the beginning of a new command,
 rather than part of the definition.

 Example: SETPFK 12 TO('F p''='' FIRST..:X9999..FIND ALL')
 redefines PF Key 12 as F p'=' FIRST;:X99999;FIND ALL
            


Leave a Reply

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