[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference iosg::all-in-1_v30

Title:*OLD* ALL-IN-1 (tm) Support Conference
Notice:Closed - See Note 4331.l to move to IOSG::ALL-IN-1
Moderator:IOSG::PYE
Created:Thu Jan 30 1992
Last Modified:Tue Jan 23 1996
Last Successful Update:Fri Jun 06 1997
Number of topics:4343
Total number of notes:18308

259.0. "Looping through Profil in script" by MISFIT::KINNEYD (Aruba Bound Soon!!) Tue Mar 17 1992 13:37

    I have the following script to update a field in the profil. It gets
    the user names from a file that is maintained by the system manager of
    valid user and profile names.
    
    get oa$dcl = "$open/read nickfil general$info:roc_users.lis"
    get oa$dcl = 'read nickfil nickrec'
    .label writerec
    get oa$dcl = 'read nickfil nickrec'
    get oa$dcl = '$username = f$edit(21,12,nickrec),"TRIM")' 
    get oa$dcl = ""write oa$mailbox ""OA GET #USERNAME = """"''USERNAME'"""""""
    get oa$dcl = "@dclmailbox"
    write change profil user=#username,prsrc='Y'
    get oa$dcl = "write oamailbox ""OA GET #NICKREC = """"''NICKREC'"""""""
    get oa$dcl = "@dclmailbox"
    .if #nickrec eqs "" then goto close
    .goto writerec
    .label close
    .get oa$dcl = "close nickfil"
    .exit
    
    I would like to forget about reading the list because the format may
    change without notice or the maintenence may lapse if the system
    manager lapses. Since the effect here is to change every profil there
    is, how do I make this procedure loop through the entire profil with no
    external reads?
    
    All help appreciated, and any coding suggestion and hints VERY
    appreciated. 
    
    Dave Kinney
T.RTitleUserPersonal
Name
DateLines
259.1Does this help Dave?SANFAN::LESLIE_DAGreetings & SolutionsTue Mar 17 1992 16:3413
    There are 2 possible solutions that come to my mind that will do what
    you want to do:
    	1. Use a for loop
    	2. Use a script-controlled loop
    
    The for example:
    	for profil do write change profil key = .%key, prsrc='Y'
    
    After showing this example, I don't think I'll even bother with the
    other one...
    
    HTH,
Dan
259.2EasySCOTTC::MARSHALLPearl-white, but slightly shop-soiledTue Mar 17 1992 16:3714
Hi,

First, I wonder why you use DCL to read the list of names, when you can do it
all quite neatly in script, via TEXT_FILE operations.

Secondly, to answer your question, you can loop through the profile quite
easily using:

    FOR PROFIL DO -
        WRITE CHANGE PRODIL USER=.USER,otherfield=newvalue

Note the dot here ---------------^

Scott
259.3Mostly BraindeadMISFIT::KINNEYDAruba Bound Soon!!Tue Mar 17 1992 17:434
    re .2 - Uhh, mostly because at the time I didn't know any better.
    Thanks for the quick input. 
    
    Dave Kinney