5. Routines for writing values to a table#
5.1. Routine TBAJLI: Add a row to the table#
TBAJLI (tabname, nbpar, namepar, vi, vr, vc, vk, numme)
Example:
Let a table containing the « integer » parameters” I1 “,” I2 “,” I2 “,” I3 “, the « real » parameters” R1 “and” R2 “and the « character string » parameters” K1 “and” K2 “
Suppose we want to add a line containing: I2=i2, R1=r1, K2=k2, K1=k1.
We can call routine TBAJLI with the arguments:
Nbpar = 4
name by = ('I2', 'R1', 'K2', 'K1')
vi = (i2)
vr = (r1)
vk = (k2, k1)
Number = 0
5.2. Routine TBNULI: Allows you to retrieve a row number from a table#
TBNULI (tabin, npacri, lipcar, vi, var, vi, vr, vc, vk, lprec, write, number)
tabin |
in |
K19 |
Name of the table whose row we want to retrieve |
npacri |
in |
I |
Number of parameters involved in the line selection criteria (lipacr dimension) |
lipacr |
in |
V (K16) |
List of names of criteria parameters |
vi |
in |
V (I) |
Criteria values for parameters” I “ |
vr |
in |
V (R) |
Criteria values for “R” parameters |
vc |
in |
V (C) |
Criteria values for “C” parameters |
vk |
in |
V (K) |
Criteria values for “K” parameters |
lprec |
in |
V (R) |
List of details (for float parameter equality criteria) [cf. § 7.1.1 Special case of equality criteria…].) |
lcrit |
in |
V (K8) |
List of secondary equality criteria for floating parameters: “EGAL”, “RELA”, “ABSO” [cf. § 7.1.1 Special case of equality criteria…].. |
nume |
out |
I |
= 0: There is no line that matches the criteria. = i: The i line is the only one that corresponds to the selection criteria < 0: There are several lines corresponding to the criteria |
We search for a line in the tabin table by imposing conditions on its parameters.
The mechanism for selecting a row in a table (arguments lipacr, lcrit, lprec, vi, vr, vc, vk) is explained in § 7 Routines for filtering and sorting a table.
When this line is found (and unique), its number is returned, which allows you to modify this line using the TBAJLI routine.
5.3. Examples#
This is the table: T3
A |
B |
C |
x1 |
x2 |
|
x6 |
x7 |
x8 |
We add a line to T3:
CALL TBAJLI (T3.1, 'B', ibid, z1, cbid, kbid,0)
We then get the table:
A |
B |
C |
x1 |
x2 |
|
x6 |
x7 |
x8 |
z1 |
We get the line number such that A=x1:
CALL TBNULI (T3.1, “A”, ibid, x1, cbid, kbid,1.d-6, “RELA”, ilig)
We modify the ilig line:
CALL TBAJLI (T3.1, “C”, ibid, z2, cbid, kbid, ilig)
We then get the table:
A |
B |
C |
z2 |
||
x6 |
x7 |
x8 |
z1 |