Figure 1: Source code for the RTNCUSTWS web service
H NoMain D ReturnOpnBal PR 10i 0 D pState 2 CONST D pOpnBal 9 2 D ReturnMaxLmt PR 10i 0 D ReturnState PR 10i 0 D pState 2 **************************************************************** * Return open balance for a provided state * Inputs - State * Output - Numeric return **************************************************************** P ReturnOpnBal b export D pi 10i 0 D pState 2 CONST D pOpnBal 9 2 D open_balance S 9 2 /free exec sql select sum(baldue) into :pOpnBal from qiws/qcustcdt where state = :pState; Return sqlcod; /end-free P ReturnOpnBal E **************************************************************** * Return the customer with the highest customer limit * Inputs - None * Output - Numeric return **************************************************************** P ReturnMaxLmt b export D pi 10i 0 D customer S 10i 0 /free exec sql select cusnum into :customer from qiws/qcustcdt where cdtlmt = (select max(cdtlmt) from qiws/qcustcdt) fetch first row only; Return customer; /end-free P ReturnMaxLmt E **************************************************************** * Return the state with the highest number of customers * Input - None * Output - Character state **************************************************************** P ReturnState b export D pi 10i 0 D pState 2 D count S 3 0 /free exec sql select state, count(*) into :pState, :count from qiws/qcustcdt group by state order by 2 desc fetch first row only; Return count; /end-free P ReturnState E ****************************************************************