I have an external function that is used extensively throughout my model. It is held in a separate .FOR file to all the program subunits that might reference it. Under certain conditions the function will print a warning to the screen, and what I'd like to be able to do is discover which particular function reference generated the warning, or even just which program subunit contained the reference.
Is there any way that the function can access and print the name of the referencing subunit within the warning? I know that I could add a flag to the list of arguments that is set by the presence of the warning, and then test this flag immediately following every use of the function within the model, but this would be very labour intensive so I'm keen to find out if there is a more elegant solution that can simply be inserted into the function itself.
Many thanks