Hi Pete,
Thanks for the quick reply! Seems i was unclear in my question: i don't want to create a generic variable, i want to replace an "entry var" with generic.
Background: i'd like to create a "module" that has data + entries (am i hearing anybody mumbling "oop" :-)?).
This is perfectly possible with PL/1:
/* just a sample */
/* declare */
dcl 1 employee,
2 id dec fixed(5),
2 name char(20),
2 birthday dec fixed(9),
2 find_employee_by_name entry(char(*)) returns(dec fixed(5)),
2 find_employee_by_birthday entry(dec fixed(9)) returns(dec fixed(5));
/* assign the entries */
employee.find_employee_by_name = the_func_that_implements_the_search_by_name;
employee.find_employee_by_birthday = the_func_that_implements_the_search_by_birthday;
dcl x_emp dec fixed(5);
/* use/call the entries */
x_emp = employee.find_employee_by_name("john doe");
x_emp = employee.find_employee_by_birthday(19800101);
/* what i want to achieve */
x_emp = employee.find_employee("john doe");
The "generic works perfect "outside" a struct:
/* a generic */dcl find_employee generic(the_func_that_implements_the_search_by_name when(char), the_func_that_implements_the_search_by_birthday when(dec fixed(9) );/* using the generic */x_emp = find_employee("john doe"); /* calls "the_func_that_implements_the_search_by_name" */
But i was not able to achieve the same as part of the struct.
so there is a workaround, but i'm curious if there's a way to do it "right".
br johann
woecki