7.120.3 SUBMIT Examples

Example 1: Submit a call to a program named INVOICE in library PRODLIB and pass two parameters, invoice number and inquiry date as literals.

SUBMIT PGM(INVOICE.PRODLIB) PARM('INV123' '010187')

Example 2: Submit a call to program PUTBATCH passing the fields #BATCH, #ORDER and the current date (which is obtained from system variable *DATE) as parameters. Use job description GLEDGER and job queue QNIGHT to submit the job.

SUBMIT PGM(PUTBATCH) PARM(#BATCH #ORDER *DATE) JOBD(GLEDGER) JOBQ(QNIGHT)

Example 3: Submit a call to LANSA process ORDERS and request that the first function in the process be executed.

SUBMIT PROCESS(ORDERS)

Example 4: Submit a call to LANSA process ORDERS2 and request that the function PURGE be executed. Exchange the order number and batch number with the function.

SUBMIT PROCESS(ORDERS2) FUNCTION(PURGE) EXCHANGE(#ORDER #BATCH)

Example 5: Write a function called PRNTBCH (belonging to process GLPROC01) that when invoked interactively asks the user to specify the print criteria, submits itself to batch, and when invoked in batch uses the print criteria to produce the required report for the user. This example also illustrates the use of expandable groups to simplify field lists.

GROUP_BY NAME(#XG_EXCH) FIELDS(#GLNUMB #BATCH #MINCREDIT)

IF COND('*JOBMODE = I')

          REQUEST FIELDS(#XG_EXCH)

          SUBMIT  PROCESS(GLPROC01) FUNCTION(PRNTBCH) EXCHANGE(#XG_EXCH)

ELSE

          SELECT  FIELDS(#CREDIT #DEBIT) FROM_FILE(GLMASTV3) WITH_KEY(#GLNUMB #BATCH) WHERE('#CREDIT *GE #MINCREDIT')

          UPRINT  FIELDS(#GLNUMB #BATCH #CREDIT #DEBIT)

          ENDSELECT

          ENDPRINT

ENDIF

When run interactively (ie: *JOBMODE = I) , this function requests that the user input a general ledger number, a batch number and a minimum credit amount. It then submits itself to batch, exchanging the general ledger number, batch number and minimum credit amount that were input by the user.

When invoked in batch, this function selects only records that match the user's request from logical file GLMASTV3 and prints them. The initial value of fields #GLNUMB, #BATCH and #MINCREDIT are established from the exchange list that was passed to the batch version of this function from the interactive version.

Example 6: Submit a form called ORDERFRM

    CHANGE FIELD(#FORM) TO ('''*FORM''')

    SUBMIT PROCESS(ORDERFRM) FUNCTION (#FORM)