为什么 /copy 在 ILE 模块中不起作用
Why /copy is not working in ILE module
好的,所以我有点困惑。我用一个过程创建了一个简单的模块。当内部包含原型和数据结构时,它就像一个魅力...
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 ;
但是当我使用 /copy 时,SQL 编译器不喜欢数据结构并给我一个错误...
原型
/if defined(GetIIM)
dcl-ds IIM ext end-ds;
dcl-pr GetIIM LikeDS(IIM);
*n char(35) options(*nopass) value ;
end-pr ;
/endif
程序
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 ;
程序
所以,我现在在做什么傻事?错误代码是 SQL 0312 变量 IIM 未定义或不可用。
我认为 /copy 基本上会将代码片段放入源代码并进行编译。我知道 SQL 预编译器有问题,但我迷路了...
查看创建 SQL ILE RPG 对象 (CRTSQLRPGI) 命令的 RPG 预处理器选项 (RPGPPOPT) 参数。
联机帮助...
RPG preprocessor options (RPGPPOPT)
Specifies if the ILE RPG compiler will be called to preprocess the
source member before the SQL precompile is run. Preprocessing the
SQL source member will allow some compiler directives to be handled
before the SQL precompile. The preprocessed source will be placed
in file QSQLPRE in QTEMP. This source will be used for the SQL
precompile.
*NONE
The compiler is not called for preprocessing.
*LVL1
The compiler is called for preprocessing to expand /COPY and
handle the conditional compilation directives except the
/INCLUDE directive.
*LVL2
The compiler will be called for preprocessing to expand /COPY
and /INCLUDE and handle the conditional compilation directives.
确保您没有使用 *NONE.
好的,所以我有点困惑。我用一个过程创建了一个简单的模块。当内部包含原型和数据结构时,它就像一个魅力...
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 ;
但是当我使用 /copy 时,SQL 编译器不喜欢数据结构并给我一个错误...
原型
/if defined(GetIIM)
dcl-ds IIM ext end-ds;
dcl-pr GetIIM LikeDS(IIM);
*n char(35) options(*nopass) value ;
end-pr ;
/endif
程序
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 ;
程序
所以,我现在在做什么傻事?错误代码是 SQL 0312 变量 IIM 未定义或不可用。
我认为 /copy 基本上会将代码片段放入源代码并进行编译。我知道 SQL 预编译器有问题,但我迷路了...
查看创建 SQL ILE RPG 对象 (CRTSQLRPGI) 命令的 RPG 预处理器选项 (RPGPPOPT) 参数。
联机帮助...
RPG preprocessor options (RPGPPOPT)
Specifies if the ILE RPG compiler will be called to preprocess the source member before the SQL precompile is run. Preprocessing the SQL source member will allow some compiler directives to be handled before the SQL precompile. The preprocessed source will be placed in file QSQLPRE in QTEMP. This source will be used for the SQL precompile. *NONE The compiler is not called for preprocessing. *LVL1 The compiler is called for preprocessing to expand /COPY and handle the conditional compilation directives except the /INCLUDE directive. *LVL2 The compiler will be called for preprocessing to expand /COPY and /INCLUDE and handle the conditional compilation directives.
确保您没有使用 *NONE.