GET_MESSAGE Scope
Posted: Thu Apr 18, 2019 7:13 am
Is getting a message with GET_MESSAGE scoped to the routine that issued the message?
I have an insert statement as such
This works as expected, however, if I move the tracing of messages to a separate method routine, I don't get any messages.
Here is the GetMessages method
Its the same logic as before, only done inside a method.
If I change the above insert code to
The GET_MESSAGE return code comes back as NO.
Thanks,
Joe
I have an insert statement as such
Code: Select all
insert fields(#EP0001F1Fields) to_file(EP0001F1) io_error(*NEXT) val_error(*NEXT)
if_status is(*OKAY)
#SYS_APPLN.TraceMessageData( 'CreateWorkforceLink - Link Created - Location: &1' #pContext.Request.Path )
#APIContext.Created( #pContext #pContext.Request.Path )
return
else
#SYS_APPLN.TraceMessageData( 'CreateWorkforceLink - Link Insert Failed - Status: &1' #IO$STS )
use builtin(GET_MESSAGE) to_get(#wk_ReturnCode #wk_Message)
#SYS_APPLN.TraceMessageData( 'GetMessage - ReturnCode:&1' #wk_ReturnCode )
dowhile (#wk_ReturnCode = 'OK')
#SYS_APPLN.TraceMessageData( 'GetMessage - ReturnCode:&1 Message:&2' #wk_ReturnCode #wk_Message )
use builtin(GET_MESSAGE) to_get(#wk_ReturnCode #wk_Message)
endwhile
#APIContext.Error( #pContext #PostWorkforceLinkv1)
return
endif
Here is the GetMessages method
Code: Select all
mthroutine name(GetMessages) access(*PRIVATE)
use builtin(GET_MESSAGE) to_get(#wk_ReturnCode #wk_Message)
#SYS_APPLN.TraceMessageData( 'GetMessage - ReturnCode:&1' #wk_ReturnCode )
dowhile (#wk_ReturnCode = 'OK')
#SYS_APPLN.TraceMessageData( 'GetMessage - ReturnCode:&1 Message:&2' #wk_ReturnCode #wk_Message )
use builtin(GET_MESSAGE) to_get(#wk_ReturnCode #wk_Message)
endwhile
endroutine
If I change the above insert code to
Code: Select all
if_status is(*OKAY)
#SYS_APPLN.TraceMessageData( 'CreateWorkforceLink - Link Created - Location: &1' #pContext.Request.Path )
#APIContext.Created( #pContext #pContext.Request.Path )
return
else
#SYS_APPLN.TraceMessageData( 'CreateWorkforceLink - Link Insert Failed - Status: &1' #IO$STS )
#COM_OWNER.GetMessages
#APIContext.Error( #pContext #PostWorkforceLinkv1)
return
endif
Thanks,
Joe