Fixed #23136 -- Added the message using the output variable

Added the message using the output variable to be consistent
with the flow of the program.