Description
This is the method that contains the call to the specific method in the appropriate class to perform the request.
This method should be extended on the specific daemon level.
In order to have a proper logging of the errors/warnings you get from the business method that is used for processing the work, you need to fill in tPassMessages temp-table parameter, as a copy of tFcMessages from the called business component.
Parameters
iiDaemonQueueId | input | integer | ID of the daemon queue record that indicates the work that needs to be done. |
olSuccess | output | logical | Was the operation successful? |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program/bcrosscydaemonprocessor.p)
<ANCESTOR-CODE>
assign olSuccess = false
oiReturnStatus = -98.
/* ========================= */
/* Find the QCrossCyDaemonID */
/* ========================= */
<Q-11 run DaemonQueueByRefID (all) (Read) (NoCache)
(input iiDaemonQueueId, (DaemonQueueID)
input ?, (DaemonQueueRef)
input '', (DaemonName)
output dataset tqDaemonQueueByRefID) in BBaseDaemonQueue >
find tqDaemonQueueByRefID where
tqDaemonQueueByRefID.tiDaemonQueueId = iiDaemonQueueId
no-lock no-error.
if not available tqDaemonQueueByRefID
then do:
assign vcCrossCyDPMsg = trim(#T-7'Daemon queue record not found.':100(262)T-7#) + chr(10) +
trim(substitute('DaemonQueueID = &1.':U, trim(string(iiDaemonQueueId))))
oiReturnStatus = -3.
<M-4 run SetMessage (input vcCrossCyDPMsg (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input string(iidaemonqueueId) (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1927':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCrossCyDaemonProcessor>
return.
end.
/* ============================================ */
/* State the Company of the Daemon Queue record */
/* ============================================ */
assign vcCompanyIDForNewSession = trim(substring(tqDaemonQueueByRefID.tcDaemonQueueRefDescription, index(tqDaemonQueueByRefID.tcDaemonQueueRefDescription, '((':U) + 2,-1,"CHARACTER":U))
viCompanyIDForNewSession = integer(substring(vcCompanyIDForNewSession, 1, length(vcCompanyIDForNewSession,"CHARACTER":U) - 2,"CHARACTER":U)) no-error.
if viCompanyIDForNewSession = 0 or
viCompanyIDForNewSession = ? or
error-status:error
then do :
assign vcCrossCyDPMsg = trim(#T-8'Internal cross-company daemon error: unable to state the entity based on the queue information.':100(1588)T-8#) + chr(10) +
trim(substitute("Queue-information = &1.":U, trim(tqDaemonQueueByRefID.tcDaemonQueueRefDescription))) + chr(10) +
trim(substitute("Company = &1.":U, string(viCompanyIDForNewSession))) + chr(10) +
trim(substitute("Error-details = &1.":U, trim(ERROR-STATUS:GET-MESSAGE(1))))
oiReturnStatus = -3.
<M-6 run SetMessage (input vcCrossCyDPMsg (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input string(iidaemonqueueId) (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-2839':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCrossCyDaemonProcessor>
return.
end. /* if error-status:error */
/* ============================ */
/* Process Daemon Queue records */
/* ============================ */
<M-94 run SwitchSessionCy
(input '' (icCompanyCode),
input viCompanyIDForNewSession (iiCompanyId),
output viFcReturnSuper (oiReturnStatus)) in BCrossCyDaemonProcessor>
if viFcReturnSuper lt 0
then do:
assign
oiReturnStatus = viFcReturnSuper
olSuccess = false.
end.
<M-91 run api/bqcrosscyposting/apiprocessqcrosscyposting.p
(input '' (icApiLogin),
input '' (icApiPassword),
input '' (icApiExtra),
input viSessionID (iiApiSessionId),
input integer(tqDaemonQueueByRefID.tcDaemonQueueRef) (iiQCrossCyPostingId),
input -1 /* already set in the session viExternalDebugLevel, */ (iiExternalDebugLevel),
input ? /* already set in the session vcExternalDebugDirectory, */ (icExternalDebugDirectory),
output dataset tFcMessages (ozFcMessagesDS),
output viFcReturnSuper (oiReturnStatus))>
if viFcReturnSuper < 0
then assign olSuccess = false.
else assign olSuccess = true.
assign oiReturnStatus = 0.