Automatic routines and unattended execution
Separates an automatic routine contract from its execution channel.
Overview
Identify the supported routine and its fields, operation and array layout. Prepare identity/company/branch only if the caller does not supply them. MsExecAuto lMsErroAuto flags nonfatal errors; it does not catch every exception. lMsHelpAuto enables capture and lAutoErrNoFile controls default log-file generation. Unattended execution must not depend on MsgInfo or onscreen MostraErro: use documented error retrieval, minimize sensitive values and plan transactions/cleanup. The example initializes controls only, with no routine call or writes. (Sources: refs. 1–2.)
Commented example
#Include "Protheus.ch"
User Function Ed635()
// PRIVATE identifiers required by the MsExecAuto contract.
Private lMsErroAuto := .F.
Private lMsHelpAuto := .T.
Private lAutoErrNoFile := .T.
// Reset lMsErroAuto immediately before the approved call.
ConOut(ValType(lMsErroAuto))
Return NilPrints L. No MsExecAuto execution or success claim occurs. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
- Do not invent a universal array for different routines. Test business failures, exceptions, concurrency and retries.
- Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.