Ok, so I am a little confused. I have created a simple module with one procedure. It works like a charm when the prototype and Data structure are included internally...
ctl-opt option(*srcstmt:*nodebugio) nomain ;
dcl-ds IIM ext end-ds;
dcl-pr GetIIM LikeDS(IIM);
*n char(35) options(*nopass) value ;
end-pr ;
dcl-proc GetIIM export ;
dcl-pi *n LikeDS(IIM);
Item char(35) options(*nopass) value ;
end-pi ;
exec sql
select * into :IIM
from iim where iprod=:ITEM;
return IIM ;
end-proc ;
But when I use /copy, the SQL compiler doesn't like the data-structure and gives me an error...
Prototype
/if defined(GetIIM)
dcl-ds IIM ext end-ds;
dcl-pr GetIIM LikeDS(IIM);
*n char(35) options(*nopass) value ;
end-pr ;
/endif
Procedure
ctl-opt option(*srcstmt:*nodebugio) nomain ;
/define GetIIM
/copy JAGRACE/SANDBOX3,prototype
/undefine GetIIM
dcl-proc GetIIM export ;
dcl-pi *n LikeDS(IIM);
Item char(35) options(*nopass) value ;
end-pi ;
exec sql
select * into :IIM
from iim where iprod=:ITEM;
return IIM ;
end-proc ;
Procedure
So, what stupid thing am I doing now? The error code is SQL 0312 Variable IIM not defined or not usable.
I thought that the /copy would basically put that code snippet into the source and compile. I understand that the SQL precompiler is having an issue, but I am lost...