Call a subroutine
Usage description: You can call a subroutine from an enquiry field. You have to invoke it using @ E.Subroutine.Name in the Conversion field. The argument to be processed by the enquiry must be set in the Operation field. Inside the subroutine, the argument will be transmitted in a dedicated variable named O.DATA. This is defined in the I_ENQUIRY.COMMON library.
Example :
We are displaying an historical transaction ID in an enquiry. We need to get the latest trans ID if exists.
In the enquiry, it will give:
11.16 FIELD.NAME..... LATEST.TRANS 12.16. 1 OPERATION... F TRANS.ID 13.16 COLUMN......... 12 14.16 LENGTH.MASK.... 20L 15.16. 1 CONVERSION.. @ E.DX.GET.LATEST.TRANS
In the subroutine, it will give:
SUBROUTINE E.DX.GET.LATEST.TRANS $INSERT I_COMMON $INSERT I_EQUATE $INSERT I_ENQUIRY.COMMON IN.R.DX.TRANS.KEYS = "" IN.DX.TRADE.ID = FIELD(O.DATA,".",1) IN.CUST.PORT = FIELD(O.DATA,".",2) IF (IN.CUST.PORT # "") THEN CALL DX.GET.LATEST.TRANSACTION.ID( IN.R.DX.TRANS.KEYS, IN.DX.TRADE.ID, IN.CUST.PORT, LAST.TXN.ID) O.DATA = LAST.TXN.ID END RETURN END