Date Function

21 Jul

COBOL has a couple  nifty date functions that allow you to add or subtract from a given date. The INTEGER-OF-DATE function converts a date in the Gregorian calendar (formatted as CCYYMMDD) to an integer, allowing you to add to subtract … Read More »


25 Apr

Redefines is a nifty clause that puts two seemingly different things in the same place at the same time.  I use it most commonly to define a field both as a numeric and a text field.  There are some strict … Read More »

UPPERCASE, lowercase

13 Sep

Way back in the early 80’s when I started developing in COBOL, code was always written entirely in uppercase, due to the limitations of the keypunch machines used in those days.  We’ve come a long way since then, and today’s … Read More »

The INSPECT statement

12 Sep

The INSPECT verb has several options: CONVERTING, REPLACING, and TALLYING. Here’s an example of the CONVERTING format: Let’s say that we have a field called FAVORITE-FOOTBALL-TEAM that contains this string:  Pittsburgh Steelers.    What if our application requires that the … Read More »

COBOL debugger tip

14 Aug

OK, so you’ve written your COBOL program with a copious amount of code that you pulled off the top of your head.  And now you execute the program, but the results are not what you were expecting.    What to do?  Using a … Read More »

Working with Dates

10 Jul

COBOL allows you to accept a number of data items from the operating system, including current date. ACCEPT WS-YYMMDD FROM DATE. This statement will return a six-digit date in the format of YYMMDD. The variable  WS-YYMMDD must be defined in … Read More »