Bill,
Does Unidata have the @NI variable this will be set to 1 for the first record
of any new LIST or SELECT so you should be able to change
IF comDbiUserArray = NULL$ OR comDbiUserArray = 0 THEN
To
IF comDbiUserArray = NULL$ OR comDbiUserArray = 0 OR @NI = 1 THEN
HTH
Andy
----- Original Message ----
From: Bill Haskett <[email protected]>
To: U2 Mail List <[email protected]>
Sent: Thursday, 20 August, 2009 22:28:44
Subject: [U2] UD: Executing small part of subroutine code once from dictionary
call
> 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
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users