Example 1: Call a program named INVOICE in library PRODLIB and pass two parameters, invoice number and inquiry date as literals.
For Visual LANSA:
CALL PGM(INVOICE PROBLIB) PARM('INV123' '010187')
For ibm I:
CALL PGM(INVOICE.PROBLIB) PARM('INV123' '010187')
Example 2: Call program PUTBATCH passing the fields #BATCH, #ORDER and the current date (which is obtained from system variable *DATE).
CALL PGM(PUTBATCH) PARM(#BATCH #ORDER *DATE)
Example 3: Call LANSA process ORDERS and request that the process main menu be displayed to allow the user to choose the desired function. If the user uses the MENU key to exit from process ORDERS continue processing in this function at the next RDML command:
CALL PROCESS(ORDERS) FUNCTION(*MENU) MENU_USED(*NEXT)
Example 4: Call LANSA process ORDERS and request that the function HEADER be directly invoked without displaying the process main menu. If the user uses the MENU or EXIT keys to exit from function HEADER, continue processing in this function at the next RDML command:
CALL PROCESS(ORDERS) FUNCTION(HEADER)
EXIT_USED(*NEXT) MENU_USED(*NEXT)
Example 5: Do the same thing as example 4, but use a direct call to function HEADER:
CALL PROCESS(*DIRECT) FUNCTION(HEADER)
EXIT_USED(*NEXT) MENU_USED(*NEXT)
Example 6: Pass data structure DATAFILE into function(ORDER):
This requires a file called DATAFILE to be defined to LANSA. The real fields on this file can be passed as a data structure to another function. A dummy field on the end of the data structure would avoid the need to recompile each called function receiving the data structure each time fields are added within the data structure. As long as the length of the data structure remains consistent, the called function would not need to be recompiled (unless the existing fields are changed in length, position or type within the data structure).
CALL PROCESS(*DIRECT) FUNCTION(ORDER) PASS_DS(DATAFILE)
Example 7: Pass working list #ORDLINE to function(ORDER):
CALL PROCESS(*DIRECT) FUNCTION(ORDER) PASS_LST(#ORDLINE)
DEF_LIST NAME(#ORDLINE) FIELDS(#ORDLIN #PRODUCT #QUANTITY #PRICE) TYPE(*WORKING)
The contents of working list #ORDLINE can now be referenced by function ORDER.
Example 8: Call WEBROUTINE ORDER:
CALL WEBROUTINE(ORDER)
Values of any fields and lists specified FOR(*INPUT) on the ORDER WEBROUTINE will be passed to it.
Example 9: Call WEBROUTINE ORDER in ORDERS WAM:
CALL WEBROUTINE(#ORDERS.ORDER)
Values of any fields and lists specified FOR(*INPUT) on the ORDER WEBROUTINE will be passed to it.
Example 10: Provide the name of a WEBROUTINE to call from a field:
#WEBRTN := 'ORDERS.ORDER'
CALL WEBROUTINE(*EVALUATE #WEBRTN)