The Story of a Homegrown Clarion Template

The simplest template in my arsenal is the one you’d find most in the code.

I discovered early on it was a good idea to send the (offending) Procedure Name through to the error logging.

_AddError('MyAwesomeProcedure','Stupid Error Subject','Stupid Error Body');

After too long, I decided to do something about always having to string type as a parameter to the error logging function.

But what to do? You’ve probably already seen what took me at least 2 years.

changing_strings

I wrote a little template that places a local var (_:ProcedureName) into every procedure in the app (globally added). This var is populated with the Procedure Name, and now i never have to change that parameter.

#!=========================================

#!= Logging Template

#!=========================================

#TEMPLATE(SA_Logging,'Stus Templates: Logging, Errors and Otherwise'),FAMILY('ABC'),FAMILY('CW20'),FAMILY('Legacy')

#!

#!

#!-----------------------------------------------

#!-----------------------------------------------

#EXTENSION(Global_GetProcedureName,'Global Template to add the GetProcedureName template to each procedure'),APPLICATION(Local_GetProcedureName)

#DISPLAY('==========================================')

#DISPLAY('Global Template for GetProcedureName functionality')

#DISPLAY('==========================================')

#PROMPT('Disable GetProcedureName Code',CHECK),%NoGPNCode,AT(10)

#AT(%DataSection)

#IF(%NoGPNCode)

#ELSE

_:ProcedureName string('%Procedure')

#ENDIF

#ENDAT

#!-----------------------------------------------

#EXTENSION(Local_GetProcedureName,'_:ProcedureName == the Procedure Name'),PROCEDURE

#!-----------------------------------------------

Simple. Sweet. Saves me heaps of time.