Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Validity Checking Program on STRSEU command (Not Working )

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Validity Checking Program on STRSEU command (Not Working )

    I hope this is the correct place to post this:
    I found this "Prevent accidental changes to production source code" article at http://search400.techtarget.com/tip/...on-source-code
    and tried it out. In my Debug testing everything works and the parameter does change to 5 (browse) but the member always comes up in Edit mode. We are at V7r1.
    Any suggestions as to what I am missing or why it does not work? (this is the code from the article, mine is modified to recognize our production source Library and File naming convention)
    CHGCMD CMD(STRSEU) VLDCKR(MYLIB/STRSEU)

    STRSEU Command CL Source
    PGM PARM(&P20 &P10 &P8 &P6 &P50)
    DCL VAR(&P20) TYPE(*CHAR) LEN(20)
    DCL VAR(&P10) TYPE(*CHAR) LEN(10)
    DCL VAR(&P8) TYPE(*CHAR) LEN(08)
    DCL VAR(&P6) TYPE(*CHAR) LEN(06)
    DCL VAR(&P50) TYPE(*CHAR) LEN(50)
    DCL VAR(&LIB) TYPE(*CHAR) LEN(10)
    DCL VAR(&FILE) TYPE(*CHAR) LEN(10)
    MONMSG MSGID(CPF0000)

    CHGVAR VAR(&FILE) VALUE(%SST(&P20 1 10))
    CHGVAR VAR(&LIB) VALUE(%SST(&P20 11 10))

    /* IF USER REQUESTED BY LIBL, DETERMINE WHERE SOURCE FILE RESIDES */
    IF COND(&LIB *EQ ' ' *OR &LIB *EQ + '*LIBL ') THEN(RTVOBJD OBJ(&FILE) + OBJTYPE(*FILE) RTNLIB(&LIB))

    /* INTERCEPT PARM AND CHANGE IT TO BROWSE ONLY IF NOT PRINTING */
    IF COND(%SST(&LIB 5 3) *EQ 'PRD' *AND &P6 *NE + '6') THEN(CHGVAR VAR(&P6) VALUE('5 '))

    ENDPGM

    (if someone will share how to post code properly I will do so in the future. thanks)
    Last edited by DavidLerman; 04-26-2015, 10:37 AM. Reason: Fixed code formatting.

  • #2
    I used a TAATOOL utility to retrieve the STRSEU command source and noticed that the parameter lengths are not the same as in the article.
    Can you tell I cut/pasted from an 80-byte screen? lol

    PARM KWD(SRCFILE) TYPE(QUAL1) DFT(*PRV)
    CHOICE('*PRV') PROMPT(EDX0002)
    PARM KWD(SRCMBR) TYPE(*NAME) LEN(10) DFT
    X'40')) EXPR(*YES) CHOICE('Name')
    PARM KWD(TYPE) TYPE(*SNAME) LEN(10) DFT(
    (BASP BASP) (BND BND) (C C) (CBL
    .
    .
    .
    PARM KWD(OPTION) TYPE(*CHAR) LEN(1) RST
    SPCVAL((*BLANK X'40')) EXPR(*YES
    PROMPT(EDX0007)
    PARM KWD(TEXT) TYPE(*CHAR) LEN(50) DFT(
    EXPR(*YES) CHOICE('Character val

    Note: QUAL1 is the standard 20 characters used for File/Library:

    QUAL1: QUAL TYPE(*NAME) LEN(10) MIN(1) EXPR(*YES)
    QUAL TYPE(*NAME) LEN(10) DFT(*LIBL) SPCVAL

    I changed it to match the parameters...like this:

    PGM PARM(&QUAL1 &SRCMBR &TYPE &OPTION &TEXT)

    DCL VAR(&QUAL1) TYPE(*CHAR) LEN(20)
    DCL VAR(&SRCMBR) TYPE(*CHAR) LEN(10)
    DCL VAR(&TYPE) TYPE(*CHAR) LEN(10)
    DCL VAR(&OPTION) TYPE(*CHAR) LEN(01)
    DCL VAR(&TEXT) TYPE(*CHAR) LEN(50)

    Regardless, I couldn't make it work as a validity checker. We are running V6R1.

    I'll try to look at this again when I get some more free time...
    Last edited by Terry Winchester; 04-29-2015, 12:52 PM. Reason: forgot descriptive line...

    Comment


    • #3
      David,

      Apparently, we should have looked at the manuals first ;-) Here is the excerpt for CHGCMD for V7R1 at this link:



      "The Change Command (CHGCMD) command does not change the parameter descriptions or validity checking information in the command definition object."

      And under RESTRICTIONS is this little gem:
      "The CHGCMD command should not be used to change the command processing program (PGM parameter), the validity checking program (VLDCKR parameter), or the prompt override program (PMTOVRPGM parameter) of an IBM-supplied command."

      Comment


      • #4
        Thank you Terry, RTFM strikes again!!!

        Comment

        Working...
        X