Skip to content

Writing Voice Apps in the Clouds with COBOL

April 1, 2009

Following on the heels of Voxeo’s announcement h96920kof support for COBOL in their recently released Tropo.com platform, I have put together a script showing how to use this great new feature. Finally, I may use the language that first introduced me to the wonders of computer programming to develop voice apps in the clouds.

The first application I participated in writing was a Computer Telephony Integration system using COBOL on HP3000s. This system is still alive and well today and now may be adapted to take advantage of all the clouds have to offer. Considering the codebase has not been touched since 1999, and then only for refactoring, this is a tremendous leap forward.

Here is an example to get you started, I will be posting to GitHub shortly:

      $ SET SOURCEFORMAT"FREE"
IDENTIFICATION DIVISION.
PROGRAM-ID.  CallingGrace.
AUTHOR.  Jason Goecke.
<ul>
  <li>Demonstrates the use of Tropo.com</li>
<li>for writing voice applications from</li>
<li>all the world's systems that use</li>
<li>COBOL in the clouds.</li>
</ul>

DATA DIVISION.
WORKING-STORAGE SECTION.
01 MenuStr             PIC X(99)      VALUE "Please tell us what you would like to know about Grace Hopper.".
01 RetryCntr           PIC 9          VALUE ZEROS.
01 MenuOptions         PIC X(99)      VALUE "war('Where did Grace work?'), bug('Where is that moth?')".
01 MenuResult          PIC X(99)      VALUE "".
01 SayGoodbye          PIC X(99)      VALUE "Thank you for calling, goodbye.".
01 PleaseTryAgain      PIC X(99)      VALUE "Invalid choice, please try again."
01 WarDeptPhone	       PIC 9999999999 VALUE 7035456700.
01 SmithsonianBugs     PIC 9999999999 VALUE 2026331000.

LINKAGE SECTION
01 TROPO-PROCEDURES

PROCEDURE DIVISION USING TROPO-PROCEDURES.
000-MAINLINE.
    CALL 'ANSWER'.
    PERFORM UNTIL RetryCntr = 3
       MenuResult = CALL 'ASK' USING MenuStr
                                     MenuOptions.
       IF MenuResult ALPHABETIC
         PERFORM 200-CALL-DESTINATION.
		 RetryCntr = 3.
       ELSE
         CALL 'SAY' USING PleaseTryAgain.
         ADD 1 TO RetryCntr.
    END-PERFORM.

    GO TO 300-EXIT.

200-CALL-DESTINATION.
    IF MenuResult EQUAL 'war'
      CALL 'TRANSFER' USING WarDeptPhone.

	IF MenuResult EQUAL 'bug'
	  CALL 'TRANSFER' USING .

300-EXIT.
	CALL 'SAY' USING SayGoodbye.
	CALL 'HANGUP'.
	STOP RUN.

It is a fact, there are more lines of COBOL in use in the world today than any other single computer programming language. I applaud the visionary leadership behind Tropo.com siezing this giant opportunity to bring voice from the clouds to all of those systems out there.

About these ads
2 Comments leave one →
  1. April 1, 2009 6:55 am

    If I can quote Paris Hilton on this – “That’s hot!”

  2. April 1, 2009 7:20 am

    I can’t believe you spent a whole day tinkering with Cobol for an April’s fools joke…

    F.Y.I. I have those same glasses…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: