3. Routines for managing a table#
3.1. Routine TBCRSD: Create a new table#
TBCRSD (tabname, base)
tabname |
in |
K19 |
Name of the new table to create If it already exists, we destroy it + show<A> |
base |
in |
K1 |
Basis for creating the table table (“G”, “V”,…) |
3.2. Routine TBAJPA: Add parameters to the table#
TBAJPA (tabname, nbpar, nameby, typpar)
tabname |
in |
K19 |
Name of the table where you want to add parameters |
nbpar |
in |
I |
Number of parameters to add |
name by |
in |
V (K16) |
List of names of parameters to be added |
typpar |
in |
V (K8) |
List of parameter types: “R”, “I”, “C”, “C”, “K8”, “K8”, “K16”, “K24”, “K32” |
3.3. Routine TBEXIP: Test the existence and type of a parameter#
TBEXIP (tabname, para, exist, typpar)
tabname |
in |
K19 |
Name of the table to be examined |
para |
in |
K16 |
parameter to test |
exist |
out |
L |
. TRUE.: the parameter already exists in the tabname table |
typpar |
out |
K8 |
type of parameters if they already exist in the table: “R”, “I”, “C”, “K8”, “K16”, “K16”, “K16”, “K16”, “K16”, “K16”, “K16”, “K16”, “K16”, “K24”, “K32” |
3.4. Routine TBFUTB: Merge multiple tables into a single table#
TBFUTB (tabout, basout, ntab, ltabin, ltabin, para, typpar, vi, vr, vc, vk)
taboo |
in |
K19 |
Name of the table you want to create |
basout |
in |
K1 |
Basis for creating the tabout table (“G”, “V”,…) |
ntab |
in |
I |
Number of tables we want to merge |
ltabin |
in |
K19 |
Names of the tables we want to merge |
para |
in |
K16 |
New parameter (optional) that will distinguish the origin of each of the rows in the new table if para=” “the following arguments are not used. |
typpar |
in |
K8 |
Type of the new parameter (optional) |
vi |
in |
V (I) |
List of values for the new parameter “I” (optional) |
vr |
in |
V (R) |
List of values for the new “R” parameter (optional) |
vc |
in |
V (C) |
List of values for the new parameter “C” (optional) |
vk |
in |
V (K*) |
List of values for the new parameter “K” (optional) |
This routine can be useful for creating a sparse table, the developer can create each subtable separately and use routine TBFUTB to merge them into a single table.
Example:
We want to merge the 2 tables: T1 and T2
A |
B |
C |
D |
x1 |
x2 |
x3 |
|
x4 |
x5 |
||
x6 |
x7 |
x8 |
A |
B |
E |
y1 |
y2 |
y3 |
y4 |
y5 |
If we write:
Latin (1) =T1
Latin (2) =T2
CALL TBFUTB (T3, 'V',2, ltabin, '', kbid, ibid, rbid, cbid, kbid, kbid)
We get the table: T3
A |
B |
C |
D |
E |
x1 |
x2 |
x3 |
||
x4 |
x5 |
|||
x6 |
x7 |
x8 |
||
y1 |
y2 |
y3 |
||
y4 |
y5 |
If we write:
Latin (1) =T1
Latin (2) =T2
VK (1) =' ACTION1 '
VK (2) =' ACTION2 '
CALL TBFUTB (T3, 'V',2, Ltabin, 'N', 'K8', ibid, rbid, cbid, VK)
We get the table: T3
N |
A |
B |
B |
C |
D |
E |
ACTION1 |
x1 |
x2 |
x3 |
|||
ACTION1 |
x4 |
x5 |
||||
ACTION1 |
x6 |
x7 |
x7 |
|||
ACTION2 |
y1 |
y2 |
y3 |
|||
ACTION2 |
y4 |
y5 |
Notes on the order of rows and columns in the new table:
The rows in the new table are ordered by putting the rows of the tables you are merging end to end.
To order the parameters we adopt the following rules:
- the new parameter (optional) is numbered first,
- the parameters from the 1st table of ltabin*are then added in the order they have in* ltabin (1)
- the parameters of the 2nd table of ltabin*are then added (except those already present in* ltabin (1) ) in the order they have in ltabin (2)
- …
3.5. Routine DETRSD: Destroy a table#
CALL DETRSD ('TABLE_SDASTER', tabname)
3.6. Routine COPISD: Duplicate a table#
CALL COPISD ('TABLE_SDASTER', 'V', tabin, taboo)