From: John R. C. <jo...@we...> - 2007-01-10 22:22:48
|
Rildo Pragana, the author emeritus of TinyCOBOL, tells me that the two compilers were both based on his original work. Just for fun I took an indexed sequential file created in Tiny and read it sequentially in a program compiled with Open Cobol. It ran without incident. So it should be feasable to use either compiler, or both, in the same application. There are differences of course. Tiny is built to the COBOL 85 standard and Open has implemented some features of 2002. And Tiny has both positional accept/display and also the official COBOL screen section. But the features and syntax largely overlap, and that is as it should be. What both lack is a jazzy GUI for the Pepsi Generation. But Rildo has written and tested an interface with Tcl/Tk. It requires a C program he wrote as an intermediate between the two. The COBOL program is in charge and calls the Tcl/TK program. This is the natural tendency for those of us raised on COBOL at our mother's knee. But I see virtues in putting Tcl/Tk on top, and using the expectk version of the Tcl/Tk program. Specifically I will be writing applications where a simple Tcl/Tk or expectk menu will call different scripts/programs and the interactive ones will consist of an expectk screen and a COBOL program spawned by it that does the heavy lifting. Long tcl programs are not very readable and there is little or no data typing in tcl. A full application written in any Tcl variant would be difficult to debug. Let me explain a bit about the history. Originally Tcl was written as a powerful scripting language for ad hoc and "glue" applications. It was expanded in two directions. When the Tk toolkit was added it became Tcl/Tk with a topnotch graphical interface. When Don Libes added his expect code it became a language that could interact with interactive applications like fsck and ftp. Add the two extensions together and you have expectk, a language that can both handle a fine GUI screen and interact with a command line interactive program that it spawns. There is no linking step required, just conversation back and forth using stdin and stdout. I have just written my first expectk over COBOL toy. The expectk script spawns the COBOL program. That program sends a string "Hello world" to the script which replies with the string "goodbye". The COBOL program writes the "goodbye" string to a file. Then the COBOL program sends the string "exit" and the script exits. So the interaction between GUI-capable script language and the COBOL program works without any intermediate programming or any linking. Here is the test script: #!/usr/bin/expectk spawn testcob expect { "llo" {exp_send "goodbye\r"} "xit" {exit} } exit And here is the PROCEDURE DIVISION: 001-MAIN-PROCEDURE. OPEN OUTPUT OUTFILE. DISPLAY "Hello world". ACCEPT OUTFIELD. WRITE OUTREC. DISPLAY "exit". CLOSE OUTFILE. STOP RUN. Note that the script does different things depending on what is sent to it. Error messages could be sent to it and these would then cause a specific field to be highlighted and so on. All in all it seems to be a very practical combination of tools. -- John Culleton Able Indexing and Typesetting Precision typesetting (tm) at reasonable cost. Satisfaction guaranteed. http://wexfordpress.com |