Hopefully I can explain this well enough to get the answer I am looking for.
What I am trying to do is create an include file to be able to create a table dynamically.
I have a set of tables where they all have the same fields. The only difference from one table to the next is the data type of one field. Below is what i would like to see in the main program:
In the above example type would tell me what type of field the udval is, whether it is an integer or a character or a decimal....etc.
The other fields are the key fields in the tables and are always the same type and same name. What I would like to see the cnv-ud.i file look like would be similar to the following:
I hope this makes sense, feel free to ask questions if it does not, and i will try to provide as much information as I can.
What I am trying to do is create an include file to be able to create a table dynamically.
I have a set of tables where they all have the same fields. The only difference from one table to the next is the data type of one field. Below is what i would like to see in the main program:
Code:
{cnv-ud.i
&type = ""
&int-field = "1"
&dec-field = "123456"
&ch-field = ""
&int-field1 = "1"
&udval = "xxxx"
}
In the above example type would tell me what type of field the udval is, whether it is an integer or a character or a decimal....etc.
The other fields are the key fields in the tables and are always the same type and same name. What I would like to see the cnv-ud.i file look like would be similar to the following:
Code:
FIND {&type} NO-LOCK
WHERE {&type}.int-field = {&int-field}
AND {&type}.dec-field = {&dec-field}
AND {&type}.ch-field = {&ch-field}
AND {&type}.int-field1 = {&int-field1}
NO-ERROR.
IF NOT AVAILABLE {&type}
THEN DO:
CREATE {&type}.
ASSIGN
{&type}.int-field = {&int-field}
{&type}.dec-field = {&dec-field}
{&type}.ch-field = "{&ch-field}"
{&type}.int-field1 = {&int-field1}
{&type}.udval = {&udval}
I hope this makes sense, feel free to ask questions if it does not, and i will try to provide as much information as I can.