Bill,

A little while ago there was a thread about running totals, and the same
problem of initialization came up.  It's apparently solved by using an
additional named commons variable that saves the date and time last
initialized compared to the current date and time of 'this' LIST/etc.
statement.  Here's a post that used that method:

http://www.mail-archive.com/u2-users%40listserver.u2ug.org/msg30268.html

Best Regards,

Richard Lewis

On Thu, Aug 20, 2009 at 3:28 PM, Bill Haskett <wphask...@advantos.net>wrote:

>
>  I have a UD dictionary that calls a subroutine.  The subroutine selects a
>> small file and saves the data into a reformatted array, which is returned as
>> a passed variable.
>>
>> I want to only execute this select code once in the subroutine then
>> continue with the reset of the subroutines business rule(s) for subsequent
>> items processed.  When I create a "named" common variable for the built data
>> array the array is set once and when I alter the data in the selected file
>> (small) it never is updated when I run a subsequent selects or sorts.
>>
>> UniData doesn't seem to be able to inform me when the first item is
>> processed, in order to initialize, read, and build the configuration array.
>>  How is this done?
>>
>> E.g. I want to know what accounts a user has access to (we run an ASP with
>> 50-100 accounts on it and our users file is global).  The dictionary builds
>> an array of users on our system as follows:
>>
>> 001 mv'd list of user names
>> 002 mv'd list of upper-cased user names
>> 003 mv'd list of account paths each user has access to
>>
>> A user can have access to multiple account paths.  When I do the following
>> (in PICK mode):
>>
>> :sort SECUSERS BY USERID ID-SUPP USERID ACCTUSER AUTHACCTS
>>
>> ...I get the following list of users and account paths they have access
>> to:
>>
>> UserId......... C. AuthAccts.....................
>>
>> PUBLICUSER       1 E:\UDAccounts\AsiPublic
>>                   E:\DataTrust\Dev
>>                   E:\DataTrust\Demo
>> DOTNETUSER       1 E:\DataTrust\Demo
>>                   E:\Advantos\Intel
>>                   E:\DataTrust\Dev
>> MYUSER           1 E:\DataTrust\Dev
>>                   E:\DataTrust\Demo
>>                   E:\Advantos\Intel
>>
>>
>> The dictionary of "AUTHACCTS" looks like:
>>
>> Top of "AUTHACCTS" in "DICT SECUSERS", 6 lines, 113 characters.
>> *--: P
>> 001: I The authorized accounts this user has access to (a DBIUSERS value)
>> 002: SUBR( "D.AUTHACCTS", @ID )
>> 003:
>> 004: AuthAccts
>> 005: 30L
>> 006: M
>> Bottom.
>> *--:
>>
>>
>> ...and the subroutine looks like:
>>
>> *
>> ** Initialize common program variables
>> $INCLUDE DTABP,INCLUDES SET.COMMON
>> *
>> ** Initialize local common
>> COMMON /dbUserc/ comDbiUserArray
>> *
>> ** Initialize null because we're calling from a dictionary and SET.INIT
>> ** hasn't run yet (besides NULL$ isn't named common).
>> NULL$ = ''
>> *
>> ** Initialize return value
>> OutValue = NULL$
>> *
>> ** Make sure we're dealing with a user record key
>> IF UserID = NULL$ THEN GOTO END.OF.PROGRAM
>> *
>> ** Get the list of DB users
>> IF comDbiUserArray = NULL$ OR comDbiUserArray = 0 THEN
>>   CALL GET.DBIUSERS ( DbiUserArray )
>>   comDbiUserArray = DbiUserArray
>> END
>> *
>> **-------------------------------------------------------------------**
>> **                                                                   **
>> **                       R U N   P R O G R A M                       **
>> **                                                                   **
>> **-------------------------------------------------------------------**
>> *
>> ** Assign the names Id & intialize variable to pass back
>> UCDbiUserList = comDbiUserArray<2>
>> DbiUserPaths  = comDbiUserArray<3>
>> UserID        = OCONV(UserID, 'MCU')
>> LOCATE(UserID, UCDbiUserList, 1; Pos) THEN
>>   OutValue = RAISE(DbiUserPaths<1,Pos>)
>> END
>>
>>
>> The problem is once I run the query the contents of the array
>> "comDbiUserArray" will never change until I log off.  How can I force the
>> array to be initialized without logging off?
>>
>> Any help would be appreciated.
>>
>> Thanks,
>>
>> Bill Haskett
>> Advantos Systems, Inc.
>>
> _______________________________________________
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to