Prevent accidental changes to production source code

Tim Granatir, Search400 expert

Tim Granatir

Even with source/object management systems in place, it's still possible for someone with sufficient authority to alter a production source file member while using the STRSEU command.

It's too easy for managers or senior programmers who are looking at or researching production code to accidentally alter or delete lines of source or mistakenly start modifying a production source instead of a development version of source. You can track those kinds of mistakes through security auditing, journaling, etc., but it's better to prevent those simple errors rather than fixing them.

One way to help limit this exposure is thru the use of a validity checker program on the STRSEU command. Validity checker programs can be used on any AS/400 command, and these programs receive the command parameters before the actual execution of a command. That gives you an additional level of control (such as logging or altering the command parameters) for any AS/400 command, even if the user is QSECOFR. This example program intercepts the parms entered by the user on the STRSEU command and then changes the user's request to be browse-only if he isn't requesting to print the source member. It uses part of the library name to determine when to limit the editing of source members, but how you choose to determine what needs to be limited depends on your individual circumstances.

This method isn't foolproof, but it does offer a reasonable way to limit accidental changes in your production source code. If you need to alter a production source member with this method in place, you can still do it but you have to be much more intentional about it. If you do an option 25 (find string) on WRKMBRPDM and specify 2 for editing, that method apparently calls an API directly rather than using the STRSEU command so the validity checker program does not come into play. Because a validity checker program does alter an IBM-supplied command, you will have to reapply the validity checker program to the STRSEU command after every new release.

To add the validity checker program to the STRSEU command type the following:

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         COND(&LIB *EQ '          ' *OR &LIB *EQ +       
                          '*LIBL     ') THEN(RTVOBJD OBJ(&FILE) +       
                          OBJTYPE(*FILE) RTNLIB(&LIB))                  
               IF         COND(%SST(&LIB 5 3) *EQ 'PRD' *AND &P6 *NE +
                          '6') THEN(CHGVAR VAR(&P6) VALUE('5     ')) 

About the author: Tim is vice president of Technical Services at Interlink Technologies in Maumee, Ohio, where he serves as chief architect for their warehouse management system. He has worked in the banking, insurance, healthcare and distribution industries in various positions, including programmer/analyst, systems analyst and DP manager. Tim has worked on IBM midrange platforms since 1983.


There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.