Script User Profile Changes

I need to change the session limits option on a large number of user profiles (370+ users). Is there a way to script this so that I can put the user profiles that I want changed into a file or something and then reference that in the CHGUSRPRF command?

I would really rather not do that many manual user profile changes...

I appreciate any help!
LVL 1
Matthew RoessnerSenior Systems ProgrammerAsked:
Who is Participating?
 
_b_hConnect With a Mentor Commented:

Create a list of all users on the system in file USERS in library MYLIB using:
DSPUSRPRF USRPRF(*ALL) OUTPUT(*OUTFILE) OUTFILE(MYLIB/USERS)

Edit this list using SQL or DFU so that it contains only the ones that you want.

Create CL program using the following source:
PGM                                                        
DCLF MYLIB/USERS                                              
NEXTUSER:                                                  
             RCVF                                          
             MONMSG (CPF0864) EXEC(DO) /* END OF FILE */  
                GOTO ENDOFFILE                            
                ENDDO                                      
             CHGUSRPRF &UPUPRF LMTDEVSSN(*YES)            
             GOTO NEXTUSER                                
ENDOFFILE:                                                
             ENDPGM                                      

Rather than edit the list, you might be able to come up with logic that identifies those 370 users. For example, if they are in group EASTERN and don't start with the letter "Q":

PGM                                                        
DCLF MYLIB/USERS                                              
NEXTUSER:                                                  
             RCVF                                          
             MONMSG (CPF0864) EXEC(DO) /* END OF FILE */  
                GOTO ENDOFFILE                            
                ENDDO
             IF (&UPGRPF *EQ 'EASTERN   ' +            
            *AND %SST(&UPUPRF 1 1) *NE 'Q') THEN(DO)  
                CHGUSRPRF &UPUPRF LMTDEVSSN(*YES)      
                ENDDO                                  
             GOTO NEXTUSER                                
ENDOFFILE:                                                
             ENDPGM                                        

Consider replacing CHGUSRPRF with SNDPGMMSG &UPPRF for testing purposes.

To get a list of fields in the file, use Display File Field Description:
DSPFFD FILE(MYLIB/USERS)

Hope this helps! Post back any questions.
Barry
0
 
Matthew RoessnerSenior Systems ProgrammerAuthor Commented:
Thanks Barry. That is exactly what I was looking for!
0
 
_b_hCommented:
You're welcome.
Thanks for the grade and the points!
Post back if you need any help tweaking the script.
Barry
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.