One of the most irritating things about COBOL for me is its lacking ability to format numeric values in a way where they can by used in texts for instance error messsages. In order to use a numeric value in a text you must be able to left justify it and remove trailing blanks. I have tried to find a solution for this problem for a long time until I came up with the following solution:
I hope you can forgive me for the missing indentations to the correct columns in COBOL. I have chosen not to declare the variable something-numeric because it might be any kind of numeric variable in COBOL. The above piece of code is only able to handle integer values.
I have mentioned before that COBOL is not the most elegant programming language and unfortunately you cannot make a function out of the above piece of code in COBOL. Compared to many other operations in COBOL it is quite impressive that you are able to use only two statements for the task. On the other hand it requires five variable declarations.