Friday, February 24, 2006

Cobol : Net Express IDE comments

Ever noticed how the comments display as actual commands even though you have an "*" in column 7 and you chose a special colour for the comments under "Options / Customize IDE / Colors" ?

The solution is to go to "Options / Edit" and set the left margin to 7.

Now you have comments that actually look like comments!

Enjoy!

Friday, February 17, 2006

Cobol : Conditional compile / debug

DISPLAY messages are often useful in a development system but you most certainly don't want them in a production environment.

You can do this by setting a "D" in column 7. From the manual:

"A debugging line is any line with a "D" in column 7. It is only permitted in the program after the OBJECT-COMPUTER paragraph.

A debugging line will be considered to have all the characteristics of a comment line if the WITH DEBUGGING MODE clause is not specified in the SOURCE-COMPUTER paragraph."

e.g. SOURCE-COMPUTER. MainFrame WITH DEBUGGING MODE.

Enjoy!

Cobol : Creating a logging file for standard out and standard error

Often you want to send a log file to stdout so you can then redirect it to wherever.

In Cobol, you can use:

SELECT OUTPUT-LOG ASSIGN ':CO:'

where:

:CO: is standard output (stdout)

These can also be used:

:CI: is standard input (stdin)

and

:CE: is standard error (stderr)

Enjoy!

SOAP : TCPMON - trace SOAP messages

This can also be done with Ethereal but that requires some TCP/IP knowledge.

Download tcpmon.jar from here

and run as:

java -jar tcpmon.jar

This will bring up the screen with:

Local Port: 8080
Server Name: 127.0.0.1
Server Port: 80

Assume that the web service address that the client uses is

http://a.b.c.d:9090

Change this in the client to

http://localhost:8080

Then change the Server Name to a.b.c.d and change the Server Port to 9090.

Then "Add Monitor"

So now your client will send to port 8080 and tcpmon will pick this up and redirect to a.b.c.d:9090 thus trapping the messages and then displaying them

Enjoy!