Visual Debugger – Animator

comments Comments Off
By spgennard, November 5, 2009 2:13 am

This is a very old advertisement of our (Micro Focus) first COBOL debugger called animator in all its glory debugging the classic sample of the day pi.cbl, which calculates the value of PI.

So why is so good?

To put it in some kind of context, most debuggers at the time were command line based, much like gdb, dbx but far less sophisticated.   So having a debugger that actually shows the execution of flow of your, query variables, monitor variables was truly application was amazing.

I have no idea, who put this on YouTube but it really does bring back some old memories.  So thank you!

Object COBOL/Java default exception handler

comments Comments Off
By spgennard, November 3, 2009 11:16 pm

While working on some support recently for our compiler (Micro Focus COBOL compiler that is), I became annoyed with the lack of a reasonable error messages/stack trace output from our Java/COBOL Object support.

I have no idea why our default exception handler for Java exceptions just displays a such a simple message with little or no information.

For those who have not seen it, display something similar to:

Exception 65537 not trapped by the class javaexceptionmanager.
Description: "Java exception"
Test error
Hit T to terminate program. Hit any other key to continue.
instantiated - test

Exception 65537 not trapped by the class javaexceptionmanager.
Description: "Java exception"
Test error
Hit T to terminate program. Hit any other key to continue.

Luckily for me and you, we do expose a mechanism for replacing the default exception handler.

Anyway, with very little effort I created a different “default” system exception handler that display this instead:

instantiated - test 1
java.lang.Exception: Test error
        at SimpleClass.TestException(SimpleClass.java:10)

WARNING: JavaException: Test error
instantiated - test 2
java.lang.Exception: Test error
        at SimpleClass.TestException(SimpleClass.java:10)
WARNING: JavaException: Test error

The key difference being that a Java stack trace is included, boy did this help me.

The program below is the code that implements the exception handler. I am sure someone else can take this example and make it much nicer and provide more features but for this blog I will keep it simple.

      $set ooctrl (+p-f) case
       program-id. ExceptionCatcher.
       
       class-control.
             EntryCallback is class          "entrycll"
             JavaExceptionManager is class   "javaexpt"
             ExceptionManager is class       "exptnmgr"
             Javasup is class "javasup"
             .
       
       working-storage section.
       01 wsCallback                   object reference.
       01 wsIterator                   object reference.
       01 theJavaException             object reference.
       local-storage section.
       01 filler pic x.   *> dummy storage item to allow recursion
       linkage section.
       01 lnkException                 object reference.
       01 lnkErrorObject               object reference.
       01 lnkErrorTextCollection       object reference.
       01 lnkErrorNumber               pic x(4) comp-5.
       01 anElement                    object reference.
         procedure division.
      *>---Set up system level Exception handler
             invoke EntryCallback "new" using
                    z"JException"
                    returning wsCallback
             end-invoke

             invoke ExceptionManager "register" using
                    javaexceptionmanager
                    wsCallback
             end-invoke

             invoke EntryCallback "new" using z"DispError"
               returning wsIterator
             end-invoke

             goback.
       
       
         entry "Jexception" using
                  lnkException
                  lnkErrorNumber
                  lnkErrorTextcollection
             .

              invoke javasup "exceptionOccurred"
                   returning theJavaException
              end-invoke

              if theJavaException not equal null
                invoke theJavaException "printStackTrace"
              end-if
           
              invoke lnkErrorTextCollection "do" using wsIterator
              goback.
             .

          entry "DispError" using anElement
            display "WARNING: JavaException: " with no advancing
            invoke anElement "display"
            display " "
            goback.
             .

To use the above code, you just have to first cut-paste to code into a file called ExceptionCatcher.cbl and include this in your project, and then add the directive INITCALL”ExceptionCatcher”, then away you go.

My test programs for the above example are:

     $set ooctrl (+p-f) case
       program-id. jtest.
       
       class-control.
             SimpleClass is class            "$JAVA$SimpleClass"
             .
       
       working-storage section.
       01 theInstance                  object reference.
       local-storage section.
       01 filler pic x.   *> dummy storage to allow the local entry
         procedure division.
      *>---Instantiate the class
             invoke SimpleClass "new" returning theInstance
       
             display "instantiated - test 1"
             invoke theInstance "TestException"

             display "instantiated - test 2"
             invoke theInstance "TestException"
             stop run.

and the Java class itself:

import java.lang.* ;

public class SimpleClass {
  public SimpleClass() { }

  public void TestException() throws Exception {
     throw new Exception ("Test error" );
  }
}

References: Studio Enterprise 6.0 Document for COBOL/Java Interop

Cheap Mobile phone tip for use in Spain

comments Comments Off
By spgennard, October 30, 2009 9:28 am

While visiting Spain/Madrid my partner finally managed to get a pay-as-you mobile that she could charge without requiring a spanish credit card, which never of us have, as we live in the UK.

Anyway, the mobile just cost €20 from Vodafone at El Corte Ingles and the phone can be topped up at ATM’s and shops.. This should hopefully cut down on our roaming charges..

Remember, you need to show a passport or the number will not be registered and you could lose it.

TomTom Xl Live and missing traffic updates

comments Comments Off
By spgennard, October 28, 2009 1:03 pm

We recently move from our trust TomTom One to the wizzy TomTom XL Live. Unfortunately some where in the update process, the TomTom live was only part activated…. basically the TomTom traffic update kept complaining the account did not have a valid subscription.

After a couple of frustrating conversations with their support the issue was identified.

The map update process had managed to zero out two important files, these being traffic.dat and tmccodes.dat. The support person said they would email the two files but I needed a quicker solution rather than waiting for the email (which so far has taken 1hr… as opposed to the 15mins that was promised).

Any the solution to is to extract these files from your downloaded maps, which will be in the TomTom Downloads area… on my mac these are found in the file “Western_Europe.zip”.

So I just extracted the files with:

mkdir tmp
cd tmp
unzip -x ../Western_Europe.zip traffic.dat tmccodes.dat

and then replaced the files in the maps/Western_Europe directory on the TomTom itself, safely unmounted the TomTom drive, reboot it… and it worked…

Online language translation services for your website

By spgennard, October 27, 2009 2:19 am

Hi,

While creating this website I looked at various widgets for translating the webpages on the fly… none of them were as easy to use as googles… so…  If you are lazy but still want people from with other countries to view your website without the aid of a translator. You could use googles web page translator via:

http://translate.google.com/translate_tools?hl=en

For user of iWeb, it could be easier just select the “HTML Snippet” drag the icon to you page, then cut-paste the html code from the page above and press “apply” and you will be left with “Select language/powered by google” widget that you move around and place it where you want…

Nice I say.. thank you google..

Panorama Theme by Themocracy