全部博文(287)
分类: 系统运维
2008-11-07 23:09:54
OS/400 R5V4 新功能下RPG与SQL编程实例
▪Integration of Free-Format RPG & SQL
d getOrderCountpi 10i 0
d inCustNumber9b 0 const
d outSqlState5a
d outSqlMsg256a
d ordercounts 10i 0
/free
outSqlMsg= *blanks;
exec sqlSELECT count(*) into :orderCountFROM orders
WHERE cust_no= :inCustNumber;
outSqlState= sqlState;
if %subst(sqlState:1:2) <> '00';
exec sqlGET DIAGNOSTICS CONDITION 1
:outSqlMsg= MESSAGE_TEXT;
orderCount= 0;
endif;
return orderCount;
/end-free