using NEXT-VALUE(..) "dynamically"

psuter

New Member
The NEXT-VALUE function needs 2 input Parameters. The first one is the name of the sequence to use and the second must be the logical database name:

NEXT-VALUE(Sequence, BasisDB)

My problem is, that I have to use NEXT-VALUE dynamically, but neither Sequence nor BasisDB can be put into the function using string variables or VALUE():

NEXT-VALUE(cSequenceName, cLogicDBName)

Is there a possibility to solve this problem "dynamically"?

Thanks for your help, Pascal
 

m1_ru

New Member
We have some problems,
when wrote utilities for automatic database generation,
and decide to use compile-time parameters .

Unfortunately program require compilation licence for execution.

<pre>
/*

svdynrw.p

Read and write sequence value

{1} - sequence value
{2} - database name

Author: Mikle Pervakov
Creation date: 02/08/2002

*/

define input parameter p-action as character no-undo .
define input-output parameter p-seq-value as integer no-undo .

&scop seq-name {1}
&scop db-name {2}

do
on error undo, return error return-value
:
case p-action :
when 'read':u then do:
assign
p-seq-value = current-value({&seq-name}, {&db-name})
.
end.
when 'write':u then do:
assign
current-value({&seq-name}, {&db-name}) = p-seq-value
.
end.
otherwise do:
message
"svdynrw.p: bad input parameters" skip
"p-action" p-action skip
view-as alert-box error .
undo, return error .
end.
end.
end.
</pre>

The value of sequence can be red (or written) such way:

<pre>
define variable v-seq-val as integer no-undo .
for each DICTDB._Sequence
:
run svdynrw.p
(input "read":U
,input-output v-seq-val
)
value(DICTDB._Sequence._Seq-Name)
value(LDBNAME("DICTDB":U))
.
display DICTDB._Sequence._Seq-Name v-seq-val .
end.

</pre>

Other way is to use standard progress utilities to store/load
sequence values to/from file:
<pre>
prodict/dump/_dmpseqs.p
prodict/dump/_lodseqs.p
</pre>
 
Top