Subject: New website I have reconstructed the OpenCOBOL website at http://www.opencobol.org/. As you can see, most pages are still under development. Please let me know if you can help maintaining this site. ---------------------------------------------------------------- yes, I am interesting for it. :-o ---------------------------------------------------------------- Subject: write/print controls I have been using opencobol on my gentoo machine to do my school work for a file structures class. In my school projects, we are required to print an underline record to a report file by printing the text line then on the same line printing the '_' char so when printed it appears that the text is underline. This is done by printing the underline line with the 'AFTER ADVANCING 0 LINES' clause. Using shed, I inspected the resulting file after running the program and there does not appear to be a control character at the end of the first line that would cause the second line to be overprinted on the first. Does opencobol correctly implement the 'AFTER ADVANCING 0 LINES' clause? What character is used as the overpunch char? How would I print this so the printer properly outputs the underline chars? -solid ---------------------------------------------------------------- CR+LF is usually appended to line print contents (CR = carriage return (char 13), LF = line feed (char(10). when used AFTER ADVANCING 0 LINES clause only the CR must exist. This is the expected behaviour (and observed under others implementations). there is no overpunch char. usually the out file is a select xxx assign print or assign line sequential. ---------------------------------------------------------------- Subject: Rationale behind the C code being generated? Hi, When I run OpenCOBOL on the COBOL program: IDENTIFICATION DIVISION. PROGRAM-ID. hello. PROCEDURE DIVISION. DISPLAY "Hello World!". STOP RUN. I get about 40 lines of nasty C code having to do with stack frame trickyness. I don't get: main(int argc, char *argv[]) { printf("Hello, World!\n"); } What is the rationale for that? I am familiar with the whole issue in general: I make a C-to-Java translator (jazillian.com), and I'm very familiar with a C-to-Java tool (Ephedra) that does the same kind of thing that you're doing here. The rationale there had to do with C constructs (pointers) for which there is no Java equivalent, and the ability to access arbitrary memory locations in C, which can't be done in Java. Is there a similar thing going on here? Is the OpenCOBOL design documented anywhere? Thanks, Andy ---------------------------------------------------------------- Hi Andy, COBOL allows complex control flow like this: MAIN. PERFORM A. PERFORM A THRU B. GO TO B. A. DISPLAY "A". B. DISPLAY "B". C. DISPLAY "C". STOP RUN. This will print "A" "A" "B" "B" "C". As far as I can imagine, it is hard to handle this flow without the tricky stack frame handling. Keisuke ---------------------------------------------------------------- Subject: La Sentencia Accept/Display WITH BACKGROUND-COLOR Accept Char30 Line Lx Column Cy With Update Accept Tec-Funcion From Escape Key *>- If Tecla-Enter Then If Is-Obligatorio And Char30 = Space Then Perform MsgErrorAccept Else Set Salir-On To True End-If End-If Al Compilar me tira este Error C:\MINGW\bin>CobC Helper.cob Helper.cob: In paragraph 'Aceptar-Buscador': Helper.cob:256: PERFORM statement not terminated by END-PERFORM Helper.cob:258: syntax error, unexpected WITH Helper.cob: In paragraph 'MessageOut': Helper.cob:495: syntax error, unexpected '(' Helper.cob: In paragraph 'BlankLin23': Helper.cob:499: syntax error, unexpected '(' :-o ---------------------------------------------------------------- Subject: open cobol for windows platform why dont u make a copy for windows platform.i'm sure it will be more interesting and hopefully more contribution from others cobol programmer. tq ---------------------------------------------------------------- You're free to make a copy for windows platform yourself, and to publish the result on the web to help other windows users. The author was so kind to publish the source code of open-cobol and allow redistribution with the coolest license on the planet. :-) ---------------------------------------------------------------- Using Cygwin, the port is trivial. Cygwin has all the necessary prerequisite packages. Using MingW/MSys, you need to build the prequisite packages yourself. Under both of the above follow the README. If you are talking native Win port based on VC then Sergey Kashyrin has a prepared package based on the pre-release 0.33 at : http://kiska.net/opencobol NOTE - For Cygwin/MingW, please use the 0.33 prerelease tarball at : http://www.sim-basis.de/open-cobol-0.33.tar.gz Roger While (OC developer) ---------------------------------------------------------------- Since I do my best not to use windows, I don't know much about cygwin. If someone takes the time to build this in cygwin, would someone need to have cygwin installed to run it? ---------------------------------------------------------------- Yes. If you build under Cygwin, you need the Cygwin environment to run it. Same for MinGW/MSYS. Roger ---------------------------------------------------------------- I don't agree with the premise it will be more interesting in windows, but in case I want to use this in windows with a different compiler. I forgot the name but I use a free C compiler in windows. Should this work for that? I mean if I use opencobol to convert the cobol to c and then compile that with the C compiler it should work, right? ---------------------------------------------------------------- jasorn wrote:"Since I do my best not to use windows,..." Hi there! That's the attitude - I like that! Now I do not feel that much alone anymore! Unfortunately, I was locked into the Windows-World for almost 3 years - makes me the more feel like jasorn. However I have to be realistic also. I have written a Commercial System un WinXP (because of the market requirement using ACUCOBOL GT with AcuBench. I chose ACU mainly for two reasons - it's GUI development features (which I consider to be supreme) and also the fact that it runs on Linux. I am looking to change compilers and I have 3 questions: 1) How do I develop a GUI interface with OpenCobol? 2) What index file system(s) are available? 3) Lastly - and because I have to provide the system on WinXP as well - could someone please explain to me in plain language how do I go about getting a WinXP-version going? Regards Tom ---------------------------------------------------------------- Subject: Compile errors Not sure what's going wrong here, but I ran ./configure and it went through and did it's thing. From there, I ran make and it blew up. I'm doing this under Mac OS X 10.4.4. Creating defaults.h... make all-recursive Making all in lib rm -f libsupport.a ar cru libsupport.a ar: no archive members specified usage: ar -d [-TLsv] archive file ... ar -m [-TLsv] archive file ... ar -m [-abiTLsv] position archive file ... ar -p [-TLsv] archive [file ...] ar -q [-cTLsv] archive file ... ar -r [-cuTLsv] archive file ... ar -r [-abciuTLsv] position archive file ... ar -t [-TLsv] archive [file ...] ar -x [-ouTLsv] archive [file ...] make[2]: *** [libsupport.a] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 ---------------------------------------------------------------- What's your version of "ar" ? $ ar V GNU ar 2.16.91 20060118 Debian GNU/Linux Copyright 2005 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License. This program has absolutely no warranty. ---------------------------------------------------------------- I'm not sure -- running ar V returns nothing but the usage stuff. How can I check or update it? $ ar V usage: ar -d [-TLsv] archive file ... ar -m [-TLsv] archive file ... ar -m [-abiTLsv] position archive file ... ar -p [-TLsv] archive [file ...] ar -q [-cTLsv] archive file ... ar -r [-cuTLsv] archive file ... ar -r [-abciuTLsv] position archive file ... ar -t [-TLsv] archive [file ...] ar -x [-ouTLsv] archive [file ...] ---------------------------------------------------------------- I guess there must be some way to query that on Mac OS X. Anyway, the problem is the version of "ar". Try upgrading it to something newer, and then things should work. ---------------------------------------------------------------- Use the 0.33 prerelease here : http://www.sim-basis.de/open-cobol-0.33.tar.gz Problem is that the Mac "ar" does not like creating empty archives. Fixed in 0.33. Roger While (Main OC developer) ---------------------------------------------------------------- Subject: Compile-time segmentation fault When compiling a program without any syntax errors the compiler issues a SEGMENTATION FAULT message and terminates. This program compiles and runs with ACUCOBOL in the WinXP environment. Any clues as to what could cause this problem will be appreciated. Thanks! ---------------------------------------------------------------- Not without your program. ---------------------------------------------------------------- My employer forbids me to post the original program code. However, I have constructed a small test program that acts exactly like the original program. I isolated the problem to the FILE SECTION. If the program contains a single (or any number of) SELECT statement then the segmentation fault occurs. If I remove the SELECT (and corresponding FD) the problem does not occur. I've tried every legal construction of the SELECT of which I'm aware all to no effect. The original program exhibits the same behavior: i.e., remove all SELECTs, FDs, and Procedure Division references to the files and the program (what's left) compiles and executes as expected. Here is the sample test program: IDENTIFICATION DIVISION. PROGRAM-ID. TESTPGM. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT PFILE ASSIGN TO "pfile.dat". DATA DIVISION. FILE SECTION. FD PFILE. 01 PREC PIC X(10). PROCEDURE DIVISION. 0000-DUMMY. DISPLAY "STARTING TESTPGM". DISPLAY "NORMAL PROGRAM TERMINATION". STOP RUN. PROGRAM-EXIT. EXIT. ---------------------------------------------------------------- I have the same problem. I tried to compile a simple example cobol program which reads a sequence file and write it to a relative file. I use open-cobol on debian linux. I also installed OpenCobol under cygwin (binary files) and it worked fine! Here is the compilation output: $ cobs Seq2Rel.CBL Segmentation fault $ Here is the source:
000000 IDENTIFICATION DIVISION.
000100 PROGRAM-ID.  Seq2Rel.

100000 ENVIRONMENT DIVISION.
100100 INPUT-OUTPUT SECTION.
100200 FILE-CONTROL.
100300 SELECT SupplierFile ASSIGN TO "RELSUPP.DAT"
100400       ORGANIZATION IS RELATIVE
100500       ACCESS MODE IS RANDOM
100600       RELATIVE KEY IS SupplierKey
100700       FILE STATUS IS Supplierstatus.

100800 SELECT SupplierFileSeq ASSIGN TO "SEQSUPP.DAT"
100900       ORGANIZATION IS LINE SEQUENTIAL.

200000 DATA DIVISION.
200100 FILE SECTION.

200200 FD  SupplierFile.
200300 01  SupplierRecord.
200400     02 SupplierCode           PIC 99.
200500     02 SupplierName           PIC X(20).
200600     02 SupplierAddress        PIC X(50).

200700 FD  SupplierFileSeq.
200800 01  SupplierRecordSeq.
200900    88 EndOfFile              VALUE HIGH-VALUES.
201000    02 SupplierCodeSeq        PIC 99.
201100    02 SupplierNameSeq        PIC X(20).
201200    02 SupplierAddressSeq     PIC X(50).

202000 WORKING-STORAGE SECTION.
202100 01  SupplierStatus            PIC X(2).
202200 01  SupplierKey               PIC 99.

500000 PROCEDURE DIVISION.
500100 Begin.
500200     OPEN OUTPUT SupplierFile.
500300     OPEN INPUT SupplierFileSeq.
    
500400     READ SupplierFileSeq 
500500         AT END SET EndOfFile TO TRUE
500600     END-READ
500700     PERFORM UNTIL EndOfFile
500800        MOVE SupplierCodeSeq TO SupplierKey
500900        MOVE SupplierRecordSeq TO SupplierRecord
501000        WRITE SupplierRecord
501100           INVALID KEY DISPLAY "Supplier status = " SupplierStatus
501200        END-WRITE
501300        READ SupplierFileSeq 
501400             AT END SET EndOfFile TO TRUE
501500        END-READ
501600     END-PERFORM.    

501700     CLOSE  SupplierFile, SupplierFileSeq.
501800     STOP RUN.
---------------------------------------------------------------- I assume you are trying on Linux, Please specify you OS and OS version. ---------------------------------------------------------------- I'm running kernel 2.6.13-15 SUSE 10.0. ---------------------------------------------------------------- I had the same problem too. I was using linux debian 3.1 (x86) and using opencobol 0.32 (open-cobol_0.32-1_i386.deb). I downloaded open-cobol-0.32.tar.gz from opencobol site, compiled and installed it and the problem "segmentation fault" disappeared . :-D ---------------------------------------------------------------- Would OpenCOBOL be sensitive to the version of GCC being used? My system has version 4.0.2 20050901. ---------------------------------------------------------------- I think that you are right. I'm using gcc version 3.3.6 and, after your post, I tried to use gcc 4.0.3 and got "seg fault". ---------------------------------------------------------------- Thanks for your feedback on the gcc issue. I think that I will pursue that as a possible solution. Will need to see what's involved in going backwards to a prior version or else look into having two versions of gcc. Thanks again! ---------------------------------------------------------------- Use the CVS snapshot tarball (AKA prerelease) here : http://www.sim-basis.de/open-cobol-0.33.tar.gz Whenever I update CVS, I create a prerelease tarball. (See OC mailing list on SourceForge) This has a whole bunch of fixes and changes. Roger While (Main OC developer) ---------------------------------------------------------------- I downloaded 0.33 and that seemed to resolve the segmentation fault issue. All of the test programs that I've compiled and run (so far) pass with flying colors. Thanks for the great work, Roger! Alec ---------------------------------------------------------------- I was attemping to compile and run a cobol program that involves an indexed file and was getting the segmentation fault error. After reading this thread, I installed the 0.33 prerelease as Roger mentioned in his post, but now I'm getting seg faults for all of my programs, including the more simple ones that do not involve indexed files. I will likely uninstall this newer version as it apparently is causing some problems. Any idea how I can get the seg faults to go away for my programs that involve index files? My environment is: SLES9 GCC 4.03 openCOBOL 0.32 ---------------------------------------------------------------- Redownload and install 0.33. If problems still persist, post one of the simpler programs that is segfaulting. (Also what Cobol compile options you are using) Roger ---------------------------------------------------------------- Is this still the correct url for 0.33? http://www.sim-basis.de/open-cobol-0.33.tar.gz I am not currently using any compile options. I'm simply compiling "cobc PROG1.cob" and running "./PROG1". ---------------------------------------------------------------- Yes, URL is correct. And here is your problem (with 0.33) - "I'm simply compiling "cobc PROG1.cob" and running "./PROG1"." The default when using no options is to create a module (sub-program) eg. Under Linux, PROG1.so So, either do cobc -x PROG1.cob ./PROG1 or cobc -m PROG1.cob cobcrun PROG1 Note that in 0.33, the "-m" is default and may be left out. The above was done to make usage very like MicroFocus. ---------------------------------------------------------------- The -x extension was my problem, so that fixed it. Thanks! Just to clarify-- openCOBOL 0.33 does not default to -x if you just type "cobc programName.cob"? I thought it did in previous versions. Again, thanks for the help ---------------------------------------------------------------- Indded, 0.33 does not default to "-x", it defaults to "-m". This was done to be more like MicroFocus/ACU. Always check "cobc --help" for defaults/options. ---------------------------------------------------------------- please update documentation User Manual http://www.opencobol.org/modules/bwiki/index.php?cmd=read&page=UserManual%2F1#content_1_1 does not show the -x option -pete ---------------------------------------------------------------- The Wiki specifically states that it applies to version 0.30. Options do occasionally change from release to release. Firstly, these are documented in the compiler change log (cobc/ChangeLog). Secondly, the info files are updated on each release (texi/open-cobol.info). This is the the user manual. ("man info" will give you (sic) info on using the info command) Note also that compiler defaults are noted in the help text (cobc --help). Snip from 0.33 cobc --help -x Build an executable program -m Build a dynamically loadable module (default) Finally, as it's a Wiki, you can change it yourself :-) Roger ---------------------------------------------------------------- Subject: differ in signedness Dear All, I tried to compile open-cobol 0.32 on debian Linux. I compiled the stuff and I got a lot of warnings like this: odegen.c:1450: warning: pointer targets in passing argument 1 of 'cb_encode_program_id' differ in signedness I found the same problem on a homepage at http://people.debian.org/~tbm/logs/gcc-4.1/open-cobol_0.32-1_20060320-1227 After running cobc I got a similar warning: $ cobc test.cob In file included from /tmp/cob80fRnm.c:9: /tmp/cob80fRnm.c.h:6: warning pointer targets in initialisation differ in signedness Could anyone help me to make these warning disappear? THX! ---------------------------------------------------------------- Hi, That warnings were caused by gcc version 4.0.x. Try to use gcc 3.x. To install it, use the command: apt-get install gcc-3.3 Instruct make to use gcc-3.3 and configure opencobol to use gcc-3.3 also: cd open-cobol-0.32 export CC=gcc-3.3 ./configure --enable--debug --with-cc=gcc-3.3 make make install I think it will work without that warnings. regards. ---------------------------------------------------------------- Use the 0.33 prerelease here : http://www.sim-basis.de/open-cobol-0.33.tar.gz Roger While (Main OC developer) ---------------------------------------------------------------- Subject: configure: error: GMP 3 or later is required I have GMP 4.x installed and I'm getting this error message when I do the configure ---------------------------------------------------------------- I assume you are referring to 0.32. Pick up the CVS snapshot tarball (AKA prerelease) at : http://www.sim-basis.de/open-cobol-0.33.tar.gz This has a whole load of fixes. Whenever I update CVS, this trball is also updated and notification is posted to the OC list over on SourceForge. Roger While (OC developer) ---------------------------------------------------------------- Hi Roger, I am still getting the GMP 3 configure error on my system with the the open-cobol-0.33.tar.gz. My system is SUSE 10.1 with the latest GMP 4.X built from source code. I did manage to create a workaround for my issue. I commented out the requirement in the configure.ac file and then rebuild the configure script. It passes all of the "make check" tests so I think I have a working version. Just a FYI.... James Robinson ---------------------------------------------------------------- Hmmm. Actually we should not be relying upon certain internal entry points at all. Better is this in configure.ac - # Checks for gmp. AC_CHECK_HEADERS([gmp.h], , AC_MSG_ERROR(gmp.h is required)) MYOLDLDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -lgmp" AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ mpz_t myvar; mpz_init (myvar); ]])], [], [AC_MSG_ERROR(GMP 3 or later is required)], []) LDFLAGS="$MYOLDLDFLAGS" LIBCOB_LIBS="$LIBCOB_LIBS -lgmp" I'll get this fixed up and upload the tarball later today. Should be there (May 24) at latest 17:00 Central European Time. Roger ---------------------------------------------------------------- Well, the tarball is there but I am going to have to rethink this. It does not work under Cygwin because of the vagueries of AC_TRY_RUN on Winbloze systems. Reverted to entry point check. Check for entry point __gmp_randinit which is in all versions of GMP from 3 upwards upto and including current 4.2.1 Tarball updated. Roger ---------------------------------------------------------------- Hi, I'm using macosx 10.4.6 and encountered the gmp 3 or later is reguired message. So i downloaded opencobol 0.33 and tried to configurel that version but then i got: configure: error: libdb is required So i installed libdb 4.4.20 but still got the same error any help would be apreciated the error: checking db.h usability... yes checking db.h presence... yes checking for db.h... yes checking db_185.h usability... no checking db_185.h presence... no checking for db_185.h... no checking db3/db_185.h usability... no checking db3/db_185.h presence... no checking for db3/db_185.h... no checking db4/db_185.h usability... no checking db4/db_185.h presence... no checking for db4/db_185.h... no checking db4.1/db_185.h usability... no checking db4.1/db_185.h presence... no checking for db4.1/db_185.h... no checking db4.2/db_185.h usability... no checking db4.2/db_185.h presence... no checking for db4.2/db_185.h... no checking db4.3/db_185.h usability... no checking db4.3/db_185.h presence... no checking for db4.3/db_185.h... no checking db4.4/db_185.h usability... no checking db4.4/db_185.h presence... no checking for db4.4/db_185.h... no checking db4.5/db_185.h usability... no checking db4.5/db_185.h presence... no checking for db4.5/db_185.h... no checking for __db_open in -ldb-4.5... no checking for dbopen in -ldb-4.5... no checking for __db_open in -ldb-4.4... no checking for dbopen in -ldb-4.4... no checking for __db_open in -ldb-4.3... no checking for dbopen in -ldb-4.3... no checking for __db_open in -ldb-4.2... no checking for dbopen in -ldb-4.2... no checking for __db_open in -ldb-4.1... no checking for dbopen in -ldb-4.1... no checking for __db_open in -ldb-4... no checking for dbopen in -ldb-4... no checking for __db_open in -ldb... no checking for dbopen in -ldb... no configure: error: libdb is required ---------------------------------------------------------------- Did you specify --enable-compat185 to BDB configure ? Did you specify --prefix=/usr to BDB configure ? The default install paths for BDB are peculiar, therefore you either need the BDB --prefix or you have to fiddle around with flags specifying the include and lib paths to the OC configure. (BDB configure --help gives BDB details) (OC ./configure --help gives OC details) Roger ---------------------------------------------------------------- thanks, no I had not specified them, but now i did and configure worked but I got another error using make /bin/sh ../libtool --tag=CC --mode=link gcc -fsigned-char -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-format-y2k -DSUPER_OPTIMIZE -O2 -finline-functions -fomit-frame-pointer -o libcob.la -rpath /usr/local/lib -version-info 1:0:0 -no-undefined libcob_la-common.lo libcob_la-move.lo libcob_la-numeric.lo libcob_la-intrinsic.lo libcob_la-termio.lo libcob_la-fileio.lo libcob_la-screenio.lo libcob_la-strings.lo libcob_la-call.lo -lm -lgmp -lncurses -ldb-4.4 gcc -dynamiclib -o .libs/libcob.1.0.0.dylib .libs/libcob_la-common.o .libs/libcob_la-move.o .libs/libcob_la-numeric.o .libs/libcob_la-intrinsic.o .libs/libcob_la-termio.o .libs/libcob_la-fileio.o .libs/libcob_la-screenio.o .libs/libcob_la-strings.o .libs/libcob_la-call.o -lm /usr/local/lib/libgmp.a -lncurses /usr/lib/libdb-4.4.dylib -install_name /usr/local/lib/libcob.1.dylib -Wl,-compatibility_version -Wl,2 -Wl,-current_version -Wl,2.0 ld: common symbols not allowed with MH_DYLIB output format with the -multi_module option /usr/local/lib/libgmp.a(mp_bpl.o) definition of common ___gmp_junk (size 4) /usr/bin/libtool: internal link edit command failed make[2]: *** [libcob.la] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 Rene ---------------------------------------------------------------- Something wrong wiith the GMP build/install - On the gcc line -> /usr/local/lib/libgmp.a This is wrong, it should be picking up the dylib. Need info on the GMP configure/make (config.log and make/make install output) Roger ---------------------------------------------------------------- Actually, researching shows that it is a GMP problem. Follow this thread - http://swox.com/list-archives/gmp-bugs/2006-April/000383.html It "may" be fixed in current GMP release (4.2.1) Will look more closely later. Roger ---------------------------------------------------------------- No, I do not think it is fixed in 4.2.1 I have a patched version which "may" work here - http://www.sim-basis.de/gmp-4.2.1.tar.gz Mail the config.log and the output from the make. Of course, you DID do what the GMP INSTALL says and ran "make check" ? Do it. Roger ---------------------------------------------------------------- Alternatively, when building GMP, you can do - ./configure CC='gcc -fPIC' Roger ---------------------------------------------------------------- thanks, where should I mail it to? rene ---------------------------------------------------------------- Hop over to OpenCOBOL at SourceForge and click on my Userid. Roger ---------------------------------------------------------------- Can you also post a ls -lai /usr/local/lib after the "make install" of GMP. Roger ---------------------------------------------------------------- According to the GMP mailing lists, you may need also to add the following to the configure - --enable-cxx --enable-shared Roger ---------------------------------------------------------------- And you may also need a export ABI=32 before you do the GMP configure. More info on the GMP mailing lists. Roger ---------------------------------------------------------------- Roger, I just send you an email. I have not tried your latest sugestions yet Rene ---------------------------------------------------------------- Hi, Im getting this error as well om Solaris 2.8: checking for gmp.h... yes checking for __gmp_randinit in -lgmp... no configure: error: GMP 3 or later is required This is happenning with open-cobol-0.32 and the open-cobol-0.33 I found in this forum. Any other ideas? Thanks, Leslie ---------------------------------------------------------------- Something wrong with the gmp installation. Did you gen gmp yourself ? Check in /usr/local/lib and /usr/lib for gmp shared libraries eg. ls -lai /usr/local/lib/libgmp* ls -lai /usr/lib/libgmp* If you just see libgmp.a, that's no good. Recheck the gmp installation. Roger ---------------------------------------------------------------- hello friend, this error is because of you installed gmp 4 try gmp 3.x you will get your open cobol configured ---------------------------------------------------------------- Hi, I did recompile the gmp, and I do have libraries in /usr/local/lib. When I configure open-cobol-0.33, I get the error "configure: error: GMP 3 or later is required". As someone pointed out, I may need to install gmp 3.x which I would be happy to do, if I can find it. I don't see it on the gmp site Any Ideas? Leslie ---------------------------------------------------------------- The 0.33 prerelease at : http://www.sim-basis.de/open-cobol-0.33.tar.gz has been tested with several different versions of BDB including the latest (4.4.20) and also several different versions of GMP including the latest (4.2.1). Roger ---------------------------------------------------------------- I've downloaded this new version, and I am still getting configure errors: checking for getopt_long_only... no checking gmp.h usability... yes checking gmp.h presence... yes checking for gmp.h... yes checking for __gmp_randinit in -lgmp... no configure: error: GMP 3 or later is required It has to be something in my enviroment, but I don't know what it could be. Thanks, Leslie ---------------------------------------------------------------- What does ls -l /usr/lib/libgmp* ls -l /usr/local/lib/libgmp* show? ---------------------------------------------------------------- ls -l /usr/lib/libgmp* /usr/lib/libgmp*: No such file or directory ls -l /usr/local/lib/libgmp* -rw-r--r-- 1 root other 2966876 Jul 31 15:48 /usr/local/lib/libgmp.a -rwxr-xr-x 1 root other 693 Jul 31 15:48 /usr/local/lib/libgmp.la lrwxrwxrwx 1 root other 15 Jul 31 15:48 /usr/local/lib/libgmp.so -> libgmp.so.3.3.2 lrwxrwxrwx 1 root other 15 Jul 31 15:48 /usr/local/lib/libgmp.so.3 -> libgmp.so.3.3.2 -rwxr-xr-x 1 root other 1708064 Jul 31 15:48 /usr/local/lib/libgmp.so.3.3.2 ---------------------------------------------------------------- This on a Linux box ? If so, why did you not use the distro's GMP ? - This would be installed in /usr/lib. Did you configure/make/install GMP yourself ? If on Linux, try doing "ldconfig" as root. If not on Linux, then it is likely that /usr/local/lib is not in the default library search path. If so, then various options - 1) Consult system documentation to get /usr/local into the default search path for includes/libs. 2) Reconfigure/make/install GMP with "--prefix=/usr" 3) Consult the output from OC's "./configure --help" Roger ---------------------------------------------------------------- Subject: Dynamic calls from COBOL to a C++ DLL I'm trying to write a COBOL program that calls into a DLL. The User Manual appears to cover calling a stand-alone module. When I run, I'm getting the message: libcob: LoadLibrary/GetProcAddress error 127. Can somebody point me in the right direction? Thanks, Ed ---------------------------------------------------------------- OK This was a Windows/VS 8.0 issue. 1) instead of -l name.dll like cobc says, MS changed the parm so the new syntax is -link name.dll. 2) In the DLL, the non-mangled name was not exported. I had to go into Linker Input and specify a Module Definition File. Side qustion.. Anybody know how to get rid of my duplicate post? ---------------------------------------------------------------- I thought you could do it yourself. Maybe not, must ask Keisuke. Anyway, I've got rid of it. Roger ---------------------------------------------------------------- Subject: buffer overflow I have a problem compiling any program with a select statement in it. Any help or suggestions would be appreciated. opencobol 0.32 ar 2.16.91.0.6 fedora core 5 kernel 2.6.16-1.2122_FC5 gcc version 4.1.1 Please ask if any other program version #'s are needed. Here is my program: IDENTIFICATION DIVISION. PROGRAM-ID. TESTPGM. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT PFILE ASSIGN TO "pfile.dat". DATA DIVISION. FILE SECTION. FD PFILE. 01 PREC PIC X(10). PROCEDURE DIVISION. 0000-DUMMY. DISPLAY "STARTING TESTPGM". DISPLAY "NORMAL PROGRAM TERMINATION". STOP RUN. PROGRAM-EXIT. EXIT. And here is the output: [krisda@programmer0 dev]$ cobc TESTPGM.cbl *** buffer overflow detected ***: cobc terminated ======= Backtrace: ========= /lib/libc.so.6(__chk_fail+0x41)[0x77e2b1] /lib/libc.so.6(__vsprintf_chk+0x0)[0x77db48] /lib/libc.so.6(_IO_default_xsputn+0x9c)[0x702817] /lib/libc.so.6(_IO_vfprintf+0x93c)[0x6dc955] /lib/libc.so.6(__vsprintf_chk+0xa1)[0x77dbe9] /lib/libc.so.6(__sprintf_chk+0x30)[0x77db3c] cobc[0x80667d0] cobc[0x8067fa4] cobc[0x8069658] cobc[0x804a798] /lib/libc.so.6(__libc_start_main+0xdc)[0x6b7724] cobc[0x80491a1] ======= Memory map: ======== 00684000-00685000 r-xp 00684000 00:00 0 [vdso] 00685000-0069e000 r-xp 00000000 03:04 3606285 /lib/ld-2.4.so 0069e000-0069f000 r-xp 00018000 03:04 3606285 /lib/ld-2.4.so 0069f000-006a0000 rwxp 00019000 03:04 3606285 /lib/ld-2.4.so 006a2000-007cf000 r-xp 00000000 03:04 3606293 /lib/libc-2.4.so 007cf000-007d1000 r-xp 0012d000 03:04 3606293 /lib/libc-2.4.so 007d1000-007d2000 rwxp 0012f000 03:04 3606293 /lib/libc-2.4.so 007d2000-007d5000 rwxp 007d2000 00:00 0 076a7000-076b2000 r-xp 00000000 03:04 3604505 /lib/libgcc_s-4.1.1-20060525.so.1 076b2000-076b3000 rwxp 0000a000 03:04 3604505 /lib/libgcc_s-4.1.1-20060525.so.1 08047000-08088000 r-xp 00000000 03:04 986576 /usr/bin/cobc 08088000-0808b000 rw-p 00040000 03:04 986576 /usr/bin/cobc 0808b000-08093000 rw-p 0808b000 00:00 0 0826e000-0828f000 rw-p 0826e000 00:00 0 [heap] b7d19000-b7f19000 r--p 00000000 03:04 986421 /usr/lib/locale/locale-archive b7f19000-b7f1a000 rw-p b7f19000 00:00 0 b7f24000-b7f26000 rw-p b7f24000 00:00 0 bfe10000-bfe25000 rw-p bfe10000 00:00 0 [stack] Aborted [krisda@programmer0 dev]$ ---------------------------------------------------------------- Moving up to the 0.33 prerelease should fix this. Download at : http://www.sim-basis.de/open-cobol-0.33.tar.gz Roger (OC Developer) ---------------------------------------------------------------- Subject: DISPLAY AND ACCEPT WITH SIZE OPTION. I am amenable to additions/fixes :-) (preferably against CVS/prerelease). Roger ---------------------------------------------------------------- Why don't have Display and Accept statements the size option ? example: ACCEPT ..... LINE 1 COLUMN 1 SIZE 01 DISPLAY ..... LINE 1 COLUMN 1 SIZE 01 thank you. ---------------------------------------------------------------- Subject: OpenCOBOL 0.33 release forthcoming OpenCOBOL 0.33 is going to be released this month in whatever state it is in ! I recommend getting the prerelease at : http://www.sim-basis.de/open-cobol-0.33.tar.gz Note - This is usually a bit ahead of CVS over at SourceForge. Changes are made to the tarball as and when I think they should be applied. Do NOT rely on programs compiled with an earlier version running with a new tarball. The CVS/tarball are prerelease and, as such, ALWAYS recompile application programs. (And that means that programs compiled with a tarball from yesterday will NOT necessarily run with a tarball from today) Please test and post comments. Roger While (Main OpenCOBOL developer) ---------------------------------------------------------------- Subject: FAQ - Multiple OpenCOBOL on one machine Can I test OpenCOBOL versions alongside a production (installed) version ? (Applies to 0.33) Sure. Just do the usual > ./configure > make in the directory where the new OC source is (eg. /home/20060608/open-cobol-0.33) and STOP there without doing a "make install". (You can of course do a "make check") Then if you want to use this version - . /home/20060608/open-cobol-0.33/tests/atconfig . /home/20060608/open-cobol-0.33/tests/atlocal Note the "." at the start, this changes your environment to work with the "test" version of OC IN THE CURRENT shell. Do NOT try to mix executables/modules produced by one version of OC with another. I recommend using the (0.33) --with-patch-level=n (default 0) option to the "./configure" to distinguish between installations. This will make sure that no program/module will be executed that has not been compiled with the correct version. (Do NOT do this for a production install) All the above will be added to a FAQ in final release. Roger While (Main OC developer) ---------------------------------------------------------------- Subject: Final call - Please test 0.33 prerelease Per subject at : http://ww.sim-basis.de/open-cobol-0.33.tar.gz Comments here or over at SourceForge. Roger (Main OC Developer) ---------------------------------------------------------------- i m using osx 10.4.6 got error msg as below: /bin/sh ../libtool --tag=CC --mode=link gcc -fsigned-char -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-format-y2k -DSUPER_OPTIMIZE -O2 -finline-functions -fomit-frame-pointer -o libcob.la -rpath /usr/local/lib -version-info 1:0:0 -no-undefined libcob_la-common.lo libcob_la-move.lo libcob_la-numeric.lo libcob_la-intrinsic.lo libcob_la-termio.lo libcob_la-fileio.lo libcob_la-screenio.lo libcob_la-strings.lo libcob_la-call.lo -lm -ldb-4.4 -lgmp -lncurses gcc -dynamiclib -o .libs/libcob.1.0.0.dylib .libs/libcob_la-common.o .libs/libcob_la-move.o .libs/libcob_la-numeric.o .libs/libcob_la-intrinsic.o .libs/libcob_la-termio.o .libs/libcob_la-fileio.o .libs/libcob_la-screenio.o .libs/libcob_la-strings.o .libs/libcob_la-call.o -lm /usr/lib/libdb-4.4.dylib /usr/local/lib/libgmp.a -lncurses -install_name /usr/local/lib/libcob.1.dylib -Wl,-compatibility_version -Wl,2 -Wl,-current_version -Wl,2.0 ld: common symbols not allowed with MH_DYLIB output format with the -multi_module option /usr/local/lib/libgmp.a(mp_bpl.o) definition of common ___gmp_junk (size 4) /usr/bin/libtool: internal link edit command failed make[2]: *** [libcob.la] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 any clues? thanks ---------------------------------------------------------------- Yep. Your GMP installation is borked and/or you have wrong environment/options to the OC configure. What is the "/usr/local/lib/libgmp.a" doing there ? This is wrong, there is no default reference to the static GMP library. Roger ---------------------------------------------------------------- Roger. I, as like as other people, always appreciate your contribution. I tried test 0.33 on my PC which is uing Windows 2000, MinGW, MSYS, and Berkeley DB 4.4.20. And I got the following configure error. libdb is required. ---------------------------------------------------------------- Well, the relevant part or all of the "config.log" would help :-) When you configured BDB, you did remember to specify --enable-compat815 --enable-mingw ?? And you probably need a --prefix= as well as BDB does not install in the usual directories. Also make sure you install into the MinGW environment (which is usually seperate to the MSYS environment). Roger ---------------------------------------------------------------- I've kinda just started but I'm using .33 to compile some utility programs I wrote ages ago. So far pretty painless. ---------------------------------------------------------------- Subject: Passing parameters to main program I'm trying to compile a program that has a using clause on the procedure division but I get the error message below. The program is just hello world with a linkage section and using on the procedure division. cobc gives me : hello.cob:14: Error: Executable program requested but PROCEDURE/ENTRY has USING clause How do you pass parameters to the main program? ---------------------------------------------------------------- The MicroFocus extensions to do this are implemented. See the ACCEPT/DISPLAY syntax for COMMAND-LINE ARGUMENT-NUMBER ARGUMENT-VALUE. There are also extensions (ACU/MF) for getting/setting environment values. The MF language reference is online at www.microfocus.com (Support->Product Documentation, then one of the Server Express, ->Language Reference) Roger ---------------------------------------------------------------- Thanks for the reply. That should work for me. Not exactly what I was hoping for but it's not so bad. ---------------------------------------------------------------- I am not sure what you were hoping for! You might also like to look at the CHAINING (ACU Cobol) clause. This is supported in the 0.33 prerelease. Roger ---------------------------------------------------------------- What was I hoping for? Oh, I have some mainframe cobol programs that take parameters from jcl. They pass them via linkage section and the using clause on the procedure division. I was hoping I wouldn't have to modify the source code but could use them as they are and the parameters would be passed the same way. I know using the accept clause instead isn't a big change but a change nontheless. I'm going to open source them and now I'll have to have two versions. Update: I suppose it would be easy enough to create a stub model just for the purpose of passing the command line to the first REAL program. That would way I could use the same exact source. btw, ACCEPT xxxx FROM COMMAND-LINE is simple enough. ---------------------------------------------------------------- I found this: "PROCEDURE DIVISION USING BY CONTENT etc. † ↑ Parameter passing to the main program † If a main program has a USING clause, how should we pass parameters to it? Command line arguments or environment variables? What other compilers do? Note (Roger) - We now have the MF extended ACCEPT/DISPLAY syntax to reference command line argumants and manipulate environment variables." So you did know what I was hoping for! :) Since the ACCEPT FROM COMMAND-LINE works well, it seems it wouldn't be such a hard thing to reuse the code and do the same basic thing when there is a USING clause and it's being compiled with '-x'. Perhaps there are bigger fish to fry but I think it would be worth keeping this on the list. ---------------------------------------------------------------- Well, the problem is that the standard has seen fit to ignore interaction with the environment (85, 2002 and 2008). So, everybody did/does their own thing. Generally speaking, it is wrong to have a PROCEDURE USING in a main (executable) program. Roger ---------------------------------------------------------------- I see. In the mainframe world I have quite a few MAIN programs that can call one another and they all have PROCEDURE USING. So will ACCEPT work to pass parameters between MAIN programs? ---------------------------------------------------------------- Then they are not MAIN progs are they ? :-) Roger ---------------------------------------------------------------- Sure they are. Just like in most other languages. Take C for instance. You can run a C program as a stand alone program or call it from another program. You can do this in most languages. Perhaps I wasn't clear on how you were using the term 'MAIN'. I understood we were talking about MAIN as in what is commonly referred to as stand alone or what would make up the executable. If that's the definition we're using, then yes, they are MAIN programs. I don't know what other definition you'd have for MAIN. At any rate, MAIN programs should be able to call each other and pass data back and forth. I was just asking how you pass data between main programs. ---------------------------------------------------------------- Ok. The combination of the ACCEPT statement to get values passed via the command line and making variables EXTERNAL gives the same basic functionality and works well. And I read a bit about there being no standard on the mechanism of programs calling each other. Seems funny to me that wouldn't be in the standard. Oh well. So now the question is, "Is there a performance benefit/cost to using external variables instead of linkage?" ---------------------------------------------------------------- I think you are mixing apples, oranges and pears here :-) The ACCEPT for environment values has nothing to do with the EXTERNAL declaration. Neither of these have anything to do with the mechanism of program calling (which IS well defined in the standard, as is EXTERNAL). To the question, well that depends on what you want to do :-) Simple example showing difference : Progs A and B both want to call prog C and pass info in "myfield". Scenario 1 with EXTERNAL Progs A, B and C all have eg in WORKING 01 myfield pic ... EXTERNAL. Progs A and B fill myfield and do CALL "C". Scenario 2 with LINKAGE Progs A and B have eg. in WORKING 01 myfield pic .... Progs A and B fill myfield and do CALL "C" USING myfield. Prog C has LINKAGE myfield and PROCEDURE USING myfield In scenario 1, note that myfield is the SAME storage area for all progs, so that changes made by prog A will be seen by prog B and vice-versa. (And of course by prog C) Possible problem here is that some prog (eg. A or B) forgets the EXTERNAL attribute in which case C is operating on a freshly initialized storage area (And you will not know it). In scenario 2, the areas being passed to C are distinct. Possible problem here is that the calling prog forgets to pass the parameter (CALL "C"), in which case you get all you asked for :-) Personally, I can only think of (maybe) one reason to use EXTERNAL and that is with a heavily nested call sequence. eg Prog A calls Prog B calls Prog C calls Prog D ... and the last Prog needs some info from Prog A. (However this is frought with danger as you must make sure that the last program is only reachable through the call sequence from Prog A). Roger ---------------------------------------------------------------- Roger, I can see how you'd think I'm mixing apples and oranges but I know pretty well how external files and data and linkage works. My problem is I worked so long with cobol that allows USING on the PROCEDURE DIVISION I forgot all about the possibility of using EXTERNAL in COBOL. I have several utility programs I created years ago that make use of USING on the PROCEDURE DIVISION for both main and subprograms. Mostly it has to do with how control data is passed to the program. e.g. I have a string replacement program. It can be used in 3 different 'modes' if you will. The format of the parm passed to it is ';STRING1;STRING2;' where the first ';' is the delimiter to be used to delimit the rest of the parm, STRING1 = the string that will be replaced by STRING2 and STRING2 is the string that will replace STRING1. This parm can be a couple thousand bytes long. STRING1 and STRING2 can be repeated as needed. Modes 1. Called as the MAIN program where the PARM isn't too long and is passeed either via JCL parm or command line. On the MAINFRAME this only works if there aren't too many string to be replaced because the PARM can only be 100 bytes long. On other platforms where the command line PARMS can be longer, this isn't very practical when there are too many strings to be replaced. 2. Called as the MAIN program where the PARM is too long to really be practical or even possible depending on the platform so it will be read in from a file. In this mode, the PARM is passed via the command line or JCL but the first byte of the PARM(the only byte that is used in this situation) is an 'F' to indicate the PARM data is being read from a file. One of the first things the program does is check the first byte of the parm. If it's an 'F' it then reads the parm file and process each row as if the program were called one per line in the file. If it's not an 'F' the program continues like normal. 3. Called from another MAIN program. In this mode the program that calls the string replacement program and passes a PARM in the format discussed in either 1 or 2 above. This makes the program more flexible. By the way, this is a pretty common way of passing parameters in the computing world. For instance many of the *nix utility programs can be called from other programs and can take command line parms and have a command line parm that means, "read the parm to act on from a file." So, that's the behavior I want to keep for these programs when I convert them for use in linux. That's where ACCEPT from COMMAND line and EXTERNAL varialbes come in. By just changing a few lines of code in each program, I can use this combination to pass data from both the command line and between main programs. While I'd rather just be able to use 'USING' on the procedure division in the MAIN program, this will work well enough for my needs and won't be TOO big of a bear when I make changes on one platform and want to sync of the code of the different platforms. As you pointed out there are pitfalls to look out for. They shouldn't cause me any problems. It's pretty typical for me to work on systems with hundreds of COBOL programs calling each other so I check my linkage section pretty well. It's also relatively common in these systems that every program gets passed the exact same linkage section. In this case I'll just treat the external variables very much like they are linkage. Since I won't be using a linkage section on the non mainframe versions, I'll likely keep them in the linkage section but comment out the LINKAGE SECTION line so they're really WORKING STORAGE. So basically, many of the COBOL programs I write take PARMS, can be used as stand alone or called from another program, and take a switch that is used to indicate that the REAL parm is to be read from a file. I don't want to change that. Actually, when I design a program this is the default and I have to find a reason not to build this functionality in. And if you can't use USING on a MAIN program, this seems to be the only way to accomplish this. Is there another? Jason ---------------------------------------------------------------- I decided to just create a program that takes in the name of a program to call and the paramater you want to pass to it. This will let me use the same source for the mainframe, windows, and linux platforms. So in the non mainframe world, this program is the program that gets called first. It in turns calls the program you tell it. It's a simple enough program but if anyone likes, post here and I'll send the source. At some point, I'll probably make a patch to enable this to work as it does in the mainframe. Until I do or someone else does, this is a pretty painless work around. Jason ---------------------------------------------------------------- I think I know where you are heading but it won't work. PROCEDURE USING is defined/reserved for called programs. It is NOT a way to pass runtime parameters. Maybe it did work on some mainframe install but we will not take this over (and it will NOT work with eg. MF or ACU). One way of passing runtime params is using CHAINING which is an ACU extension supported by OC. Also consider (abbreviated) : LINKAGE. 01 MYFLD .. PROC DIV. ENTRY "MYENT" USING MYFLD. and LINKAGE. 01 MYFLD .. PROC DIV USING MYFLD2. ENTRY "MYENT2". or any derivation of the above. The basic problem is, as I said, lack of standards. We will NOT/NEVER interpret PROC USING params as command line params UNLESS the CHAINING command is used. Roger ---------------------------------------------------------------- Subject: FOSS ISPF like editor I'm just guessing there are at least some mainframers here who'd rather edit cobol programs in an ispf type editor. Well here's a free one I've used in linux and windows. The author actively maintains it and is responsive. This is the only free editor I've seen that's pretty close to the ispf editor. I'm posting here just because I haven't seen this in many of the free editor sites I've seen and figure you might not have heard of it. http://www.geocities.jp/sakachin2/index.htm ---------------------------------------------------------------- If you give this a try please post here and let us know how it went. ---------------------------------------------------------------- This editor, in my humble opinion, is getting closer and closer to ispf as far as the editor stuff is concerned. Some of the recent updates to this editor include: * Typematic support for Right-Control key(can be used as newline) * Crosshair support * Linux version is now packaged by libtool to enable installing from source by "./configure && make" * bounds support * text flow support * large file support >4g * find support added to the directory lists. * added 3.12 & 3.14 interface to the file search and file compare that comes with gxe. not exactly like the mainframe versions but kinda similar. ---------------------------------------------------------------- Subject: DISPLAY ... UPON STDERR I can't figure out how to send the display to stderr. Display ... upon stderr gives me -> warning: 'stderr' undefined in SPECIAL-NAMES Same thing with syserr. If I define it in special-names, the compile is clean, but nothing comes out anywhere. What am I missing? Thanks in advance. Never mind... Just tried it with 0.33 and it works great. ---------------------------------------------------------------- Yep, 0.33 is light-years ahead of 0.32 :-) (That's why it is taking so long to get the release out) I will put together a post with the 0.33 features in the near future. In the meantime you can peruse the ChangeLog file in each directory (top level included) Roger ---------------------------------------------------------------- Subject: INTRINSIC FUNTIONS I noticed that the documentation says that intrinsic functions aren't implemented so I took the ones I was using out. Turns out I forgot some but they worked just fine. Aren't intrinsic functions the things you call like this? FUNCTION UPPER-CASE('Hello World') ---------------------------------------------------------------- They are implemented in 0.33. And, yes, that is a valid example. If, after the usual configure/make, you run "make check", you see the OC tests for FUNCTION's ala: 99: FUNCTION ABS ok 100: FUNCTION ACOS ok 101: FUNCTION ANNUITY ok 102: FUNCTION ASIN ok 103: FUNCTION ATAN ok 104: FUNCTION CHAR ok 105: FUNCTION COS ok 106: FUNCTION DATE-OF-INTEGER ok 107: FUNCTION DATE-TO-YYYYMMDD ok 108: FUNCTION DAY-OF-INTEGER ok 109: FUNCTION DAY-TO-YYYYDDD ok 110: FUNCTION EXCEPTION-FILE ok 111: FUNCTION EXCEPTION-LOCATION ok 112: FUNCTION EXCEPTION-STATEMENT ok 113: FUNCTION EXCEPTION-STATUS ok 114: FUNCTION EXP ok 115: FUNCTION FACTORIAL ok 116: FUNCTION FRACTION-PART ok 117: FUNCTION INTEGER ok 118: FUNCTION INTEGER-OF-DATE ok 119: FUNCTION INTEGER-OF-DAY ok 120: FUNCTION INTEGER-PART ok 121: FUNCTION LENGTH ok 122: FUNCTION LOG ok 123: FUNCTION LOG10 ok 124: FUNCTION LOWER-CASE ok 125: FUNCTION MAX ok 126: FUNCTION MEAN ok 127: FUNCTION MEDIAN ok 128: FUNCTION MIDRANGE ok 129: FUNCTION MIN ok 130: FUNCTION MOD ok 131: FUNCTION NUMVAL ok 132: FUNCTION ORD ok 133: FUNCTION ORD-MAX ok 134: FUNCTION ORD-MIN ok 135: FUNCTION PRESENT-VALUE ok 136: FUNCTION RANGE ok 137: FUNCTION REM ok 138: FUNCTION REVERSE ok 139: FUNCTION SIGN ok 140: FUNCTION SIN ok 141: FUNCTION SQRT ok 142: FUNCTION STANDARD-DEVIATION ok 143: FUNCTION STORED-CHAR-LENGTH ok 144: FUNCTION TAN ok 145: FUNCTION VARIANCE ok Roger ---------------------------------------------------------------- Good thing I tried .33! ---------------------------------------------------------------- Subject: COBOL runtime for SCO release 3.2 v4.2 Hi, I'm suddenly faced with the need for a cobol runtime (runcobol)on my SCO release 3.2 v4.2 NCR computer (recovering from a hard disk failure). Although I was able to find the OS recovery floppy disks and tape, I could not find any COBOL runtime diskettes. Can anyone recommend a runtime other than Liant Software? Is the "runcobol" program something I can obtain from the OpenCOBOL project? Thank you one and all for your help. ---------------------------------------------------------------- No, you are out of luck. Executables and libraries are NOT interchangable. Better boot up a Linux sytem :-) Roger ---------------------------------------------------------------- Subject: cob_init from within COBOL program What's the equivalent cobol call for the C call cob_init(0,NULL); ? I'm porting DB2/VSE (Mainframe) stored procedures written in COBOL to Linux. With a few minor changes and a wrapper program written in C to call cob_init, it works great. The stored procedure has to take parameters, so it needs a linkage section and a procedure division with using. I'd love to get rid of that wrapper program and just call cob_init from within the program itself. I am really impressed with the work you guys have done. Keep up the good work. Thanks. ---------------------------------------------------------------- There isn't one :-) By the time the first COBOL statement is executed, is the the check for cob_init already done. Roger ---------------------------------------------------------------- OK. With that in mind, do you have a philosophical problem with maybe adding another flag to generate a cob_init(0,NULL) call from within a module, if cob_init hasn't already been called? My problem is, I don't have control over the calling program, which loads the module dynamically. I made minor changes to the source to suit my purposes (and it works great), but I'd rather not maintain it if I don't have to. If you're interested, I can send you a patch. If you're not interested, I'll keep it to myself. ---------------------------------------------------------------- Patches always welcome. (diff -u format against latest prerelease) IIRC, we did this at some stage. There was some sort of problem involved. I will have to see if I have my old notes available to find out why. Roger ---------------------------------------------------------------- Here's the cvs diff -u against the CVS on sourceforge. I've used this to port stored procedures from DB2 on VSE to DB2 on Linux and, so far, it has been pretty straight forward. Dan Index: cobc/cobc.c =================================================================== RCS file: /cvsroot/open-cobol/open-cobol/cobc/cobc.c,v retrieving revision 1.201 diff -u -r1.201 cobc.c --- cobc/cobc.c 26 Jul 2006 12:39:20 -0000 1.201 +++ cobc/cobc.c 1 Aug 2006 17:34:11 -0000 @@ -86,6 +86,7 @@ int cb_id = 1; int cb_flag_main = 0; +int cb_flag_auto_init = 0; int errorcount = 0; int warningcount = 0; @@ -148,9 +149,10 @@ static const char fcopts[] = " "; #endif -static char short_options[] = "hVvECScmxOgwo:t:I:L:l:"; +static char short_options[] = "ahVvECScmxOgwo:t:I:L:l:"; static struct option long_options[] = { + {"autoinit", no_argument, NULL, 'a'}, {"help", no_argument, NULL, 'h'}, {"version", no_argument, NULL, 'V'}, /* getopt_long_only has a problem with eg. -xv - remove @@ -376,6 +378,7 @@ " -C Translation only; convert COBOL to C\n" " -S Compile only; output assembly file\n" " -c Compile and assemble, but do not link\n" + " -a Auto init, used for standalone modules with no argc / argv\n" " -t Place the listing into \n" " -I Add to copybook search path\n" " -L Add to library search path\n" @@ -464,6 +467,9 @@ wants_nonfinal = 1; cb_compile_level = CB_LEVEL_ASSEMBLE; break; + case 'a': + cb_flag_auto_init = 1; + break; case 'm': if (cb_flag_main) { fprintf (stderr, "Only one of options 'm', 'x' may be specified\n"); Index: cobc/cobc.h =================================================================== RCS file: /cvsroot/open-cobol/open-cobol/cobc/cobc.h,v retrieving revision 1.99 diff -u -r1.99 cobc.h --- cobc/cobc.h 2 Jul 2006 10:10:21 -0000 1.99 +++ cobc/cobc.h 1 Aug 2006 17:34:12 -0000 @@ -86,6 +86,7 @@ extern int cb_id; extern int cb_flag_main; +extern int cb_flag_auto_init; extern int errorcount; extern int warningcount; Index: cobc/codegen.c =================================================================== RCS file: /cvsroot/open-cobol/open-cobol/cobc/codegen.c,v retrieving revision 1.588 diff -u -r1.588 codegen.c --- cobc/codegen.c 26 Jul 2006 12:39:20 -0000 1.588 +++ cobc/codegen.c 1 Aug 2006 17:34:17 -0000 @@ -3188,9 +3188,15 @@ output_line ("if (unlikely(initialized == 0))"); output_indent (" {"); /* output_stmt (cb_build_assign (cb_return_code, cb_int0)); */ - output_line ("if (!cob_initialized) {"); - output_line (" cob_fatal_error (COB_FERROR_INITIALIZED);"); - output_line ("}"); + if (cb_flag_auto_init) { + output_line ("if (!cob_initialized) {"); + output_line (" cob_init (0,NULL);"); + output_line ("}"); + } else { + output_line ("if (!cob_initialized) {"); + output_line (" cob_fatal_error (COB_FERROR_INITIALIZED);"); + output_line ("}"); + } output_line ("cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL);"); if (prog->flag_screen) { ---------------------------------------------------------------- Yes, idea is good. Couple of nitpicks - I have the "a" option slated for 0.34 development. No big problem as I want to revise the whole options/flags stuff for 0.34. So we can do this for 0.33. There is also an alternative in using "-fxxxx"; see cobc/flags.def. (Which, on reflection, might be a better idea; we have enough clutter in the options already) Bigger problem is possible confusion between this and the configuration variable "auto-initialize" (see config/default.conf) and it's attendant C variable cb_auto_initialize. Maybe we should use something like "autoarg". Let me think about this. I'll get back later today. Roger ---------------------------------------------------------------- Roger, This was just my throw-together solution. Whatever works for you and OpenCOBOL, I can adjust to. Thank you. Dan ---------------------------------------------------------------- Sorry, I meant to post yesterday but had to take the wife to the airport. I will cook something up and post when the tarball is ready. Roger ---------------------------------------------------------------- OK. New tarball up as usual at : http://www.sim-basis.de/open-cobol-0.33.tar.gz cobc --help should give you the option :-) It's -fimplicit-init This, of course, will be in 0.33 release. Roger ---------------------------------------------------------------- Subject: Lock mode and keys symbasys? Don't know them :-) What's the problem ? The messages are quite clear :-) So, no, nobody can help you :-) If you mean when are these features going to be implemented, I cannot say. As mentioned in another thread, I am the only active OC developer at the moment and I do have a full-time job. (Which does NOT include OC development) Therefore, if anybody wants to start coding this stuff, please do so and get in contact with me. (Based on CVS or tarball) Roger ---------------------------------------------------------------- I've downloaded from symbasys.de latest release. Compilation still gives me: LOCK MODE not implemented SPLIT KEYS not implemented READ ... WITH LOCK not implemented Can anyone help me? Thanks ---------------------------------------------------------------- Subject: Access to the Windows API. Is it possible to access the WinApi with Opencobol?; e.g. via call WINAPI "FunctionName" If not, is there another way to implement http-access (e.g. downloading a file from a Webserver)? Also: are there other modules implemented for Windows which can be accessed via call "Module_Name" ? I use the pre-compiled Windows binary, version 0.33. thanks and keep up the good work. ---------------------------------------------------------------- No, Yes(non-Win) and No :-) With Linux, to retrieve a file from the web you can do something like : 01 MYDOWN PIC X(128) VALUE "wget http://server/filename 1>/dev/null 2>&1". CALL "SYSTEM" USING MYDOWN. IF RETURN-CODE = 0 ... OK ELSE ... It didn't work END-IF. This is immensely simplified; see the man pages for wget. Note "SYSTEM" just recently implemented in tarball. Roger ---------------------------------------------------------------- Subject: error in running cobol program after compiling hello.cob when i run it i got following error error while loading shared libraries : libcob.so.1 : cannot open shared object file : no such file or directory how can i resolve this problem ---------------------------------------------------------------- I do not know :-) My crystal ball does not seem to be working :-) What OC release ? What system ? For the 0.33 prerelease, have you read the README ? Did you take note of information when you did a make install ? eg: (from a make install) Libraries have been installed in: /usr/local/lib If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,--rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. Roger ---------------------------------------------------------------- I have the same problem on SuSe linux 9.0 and libraries are in /usr/local/lib and this path is in ld.conf Help ! ---------------------------------------------------------------- Run (as root) "ldconfig". It's in the 0.33 README :-) Roger ---------------------------------------------------------------- Thank you it's work ! I have installed the 0.32 release. It's fine to include this remark in the 0.33 release ! ---------------------------------------------------------------- Install 0.33 ! Roger ---------------------------------------------------------------- I still have this problem with version 0.33 Please help! ---------------------------------------------------------------- Read the second post in this thread !! How the **** can I help when NO details are provided ? !!! This is like faxing your local garage saying "Hi, My car has stopped working, help" :-) Roger ---------------------------------------------------------------- Subject: Calling sub-programs Is it possible to call subprograms using openCOBOL? I'm not sure they're called "subprograms", but basically I want to use a CALL command followed by the alias or filename of another executable cobol program in the same directory. This was possible on COBOL 85. ---------------------------------------------------------------- Yes, of course. What use would a Cobol compiler be without being able to support the CALL statement :-) Roger ---------------------------------------------------------------- Ok.. I can't seem to get this to work. It's probably something obvious. To clarify, here's what I'm trying to do. I wrote to programs MAIN_PROGRAM.cob and SUB_PROGRAM.cob, compiled them, and their executables are sitting in my directory. I run the MAIN_PROGRAM "./MAIN_PROGRAM". Within my MAIN_PROGRAM I've got a CALL statement "CALL SUB_PROGRAM" (SUB_PROGRAM is also the Program_ID for SUB_PROGRAM.cob). When MAIN_PROGRAM runs, I get an error message stating that "module SUB_PROGRAM" could not be found. Anyone see what I'm doing wrong? ---------------------------------------------------------------- "and their executables are sitting in my directory" Did you compile both programs with "-x"? That's wrong. Modules (sub-programs) should be compiled with "-m". ie. cobc -x MAIN_PROGRAM.cob cobc -m SUB_PROGRAM.cob ./MAIN_PROGRAM In fact, it is easier to compile everything as modules and then execute your "main" program with "cobcrun". ie. cobc -m MAIN_PROGRAM.cob cobc -m SUB_PROGRAM.cob cobcrun MAIN_PROGRAM Roger ---------------------------------------------------------------- That fixed it. Thanks very much. ---------------------------------------------------------------- Subject: Possible memory overflow causing issue Given the following definition in cobol: ----------------------------------------------------- 01 MY-REC-LINES. 05 AAAAAAAAAAAAAAAAA PIC 9(4) COMP SYNC VALUE 125. 05 BBBBBBBBBBB PIC X(4) VALUE 'XXXX'. 05 CCCCCCCCCC. 10 FILLER PIC X(30) VALUE '111111111111111111111111111111'. 10 FILLER PIC X(25) VALUE '2222222222222222222222222'. 10 FILLER PIC X(34) VALUE '3333333333333333333333333333333333'. 10 FILLER PIC X(31) VALUE '4444444444444444444444444444444'. 10 FILLER PIC X(33) VALUE '555555555555555555555555555555555'. 10 FILLER PIC X(42) VALUE '666666666666666666666666666666666666666666'. 10 FILLER PIC X(45) VALUE '777777777777777777777777777777777777777777777'. 10 FILLER PIC X(27) VALUE '888888888888888888888888888'. 10 FILLER PIC X(38) VALUE '99999999999999999999999999999999999999'. 05 DDDDDDDDDDDDD PIC 9(4) COMP SYNC VALUE 305. 05 EEEEEEEEEEEEEEE. 10 EEEEEEEEEE-KEY PIC 9(8). ----------------------------------------------------- The cobol compiler generates the following C code static cob_field f_104 = {2, b_103, &a_388}; /* AAAAAAAAAAAAAAAAA */ memcpy (b_103 + 2, "XXXX", 4); memcpy (b_103 + 6, "111111111111111111111111111111", 30); memcpy (b_103 + 36, "2222222222222222222222222", 25); memcpy (b_103 + 61, "3333333333333333333333333333333333", 34); memcpy (b_103 + 95, "4444444444444444444444444444444", 31); memcpy (b_103 + 126, "555555555555555555555555555555555", 33); memcpy (b_103 + 159, "666666666666666666666666666666666666666666", 42); memcpy (b_103 + 201, "777777777777777777777777777777777777777777777", 45); memcpy (b_103 + 246, "888888888888888888888888888", 27); memcpy (b_103 + 273, "99999999999999999999999999999999999999", 38); static cob_field f_116 = {2, b_103 + 312, &a_388}; /* DDDDDDDDDDDDD */ I would have expected field f_116 should start at offset 311 instead of 312 ... this could potentially overrun the b_103 buffer as we keep assigning the other fields to the various offsets in b_103. One of the fields in our pgm was getting reset to an invalid value ... this could be the cause ? Rgds Bhaskar ---------------------------------------------------------------- It is perfectly correct. You defined DDDDDDDDDDDDD with SYNC so (for this 2 byte field) that gets allocated on an even byte boundary ie. 312. Total size of MY-REC-LINES is 322, also correct. The only way to get SYNC ignored is to specify -std=mf as compile option (but that may not be what you want) Roger ---------------------------------------------------------------- Subject: strange results using SUBTRACT or ADD, but using COMPUTE works fine Dear All, I am seeing strange results when using "SUBTRACT" or "ADD": [code] ID DIVISION. PROGRAM-ID. SUBSTRACT. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 INDATE PIC 9(8) VALUE 20060807. 01 OUTDATE PIC 9(8) VALUE ZERO. 01 OUTDATE-FILLER1 REDEFINES OUTDATE. 05 OUTDATE-YY PIC 9(4). 05 OUTDATE-MM PIC 9(2). 05 OUTDATE-DD PIC 9(2). PROCEDURE DIVISION. BEGIN-PGM. DISPLAY "INDATE = " INDATE. DISPLAY "USING COMPUTE ...". MOVE INDATE TO OUTDATE. DISPLAY " OUTDATE BEFORE = " OUTDATE. COMPUTE OUTDATE-DD = OUTDATE-DD - 1. DISPLAY " OUTDATE AFTER = " OUTDATE. DISPLAY "USING SUBTRACT 1 ...". MOVE INDATE TO OUTDATE. DISPLAY " OUTDATE BEFORE = " OUTDATE. SUBTRACT 1 FROM OUTDATE-DD. DISPLAY " OUTDATE AFTER = " OUTDATE. DISPLAY "USING ADD -1 ...". MOVE INDATE TO OUTDATE. DISPLAY " OUTDATE BEFORE = " OUTDATE. ADD -1 TO OUTDATE-DD. DISPLAY " OUTDATE AFTER = " OUTDATE. STOP RUN. [/code] result: [code] INDATE = 20060807 USING COMPUTE ... OUTDATE BEFORE = 20060807 OUTDATE AFTER = 20060806 USING SUBTRACT 1 ... OUTDATE BEFORE = 20060807 OUTDATE AFTER = 20060894 USING ADD -1 ... OUTDATE BEFORE = 20060807 OUTDATE AFTER = 20060894 [/code] tested with OpenCOBOL 0.31 on SunOS/Sparc and OpenCOBOL 0.32 on Linux/intel. Could anyone help me ? THX! ---------------------------------------------------------------- now I have tested it with the OpenCOBOL 0.33 Prerelease (on Linux/intel) and the problem seems to be fixed. Thanks again for your nice work! ---------------------------------------------------------------- Subject: Migration from Microfocus Cobol to OpenCobol Hi, I'm a beginner in CObol, but I try to migrate from hp microfocus cobol on hp-unix to open cobol on linux platform, unfortunately I have some messages : 1- Permanent file error (STATUS=30) 2- Level 01 item cannot have occurs clause 5- Alphanumeric value is expected How to debug programs with gdb? Thanks for help ---------------------------------------------------------------- cobc --help is a good start :-) Move up to 0.33 prerelase if you have not already done so. Generally, if you are coming from MicroFocus, then the first thing to check is if you were (with MF) implicitly or explicitly using the IBMCOMP option (Note this can be implicitly set by other options eg. DIALECT; check your MF doc). If you did NOT have the IBMCOMP option, then you probably should start with the "-std=mf" OC option. If you DID have the IBMCOMP option, then you probably need one of the "-std=mvs", "-std=bs2000", "-std=ibm" OC options. You can look at "config/default.conf" for the default configuration settings and, then, the individual "xxx.conf" (eg. bs2000.conf) files to see what is overridden. For debugging, look at the "-debug" and "-ftrace" options. Roger ---------------------------------------------------------------- Hi, Got these problems when migrating: - (STATUS =30), most of the time it's a bad ASSIGN order. with MF you can write : ASSIGN "TMPDIR/WRKFILE" MF understand that the file named WRKFILE is located at $TMPDIR variable substitution OC doesn't so change like that: ASSIGN "$TMPDIR/WRKFILE" you can change all your assign commmands by a sed command. - Level 01 item can not have occurs. MF authorise to declare: 01 THINGS OCCURS 10. means you declare a array of 10 elements called THINGS. and you use THINGS(1),THINGS(2)... THINGS(I) With OC you must declare the array on an other level than 01 and so create a 01 level: 01 MANY-THINGS. 03 THINGS OCCURS 10. - alphanumeric value... not encoutered but I've already seen that MF is quiet cool with variables declared as characters and used as integers or vice-versa ---------------------------------------------------------------- - ASSIGN "TMPDIR/WRKFILE" No, from the MF File Handling reference manual - **** In this example, opening input-file opens the file prog in the data directory (relative to the current directory): select input-file assign to "data/prog". **** - Level 01 item can not have occurs. Depends on compiler option, one of -std=mf, -std=ibm, -std=mvs, -std=bs2000 will allow this. (Specifically, it is the top-level-occurs-clause clause in the xxx.conf file in the config directory) ---------------------------------------------------------------- - ASSIGN "TMPDIR/WRKFILE" I agree that this syntax means to assign file "WRKFILE" in directory "TMPDIR". But I see hundreds of cobol lines compiled with MF OCS 4.2 on AIX 4.3 which understand it as "$TMPDIR/WRKFILE"... I don't know why but I know it works like that on my site + 40 other sites using the same product and MF (OCS or Express) ---------------------------------------------------------------- Not quite. You are almost correct. Refer to chapter 3.3 Filename Mapping in the File Handling reference. MF will NOT look for env variable TMPDIR. It WILL however look for dd_TMPDIR or DD_TMPDIR. (Tested with Server Express 2.2 and 4.0) Note that this is very MF specific and extremely non-portable. A simple ASSIGN "WRKFILE" with appropiate mods to the JCL is the way to go :-) Having said all that, I will take a look at being more MF compatible. Note that for simple names (eg. "WRKFILE"), we already do filename mapping ie. We check for env variables DD_WRKFILE, dd_WRKFILE and WRKFILE in that order. ---------------------------------------------------------------- Things become clearer... I now understand better why a variable DD_TMPDIR is set on my system... and is the same value than TMPDIR. But my cobol "select" statements refers to TMPDIR for sequential files or indexed sequential files and not DD_TMPDIR... Strange... ---------------------------------------------------------------- Not strange, that's what MF does. As I said, refer to the File Handling reference manual. Excerpt from Chapter 3.3 (delimited asterisks) ****************************** 3.3 Filename Mapping This COBOL system provides several ways of mapping the filename supplied by the program via the ASSIGN clause onto a different name, for greater flexibility at run time. When the File Handler is presented with a filename (which may be a literal, the contents of a data item, or, in the case of the ASSIGN TO EXTERNAL syntax, an external reference), it isolates the first element of that name, that is, all the text before the first slash character (/), all the text if the name does not include such a character, or nothing if the filename starts with a slash character. Having done that, it: Removes the leading dollar character ($) if it is present, prefixes the characters "dd_" to this first element and searches for an environment variable with this name. If it does not find this environment variable and either the ASSIGN EXTERNAL syntax was used or the first element of the filename began with a dollar character, it looks for an environment variable with the same name as the first element (minus the leading dollar character if present). If the search is unsuccessful, the original filename is left unchanged, except in the case where the name begins with a dollar character and contains at least one slash character. In this case, the whole of the first element, together with the first slash is removed from the name. The result is then considered to be the filename of the physical file. Consider the following examples: ***************************************************** Note that although not specifically mentioned, it also prefixes and looks for "DD_" (note upper case). The MF documentation is online through www.microfocus.com, Support, Product Documentation and then select a flavour of Server Express and then File Handling. ---------------------------------------------------------------- OK, all is clear now. I haven't correctly understood the previous message. ---------------------------------------------------------------- As an addendum, note that the environment variable "TMPDIR" is used by MF (and OC) for other purposes. It is used for compiler temporary (intermediate) files and also by SORT for intermediate files. See MF Users Guide(SE 2.2) Chapter 6.2 and Appendix A. Roger ---------------------------------------------------------------- Subject: Need help understanding Cobol I got a specification for a report format I need to understand. It is explained using some Cobol stuff, but I've never read Cobol and noone else around can help me. Can anyone explain how to parse: Pic -(10)9,99 How many bytes is it? What is a valid value? After reading an old Cobol book I thought it was 14 bytes and a valid value was "-1234567890,00", but that doesnt look right... ---------------------------------------------------------------- It is 14 bytes, however be careful. If the last two places are supposed to represent a fractional part, then you will need the DECIMAL-POINT IS COMMA clause in SPECIAL-NAMES if the picture is as stated. Let's look at examples. Given 2 values eg. 1234567890.99 and -98.76 With no DECIMAL-POINT clause - PIC -(10)9,99 gives " 12345678,90" " -0,98" Do you see why? The "," is just an editing symbol, so only the integer part of the value is represented. Now lets look at PIC -(10)9.99 gives " 1234567890.99" " -98.76" ** NOTE ** Posting seems to screw up the spacing; all values between the quotes in the above examples are 14 characters and right-justified. Note also that the left most place is always reserved for a possible negtive sign, so that a maximum of 10 digits for the integer part can be represented. (If larger, it will be left-truncated) As stated above, the DECIMAL-POINT clause affects this behaviour. Roger ---------------------------------------------------------------- Subject: configure on 64-bit: bdb >=4.1 test seg fault solution On a 64-bit Linux, the configure gets segmentation faults testing for the version of BDB. The test program needs a #include to get past it. For some reason it wasn't a problem on 32-bit. --Dan ---------------------------------------------------------------- Hmm. What BDB version ? This would imply either : a) Something wrong with your include files (unlikely when this is a normal Linux distro) b) BDB is missing an include in "db.h". This is likely to be the problem. The question is, what does BDB need from stdlib.h that is dependent on 32/64 bit ? OK, we can put in extra include(s) in the configure but this is really a BDB problem. Roger ---------------------------------------------------------------- I have updated the configure in the 0.33 prerelease. Roger ---------------------------------------------------------------- It's actually a getenv problem. Dan ---------------------------------------------------------------- Ahh, yes, prototype for getenv is in stdlib.h. Well spotted. Roger ---------------------------------------------------------------- Subject: libcob.conf Is there a way I can set defaults with this file? For example, I would like to set -free, so as to not have to type it every time i compile something. I cant seem to find any documentation on this file. Ian Sulzer ---------------------------------------------------------------- Maybe because it does not exist :-) Currently there is no way to set free as the default. For info, the Cobol standards require that fixed format is the default. Easy way is to set up your own script for compiling and make sure it is somewhere in your "$PATH". eg. Here is a stripped down example of something I use for a mainframe app that : a) Has upper-case names and ".CBL" as suffix. b) Assumes that the programs reside in directory "$SRC" and that COPY's reside in directory "$CPYDIR" (which may be the same as $SRC) (Both default to current directory if not set) c) There is a temporary directory ("$TMP") for error lists (defaults to "/tmp") If this script is called "occomp" and I have progs PROG1.CBL, PROG2.CBL, etc., then I can do eg. occomp prog1 prog2.cbl or occomp PROG1.cbl PROG2 or occomp prog1 prog2 You can, of course, have various scripts for various compile options eg. for debug. Roger The script : (Posting seems to screw up spacing/tabbing, so this may appear very strange. In the original and this post it is correctly tab indented) # # shell script to compile a COBOL program under OpenCobol. # # Note in this example, it is assumed that programs have upper-case # names and use the suffix ".CBL" # LANG=C; export LANG if [ ${#} -lt 1 ] then echo "Missing parameter(s)" exit 1 fi export EXVAL=0 if [ -z "${TMP}" ] then export TMP="/tmp" fi if [ -z "${SRC}" ] then export SRC="." fi if [ -z "${CPYDIR}" ] then export CPYDIR="." fi cd ${SRC} for ARG in ${*} do INP=`echo ${ARG} | tr "[a-z]" "[A-Z]"` INP=`basename ${INP} .CBL` if [ ! -r ${INP}.CBL ] then echo "${INP}.CBL does not exist in ${SRC}" continue fi rm -f ${TMP}/${INP}.lst echo "Compile ${INP} start at `date`" rm -f ${INP} rm -f ${INP}.o rm -f ${INP}.so cobc -O2 -fixed -std=mvs -I${CPYDIR} -m ${INP}.CBL 1>${TMP}/${INP}.lst 2>&1 RETVAL=${?} ERRORS="" if [ ${RETVAL} -ne 0 ] then EXVAL=1 ERRORS="(Errors found)" echo "Errors found - listing in ${TMP}/${INP}.lst" rm -f ${INP} rm -f ${INP}.o rm -f ${INP}.so else rm -f ${INP}.o rm -f ${TMP}/${INP}.lst fi echo "Compile ${INP} end at `date` ${ERRORS}" done exit ${EXVAL} ---------------------------------------------------------------- Subject: Use with Oracle Pro*COBOL precompiler? I am not a COBOL programmer, so this may be a stupid question. My organization buys and runs an application package from a software vendor. A handful of programs are legacy items that are written in COBOL. Recently we have been forced into an upgrade of the application and of Oracle(this application uses Oracle). And that required an upgrade of our MicroFocus Cobol Compiler (to server express 2.2+) and subsequent expenditure of bales of money. Would OpenCOBOL fit in this environment? Is it something I should just try and see what happens? (Oh! I should add that we have source code to this application and do our own compile cycle of any changes that come from the software vendor.) P.s. our OS is HP-UX 11i Oracle 10g Thanks! ---------------------------------------------------------------- No reason why it should not work. Use the 0.33 prerelease and follow the README. Roger ---------------------------------------------------------------- Subject: Permission denied error when using OpenCobol with Cygwin Hi I've installed OpenCobol on Cygwin successfully. I've also compiled a .cob file into .exe file. But when executing .exe file I received "Permission Denied". Can anyone help me out? Thanks a lot. ---------------------------------------------------------------- Sorry, Can not reproduce. I always test pre-releases with Cygwin. Download the 0.33 pre at the link on the left of the home page and try again. Next time, please, versions from OC and Cygwin :-) Roger ---------------------------------------------------------------- Subject: COBOL and Stored Procedures Don't know. Sounds like a relational database interface. If it works with some Unix/Linux Cobol compiler like MF, then we should be able to do it. Roger ---------------------------------------------------------------- Hi folks, is it possible to call a stored procedure from COBOL when one of the parameters is a cursor? Also, the cursor was made for crystal reports. My colleague told me that the cursor used is exclusive for crystal reports. If so, can i just create another package for a cursor and use it? but how's the cobol code going to like? and how will i be able to retrieve the data from the cursor in cobol code? ---------------------------------------------------------------- Subject: syntax error, unexpected LITERAL, expecting COLUMN or LINE Dear, it forgives my English I work with micro focus COBOL and Sco Unix 5.2.. I need to migrate for Red Hat linux 9…. already I installed and I configured open COBOL 3,2, and this executing ok…. I use DISPLAY field AT line+column and ACCEPT field AT line+column, but occurs error in compiler already I tried: cobc -std=cobol2002 program.cob cobc -std=cobol85 program.cob cobc -std=ibm program.cob cobc -std=mvs program.cob cobc -std=mf program.cob the following error always occurs: syntax error, unexpected LITERAL, expecting COLUMN or LINE only accepted open COBOL syntax ACCEPT/DISPLAY line (nn) column (nn)??????? geraldo ---------------------------------------------------------------- Move to 0.33 prerelease at the link on the left of the home page here. However, this might not get what you want as we currently do NOT have any reasonable screen handling. (Code donations welcome :-) ) Roger ---------------------------------------------------------------- Subject: Prerelease 0.33 notes Some notes. DO read the README ! (And do ALL what it recommends!) The default action for the compiler (cobc) is to produce a module not an executable (Change from 0.32) If you want to produce an executable use the "-x" option. The "-m" option (produce a module) is default (as per MF) cobc --help gives details. (Hint - Compile everything with default ala. MF and execute with cobcrun) Cobol FUNCTION's are implemented. The FUNCTION list is taken from the Cobol 2002 standard. Implemented FUNCTION's can be seen in cobc/reserved.c at ca. line 583 The top-level directory and the sub-directories cobc, libcob, lib, bin, tests, config contain a file named ChangeLog which documents all committed changes. These are the main recourse to determining new/changed features. Also implemented are several MF/ACU system routines. There are MANY bug fixes against 0.32, therefore it is advisable to try 0.33 now. Really, read the ChangeLog's since 0.32 release (05/2005)! Roger ---------------------------------------------------------------- Also note that the prerelease is continually updated. For instance, today there has been an update to rectify various things. Roger ---------------------------------------------------------------- Hi I have a modified codegen.c which addresses some of the problems when using ddd to debug. Basically, I have changed the output to remove newlines so all 'c' code relating to a cobol line is on one line. This allows you to use ddd to step through the cobol code. I have produced this as a patch against the latest prerelease package. If you feel it of use please let me know and I will email it to you. Regards Shaun Coughlin shaunc@traderman.co.uk ---------------------------------------------------------------- New pre-release uploaded. ** Note ** ISAM secondary index files are NOT compatible. Please unload/reload. Further changes, see ChangeLog in top dirctory and "cobc", "libcob" directories. Roger ---------------------------------------------------------------- New pre-release uploaded. ** Note ** ISAM secondary index files are NOT compatible. Please unload/reload. Further changes, see ChangeLog in top dirctory and "cobc", "libcob" directories. ---------------------------------------------------------------- Please read the previous post. For those that have the "wget" command and have an internet connection, then you can do wget http://www.sim-basis.de/open-cobol-0.33.tar.gz Roger ---------------------------------------------------------------- Bump. Read original post. *DO* read the README !! Download direct at : http://www.sim-basis.de/open-cobol-0.33.tar.gz (however, see previous post) Roger ---------------------------------------------------------------- Subject: Problem reporting Firstly check out the official SourceForge website at : http://sourceforge.net/projects/open-cobol Alternatively with https Please supply the following information : OC version : a) cobc --version b) When prerelease, when downloaded. What OS : a) What version b) What version from C or GCC What version from dependent software : a) GMP b) BDB c) ncusrses/pdcurses Do NOT write it does not work. I need an example (And do not be afraid to post it inline, we need the source!). (My crystal ball is very cloudy :-) ) PS. I may need the output from configure/make - Post/send config.log and/or the output from make (see README) Roger ---------------------------------------------------------------- Until I get this as a "sticky" thread, I will post to get this at the top of the list. Roger ---------------------------------------------------------------- Subject: problem on mac os x (libdb) i have the macpro 2,66 ghz and mac os x 10.4.8 i install db berkeley and the make install put it in [omignard:/usr/local/BerkeleyDB.4.4] omignard% ls lib libdb-4.4.a libdb-4.4.dylib libdb-4.4.la libdb-4.dylib libdb.a libdb.dylib [omignard:/usr/local/BerkeleyDB.4.4] omignard% buth the results of the configure of opencobol : checking db.h usability... yes checking db.h presence... yes checking for db.h... yes checking db_185.h usability... no checking db_185.h presence... no checking for db_185.h... no checking db3/db_185.h usability... no checking db3/db_185.h presence... no checking for db3/db_185.h... no checking db4/db_185.h usability... no checking db4/db_185.h presence... no checking for db4/db_185.h... no checking db4.1/db_185.h usability... no checking db4.1/db_185.h presence... no checking for db4.1/db_185.h... no checking db4.2/db_185.h usability... no checking db4.2/db_185.h presence... no checking for db4.2/db_185.h... no checking db4.3/db_185.h usability... no checking db4.3/db_185.h presence... no checking for db4.3/db_185.h... no checking db4.4/db_185.h usability... no checking db4.4/db_185.h presence... no checking for db4.4/db_185.h... no checking db4.5/db_185.h usability... no checking db4.5/db_185.h presence... no checking for db4.5/db_185.h... no checking for __db_open in -ldb-4.5... no checking for dbopen in -ldb-4.5... no checking for __db_open in -ldb-4.4... no checking for dbopen in -ldb-4.4... no checking for __db_open in -ldb-4.3... no checking for dbopen in -ldb-4.3... no checking for __db_open in -ldb-4.2... no checking for dbopen in -ldb-4.2... no checking for __db_open in -ldb-4.1... no checking for dbopen in -ldb-4.1... no checking for __db_open in -ldb-4... no checking for dbopen in -ldb-4... no checking for __db_open in -ldb... no checking for dbopen in -ldb... no configure: error: libdb is required where is the problem ? ---------------------------------------------------------------- Well you answered that yourself in the second sentence. BDB has a very strange default install path. You have two options - 1) Fiddle around with setting environment variables so that OC finds BDB. OC's ./configure --help will give you info. 2) This is the recommended way - Regenerate BDB using ./configure --prefix=/usr/local (or ./configure --prefix=/usr) and then the usual make install. (Don't forget to do a "make distclean" first) ** AND ** - Please use the OC 0.33 prerelease; this has fixes for the Mac. (Download is on the left of the home page) Roger ---------------------------------------------------------------- i used the oc 0.33 :-D ---------------------------------------------------------------- Subject: problem with ld .. ld: common symbols not allowed with MH_DYLIB output format with the -multi_module option /usr/local/lib/libgmp.a(mp_bpl.o) definition of common ___gmp_junk (size 16) /usr/bin/libtool: internal link edit command failed make[2]: *** [libcob.la] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 ---------------------------------------------------------------- That's not an OC problem. Something is borked with GMP. This has happened before - See the thread - "configure: error: GMP 3 or later is required" Seems that a workaround for generating/installing GMP is - export ABI=32 ./configure --with-pic --enable-cxx --enable-shared Roger ---------------------------------------------------------------- i am on a mac pro xeon i have this error tmp-dive_1.s:108:junk `@GOT' after expression make[2]: *** [dive_1.lo] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 Using built-in specs. Target: i686-apple-darwin8 Configured with: /private/var/tmp/gcc/gcc-5363.obj~28/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=powerpc-apple-darwin8 --with-arch=nocona --with-tune=generic --program-prefix= --host=i686-apple-darwin8 --target=i686-apple-darwin8 Thread model: posix gcc version 4.0.1 (Apple Computer, Inc. build 5363) ---------------------------------------------------------------- Sorry, you are going to have to take this over to the GMP list. www.swox.com/gmp Look for lists and submit to the bug list. ---------------------------------------------------------------- Subject: Running error: symbol lookup error this is i have got while running this program... ./FILE01: symbol lookup error: ./FILE01: undefined symbol: cob_save_call_params compile ok! but when i try running it fails 000100 IDENTIFICATION DIVISION. 000200 PROGRAM-ID. PHNADD01. 000800 ENVIRONMENT DIVISION. 000900 INPUT-OUTPUT SECTION. 001000 FILE-CONTROL. 001200 SELECT PHONE-FILE 001300 ASSIGN TO "PHONE.DAT" 001500 ORGANIZATION IS SEQUENTIAL. 001600 001700 DATA DIVISION. 001800 FILE SECTION. 001900 FD PHONE-FILE 002000 LABEL RECORDS ARE STANDARD. 002100 01 PHONE-RECORD. 002200 05 PHONE-LAST-NAME PIC X(20). 002500 003600 PROCEDURE DIVISION. 003700 MAIN-LOGIC SECTION. 003800 PROGRAM-BEGIN. 003900 OPEN EXTEND PHONE-FILE. 000000 DISPLAY "INTRODUCE LAST NAME: ". 006700 ACCEPT PHONE-LAST-NAME. 008100 WRITE PHONE-RECORD. 004100 CLOSE PHONE-FILE. 004600 PROGRAM-DONE. 004700 STOP RUN. 009000 please help me. gcc version 4.0.3 opencobol 0.33.0 and 0.32.x !ldconfig done! ---------------------------------------------------------------- Mismatch between compiler and libraries. Check your environment. If you have done a default configure/make install, then you do not need to do anything special in the environment. If nothing is obvious, redo (as root) the "make install" from 0.33. Redo "ldconfig". Check output from : ldconfig -p | grep libcob Then do hash cobc hash Check the paths to cobc from the hash command and from the ldconfig command. ---------------------------------------------------------------- thanks i have solved it. problems with libcob version 0.32.x ---------------------------------------------------------------- hi i have the same problem, but i don't quite understand your solution output from ldconfig -p | grep libcob: libcob.so.1 (libc6) => /usr/lib/libcob.so.1 libcob.so (libc6) => /usr/lib/libcob.so output from hash: hits command 0 /usr/local/bin/cobc 4 /usr/bin/sudo 1 /bin/ls and now what ... i'm not really what you can call an advanced linux user (using ubuntu), so any help is welcome :-) thx ---------------------------------------------------------------- Download/install 0.33 prerelease. If this problem persists, then I want the the config.log file. Roger ---------------------------------------------------------------- downloaded and installed the 0.33 prerelease, and the error persists [url=http://fabian.madoka.be/files/config.log]config.log[/url] ---------------------------------------------------------------- And did you carefully read the README :-) ---------------------------------------------------------------- i've read the readme, followed the installation procedure (and the the test, which passed) but still not working ---------------------------------------------------------------- How many times - Say your environment, etc. Roger ---------------------------------------------------------------- Subject: compilation problem Hi there I'm trying to compile opencobol 0.33 on solaris. Here is the last compilation line : gcc -m64 -DHAVE_CONFIG_H -I. -I. -I.. -fsigned-char -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-format-y2k -DSUPER_OPTIMIZE -I.. -O2 -finline -functions -fomit-frame-pointer -MT libcob_la-fileio.lo -MD -MP -MF .deps/libcob_la-fileio.Tpo -c fileio.c -fPIC -DPIC -o .libs/libcob_la-fileio.o and here are the first errors : fileio.c:236: error: parse error before "DB" fileio.c:236: warning: no semicolon at end of struct or union fileio.c:237: warning: type defaults to `int' in declaration of `key' fileio.c:237: warning: data definition has no type or storage class fileio.c:238: error: parse error before "data" fileio.c:238: warning: type defaults to `int' in declaration of `data' fileio.c:238: warning: data definition has no type or storage class fileio.c:250: error: parse error before '}' token fileio.c: In function `cob_sync': fileio.c:380: error: dereferencing pointer to incomplete type fileio.c:380: error: dereferencing pointer to incomplete type fileio.c:389: error: dereferencing pointer to incomplete type fileio.c:389: error: dereferencing pointer to incomplete type fileio.c: In function `indexed_open': fileio.c:1272: error: invalid application of `sizeof' to an incomplete type fileio.c:1323: error: dereferencing pointer to incomplete type fileio.c:1323: error: `DB' undeclared (first use in this function) fileio.c:1323: error: (Each undeclared identifier is reported only once fileio.c:1323: error: for each function it appears in.) fileio.c:1323: error: parse error before ')' token fileio.c:1328: error: dereferencing pointer to incomplete type fileio.c:1337: error: `BTREEINFO' undeclared (first use in this function) fileio.c:1337: error: parse error before "info" fileio.c:1370: error: `info' undeclared (first use in this function) fileio.c:1372: error: `R_DUP' undeclared (first use in this function) fileio.c:1383: error: dereferencing pointer to incomplete type Any idea of the problem ? ---------------------------------------------------------------- Something screwy with the BDB include files. Send or post config.h and config.log ---------------------------------------------------------------- Oups, the configure script reported the db.h missing. As there were no error, I didn't look at it ... Thanks ! ---------------------------------------------------------------- Installing the db4 dev package solved this for me. ---------------------------------------------------------------- Subject: gcc for mvs You might like to use GCC 3.2.3 for OpenCOBOL, as it has been ported to MVS 3.8, MVS/XA and OS/390 (native, not USS). You can find it here: http://www.softlib.org/GCCMVS/gccmvs.html BFN. Paul. ---------------------------------------------------------------- That would be GREAT! Have a working COBOL that supports functions! ---------------------------------------------------------------- Subject: configure: error: gmp.h is required I have downloaded and trying to run ./configure but I get and error "configure: error: gmp.h is required". I have checked and GMP is installed. I'm running on Suse 10.1 Linux. Do I need to download any patches or some other package. Thanks for any info into this matter. ---------------------------------------------------------------- What OC release ? If it's 0.32, there is a known problem with gmp detection. Use OC 0.33. If you are using 0.33 post config.log. OC works fine with default Suse packages for GMP, BDB on 10.1. (I use it at home) ---------------------------------------------------------------- I am using OC 0.33 the config.log follows: This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by OpenCOBOL configure 0.33, which was generated by GNU Autoconf 2.59. Invocation command line was $ ./configure ## --------- ## ## Platform. ## ## --------- ## hostname = program-1 uname -m = i686 uname -r = 2.6.16.13-4-default uname -s = Linux uname -v = #1 Wed May 3 04:53:23 UTC 2006 /usr/bin/uname -p = unknown /bin/uname -X = unknown /bin/arch = i686 /usr/bin/arch -k = unknown /usr/convex/getsysinfo = unknown hostinfo = unknown /bin/machine = unknown /usr/bin/oslevel = unknown /bin/universe = unknown PATH: /sbin PATH: /usr/sbin PATH: /usr/local/sbin PATH: /opt/gnome/sbin PATH: /root/bin PATH: /usr/local/bin PATH: /usr/bin PATH: /usr/X11R6/bin PATH: /bin PATH: /usr/games PATH: /opt/gnome/bin PATH: /opt/kde3/bin PATH: /usr/lib/jvm/jre/bin PATH: /usr/lib/mit/bin PATH: /usr/lib/mit/sbin ## ----------- ## ## Core tests. ## ## ----------- ## configure:1612: checking for a BSD-compatible install configure:1667: result: /usr/bin/install -c configure:1678: checking whether build environment is sane configure:1721: result: yes configure:1786: checking for gawk configure:1802: found /usr/bin/gawk configure:1812: result: gawk configure:1822: checking whether make sets $(MAKE) configure:1842: result: yes configure:2010: checking whether to enable maintainer-specific portions of Makefiles configure:2019: result: no configure:2133: checking for gcc configure:2149: found /usr/bin/gcc configure:2159: result: gcc configure:2403: checking for C compiler version configure:2406: gcc --version &5 gcc (GCC) 4.1.0 (SUSE Linux) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. configure:2409: $? = 0 configure:2411: gcc -v &5 Using built-in specs. Target: i586-suse-linux Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib --enable-languages=c,c++,objc,fortran,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.1.0 --enable-ssp --disable-libssp --enable-java-awt=gtk --enable-gtk-cairo --disable-libjava-multilib --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit --enable-libstdcxx-allocator=new --without-system-libunwind --with-cpu=generic --host=i586-suse-linux Thread model: posix gcc version 4.1.0 (SUSE Linux) configure:2414: $? = 0 configure:2416: gcc -V &5 gcc: '-V' option must have argument configure:2419: $? = 1 configure:2442: checking for C compiler default output file name configure:2445: gcc conftest.c >&5 configure:2448: $? = 0 configure:2494: result: a.out configure:2499: checking whether the C compiler works configure:2505: ./a.out configure:2508: $? = 0 configure:2525: result: yes configure:2532: checking whether we are cross compiling configure:2534: result: no configure:2537: checking for suffix of executables configure:2539: gcc -o conftest conftest.c >&5 configure:2542: $? = 0 configure:2567: result: configure:2573: checking for suffix of object files configure:2594: gcc -c conftest.c >&5 configure:2597: $? = 0 configure:2619: result: o configure:2623: checking whether we are using the GNU C compiler configure:2647: gcc -c conftest.c >&5 configure:2653: $? = 0 configure:2657: test -z || test ! -s conftest.err configure:2660: $? = 0 configure:2663: test -s conftest.o configure:2666: $? = 0 configure:2679: result: yes configure:2685: checking whether gcc accepts -g configure:2706: gcc -c -g conftest.c >&5 configure:2712: $? = 0 configure:2716: test -z || test ! -s conftest.err configure:2719: $? = 0 configure:2722: test -s conftest.o configure:2725: $? = 0 configure:2736: result: yes configure:2753: checking for gcc option to accept ANSI C configure:2823: gcc -c -g -O2 conftest.c >&5 configure:2829: $? = 0 configure:2833: test -z || test ! -s conftest.err configure:2836: $? = 0 configure:2839: test -s conftest.o configure:2842: $? = 0 configure:2860: result: none needed configure:2878: gcc -c -g -O2 conftest.c >&5 conftest.c:2: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'me' configure:2884: $? = 1 configure: failed program was: | #ifndef __cplusplus | choke me | #endif configure:3028: checking for style of include used by make configure:3056: result: GNU configure:3084: checking dependency style of gcc configure:3174: result: gcc3 configure:3196: checking how to run the C preprocessor configure:3231: gcc -E conftest.c configure:3237: $? = 0 configure:3269: gcc -E conftest.c conftest.c:13:28: error: ac_nonexistent.h: No such file or directory configure:3275: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "0.33" | #define PACKAGE_STRING "OpenCOBOL 0.33" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "0.33" | #define COB_DEBUG 1 | #define __USE_STRING_INLINES 1 | /* end confdefs.h. */ | #include configure:3314: result: gcc -E configure:3338: gcc -E conftest.c configure:3344: $? = 0 configure:3376: gcc -E conftest.c conftest.c:13:28: error: ac_nonexistent.h: No such file or directory configure:3382: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "0.33" | #define PACKAGE_STRING "OpenCOBOL 0.33" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "0.33" | #define COB_DEBUG 1 | #define __USE_STRING_INLINES 1 | /* end confdefs.h. */ | #include configure:3425: checking for egrep configure:3435: result: grep -E configure:3626: checking for ANSI C header files configure:3651: gcc -c -g -O2 conftest.c >&5 configure:3657: $? = 0 configure:3661: test -z || test ! -s conftest.err configure:3664: $? = 0 configure:3667: test -s conftest.o configure:3670: $? = 0 configure:3759: gcc -o conftest -g -O2 conftest.c >&5 conftest.c: In function 'main': conftest.c:35: warning: incompatible implicit declaration of built-in function 'exit' configure:3762: $? = 0 configure:3764: ./conftest configure:3767: $? = 0 configure:3782: result: yes configure:3806: checking for sys/types.h configure:3822: gcc -c -g -O2 conftest.c >&5 configure:3828: $? = 0 configure:3832: test -z || test ! -s conftest.err configure:3835: $? = 0 configure:3838: test -s conftest.o configure:3841: $? = 0 configure:3852: result: yes configure:3806: checking for sys/stat.h configure:3822: gcc -c -g -O2 conftest.c >&5 configure:3828: $? = 0 configure:3832: test -z || test ! -s conftest.err configure:3835: $? = 0 configure:3838: test -s conftest.o configure:3841: $? = 0 configure:3852: result: yes configure:3806: checking for stdlib.h configure:3822: gcc -c -g -O2 conftest.c >&5 configure:3828: $? = 0 configure:3832: test -z || test ! -s conftest.err configure:3835: $? = 0 configure:3838: test -s conftest.o configure:3841: $? = 0 configure:3852: result: yes configure:3806: checking for string.h configure:3822: gcc -c -g -O2 conftest.c >&5 configure:3828: $? = 0 configure:3832: test -z || test ! -s conftest.err configure:3835: $? = 0 configure:3838: test -s conftest.o configure:3841: $? = 0 configure:3852: result: yes configure:3806: checking for memory.h configure:3822: gcc -c -g -O2 conftest.c >&5 configure:3828: $? = 0 configure:3832: test -z || test ! -s conftest.err configure:3835: $? = 0 configure:3838: test -s conftest.o configure:3841: $? = 0 configure:3852: result: yes configure:3806: checking for strings.h configure:3822: gcc -c -g -O2 conftest.c >&5 configure:3828: $? = 0 configure:3832: test -z || test ! -s conftest.err configure:3835: $? = 0 configure:3838: test -s conftest.o configure:3841: $? = 0 configure:3852: result: yes configure:3806: checking for inttypes.h configure:3822: gcc -c -g -O2 conftest.c >&5 configure:3828: $? = 0 configure:3832: test -z || test ! -s conftest.err configure:3835: $? = 0 configure:3838: test -s conftest.o configure:3841: $? = 0 configure:3852: result: yes configure:3806: checking for stdint.h configure:3822: gcc -c -g -O2 conftest.c >&5 configure:3828: $? = 0 configure:3832: test -z || test ! -s conftest.err configure:3835: $? = 0 configure:3838: test -s conftest.o configure:3841: $? = 0 configure:3852: result: yes configure:3806: checking for unistd.h configure:3822: gcc -c -g -O2 conftest.c >&5 configure:3828: $? = 0 configure:3832: test -z || test ! -s conftest.err configure:3835: $? = 0 configure:3838: test -s conftest.o configure:3841: $? = 0 configure:3852: result: yes configure:3864: checking for getopt_long_only configure:3921: gcc -o conftest -g -O2 conftest.c >&5 configure:3927: $? = 0 configure:3931: test -z || test ! -s conftest.err configure:3934: $? = 0 configure:3937: test -s conftest configure:3940: $? = 0 configure:3952: result: yes configure:3970: checking kpathsea/getopt.h usability configure:3982: gcc -c -g -O2 conftest.c >&5 conftest.c:62:29: error: kpathsea/getopt.h: No such file or directory configure:3988: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "0.33" | #define PACKAGE_STRING "OpenCOBOL 0.33" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "0.33" | #define COB_DEBUG 1 | #define __USE_STRING_INLINES 1 | #define WITH_DB 3 | #define WITH_LFS64 1 | #define COB_PARAM_CHECK 1 | #define PATCH_LEVEL 0 | #define WITH_VARSEQ 1 | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | /* end confdefs.h. */ | #include | #if HAVE_SYS_TYPES_H | # include | #endif | #if HAVE_SYS_STAT_H | # include | #endif | #if STDC_HEADERS | # include | # include | #else | # if HAVE_STDLIB_H | # include | # endif | #endif | #if HAVE_STRING_H | # if !STDC_HEADERS && HAVE_MEMORY_H | # include | # endif | # include | #endif | #if HAVE_STRINGS_H | # include | #endif | #if HAVE_INTTYPES_H | # include | #else | # if HAVE_STDINT_H | # include | # endif | #endif | #if HAVE_UNISTD_H | # include | #endif | #include configure:4011: result: no configure:4015: checking kpathsea/getopt.h presence configure:4025: gcc -E conftest.c conftest.c:28:29: error: kpathsea/getopt.h: No such file or directory configure:4031: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "0.33" | #define PACKAGE_STRING "OpenCOBOL 0.33" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "0.33" | #define COB_DEBUG 1 | #define __USE_STRING_INLINES 1 | #define WITH_DB 3 | #define WITH_LFS64 1 | #define COB_PARAM_CHECK 1 | #define PATCH_LEVEL 0 | #define WITH_VARSEQ 1 | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | /* end confdefs.h. */ | #include configure:4051: result: no configure:4086: checking for kpathsea/getopt.h configure:4093: result: no configure:3970: checking getopt.h usability configure:3982: gcc -c -g -O2 conftest.c >&5 configure:3988: $? = 0 configure:3992: test -z || test ! -s conftest.err configure:3995: $? = 0 configure:3998: test -s conftest.o configure:4001: $? = 0 configure:4011: result: yes configure:4015: checking getopt.h presence configure:4025: gcc -E conftest.c configure:4031: $? = 0 configure:4051: result: yes configure:4086: checking for getopt.h configure:4093: result: yes configure:4145: checking gmp.h usability configure:4157: gcc -c -g -O2 conftest.c >&5 conftest.c:63:17: error: gmp.h: No such file or directory configure:4163: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "0.33" | #define PACKAGE_STRING "OpenCOBOL 0.33" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "0.33" | #define COB_DEBUG 1 | #define __USE_STRING_INLINES 1 | #define WITH_DB 3 | #define WITH_LFS64 1 | #define COB_PARAM_CHECK 1 | #define PATCH_LEVEL 0 | #define WITH_VARSEQ 1 | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define HAVE_GETOPT_H 1 | /* end confdefs.h. */ | #include | #if HAVE_SYS_TYPES_H | # include | #endif | #if HAVE_SYS_STAT_H | # include | #endif | #if STDC_HEADERS | # include | # include | #else | # if HAVE_STDLIB_H | # include | # endif | #endif | #if HAVE_STRING_H | # if !STDC_HEADERS && HAVE_MEMORY_H | # include | # endif | # include | #endif | #if HAVE_STRINGS_H | # include | #endif | #if HAVE_INTTYPES_H | # include | #else | # if HAVE_STDINT_H | # include | # endif | #endif | #if HAVE_UNISTD_H | # include | #endif | #include configure:4186: result: no configure:4190: checking gmp.h presence configure:4200: gcc -E conftest.c conftest.c:29:17: error: gmp.h: No such file or directory configure:4206: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "0.33" | #define PACKAGE_STRING "OpenCOBOL 0.33" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "0.33" | #define COB_DEBUG 1 | #define __USE_STRING_INLINES 1 | #define WITH_DB 3 | #define WITH_LFS64 1 | #define COB_PARAM_CHECK 1 | #define PATCH_LEVEL 0 | #define WITH_VARSEQ 1 | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define HAVE_GETOPT_H 1 | /* end confdefs.h. */ | #include configure:4226: result: no configure:4261: checking for gmp.h configure:4268: result: no configure:4278: error: gmp.h is required ## ---------------- ## ## Cache variables. ## ## ---------------- ## ac_cv_c_compiler_gnu=yes ac_cv_env_CC_set= ac_cv_env_CC_value= ac_cv_env_CFLAGS_set= ac_cv_env_CFLAGS_value= ac_cv_env_CPPFLAGS_set= ac_cv_env_CPPFLAGS_value= ac_cv_env_CPP_set= ac_cv_env_CPP_value= ac_cv_env_CXXCPP_set= ac_cv_env_CXXCPP_value= ac_cv_env_CXXFLAGS_set= ac_cv_env_CXXFLAGS_value= ac_cv_env_CXX_set= ac_cv_env_CXX_value= ac_cv_env_F77_set= ac_cv_env_F77_value= ac_cv_env_FFLAGS_set= ac_cv_env_FFLAGS_value= ac_cv_env_LDFLAGS_set= ac_cv_env_LDFLAGS_value= ac_cv_env_build_alias_set= ac_cv_env_build_alias_value= ac_cv_env_host_alias_set= ac_cv_env_host_alias_value= ac_cv_env_target_alias_set= ac_cv_env_target_alias_value= ac_cv_exeext= ac_cv_func_getopt_long_only=yes ac_cv_header_getopt_h=yes ac_cv_header_gmp_h=no ac_cv_header_inttypes_h=yes ac_cv_header_kpathsea_getopt_h=no ac_cv_header_memory_h=yes ac_cv_header_stdc=yes ac_cv_header_stdint_h=yes ac_cv_header_stdlib_h=yes ac_cv_header_string_h=yes ac_cv_header_strings_h=yes ac_cv_header_sys_stat_h=yes ac_cv_header_sys_types_h=yes ac_cv_header_unistd_h=yes ac_cv_objext=o ac_cv_path_install='/usr/bin/install -c' ac_cv_prog_AWK=gawk ac_cv_prog_CPP='gcc -E' ac_cv_prog_ac_ct_CC=gcc ac_cv_prog_cc_g=yes ac_cv_prog_cc_stdc= ac_cv_prog_egrep='grep -E' ac_cv_prog_make_make_set=yes am_cv_CC_dependencies_compiler_type=gcc3 ## ----------------- ## ## Output variables. ## ## ----------------- ## ACLOCAL='${SHELL} /usr/local/src/open-cobol-0.33/missing --run aclocal-1.9' ALLOCA='' AMDEPBACKSLASH='\' AMDEP_FALSE='#' AMDEP_TRUE='' AMTAR='${SHELL} /usr/local/src/open-cobol-0.33/missing --run tar' AR='' AS='' AUTOCONF='${SHELL} /usr/local/src/open-cobol-0.33/missing --run autoconf' AUTOHEADER='${SHELL} /usr/local/src/open-cobol-0.33/missing --run autoheader' AUTOMAKE='${SHELL} /usr/local/src/open-cobol-0.33/missing --run automake-1.9' AWK='gawk' CC='gcc' CCDEPMODE='depmode=gcc3' CFLAGS='-g -O2' COBC_LIBS='' COB_BIGENDIAN='' COB_CC='gcc' COB_CFLAGS='' COB_CONFIG_DIR='' COB_EXPORT_DYN='' COB_LDFLAGS='' COB_LIBRARY_PATH='' COB_LIBS='' COB_MODULE_EXT='' COB_PIC_FLAGS='' COB_SHARED_OPT='' CPP='gcc -E' CPPFLAGS='' CXX='' CXXCPP='' CXXDEPMODE='' CXXFLAGS='' CYGPATH_W='echo' DEFS='' DEPDIR='.deps' DLLTOOL='' ECHO='echo' ECHO_C='' ECHO_N='-n' ECHO_T='' EGREP='grep -E' EXEEXT='' F77='' FFLAGS='' GMSGFMT='' INSTALL_DATA='${INSTALL} -m 644' INSTALL_PROGRAM='${INSTALL}' INSTALL_SCRIPT='${INSTALL}' INSTALL_STRIP_PROGRAM='${SHELL} $(install_sh) -c -s' INTLLIBS='' LDFLAGS='' LIBCOB_CFLAGS='' LIBCOB_LIBS='-lm' LIBICONV='' LIBINTL='' LIBOBJS='' LIBS='' LIBTOOL='' LN_S='' LTLIBICONV='' LTLIBINTL='' LTLIBOBJS='' MAINT='#' MAINTAINER_MODE_FALSE='' MAINTAINER_MODE_TRUE='#' MAKEINFO='${SHELL} /usr/local/src/open-cobol-0.33/missing --run makeinfo' MKINSTALLDIRS='' MSGFMT='' MSGMERGE='' OBJDUMP='' OBJEXT='o' PACKAGE='open-cobol' PACKAGE_BUGREPORT='open-cobol-list@lists.sourceforge.net' PACKAGE_NAME='OpenCOBOL' PACKAGE_STRING='OpenCOBOL 0.33' PACKAGE_TARNAME='open-cobol' PACKAGE_VERSION='0.33' PATH_SEPARATOR=':' POSUB='' RANLIB='' SET_MAKE='' SHELL='/bin/sh' STRIP='' USE_NLS='' VERSION='0.33' XGETTEXT='' ac_ct_AR='' ac_ct_AS='' ac_ct_CC='gcc' ac_ct_CXX='' ac_ct_DLLTOOL='' ac_ct_F77='' ac_ct_OBJDUMP='' ac_ct_RANLIB='' ac_ct_STRIP='' am__fastdepCC_FALSE='#' am__fastdepCC_TRUE='' am__fastdepCXX_FALSE='' am__fastdepCXX_TRUE='' am__include='include' am__leading_dot='.' am__quote='' am__tar='${AMTAR} chof - "$$tardir"' am__untar='${AMTAR} xf -' bindir='${exec_prefix}/bin' build='' build_alias='' build_cpu='' build_os='' build_vendor='' datadir='${prefix}/share' exec_prefix='NONE' host='' host_alias='' host_cpu='' host_os='' host_vendor='' includedir='${prefix}/include' infodir='${prefix}/info' install_sh='/usr/local/src/open-cobol-0.33/install-sh' libdir='${exec_prefix}/lib' libexecdir='${exec_prefix}/libexec' localstatedir='${prefix}/var' mandir='${prefix}/man' mkdir_p='mkdir -p --' oldincludedir='/usr/include' prefix='NONE' program_transform_name='s,x,x,' sbindir='${exec_prefix}/sbin' sharedstatedir='${prefix}/com' sysconfdir='${prefix}/etc' target_alias='' ## ----------- ## ## confdefs.h. ## ## ----------- ## #define COB_DEBUG 1 #define COB_PARAM_CHECK 1 #define HAVE_GETOPT_H 1 #define HAVE_INTTYPES_H 1 #define HAVE_MEMORY_H 1 #define HAVE_STDINT_H 1 #define HAVE_STDLIB_H 1 #define HAVE_STRINGS_H 1 #define HAVE_STRING_H 1 #define HAVE_SYS_STAT_H 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_UNISTD_H 1 #define PACKAGE "open-cobol" #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" #define PACKAGE_NAME "OpenCOBOL" #define PACKAGE_STRING "OpenCOBOL 0.33" #define PACKAGE_TARNAME "open-cobol" #define PACKAGE_VERSION "0.33" #define PATCH_LEVEL 0 #define STDC_HEADERS 1 #define VERSION "0.33" #define WITH_DB 3 #define WITH_LFS64 1 #define WITH_VARSEQ 1 #define __USE_STRING_INLINES 1 configure: exit 1 ---------------------------------------------------------------- It can not find the GMP include file - | #include configure:4186: result: no configure:4190: checking gmp.h presence configure:4200: gcc -E conftest.c conftest.c:29:17: error: gmp.h: No such file or directory So, GMP is not correctly installed. (Or there is something screwy in your envirionment). In /usr/include, there should be gmp.h and gmpxxx.h. In /usr/lib, there should be the libraries - libgmp*. ---------------------------------------------------------------- Subject: libcob.so.1 path error I am using RH Fedora 5 and OpenCOBOL 0.33 patchlevel 0 downloaded 10/20/06. 'configure' was run without any parameters. hello.cob from the manual was used for my initial test. At runtime the 'libcob.so.1' file could not be found. It was in '/usr/local/lib/' but the runtime object was looking for it in '/usr/lib/'. As a work around I created a symbolic link: ln -s /usr/local/lib/libcob.so.1 /usr/lib/libcob.so.1 and everything worked just fine, including the test in 'tests/cobol85'. Curt I found this issue addressed in the TODO section. ---------------------------------------------------------------- That should not be necessary. From the README - ********* Note - On Linux systems, if you are installing for the -first- time, you may need to run "ldconfig" (as root). In fact, it does not hurt if you always do this. ********* ---------------------------------------------------------------- I did the following: Booted my laptop Removed the extra link (above) ran, as root, ldconfig compiled hello.cob ran './hello', got this message: ./hello: error while loading shared libraries: libcob.so.1: cannot open shared object file: No such file or directory Placed the link back in /usr/lib ran './hello', got this message: Hello World! Let me know if there is anything else I can do to help resolve this. Thanks for your help, Curt ---------------------------------------------------------------- OK. It seems that there are Red Hat distros that do not include /usr/local/lib in the default search path. eg. See http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html - Chapter 3.2, Paragraph 2. Remove the extra link. Edit /etc/ld.so.conf and add in /usr/local/lib. Run ldconfig. (You do not have to reboot to do all this) I will put a note in the README regarding Red Hat. This is rather perturbing in that RH IS searching /usr/local/include for the compile (otherwise you could not compile hello.cob), yet not searching (per default) /usr/local/lib for runtime. Weird and could cause a lot of confusion for add on packages. Note that /usr/local is the default install path for many packages. I hope RH has /usr/local/bin as part of the default PATH. Try running "cobcrun". ---------------------------------------------------------------- Everything works now - thanks! It appears /etc/ld.so.conf runs the *.conf files in /etc/ld.so.conf.d. I created OpenCOBOL.conf file in this directory. /usr/local/bin is in the default path. Curt ---------------------------------------------------------------- Subject: embedded SQL What is the current status of embedded SQL? Are you looking for contributers? Curt ---------------------------------------------------------------- Not quite sure I understand the question. SQL is not part of any COBOL standard. Major relational databases already provide a COBOL precompiler (eg. Oracle, Informix, etc.) Are you thinking about specific RDB support eg. Postgresql ? ---------------------------------------------------------------- I was thinking about mySQL support (or other open RDB). ---------------------------------------------------------------- OK. Suggest Postgresql and mySQL for starters. Well, first of all, you will have to decide exactly the SQL syntax (from the COBOL point of view) that you will support. Then you will have to provide the COBOL copy files for the equivalent of the sqlca, etc. structures relevant for each DB. That's for starters. Incidentally, many years ago, the XOPEN group brought out an SQL COBOL standard. I think I still have a copy. Must dig it out. (Anybody remember that?) ---------------------------------------------------------------- Sounds simple enough :-) I use COBOL embedded SQL on an IBM AIX box so I'm familiar with the basic operations. Recommendations from those that know the inter-workings of OpenCOBOL would be very helpful, especially on the interface design. Is there anyone else interested in getting involved with this? I think this is definately worth investigating. Curt ---------------------------------------------------------------- As a proof-of-concept I built a small interface to mysql via mysqlclient. This is NOT embedded SQL, but utilizes COBOL calls to access the database. SQL 'SELECT' results set handling was fairly straight forward. The biggest deficiency appears to be there is no was to get parameter information (type/length) on parameterized statements. It looks like the mysql folks are in the process of supplying this functionality. If anyone is interested is trying out this lightly tested and undocumented code, let me know and I'll make it available. You'll need the client and the header files from dev.mysql.com Curt ---------------------------------------------------------------- Subject: ./configure error I am running CYGWIN on a Windows XP laptop and I receive the following error: dhickey@coldhickey /cygdrive/c/OpenCOBOL/open-cobol-0.33 $ ./configure : command not found3: ./configure: line 21: syntax error near unexpected token `elif' ./configure: line 21: `elif test -n "${BASH_VERSION+set}" && (set -o posix) >/de '/null 2>&1; then I have received this same error for the 0.32 version as well. What am I missing in my setup? ---------------------------------------------------------------- I do not know. Looks like a Cygwin problem. There is nothing that is peculiar at line 21 in the configure script. Sure you are running the bash shell ? $ echo $SHELL /bin/bash Works fine here under XP. ---------------------------------------------------------------- have the same problem - did you found out what was the reason? ---------------------------------------------------------------- No and the original poster did not reply. Works fine here with W2K and WXP. You must start the bash shell from the icon on the desktop. Roger ---------------------------------------------------------------- I had this too. The problem is that Cygwin is expecting text lines to be delimited Unix-style with a line feed "\n" character, but the OpenCOBOL files have lines ending in Windows-style "\r\n" (carriage return, line feed). If you used Windows tools to get OpenCOBOL, you will probably end up with Windows-style text lines. WinZIP has an option to turn off "smart newlines" or something like that, but you could unpack from the Cygwin prompt with "gzip -d open-cobol-0.33.tar.gz;tar -xvf open-cobol-0.33.tar". If you got OpenCOBOL from CVS, WinCVS has an option on the "Globals" page - "Checkoout using Unix LF" - or you could ask someone how to use CVS from the Cygwin prompt. See http://en.wikipedia.org/wiki/Line_feed#Common_problems for some background and other suggestions. ---------------------------------------------------------------- Most certainly not. There are no "DOS" things in the source from OC 0.33. What people do with it is another question ;-) Roger ---------------------------------------------------------------- Subject: Indexed file very slow Hi, I'm trying to migrate from MF to OC Everything has been compiled but when I'm using Indexed files it's extraordinary slow compared to MF (10 times slower at less...) Any experiences, ideas or other to solve the problem ? OC 0.33 loaded 11 October 2006 Berkeley DB 4.5.20 gmp 4.21 lt 5.22 ncurses 5.5 AIX 4.3.3.10 ---------------------------------------------------------------- Yes, that's the consequence of piggybacking an ISAM functionality on top of a relational database. MF uses a modified version of IBM (formally INFORMIX) C-ISAM. Many years ago they bought the rights to the source. I have been trying to get IBM to OpenSource C-ISAM as it can't be any great revenue for them. So far without success. It might help if you, and all others who read this, also put pressure on IBM to release C-ISAM to the OpenSource community. Having said this, I have been looking at alternatives. One that MAY eventually be a possibility is VBISAM over at SourceForge. The VB has NOTHING, repeat NOTHING to do with Visual Basic :-) It comes from the originator - Trevor Van Bremen. Problem is that Trevor disappears for months at a time. I have, however, taken the code, completely revised it and put it under control of autotools (so that you can do a normal configure, make, etc. on a variety of platforms) This is still not ripe for usage. You can at least check if it will configure/make on your platform - Download at http://www.sim-basis.de/vbisam-2.0.tar.gz You will not be able to do very much with this other than the configure/make. To date, I have not found anything else that might be an alternative. ---------------------------------------------------------------- Ok. Thanks. I'll look how I can use this VBISAM to solve my problems. Knowing the origin of the problem is the start of the solution... ---------------------------------------------------------------- Well, you can't until we integrate another ISAM handler into OC :-) However, a configure/make on your AIX would provide useful info on porting. ---------------------------------------------------------------- If you want to apply pressure on IBM to opensource C-ISAM, the product manager is Andrea Reid - E-Mail areid@us.ibm.com ---------------------------------------------------------------- Latest attempt to influence IBM - ********************************** Hello Roger, the comment below from Thomas is the current & correct assessment for C-ISAM. From time to time we have looked into open sourcing C-ISAM and have decided it was not something we wanted to pursue. If there's anything else I can help you with let me know. Regards, Andrea Reid WW Informix Product Manager DB2 Information Management Software IBM Software Group areid@us.ibm.com VOICE: 530-877-6712 *************************** ---------------------------------------------------------------- Hello, I'm working on the project described above by jfrot and i have a few questions about the handling of indexed sequential files/sort. I've noticed that VBISAM (or C-ISAM) is implemented for the handling of sequential or relative files but not for indexed sequential files, nor sort So I've three questions : - Do you have statistics in the use on aix and linux platforms on the handling of indexed sequential files/sort with db berkeley ? - To enhance the performance of the handling, how could it be possible to customize the settings of the db (with set_pagesize and/or set_cachesize - with are not used in the function "indexed_open") manually or automatically - Do you think in implementing VBISAM in handling those kind of files ? If so, when ? Do you think it could take about 5 to 15 days to some developer to implement and test it ? Thanks in advance for your help. ---------------------------------------------------------------- VBISAM/C-ISAM is NOT and can NOT be used for anything in OC at the moment. Sequential/relative has nothing whatsoever to do with IS. To the questions : 1) No. 2) If your BDB is version >= 4.1 and you set DB_HOME, then this will be done automatically. (See join_environment) Note that setting DB_HOME to a directory also means that the files (when not absolute paths) land up there. 3) a) Yes b) I do not know c) See below (c) continued : C-ISAM we can forget if IBM will not opensource. VBISAM needs a bunch of mods (also applies to C-ISAM) eg. a) Support for lock on write when manually locking. b) Support for own comparison routine c) Support for Win locking (it currently does not work even under Cygwin) VBISAM also needs rigorous testing. There is no testbed for this. To get VBISAM in some sort of shape for use by OC will probably take ca. 20-30 man days. Assuming we then have required functionality, then we probably need ca. 15-20 man days for OC changes. Roger ---------------------------------------------------------------- Hello, I find that the way OC handles the different kind of files access methods used in COBOL is well designed (a set of functions for each kind of method - SEQ / REL / IS / sort). And for ISAM, the fact that the records+key and the indexes are stored in their own file is, i suppose, for general purpose. Because, (As heard in a show called Eurovision :) The results for ISAM are (with 3 simple test programs which write, read, read and rewrite records) : - AIX 4.3.3 (5 000 records with MF) : * Write < 5 s * Read < 5 s * Rewrite < 5 s - AIX 4.3.3 (5 000 records with OC) : * Write < 5 s * Read < 5 s * Rewrite = 25 min - LX RH EL AS 4 / VMWare (5 000 records with OC) : * Write < 1 s * Read < 1 s * Rewrite = 3 min 30 s - LX RH EL AS 4 / VMWare (100 000 records with OC) : * Write < 5 s * Read < 5 s * Rewrite > 8 hours Those tests show that the way the rewrite function was developped is not efficient enough for big files. I give you some details about a part of the project I'm on : the IS files are used for temporary use : - extraction from db to IS files (some IS files have huge number of records > 200 000) - calculation are made in IS files (thus no modification on key/indexes but need of rewrites data part) - this step takes more than 6 hours with MF and more than 3 days with OC (on AIX platform) - commit to db from IS files So I have two questions : - is the way the functions set for ISAM was developped by design : * so any underlying product can fit * the underlying product didn't have the needed options to implement efficient handling of indexes in ISAM without an "abstract" layer * or other reasons - since BDB version 4.x, the function associate appear to deal with indexes in a secondary db : what is your opinion in the use of this function ? ---------------------------------------------------------------- Subject: ACCEPT statement not to capture the carriage-return character. On using the ACCEPT statement to capture elementary data items, when I use MOVE to store them in a file record there appears the characters "^@" at the end of each the data item. I am interpreting this to be the carriage-return that I press after keying-in the data. How do I make these "^@" characters not to be captured and/or saved in the file? Also, is there a way that the ACCEPT statement can capture data in group fields like in Micro Focus Cobol? Thanks. ---------------------------------------------------------------- I can not reproduce this. Please post an example program. ---------------------------------------------------------------- Subject: start up hi, I'm very new to cobol. started a few hours ago, and my questions will sound very silly. installed open-cobol-0.33 and cygwin, using crimson editor for source. couldn't find a site to get what I need to install and how to do so. for $ cobc hello.cob in cygwin gives the following error: bash: cobc: command not found I appreciate any help to get me run a cobol program Aliv :-( ---------------------------------------------------------------- It looks to be (at less) a problem of 'PATH' environment variable. Add it the path to opencobol bin directory, if it is not already done. Jerome ---------------------------------------------------------------- thank you kindly. I havn't done thsi in a few years. would you possibly tell me how can I set the path? I'm a little confuse. thanks a lot ---------------------------------------------------------------- Don't know exactly how it work under cygwin because I never used it. but typing the command : set PATH = $PATH:opencobol_dir/bin where opencobol_dir is the directory where you installed OC, should work. To verify just check by cobc --help being in an other directory than opencobol_dir. the command set PATH =... must be in the appropriate file. Look at the install guide and user manual to set all the other necessary variables (LB_LIBRARY_PATH, COB_LIBRARY_PATH...) to find the standard libraries during linking. ---------------------------------------------------------------- Hi thanks a lot. I tried it in so many way but it did not work. thanks a lot, Aliv ---------------------------------------------------------------- Well, it would help if you described exactly how you did the OpenCOBOL install. Also what version of Cygwin. There are no known problems installing/using OC with a fairly recent ( < 1 - 2 year old) Cygwin. Read the README provided with the 0.33 release, make sure you have any prerequisites installed and follow the README instructions. ---------------------------------------------------------------- Subject: make errors Hi to all, well I got past my gmp.h error and was able to run configure with no errors. Now when I run make I get a DB error. Anyone have an idea of what's going on. Here is part of the cocde I get... fileio.c:236: error: 'struct indexed_file' has no member name 'db' Is this a Berkley DB issue? Thanks for any info on this ---------------------------------------------------------------- Looks like you do not have BDB (4.x) correctly installed. Do a rpm -qa | grep db- Amongst a couple of other packets you should see db-4.x.x-n db-devel-4.x.x-n If not, install these with Yast. Recheck that they are there. Then in OC, do a make distclean ./configure make and so on. Roger ---------------------------------------------------------------- Subject: Cut VALUE Hello, Normally, I develop Cobol Under Windows because I didn't know that OpenCobol exist. Now, I've discovered it and I compile my Cobol source file with it, but I've several problems. In fact, with the compiler that I used under Win, I could type : 77 Sentence PIC X(50) VALUE "Hello, how" - "are you". So, I could "cut" my VALUE. I tried to do it with OpenCobol, but it fails. How can I do this ? Thanks a lot and sorry for my language (I'm not English) ---------------------------------------------------------------- Firstly, SENTENCE is a reserved word, so you will have to change that. Then, assuming you are using fixed format (default), the continuation character '-' must be in column 7. Also the '77' should start in column 8. Roger ---------------------------------------------------------------- In fact, as I'm Belgian, I've exactly type : 77 Phrase PIC X(50) VALUE "Hello, how" - "are you". So The problem wasn't the reserved word Sentence, but I'm gonna test your solution and i'll tell you if you're right. Thanks ---------------------------------------------------------------- Probably you can also use the -free option with cobc to avoid problems linked to the number of column... ---------------------------------------------------------------- Actually, no. He specifically uses the continuation character '-'. That's only valid in fixed format. There is no continuation in free format. Continuation of literals in free format is achieved by concatenation eg. "A" & "B". Roger ---------------------------------------------------------------- Subject: Error compiling prog. with USAGE COMP-6 I have a projet with a lot of cobol sorce files with data defined USAGE COMP-6. For example 05 KEYS. 10 KEY1 PIC 9(18) COMP-6. 10 KEY2 PIC 9(18) COMP-6. 10 KEY3 PIC 9(18) COMP-6. 10 KEY4 PIC 9(18) COMP-6. 10 KEY5 PIC 9(10) COMP-6. 10 KEY6 PIC 9(18) COMP-6. 10 FILLER PIC X(16). This programs are compiled with MF Cobol (Server Express) and OpenCobol don't like: ...XXX.cpy:5: syntax error, unexpected WORD, expecting EXTERNAL or GLOBAL The project have about 5 millions of lines and I trying for compiling with OpenCobol, so I can't modify the sources. I set some compiler directives for MF: COB_OPTIONS = -cxg \ -C COPYLIST=0 \ -C DATE \ -C TIME \ -C OSEXT=cpy \ -C COPYEXT="cpy" \ -C XREF \ -C REF \ -C NOANIM \ -C ASSIGN=EXTERNAL \ -C ADDRSV=COMP-6 \ -C COMP-6=2 What can I do for solve this problem. Tanks. ---------------------------------------------------------------- COMP-6 is a RM Cobol "invention". I do not think we will ever support the weird RM non-standard syntax. Change the syntax to COMP-3 or nothing. ie. Packed or normal numeric. Note in both cases that storage allocation will be different. A simple shell script will do this. eg. Assuming you have source with prefixes ".cpy", ".cbl" - Set up a new directory eg. "mynewsource" - Then from your current source directory - for i in `ls *.cpy *.cbl` do sed -e 's/COMP-6/COMP-3/g' <$i >mynewsource/$i done That changes COMP-6 to COMP-3 globally. If you want to change to normal numeric, replace the COMP-3 in the sed statement with 6 spaces. (Why spaces? - In case you have comments in columns 73-80) Somebody may ask why we do not simply accept COMP-6 as a synonym for COMP-3. Well, the format is similar but NOT identical. COMP-3 (aka. PACKED) always has a sign "nibble" (half-byte) regardless whether it is signed/unsigned. ie. PIC 99 COMP-3 takes 2 bytes (actually 1 and 1/2, the left hand half-byte is ignored) with the right hand half-byte ("nibble") being 0xF. PIC S99 COMP-3 is the same with the right hand half-byte representing the sign - 0xC positive, 0xD negative. COMP-6 unsigned (RM) does not have any sign nibble. Therefore PIC 99 COMP-6 is 1 byte. Actually, if we did ever support this, it might make more sense to treat COMP-6 as COMP. ---------------------------------------------------------------- > COMP-6 is a RM Cobol "invention". > > I do not think we will ever support the weird RM non-standard syntax. > > Change the syntax to COMP-3 or nothing. ie. Packed or normal numeric. > > Note in both cases that storage allocation will be different. > > A simple shell script will do this. eg. > > Assuming you have source with prefixes ".cpy", ".cbl" - > Set up a new directory eg. "mynewsource" - > > Then from your current source directory - > > for i in `ls *.cpy *.cbl` > do > sed -e 's/COMP-6/COMP-3/g' <$i >mynewsource/$i > done > > That changes COMP-6 to COMP-3 globally. > > If you want to change to normal numeric, replace the COMP-3 in the sed > statement with 6 spaces. (Why spaces? - In case you have comments in > columns 73-80) > I can't do this, because in my applications COMP-6 don't means the same that COMP-3. COMP-6 is a UNSIGNED PACKED DECIMAL, in other words, without sing nibble. So an area "PIC 9(18) COMP-6" takes 9 bytes and an area "PIC X(17) also takes 9 bytes, but the left hand half-byte is ignored. But on the other hand, I'm keeping a dinamyc copy of producction source tree in a 'git' respositorie. This make that modify the sources to adjust to OpenCobol syntax increase the complexity level of this task. This project is very large, and we're to look a free Cobol Compiler that fit a our coding style. > > Somebody may ask why we do not simply accept COMP-6 as a synonym for > COMP-3. Well, the format is similar but NOT identical. COMP-3 > (aka. PACKED) always has a sign "nibble" (half-byte) regardless > whether it is signed/unsigned. > > ie. PIC 99 COMP-3 takes 2 bytes (actually 1 and 1/2, the left hand > half-byte is ignored) with the right hand half-byte ("nibble") being > 0xF. PIC S99 COMP-3 is the same with the right hand half-byte > representing the sign - 0xC positive, 0xD negative. > > COMP-6 unsigned (RM) does not have any sign nibble. Therefore PIC 99 > COMP-6 is 1 byte. > That changes COMP-6 to COMP-3 globally. > > If you want to change to normal numeric, replace the COMP-3 in the sed > statement with 6 spaces. (Why spaces? - In case you have comments in > columns 73-80) > Alright. See the next quote from MicroFocus explaining the COMP-6 Compiler Directive (remember that in my istallation is set to 2): ********************************************************************** COMP-6 Specifies whether COMP-6 data is to be held in binary or packed decimal format. Syntax: ------- >>-.---.--COMP-6--"integer"---------------->< .-/-+ Parameters: ----------- integer Must be 1 or 2. Properties: ----------- Default: COMP-6"2" Phase: Syntax check $SET: Initial Dependencies: ------------- RM or MF must be set. RM and RM"ANSI" set COMP-6"1". NORM sets COMP-6"2". Comments: --------- The possible values of integer are: 1 A binary format is used for COMP-6 data, as described in the chapter Ryan McFarland COBOL V2.0 Syntax Support in your Language Reference - Additional Topics. 2 Packed decimal format is used. If the item is signed, the format is identical to COMP-3. If the item is unsigned, no sign field is present. Even if you specify the COMP-6 directive, the reserved word COMP-6 is recognized only if it belongs to the dialect specified by RM or MF"10". Example: -------- With COMP-6"2" specified: PIC 99 COMP-6 VALUE 87 is stored in one byte as x"87" PIC S99 COMP-6 VALUE 87 is stored in two bytes as x"087C" ********************************************************************** See complete documentation on: http://supportline.microfocus.com/documentation/books/sx22sp1/cypubb.htm > > Actually, if we did ever support this, it might make more sense to > treat COMP-6 as COMP. Why? I dont understant. For legacy applications derived form RM dialects the proper form it's explained previusly in COMP-6 MF Compiler Directive (COMP-6"2"). ---------------------------------------------------------------- You do not need to quote MF stuff at me. I have been using MF since the days of MF "Level II ET" which is a couple of decades ago :-) I gave the answer in my first post. Change the application so that it is conformant to Cobol standard. I generally have had no problem in convincing customers to change their programs to be standard conformant. If you are asking is it possible that OC could support COMP-6, then, sure, we could support anything. However, as I have said in other threads, I do have a full-time job which does NOT include developing/maintaining OC. As such, feature requests like this are at the bottom of my priority list. If people would like oddball features like this, then my recommendation is to get involved in the OC source code; particularly the directories "cobc" (compiler) and "libcob" (runtime). I am willing to review any submitted code. Roger ---------------------------------------------------------------- Because this old topic is the only one that wrote about COMP-6 and I just had a quick look at COMP-6 in OC I wanted to bump it up. There are a lot of interesting things Roger mentioned (I like especially the part of "I am willing to review any submitted code"). Before having a deeper look I wanted to ask what you think about this? How should one decide what mode is used? [code] 1 A binary format is used for COMP-6 data 2 Packed decimal format is used. If the item is signed, the format is identical to COMP-3. If the item is unsigned, no sign field is present. (standard)[/code] I think if I'd have a look I would make OC use COMP-6 just as COMP-3 (no matter how the sign field looks like) or as BINARY. human BTW: I'm not using COMP-6 or plan to do so, I just want to give our nice OC an addition for easier migrations and this one looks not so hard. ---------------------------------------------------------------- Changing a program from using COMP-6 to COMP-3 (or any other USAGE) is EASY. The problem is that the DATA itself won't work. You need to CONVERT all your outside data files (databases whatever) from an unsigned (not sign nibble) packed format to a format that takes a sign nibble. If you have an odd number of 9's in the PICTURE, this is relatively easy, just convert from Pic 9(odd-number) Comp-6 to Pic S9(Odd-number) Packed-Decimal (or the non-Standard but common COMP-3). However, if the data is defined with an even numb er of 9's, then your actual files will need to ber expanded by one byte (one for the sign nibble and one for "slack"). Yes, it would be possible to convert to some other USAGE, but I think this would be the easiest way to do it. NOTE: This is anotehr place where the MF extension of allowing "makesyn" might be nice. You could actually keep your source code as COMP-6, but make it a synonym for COMP-3. ---------------------------------------------------------------- Do you have some useful examples for makesyn? If I understood [url=http://supportline.microfocus.com/documentation/books/sx22sp1/cyadir.htm#0102]makesyn command line switch from MF[/url] right there only has to be a SEARCH+REPLACE during preprocessing the COBOL file (and copybooks) to add that feature (and only allow this for two reserved words). If this would be added [url=http://supportline.microfocus.com/documentation/books/sx22sp1/cyadir.htm#0016]addsyn[/url] and maybe [url=http://supportline.microfocus.com/documentation/books/sx22sp1/cyadir.htm#0119]override[/url] (the same just with user-defined --> reserved) should be added, too. Or maybe just add a new own command line switch for doing SEARCH+REPLACE words (without checking if they are reserved or user-defined words)? Before looking at that I surely want to know how Roger's thoughts about that look like. human ---------------------------------------------------------------- [quote] wmklein wrote: Changing a program from using COMP-6 to COMP-3 (or any other USAGE) is EASY. [/quote] It is more complicated. Assume you store a date in a PIC 9(8) COMP-6. Then you can redefine it to a group DAY PIC 9(2) COMP-6, MONTH PIC 9(2) COMP-6 and YEAR PIC 9(4) COMP-6. This won't work any more if you always have a trailing sign nibble. Alex ---------------------------------------------------------------- Alex, you missed the important next sentence in your [quote]The problem is that the DATA itself won't work.[/quote] But you gave another good example for that problem. human ---------------------------------------------------------------- Subject: Copy not working & screen section question In the program use : copy openfile. Compile with : cobc -x -I/usr/local/src/cobol/cpy yourprog.cob Why are you using /usr/local for user programs ? You shouldn't be doing that. /usr/local is a system directory. This also usually means you are working as "root". DO NOT do this! (I suppose this could be a MinGW/Cygwin environment but even then you should work from the home directory) Re: screen section. There is basically no runtime support yet. Most of the syntax is accepted by the compiler. Roger ---------------------------------------------------------------- Hi to all and I have completely gotten OC 0.33 installed & working. My question is when I run cobc - x testlst.cob A simple file open, read, print & close file program. I get the following error when I run cobc and the source has the standard COBOL copy: copy openfile.cob in /usr/local/src/cobol/cpy. I get the following error: testlst.cob:78: Error: openfile: No such file or directory cob in /usr/local/src/cobol/cpy/ Anyone have an idea of what I might be doing wrong. Also could someone tell me if screen-section works or not. I see some mention of it not working yet but when I run make check I see Ncurses (libncurses) 5.2 or later referenced. If it is supported is there any documentation avail for this. Thanks ---------------------------------------------------------------- Subject: Where should OC & prog's go Thank you Roger for the help with prior post and thanks for pointing out that I should not be using "/usr/local/" directories. With being new to the Linux world could you tell me where OC 'compiler and libraries' should be placed, and where source, copy, and user built libraries should be placed in a Linux system. Should the PATH variable have the location of the OC compiler added to it? Thanks for the help. ---------------------------------------------------------------- It is correct that the default OC install places things in the /usr/local directory. This is so that users can use the compiler/runtime without changing anything in their environment and so that the compiler/runtime can be automatically found. User Cobol programs should be placed somewhere else other than system directories. eg. On Linux, when you add a user, the user usually gets (per default) a home directory of /home/. ie. Let's say you add a user ljungers. Login as ljungers and you will likely be in /home/ljungers. Put your programs/copys there and compile/execute as usual. Note for the build/install of OC, you only need root permission to do the "make install". Therefore, the usual procedure (eg. for the 0.33 prerelease) is : Login as a normal user (eg. ljungers), then : (Note, next command assumes internet connectivity and presence of the "wget" command; otherwise get the tarball in your usual manner) - wget http://www.sim-basis.de/open-cobol-0.33.tar.gz tar xzf open-cobol-0.33.tar.gz cd open-cobol-0.33 ./configure make make check sudo make install To repeat what I said. do NOT operate as "root" unless it is really necessary. Roger ---------------------------------------------------------------- Subject: Any work arounds available for the screen-section? Was wondering if there is any good work arounds that could replace the function of the screen section. I have several old Micro Focus DOS/batch programs that I would like to convert, but 1st would like to know what would be the easiest way to handle the screen-section. I'm open to any and all sugestions. Thanks for any info. ---------------------------------------------------------------- Subject: Cobol Reference Manual Where can I find some document like "Open-Cobol Reference Manual" ?. I'm testing open-cobol and I would like to have informations on ACCEPT / DISPLAY statements... :-( ---------------------------------------------------------------- Subject: several compiler and runtime errors using version 0.33 Hi COBOL user group, we want to use the open cobol compiler to migrate old COBOL IBM/MVS cobol sources to a Linux system. With the first (smaller, round about 1.000 lines of code ) cobol sources we have no problems. Now i have a cobol programm with roud about 69.000 lines and i have some problems: 1.) the created header file for the c source include several times the same declarations of a structure cob_field f0; 2.) running the changed code i have a core dump in following statement (of the generated c code) ... if (((cob_cmp((...) ... curently i'm not able to debug this function of the cobol compiler project. Can anybody give some hint's how to debug this call? -Steffen Groba- ---------------------------------------------------------------- Can you send me the offending program (and any necessary COPY files). Roger ---------------------------------------------------------------- Hello Roger, thanks for offering help. We have found in the chrismas week the error on our side. We have used a copy from the MVS System, including all procedures in one text file. Splitting the source code per programm-id, the compiler works fine and we have also not longer the error, to have sevaral times the same declarations in the include file. But today i will add a new request. Currently i'm not able call a procedure, defined in another source code file. Perhaps you can help me here? -Steffen- :-) ---------------------------------------------------------------- Sure :-) ---------------------------------------------------------------- Subject: Help Needed on ACCEPT / DISPLAY statements WORKING-STORAGE SECTION. 77 witem1 pic X(10). 77 x-funkey pic 9(04). 77 wLin pic 999. 77 wPos pic 999. PROCEDURE DIVISION. BEGIN. . move 5 to wlin move 10 to wpos . ACCEPT witem1 line wlin column wpos no beep prompt tab size 5 foreground-color 1 background-color 7 on exception x-Funkey not on exception continue END-ACCEPT. what can I do to make this work OK ? If anyone has an idea ... Thank you .. ---------------------------------------------------------------- Subject: please help to download and install opencobol compiler Hi, im new here and trying to learn cobol programming. The problem is i need compiler to test my codes but im having trouble finding free cobol compiler and thats how i end up here. Tried to download the openCobol .32 but dont know how to start the installation or do I still need to download something, if so please can anyone tell me where i can download. your friendly advise is well appreciated. Thanks ---------------------------------------------------------------- What machine/operating system ? ---------------------------------------------------------------- Subject: Calling cobol procedures from different object files I have create two small COBOL example files and tested, if i can call from one cobol file a procedure, defined in a second file. file1 (MAIN): 000020 IDENTIFICATION DIVISION. V78AVER 000030 PROGRAM-ID. TESTPRG. LV008 000170*REMARKS 03.12.90 000180 ENVIRONMENT DIVISION. V78AVER 000190 CONFIGURATION SECTION. V78AVER 000220 SPECIAL-NAMES. DECIMAL-POINT IS COMMA. V78AVER 000230 INPUT-OUTPUT SECTION. V78AVER 000350 DATA DIVISION. V78AVER 000360 FILE SECTION. V78AVER 000370* V78AVER 001140 WORKING-STORAGE SECTION. V78AVER 001150 01 TEST1 PIC S9(4) COMPUTATIONAL. 000280* 000290 88 DB-AUFRUF-OK VALUE +0. 000300 88 KEIN-WEITERER-SATZ-DA VALUE +3. 000310 88 ZEIT-ABGELAUFEN VALUE +9. 000320 88 KEINE-ET-DATEN-DA VALUE +80. 000330 88 SATZ-NICHT-DA VALUE +120. 000340 88 SATZ-NICHT-FREI VALUE +145. 000350 88 SATZ-SCHON-DA VALUE +199. 002660* PVCV000 002670 LINKAGE SECTION. V78AVER 002680/ V78AVER 002690 PROCEDURE DIVISION. V78AVER 002700 V78AVER 002710******************************************************************V78AVER 002720* *V78AVER 002730 H-STEUERUNG SECTION. V78AVER 002740* *V78AVER 002750******************************************************************V78AVER 002760* V78AVER 02768 CALL 'VTEST' USING TEST1. 002910 IF TEST1 = SATZ-SCHON-DA 002920 THEN V78AVER 002930 DISPLAY "Hallo" . V78AVER 002990 STOP RUN. file2 (PROCEDURE): 000020 IDENTIFICATION DIVISION. V78AVER 000030 PROGRAM-ID. VTEST. LV008 000170*REMARKS 03.12.90 000180 ENVIRONMENT DIVISION. V78AVER 000190 CONFIGURATION SECTION. V78AVER 000200 SOURCE-COMPUTER. IBM-370. V78AVER 000210 OBJECT-COMPUTER. IBM-370. V78AVER 000220 SPECIAL-NAMES. DECIMAL-POINT IS COMMA. V78AVER 000230 INPUT-OUTPUT SECTION. V78AVER 000350 DATA DIVISION. V78AVER 000360 FILE SECTION. V78AVER 000370* V78AVER 001140 WORKING-STORAGE SECTION. V78AVER 002670 LINKAGE SECTION. V78AVER 001150 01 TEST1 PIC S9(4) COMPUTATIONAL. 000280* 000290 88 DB-AUFRUF-OK VALUE +0. 000300 88 KEIN-WEITERER-SATZ-DA VALUE +3. 000310 88 ZEIT-ABGELAUFEN VALUE +9. 000320 88 KEINE-ET-DATEN-DA VALUE +80. 000330 88 SATZ-NICHT-DA VALUE +120. 000340 88 SATZ-NICHT-FREI VALUE +145. 000350 88 SATZ-SCHON-DA VALUE +199. 002660* PVCV000 002690 PROCEDURE DIVISION USING TEST1. V78AVER 002761 MOVE +199 TO TEST1. 027620 MOVE +0 TO TEST1. 027630 MOVE +3 TO TEST1. 027640 MOVE +9 TO TEST1. 027650 MOVE +80 TO TEST1. 027660 MOVE +120 TO TEST1. 027670 MOVE +199 TO TEST1. 002990 EXIT. V78AVER compiler call: #!/bin/sh # cobc -C \ -std=mvs \ -fixed \ -Wall \ -Wobsolete \ -ftrace \ -fdebugging-line \ -fsource-location \ VTEST.cob \ 2> TESTPRG.log cobc -C \ -std=mvs \ -fixed \ -Wall \ -Wobsolete \ -ftrace \ -fdebugging-line \ -fsource-location \ TESTPRG.cob \ -x 2>> TESTPRG.log # gcc -ggdb *.c -o TESTPRG -lm -lcob exit 0; Result: "libcob: can not find module 'VTEST' Any idea?? ---------------------------------------------------------------- Works fine here :-) roger: # cat TSTPRG.cob 000020 IDENTIFICATION DIVISION. 000030 PROGRAM-ID. TESTPRG. 000170*REMARKS 03.12.90 000180 ENVIRONMENT DIVISION. 000190 CONFIGURATION SECTION. 000220 SPECIAL-NAMES. DECIMAL-POINT IS COMMA. 000230 INPUT-OUTPUT SECTION. 000350 DATA DIVISION. 000360 FILE SECTION. 000370* 001140 WORKING-STORAGE SECTION. 001150 01 TEST1 PIC S9(4) COMPUTATIONAL. 000280* 000290 88 DB-AUFRUF-OK VALUE +0. 000300 88 KEIN-WEITERER-SATZ-DA VALUE +3. 000310 88 ZEIT-ABGELAUFEN VALUE +9. 000320 88 KEINE-ET-DATEN-DA VALUE +80. 000330 88 SATZ-NICHT-DA VALUE +120. 000340 88 SATZ-NICHT-FREI VALUE +145. 000350 88 SATZ-SCHON-DA VALUE +199. 002660* PVCV000 002670 LINKAGE SECTION. 002680/ 002690 PROCEDURE DIVISION. 002700 002710******************************************************************V78AVER 002720* *V78AVER 002730 H-STEUERUNG SECTION. 002740* *V78AVER 002750******************************************************************V78AVER 002760* 027680 CALL 'VTEST' USING TEST1. 002910 IF TEST1 = SATZ-SCHON-DA 002920 THEN 002930 DISPLAY "Hallo" . 002990 STOP RUN. roger: # cat VTEST.cob 000020 IDENTIFICATION DIVISION. 000030 PROGRAM-ID. VTEST. 000170*REMARKS 03.12.90 000180 ENVIRONMENT DIVISION. 000190 CONFIGURATION SECTION. 000200 SOURCE-COMPUTER. IBM-370. 000210 OBJECT-COMPUTER. IBM-370. 000220 SPECIAL-NAMES. DECIMAL-POINT IS COMMA. 000230 INPUT-OUTPUT SECTION. 000350 DATA DIVISION. 000360 FILE SECTION. 000370* 001140 WORKING-STORAGE SECTION. 002670 LINKAGE SECTION. 001150 01 TEST1 PIC S9(4) COMPUTATIONAL. 000280* 000290 88 DB-AUFRUF-OK VALUE +0. 000300 88 KEIN-WEITERER-SATZ-DA VALUE +3. 000310 88 ZEIT-ABGELAUFEN VALUE +9. 000320 88 KEINE-ET-DATEN-DA VALUE +80. 000330 88 SATZ-NICHT-DA VALUE +120. 000340 88 SATZ-NICHT-FREI VALUE +145. 000350 88 SATZ-SCHON-DA VALUE +199. 002660* PVCV000 002690 PROCEDURE DIVISION USING TEST1. 002761 MOVE +199 TO TEST1. 027620 MOVE +0 TO TEST1. 027630 MOVE +3 TO TEST1. 027640 MOVE +9 TO TEST1. 027650 MOVE +80 TO TEST1. 027660 MOVE +120 TO TEST1. 027670 MOVE +199 TO TEST1. 002990 EXIT. roger: # cobc -x TESTPRG.cob VTEST.cob roger: # ./TESTPRG Hallo Or - roger: # cobc -x TESTPRG.cob roger: # cobc -m VTEST.cob roger: # ./TESTPRG Hallo Or - roger: # cobc TESTPRG.cob roger: # cobc VTEST.cob roger: # cobcrun TESTPRG Hallo Note the "-m" option is implicit (create module) ---------------------------------------------------------------- Hallo Simrw, thanks also here for the correct cmpiler options. -Steffen- :-) ---------------------------------------------------------------- No probs :-) (Must get the doc up to date - Geez) Roger ---------------------------------------------------------------- Subject: Ncurses (Screen) Support for Open Cobol Users First - a big thanks to the developers of the Open Cobol project! I really like what you guys are doing with this project. For those impatient to get some sort of full screen support for their Open Cobol programs, be sure to visit my project on SF here: http://sourceforge.net/projects/cobcurses It started out as a basic Ncurses binding for Cobol programs. The project is mature enough that you can use ncurses from your Cobol programs, but I quickly discovered that ncurses is just a little tedious for the average screen application. However, it does work and can be used in an ncurses only mode. To make screen development less painful and more rapid, I am currently developing a Screen Designer framework for use with the Ncurses interface provided. The CobCurses project now fully supports hand crafted screens using "edit fields" instead of bare ncurses calls. The edit field provides sophisticated edit controls and CobCurses supports a field state machine for screen event handling. The Screen Designer is able to use screens to define screens, their screen background (with the screen painter), and define fields and field features (such as numeric verification and password masking etc.). Screen data is saved in INDEXED files. The program BGGEN (to be renamed later on), now generates WORKING-STORAGE code for screen background data, and "field info" text. Additionally it generates PROCEDURE DIVISION code for initializing arrays for screen background and field position and attribute info. The field state array is not yet produced, but will be next. To find out more, browse the CVS repository and view the file named QUICKSTART. The project already includes a few operating screens for those willing to try it. Perhaps by the time you read this, I'll have some screen shots available at the site as well. Two major current limitations of the project are: 1. Host endian order only for cobcurses.c 2. Only known to work with Open Cobol (vers 0.32) I expect that it will work with future versions of Open Cobol. I also plan to make the endianness a compilable choice (perhaps someone wants to volunteer the changes?) I hope you'll find this useful. Thanks, Warren. ---------------------------------------------------------------- I haven't thought much about the details but wouldn't it be easier to develop a WEB server interface to OpenCobol? All of the presentation software is already available (the browser). Passing form variables to an OpenCobol application seems like it sould be no more difficult than interfacing to ncurses. Curt ---------------------------------------------------------------- A web interface to Cobol is certainly an interesting idea, and I think there are good applications for that. However, depending upon what you are doing, web interfaces can be slow and clumsy for data entry operations. OTOH, I have seen data entry operators fly through text mode screens that were designed for the purpose. Anyway, nobody's insisting you accept my preferences ;-) Warren. ---------------------------------------------------------------- Just a quick update (Release 0.02): The screen designer now allows you to configure and save all field states. The generator (BGGEN) now generates all Working-Storage and Procedure Division grunt code in COPY books that you can use. Use module SD001050.cob as an example, since the screen designer now takes advantage of its own generated code. Warren. ---------------------------------------------------------------- What exactly is this ? Can we integrate runtime into OC ? Is it pdcurses compatible (Win) ? Roger ---------------------------------------------------------------- Re: Big-endian Generate COMP-5 items or handle byte-swap :-) (Depending on compile opts .-) ) Roger ---------------------------------------------------------------- Hi Roger: CobCurses is more of an "application framework" for using OpenCobol with ncurses. In this form, I doubt there would be anything that you would want to use directly in the compiler/runtime library. If you've ever done any ncurses programming in C, you know that it takes a large number of ncurses API calls to produce anything close to a "sophisticated" screen. As a result, C programmers usually wrap a number of things into higher API calls to reduce the complexity. Using Ncurses from Cobol presents an even greater challenge than C, because of the impedance mismatch between Cobol's CALL and C programs. As a result you end up moving arguments to fixed locations (PIC 9999 COMP), and passing those. For example, to move the cursor, in CobCurses you would have to do this: [code] COPY COBCURSL. {W-S items} ... MOVE 23 TO NC-POS-COLUMN MOVE 5 TO NC-POS-LINE PERFORM NC-MOVE ... COPY COBCURSQ. {CobCurses Paragraphs} [/code] You can use CobCurses this way, if you are a ncurses diehard. I quickly abandoned that idea in favour of expanding that into a "framework" that can work with a screen designer. To increase the RAD factor, I created a screen designer that let's you paint a screen background, design individual fields (with various input/edit options) and then define the field state array for the state machine (all info stored in INDEXED files). Then a screen generator blasts out two COPY books: 1. WORKING-STORAGE SECTION code 2. PROCEDURE DIVISION code COPY-ed into a template program, it then becomes much much easier to get a screen up and running, and drastically reduce the amount of debugging. The "field" interface, calls into a ncurses aware C module (cobcurses.c). Within it the complexities of insert/delete/characters and undo etc. are all handled. One other feature it supports is the "Windowed Field" concept where the field can be much larger than the actual space used on the screen (often a pain in screen design). The field state machine reduces and almost eliminates the need for special application if statements to control which field is entered next. Obviously, the application can "intervene", as is often necessary when implementing "searches" etc. What is generated is the initialization of 3 CobCurses specific arrays that define the screen background, the field positon, buffers and attributes, and finally the state array entries. What I am currently in the process of doing is bootstrapping the new screen designer using the first, mostly hand crafted one. The new one is much cleaner and reliable so far. Oh, and if I could put a little "plug" in now, I have registered a bug on the SF area regarding variable length tables. Right now CobCurses preallocates fixed sized arrays, but variable length tables would clean up my design. ;-) I know that is a winded reply- hopefully that explains better what CobCurses is about. I haven't tried pdcurses with CobCobol yet, but I expect that it "should" work. I do intend to test with pdcurses towards the end of the development cycle (I think this would be good for non-cygwin progs). As far as adding terminal support to OpenCobol, I think ncurses/pdcurses is the right way to go. I am willing to be consulted if you like about ncurses, but beyond getting CobCurses done, I don't think I really have enough free time to otherwise contribute (I have a 2 hour commute to work). Let me know if you want my email address and we can discuss it further if you like. Maybe I can contribute somehow in other ways. I'd sure like to see terminal support added. Warren. ---------------------------------------------------------------- I didn't know about the COMP-5, but that is a great idea. Is COMP-5 supported in 0.32? I guess I'll probably know before you reply ;-) Thanks, Warren. ---------------------------------------------------------------- Ok, I just tried out COMP-5 and it works like a charm. Thanks for the tip! Warren. ---------------------------------------------------------------- :-) ---------------------------------------------------------------- OK. Mail me private re support/questions. I have done curses since 1986(!) so I think I can get to grips with this. (incidentally, I wrote a (pseudo) curses package (way back-when) and only our defined interfaces : Here is the header for still actual : #if defined(__hpux) && defined(KHPUX11) #define __HP_CURSES #define _CURS_SGTTY #else /* KHPUX11 */ #ifndef _USING_DGUX #define _BOOL_T #define _CHTYPE_T typedef char bool; #ifndef KRCHTYPEDEF typedef char chtype; #endif #endif #endif /* KHPUX11 */ #ifdef NONXPG3 #include typedef struct termio SGTTY; #else #include #define _SGTTY_T typedef struct termios SGTTY; #endif #ifdef __alpha #define SINGLE #endif #ifdef KAIXBUG #ifndef __attr_t_ #define __attr_t_ typedef long attr_t; #endif #ifndef __cchar_t_ #define __cchar_t_ #define ZLC_MOD_MAX 5 typedef struct { attr_t a; wchar_t c; wchar_t z[ZLC_MOD_MAX]; } cchar_t; #endif #endif /* KAIXBUG */ #ifdef __linux__ #include "../src/linterm.h" #else #include #endif #ifdef CUR #undef CUR #endif /* CUR */ #ifdef __linux__ #define CUR termptr.type. #else #define CUR termptr. #endif #ifdef CURB #undef CURB #define CURB bool_str. static struct _bool_struct bool_str = { 0 }; static char dummypad1[32] = "\0"; #endif /* CURB */ #ifdef CURN #undef CURN #define CURN num_str. static struct _num_struct num_str = { 0 }; static char dummypad2[64] = "\0"; #endif /* CURN */ #ifdef CURS #undef CURS #define CURS cur_str. static struct _str_struct cur_str = { (char *)0 }; static char dummypad3[128] = "\0"; #define KVR2EXT #endif /* CURS */ static struct term termptr = { 0 }; #include #include #include #include #ifdef KRSELECTOK #include #endif ---------------------------------------------------------------- Very good then. You would also understand the curses programming challenges well from the Cobol side, I expect. ;-) Anyway, there's nothing in CobCurses that would be useful to the compiler project. The only possible [b]exception[/b] is that if you ever get to the point where you want a "smart field input" feature, some code could be snarfed from my cobcurses.c module if you like. Is there any roadmapped time line for terminal support in OC? Thanks, Warren. ---------------------------------------------------------------- Well, post 0.33 release. The compiler stage is pretty well set up. Just needs the runtime component. Roger ---------------------------------------------------------------- I'd be willing to contribute library code if you have the API more-or-less defined for what's needed. Email me at: [code] STRING "ve3wwg", "@", "cogeco.ca" TO EMAIL-ADDRESS. [/code] if you like. Thanks, Warren. ---------------------------------------------------------------- Subject: Ability to read from standard input Microfocus would allow me to SELECT FILE-NAME ASSIGN TO KEYBOARD when I then executed the program I would pipe to the program the input to be read. Is there an equivalent way to do this in OC? I have several utility programs to convert that all read from standard input, often being piped the output from several processes. Thanks Michael ---------------------------------------------------------------- Maybe this is too obvious, but ACCEPT reads a pipe (stdin) for example, and DISPLAY sends to standard output. I know that ACCEPT works nicely with piped commands, because I used that in a Makefile. echo Whatever | mycobolprog Warren. ---------------------------------------------------------------- The problem we have is that the code we are conveting uses the READ verb. It may be possible to convert to accept instead by moving things around. The question was if OC supported the KEYBOARD option in the Select statement or someother way to use the READ verb to obtain data from Standard Input. Thanks ---------------------------------------------------------------- I am able to use the ACCEPT verb, however, detecting end of file seems to be a problem. Previously with the SELECT ASSGIGN to KEYBOARD, the READ AT END syntax handled the end of file. How can the ACCEPT detect end of file when a file is piped to the process? ---------------------------------------------------------------- Yes, well, that is what you get for using non-standard Cobol :-) However, I will look at this MF variation and see what can be done. (We have a number of MF extensions already) Roger ---------------------------------------------------------------- OK. Pick up the latest 0.33 prerelease from the link on the home page. Or directly here : http://www.sim-basis.de/open-cobol-0.33.tar.gz ASSIGN [TO] KEYBOARD is handled specially. The file type will automatically be set to line sequential (regardless if specified). Obviously, you can only OPEN INPUT on such a file. Roger ---------------------------------------------------------------- I downloaded the linked gz file, did a fresh build, and when I run the program that attempts to use SELECT ... ASSIGN TO KEYBOARD I get the error: libcob: File does not exist (STATUS=35) File : '' Do I need to compile with the MF option? ---------------------------------------------------------------- No. Post the prog. ---------------------------------------------------------------- And how you are executing Roger ---------------------------------------------------------------- Do download/regen.. When again,, post source. Roger ---------------------------------------------------------------- Did new download and clean rebuild, now program works perfectly reading from standard input via the ASSIGN KEYBOARD syntax. Thanks Michael ---------------------------------------------------------------- OK. Thanks, that's good to know. I will also put a test in the OC test suite for this. I hope nobody wants support for ASSIGN DISPLAY ! That's not trivial. Roger ---------------------------------------------------------------- Update on last post. Actually it's not so bad. I have a test version for ASSIGN [TO] DISPLAY which appears to work correctly. This is quite nice as it allows one to program Cobol as a filter with KEYBOARD/DISPLAY and use as any other Unix command. More later when I update the prerelease. Roger ---------------------------------------------------------------- This is updated. ChangeLog's etc. is in 0.33. Roger ---------------------------------------------------------------- Subject: Segmentation vialotion message running example from opencobol manual with release 0.33 Testing the possibility of calling other C-Libs or COBOL Libs from a cobol main lib, i tested the example from your documentation 2.3 (static cobol to c). I only exchange the option -fmain with -x. The result was a "Memory acess violation on shell level. Any idea why? I'm working with gcc version 3.3.3 on SuSE 9. Thanks! ---------------------------------------------------------------- Works fine here : roger:~ # cc -c say.c roger:~ # cobc -x -c -static hello.cob roger:~ # cobc -x -o hello hello.o say.o roger:~ # ./hello Hello World! ---------------------------------------------------------------- Hello Roger, thanks for the hint with the -x optin in the link section. Perhaps it make sense to extend the user manual for release 0.33 with this needed link option. ---------------------------------------------------------------- Indeed, you are correct :-) I have sadly neglected the doc :-( Roger ---------------------------------------------------------------- Subject: Counting Trailing Blanks in Cobol Whithout resorting to a PERFORM VARYING loop on a character by character basis, how can you count trailing blanks in Open Cobol? I've tried all of the following (below), but none are supported. I believe only the first form is "standard". I did find the other 3 references on the web however. Thanks, Warren. [code] 01 B-COUNT PIC 999 VALUE 0. 01 TEST-CASE PIC X(80) VALUE "This is my string.". ... ATTEMPT-ONE. INSPECT FUNCTION REVERSE(TEST-CASE) TALLYING B-COUNT FOR ' '. ATTEMPT-TWO. INSPECT TEST-CASE IN REVERSE ORDER TALLYING B-COUNT FOR ' '. ATTEMPT-THREE. INSPECT TEST-CASE TALLYING B-COUNT FOR TRAILING BLANKS. ATTEMPT-FOUR. MOVE LENGTH-OF-STRING(TEST-CASE) TO B-COUNT. [/code] ---------------------------------------------------------------- Below refers to OC 0.33 - Almost correct :-) Attempt one should be : INSPECT FUNCTION REVERSE(TEST-CASE) TALLYING B-COUNT FOR LEADING ' '. This should be compatible with all Cobol variants. (Adheres to Cobol standard) Attempt three should be : INSPECT TEST-CASE TALLYING B-COUNT FOR TRAILING SPACE. This is NOT Cobol standard (there is no TRAILING in the standard), but OC supports this. Roger ---------------------------------------------------------------- Thanks Roger. Yes, I somehow managed to drop the LEADING from the example I posted here. Attempt three was copied from the net somewhere. That is great news that it is supported in 0.33. Implementation Question: When INSPECT FUNCTION REVERSE(TEST-CASE) is used, does just imply a reverse in semantics, or is there an actual behind the scenese 'reverse' operation being done before applying a normal INSPECT? It's just a question of effiency. Thanks, Warren. ---------------------------------------------------------------- This is a real function that allocates storage for the size of the source field, does the reverse, and returns a new field with this. (See libcob/intrinsics.c) If the question is aimed at performance then the second (non-standard) solution is better. Roger ---------------------------------------------------------------- Just to clarify the use of FUNCTION. (Applies to 0.33) FUNCTION (generally speaking, there are exceptions) can be used anywhere where a source item is valid. It always results in a new temporary field. This will have the desired characteristics dependant on the parameters. eg. FUNCTION MIN (x, y, z) with x PIC 99 y PIC 9(8) COMP z PIC 9(6)V99 will result in returning a field that has at least 8 positions before the (implied) decimal point and 2 after. It does NOT ever change the contents of parameters to the function. FUNCTION's are nestable. eg. DISPLAY FUNCTION REVERSE (FUNCTION UPPER-CASE (myfield)). Roger ---------------------------------------------------------------- Subject: OpenCOBOL on Windows Hi. Can you use OC on Windows too ? I saw it's written there as a supported platform, but there aren't any specific details about how to install it on Windows in the INSTALL file. I might be missing something. Anyway, any help on how to install OC on Windows will be appreciated. Thanks in advance. Dan Dumitru ---------------------------------------------------------------- Sergey Kashyrin maintains various binaries at : http://kiska.net/opencobol/ They are not actual development, but are at least based on 0.33. When 0.33 comes out of the door, these will be updated. Note - Sergey has been an invaluable tester for various ports to eg. AIX, HP (-UX), Win 32/64, etc. Roger ---------------------------------------------------------------- Subject: opencobol0.33+procool 10.2+linuxx86_64 Hello, Just one question: Does opencobol 0.33 work with procobol/Oracle 10.2 for linux x86_64 bits ? Thank you ---------------------------------------------------------------- Ask Oracle :-) Roger ---------------------------------------------------------------- Subject: CobCurses Release 0.4 Available (Screen Designer) I have managed to bootstrap the Screen Designer with the first mostly hand-crafted one. SD002 is the Screen Designer 2.0 program that can be used to design screens and generate a large portion of the cobol code as COPY book segments. Use program SD002010.cob as a fairly good example of how to implement a simple file maintenance screen. Unfortunately documentation is still sadly lacking, but it is moving up on the priority list. Further productivity enhancements will be added later, like the ability to generate a default set of state definition records. For now the editor otherwise seems quite stable and useful. Load/unload utilities were added so that you can backup your screen definition database. Furthermore, you should be able to build it on any open platform (you no longer need the binary indexed data files). There are both source and i386-cygwin download packages available here at [url=http://sourceforge.net/projects/cobcurses]sourceforge.net/projects/cobcurses[/url] Warren. ---------------------------------------------------------------- Within the CVS repository, you can now get documentation about the Screen Designer program. The API documentation is still outstanding, but you may not need much of that. PDF or MS-Word is available there. If you don't cvs, you can cvs browse to the document and download it that way. Also look for the template_main.cob and template_screen.cob programs. The next "file release" will build this working template. The cvs release also now includes full character set support. Enjoy, Warren. ---------------------------------------------------------------- Release 0.5 is now available. This release includes: 1) The restricted character set support in the Screen Designer for fields 2) A pair of template Cobol programs for your next screen. This is a complete and working program, but suitable as a starting template. 3) A User Guide is provided in PDF format. Download site: http://sourceforge.net/projects/cobcurses ---------------------------------------------------------------- Subject: problem in compilation(im new to cobol) Greetings to all members Im just new to cobol.I just downloaded the opencobol 0.33.and follow the instruction as written on site.im using redhat 9. un tar:tar xzfv filename ./configure make make install make clean un tar libtool tar xzfv libtool ./configure make make install make clean untar gpm tar xzfv filename ./configre make make install make clean Im sure ive done well with out any mistaken in installation.i copied the simple code of hellow world from the forum and paste it inot a file and save it hello.cob when im compling it directly like cobc hello.cob then ./hello im getting the error open share library object:libcob.so.1 then i make the link of that file and resolve that issue might be im doing that wrong so kindly tell me how to resolve that share library problem and also getting the error segmantaion fault on runing compiled.im looking forward for your kind help Regards Net_Spy ---------------------------------------------------------------- From the README - ** Note ** - On Linux systems, if you are installing for the -first- time, you may need to run "ldconfig" (as root). In fact, it does not hurt if you always do this. ** Note ** - On some Red Hat (Fedora) installations, /usr/local/lib is NOT automatically searched at runtime. Edit /etc/ld.so.conf and add /usr/local/lib to the file. Rerun "ldconfig". Also to get an executable - cobc -x hello.cob ./hello or compile to module (default - is equivalent to -m option) cobc hello.cob cobcrun hello cobc --help shows options and defaults Also from the README - (NOTE - all the following packages are normally part of a Linux distribution. Cygwin also has these as installable packages) ie. GMP and *** Note - libltdl is NOT needed when installing on Linux or Windows (including Cygwin and MingW) *** Roger ---------------------------------------------------------------- when i make open cobol i got following messages [quote]common.c:48: warning: pointer targets in initialization differ in signedness common.c:49: warning: pointer targets in initialization differ in signedness common.c:50: warning: pointer targets in initialization differ in signedness common.c:51: warning: pointer targets in initialization differ in signedness common.c:52: warning: pointer targets in initialization differ in signedness[/quote] Also when i run cobc ie cobc hello.cob i got [quote]In file included from /tmp/cob5ysiH7.c:9: /tmp/cob5ysiH7.c.h:5: warning: pointer targets in initialization differ in signedness[/quote] Also when i tried to execute file hello ie ./hello i got error as [quote]./hello: error while loading shared libraries: libcob.so.1: cannot open shared object file: No such file or directory [/quote] my shared lib libcob.so.1 found at /usr/local/lib/ i am using ubuntu 6.06 lts please help me ---------------------------------------------------------------- I don't have ld.so.conf in /etc dir after creating a new one in /etc and addind /usr/local/lib line in the file i got command ./hello worked but other problems still exist while compiling i got [quote] In file included from /tmp/cob5ysiH7.c:9: /tmp/cob5ysiH7.c.h:5: warning: pointer targets in initialization differ in signedness[/quote] and make command also results in previous post's warning [b]ie pointer targets in initialization differ in signedness[/b] ---------------------------------------------------------------- Fix your compiler :-) Let me guess - Ubuntu has released with the broken gcc 4.0 or 4.1 compiler. Roger ---------------------------------------------------------------- Actually, if you use the latest 0.33 prerelease at - http://www.sim-basis.de/open-cobol-0.33.tar.gz then there is a workaround for these broken 4.x compilers :-) ---------------------------------------------------------------- how can i upgraded to open cobol-0.33. now i am using open cobol 0.32 . I uninstalled old version and configured 0.33 and when tried the make command i got following error ------------------------------------------------------------- mkdir .libs gcc -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-stri ngs -Wmissing-prototypes -Wno-format-y2k -Wl,--export-dynamic -o .libs/cobcrun c obcrun-cobcrun.o -L/home/unni/softwares/open-cobol-0.33/libcob /home/unni/softw ares/open-cobol-0.33/libcob/.libs/libcob.so -lm -lgmp -lncurses -ldb-4.3 -ldl /home/unni/softwares/open-cobol-0.33/libcob/.libs/libcob.so: undefined reference to `mpz_init2' collect2: ld returned 1 exit status make[2]: *** [cobcrun] Error 1 make[2]: Leaving directory `/home/unni/softwares/open-cobol-0.33/bin' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/unni/softwares/open-cobol-0.33' make: *** [all] Error 2 -------------------------------------------------------- ---------------------------------------------------------------- Looks like it is not only gcc that is broken :-) "mpz_init2" is a routine in the gmp library and there is quite clearly a "-lgmp" on the command line. Do this - make distclean env | sort >env.txt ./configure 1>conf.txt 2>&1 make 1>make.txt 2>&1 Send me env.txt, conf.txt, make.txt, config.h and config.log Roger ---------------------------------------------------------------- Env.txt [quote] COLORTERM=gnome-terminal DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-9b5kRNDCLz,guid=4f2fe1458e273e7a8dae2d3dec31f800 DESKTOP_SESSION=default DISPLAY=:0.0 GDMSESSION=default GDM_XSERVER_LOCATION=local GNOME_DESKTOP_SESSION_ID=Default GNOME_KEYRING_SOCKET=/tmp/keyring-BTklF3/socket GTK_RC_FILES=/etc/gtk/gtkrc:/home/unni/.gtkrc-1.2-gnome2 HISTCONTROL=ignoredups HOME=/home/unni LANG=en_IN LANGUAGE=en_IN:en LESSCLOSE=/usr/bin/lesspipe %s %s LESSOPEN=| /usr/bin/lesspipe %s LOGNAME=unni LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.flac=01;35:*.mp3=01;35:*.mpc=01;35:*.ogg=01;35:*.wav=01;35: OLDPWD=/home/unni/softwares PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games PWD=/home/unni/softwares/open-cobol-0.33 SESSION_MANAGER=local/ubuntu:/tmp/.ICE-unix/5072 SHELL=/bin/bash SHLVL=1 SSH_AGENT_PID=5114 SSH_AUTH_SOCK=/tmp/ssh-nwDGzU5072/agent.5072 TERM=xterm USERNAME=unni USER=unni _=/usr/bin/env WINDOWID=35652977 XAUTHORITY=/home/unni/.Xauthority [/quote] ---------------------------------------------------------------- Per discussion over private mail, it was discovered that the GMP and BDB installations were screwed. Roger ---------------------------------------------------------------- thanks roger for the help i will tell the process that solved my problem. my problem in installing new 0.33 prerelease was some errors in the result of make command. the error thrown at make command is [quote]undefined reference to `mpz_init2'[/quote]. I dont know for what reason i got that error. i will quote the private email discussion with reoger [quote] roger: Looks like it is not only gcc that is broken :-) "mpz_init2" is a routine in the gmp library and there is quite clearly a "-lgmp" on the command line. Do this - make distclean env | sort >env.txt ./configure 1>conf.txt 2>&1 make 1>make.txt 2>&1 Send me env.txt, conf.txt, make.txt, config.h and config.log Roger [/quote] after sending those files i got replay as [quote]Hi, OK. Not to do with the problem, however your BDB installation is not correct - > checking for BDB db.h version >= 4.1 ... no (3.2) Here it says that /usr/include/db.h is from version 3.2 > checking for __db_open in -ldb-4.3... yes Here it says that the library is version 4.3 Make sure you have runtime AND development packages installed for BDB 4.x (as per README) Please send output from - ls -l /usr/lib/libgmp* Roger [/quote] after sending the listing [quote]Hi, Well that is not correct. It is missing some things. Are there other bits of gmp maybe in other directories ? Try - ls -l /lib/libgmp* ls -l /usr/local/lib/gmp* If neither of the above show any files, then your gmp installation is broken. Reinstall gmp (runtime and development if seperate) ( A complete/correct gmp install looks something like - ls -l /usr/lib/libgmp* -rw-r--r-- 1 root root 473418 Mar 19 2005 /usr/lib/libgmp.a -rwxr-xr-x 1 root root 779 Mar 19 2005 /usr/lib/libgmp.la lrwxrwxrwx 1 root root 15 Aug 20 2005 /usr/lib/libgmp.so -> libgmp.so.3.3.3 lrwxrwxrwx 1 root root 15 Aug 20 2005 /usr/lib/libgmp.so.3 -> libgmp.so.3.3.3 -rwxr-xr-x 1 root root 204200 Mar 19 2005 /usr/lib/libgmp.so.3.3.3 -rw-r--r-- 1 root root 31398 Mar 19 2005 /usr/lib/libgmpxx.a -rwxr-xr-x 1 root root 834 Mar 19 2005 /usr/lib/libgmpxx.la lrwxrwxrwx 1 root root 17 Aug 20 2005 /usr/lib/libgmpxx.so -> libgmpxx.so.3.0.5 lrwxrwxrwx 1 root root 17 Aug 20 2005 /usr/lib/libgmpxx.so.3 -> libgmpxx.so.3.0.5 -rwxr-xr-x 1 root root 14928 Mar 19 2005 /usr/lib/libgmpxx.so.3.0.5 ) Roger [/quote] after reinstalling gimp, i send the libgmp listing [quote]Hi, OK. That looks better. Remove the stuff in /usr/local - rm /usr/local/include/gmp* rm /usr/local/lib/libgmp* and remove the spurious 3.3 lib from /usr/lib - rm /usr/lib/libgmp.so.3.3.3 When you have done this, run - ldconfig (as root) Incidentally, where did this 3.1 gmp come from ? I can not believe that this Ubuntu version released with 3.1. (However, everything should be OK with 3.1) Now, you need to fix up your BDB and then you should be OK. Roger [/quote] first i used tar ball to install gmp and bdb i think that leads to all these problems later i used packages to install them. Hope that this will be useful to someone with same problem :-) ---------------------------------------------------------------- To be perfectly clear here and as documented in the 0.33 README - For Linux, Use the distro's packages for (development and runtime) for GMP and BDB. Roger ---------------------------------------------------------------- Subject: OPENCOBOL 0.33 for windows hi! i was looking for an open source compiler for windows XP and i read that open cobol can be used in windows (yehey!!) :) umm.. the problem is i'm having trouble installing it. so far, i have downloaded and installed MINGW 5.1.3 and CYGWIN because I read that I needed this to run Opencobol in windows. i'm not sure about my next step. I read the install guide but I couldn't quite understand it hehe. :) Where and when do you do that ./configure and the rest? :) Sorry, i'm just a super-newbie. :) I only started learning the language a week ago. May I request a step-by-step guide on installing it in windows? I would really love to use this software. Thank You!! :-) ---------------------------------------------------------------- Look down about 9 topics and you'll see what you're looking for. ---------------------------------------------------------------- I was waiting for that :-) ---------------------------------------------------------------- Subject: Migrate from MicroFocus Cobol to OpenCobol - Problem With level 03 Hello... I try to migrate from microfocus cobol on HPUX to OpenCobol on linux / Oracle 10G and I have some problems with some variables declared in level 03. For Example HPUX / Microfocus Code --> Without Problems of Execution EXEC SQL BEGIN DECLARE SECTION END-EXEC. 77 S-COUNT PIC S9(7) COMP VALUE 0. ..... 01 S-V1. 03 S-EXAMPLE-V11 PIC S9(4) COMP VALUE 0. 03 S-EXAMPLE-V12 PIC S9(2) COMP VALUE 0. 03 S-EXAMPLE-V13 PIC S9(2) COMP VALUE 0. .... EXEC SQL END DECLARE SECTION END-EXEC. ... ... ... ... EXAMPLE-FUNCTION. EXEC SQL SELECT COUNT(*) INTO :S-COUNT FROM FINCAS WHERE DAT1 = :S-EXAMPLE-V11 AND DAT2 = :S-EXAMPLE-V12 AND DAT3 = :S-EXAMPLE-V13 END-EXEC. IN HPUX THE QUERY RETURNS A VALUE N. IN OPENCOBOL-LINUX, RETURNS 0 AND SQLCODE IS = 0 I DID FOLLOWING MODIF AND WALKED... 77 S-EXAMPLE-V11 PIC S9(4) COMP VALUE 0. 77 S-EXAMPLE-V12 PIC S9(2) COMP VALUE 0. 77 S-EXAMPLE-V13 PIC S9(2) COMP VALUE 0. Somebody had similar problems.... ? Thank.. ---------------------------------------------------------------- 1) Use the latest 0.33 2) Check what compile options were used for MF. In particular, the DIALECT= and IBMCOMP directives alter the size of binary fields. If you do not have these directives then you should be OK with "-std=mf" for OC compiles. If you do, then start with "-std=bs2000". 3) To actually see what is going on, we would need to see the generated code from the Oracle preprocessor. 4) Are you sure that the fields should be defined as COMP and not COMP-5 ? Note, HP-UX on HP risc is big-endian arhcitecture, so that COMP is the same as COMP-5. As you mention Linux, you are probably on Intel x86 whereby COMP is always (compatibly) big-endian and COMP-5 is little-endian (native machine format). Roger ---------------------------------------------------------------- Roger, I updated version of OpenCobol (V 0.33) and worked. Thank you very much. - ---------------------------------------------------------------- That is nice to know :-) Everybody take note - Update to 0.33, you will not regret it. (I know that I am behind in releasing this but there seem to be always extensions that are necessary) :-) Roger ---------------------------------------------------------------- Subject: Dynamic calls on Windows platform I'm using the Windows executables provided by Sergey Kashyrin and I'm reading the documentation on opencobol.org. The documentation provides excellent examples of both static and dynamic calls on a UNIX platform. Can somebody provide an example using Windows? I've got a entry in a DLL I'd like to call. Wow, before I hit enter I hit upon an idea of how to do it but I'd like verification. If I want to dynamically call program ABC, it appears it must be in a DLL called ABC.DLL. There appears to be no way to call ABC which resides in FUBAR.DLL. Right or wrong? If this is true, I'd like to suggest a new parm on the COBC command where you can specify the library (FUBAR) to find the executable. I'm better the same applies to UNIX but I could be wrong since I don't current test on that platform. Thanks. Ed ---------------------------------------------------------------- Already there :-) I am a bit behind with the documentation. Set/export the environment COB_PRE_LOAD to the name of the library - COB_PRE_LOAD=FUBAR Roger ---------------------------------------------------------------- Excellent. Thanks. How long has this been in the code? Is it in the Windows build or do I need an update? Obviously this is a runtime export variable. Correct? Just asking, is it limited to a single DLL or do I can I specify muliple with a semicolon? ---------------------------------------------------------------- 1) It is in the Win build. 2) Yes, runtime export variable 3) You can specify multiple libs with a colon (Yep, that's not typical Win) COB_PRE_LOAD=FOO:BAR Roger ---------------------------------------------------------------- Subject: First Steps with Cobol & migration from Acucobol to OpenCobol Hello to all. My father-in-law has written more than 10 years ago a cobol program for his own company, using Acucobol running on a SCO unix server. Now he asks my help to move to a different OS and upgrade the hw without rewrite all the code. I suggest him Linux with SUSE 10.2. I've no experience with cobol programming at all, so I start from zero. I'll buy for sure some books as reference, but I'm sure some of my questions we'll be too low level for this forum. Does somebody out there have already migrated from Acucobol to OpenCobol? Suggestions & tips ? I've installed OpenCobol 0.33 under SUSE 10.2. So, I've started following the online User manual and with "hello world" , just to check if everything works fine. I'm using Kate as editor, it's ok or I need to use another one? Copy & Paste this simple program and saved as helloworld.cob compile it with cobc helloworld.cob with the following errors: helloworld.cob:1: Warning: Invalid indicator 'e' at column 7 helloworld.cob:6: Warning: File not terminated by a newline helloworld.cob:1: Error: syntax error, unexpected WORD, expecting PROGRAM_ID If I do cobcrun helloworld I've got this : libcob: Cannot find module 'helloworld' Maybe because I've got some errors in the previous steps. Maybe is something in the config file .... maybe is my poor knowledge, but for sure tomorrow I'll go to the bookstore. After this I've open one father-in-law .CBL file, saved it as .cob and compile it, with the following results : lireeuro.cob:35: Error: 'flag' cannot have PICTURE clause lireeuro.cob:71: Error: 'cf' reserved word, but not supported yet lireeuro.cob:78: Error: 'cf' reserved word, but not supported yet lireeuro.cob: In paragraph 'RIC-CF': lireeuro.cob:102: Error: 'window' undefined lireeuro.cob:102: Error: syntax error, unexpected POSITION, expecting COLUMN lireeuro.cob: In paragraph 'RCF2': lireeuro.cob:108: Error: syntax error, unexpected POSITION, expecting COLUMN lireeuro.cob:111: Error: syntax error, unexpected POSITION, expecting COLUMN lireeuro.cob: In paragraph 'RLEC1': lireeuro.cob:132: Error: syntax error, unexpected POSITION, expecting COLUMN Besides my cobol knowledge, do you think this will be a "mission impossible" migration, or it can be done? For sure some codes lines needs to be rewrite. The first thing to understand is the new syntax ... I really need a cobol book, so I can help my father-in-law with the migration. :-) Thanks in advance for your reply. eragon ---------------------------------------------------------------- I had a similar error with "position". I changed them all to "column" and my script compiled. Seems you have more problems but its a start.[quote] eragon wrote: Hello to all. My father-in-law has written more than 10 years ago a cobol program for his own company, using Acucobol running on a SCO unix server. Now he asks my help to move to a different OS and upgrade the hw without rewrite all the code. I suggest him Linux with SUSE 10.2. I've no experience with cobol programming at all, so I start from zero. I'll buy for sure some books as reference, but I'm sure some of my questions we'll be too low level for this forum. Does somebody out there have already migrated from Acucobol to OpenCobol? Suggestions & tips ? I've installed OpenCobol 0.33 under SUSE 10.2. So, I've started following the online User manual and with "hello world" , just to check if everything works fine. I'm using Kate as editor, it's ok or I need to use another one? Copy & Paste this simple program and saved as helloworld.cob compile it with cobc helloworld.cob with the following errors: helloworld.cob:1: Warning: Invalid indicator 'e' at column 7 helloworld.cob:6: Warning: File not terminated by a newline helloworld.cob:1: Error: syntax error, unexpected WORD, expecting PROGRAM_ID If I do cobcrun helloworld I've got this : libcob: Cannot find module 'helloworld' Maybe because I've got some errors in the previous steps. Maybe is something in the config file .... maybe is my poor knowledge, but for sure tomorrow I'll go to the bookstore. After this I've open one father-in-law .CBL file, saved it as .cob and compile it, with the following results : lireeuro.cob:35: Error: 'flag' cannot have PICTURE clause lireeuro.cob:71: Error: 'cf' reserved word, but not supported yet lireeuro.cob:78: Error: 'cf' reserved word, but not supported yet lireeuro.cob: In paragraph 'RIC-CF': lireeuro.cob:102: Error: 'window' undefined lireeuro.cob:102: Error: syntax error, unexpected POSITION, expecting COLUMN lireeuro.cob: In paragraph 'RCF2': lireeuro.cob:108: Error: syntax error, unexpected POSITION, expecting COLUMN lireeuro.cob:111: Error: syntax error, unexpected POSITION, expecting COLUMN lireeuro.cob: In paragraph 'RLEC1': lireeuro.cob:132: Error: syntax error, unexpected POSITION, expecting COLUMN Besides my cobol knowledge, do you think this will be a "mission impossible" migration, or it can be done? For sure some codes lines needs to be rewrite. The first thing to understand is the new syntax ... I really need a cobol book, so I can help my father-in-law with the migration. :-) Thanks in advance for your reply. eragon[/quote] ---------------------------------------------------------------- Subject: CobCurses Release 0.90 Beta Available (Screen Designer) Website: http://sourceforge.net/projects/cobcurses This release is mostly about portability and bug fixes. The two new features that were added include: 1. The Read-only field option 2. Limited mouse support (optional) The project is now in beta status. If you experience portability issues and/or bugs, please report them or post to the CobCurses forums so that they can be addressed. Thanks, Warren. Change Log: [code] VERSION 0.9 FEB 07, 2007 (Beta) 1. Expanded copy book SCREEN-FD.cob to allow for a new option (READ-ONLY-OPTION). 2. SD002040.cob now supports on screen maintenance of a 33.Read-Only Field option. 3. BGGEN now supports the necessary field initialization to make the read-only fields automatically coloured the same as the title. 4. Corrected SD002030.cob so that the title line in the paint screen would be displayed correctly. 5. Numerous adjustments to cobcurses.c for portability were made. A number of the issues were related to Cobol parameter alignment issues. Type cleanup was also done in the interest of portability. 6. Bug fixes to NC_MSG(). Now properly fills out the entire status line if given a NULL pointer value. 7. Module genkeys.c now generates free format compatible comment lines. It also now uses PIC 9(18) COMP-5 for attribute values, to avoid value truncation at the picture clause level. Now also checks if a given platform exceeds PIC 9999 for colour or key code assignments. 8. Now explicitly compiles with -std=cobol2002, so that it will compile consistently on a given platform where the defaults may be different. 9. Curses key definitions now stored in the data type PIC 9(18) COMP-5 for value safety. 10. Corrected some COMP-5 data type and size issues for greater portability. 11. Comment lines in generated or copybook definitions now use ">" in column 6 to allow compiling in programs using free format source code. 12. Bug fix in BGGEN. that was causing it to generated corrupted lines without a comment character. This was causing the compiler to treat those lines as TITLE lines. 13. Makefile has been adjusted to use -x for the OpenCobol 0.33 compiler release. You can now change a comment to have it revert to -fmain if necessary. 14. Preliminary mouse support has been added. A mouse click within the field being edited will move the cursor. When the cursor is in an action field, a mouse click can choose the field to edit now. There are some bugs in the Field Maintenance Screen related to this. Mouse events get sent to the new NC-MOUSE-EVENT callback. [/code] Thanks: Many thanks to Roger While for his invaluable assistance in pointing out portability issues and suggestions for improvement. ---------------------------------------------------------------- Sorry folks. For those that have downloaded release 0.90, you'll want to download the latest cobcurses.c from the CVS repository (browse or otherwise). A bug snuck in there that will cause the Screen Designer to hang after saving changes to the scrren background (in the screen painter). The current version of cobcurses.c (1.23) corrects this problem. Warren. ---------------------------------------------------------------- I think the 3270 mode is fairly stable now in CobCurses. In the next little while, I plan to come out with a 0.91 release. How does 3270 mode work? In 3270 mode, you do _not_ need to define any "field states" for the state machine. The numbering of the fields is not important, as long as they are unique and range from 1 to 80. As you might expect, it resembles a mainframe 3270 session (though not exactly). When your application calls NC-3270-STATE-MACHINE, the user is able to visit any editable field and entering/editing any value he chooses. No validation is performed until he terminates the form. The form is terminated when he presses ENTER or a function key (PF key). At that point, if you have declared any special editing requirements on a field (like numeric etc.) these are checked. If there are no errors, control returns to the calling application. The exception to this rule is when you define a PF key to be exempt from validation. For example, you can declare that PF12 is exempt, allowing it to function as a "cancel" PF key. This allows the user to press PF12 to return to the calling application, regardless of the edit status of any input field. This is definitely a simpler mode to work with, and much easier to program. The downside however, is that you will not be able to do interactive browsing of key fields etc. Note that within a single application, you _can_ have some subroutines using 3270 mode, and some using the former "action mode", if that makes sense. Just be aware that you cannot mix the two modes within one subroutine however. Note also, there are _no_ callbacks in 3270 mode. The 3270 mode enhancements are currently only available in CVS. I'll be making a release file soon for those that wish to wait. Enjoy, Warren. ---------------------------------------------------------------- Subject: error: cannot find -ldb Hello, new to opencobol and linux I need assitence. I'm using ubuntu 6.10 and opencobol version that comes with ubuntu. Trying to compile hello.cob ends in a error. Whats wrong? rugen@computer:~/cobol$ cobc hello.cob /usr/bin/ld: cannot find -ldb collect2: ld returned 1 exit status By the way, is there a installation description for dummies available? Kind greetings, Rugen ---------------------------------------------------------------- sudo apt-get install libdb4.4 libdb4.4-dev ---------------------------------------------------------------- Hello, after installing libdb4.4-dev (libdb4.4 was installed allready) running cobc hello.com was successfull. "Hello World!" I'm back to COBOL. ;) Thank You. ---------------------------------------------------------------- Subject: OPEN COBOL: install in WINDOWS... I'm not be able to install Open Cobol in windows... I read all the topics about but I didn't understand anything! Please help me... Thanks. ---------------------------------------------------------------- Open cobol is not directly instalable in windows for that you need emulator's which creates linux environment in windows .So you need emulator's such as [url=http://cygwin.com/]cygwin[/url] ---------------------------------------------------------------- That is not true. Sergey Kashryin has done and maintains a native Windows port. Look down at other Win topics for the link. That means there are 3 ways for Win - Cygwin MinGW Native Roger ---------------------------------------------------------------- Subject: Problem with EXIT PERFORM Problem with EXIT PERFORM Hello, When we use EXIT PERFORM in an EVALUATE statement itself in a PERFORM statement, we have an error at compilation time. Here is a source code that implements EXIT PERFORM the way we want : * $Id: EXITPERF.cbl,v 1.0 IDENTIFICATION DIVISION. PROGRAM-ID. EXITPERF. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. * INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. WORKING-STORAGE SECTION. 77 VARTXT PIC X(018) VALUE "-10000 ". 77 NEGATIF PIC 9(001) VALUE ZEROES. 77 POS-VIRGULE PIC 9(001) VALUE ZEROES. 77 I PIC 9(003) VALUE ZEROES. 77 J PIC 9(003) VALUE ZEROES. 77 ERREUR PIC 9(001) VALUE ZEROES. PROCEDURE DIVISION. DEBUT. INITIALIZE ERREUR I J NEGATIF POS-VIRGULE. DISPLAY "Nombre=" VARTXT. PERFORM WITH TEST AFTER VARYING I FROM 1 BY 1 UNTIL I >= 18 IF VARTXT(I:1) IS NUMERIC ADD 1 TO J END-IF EVALUATE VARTXT(I:1) WHEN "-" MOVE 1 TO NEGATIF WHEN "," MOVE I TO POS-VIRGULE EXIT PERFORM WHEN " " EXIT PERFORM WHEN OTHER CONTINUE END-EVALUATE END-PERFORM DISPLAY "Nombre=" VARTXT ",NEGATIF=" NEGATIF ",POS-VIRGULE=" POS-VIRGULE ",LONG NB=" J. FIN. STOP RUN . So when it is compiled, we have the following error message : $ cobc -free EXITPERF.cbl /coriolisfs/Coriolisopc410/Tmp/cob17331_0.c: In function `EXITPERF_': /coriolisfs/Coriolisopc410/Tmp/cob17331_0.c:139: label `l_14' used but not defined This is the C file generated by cobc : /* Generated from EXITPERF.cbl by cobc version 0.33 patch level 0 */ #define __USE_STRING_INLINES 1 #include #include #include #include #include #define COB_SOURCE_FILE "EXITPERF.cbl" #define COB_PACKAGE_VERSION "0.33" #define COB_PATCH_LEVEL 0 /* function prototypes */ static int EXITPERF_ (const int); int EXITPERF (void); /* functions */ int EXITPERF () { return EXITPERF_ (0); } /* end functions */ static int EXITPERF_ (const int entry) { #include "EXITPERF.c.h" /* local variables */ static int initialized = 0; static cob_field *cob_user_parameters[COB_MAX_FIELD_PARAMS]; static cob_module module = { NULL, NULL, NULL, NULL, cob_user_parameters, 0, ',', '$', '.', 1, 1, 1, 0, 0}; /* perform frame stack */ int frame_index; struct frame { int perform_through; void *return_address; } frame_stack[255]; /* Start of function code */ if (unlikely(entry < 0)) { initialized = 0; return 0; } module.next = cob_current_module; cob_current_module = &module; if (unlikely(initialized == 0)) { if (!cob_initialized) { cob_fatal_error (COB_FERROR_INITIALIZED); } cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); (*(int *) (b_2)) = 0; (*(int *) (b_3)) = 0; memcpy (b_5, "-10000", 6); memset (b_5 + 6, 32, 12); *(b_6) = 48; *(b_7) = 48; own_memset (b_8, 48, 3); own_memset (b_9, 48, 3); *(b_10) = 48; initialized = 1; } /* initialize frame stack */ frame_index = 0; frame_stack[0].perform_through = -1; /* initialize number of call params */ (*(int *) (b_3)) = cob_call_params; cob_save_call_params = cob_call_params; goto l_11; /* PROCEDURE DIVISION */ /* EXITPERF: */ l_11:; /* DEBUT: */ /* EXITPERF.cbl:28: INITIALIZE */ { *(unsigned char *)(b_10) = 48; memset (b_8, 48, 3); memset (b_9, 48, 3); *(unsigned char *)(b_6) = 48; *(unsigned char *)(b_7) = 48; } /* EXITPERF.cbl:30: DISPLAY */ { cob_new_display (0, 1, 2, &c_19, &f_5); } /* EXITPERF.cbl:31: PERFORM */ { own_memcpy (b_8, "001", 3); while (1) { { /* EXITPERF.cbl:32: IF */ { if (cob_is_numeric ((f0.size = 1, f0.data = b_5 + (cob_get_numdisp (b_8, 3) - 1), f0.attr = &a_18, &f0))) { /* EXITPERF.cbl:33: ADD */ { cob_add (&f_9, &c_22, 2); } } } /* EXITPERF.cbl:35: EVALUATE */ { if (((int)(*(b_5 + (cob_get_numdisp (b_8, 3) - 1)) - 45) == 0)) { /* EXITPERF.cbl:36: MOVE */ { *(b_6) = 49; } } else if (((int)(*(b_5 + (cob_get_numdisp (b_8, 3) - 1)) - 44) == 0)) { /* EXITPERF.cbl:37: MOVE */ { cob_move (&f_8, &f_7); } /* EXITPERF.cbl:38: EXIT */ { goto l_14; } } else if (((int)(*(b_5 + (cob_get_numdisp (b_8, 3) - 1)) - 32) == 0)) { /* EXITPERF.cbl:39: EXIT */ { goto l_16; } } else { /* EXITPERF.cbl:40: CONTINUE */ { ; } } } } if ((cob_cmp_numdisp (b_8, 3, 18) >= 0)) break; cob_add (&f_8, &c_22, 4); } /* PERFORML-EXIT15: */ l_16:; } /* EXITPERF.cbl:43: DISPLAY */ { cob_new_display (0, 1, 8, &c_19, &f_5, &c_23, &f_6, &c_24, &f_7, &c_25, &f_9); } /* FIN: */ /* EXITPERF.cbl:45: STOP */ { cob_stop_run ((*(int *) (b_2))); } cob_current_module = cob_current_module->next; return (*(int *) (b_2)); } /* end function stuff */ This is the C.h file generated by cobc : /* Generated from EXITPERF.cbl by cobc version 0.33 patch level 0 */ static unsigned char b_2[4]; /* RETURN-CODE */ static unsigned char b_3[4]; /* NUMBER-OF-CALL-PARAMETERS */ static unsigned char b_5[18]; /* VARTXT */ static unsigned char b_6[1]; /* NEGATIF */ static unsigned char b_7[1]; /* POS-VIRGULE */ static unsigned char b_8[3]; /* I */ static unsigned char b_9[3]; /* J */ static unsigned char b_10[1]; /* ERREUR */ /* attributes */ static cob_field_attr a_21 = {16, 1, 0, 0, NULL}; static cob_field_attr a_20 = {16, 3, 0, 0, NULL}; static cob_field_attr a_18 = {33, 0, 0, 0, NULL}; /* fields */ static cob_field f_6 = {1, b_6, &a_21}; /* NEGATIF */ static cob_field f_7 = {1, b_7, &a_21}; /* POS-VIRGULE */ static cob_field f_8 = {3, b_8, &a_20}; /* I */ static cob_field f_9 = {3, b_9, &a_20}; /* J */ static cob_field f_5 = {18, b_5, &a_18}; /* VARTXT */ /* constants */ static cob_field c_25 = {9, (unsigned char *)",LONG NB=", &a_18}; static cob_field c_24 = {13, (unsigned char *)",POS-VIRGULE=", &a_18}; static cob_field c_23 = {9, (unsigned char *)",NEGATIF=", &a_18}; static cob_field c_22 = {1, (unsigned char *)"1", &a_21}; static cob_field c_19 = {7, (unsigned char *)"Nombre=", &a_18}; /* cob fields */ cob_field f0; /* ---------------------------------------------- */ It seems that the only label found at the end of the perform is the last exit perform label. Thanks in advance for your help. Eric Rasoa label `l_14' used but not defined ---------------------------------------------------------------- Correct as stated. This is perfectly legal code which should work. Will have a fix later today. Will post when new tarball is available. Roger ---------------------------------------------------------------- OK. Tarball updated (0.33). Load from link at main page or directly here - http://www.sim-basis.de/open-cobol-0.33.tar.gz Roger ---------------------------------------------------------------- TY. The problem is solved. eraso :-) ---------------------------------------------------------------- Subject: cobol compile error when i add author and date-compiled with cobol source code i got following error unni@ubuntu:~/cobol$ cobc eval.cob gcc: /tmp/cob5n1ArN.c: No such file or directory gcc: no input files -----------my program----------- IDENTIFICATION DIVISION. PROGRAM-ID. EVAL. AUTHOR. UNNIKRISHNAN. DATE-WRITTEN. 23/02/2007. DATA DIVISION. WORKING-STORAGE SECTION. 01 VAR PIC 9(3). PROCEDURE DIVISION. MAIN. ACCEPT VAR. EVALUATE VAR WHEN 1 DISPLAY 'VALUE IS ONE' WHEN 2 DISPLAY 'VALUE IS TWO' WHEN OTHER DISPLAY 'VALUE IS OTHER' END-EVALUATE. STOP RUN. ------------------------------------------------------ ---------------------------------------------------------------- Compiles fine here :-) (0.33) (Assuming your source is free format) roglinux:~ # cobc -free webf.cob roglinux:~ # echo $? 0 Roger ---------------------------------------------------------------- Subject: REAL RECORD SIZE IN LINE SEQ FILE HANDLING Hello, I've a question about a problem i've met when trying to have the correct length of a "variable" record that is read from a file with fixed-length records (310 characters for example) : ... SELECT FIXVAR ASSIGN TO "$DD_TMPDIR/FIXVAR" ORGANIZATION LINE SEQUENTIAL FILE STATUS FS-FIXVAR. ... FIXVAR-T RECORD IS VARYING IN SIZE FROM 1 TO 1000 DEPENDING ON LONGUEUR. ... READ FIXVAR NOT AT END IF LONGUEUR NOT = 310 THEN ... END-IF ... after the read is done, the LONGUEUR variable is equal to 1000 and not to 310. What could be done to resolve this problem. I Thank you in advance for your help. Eric Rasoa ---------------------------------------------------------------- You can't. A fixed length record file can not be defined as anything else. ie. It can not be defined as "LINE SEQUENTIAL" and it can not be defined with "RECORD VARYING". This is exactly according to Cobol standard. Roger ---------------------------------------------------------------- Subject: Problem with parameters Hi, I wanted to try some COBOL with OpenCOBOL for my next classtest :-) and ran into a problem :-?. It seems like with 0.33 (downloaded and compiled today), the linkage section is either broken or I'm too dumb to use it correctly. (Which might be a cause of Net Express which we use at school?) I'd like to use a program as a sub-program for another one but the parameters don't seem to work. As I thought there might be a weird error in my code which I just cannot see, I took the easy "say.cob" example from the User Manual: [code] IDENTIFICATION DIVISION. PROGRAM-ID. say. ENVIRONMENT DIVISION. DATA DIVISION. LINKAGE SECTION. 01 HELLO PIC X(6). 01 WORLD PIC X(6). PROCEDURE DIVISION USING HELLO WORLD. DISPLAY HELLO WORLD. EXIT PROGRAM. [/code] However, it gets to nearly the same error as my program does: [quote] LC_ALL="en_GB" LANG="en_GB" cobc say.cob /tmp/cob25515_0.c: In function 'say_': /tmp/cob25515_0.c:95: error: 'b_4' undeclared (first use in this function) /tmp/cob25515_0.c:95: error: (Each undeclared identifier is reported only once /tmp/cob25515_0.c:95: error: for each function it appears in.) [/quote] That's the stuff it produced with 'LC_ALL="en_GB" LANG="en_GB" cobc -C say.cob' say.c.h [code] /* Generated from say.cob by cobc version 0.33 patch level 0 */ static unsigned char b_1[4]; /* RETURN-CODE */ static unsigned char b_2[4]; /* SORT-RETURN */ static unsigned char b_3[4]; /* NUMBER-OF-CALL-PARAMETERS */ /* attributes */ static cob_field_attr a_1 = {33, 0, 0, 0, NULL}; /* local/external fields */ static cob_field f_6 = {6, NULL, &a_1}; /* WORLD */ static cob_field f_5 = {6, NULL, &a_1}; /* HELLO */ /* ---------------------------------------------- */ [/code] say.c [code] /* Generated from say.cob by cobc version 0.33 patch level 0 */ #define __USE_STRING_INLINES 1 #include #include #include #include #include #define COB_SOURCE_FILE "say.cob" #define COB_PACKAGE_VERSION "0.33" #define COB_PATCH_LEVEL 0 /* function prototypes */ static int say_ (const int, unsigned char *, unsigned char *); int say (unsigned char *, unsigned char *); /* functions */ int say (unsigned char *b_5, unsigned char *b_6) { return say_ (0, b_5, b_6); } /* end functions */ static int say_ (const int entry, unsigned char *b_5, unsigned char *b_6) { #include "say.c.h" /* local variables */ static int initialized = 0; static cob_field *cob_user_parameters[COB_MAX_FIELD_PARAMS]; static cob_module module = { NULL, NULL, NULL, NULL, cob_user_parameters, 0, '.', '$', ',', 1, 1, 1, 0, 0}; /* LINKAGE SECTION */ /* perform frame stack */ int frame_index; struct frame { int perform_through; void *return_address; } frame_stack[255]; /* Start of function code */ if (unlikely(entry < 0)) { if (!initialized) { return 0; } initialized = 0; return 0; } module.next = cob_current_module; cob_current_module = &module; if (unlikely(initialized == 0)) { if (!cob_initialized) { cob_fatal_error (COB_FERROR_INITIALIZED); } cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); cob_set_cancel ((const char *)"say", (void *)say, (void *)say_); (*(int *) (b_1)) = 0; (*(int *) (b_2)) = 0; (*(int *) (b_3)) = 0; initialized = 1; } /* initialize frame stack */ frame_index = 0; frame_stack[0].perform_through = -1; /* initialize number of call params */ (*(int *) (b_3)) = cob_call_params; cob_save_call_params = cob_call_params; goto l_2; /* PROCEDURE DIVISION */ /* say: */ l_2:; /* say.cob:9: DISPLAY */ { [b]cob_new_display (0, 1, 2, (f_5.data = b_4, &f_5), (f_6.data = b_5, &f_6));[/b] } /* say.cob:10: EXIT */ { goto exit_program; } exit_program: cob_current_module = cob_current_module->next; return (*(int *) (b_1)); } /* end function stuff */ [/code] (I highlighted the line which causes the error.) Any ideas? :) ---------------------------------------------------------------- Yes, there was an error in the tarball that was uploaded yesterday. It has just now been fixed. Redownload and all should be OK. Roger ---------------------------------------------------------------- Hi, thanks, problem seems to be solved. :) Is there any reason why you don't really specify sub-versions? As far as I've seen so far, it's not really possible to understand the different 0.33 versions at all. ---------------------------------------------------------------- Well, the prerelease is provided as a courtesy by me. Normally, you would have to hop over to the OpenCOBOL SourceForge main project and do a CVS checkout to get actual status. To do a build from CVS code, you would then need the extra development tools as defined in the README (at the bottom). The tarball creation is a feature of the autoxxxx (autoconf, automake etc) created Makefiles (actually created by "make dist", which, depending on changes, would need the extra dev tools). Roger ---------------------------------------------------------------- Subject: problem (link oracle9i) Greetings to all members. Im just new to cobol.Working in asianux2.0. How can I use opencobol0.33 to link oracle9i. These are a part of my code. 12 WORKING-STORAGE SECTION. 13 EXEC SQL BEGIN DECLARE SECTION END-EXEC. 14 01 USERNAME PIC X(10). 15 01 PASSWORD PIC X(10). 16 01 DB-NAME PIC X(10). 17 01 DB-STRING PIC X(20). 18 EXEC SQL END DECLARE SECTION END-EXEC. #cobc linkOracle2.cob linkOracle2.cob:13: Error: Invalid level number 'EXEC' this is the error. What should I do? Im looking forward for your kind help Regards ---------------------------------------------------------------- That is nothing to do with linking. Pass your source code through the Oracle Cobol Preprocessor (check your Oracle documentation) and then try to compile. EXEC is NOT Cobol standard, however some Cobol implementations do support it. OpenCOBOL does not. Roger ---------------------------------------------------------------- Thank you very much. ---------------------------------------------------------------- Subject: Insatllation problem with MinGW-MSYS Hi, in trying to install opnecpobol 0.33 under windows xp using the MinGW-MSYS ide and executing the configure script. I just installed the libgmp in the environment without problems, and executed the opencobol ./configure --without-db couse i don't need the libdb functions. The configure goes ok, but executin the make, i obtain these errors: "intrinsic.c: In function `cob_intr_locale_date': intrinsic.c:2178: error: `indate' undeclared (first use in this function) intrinsic.c:2178: error: (Each undeclared identifier is reported only once intrinsic.c:2178: error: for each function it appears in.) intrinsic.c:2183: error: `p' undeclared (first use in this function) intrinsic.c:2185: error: `len' undeclared (first use in this function) intrinsic.c:2185: warning: left-hand operand of comma expression has no effect intrinsic.c:2194: error: `year' undeclared (first use in this function) intrinsic.c:2199: error: `month' undeclared (first use in this function) intrinsic.c:2203: error: `days' undeclared (first use in this function) intrinsic.c: In function `cob_intr_locale_time': intrinsic.c:2276: error: `indate' undeclared (first use in this function) intrinsic.c:2281: error: `p' undeclared (first use in this function) intrinsic.c:2283: error: `len' undeclared (first use in this function) intrinsic.c:2283: warning: left-hand operand of comma expression has no effect intrinsic.c:2292: error: `hours' undeclared (first use in this function) intrinsic.c:2297: error: `minutes' undeclared (first use in this function) intrinsic.c:2301: error: `seconds' undeclared (first use in this function) intrinsic.c: In function `cob_intr_locale_date': intrinsic.c:2185: warning: statement with no effect intrinsic.c: In function `cob_intr_locale_time': intrinsic.c:2283: warning: statement with no effect make[2]: *** [libcob_la-intrinsic.lo] Error 1 make[2]: Leaving directory `/home/mc.god/open-cobol-0.33/libcob' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/mc.god/open-cobol-0.33' make: *** [all] Error 2" Have you any idea about the cause of the problem? Thanks :) ---------------------------------------------------------------- Yes, the Win coding for these functions was not quite complete. Should be OK now. Redownload 0.33. Roger ---------------------------------------------------------------- Yeah, now it's working good! But i've got another little problem... After: ./configure --without-db make make check make install it copied cobc.exe under d:/msys/local/bin, and libgmp.dll.a under d:/msys/local/lib When i try to launch cobc.exe, i says he can't locate the configuration file: /usr/local/shared/opn-cobol/config/default.cfg I tried to copy the config folder in this path and even evrywhere in the msys folder but it says always the same. Did I miss something? Thank You very much. ---------------------------------------------------------------- Are you sure the message says - /usr/local/shared/opn-cobol/config/default.cfg That should be - /usr/local/shared/open-cobol/config/default.conf Also, you can only call the compiler ("cobc") from MSYS shell, NOT from native Win command. Roger ---------------------------------------------------------------- Sorry, the string is exactly how you said: /usr/local/shared/open-cobol/config/default.conf i made some mistakes typing ^^; And yes, i execute "cobc" from Msys shell. ---------------------------------------------------------------- OK. Please redo the "make install" and post output. The install copies the config files to the destination directory. Also what version of MinGW and MSYS do you have ? (I will test MinGW later today or tomorrow myself) Roger ---------------------------------------------------------------- Made "make install", here is the entire output: _________________________________________________________ $ make install make install-recursive make[1]: Entering directory `/home/mc.god/open-cobol-0.33' Making install in lib make[2]: Entering directory `/home/mc.god/open-cobol-0.33/lib' make[3]: Entering directory `/home/mc.god/open-cobol-0.33/lib' make[3]: Nothing to be done for `install-exec-am'. make[3]: Nothing to be done for `install-data-am'. make[3]: Leaving directory `/home/mc.god/open-cobol-0.33/lib' make[2]: Leaving directory `/home/mc.god/open-cobol-0.33/lib' Making install in libcob make[2]: Entering directory `/home/mc.god/open-cobol-0.33/libcob' make[3]: Entering directory `/home/mc.god/open-cobol-0.33/libcob' test -z "/usr/local/lib" || mkdir -p -- "/usr/local/lib" /bin/sh ../libtool --mode=install /bin/install -c 'libcob.la' '/usr/local/lib/libcob.la' /bin/install -c .libs/libcob.dll.a /usr/local/lib/libcob.dll.a base_file=`basename ${file}` dlpath=`/bin/sh 2>&1 -c '. .libs/'${base_file}'i;echo $dlname'` dldir=/usr/local/lib/`dirname $dlpath` test -d $dldir || mkdir -p $dldir /bin/install -c .libs/libcob-1.dll $dldir/libcob-1.dll chmod a+x $dldir/libcob-1.dll /bin/install -c .libs/libcob.lai /usr/local/lib/libcob.la /bin/install -c .libs/libcob.a /usr/local/lib/libcob.a chmod 644 /usr/local/lib/libcob.a ranlib /usr/local/lib/libcob.a ---------------------------------------------------------------------- Libraries have been installed in: /usr/local/lib If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-LLIBDIR' linker flag See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- test -z "/usr/local/include/libcob" || mkdir -p -- "/usr/local/include/libcob" /bin/install -c -m 644 'byteswap.h' '/usr/local/include/libcob/byteswap.h' /bin/install -c -m 644 'common.h' '/usr/local/include/libcob/common.h' /bin/install -c -m 644 'move.h' '/usr/local/include/libcob/move.h' /bin/install -c -m 644 'numeric.h' '/usr/local/include/libcob/numeric.h' /bin/install -c -m 644 'exception.def' '/usr/local/include/libcob/exception.def' /bin/install -c -m 644 'termio.h' '/usr/local/include/libcob/termio.h' /bin/install -c -m 644 'fileio.h' '/usr/local/include/libcob/fileio.h' /bin/install -c -m 644 'screenio.h' '/usr/local/include/libcob/screenio.h' /bin/install -c -m 644 'strings.h' '/usr/local/include/libcob/strings.h' /bin/install -c -m 644 'call.h' '/usr/local/include/libcob/call.h' /bin/install -c -m 644 'intrinsic.h' '/usr/local/include/libcob/intrinsic.h' /bin/install -c -m 644 'codegen.h' '/usr/local/include/libcob/codegen.h' /bin/install -c -m 644 'system.def' '/usr/local/include/libcob/system.def' make[3]: Leaving directory `/home/mc.god/open-cobol-0.33/libcob' make[2]: Leaving directory `/home/mc.god/open-cobol-0.33/libcob' Making install in cobc make[2]: Entering directory `/home/mc.god/open-cobol-0.33/cobc' make install-am make[3]: Entering directory `/home/mc.god/open-cobol-0.33/cobc' make[4]: Entering directory `/home/mc.god/open-cobol-0.33/cobc' test -z "/usr/local/bin" || mkdir -p -- "/usr/local/bin" /bin/sh ../libtool --mode=install /bin/install -c 'cobc.exe' '/usr/local/bin/cobc.exe' /bin/install -c cobc.exe /usr/local/bin/cobc.exe make[4]: Nothing to be done for `install-data-am'. make[4]: Leaving directory `/home/mc.god/open-cobol-0.33/cobc' make[3]: Leaving directory `/home/mc.god/open-cobol-0.33/cobc' make[2]: Leaving directory `/home/mc.god/open-cobol-0.33/cobc' Making install in bin make[2]: Entering directory `/home/mc.god/open-cobol-0.33/bin' make[3]: Entering directory `/home/mc.god/open-cobol-0.33/bin' test -z "/usr/local/bin" || mkdir -p -- "/usr/local/bin" /bin/sh ../libtool --mode=install /bin/install -c 'cobcrun.exe' '/usr/local/bin/cobcrun.exe' /bin/install -c .libs/cobcrun.exe /usr/local/bin/cobcrun.exe make[3]: Nothing to be done for `install-data-am'. make[3]: Leaving directory `/home/mc.god/open-cobol-0.33/bin' make[2]: Leaving directory `/home/mc.god/open-cobol-0.33/bin' Making install in po make[2]: Entering directory `/home/mc.god/open-cobol-0.33/po' if test "open-cobol" = "gettext-tools"; then \ /bin/sh .././mkinstalldirs /usr/local/share/gettext/po; \ for file in Makefile.in.in remove-potcdate.sin Makevars.template; do \ /bin/install -c -m 644 ./$file \ /usr/local/share/gettext/po/$file; \ done; \ for file in Makevars; do \ rm -f /usr/local/share/gettext/po/$file; \ done; \ else \ : ; \ fi make[2]: Leaving directory `/home/mc.god/open-cobol-0.33/po' Making install in texi make[2]: Entering directory `/home/mc.god/open-cobol-0.33/texi' make[3]: Entering directory `/home/mc.god/open-cobol-0.33/texi' make[3]: Nothing to be done for `install-exec-am'. test -z "/usr/local/info" || mkdir -p -- "/usr/local/info" /bin/install -c -m 644 './open-cobol.info' '/usr/local/info/open-cobol.info' install-info --info-dir='/usr/local/info' '/usr/local/info/open-cobol.info' make[3]: Leaving directory `/home/mc.god/open-cobol-0.33/texi' make[2]: Leaving directory `/home/mc.god/open-cobol-0.33/texi' Making install in config make[2]: Entering directory `/home/mc.god/open-cobol-0.33/config' make[3]: Entering directory `/home/mc.god/open-cobol-0.33/config' make[3]: Nothing to be done for `install-exec-am'. test -z "/usr/local/share/open-cobol/config" || mkdir -p -- "/usr/local/share/open-cobol/config" /bin/install -c -m 644 'default.conf' '/usr/local/share/open-cobol/config/default.conf' /bin/install -c -m 644 'cobol85.conf' '/usr/local/share/open-cobol/config/cobol85.conf' /bin/install -c -m 644 'cobol2002.conf' '/usr/local/share/open-cobol/config/cobol2002.conf' /bin/install -c -m 644 'v023.conf' '/usr/local/share/open-cobol/config/v023.conf' /bin/install -c -m 644 'mf.conf' '/usr/local/share/open-cobol/config/mf.conf' /bin/install -c -m 644 'ibm.conf' '/usr/local/share/open-cobol/config/ibm.conf' /bin/install -c -m 644 'mvs.conf' '/usr/local/share/open-cobol/config/mvs.conf' /bin/install -c -m 644 'bs2000.conf' '/usr/local/share/open-cobol/config/bs2000.conf' make[3]: Leaving directory `/home/mc.god/open-cobol-0.33/config' make[2]: Leaving directory `/home/mc.god/open-cobol-0.33/config' Making install in tests make[2]: Entering directory `/home/mc.god/open-cobol-0.33/tests' Making install in cobol85 make[3]: Entering directory `/home/mc.god/open-cobol-0.33/tests/cobol85' make[4]: Entering directory `/home/mc.god/open-cobol-0.33/tests/cobol85' make[4]: Nothing to be done for `install-exec-am'. make[4]: Nothing to be done for `install-data-am'. make[4]: Leaving directory `/home/mc.god/open-cobol-0.33/tests/cobol85' make[3]: Leaving directory `/home/mc.god/open-cobol-0.33/tests/cobol85' make[3]: Entering directory `/home/mc.god/open-cobol-0.33/tests' make[4]: Entering directory `/home/mc.god/open-cobol-0.33/tests' make[4]: Nothing to be done for `install-exec-am'. make[4]: Nothing to be done for `install-data-am'. make[4]: Leaving directory `/home/mc.god/open-cobol-0.33/tests' make[3]: Leaving directory `/home/mc.god/open-cobol-0.33/tests' make[2]: Leaving directory `/home/mc.god/open-cobol-0.33/tests' make[2]: Entering directory `/home/mc.god/open-cobol-0.33' make[3]: Entering directory `/home/mc.god/open-cobol-0.33' test -z "/usr/local/bin" || mkdir -p -- "/usr/local/bin" /bin/install -c 'cob-config' '/usr/local/bin/cob-config' test -z "/usr/local/include" || mkdir -p -- "/usr/local/include" /bin/install -c -m 644 'libcob.h' '/usr/local/include/libcob.h' make[3]: Leaving directory `/home/mc.god/open-cobol-0.33' make[2]: Leaving directory `/home/mc.god/open-cobol-0.33' make[1]: Leaving directory `/home/mc.god/open-cobol-0.33' _______________________________________________________________ As you can see, the process created the config folder under the right path but it doesn't recognize it: $ cobc /usr/local/share/open-cobol/config/default.conf: No such file or directory error: failed to load the initial config file I'm using MinGW 5.1.3 with gcc 3.4.5, binutils 2.17, runtime 3.11 and MSYS 1.0.10. MinGW is installed in the mingw subfolder of MSYS, and the proper path is given in /etc/fstab Thank You ^^ EDIT... I'v tried onanother machine, getting exactly the same ^^; ---------------------------------------------------------------- Yep, I can reproduce this. Weird, I do not remember having this problem last year. Until I can figure out what is going on, you can do this workaround - Assume you have MSYS in C:/msys/1.0 (change the path/name to wherever your MSYS is) - In OC directory - make distclean ./configure --datadir=C:/msys/1.0/local/share --without-db and the rest as usual. Roger ---------------------------------------------------------------- OK. This should now be fixed. Redownload 0.33 and do your normal configure. Roger ---------------------------------------------------------------- Thank you very much, I'm going to try and let you know asap ;) ---------------------------------------------------------------- Yeah! Now everything is working allright, opencobl ready to work ;) Thank you! ---------------------------------------------------------------- :-) To my mind, this is a bug in the directory mapping within MSYS/MinGW. However, a quick google revealed that other projects were having the same problem. I had to special case mingw in the configure to get the real directory name (using a command that is only available with MSYS shell - "pwd -W") Actually, this mingw test brought to light another problem whereby one of the OC tests was failing ("make check"). Also fixed. Slaps self on the wrist and says - "Repeat after me, I must do mingw ports regularly" :-) Roger Roger ---------------------------------------------------------------- Wow, glad of being helpful, do your best! ^^ ---------------------------------------------------------------- Hi, I'm having what seems like a similar problem. In any event, I've been finding it tricky to ./configure the install under mingw-msys, because it's not finding libdb (which i've plastered all over the place in frustration now). Anyway, I tried --without-db, and lo and behold, I get to make. Unfortunately, it stops at a similar point to the original poster, though the stuff before the make[] stuff is slightly different. *** Warning: This system can not link to static lib archive /mingw/lib//libgmp.l a. *** I have the capability to make that library automatically link in when *** you link to this library. But I can only do this if you have a *** shared version of the library, which you do not appear to have. gcc -shared .libs/libcob_la-common.o .libs/libcob_la-move.o .libs/libcob_la-num eric.o .libs/libcob_la-intrinsic.o .libs/libcob_la-termio.o .libs/libcob_la-file io.o .libs/libcob_la-screenio.o .libs/libcob_la-strings.o .libs/libcob_la-call.o -march=i686 -mtune=pentium4 -Wl,--export-all-symbols -Wl,--enable-auto-import -o .libs/libcob-1.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlink er .libs/libcob.dll.a Creating library file: .libs/libcob.dll.a .libs/libcob_la-numeric.o:numeric.c:(.text+0x1d8b): undefined reference to `__gmpz_init2' ... ... ... ... ... .libs/libcob_la-numeric.o:numeric.c:(.text+0x329e): undefined reference to `__gmpz_cmp' .libs/libcob_la-numeric.o:numeric.c:(.text+0x32ff): undefined reference to `__gmpz_cmp' .libs/libcob_la-intrinsic.o:intrinsic.c:(.text+0x496): undefined reference to `__gmpz_fdiv_ui' .libs/libcob_la-intrinsic.o:intrinsic.c:(.text+0x4b2): undefined reference to `__gmpz_sub_ui' .libs/libcob_la-intrinsic.o:intrinsic.c:(.text+0x1960): undefined reference to `__gmpz_fac_ui' .libs/libcob_la-intrinsic.o:intrinsic.c:(.text+0x1a9b): undefined reference to `__gmpz_get_d' .libs/libcob_la-intrinsic.o:intrinsic.c:(.text+0x1c5d): undefined reference to `__gmpz_get_d' .libs/libcob_la-intrinsic.o:intrinsic.c:(.text+0x1dfa): undefined reference to `__gmpz_get_d' .libs/libcob_la-intrinsic.o:intrinsic.c:(.text+0x1fdd): undefined reference to `__gmpz_get_d' .libs/libcob_la-intrinsic.o:intrinsic.c:(.text+0x21a3): undefined reference to `__gmpz_get_d' .libs/libcob_la-intrinsic.o:intrinsic.c:(.text+0x2369): more undefined references to `__gmpz_get_d' follow .libs/libcob_la-intrinsic.o:intrinsic.c:(.text+0x3887): undefined reference to `__gmpz_set_ui' .libs/libcob_la-intrinsic.o:intrinsic.c:(.text+0x3c8e): undefined reference to `__gmpz_set_ui' .libs/libcob_la-intrinsic.o:intrinsic.c:(.text+0x3e9e): undefined reference to `__gmpz_set_ui' .libs/libcob_la-intrinsic.o:intrinsic.c:(.text+0x3f6b): undefined reference to `__gmpz_set_ui' .libs/libcob_la-intrinsic.o:intrinsic.c:(.text+0x3fc3): undefined reference to `__gmpz_set_ui' .libs/libcob_la-intrinsic.o:intrinsic.c:(.text+0x44cd): more undefined references to `__gmpz_set_ui' follow .libs/libcob_la-intrinsic.o:intrinsic.c:(.text+0x49ac): undefined reference to `__gmpz_get_d' .libs/libcob_la-intrinsic.o:intrinsic.c:(.text+0x49e7): undefined reference to `__gmpz_get_d' .libs/libcob_la-intrinsic.o:intrinsic.c:(.text+0x4be2): undefined reference to `__gmpz_set_ui' .libs/libcob_la-intrinsic.o:intrinsic.c:(.text+0x4c14): undefined reference to `__gmpz_set_ui' .libs/libcob_la-intrinsic.o:intrinsic.c:(.text+0x4c50): undefined reference to `__gmpz_set' .libs/libcob_la-intrinsic.o:intrinsic.c:(.text+0x4cd9): undefined reference to `__gmpz_set_ui' collect2: ld returned 1 exit status make[2]: *** [libcob.la] Error 1 make[2]: Leaving directory `/home/JKN/open-cobol-0.33/libcob' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/JKN/open-cobol-0.33' make: *** [all] Error 2 Sorry about the mass of text. Anyway, installed libtool and gmp without problems, copied the bits from local/* to their equivalent directories in mingw to make sure stuff worked. It might actually be worth a shot having a complete 'how-to' guide for installing in mingw-msys, shouldn't be too large or hard to make. I'd do it myself, but unfortunately I'm more in a position to be needing it than creating it. ---------------------------------------------------------------- Nope, you did not install GMP correctly. See, within GMP. ./configure --help ---------------------------------------------------------------- Subject: How to link oracle9i(useing opencobol0.33) Im just new to cobol.Working in asianux2.0. How can I use opencobol0.33 to link oracle9i. There is only pro*cobol`s introduction in oracle doc. I need some code about this. Im looking forward for your kind help. ---------------------------------------------------------------- I state again, use and read the documentation for the Oracle Pro*COBOL Precompiler. Contact Oracle for further information. Roger ---------------------------------------------------------------- Thank you. ---------------------------------------------------------------- I hope this help You My test environment HP-UX 11.23 PA 64 Oracle 9.2.0.7 EE or SE (including programmer tools) OpenCobol 0.33.0 Set envs. ORACLE_HOME=; export ORACLE_HOME SHLIB_PATH=$SHLIB_PATH:$ORACLE_HOME/lib32; export SHLIB_PATH ORACLE_PATH=$ORACLE_HOME/bin; export ORACLE_PATH PATH=$PATH:/usr/local/bin; export PATH COB_LIBRARY_PATH=/usr/local/lib; export COB_LIBRARY_PATH Compiling a "test" program (build dynamic method) make -f $ORACLE_HOME/precomp/demo/procob2/demo_procob_32.mk \ build COBS="test.cob" EXE=test \ PCCFLAGS="sqlcheck=full userid=scott/tiger picx=varchar2 include=$PWD/../clib" \ COB=cobc COBFLAGS=-x -std=mf -fstatic-call -t test.lis COBGNTFLAGS=-m GNT=.sl :-) ---------------------------------------------------------------- Thanks for posting this example :-) I have a couple of questions regarding the params to the make. Can you send me a mail to my Sourceforge OpenCOBOL mail address and we can discuss this off of this list. Thanks. Roger ---------------------------------------------------------------- Subject: an editor for cobol in linux can anybody suggest a syntax highlighting editor for cobol in linux ---------------------------------------------------------------- vim - www.vim.org Curt ---------------------------------------------------------------- Subject: Environment variable in an assign statement Hello, In the cob_open function, the substitution of an environment variable (for AIX and LINUX) fails when the name of the variable contains an "_" character. For instance : SELECT BILAN ASSIGN TO "$DIR_ED/BILAN" with DIR_ED=/edition/0703 The substitution of the DIR_ED variable doesn't work. What could be done about that. Thanks in advance for your help. eraso ---------------------------------------------------------------- Works fine here (0.33) - IDENTIFICATION DIVISION. PROGRAM-ID. prog. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT TEST-FILE ASSIGN "$TESTENV/TEST-FILE". DATA DIVISION. FILE SECTION. FD TEST-FILE. 01 TEST-REC PIC X(10). WORKING-STORAGE SECTION. 01 X PIC X(10). PROCEDURE DIVISION. OPEN OUTPUT TEST-FILE. CLOSE TEST-FILE. STOP RUN. linux:~ # cobc -x prog.cob linux:~ # export TESTENV=/tmp linux:~ # ./prog linux:~ # ls -l /tmp/TEST-FILE -rw-r--r-- 1 root root 0 Mar 10 11:35 /tmp/TEST-FILE ---------------------------------------------------------------- Hello, FYI or as a remind, in Unix or Linux, any variable name may contain any combination of alphanumeric character and underscore character. I may insist but what if the environment variable is called TEST_ENV and not TESTENV. In this case the TEST_ENV variable is not recognized but the TESTENV variable will be by OpenCobol. So what could be done for that TEST_ENV variable in OpenCobol ? eraso ---------------------------------------------------------------- And why do you think that assign will behave this way :-) Coming from MF ? :-) Why do you think that another Cobol will do what you have already preprogrammed :-) OK. I will look at this. Roger ---------------------------------------------------------------- OK. This is fixed in the latest 0.33 tarball. Download from link on home page. Roger ---------------------------------------------------------------- Subject: Desync problem while reading sequential file Hello, With some programs treating sequential files, it appears that while reading records the stream is desynchronized. So by testing putting a ftell just after the SEEK_INIT statement, the stream is not anymore desynchronized. What is your opinion about that. eraso Platform : Linux RH EL 4 AS/VMWare. ---------------------------------------------------------------- I am sorry, but I do not understand what you are saying. What do you mean "desynchronized" ? Can you post an example. Roger ---------------------------------------------------------------- Subject: Downloaded open-cobol-0.30-1.i386.rpm Linux AS4. Hello World does not work..Please Help.. Dear all, I am using Red Hat Linux AS 4.0 and have downloaded the package open-cobol-0.30-1.i386.rpm On double-clicking the RPM package. Linux has auto-installed the RPM. I am able to use the cobc compiler. However my first program- Hello World, as given on this site does not seem to work. I get the following error message: # cobc hello.cob gcc: /tmp/cobRETwvb.c: No such file or directory gcc: no input files I have very little idea what may be wrong. Please help.... ---------------------------------------------------------------- I tried the following. And it worked. # cobc -free hello.cob # cobc hello.cob gcc: /tmp/cobVGQmXm.c: No such file or directory gcc: no input files #./hello.cob HELLO WORLD! Still could not understand, why gcc complains-No such file or directory Regards ---------------------------------------------------------------- Subject: Win32 Compilation - 'cl' Hi, Just ran into a bit of a problem trying to compile a test program using the win32 binaries provided at: http://www.kiska.net/opencobol/ Using the simple 'hello world' demo program from the first bit of the User Manual, named HW.cob, I try the following command and get the subesquent response: C:\OpenCobol>cobc -v -o C:\OpenCobol\hw.exe C:\OpenCobol\HW.cob preprocessing C:\OpenCobol\HW.cob into C:\DOCUME~1\JKN\LOKALE~1\Temp\cob50.cob translating C:\DOCUME~1\JKN\LOKALE~1\Temp\cob50.cob into C:\DOCUME~1\JKN\LOKALE~ 1\Temp\cob51.c cl -I c:/OpenCobol /MD /LD /FeC:\OpenCobol\hw.exe /FoC:\OpenCobol\hw.exe C:\DOC UME~1\JKN\LOKALE~1\Temp\cob51.c c:/OpenCobol/libcob.lib c:/OpenCobol/gmp.lib cl gjenkjennes ikke som en intern eller ekstern kommando, kjrbart program eller satsvis fil. That last bit is simply translated: 'cl is not recognized as an internal or external command, executable file', what i'm guessing would be the equivalent of 'bad command or file name'. In other words, I need to figure out what 'cl' is, where it comes from, etc. With the win32 install provided, also comes vcredist_x86.exe, which I have installed (or as far as I can tell I've installed it). Any ideas? ---------------------------------------------------------------- OC produces C code which requires a C compiler. :-) ---------------------------------------------------------------- I ended up getting Visual 2005 Express, and then having to manually edit 'path' in the command prompt so that it would be seen. Probably some nastiness on this machine, problem solved anyway. ---------------------------------------------------------------- Subject: Installation Problem with OpenCobol on *Ubuntu Linux Hello, I tried to install OpenCobol on *Ubuntu but i've the following problem: In Compilation phase it don't worked and it blocks in output i had the following: [quote]checking for C compiler default output file name... a.out[/quote] Why? Which is the problem? With Slackware, Mandriva and Vector Linux it works well. Thanks ---------------------------------------------------------------- You have given nothng to work on. As I have repeatedly said on this list, more info is better than no info. Post all relevant details. Including : Ubuntu revision gcc version config.log and anything else that may be useful. eg. Is this the latest OC 0.33 tarball ? Roger ---------------------------------------------------------------- Excuse me for the little information given. Now i try to remedy!! Ubuntu distribution ver 6.10 GCC ver. 4.x. I have tried to install the version 3.x but with this version it had the same problems. Now i don't have the config.log file to disposition since I am on an other computer. However i think that is a problem of the distribution Ubuntu. What do you think about? Thanks ---------------------------------------------------------------- Soryy, but with so little information, I can not help. I need at least the config.log. Can you compile a simple C program ? Roger ---------------------------------------------------------------- That's the config.log files!!! Thanks Bye bye Gabry CONFIG-OPENCOBOL.LOG [code]This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by OpenCOBOL configure 0.32, which was generated by GNU Autoconf 2.59. Invocation command line was $ ./configure --prefix=/opt/local/opencobol ## --------- ## ## Platform. ## ## --------- ## hostname = gabry-laptop uname -m = i686 uname -r = 2.6.17-10-generic uname -s = Linux uname -v = #2 SMP Fri Oct 13 18:45:35 UTC 2006 /usr/bin/uname -p = unknown /bin/uname -X = unknown /bin/arch = i686 /usr/bin/arch -k = unknown /usr/convex/getsysinfo = unknown hostinfo = unknown /bin/machine = unknown /usr/bin/oslevel = unknown /bin/universe = unknown PATH: /usr/local/sbin PATH: /usr/local/bin PATH: /usr/sbin PATH: /usr/bin PATH: /sbin PATH: /bin PATH: /usr/bin/X11 PATH: /usr/games ## ----------- ## ## Core tests. ## ## ----------- ## configure:1583: checking for a BSD-compatible install configure:1638: result: /usr/bin/install -c configure:1649: checking whether build environment is sane configure:1692: result: yes configure:1749: checking for gawk configure:1778: result: no configure:1749: checking for mawk configure:1765: found /usr/bin/mawk configure:1775: result: mawk configure:1785: checking whether make sets $(MAKE) configure:1805: result: yes configure:1969: checking whether to enable maintainer-specific portions of Makefiles configure:1978: result: no configure:2032: checking for gcc configure:2048: found /usr/bin/gcc configure:2058: result: gcc configure:2164: checking for style of include used by make configure:2192: result: GNU configure:2263: checking for gcc configure:2279: found /usr/bin/gcc configure:2289: result: gcc configure:2533: checking for C compiler version configure:2536: gcc --version &5 gcc (GCC) 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. configure:2539: $? = 0 configure:2541: gcc -v &5 Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) configure:2544: $? = 0 configure:2546: gcc -V &5 gcc: '-V' option must have argument configure:2549: $? = 1 configure:2572: checking for C compiler default output file name configure:2575: gcc conftest.c >&5 /usr/bin/ld: crt1.o: No such file: No such file or directory collect2: ld returned 1 exit status configure:2578: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "0.32" | #define PACKAGE_STRING "OpenCOBOL 0.32" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "0.32" | #define COB_DEBUG 1 | /* end confdefs.h. */ | | int | main () | { | | ; | return 0; | } configure:2617: error: C compiler cannot create executables See `config.log' for more details. ## ---------------- ## ## Cache variables. ## ## ---------------- ## ac_cv_env_CC_set= ac_cv_env_CC_value= ac_cv_env_CFLAGS_set= ac_cv_env_CFLAGS_value= ac_cv_env_CPPFLAGS_set= ac_cv_env_CPPFLAGS_value= ac_cv_env_CPP_set= ac_cv_env_CPP_value= ac_cv_env_CXXCPP_set= ac_cv_env_CXXCPP_value= ac_cv_env_CXXFLAGS_set= ac_cv_env_CXXFLAGS_value= ac_cv_env_CXX_set= ac_cv_env_CXX_value= ac_cv_env_F77_set= ac_cv_env_F77_value= ac_cv_env_FFLAGS_set= ac_cv_env_FFLAGS_value= ac_cv_env_LDFLAGS_set= ac_cv_env_LDFLAGS_value= ac_cv_env_build_alias_set= ac_cv_env_build_alias_value= ac_cv_env_host_alias_set= ac_cv_env_host_alias_value= ac_cv_env_target_alias_set= ac_cv_env_target_alias_value= ac_cv_path_install='/usr/bin/install -c' ac_cv_prog_AWK=mawk ac_cv_prog_COB_CC=gcc ac_cv_prog_ac_ct_CC=gcc ac_cv_prog_make_make_set=yes ## ----------------- ## ## Output variables. ## ## ----------------- ## ACLOCAL='${SHELL} /home/gabry/Desktop/OpenCobolSource/open-cobol-0.32/missing --run aclocal-1.8' ALLOCA='' AMDEPBACKSLASH='\' AMDEP_FALSE='#' AMDEP_TRUE='' AMTAR='${SHELL} /home/gabry/Desktop/OpenCobolSource/open-cobol-0.32/missing --run tar' AR='' AS='' AUTOCONF='${SHELL} /home/gabry/Desktop/OpenCobolSource/open-cobol-0.32/missing --run autoconf' AUTOHEADER='${SHELL} /home/gabry/Desktop/OpenCobolSource/open-cobol-0.32/missing --run autoheader' AUTOMAKE='${SHELL} /home/gabry/Desktop/OpenCobolSource/open-cobol-0.32/missing --run automake-1.8' AWK='mawk' CC='gcc' CCDEPMODE='' CFLAGS='' COBCRUN_SHARED_FALSE='' COBCRUN_SHARED_TRUE='' COBC_CFLAGS='' COBC_LIBS='' COB_CC='gcc' COB_CFLAGS='' COB_CONFIG_DIR='' COB_EXPORT_DYN='' COB_LIBRARY_PATH='' COB_LIBS='' COB_MODULE_EXT='' COB_PIC_FLAGS='' COB_SHARED_OPT='' COB_STRIP_CMD='' CPP='' CPPFLAGS='' CXX='' CXXCPP='' CXXDEPMODE='' CXXFLAGS='' CYGPATH_W='echo' DEFS='' DEPDIR='.deps' DLLTOOL='' ECHO='echo' ECHO_C='' ECHO_N='-n' ECHO_T='' EGREP='' EXEEXT='' F77='' FFLAGS='' GMSGFMT='' INSTALL_DATA='${INSTALL} -m 644' INSTALL_PROGRAM='${INSTALL}' INSTALL_SCRIPT='${INSTALL}' INSTALL_STRIP_PROGRAM='${SHELL} $(install_sh) -c -s' INTLLIBS='' LDFLAGS='' LIBCOB_CFLAGS='' LIBCOB_LIBS='-lm' LIBICONV='' LIBINTL='' LIBOBJS='' LIBS='' LIBTOOL='' LN_S='' LTLIBICONV='' LTLIBINTL='' LTLIBOBJS='' MAINT='#' MAINTAINER_MODE_FALSE='' MAINTAINER_MODE_TRUE='#' MAKEINFO='${SHELL} /home/gabry/Desktop/OpenCobolSource/open-cobol-0.32/missing --run makeinfo' MKINSTALLDIRS='' MSGFMT='' MSGMERGE='' OBJDUMP='' OBJEXT='' PACKAGE='open-cobol' PACKAGE_BUGREPORT='open-cobol-list@lists.sourceforge.net' PACKAGE_NAME='OpenCOBOL' PACKAGE_STRING='OpenCOBOL 0.32' PACKAGE_TARNAME='open-cobol' PACKAGE_VERSION='0.32' PATH_SEPARATOR=':' POSUB='' RANLIB='' SET_MAKE='' SHELL='/bin/bash' STRIP='' USE_NLS='' VERSION='0.32' XGETTEXT='' ac_ct_AR='' ac_ct_AS='' ac_ct_CC='gcc' ac_ct_CXX='' ac_ct_DLLTOOL='' ac_ct_F77='' ac_ct_OBJDUMP='' ac_ct_RANLIB='' ac_ct_STRIP='' am__fastdepCC_FALSE='' am__fastdepCC_TRUE='' am__fastdepCXX_FALSE='' am__fastdepCXX_TRUE='' am__include='include' am__leading_dot='.' am__quote='' bindir='${exec_prefix}/bin' build='' build_alias='' build_cpu='' build_os='' build_vendor='' datadir='${prefix}/share' exec_prefix='NONE' host='' host_alias='' host_cpu='' host_os='' host_vendor='' includedir='${prefix}/include' infodir='${prefix}/info' install_sh='/home/gabry/Desktop/OpenCobolSource/open-cobol-0.32/install-sh' libdir='${exec_prefix}/lib' libexecdir='${exec_prefix}/libexec' localstatedir='${prefix}/var' mandir='${prefix}/man' mkdir_p='mkdir -p -- .' oldincludedir='/usr/include' prefix='/opt/local/opencobol' program_transform_name='s,x,x,' sbindir='${exec_prefix}/sbin' sharedstatedir='${prefix}/com' sysconfdir='${prefix}/etc' target_alias='' ## ----------- ## ## confdefs.h. ## ## ----------- ## #define COB_DEBUG 1 #define PACKAGE "open-cobol" #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" #define PACKAGE_NAME "OpenCOBOL" #define PACKAGE_STRING "OpenCOBOL 0.32" #define PACKAGE_TARNAME "open-cobol" #define PACKAGE_VERSION "0.32" #define VERSION "0.32" configure: exit 77[/code] CONFIG-m4.LOG [code]This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by GNU M4 configure 1.4.8, which was generated by GNU Autoconf 2.61. Invocation command line was $ ./configure ## --------- ## ## Platform. ## ## --------- ## hostname = gabry-laptop uname -m = i686 uname -r = 2.6.17-10-generic uname -s = Linux uname -v = #2 SMP Fri Oct 13 18:45:35 UTC 2006 /usr/bin/uname -p = unknown /bin/uname -X = unknown /bin/arch = i686 /usr/bin/arch -k = unknown /usr/convex/getsysinfo = unknown /usr/bin/hostinfo = unknown /bin/machine = unknown /usr/bin/oslevel = unknown /bin/universe = unknown PATH: /usr/local/sbin PATH: /usr/local/bin PATH: /usr/sbin PATH: /usr/bin PATH: /sbin PATH: /bin PATH: /usr/bin/X11 PATH: /usr/games ## ----------- ## ## Core tests. ## ## ----------- ## configure:1868: checking for a BSD-compatible install configure:1924: result: /usr/bin/install -c configure:1935: checking whether build environment is sane configure:1978: result: yes configure:2006: checking for a thread-safe mkdir -p configure:2045: result: /bin/mkdir -p configure:2058: checking for gawk configure:2088: result: no configure:2058: checking for mawk configure:2074: found /usr/bin/mawk configure:2085: result: mawk configure:2096: checking whether make sets $(MAKE) configure:2117: result: yes configure:2320: checking build system type configure:2338: result: i686-pc-linux-gnulibc1 configure:2360: checking host system type configure:2375: result: i686-pc-linux-gnulibc1 configure:2445: checking for gcc configure:2461: found /usr/bin/gcc configure:2472: result: gcc configure:2710: checking for C compiler version configure:2717: gcc --version >&5 gcc (GCC) 3.3.6 (Debian 1:3.3.6-15) Copyright (C) 2003 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. configure:2720: $? = 0 configure:2727: gcc -v >&5 Reading specs from /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/specs Configured with: ../src/configure -v --enable-languages=c,c++ --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --enable-__cxa_atexit --with-system-zlib --enable-nls --without-included-gettext --enable-clocale=gnu --enable-debug i486-linux-gnu Thread model: posix gcc version 3.3.6 (Debian 1:3.3.6-15) configure:2730: $? = 0 configure:2737: gcc -V >&5 gcc: `-V' option must have argument configure:2740: $? = 1 configure:2763: checking for C compiler default output file name configure:2790: gcc conftest.c >&5 /usr/bin/ld: crt1.o: No such file: No such file or directory collect2: ld returned 1 exit status configure:2793: $? = 1 configure:2831: result: configure: failed program was: | /* confdefs.h. */ | #define PACKAGE_NAME "GNU M4" | #define PACKAGE_TARNAME "m4" | #define PACKAGE_VERSION "1.4.8" | #define PACKAGE_STRING "GNU M4 1.4.8" | #define PACKAGE_BUGREPORT "bug-m4@gnu.org" | #define PACKAGE "m4" | #define VERSION "1.4.8" | /* end confdefs.h. */ | | int | main () | { | | ; | return 0; | } configure:2838: error: C compiler cannot create executables See `config.log' for more details. ## ---------------- ## ## Cache variables. ## ## ---------------- ## ac_cv_build=i686-pc-linux-gnulibc1 ac_cv_env_CC_set= ac_cv_env_CC_value= ac_cv_env_CFLAGS_set= ac_cv_env_CFLAGS_value= ac_cv_env_CPPFLAGS_set= ac_cv_env_CPPFLAGS_value= ac_cv_env_CPP_set= ac_cv_env_CPP_value= ac_cv_env_LDFLAGS_set= ac_cv_env_LDFLAGS_value= ac_cv_env_LIBS_set= ac_cv_env_LIBS_value= ac_cv_env_build_alias_set= ac_cv_env_build_alias_value= ac_cv_env_host_alias_set= ac_cv_env_host_alias_value= ac_cv_env_target_alias_set= ac_cv_env_target_alias_value= ac_cv_host=i686-pc-linux-gnulibc1 ac_cv_path_install='/usr/bin/install -c' ac_cv_path_mkdir=/bin/mkdir ac_cv_prog_AWK=mawk ac_cv_prog_ac_ct_CC=gcc ac_cv_prog_make_make_set=yes ## ----------------- ## ## Output variables. ## ## ----------------- ## ABSOLUTE_STDINT_H='' ABSOLUTE_SYS_STAT_H='' ACLOCAL='${SHELL} /home/gabry/Desktop/OpenCobolSource/m4-1.4.8/missing --run aclocal-1.10' ALLOCA='' ALLOCA_H='' AMDEPBACKSLASH='' AMDEP_FALSE='' AMDEP_TRUE='' AMTAR='${SHELL} /home/gabry/Desktop/OpenCobolSource/m4-1.4.8/missing --run tar' AUTOCONF='${SHELL} /home/gabry/Desktop/OpenCobolSource/m4-1.4.8/missing --run autoconf' AUTOHEADER='${SHELL} /home/gabry/Desktop/OpenCobolSource/m4-1.4.8/missing --run autoheader' AUTOMAKE='${SHELL} /home/gabry/Desktop/OpenCobolSource/m4-1.4.8/missing --run automake-1.10' AWK='mawk' BITSIZEOF_PTRDIFF_T='' BITSIZEOF_SIG_ATOMIC_T='' BITSIZEOF_SIZE_T='' BITSIZEOF_WCHAR_T='' BITSIZEOF_WINT_T='' CC='gcc' CCDEPMODE='' CFLAGS='' CPP='' CPPFLAGS='' CYGPATH_W='echo' DEFS='' DEPDIR='' ECHO_C='' ECHO_N='-n' ECHO_T='' EGREP='' EOVERFLOW='' EXEEXT='' GETOPT_H='' GL_COND_LIBTOOL_FALSE='' GL_COND_LIBTOOL_TRUE='' GREP='' HAVE_INTTYPES_H='' HAVE_LONG_LONG_INT='' HAVE_SIGNED_SIG_ATOMIC_T='' HAVE_SIGNED_WCHAR_T='' HAVE_SIGNED_WINT_T='' HAVE_STDINT_H='' HAVE_SYS_BITYPES_H='' HAVE_SYS_INTTYPES_H='' HAVE_SYS_TYPES_H='' HAVE_UNSIGNED_LONG_LONG_INT='' HAVE_WCHAR_H='' HAVE__BOOL='' INSTALL_DATA='${INSTALL} -m 644' INSTALL_PROGRAM='${INSTALL}' INSTALL_SCRIPT='${INSTALL}' INSTALL_STRIP_PROGRAM='$(install_sh) -c -s' LDFLAGS='' LIBM4_LIBDEPS='' LIBM4_LTLIBDEPS='' LIBOBJS='' LIBS='' LTLIBOBJS='' M4_LIBOBJS='' M4_LTLIBOBJS='' MAKEINFO='${SHELL} /home/gabry/Desktop/OpenCobolSource/m4-1.4.8/missing --run makeinfo' OBJEXT='' PACKAGE='m4' PACKAGE_BUGREPORT='bug-m4@gnu.org' PACKAGE_NAME='GNU M4' PACKAGE_STRING='GNU M4 1.4.8' PACKAGE_TARNAME='m4' PACKAGE_VERSION='1.4.8' PATH_SEPARATOR=':' PTRDIFF_T_SUFFIX='' RANLIB='' SET_MAKE='' SHELL='/bin/bash' SIG_ATOMIC_T_SUFFIX='' SIZE_T_SUFFIX='' STACKOVF_FALSE='' STACKOVF_TRUE='' STDBOOL_H='' STDINT_H='' STRIP='' SYS_STAT_H='' UNISTD_H='' VERSION='1.4.8' WCHAR_T_SUFFIX='' WINT_T_SUFFIX='' ac_ct_CC='gcc' am__fastdepCC_FALSE='' am__fastdepCC_TRUE='' am__include='' am__isrc='' am__leading_dot='.' am__quote='' am__tar='${AMTAR} chof - "$$tardir"' am__untar='${AMTAR} xf -' bindir='${exec_prefix}/bin' build='i686-pc-linux-gnulibc1' build_alias='' build_cpu='i686' build_os='linux-gnulibc1' build_vendor='pc' datadir='${datarootdir}' datarootdir='${prefix}/share' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' dvidir='${docdir}' exec_prefix='NONE' host='i686-pc-linux-gnulibc1' host_alias='' host_cpu='i686' host_os='linux-gnulibc1' host_vendor='pc' htmldir='${docdir}' includedir='${prefix}/include' infodir='${datarootdir}/info' install_sh='$(SHELL) /home/gabry/Desktop/OpenCobolSource/m4-1.4.8/install-sh' libdir='${exec_prefix}/lib' libexecdir='${exec_prefix}/libexec' localedir='${datarootdir}/locale' localstatedir='${prefix}/var' mandir='${datarootdir}/man' mkdir_p='/bin/mkdir -p' oldincludedir='/usr/include' pdfdir='${docdir}' prefix='NONE' program_transform_name='s,x,x,' psdir='${docdir}' sbindir='${exec_prefix}/sbin' sharedstatedir='${prefix}/com' sysconfdir='${prefix}/etc' target_alias='' ## ----------- ## ## confdefs.h. ## ## ----------- ## #define PACKAGE_NAME "GNU M4" #define PACKAGE_TARNAME "m4" #define PACKAGE_VERSION "1.4.8" #define PACKAGE_STRING "GNU M4 1.4.8" #define PACKAGE_BUGREPORT "bug-m4@gnu.org" #define PACKAGE "m4" #define VERSION "1.4.8" configure: exit 77[/code] config-gmp.log [code]This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by GNU MP configure 4.2.1, which was generated by GNU Autoconf 2.59. Invocation command line was $ ./configure ## --------- ## ## Platform. ## ## --------- ## hostname = gabry-laptop uname -m = i686 uname -r = 2.6.17-10-generic uname -s = Linux uname -v = #2 SMP Fri Oct 13 18:45:35 UTC 2006 /usr/bin/uname -p = unknown /bin/uname -X = unknown /bin/arch = i686 /usr/bin/arch -k = unknown /usr/convex/getsysinfo = unknown hostinfo = unknown /bin/machine = unknown /usr/bin/oslevel = unknown /bin/universe = unknown PATH: /usr/local/sbin PATH: /usr/local/bin PATH: /usr/sbin PATH: /usr/bin PATH: /sbin PATH: /bin PATH: /usr/bin/X11 PATH: /usr/games ## ----------- ## ## Core tests. ## ## ----------- ## configure:1658: checking build system type configure:1676: result: i686-pc-linux-gnulibc1 configure:1684: checking host system type configure:1698: result: i686-pc-linux-gnulibc1 configure:1721: checking for a BSD-compatible install configure:1776: result: /usr/bin/install -c configure:1787: checking whether build environment is sane configure:1830: result: yes configure:1887: checking for gawk configure:1916: result: no configure:1887: checking for mawk configure:1903: found /usr/bin/mawk configure:1913: result: mawk configure:1923: checking whether make sets $(MAKE) configure:1943: result: yes configure:2109: checking whether to enable maintainer-specific portions of Makefiles configure:2118: result: no User: ABI= CC= CFLAGS=(unset) CPPFLAGS=(unset) MPN_PATH= GMP: abilist=32 cclist=gcc icc configure:3776: gcc 2>&1 | grep xlc >/dev/null configure:3779: $? = 1 configure:3833: checking compiler gcc -m32 -O2 -fomit-frame-pointer Test compile: configure:3847: gcc -m32 -O2 -fomit-frame-pointer conftest.c >&5 /usr/bin/ld: crt1.o: No such file: No such file or directory collect2: ld returned 1 exit status configure:3850: $? = 1 failed program was: int main () { return 0; } configure:4856: result: no configure:3833: checking compiler gcc -O2 -fomit-frame-pointer Test compile: configure:3847: gcc -O2 -fomit-frame-pointer conftest.c >&5 /usr/bin/ld: crt1.o: No such file: No such file or directory collect2: ld returned 1 exit status configure:3850: $? = 1 failed program was: int main () { return 0; } configure:4856: result: no configure:3754: icc -c conftest.c >&5 ./configure: line 3755: icc: command not found configure:3757: $? = 127 configure:3776: icc 2>&1 | grep xlc >/dev/null configure:3779: $? = 1 configure:3833: checking compiler icc -no-gcc Test compile: configure:3847: icc -no-gcc conftest.c >&5 ./configure: line 3848: icc: command not found configure:3850: $? = 127 failed program was: int main () { return 0; } configure:4856: result: no configure:5094: error: could not find a working compiler, see config.log for details ## ---------------- ## ## Cache variables. ## ## ---------------- ## ac_cv_build=i686-pc-linux-gnulibc1 ac_cv_build_alias=i686-pc-linux-gnulibc1 ac_cv_env_ABI_set= ac_cv_env_ABI_value= ac_cv_env_CC_FOR_BUILD_set= ac_cv_env_CC_FOR_BUILD_value= ac_cv_env_CC_set= ac_cv_env_CC_value= ac_cv_env_CFLAGS_set= ac_cv_env_CFLAGS_value= ac_cv_env_CPPFLAGS_set= ac_cv_env_CPPFLAGS_value= ac_cv_env_CPP_FOR_BUILD_set= ac_cv_env_CPP_FOR_BUILD_value= ac_cv_env_CPP_set= ac_cv_env_CPP_value= ac_cv_env_CXXCPP_set= ac_cv_env_CXXCPP_value= ac_cv_env_CXXFLAGS_set= ac_cv_env_CXXFLAGS_value= ac_cv_env_CXX_set= ac_cv_env_CXX_value= ac_cv_env_LDFLAGS_set= ac_cv_env_LDFLAGS_value= ac_cv_env_M4_set= ac_cv_env_M4_value= ac_cv_env_build_alias_set= ac_cv_env_build_alias_value= ac_cv_env_host_alias_set= ac_cv_env_host_alias_value= ac_cv_env_target_alias_set= ac_cv_env_target_alias_value= ac_cv_host=i686-pc-linux-gnulibc1 ac_cv_host_alias=i686-pc-linux-gnulibc1 ac_cv_path_install='/usr/bin/install -c' ac_cv_prog_AWK=mawk ac_cv_prog_make_make_set=yes ## ----------------- ## ## Output variables. ## ## ----------------- ## ABI='' ACLOCAL='${SHELL} /home/gabry/Desktop/OpenCobolSource/gmp-4.2.1/missing --run aclocal-1.8' AMTAR='${SHELL} /home/gabry/Desktop/OpenCobolSource/gmp-4.2.1/missing --run tar' ANSI2KNR='' AR='' AS='' AUTOCONF='${SHELL} /home/gabry/Desktop/OpenCobolSource/gmp-4.2.1/missing --run autoconf' AUTOHEADER='${SHELL} /home/gabry/Desktop/OpenCobolSource/gmp-4.2.1/missing --run autoheader' AUTOMAKE='${SHELL} /home/gabry/Desktop/OpenCobolSource/gmp-4.2.1/missing --run automake-1.8' AWK='mawk' BITS_PER_MP_LIMB='' CALLING_CONVENTIONS_OBJS='x86call.lo x86check$U.lo' CC='' CCAS='' CC_FOR_BUILD='' CFLAGS='' CPP='' CPPFLAGS='' CPP_FOR_BUILD='' CXX='' CXXCPP='' CXXFLAGS='' CYGPATH_W='echo' DEFN_LONG_LONG_LIMB='' DEFS='' DLLTOOL='' ECHO='echo' ECHO_C='' ECHO_N='-n' ECHO_T='' EGREP='' ENABLE_STATIC_FALSE='' ENABLE_STATIC_TRUE='' EXEEXT='' EXEEXT_FOR_BUILD='' GMP_LDFLAGS='' GMP_NAIL_BITS='0' HAVE_CLOCK_01='' HAVE_CPUTIME_01='' HAVE_GETRUSAGE_01='' HAVE_GETTIMEOFDAY_01='' HAVE_HOST_CPU_FAMILY_power='0' HAVE_HOST_CPU_FAMILY_powerpc='0' HAVE_SIGACTION_01='' HAVE_SIGALTSTACK_01='' HAVE_SIGSTACK_01='' HAVE_STACK_T_01='' HAVE_SYS_RESOURCE_H_01='' INSTALL_DATA='${INSTALL} -m 644' INSTALL_PROGRAM='${INSTALL}' INSTALL_SCRIPT='${INSTALL}' INSTALL_STRIP_PROGRAM='${SHELL} $(install_sh) -c -s' LDFLAGS='' LEX='' LEXLIB='' LEX_OUTPUT_ROOT='' LIBCURSES='' LIBGMPXX_LDFLAGS='' LIBGMP_DLL='' LIBGMP_LDFLAGS='' LIBM='' LIBM_FOR_BUILD='' LIBOBJS='' LIBREADLINE='' LIBS='' LIBTOOL='' LN_S='' LTLIBOBJS='' M4='' MAINT='#' MAINTAINER_MODE_FALSE='' MAINTAINER_MODE_TRUE='#' MAKEINFO='${SHELL} /home/gabry/Desktop/OpenCobolSource/gmp-4.2.1/missing --run makeinfo' OBJDUMP='' OBJEXT='' PACKAGE='gmp' PACKAGE_BUGREPORT='gmp-bugs@swox.com' PACKAGE_NAME='GNU MP' PACKAGE_STRING='GNU MP 4.2.1' PACKAGE_TARNAME='gmp' PACKAGE_VERSION='4.2.1' PATH_SEPARATOR=':' RANLIB='' SET_MAKE='' SHELL='/bin/bash' SPEED_CYCLECOUNTER_OBJ='pentium.lo' STRIP='' TAL_OBJECT='' TUNE_SQR_OBJ='' U='' U_FOR_BUILD='' VERSION='4.2.1' WANT_CXX_FALSE='' WANT_CXX_TRUE='' WANT_MPBSD_FALSE='' WANT_MPBSD_TRUE='#' WITH_READLINE_01='' YACC='' ac_ct_AR='' ac_ct_AS='' ac_ct_CC='' ac_ct_CXX='' ac_ct_DLLTOOL='' ac_ct_OBJDUMP='' ac_ct_RANLIB='' ac_ct_STRIP='' am__leading_dot='.' bindir='${exec_prefix}/bin' build='i686-pc-linux-gnulibc1' build_alias='' build_cpu='i686' build_os='linux-gnulibc1' build_vendor='pc' datadir='${prefix}/share' exec_prefix='NONE' gmp_srclinks='' host='i686-pc-linux-gnulibc1' host_alias='' host_cpu='i686' host_os='linux-gnulibc1' host_vendor='pc' includedir='${prefix}/include' infodir='${prefix}/info' install_sh='/home/gabry/Desktop/OpenCobolSource/gmp-4.2.1/install-sh' libdir='${exec_prefix}/lib' libexecdir='${exec_prefix}/libexec' localstatedir='${prefix}/var' mandir='${prefix}/man' mkdir_p='mkdir -p -- .' mpn_objects='' mpn_objs_in_libgmp='' mpn_objs_in_libmp='' oldincludedir='/usr/include' prefix='NONE' program_transform_name='s,x,x,' sbindir='${exec_prefix}/sbin' sharedstatedir='${prefix}/com' sysconfdir='${prefix}/etc' target_alias='' ## ----------- ## ## confdefs.h. ## ## ----------- ## #define HAVE_HOST_CPU_i686 1 #define PACKAGE "gmp" #define PACKAGE_BUGREPORT "gmp-bugs@swox.com" #define PACKAGE_NAME "GNU MP" #define PACKAGE_STRING "GNU MP 4.2.1" #define PACKAGE_TARNAME "gmp" #define PACKAGE_VERSION "4.2.1" #define VERSION "4.2.1" #define WANT_FFT 1 configure: exit 1[/code] config.ncurses.log [code]This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by configure, which was generated by GNU Autoconf 2.52.20061216. Invocation command line was $ ./configure --prefix=/opt/local/ncurses ## ---------- ## ## Platform. ## ## ---------- ## hostname = gabry-laptop uname -m = i686 uname -r = 2.6.17-10-generic uname -s = Linux uname -v = #2 SMP Fri Oct 13 18:45:35 UTC 2006 /usr/bin/uname -p = unknown /bin/uname -X = unknown /bin/arch = i686 /usr/bin/arch -k = unknown /usr/convex/getsysinfo = unknown hostinfo = unknown /bin/machine = unknown /usr/bin/oslevel = unknown /bin/universe = unknown PATH = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games ## ------------ ## ## Core tests. ## ## ------------ ## configure:1080: PATH=".;."; conftest.sh ./configure: 1087: conftest.sh: not found configure:1083: $? = 127 configure:1096: checking for egrep configure:1106: result: grep -E configure:1120: result: Configuring NCURSES 5.6 ABI 5 (Fri Mar 16 22:46:40 CET 2007) configure:1225: checking build system type configure:1243: result: i686-pc-linux-gnulibc1 configure:1250: checking host system type configure:1264: result: i686-pc-linux-gnulibc1 configure:1272: checking target system type configure:1286: result: i686-pc-linux-gnulibc1 configure:1317: result: Configuring for linux-gnulibc1 configure:1341: checking for prefix configure:1353: result: /opt/local/ncurses configure:1429: checking for gcc configure:1444: found /usr/bin/gcc configure:1452: result: gcc configure:1680: checking for C compiler version configure:1683: gcc --version &5 gcc (GCC) 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. configure:1686: $? = 0 configure:1688: gcc -v &5 Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) configure:1691: $? = 0 configure:1693: gcc -V &5 gcc: '-V' option must have argument configure:1696: $? = 1 configure:1716: checking for C compiler default output configure:1719: gcc conftest.c >&5 /usr/bin/ld: crt1.o: No such file: No such file or directory collect2: ld returned 1 exit status configure:1722: $? = 1 configure: failed program was: #line 1700 "configure" #include "confdefs.h" int main () { ; return 0; } configure:1745: error: C compiler cannot create executables ## ----------------- ## ## Cache variables. ## ## ----------------- ## ac_cv_build='i686-pc-linux-gnulibc1' ac_cv_build_alias='i686-pc-linux-gnulibc1' ac_cv_env_CC_set='' ac_cv_env_CC_value='' ac_cv_env_CFLAGS_set='' ac_cv_env_CFLAGS_value='' ac_cv_env_CPPFLAGS_set='' ac_cv_env_CPPFLAGS_value='' ac_cv_env_CPP_set='' ac_cv_env_CPP_value='' ac_cv_env_CXXCPP_set='' ac_cv_env_CXXCPP_value='' ac_cv_env_CXXFLAGS_set='' ac_cv_env_CXXFLAGS_value='' ac_cv_env_CXX_set='' ac_cv_env_CXX_value='' ac_cv_env_LDFLAGS_set='' ac_cv_env_LDFLAGS_value='' ac_cv_env_build_alias_set='' ac_cv_env_build_alias_value='' ac_cv_env_host_alias_set='' ac_cv_env_host_alias_value='' ac_cv_env_target_alias_set='' ac_cv_env_target_alias_value='' ac_cv_host='i686-pc-linux-gnulibc1' ac_cv_host_alias='i686-pc-linux-gnulibc1' ac_cv_prog_ac_ct_CC='gcc' ac_cv_prog_egrep='grep -E' ac_cv_target='i686-pc-linux-gnulibc1' ac_cv_target_alias='i686-pc-linux-gnulibc1' cf_cv_abi_version='5' cf_cv_rel_version='5.6' cf_cv_system_name='linux-gnulibc1' cf_cv_timestamp='Fri Mar 16 22:46:40 CET 2007' ## ------------ ## ## confdefs.h. ## ## ------------ ## #define SYSTEM_NAME "linux-gnulibc1" configure: exit 77[/code] Excuse me for the long texts!!! :pint: ---------------------------------------------------------------- configure:2572: checking for C compiler default output file name configure:2575: gcc conftest.c >&5 /usr/bin/ld: crt1.o: No such file: No such file or directory collect2: ld returned 1 exit status OK. Here is your problem. Your development tools installation is screwed up. Not an OC problem. ---------------------------------------------------------------- OK simrw, i've installed the meta package build-essential and now it build, compile the packages. Then I've build, compile and install without problems the packages follows: m4-x.x.x, gmp-x.x.x, libtool-x.x.x, Berkley db (db-x.x.x) and ncurses. But when i do ./configure for build the opencobol-0.32 it has the follow result (config.log): [code]This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by OpenCOBOL configure 0.32, which was generated by GNU Autoconf 2.59. Invocation command line was $ ./configure ## --------- ## ## Platform. ## ## --------- ## hostname = gabry-laptop uname -m = i686 uname -r = 2.6.17-10-generic uname -s = Linux uname -v = #2 SMP Fri Oct 13 18:45:35 UTC 2006 /usr/bin/uname -p = unknown /bin/uname -X = unknown /bin/arch = i686 /usr/bin/arch -k = unknown /usr/convex/getsysinfo = unknown hostinfo = unknown /bin/machine = unknown /usr/bin/oslevel = unknown /bin/universe = unknown PATH: /usr/local/sbin PATH: /usr/local/bin PATH: /usr/sbin PATH: /usr/bin PATH: /sbin PATH: /bin PATH: /usr/bin/X11 PATH: /usr/games ## ----------- ## ## Core tests. ## ## ----------- ## configure:1583: checking for a BSD-compatible install configure:1638: result: /usr/bin/install -c configure:1649: checking whether build environment is sane configure:1692: result: yes configure:1749: checking for gawk configure:1778: result: no configure:1749: checking for mawk configure:1765: found /usr/bin/mawk configure:1775: result: mawk configure:1785: checking whether make sets $(MAKE) configure:1805: result: yes configure:1969: checking whether to enable maintainer-specific portions of Makefiles configure:1978: result: no configure:2032: checking for gcc configure:2048: found /usr/bin/gcc configure:2058: result: gcc configure:2164: checking for style of include used by make configure:2192: result: GNU configure:2263: checking for gcc configure:2279: found /usr/bin/gcc configure:2289: result: gcc configure:2533: checking for C compiler version configure:2536: gcc --version &5 gcc (GCC) 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. configure:2539: $? = 0 configure:2541: gcc -v &5 Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) configure:2544: $? = 0 configure:2546: gcc -V &5 gcc: '-V' option must have argument configure:2549: $? = 1 configure:2572: checking for C compiler default output file name configure:2575: gcc conftest.c >&5 configure:2578: $? = 0 configure:2624: result: a.out configure:2629: checking whether the C compiler works configure:2635: ./a.out configure:2638: $? = 0 configure:2655: result: yes configure:2662: checking whether we are cross compiling configure:2664: result: no configure:2667: checking for suffix of executables configure:2669: gcc -o conftest conftest.c >&5 configure:2672: $? = 0 configure:2697: result: configure:2703: checking for suffix of object files configure:2724: gcc -c conftest.c >&5 configure:2727: $? = 0 configure:2749: result: o configure:2753: checking whether we are using the GNU C compiler configure:2777: gcc -c conftest.c >&5 configure:2783: $? = 0 configure:2787: test -z || test ! -s conftest.err configure:2790: $? = 0 configure:2793: test -s conftest.o configure:2796: $? = 0 configure:2809: result: yes configure:2815: checking whether gcc accepts -g configure:2836: gcc -c -g conftest.c >&5 configure:2842: $? = 0 configure:2846: test -z || test ! -s conftest.err configure:2849: $? = 0 configure:2852: test -s conftest.o configure:2855: $? = 0 configure:2866: result: yes configure:2883: checking for gcc option to accept ANSI C configure:2953: gcc -c -g -O2 conftest.c >&5 configure:2959: $? = 0 configure:2963: test -z || test ! -s conftest.err configure:2966: $? = 0 configure:2969: test -s conftest.o configure:2972: $? = 0 configure:2990: result: none needed configure:3008: gcc -c -g -O2 conftest.c >&5 conftest.c:2: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'me' configure:3014: $? = 1 configure: failed program was: | #ifndef __cplusplus | choke me | #endif configure:3149: checking dependency style of gcc configure:3234: result: gcc3 configure:3252: checking for getopt_long_only configure:3309: gcc -o conftest -g -O2 conftest.c >&5 configure:3315: $? = 0 configure:3319: test -z || test ! -s conftest.err configure:3322: $? = 0 configure:3325: test -s conftest configure:3328: $? = 0 configure:3340: result: yes configure:3366: checking for regcomp in -lregex configure:3396: gcc -o conftest -g -O2 conftest.c -lregex >&5 /usr/bin/ld: cannot find -lregex collect2: ld returned 1 exit status configure:3402: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "0.32" | #define PACKAGE_STRING "OpenCOBOL 0.32" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "0.32" | #define COB_DEBUG 1 | /* end confdefs.h. */ | | /* Override any gcc2 internal prototype to avoid an error. */ | #ifdef __cplusplus | extern "C" | #endif | /* We use char because int might match the return type of a gcc2 | builtin and then its argument prototype would still apply. */ | char regcomp (); | int | main () | { | regcomp (); | ; | return 0; | } configure:3428: result: no configure:3442: checking how to run the C preprocessor configure:3477: gcc -E conftest.c configure:3483: $? = 0 configure:3515: gcc -E conftest.c conftest.c:12:28: error: ac_nonexistent.h: No such file or directory configure:3521: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "0.32" | #define PACKAGE_STRING "OpenCOBOL 0.32" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "0.32" | #define COB_DEBUG 1 | /* end confdefs.h. */ | #include configure:3560: result: gcc -E configure:3584: gcc -E conftest.c configure:3590: $? = 0 configure:3622: gcc -E conftest.c conftest.c:12:28: error: ac_nonexistent.h: No such file or directory configure:3628: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "0.32" | #define PACKAGE_STRING "OpenCOBOL 0.32" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "0.32" | #define COB_DEBUG 1 | /* end confdefs.h. */ | #include configure:3672: checking for egrep configure:3682: result: grep -E configure:3687: checking for ANSI C header files configure:3712: gcc -c -g -O2 conftest.c >&5 configure:3718: $? = 0 configure:3722: test -z || test ! -s conftest.err configure:3725: $? = 0 configure:3728: test -s conftest.o configure:3731: $? = 0 configure:3820: gcc -o conftest -g -O2 conftest.c >&5 conftest.c: In function 'main': conftest.c:29: warning: incompatible implicit declaration of built-in function 'exit' configure:3823: $? = 0 configure:3825: ./conftest configure:3828: $? = 0 configure:3843: result: yes configure:3867: checking for sys/types.h configure:3883: gcc -c -g -O2 conftest.c >&5 configure:3889: $? = 0 configure:3893: test -z || test ! -s conftest.err configure:3896: $? = 0 configure:3899: test -s conftest.o configure:3902: $? = 0 configure:3913: result: yes configure:3867: checking for sys/stat.h configure:3883: gcc -c -g -O2 conftest.c >&5 configure:3889: $? = 0 configure:3893: test -z || test ! -s conftest.err configure:3896: $? = 0 configure:3899: test -s conftest.o configure:3902: $? = 0 configure:3913: result: yes configure:3867: checking for stdlib.h configure:3883: gcc -c -g -O2 conftest.c >&5 configure:3889: $? = 0 configure:3893: test -z || test ! -s conftest.err configure:3896: $? = 0 configure:3899: test -s conftest.o configure:3902: $? = 0 configure:3913: result: yes configure:3867: checking for string.h configure:3883: gcc -c -g -O2 conftest.c >&5 configure:3889: $? = 0 configure:3893: test -z || test ! -s conftest.err configure:3896: $? = 0 configure:3899: test -s conftest.o configure:3902: $? = 0 configure:3913: result: yes configure:3867: checking for memory.h configure:3883: gcc -c -g -O2 conftest.c >&5 configure:3889: $? = 0 configure:3893: test -z || test ! -s conftest.err configure:3896: $? = 0 configure:3899: test -s conftest.o configure:3902: $? = 0 configure:3913: result: yes configure:3867: checking for strings.h configure:3883: gcc -c -g -O2 conftest.c >&5 configure:3889: $? = 0 configure:3893: test -z || test ! -s conftest.err configure:3896: $? = 0 configure:3899: test -s conftest.o configure:3902: $? = 0 configure:3913: result: yes configure:3867: checking for inttypes.h configure:3883: gcc -c -g -O2 conftest.c >&5 configure:3889: $? = 0 configure:3893: test -z || test ! -s conftest.err configure:3896: $? = 0 configure:3899: test -s conftest.o configure:3902: $? = 0 configure:3913: result: yes configure:3867: checking for stdint.h configure:3883: gcc -c -g -O2 conftest.c >&5 configure:3889: $? = 0 configure:3893: test -z || test ! -s conftest.err configure:3896: $? = 0 configure:3899: test -s conftest.o configure:3902: $? = 0 configure:3913: result: yes configure:3867: checking for unistd.h configure:3883: gcc -c -g -O2 conftest.c >&5 configure:3889: $? = 0 configure:3893: test -z || test ! -s conftest.err configure:3896: $? = 0 configure:3899: test -s conftest.o configure:3902: $? = 0 configure:3913: result: yes configure:3929: checking for dbopen configure:3986: gcc -o conftest -g -O2 conftest.c >&5 /tmp/ccOXHHuy.o: In function `main': /home/gabry/Desktop/OpenCobolSource/open-cobol-0.32/conftest.c:61: undefined reference to `dbopen' /tmp/ccOXHHuy.o:(.data+0x0): undefined reference to `dbopen' collect2: ld returned 1 exit status configure:3992: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "0.32" | #define PACKAGE_STRING "OpenCOBOL 0.32" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "0.32" | #define COB_DEBUG 1 | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | /* end confdefs.h. */ | /* Define dbopen to an innocuous variant, in case declares dbopen. | For example, HP-UX 11i declares gettimeofday. */ | #define dbopen innocuous_dbopen | | /* System header to define __stub macros and hopefully few prototypes, | which can conflict with char dbopen (); below. | Prefer to if __STDC__ is defined, since | exists even on freestanding compilers. */ | | #ifdef __STDC__ | # include | #else | # include | #endif | | #undef dbopen | | /* Override any gcc2 internal prototype to avoid an error. */ | #ifdef __cplusplus | extern "C" | { | #endif | /* We use char because int might match the return type of a gcc2 | builtin and then its argument prototype would still apply. */ | char dbopen (); | /* The GNU C library defines this for functions which it implements | to always fail with ENOSYS. Some functions are actually named | something starting with __ and the normal name is an alias. */ | #if defined (__stub_dbopen) || defined (__stub___dbopen) | choke me | #else | char (*f) () = dbopen; | #endif | #ifdef __cplusplus | } | #endif | | int | main () | { | return f != dbopen; | ; | return 0; | } configure:4017: result: no configure:4504: checking gmp.h usability configure:4516: gcc -c -g -O2 conftest.c >&5 configure:4522: $? = 0 configure:4526: test -z || test ! -s conftest.err configure:4529: $? = 0 configure:4532: test -s conftest.o configure:4535: $? = 0 configure:4545: result: yes configure:4549: checking gmp.h presence configure:4559: gcc -E conftest.c configure:4565: $? = 0 configure:4585: result: yes configure:4620: checking for gmp.h configure:4627: result: yes configure:4645: checking for __gmp_rand in -lgmp configure:4675: gcc -o conftest -g -O2 conftest.c -lgmp >&5 /tmp/cc9Umoej.o: In function `main': /home/gabry/Desktop/OpenCobolSource/open-cobol-0.32/conftest.c:34: undefined reference to `__gmp_rand' collect2: ld returned 1 exit status configure:4681: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "0.32" | #define PACKAGE_STRING "OpenCOBOL 0.32" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "0.32" | #define COB_DEBUG 1 | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define HAVE_GMP_H 1 | /* end confdefs.h. */ | | /* Override any gcc2 internal prototype to avoid an error. */ | #ifdef __cplusplus | extern "C" | #endif | /* We use char because int might match the return type of a gcc2 | builtin and then its argument prototype would still apply. */ | char __gmp_rand (); | int | main () | { | __gmp_rand (); | ; | return 0; | } configure:4707: result: no configure:4717: error: GMP 3 or later is required ## ---------------- ## ## Cache variables. ## ## ---------------- ## ac_cv_c_compiler_gnu=yes ac_cv_env_CC_set= ac_cv_env_CC_value= ac_cv_env_CFLAGS_set= ac_cv_env_CFLAGS_value= ac_cv_env_CPPFLAGS_set= ac_cv_env_CPPFLAGS_value= ac_cv_env_CPP_set= ac_cv_env_CPP_value= ac_cv_env_CXXCPP_set= ac_cv_env_CXXCPP_value= ac_cv_env_CXXFLAGS_set= ac_cv_env_CXXFLAGS_value= ac_cv_env_CXX_set= ac_cv_env_CXX_value= ac_cv_env_F77_set= ac_cv_env_F77_value= ac_cv_env_FFLAGS_set= ac_cv_env_FFLAGS_value= ac_cv_env_LDFLAGS_set= ac_cv_env_LDFLAGS_value= ac_cv_env_build_alias_set= ac_cv_env_build_alias_value= ac_cv_env_host_alias_set= ac_cv_env_host_alias_value= ac_cv_env_target_alias_set= ac_cv_env_target_alias_value= ac_cv_exeext= ac_cv_func_dbopen=no ac_cv_func_getopt_long_only=yes ac_cv_header_gmp_h=yes ac_cv_header_inttypes_h=yes ac_cv_header_memory_h=yes ac_cv_header_stdc=yes ac_cv_header_stdint_h=yes ac_cv_header_stdlib_h=yes ac_cv_header_string_h=yes ac_cv_header_strings_h=yes ac_cv_header_sys_stat_h=yes ac_cv_header_sys_types_h=yes ac_cv_header_unistd_h=yes ac_cv_lib_gmp___gmp_rand=no ac_cv_lib_regex_regcomp=no ac_cv_objext=o ac_cv_path_install='/usr/bin/install -c' ac_cv_prog_AWK=mawk ac_cv_prog_COB_CC=gcc ac_cv_prog_CPP='gcc -E' ac_cv_prog_ac_ct_CC=gcc ac_cv_prog_cc_g=yes ac_cv_prog_cc_stdc= ac_cv_prog_egrep='grep -E' ac_cv_prog_make_make_set=yes am_cv_CC_dependencies_compiler_type=gcc3 ## ----------------- ## ## Output variables. ## ## ----------------- ## ACLOCAL='${SHELL} /home/gabry/Desktop/OpenCobolSource/open-cobol-0.32/missing --run aclocal-1.8' ALLOCA='' AMDEPBACKSLASH='\' AMDEP_FALSE='#' AMDEP_TRUE='' AMTAR='${SHELL} /home/gabry/Desktop/OpenCobolSource/open-cobol-0.32/missing --run tar' AR='' AS='' AUTOCONF='${SHELL} /home/gabry/Desktop/OpenCobolSource/open-cobol-0.32/missing --run autoconf' AUTOHEADER='${SHELL} /home/gabry/Desktop/OpenCobolSource/open-cobol-0.32/missing --run autoheader' AUTOMAKE='${SHELL} /home/gabry/Desktop/OpenCobolSource/open-cobol-0.32/missing --run automake-1.8' AWK='mawk' CC='gcc' CCDEPMODE='depmode=gcc3' CFLAGS='-g -O2' COBCRUN_SHARED_FALSE='' COBCRUN_SHARED_TRUE='' COBC_CFLAGS='' COBC_LIBS='' COB_CC='gcc' COB_CFLAGS='' COB_CONFIG_DIR='' COB_EXPORT_DYN='' COB_LIBRARY_PATH='' COB_LIBS='' COB_MODULE_EXT='' COB_PIC_FLAGS='' COB_SHARED_OPT='' COB_STRIP_CMD='' CPP='gcc -E' CPPFLAGS='' CXX='' CXXCPP='' CXXDEPMODE='' CXXFLAGS='' CYGPATH_W='echo' DEFS='' DEPDIR='.deps' DLLTOOL='' ECHO='echo' ECHO_C='' ECHO_N='-n' ECHO_T='' EGREP='grep -E' EXEEXT='' F77='' FFLAGS='' GMSGFMT='' INSTALL_DATA='${INSTALL} -m 644' INSTALL_PROGRAM='${INSTALL}' INSTALL_SCRIPT='${INSTALL}' INSTALL_STRIP_PROGRAM='${SHELL} $(install_sh) -c -s' INTLLIBS='' LDFLAGS='' LIBCOB_CFLAGS='' LIBCOB_LIBS='-lm' LIBICONV='' LIBINTL='' LIBOBJS='' LIBS='' LIBTOOL='' LN_S='' LTLIBICONV='' LTLIBINTL='' LTLIBOBJS='' MAINT='#' MAINTAINER_MODE_FALSE='' MAINTAINER_MODE_TRUE='#' MAKEINFO='${SHELL} /home/gabry/Desktop/OpenCobolSource/open-cobol-0.32/missing --run makeinfo' MKINSTALLDIRS='' MSGFMT='' MSGMERGE='' OBJDUMP='' OBJEXT='o' PACKAGE='open-cobol' PACKAGE_BUGREPORT='open-cobol-list@lists.sourceforge.net' PACKAGE_NAME='OpenCOBOL' PACKAGE_STRING='OpenCOBOL 0.32' PACKAGE_TARNAME='open-cobol' PACKAGE_VERSION='0.32' PATH_SEPARATOR=':' POSUB='' RANLIB='' SET_MAKE='' SHELL='/bin/bash' STRIP='' USE_NLS='' VERSION='0.32' XGETTEXT='' ac_ct_AR='' ac_ct_AS='' ac_ct_CC='gcc' ac_ct_CXX='' ac_ct_DLLTOOL='' ac_ct_F77='' ac_ct_OBJDUMP='' ac_ct_RANLIB='' ac_ct_STRIP='' am__fastdepCC_FALSE='#' am__fastdepCC_TRUE='' am__fastdepCXX_FALSE='' am__fastdepCXX_TRUE='' am__include='include' am__leading_dot='.' am__quote='' bindir='${exec_prefix}/bin' build='' build_alias='' build_cpu='' build_os='' build_vendor='' datadir='${prefix}/share' exec_prefix='NONE' host='' host_alias='' host_cpu='' host_os='' host_vendor='' includedir='${prefix}/include' infodir='${prefix}/info' install_sh='/home/gabry/Desktop/OpenCobolSource/open-cobol-0.32/install-sh' libdir='${exec_prefix}/lib' libexecdir='${exec_prefix}/libexec' localstatedir='${prefix}/var' mandir='${prefix}/man' mkdir_p='mkdir -p -- .' oldincludedir='/usr/include' prefix='NONE' program_transform_name='s,x,x,' sbindir='${exec_prefix}/sbin' sharedstatedir='${prefix}/com' sysconfdir='${prefix}/etc' target_alias='' ## ----------- ## ## confdefs.h. ## ## ----------- ## #define COB_DEBUG 1 #define HAVE_GMP_H 1 #define HAVE_INTTYPES_H 1 #define HAVE_MEMORY_H 1 #define HAVE_STDINT_H 1 #define HAVE_STDLIB_H 1 #define HAVE_STRINGS_H 1 #define HAVE_STRING_H 1 #define HAVE_SYS_STAT_H 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_UNISTD_H 1 #define PACKAGE "open-cobol" #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" #define PACKAGE_NAME "OpenCOBOL" #define PACKAGE_STRING "OpenCOBOL 0.32" #define PACKAGE_TARNAME "open-cobol" #define PACKAGE_VERSION "0.32" #define STDC_HEADERS 1 #define VERSION "0.32" configure: exit 1 [/code] or in general that gmp3 or sup. is request. But i've installed it without errors!!Where is the problem? Thank you them ---------------------------------------------------------------- Why did you build/make the gmp, BDB, etc. packages yourself ? (You probably did not specify installation directories) Every Linux comes with precompiled/installable packages for these prerequisites. Install the stuff from the Ubuntu repository. (Runtime AND development where seperate) And please use the 0.33 prerelease. ---------------------------------------------------------------- Excuse me, but i don't know you!!! I've execute the classic commads follows for the package's installation (libraries external required: gmp, DDB, ncurses, libtool): ./configure, make, make install. For default it has installed the packages in /usr/local/lib or /usr/lib. I hope that openCobol founds here the libraries requires or no? Them, i don't know when you tell me: "..Every Linux comes with precompiled/installable packages for these prerequisites. Install the stuff from the Ubuntu repository. (Runtime AND development where seperate)..." I've build, compile and install the libraries external but why i need of the precompiled/installable packages? Can you explained better please? Thanks!! ---------------------------------------------------------------- > For default it has installed the packages in /usr/local/lib or /usr/lib. Not true for BDB except if you have specified a --prefix to the configure. Excerpt from 0.33 README : ----------------- OpenCOBOL requires the following external libraries to be installed: ** NOTE - all the following packages are normally part of a Linux distribution. Cygwin also has these as installable packages. ALWAYS install the distro packages when available !! ---------------------- Further excerpt from 0.33 README : ---------------------- ** Note ** - On Linux systems, if you are installing for the -first- time, you may need to run "ldconfig" (as root). In fact, it does not hurt if you always do this. ** Note ** - On some Red Hat (Fedora) installations and possibly other Linux distros, /usr/local/lib is NOT automatically searched at runtime. Edit /etc/ld.so.conf and add /usr/local/lib to the file. Rerun "ldconfig". ---------------------- This last also applies if you build/install other packages. Roger ---------------------------------------------------------------- Ok simrw!!! All the problems have been resolved!!! :-D Now OC works perfectly. I've re-installed Berkley DB with --prefix=/usr/local and i've added the path /usr/local/lib in /etc/ld.so.conf and run ldconfig. Then i've installed OC-0.33 without problems also on Ubuntu!! Thank you very much I ask you a last demand: When i try to compiling hello.cob example con cobc hello.cob: [code]---- hello.cob ------------------------- * Sample COBOL program IDENTIFICATION DIVISION. PROGRAM-ID. hello. PROCEDURE DIVISION. DISPLAY "Hello World!". STOP RUN. ----------------------------------------[/code] I obtain turned out following: [code]hello.cob:1: Warning: Invalid indicator 'e' at column 7 hello.cob:1: Error: syntax error, unexpected WORD, expecting PROGRAM_ID[/code] Where do i mistake? Still thank you very much!! ---------------------------------------------------------------- ---- hello.cob ------------------------- ---------------------------------------- Take out the above 2 lines from the source code :-) Note that the '*' on the comment line should be at column 7 and that the following lines should start at column 8. (That's standard fixed-format Cobol) Then - cobc -x hello.cob ./hello or - cobc hello.cob (equivalent to cobc -m hello.cob) cobcrun hello Roger ---------------------------------------------------------------- I have Ubuntu also. I was on v6.10 and had installed v.32 of OC from the repositories. It worked great. Now I have done a completely fresh installed on a wiped drive to v7.04 of Ubuntu, partly to try my hand and installing v.33 of OC from source. I've never done that before with any program. It worked splendid. I had a few hitches due to not being sudo (not realizing I needed to be...) but once I got everything figured out I was able to compile programs fine. At first I just did cobc codefile.cob and it produced .so files. (Will learn more later I gather those are library files). Then in the news I saw the -x option, so I tried and it worked fine, I got a nice executable from my code. Love it. Also I ran the tests/cobol85 test as instructed. I did a diff as the test stated. I got no differences. I assume that is a good thing? Or is this a test we run over and over? Also from what I read, is the screen section now implemented? Lastly I realize there is probably a way in all of these files for me to tell what is and what isnt implemented yet, but I've no idea where to start looking. Any suggestions are appreciated. (I can wait patiently, I realize yall are very busy). Thanks kindly and best regards. ---------------------------------------------------------------- Subject: newbie looking to find out where to start-Windows needing to use COBOL Hi Just looking to replace a copy of MSCOBOL that has become both outdated and lost! I am looking to edit flat files to produce rearranged flat files. I am assuming this product will do the job. It appears I need the COBOL download and a couple of other libraries--am assuming that all the COBOL downloads and ensuing executable(s) go in the same subdirectory. If so, I would like to proceed. I also read where this application appears to take the COBOL code and execute C instructions, is that a correct read? Enough questions for now. I am glad to have found this site. Thanks Joe ---------------------------------------------------------------- OpenCobol tranlsates cobol into c, this is right. If you want to use Opencobol with a Windows environment you need extra software, I advise Cygwin. Just download the 0.33 prerelease and follow the instructions that can be found in rhe readme file. ---------------------------------------------------------------- Subject: Generating listing file. Hello: I've been hacking on the 0.33 version of the compiler and have added a program listing capability. The -t option does something other than reflect the source. And added a -T option for a wide format listing (instead of 80 columns). My question is where is the symbol table documented as I'd like to add a listing of the user symbols, etc. to the listing? And can I follow the TREE structures for this data? Thanks... ---------------------------------------------------------------- Basic starting point is cobc/tree.h which defines all the tree structures. Your starting point should be current_program (defined in cobc.c) which contains pointers to tree lists (eg. file_list, reference_list etc.) current_program is tree type cb_program defined at ca. line 1063 in tree.h. Hope that helps. ---------------------------------------------------------------- Subject: Power PC I am thinking about moving some old IBM 370 COBOL Code onto a Power PC. I am planning on using the Open Source COBOL Compiler for doing this. Any suggestions? Bob ---------------------------------------------------------------- Go for it ! Get the 0.33 prerelease and peruse the README for install instructions :-) (0.32 is broken on PPC) As you are coming from IBM, you will want to start out with compile option -std=mvs Roger ---------------------------------------------------------------- Subject: Compliation Problem : lncurses Hi everyone ! I'm working here on a Debian computer (2.6.18-3-686) and i've installed Open-Cobol via [code]apt-get install open-cobol[/code]Everythig goes righ untill I want to compilate a simple program. The Konsole returns this error :[code]# cobc hworld.cob /usr/bin/ld: ne peut trouver -lncurses collect2: ld returned 1 exit status[/code] Can someone help me to solve this problem ? I think I have ton install that program from the apt, but a [code]apt-cache search lncurses[/code] returns nothing :-( thanks to you ! ---------------------------------------------------------------- I would run the command: cobc -verbose hworld.cob The -verbose option shows what flags are passed to the C compiler and to the linker. Doing this will not automaticly solve your problem but it may give you a good place to look. Bob ---------------------------------------------------------------- I suppose you have to install ncurses, not lncurses ---------------------------------------------------------------- Indeed, but the question is who packaged this ? AFAIK, apt should resolve dependencies. This would mean that the packaging is wrong. Play safe and build from source using the 0.33 prerelease. Do not forget to read the README :-) Roger ---------------------------------------------------------------- Ok thanks to you ... Sorry for the long time not respondig, I was on Holliday, far away ... :-D I'll try to install the 0.33 prerelease with all specified packages in the Readme as soon I've a lot of time ... ---------------------------------------------------------------- Are you use Debian GNU/Linux? apt-get install libncurses5-dev Wait for answer... :-D :-D ---------------------------------------------------------------- Subject: pb with debugging tools Hello, Thanks for OC; but I got some prob when trying debugging tools. Here's the trace (OC 0.33) $:less /proc/version Linux version 2.6.17-2-k7 (Debian 2.6.17-9) (waldi@debian.org) (gcc version 4.1.2 20060901 (prerelease) (Debian 4.1.1-13)) #1 SMP Wed Sep 13 17:18:46 UTC 2006 $:less er.cob identification division. program-id. er. data division. working-storage section. 77 err pic 99. procedure division. 1. D Display "DEbug" move "AAAA" to err. display "err = " err add 1 to err display "err2 = " err. 2. stop run. $:cobc -x -debug er.cob $:er err = AA err2 = AA In the doc: "The compiler option -debug can be used during the development of your programs. It enables all run-time error checking, such as subscript boundary checks and numeric data checks, and displays run-time errors with source locations." How works -fdebugging-line (I tried D line,as above, but no output)? Tx for help Leo ---------------------------------------------------------------- Yes, correct on both counts. The numeric checks for ADD/SUBTRACT with -debug were missing. The -fdebugging-line should activate debugging lines (fixed-format - "D" in column 7) Both fixed in the 0.33 prerelease tarball. Redownload from link on home page or direct here : http://www.sim-basis.de/open-cobol-0.33.tar.gz Roger ---------------------------------------------------------------- Thanks Roger; both points are OK now. Another request: which options work with DISPLAY? I tried DISPLAY ... WITH BLINK, or WITH REVERSE-VIDEO, ... (ala MF) and got a compile error. Positionning (AT LINE ..) works but LINE and COLUMN are both mandatory. Leo ---------------------------------------------------------------- Re: LINE/COLUMN Yes, if one is specified then the other need not be specified. Fixed in current tarball. This gives 4 variants - AT LINE y (COLUMN assumed 1) AT COLUMN x (LINE assumed 1) AT LINE y COLUMN x AT COLUMN x LINE y The compiler should accept the WITH attributes although it does not do anything with them. eg. DISPLAY xxx AT LINE 3 WITH BLINK. Note that there is only the most rudimentary runtime support for screen I/O. This is a TODO item and is targeted for 0.34 Roger ---------------------------------------------------------------- Subject: Problems with make / openCobol in Cygwin Hi All, today I tried to install openCobol under Cygwin. The configure-Script works fine, but my makefile is producing an error. It says: intrinsic.c: In function `cob_intr_current_date': intrinsic.c:753: error: storage size of 'tmb' isn't known intrinsic.c:775: warning: implicit declaration of function `_ftime' intrinsic.c:753: warning: unused variable `tmb' make[2]: *** [libcob_la-intrinsic.lo] Error 1 Then the make-process ends and I am not able to install openCobol. I don't know what to do to solve this problem. I would be very thankfull if someone can help me. Thanks in advance Chris ---------------------------------------------------------------- Whoa, slowly here, that code does not get compiled unless _WIN32 is set, which it is NOT under Cygwin. The configure/make must be done under the Cygwin bash shell. ---------------------------------------------------------------- Actually on one Cygwin installation I have managed to reproduce this. Tracking it down now. Roger ---------------------------------------------------------------- Ah, yes, I see the problem. I will put up a new tarball later today. (Will post when ready) Fix is : Edit libcob/intrinsic.c Line 750 - #ifdef _WIN32 Change to - #if defined(_WIN32) && !defined(__CYGWIN__) Line 774 - #ifdef _WIN32 Change to - #if defined(_WIN32) && !defined(__CYGWIN__) Problem is weird. We normally only include the windows.h file if _WIN32 is defined. Specifically in intrinsic.c however we also include it for __CYGWIN__. Problem is that the windows.h file implicitely sets _WIN32. Why do we need this for Cygwin? - So that we can use the native Win functions for LOCALE support as although Cygwin pretends to have LOCALE support, it doesn't actually. Geez. Roger ---------------------------------------------------------------- OK. 0.33 tarball has been updated. Roger ---------------------------------------------------------------- Thank you for your replies. I'll give it a try tomorrow!! ---------------------------------------------------------------- Subject: OpenCobol in OS X 10.4 (intel) I'm trying to compile OpenCobol 0.33 in Tiger but get the following errors in ./configure --with-db /usr/local/lib/libgmp.a(mp_bpl.o) definition of common ___gmp_junk (size 16) /usr/bin/libtool: internal link edit command failed make[2]: *** [libcob.la] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 I installed gmp using Fink. Any ideas? ---------------------------------------------------------------- Sure, GMP is borked :-) Nothing to do with OC :-) Roger ---------------------------------------------------------------- According to the GMP home site - http://www.swox.com/gmp and going through the mailing lists, Intel Mac is not currently supported. Complain on that list or via Apple :-) Roger ---------------------------------------------------------------- :-( Ok then, I guess I'll have to wait for a new version. Now, do you know any COBOL compiler for OS X? Thanks for your answer! ---------------------------------------------------------------- You might want to try this to get GMP going - http://gmplib.org/list-archives/gmp-discuss/2006-July/002430.html Roger ---------------------------------------------------------------- Subject: windows and opencobol + cygwin Hi another win compilation problem... ;o( have installed cygwin 4.2.1 and when I want to install opencobol or gmp following error: error during gmp compilation: line 37: $'\r': command not found line 45: syntax error near unexpected token 'elif' line 45: 'elif test -n "${BASH_VERSION+set}" && (set -o posix) >/de'/null 2>&1; then the same I'm getting when I want to install opencobol... probably am doing something veeeery wrong please help... ---------------------------------------------------------------- No idea what Cygwin 4.2.1 is :-) According to Cygwin site, cuurent release is 1.5.24-2. Cygwin has all the necessary prerequisites for OC. After reading the OC README :-), Cygwin provides ALL necessary packages. If you are not versed with Cygwin, then read the Cygwin introductory documentation. Use the 0.33 prerelease, this has been tested under cuurent/previous Cygwin. Roger ---------------------------------------------------------------- Subject: Error compiling Towers of Hanoi Hi, I installed opencobol on OS X from Fink today. Version 0.32. I tried compiling the Towers of Hanoi program from: http://www.kernelthread.com/hanoi/html/cob.html It fails with this: marvin-2:~/tmp sandyd$ cobc hanoi.cbl hanoi.cbl: In paragraph 'DO-HANOI': hanoi.cbl:84: syntax error, unexpected WORD hanoi.cbl:89: 'GET-DISKS' undefined hanoi.cbl:40: 'GET-DISKS' undefined hanoi.cbl:54: 'MOVE-DISK' undefined hanoi.cbl:73: 'MOVE-DISK' undefined The program appears to meet IBM's specification of the COBOL grammar. It gets past the "syntax error, unexpected WORD" if I insert a line before the MOVE-DISK paragraph that contains only a period, and then the whole thing compiles if I insert another line like that before the GET-DISKS paragraph. Is this expected behaviour? ---------------------------------------------------------------- Yes. The syntax is illegal (in any Cobol). A paragraph MUST be terminated with a period. That applies to DO-HANOI and MOVE-DISK. And although the author links to OpenCOBOL, he obviously never compiled that source :-) Roger ---------------------------------------------------------------- Thanks for the quick reply Roger. ---------------------------------------------------------------- ;-) Roger ---------------------------------------------------------------- The original program has been changed. I contacted the original person. This has since been changed :-) Reload and try :-) Roger ---------------------------------------------------------------- Subject: Hi Hi. I'm Jon. I like programming, and I've been interested in COBOL because my teachers talked about it a lot. I think it'll be fun learning it, but I needed a compiler. I don't have all the money in the world, and I don't want to support companies who don't give out free stuff for educational purposes (Fujitsu's free COBOL version is not a good thing either, because it's hard to make it work on XP, and I had to dig up a copy of Windows NT 199x) because I think they're greedy. That's why I got OpenCOBOL. I downloaded everything that is necessary, and a boat load of documentation. I'll try to follow everything given my limited intelligence and time :oops: . I hope it's okay to ask you guys for help, if I'm really stuck in a rut. ---------------------------------------------------------------- Sure. Everybody is free to post as he/she wants :-) Recommend you download the 0.33 prerelease and carefully read the README. If you get problems, do not be afraid to post. Roger ---------------------------------------------------------------- Subject: COBOL to C question First off just let me say that I am new to COBOL. Since nobody in the company that I am contracted to knows COBOL and I am the low guy on the Totem pole I have been tasked with converting some COBOL programs to C. I am looking into OpenCOBOL as a way to do this conversion. I was just wondering if anyone has any information as far as performance hits, conversion accuracy, helpful hints, or any pitfalls that I should be aware of before I start the conversion. I have searched the website but I didn't find anything, I may have missed it though. I am just looking for any information that may save me some headaches in the future. Thanks. ---------------------------------------------------------------- Yes, I can understand the problem. There is nothing that I know of on the market that will do what you want. Yes, OC generates C code, but it is NOT "maintainable". It is dependant on OC release/version and is practically non-informative. Do NOT go with any COBOL->C way. It will NOT work ultimately. Instead, maybe think, I have a free Cobol compiler :-) THAT reduces budgets :-) It does not make sense to try to convert legacy Cobol progs to any other language. Roger ---------------------------------------------------------------- Thank you for your quick response. I agree with you as well, in all my experiences with converting one program language to another I have not seen any software that will accomplish it successfully. In the past couple days I have been creating some test COBOL programs and have found that as I am becoming more familiar with the language the more I like it. I am not sure if it will be an option to keep the programs in the Cobol language or not. I have a feeling that they are going to force this Cobol->C conversion. Regardless, I think I will continue to learn Cobol. ---------------------------------------------------------------- Subject: Runtime Segmentation Fault. Hi there, I am first time user of OpenCobol. Problem: I have 2 COBOL programs say Cob1.cob and Cob2.cob I am dynamically calling Cob2 from Cob1 using a call statement, both the programs are compiled individually. cobc Cob1.cob & cobc Cob2.cob I have set the variable as COB_LIBRARY_PATH=. both the program programs are compiled in the same folder. When I execute the Cob1.cob it gives me a runtime error as Segmentation Fault. Tried the cobc -m Cob2.cob as well. No luck. Can you tell me If I am doing something wrong. My Environment: Fedora Core 5, Kernel Version: 2.6.20-1.2316.fc5 COBOL Version: cobc (OpenCOBOL) 0.32 Copyright (C) 2001-2004 Keisuke Nishida GCC Version: gcc (GCC) 4.1.1 20060525 (Red Hat 4.1.1-1) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Thanks in advance, Giri :-) ---------------------------------------------------------------- Firstly, move up to the 0.33 prerelease. (Link from home page) (Don't forget to read the README) Note that in 0.33, the default option if non specified is -m ie. Create a module. Then - cobc -x cob1.cob cobc -m cob2.cob ./cob1 Alternatively - cobc -m cob1.cob cobc -m cob2.cob cobcrun cob1 Roger ---------------------------------------------------------------- Subject: errors in doing make check (cygwin) Sorry, I can't help you here. This is not an OC problem. This is a Cygwin/Windows problem. (I regularly do Cygwin checks on the 0.33 prerelease) Roger ---------------------------------------------------------------- Hi! I'm running cygwin and compiling my first cobol-programs works fine. But there were some errors during install (only in make check) with windows-errors. I think there are some tricky issues in the make check routine, maybe you know what these are about: Always the same Windows Error: SH caused an error by an invalid side in module CYGWIN1.DLL 105: FUNCTION ACOS 68928 [main] sh 1103967 fork : child -1 - died waiting for longjmp before initialization, retry 0, exit code 0xFFFFFFFF, errno 11 ././run: fork: Resource temporarily unavailable 128 [main] sh 68166783 fork: child -1 - died waiting for longjmp before init ialization, retry 0, exit code 0xFFFFFFFF, errno 11 197 [main] sh 375667 fork: child -1 - died waiting for longjmp before initia lization, retry 0, exit code 0xFFFFFFFF, errno 11 ././run: fork: Resource temporarily unavailable FAIL: ./run ## Run time tests with -O option ## ## ------------------------------------- ## ## OpenCOBOL 0.33 test suite: Run Tests. ## ## ------------------------------------- ## 461 [main] sh 375667 fork: child -1 - died waiting for longjmp before initia lization, retry 0, exit code 0xFFFFFFFF, errno 11 /tmp/install/open-cobol-0.33/tests/run: fork: Resource temporarily unavailable FAIL: ./run-O .... ====================================================== 2 of 5 tests failed Please report to open-cobol-list@lists.sourceforge.net ====================================================== make[4]: *** [check-TESTS] Error 1 make[4]: Leaving directory `/tmp/install/open-cobol-0.33/tests' make[3]: *** [check-am] Error 2 make[3]: Leaving directory `/tmp/install/open-cobol-0.33/tests' make[2]: *** [check-recursive] Error 1 make[2]: Leaving directory `/tmp/install/open-cobol-0.33/tests' make[1]: *** [check-recursive] Error 1 make[1]: Leaving directory `/tmp/install/open-cobol-0.33' make: *** [check] Error 2 ---------------------------------------------------------------- Subject: screen section bug and attributes and colors hello i'm ANdrea i was trying to implement some screen section attributes and colors in the opencobol libcob and i discovered a bug that prevent screen section attributes to work. i list the corrections i have made to perser.c of cobc (that generates from parser.y) as reported by the diff utility. I have implemented some code to the screenio.c module of libcob to handle some screen section attributes and colors. if you tell me where to send the modified version of the file i will send it to you sincerely Andrea 5953c5953 < current_field->screen_flag |= COB_SCREEN_COLUMN_ABS; --- > current_field->screen_flag |= ~COB_SCREEN_COLUMN_ABS; 5961c5961 < current_field->screen_flag |= COB_SCREEN_COLUMN_PLUS; --- > current_field->screen_flag |= ~COB_SCREEN_COLUMN_PLUS; 5969c5969 < current_field->screen_flag |= COB_SCREEN_COLUMN_MINUS; --- > current_field->screen_flag |= ~COB_SCREEN_COLUMN_MINUS; ---------------------------------------------------------------- The parser stuff has been fixed in the development tarball of 0.33 to be found here: http://www.sim-basis.de/develop/open-cobol-0.33.tar.gz Rebase your screenio changes against above tarball. The address to send to can be found out by going to the OpenCOBOL project over at SourceForge, finding a mail from me in the mailing list and clicking on my name. Roger ---------------------------------------------------------------- Subject: AN IDEA FOR SQL SUPPORT IN OPENCOBOL hello everybody from Andrea perhaps i'm crazy but i was thinking about an idea to support SQL in opencobol and i would like to hear your comments the idea is to use the cobol syntax used for accessing sequential files to access SQL "pseudo files" which in reality will be sql connections to a sql database server we could declare a sql pseudo file by using a new pseudo file namimg syntax: for example we could wrtite: SELECT PSEUDO-FILE ASSIGN 'SQL://dbdriver/servername/database/username/password/options' organization is sequential. than we could declare some buffers to comunicate with the sql server: FD PSEUDO-FILE. 01 PSEUDO-FILE-SQL-COMMAND pic (100) value "select * from tablename". 01 PSEUDO-FILE-RESULT-ROW. 02 FIELD1 .... 02 FIELD2 ... ........... 02 FIELDN ... to open the connection to sql database: OPEN PSEUDO-FILE I-O to issue a query to the database: WRITE PSEUDO-FILE FROM PSEUDO-FILE-SQL-COMMAND to read a row from the resultset READ PSEUDO-FILE INTO PSEUDO-FILE-RESULT-ROW AT END ..... to close the connection to the database: CLOSE PSEUDO-FILE the advantages would be: 1) No new syntax to learn 2) no disruption of cobol syntax and standards 3) no sql preprocessor to use and learn 4) extensibility to more database server types i know it's a little dirty idea , but .. ;-) Andrea ---------------------------------------------------------------- Thanks for a very thoughtful and considered contribution! This is not a yay or nay vote for your suggestion but a caveat based on 35+ years of programming experience most of which involved COBOL. I've used practically all of the COBOL compilers from IBM, Honeywell, and Bull, and others. A big part of the very foundation of COBOL is standardization. I've converted literally thousands of programs from one vendor's COBOL to that of another. What always made this feasible was standardization. What always caused problems was a vendor's failure to adhere to the standard. Many times this was called "extensions to the standard" by the manufacturer or vendor. Some times the "extensions" later became part of the standard. Often, however, the extensions were merely failure to follow the industry standard. If we (OpenCOBOL developers and users) want to attract converts from other platforms (hardware and software) then we must be very careful about following the standards and about introducing "extensions" or non-standard constructs. Most mainframe programmers, and many pc programmers, that use COBOL are familar with embedded SQL in programs (for instance, the gazillion or so DB2 programmers). They may be reluctant to convert to a compiler that has implemented embedded SQL in a non-standard fashion. Food for thought.... Regards, Alec 8-) ---------------------------------------------------------------- Have you tried this solution ? I get 'File doest not exist'[quote] ---------------------------------------------------------------- hi it was only an idea for a possible future implementation but currently it is not implemented so it does not work ! bye ---------------------------------------------------------------- I think it is not a bad idea. Embebed SQL must be kept for compatibility, but new cobol compiler need better features. An SQL dataset may be created via a SQL cursor and asociate it with a dynamic access file. ---------------------------------------------------------------- Many years ago, I did embedded SQL against Adabas. It used a syntax of EXEC SQL kind of like the CICS syntax. You were able to create cursors, and fetch into (or select directly into) working storage variables. ---------------------------------------------------------------- That is the standard way. Each database brings its own preprocesor which translates the EXEC SQL into propietary API call. I used two of them: Pro*Cobol (Oracle) and gpre (Interbase). Regards. ---------------------------------------------------------------- Embedded SQL with DB2 and the DB2 preprocessor (db2 prep)works fine with OpenCobol, too. Cheers, Juergen ---------------------------------------------------------------- Subject: Unsatisfied code symbol I am new to OpenCOBOL. I thought that my installation of OpenCOBOL was successful, I didn't notice any errors and I have been able to successfully compile and execute a number of COBOL scripts. Lately I have been recieving the following error when I try and execute a script that is utilizing a MULTIPLY command. /usr/lib/pa20_64/dld.sl: Unsatisfied code symbol "cob_decimal_set_int" in load module './cob1.sl'. Hopefully you can shed some light on this because the only thing that I can think of doing is to install everything again to see if it fixes the issue (which i would rather not do if I can help it). OS: HP-UX PA8700 2.3 B.11.11. U OpenCOBOL: version .33 GMP version 4.2.1 Thanks for the help. ---------------------------------------------------------------- Sorry for wasting your time, I was able to figure it out and it works fine now. Sorry again. ---------------------------------------------------------------- Subject: Problem with comp-types --> all comp-types seem to be the same Let me first give the summary: I need a comp-type with big endian as byte-order. According to simrw [quote]by simrw on 2007/1/8 14:18:07 Re: Big-endian Generate COMP-5 items or handle byte-swap (Depending on compile opts .-) ) Roger[/quote] different comp-types should have different Byte-Order. This is also part of one of my test programs for oc and it seems that it does not work. Here is my test program: [code] IDENTIFICATION DIVISION. PROGRAM-ID. CMPTST. **************************************************************** * * * PROGRAM FOR TESTING DIFFERENT COMP-TYPES IN OC * * * **************************************************************** ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. UNIX. OBJECT-COMPUTER. UNIX. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. *---------------------------------------------------------------- INPUT-OUTPUT SECTION. * FILE-CONTROL. SELECT CMP ASSIGN TO "CMPFILE" ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS CMP-STATUS. SELECT CMP4 ASSIGN TO "CMP4FILE" ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS CMP4-STATUS. SELECT CMP5 ASSIGN TO "CMP5FILE" ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS CMP5-STATUS. SELECT CMPX ASSIGN TO "CMPXFILE" ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS CMPX-STATUS. *---------------------------------------------------------------- DATA DIVISION. FILE SECTION. FD CMP. 01 CMP-REC. 03 CMP-ENTRY PIC X(300). FD CMP4. 01 CMP4-REC. 03 CMP4-ENTRY PIC X(300). FD CMP5. 01 CMP5-REC. 03 CMP5-ENTRY PIC X(300). FD CMPX. 01 CMPX-REC. 03 CMPX-ENTRY PIC X(300). *---------------------------------------------------------------- WORKING-STORAGE SECTION. * 01 CMP-STATUS PIC X(02). 01 CMP4-STATUS pic X(02). 01 CMP5-STATUS pic X(02). 01 CMPX-STATUS PIC X(02). * 01 testvar-nc pic 99 COMP value zero. * 01 testvar-ncx redefines testvar-nc. 02 testvar-ncx-a pic x. 02 testvar-ncx-b pic x. * 01 testvar-n4c pic 99 COMP-4 value zero. * 01 testvar-n4cx redefines testvar-n4c. 02 testvar-n4cx-a pic x. 02 testvar-n4cx-b pic x. * 01 testvar-n5c pic 99 COMP-5 value zero. * 01 testvar-n5cx redefines testvar-n5c. 02 testvar-n5cx-a pic x. 02 testvar-n5cx-b pic x. * 01 testvar-nxc pic 99 COMP-X value zero. * 01 testvar-nxcx redefines testvar-nxc. 02 testvar-nxcx-a pic x. 02 testvar-nxcx-b pic x. * *-------------------------------------------------------------- *-------------------------------------------------------------- PROCEDURE DIVISION. MAIN SECTION. 00. open output CMP open output CMP4 open output CMP5 open output CMPX * move 4 to testvar-nc, testvar-n4c, testvar-n5c, testvar-nxc * move '4' to CMP-ENTRY, CMP4-ENTRY, CMP5-ENTRY, CMPX-ENTRY perform rec-write * move testvar-nc to CMP-ENTRY move testvar-n4c to CMP4-ENTRY move testvar-n5c to CMP5-ENTRY move testvar-nxc to CMPX-ENTRY perform rec-write * move testvar-ncx to CMP-ENTRY move testvar-n4cx to CMP4-ENTRY move testvar-n5cx to CMP5-ENTRY move testvar-nxcx to CMPX-ENTRY perform rec-write * move testvar-ncx-a to CMP-ENTRY move testvar-n4cx-a to CMP4-ENTRY move testvar-n5cx-a to CMP5-ENTRY move testvar-nxcx-a to CMPX-ENTRY perform rec-write * move testvar-ncx-b to CMP-ENTRY move testvar-n4cx-b to CMP4-ENTRY move testvar-n5cx-b to CMP5-ENTRY move testvar-nxcx-b to CMPX-ENTRY perform rec-write * close CMP close CMP4 close CMP5 close CMPX * stop run * continue. ex. exit program. *-------------------------------------------------------------- rec-write section. 00. write CMP-REC write CMP4-REC write CMP5-REC write CMPX-REC * continue. ex. exit. *-------------------------------------------------------------- *-- End of CMPTST -------------------------------------------[/code] Compiling with "cobc CMPTST.CBL" and running with "cobcrun CMPTST" generates four files. Viewing all four with an hex editor shows that these are identical files:[quote]340A 3034 0A04 000A 040A 000A[/quote]: Shouldn't at least one file be [quote]340A 3034 0A00 040A 000A 040A[/quote]? According to the [url=http://supportline.microfocus.com/documentation/books/nx50/lhclan.htm#u943]microfocus documentation[/url] the outcome should be different, too. I've compiled this program using a Linux machine (Intel) and urgently need the file (without swapping the bytes manually) like the one I quoted (generated by ACU with pic 99 comp.). Are there some compiler options for that? Greetings, human. ---------------------------------------------------------------- Example is completely invalid. (Following apllies to whatever compiler you are using, OC, MF, ACU, etc) You should first understand how binary fields are allocated. Depending on the PIC clause and compile options, you will get a differing number of bytes allocated for binary fields. In OC, this is controlled by the "-std=" option (or lack of). How this affects binary allocation is documented in config/default.conf under parameter "binary-size". In eg. MF, the default mode can allocate any value from 1 to 8 bytes depending on PIC. However, per compile option (MF - IBMCOMP, OC - -std=ibm, mvs, bs2000), this switches to so-called "word-stoarge mode". ie. allocation is restricted to 2, 4 and 8 bytes. So, per default, your PIC 99 COMP(-n) fields are 1 byte (unless influenced by options). Try this - IDENTIFICATION DIVISION. PROGRAM-ID. CMPTST. DATA DIVISION. WORKING-STORAGE SECTION. 01 testvar-nc pic 9(4) COMP value 4. 01 testvar-ncx redefines testvar-nc. 02 testvar-ncx-a pic 99 comp. 02 testvar-ncx-b pic 99 comp. * 01 testvar-n4c pic 9(4) COMP-4 value 4. 01 testvar-n4cx redefines testvar-n4c. 02 testvar-n4cx-a pic 99 comp. 02 testvar-n4cx-b pic 99 comp. * 01 testvar-n5c pic 9(4) COMP-5 value 4. 01 testvar-n5cx redefines testvar-n5c. 02 testvar-n5cx-a pic 99 comp. 02 testvar-n5cx-b pic 99 comp. * 01 testvar-nxc pic 9(4) COMP-X value 4. 01 testvar-nxcx redefines testvar-nxc. 02 testvar-nxcx-a pic 99 comp. 02 testvar-nxcx-b pic 99 comp. * PROCEDURE DIVISION. MAIN SECTION. 00. display "COMP". display "Byte 1 " testvar-ncx-a " Byte 2 " testvar-ncx-b. display "COMP-4". display "Byte 1 " testvar-n4cx-a " Byte 2 " testvar-n4cx-b. display "COMP-5". display "Byte 1 " testvar-n5cx-a " Byte 2 " testvar-n5cx-b. display "COMP-X". display "Byte 1 " testvar-nxcx-a " Byte 2 " testvar-nxcx-b. stop run. *NOTE* This will only run correctly in "byte-storage mode". ie. In OC, per default or NOT using "-std=ibm, mvs, bs2000). In MF, with NOT specifying IBMCOMP. Strictly speaking, the testvar-nxxx fields should be defined as USAGE BINARY-CHAR UNSIGNED (No PIC clause). This is the 2002 standard. However, MF/ACU (depending on version) do not allow a mix of 2002/non-2002 syntax. Note that 2002 (and 85) standards do not define any COMP-x variants. Result of above prog with OC - # cobc -x cmptst2.cob # ./cmptst2 COMP Byte 1 00 Byte 2 04 COMP-4 Byte 1 00 Byte 2 04 COMP-5 Byte 1 04 Byte 2 00 COMP-X Byte 1 00 Byte 2 04 Result with MF - # cob -u cmptst2.cob # cobrun ./cmptst2 COMP Byte 1 00 Byte 2 04 COMP-4 Byte 1 00 Byte 2 04 COMP-5 Byte 1 04 Byte 2 00 COMP-X Byte 1 00 Byte 2 04 All perfectly OK and as expected. In other words - COMP (aka BINARY) is always big endian. COMP-5 (aka BINARY-CHAR/SHORT/LONG/DOUBLE) is machine dependent and maybe either little or big endian. Roger ---------------------------------------------------------------- Subject: WANT TO KNOW HOW TO INSTALL OPENCOBOL HELLO ALL. I studied COBOL years ago and want to get back into it. I am new to OpenCOBOL and need to understand how to install it. I was not able to understand the user manual explaining how to extract the .tar gz file. But I used WinZIP and fortunately it was able to unzip and extract the file. Now I have a bunch of files in a folder and still have no idea how to use it. I can not open hardly any of the files with any program that I have and nothing looks like an execute or setup file. How and I supposed to install the COBOL compiler ? Also, once I install the compiler I need a manual on how to actually use it. I greatly appreciate whatever help you can give I have been thoroughly confused. Thanks, Stormy. ---------------------------------------------------------------- OC works only with an unix environment. Use an unix Machine / Virtual Machine or, as I suppose, CygWin to compile in an unix environment. Please have a look at the other topics and read the [url=http://www.opencobol.org/modules/xoopsfaq/index.php?cat_id=1]FAQ[/url] about that. ---------------------------------------------------------------- Subject: syntax error Hi, I am new to COBOL and I have a little problem.This is my code [code] IDENTIFICATION DIVISION. PROGRAM-ID. ex1a. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT inputfile ASSIGN TO "input.dat" organization is line sequential. SELECT outputfile ASSIGN TO "output.dat" organization is line sequential. SELECT sortfile ASSIGN TO disk. DATA DIVISION. FILE SECTION. FD inputfile block contains 100 records. 01 inputrec pic x(24). FD outputfile block contains 100 records. 01 outputrec pic x(24). SD sortfile. 01 sortrec. 03 city pix x(20). 03 postalcode pic 9(4). PROCEDURE DIVISION. MAIN. SORT sortfile ON DESCENDING KEY postalcode USING inputfile GIVING outputfile STOP RUN.[/code] As you can see it is not a very difficult program (just an exercise for school). But when I try to compile it with openCOBOL (cobc ex1a.cob) it gives a syntax error: [code]syntax error, unexpected WORD, expecting EXTERNAL or GLOBAL[/code] But I can't see what I'm doing wrong... Could somebody help me? Thank you very much! ---------------------------------------------------------------- I just spotted my error, I wrote 'pix' instead of 'pic'. So never mind this topic. ---------------------------------------------------------------- Subject: program execution hangs when executed via ssh Whenever I try to execute a compiled program via ssh the program hangs. Even the simple hello.cbl hangs when I execute via ssh. example: ssh user@server1 /home/user/hello The process will hang, yet if I execute the same program on the server directly, it runs without a problem. Any thoughts or solutions? Thanks Michael ---------------------------------------------------------------- I found the problem. When ssh'ing into the server, the path /usr/local/bin was not included, and thus cygcob-1.dll could not be found. By creating a simple wrapper script to set the path prior to program execution solved the problem. ---------------------------------------------------------------- Subject: Compile warning; c warning? Hi, when I compile the following code, I get the compiler output: [code] /tmp/cobpyX3Ix.c: In function ‘Course$2DRecords_’: /tmp/cobpyX3Ix.c:37: warning: initialization from incompatible pointer type [/code] If anyone could tell me how to fix this, it would great. Since this is a warning, I have the impression that it might not be influencing the functionality of my COBOL program. Could anyone confirm this? test.cbl [code] IDENTIFICATION DIVISION. PROGRAM-ID. Course-Records. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT course-file ASSIGN TO "COURSE.DAT" ORGANIZATION IS LINE SEQUENTIAL. DATA DIVISION. FILE SECTION. FD course-file. 01 course-record. 10 cr-course-number PIC X(8). PROCEDURE DIVISION. 000-main. DISPLAY "This program generates a data file." OPEN OUTPUT course-file CLOSE course-file. STOP RUN. [/code] ---------------------------------------------------------------- Please use the 0.33 prerelease. Roger ---------------------------------------------------------------- I updated to 0.33 prerelease and no longer get those messages on compile. However, now with 0.33 I get the following message when I run the binary: [code] Segmentation fault (core dumped) [/code] FYI: I am on Ubuntu 7.04. What would be causing this problem? I imagine you would like the core dump, where do I get this? Thanks, Jeffrey ---------------------------------------------------------------- To follow up on my previous post, I tried to compile and run the following 'simple' Hello World program. The pogram compiles without any errors, but I get another segmentation fault error on run-time. Here is the code for the program: [code] IDENTIFICATION DIVISION. PROGRAM-ID. Hello-World. PROCEDURE DIVISION. 000-main. DISPLAY "Hello World." STOP RUN. [/code] Any help in solving this problem is appreciated. Thanks, Jeffrey ---------------------------------------------------------------- And HOW did you compile it? Note that default options have changed between 0.32 and 0.33. cobc --help will show you options and defaults. Under 0.33, to compile an executable - cobc -x hello.cob ./hello Or you can do - cobc -m hello.cob cobcrun hello Note the "-m" is optional as creating a loadable module is default. Roger ---------------------------------------------------------------- Okay, I was using default options and now that I specify [code] cobc -x hello_world.cbl -o hello_world.bin ./hello_world.bin [/code] I get different results; I now get [code] ./hello_world.bin: error while loading shared libraries: libcob.so.1: cannot open shared object file: No such file or directory [/code] What does this mean? Thanks, Jeffrey ---------------------------------------------------------------- What it means is read the README :-) Roger ---------------------------------------------------------------- I imagine you are talking about ld.so.conf? I thought I completed that step; maybe I misunderstood? The contents of my /etc/ld.so.conf file is: [code] include /etc/ld.so.conf.d/*.conf include /usr/local/lib [/code] After adding the last line, I ran sudo ldconfig, but it doesn't seem to help. Is it in fact ld.so.conf you are talking about? Did I make the changes to the ld.so.conf file properly? Thanks, Jeffrey ---------------------------------------------------------------- I have no idea :-) Consult your Ubuntu doc :-) (Why any distro allows execution from /usr/loc/bin but does not inspect /usr/local/lib is beyond me) Actually, looking at it logically (and not knowing Ubuntu) your change does not seem correct :-) How can you include a file that does not exist :-) Hint :-) Roger ---------------------------------------------------------------- Eureka!! I got it working! Thanks for your help Roger. Turns out the second line of /etc/ld.so.conf needs to be as follows: [code] include /etc/ld.so.conf.d/*.conf /usr/local/lib/ [/code] As you said, it doesn't make much sense that this is not set by default considering how /usr/local/bin/ is. Go figure. Thanks again for the help! P.S. I now have WRITE access to files (when I started this topic, my program created a file but could not write to it). I guess that warning did influence my programs after all! ---------------------------------------------------------------- :-) That's what I like. Somebody that can react to the basics. I must tell you about something that happened to me recently. Somebody came to me and said - My monitor has some peculiar shadows. Hmm. What do you mean. Well, the monitor has funny logos on the display. Oh. OK. What is your monitor? - Blah And did you read the documention? Erm - No. What do you see exactly? Hmm, A thing that says 1280 x 1024 Enough said? If you haven't got it by now, the person had not removed the protective layer on the display! So much for reading the doc. Roger ---------------------------------------------------------------- Yes, it is easy to get to excited and skip docs. In this case, I did read the README but the note was talking about Red Hat and Fedora (and possibly other ditros)... I thought Ubuntu would have avoided that.... Maybe if the note would include a typical error, such as the one I had, I would have been able to figure this out for myself. Either way, thanks for the help. Jeffrey :-P ---------------------------------------------------------------- Actually, this is very valid. OK. Will review the README. However, what various distros do is of course something of guesswork. It also depends on security aspects. The default as done should (with respect to the README) satisfy most people. Roger ---------------------------------------------------------------- I think that one of the great things in life is to say "I was wrong". I have done it many times with respect to Cobol standards on other forums. Many times I have contibuted to the cobol forum and the last post on the forum for cobol has resulted in a revision of the 2002 standard. People respect that and I am sure you will be a respected forum contributor. Thanks Roger ---------------------------------------------------------------- Subject: Not Issue Please consider the following COBOL Program: IDENTIFICATION DIVISION. PROGRAM-ID. Not1. ENVIRONMENT DIVISION. CONFIGURATION SECTION. DATA DIVISION. WORKING-STORAGE SECTION. 01 QVAR PIC X VALUE SPACES. 88 Q232-PAPER VALUE 'P'. 88 Q232-ALT-MEDIA VALUE 'A'. 88 Q232-PAPER-ALT-MEDIA VALUE 'Z'. PROCEDURE DIVISION. DISPLAY 'FII2AI20: before EVALUATE TRUE' MOVE 'A' TO QVAR. EVALUATE TRUE WHEN NOT Q232-PAPER AND NOT Q232-ALT-MEDIA DISPLAY 'CASE 1' WHEN OTHER DISPLAY 'OTHER' END-EVALUATE GOBACK. When run on the IBM mainframe, it displays: OTHER. When I compile this with the Open Source COBOL Compiler (with -std=mvs) and run this under Unix/Linux I get ‘CASE 1’. I believe that the issue is with the precedence of the NOT operator. Please consider the first WHEN clause in the above program. The IBM mainframe COBOL Compiler assumes that the user (programmer) meant: WHEN (NOT Q232-PAPER) AND (NOT Q232-ALT-MEDIA) But the Open Source COBOL Compiler assumes that the programmer meant: WHEN NOT (Q232-PAPER AND (NOT Q232-ALT-MEDIA)) I am attempting to modify the Open Source COBOL so that it has the same behavior as the IBM COBOL Compiler. To accomplish this task, I wrote the following two functions: int cb_inc_pri() { expr_prio['!'] -= 1; } int cb_dec_pri() { expr_prio['!'] += 1; } When the parser (parser.y) sees the token WHEN, of a when clause of an evaluate statement in calls the routine cb_inc_pri. When it is done parsing the clause, it calls cb_dec_pri. However, this change failed to solve my problem. I am also thinking that in the statement: IF X NOT = Y That is, “NOT =†should be treated as one token not two tokens. Not sure if this is relevant to my issue or not. I am hoping that somebody who has a strong understanding of the source code can tell me what I am missing and how I can modify the compiler to get the behavior I desire. Bob Sherry ---------------------------------------------------------------- And the winner is .. OC ! :-) The WHEN clause of the EVALUATE statement has a very specific syntax. This is true in the 85 standard as well as the 2002 standard. Part of the rules for evaluation (sic) - 6. If the selection object is identifier-2, literal-2, arithmetic-expression-2, or boolean-expression-2, the pair is considered to be a conditional expression of the following form: selection-subject [NOT] = selection-object where 'NOT' is present if it is present in the selection object. The result of the analysis is the truth value of the resulting conditional expression. Summary - WHEN NOT expr1 AND NOT expr2 is bracketed thus WHEN NOT (expr1 AND NOT expr2) and then (as it should be) interpreted as if subj NOT = (expr1 AND NOT expr2) As per the rules above. After all, MF, ACU and OC can't all be wrong :-) You can, of course, bracket the condition - WHEN (NOT expr1 AND NOT expr2) Roger ---------------------------------------------------------------- Roger, I compiled and ran the above exampe with the Micro Focus COBOL Compiler and I found that it matched the results of the main frame. The version of Micro Focus I am using is: 1.313. I also have Service Pack 2 of the compiler installed. I did this on a machine running Linux. Bob Sherry ---------------------------------------------------------------- Please carefully ready my reply. OC is doing the correct thing. (According to 85 /2002 rules) (Check your results using MF 2.2 or 4) Roger ---------------------------------------------------------------- Roger, The version of Micro Focus that I am using is current. I am guessing that you are using a Windows version of the Micro Focus Compiler. Is this true? Also, when you compile your program, what compiler options are you using? The only option I am using is -x. I now have modified my version of the Open Source COBOL Compiler to bind the NOT operator the same way the IBM Mainframe Compiler treats it. You are correct when you say that this is consistent with the 85/2002 rules. However, I think it would be nice if OC worked like the IBM Mainframe Compiler when -std=mvs was specified. I would be happy to send you these changes and/or include them in the official version of the Compiler if you wanted me to. Thanks Bob Sherry ---------------------------------------------------------------- Actually, this gets more and more interesting :-) It's more complicated than it seems. I was NOT actually 100% correct with the rules interpretation. The binding of the NOT to the WHEN is dependent on the evaluate subject type. Eeeek. TRUE does NOT fall into this category. Therefore OC is doing the wrong thing :-( Has been fixed in 0.33. Download from link here on the home page. Roger ---------------------------------------------------------------- Subject: error (STATUS=30) hi, when I open I-O a file I have this error libcob: Permanent file error (STATUS=30) File : ...... the file was created in another system what means ? there is a list of errors ? thank you ---------------------------------------------------------------- The first thing that came to mind was a permissions issue. That is, do you have permission to write the file. My second thought is that this is an index file. The format used by the Open Source COBOL Compiler for indexed files is different than that used by other COBOL compilers. If this is the case, you may want to recreate the file using the Open Source COBOL Compiler. I hope this helps. Bob Sherry ---------------------------------------------------------------- the file is: SELECT OPTIONAL PODISTI-FILE ASSIGN TO "PODISTI.DAT" ORGANIZATION IS INDEXED ACCESS MODE IS DYNAMIC RECORD KEY IS PODISTI-KEY. can you suggest me how migrate the file using the Open Source COBOL Compiler ? ---------------------------------------------------------------- Unload to a sequential file and reload into the new environment. This is normal as there is ZERO compatibility between IS files. (And not even normal files) (Quite easy, prog reads sequentially on subject system and writes (fixed) records. Object system reads sequential records and writes to object system) Perfectly normal data migration. Roger ---------------------------------------------------------------- If I understand.... I can read that file using: ... ACCESS SEQUENTIAL ... ?? ---------------------------------------------------------------- Please, need more help. Here, the same problem. FARTIC.DAT is an indexed file that comes from DOS / RM-Cobol. This would be the code in Open Cobol: INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT FARTIC ASSIGN TO 'FARTIC.DAT' * ASSIGN TO RANDOM 'FARTIC.DAT' (on RM-Cobol) ORGANIZATION INDEXED ACCESS SEQUENTIAL RECORD KEYART. Is there any other solution beside 'converting' the file ? ---------------------------------------------------------------- Indexed Sequential files are NOT, repeat NOT, compatible between Cobol systems. (And, depending on system, maybe not even variable length record files) You MUST unload the I/S data to a record sequential file on the source system and load this sequential file back on the object system. Schematically - Source system - READ NEXT MYISAM WRITE MYFIXEDRECORD Object System - READ MYFIXEDRECORD WRITE MYNEWISAM Roger ---------------------------------------------------------------- All clear !! :-D thanks ---------------------------------------------------------------- Subject: cobcurses-0.92.tar.gz Now Available Hi Everyone: This release has been long in coming, but some major changes took place over the last 6 months for this project. Many thanks to Roger While in working through a number of issues, especially HPUX OC issues connected with CobCurses. The largest aspect of this release was the incorporation of the GNU autoconf/automake system. So now you should be able to do: $ ./configure $ make $ make install ignoring some special configuration options. This particular release should compile and install out of the box for Cygwin and all Intel Linux distributions. You may have varying success on other UNIX systems. You must however, have a very recent Open-Cobol 0.33 installed, that supports the new -b compiler option. The good news for HPUX-11 users is that CobCurses should compile and install successfully (please follow the special documentation for installing on HPUX). It might also install on HPUX-10.x, but I have not tested this, and would be interested in hearing of experiences. The documentation is now ALL online. This was another major effort, but I think it will serve everyone best in the long run. The sourceforge.net people now support a project wiki. So you will find all CobCurses documentation now at: http://cobcurses.wiki.sourceforge.net Look for file downloads at: http://sourceforge.net/project/showfiles.php?group_id=186285 for the source distribution file: cobcurses-0.92.tar.gz ===================================== What is CobCurses? CobCurses is a package for use with the Open-Cobol compiler. It provides the COBOL programmer the ability to program screens in Open-Cobol, without SCREENS SECTION support in the compiler. The project includes a Screen Designer and code generator to make development of screens easier for COBOL programmers. ---------------------------------------------------------------- Thanks, thanks, thanks !! I've run the 3270test sample telnet-ing from a PuTTY terminal on XP and works perfectly. On the other side there was a Debian Linux. ---------------------------------------------------------------- Hey, I am glad people are using it. A lot of effort has gone into it, since the skunk-works start it had in January! Check the wiki site for updates since the current release (0.92). It will show the work in progress and what has been fixed (yes, there are bugs ;-) Information about the upcoming release can be found directly here (Release 0.93): http://cobcurses.wiki.sourceforge.net/ChangeLog+Release+0.93 Overall documentation can be found here: http://cobcurses.wiki.sourceforge.net or just: http://cobcurses.sourceforge.net (this redirects to the wiki URL above) I have a number of things on the wish list for the future of this package. For example, I want to build a menu process so that application "suites" can be built. But this is complicated by the need for a security mechanism on a menu item by menu item basis. This requires some careful planning on my part. A date field type is also needed, perhaps with a pop-up calendar picker. Stay tuned! Also please report any bugs that you find. I am happy to eliminate them. Release 0.93 may be out this weekend, if I get time for it. Thanks, Warren. ---------------------------------------------------------------- Subject: GOBACK and STOP RUN ? As per COBOL standards, GOBACK is used in a program to exit back to the last environment. If the last environment is shell it should exit to shell providing the return status, closing the code/thread / runtime. STOP RUN is used to exit the COBOL code, here also you can set the return-code to provide it to the last environment closing the runtime. Both the cases run time environment should behave similarly or same. But it is not happening, I think it is reloading the program again and then exiting to the environment. When I run it with GOBACK I get an extra line, where as STOP RUN output comes out correct. I am pasting the program below: --------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. filehndl. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT xfile ASSIGN TO ws-xfile ORGANIZATION IS LINE SEQUENTIAL file status is fs-xfile. DATA DIVISION. FILE SECTION. FD xfile. 01 xrecord pic x(80). WORKING-STORAGE SECTION. 01 WS-XFILE PIC X(100) VALUE './src/filehndl.cob'. 01 FS-XFILE PIC XX. ********************************************************* PROCEDURE DIVISION. 000-main. perform 1000-init-proc. perform 2000-proc until fs-xfile not = '00'. perform 9000-term-para. GOBACK. ********************************************************* 1000-init-proc. open input xfile. IF FS-XFILE = '00' READ XFILE END-IF CONTINUE. ********************************************************* 2000-PROC. DISPLAY XRECORD. READ XFILE. CONTINUE. ********************************************************* 9000-TERM-PARA. CLOSE XFILE. ********************************************************* Compilation: cobc -x src/filehndl.cob Execution: ./filehndl Environment. FC5 Cobol Version 0.33 Any suggestions? ---------------------------------------------------------------- This was fixed on June 16. Redownload and install 0.33. Roger ---------------------------------------------------------------- Subject: Duplicate Data Names While I admit, the following program fragment is not an ideal piece of COBOL code, it does go through the IBM Mainframe Compiler. However, it does not go though the Open Source COBOL Compiler. That is, cobc, generates an error message because the variable name: VARIABLE1 is defined in two places. Here is the code: IDENTIFICATION DIVISION. PROGRAM-ID. t11. DATA DIVISION. WORKING-STORAGE SECTION. 01 K525-AII-DRVR-RSTRT-DATA. 03 VARIABLE1 PIC X(8) VALUE SPACES. 03 K525-FRMT-FILE-ARRAY. 06 K525-FRMT-FILE-ARRAY-ROW OCCURS 6 TIMES ASCENDING KEY IS VARIABLE1. 09 VARIABLE1 PIC X(8) VALUE SPACES. 09 OTHER-DATA-ITEM PIC S9(5). PROCEDURE DIVISION. GOBACK. I would like to modify the COBOL Compiler so that it does accept the above code. I am hoping that somebody on this forum can give me some guidance on the best way to do this. Bob Sherry ---------------------------------------------------------------- If I am interpreting the (2002 and I believe the 85) standard correctly, this should not compile. (See 8.4.1.1, 2002) The KEY clause creates an implicit reference to VARIABLE1. However, if you change the ASCENDING statement to - ASCENDING KEY IS VARIABLE1 OF K525-FRMT-FILE-ARRAY-ROW. then OC will compile it. Roger ---------------------------------------------------------------- Roger, I am not saying that my example was "standard" COBOL. I am saying that my example represents COBOL code that will compile on an IBM mainframe and it will compile when using the Micro Focus compiler. As such that it would be nice if OC could compile it as written. Do you have any guidance I how I can modify OC so that it will compile the above code when -std=mvs? Also, I would be happy to send to my changes to fix the above issue. Bob Sherry ---------------------------------------------------------------- OC is correct.The implicit reference is there. Whether (x compiler) checks is not relevant. In fact your hypothetical construct is not usable in code in the PROCEDURE DIV. Try DISPLAY'ing your first VARIABLE1 :-) (The one at level 03) No matter how qualified :-) How about you putting your thoughts towards missing 2002 features in OC? :-) Roger ---------------------------------------------------------------- Roger, I realize that you do a lot of free work to support OC and I thank you. Our interest in OC is for moving old COBOL code off the IBM mainframe. Therefore, I do not have time adding the latest features of COBOL to OC. However, we have added some optimizations to OC and I would be happy to make them available. Would you like me to do this? Bob Sherry ---------------------------------------------------------------- And what has your reply to do with the original question ? The prog is an artificial construct that has nothing to do with real life. If you have a problem , post the the source code. Re. Optmizations - Resync against current 0.33 and post with an explanation. Roger ---------------------------------------------------------------- Subject: Getting Started I've downloaded everything I need to get started but I can't install anything. Even the install icon is unassigned. What am I missing? ---------------------------------------------------------------- Please have a look at the other topics and read the FAQ about that. Read also Install Guide and User Manual on the left menu in the documentation item. ---------------------------------------------------------------- Hi, Without more information nobody will be able to help you. ---------------------------------------------------------------- Good question. I am just looking to get started amd I am not sure what to download and in what order to download it. What have you done, so far? ---------------------------------------------------------------- A good place to start is with the README with any software. Roger ---------------------------------------------------------------- Subject: ¿Bug? PIC 9(08) HIGH-VALUES The testing program: WORKING-STORAGE SECTION. 01 KEY1-06 PIC 9(06). 01 KEY2-06 PIC 9(06). 01 KEY1-08 PIC 9(08). 01 KEY2-08 PIC 9(08). PROCEDURE DIVISION. MOVE 1 TO KEY1-06 KEY1-08 MOVE HIGH-VALUES TO KEY2-06 KEY2-08 DISPLAY 'KEY1-06 ' KEY1-06 ' KEY2-06 ' KEY2-06 IF ( KEY1-06 > KEY2-06 ) DISPLAY 'PROBLEM WITH PIC 9(06)' DISPLAY '1 GREATHER THAN HIGH-VALUES' ELSE DISPLAY 'ALL OK' END-IF. DISPLAY 'KEY1-08 ' KEY1-08 ' KEY2-08 ' KEY2-08 IF ( KEY1-08 > KEY2-08 ) DISPLAY 'PROBLEM WITH PIC 9(08)' DISPLAY '1 GREATHER THAN HIGH-VALUES' ELSE DISPLAY 'ALL OK' END-IF. ********************* The OUTPUT: KEY1-06 000001 KEY2-06 ������ ALL OK KEY1-08 00000001 KEY2-08 �������� PROBLEM WITH PIC 9(08) 1 GREATHER THAN HIGH-VALUES ********************* The execution was on: uname -a Linux chulo-desktop 2.6.20-16-generic #2 SMP Thu Jun 7 20:19:32 UTC 2007 i686 GNU/Linux cobc -version cobc (OpenCOBOL) 0.33.0 Copyright (C) 2001-2007 Keisuke Nishida Copyright (C) 2007 Roger While Thanks for any help with this problem. Excuse my bad english, sorry. Bye. ---------------------------------------------------------------- Hmmm. Here is what Microfocus makes of this - roglinux:~ # cob -u high.cob 12 MOVE HIGH-VALUES TO KEY2-06 KEY2-08 *1026-E*************************** ** ** Source literal is non-numeric - substituting zero ** Source literal is non-numeric - substituting zero *1026-E*********************************** ** ** Source literal is non-numeric - substituting zero roglinux:~ # cobrun high KEY1-06 000001 KEY2-06 000000 PROBLEM WITH PIC 9(06) 1 GREATHER THAN HIGH-VALUES KEY1-08 00000001 KEY2-08 00000000 PROBLEM WITH PIC 9(08) 1 GREATHER THAN HIGH-VALUES I know what the problem is, I do not know if we should follow MF here. Let me think about it. More later on this. --- Nobody, I repeat NOBODY, has to excuse bad english here. Write it as you can. (If only something like - "Not work", followed by example code) Just post as you can. (But please with a reasonable subject) Roger ---------------------------------------------------------------- If on MVS I move the figurative constant HIGH-VALUES (or HIGH-VALUE) to a numeric field, and then I compare it with any other numeric field different of HIGH-VALUES, I get that the first field its greater. I haven't a copy of MF compiler, why the compiler moves ZEROS to the field? HIGH-VALUES is not a valid value for a numeric field? I use very often, that MOVE to stop the process of the program. Something like: READ FILE1 AT END MOVE HIGH-VALUES TO KEY1. .... then I compare: IF KEY2 > KEY1 PERFORM READ-FILE1 ... So when i get AT END on a file, the program skip the read of that file. Thanks for your reply. ---------------------------------------------------------------- Per standard, the only figurative constant that you can move to a numeric data item is ZERO (ZEROS, ZEROES). Anything else is implementor defined with possibly undefined behaviour. In the case of HIGH-VALUES, the implementor may choose to move the maximum valid value into the numeric data item. ie. In your case all '9'. You then have a problem if your file contains a key with all '9'. The same applies to LOW-VALUES. The implementor may choose to move the minimum valid value into the data item. ie. All '0'. The safest way is to use an end-of-file indicator in working-storage. Roger ---------------------------------------------------------------- For the original problem, a fix has been applied. Please redownload. However, there is still a possible problem with illegal values in display fields which I am investigating. This, in no way, changes what I said in my previous post. If a program manages to get invalid contents into a field, then the results are undefined. Roger ---------------------------------------------------------------- Subject: Lines limited to 72 characters? I'm trying to write some simple programs in Ubuntu Linux using just a text editor, Joe, but I am unable to compile anything with lines longer than 72 characters. Programs with lines less than or equal to 72 characters work fine. Any ideas as to why? ---------------------------------------------------------------- Well, I've found my own answer. For any other extreme COBOL newbies out there, here's the answer I found in the wiki: [quote] Source Format OpenCOBOL supports both fixed and free source format. The default format is the fixed format. This can be explicitly overwritten by one of the following options: -free Free format. -fixed Fixed format. [/quote] So, COBOL can either compile in FIXED or FREE mode. FIXED means the code must be a fixed width, with each line starting at column 7 and ending at column 72. Since the default is FIXED, one must explicitly specify if their code is in the FREE format, e.g.: cobc -x -free MyCode.cob Also, any comments (lines beginning with *) must have the * at column 1 in FREE mode. It's great when I answer my own question! :-D ---------------------------------------------------------------- Not quite true :-) Fixed format allows longer lines, however, the syntax must then conform. If you want comment lines to be accepted regardless of fixed/free then you must code exactly as follows - columns 1-6 spaces, column 7 a '*' and column 8 a '>'. Such comments will compile regardless of fixed/free. Roger ---------------------------------------------------------------- Subject: July 27, 2007: cobcurses-0.93.tar.gz Available Major features of this release are: - New sdbackup/sdload backup and recovery commands - Enhanced sdgenerate command - A Generate screen from within the Screen Designer - Additional support API for loading spreadsheet *.CSV files - Additional support API for COBOL associative arrays - Enhanced COBCURSES-INIT-PATHNAME CALLable routine - NC-DRAW-SCREEN now checks minimum column/line/colour-pair requirements for your screen. - Various bug fixes The full details are found here: http://cobcurses.wiki.sourceforge.net/ This is the best release yet! If you are experiencing any build problems or bugs, don't be shy -- report them in the forum for it: http://sourceforge.net/forum/forum.php?forum_id=651454 ---- CobCurses is a package to make it possible to create screen based programs on open platforms that support a curses(3X) or ncurses(3X) library. CobCurses not only provides a binding to curses, but provides a Screen Designer to make it easier to build interactive COBOL screens. Enjoy, Warren. ---------------------------------------------------------------- Nuts! I knew I'd forget something.. Here's a direct link to the downloads page: http://sourceforge.net/project/showfiles.php?group_id=186285 Warren. ---------------------------------------------------------------- I had originally intended to include this fix in the 0.93 release, but it got forgotten. It is not a critical patch unless you are deleting many records within the sdesign screen. This patch corrects the deficiency where sdesign was failing to clean up records associated with the main screen record that was deleted. Previously, if you deleted a screen, the field definitions, the screen background and all field state records would remain in the database. To apply the patch, simply: 1. Download it 2. gunzip it 3. cd cobcurses-0.93/src 4. patch -p0 "configure: error: GMP 3 or later is required" What's happening? ;( cat config.log ... It was created by OpenCOBOL configure 0.32, which was generated by GNU Autoconf 2.59. Invocation command line was ... O/S: SuSE Linux 9.3 i686 i386 GNU/Linux :-o Then I installed 0.33 version and configure responded ok but make stopped with errors as noted below. I replaced configure in 0.32 with that of 0.33 but the same, so I commented the lines that check GMP in 0.32 configure and it ended ok, so make, but make check returned error on file operations : 59: First READ on empty SEQUENTIAL INDEXED file FAILED (misc.at:796) 60: REWRITE a RELATIVE file with RANDAM access ok 61: SORT: table sort ok 62: SORT nonexistent file FAILED (misc.at:907) make errors 0.33 or 0.32: gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -march=i686 -mcpu=pentium4 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF .deps/libcob_la-fileio.Tpo -c fileio.c -fPIC -DPIC -o .libs/libcob_la-fileio.o fileio.c:300: error: syntax error before "DB" fileio.c:300: warning: no semicolon at end of struct or union fileio.c:301: warning: type defaults to `int' in declaration of `key' fileio.c:301: warning: data definition has no type or storage class fileio.c:302: error: syntax error before "data" fileio.c:302: warning: type defaults to `int' in declaration of `data' fileio.c:302: warning: data definition has no type or storage class fileio.c:316: error: syntax error before '}' token fileio.c: In function `cob_sync': fileio.c:481: error: dereferencing pointer to incomplete type fileio.c:488: error: dereferencing pointer to incomplete type fileio.c: In function `indexed_open': fileio.c:1456: error: invalid application of `sizeof' to an incomplete type fileio.c:1505: error: dereferencing pointer to incomplete type fileio.c:1505: error: `DB' undeclared (first use in this function) fileio.c:1505: error: (Each undeclared identifier is reported only once fileio.c:1505: error: for each function it appears in.) fileio.c:1505: error: syntax error before ')' token fileio.c:1510: error: dereferencing pointer to incomplete type fileio.c:1511: error: dereferencing pointer to incomplete type fileio.c:1512: error: dereferencing pointer to incomplete type fileio.c:1521: error: `BTREEINFO' undeclared (first use in this function) fileio.c:1521: error: syntax error before "info" fileio.c:1554: error: `info' undeclared (first use in this function) fileio.c:1556: error: `R_DUP' undeclared (first use in this function) fileio.c:1567: error: dereferencing pointer to incomplete type fileio.c:1567: warning: implicit declaration of function `dbopen' fileio.c:1567: error: `DB_BTREE' undeclared (first use in this function) fileio.c:1568: error: dereferencing pointer to incomplete type fileio.c:1574: error: dereferencing pointer to incomplete type fileio.c:1574: error: dereferencing pointer to incomplete type fileio.c:1581: error: dereferencing pointer to incomplete type fileio.c:1582: error: dereferencing pointer to incomplete type fileio.c:1583: error: dereferencing pointer to incomplete type fileio.c:1595: error: dereferencing pointer to incomplete type fileio.c:1596: error: dereferencing pointer to incomplete type fileio.c:1599: error: dereferencing pointer to incomplete type fileio.c:1601: error: dereferencing pointer to incomplete type fileio.c:1602: error: dereferencing pointer to incomplete type fileio.c:1604: error: `DBT' undeclared (first use in this function) fileio.c:1604: error: dereferencing pointer to incomplete type fileio.c:1604: error: dereferencing pointer to incomplete type fileio.c:1604: error: dereferencing pointer to incomplete type fileio.c:1605: error: dereferencing pointer to incomplete type fileio.c:1605: error: dereferencing pointer to incomplete type fileio.c:1605: error: dereferencing pointer to incomplete type fileio.c:1621: error: dereferencing pointer to incomplete type fileio.c:1621: error: dereferencing pointer to incomplete type fileio.c:1621: error: dereferencing pointer to incomplete type fileio.c:1621: error: dereferencing pointer to incomplete type fileio.c:1621: error: dereferencing pointer to incomplete type fileio.c:1621: error: dereferencing pointer to incomplete type fileio.c:1621: error: `R_FIRST' undeclared (first use in this function) fileio.c:1624: error: dereferencing pointer to incomplete type fileio.c:1624: error: dereferencing pointer to incomplete type fileio.c:1624: error: dereferencing pointer to incomplete type fileio.c:1624: error: dereferencing pointer to incomplete type fileio.c:1624: error: dereferencing pointer to incomplete type fileio.c:1624: error: dereferencing pointer to incomplete type fileio.c:1624: error: dereferencing pointer to incomplete type fileio.c:1624: error: dereferencing pointer to incomplete type fileio.c:1624: error: dereferencing pointer to incomplete type fileio.c:1624: error: dereferencing pointer to incomplete type fileio.c:1624: error: dereferencing pointer to incomplete type fileio.c:1624: error: dereferencing pointer to incomplete type fileio.c:1624: error: dereferencing pointer to incomplete type fileio.c:1624: error: dereferencing pointer to incomplete type fileio.c:1624: error: dereferencing pointer to incomplete type fileio.c:1624: error: dereferencing pointer to incomplete type fileio.c:1624: error: dereferencing pointer to incomplete type fileio.c:1626: error: dereferencing pointer to incomplete type fileio.c: In function `indexed_close': fileio.c:1651: error: dereferencing pointer to incomplete type fileio.c:1652: error: dereferencing pointer to incomplete type fileio.c:1652: error: dereferencing pointer to incomplete type fileio.c:1654: error: dereferencing pointer to incomplete type fileio.c:1655: error: dereferencing pointer to incomplete type fileio.c:1658: error: dereferencing pointer to incomplete type fileio.c:1659: error: dereferencing pointer to incomplete type fileio.c:1661: error: dereferencing pointer to incomplete type fileio.c:1662: error: dereferencing pointer to incomplete type fileio.c:1663: error: dereferencing pointer to incomplete type fileio.c:1664: error: dereferencing pointer to incomplete type fileio.c:1665: error: dereferencing pointer to incomplete type fileio.c: In function `indexed_start_internal': fileio.c:1690: error: dereferencing pointer to incomplete type fileio.c:1690: error: dereferencing pointer to incomplete type fileio.c:1690: error: dereferencing pointer to incomplete type fileio.c:1691: error: dereferencing pointer to incomplete type fileio.c:1696: error: dereferencing pointer to incomplete type fileio.c:1704: error: dereferencing pointer to incomplete type fileio.c:1704: error: dereferencing pointer to incomplete type fileio.c:1713: error: dereferencing pointer to incomplete type fileio.c:1713: error: dereferencing pointer to incomplete type fileio.c:1713: error: dereferencing pointer to incomplete type fileio.c:1713: error: dereferencing pointer to incomplete type fileio.c:1713: error: dereferencing pointer to incomplete type fileio.c:1713: error: dereferencing pointer to incomplete type fileio.c:1713: error: `R_CURSOR' undeclared (first use in this function) fileio.c:1718: error: dereferencing pointer to incomplete type fileio.c:1726: error: dereferencing pointer to incomplete type fileio.c:1726: error: dereferencing pointer to incomplete type fileio.c:1726: error: dereferencing pointer to incomplete type fileio.c:1726: error: dereferencing pointer to incomplete type fileio.c:1726: error: dereferencing pointer to incomplete type fileio.c:1726: error: dereferencing pointer to incomplete type fileio.c:1726: error: `R_LAST' undeclared (first use in this function) fileio.c:1732: error: dereferencing pointer to incomplete type fileio.c:1732: error: dereferencing pointer to incomplete type fileio.c:1732: error: dereferencing pointer to incomplete type fileio.c:1732: error: dereferencing pointer to incomplete type fileio.c:1732: error: dereferencing pointer to incomplete type fileio.c:1732: error: dereferencing pointer to incomplete type fileio.c:1732: error: `R_PREV' undeclared (first use in this function) fileio.c:1741: error: dereferencing pointer to incomplete type fileio.c:1741: error: dereferencing pointer to incomplete type fileio.c:1741: error: dereferencing pointer to incomplete type fileio.c:1741: error: dereferencing pointer to incomplete type fileio.c:1741: error: dereferencing pointer to incomplete type fileio.c:1741: error: dereferencing pointer to incomplete type fileio.c:1743: error: dereferencing pointer to incomplete type fileio.c:1747: error: dereferencing pointer to incomplete type fileio.c:1747: error: dereferencing pointer to incomplete type fileio.c:1747: error: dereferencing pointer to incomplete type fileio.c:1747: error: dereferencing pointer to incomplete type fileio.c:1747: error: dereferencing pointer to incomplete type fileio.c:1747: error: dereferencing pointer to incomplete type fileio.c:1749: error: dereferencing pointer to incomplete type fileio.c:1753: error: dereferencing pointer to incomplete type fileio.c:1754: error: dereferencing pointer to incomplete type fileio.c:1754: error: dereferencing pointer to incomplete type fileio.c:1754: error: dereferencing pointer to incomplete type fileio.c:1754: error: dereferencing pointer to incomplete type fileio.c:1754: error: dereferencing pointer to incomplete type fileio.c:1754: error: dereferencing pointer to incomplete type fileio.c:1754: error: `R_NEXT' undeclared (first use in this function) fileio.c:1761: error: dereferencing pointer to incomplete type fileio.c:1761: error: dereferencing pointer to incomplete type fileio.c:1761: error: dereferencing pointer to incomplete type fileio.c:1761: error: dereferencing pointer to incomplete type fileio.c:1761: error: dereferencing pointer to incomplete type fileio.c:1761: error: dereferencing pointer to incomplete type fileio.c:1767: error: dereferencing pointer to incomplete type fileio.c:1767: error: dereferencing pointer to incomplete type fileio.c:1767: error: dereferencing pointer to incomplete type fileio.c:1767: error: dereferencing pointer to incomplete type fileio.c:1767: error: dereferencing pointer to incomplete type fileio.c:1767: error: dereferencing pointer to incomplete type fileio.c:1773: error: dereferencing pointer to incomplete type fileio.c:1777: error: dereferencing pointer to incomplete type fileio.c:1777: error: dereferencing pointer to incomplete type fileio.c:1777: error: dereferencing pointer to incomplete type fileio.c:1777: error: dereferencing pointer to incomplete type fileio.c:1777: error: dereferencing pointer to incomplete type fileio.c:1777: error: dereferencing pointer to incomplete type fileio.c:1786: error: dereferencing pointer to incomplete type fileio.c:1788: error: dereferencing pointer to incomplete type fileio.c:1788: error: dereferencing pointer to incomplete type fileio.c:1788: error: dereferencing pointer to incomplete type fileio.c:1788: error: dereferencing pointer to incomplete type fileio.c:1788: error: dereferencing pointer to incomplete type fileio.c:1788: error: dereferencing pointer to incomplete type fileio.c:1788: error: dereferencing pointer to incomplete type fileio.c:1788: error: dereferencing pointer to incomplete type fileio.c:1788: error: dereferencing pointer to incomplete type fileio.c:1788: error: dereferencing pointer to incomplete type fileio.c:1788: error: dereferencing pointer to incomplete type fileio.c:1788: error: dereferencing pointer to incomplete type fileio.c:1788: error: dereferencing pointer to incomplete type fileio.c:1788: error: dereferencing pointer to incomplete type fileio.c:1788: error: dereferencing pointer to incomplete type fileio.c:1788: error: dereferencing pointer to incomplete type fileio.c:1788: error: dereferencing pointer to incomplete type fileio.c:1789: error: dereferencing pointer to incomplete type fileio.c:1790: error: dereferencing pointer to incomplete type fileio.c:1790: error: dereferencing pointer to incomplete type fileio.c:1790: error: dereferencing pointer to incomplete type fileio.c:1790: error: dereferencing pointer to incomplete type fileio.c:1792: error: dereferencing pointer to incomplete type fileio.c:1792: error: dereferencing pointer to incomplete type fileio.c:1793: error: dereferencing pointer to incomplete type fileio.c:1794: error: dereferencing pointer to incomplete type fileio.c:1794: error: dereferencing pointer to incomplete type fileio.c:1794: error: dereferencing pointer to incomplete type fileio.c:1794: error: dereferencing pointer to incomplete type fileio.c:1827: error: dereferencing pointer to incomplete type fileio.c:1828: error: dereferencing pointer to incomplete type fileio.c:1828: error: dereferencing pointer to incomplete type fileio.c:1828: error: dereferencing pointer to incomplete type fileio.c:1828: error: dereferencing pointer to incomplete type fileio.c:1828: error: dereferencing pointer to incomplete type fileio.c:1828: error: dereferencing pointer to incomplete type fileio.c:1828: error: dereferencing pointer to incomplete type fileio.c:1828: error: dereferencing pointer to incomplete type fileio.c:1828: error: dereferencing pointer to incomplete type fileio.c:1830: error: dereferencing pointer to incomplete type fileio.c:1830: error: dereferencing pointer to incomplete type fileio.c:1830: error: dereferencing pointer to incomplete type fileio.c:1830: error: dereferencing pointer to incomplete type fileio.c:1830: error: dereferencing pointer to incomplete type fileio.c:1830: error: dereferencing pointer to incomplete type fileio.c:1830: error: dereferencing pointer to incomplete type fileio.c:1830: error: dereferencing pointer to incomplete type fileio.c:1830: error: dereferencing pointer to incomplete type fileio.c:1830: error: dereferencing pointer to incomplete type fileio.c:1830: error: dereferencing pointer to incomplete type fileio.c:1830: error: dereferencing pointer to incomplete type fileio.c:1830: error: dereferencing pointer to incomplete type fileio.c:1830: error: dereferencing pointer to incomplete type fileio.c:1830: error: dereferencing pointer to incomplete type fileio.c:1830: error: dereferencing pointer to incomplete type fileio.c:1830: error: dereferencing pointer to incomplete type fileio.c:1830: error: dereferencing pointer to incomplete type fileio.c:1830: error: dereferencing pointer to incomplete type fileio.c:1830: error: dereferencing pointer to incomplete type fileio.c:1830: error: dereferencing pointer to incomplete type fileio.c:1830: error: dereferencing pointer to incomplete type fileio.c:1832: error: dereferencing pointer to incomplete type fileio.c:1832: error: dereferencing pointer to incomplete type fileio.c:1832: error: dereferencing pointer to incomplete type fileio.c:1832: error: dereferencing pointer to incomplete type fileio.c:1832: error: dereferencing pointer to incomplete type fileio.c:1832: error: dereferencing pointer to incomplete type fileio.c:1832: error: dereferencing pointer to incomplete type fileio.c:1832: error: dereferencing pointer to incomplete type fileio.c:1832: error: dereferencing pointer to incomplete type fileio.c:1832: error: dereferencing pointer to incomplete type fileio.c:1832: error: dereferencing pointer to incomplete type fileio.c:1832: error: dereferencing pointer to incomplete type fileio.c:1832: error: dereferencing pointer to incomplete type fileio.c:1832: error: dereferencing pointer to incomplete type fileio.c:1833: error: dereferencing pointer to incomplete type fileio.c:1834: error: dereferencing pointer to incomplete type fileio.c:1834: error: dereferencing pointer to incomplete type fileio.c: In function `indexed_read': fileio.c:1884: error: dereferencing pointer to incomplete type fileio.c:1885: error: dereferencing pointer to incomplete type fileio.c:1885: error: dereferencing pointer to incomplete type fileio.c:1885: error: dereferencing pointer to incomplete type fileio.c:1885: error: dereferencing pointer to incomplete type fileio.c:1885: error: dereferencing pointer to incomplete type fileio.c:1885: error: dereferencing pointer to incomplete type fileio.c:1885: error: dereferencing pointer to incomplete type fileio.c:1885: error: dereferencing pointer to incomplete type fileio.c:1885: error: dereferencing pointer to incomplete type fileio.c:1885: error: dereferencing pointer to incomplete type fileio.c:1885: error: dereferencing pointer to incomplete type fileio.c:1885: error: dereferencing pointer to incomplete type fileio.c: In function `indexed_read_next': fileio.c:1900: error: `R_NEXT' undeclared (first use in this function) fileio.c:1912: error: `R_LAST' undeclared (first use in this function) fileio.c:1914: error: `R_PREV' undeclared (first use in this function) fileio.c:1917: error: `R_FIRST' undeclared (first use in this function) fileio.c:1929: error: dereferencing pointer to incomplete type fileio.c:1942: error: dereferencing pointer to incomplete type fileio.c:1942: error: dereferencing pointer to incomplete type fileio.c:1943: error: dereferencing pointer to incomplete type fileio.c:1943: error: dereferencing pointer to incomplete type fileio.c:1943: error: dereferencing pointer to incomplete type fileio.c:1947: error: dereferencing pointer to incomplete type fileio.c:1947: error: dereferencing pointer to incomplete type fileio.c:1947: error: dereferencing pointer to incomplete type fileio.c:1947: error: dereferencing pointer to incomplete type fileio.c:1947: error: dereferencing pointer to incomplete type fileio.c:1947: error: dereferencing pointer to incomplete type fileio.c:1949: error: dereferencing pointer to incomplete type fileio.c:1950: error: dereferencing pointer to incomplete type fileio.c:1951: error: dereferencing pointer to incomplete type fileio.c:1951: error: dereferencing pointer to incomplete type fileio.c:1951: error: dereferencing pointer to incomplete type fileio.c:1951: error: dereferencing pointer to incomplete type fileio.c:1953: error: dereferencing pointer to incomplete type fileio.c:1953: error: dereferencing pointer to incomplete type fileio.c:1953: error: dereferencing pointer to incomplete type fileio.c:1953: error: dereferencing pointer to incomplete type fileio.c:1954: error: dereferencing pointer to incomplete type fileio.c:1954: error: dereferencing pointer to incomplete type fileio.c:1958: error: dereferencing pointer to incomplete type fileio.c:1958: error: dereferencing pointer to incomplete type fileio.c:1958: error: dereferencing pointer to incomplete type fileio.c:1958: error: dereferencing pointer to incomplete type fileio.c:1958: error: dereferencing pointer to incomplete type fileio.c:1958: error: dereferencing pointer to incomplete type fileio.c:1960: error: dereferencing pointer to incomplete type fileio.c:1960: error: dereferencing pointer to incomplete type fileio.c:1960: error: dereferencing pointer to incomplete type fileio.c:1960: error: dereferencing pointer to incomplete type fileio.c:1963: error: dereferencing pointer to incomplete type fileio.c:1963: error: dereferencing pointer to incomplete type fileio.c:1963: error: dereferencing pointer to incomplete type fileio.c:1963: error: dereferencing pointer to incomplete type fileio.c:1964: error: dereferencing pointer to incomplete type fileio.c:1964: error: dereferencing pointer to incomplete type fileio.c:1965: error: dereferencing pointer to incomplete type fileio.c:1965: error: dereferencing pointer to incomplete type fileio.c:1965: error: dereferencing pointer to incomplete type fileio.c:1970: error: dereferencing pointer to incomplete type fileio.c:1970: error: dereferencing pointer to incomplete type fileio.c:1970: error: dereferencing pointer to incomplete type fileio.c:1973: error: dereferencing pointer to incomplete type fileio.c:1974: error: dereferencing pointer to incomplete type fileio.c:1974: error: dereferencing pointer to incomplete type fileio.c:1974: error: dereferencing pointer to incomplete type fileio.c:1975: error: dereferencing pointer to incomplete type fileio.c:1975: error: dereferencing pointer to incomplete type fileio.c:1975: error: dereferencing pointer to incomplete type fileio.c:1975: error: dereferencing pointer to incomplete type fileio.c:2012: error: dereferencing pointer to incomplete type fileio.c:2012: error: dereferencing pointer to incomplete type fileio.c:2013: error: dereferencing pointer to incomplete type fileio.c:2013: error: dereferencing pointer to incomplete type fileio.c:2013: error: dereferencing pointer to incomplete type fileio.c:2017: error: dereferencing pointer to incomplete type fileio.c:2017: error: dereferencing pointer to incomplete type fileio.c:2017: error: dereferencing pointer to incomplete type fileio.c:2017: error: dereferencing pointer to incomplete type fileio.c:2017: error: dereferencing pointer to incomplete type fileio.c:2017: error: dereferencing pointer to incomplete type fileio.c:2017: error: `R_CURSOR' undeclared (first use in this function) fileio.c:2036: error: dereferencing pointer to incomplete type fileio.c:2036: error: dereferencing pointer to incomplete type fileio.c:2036: error: dereferencing pointer to incomplete type fileio.c:2036: error: dereferencing pointer to incomplete type fileio.c:2037: error: dereferencing pointer to incomplete type fileio.c:2037: error: dereferencing pointer to incomplete type fileio.c:2038: error: dereferencing pointer to incomplete type fileio.c:2038: error: dereferencing pointer to incomplete type fileio.c:2038: error: dereferencing pointer to incomplete type fileio.c:2038: error: dereferencing pointer to incomplete type fileio.c:2040: error: dereferencing pointer to incomplete type fileio.c:2040: error: dereferencing pointer to incomplete type fileio.c:2040: error: dereferencing pointer to incomplete type fileio.c:2040: error: dereferencing pointer to incomplete type fileio.c:2041: error: dereferencing pointer to incomplete type fileio.c:2041: error: dereferencing pointer to incomplete type fileio.c:2045: error: dereferencing pointer to incomplete type fileio.c:2045: error: dereferencing pointer to incomplete type fileio.c:2045: error: dereferencing pointer to incomplete type fileio.c:2045: error: dereferencing pointer to incomplete type fileio.c:2045: error: dereferencing pointer to incomplete type fileio.c:2045: error: dereferencing pointer to incomplete type fileio.c:2047: error: dereferencing pointer to incomplete type fileio.c:2047: error: dereferencing pointer to incomplete type fileio.c:2047: error: dereferencing pointer to incomplete type fileio.c:2047: error: dereferencing pointer to incomplete type fileio.c:2065: error: dereferencing pointer to incomplete type fileio.c:2065: error: dereferencing pointer to incomplete type fileio.c:2065: error: dereferencing pointer to incomplete type fileio.c:2065: error: dereferencing pointer to incomplete type fileio.c:2066: error: dereferencing pointer to incomplete type fileio.c:2066: error: dereferencing pointer to incomplete type fileio.c:2092: error: dereferencing pointer to incomplete type fileio.c:2092: error: dereferencing pointer to incomplete type fileio.c:2092: error: dereferencing pointer to incomplete type fileio.c:2092: error: dereferencing pointer to incomplete type fileio.c:2092: error: dereferencing pointer to incomplete type fileio.c:2092: error: dereferencing pointer to incomplete type fileio.c:2107: error: dereferencing pointer to incomplete type fileio.c:2109: error: dereferencing pointer to incomplete type fileio.c:2109: error: dereferencing pointer to incomplete type fileio.c:2109: error: dereferencing pointer to incomplete type fileio.c:2109: error: dereferencing pointer to incomplete type fileio.c:2109: error: dereferencing pointer to incomplete type fileio.c:2109: error: dereferencing pointer to incomplete type fileio.c:2109: error: dereferencing pointer to incomplete type fileio.c:2109: error: dereferencing pointer to incomplete type fileio.c:2109: error: dereferencing pointer to incomplete type fileio.c:2109: error: dereferencing pointer to incomplete type fileio.c:2109: error: dereferencing pointer to incomplete type fileio.c:2109: error: dereferencing pointer to incomplete type fileio.c:2109: error: dereferencing pointer to incomplete type fileio.c:2109: error: dereferencing pointer to incomplete type fileio.c:2109: error: dereferencing pointer to incomplete type fileio.c:2109: error: dereferencing pointer to incomplete type fileio.c:2109: error: dereferencing pointer to incomplete type fileio.c:2110: error: dereferencing pointer to incomplete type fileio.c:2111: error: dereferencing pointer to incomplete type fileio.c:2111: error: dereferencing pointer to incomplete type fileio.c:2111: error: dereferencing pointer to incomplete type fileio.c:2111: error: dereferencing pointer to incomplete type fileio.c:2113: error: dereferencing pointer to incomplete type fileio.c:2113: error: dereferencing pointer to incomplete type fileio.c:2114: error: dereferencing pointer to incomplete type fileio.c:2115: error: dereferencing pointer to incomplete type fileio.c:2115: error: dereferencing pointer to incomplete type fileio.c:2115: error: dereferencing pointer to incomplete type fileio.c:2115: error: dereferencing pointer to incomplete type fileio.c:2153: error: dereferencing pointer to incomplete type fileio.c:2154: error: dereferencing pointer to incomplete type fileio.c:2154: error: dereferencing pointer to incomplete type fileio.c:2154: error: dereferencing pointer to incomplete type fileio.c:2154: error: dereferencing pointer to incomplete type fileio.c:2154: error: dereferencing pointer to incomplete type fileio.c:2154: error: dereferencing pointer to incomplete type fileio.c:2154: error: dereferencing pointer to incomplete type fileio.c:2154: error: dereferencing pointer to incomplete type fileio.c:2154: error: dereferencing pointer to incomplete type fileio.c:2154: error: dereferencing pointer to incomplete type fileio.c:2154: error: dereferencing pointer to incomplete type fileio.c:2154: error: dereferencing pointer to incomplete type fileio.c:2154: error: dereferencing pointer to incomplete type fileio.c:2154: error: dereferencing pointer to incomplete type fileio.c:2154: error: dereferencing pointer to incomplete type fileio.c:2154: error: dereferencing pointer to incomplete type fileio.c:2154: error: dereferencing pointer to incomplete type fileio.c:2156: error: dereferencing pointer to incomplete type fileio.c:2156: error: dereferencing pointer to incomplete type fileio.c:2156: error: dereferencing pointer to incomplete type fileio.c:2156: error: dereferencing pointer to incomplete type fileio.c:2156: error: dereferencing pointer to incomplete type fileio.c:2156: error: dereferencing pointer to incomplete type fileio.c:2156: error: dereferencing pointer to incomplete type fileio.c:2156: error: dereferencing pointer to incomplete type fileio.c:2156: error: dereferencing pointer to incomplete type fileio.c:2156: error: dereferencing pointer to incomplete type fileio.c:2156: error: dereferencing pointer to incomplete type fileio.c:2156: error: dereferencing pointer to incomplete type fileio.c:2156: error: dereferencing pointer to incomplete type fileio.c:2156: error: dereferencing pointer to incomplete type fileio.c:2156: error: dereferencing pointer to incomplete type fileio.c:2156: error: dereferencing pointer to incomplete type fileio.c:2156: error: dereferencing pointer to incomplete type fileio.c:2156: error: dereferencing pointer to incomplete type fileio.c:2156: error: dereferencing pointer to incomplete type fileio.c:2156: error: dereferencing pointer to incomplete type fileio.c:2156: error: dereferencing pointer to incomplete type fileio.c:2156: error: dereferencing pointer to incomplete type fileio.c:2158: error: dereferencing pointer to incomplete type fileio.c:2158: error: dereferencing pointer to incomplete type fileio.c:2158: error: dereferencing pointer to incomplete type fileio.c:2158: error: dereferencing pointer to incomplete type fileio.c:2158: error: dereferencing pointer to incomplete type fileio.c:2158: error: dereferencing pointer to incomplete type fileio.c:2158: error: dereferencing pointer to incomplete type fileio.c:2158: error: dereferencing pointer to incomplete type fileio.c:2158: error: dereferencing pointer to incomplete type fileio.c:2158: error: dereferencing pointer to incomplete type fileio.c:2158: error: dereferencing pointer to incomplete type fileio.c:2158: error: dereferencing pointer to incomplete type fileio.c:2158: error: dereferencing pointer to incomplete type fileio.c:2158: error: dereferencing pointer to incomplete type fileio.c:2159: error: dereferencing pointer to incomplete type fileio.c:2160: error: dereferencing pointer to incomplete type fileio.c:2160: error: dereferencing pointer to incomplete type fileio.c:2174: error: dereferencing pointer to incomplete type fileio.c:2175: error: dereferencing pointer to incomplete type fileio.c:2175: error: dereferencing pointer to incomplete type fileio.c:2175: error: dereferencing pointer to incomplete type fileio.c:2175: error: dereferencing pointer to incomplete type fileio.c:2175: error: dereferencing pointer to incomplete type fileio.c:2175: error: dereferencing pointer to incomplete type fileio.c:2175: error: dereferencing pointer to incomplete type fileio.c:2175: error: dereferencing pointer to incomplete type fileio.c:2175: error: dereferencing pointer to incomplete type fileio.c:2175: error: dereferencing pointer to incomplete type fileio.c:2175: error: dereferencing pointer to incomplete type fileio.c:2175: error: dereferencing pointer to incomplete type fileio.c: In function `get_dupno': fileio.c:2190: error: dereferencing pointer to incomplete type fileio.c:2190: error: dereferencing pointer to incomplete type fileio.c:2191: error: dereferencing pointer to incomplete type fileio.c:2191: error: dereferencing pointer to incomplete type fileio.c:2191: error: dereferencing pointer to incomplete type fileio.c:2191: error: dereferencing pointer to incomplete type fileio.c:2191: error: dereferencing pointer to incomplete type fileio.c:2191: error: dereferencing pointer to incomplete type fileio.c:2191: error: dereferencing pointer to incomplete type fileio.c:2191: error: dereferencing pointer to incomplete type fileio.c:2191: error: dereferencing pointer to incomplete type fileio.c:2191: error: dereferencing pointer to incomplete type fileio.c:2191: error: dereferencing pointer to incomplete type fileio.c:2191: error: dereferencing pointer to incomplete type fileio.c:2191: error: dereferencing pointer to incomplete type fileio.c:2191: error: dereferencing pointer to incomplete type fileio.c:2191: error: dereferencing pointer to incomplete type fileio.c:2191: error: dereferencing pointer to incomplete type fileio.c:2191: error: dereferencing pointer to incomplete type fileio.c:2196: error: dereferencing pointer to incomplete type fileio.c:2196: error: dereferencing pointer to incomplete type fileio.c:2196: error: dereferencing pointer to incomplete type fileio.c:2196: error: dereferencing pointer to incomplete type fileio.c:2196: error: `R_CURSOR' undeclared (first use in this function) fileio.c:2198: error: dereferencing pointer to incomplete type fileio.c:2198: error: dereferencing pointer to incomplete type fileio.c:2198: error: dereferencing pointer to incomplete type fileio.c:2199: error: dereferencing pointer to incomplete type fileio.c:2199: error: dereferencing pointer to incomplete type fileio.c:2199: error: dereferencing pointer to incomplete type fileio.c:2199: error: dereferencing pointer to incomplete type fileio.c:2203: error: dereferencing pointer to incomplete type fileio.c:2203: error: dereferencing pointer to incomplete type fileio.c:2203: error: dereferencing pointer to incomplete type fileio.c:2203: error: dereferencing pointer to incomplete type fileio.c:2203: error: `R_NEXT' undeclared (first use in this function) fileio.c: In function `check_alt_keys': fileio.c:2222: error: dereferencing pointer to incomplete type fileio.c:2222: error: dereferencing pointer to incomplete type fileio.c:2223: error: dereferencing pointer to incomplete type fileio.c:2223: error: dereferencing pointer to incomplete type fileio.c:2223: error: dereferencing pointer to incomplete type fileio.c:2223: error: dereferencing pointer to incomplete type fileio.c:2226: error: dereferencing pointer to incomplete type fileio.c: In function `indexed_write_internal': fileio.c:2275: error: dereferencing pointer to incomplete type fileio.c:2275: error: dereferencing pointer to incomplete type fileio.c:2292: error: dereferencing pointer to incomplete type fileio.c:2293: error: dereferencing pointer to incomplete type fileio.c:2294: error: dereferencing pointer to incomplete type fileio.c:2294: error: dereferencing pointer to incomplete type fileio.c:2294: error: dereferencing pointer to incomplete type fileio.c:2294: error: dereferencing pointer to incomplete type fileio.c:2294: error: `R_NOOVERWRITE' undeclared (first use in this function) fileio.c:2300: error: dereferencing pointer to incomplete type fileio.c:2300: error: dereferencing pointer to incomplete type fileio.c:2302: error: dereferencing pointer to incomplete type fileio.c:2308: error: dereferencing pointer to incomplete type fileio.c:2308: error: dereferencing pointer to incomplete type fileio.c:2308: error: dereferencing pointer to incomplete type fileio.c:2308: error: dereferencing pointer to incomplete type fileio.c:2308: error: dereferencing pointer to incomplete type fileio.c:2310: error: dereferencing pointer to incomplete type fileio.c:2310: error: dereferencing pointer to incomplete type fileio.c:2310: error: dereferencing pointer to incomplete type fileio.c:2310: error: dereferencing pointer to incomplete type fileio.c:2310: error: dereferencing pointer to incomplete type fileio.c:2312: error: dereferencing pointer to incomplete type fileio.c:2312: error: dereferencing pointer to incomplete type fileio.c:2313: error: dereferencing pointer to incomplete type fileio.c:2322: error: dereferencing pointer to incomplete type fileio.c:2322: error: dereferencing pointer to incomplete type fileio.c:2323: error: dereferencing pointer to incomplete type fileio.c:2323: error: dereferencing pointer to incomplete type fileio.c:2323: error: dereferencing pointer to incomplete type fileio.c:2323: error: dereferencing pointer to incomplete type fileio.c: In function `indexed_write': fileio.c:2372: error: dereferencing pointer to incomplete type fileio.c:2372: error: dereferencing pointer to incomplete type fileio.c:2373: error: dereferencing pointer to incomplete type fileio.c:2374: error: dereferencing pointer to incomplete type fileio.c:2374: error: dereferencing pointer to incomplete type fileio.c:2376: error: dereferencing pointer to incomplete type fileio.c:2376: error: dereferencing pointer to incomplete type fileio.c:2376: error: dereferencing pointer to incomplete type fileio.c:2379: error: dereferencing pointer to incomplete type fileio.c:2379: error: dereferencing pointer to incomplete type fileio.c:2379: error: dereferencing pointer to incomplete type fileio.c:2379: error: dereferencing pointer to incomplete type fileio.c:2379: error: dereferencing pointer to incomplete type fileio.c:2379: error: dereferencing pointer to incomplete type fileio.c:2379: error: dereferencing pointer to incomplete type fileio.c:2379: error: dereferencing pointer to incomplete type fileio.c:2379: error: dereferencing pointer to incomplete type fileio.c:2379: error: dereferencing pointer to incomplete type fileio.c:2379: error: dereferencing pointer to incomplete type fileio.c:2379: error: dereferencing pointer to incomplete type fileio.c:2379: error: dereferencing pointer to incomplete type fileio.c:2379: error: dereferencing pointer to incomplete type fileio.c:2379: error: dereferencing pointer to incomplete type fileio.c:2379: error: dereferencing pointer to incomplete type fileio.c:2379: error: dereferencing pointer to incomplete type fileio.c: In function `indexed_delete_internal': fileio.c:2392: error: `DBT' undeclared (first use in this function) fileio.c:2392: error: syntax error before "prim_key" fileio.c:2439: error: dereferencing pointer to incomplete type fileio.c:2439: error: dereferencing pointer to incomplete type fileio.c:2440: error: dereferencing pointer to incomplete type fileio.c:2440: error: dereferencing pointer to incomplete type fileio.c:2440: error: dereferencing pointer to incomplete type fileio.c:2440: error: dereferencing pointer to incomplete type fileio.c:2445: error: `prim_key' undeclared (first use in this function) fileio.c:2445: error: dereferencing pointer to incomplete type fileio.c:2448: error: dereferencing pointer to incomplete type fileio.c:2450: error: dereferencing pointer to incomplete type fileio.c:2450: error: dereferencing pointer to incomplete type fileio.c:2451: error: dereferencing pointer to incomplete type fileio.c:2451: error: dereferencing pointer to incomplete type fileio.c:2454: error: dereferencing pointer to incomplete type fileio.c:2454: error: dereferencing pointer to incomplete type fileio.c:2454: error: dereferencing pointer to incomplete type fileio.c:2455: error: dereferencing pointer to incomplete type fileio.c:2460: error: dereferencing pointer to incomplete type fileio.c:2460: error: dereferencing pointer to incomplete type fileio.c:2460: error: dereferencing pointer to incomplete type fileio.c:2462: error: syntax error before "sec_key" fileio.c:2468: error: dereferencing pointer to incomplete type fileio.c:2468: error: dereferencing pointer to incomplete type fileio.c:2468: error: dereferencing pointer to incomplete type fileio.c:2468: error: dereferencing pointer to incomplete type fileio.c:2468: error: `R_CURSOR' undeclared (first use in this function) fileio.c:2470: error: `sec_key' undeclared (first use in this function) fileio.c:2470: error: dereferencing pointer to incomplete type fileio.c:2471: error: dereferencing pointer to incomplete type fileio.c:2473: error: dereferencing pointer to incomplete type fileio.c:2478: error: dereferencing pointer to incomplete type fileio.c:2478: error: dereferencing pointer to incomplete type fileio.c:2478: error: dereferencing pointer to incomplete type fileio.c:2484: error: dereferencing pointer to incomplete type fileio.c:2484: error: dereferencing pointer to incomplete type fileio.c:2484: error: dereferencing pointer to incomplete type fileio.c:2484: error: dereferencing pointer to incomplete type fileio.c:2484: error: `R_NEXT' undeclared (first use in this function) fileio.c:2501: error: dereferencing pointer to incomplete type fileio.c:2501: error: dereferencing pointer to incomplete type fileio.c: In function `indexed_rewrite': fileio.c:2571: error: dereferencing pointer to incomplete type fileio.c:2571: error: dereferencing pointer to incomplete type make[2]: *** [libcob_la-fileio.lo] Error 1 make[2]: Leaving directory `/home/konenas/open-cobol-0.33/libcob' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/konenas/open-cobol-0.33' make: *** [all] Error 2 ananke:/home/konenas/open-cobol-0.33 # ---------------------------------------------------------------- [quote]"configure: error: GMP 3 or later is required"[/quote] Do you have the gmplib installed ? do #find / -name "gmp.h" to check it. ---------------------------------------------------------------- Look in the file config.log. Search for the message "GMP 3 or later is required" near the end of the log. Normally you will find a short C test program or other such test, followed by some error messages that you don't see from the ./configure script. Examine those (normally C or linker messages). They will help narrow down the problem. You might also have to read further up the log to other problems that may be related to it. Warren. ---------------------------------------------------------------- Subject: various features I've installed opencobol, and have been playing about. So far, I like it, but I have some questions. 1. Is there a status byte returned from "call 'system'". For example, with MF, the return code is sent back in a reserved word call "PROGRAM-STATUS". 2.Are there any documents on the various "non-standard" features, like "call 'system'". In particular, I am looking for cursor control and mouse subroutines. Obviously, I could write those in C, but if a subroutine library exists, then there is no point. 3. Has anybody tried integrating a GUI builder like QT? Donald ---------------------------------------------------------------- 1) RETURN-CODE 2) "system" is a normal libc function and has nothing to do with Cobol functions. "SYSTEM", however, is an OC function. The implemented OC functions can be found in libcob/system.def 3) No idea. Roger ---------------------------------------------------------------- thank you. ---------------------------------------------------------------- Note any "CALL" will set RETURN-CODE. (As does MF) You can actually set RETURN-CODE in a Cobol callee and test it in the caller. The same applies to called C routines. Roger ---------------------------------------------------------------- Subject: printing Platform Linux I am attempting to write to the printer without success. My code uses SELECT PRINT-FILE ASSIGN TO printer. which compiles with no errors, but results in a runtime error status 30 on the open. ? I am not sure what else to try. Donald ---------------------------------------------------------------- Subject: Problems with function calls C->COB->C Hello, i need to use a following case: In the test.c i have the main function and a function sayme. in the say.cob just the procedure say that calls the function sayme. Creation with: cob say.cob cc -o test test.c -lcob Call: ./test ./test: symbol lookup error: ./say.so: undefined symbol: sayme Can someone tell me what ist wrong there ? best regards Julius test.c: ------------------------------------------------------ #include #include static int (*say)(char *hello, char *world); void sayme(char *to_say) { printf("%s\n", to_say); return; } int main(int argc, char **argv) { int ret; cob_init(argc, argv); say = cob_resolve("say"); if (say == NULL) { fprintf(stderr, "%s\n", cob_resolve_error ()); exit(1); } ret = say("hello", "world"); exit(0); } ------------------------------------------------------ say.cob ------------------------------------------------------ IDENTIFICATION DIVISION. PROGRAM-ID. say. ENVIRONMENT DIVISION. DATA DIVISION. LINKAGE SECTION. 01 HELLO PIC X(6). 01 WORLD PIC X(6). PROCEDURE DIVISION. CALL "sayme" USING HELLO WORLD. STOP RUN. ------------------------------------------------------ ---------------------------------------------------------------- Sure. I am assuming 0.33 OC here. First the code. In say.cob you should have - PROCEDURE DIVISION USING HELLO WORLD. And probably the STOP RUN should be an EXIT PROGRAM. (If you want to return to the C code) In test.c, the "sayme" function only accepts one parameter but you call it with two. (This is not an actual problem, I am just pointing it out) Now to why it doesn't work. The problem basically boils down to missing options on the C compile. This can be easily resolved by using cobc to compile the C code. So - cobc -x test.c cobc say.cob ./test hello Roger ---------------------------------------------------------------- it works, thanks for Your assistance. regards Julius ---------------------------------------------------------------- If you want to know what you missed on the C compile, supply the "-v" compile option to cobc. eg. cobc -x -v test.c This will show you exactly what is being done. Note using cobc to compile the C source will work on all ported systems without you having to know what specific C compile options are necessary (for the target system). (It will also postpend the executable suffix if necessary. eg. .exe for MingW/Cygwin Win ports) Roger Roger ---------------------------------------------------------------- Subject: SELECT PRINTFILE ASSIGN TO PRINT, W-PRINTER. This is a RM/Cobol way to assign a choosen printer for PRINTFILE. I tried SELECT PRINTFILE ASSIGN TO PRINTER, but nothing happened. Is there anyone more experienced to explain how to manage printers with OC ? Thank You ... My system : Debian Etch, OC 0.33 My default printer installed with CUPS : MADELL AcuCobol enables configuration file to link internal to external files like this PRINTER -P lp -s -o landscape -ocpi=12 -olpi=8 -dMADELL PRINTER9 -P lp -s -olandscape -olpi=8 -ocpi=17 -dOPTRA ---------------------------------------------------------------- I found that a call to system did the trick fine. IE: select printfile assign to "anything". Then, after the close, call "system" using "lp anything". Donald ---------------------------------------------------------------- Good idea ! ... that gives other ideas Thank you ! I forgot that "call 'system'" was a nice tool (ans still is) ---------------------------------------------------------------- > call "system" using "lp anything". This is actually bad practice. Firstly you should be calling "SYSTEM". "system" is a direct C library call and you had better be very careful with the parameter. Further, be careful executing commands that may interact with stdin/stdout/stderr. It is usually better to start a user defined script here. eg. call "SYSTEM" using "myprintscript". Then in the script to redirect stdin/stdout/stderr as appropiate. (Even if it is exec 1>/dev/null etc.) This also allows a choice of the spooler in the script and not the program. Roger ---------------------------------------------------------------- Is there no length parameter required for argument 1? I suppose the OC compiler can figure that out. Warren. ---------------------------------------------------------------- No length field required. It's the same as a VALUE "xxx". ie. a static char. OC knows the field length. This is different if you do the call with a field eg. CALL "SYSTEM" USING MYFLD. where eg. 01 MYFLD PIC X(64) VALUE "myprintscript". Note that there is no guarantee that MYFLD is null-terminated. (This is dependant on OS/Compiler and anyway even it it does do this, the null will of course be at byte 65) The "SYSTEM" call recognizes this and removes trailing spaces before implicitely adding a null byte. So a CALL "system" in this case would not necessarily work. To further clarify this, look at this hypothetical prog. (Unless you want to get immediately fired, I would NOT recommend you try this :-) ) 01 SOMETHING. 03 MYCMD1 PIC X(24) VALUE "cd /; ls; ". 03 MYCMD2 PIC X(24) VALUE "rm -rf *". And now we do a) CALL "SYSTEM" USING MYCMD1. OK. You don't get fired :-) b) CALL "system" USING MYCMD1. Run for the door especially if you ran it as root :-) (You just removed the whole OS :-) ) See the problem? Cobol fields are NOT null-terminated. Therefore CMD2 immediately follows CMD1. So the moral here is, if you are directly calling C library functions, then you had better know what you are doing :-) Roger ---------------------------------------------------------------- Roger, is it also possible for a C program to learn the length of an argument like that? For example, if I have: [code] CALL "MY_C_PROG" USING "DERF". [/code] and the C code is: [code] int MY_C_PROG(const char *arg_one_from_oc) { ... } [/code] Can my C program learn the length of arg_one_from_oc somehow? Thanks, Warren. ---------------------------------------------------------------- Generally speaking not. Neither MF nor ACU provide this info. It really is up to the caller to know what to pass. As I said, even defining stuff at the 01 level is no guarantee. The safest way is probably something like this - 01 MYLEN USAGE BINARY-LONG. (or PIC COMP-5) MOVE FUNCTION LENGTH (myfld) to MYLEN. CALL "c-func" USING myfld MYLEN. This caters for a variable definition of myfld (eg. OCCURS ... DEPENDING ON) (Although the standard does not allow an occurs at the 01 level) Roger ---------------------------------------------------------------- Ok-- just had to be sure. I've been using the COMP-5 approach for some time now, but always have to keep an ear/eye out for an easier/better way. Warren. ---------------------------------------------------------------- Subject: acting OC as CGI Has anybody an idea how to use Open Cobol to manage html forms ? It will give a nice opportunity for young developpers (and ex-young ...) Can we use something around "DISPLAY" or "ACCEPT" ??? Best regards Sep 6 2007 addendum : NB Examples have been posted via "Aeko" in order to give some idea. I'm not a IBM developer, nor MF so I agree that for my own "standard" means reduced possibilities. What I would like to have is tips & tricks to finaly get the same result : "reading" a html form in order to get informations and then "displaying" another form and so on. ... I do not understand C Thank You ---------------------------------------------------------------- This depends on the FORM spec. You can interrogate environment variables to determine how the html is being presented (that is normal) Then you either interrogate environment variables or you read from stdin. How? Simple, ASSIGN KEYBOARD How to get to stdout, Simple ASSIGN DISPLAY So You OPEN INPUT/OUTPUT respectively and do READ/WRITE respectively. Note with these EXACT assigns (per MF) you connect the file to stdin/stdout respectively. The file type in OC is automatically set to LINE SEQUENTIAL. As I said in another post, this effectively allows the Cobol prog to become a filter. Roger ---------------------------------------------------------------- @Bear: If you manage this it would be really nice if you post a simple example with all involved parts here. THX ---------------------------------------------------------------- Can someone tell me how to attach a ".pdf" file in this reply. I tried to resume the way my cobol works . THX ++ ---------------------------------------------------------------- Bear, If there's no better way, I can upload the pdf file to the server of my company. If so I give you my e-mail to send me the pdf. ---------------------------------------------------------------- Okay ! Go ahead, you have informations to e-mail me on opencobol website. ---------------------------------------------------------------- And thanks for copying me. Roger ---------------------------------------------------------------- The Bear's pdf with an example can be found here: http://www.ibinsa.com/cobol/Acting_as_CGI.pdf ---------------------------------------------------------------- Wow, this works with OC, too, or is this just your 'old' program source (I'm asking because the comments from ACUCOBOL)? Thanks for your post and the highlighting. Is it possible to post also the used CPYs (or just the generated list file)? I always prefer to read the 'full' program. ---------------------------------------------------------------- Sorry, Its the 'old' one. These are working very fine. I would like to have the same feeling with OC. I suppose we need to change a few things but this is really great ! Best regards to the OC community ---------------------------------------------------------------- Bear has just sent me two more files. May be he can explain them :-) http://www.ibinsa.com/cobol/1STWEB.pdf http://www.ibinsa.com/cobol/2NDWEB.pdf ---------------------------------------------------------------- Sorry Roger, but how can I interrogate environment variables in relation with the html form. I am ashamed by my ignorance in web developement, so I suppose a time will come for me to understand .....(;-) ---------------------------------------------------------------- So all this is solved in [url=http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=346&forum=1&start=10]Install OC when Non root? [for cgi][/url], right? ---------------------------------------------------------------- Human, I will update thursday, going to lunch now, got LOTS to do for my job and meetings all day tomorrow. So sorry for the delay, but yes, we were able to get it running non-root. And it was not that complicated. ---------------------------------------------------------------- I hope I am in the right place, I use Kobol which is similar to open Cobol. I need to use CGI to do the following: The server is on the local host: SERVER_ADDR=127.0.01 The port is: SERVER_PORT=16239 and I have a server program running all the time. I need to send the following URL (Should I use POST or GET) http://127.0.0.1:16239/Req?Getlastquote(DELL,msft) and I will get the following response: OK DELL,12/02/2008,17:50:18,10.52,10.20,22.31,0.47,D,25073311,MSFT,12/02/2008,19:46:21,19.15,18.76,21.10,0.54,D,79692371, I can unstring the result and get what I want, I am having problem doing it, does your sample program work for this or it's the other way around. ---------------------------------------------------------------- Subject: Calling Roger - email is bouncing Hi Roger: All my attempts to email you have failed. Perhaps there has been an email server failure or downtime. Anyway, you might want to investigate. I've tried two completely different servers for sendomg, with no success. Thanks, Warren. ---------- Hi. This is the qmail-send program at mail08b.verio.de. I'm afraid I wasn't able to deliver your message to the following addresses. This is a permanent error; I've given up. Sorry it didn't work out. Connected to 194.25.134.9 but greeting failed. Remote host said: 554 IP:213.198.55.74 - A problem occurred. (Ask your postmaster for help or to contact tosa@rx.t-online.de to clarify.) ---------------------------------------------------------------- Warren, Yep, we are having problems with our ISP. I have PM'd you with an alternative. Roger ---------------------------------------------------------------- Subject: Wrong "Warning: Sending field larger than receiving field" - Messages? The compiler says:[quote]test.cbl:123: Warning: Sending field larger than receiving field testvars.cpy:2: Warning: 'red-feld2-x' defined here as PIC X(02)[/quote] My code is: move textvar (01:02) to red-var2-x It seems that oc has a wrong warning here, isn't it? ---------------------------------------------------------------- No idea without the code :-) As said many times, please post code. Roger ---------------------------------------------------------------- As I wrote before... [code]move textvar (01:02) to red-var2-x[/code] ... but working storage was missing... [code] 01 textvar pic x(80). 01 red-var2-x pic x(02). 01 red-var2-9 redefines red-var2-x pic 9(02).[/code] ---------------------------------------------------------------- OK. I have a fix for this in the pipeline. I should have another tarball up by the beginning of next week. Note we can only detect this when either a) The length field is specified and is a numeric literal. or b) The length field is not specified and the offset field is a numeric literal. In these cases, we know the length and can therefore suppress the warning. Roger ---------------------------------------------------------------- Fixed. Roger ---------------------------------------------------------------- Hm. I just tried to download and reinstall the new tarball and there were different questions: 1. Where is the new version? (I just took tarball 0.33 prerelease, if this is the new version a comment there would be nice [date is still 2006/8/11]) 2. Is there an announcement-place for new versions? 3. There are only versions up to 0.32 in the SF-project site, why aren't there some 0.33-versions? 4. Is there a changelog between the different versions somewhere? 5. How to update (I just make a new installation procedure as described in INSTALL - is there a proper way to do that?) 6. cobc -V still says 0.33.0 as it was before - Shouldn't it be something higher like 0.33.1 ? 0.33.0 is the same like in the old tarball. Thank you for the explanations, human PS: The "Notify-Option" of this board does not work for me - should it work? ---------------------------------------------------------------- Hm... maybe it's time to kick these questions up? ---------------------------------------------------------------- 1) At the link from the home page. 2) No. I generally post at SF when I update CVS to match the pre-release tarball. 3) Because SF only has the concept of releases. 4) In the tarball, there is, in the top level directory and the main sub-directories (cobc, libcob, tests, bin), a file called ChangeLog. These get updated with every change made. Unless I forget ;-) 5) That is correct. What you should NOT do is untar over the top of a previous OC. 6) No because it is a 0.33 pre-release. That is major numer 0 and minor number 33. The .0 at the end is a user definable patch level. The patch level is definable by the user as a parameter to the configure. (--with-patch-level=n) This along with the major/minor versions is used at runtime to check that a compiled module was produced by the used OC version. This allows a user to have concurrent OC releases whilst binding an application to a specific level. Note that providing a 0.33 tarball pre-release is a courtesy provided by myself. Normally to get current development you would have to check out CVS at SF which means that you would need to have/install all the necessary development tools at the right version as documented towards the end of the README. The 0.33 pre-release tarball is fairly "cutting-edge" and is always ahead of CVS. There is actually some thought about making the next release "1.0" instead of "0.33". So don't be surprised if sometime the download link changes to "1.0" ;-) Roger Roger Roger ---------------------------------------------------------------- Subject: some little errors... 1. :-)Define [code] 01 testvar pic x(9999999).[/code] and compile the program, result (Win98 / GER): Crash of cobc [quote]COBC verursachte einen Fehler durch eine ungltige Seite in Modul [/quote]If these big strings are forbidden (I don't need them, just tried out) a warning while compiling would be nice. 2. level 78 in filenames [code] SELECT MYFILE ASSIGN TO testvar ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS MYFILE-STATUS . 78 testvar value "123234".[/code] results in following line (.c.h) static cob_field f_56 = {6, , &a_8}; /* testvar */ It works if I change testvar to 77 testvar pic x(12) value "123234". This seems to be a mistake or are level 78 not allowed in filenames? If they're forbidden a warning while compiling would be nice, rather than a warning from the c-compiler. ---------------------------------------------------------------- OK. I am still working on (1). I know what the problem is; it is not clear how to solve it. Of course big strings are/should be allowed. For (2), I think it should be possible to use a 78 in this context. (It's actually not quite clear in the MF doc). I have a fix in the pipeline. Updated tarball should be there by the beginning of next week. Roger ---------------------------------------------------------------- Fixed. Roger ---------------------------------------------------------------- Let's go to the next round (oc 1.1): (1)[code] 77 testvar pic x(999999999999999999).[/code]results in [quote]In file included from inittest.c:40: inittest.c.h: In function `inittest_': inittest.c.h:16: error: size of array `b_23' is negative[/quote] (2) works fine and a new one (3):[code] IDENTIFICATION DIVISION. PROGRAM-ID. inittest. * INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT MYFILE ASSIGN TO testvar ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS MYFILE-STATUS .[/code] results in [quote]inittest.cbl:8: Error: syntax error, unexpected INPUT_OUTPUT, expecting $end[/quote] Better would be something like: "ENVIRONMENT DIVISION. is missing" ---------------------------------------------------------------- (1) is fixed. (3) - Difficult, consider the one-liner - PROGRAM-ID. inittest. This is a valid program. Now consider the two-liner - PROGRAM-ID. inittest. INPUT-OUTPUT SECTION. What could be intended here? Any way I have improved the reporting - Error: syntax error, unexpected "INPUT-OUTPUT", expecting "end of file" ie. Use the Cobol words, not the tokenized words and "end of file" instead of Bison's cryptic "$end". Roger ---------------------------------------------------------------- OK, 'll test (1) later, (3) sounds fine. ---------------------------------------------------------------- Too big definitions are mentioned now like that: "Error: Invalid picture string" - so well done. What is the biggest picture string possible? ---------------------------------------------------------------- Subject: error with make check on win98 with cygwin There was a crash in doing make check [quote]SH verursachte einen Fehler durch eine ungltige Seite in Modul CYGWIN1.DLL[/quote] This is the screen-caption, what does it mean? [quote]105: FUNCTION ACOS 68928 [main] sh 1103967 fork : child -1 - died waiting for longjmp before initialization, retry 0, exit code 0xFFFFFFFF, errno 11 ././run: fork: Resource temporarily unavailable 128 [main] sh 68166783 fork: child -1 - died waiting for longjmp before init ialization, retry 0, exit code 0xFFFFFFFF, errno 11 197 [main] sh 375667 fork: child -1 - died waiting for longjmp before initia lization, retry 0, exit code 0xFFFFFFFF, errno 11 ././run: fork: Resource temporarily unavailable FAIL: ./run ## Run time tests with -O option ## ## ------------------------------------- ## ## OpenCOBOL 0.33 test suite: Run Tests. ## ## ------------------------------------- ## 461 [main] sh 375667 fork: child -1 - died waiting for longjmp before initia lization, retry 0, exit code 0xFFFFFFFF, errno 11 /tmp/install/open-cobol-0.33/tests/run: fork: Resource temporarily unavailable FAIL: ./run-O .... ====================================================== 2 of 5 tests failed Please report to open-cobol-list@lists.sourceforge.net ====================================================== make[4]: *** [check-TESTS] Error 1 make[4]: Leaving directory `/tmp/install/open-cobol-0.33/tests' make[3]: *** [check-am] Error 2 make[3]: Leaving directory `/tmp/install/open-cobol-0.33/tests' make[2]: *** [check-recursive] Error 1 make[2]: Leaving directory `/tmp/install/open-cobol-0.33/tests' make[1]: *** [check-recursive] Error 1 make[1]: Leaving directory `/tmp/install/open-cobol-0.33' make: *** [check] Error 2[/quote] ---------------------------------------------------------------- I have no idea. It's a Cygwin problem. Take it over to the Cygwin list. Roger ---------------------------------------------------------------- Subject: Linking error Hello, i've try to link some Objects with -o option and i got error: cobc: -o option invalid in this combination I have also used the sample from UserManual: (Top / UserManual / 2_3) C-Interface -------- $ cc -c `cob-config --cflags` hello.c $ cobc -c -static say.cob $ cobc -o hello hello.o say.o $ cobc: -o option invalid in this combination -------- and i got same error. What is wrong there ? regards Julius ---------------------------------------------------------------- Presuming this is 0.33, you are missing the "-x" option on the final link. Roger ---------------------------------------------------------------- Subject: HOWTO: MinGW Open-Cobol with BDB Support The next release of CobCurses (0.94) will support the MinGW environment, in addition to POSIX environments like Unix, Linux and Cygwin. In connection with the work in this direction, I have taken the trouble to document the steps necessary for building up your own MinGW environment, which is capable of running Open-Cobol compiled applications. In other words, you can create Open-Cobol applications in win32, capable of using Indexed sequential files thanks to the Berkeley Database project. Unlike Cygwin, you won't have to distribute 100s of files to make your Cobol application usable on an end-user PC. You only need 5 DLLs and your own application file(s). CobCurses-0.94, when it becomes available, will also make it possible for you to run database enabled SCREENS, with the help of the PDCurses project. This has been done successfully in development mode already. The following link takes you directly to the HOWTO information, for building your own MinGW environment. ====================================== It has been assumed that only Win2K or later releases of Windows are being used (you're a pioneer if you try this on Win98 for example): ====================================== http://cobcurses.wiki.sourceforge.net/MinGW+Open-Cobol+Install The CobCurses project is described here: http://cobcurses.wiki.sourceforge.net Please notify me of any errors or omissions in the HOWTO. The procedure is lengthy and it is possible that I have assumed or omitted an important detail. I also want to thank Roger While (OC) and William McBrine (PDCurses) for their assistance in making this happen. Enjoy, and good luck! Warren. ---------------------------------------------------------------- Just to be clear about "what needs to be distributed", just be aware that the instructions do not cover GPL and Berkeley DB licensing compliance issues. License compliance is your responsibility, and is not covered by the instructions. Warren. ---------------------------------------------------------------- Subject: Help in compiling code. Specify multiple -I options - cobc -std=cobol2002 -I $HOME/Cobol/copy -I $HOME/sqllib/copy -L $/usr/local/lib:. -o bin/cntrylst cntrylst.cob ---------------------------------------------------------------- Hi I was trying to compile my program. I have the program in the following folder structuer $HOME/Cobol/src -- All source folder $HOME/Cobol/copy -- All copy books involved. $HOME/Cobol/bin -- Place any shell programs, and final output $HOME/Cobol/obj -- Any object files at the time of compilation. $HOME/sqllib/copy linked to /opt/ibm/db2/V9.1/include/cobol_mf I am trying to compile using the following command. cobc -std=cobol2002 -I $HOME/Cobol/copy:$HOME/sqllib/copy -L $/usr/local/lib:. -o bin/cntrylst cntrylst.cob I am getting the error as : cntrylst.cob:14: Error: sqlca: No such file or directory cntrylst.cob:17: Error: country: No such file or directory I tried giving the complete path instead of $HOME. It is probably taking one path. How to make the compilor search in multiple paths for copybooks at the time of compilation ? Thanks, Giri ---------------------------------------------------------------- Subject: XML Support Hello, is there any support for XML parsing like that found in MF or IBM Cobol planned? Best regards Sönke ---------------------------------------------------------------- Subject: CobCurses Release 0.94 Available for Download New Features in Release 0.94 : =================== These are the main new features in this release: 1. COBOL programs can now write spreadsheet formatted text files (*.CSV), in addition to being able to read them. 2. Support of COMP-1/COMP-2 types, with scientific (exponential) notation support. Additionally unit support and engineering exponent support is included. 3. Read-only field support is now supported by the sdesign screens, and by the code generator. 4. Changes were implemented to make CobCurses operate in a MinGW environment. The following describes the features/changes in more detail: * ADDITIONAL SPREADSHEET SUPPORT : - Create *.CSV spreadsheet records using API routines NC-EMIT-CSV-HEADINGS and NC-EMIT-CSV-RECORD. * SUPPORT FOR SCIENTIFIC INPUT / OUTPUT - Convert COMP-2 (or COMP-1) values to displayable text in scientific (exponential) notation using new routine COBCURSES-SCI-NOTATION-COMP-2/COMP-1. - C programmer's ecvt(3) routine is also now available to COBOL programs using COBCURSES-ECVT-COMP-2/1. - Possibly scientific notation text can be converted to a COBOL COMP-2/COMP-1 value using the new routines COBCURSES-EDIT-COMP-2/COMP-1. Input can optionally include "unit designations" to adjust the exponent (example the input ".002uf" can be interpreted automatically as "microfarads", rather than the base unit of "Farads"). - Routines COBCURSES-FORMAT-COMP-2/1, can be used to "format" scientific values (optionally with unit designations). - The screen designer allows you to specify fields that accept "scientific/exponential" input values. - The screen designer now allows you to define and test "unit specifications" (such as "Farads" for capacitance). (This is done in the character set screen). - Fields that are designated as using COMP-2 (or COMP-1) automatically have the value populated in their CMP-* field (in addition to the text in FLD-*). * READ-ONLY FIELD SUPPORT - The Screen Designer now properly implements "read-only" fields, used for display purposes only. It is no longer required to cheat with added code -- this is now fully automated by the code-generator. * MINGW ENHANCEMENTS - CobCurses can now be compiled and used in a MinGW compiled form, allowing native Windows use. - The script init-cobcurses was replaced by the executable init-cobc, for use in a MINGW environment. - The script sdgenerate is now an executable to allow use in the MINGW environment. - A guide to installing Open-Cobol in a MinGW environment is provided here: http://cobcurses.wiki.sourceforge.net/MinGW+Open-Cobol+Install For a more detailed list of changes, visit the wiki at: ========================================= http://cobcurses.wiki.sourceforge.net/ChangeLog+Release+0.94 You can download the release from here: http://sourceforge.net/project/showfiles.php?group_id=186285 ========================================= CobCurses is a software package that allows a COBOL program to use a "screen designer" to generate programs that uses "curses". This permits Open-Cobol programs to interact with the user through a screen interface. A more complete description can be found here, including all documentation: http://cobcurses.wiki.sourceforge.net/ Enjoy, Warren. ---------------------------------------------------------------- Subject: open cobol and Ubuntu I am using opencobol with Ubuntu (Gutsy Gibbon) and i'm having two problems. 1) The first problem wasn't in Feisty Fawn, when compiling something i get this error message in the terminal: /usr/bin/ld: cannot find -lncurses collect2: ld gaf exit-status 1 terug 2) The second issue is that I could compile and run programs but i can't read input the way i could in Windows. for example: [code] IDENTIFICATION DIVISION. PROGRAM-ID. PERSONS. AUTHOR. Dirk. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. PC. OBJECT-COMPUTER. PC. DATA DIVISION. WORKING-STORAGE SECTION. 01 PERSONS. 03 NAME PIC X(30). 01 scherm-1. 03 lijn-109 pic X(80) value "Naam: ". PROCEDURE DIVISION. MAINPROG. PERFORM PRINT-SCREEN PERFORM READ-SCREEN STOP RUN . PRINT-SCREEN. display scherm-1 line 09 column 01 . READ-SCREEN. accept NAME line 09 column 07 . [/code] so the name should be read at line 9 column 7 but, after the 'label' name but instead it reads at the bottom of my terminal window any solutions?? ---------------------------------------------------------------- Hi Dirken, First can be solved by 'su ldconfig' and editing /etc/ld.so.conf, adding the path where ncourses.so is on your system (may be /usr/local/lib). Take a look to the README file. Second question: I think line and column aren't from cobol85 standards, so, you must take a look to the cobcourses instead, a library for the screen section. Search in this forum. It's no so far. I wish also have a 'display spaces erase' :-D ---------------------------------------------------------------- yeah i'm missing also the 'display spaces upon crt' statement from cobol in windows ---------------------------------------------------------------- well successfully installed cobcurses but that's about everything new i can say. i tried to compile a program called test.cob and where i used to get a file 'test' in feisty that i could execute with the command ./test i'm now getting a file 'test.so' that i can't execute with the commando ./test.so AND 'cobcrun test.so'. with the latest command using cobcrun i'm always getting the message: libcob: Cannot find module 'test.so' what do i have to do now??? ---------------------------------------------------------------- You should use `cobc -x foo.cob` and then you can `./foo`. Hope that helps. ---------------------------------------------------------------- thx a lot, it did help!! ---------------------------------------------------------------- This helped me get rid of the first problem: sudo apt-get install libncurses5-dev Hope this helps. ---------------------------------------------------------------- Subject: Mac OSX: OpenCOBOL + MacPorts Hi I'm currently trying to get OpenCOBOL working on Mac OSX. I installed gmp & db3 via Macports. Because Macports installs these packages in /opt/local, I had to set the environment variable LDFLAGS to "-L/opt/local/lib" and CPPFLAGS to "-I/opt/local/include". The installation succeeded, but when I try to compile a cobol source file, I get the following error: $ cobc Personeel.cbl i686-apple-darwin8-gcc-4.0.1: unrecognized option '-R/opt/local/lib' Is there a way to fix this? ---------------------------------------------------------------- Add a -v option to your command line, so that the compiler will report what is happening at each step of the way. That won't solve your problem, but it may help point to a solution. Warren. ---------------------------------------------------------------- $ cobc -v Personeel.cbl preprocessing Personeel.cbl into /tmp/cob15560_0.cob translating /tmp/cob15560_0.cob into /tmp/cob15560_0.c gcc -pipe -I/opt/local/include -I/opt/local/include -O2 -Wno-unused -fsigned-char -Wno-pointer-sign -bundle -flat_namespace -undefined suppress -L/opt/local/lib -fno-common -DPIC -o Personeel.dylib /tmp/cob15560_0.c -L/opt/local/lib -L/opt/local/lib -lcob -lm -lgmp -L/opt/local/lib -lintl -L/opt/local/lib -liconv -lc -R/opt/local/lib -lncurses -ldb i686-apple-darwin8-gcc-4.0.1: unrecognized option '-R/opt/local/lib' You should be able to modify the compiler flags cobc is using somewhere... ---------------------------------------------------------------- The module you'll want to look at is ./cobc/cobc.c, somewhere around line 1295. If you look at my instructions for 64-bit HPUX OC here: http://cobcurses.wiki.sourceforge.net/Installing-OC-on-HPUX you can see how a linker option was added for HP. In your case you want to find the -R option and replace it with something suitable. Good luck. Warren. ---------------------------------------------------------------- I found the -R option in the Makefiles, seems like ./configure detects it: COBC_LIBS -L/opt/local/lib -lintl -L/opt/local/lib -liconv -lc -R/opt/local/lib COB_LIBS -L/opt/local/lib -L${exec_prefix}/lib -lcob -lm -lgmp -Lopt/local/lib -lintl -L/opt/local/lib -liconv -lc -R/opt/local/lib -lncurses -ldb So I replaced most -R's in the configure file with -L. Now my 'make check' output looks a lot better, but there are still some failures: Test 1: All 74 tests were successful. Test 2: 33: EXTERNAL data item FAILED (misc.at:113) 34: EXTERNAL AS data item FAILED (misc.at:154) 35: cobcrun validation FAILED (misc.at:194) ERROR: All 157 tests were run, 3 failed unexpectedly. Test 3: 33: EXTERNAL data item FAILED (misc.at:113) 34: EXTERNAL AS data item FAILED (misc.at:154) 35: cobcrun validation FAILED (misc.at:194) ERROR: All 157 tests were run, 3 failed unexpectedly. Test 4: All 16 tests were successful. Test 5: All 16 tests were successful. ====================================================== 2 of 5 tests failed Please report to open-cobol-list@lists.sourceforge.net ====================================================== ---------------------------------------------------------------- If you have time to kill, you might try looking at the individual (or summarized) test logs that are generated. Sometimes the tests fail because of a missing or failed command that used for the test. If so, you could try the test manually (possibly), or just dismiss the failure as a "bad test". Otherwise, perhaps Roger or Sergey will be able to help you further. Roger usually responds here, but he must be up to his neck in something at the moment. ;-) Warren. ---------------------------------------------------------------- Thanks for the help. I'll check the logs later since compilation of cobol files seems to work. 8-) ---------------------------------------------------------------- Subject: perform until and clear screen issue i wrote a little program (don't ask why i did it, it's just for school) where you can enter the details of emplyees and as long as you enter a name. When you leave the name blank and press enter the program should move on to something else. In windows it all works fine so i'm sure it has to work but maybe the syntax with opencobol is a little different. this is how i did it: [code] perform read-name until name = SPACES [/code] why isn't that working? Also i'm using 'display spaces upon crt' to clear the screen and start putting my new text in a new window but the clearing thing doesn't neither. Solution??? ---------------------------------------------------------------- I think you'll need to post more of the program for a definitive answer. At this point, I think the problem is that you are using screen features that OpenCobol does not support. You will need to modify your program to use simple ACCEPT and DISPLAY verbs. Warren. ---------------------------------------------------------------- Testing in Cobol is done at the beginning of the loop ... think of it as a perform while. So, to do what you want, you will have to set the field you are accepting to non-space before the loop. Then the performed paragraph will set it to space, and do an accept. That is a pretty common mistake for Cobol beginners. IE-- move "Y" to end-flag. Perform my-routine until end-flag is equal to "Y". Does not execute "my-routine" at all. Not even once. Donald ---------------------------------------------------------------- Subject: ./configure problem( Use enhanced Berkeley DB (>= 4.1) no) HI: When i run ./confiure. I have a problem. Below is my log. -------------- . . COB_CFLAGS -I/usr/local/include -O2 COB_EXTRA_FLAGS -march=i686 -mtune=pentium4 LDFLAGS COB_LDFLAGS COB_LIBS -L${exec_prefix}/lib -lcob -lm -lgmp -lncurses -ldb-4.5 -ldl COB_CONFIG_DIR ${prefix}/share/open-cobol/config COB_LIBRARY_PATH .:${exec_prefix}/lib/open-cobol COB_MODULE_EXT so COB_SHARED_OPT -shared COB_PIC_FLAGS -fPIC -DPIC COB_EXPORT_DYN -Wl,--export-dynamic COB_STRIP_CMD strip --strip-unneeded Dynamic loading System Use gettext for international messages: yes Use Berkeley DB for file I/O: yes Use enhanced Berkeley DB (>= 4.1) no Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: yes ------------- how can i make (DB>=4.1)? ---------------------------------------------------------------- First, make sure that you have the BDB "1.85 compatibility interface" available. In this case it is also possible you did not point the configure script to where the BDB software is (this varies a lot according to platform and how it was installed). You may need to add a CFLAGS="-I/usr/local/BerkeleyDB/include" (or some path), and a corresponding LDFLAGS="-L/usr/local/BerkeleyDB/lib" (or some path). Warren. ---------------------------------------------------------------- This is usually caused by by forgetting to install BOTH BDB packages. Runtime AND Development. (See README) Roger ---------------------------------------------------------------- Fisrt.Thanks all Friends. Second. Today i download the db-4.2.52.tar.gz from http://www.filewatcher.com/m/db-4.2.52.tar.gz.4073147.0.0.html then installed. # tar zxvf db-4.2.52.tar.gz # cd db-4.2.52 # cd build_unix # ../dist/configure --prefix=/usr/local/BerkeleyDB.4.2 # make # make install add /usr/local/BerkeleyDB.4.2/lib to /etc/ld.so.conf # cat /etc/ld.so.conf include /etc/ld.so.conf.d/*.conf /usr/local/BerkeleyDB.4.2/lib Run ldconfig #ldconfig #cd open-cobol-0.33 set CFLAGS&LDFLAGS #env CFLAGS="-I/usr/local/BerkeleyDB.4.2/include" LDFLAGS="-L/usr/local/BerkeleyDB.4.2/lib" #./configure --prefix=/usr/local/opencobol Below is the Error Log ------------------------------------------- .... checking for iconv declaration... extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); checking for nl_langinfo and CODESET... yes checking db.h usability... no checking db.h presence... no checking for db.h... no checking db_185.h usability... no checking db_185.h presence... no checking for db_185.h... no checking db3/db_185.h usability... no checking db3/db_185.h presence... no checking for db3/db_185.h... no checking db4/db_185.h usability... no checking db4/db_185.h presence... no checking for db4/db_185.h... no checking db4.1/db_185.h usability... no checking db4.1/db_185.h presence... no checking for db4.1/db_185.h... no checking db4.2/db_185.h usability... no checking db4.2/db_185.h presence... no checking for db4.2/db_185.h... no checking db4.3/db_185.h usability... no checking db4.3/db_185.h presence... no checking for db4.3/db_185.h... no checking db4.4/db_185.h usability... no checking db4.4/db_185.h presence... no checking for db4.4/db_185.h... no checking db4.5/db_185.h usability... no checking db4.5/db_185.h presence... no checking for db4.5/db_185.h... no checking for __db_open in -ldb-4.5... yes checking for dlopen in -lc... no checking for dlopen in -ldl... (cached) yes configure: creating ./config.status config.status: creating cob-config config.status: creating Makefile config.status: creating lib/Makefile config.status: creating libcob/Makefile config.status: creating cobc/Makefile config.status: creating bin/Makefile config.status: creating po/Makefile.in config.status: creating texi/Makefile config.status: creating config/Makefile config.status: creating tests/atlocal config.status: creating tests/Makefile config.status: creating tests/cobol85/Makefile config.status: creating config.h config.status: config.h is unchanged config.status: executing tests/atconfig commands config.status: executing depfiles commands config.status: executing default-1 commands config.status: creating po/POTFILES config.status: creating po/Makefile OpenCOBOL Configuration: CC gcc COB_CC gcc CFLAGS -O2 -march=i686 -mtune=pentium4 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k COB_CFLAGS -I/usr/local/opencobol/include -O2 COB_EXTRA_FLAGS -march=i686 -mtune=pentium4 LDFLAGS COB_LDFLAGS COB_LIBS -L${exec_prefix}/lib -lcob -lm -lgmp -lncurses -ldb-4.5 -ldl COB_CONFIG_DIR ${prefix}/share/open-cobol/config COB_LIBRARY_PATH .:${exec_prefix}/lib/open-cobol COB_MODULE_EXT so COB_SHARED_OPT -shared COB_PIC_FLAGS -fPIC -DPIC COB_EXPORT_DYN -Wl,--export-dynamic COB_STRIP_CMD strip --strip-unneeded Dynamic loading System Use gettext for international messages: yes Use Berkeley DB for file I/O: yes Use enhanced Berkeley DB (>= 4.1) no Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: yes ------------------------------------------------------ why i can't install opencobol?? ---------------------------------------------------------------- Because your BDB is screwed up. Notice - checking for __db_open in -ldb-4.5... yes So, you have a library from 4.5 BUT you do not have any header files. This means that your system has the RUNTIME BDB 4.5 but NOT the DEVELOPMENT BDB 4.5. Assuming this is Linux, (looks like it is), the install the packages from the distro. This is all in the README. Roger ---------------------------------------------------------------- Thanks simrw and Thanks god :-) open-cobol-0.33 is installed ok [quote]This means that your system has the RUNTIME BDB 4.5 but NOT the DEVELOPMENT BDB 4.5.[/quote] then I install Berkeley v4.4 Database Libraries [runtime] and Berkeley v4.4 Database Libraries [development] #./confiure #make #make install install ok :-) :-) ---------------------------------------------------------------- Of course, now that you have read the fine README ;-) , you did do a "make check" ;-) Roger ---------------------------------------------------------------- [quote]now that you have read the fine README ;-) , you did do a "make check" ;-)[/quote] Next install i will Try :) ---------------------------------------------------------------- You can do this anytime after the "make" or "make install". As per README, it is recommended that you do this to check basic functionality. Roger ---------------------------------------------------------------- Subject: wrong warning message: with level 78 named constant It's possible to use level 78 items as an integer (no problem with MF/ACU/OC). But there is a very misleading message "Warning: Alphanumeric value is expected" if placing the 78 item within another item. This results in a misleading message: [code] 01 filler. * level 78 constant is an integer 78 myconst value 130. 03 myvars. 05 my firstvar pic X(01) occurs myconst.[/code] This is possible and right: [code] * level 78 constant is an integer 78 myconst value 130. 01 filler. 03 myvars. 05 my firstvar pic X(01) occurs myconst.[/code] Maybe it's possible to have a message like "Error: Items with level 77 or 78 are not allowed to be placed within another group" ---------------------------------------------------------------- Yes, misleading message AND generates wrong code. Fixed in current 0.33. In fact the message should be "Level number must begin with 01 or 77" and point to the line with "myvars" A 01, 77 or 78 level terminates any previous group. Roger ---------------------------------------------------------------- Subject: Compiling open cobol 0.33 [code]make[2]: Entering directory `/home/user/open-cobol-0.33/libcob' /bin/sh ../libtool --tag=CC --mode=link gcc -DSUPER_OPTIMIZE -O2 -march=i686 -mcpu=pentium4 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -Wl,--export-dynamic -o libcob.la -rpath /usr/local/lib -version-info 1:0:0 -no-undefined libcob_la-common.lo libcob_la-move.lo libcob_la-numeric.lo libcob_la-intrinsic.lo libcob_la-termio.lo libcob_la-fileio.lo libcob_la-screenio.lo libcob_la-strings.lo libcob_la-call.lo -lm -lgmp -lncurses -ldb-4.6 -ldl gcc -shared .libs/libcob_la-common.o .libs/libcob_la-move.o .libs/libcob_la-numeric.o .libs/libcob_la-intrinsic.o .libs/libcob_la-termio.o .libs/libcob_la-fileio.o .libs/libcob_la-screenio.o .libs/libcob_la-strings.o .libs/libcob_la-call.o -lm /usr/local/lib/libgmp.so -lncurses -ldb-4.6 -ldl -march=i686 -mcpu=pentium4 -Wl,--export-dynamic -Wl,-soname -Wl,libcob.so.1 -o .libs/libcob.so.1.0.0 /usr/lib/gcc-lib/i586-suse-linux/3.3.5/../../../../i586-suse-linux/bin/ld: cannot find -ldb-4.6 collect2: ld returned 1 exit status make[2]: *** [libcob.la] Error 1 make[2]: Leaving directory `/home/user/open-cobol-0.33/libcob' make[1]: *** [all-recursive] Error 1[/code] db 4.6 installed ---------------------------------------------------------------- From where/to where was BDB 4.6 installed ? I am not aware that Suse has any 4.6 rpm's. As stated in the README, use distro packages when available. As you are on Suse, install the 4.x (latest) from the distro. (Runtime and Development) (Depending on Suse release, these will be 4.1, 4.2, 4.3, 4.4 or 4.5, whichever is the latest) Roger ---------------------------------------------------------------- I've installed it from oracle sources. http://www.oracle.com/technology/software/products/berkeley-db/index.html ---------------------------------------------------------------- Well undo anything you tried to do with 4.6 and install the Suse packages eg. db-4.3.27-3 db-devel-4.3.27-3 or whatever is available for your Suse release. (Yast->software install ->search ->berkeley) (Choose the latest from multiple db's) Roger ---------------------------------------------------------------- Subject: Acting OC as CGI - Part II Some weeks ago I posted a request about CGI. As usual Roger gave me tips to understand how OC could read from stdin and write upon stdin. so I wrote some programs you can test. you have 2 cobol source programs, 1 .cgi and a html file. See link http://www.hiniger.eu/CGI_OC.tgz All of these are working on my Debian Etch. Enjoy Hello Aeko Thank You Roger Bear ---------------------------------------------------------------- Subject: This is my first program with opencobol .Compile ok but Run errer.why? Below is my test Src --------------------------------------------------------------------------- 001000 IDENTIFICATION DIVISION. 002000 PROGRAM-ID. TESTCOB. 002100 AUTHOR. enjoy. 002200 DATE-WRITTEN. 2007.10.12. 002300 DATE-COMPILED. 002400* 002500 ENVIRONMENT DIVISION. 002600 CONFIGURATION SECTION. 002700 SOURCE-COMPUTER. ibm. 002800 OBJECT-COMPUTER. ibm. 002900* 003000 INPUT-OUTPUT SECTION. 003400* 003500 DATA DIVISION. 004500* 004600 WORKING-STORAGE SECTION. 008700* 009700**** USER-WORK-AREA. 009800 01 WK-DATE. 009900 03 WK-DATE-YY PIC X(04) VALUE SPACE. 010000 03 WK-DATE-MM PIC X(02) VALUE SPACE. 010100 03 WK-DATE-DD PIC X(02) VALUE SPACE. 011900* 012000 PROCEDURE DIVISION. 012100****************************************************************** 012200* MAIN-RTN * 012300****************************************************************** 012400 MAIN-RTN. 012600 MOVE "20071012" TO WK-DATE. 012700 DISPLAY WK-DATE. 014000 STOP RUN. ------------------------------------------------------------------------------- # ls -l total 4 -rw-r--r-- 1 root root 2183 Oct 12 23:35 test.cob # cobc test.cob Complie ok # ls -l total 12 -rw-r--r-- 1 root root 2183 Oct 12 23:35 test.cob -rwxr-xr-x 1 root root 7160 Oct 12 23:46 test.so # ./test.so Segmentation fault (core dumped) why? ---------------------------------------------------------------- (For OC 0.33) The default (when no options supplied) is to create a loadable module as you saw (test.so). You can NOT directly execute this ;-) You can execute this with the OC driver program - cobcrun test Or you can directly compile to an executable - cobc -x test.cob ./test cobc --help gives summary options and the defaults. Roger ---------------------------------------------------------------- I can run my first test program ok :-D [quote]cobc --help gives summary options and the defaults.[/quote] This is the guide line. Thanks ---------------------------------------------------------------- In my case, when I used "cobc hello.cob" to compile and used "cobcrun hello" to run the program, It displayed the result successfully. But when I used "cobc -x hello.cob" to compile and used "./hello" to run the program, It failed and the error message as follows. "./hello: error while loading shared libraries: libcob.so.1: cannot open shared object file: No such file or directory " :-o How to resolve this problem ? Thanks . ---------------------------------------------------------------- RTFR :-) (Read The Fine README) Roger ---------------------------------------------------------------- Subject: OC 0.33 is now OC 1.0 The decision has been made to make the next release of OC version 1.0. The prerelease link is automatically updated. It is expected that OC 1.0 will be released within this month. Roger ---------------------------------------------------------------- Congratulations ! Thanks for your dedication and work. ---------------------------------------------------------------- I am happy to see that the project is living. So welcome to Release 1.0 ! We need OpenCobol for our personal progress. Long live to OC ! Thank You Staff Thank You Roger Bear :-D ---------------------------------------------------------------- Subject: Embedded SQL and TX-Monitor Hi, has anybody ever tried to use embedded SQL with OpenCOBOL and DB2? From skimming the DB2 docs it seems it's as easy as running the DB2 preprocessor, cobol-compile the result and link it to the DB2 libraries. But in reality? And what if you use a Transaction monitor like Tuxedo? Thanks for any hints, Juergen ---------------------------------------------------------------- The best way to know is to try something small. But if I were to place a bet, I'd say there'd be complications. Any SQL front end has to be tailoured for the types of library calls made by the compiler. But who knows? Try it and see. I've been meaning to give OpenAMQ a try, but to make it friendly, its going to need some sort of COBOL binding. If I ever finish CobCurses to a reasonable point, I plan on having a go at that. Warren. --- http://cobcurses.wiki.sourceforge.net ---------------------------------------------------------------- I tried using Oracle and UDB. It seems to work. internal data representation of opencobol is "cobol compliant", therefore the precompiler manages data types correctly. As far as I know, the only TXmonitor supporting opencobol is XCICS (XFRAME). Rgds ---------------------------------------------------------------- Subject: OC 1.0 compiling error ?? Hello ! This program ran at least 35 times under 0.33. I turned to 'free' source and copybooks, and I have an error : crecli.cbl:17: Error: 'wtx-st' undefined identification division. program-id. crecli. author. bear. date-written. Aou-07. * * Programme de test pour OpenCobol 1.0 avec indexation fichiers reels * environment division. configuration section. source-computer. dell. object-computer. dell. input-output section. file-control. select TX assign to wtx-id organization is line sequential access mode is sequential file status is wtx-st. copy "OCCLI.DYN". data division. file section. fd TX label record is standard data record is txxx. 01 txxx. 02 filler pic X(2048). copy "OCCLI.CPY". working-storage section. 77 wtx-id pic X(060). 77 wtx-st pic X(002). 77 wtx-aig pic S9. 77 wtx-Lus pic 9(06). copy "OCCLI.WRK". 77 intro pic X. procedure division. initiale section. debut. display "OpenCobol 1.0" line 1 column 1 end-display display "CLIENTS" line 1 column 30. move "CLIENTS.txt" to wtx-id. open input TX move "CLIENTS" to wcl-id open output CL. move -1 to wtx-aig perform until wtx-aig > 0 read TX no lock at end move 1 to wtx-aig not at end add 1 to wtx-lus if txxx = spaces continue else if wtx-aig = -1 move 0 to wtx-aig else initialize cl20 unstring txxx delimited by "|" into cl20-NuCli cl20-MoDir cl20-NmCli cl20-NuTel cl20-NuFax cl20-NuMob cl20-AdCl1 cl20-AdCl2 cl20-CdPtl cl20-LbVil cl20-MdRgl cl20-CnRgl end-unstring display cl20-NuCli line 12 column 38 end-display write clxx invalid display "!ErrWriteCLI!" not invalid add 1 to wcl-cre end-write end-if end-if end-read display wtx-lus line 15 column 38 end-display display wcl-cre line 16 column 38 end-display end-perform close CL close TX . terminale section. fin. display "C'est fini !" line 24 column 1 accept intro line 24 column 0. stop run. ---------------------------------------------------------------- Sorry, I can not reproduce this. Can you post the contents of the COPY files and also what compile options you used. You could also post the output adding the "E" option which will show the complete preprocessed source. eg. cobc -xE -std=mf crecli.cbl Incidentally, comment lines in free format are strictly speaking defined by using "*>" and not just "*". Roger ---------------------------------------------------------------- YES! "OCCLI.DYN" was in fixed format with first line commented (* in column 7). "OCCLI.CPY" is in free format but comments were codified "*" instead of "*>" compile options {were|are) cobc -x -free -std=mf -I../Copies crecli.cbl Corrections done, everything works great !!! So I will look at my source programs & Copybooks and change all commented lines so I won't mix free & fixed formats ... Just 2 words : THANK YOU ---------------------------------------------------------------- OK. Even if you are coding fixed format,you should get used to using "*>" for comments with the asterisk in column 7 and columns 1 to 6 spaces. You have to be careful when using free format on progs that were originally fixed format; here's an example (assume MYFLD1, MYFLD2 are somewhere defined) (posting mangles spaces so I have replaced spaces with periods) - ...........COMPUTE somefield = ...............................MYFLD1 ......*........................MYFLD2 So originally we were using MYFLD2 but then replaced it with MYFLD1 and commented out the original line BUT in free format that is no longer a comment and becomes part of the COMPUTE!!! ie. COMPUTE somefield = MYFLD1 * MYFLD2 There are other pitfalls like the continuation character ("-") or other indicators that maybe allowed in column 7. Roger ---------------------------------------------------------------- Sure ! And what about using "SECTION" instead of paragraphs. I coded long time ago with SECTION (because they could be in overlay), but these were tips of the past due of small memory ... example : sort WW ascending key key-1 ........descending key key-2 ........input procedure is ENTREE ........output procedure is SORTIE . . ENTREE SECTION. D-ENTREE. . . F-ENTREE. ....EXIT. SORTIE SECTION. D-SORTIE. . . F-SORTIE. ....EXIT. Bear DECLARATIVES makes use of "SECTION" necessary ... ---------------------------------------------------------------- Not sure what you are asking here. Sure if you want to use sections, why not. Some more clarification about the free format comment indicator "*>". This can appear anywhere on a line and anything after it will be ignored. (So-called floating comment) So - ADD 1 TO FLD *> ADD 1 TO FLD2 on one line would mean that the second add is a comment. Also note that fixed format cobol line syntax is restricted to columns 8(or 12) to 71 inclusive whilst free format is 1 to 255 inclusive. So while you can program a fixed format prog to compile with free format (taking care about the indicator column), it is not generally possible to do the reverse (because then you would anyway end up coding it as fixed) Roger ---------------------------------------------------------------- Subject: goback goback does not seem to work properly. It's supposed to do "exit program" if running as a subprogram and "stop run" if running as a main program, but instead it always does "exit program". So it turns out, if you use "goback" in a main program, the "goback" is ignored, and instead of ending the program it "falls through" to the next statement, causing very weird results! Should I report this as a bug? ---------------------------------------------------------------- Sounds like you're using an older version of the compiler. I doubt you'll experience that on the current one (now version 1.0). Warren. ---------------------------------------------------------------- I got it from the latest Ubuntu repository. How do I check what version it is? ---------------------------------------------------------------- $ cobc -V cobc (OpenCOBOL) 0.33.0 Copyright (C) 2001-2007 Keisuke Nishida Copyright (C) 2007 Roger While ---------------------------------------------------------------- Then do an update (just install over your existing version). You find all the necessary information in "Install Guide" (you can see in navigation on the left side), in README and INSTALL from the download package you need anyway. After updating the version it should say [quote]cobc (OpenCOBOL) 1.0.0 Copyright (C) 2001-2007 Keisuke Nishida Copyright (C) 2007 Roger While[/quote] when doing [code]$ cobc -V[/code] ---------------------------------------------------------------- Actually I would hope we see - cobc (OpenCOBOL) 1.0.0 ;-) Roger ---------------------------------------------------------------- This version 0.33 for sure. You have already figured this out based on later posts. I recommend the following: 1. Download the latest OC tar: open-cobol-1.0.tar.gz 2. Place the file in the appropriate directory like: /usr/local/src 3. Open the terminal application (Applications...Accessories...Terminal) 4. cd /usr/local/src 5. sudo tar -xzf open-cobol-1.0.tar.gz 6. cd open-cobol-1.0 7. Read the INSTALL text file. 8. sudo ./configure 9. sudo ./make 10. sudo ./make check 11. sudo ./ make install 12. sudo ./ make clean 13. sudo apt-get remove open-cobol You might have to install gcc and autoconf to get it to compile(among other things).... 8-) ---------------------------------------------------------------- How many 0.33 releases were there Roger? I could be wrong, but GOBACK did seem to work for some of them. 8-) Warren. ---------------------------------------------------------------- There was not ever and will not be a 0.33 release :-) From cobc/ChangeLog - 2007-06-16 Roger While * tree.h, parser.y, typeck.c, codegen.c : Fix subtle difference between GOBACK and EXIT PROGRAM Roger ---------------------------------------------------------------- I'll have to check, but I think it has been recorded somewhere in my logs! ;-) Warren. ---------------------------------------------------------------- Subject: POINTER in OpenCobol 1.0 It seems that pointers have an internal length of 4 Byte as it is with Microfocus, [quote]The default amount of storage allocated for the POINTER format may vary depending on the operating environment but is at least four bytes. The method of representation of the memory address varies between environments and is in general consistent with the representation used in non-COBOL languages.[/quote] Is is possible to have a defined length (8 Byte) whichever environment is used? ---------------------------------------------------------------- Pointers have an internal length depending on the operating environment. If 32 bit, you get 4 byte pointers. If 64 bit, you get 8 byte pointers. Roger ---------------------------------------------------------------- So if one want to be sure that there are ALWAYS 8 Byte reserved (for example you have a pointer in a file structure and don't know if you need to change the machine some day or communicate between different machine types), this is what you need [code] 01 mystructrure. 05 [some stuff before the pointervar...] 05 mypointerplace pic 9 (08). 05 mypointer redefines mypointerplace pointer 05 [some stuff behind the pointervar...][/code] ---------------------------------------------------------------- NO, NO and again NO! A pointer (aka address) is only meaningful within the currently executing process! Re-execute the program and you will almost certainly get another value for the pointer. Anything that is machine/execution specific should never be made available in a file or anything else. Another example is having COMP-5 fields in file records. These depend on the endianness of the machine. Roger ---------------------------------------------------------------- Why would you care about the POINTER size? As Roger has indicated, you don't want to save them in files, nor communicate them over a socket. Addresses have very local "value". They can't be usefully shared with other platforms, and even for similar platforms, what value would this address have? If you are interfacing to other language(s), they too will already know the local host's POINTER size. Maybe you can describe WHY you need a fixed size for POINTER. The only scenario I can imagine this being important is for the design of a remote debugging/trace utility. But then you'd have bigger issues than this one. Warren. ---------------------------------------------------------------- The smallest example I could imagine: There are two programs using this structure 01 mystructure. 05 firstvar pic x. ...lets say something about 200 vars 05 mypointerplace pic 9 (08). 05 mypointer redefines mypointerplace pointer ...lets say something about 200 vars 05 lastvar pic x. Program A runs on a 32bit-machine, program B runs on a 64bit-platform. They are communicating via network [program B does not use the pointer of program A but most of the other vars] and because this structure is big you would not want to have to define a new structure just for the transmitting. Is this reasonable in some way? ---------------------------------------------------------------- My question is why is the pointer in the struct if only program A uses it? Why transmit it at all? If you must keep a pointer in the struct, then I would suggest that you put all pointers at the end of the struct, so that nothing (in prog B) is affected by its size. Otherwise, reserving a max size and redefining is the only choice you have AFAIK. Of course, some day you'll be revisiting the code again when we go to 128bit hardware. Also be careful if you are using alignment clauses like SYNCHRONIZED, as they may add some additional byte padding. Warren. ---------------------------------------------------------------- Yes, agree with previous post. It's ridiculous to pass pointers externally. It has no meaning. To repeat, a POINTER is 4 bytes on 32 bit OS (or is compiled for 32 bit on a 64 bit system) or it is 8 bytes. Note that this means that (compatible to MF) that CALL params and POINTERS maybe 4 or 8 byte pointers. Roger ---------------------------------------------------------------- Subject: vbisam Roger(simrw), I was wondering if the link between vbisam-2.0 and OpenCOBOL ever happened. I am working on extracting some data from some MF ISAM files. I have been searching for a way to do this via available open source software. I am also working on compiling some MF COBOL source code with the OpenCOBOL compiler. My first attempt failed. The compiler reports a syntax error on line 17 of the first COPY book. The line is the 17th line of comments of the following variety: XXX001* mm-dd-yy comment begins.... I am compiling with the following command: cobc -x -std=mf -free -I /usr/local/src/copy progname ---------------------------------------------------------------- To answer the last point first - XXX001* mm-dd-yy comment begins.... That is fixed format but you are trying to compile with free format. Re. vbisam. I do not have time to work on this. vbisam needs developers. It is currently not usable by Cobol due to missing functionality. Easiest way to transfer data is to write an unload program on the original source machine which sequentially reads the I/S file and writes a fixed sequential file. Transfer the fixed sequential file to the target machine. Write a load program that reads the fixed sequential file and writes the new I/S file. Roger ---------------------------------------------------------------- Subject: CobCurses 0.95 Released (with Menu support) I have suddenly become busy, so I have rushed this release out to make it available for use. It has been thoroughly tested under Cygwin and HPUX, and should compile without incident on Linux. I have not yet had the time to check for portability issues elsewhere. The huge improvement here is the menu support and the ability to support graphics characters in the screen backgrounds. The notes for the release file are repeated below for your convenience. What is CobCurses? CobCurses is a package designed to allow Open-Cobol programmers to create screens on open system platforms, or those (like Windows) that can use PDCurses. Since handcrafting screens is tedious work, this package includes a "Screen Designer" utility. All User Guides and Programmer Guide documentation can be found on the source forge (see link at bottom). ==== RELEASE NOTES ==== A large number of internal changes were implemented in this release, but first let's cover the user visible improvements: 1. MENUS! Popup menus are now supported, and are available in sdesign with every Action field. In fact, any sdesign field that is marked with a diamond graphic, has the ability to popup a menu with F1 (or ^O). 2. To support menus, FUNCTION keys are now available in Action mode (though CONTROL-O is an alternate way of opening a menu). This included a new event callback NC-FKEY-EVENT. 3. GRAPHIC characters in the screen background. It is now possible using sdesign to draw alternate-charset graphics in your screen background. See the notes in the opening help screen for the "Paint" function. 4. TRACE facilities. CobCurses now includes an environment variable that can enable capturing of trace information to a file for debugging. A routine named NC_TRACE_MSG can also be used to add custom messages to the trace file. INTERNAL CHANGES: The main two major internal changes were: 1. The terminal support has been virtualized, so that the CobCurses routines deal with a "terminal" object (not curses routines). This will eventually lead to other possible windowing interfaces like perhaps graphic X Window or native Windows support. The other motivation for this was to allow CobCurses to have one consistent set of constants for colours, attributes and character sets. Previously, these values were different depending upon the platform and implementation of curses used. 2. Menu support has been provided independently of curses. This is important for portability since PDCurses and some platforms do not provide a curses menu library. This also guarantees that CobCurses menus will behave consistently on all platforms (and overcome menu paging bugs in ncurses). PLANNED FOR THE NEXT RELEASE: Please avoid writing much code that works with colour pairs. In the next release, it is planned to hide the colour pair value altogether by using a TDC (Terminal Drawing Context). This TDC will tie together attributes and colours, and perhaps other "drawing contexts" so that you won't have to manage colour pairs (this will be transparent). This will also pave the way for graphical interfaces where a selected font and line styles etc. may also be supported. NOTES: HPUX users will need to link with ncurses, instead of the native HPUX curses libraries. I didn't have time to fully investigate this, but the native include files define things like MENU and ITEM types that conflict with the CobCurses defined ones. ==== The release is available for download here: http://sourceforge.net/projects/cobcurses ---------------------------------------------------------------- Sounds great. Can somebody link some pictures using all the methods cobcurses provides? The pictures from sourceforge are from January 2007 and the wiki isn't quite up-to-date. ---------------------------------------------------------------- The screen shots and the wiki documentation are still catching up with the software. Both are NEXT on my list of things to do. This last release was an enormous amount of work, and I had hoped to have the documentation completed as part of the release (0.95). But I have become suddenly busy and I have to defer that for the moment. When I get some free time you will see the wiki documentation catch up with the new features. Thanks for your interest, Warren. ---------------------------------------------------------------- Ok. It only took a few minutes to update the screen shots (it seems I am only allowed 6 of them). So the screen shots shown do not cover all of the screens, but you can see a few that show the menu in operation. From these you can also see the alt charset graphics being used. Warren. ---------------------------------------------------------------- I tried do install CC on a OC1.1/cygwin machine. All steps before went fine and there is a lot of new stuff in /usr/local/lib, but on init-cobcurses the system says "command not found" (I'm at $HOME) Could not find the file, where should it be? make at src/tests results in $ make sdgenerate TEMPLATE libcob: Cannot find module 'libcobcursex' make: *** [TEMPLATE-WS.cbl] Error 1 Something is quite wrong, I think. Could you tell/guess what? ---------------------------------------------------------------- Did you ever get this working? If not, and so everyone knows ... [i]this is a wicked cool utility. It really highlights that OpenCOBOL can pass muster.[/i] [quote]I tried do install CC on a OC1.1/cygwin machine. All steps before went fine and there is a lot of new stuff in /usr/local/lib, but on init-cobcurses the system says "command not found" (I'm at $HOME) Could not find the file, where should it be? make at src/tests results in $ make sdgenerate TEMPLATE libcob: Cannot find module 'libcobcursex' make: *** [TEMPLATE-WS.cbl] Error 1 Something is quite wrong, I think. Could you tell/guess what?[/quote] [i]init-cobcurses[/i] in the wiki docs is wrong for 0.95 it seems. Use [code]init-cobc [-t -][/code] where the option -t creates a TEMPLATE. For the second part (and before you can init-cobc actually), you will need [code] $ export COB_LIBRARY_PATH=/usr/local/lib:$COB_LIBRARY_PATH [/code] before the make. After those two steps, all went well with the make and running the sdesign program was quite intriguing. Reading through the sources today is what prompted the [i]pass muster[/i] comment above. Well done Warren. (ve3wwg) I strongly suggest that curious OpenCOBOL developers take a look at the package at http://sourceforge.net/projects/cobcurses/ The amount of OpenCOBOL source code makes for a great intermediate, advanced how-to resource, in my humble opinion. Roger also showed me use of COB_LIBRARY_PATH and how we should all know of it. Know of it and get used to builds relying on it for 'good practice' modular development. Cheers, Brian ---------------------------------------------------------------- Subject: General Test Case Question I was wondering if there is something similar to cUnit(C) or nUnit(.NET) for writing test cases in COBOL. I realize this list is OpenCOBOL specific but, I was wondering if something like this exists for COBOL(OpenCOBOL would be a bonus!!!). ---------------------------------------------------------------- I did find this comment on unit testing in COBOL in case someone else is researching this. http://idinews.com/unitTest.html ---------------------------------------------------------------- OC provides a basic series of tests done with "make check". These are things that are outside of the normal ANSI85 tests which can be performed by reading the doc. (Read the README and read tests/cobol85/README) Even gcc has it's own test harness and does not require such stuff. Maybe you should post this to the MF(which now has acquired ACU) :-) Roger ---------------------------------------------------------------- Subject: How do you combine static and dynamic libs? Say you want to combine some source and a static library into one executable, that calls a DLL. For C and Linux, you would do something like gcc -o myexe myexe.c /my/static/lib.a -lmylib i.e. you have explicitely name the .a to get lib.a and the linker adds libMylib.so I tried that with cobc, too. Unfortunately cobc thinks the .a is a cobol source. The only way I got the scenario to work was ar-x-ing the .a and adding all .o to the cobc command line. Somehow, I feel there should be a better way. Is there? If yes, could you please add it to the Multiple Sources page on the wiki? Thanks, Juergen ---------------------------------------------------------------- Subject: i'm going crazy! hi everybody, i've installed open-cobol on ubuntu... when i tried to compile this simple test program [code] * Sample COBOL program IDENTIFICATION DIVISION. PROGRAM-ID. hello. PROCEDURE DIVISION. DISPLAY "Hello World!". STOP RUN.[/code] i got this error output: [code] cobc hello.cob hello.cob:1: Warning: Invalid indicator 'm' at column 7 hello.cob:1: Error: syntax error, unexpected WORD, expecting PROGRAM_ID[/code] can anyone help me!?!? :-? thanks ---------------------------------------------------------------- 1) begin your code from column 1 2) compile with "cobc -free hello.cob" 3) run ---------------------------------------------------------------- now it works!!! :-D thankyou very much!!! 8-) ---------------------------------------------------------------- Subject: FAQ Would someone be kind enough to point me to the FAQ please, the link http://www.opencobol.org/modules/xoopsfaq/ (top right of these pages) gives me a blank page. Regards John ---------------------------------------------------------------- You're right, same for me - the FAQ is missing. Have a look at the Documentation part on the left, then download the 1.0 prerelease and have a look at the README and INSTALL-Files. ---------------------------------------------------------------- Roger, can you delete the FAQ-Link at top of the page or do even better: have a FAQ there? Thank you! ---------------------------------------------------------------- Subject: CBL_READ_FILE and 0 byte count I have a program that is not working correctly between MF and OC. After opening a file using CBL_OPEN_FILE, the program calls CBL_READ_FILE with a File Offset of 0, a Byte Count of 0 and FLAGS of 128. In MF, this returns the length of the file. The same will occur in OC, but only if the Byte Count is greater than 0. Looking in fileio.c, I believe that if a Byte Count of 0 is used, the rc from the read is 0, which in turns caused 10 to be returned (EOF). If the byte count is 0 and flags is 128, can the EOF check be bypassed? ---------------------------------------------------------------- Yes, seems reasonable. I did this - long long off; int fd; int len; int rc = 0; struct stat st; memcpy (&fd, file_handle, 4); memcpy (&off, file_offset, 8); memcpy (&len, file_len, 4); #ifndef WORDS_BIGENDIAN off = COB_BSWAP_64 (off); len = COB_BSWAP_32 (len); #endif if (lseek (fd, (off_t)off, SEEK_SET) < 0) { return -1; } if (len > 0) { rc = read (fd, buf, len); if (rc < 0) { rc = -1; } else if (rc == 0) { rc = 10; } else { rc = 0; } } if ((*flags & 0x80) != 0) { if (fstat (fd, &st) < 0) { return -1; } off = st.st_size; #ifndef WORDS_BIGENDIAN off = COB_BSWAP_64 (off); #endif memcpy (file_offset, &off, 8); } return rc; } Look OK. ? Roger ---------------------------------------------------------------- Roger, I think I followed the change (all the indents were removed). I believe that it is only do the read if the len is greater than 0. Should the seek before it be included inside the IF check? If no read is being done, should a seek occur? Cris ---------------------------------------------------------------- I do not know. The doc is not very clear about this. Excerpt - ------------------- On Entry: file-handle The file handle returned when the file was opened. file-offset The offset in the file at which to read. This field is currently limited to a maximum value of x"00FFFFFFFF". byte-count The number of bytes to read. flags This parameter can take the following values: 0 Standard read 128 Return the current file size in file-offset On Exit: file-offset Contains the current file size on return if flags is set to 128 on entry. buffer The buffer into which the bytes are read. It is your responsibility to ensure that the buffer is large enough to hold the number of bytes to be read. Comments: The success of the call can be checked by examining RETURN-CODE. When using this routine to read a file that is contained in a .lbr file, the end-of-file status is not returned. To ensure you only read the file you want, obtain the size of the file first (set flags to 128), and only read up to that size. -------------------- Nowhere is stated anything about len <= 0 or that offset is dependent on len. Also nothing is stated about parameter interpretation when flags == 128. Hmmm. I guess it's a case of setting up a test case and trying it under various MF/ACU releases. It might make sense to move the seek to within the if; however, it also may make sense to leave it as is so that the read effectively becomes a positioning statement. Roger ---------------------------------------------------------------- Roger, I'm mixed on this as well. The question is whether or not it makes sense that someone would use it as a positioning statement. When the file size is request (with flags = 128) the offset is populated with the file size. I don't think a MF/ACU test would work because the next read would use the offset value to position the file. So if an offset is sent to position the file with flag 128 request, the next read requires the offset to be set to byte in which to perform the read. I don't know if having the file positioned when gain anything, when the first statement of a read is to position it with the value in OFFSET. Another question is what is returned for File size if the seek is set to a position other than zero. I'm not familiar enough with C to know that, but a quick test of setting the offset to greater than 0 could provide the answer. I may have to test that real quick in a program. Cris ---------------------------------------------------------------- Anything more on this? I am busy on other stuff. Roger ---------------------------------------------------------------- Sorry, I was having wondering thoughts. I tried a test with setting the offset to something other than 0 and the correct file length was returned. So whether or not it repositioned should not matter as long as the repositioning does not affect the returned file length. Since it does not, there is nothing more that needs to occur. Cris ---------------------------------------------------------------- OK. Lets look at this as resoved. (Although I am not sure here) Roger ---------------------------------------------------------------- Subject: Used "cobc -x " to compile and met a problem In my case, when I used "cobc hello.cob" to compile and used "cobcrun hello" to run the program, It displayed the result successfully. But when I used "cobc -x hello.cob" to compile and used "./hello" to run the program, It failed and the error message as follows. "./hello: error while loading shared libraries: libcob.so.1: cannot open shared object file: No such file or directory " :-( How to resolve this problem ? Thanks. ---------------------------------------------------------------- Read the README maybe? :-) Excerpt from README - ------------------ make install ** Note ** - On Linux systems, if you are installing for the -first- time, you may need to run "ldconfig" (as root). In fact, it does not hurt if you always do this. ** Note ** - On some Red Hat (Fedora) installations and possibly other Linux distros, /usr/local/lib is NOT automatically searched at runtime. Edit /etc/ld.so.conf and add /usr/local/lib to the file. Rerun "ldconfig". ------------------- Roger ---------------------------------------------------------------- Subject: internal compiler error when compilling my Source [FeistyFAwn] HEllo im learning Cobol and i have a little project to do for school. I trying to compile my source but OpenCOBOL 0.32 shows me this error [quote]Unexpected tree tag 5194305 Aborting compile of COBOL6.cob at line 323 codegen.c:802: internal compiler error Abandon (core dumped)[/quote] Im on ubuntu 7.04 Feisty Fawn. thank you for your help It is quite urgent !! I post here my source code [code] IDENTIFICATION DIVISION. PROGRAM-ID. FACTEL07. AUTHOR. CODJOVI. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. AS400. OBJECT-COMPUTER. AS400. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT ABO ASSIGN TO "Abo07.dat". SELECT TEL ASSIGN TO "AboMaj07.dat". SELECT ABOMAJ ASSIGN TO "Tel07.dat". SELECT FACTURE ASSIGN TO "Ano07.dat". SELECT ANOMALIES ASSIGN TO "Facture07.dat". DATA DIVISION. FILE SECTION. FD ABO LABEL RECORD STANDARD RECORD CONTAINS 94 CHARACTERS DATA RECORD INABO. 01 INABO. 02 NUMABO PIC X(10). 02 INFOABO. 03 NOMABO PIC X(20). 03 ADRABO. 04 RUEABO PIC X(30). 04 CPABO PIC X(05). 04 VILABO PIC X(15). 02 DATEPREVFACT PIC S9(7) COMP-3. 02 MONTANTFACT PIC S9(7)V99 COMP-3. 02 MONTANTPAYE PIC S9(7)V99 COMP-3. FD ABOMAJ LABEL RECORD STANDARD RECORD CONTAINS 94 CHARACTERS DATA RECORD OUTABOMAJ. 01 OUTABOMAJ PIC X(94). FD TEL LABEL RECORD STANDARD RECORD CONTAINS 53 CHARACTERS DATA RECORD INTEL. 01 INTEL. 02 DATEAPPEL PIC S9(7) COMP-3. 02 HEUREAPPEL. 03 HHAPPL PIC 9(2). 03 MMAPPL PIC 9(2). 02 NUMTEL PIC X(10). 02 NUMAPPELE PIC 9(13). 02 LOCALISATION PIC X(15). 02 HEUREFIN PIC 9(4). 02 NBUNITES PIC S9(5) COMP-3. FD ANOMALIES LABEL RECORD STANDARD RECORD CONTAINS 50 CHARACTERS DATA RECORD OUTANOMALIES. 01 OUTANOMALIES. 02 FILLER PIC X(5). 02 ERREUR PIC X(15). 02 FILLER PIC X(5). 02 TELERREUR PIC X(10). 02 FILLER PIC X(5). 02 UNITANOM PIC B(5). 02 FILLER PIC X(5). FD FACTURE LABEL RECORD STANDARD RECORD CONTAINS 132 CHARACTERS DATA RECORDS ARE FTITRE1 FTITRE2 FNOM FCOORD FPREVFACT FMONTANTPAYE FSOLDEREP INFOCOMM FTITRE3. 01 FTITRE1. 02 FILLER PIC X(05). 02 TITRETEL PIC X(21). 02 NUMTELFAC PIC X(2)BX(2)BX(2)BX(2)BX(2). 02 FILLER PIC X(69). 02 DATEFACTURE. 03 DATEFACTJOUR PIC 9(2). 03 FILLER PIC X. 03 DATEFACTMOIS PIC X(8). 03 FILLER PIC X. 03 DATEFACTANNE PIC 9(4). 03 FILLER PIC X(5). 02 FILLER PIC X(02). 01 FTITRE2. 02 FILLER PIC X(56). 02 TITREFACT PIC X(19). 02 FILLER PIC X(57). 01 FNOM. 02 FILLER PIC X(15). 02 FNOMABO PIC X(20). 02 FILLER PIC X(97). 01 FCOORD. 02 FILLER PIC X(15). 02 FADRESSE PIC X(30). 02 FILLER PIC X(40). 02 FCP PIC X(5). 02 FILLER PIC X(5). 02 FVILLE PIC X(15). 02 FILLER PIC X(22). 01 FPREVFACT. 02 FILLER PIC X(78). 02 TITREPREV PIC X(25). 02 FPREVDATE PIC B(4)9(2)B9(2)B9(2). 02 FILLER PIC X(17). 01 FMONTANTPAYE. 02 FILLER PIC X(78). 02 TITREPREVMONTANT PIC X(25). 02 FPAYEPREV PIC 9(3)B9(3)V99. 02 FILLER PIC X(17). 01 FSOLDEREP. 02 FILLER PIC X(78). 02 TITRESOLDREP PIC X(25). 02 FREPORTE PIC 9(3)B9(3)V99. 02 FILLER PIC X(17). 01 FTITRE3. 02 FILLER PIC X(10). 02 TITREDATEAPPL PIC X(4). 02 FILLER PIC X(10). 02 TITREHEUREAPPL PIC X(9). 02 FILLER PIC X(10). 02 TITRENUM PIC X(6). 02 FILLER PIC X(10). 02 TITRELOCA PIC X(12). 02 FILLER PIC X(10). 02 TITREDUREE PIC X(5). 02 FILLER PIC X(10). 02 TITREPRIXHT PIC X(10). 02 FILLER PIC X(26). 01 INFOCOMM. 02 FILLER PIC X(10). 02 DATECOMM PIC 9(2)B9(2). 02 FILLER PIC X(10). 02 HEUREAPPL. 03 FHHAPPL PIC 9(2). 03 HDOTAPPL PIC X. 03 FMMAPPL PIC 9(2). 02 FILLER PIC X(15). 02 NUMCOMM PIC 9(10). 02 FILLER PIC X(10). 02 LOCALCOMM PIC X(15). 02 FILLER PIC X(10). 02 DUREECOMM. 03 FHHCOMM PIC X(02). 03 HDOTDUREE PIC X. 03 FMMCOMM PIC X(02). 02 FILLER PIC X(10). 02 PRIXHT PIC 9(3)B9(3)V99. 02 FILLER PIC X(15). WORKING-STORAGE SECTION. 77 PRIXABOHT PIC S99V999 COMP-3 VALUE 13.381. 77 PRIXUNITE PIC S9V999 COMP-3 VALUE 0.028. 77 TVA PIC S9V999 COMP-3 VALUE 0.196. 77 CALCUL PIC S9(7)V99. 77 DUREEAPPEL PIC 9(4). 77 MONTANTAPPEL PIC S9(9)V999. 77 MONTANTTOTALHT PIC S9(9)V99. 77 MONTANTTVA PIC S9(9)V99. 77 CALCTEMPS PIC 9(4) COMP-4. 77 TELCOURANT PIC X(10). 77 LIBNUMTEL PIC X(22) VALUE "NUMERO DE TELEPHONE : ". 77 LIBTITRE2 PIC X(19) VALUE "RELEVE TELEPHONIQUE". 77 LIBFACTUREPREV PIC X(18) VALUE "FACTURE PRECEDENTE". 77 LIBMONTANTPAYE PIC X(12) VALUE "MONTANT PAYE". 77 LIBSOLDEREP PIC X(13) VALUE "SOLDE REPORTE". 77 1HEURE PIC 99 VALUE 60. 77 ANNEE PIC 9(4) VALUE 2000. 01 JOUR. 02 AA PIC 99. 02 MM PIC 99. 02 JJ PIC 99. 01 MOIS. 02 FILLER PIC X(09) VALUE "JANVIER". 02 FILLER PIC X(09) VALUE "FEVRIER". 02 FILLER PIC X(09) VALUE "MARS". 02 FILLER PIC X(09) VALUE "AVRIL". 02 FILLER PIC X(09) VALUE "MAI". 02 FILLER PIC X(09) VALUE "JUIN". 02 FILLER PIC X(09) VALUE "JUILLET". 02 FILLER PIC X(09) VALUE "AOUT". 02 FILLER PIC X(09) VALUE "SEPTEMBRE". 02 FILLER PIC X(09) VALUE "OCTOBRE". 02 FILLER PIC X(09) VALUE "NOVEMBRE". 02 FILLER PIC X(09) VALUE "DECEMBRE". 01 FILLER REDEFINES MOIS. 02 TMOIS PIC X(09) OCCURS 12. PROCEDURE DIVISION. PRETRAIT. ACCEPT JOUR FROM DATE. ADD JJ TO ANNEE. DEBUT. OPEN INPUT ABO. OPEN INPUT TEL. OPEN OUTPUT ABOMAJ. OPEN OUTPUT FACTURE. OPEN OUTPUT ANOMALIES. READ ABO AT END MOVE HIGH-VALUE TO NUMABO END-READ. READ TEL AT END MOVE HIGH-VALUE TO NUMTEL END-READ. PERFORM TEST AFTER UNTIL NUMABO = HIGH-VALUE PERFORM DPDEBUTFACT THRU FPDEBUTFACT PERFORM TEST AFTER UNTIL NUMTEL NOT = NUMABO IF NUMABO NOT = NUMTEL IF NUMABO > NUMTEL PERFORM DANOM1 THRU FANOM1 ELSE PERFORM DANOM2 THRU FANOM2 MOVE HIGH-VALUE TO NUMTEL END-IF ELSE PERFORM DMAJFABO THRU FMAJFABO PERFORM DCORPFACT THRU FCORPFACT END-IF IF NUMTEL NOT = HIGH-VALUE READ TEL AT END MOVE HIGH-VALUE TO NUMTEL END-READ END-IF END-PERFORM PERFORM DFINFACT THRU FFINFACT READ ABO AT END MOVE HIGH-VALUE TO NUMABO END-READ END-PERFORM. FIN. CLOSE ABO TEL ABOMAJ FACTURE ANOMALIES. STOP RUN. DANOM1. EXIT. FANOM1. DANOM2. EXIT. FANOM2. DMAJFABO. EXIT. FMAJFABO. DPDEBUTFACT. TITRE-12. MOVE " " TO FTITRE1. MOVE LIBNUMTEL TO TITRETEL. MOVE NUMABO TO NUMTELFAC. MOVE JJ TO DATEFACTJOUR. MOVE ANNEE TO DATEFACTANNE. MOVE TMOIS(MM) TO DATEFACTMOIS. WRITE FTITRE1 AFTER 1. MOVE " " TO FTITRE2. MOVE LIBTITRE2 TO TITREFACT. WRITE FTITRE2 AFTER 2. COORD. MOVE NOMABO TO FNOMABO. WRITE FNOM AFTER 3. MOVE RUEABO TO FADRESSE. MOVE CPABO TO FCP. MOVE VILABO TO FVILLE. WRITE FCOORD AFTER 1. INFOPREVFACT. MOVE " " TO FPREVFACT. MOVE LIBFACTUREPREV TO TITREPREV. MOVE DATEPREVFACT TO FPREVDATE. WRITE FPREVFACT AFTER 2. MOVE " " TO FMONTANTPAYE. MOVE "MONTANT PAYE" TO TITREPREVMONTANT. * MOVE MONTANTPAYE TO FPAYEPREV. WRITE FMONTANTPAYE AFTER 1. MOVE " " TO FSOLDEREP. MOVE LIBSOLDEREP TO TITRESOLDREP. SUBTRACT MONTANTFACT FROM MONTANTPAYE GIVING FREPORTE. WRITE FSOLDEREP AFTER 1. TITRE-3. MOVE " " TO FTITRE3. MOVE "DATE" TO TITREDATEAPPL. * MOVE "H DAPPEL" TO TITREHEUREAPPL. MOVE "NUMERO" TO TITRENUM. MOVE "LOCALISATION" TO TITRELOCA. MOVE "DUREE" TO TITREDUREE. MOVE "MONTANT HT" TO TITREPRIXHT. WRITE FTITRE3 AFTER 2. EXIT. FPDEBUTFACT. DCORPFACT. MOVE HHAPPL TO FHHAPPL. MOVE MMAPPL TO FMMAPPL. MOVE ":" TO HDOTAPPL HDOTAPPL. MOVE DATEAPPEL TO DATECOMM. MOVE NUMTEL TO NUMCOMM. MOVE LOCALISATION TO LOCALCOMM. DIVIDE NBUNITES BY 1HEURE GIVING CALCTEMPS ROUNDED. MOVE CALCTEMPS TO FHHCOMM. MULTIPLY CALCTEMPS BY 1HEURE. SUBTRACT CALCTEMPS FROM NBUNITES. MOVE CALCTEMPS TO FMMCOMM. MULTIPLY NBUNITES BY PRIXUNITE GIVING PRIXHT. EXIT. FCORPFACT. DFINFACT. EXIT. FFINFACT. END PROGRAM FACTEL07. [/code] ---------------------------------------------------------------- Please use OpenCOBOL 1.0. Works fine with 1.0. Roger ---------------------------------------------------------------- I'm using Ubuntu 7.10 (Gutsy) and your source compiled fine apart from this section: [code] READ TEL AT END MOVE HIGH-VALUE TO NUMTEL END-READ. PERFORM TEST AFTER UNTIL NUMABO = HIGH-VALUE [/code] which failed because it started in column 7 - shifting the text solved that. Type 'cobc -V' - what version are you using? The version packaged with Ubuntu 7.10 is '0.33.0'. What are you using to edit the code? ---------------------------------------------------------------- And who is doing the packaging? There is no 0.33 !! This is probably a one-off situation. When 1.0 is released there will be automatically a development 1.1. However, The 0.33 was always a private download and that somebody made a rpm/deb from that defies my comprehension. Maybe they can look at the 1.0 now. Maybe somebody should get in contact. Roger ---------------------------------------------------------------- According to the package changelog the maintainer is Bart Martens The last change to the package was in June 2007: open-cobol (0.33~cvs20070616-1) unstable; urgency=low * New upstream version from upstream cvs. Closes: #405597. * debian/README.Debian-source: Added. * debian/control: Replaced libdb4.3-dev by libdb4.5-dev. * debian/copyright: Updated. -- Bart Martens Sat, 16 Jun 2007 16:24:46 +0200 ---------------------------------------------------------------- Thank you for this quick response. It compiles well with OpenCobol 1.0 I have now completed my code and i want to test it. I have several input files transferred out of an IBM-AS400 I have the same files in 3 different encoding: EBCDIC, ACSI, ANSI which one should i use???!! I tried that way but open Cobol send me an error [quote]kanux@Kanux-Linux:~/COBOL$ ./COBOLIUT-EXT-M ./COBOLIUT-EXT-M: symbol lookup error: ./COBOLIUT-EXT-M: undefined symbol: cob_save_call_params[/quote] thank you for your help. Here my FiLe-Control paragraph [code] IDENTIFICATION DIVISION. PROGRAM-ID. FACTEL07. AUTHOR. CODJOVI. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. AS400. OBJECT-COMPUTER. AS400. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT ABO ASSIGN TO "AB07_EBCDIC.dat". SELECT TEL ASSIGN TO "TE07_EBCDIC.dat". SELECT ABOMAJ ASSIGN TO "Abomaj.dat". SELECT FACTURE ASSIGN TO "FactMAj.dat". SELECT ANOMALIES ASSIGN TO "Anom.dat".[/code] ---------------------------------------------------------------- Geez. I am losing count of how many times I have had to answer this. RTFR (also known as Read The Fine README) !! Here is the relevant excerpt - ----------- make install ** Note ** - On Linux systems, if you are installing for the -first- time, you may need to run "ldconfig" (as root). In fact, it does not hurt if you always do this. ** Note ** - On some Red Hat (Fedora) installations and possibly other Linux distros, /usr/local/lib is NOT automatically searched at runtime. Edit /etc/ld.so.conf and add /usr/local/lib to the file. Rerun "ldconfig". ------------ Roger ---------------------------------------------------------------- All right You should create a F.A.Q section on the website then. Because it is hard (impossible for a newbie like me) to make a link between this error message and the fact i didn't add "/usr/local/lib" to /etc/ld.so.conf. Especially when the readme file use words like "may", "possibly" "in some case" and talk about Fedora when im running Ubuntu.. My program is running perfectly, you did a nice job!! Now I can compile and debug my project at home!! ---------------------------------------------------------------- The error message comes from the dynamic linker in Linux :-) ie. It has nothing to do with OC :-) With regard to "may", etc., I do NOT (and can not) test on all variants. The README is, as such, so formulated to be general for all installations. Suse, for instance, does search /usr/local/lib per default. Roger ---------------------------------------------------------------- Subject: Linux / Firebird / GPRE SQL Precompiler I've been a mainframe (OS390) Cobol / CICS / DB2 programmer for ten years, but I'm also a keen Linux user and I'm currently tinkering with Open Cobol on my Ubuntu box and was wondering if anyone has had any success with the gpre SQL precompiler that's packaged with Firebird RDBMS? The documentation for gpre says that it can handle Cobol source, but does this mean it will work with Open Cobol? I'm just trying to save a little time - I've never used Firebird, so I was trying to avoid spending time with it only to find out it's not going to work with Open Cobol. I expect the answer will probably be "try it and see". BTW, is this the only Open Cobol forum or is there a more active place? Seems like this project is barely breathing - I hope I'm wrong about that. ---------------------------------------------------------------- I appear to be talking to myself - oh well :-D Anyway, the answer is... ...I still dunno. I've installed firebird and it's utilities - the version of 'gpre' packaged with ubuntu 7.10 will only process C/C++, but looking at the firebird cvs website, 'gpre' can be compiled to process other languages - including cobol. Hmmm - should I spend time trying to compile a new version of 'gpre'? Does anyone know if this is likely to work with open cobol? ---------------------------------------------------------------- Yea it looks like they took it out of gpre for 1.5.x and higher. Get firebird 1.0.x, it has cobol support in it... not sure if ANSI or COB will work, you will just have to try it...the client that you make with it though should be able to connect to newer servers in dialect 1 and 3 just fine: C extended C program CXX extended C++ program CPLUSPLUS extended C++ program COB extended COBOL program ANSI generate ANSI85 compatible COBOL ---------------------------------------------------------------- Okay, some weeks ago, I raised a wish-list request with the Ubuntu package maintainer and as of version 2.0.312981.ds1-15 the firebird packages provide a version of GPRE that will pre-compile your cobol! :) I've installed Firebird on my Ubuntu box - I got the packages (versions 2.0.4.13130.ds1-2) from the 'Intrepid' repository: LINK -> [url=http://packages.ubuntu.com/intrepid/firebird2.0-classic]Ubuntu Intrepid - Firebird Classic[/url] You need firebird2.0-common, firebird2.0-server-common, firebird2.0-classic (or super), libfbembed2 and firebird2.0-dev. I installed them all manually using GDebi Package Installer. I haven't yet had a successful compile though... [code] IDENTIFICATION DIVISION. PROGRAM-ID. test-db. DATA DIVISION. WORKING-STORAGE SECTION. EXEC SQL SET DATABASE test2 = '/var/lib/firebird/2.0/data/test2.fdb' USER 'SYSDBA' PASSWORD 'phoenix'; . 01 wv-count pic s9(04) usage binary. PROCEDURE DIVISION. EXEC SQL CONNECT test2; . exec sql select count(*) into :wv-count from test_table; . EXEC SQL DISCONNECT test2; . display wv-count STOP RUN . [/code] [code] > sudo gpre -cob -ansi -manual -no_lines test_db.cbl test_db_sql.cbl [/code] Produces this precompiled code: [code] * ********** Preprocessed module -- do not edit ************** * ********** Preprocessed module -- do not edit ************** * ********** Preprocessed module -- do not edit ************** * ********** Preprocessed module -- do not edit ************** * ********** Preprocessed module -- do not edit ************** * **************** gpre version LI-V2.0.4.13130 Firebird 2.0 ********************* IDENTIFICATION DIVISION. PROGRAM-ID. test-db. DATA DIVISION. WORKING-STORAGE SECTION. * EXEC SQL * SET DATABASE * test2 = '/var/lib/firebird/2.0/data/test2.fdb' * USER 'SYSDBA' PASSWORD 'phoenix'; * **** GDS Preprocessor Definitions **** 01 isc-blob-null PIC S9(18) USAGE COMP VALUE IS 0. 01 ISC-SQL-CODE PIC S9(9) USAGE COMP EXTERNAL. 01 test2 IS GLOBAL PIC S9(9) USAGE COMP VALUE IS 0. 01 isc-1db PIC X(36) VALUE IS "/var/lib/firebird/2.0/data/test2.fdb". 01 ISC-TRANS IS GLOBAL PIC S9(9) USAGE COMP VALUE IS 0. 01 ISC-STATUS-VECTOR IS GLOBAL. 03 ISC-STATUS PIC S9(9) USAGE COMP OCCURS 20 TIMES. 01 ISC-STATUS-VECTOR2 IS GLOBAL. 03 ISC-STATUS2 PIC S9(9) USAGE COMP OCCURS 20 TIMES. 01 ISC-ARRAY-LENGTH PIC S9(9) USAGE COMP. 01 SQLCODE IS GLOBAL PIC S9(9) USAGE COMP-5 VALUE IS 0. 01 isc-0 PIC S9(9) USAGE COMP VALUE IS 0. 01 ISC-1. 03 ISC-1-1 PIC XXXX USAGE COMP-X VALUE IS 262661. 03 ISC-1-2 PIC XXXX USAGE COMP-X VALUE IS 524290. 03 ISC-1-3 PIC XXXX USAGE COMP-X VALUE IS 117571591. 03 ISC-1-4 PIC XXXX USAGE COMP-X VALUE IS 1325482879. 03 ISC-1-5 PIC XXXX USAGE COMP-X VALUE IS 1241596673. 03 ISC-1-6 PIC XXXX USAGE COMP-X VALUE IS 1397052426. 03 ISC-1-7 PIC XXXX USAGE COMP-X VALUE IS 1096048468. 03 ISC-1-8 PIC XXXX USAGE COMP-X VALUE IS 4541506. 03 ISC-1-9 PIC XXXX USAGE COMP-X VALUE IS 1291865855. 03 ISC-1-10 PIC XXXX USAGE COMP-X VALUE IS 1. 03 ISC-1-11 PIC XXXX USAGE COMP-X VALUE IS 982867. 03 ISC-1-12 PIC XXXX USAGE COMP-X VALUE IS 18350338. 03 ISC-1-13 PIC XXXX USAGE COMP-X VALUE IS 1638400. 03 ISC-1-14 PIC XXXX USAGE COMP-X VALUE IS 352387072. 03 ISC-1-15 PIC XXXX USAGE COMP-X VALUE IS 65544. 03 ISC-1-16 PIC XXXX USAGE COMP-X VALUE IS 1638400. 03 ISC-1-17 PIC XXXX USAGE COMP-X VALUE IS 251592705. 03 ISC-1-18 PIC XXXX USAGE COMP-X VALUE IS 135594240. 03 ISC-1-19 PIC XXXX USAGE COMP-X VALUE IS 0. 03 ISC-1-20 PIC XXXX USAGE COMP-X VALUE IS 16783616. 03 ISC-1-21 PIC XXXX USAGE COMP-X VALUE IS 1291845376. * * FORMATTED REQUEST BLR FOR ISC-1 = * blr_version5, * blr_begin, * blr_message, 0, 2,0, * blr_long, 0, * blr_short, 0, * blr_begin, * blr_for, * blr_singular, * blr_rse, 1, * blr_aggregate, 1, * blr_rse, 1, * blr_relation, 10, 'T','E','S', * 'T','_','T','A','B','L', * 'E', 0, * blr_end, * blr_group_by, 0, * blr_map, 1,0, * 0,0, * blr_agg_count, * blr_end, * blr_send, 0, * blr_begin, * blr_assignment, * blr_fid, 1, 0,0, * blr_parameter, 0, 0,0, * blr_assignment, * blr_literal, blr_long, 0, 1,0,0,0, * blr_parameter, 0, 1,0, * blr_end, * blr_send, 0, * blr_assignment, * blr_literal, blr_long, 0, 0,0,0,0, * blr_parameter, 0, 1,0, * blr_end, * blr_end, * blr_eoc * * END OF BLR STRING FOR REQUEST ISC-1 01 ISC-2. 03 ISC-3 PIC S9(9) USAGE IS COMP. 03 ISC-4 PIC S9(4) USAGE IS COMP. 01 ISC-6L PIC S9(4) USAGE COMP-5 VALUE IS 18. 01 ISC-6. 03 ISC-6-1 PIC XXXX USAGE COMP-X VALUE IS 1392909313. 03 ISC-6-2 PIC XXXX USAGE COMP-X VALUE IS 1111774041. 03 ISC-6-3 PIC XXXX USAGE COMP-X VALUE IS 1879514433. 03 ISC-6-4 PIC XXXX USAGE COMP-X VALUE IS 1852141416. 03 ISC-6-5 PIC XXXX USAGE COMP-X VALUE IS 19561. * * FORMATTED REQUEST BLR FOR ISC-6 = * gds__dpb_version1, * isc_dpb_user_name,6, 'S','Y','S','D','B','A', * isc_dpb_password,7, 'p','h','o','e','n','i','x', * * END OF DPB STRING FOR REQUEST ISC-6 * **** end of GPRE definitions **** . 01 wv-count pic s9(04) usage binary. PROCEDURE DIVISION. * EXEC SQL * CONNECT test2 CALL "isc_attach_database" USING ISC-STATUS-VECTOR, BY VALUE 36, BY REFERENCE isc-1db, BY REFERENCE test2, BY VALUE 18, BY REFERENCE isc-6 CALL "isc_sqlcode_s" USING ISC-STATUS-VECTOR, BY REFERENCE SQLCODE ; . * exec sql * select count(*) * into :wv-count * from test_table; IF isc-0 = 0 THEN CALL "isc_compile_request2" USING ISC-STATUS-VECTOR, BY REFERENCE test2, BY REFERENCE isc-0, BY VALUE 84, BY REFERENCE ISC-1 CALL "isc_sqlcode_s" USING ISC-STATUS-VECTOR, BY REFERENCE SQLCODE END-IF IF isc-0 NOT = 0 THEN CALL "isc_start_request" USING ISC-STATUS-VECTOR, BY REFERENCE isc-0, BY REFERENCE isc-trans, BY VALUE 0 CALL "isc_sqlcode_s" USING ISC-STATUS-VECTOR, BY REFERENCE SQLCODE END-IF IF SQLCODE = 0 THEN CALL "isc_receive" USING ISC-STATUS-VECTOR, BY REFERENCE isc-0, BY VALUE 0, BY VALUE 6, BY REFERENCE ISC-2, BY VALUE 0 CALL "isc_sqlcode_s" USING ISC-STATUS-VECTOR, BY REFERENCE SQLCODE IF isc-4 NOT = 0 THEN MOVE isc-3 TO wv-count ELSE MOVE 100 TO SQLCODE END-IF END-IF . * EXEC SQL * DISCONNECT test2 IF test2 NOT = 0 THEN CALL "isc_detach_database" USING ISC-STATUS-VECTOR, BY REFERENCE test2 END-IF CALL "isc_sqlcode_s" USING ISC-STATUS-VECTOR, BY REFERENCE SQLCODE ; . display wv-count STOP RUN . [/code] The firebird-dev package installs the Firebird (Interbase) shared objects: [code] /usr/lib/libfbclient.so /usr/lib/libfbembed.so [/code] and some headers: [code] /usr/include/blr.h /usr/include/ib_util.h /usr/include/ibase.h /usr/include/iberror.h /usr/include/perf.h [/code] I tried to compile the pre-compiled code with the following options: [code] cobc -v -x -lfbembed test_db_sql.cbl [/code] Here's the output: [code] cobc -v -x -lfbembed test_db_sql.cbl preprocessing test_db_sql.cbl into /tmp/cob10069_0.cob translating /tmp/cob10069_0.cob into /tmp/cob10069_0.c test_db_sql.cbl:26: Warning: 'GLOBAL' not implemented test_db_sql.cbl:29: Warning: 'GLOBAL' not implemented test_db_sql.cbl:30: Warning: 'GLOBAL' not implemented test_db_sql.cbl:32: Warning: 'GLOBAL' not implemented test_db_sql.cbl:35: Warning: 'GLOBAL' not implemented test_db_sql.cbl:41: Warning: Value size exceeds data size test_db_sql.cbl:42: Warning: Value size exceeds data size test_db_sql.cbl:43: Warning: Value size exceeds data size test_db_sql.cbl:44: Warning: Value size exceeds data size test_db_sql.cbl:46: Warning: Value size exceeds data size test_db_sql.cbl:58: Warning: Value size exceeds data size test_db_sql.cbl:106: Warning: Value size exceeds data size test_db_sql.cbl:107: Warning: Value size exceeds data size test_db_sql.cbl:108: Warning: Value size exceeds data size test_db_sql.cbl:109: Warning: Value size exceeds data size cc -pipe -c -O2 -Wall -O2 -Wno-unused -fsigned-char -Wno-pointer-sign -o /tmp/cob10069_0.o /tmp/cob10069_0.c cc -pipe -Wl,-Bsymbolic-functions -Wl,--export-dynamic -o test_db_sql /tmp/cob10069_0.o -Wl,-Bsymbolic-functions -L/usr/lib -lcob -lm -lgmp -lncurses -ldb -lfbembed [/code] It DOES produce an executable but when I run it I get this: [code] > ./test_db_sql libcob: Cannot find module 'isc_sqlcode_s' [/code] So, it's all about correctly linking the Firebird shared objects? Any ideas? ---------------------------------------------------------------- Yep, looks like you need "-lfbclient" as well on the compile. (Assuming that 'isc_sqlcode_s' is defined in /usr/lib/libfbclient.so) Roger ---------------------------------------------------------------- Hmmm - made no difference. I've no idea how to resolve this... ---------------------------------------------------------------- Can you check that the symbol is actually defined in one of the libraries. Do nm -a /usr/lib/libfbclient.so | grep isc_sqlcode_s nm -a /usr/lib/libfbembed.so | grep isc_sqlcode_s It should show up somewhere marked as " T " (text segement ie. instruction entry point) If it does, then execute as root - ldconfig and try again. If it doesn't, then something is missing. Roger ---------------------------------------------------------------- [code] > nm -a /usr/lib/libfbclient.so | grep isc_sqlcode_s nm: /usr/lib/libfbclient.so: no symbols > nm -a /usr/lib/libfbembed.so | grep isc_sqlcode_s nm: /usr/lib/libfbembed.so: no symbols [/code] Hmmm - does this mean that they're no use without the symbols? ---------------------------------------------------------------- Can you try adding the "-D" option to nm. Roger ---------------------------------------------------------------- There is no 'isc_sqlcode_s' so I did a more general search and found 'isc_sqlcode': [code] > nm -D /usr/lib/libfbembed.so | grep isc_s 0002e4b0 T isc_seek_blob 0002e2c0 T isc_send 0002d870 T isc_service_attach 0002fb30 T isc_service_detach 0002e0b0 T isc_service_query 0002dee0 T isc_service_start 00027180 T isc_set_debug 0001f440 T isc_sql_interprete 00011bb0 T isc_sqlcode 00034b70 T isc_start_and_send 0002b500 T isc_start_multiple 000348d0 T isc_start_request 0002b820 T isc_start_transaction [/code] [code] > nm -D /usr/lib/libfbclient.so | grep isc_ 0002a9d0 T isc_seek_blob 0002bfc0 T isc_send 000285e0 T isc_service_attach 0002c4e0 T isc_service_detach 0002a1e0 T isc_service_query 0002b6f0 T isc_service_start 00022d10 T isc_set_debug 00019a00 T isc_sql_interprete 0000b510 T isc_sqlcode 0002bb90 T isc_start_and_send 00029440 T isc_start_multiple 0002ab80 T isc_start_request 00029780 T isc_start_transaction [/code] I'm gonna try replacing 'isc_sqlcode_s' with 'isc_sqlcode' in the pre-compiled code and see what happens... ---------------------------------------------------------------- Okay - two things: 1 - I replaced Firebird-Classic with Firebird-Super and this seemed to resolve some permission problems I was having 2 - Between the gpre pre-compile step and the cobc compile step, I changed "isc_sqlcode_s" to "isc_sqlcode" in the pre-compiled source. (I just need to make a little script to do it all auto-magically). And... ...it looks like I'm nearly there - the code compiles and successfully runs, but the result is '+0000' when it should be '+0002' (I put 2 test rows on the table). I just need to put some error checking in the test program to find out why the result is incorrect - it's probably database user permissions or incorrect database/table qualification. ---------------------------------------------------------------- [code] 01 ISC-1. 03 ISC-1-1 PIC XXXX USAGE COMP-X VALUE IS 262661. 03 ISC-1-2 PIC XXXX USAGE COMP-X VALUE IS 524290. 03 ISC-1-3 PIC XXXX USAGE COMP-X VALUE IS 117571591. 03 ISC-1-4 PIC XXXX USAGE COMP-X VALUE IS 1325482879. 03 ISC-1-5 PIC XXXX USAGE COMP-X VALUE IS 1241596673. 03 ISC-1-6 PIC XXXX USAGE COMP-X VALUE IS 1397052426. 03 ISC-1-7 PIC XXXX USAGE COMP-X VALUE IS 1096048468. 03 ISC-1-8 PIC XXXX USAGE COMP-X VALUE IS 4541506. 03 ISC-1-9 PIC XXXX USAGE COMP-X VALUE IS 1291865855. 03 ISC-1-10 PIC XXXX USAGE COMP-X VALUE IS 1. 03 ISC-1-11 PIC XXXX USAGE COMP-X VALUE IS 982867. 03 ISC-1-12 PIC XXXX USAGE COMP-X VALUE IS 18350338. 03 ISC-1-13 PIC XXXX USAGE COMP-X VALUE IS 1638400. 03 ISC-1-14 PIC XXXX USAGE COMP-X VALUE IS 352387072. 03 ISC-1-15 PIC XXXX USAGE COMP-X VALUE IS 65544. 03 ISC-1-16 PIC XXXX USAGE COMP-X VALUE IS 1638400. 03 ISC-1-17 PIC XXXX USAGE COMP-X VALUE IS 251592705. 03 ISC-1-18 PIC XXXX USAGE COMP-X VALUE IS 135594240. 03 ISC-1-19 PIC XXXX USAGE COMP-X VALUE IS 0. 03 ISC-1-20 PIC XXXX USAGE COMP-X VALUE IS 16783616. 03 ISC-1-21 PIC XXXX USAGE COMP-X VALUE IS 1291845376. [/code] OKay - what is COMP-X and why are some of these values too big? ---------------------------------------------------------------- Eeermm, I do not think you should be blindly replacing isc_sqlcode_s with something else. There must be a reason why the preprocessor is generating these calls. It sounds like a missing library and/or interface stub. I would ask on the Firebird list. COMP-X is a binary field with length defined by the PIC clause. In this case 4 bytes. The warning is because some of these values are 10 digits which may possibly overflow the field (Here, it doesn't). Roger ---------------------------------------------------------------- What happened? Any luck? I'm anxious. ---------------------------------------------------------------- hi, I got interested in the same thing. I had already downloaded OC 1.1 and would have liked to see embedded SQL working here. And then I got hold of the firebirdsql 2.0.4 tarball. I setup firebird with --with-gpre-cobol and that addded cobol support in GPRE. Now I am using the same cbl program and have similar errors with isc_sqlcode_s not being there. I thought I had traced it back to ibase.h not exposing the function however rebuilding the sql server from the tarball did not change a thing. The nm command did not show any improvement and the error about isc_sqlcode_c is still there. What am I doing wrong ? Googling around I found out that ibase.h had been changed in 2006 (?) to implement the following: ........... 2006.09.06 Steve Boyd - Added various prototypes required by Cobol ESQL * isc_embed_dsql_length * isc_event_block_a * isc_sqlcode_s * isc_embed_dsql_fetch_a * isc_event_block_s * isc_baddress * isc_baddress_s * ........... which might be part of what we need here. however the 2.0.4 tarball from firebirdsql.org does not have that. While alt.cpp already defines the isc_sqlcode_s function. I am not too familiar with how these things work and this does not seem to be (yet) an OC problem. If someone has found a solution or would know who should be contacted..... edit: I dropped firebird 2.04 and moved to 2.1.1, the latest, even if that version is not available for opensuse 10.3 (which I need). Those changes in ibase.h were there but I still had the same problem. I managed to get isc_sqlcode_s in the lib by tweaking one setup file used by make to expose functions in the libs. I can now use GPRE and cobc to compile the SQL code. When run, the program does not fall over anymore however I am not sure whether this is the correct approach..... L ---------------------------------------------------------------- hi, after a while, I have come back to this. Now, I can open a connection to the db but then I get error " -000000104" with text "invalid request BLR at offset 0", "unsupported BLR version (expected 4, encountered 0)". Any ideas ? wrong dialect, authorities ? Or is Opencobol incompatible with Firebird 2.1.1 (or viceversa) ?? bye L ---------------------------------------------------------------- I did some poking around. GPRE Firebird 2.0.4, packaged in Debian Lenny. firebird2.0-common, -server-common, -super, -dev Database created at localhost:/var/lib/firebird/2.0/data/test.fdb and test_table created with some 6 records. And then using the sample posted here. Yeah, I had the same initial isc_sqlcode_s problem; The signatures are different; isc_sqlcode_s(isc_status_vector, sqlcode) sqlcode = isc_sqlcode(isc_status_vector) So I changed the calls in the GPRE output from USING to RETURNING SQLCODE (as I didn't build Firebird from source). isc_attach_database is returning sqlcode -901. From the api doc -901 covers a shipload of different conditions. isc_print_status reports Invalid clumplet buffer structure: buffer end before end of clumplet - clumplet too long isc_print_sqlerror reports that it can't find the message array; I don't trust any of this info. :) Note; I get this same behaviour linking to either fbclient or fbembed. It seems we should talk with the Firebird engineers before spending too much more time on this one. Work with them to nail down a nice powerful open source solution to COBOL and SQL. The synergy between the two projects could be exponential. OR skip the niceties of GPRE and just write up Firebird API call idioms and the associated datastructures. BUT GPRE does make for some nice concise SQL EXEC embedding, so I think it'll be worth pursuing with the FB engineer team. Especially when we explain that OpenCOBOL will be thee COBOL soon :) ... and it may well ring true with their Open Source natures. It does seem very very close to functional; only the devil in the details to shake out. Decard, lfield08; Do you have any news? And lfield08 you'll need to decompose some of the ISC-1 or ISC-6 working store. See if the COBOL defs match the comments that describe the BLR structure in the GPRE output code. Cheers, Brian ---------------------------------------------------------------- I took a quick look at this. Basically gpre is terminally broken. What may work is if you have RM-COBOL and use the rm option on gpre. Using gpre in all variations (no option, ansi option, rm option) results in non-workable code for current compilers (OC, MF, ACU). What is needed is a rework/merging of src/gpre/cob.cpp and src/gpre/rmc.cpp A problem with these sources is that stuff is statically compiled in/out with #ifdef's instead of being options. eg. - #ifdef GIVING_SUPPORTED That's for support of GIVING/RETURNING on a CALL. (Incidentally, that is exactly where this "isc_sqlcode"/"isc_sqlcode_s" is coming from. Roger ---------------------------------------------------------------- Subject: Problem with PIC 9(8) COMP Hello, For testing comp with pic i did 2 simple loops in a program : IDENTIFICATION DIVISION. PROGRAM-ID. TESTCOMP. * ENVIRONMENT DIVISION. ************************* * CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. *************** DATA DIVISION. FILE SECTION. WORKING-STORAGE SECTION. 01 I-0 PIC 9(8) . 01 I-1 PIC 9(8) COMP. PROCEDURE DIVISION. PERFORM VARYING I-0 FROM 1 BY 1 UNTIL I-0 > 10 DISPLAY "I-0=" I-0 END-PERFORM. PERFORM VARYING I-1 FROM 1 BY 1 UNTIL I-1 > 10 DISPLAY "I-1=" I-1 END-PERFORM. FINI. STOP RUN RETURNING 0. This is the result i have : I-0=00000001 I-0=00000002 I-0=00000003 I-0=00000004 I-0=00000005 I-0=00000006 I-0=00000007 I-0=00000008 I-0=00000009 I-0=00000010 I-1=94967296 I-1=89934592 I-1=84901888 I-1=79869184 I-1=74836480 I-1=69803776 I-1=64771072 I-1=59738368 I-1=54705664 I-1=49672960 The platform is solaris 10/intel x86/gmp 4.2.1 (gmp.so.3.4.1 ) Please can you help me on this problem. Eric FYI: the c generated code is : /* Generated from test.cbl by cobc version 1.0 patch level 0 */ #define __USE_STRING_INLINES 1 #include #include #include #include #define WORDS_BIGENDIAN 1 #include #define COB_SOURCE_FILE "test.cbl" #define COB_PACKAGE_VERSION "1.0" #define COB_PATCH_LEVEL 0 /* function prototypes */ static int TESTCOMP_ (const int); int TESTCOMP (void); /* functions */ int TESTCOMP () { return TESTCOMP_ (0); } /* end functions */ static int TESTCOMP_ (const int entry) { #include "test.c.h" /* local variables */ static int initialized = 0; static cob_field *cob_user_parameters[COB_MAX_FIELD_PARAMS]; static cob_module module = { NULL, NULL, NULL, NULL, cob_user_parameters, 0, ',', '$', '.', 1, 1, 1, 0}; /* perform frame stack */ int frame_index; struct frame { int perform_through; int return_address; } frame_stack[255]; /* Start of function code */ if (unlikely(entry < 0)) { if (!initialized) { return 0; } initialized = 0; return 0; } module.next = cob_current_module; cob_current_module = &module; if (unlikely(initialized == 0)) { if (!cob_initialized) { cob_fatal_error (COB_FERROR_INITIALIZED); } cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); if (module.next) cob_set_cancel ((const char *)"TESTCOMP", (void *)TESTCOMP, (void *)TESTCOMP_); (*(int *) (b_1)) = 0; (*(int *) (b_2)) = 0; (*(int *) (b_3)) = 0; memset (b_5, 48, 8); memset (b_6, 0, 4); initialized = 1; } /* initialize frame stack */ frame_index = 0; frame_stack[0].perform_through = -1; /* initialize number of call params */ (*(int *) (b_3)) = cob_call_params; cob_save_call_params = cob_call_params; goto l_2; /* PROCEDURE DIVISION */ /* TESTCOMP: */ l_2:; /* MAIN SECTION: */ /* MAIN PARAGRAPH: */ /* test.cbl:35: PERFORM */ { own_memcpy (b_5, "00000001", 8); while (1) { if (((int)cob_cmp_numdisp (b_5, 8, 10) > 0)) break; { /* test.cbl:36: DISPLAY */ { cob_new_display (0, 1, 2, &c_1, &f_5); } } cob_add_int (&f_5, 1); } } /* test.cbl:39: PERFORM */ { (*(unsigned int *)(b_6)) = 1; while (1) { if (((int)cob_cmp_align_u32_binary (b_6, 10) > 0)) break; { /* test.cbl:40: DISPLAY */ { cob_new_display (0, 1, 2, &c_2, &f_6); } } cob_add_align_u32_binary (b_6, 1); } } /* FINI: */ /* test.cbl:44: STOP */ { cob_stop_run (0); } cob_current_module = cob_current_module->next; return (*(int *) (b_1)); PSWITCH: cob_fatal_error (COB_FERROR_CODEGEN); } /* end function stuff */ the c.h generated code is : /* Generated from test.cbl by cobc version 1.0 patch level 0 */ /* PROGRAM-ID : TESTCOMP */ static unsigned char b_1[4] __attribute__((aligned)); /* RETURN-CODE */ static unsigned char b_2[4] __attribute__((aligned)); /* SORT-RETURN */ static unsigned char b_3[4] __attribute__((aligned)); /* NUMBER-OF-CALL-PARAMETERS */ static unsigned char b_5[8] __attribute__((aligned)); /* I-0 */ static unsigned char b_6[4] __attribute__((aligned)); /* I-1 */ /* attributes */ static cob_field_attr a_1 = {33, 0, 0, 0, NULL}; static cob_field_attr a_2 = {16, 8, 0, 0, NULL}; static cob_field_attr a_3 = {17, 8, 0, 0, NULL}; /* fields */ static cob_field f_6 = {4, b_6, &a_3}; /* I-1 */ static cob_field f_5 = {8, b_5, &a_2}; /* I-0 */ /* constants */ static cob_field c_1 = {4, (unsigned char *)"I-0=", &a_1}; static cob_field c_2 = {4, (unsigned char *)"I-1=", &a_1}; /* ---------------------------------------------- */ ---------------------------------------------------------------- This looks weird. It thinks we are a big-endian machine. AFAIK, Solaris on x86 is little-endian. Look in config.h in OC's top level directory for WORDS_BIGENDIAN. If it's defined, can you send me "config.log". Then set up this test C prog as chkend.c [code] #include main() { union { int chkint; unsigned char chkchr[4]; } chkun; chkun.chkint = 0; chkun.chkchr[3] = 1; printf ("Val %d\n", chkun.chkint); } [/code] Compile and execute - cc chkend.c -o chkend ./chkend Roger ---------------------------------------------------------------- You are right about the big endian thing : i reran configuration and compilation of oc with ac...bigendian=no and that has resolved the problem. Thank you for your help. ---------------------------------------------------------------- Hold on. Do you mean you specifically had to set the ac..endian for the configure? If so, I need to know why the autoconf macros for this are not working on your box. I need the "config.log" from the non-working case. Can you also have a look at the system files /usr/include/sys/types.h /usr/include/sys/param.h Look for anything with BYTE_ORDER and/or ENDIAN. Roger ---------------------------------------------------------------- Theres is nothing about BYTE_ORDER and/or ENDIAN thing (except in param.h where the definitins of LO/HIBYTE and LO/HIWORD are different for BIG or LITTLE endian) in the include files. I sent you the config.log by email. Eric ---------------------------------------------------------------- Sorry, I did not get anything. Please be careful that the title does not contain anything that maybe suspect. Also the content. Roger ---------------------------------------------------------------- OK. Got the log. This shows there is an aborted/incomplete ncurses installation somwhere on the system. So, although a link with the ncurses lib succeeds, an attempt to execute does not. Unfortunately, we test this early in the configure process, so that, in this case the endian test bombs out. To prevent similar things happening, I have moved the lib checks (including curses) to later in the configure. This will NOT solve the problem here which is due to a misconfigured system. Roger ---------------------------------------------------------------- Subject: ALTER statement silently ignored The following program, compiled with cobc (OpenCOBOL) 1.0.0, goes into an endless loop. The generated C source shows that the ALTER statement does not have any effect. I do not insist that ALTER should be supported, but the compiler should issue some error instead of silently ignoring it. IDENTIFICATION DIVISION. PROGRAM-ID. "TEST01". PROCEDURE DIVISION. 010. GO TO 020. 020. ALTER 010 TO PROCEED TO 030. GO TO 010. 030. STOP RUN. ---------------------------------------------------------------- I fully agree. I will change this to a fatal error. ALTER was designated as obsolete in the 85 standard. Roger ---------------------------------------------------------------- Corrected. This will be correctly errored out. Roger ---------------------------------------------------------------- Subject: Print / Spool Hello. How can I can print my files to make them completely readable?? I tried [code]SELECT FACTURE ASSIGN TO PRINTER.[/code] but it throws that error [quote]libcob: Permanent file error (STATUS = 30) File : ''[/quote] thank you for your help ---------------------------------------------------------------- try : select facture assign to "printer" . . . and after executing your program cat printer C'est du pur jus ! Bear ---------------------------------------------------------------- Erm, what is this ? Roger ---------------------------------------------------------------- Actually what i want is a way to display ebcdic characters My result file mix EBCDIC and ASCII, so I cant convert (EBCDIC to ascii) the whole text at the same time.... ---------------------------------------------------------------- Then set up a table. This is classic Cobol programming :-) (No, I am not going to do your homework for you) Roger ---------------------------------------------------------------- Subject: Compile errors in fileio.c Upon performing the make step, numerous errors are detected in C module fileio.c. The compile ends with an error and installation does not proceed. The errors are quite numerous, so only the beginning portion will be shown: fileio.c:300: error: expected specifier-qualifier-list before 'DB' fileio.c: In function 'cob_sync': fileio.c:481: error: 'struct indexed_file' has no member named 'db' fileio.c:481: error: 'struct indexed_file' has no member named 'db' fileio.c:488: error: 'struct indexed_file' has no member named 'db' fileio.c:488: error: 'struct indexed_file' has no member named 'db' fileio.c: In function 'indexed_open': fileio.c:1505: error: 'struct indexed_file' has no member named 'db' fileio.c:1505: error: 'DB' undeclared (first use in this function) fileio.c:1505: error: (Each undeclared identifier is reported only once fileio.c:1505: error: for each function it appears in.) fileio.c:1505: error: expected expression before ')' token fileio.c:1510: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:1511: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:1512: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:1521: error: 'BTREEINFO' undeclared (first use in this function) fileio.c:1521: error: expected ';' before 'info' fileio.c:1554: error: 'info' undeclared (first use in this function) fileio.c:1556: error: 'R_DUP' undeclared (first use in this function) fileio.c:1567: error: 'struct indexed_file' has no member named 'db' fileio.c:1567: warning: implicit declaration of function 'dbopen' fileio.c:1567: error: 'DB_BTREE' undeclared (first use in this function) fileio.c:1568: error: 'struct indexed_file' has no member named 'db' fileio.c:1574: error: 'struct indexed_file' has no member named 'db' fileio.c:1574: error: 'struct indexed_file' has no member named 'db' This is on a Debian distro running kernel 2.6.21. Any ideas as to what the problem might be? I ran ldconfig prior to beginning the install. ---------------------------------------------------------------- Download 1.0 and RTFR :-) (Read The Fine README) :-) Roger ---------------------------------------------------------------- Roger, Many thanks. The problem was not that I did not read the README, but rather my poor eyesight (legally blind). I thought I saw a check in front of the required library libdb4.4-dev in Synaptic. I was wrong. ---------------------------------------------------------------- OK. But raises an interesting question. Why did the configure not pick this up? Roger ---------------------------------------------------------------- Subject: Variable length files and RDW size I am looking into using SyncSort to do sorting of flat files. In asking about variable length files, I found out that SyncSort will only handle a 2-byte RDW in Big-Endian as unsigned. I looked at the README and found a switch to control the setting of the RDW, but is always four bytes. --with-varseq= Is it practical for OC to read and write Variable length files with a 2 byte RDW (I'm sure it's possible, so I won't ask that). This would focus only on record sequential read and write. I'm looking through libcob/fileio.c at the sequential_* functions and kind of following. Thanks, Cris ---------------------------------------------------------------- You should be OK with the default. ie. --with-varseq=0. See the README. The default is 2 bytes big-endian followed by 2 slack bytes. The length always includes the length (and slack bytes). AFAIK, this works fine with SyncSort. You also might want to use Cobol SORT to do this. The OC SORT is very fast :-) (As of OC 1.0, which uses a list/merge technique) Roger ---------------------------------------------------------------- I asked SyncSort about it but they insisted that it will only handle 2 bytes (it's actually DMExpress that we are looking at). I'm not sure how the two slack bytes will be handled. We are installing a trial, and will be one of the first tests that we run. I did look at using the SORT verb. Performance was not the main issue. The big issue is that we have over 60 sort jobs, so each would need to be turned into Cobol programs. Some are also doing OUTREC and OUTFIL processing. We having existing mfsort parm cards which will fairly easily convert over. Cris ---------------------------------------------------------------- Well, we cover the known variations of mainframe/early MF as regards variable length. Later MF incarnations put a 128 byte header in there. It is on the TODO list to provide an "ocsort". If you have suggestions, then post. Roger ---------------------------------------------------------------- Roger, I remember the ocsort discussions, as I asked the question that started it all. ocsort would be great, but like many managers, they want a solution yesterday. I'll dust off my notes and put something together. I believe there were some that kind of looked at on the mail list but I never saw much past the initial emails (back in July). Cris ---------------------------------------------------------------- Maybe, I am trying to find particularly difference between MF and OC. I am still trying to get 1.0 out of the door. Managers can wait. I will do what I can. Roger ---------------------------------------------------------------- For this, there really isn't a different between MF and OC to look for, as it now becomes specificly what a separate third-party product is looking for in an input file. I'll know more when I get SyncSort installed to see if it truely only handles 2 bytes. I've been watching for 1.0 to come out. This can wait until after that, and I'll just tell my managers it's coming (or better yet we can try to adjust the code for our needs and send it in ;) - Give me a chance to really break some code. Looking at the code, I'm thinking of adding a type 3 for 2 bytes and then work to get the code in the sequential_read and sequential_write functions. Thanks Cris ---------------------------------------------------------------- Roger, I think I know where I am getting off track and why I was confused. Looking at some test files, I am seeing 00 00 03 e8 for a 1000 byte record. From your statement, I was expecting to see 03 e8 00 00 (I found some mainframe doc, as I had never heard of the length being like this). Looking in the config.log I found that WITH_VARSEQ is being set to 1. Looking at the configure I can not find anywhere where the argument value passed with -with-varseq is ever used. I suspect that this statement should be using a variable. cat >>confdefs.h <<\_ACEOF #define WITH_VARSEQ 1 _ACEOF Cris ---------------------------------------------------------------- Aaagh, yes, indeed. There is a blooper in the configure. (Actually configure.ac) Now fixed and tarball updated. ** WARNING ** WITH_VARSEQ is now correctly defaulted to 0. This means that variable length files are incompatible with previous releases. If you want to retain compatibility and use files created with previous releases, specify --with-varseq=1 to the configure. Roger ---------------------------------------------------------------- Subject: OpenCOBOL 1.0 OpenCOBOL 1.0 has been released. This release covers most of the syntax from the 85 standard as well as including features from MF, ACU and the 2002 standard. Further info can be obtained by looking at the ChangeLog files at top level and sub-directories. Roger ---------------------------------------------------------------- Subject: Season's greetings and a happy new year I wish all a happy and successful new year. Thank you very much for the feedback and support and I hope that this will continue into the new year. Roger (And from Keisuke) ---------------------------------------------------------------- Subject: file section Hi, in my cobol source there is: DATA DIVISION. FILE SECTION. FD Entryplist LABEL RECORD IS STANDARD VALUE OF FILE-ID IS "Entryptxt" DATA RECORD IS listarpg-REC. when I try to compile with cobc , I recive this error referred to line with the word FILE-ID: syntax error , unexpected VALUE, expecting EXTERNAL or GLOBAL Why? wher I can find the complet user/reference manual ? thanks ---------------------------------------------------------------- The VALUE OF clause was declared obsolete in the 85 standard. MF accepts it as should OC. However, there is a bug in OC causing the syntax failure. This has been fixed in the 1.1 prerelease - download link on main page. So - # cobc --version cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2007 Keisuke Nishida Copyright (C) 2007 Roger While # # cobc -x ext3.cob # # cobc -x -Wall ext3.cob ext3.cob:18: Warning: VALUE OF is obsolete in OpenCOBOL # # cobc -x -Wall -std=cobol85 ext3.cob ext3.cob:18: Warning: VALUE OF is obsolete in COBOL 85 # # cobc -x -Wall -std=cobol2002 ext3.cob ext3.cob:18: Error: VALUE OF does not conform to COBOL 2002 # Roger ---------------------------------------------------------------- thanks, but now, with the 1.1 prerelease, there are other errors in SELECT: janilo@ununtu704:-/XcvtAStoJ/cvastoj_src$ cobc -v :obc (OpenCOBOL) 1.1.0 :opyright (C) 2001-2007 Keisuke Nishida :opyright (C) 2007 Roger While janilo@ununtu704:-/XcvtAStoJ/cvastoj_src$ cobc -x -Wall -std=cobol85 crt000.cbl :rt000.cbl:8: Warning: AUTHOR is obsolete in COBOL 85 :rt000.cbl:9: Warning: DATE-WRITTEN is obsolete in COBOL 85 :rt000.cbl:23: Error: syntax error, unexpected ORGANIZATION, expecting WORD or L [TERAL or DISPLAY janilo@ununtu704:-/XcvtAStoJ/cvastoj_src$ cobc -x -Wall -std=mf crt000.cbl :rt000.cbl:8: Warning: AUTHOR is obsolete in Micro Focus COBOL :rt000.cbl:9: Warning: DATE-WRITTEN is obsolete in Micro Focus COBOL :rt000.cbl:23: Error: syntax error, unexpected ORGANIZATION, expecti~g WORD or L [TERAL or DISPLAY janilO@ununtu704:-/XcvtAStoJ/cvastoj src$ cobc -x -Wall -std=mvs crt000.cbl :rt000.cbl:8: Warning: AUTHOR is obsolete in IBM COBOL for MVS & VM :rt000.cbl:9: Warning: DATE-WRITTEN is obsolete in IBM COBOL for MVS & VM :rt000.cbl:23: Error: syntax error, unexpected ORGANIZATION, expecting WORD or L [TERAL or DISPLAY janilo@ununtu704:-/XcvtAStoJ/cvastoj src$ cobc -x -Wall -std=ibm crt000.cbl :rt000.cbl:8: Warning: AUTHOR is obsolete in IBM COBOL :rt000.cbl:9: Warning: DATE-WRITTEN is obsolete in IBM COBOL :rt000.cbl:23: Error: syntax error, unexpected ORGANIZATION, expecting WORD or L [TERAL or DISPLAY janilo@ununtu704:-/XcvtAStoJ/cvastoj_src$ IDENTIFICATION DIVISION. PROGRAM-ID. crt000. ************************************************************************* * * CREAZIONE application java * ************************************************************************* AUTHOR. rosso. DATE-WRITTEN. nov 1999. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. w95. OBJECT-COMPUTER. w95. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT Entryplist ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-STAT-Entryplist. SELECT errori ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-STAT-errori. SELECT ambiente ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-STAT-ambiente. SELECT srcrpg ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-STAT-srcrpg. SELECT tabwrks ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-STAT-tabwrks. SELECT tabwrk ASSIGN TO DISK ORGANIZATION IS indexed ACCESS MODE IS DYNAMIC RECORD KEY IS iflk-wrk ALTERNATE RECORD KEY IS nci-wrk WITH DUPLICATES FILE STATUS IS WS-STAT-tabwrk. DATA DIVISION. FILE SECTION. FD Entryplist LABEL RECORD IS STANDARD VALUE OF FILE-ID IS "Entryp.txt" DATA RECORD IS listarpg-REC. 01 Entryplist-REC. 05 parametro pic x(10). ******etc.****etc.*****etc***** this program run fine under DOS with microsoft cobol and also under AIX/6000 with vs cobol compiler/6000. ---------------------------------------------------------------- DISK is a reserved word. Roger ---------------------------------------------------------------- thanks for your reply, but was not correct: yes, DISK is a reserved word but not for all cobol dialects. below there is a little example what i find in the web, where DISK is used. Ch 3_1. DATA DIVISION FILE SECTION * Describes Input/Output formats to be used by the program IDENTIFICATION DIVISION. PROGRAM-ID. COPY-THE-FIRTST-RECORD. ENVIRONMENT SECTION. SOURCE-COMPUTER. VAX-8800. OBJECT-COMPUTER. VAX-8800. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT F1 ASSIGN TO DISK 'TST.DAT' ORGANIZATION IS LINE SEQUENTIAL. SELECT F2 ASSIGN TO DISK 'TST.RES' ORGANIZATION IS LINE SEQUENTIAL. DATA DIVISION. FILE SECTION. FD F1 RECORD CONTATINS 35 CHARACTERS. 01 INPUT-REC. 03 NAME. 05 LAST-NAME PIC X(10). 05 FIRST-NAME PIC X(10). 03 SSN PIC X(9). 03 DOB-YYMMDD PIC X(6). FD F2 RECORD CONTATINS 35 CHARACTERS. 01 OUTPUT-REC PIC X(35). below there is sample from IBM manual COBOL_PRG_GUIDE_QB3AG402: 769CB1 V4R4M0 990521 LN IBM ILE COBOL for AS/400 TESTLIB/SAMPLE AS400SYS 98/11/20 16:46:03 Page 4 STMT PL SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN S COPYNAME CHG DATE A B C D E F 1 000030 IDENTIFICATION DIVISION. 2 000050 PROGRAM-ID. SAMPLE. 3 000060 AUTHOR. PROGRAMMER NAME. 4 000070 INSTALLATION. COBOL DEVELOPMENT CENTRE. 5 000080 DATE-WRITTEN. 02/24/94. 6 000090 DATE-COMPILED. 98/11/20 16:46:03 7 000110 ENVIRONMENT DIVISION. 8 000130 CONFIGURATION SECTION. 9 000140 SOURCE-COMPUTER. IBM-AS400. 10 000150 OBJECT-COMPUTER. IBM-AS400. 11 000170 INPUT-OUTPUT SECTION. 12 000180 FILE-CONTROL. 13 000190 SELECT FILE-1 ASSIGN TO DISK-SAMPLE. 15 000210 DATA DIVISION. 16 000230 FILE SECTION. 17 000240 FD FILE-1 000250 LABEL RECORDS ARE STANDARD and also the clause ORGANIZATION is accepted: Display Module Source Program: MYPGM1 Library: TESTLIB Module: MYPGM1 1 IDENTIFICATION DIVISION. 2 PROGRAM-ID. MYPGM1. 3 * 4 * This is the main program that controls 5 * the external file processing. 6 * 7 8 ENVIRONMENT DIVISION. 9 INPUT-OUTPUT SECTION. 10 FILE-CONTROL. 11 SELECT EF1 12 ASSIGN TO DISK-EFILE1 13 FILE STATUS IS EFS1 14 ORGANIZATION IS SEQUENTIAL. 15 and there is a sample from AIX/6000 IDENTIFICATION DIVISION. PROGRAM-ID. CRTDTAAR. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. RISC6000. OBJECT-COMPUTER. RISC6000. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT SBWARDLA ASSIGN TO DISK ORGANIZATION IS INDEXED ACCESS MODE IS DYNAMIC RECORD KEY IS BWNOM0 STATUS IS SBWST. DATA DIVISION. FILE SECTION. FD SBWARDLA VALUE OF FILE-ID IS 'SBWARDF0.DAT' DATA RECORD BWARD-REC. 01 BWARD-REC. 05 BWNOM0 PIC X(10). 05 BWDAT0 PIC X(512). So, during all mine experience with cobol, always I have used the clause ASSIGN TO DISK and ORGANIZATION IS without problems. ---------------------------------------------------------------- Note the difference in your examples. 1) SELECT F1 ASSIGN TO DISK 'TST.DAT' That's fine. 2) SELECT FILE-1 ASSIGN TO DISK-SAMPLE. That's also fine. Refers to a (possibly implicit) field. 3) SELECT SBWARDLA ASSIGN TO DISK This is not OK. MF, ACU and OC compile (1) and (2) fine. None will compile (3). Roger ---------------------------------------------------------------- Hi, probably you have good reasons but my compilers on DOS or AS400 are not agree whit you. cobol crtcab.cbl,,crtcab.lst >xcobc09.txt Microsoft (R) COBOL Optimizing Compiler Version 3.00A COBOL software by Micro Focus Copyright (C) Microsoft Corporation 1984,1988. All rights reserved. Copyright (C) Micro Focus Ltd. 1984,1988. All rights reserved. Object listing [NUL.GRP]: * Checking complete with no errors - starting code generation * Data = 000006417 Code = 000007926 Dictionary = 000015727 Il volume nell'unit C non ha etichetta. Numero di serie del volume: 2B49-1EDD dir crtcab.* >>xcobc09.txt Directory di C:\CVASTO~1 22/08/2006 19.36 24.774 crtcab.cbl 05/01/2008 11.00 11.008 CRTCAB.OBJ 05/01/2008 11.00 29.648 CRTCAB.LST 3 File 65.430 byte 0 Directory 238.345.977.856 byte disponibili * Microsoft COBOL Version 3.00A L2.0 revision 054 05-Jan-08 11:00 Page 1 * CRTCAB.CBL * Options: GNT(CRTCAB.OBJ) LIST(CRTCAB.LST) NOASMLIST 1 IDENTIFICATION DIVISION. 2 PROGRAM-ID. crtcab. 11 AUTHOR. rosso. 12 DATE-WRITTEN. nov 1999. 13 ENVIRONMENT DIVISION. 14 15 CONFIGURATION SECTION. 16 SOURCE-COMPUTER. w95. 17 OBJECT-COMPUTER. w95. 18 19 SPECIAL-NAMES. DECIMAL-POINT IS COMMA. 20 21 INPUT-OUTPUT SECTION. 22 FILE-CONTROL. 23 24 SELECT ambiente ASSIGN TO DISK 25 ORGANIZATION IS LINE SEQUENTIAL 26 FILE STATUS IS WS-STAT-ambiente. 27 28 SELECT listarpg ASSIGN TO DISK 29 ORGANIZATION IS LINE SEQUENTIAL 30 FILE STATUS IS WS-STAT-listarpg. 31 32 SELECT listafmt ASSIGN TO DISK 33 ORGANIZATION IS LINE SEQUENTIAL 34 FILE STATUS IS WS-STAT-listafmt. 35 36 SELECT srcrpg ASSIGN TO DISK 37 ORGANIZATION IS LINE SEQUENTIAL 38 FILE STATUS IS WS-STAT-srcrpg. 39 40 SELECT srcrpgo ASSIGN TO DISK 41 ORGANIZATION IS LINE SEQUENTIAL 42 FILE STATUS IS WS-STAT-srcrpgo. 43 44 SELECT mdsrcj ASSIGN TO DISK 45 ORGANIZATION IS LINE SEQUENTIAL 46 FILE STATUS IS WS-STAT-mdsrcj. 47 49 DATA DIVISION. 51 FILE SECTION. 53 54 FD listarpg LABEL RECORD IS STANDARD 55 VALUE OF FILE-ID IS "listarpg.txt" 56 DATA RECORD IS listarpg-REC. 57 01 listarpg-REC. * Microsoft COBOL Version 3.00A L2.0 revision 054 05-Jan-08 11:00 Page 2 * CRTCAB.CBL 58 10 WHFILE. 59 15 primicar. 60 17 filler pic x. 61 17 whfuno pic x. 62 15 restocar. 63 17 filler pic x(4). 64 17 whfSET pic x. 70 17 filler pic x(3). 71 15 filler pic x(40). 72 73 FD listafmt LABEL RECORD IS STANDARD 74 VALUE OF FILE-ID IS "listafmt.txt" 75 DATA RECORD IS listafmt-REC. 76 77 01 listafmt-REC. 78 10 nomevideo pic x(10). 79 10 nomepgm pic x(10). 80 10 filler pic x(80). 81 82 FD srcrpgo LABEL RECORD IS STANDARD 83 VALUE OF FILE-ID IS nome-srcrpgo 90 DATA RECORD IS srcrpgo-REC. 91 01 srcrpgo-REC. 92 05 filler pic x(100). 93 94 FD srcrpg LABEL RECORD IS STANDARD 95 VALUE OF FILE-ID IS nome-srcrpg 96 DATA RECORD IS srcrpg-REC. 97 01 srcrpg-REC. 98 05 filler pic x(100). 99 100 FD mdsrcj LABEL RECORD IS STANDARD 101 VALUE OF FILE-ID IS nome-mdsrcj 102 DATA RECORD IS mdsrcj-REC. 103 01 mdsrcj-REC. 104 105 05 filler pic x(100). 108 FD ambiente LABEL RECORD IS STANDARD 109 VALUE OF FILE-ID IS "ambiente.txt" 110 DATA RECORD IS ambiente-REC. 111 112 01 ambiente-REC. 113 05 creads. 114 12 filler pic x(4). 115 12 nomeamb pic x(100). * Microsoft COBOL Version 3.00A L2.0 revision 054 05-Jan-08 11:00 Page 3 * CRTCAB.CBL ***************************************************************** etc etc etc ***************************************************************** 773 * Microsoft COBOL Version 3.00A L2.0 revision 054 * (C)Copyright Microsoft Corp 1984, 1988 URN AXUPA/MS0/40640 * REF GNB-007047054A4 * * Total Messages: 0 * Data: 6364 Code: 3609 Dictionary: 4800 On AS/400, there are little differences regarding the position of SELECT word that on AS must be in col. B. 0000.53 12 002300 SELECT ambiente ASSIGN TO DISK 05/01/08 0000.54 13 002400 ORGANIZATION IS SEQUENTIAL 05/01/08 0000.55 14 002500 FILE STATUS IS WS-STAT-ambiente. 0008.43 * * * * * E N D O F S O U R C E * * * * * 0008.44 5763CB1 V3R2M0 960517 AS/400 COBOL Messages DANILO/CRTCAB S4409058 05/01/08 14:13:43 0008.45 STMT 0008.46 * 12 MSGID: LBL0010 SEVERITY: 10 SEQNBR: 002300 0008.47 Message . . . . : 'SELECT' invalid in Area A. Accepted as if 0008.48 in Area B. 5763CB1 V3R2M0 960517 IBM COBOL/400 DANILO/CRTCAB S4409058 05/01/08 Program . . . . . . . . . . . . . . : CRTCAB Library . . . . . . . . . . . . . : DANILO Source file . . . . . . . . . . . . : QCBLSRC Library . . . . . . . . . . . . . : DANILO Source member . . . . . . . . . . . : CRTCAB 05/01/08 11:27:11 Generation severity level . . . . . : 29 Text 'description' . . . . . . . . . : *BLANK Source listing options . . . . . . . : *NONE Generation options . . . . . . . . . : *NONE Conversion options . . . . . . . . . : *NONE Sort sequence . . . . . . . . . . . : *HEX Library . . . . . . . . . . . . . : Language identifier . . . . . . . . : *JOBRUN Message limit: Number of messages . . . . . . . . : *NOMAX Message limit severity . . . . . . : 29 Print file . . . . . . . . . . . . . : QSYSPRT Library . . . . . . . . . . . . . : *LIBL FIPS flagging . . . . . . . . . . . : *NOFIPS *NOSEG *NODEB *NOOBSOLETE SAA flagging . . . . . . . . . . . . : *NOFLAG Extended display options . . . . . . : *NONE Flagging severity . . . . . . . . . : 0 Replace program . . . . . . . . . . : *NO Target release . . . . . . . . . . . : *CURRENT User profile . . . . . . . . . . . . : *USER Authority . . . . . . . . . . . . . : *LIBCRTAUT Compiler . . . . . . . . . . . . . . : IBM COBOL/400 5763CB1 V3R2M0 960517 AS/400 COBOL Source DANILO/CRTCAB S4409058 05/01/08 STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN S COPYNAME CHG 1 000100 IDENTIFICATION DIVISION. 2 000200 PROGRAM-ID. crtcab. 3 001000 AUTHOR. rosso. 4 001100 DATE-WRITTEN. nov 1999. 5 001200 ENVIRONMENT DIVISION. 001300 6 001400 CONFIGURATION SECTION. 7 001500 SOURCE-COMPUTER. w95. 8 001600 OBJECT-COMPUTER. w95. 001700 9 001800 SPECIAL-NAMES. DECIMAL-POINT IS COMMA. 001900 10 002000 INPUT-OUTPUT SECTION. 11 002100 FILE-CONTROL. 002200 12 002300 SELECT ambiente ASSIGN TO DISK 05/0 13 002400 ORGANIZATION IS SEQUENTIAL 05/0 14 002500 FILE STATUS IS WS-STAT-ambiente. 002600 15 002700 SELECT listarpg ASSIGN TO DISK 05/0 16 002800 ORGANIZATION IS SEQUENTIAL 05/0 17 002900 FILE STATUS IS WS-STAT-listarpg. 003000 18 003100 SELECT listafmt ASSIGN TO DISK 05/0 19 003200 ORGANIZATION IS SEQUENTIAL 05/0 20 003300 FILE STATUS IS WS-STAT-listafmt. 003400 21 003500 SELECT srcrpg ASSIGN TO DISK 05/0 22 003600 ORGANIZATION IS SEQUENTIAL 05/0 23 003700 FILE STATUS IS WS-STAT-srcrpg. 003800 24 003900 SELECT srcrpgo ASSIGN TO DISK 05/0 25 004000 ORGANIZATION IS SEQUENTIAL 05/0 26 004100 FILE STATUS IS WS-STAT-srcrpgo. 004200 27 004300 SELECT mdsrcj ASSIGN TO DISK 05/0 28 004400 ORGANIZATION IS SEQUENTIAL 05/0 29 004500 FILE STATUS IS WS-STAT-mdsrcj. 004600 004700 30 004800 DATA DIVISION. 004900 31 005000 FILE SECTION. 005100 005200 32 005300 FD listarpg LABEL RECORD IS STANDARD 33 005400 VALUE OF FILE-ID IS "listarpg.txt" 34 005500 DATA RECORD IS listarpg-REC. 5763CB1 V3R2M0 960517 AS/400 COBOL Source DANILO/CRTCAB S4409058 05/01/08 STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN S COPYNAME CHG 35 005600 01 listarpg-REC. 36 005700 10 WHFILE. 37 005800 15 primicar. 38 005900 17 filler pic x. 39 006000 17 whfuno pic x. 40 006100 15 restocar. 41 006200 17 filler pic x(4). 42 006300 17 whfSET pic x. 43 006900 17 filler pic x(3). 44 007000 15 filler pic x(40). 007100 45 007200 FD listafmt LABEL RECORD IS STANDARD 46 007300 VALUE OF FILE-ID IS "listafmt.txt" 47 007400 DATA RECORD IS listafmt-REC. 007500 48 007600 01 listafmt-REC. 49 007700 10 nomevideo pic x(10). 50 007800 10 nomepgm pic x(10). 51 007900 10 filler pic x(80). 008000 52 008100 FD srcrpgo LABEL RECORD IS STANDARD 53 008200 VALUE OF FILE-ID IS nome-srcrpgo 008300 54 008900 DATA RECORD IS srcrpgo-REC. 55 009000 01 srcrpgo-REC. 56 009100 05 filler pic x(100). 009200 57 009300 FD srcrpg LABEL RECORD IS STANDARD 58 009400 VALUE OF FILE-ID IS nome-srcrpg 59 009500 DATA RECORD IS srcrpg-REC. 60 009600 01 srcrpg-REC. 61 009700 05 filler pic x(100). 009800 62 009900 FD mdsrcj LABEL RECORD IS STANDARD 63 010000 VALUE OF FILE-ID IS nome-mdsrcj 64 010100 DATA RECORD IS mdsrcj-REC. 65 010200 01 mdsrcj-REC. 010300 66 010400 05 filler pic x(100). 010500 010600 67 010700 FD ambiente LABEL RECORD IS STANDARD 68 010800 VALUE OF FILE-ID IS "ambiente.txt" 69 010900 DATA RECORD IS ambiente-REC. 011000 5763CB1 V3R2M0 960517 AS/400 COBOL Source DANILO/CRTCAB S4409058 05/01/08 STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN S COPYNAME CHG 70 011100 01 ambiente-REC. 71 011200 05 creads. 72 011300 12 filler pic x(4). 73 011400 12 nomeamb pic x(100). ******************************************************************** etc etc etc ******************************************************************** * * * * * E N D O F S O U R C E * * * * * 5763CB1 V3R2M0 960517 AS/400 COBOL Messages DANILO/CRTCAB S4409058 05/01/08 STMT * 32 MSGID: LBL0650 SEVERITY: 00 SEQNBR: 005300 Message . . . . : Blocking/Deblocking for file 'LISTARPG' will be performed by compiler-generated code. ******************************************************************** etc etc etc ******************************************************************** * * * * * E N D O F M E S S A G E S * * * * * Message Summary Total Info(0-4) Warning(5-19) Error(20-29) Severe(30-39) Terminal(40-99) 60 6 51 3 0 0 Source records read . . . . . . . . : 784 Copy records read . . . . . . . . . : 0 Copy members processed . . . . . . : 0 Sequence errors . . . . . . . . . . : 0 Highest severity message issued . . : 20 LBL0901 00 Program CRTCAB created in library DANILO on 05/01/08 11:27:53. * * * * * E N D O F C O M P I L A T I O N * * * * * Actually I can not try on AIX/6000 or other unix hardware, but please believe me, all my sources cobol whit the select like this are ok. Now on ubuntu with cobc (the same source that AS400): danilo@ununtu704:-/XcvtAStoJ/cvastoj_src$ cobc -x -std=mf crtcab3.cbl crtcab3.cbl:24: Error: syntax error, unexpected ORGANlZATION, expecting WORD or LITERAL or DISPLAY danilo@ununtu704:-/XcvtAStoJ/cvastoj_src$ the error is always the same, but with the option -free, there is a different error: danilo@ununtu704:-/XcvtAStoJ/cvastoj_src$ cobc -x -std=mf -free crtcab3.cbl crtcab3.cbl:359: Error: syntax error danilo@ununtu704:-/XcvtAStOJ/cvastoj_src$ I the line 359 is a comment: *----------------------------------------------------------------- * CHIUSURA ARCHIVI *----------------------------------------------------------------- INIZIO-CLOSE. CLOSE srcrpg srcrpgo mdsrcj listarpg listafmt. FINE-CLOSE. EXIT. *----------------------------------------------------------------- * ELABORAZIONE ARCHIVIO PER CREAZIONE COPY 359 *----------------------------------------------------------------- INIZIO-ELAB. thanks for your courtesy Danilo ---------------------------------------------------------------- In free-format, the '*' is not, on it's own, a comment. In free format a comment area is indicated by "*>". Roger ---------------------------------------------------------------- And since day 1 of COBOL, the asterisk '*' is in column 7. (Fixed format) Compatibly for comments,re fixed/free - then columns 1-6 should be spaces and columns 7-8 should contain '*>'. Roger ---------------------------------------------------------------- Ok sorry, but this not solve my first problem: danilo@ununtu704:-/XcvtAStoJ/cvastoj_src$ cobc -x -std=mf crtcab3.cbl crtcab3.cbl:24: Error: syntax error, unexpected ORGANlZATION, expecting WORD or LITERAL or DISPLAY danilo@ununtu704:-/XcvtAStoJ/cvastoj_src$ cobc accept the standard cobol syntax like Micro Focus ? yes or yes but not fully? The -free option doesn't interest me , but only out of curriosity: whi the '*' used for comment is checked out only at line 359 and not at the precedent lines? *----------------------------------------------------------------- * CHIUSURA ARCHIVI *----------------------------------------------------------------- INIZIO-CLOSE. CLOSE srcrpg srcrpgo mdsrcj listarpg listafmt. FINE-CLOSE. EXIT. *----------------------------------------------------------------- * ELABORAZIONE ARCHIVIO PER CREAZIONE COPY 359 *----------------------------------------------------------------- INIZIO-ELAB. Happy New Year ---------------------------------------------------------------- I know, was a mistake during the paste, I believe you can understand alone, because in the postlist there are 0 errors * Microsoft COBOL Version 3.00A L2.0 revision 054 * (C)Copyright Microsoft Corp 1984, 1988 URN AXUPA/MS0/40640 * REF GNB-007047054A4 * * Total Messages: 0 * Data: 6364 Code: 3609 Dictionary: 4800 Message Summary Total Info(0-4) Warning(5-19) Error(20-29) Severe(30-39) Terminal(40-99) 60 6 51 3 0 0 Source records read . . . . . . . . : 784 Copy records read . . . . . . . . . : 0 Copy members processed . . . . . . : 0 Sequence errors . . . . . . . . . . : 0 Highest severity message issued . . : 20 LBL0901 00 Program CRTCAB created in library DANILO on 05/01/08 11:27:53. * * * * * E N D O F C O M P I L A T I O N * * * * * Bye Bye ---------------------------------------------------------------- While that is NOT standard COBOL syntax! Roger ---------------------------------------------------------------- While we do try to put in features that are MF/ACU specificic, there comes a time when I say no. This is one of them. Roger ---------------------------------------------------------------- Actually, as the changes are fairly minimal, I have implemented ASSIGN DISK combined with FILE-ID. Pick up the latest 1.1 tarball. Roger ---------------------------------------------------------------- Subject: Finding Dead Code Does anyone have any suggestions for identifying dead code in a large COBOL project? I have read some other forums where folks suggest that some compilers automatically eliminate dead code. I am also looking for hints on getting familiar with the code in a large project. ---------------------------------------------------------------- I remember when MicroFocus introduced their COBOL Animator product. It was the first time I was able to watch code in action. Now these tools are available in many compilers. I have always found this a good way to understand what a program is doing. Good luck! ---------------------------------------------------------------- Does someone has anything similar for OC? You could write a cobol program for dead code, doing the following: 1. Open the list file 2. Search for all section names 3. Search if there is a perform on all sections 4. Search if the section is hidden in a copy file - if yes: Are all sections of this copy not used: give an output "COPY XYZ can be removed from TEST.CBL" - if not give an output "Section XYZ can be removed from TEST.CBL" 5. Search for all defined vars 6. Search if the vars from level 77 and 78 are used and if the level 01 or underlying levels are used. 7. Search if the section is hidden in a copy file - if yes: Are all vars of this copy not used: give an output "COPY XYZ can be removed from TEST.CBL" - if not give an output "Definition of XYZ can be removed from TEST.CBL" 8. Have a look if the lines are only comments for all searches mentioned above. And there you go! (I would test your program but do not have the need to write it for my own). PS: The named link "Visustin Flow chart generator" in link area does not work for my projects very well, maybe there are other (free?) tools to visualize Cobol Code. ---------------------------------------------------------------- Problem is that COBOL allows you to call a procedure-pointer which is not determinable. Roger ---------------------------------------------------------------- What does this look like? ---------------------------------------------------------------- procedure-pointer. Roger ---------------------------------------------------------------- A new (to OC) product has been uploaded onto OC site subject to Roger making it avail that will cross reference cobol source programs/ This will help in finding code ie sections, variables etc that are defined but not used. This will be a step in the right direction for your requirements. ---------------------------------------------------------------- What OC site do you mean? SF does not contain anything like that? For everybody who does not know what a procedure-pointer is, it seems to be some special MF/COB370 thing: http://supportline.microfocus.com/documentation/books/nx50/lhclan.htm#u945 ---------------------------------------------------------------- Does anybody know something about the program that "has been uploaded"? ---------------------------------------------------------------- Subject: opencobol on arch=powerpc hi, I have installed opencobol 1.0 in my apple-mini-ppc but at DISPLAY I have: Illegal instruction can you help me ? ---------------------------------------------------------------- How about posting/sending "config.log". Roger ---------------------------------------------------------------- As we generate C code and pass that to the C compiler, I don't think that this is an OC problem. Try generating to C code and post. Roger ---------------------------------------------------------------- * Sample COBOL program IDENTIFICATION DIVISION. PROGRAM-ID. hello. PROCEDURE DIVISION. DISPLAY "Hello World!". STOP RUN. this is source what have I to try ? thanks ---------------------------------------------------------------- this is hello.s .file "cob12607_0.c" .section ".text" .align 2 .type hello_, @function hello_: cmpwi 7,3,0 stwu 1,-32(1) mflr 0 stw 26,8(1) stw 27,12(1) stw 28,16(1) stw 29,20(1) stw 30,24(1) stw 31,28(1) stw 0,36(1) blt- 7,.L16 lis 27,.LANCHOR0@ha lis 9,cob_current_module@ha lwz 28,.LANCHOR0@l(27) lis 31,.LANCHOR1@ha la 30,.LANCHOR0@l(27) lwz 0,cob_current_module@l(9) la 26,.LANCHOR1@l(31) addi 11,30,16 cmpwi 7,28,0 stw 26,cob_current_module@l(9) addi 29,30,32 stw 0,.LANCHOR1@l(31) beq- 7,.L17 .L8: .L13: lis 9,cob_call_params@ha li 3,0 lwz 0,cob_call_params@l(9) lis 9,cob_save_call_params@ha addi 6,26,28 li 4,1 li 5,1 stw 0,cob_save_call_params@l(9) stw 0,0(11) crxor 6,6,6 bl cob_new_display lwz 3,0(29) bl cob_stop_run .L16: lis 9,.LANCHOR0@ha lwz 0,.LANCHOR0@l(9) cmpwi 7,0,0 beq- 7,.L4 li 0,0 stw 0,.LANCHOR0@l(9) .L4: lwz 0,36(1) li 3,0 lwz 26,8(1) lwz 27,12(1) mtlr 0 lwz 28,16(1) lwz 29,20(1) lwz 30,24(1) lwz 31,28(1) addi 1,1,32 blr .L17: lis 9,cob_initialized@ha lwz 0,cob_initialized@l(9) cmpwi 7,0,0 beq- 7,.L18 lis 3,.LC0@ha lis 4,.LC1@ha la 3,.LC0@l(3) la 4,.LC1@l(4) li 5,0 bl cob_check_version lwz 0,.LANCHOR1@l(31) cmpwi 7,0,0 beq- 7,.L11 lis 3,.LC2@ha lis 4,hello@ha lis 5,hello_@ha la 3,.LC2@l(3) la 4,hello@l(4) la 5,hello_@l(5) bl cob_set_cancel .L11: li 0,1 addi 29,30,32 stw 28,16(30) addi 11,30,16 stw 0,.LANCHOR0@l(27) stw 28,32(30) stw 28,48(30) b .L8 .L18: li 3,0 bl cob_fatal_error .size hello_, .-hello_ .align 2 .globl hello .type hello, @function hello: li 3,0 b hello_ .size hello, .-hello .section ".data" .align 2 .set .LANCHOR1,. + 0 .type module.6231, @object .size module.6231, 28 module.6231: .long 0 .long 0 .long 0 .long 0 .long cob_user_parameters.6230 .byte 0 .byte 46 .byte 36 .byte 44 .byte 1 .byte 1 .byte 1 .byte 0 .type c_1.6228, @object .size c_1.6228, 12 c_1.6228: .long 12 .long .LC3 .long a_1.6227 .type a_1.6227, @object .size a_1.6227, 8 a_1.6227: .byte 33 .byte 0 .byte 0 .byte 0 .long 0 .section .rodata.str1.4,"aMS",@progbits,1 .align 2 .LC0: .string "hello.cob" .zero 2 .LC1: .string "1.0" .LC2: .string "hello" .zero 2 .LC3: .string "Hello World!" .section ".bss" .align 4 .set .LANCHOR0,. + 0 .type initialized.6229, @object .size initialized.6229, 4 initialized.6229: .zero 4 .zero 12 .type b_3.6226, @object .size b_3.6226, 4 b_3.6226: .zero 4 .zero 12 .type b_1.6224, @object .size b_1.6224, 4 b_1.6224: .zero 4 .zero 12 .type b_2.6225, @object .size b_2.6225, 4 b_2.6225: .zero 4 .type cob_user_parameters.6230, @object .size cob_user_parameters.6230, 256 cob_user_parameters.6230: .zero 256 .ident "GCC: (GNU) 4.2.2" .section .note.GNU-stack,"",@progbits ---------------------------------------------------------------- You have a broken GCC. Roger ---------------------------------------------------------------- what do you mean "brocken GCC" ? I in my archlinux-powerpc I have: gcc 4.2.2-4 gcc-gcj 4.2.2-1 gcc-libs 4.2.2-3 libgcc-legacy 3.3.6-2 what is wring ? thanks ---------------------------------------------------------------- If you are getting "illegal instruction", then GCC is producing illegal code. Try contacting your system supplier. What exactly is your platform/OS ? Roger ---------------------------------------------------------------- I have: apple-mini-powerpc archlinux Linux powerpc-linux-gnu 2.6.23-ARCH #1 Fri Oct 19 16:14:36 UTC 2007 ppc 7447A, altivec supported PowerMac10,1 GNU/Linux p.s. I have to build with gcc3 or gcc 4 ? ---------------------------------------------------------------- It is quite simple. Your GCC 4.2.2 is not usable! Complain to your supplier! Roger ---------------------------------------------------------------- this is hello.s from same source but from my linux-x86 NOTE I have segmentation in x86 too --------------------------------------------------------- .file "cob19369_0.c" .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "1.0" .LC1: .string "hello.cob" .LC2: .string "hello" .text .p2align 4,,15 .type hello_, @function hello_: pushl %ebp movl %esp, %ebp subl $24, %esp movl 8(%ebp), %eax testl %eax, %eax js .L16 movl initialized.7401, %ecx movl cob_current_module, %eax movl $module.7403, cob_current_module testl %ecx, %ecx movl %eax, module.7403 je .L17 .L8: .L13: movl cob_call_params, %eax movl $c_1.7400, 12(%esp) movl $1, 8(%esp) movl $1, 4(%esp) movl %eax, b_3.7398 movl %eax, cob_save_call_params movl $0, (%esp) call cob_new_display movl b_1.7396, %eax movl %eax, (%esp) call cob_stop_run .L16: movl initialized.7401, %eax testl %eax, %eax je .L4 movl $0, initialized.7401 .L4: leave xorl %eax, %eax ret .L17: movl cob_initialized, %edx testl %edx, %edx je .L18 movl $0, 8(%esp) movl $.LC0, 4(%esp) movl $.LC1, (%esp) call cob_check_version movl module.7403, %eax testl %eax, %eax je .L11 movl $hello_, 8(%esp) movl $hello, 4(%esp) movl $.LC2, (%esp) call cob_set_cancel .L11: movl $0, b_1.7396 movl $0, b_2.7397 movl $0, b_3.7398 movl $1, initialized.7401 jmp .L8 .L18: movl $0, (%esp) call cob_fatal_error .size hello_, .-hello_ .p2align 4,,15 .globl hello .type hello, @function hello: pushl %ebp movl %esp, %ebp subl $8, %esp movl $0, (%esp) call hello_ leave ret .size hello, .-hello .data .align 4 .type module.7403, @object .size module.7403, 28 module.7403: .long 0 .long 0 .long 0 .long 0 .long cob_user_parameters.7402 .byte 0 .byte 46 .byte 36 .byte 44 .byte 1 .byte 1 .byte 1 .byte 0 .local initialized.7401 .comm initialized.7401,4,4 .section .rodata.str1.1 .LC3: .string "Hello World!" .data .align 4 .type c_1.7400, @object .size c_1.7400, 12 c_1.7400: .long 12 .long .LC3 .long a_1.7399 .local b_3.7398 .comm b_3.7398,4,16 .local b_2.7397 .comm b_2.7397,4,16 .local b_1.7396 .comm b_1.7396,4,16 .local cob_user_parameters.7402 .comm cob_user_parameters.7402,256,32 .align 4 .type a_1.7399, @object .size a_1.7399, 8 a_1.7399: .byte 33 .byte 0 .byte 0 .byte 0 .long 0 .ident "GCC: (GNU) 4.2.2" .section .note.GNU-stack,"",@progbits ---------------------------------------------------------------- How are you compiling? How are you executing? You should be doing something like this - cobc -x hello.cob ./hello or - cobc hello.cob cobcrun hello Roger ---------------------------------------------------------------- ho it works with -x parameter it works thankyou and sorry ---------------------------------------------------------------- Subject: C Interface Manual chapter updated Hi, I compiled the samples from the C Interface chapter, there were same #includes missing from the C samples. Same for -x to generate executables from Cobol. But now the samples all work. Juergen ---------------------------------------------------------------- Thanks. Much needed. I need help from users to maintain this. Roger ---------------------------------------------------------------- How current is the Tasks section? What other things would you like help with? ---------------------------------------------------------------- I updated the tasks section. It is current. Roger ---------------------------------------------------------------- We need help in all categories. I do not have the time to update everything. Somebody posted that they would like a complete syntax for OC. Going by what MF has, this would be ca: 800 pages (For the syntax alone, and ignoring the specfic MF things like eg. file handling) !! Anybody want to do that? Generally, OC goes by standards/MF/ACU rules so that syntax is elsewhere defined. Roger ---------------------------------------------------------------- Subject: Dereference a POINTER - how? I wonder how to dereference a POINTER, i.e. how do you access the data pointed to. [url=http://home.swbell.net/mck9/cobol/tech/cobolptr.html]http://home.swbell.net/mck9/cobol/tech/cobolptr.html[/url] suggests [quote] So I've Got an Address. Now What? You have a pointer EXAMPLE-P which points to an object of some known type. Set up an instance of such an object in the LINKAGE SECTION: LINKAGE SECTION. 01 NAME-STRUCTURE. 05 FIRST-NAME PIC X(18). 05 LAST-NAME PIC X(26). Now use the SET verb: SET ADDRESS OF NAME-STRUCTURE TO EXAMPLE-P. [/quote] I couldn't get that to work with OpenCobol. [code]/tmp/cob4482_0.c: In function 'say_': /tmp/cob4482_0.c:109: error: invalid lvalue in assignment [/code] How do you dereference a POINTER with OpenCobol? Thanks, Juergen ---------------------------------------------------------------- Works fine here - WORKING-STORAGE SECTION. 01 PTR-P USAGE POINTER. LINKAGE SECTION. 01 MY01. 03 MYV1 PIC X. 03 MYV2 PIC X. PROCEDURE DIVISION. SET ADDRESS OF MY01 TO PTR-P. Maybe post the complete example. Roger ---------------------------------------------------------------- We are getting this error too. /tmp/cob71864_0.c: In function 'envtest_': /tmp/cob71864_0.c:155: error: invalid lvalue in assignment We are using OC version 1.1 on the AIX system. Compile statement: cobc -x -o envtest envtest.cbl -I/usr/include -L/usr/lib -lc envtest.cbl code: IDENTIFICATION DIVISION. PROGRAM-ID. envtest. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 ENVTAG PIC X(4) VALUE "TEST". 01 ENVSTR PIC X(11) VALUE "TEST=value!". 01 WS-ENVIRON-VARIABLE-STRING PIC X(31). 01 WS-ENVIRON-VARIABLE-LENGTH PIC 9(03). 01 WS-RESULT-STRING-POINTER USAGE POINTER. 01 WS-STRIP-RESULT-STRING PIC X(160). 01 WS-STRIP-RESULT-STRING-SIZE PIC S9(04) COMP. 01 WS-MAX-ENVIRON-VALUE-SIZE PIC 9(02) VALUE 30. LINKAGE SECTION. 01 WS-RESULT-STRING PIC X(160). PROCEDURE DIVISION. DISPLAY "Environment string to be set: " ENVSTR. CALL "putenv" USING BY REFERENCE ENVSTR. DISPLAY "Need to retrieve ENVIRONMENT VARIABLE". DISPLAY "Attempt to retrieve environment variable: " ENVTAG. CALL "getenv" USING BY REFERENCE ENVTAG RETURNING WS-RESULT-STRING-POINTER. DISPLAY "Environment value returned for " ENVTAG " is: " WS-RESULT-STRING-POINTER IF WS-RESULT-STRING-POINTER <> NULL DISPLAY "pointer is not null " SET ADDRESS OF WS-RESULT-STRING TO WS-RESULT-STRING-POINTER UNSTRING WS-RESULT-STRING DELIMITED BY LOW-VALUE INTO WS-STRIP-RESULT-STRING COUNT IN WS-STRIP-RESULT-STRING-SIZE END-UNSTRING DISPLAY "Environment value returned for " ENVTAG " is: " WS-STRIP-RESULT-STRING END-IF. IF WS-RESULT-STRING-POINTER = NULL DISPLAY "string is NULL" END-IF. DISPLAY "End" STOP RUN. Any idea why?? :-) ---------------------------------------------------------------- Post the envtest.c and envtest.c.h genned by cobc -xC envtest.cbl (And, as in another thread, this is not the way to do something like this; there are perfectly good Cobol routines ala. MF/ACU for this) Roger ---------------------------------------------------------------- envtest.c: /* Generated from envtest.cbl by cobc 1.1.0 (Build date - May 21 2008 13:48:58) */ #define __USE_STRING_INLINES 1 #ifndef _XOPEN_SOURCE_EXTENDED #define _XOPEN_SOURCE_EXTENDED 1 #endif #include #include #include #include #define WORDS_BIGENDIAN 1 #include #define COB_SOURCE_FILE "envtest.cbl" #define COB_PACKAGE_VERSION "1.1" #define COB_PATCH_LEVEL 0 /* function prototypes */ static int envtest_ (const int); int envtest (void); int main (int argc, char **argv) { cob_init (argc, argv); cob_stop_run (envtest ()); } /* functions */ int envtest () { return envtest_ (0); } /* end functions */ static int envtest_ (const int entry) { #include "envtest.c.h" /* local variables */ static int initialized = 0; static cob_field *cob_user_parameters[COB_MAX_FIELD_PARAMS]; static cob_module module = { NULL, NULL, NULL, NULL, cob_user_parameters, 0, '.', '$', ',', 1, 1, 1, 0}; /* LINKAGE SECTION */ unsigned char *b_13 = NULL; /* WS-RESULT-STRING */ /* perform frame stack */ int frame_index; struct frame { int perform_through; void *return_address; } frame_stack[255]; /* Start of function code */ if (unlikely(entry < 0)) { if (!initialized) { return 0; } initialized = 0; return 0; } module.next = cob_current_module; cob_current_module = &module; if (unlikely(initialized == 0)) { if (!cob_initialized) { cob_fatal_error (COB_FERROR_INITIALIZED); } cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); (*(int *) (b_1)) = 0; (*(int *) (b_2)) = 0; (*(int *) (b_3)) = 0; memcpy (b_5, "TEST", 4); memcpy (b_6, "TEST=value!", 11); memset (b_7, 32, 31); memset (b_8, 48, 3); memset (b_9, 0, 4); memset (b_10, 32, 160); memset (b_11, 0, 2); memcpy (b_12, "30", 2); initialized = 1; } /* initialize frame stack */ frame_index = 0; frame_stack[0].perform_through = -1; /* initialize number of call params */ (*(int *) (b_3)) = cob_call_params; cob_save_call_params = cob_call_params; goto l_2; /* PROCEDURE DIVISION */ /* envtest: */ l_2:; /* MAIN SECTION: */ /* MAIN PARAGRAPH: */ /* envtest.cbl:20: DISPLAY */ { cob_new_display (0, 1, 2, &c_1, &f_6); } /* envtest.cbl:21: CALL */ { { int (*func)(); module.cob_procedure_parameters[0] = &f_6; module.cob_procedure_parameters[1] = NULL; module.cob_procedure_parameters[2] = NULL; module.cob_procedure_parameters[3] = NULL; module.cob_procedure_parameters[4] = NULL; cob_call_params = 1; func = cob_resolve_1 ((const char *)"putenv"); (*(int *) (b_1)) = func (b_6); } } /* envtest.cbl:23: DISPLAY */ { cob_new_display (0, 1, 1, &c_2); } /* envtest.cbl:25: DISPLAY */ { cob_new_display (0, 1, 2, &c_3, &f_5); } /* envtest.cbl:27: CALL */ { { void * (*func)(); module.cob_procedure_parameters[0] = &f_5; module.cob_procedure_parameters[1] = NULL; module.cob_procedure_parameters[2] = NULL; module.cob_procedure_parameters[3] = NULL; module.cob_procedure_parameters[4] = NULL; cob_call_params = 1; func = cob_resolve_1 ((const char *)"getenv"); (cob_get_pointer (b_9)) = func (b_5); } } /* envtest.cbl:30: DISPLAY */ { cob_new_display (0, 1, 4, &c_4, &f_5, &c_5, &f_9); } /* envtest.cbl:33: IF */ { if (((int)((cob_get_pointer (b_9)) - (unsigned char *)NULL) != 0)) { /* envtest.cbl:35: DISPLAY */ { cob_new_display (0, 1, 1, &c_6); } /* envtest.cbl:37: SET */ { { void *temp_ptr; memcpy(&temp_ptr, b_9, sizeof(temp_ptr)); b_13 = temp_ptr; } } /* envtest.cbl:39: UNSTRING */ { cob_unstring_init ((f_13.data = b_13, &f_13), 0, 1); cob_unstring_delimited (&cob_low, 0); cob_unstring_into (&f_10, 0, &f_11); cob_unstring_finish (); } /* envtest.cbl:44: DISPLAY */ { cob_new_display (0, 1, 4, &c_4, &f_5, &c_5, &f_10); } } } /* envtest.cbl:48: IF */ { if (((int)((cob_get_pointer (b_9)) - (unsigned char *)NULL) == 0)) { /* envtest.cbl:49: DISPLAY */ { cob_new_display (0, 1, 1, &c_7); } } } /* envtest.cbl:51: DISPLAY */ { cob_new_display (0, 1, 1, &c_8); } /* envtest.cbl:52: STOP */ { cob_stop_run ((*(int *) (b_1))); } cob_current_module = cob_current_module->next; return (*(int *) (b_1)); } /* end function stuff */ envtest.c.h: /* Generated from envtest.cbl by cobc 1.1.0 (Build date - May 21 2008 13:48:58) */ /* PROGRAM-ID : envtest */ static unsigned char b_1[4] __attribute__((aligned)); /* RETURN-CODE */ static unsigned char b_2[4] __attribute__((aligned)); /* SORT-RETURN */ static unsigned char b_3[4] __attribute__((aligned)); /* NUMBER-OF-CALL-PARAMETERS */ static unsigned char b_5[4] __attribute__((aligned)); /* ENVTAG */ static unsigned char b_6[11] __attribute__((aligned)); /* ENVSTR */ static unsigned char b_7[31] __attribute__((aligned)); /* WS-ENVIRON-VARIABLE-STRING */ static unsigned char b_8[3] __attribute__((aligned)); /* WS-ENVIRON-VARIABLE-LENGTH */ static unsigned char b_9[4] __attribute__((aligned)); /* WS-RESULT-STRING-POINTER */ static unsigned char b_10[160] __attribute__((aligned)); /* WS-STRIP-RESULT-STRING */ static unsigned char b_11[2] __attribute__((aligned)); /* WS-STRIP-RESULT-STRING-SIZE */ static unsigned char b_12[2] __attribute__((aligned)); /* WS-MAX-ENVIRON-VALUE-SIZE */ /* attributes */ static cob_field_attr a_1 = {33, 0, 0, 0, NULL}; static cob_field_attr a_2 = {17, 10, 0, 0, NULL}; static cob_field_attr a_3 = {17, 4, 0, 1, NULL}; /* fields */ static cob_field f_11 = {2, b_11, &a_3}; /* WS-STRIP-RESULT-STRING-SIZE */ static cob_field f_10 = {160, b_10, &a_1}; /* WS-STRIP-RESULT-STRING */ static cob_field f_9 = {4, b_9, &a_2}; /* WS-RESULT-STRING-POINTER */ static cob_field f_5 = {4, b_5, &a_1}; /* ENVTAG */ static cob_field f_6 = {11, b_6, &a_1}; /* ENVSTR */ /* local/external fields */ static cob_field f_13 = {160, NULL, &a_1}; /* WS-RESULT-STRING */ /* constants */ static cob_field c_1 = {30, (unsigned char *)"Environment string to be set: ", &a_1}; static cob_field c_2 = {37, (unsigned char *)"Need to retrieve ENVIRONMENT VARIABLE", &a_1}; static cob_field c_3 = {42, (unsigned char *)"Attempt to retrieve environment variable: ", &a_1}; static cob_field c_4 = {31, (unsigned char *)"Environment value returned for ", &a_1}; static cob_field c_5 = {5, (unsigned char *)" is: ", &a_1}; static cob_field c_6 = {20, (unsigned char *)"pointer is not null ", &a_1}; static cob_field c_7 = {14, (unsigned char *)"string is NULL", &a_1}; static cob_field c_8 = {3, (unsigned char *)"End", &a_1}; /* ---------------------------------------------- */ BTW - the original code was using MF cobgetenv in the code but when we started converting we did not see anything documented in OC that would replace this function. ---------------------------------------------------------------- Fixed in current 1.1 tarball. I screwed up the non-aligned architecture case. Re. cobgetenv, see - http://supportline.microfocus.com/Documentation/books/oc41books/printf.htm#012 Capital 10.9.6 Excerpt - *** In COBOL, the following syntax enables you to read and change the environment at run time. DISPLAY ... UPON ENVIRONMENT-NAME ... ACCEPT ... FROM ENVIRONMENT-NAME ... You can also call the following routines from C to do the same things: cobgetenv cobputenv cobrescanenv Use the COBOL syntax in preference to the C routines. *** Also see 10.9.6.1 Example Excerpt - *** The following example demonstrates calling a C routine directly from a COBOL program using the cobgetenv routine. (This is only for example purposes. We recommend you do not use cobgetenv from COBOL.) *** Also from example - *** "cobgetenv" expects a pointer to an array of characters terminated by a low-value. *** As indeed does "getenv". Note that the example is NOT correct in it's reference to "errno". Some (all?) current libc implementations do NOT have "errno" externalized as an "int". Instead, the "errno.h" include does something like this - #define errno (*__errno_location ()) Note OC supports the MF ACCEPT/DISPLAY extensions as well as the more succint ACU variant - ACCEPT dataitem FROM ENVIRONMENT identifier_or_literal Roger ---------------------------------------------------------------- Just to clear up this environment issue. The preferred (and easiest) way to set/get environment variables is to use the OC (ACU) extensions - SET ENVIRONMENT identifier_or_literal TO identifier_or_literal ACCEPT identifier FROM ENVIRONMENT identifier_or_literal This has the advantage that you do not have to worry about null termination. For the ACCEPT, the identifier will be space-filled/truncated according to definition (assuming presence of the variable). Roger ---------------------------------------------------------------- Subject: Return a POINTER to a Cobol Program - how? Hi, how do you return a pointer to a cobol program? CALL "myCfun" USING BY VALUE INBUF-PTR RETURNING HANDLE-PTR. does not work. Error: Invalid MOVE statement Unexpected tree tag 0 codegen.c:2756: Internal compiler error ---------------------------------------------------------------- That's an OC bug. Working on a fix. Will post when I have something. Roger ---------------------------------------------------------------- OK. Fixed in current 1.1 tarball. (For alignment tolerant machines ie. x86(_64)) I need to think out the non-tolerant machine implications. Note, I think you need to rethink your passing BY VALUE of what appears to be a pointer. That will not work. (At least not compatibly) The normal way to pass Cobol params is BY REFERENCE and if you need to interpret these in C, then do the appropiate casts. This is exactly what MF/ACU do. Roger ---------------------------------------------------------------- Thanks very much. Where is the tar-ball? OpenCOBOL 1.1 prerelease has Submitted Date: 2007/12/27 this seems a bit old. Juergen ---------------------------------------------------------------- Yea, it's a bit confusing. The submitted date is when the link was set up. What it points to is of course actual. Roger ---------------------------------------------------------------- Addendum to BY VALUE. I have now changed the whole BY VALUE/CONTENT processing so passing BY VALUE should now work. 1.1 tarball updated. Roger ---------------------------------------------------------------- Subject: BINARY BY VALUE parameters Hi, I'd like to call Cobol from C and transfer pointers and integer lengths. In C speak the Cobol program should be like extern int ptrcob(char *, int); So I tried this program [code] IDENTIFICATION DIVISION. PROGRAM-ID. ptrcob. ENVIRONMENT DIVISION. DATA DIVISION. LINKAGE SECTION. 01 DATA-PTR USAGE IS POINTER. 01 DATA-LEN PIC S9(9) USAGE IS BINARY. PROCEDURE DIVISION USING DATA-PTR BY VALUE DATA-LEN. DISPLAY "HELLO WORLD." EXIT PROGRAM. [/code] This generates this function [code] int ptrcob (unsigned char *b_5, int i_6) { return ptrcob_ (0, b_5, (unsigned char *) &i_6); } [/code] The parameters seem right, but the cast to (unsigned char *) is wrong, isn't it? Thanks, Juergen ---------------------------------------------------------------- No, that is perfectly OK. Look at the definition of ptrcob_. Put in a DISPLAY of DATA-LEN and you will see what happens. Roger ---------------------------------------------------------------- Subject: ADDRESS OF wrong Hi, I continued playing. I'd expect the code below to output OPNAME but it doesn't. Anybody an idea what is wrong? [code] IDENTIFICATION DIVISION. PROGRAM-ID. addr. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 OPNAME PIC X(30) VALUE "OPNAME". 01 OPNAME-PTR USAGE IS POINTER. PROCEDURE DIVISION. SET OPNAME-PTR TO ADDRESS OF OPNAME. CALL "cfun" USING OPNAME-PTR. EXIT PROGRAM. [/code] [code]#include #include cfun(char *s) { char b[50]; strncpy(b,s,30); printf("%s\n",b); }[/code] cobc -x addr.cob caddr.c SET OPNAME-PTR TO ADDRESS OF OPNAME. generates (*(unsigned char **) (b_6)) = (b_5); Is that correct? Shouldn't that be &b_5 ? Thanks, Juergen ---------------------------------------------------------------- No, the Cobol code is correct. BY REFERENCE parameters are passed by pointer. Here you are passing a pointer field. So what you have is an "address of address of" field. So the C code should look like this - #include #include cfun(unsigned char *s) { char **ptr; char b[50]; ptr = (char **)s; strncpy(b,s,30); printf("%s\n",*ptr); } Roger ---------------------------------------------------------------- Roger, thanks for helping me. I tried your changes in z/OS 1.7, there they work: [code] IDENTIFICATION DIVISION. PROGRAM-ID. "addr". ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 OPNAME PIC X(30) VALUE "OPNAME". 01 OPNAME-PTR USAGE IS POINTER. PROCEDURE DIVISION. SET OPNAME-PTR TO ADDRESS OF OPNAME. DISPLAY "OPNAME=" OPNAME. CALL "cfun" USING OPNAME-PTR. STOP RUN. [/code] [code]#include #include cfun(char *s) { char **ptr; char b[50]; printf("start cfun\n"); ptr = (char **)s; strncpy(b,*ptr,30); printf("%s\n",b); printf("end cfun\n"); } [/code] [code] $ cob2 -qpgmname\(longmixed\) addr.cbl cfun.o PP 5655-G53 IBM Enterprise COBOL for z/OS 3.3.0 in progress ... End of compilation 1, program addr, no statements flagged. $ a.out OPNAME=OPNAME start cfun OPNAME end cfun [/code] With opencobol, there is still something wrong, looks like the pointer is one off: [code] OPNAME=OPNAME start cfun 3PNAME ð end cfun [/code] My original C version (directly use the pointer) works in z/OS with USING BY VALUE, too: [code] CALL "cfun" USING BY VALUE OPNAME-PTR. cfun(char *s) { char b[50]; printf("start cfun\n"); strncpy(b,s,30); printf("%s\n",b); printf("end cfun\n"); } [/code] This compiles with opencobol, too, but segfaults. Greetings, Juergen ---------------------------------------------------------------- The printf is scribbling places where it should not be. strncpy stops when it hits a null byte (not true) or when it hits the count (true = 30). In the last case a null-byte is NOT appended. Try doing a memset (b, 0, sizeof(b)); before the strncpy. Roger ---------------------------------------------------------------- [quote] simrw wrote: The printf is scribbling places where it should not be. strncpy stops when it hits a null byte (not true) or when it hits the count (true = 30). In the last case a null-byte is NOT appended. Try doing a memset (b, 0, sizeof(b)); before the strncpy. Roger[/quote] Yes, but the strange thing is, the *first* character is wrong, too. Juergen ---------------------------------------------------------------- What is strange about it? You are printing uninitialized stack which could include binary representation of any character including such things as carriage-returns, back-spaces and any other control character. Roger ---------------------------------------------------------------- Subject: CALL "c" USING PTR to PIC S9(9) Hi again, I tried to pass a pointer to a binary integer from Cobol to C with the code below. This works with z/OS Cobol, but not with OpenCobol. Is that a bug? Thanks, Juergen [code] IDENTIFICATION DIVISION. PROGRAM-ID. "rdintcob". ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 MYINT PIC S9(9) USAGE IS BINARY. 01 PTR USAGE IS POINTER. PROCEDURE DIVISION. MOVE 20080106 TO MYINT. DISPLAY "MYINT=" MYINT. SET PTR TO ADDRESS OF MYINT. CALL "rdint" USING PTR. DISPLAY "MYINT=" MYINT. STOP RUN. [/code] [code]#include #include rdint(int **s) { printf("start rdint, **s=%d\n", **s); (**s) ++; printf("end rdint, **s = %d\n",**s); } [/code] z/OS output: [code] $ cob2 -qpgmname\(longmixed\) rdintcob.cbl rdint.c PP 5655-G53 IBM Enterprise COBOL for z/OS 3.3.0 in progress ... End of compilation 1, program rdintcob, no statements flagged. $ a.out MYINT=020080106 start rdint, **s=20080106 end rdint, **s = 20080107 MYINT=020080107 [/code] OpenCobol output [code]$cobc -x rdintcob.cob rdintc.c $rdintcob MYINT=+020080106 start rdint, **s=-362466815 end rdint, **s = -362466814 MYINT=+036857322 [/code] ---------------------------------------------------------------- USAGE BINARY (aka COMP) is big-endian order. Change to USAGE COMP-5 and everything will be OK. Alternatively you can use the 2002 syntax - 01 MYINT USAGE BINARY-LONG SIGNED. Roger ---------------------------------------------------------------- I must have been blind, thanks for pointing it out. I left Cobol alone and changed C by slightly misusing ntohl(), this version of rdint.c works with opencobol on Linux and with IBM's cobol on z/OS: [code] #include #include #include rdint(int **s) { int a = ntohl(**s); printf("start rdint, a=%d\n", a); a ++; printf("end rdint, a = %d\n",a); **s = htonl(a); } [/code] ---------------------------------------------------------------- Yes, well assuming the passed parameter is aligned :-) If it's on 01/77, then it will work on on any architecture. BUT - 01 ... 03 FILLER PIC X. 03 MYPTR USAGE POINTER. CALL .. USING (BY VALUE) MYPTR. C code works fine on alignment-tolerant architectures (eg. X86(_64), and others), but will bomb out spectacularly otherwise! That means that you either know the exact alignment of parameters to C routines or not. If the former, OK., if the latter then you must code in C defensively. Roger ---------------------------------------------------------------- Subject: OpenCOBOL 1.1 wishlist As per subject. (This applies to things not there in 1.0, do not post unless you have tested/installed 1.0) Post away! Roger ---------------------------------------------------------------- Debugging support would be great. I think one should teach Cobol to gdb (Using GDB with Different Languages: http://sources.redhat.com/gdb/current/onlinedocs/gdb_13.html#SEC144). I am not overly good at reading Portugese, but the TC-gui.pdf from http://wiki.tinycobol.org/cobol.html describes how you can debug Tinycobol programs with ddd and gdb. As Tinycobol is GPLed, too, it should be possible to use its debugging code for OpenCobol, too. Anyway, you should be able to do a session like this (manipulated C ;-) session: [code] (gdb) list 10 IDENTIFICATION DIVISION. 11 PROGRAM-ID. "cobmain". 12 DATA DIVISION. 13 WORKING-STORAGE SECTION. 14 01 MYVAR PIC X(20). 15 PROCEDURE DIVISION. 16 DisplayPrompt. 17 MOVE "HELLO" to MYVAR 18 DISPLAY "Hello, world.". 19 STOP RUN. (gdb) break cobmain.cbl:18 Breakpoint 1 at 0x80483b8: file cobmain.cbl, line 18. (gdb) run Starting program: /home/cobol/a.out Breakpoint 1, main (argc=1, argv=0xbfcc7624) at cobmain.cbl:18 19 DISPLAY "Hello, world.". (gdb) print MYVAR $1 = "HELLO" (gdb) [/code] http://www.opencobol.org/modules/bwiki/index.php?cmd=read&page=UserManual%2F5 ---------------------------------------------------------------- There should be Win32 Visual Studio built binaries available. This should vastly enhance OpenCobol's user base. See also "configure fails in Windows XP" http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=178&forum=1 ---------------------------------------------------------------- To mail 2 - Of course you can use gdb. To be meaningful, you normally would compile with the -g and -debug options. To mail 3 - Sergey Kashyrin will be hosting OC 1.0 pre-prepared binaries for a number of systems including Native Win within the near future. Will post (or he will) when available. Note this will/does not include MinGW or Cygwin ports. Cygwin can be seen as a normal UNIX installation. Be sure to install all required prerequisites (both runtime AND development). For MinGW, you must prepare/make/install the prerequisites yourself. Roger ---------------------------------------------------------------- [quote] simrw wrote: Of course you can use gdb. To be meaningful, you normally would compile with the -g and -debug options. [/quote] I am sorry, I had overlooked the -debug option. Anyway, it looks like you see no stdout of your program and you cannot display data: So, I change my vote to enhance debugging suppport. Thanks, Juergen [code] ~/cobol cobc -g -debug -x cobmain.cbl ~/cobol ./cobmain Hello, world. MYVAR=HELLO ~/cobol ./cobmain Hello, world. MYVAR=HELLO ~/cobol gdb cobmain GNU gdb Red Hat Linux (6.5-16.el5rh) Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/i686/nosegneg/libthread_db.so.1". (gdb) list 13 /tmp/cob21935_0.c: No such file or directory. in /tmp/cob21935_0.c (gdb) break cobmain.cbl:20 Breakpoint 1 at 0x80489d7: file cobmain.cbl, line 20. (gdb) run Starting program: /home/intuser/cobol/cobmain [Thread debugging using libthread_db enabled] [New Thread -1208407856 (LWP 22132)] [Switching to Thread -1208407856 (LWP 22132)] Breakpoint 1, cobmain_ (entry=0) at cobmain.cbl:20 20 STOP RUN. (gdb) print MYVAR No symbol "MYVAR" in current context. (gdb) list 15 PROCEDURE DIVISION. 16 DisplayPrompt. 17 DISPLAY "Hello, world.". 18 MOVE "HELLO" to MYVAR 19 DISPLAY "MYVAR=" MYVAR. 20 STOP RUN. 21 [/code] ---------------------------------------------------------------- [New Thread 1076823904 (LWP 4574)] Hello, world. Program exited normally. Works fine here :-) Roger ---------------------------------------------------------------- Addendum to mail 3 - It is anticipated that for 1.1 we will provide a "winbuild" directory (or something) that allows a native MSVC build. Note this will NOT include building anything for the prerequisites such as GMP etc. Roger ---------------------------------------------------------------- I tried again, now, it works, too. No idea what went wrong the first time. Thanks for helping, Juergen ---------------------------------------------------------------- OK. No probs. But you should open then a new subject/thread :-) That is/was not to do with 1.1 :-) Roger ---------------------------------------------------------------- 1. Debugging can only be done using gdb debugger commands and with c code. The big "enhancement" for OC 1.1 would be to debug with the "COBOL-Source", being enabled to set breakpoints or jump to the code, seeing and modifying vars in a way COBOL sees them (I'm just dreaming, maybe this is possible some day...). 2. Have unimplemented Functions of MF/ACU implemented (is there a list of all Functions / CALL C$XYZ / etc. available in MF/ACU and showing what works in OC?) 3. There were different request about native XML-Support for OC in the forum, maybe it's possible to add a frontend to some GPLed XML-read/write-library for OC?. ---------------------------------------------------------------- 1) But you have the info. If you compile with -g -debug, the you have "#line" directives :-) 2) For what is implemented, see libcob/system.def 3) Dunno. Roger ---------------------------------------------------------------- No replies uptil now. Hmm. Everybody satisfied with OC 1.0 or ? No, can not be - lets hear from people. Roger ---------------------------------------------------------------- I saw somewhere in the wiki that screen section in tinycobol has better support. That means we can mix part of TC ? Last time I tried to install TC I had errors during "make install" in scan.c ... I'm not a "screen-section" supporter, my whishes goes to complete display/accept with colors, boxes and control key handling, etc. popup screens will be marvelous ! As I am not a C programmer, how can I contribute to make things go on ? PS All these are whishes, not reproaches ... ---------------------------------------------------------------- I'd still like to see the functionality that when compiled in 'mainframe mode' that the main program can have parms passed via the command line like the mainframe allows. Last time I asked you just replied something like, "It's not possible." But I don't understand why it's not possible. ---------------------------------------------------------------- [quote]There were different request about native XML-Support for OC in the forum, [...][so] add [...][native] XML-read/write-[...][support] for OC [is a wish].[/quote] ---------------------------------------------------------------- If the written code is not very well formed OC prompts messages like [quote]Error: syntax error, unexpected INPUT_OUTPUT, expecting $end[/quote]. Better would be something like: 'ENVIRONMENT DIVISION. is missing'. I think there are other hard-to-understand-messages. The wish is a clear message that says what is wrong. ---------------------------------------------------------------- A small one: Have a nice logo for OC. And another: put something behind the FAQ link at the top or remove it. Maybe a bigger one: Distribute not only makefiles but also Visual Studio Project Files. ---------------------------------------------------------------- Per last post - Small one - OK. Will see what I (or Keisuke) can do. Big one - Maybe not so big, it is intended to provide a winbuild for 1.1 ie. Native MSVC, (NOT Cygwin, MinGW which are straight-forward UNIX ports). Note, this will NOT include any build for the OC dependencies (GMP et al.) Roger ---------------------------------------------------------------- Re: Better would be something like: 'ENVIRONMENT DIVISION. is missing'. I think there are other hard-to-understand-messages. Answered in another thread. Roger ---------------------------------------------------------------- Re: ----- I saw somewhere in the wiki that screen section in tinycobol has better support. That means we can mix part of TC ? Last time I tried to install TC I had errors during "make install" in scan.c ... I'm not a "screen-section" supporter, my whishes goes to complete display/accept with colors, boxes and control key handling, etc. popup screens will be marvelous ! ----- To part 1, yes TC has super screen I/O support (but TC is ONLY on x86; I am not sure if TC works correctly on x86_64) We can not "mix" TC and OC. The ACCEPT/DISPLAY syntax that you refer to is a MF extension that is not part of any standard that I know about. Yes, OC has the parser to do this syntax. Problem is to get the runtime code in :-) As usual, lack of time and lack of developers are the major problems as far as OC is concerned. Suggestions welcome :-) Roger ---------------------------------------------------------------- I would like to see a more flexible handling of upper/lowercase filenames, similar to the fold-call-name and fold-copy-name options in Microfocus. Traditionally, COBOL source code is in all uppercase. Also traditionally, Unix filenames are all lowercase. So I would like to be able to write PROGRAM-ID. MYPROG. ... COPY "MYCPY". ... CALL MYSUB1 CALL "MYSUB2" in a file myprog.cbl, to include mycpy.cpy and call mysub1.so and mysub2.so (which are compiled from mysub1.cbl and mysub2.cbl). I found a discussion of this topic two years ago on the mailing list, but there seemed to be no consensus. Regards, Alex ---------------------------------------------------------------- Why not copy "MYCPY". call "MYSUB" move "MYSUB" to wprogram call wprogram ... I think its better so. Of course there is another way using configuration files "a la acucobol" - why not ? Regards ---------------------------------------------------------------- Some other wishes for the list: - an option to have all the key files together with the data in one file - If I'm right, there is a problem with memory handling: other COBOL systems unload programs from memory if there is a CANCEL 'MYPROG', OC does not, does it? The wish is a functional unloading on CANCEL operations. By the way: Is there a possible release date for OC 1.1 and / or other versions? Maybe a plan of mile stones / features that should be implemented? ---------------------------------------------------------------- Hi Roger, I'll split my wishes into separate messages. USAGE NATIONAL and everything connected to that. It should not be complicated, but still amount of work mostly duplicating existing functions. Regards, Sergey ---------------------------------------------------------------- low-value terminated strings, i.e. MOVE Z"ABC" TO STR. ---------------------------------------------------------------- That can be split into several stages. STAGE 1 To keep the names of the variables like original in C i.e. if we have 01 X. 02 F-1 PIC X(4). 02 F-2 PIC S9(7) COMP-4. instead of generating static char b123[8]; to generate #pragma pack(1) static struct s_X { char F_1[4]; char F_2[4]; } X; and the appropriate references, i.e. instead of b123 + 4 just X.F_2 ---------------------------------------------------------------- STAGE 2 Switch to the appropriate types where possible in C, i.e. if it's BIG_ENDIAN (and COMP-4 is native int), produce #pragma pack(1) static struct s_X { char F_1[4]; int F_2; } X; ---------------------------------------------------------------- STAGE 3 Switch from C to C++ and in the following case 01 X. 02 I-1 PIC S9(7) COMP-4. 02 P-1 PIC S9(5)V9(2) COMP-3. produce struct s_X { COMP4<4> I_1; COMP3<7,2> P_1; } X; and of course MOVE I-1 TO P-1 will be just X.P_1 = X.I_1; Easy ? NO Possible ? YES ---------------------------------------------------------------- Also can be split into 2 stages 1. Get rid of static dependencies in runtime to be able to work in multithread environment 2. To introduce kind of "multithread mode" in which case all WORKING-STORAGE become a thread-local storage, like Fujitsu did in their .NET version. All of this might be important for people who want to mix their new java apps with an old legacy code and not to run several copies as a processes but do multithreading and just call Cobol code natively. ---------------------------------------------------------------- Re: - > low-value terminated strings, i.e. > MOVE Z"ABC" TO STR. You can already do this - MOVE "ABC" & X"00" TO STR. :-) Roger ---------------------------------------------------------------- OK so this is mine : libcob: Convert packed to int are a nightmare. libcob have theses functions (cob_get_packed) but use cob_field structure, with user defined function don't have (CALL use the unsigned char b_1 as parameters. modify generated C: make possible to include file generated code. For exemple, i want my cobol program use my own cob_resolve_1 function, if i use -D, it don't work (-D'cob_resolve_1 my_resolve_1' transform 'cob_resolve_1' in 'myresolve_1 1' . I have to add #define in .c.h : (in makefile) cobc -C test.cob echo "#define cob_resolve_1 my_resolve_1' >> test.c.h cobc test.c myresolve.o -o test This first is probably more interesting, it need to modify call architecture (and break compatibility)... Regards ---------------------------------------------------------------- Both of the suggestions in previous post are rejected. I have no idea what on earth you are trying to do. You should never be using the internal OC functions. (Except as described in the documentation) Roger ---------------------------------------------------------------- libcob: I want to write a C function (aka cobol sub program), taking as parameters COMP and COMP-3 variable. But i have some trouble to handle them (COMP-5 is not enough) I need to write my own function to transform them to C understandable data. Opencobol already had these functions, so why not use them ? Ex: I receive a S9(6) COMP variable i do : int get_from_packed(char *data) { cob_field_attr a = {18,6,0,1,NULL}; cob_field f= {4,data,&a}; return cob_get_packed_int(&f); } Works!!! (not use about the 18, but you get the idea..) Only a proposal... What is the best solution, write my own function (which will be only compatible with opencobol..) or use the solution with libcob ? modify generated C: As i said in my message, i think this is not so important for all users, i only propose. Perhaps someone could have a more interesting feature with it... And i had my work around (but it is quite ugly) Regards ---------------------------------------------------------------- a) My code looks like[code]perform varying a from 1 by 1 until a > 99 if a = b or d = e perform something end-if end-perform[/code], the listing looks like [quote]perform varying a from 1 by 1 until a > 99 if a = b or d = e perform something end-if end-perform[/quote] I'd like to have indention kept in list files, because the generated list files would be easier to read. b) I'd would like to have all relevant parameters for compiling at top of the list file, with full cobc line, environment vars, oc-version, ... This is very helpful if one need to compile again and does not know what the environment was set before or how the cobc line looked like. ---------------------------------------------------------------- a) No can do. (At least not easily) "listing" is really a misnomer. What it really is, is the output from the preprocessor phase (which has been normalized to free format) and then reindented to column 8/12. b) Done. Updated in current 1.1 tarball. Let me know if you need any other info there. Roger ---------------------------------------------------------------- To a) ... sounds a little bit weird. I understand that this is not so easy to fix. To b) Sounds good, I'll have a look and like to have c) also available in list file (if possible) New point c) I'd like to have a 'Build on [DATE]' in [code]cobc -version[/code] to be able to see when the used OC was build (because the output is always '1.1') What do you think of moving all feature requests and bug reporting to sf-site? And (I know that this was asked before, but maybe you change your mind about this) what do you think of moving the pre-release OC 1.1 to SF, too (as package OpenCobol pre-release)? What about moving/copying the pre-build OC binaries from kiska.net to SF, too? And last question for today: What about removing or enabling the not working FAQ at this site (top)? By the way: OC 1.1 is really good work! ---------------------------------------------------------------- Re. (c) - Yep, OK. Got something in test. Will post when tarball available. (Should also reflect in the listing option, -t ) Re SF site. Problem is that SF only knows about releases and not anything else (pre-release or such). Not sure what we can do here. Roger ---------------------------------------------------------------- We can make a new release part called "prereleases", like the experimental builds winmerge on SF does (about every week before a new release occurs): http://sourceforge.net/project/showfiles.php?group_id=13216 The really nice thing about that: Everybody knows, when there is a new tarball because of the release-date. ---------------------------------------------------------------- Re: (c) - Build date is now part of version info. Tarball updated. Roger ---------------------------------------------------------------- I tried the current 1.1 tarball, version and compile info in listing output are fine. Is it possible to place the warnings/errors at the related places in the list file or if it is not then place at the end of the list file? ---------------------------------------------------------------- Hi, sometimes it might be useful to disable all displays (for performance reasons in servers). What about a compiler option -fsuppress-console-output ? Greetings, Juergen ---------------------------------------------------------------- Reply to weberjn - Why? You have enough possibilities in the source code and/or the environment to achieve this. Roger ---------------------------------------------------------------- Excuse me if this first part is in an inappropriate thread, but having experienced OC 1.0 last week and OC 1.1 today, I'd just like to wish you and your team all the best. Well done. I haven't seriously COBOLed since the early 80's and this system is working out great. And a wishlist wish (or at least request for information); what are the plans for Report Writer? I've only barely skimmed the docs that I could find and haven't seen any mention other than a "'REPORT' reserved word, but not supported yet" error message (and the "yet" piqued my curiosity). Thanks, and wishing you well, Brian Tiffin ---------------------------------------------------------------- Well, of course, the word "yet" is subjective. It is a global message from the parser that we may at some time support this feature. Actually, you are the first person to inquire about Report Writer. I do not have any plans to implement this. I have never had a request for this. (Of course, if some customer came along and said we will pay for this development, then OK. :-)) Roger ---------------------------------------------------------------- My history with COBOL is report writing. :) During my time, wayy back in the day, I wrote quite a few reports from scratch and never got a chance to try REPORT SECTION and GENERATE. I changed course completely and became a polyFORTH programmer; so think of this Wish List entry as little more than nostalgic from an OpenCOBOL new user wishing on a star. Cheers ---------------------------------------------------------------- Before 1.1 goes out of the door, I will review these messages and try to produce something that may be meaningful as to intentions (or not as the case may be). Roger ---------------------------------------------------------------- Like I posted in http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=254&forum=1&start=10 It would be nice to have some markers (for example in column 73 if using fixed format) like[code] perform mf-things MARKMF perform 85-things MARK85 perform 2002-things MARK02[/code] For Doing things like[code] cobc -x -Wall -std=mf -inclMark=MARKMF -exclMark=MARK85 -exclMark=MARK02 prog.cob cobc -x -Wall -std=cobol85 -inclMark=MARK85 -exclMark=MARKMF -exclMark=MARK02 prog.cob cobc -x -Wall -std=cobol2002 -inclMark=MARK02 -exclMark=MARKMF -exclMark=MARK85 prog.cob[/code] (the -exclMark should be commented out, the -inclMark should be commented in) I think ACU had something like that. Has anybody an idea for doing that stuff in free format? With techniques like that we could have samples working on all std's ---------------------------------------------------------------- Human, NAK on that. I have the Cobol standard conditional compilation directives on my TODO list. ie. >>IF whatever >>ELSE >>END-IF Roger ---------------------------------------------------------------- I do not understand what you wanted to say... But sounds like you wanted to do something about that, so I'll just wait. (No matter what, I would really like to have column 73-directives implemented for fix format, because preparsing the cbl-file to do that is not so easy, but I'll wait for your respond to that before I'll beg you again with this topic.) ---------------------------------------------------------------- I am saying that conditional code generation will be handled using the Cobol standard directives feature. I am not going to do anything with col 73. It is easy enough to do that externally. eg. Assume you have a template prog with MARKMF/MARK85/MARK02/MARKOC in column 73, then feed your template prog into a shell script something like - # Template program as param 1, output as param 2 # Activate OC lines, deactivate MF, 85, 02 lines sed -s 's/^\(......\).\(.\{65\}\)MARKMF/\1\*\2MARKMF/ s/^\(......\).\(.\{65\}\)MARK02/\1\*\2MARK02/ s/^\(......\).\(.\{65\}\)MARK85/\1\*\2MARK85/ s/^\(......\).\(.\{65\}\)MARKOC/\1\ \2MARKOC/' <$1 >$2 To activate all OC and deactivate the other 3. Then - myscript template.cob myocprog.cob You can then have scripts to activate the other 3 by minimal modification (It can even be the same script, just linked with a different name and tested for within the script - eg. case `basename $0` in "cobconvoc") # Do OC sed ;; "cobconv85") # Do 85 sed .... .... esac Roger ---------------------------------------------------------------- I'm just a beginner with sed, but this seem to be all that is necessary for replacing the special ACU-Flags. Thank you! ---------------------------------------------------------------- Here is another sed version that is perhaps a little easier on the eye and a bit easier to understand - sed -s 's@^\(......\).\(.\{65\}MARKMF\)@\1\*\2@ s@^\(......\).\(.\{65\}MARK02\)@\1\*\2@ s@^\(......\).\(.\{65\}MARK85\)@\1\*\2@ s@^\(......\).\(.\{65\}MARKOC\)@\1\ \2@' <$1 >$2 Roger ---------------------------------------------------------------- Recent activities have kind of buried this thread. This is just a ping post to bubble it up to the top so everyone knows it's still here. ---------------------------------------------------------------- Request for new OpenCOBOL reserved word. NEWLINE For usage such as [code] DISPLAY thing NEWLINE otherthing WITH NO ADVANCING END-DISPLAY [/code] Or is 01 NEWLINE CONSTANT AS x"0a". acceptable across platforms? Cheers, Brian ---------------------------------------------------------------- I don't know an easy way to remove DISPLAYs. I have just now commented out all DISPLAYs of a program, search and replace does not really cope with the indentation. And, sometimes I need the DISPLAYs, again. In C I'd just use an #ifdef DEBUG but in Cobol I have to comment out, have I? So with -fsuppress-console-output I could program with lot of debug output and could run in production without debug output. Thanks, Juergen [quote] simrw wrote: Reply to weberjn - Why? You have enough possibilities in the source code and/or the environment to achieve this. [quote] Hi, sometimes it might be useful to disable all displays (for performance reasons in servers). What about a compiler option -fsuppress-console-output ? [/quote] [/quote] ---------------------------------------------------------------- [b]For using the compiler[/b] see [url=http://opencobol.add1tocobol.com/ocfaq.html#does-opencobol-support-d-indicator-debug-lines ]OpenCOBOL FAQ / Debug Indicator[/url] If you want to have different outputs in debug / normal mode use a fake if 1 = 1 like[code] D IF 1 = 1 D DISPLAY "Debug Line" END-DISPLAY D ELSE DISPLAY "Normal Line" END-DISPLAY D END-IF[/code] This sample is missing in the OpenCOBOL Manual (the new name for the OpenCOBOL FAQ). If one of the manual peoples read this, you maybe want to add it. [b]For using the environment[/b] Just define [code] 01 debugmode pic x. 88 debugmode-on values 'O', 'Y', 'J', 'o', 'y', 'j', '1'.[/code] put an [code] accept debugmode from Environment "DEBUGMODE" end-accept[/code] at the beginning of each program (or define debugmode as external) and use it in your programs like[code] IF debugmode-on DISPLAY "Debug Line" END-DISPLAY ELSE DISPLAY "Normal Line" END-DISPLAY END-IF[/code] human ---------------------------------------------------------------- Yes, a flag works. But you still have code for the flag testing at runtime, and the source code is cluttered (the latter is the case in C, too). A compiler flag to ignore DISPLAY statements would produce a faster code and source code would look better. But, your solution allows to switch at runtime. ---------------------------------------------------------------- For having no debug code in runtime you can combine these two: [code] D 01 debugmode pic x. D 88 debugmode-on values 'O', 'Y', 'J', 'o', 'y', 'j', '1'. ... D accept debugmode from Environment "DEBUGMODE" D end-accept ... D IF debugmode-on D DISPLAY "Debug Line" END-DISPLAY D ELSE DISPLAY "Normal Line" END-DISPLAY D END-IF[/code] In this way you have fast code at runtime (if not compiled with -fdebugging-line) and can switch the output during development. The advantages over a compiler switch to disable the displays are: - You can always use display in your program, not only for debug information - You see in the code what you do - If compiled with lines that have 'D' indicator you can switch at runtime - If compiled without lines that have 'D' indicator you can have faster and smaller modules. ---------------------------------------------------------------- I didn't know about 'D' indicators (blush), this is a fine concept. I checked on z/OS, to activate D lines you have to add CONFIGURATION SECTION. SOURCE-COMPUTER. IBM-370 WITH DEBUGGING MODE. This does not enable them with OpenCobol, not even for -std=mvs Should it? Thanks, Juergen ---------------------------------------------------------------- human; I've added your debug tricks to the FAQ/Manual. Cheers, Brian ---------------------------------------------------------------- Also note that there is an OC extension for debugging. That is the "floating debug directive" which is the 3 characters ">>D". This allows debugging stuff which will compile in both fixed and free format source code. Note that usually directives should be specified on or after column 8 so as to be compilable in both fixed and free format. Here you can play a small trick :-) Set columns 1 to 4 as spaces and 5 to 7 as the floating debug directive. That works in both fixed and free format :-) (As columns 1 to 6 are ignored in fixed format and column 7 is the indicator column). Roger ---------------------------------------------------------------- Subject: Multicore-Features and how to optimize the code Does anybody has a working solution for better using multicores? I have to convert large files on a multicore and using 100% of only one core. ---------------------------------------------------------------- Well, really there is not enough info. What OS? What OS version? If Linux, what does "cat /proc/interrupts" show? If you are just converting files, then I would expect that I/O is limiting factor and not CPU. (Depending on the complexity of transformation) However, that depends on how the program is coded. 1) Make sure that all indicators/switches/subscripts/counters are on the 01 level. 2) Define the above as PIC S9(8) COMP-5 (alternatively as USAGE BINARY-LONG SIGNED) 3) Compile with "-std=mf -O2" ifff you are not dealing with COMP fields in the files. Note the various "-std=" change the size AND handling of COMP fields. The above applies to any architecture but especially x86(_64). If you use the 2002 standard BINARY-xxx, then the "-std=' is irrelevant. Roger ---------------------------------------------------------------- I'm using a normal Intel machine, WinXP[cygwin] and Linux with two cores. The transformation is very complex and done in 3 Steps: 1. Read the old files line per line, do analyses about the input and put it into ISAM (in case of OC: BDB) files (needs quite a lot of time). 2. Do some transformations for some of the ISAM files (works quite fast). 3. Export the files in some new structures (needs quite a lot of time too, because of transformation in an xml-like syntax.) Some counters are not on level 01, most on 77 (These a faster than 01 in COBOL/OC, aren't they?) Is it better to have "-std=mf -O2" or counters with USAGE BINARY-LONG SIGNED? ---------------------------------------------------------------- -O2 is a given to produce optimal code (although that is highly dependant on the code). USAGE BINARY-xxx [SIGNED/UNSIGNED] means that REGARDLESS of the -std (or lack thereof) that these fields will be optimally handled in native machine format (and have defined sizes). Note, however, this is only true when these fields are aligned ie 01 or 77 (there is no difference) OR you are on an alignment tolerant machine. OK. and now to the root of the problem. Cygwin is a very slow emulation layer. It's fine (and I use it myself) to do some fairly normal stuff. It Is not OK when an app is processor and/or I/O intensive. I would suggest installing a Linux variant alongside. Modern Linux installs offer at the installation stage an option to resize your Win partition. If you are not strapped for space, then this is the way. Then you get really native speeds. I do this regularly on my boxen. Roger ---------------------------------------------------------------- You do what regularly? Setup a new OS? What std-option is standard? Why do you suggest mf? I will try with -O2, with a virtual machine (should be no big problem with virtualisation features of CPU) and with OpenSuse on an old harddisk. By the way: are substring comparisons slower in OC than a normal one? For example [code]evaluate var-a (10:20) when 'ABCD' perform abcd when 'DEFG' perform defg ... end-evaluate[/code] (there could also be a move of the substring to another string) ---------------------------------------------------------------- > You do what regularly? Setup a new OS? Sure, I do multiple OS installs, otherwise I could not even start on the problems here and on SourceFourge. Recipe - Win first- then the real OS :-) Works every time :-) Every new box with pre-installed Win (or -not) is easily bi-installed with eg. OpenSuse 10.2(3). (Which I do as a matter of course). Roger ---------------------------------------------------------------- Compile with -O2 and running the program does not helped. I may try COMP fields later, but I think the main problem is I/O. Is there a possibility to fasten BDB (I need no locking during the transformation) or maybe a document how to set up VBISAM as the used ISAM? ---------------------------------------------------------------- Subject: "./configure" fails in Windows XP The first line of the "OpenCOBOL Manual" webpage says that "OpenCOBOL is an open-source COBOL compiler, which translates COBOL programs to C code and compiles it using GCC." As I have some legacy Cobol programs on my PC (running Windows XP) and the configuration of my old Cobol compiler was lost on a corrupt hard-drive, I thought OpenCobol answered my prayers ... I have just spent three hours downloading 1.0, then realising it has no Windows interface, downloading 0.33 plus add-ons from Sergei Kiska's website, then entering Windows XP Command Prompt, following the instructions on the "Install Guide" webpage as far as "./configure". This returns "'.' is not recognised as an internal or external command". "Configure" without the "./" returns the equivalent message. When I looked on the Forum for a possible explanation, I found the "Win32 Compilation - 'cl'" post which suggests I also need a C compiler, but I didn't see anywhere obvious that it says this. Does that mean I also need a knowledge of C (or at least how to run the compiler)? -- I have absolutely none. If I DO need to know C, OpenCobol is of no use to me. If I don't need C knowledge, can anyone suggest what is wrong please? DIR shows "configure" as dated 02/08/2007 13:15 with size of 889,776 bytes. Thanks in anticpation :-? ---------------------------------------------------------------- The home page states - OpenCOBOL translates COBOL into C and compiles the translated code using the native C compiler. You can build your COBOL programs on various platforms, including Unix/Linux, Mac OS X, and Microsoft Windows. :-) See the "native C compiler"? However, see the other thread regarding wishlist. ** The above statement is relevant** As stated many times in the past, I support OC in my spare time. Other people are enormously contributing to OC and, in the meantime, we have world-wide successful OC implemtations on a grand scale. To answer this, no, you can not do a "./configure" on Win native :-) Geez, what can "cmd.exe" actually do. Do you really expect that native Win will do POSIX configures? :-) Roger ---------------------------------------------------------------- In other words: you need cygwin if you want to do things like that on Windows. ---------------------------------------------------------------- Or MinGW/MSYS plus prerequisites. Roger ---------------------------------------------------------------- Subject: indexed files Is Isam implimented in open cobol? I am trying to create an Indexed file, and get a filestatus of 35 on open output. I am not sure how to create a new Isam file (if Isam is indeed implimented) Donald ---------------------------------------------------------------- Donald, Post the program. Mail to me config.log and config.h Roger ---------------------------------------------------------------- The program stub looks like so: I get a file status 35 on the first try, a 30 on the open output, and a 35 the second try as well IDENTIFICATION DIVISION. PROGRAM-ID. "COBOL-SCREENS". ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. Select smart-name-file assign to smart-file-name organization is indexed access mode is dynamic file status is smart-status record key is smart-key. DATA DIVISION. FILE SECTION. FD smart-name-file. 01 smart-name-line. 02 smart-key picture x(16). 02 screen-width picture 999. 02 screen-height picture 999. 02 screen-background-c picture 99. 02 screen-foreground-c PICTURE 99. WORKING-STORAGE SECTION. 01 Sequential-input-name picture x(75) value "/home/donald/Library/cobol/mydata". 01 smart-status picture xx. PROCEDURE DIVISION. start-paragraph. open input smart-name-file. display smart-status. if smart-status is not equal to '00' perform fix-smart-status. close smart-name-file. display "Screens Version 1.00". display "Copyright(C), 2008, Donald L. Tees." display "Screens Version 1.00, normal exit". STOP RUN. fix-smart-status. display 'smart-status=' smart-status. if smart-status is equal to '35' close smart-name-file open i-o smart-name-file display 'after open i-o ' smart-status move "SCREENS" to smart-key move 132 to screen-width move 50 to screen-height move 0 to screen-background-c move 7 to screen-foreground-c write smart-name-line invalid key display 'could not create ' Sequential-input-name stop run. display 'after write ' smart-status close smart-name-file. display 'after close ' smart-status. ---------------------------------------------------------------- P.S. What is your mail address? Donald ---------------------------------------------------------------- You lied :-) You are not opening output, you are opening i-o :-) So, 35, 30, 35 is correct. Roger ---------------------------------------------------------------- Actually, I tried both with the same result. The code I sent you was the second try ... changed it and forgot to change it back before clipping and sending it to you. Sorry about that. Donald ---------------------------------------------------------------- Here's your problem - assign to smart-file-name You don't define smart-file-name yourself so you get an implicit W/S field created (ala. MF) However, you do not put any value into smart-file-name. Roger ---------------------------------------------------------------- That took care of the problem, ty. I should have noticed it myself, or deduced it from the strange data name that appeared. I've never quite figured out how to avoid the "string at something obvious and not seeing it" problem. :( Donald ---------------------------------------------------------------- Yes, I think we should warn about this if -Wall is specified. I will cook up a patch. Roger ---------------------------------------------------------------- Subject: return code when you do a call to "system", is there a return code? If so, what is the data name and picture? Thanks Donald ---------------------------------------------------------------- Yes, the status is available in RETURN-CODE - IDENTIFICATION DIVISION. PROGRAM-ID. ac7. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DATA DIVISION. WORKING-STORAGE SECTION. PROCEDURE DIVISION. AA-MAIN SECTION. A00. CALL "system" USING "ls -l ac7.cob" & X'00'. DISPLAY "Return Status " RETURN-CODE. CALL "SYSTEM" USING "ls -l ac7.cob". DISPLAY "Return Status " RETURN-CODE. CALL "system" USING "ls -l doesnotexist" & X'00'. DISPLAY "Return Status " RETURN-CODE. CALL "SYSTEM" USING "ls -l doesnotexist". DISPLAY "Return Status " RETURN-CODE. STOP RUN. ./ac7 -rw-r--r-- 1 root root 716 Jan 25 05:57 ac7.cob Return Status +000000000 -rw-r--r-- 1 root root 716 Jan 25 05:57 ac7.cob Return Status +000000000 ls: doesnotexist: No such file or directory Return Status +000000512 ls: doesnotexist: No such file or directory Return Status +000000512 Note that string literals and/or alphanumeric fields passed to C library routines are expected to be null terminated (ie. for "system"). This is not necessary when using the OC "SYSTEM" library routine (ala MF). You can also specify a RETURNING clause to define your own (numeric) status field - 01 MYRETURN PIC 9(4). .... CALL "SYSTEM" USING "ls -l doesnotexist" RETURNING MYRETURN. DISPLAY "Return Status " RETURN-CODE. DISPLAY "Return Status " MYRETURN. ls: doesnotexist: No such file or directory Return Status +000000512 Return Status 0512 Roger ---------------------------------------------------------------- I suspect there is a bug in there somewhere, and the 512 in your example return should be a 2. [donald@localhost test]$ cat one.cob IDENTIFICATION DIVISION. PROGRAM-ID. "one". ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. WORKING-STORAGE SECTION. 77 program-status picture 999. PROCEDURE DIVISION. start-paragraph. display "this is one". call "system" using "./two" returning program-status. display program-status. DISPLAY RETURN-CODE. STOP RUN. [donald@localhost test]$ cat two.cob IDENTIFICATION DIVISION. PROGRAM-ID. "two". ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. WORKING-STORAGE SECTION. PROCEDURE DIVISION. start-paragraph. MOVE 1 TO RETURN-CODE. display "this is two". STOP run. [donald@localhost test]$ cobc -x one.cob [donald@localhost test]$ cobc -x two.cob [donald@localhost test]$ ./one this is one this is two 256 +000000256 The only arguement that I can pass *FROM* cobol correctly is zero. 1 gives 256, 2 gives 512, etc. The negative results are even stranger. Maybe a misalignment problem? Donald ---------------------------------------------------------------- No, everything is correct. What you are getting is the return status of "system". Do a "man system" to see why you get the values that you see. Here is an excerpt from the system man pages -- RETURN VALUE The value returned is -1 on error (e.g. fork failed), and the return status of the command otherwise. This latter return status is in the format specified in wait(2). Thus, the exit code of the command will be WEXIT-STATUS(status). In case /bin/sh could not be executed, the exit status will be that of a command that does exit(127). -- I know its weird but that is what "system" does. Roger ---------------------------------------------------------------- OK, thank you. It definitely is weird ... looks like I have some more reading to do. Donald ---------------------------------------------------------------- Subject: OpenCobol > Java byte code - interested? Hi. Is someone interested on this compiler? Regards. ---------------------------------------------------------------- Hi, This could be interesting. We have a lot of COBOL programs which we would like to migrate to the java world with re-writing everything. Do you have such compiler ? Regards ---------------------------------------------------------------- No, still not. There is a commercial one (percobol I think) but is too expensive and not OS. My first intention is a full java compiler for COBOL language but may be OpenCobol can emit Java instead of C: instead of develop a full compiler just write the back-end. The problem with this approach is that new back-end should be write in C which I don't dominate because I'm primary a java developer. May be the AST can be streamed in some intermediate code (XML) from C front-end to java writen back-end. Thoughts? Ideas? Regards. ---------------------------------------------------------------- Subject: Unicode Hi, I would like to know if OC supports Unicode (USAGE NATIONAL). Thanks in advance, Pierre ---------------------------------------------------------------- Subject: OpenCobol on Solaris Hi everyone, We are interested in using OpenCobol instead of Microfocus Cobol (ServerExpress 2.0.11) on our new Solaris 10 (sparc) hosts. Can we expect it to work? What sort of code changes do you think we'd need to make? (Ideally we'd like to make none, but I do and try live in the real world.) ;-) Our code is fairly all standard stuff but does call the occasional 'C' function that gets linked into the executable. Is that going to be a problem (we mainly pass fixed length strings)? We do also use indexed files sometimes. I know this is all a bit general at the moment, but any pointers at this stage would be gladly received. Thanks, Michael ---------------------------------------------------------------- It is hard to say if everything will compile and work as expected since each compiler maker has putting its own lanuage extensions. The best way to check is compiling a bunch of sources and see which errors you got. Your bigger problem will be the data files format and conversion. AFAIK (I'm not OC expert) OC uses sleepy cat's berkley db and Micro Focus has its own format. What is the porpuse of the change? Reduce license costs? Regards. ---------------------------------------------------------------- Thanks for your reply. Yes the purpose would solely be to save some money, but if the time taken to do the conversion and testing is too great it won't be worth it. Converting the indexed files won't be an issue as we'd let them be recreated from scratch by the programs. Much of this Cobol was previously converted from a main-frame so hopefully the much of the 'weird' non-standard stuff got smoothed out then. But there's no telling till we give it a try. ---------------------------------------------------------------- > Yes the purpose would solely be to save some money How much is the cost of the Micro Focus license? How many programs? How many lines of source code? Are they batch oriented only or there is screen I/O? Almost forget: One of the biggest issues in the projects I participated about compiler change / migration and/or language migration is that sometimes there is lost sources. This is an (almost) inevitable consequence of entropy: As more years pass is more likely to happend. Regards. ---------------------------------------------------------------- Really good questions from ssamayoa. Why don't you put all your sources in a folder, compile all the stuff (via batch and "for all *.cbl") over night (add the mistakes in the batch to a huge file together) and take a BIG coffee the next morning while inspecting the error file. Then you'll see what your work is about. Files are not THAT big thing to convert: unload all files to line sequential one's via old compiler and then load the line sequential file into BDB via OC. By the way: compiler change from MF is more easy than from others like ACU because OC is very near to MF. ---------------------------------------------------------------- Our Unix systems people are still struggling to install Open Cobol. In fact they haven't even started in the OpenCobol install, they are still trying to get the pre-requisite libraries to install properly on Solaris 10 (it's actually a host with Solaris 10 zones.) :-) The license costs for the new hosts are going to cost around 10,000 GBP I've been told. Not sure how long they will carry on fighting with it, they may just give up and spend the money instead. ---------------------------------------------------------------- I have been trying to do the same install. I have been able to get GMP and OC installed, but have been having issues with BerkeleyDB. I have found that shared needs to be disabled. Before doing any installs, I add these environment variables. #Needed for m4 (I think, it's been a few weeks) export PATH=/usr/sfw/bin:/usr/ccs/bin:$PATH #Since installing to non-standard location export C_INCLUDE_PATH=/db01/pm/opencobol/local/include export CPLUS_INCLUDE_PATH=/db01/pm/opencobol/local/include export LIBRARY_PATH=/db01/pm/opencobol/local/lib export LIBPATH=/db01/pm/opencobol/local/lib #Needed for 64-bit export OBJECT_MODE=64 export LD_LIBRARY_PATH=/usr/sfw/lib/sparcv9 export LD_LIBRARY_PATH_64=/usr/sfw/lib/sparcv9 #To point to known temp directory (had some space issues) export TMP=/db01/pm/opencobol/temp export TMPDIR=/db01/pm/opencobol/temp #Installing GMP #Not sure if the LDFLAGS are needed. Its there from previous failed attempts. After the enable and disable were added it worked. ./configure --prefix=/db01/pm/opencobol/local ABI=64 --disable-shared --enable-static LDFLAGS='-Wl,-L/usr/sfw/lib/sparcv9' #Installing OC ./configure --prefix=/db01/pm/opencobol/local CC='gcc -m64 -mptr64' CFLAGS=' -O2 ' LIBS=' -lpthread' CONFIG_SHELL='/bin/bash' --enable-cxx --disable-shared -without-db I have not been able to install OC with Berkeley DB. Here is the configure I used and the error message from the OC configure. #BerkeleyDB. #From the build_unix directory ../dist/configure --prefix=/db01/pm/opencobol/local CC='gcc -m64 -mptr64' --disable-shared --enable-static --disable-largefile Undefined first referenced symbol in file bind /db01/pm/opencobol/local/lib/libdb-4.5.a(repmgr_net.o) send /db01/pm/opencobol/local/lib/libdb-4.5.a(repmgr_sel.o) accept /db01/pm/opencobol/local/lib/libdb-4.5.a(repmgr_sel.o) listen /db01/pm/opencobol/local/lib/libdb-4.5.a(repmgr_net.o) socket /db01/pm/opencobol/local/lib/libdb-4.5.a(repmgr_net.o) fdatasync /db01/pm/opencobol/local/lib/libdb-4.5.a(os_fsync.o) setsockopt /db01/pm/opencobol/local/lib/libdb-4.5.a(repmgr_net.o) getsockopt /db01/pm/opencobol/local/lib/libdb-4.5.a(repmgr_posix.o) connect /db01/pm/opencobol/local/lib/libdb-4.5.a(repmgr_sel.o) getaddrinfo /db01/pm/opencobol/local/lib/libdb-4.5.a(getaddrinfo.o) freeaddrinfo /db01/pm/opencobol/local/lib/libdb-4.5.a(getaddrinfo.o) gai_strerror /db01/pm/opencobol/local/lib/libdb-4.5.a(getaddrinfo.o) ld: fatal: Symbol referencing errors. No output written to conftest collect2: ld returned 1 exit status ---------------------------------------------------------------- > The license costs for the new hosts are going to cost around 10,000 GBP I've been told. Is almost US$20K! How many cobol programs are? What kind? Batch processing? Data entry? Both? How many C routines they call? Do you have the sources of such C routines? For such money may be I can hire two good Java developers (Swing and/or JSF) and migrate all your application from COBOL to Java, Swing based (client/server) and/or JSF based (Web) Regards. ---------------------------------------------------------------- Sergey has ports available at - http://www.kiska.net/opencobol/ Roger ---------------------------------------------------------------- Subject: Problem HP-UX 11.11 Dear all, I have installed open-cobol on HP-UX just fo fun at home. When I compile a program I get: # cobc -x hello.cob gcc: unrecognized option `-R/usr/local/lib' I am running # gcc -v Reading specs from /usr/local/lib/gcc/hppa2.0w-hp-hpux11.11/3.4.2/specs Configured with: /scratch/njs/pkgbuild/3.3.1/hpux-11/gcc-3.4.2/configure --enabl e-languages=c,c++ --enable-threads=posix --disable-nls --with-gnu-as --without-g nu-ld --with-as=/usr/local/bin/as --with-ld=/usr/ccs/bin/ld --with-libiconv-pref ix=/usr/local --prefix=/usr/local Thread model: posix gcc version 3.4.2 Lars PS I used to program in Cobol 1976--- On a Univac 1100 mainfram ---------------------------------------------------------------- Subject: REDEFINES in LINKAGE SECTION Hello, I try to compile some cobol programs of a professional project, but sub programs have a redefines clause in their linkage section, and OpenCOBOL don't like that. I like to know why it is forbidden. Exemple: LINKAGE SECTION. 01 ZOO1. 10 FILLER PIC X(00200). 01 Z001-Z002 REDEFINES Z001. 10 Z001-TOTO PIC X(5). 10 Z001-TOTO2 PIC X(6). ... I look in the source, and the parser made an error if it seen that. I can comment the line but... Thanks ---------------------------------------------------------------- What OC version? What compile options? Please supply the complete program. Roger ---------------------------------------------------------------- Hi, I'm pretty busy, so it take me a long time to answer... I cannot post the original program, but i find that : LINKAGE SECTION. 01 ZCOM. 15 FILLER PIC X(18). 01 Z001 REDEFINES ZCOM. 10 MT-A PIC 9(6). 10 MT-B PIC 9(6). 10 RES PIC 9(6). PROCEDURE DIVISION USING ZCOM. MOVE MT-A TO RES. ADD MT-B TO RES. GOBACK. This works. LINKAGE SECTION. 01 ZCOM. 15 FILLER PIC X(18). 01 Z001 REDEFINES ZCOM. 10 MT-A PIC 9(6). 10 MT-B PIC 9(6). 10 RES PIC 9(6). PROCEDURE DIVISION USING Z001. MOVE MT-A TO RES. ADD MT-B TO RES. GOBACK. This one cannot compile (Z001 / ZCOM in PROCEDURE DIVISION USING) : addi.cob:14: Error: 'Z001' REDEFINES field not allowed here It works with : IBM Enterprise COBOL for z/OS 3.3.1 MicroFocus Server Express 4.0 I have OC 1.0 I try with all -std parameters Regards ---------------------------------------------------------------- I'm not sure why there is an error but if You do not need ZCOM on program B you can delete ZCOM from linkage section and just define Z001 instead. ---------------------------------------------------------------- Subject: Initialize with Reference Modification I've never seen an initialize like that before, maybe it is not well formed:[code]initialize mybigvar (15491:4500)[/code] This is compiled by OC (also 1.1 prerelease). Is this according to COBOL 85? With an old version of OC (cannot post the big program here and cannot test it with OC 1.1 prerelease, the old one was a later 0.33 prerelease) there was ANOTHER variable initialized that was about 18000 Bytes BEFORE mybigvar. A small test program with 1.1 prerelease does not has that problem but I'm not sure a) if this code is OK so that OC should compile it and b) if this mistake couldn't occur in newer releases. Maybe someone has noticed things like that or know if there were some changes about that in OC since the last year. PS: After changing the code to [code]move spaces to mybigvar (15491:4500)[/code] all was fine but I did not realized that a wrong variable was changed... ---------------------------------------------------------------- Well, if I am understanding the 2002 standard correctly, this is valid. HOWEVER, we have a bug in OC - 01 D99 PIC X(50000). PROCEDURE DIVISION. INITIALIZE D99 (15491:4500). MOVE SPACES TO D99 (15491:4500). This generates - /* TST.cob:12: INITIALIZE */ { memset (b_10 + 15490, 32, 50000); } /* TST.cob:13: MOVE */ { memset (b_10 + 15490, 32, 4500); } Which, of course, is wrong for the INITIALIZE. I am testing a fix now. I will post when a new tarball is available. Roger ---------------------------------------------------------------- Preliminary fix included in current 1.1 tarball. Please download/test. Thanks for reporting this. Roger ---------------------------------------------------------------- Subject: RECORD CONTAINS 0 On the mainframe, if you code record contains 0 on the fd statement, you can read in fb files of any length up to and including the size you give for the 01 level for that file(i.e. the file needn't be vb). But in OC, this doesn't work. It throws an error that the it came to the end of line too early. Should record contains 0 behave the way it does in OC or the way it does in the cobol that comes with the mainframe? ---------------------------------------------------------------- Actually, it should not compile. I have fixed this in the 1.1 tarball. Roger ---------------------------------------------------------------- Why do you say it shouldn't compile? This compiles and runs in more than one version of COBOL I've used. Here is one page showing HP either supports it or is in the process. I'm not sure what status 'D' stands for. http://docs.hp.com/cgi-bin/doc3k/BB243390012.12979/86 ---------------------------------------------------------------- From HP Docs - Implementation Status of the Feature (space) Fully implemented. I Fully implemented, but another directive* (not the dialect one) enables it. U Syntax support but no run time support in some environments. D Implemented as documentary. G A group of features. :-) :-) Roger ---------------------------------------------------------------- Subject: Problem with LINE SEQUENTIAL and RECORD IS VARYING The following program compiles and runs fine under HP,Acucobol and Kobol but does not compile under Opencobol. I believe this is a bug. IDENTIFICATION DIVISION. PROGRAM-ID. test01. ENVIRONMENT DIVISION. CONFIGURATION SECTION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT INFILE ASSIGN INPUT-FILE ORGANIZATION IS LINE SEQUENTIAL ACCESS MODE IS SEQUENTIAL FILE STATUS IS INPUT-STATUS . SELECT OUTFILE ASSIGN OUTPUT-FILE ORGANIZATION IS LINE SEQUENTIAL ACCESS MODE IS SEQUENTIAL FILE STATUS IS OUTPUT-STATUS . DATA DIVISION. FILE SECTION. FD INFILE RECORD VARYING FROM 1 TO 4096 CHARACTERS DEPENDING ON INPUT-LEN . 01 INPUT-REC PIC X(4096). FD OUTFILE RECORD VARYING FROM 1 TO 4096 CHARACTERS DEPENDING ON OUTPUT-LEN . 01 OUTPUT-REC PIC X(4096). WORKING-STORAGE SECTION. 01 INPUT-FILE PIC X(196) VALUE 'IN'. 01 INPUT-STATUS PIC XX. 01 INPUT-LEN UNSIGNED-SHORT VALUE 4096 . 01 OUTPUT-FILE PIC X(196) VALUE 'OUT'. 01 OUTPUT-STATUS PIC XX. 01 OUTPUT-LEN UNSIGNED-SHORT VALUE 4096 . PROCEDURE DIVISION. A000-BEGIN. OPEN INPUT INFILE. OPEN OUTPUT OUTFILE. READ INFILE AT END STOP RUN NOT AT END MOVE INPUT-LEN TO OUTPUT-LEN MOVE INPUT-REC TO OUTPUT-REC END-READ. WRITE OUTPUT-REC CLOSE INFILE. CLOSE OUTFILE. STOP RUN. ---------------------------------------------------------------- Not a bug. LINE SEQUENTIAL is not part of any standard. I believe it was invented by MF. L/S files are neither fixed nor variable in the Cobol sense (And that is how MF document it). So the RECORD clause is not allowed. Roger ---------------------------------------------------------------- How else can a program read in a text file and know the bytes read? Or for that matter if you wish to write a text file of a fixed length (with trailing spaces)? Yes you can hard code an FD for each required record length but it is much better to handle it with a "RECORD IS VARYING FROM X TO Y BYTES DEPENDING ON Z". Then when you read or write a record, you the programmer can control the record sizes. ---------------------------------------------------------------- You obviously do not understand what LINE SEQUENTIAL is. You want to write a "text file" of "fixed length"? Easy, define it as your desired fixed length (not LINE SEQUENTIAL) and put the trailing new-line yourself as the last byte in the record. When L/S records are written, trailing spaces are removed and a new-line is automatically appended. When L/S records are read, bytes are transferred to the record area until a new-line is hit. The remaining bytes in the record area are initialized to space. What's the problem? This incidentally is exactly what MF and ACU do. Roger ---------------------------------------------------------------- Subject: OC and z/Linux Has anyone tried to install OC on z/Linux? I'm waiting to get access to the box, so I thought I would check beforehand. ---------------------------------------------------------------- Should not be any problem. Make sure all the prerequisites are in place (see README). Recommend you use OC 1.1. General z/Linux info on wikipedia - http://en.wikipedia.org/wiki/Linux_on_zSeries Scrolling down to "Developer Resources", I notice that IBM offer "test drive" facilities. Interesting. I may look at that myself. Roger ---------------------------------------------------------------- Subject: install problem Hi, i've an installation problem on a linux redhat 6.2 i've installed libgmp and opencobol 1.1 when i complie a program and run ... this is the error error in loading shared libraries:libcob.so.1 cannot open shared object file: no such file o directory the file exist in /usr/local/lib/ and i linked it manually in etc/profile but the problem continue tks for an help Lu ---------------------------------------------------------------- Read the README :-) In particularly, the part regarding ldconfig. Roger ---------------------------------------------------------------- I've installed gmp But, when I try ./configure for open-cobol-1.0 : checking getopt.h usability... yes checking getopt.h presence... yes checking for getopt.h... yes checking gmp.h usability... no checking gmp.h presence... no checking for gmp.h... no configure: error: gmp.h is required How gmp must be installed ? Thanks for your help. ---------------------------------------------------------------- It might help if you reported - a) For which system b) How you installed GMP You did notice this in the README? - ---- o GNU MP (libgmp) 4.1.2 or later http://gmplib.org *** Note - Recent Linux distributions have runtime AND development packages; BOTH are required *** ---- Roger ---------------------------------------------------------------- Subject: Reading DAT and IDX files from Micro Focus cobol Hi, i've been browsing this site and i'm trying to read (and maybe even write to) DAT and IDX files from a legacy Micro Focus cobol application. Can i use OpenCobol to do this? Thanks in advance... Chris ---------------------------------------------------------------- If I am right: This is not possible. I would suggest to unload the files via MF into a text file and load this file via OC into one of the possible index sequential files (I think BDB is the standard type). ---------------------------------------------------------------- Most likely the index (IDX) file is completely worthless to you. It is, however, likely that the DAT file is just data. You may need to look at it with an advanced editor or even a hex editor to know whether it is ASCII or EBCIDIC, and how it has encoded things like packed numbers. I haven't used MicroFocus since '95, but then, I think the DAT files were just fixed length data. It's been a while, though :lol: . ---------------------------------------------------------------- Thanks for the help, although its not really good news! ---------------------------------------------------------------- Subject: Problem with compiling (newbie) I'm working with cygwin on Vista, and running into a problem with the standard Hello World program. I've tested gcc and it works fine for C programs, but when trying to compile a COBOL program I get the following. $ more hello.cob IDENTIFICATION DIVISION. PROGRAM-ID. hello. PROCEDURE DIVISION. DISPLAY "Hello World!". STOP RUN. $ cobc -x hello.cob hello.cob:1: Warning: Invalid indicator 'I' at column 7 It does create an executable, but it does not display anything when it is run. Has anyone run into a problem like this before? ---------------------------------------------------------------- Try "cobc -x -free hello.cob" ---------------------------------------------------------------- Thank you, that solved the problem. ---------------------------------------------------------------- indent your code with 7 spaces, this is an old throwback to the required formatting for cobol, the 1st 7 characters were reserved for line numbers. ---------------------------------------------------------------- Subject: MVS port Is anyone interested in porting OpenCobol to MVS? There has been a recent breakthrough on MVS. The freely available MVS 3.8j (24-bit) has been converted into MVS/380 which allows 31-bit programming with more than 16 MB of memory (something like 700 MB is allowed) with the caveat that only one application at a time that uses that above-the-line memory can be run at a time. In addition, it comes with a port of GCC 3.2.3 which is now a conforming compiler if you don't count the odd bug that hasn't been fixed yet, and also the C runtime library provided is not quite conforming too. Which may or may not affect Open Cobol. There may be some actual real MVS sites out there with a legacy app written in Cobol that needs more than 16 MB of memory and they may be able to run it on Open Cobol running under MVS/380 if it were available. It would be nice to have some "real" users. :-) MVS/380 is available here: http://mvs380.sourceforge.net Source for the supplied applications is on different sourceforge sites. I tried downloading Open Cobol 1.0 to see if it compiled on GCCMVS but couldn't even get it to compile on my Windows Vista system with Cygwin (various errors in configure which I'd have to investigate). Can anyone tell me if OpenCobol uses any extensions to C90 at all? I had a look at some of the code and it looks clean. I did a grep and found some mention of MVS, but I know it is not listed as a supported platform. What do you think would be required to get it to the point where it can at least compile and run simple Cobol programs that read from a sequential dataset and produce a report to the printer? That would at least provide a basis on which to work. Note that Bison 1.35 and Flex 2.5.4a have also been ported to MVS/380. But not Bison 1.875 which is listed as a requirement. I think that contains non-C90 stuff like fork(). BFN. Paul. ---------------------------------------------------------------- Paul, I did z/OS (OMVS) OC 0.33 port once, but that was mostly to check if OC can work in EBCDIC environment. I think nobody used it for real. If your C/C++/libraries are limited, OC will be the least of your worries. It was a big headache to build GMP and BDB even with a native "cc" under OMVS. Regards, Sergey ---------------------------------------------------------------- Hi Sergey. Does the procedure you used to do the z/OS port still exist? Perhaps it could be documented and made part of current Open Cobol? I don't have C++ libraries, just C libraries. Does some component use C++? The C library is pretty complete (close to C90 standard). Can you tell me something about the GMP and BDB problems? I assume you overcame these problems, so do you have a patch of some sort with your changes? BFN. Paul. ---------------------------------------------------------------- Hi Paul, BDB (4.4.20) went relatively easy - small patch in log.c and tweaking of configure and small editing of Makefile after... GMP (4.2.1) is another story. For whatever reason z/OS can't link if you have 2 object filenames with the same name, even in a different directories. Some dependencies on CSECT generation... So you have to rename all mpn/, mpq/, and mpz/ source files (or to have a symbolic links with a different names, that's how I did) to have a different names. Of course you can't use Makefile-s produced by configure, so it was better just to write shell scripts for compile/link And of course about 7 different source patches :-) If you want to see this stuff, grab it from z/OS part of this page: http://www.kiska.net/opencobol/0.33/index.html Regards, Sergey ---------------------------------------------------------------- Sergey, interesting to see your port. Given that you've already made all the code work on z/OS, then what do you believe I would need to do to port this to a pure C90 environment on MVS 3.8j/380? As I see it, I need to: 1. Create JCL to do all the compiles. 2. Potentially replace open() with fopen() etc if people have used Posix instead of C90 functions. Note that I already have such routines which I needed to do to port GCC itself to MVS 3.8j/380. Can you tell me if there is anything fundamental I am missing? E.g. if OpenCob generates non-standard C code relying on fork() to exist or something like that, then I will not attempt to proceed. But if OpenCob generates standard C90 code or close, then it would seem doable. BTW, what's the reason this was required? s390\gmp-4.2.1\mpz>diff inp_str.c.orig inp_str.c 83c83 < if (c == '-') --- > if (c == (unsigned char)'-') 98c98 < if (c == '0') --- > if (c == (unsigned char)'0') 103c103 < if (c == 'x' || c == 'X') --- > if (c == (unsigned char)'x' || c == (unsigned char)'X') 109c109 < else if (c == 'b' || c == 'B') --- > else if (c == (unsigned char)'b' || c == (unsigned char)'B') 119c119 < while (c == '0') --- > while (c == (unsigned char)'0') I've never seen a need to do something like that before and I would have assumed that that change would have had no functional effect. BFN. Paul. ---------------------------------------------------------------- Hi Paul, 1. OpenCobol is not using fork(). There is no fork() on Windows too. It uses "system" call to call components of the compilation process (i.e. cobc, c compiler, linker). 2. BDB (that might be critical) is actively using multithreading and pthread library. If you don't have that, than you need to think how to implement ISAM files... 3. > I've never seen a need to do something like that < if (c == '0') --- > if (c == (unsigned char)'0') If you force "char" to be "unsigned" (which is actually default in IBM C on z/OS), you might get another problems because I saw part of the code relying on "signed"...(If you saw my build files you should see "-Wc,LONGLONG,CHARS(SIGNED)" OC itself should not have this problem (I've actually never checked), but I believe GMP and BDB might have. Otherwise the value of '0' is negative in EBCDIC :-) Regards, Sergey ---------------------------------------------------------------- Ok, I will need to replace the system() to the linker etc and instead get OpenCobol to finish as soon as the C code has been generated. It will be a separate job step to do the C compile, and the assemble, and the link. Passing the appropriate intermediate files between programs is best done (and pretty much only possible to be done) via JCL. Otherwise you can't specify all the DCB attributes and space requirements, things like that. If BDB is using multithreading, and there's no easy way to switch that off, I might just skip support for ISAM files. I'm more interested in having Cobol reporting programs that read sequential files working. ISAM can be added another day. Or does sequential file access go through BDB too? Wow, I would have never guessed that chars were being forced to being signed on an EBCDIC machine. That's actually against the C standard. The basic character set must be represented as positive numbers. Something else needs to change if that doesn't work. Ok, I think I'll give it a go. I'll need to know which C files to compile for MVS. I'll assume all of them need to be compiled and delete any if I find errors. Is there any reliance on C++? I don't have C++ available, so that would put an immediate end to the attempt. BFN. Paul. ---------------------------------------------------------------- > signed on an EBCDIC machine. That's actually against the C standard IBM compilers have char-s unsigned by default. All other compilers by default using signed char. It's not in C standard I think. > Is there any reliance on C+ No. At least so far no. > get OpenCobol to finish as soon as the C code has been generated There is "-C" option for that. You can use it and make system() call just void function. But the same limitation will be in Cobol runtime if you want to "run the unit". Regards, Sergey ---------------------------------------------------------------- >> signed on an EBCDIC machine. That's actually against the C standard > IBM compilers have char-s unsigned by default. > All other compilers by default using signed char. > It's not in C standard I think. The C standard is that the basic character set must be positive values. If a signed char can do that, that's fine, and on most ASCII compilers that will be the case, and that's what they use as a default. But EBCDIC machines can't do that as a signed char, so the default is unsigned char, and if you switch that to signed char, then the compiler will cease to be conforming (on that platform). A C program that relies on chars to be signed by default is non-conforming. > There is "-C" option for that. You can use it and make > system() call just void function. But the same limitation > will be in Cobol runtime if you want to "run the unit". Can you explain this please? The Cobol runtime will be statically linked into the executable the same way that the C runtime library is, won't it? Or is that not supported? BFN. Paul. ---------------------------------------------------------------- > "run the unit". I mean that in Cobol you have a functions to spawn a separate process (CALL SYSTEM, etc) which uses of course underlying "system()" function. Cobol also has "dynamic" calls, which resolved thru "dlopen" and etc functions (or equivalent LoadLibrary on Win) - do you have that in MVS ? Otherwise you should rewrite those parts of runtime too. Regards, Sergey ---------------------------------------------------------------- > I mean that in Cobol you have a functions to spawn a > separate process (CALL SYSTEM, etc) which uses of course > underlying "system()" function. Ok, for that I'll just say "call system" is not supported in this subset. > Cobol also has "dynamic" calls, which resolved > thru "dlopen" and etc functions (or equivalent > LoadLibrary on Win) - do you have that in MVS ? Certainly I don't have it at the moment, but that should be able to be added in the future too. > Otherwise you should rewrite those parts of runtime too. But to run a simple Cobol reporting program, I don't need to worry about this now, right? Everything that is needed to compile and run it just needs a standard C90 compiler, right? Note that the specifics of what system() actually does is outside the scope of C90, so I'm not concerned that I don't support that functionality. BFN. Paul. ---------------------------------------------------------------- I've been hoping for an mvs port for a long time. Don't forget to post back if you get it working. ---------------------------------------------------------------- [quote] jasorn wrote: I've been hoping for an mvs port for a long time. Don't forget to post back if you get it working.[/quote] I've only had a quick look at it, and there are things like cobc.c including sys/stat.h, so it's apparently not C90-compliant. Meanwhile, I have been working on PDPCLIB, bringing it up to C90-compliance. That has now been achieved, so we have a free C90 compiler available on MVS. Not only that, but MVS/380 has just been released so now you have a free MVS without memory restrictions. And a new version of GCCMVS too. So the underlying components are now in place and can be obtained from: http://mvs380.sourceforge.net http://gccmvs.sourceforge.net http://pdos.sourceforge.net I haven't decided which project to start on yet. An OpenCobol port to MVS/380 is certainly one possibility, but other interesting things are getting PDPCLIB to support more compilers (e.g. IBM C), upgrading GCC from 3.2.3 to 3.4.6 level, getting GCC ported to some more environments - specifically DOS/VSE and MUSIC/SP, and creating a 380 (31-bit) version of DOS/VS. A lot also depends on what other people are doing. If others are working on something that I can assist with, I generally prefer to do that as it provides more results. The current burst of activity is people trying to use GCC + PDPCLIB in different aspects of VM/CMS, so I'll probably be assisting there until they run out of steam. BFN. Paul. ---------------------------------------------------------------- Subject: [fixed] 1.1 - undefined symbol: cob_save_call_params (newbie) I'll switch to 1.0, but I get this error: $ cobc -x hello.cob $ ./hello ./hello: symbol lookup error: ./hello: undefined symbol: cob_save_call_params $ cat hello.cob * Hello World Program * GPL Copyleft Jonathan Riddell 2001 IDENTIFICATION DIVISION. PROGRAM-ID. hello. ENVIRONMENT DIVISION. DATA DIVISION. PROCEDURE DIVISION. DISPLAY "hello ," WITH NO ADVANCING DISPLAY "world!" STOP RUN. ---------------------------------------------------------------- I get the same thing in 1.0. I'm running on Gentoo Linux. ---------------------------------------------------------------- [quote] cat test01.cbl * Hello World Program * GPL Copyleft Jonathan Riddell 2001 IDENTIFICATION DIVISION. PROGRAM-ID. hello. ENVIRONMENT DIVISION. DATA DIVISION. PROCEDURE DIVISION. DISPLAY "hello ," WITH NO ADVANCING DISPLAY "world!" STOP RUN. $ cobc -x -free test01.cbl $ ./test01 hello ,world! [/quote] Your Program works on my System (Debian Etch, OC 1.1) Is that your 1rst installation ? Uninstall previous release correctly ? Regards Bear ---------------------------------------------------------------- [quote] Uninstall previous release correctly ? [/quote] That was it. I had gentoo emerged 0.32 before installing the 1.1. Fixed. ---------------------------------------------------------------- Subject: Newb: Error: syntax error, unexpected TOK_FILE, expecting $end Ok so I had to write a program for school in percobol and it compiles just fine. But I wanted it to run on linux in native code instead of java (juk). However opencobol gives an error that I don't quite understand: ProjectOverzicht-ErikDeRijcke.cbl:12: Error: syntax error, unexpected TOK_FILE, expecting $end link to the full program code: http://pastebin.com/m7ec8d95c I'm still a total cobol noob so hints and tips on how to succesfully compile and improve my code would be greatly appreciated. ---------------------------------------------------------------- 1. Which OC-version are you using? (cobc -v) 2. remove "record contains 80 characters", because the record size is defined with first entry after your fd-clause 3. If you like, you could write [code] move low-values to projectkeuze, outputkeuze, totaletijd[/code] 4. In alleprojekten and enkelproject there are some performs, that are allways done. Maybe you want to put them after end-evaluate. 5. I personally prefer sections instead of paragraphs when using perform. ---------------------------------------------------------------- cobc (OpenCOBOL) 1.0.0 Copyright (C) 2001-2007 Keisuke Nishida Copyright (C) 2007 Roger While I managed to rewrite my original percobol code and now the error is gone. No idea what caused it though :s Now I get errors on the embedded sql, opencobol doesn't support it I guess? Anyway thanks for the tips, I'll make sure to change my code accordingly! :) ---------------------------------------------------------------- The original program has the following problems - 1) The "data division" starts in column 7. As "d" in the indicator column (7) denotes a debugging line, this line is ignored (per default) causing the original error. 2) The RECORD CONTAINS clause is invlaid for LINE SEQUENTIAL files (This has been relaxed to a warning in OC 1.1) 3) Level 77 entries are not allowed in FD clauses. (Should be 01) 4) The "EQUALS" keyword is not Cobol standard. (It is accepted in OC 1.1) 5) EXEC-xxx is not supported. Roger ---------------------------------------------------------------- Subject: screen section not identified Hi, I am using SCREEN SECTION in my program and the error is : unexpected SCREEN expecting WORD or LITERAL. pls let me know if there is any changes in defining a SCREEN SECTION. thanks sm ---------------------------------------------------------------- There is no support for Screen Section in OC. @simrw: Maybe a good thing for a compiler message 'Screen Section not supported'? ---------------------------------------------------------------- Subject: Re: REDEFINES in LINKAGE SECTION I think that i have some solutions : - Use the first program (in USING clause, ZCOM and not Z001) - Define ZCOM as group containing Z001 I think those two solutions are similar (ie when i change a value in Z001, ZCOM change too). But i have a lot of program like that, and i need to find an automatic procedure. Regards ---------------------------------------------------------------- Sorry, seems i click on new topic, and not reply to... ---------------------------------------------------------------- The Cobol standard is quite clear in this respect (85 and 2002). Excerpt from USING clause - Data-name-1 shall be defined as a level 01 entry or a level 77 entry in the linkage section. A particular user-defined word shall not appear more than once as data-name-1. The data description entry for data-name-1 shall not contain a BASED clause or a REDEFINES clause. End excerpt. Do not think that you can take out the check in the parser. That will not work. Roger ---------------------------------------------------------------- I think i can use ZCOM in USING clause. If i made a modification in Z001, modification will be reported to Z001 ??? This code is generated by a IBM tools. I just post in case you want to make opencobol compatible with IBM Compiler and microfocus compiler... Regards ---------------------------------------------------------------- Just change all your programs via command line tools, like sed in unix environment and make them work according to the cobol standards. This would help you to compile them on OC, MF, ACU, IBM etc. Non-standard stuff works only in some environments. ---------------------------------------------------------------- If that stuff is generated by IBM tools, then I would complain very loudly to IBM for not following the standards. Roger ---------------------------------------------------------------- Subject: What are these command line options for? (solved) [quote]cobc -fstatic-linkage Statically allocate non-USING LINKAGE parameters -fstack-check PERFORM stack checking[/quote]What does these parameter are helpful for, should they be set normally? Edit: Thank you! ---------------------------------------------------------------- To answer the second question first, no, you would not normally need to set these parameters. -fstack-check On a Cobol per-module basis, PERFORM processing is done by pushing/popping information onto a locally declared stack. This has a fixed size of 255. The -fstack-check generates code to detect if the stack overflows. This option is automatically turned on if you specify one or both of "-g", "-debug". -fstatic-linkage As stated in the help, this only applies to LINKAGE data items that are not referenced in the PROCEDURE DIVISION USING clause. Normally, LINKAGE items lose their validity when exiting the module (they are local). This option causes these data items to be statically allocated thus retaining their validity after the module has exited. Roger ---------------------------------------------------------------- Subject: Emtpy programs are compiled without an error I think this program should not be compiled, because of missing procedure division, but OC does. Is this wanted?[code] IDENTIFICATION DIVISION. PROGRAM-ID. shorttest. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION.[/code] ---------------------------------------------------------------- This is perfectly OK. According to the standard, the minimum valid program is the one-liner : PROGRAM-ID. shortest. Which is valid either as a main program or as a callable module. :-) Roger ---------------------------------------------------------------- Can we invent a new warning (not set by -Wall)? -Wempty ---------------------------------------------------------------- Why? Neither MF nor ACU produce any warning. Roger ---------------------------------------------------------------- Because a warning would be a nice feature for everybody who doesn't like to have such programs. Y/N? ---------------------------------------------------------------- N :-) Why produce a warning for a valid program? Roger ---------------------------------------------------------------- Subject: debug with gdb Hi: Can open-cobol debug with gdb? I test it, but I found it uses generated C source file rather than Cobol source file for debugging. Is it possible to trace through the cobol source code? open-cobol version 1.1 Thank you very much :) ---------------------------------------------------------------- Can anyone tell me some information about this? Can the gdb debugger trace through the cobol source code? Thank you so much! ---------------------------------------------------------------- No, only the C code. Until recently, we did have #line directives (optionally) generated. BUT, this did not work. gdb (and other variants eg. ddd) got confused with the #line directives referring to eg. #line 10 "abc.cob" after returning, gdb would complain that current line number was out of range. (Clearly the case with the C code, as the C line number is way bigger) Roger ---------------------------------------------------------------- That's OK. Thanks for your reply :-) ---------------------------------------------------------------- Just curious.. What are the plans to make it work? It seems that it technically possible because it works with the Fortran compiler, Isn't it? Thanks! ---------------------------------------------------------------- Fortran is a front-end for gcc :-) Actually, if you use the -ftraceall compile option in latest OC 1.1, you will get a statement trace on stderr. And the generated C code reflects this, so you can see it with gdb; eg. /* roger.cob:19: SET */ cob_set_location ("roger", "roger.cob", 19, "MAIN SECTION", "MAIN PARAGRAPH", "SET"); Roger ---------------------------------------------------------------- OK, thank you very much :) Jason ---------------------------------------------------------------- Also with current OC 1.1, if you specify "-g" and/or "-debug", the "cob_set_location" calls will be generated. There will be no print to stderr unless you specify "-ftraceall". Roger ---------------------------------------------------------------- Subject: Migrating MF to OC: INVALID KEY Hi, I'm new to OC and I'm trying to migrate my cobol sources from MF to OC. In one of my sources I have a structure like this: WRITE F1LIGNE INVALID KEY DISPLAY "ERROR" GO EXIT-PROGRAM END-WRITE which causes the error INVALID KEY clause invalid with this file type. Before it was succesfully compiled by MF. Best regards, Geert ---------------------------------------------------------------- Please submit the full INPUT-OUTPUT SECTION and FILE SECTION to the mentioned program. If the file is not indexed, the message would be right. ---------------------------------------------------------------- Ok, here is my Input-Output and File section. INPUT-OUTPUT SECTION. *===================== FILE-CONTROL. SELECT F1 ASSIGN TO DYNAMIC FILIMP ORGANIZATION IS LINE SEQUENTIAL. DATA DIVISION. *============== FILE SECTION. *============= FD F1 RECORD IS VARYING IN SIZE FROM 1 TO 132 CHARACTERS DEPENDING ON LONREC. 01 F1LIGNE PIC X(132). Thanks in advance, Geert ---------------------------------------------------------------- As I said before: there is no key on line sequential files and therefore no need for your piece of [code]INVALID KEY DISPLAY "ERROR" GO EXIT-PROGRAM[/code]. Just delete it, this will work with oc and mf. ---------------------------------------------------------------- Indeed, the clause is invalid. Note that if the write is changed to a read, then MF produces - simlinux:~ # cob mffile.cob 33 read infile invalid key go to start-100. * 368-S**************************** ** ** Exception phrase inappropriate This is very clearly a MF deficiency. I will raise a bug report against MF SE (2.2and 4.x). And you should do the same. The syntax is invalid for WRITE to a SEQUENTIAL file both according to Cobol standard and MF documentation. Roger ---------------------------------------------------------------- Thanks for your quick answer. Is there a way to detect if this write is invalid? Or is it something like "IF NOT ACCES-OK"? Regards ---------------------------------------------------------------- You can compare the file status, see mf-docu at http://supportline.microfocus.com/documentation/books/nx50/lhtocc.htm 'ANSI File Status Summary' --> 'I/O-STATUS' Status '00' means always operation successful. ---------------------------------------------------------------- Subject: Migrating from MF to OC: "Indexed by" Hi all, in my cobol programs I have a variable with an index: 01 EUXXV. ... 07 TABDIN OCCURS 00020 INDEXED BY NUMDIN. when I want to put this index on 1 like the following line, I got an error from cobc. SET NUMDIN OF EUXXV TO 1. Error: 'NUMDIN' in 'EUXXV' undefined This isn't normal, is it? I think it is a bug, I created already a bug report on the sourceforge page (request ID:1939997) Is there a workaround for this problem? Best regards, Geert ---------------------------------------------------------------- Hi, I found the problem. When using an indexed by the INDEXED BY construction cobc will create a global variable in his generated C-code and this must be logically unique. There is no need to specify the table. In my case this results in: SET NUMDIN TO 1. Best regards, Geert ---------------------------------------------------------------- Actually, according to the standard, qualification of an INDEXED BY item is allowed. So, the following is valid code and should be correctly interpreted by OC (I have a fix in test) - 01 AA. 03 BB PIC X OCCURS 10 INDEXED BY ZZ. 01 CC. 03 DD PIC X OCCURS 10 INDEXED BY ZZ. Note that the 2 "ZZ" items are 2 unique fields. SET ZZ OF BB OF AA TO 1. or (in this case) SET ZZ OF AA TO 1. Also qualification is allowed even if the referenced item is unique. I will post when the fixes have been included in the 1.1 tarball. Roger ---------------------------------------------------------------- OK. Fix applied. OC 1.1 tarball updated. Roger ---------------------------------------------------------------- Subject: roadmap for open cobol ? Hi, I am new one here. I have installed OC1.1 under Linux and tried to convert 2 typical mf-sources: a) the first accept/display related with diverse mf-extensions like "with size, with secure, with grid, etc." b) the second with i-o work - split keys etc. I could change the a) source to compile without error, but the execution is very poor (function keys makes big problems) The b) source could not be compiled to the end, because OC does not support the "split keys" - it is since essential since 25 years My question is if there is a roadmap to point b) ? ---------------------------------------------------------------- What I did was the following: the split key with the fields key-part-1a and key-part-1b 05 key-part-1a pic x. 05 key-part-1b pic x. changed to split key key-part-1 05 key-part-1. 10 key-part-1a pic x. 10 key-part-1b pic x. I do not know for sure if this is the only working solution, but it works for now. ---------------------------------------------------------------- Hi, I'd like to know if the feature about the "Split Keys"'s support is viable for next OpenCobol's implementations? Thanks! ---------------------------------------------------------------- Subject: file status on concurrent access I noticed strange behaviour on a program during migration. This program opens a text file for input and an indexed file for output. I ran many times successfully until I made a mistake and ran it again without paying attention that the first process was not terminated. My problem is that nothing happened : no message, no error, so I modified the lock mode, declaratives, and tried again. Same results as if there were two different programs running for two different indexed files. I suppose I've forgot something ? My system Debian Etch OpenCobol 1.1.0 April 2008 (latest tarball) Regards ---------------------------------------------------------------- Assuming you are using BDB. For multi-user access/locking with BDB, you need to activate BDB concurrency. This is done by setting/exporting the environment variable "DB_HOME" to a directory that is read/writable for all users that should be able to access the files. Notes - a) This requires BDB version >= 4.1 b) Files that do not resolve to an absolute path will be created in the above directory. Also note the above is not OC specific, this is general BDB usage. (I am considering defaulting DB_HOME to something or other if not defined by the user) Roger ---------------------------------------------------------------- Thank You Roger, I was only concentrated in my OC environment, and of course I have no idea how BDB works ;-). Yes I'm working with BDB >=4.1 My working directory (in witch I store all my OC files) looks like "/users/something" : so I will test again. Best Regards. Bear Is someone kind enough to tell me where can I find BDB documentation / information useful for OC (and for me). Thanks ---------------------------------------------------------------- Hi, Setting DB_HOME to my working directory gives great results. I added some lines in my program in order to display file status after every IO statement. I ran first process (more than 250 000 items to be loaded on a indexed file) - Ok As this process was still working, I ran same program : this time I have a file status = 61 on open output for my indexed file. then every write statement is invalid (which is normal) and gives up a status of 48 (which is understandable). what is file status 61 ? Best regards ---------------------------------------------------------------- This is an interesting question. MF says nothing about status 61 http://supportline.microfocus.com/documentation/books/nx50/lhpdf613.htm ---------------------------------------------------------------- Excerpt from the Cobol standard - ***** 9.1.12.7 Record operation conflict condition with unsuccessful completion 1) I-O status = 51. The input-output statement is unsuccessful due to an attempt to access a record that is currently locked by another file connector. 2) I-O status = 52. The input-output statement is unsuccessful due to a deadlock. The implementor shall specify under what conditions a deadlock is detected. 3) I-O status = 53. The input-output statement is unsuccessful because the statement requested a record lock, but this run unit holds the maximum number of locks allowed by this implementation. 4) I-O status = 54. The input-output statement is unsuccessful because the statement requested a record lock, but this file connector holds the maximum number of locks allowed by this implementation. 9.1.12.8 File sharing conflict condition with unsuccessful completion 1) I-O status = 61. A file sharing conflict condition exists because an OPEN statement is attempted on a physical file and that physical file is already open by another file connector in a manner that conflicts with this request. The possible violations are: a) An attempt is made to open a physical file that is currently open by another file connector in the sharing with no other mode. b) An attempt is made to open a physical file in the sharing with no other mode and the physical file is currently open by another file connector. c) An attempt is made to open a physical file for I-O or extend and the physical file is currently open by another file connector in the sharing with read only mode. d) An attempt is made to open a physical file in the sharing with read only mode and the physical file is currently open by another file connector in the I-O or extend mode. e) An attempt is made to open a physical file in the output mode and the physical file is currently open by another file connector. ***** Roger ---------------------------------------------------------------- Is there a public access to the quoted standard? ---------------------------------------------------------------- No, you have to pay for both the 85 and the 2002 standard. Roger ---------------------------------------------------------------- Thank you Roger ... By the way I see that human has great interest for OC . Good Job ---------------------------------------------------------------- The working document for the next proposed standard from the J4 committee is publicly available at : http://www.cobolstandard.info/j4/files/std.zip Roger ---------------------------------------------------------------- Subject: Moving values to packed numerics defined with decimals Hello, we're migrating from MicroFocus to OpenCobol at the moment. Seems like we've discovered the following problem. Example program: [code]WORKING-STORAGE SECTION. 01 W-FIELDS. 05 W-TEST1 PIC S9(06)V9(06) COMP-3 VALUE ZERO. 05 W-TEST2 PIC S9(06)V9(06) VALUE ZERO. 05 W-TEST3 PIC S9(06) COMP-3 VALUE ZERO. 05 W-TEST4 PIC S9(06) VALUE ZERO. 05 W-TEST5 PIC 9(06) COMP-3 VALUE ZERO. 05 W-TEST6 PIC 9(06) VALUE ZERO. 05 W-TEST7 PIC 9(06)V9(06) COMP-3 VALUE ZERO. 05 W-TEST8 PIC 9(06)V9(06) VALUE ZERO. PROCEDURE DIVISION. MOVE 999999 TO W-TEST1. MOVE 999999 TO W-TEST2. MOVE 999999 TO W-TEST3. MOVE 999999 TO W-TEST4. MOVE 999999 TO W-TEST5. MOVE 999999 TO W-TEST6. MOVE 999999 TO W-TEST7. MOVE 999999 TO W-TEST8. DISPLAY 'W-TEST1 [' W-TEST1 ']'. DISPLAY 'W-TEST2 [' W-TEST2 ']'. DISPLAY 'W-TEST3 [' W-TEST3 ']'. DISPLAY 'W-TEST4 [' W-TEST4 ']'. DISPLAY 'W-TEST5 [' W-TEST5 ']'. DISPLAY 'W-TEST6 [' W-TEST6 ']'. DISPLAY 'W-TEST7 [' W-TEST7 ']'. DISPLAY 'W-TEST8 [' W-TEST8 ']'. MOVE 999999,0 TO W-TEST1. MOVE 999999,0 TO W-TEST7. DISPLAY 'W-TEST1 2nd time [' W-TEST1 ']'. DISPLAY 'W-TEST7 2nd time [' W-TEST7 ']'.[/code] Output: [code]W-TEST1 [000728379968-] <-- what happened here? W-TEST2 [999999000000+] W-TEST3 [999999+] W-TEST4 [999999+] W-TEST5 [999999] W-TEST6 [999999] W-TEST7 [000728379968] <-- what happened here? W-TEST8 [999999000000] W-TEST1 2nd time [999999000000+] <-- now it's ok W-TEST7 2nd time [999999000000] <-- now it's ok[/code] Expected Output: [code]W-TEST1 [999999000000+] W-TEST2 [999999000000+] W-TEST3 [999999+] W-TEST4 [999999+] W-TEST5 [999999] W-TEST6 [999999] W-TEST7 [999999000000] W-TEST8 [999999000000] W-TEST1 2nd time [999999000000+] W-TEST7 2nd time [999999000000][/code] cobc (OpenCOBOL) 1.0.0 using the -std=mf flag HP-UX machinename B.11.31 U ia64 3567537583 unlimited-user license Thanks for help... LeBoepp ---------------------------------------------------------------- Can you try with OC 1.1.0 ? ---------------------------------------------------------------- We are now going to install OC 1.1.0 pre-release. I'll inform you on the results. Alternatively, we'll have to change all our sources. :-( Thanks! ---------------------------------------------------------------- Yep, bug in OC. I have just put a preliminary fix into the code and updated the 1.1 tarball. If you have downloaded prior to the date/time of this post, then please redownload. Roger ---------------------------------------------------------------- It works! :-D Output looks like expected now: [code]W-TEST1 [999999000000+] W-TEST2 [999999000000+] W-TEST3 [999999+] W-TEST4 [999999+] W-TEST5 [999999] W-TEST6 [999999] W-TEST7 [999999000000] W-TEST8 [999999000000] W-TEST1 2nd time [999999000000+] W-TEST7 2nd time [999999000000][/code] Thanks a lot! LeBoepp ---------------------------------------------------------------- Hm... there is no entry for that in cobc/ChangeLog ---------------------------------------------------------------- Subject: Migrating MF -> OC: Occurs with Depending on Hi, We have a strange problem with the execution of a program generated by OC. In our Worker data we have a table (TABROU) which has a dynamical length (NBR-ROUTINES). 03 TABROU OCCURS 0 TO 9999 TIMES DEPENDING ON NBR-ROUTINES. This variable length (NBR-ROUTINES) causes very strange generated c code. When changing this variable length by a fixed length everything works like it should be. Is this a bug in OC? Best regards, Geert ---------------------------------------------------------------- Sorry, it's not clear what your problem is. Please post some code. There are no known problems with variable length. Roger ---------------------------------------------------------------- Hi, I created a little cobol program as an example to show you what I mean with my previous post. [code] IDENTIFICATION DIVISION. *===========================* PROGRAM-ID. EXAMPLE. AUTHOR. GEERT. ENVIRONMENT DIVISION. *===========================* CONFIGURATION SECTION. SOURCE-COMPUTER. UNIX. OBJECT-COMPUTER. UNIX. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. DATA DIVISION. *===========================* WORKING-STORAGE SECTION. 01 WORKER. 03 ENDFIC PIC X. 03 NBRROU PIC 9(03). 03 NBR-ROUTINES PIC 9(04). 03 TABROU OCCURS 0 TO 9999 TIMES [b]DEPENDING ON NBR-ROUTINES[/b]. 05 NOMROU PIC 9(04). PROCEDURE DIVISION. *====================* MOVE 100 TO NBR-ROUTINES. MOVE ZEROES TO NBRROU. MOVE "N" TO ENDFIC OF WORKER. PERFORM UNTIL ENDFIC OF WORKER = "Y" IF NBRROU OF WORKER < NBR-ROUTINES ADD 1 TO NBRROU ELSE MOVE "Y" TO ENDFIC OF WORKER END-IF END-PERFORM. STOP RUN. [/code] When creating the table TABROU we use a variable for the length of it. This length will be assigned when executing the program. In my company we have a large cobol program which has the same structure. This cobol sources compiles, but it goes wrong when the table is declared with a variable length. When changing this variable length by a fixed length everything runs like it should. Best regards, Geert ---------------------------------------------------------------- I modified my example to a working program which shows the problem. [code] IDENTIFICATION DIVISION. *===========================* PROGRAM-ID. EXAMPLE. AUTHOR. GEERT. ENVIRONMENT DIVISION. *===========================* CONFIGURATION SECTION. SOURCE-COMPUTER. UNIX. OBJECT-COMPUTER. UNIX. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. DATA DIVISION. *===========================* WORKING-STORAGE SECTION. 01 WORKER. 03 EOF PIC X. 03 CTR PIC 9(03). 03 TABLESIZE PIC 9(03) VALUE ZEROS. 03 MYTABLE OCCURS 9 TIMES DEPENDING ON TABLESIZE. 05 TABLECONTENT PIC X(03). 03 MYDISP PIC X(100) VALUE "Hello world". PROCEDURE DIVISION. *====================* MOVE 5 TO TABLESIZE. MOVE ZEROES TO CTR. MOVE "N" TO EOF. PERFORM UNTIL EOF = "Y" ADD 1 TO CTR IF CTR > TABLESIZE ADD 1 TO TABLESIZE GIVING TABLESIZE END-IF MOVE "GGE" TO TABLECONTENT (CTR) IF TABLESIZE > 7 MOVE "Y" TO EOF END-IF DISPLAY "------------------------------" DISPLAY "EOF : " EOF DISPLAY "CTR : " CTR DISPLAY "TABLESIZE : " TABLESIZE DISPLAY "TABLECONTENT : " TABLECONTENT(1) DISPLAY "MYDISPL : " MYDISP END-PERFORM. STOP RUN. [/code] When executing you can see in the output that the program creates MYTABLE with just one time TABLESIZE. The first time it adds the right value. But afterwards, it just overwrites every variable which follows in stead of making MYTABLE bigger for every time that value will be added. Is there a workaround for this? Regards, Geert ---------------------------------------------------------------- Fixed in current OC 1.1. Note that an ODO item normally should be the last item in the group. In fact, this program will not compile unless using "-std=mf". We forgot to take into account the ODO offset in this case. Roger ---------------------------------------------------------------- Ok thanks a lot. How do I get the last update of the OC sources? Should I use CVS or is the OpenCOBOL 1.1 pre-release always updated? Best regards, Geert ---------------------------------------------------------------- The OC 1.1 pre-release is always the first to be updated. CVS follows somewhat later (which may be days or even weeks) depending on the time I have to perform further tests/ update doc/implement further OC tests for bugs/features. CVS commits are always preceeded with a pre-release. Roger ---------------------------------------------------------------- Subject: Does open-cobol support WORKING STORAGE CLEAR option? Hello: Cobol compiler like IBM cobol supports an option -qWSCLEAR for WORKING STORAGE CLEAR, so does open-cobol has such a similar option? I didn't find it in man pages. Thanks, Jason ---------------------------------------------------------------- It's done automatically. ie. W/S items that are not implicitly/explicitly defined with values will be initialized according to their storage. Roger ---------------------------------------------------------------- Good, Thanks :-) ---------------------------------------------------------------- Subject: Segmentation fault with OC 1.1 There where no problem or warnings (-Wall) on compiling but the program results in [quote]Exception: STATUS_ACCESS_VIOLATION at eip=61D865A0 eax=000347B1 ebx=0002DE0E ecx=00000002 edx=00428DC2 esi=00488000 edi=00428DC2 ebp=61DA7380 esp=0022C410 program=myprog.exe, pid 3092, thread main cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023 Stack trace: Frame Function Args 61DA7380 61D865A0 (00425038, 00000000, 00000000, 00000000) 7619 [main] myprog 3092 _cygtls::handle_exceptions: Error while dumping state (probably corrupted stack)[/quote]I had never any problems in my environment (cygwin), before. What can I do now? Restarting the computer and try again gave the same results. Any suggestions? ---------------------------------------------------------------- Try compiling with "-g -debug -ftraceall". This might give some indication. If not, post the prog. Roger ---------------------------------------------------------------- ./myprog.exe 2> output.txt showed the wrong behavior: [quote]Length of 'bigvar' out of bounds[/quote] Is there another way to avoid segmentation faults than compile with -debug? ---------------------------------------------------------------- ???? What do you think "-debug" is for? :-) You don't "avoid" faults, you "fix" them :-) Generally, when trying any progs for the first time with OC, you should specify "-debug". This will catch most of the simpler programming errors. (MF has a similar feature) Roger ---------------------------------------------------------------- The same program had no crashes with OC 0.33. But there was a clear mistake like[code]perform varying a from 1 by x string mytexta (a:b) delimited by somedeli into mytextb end-string end-perform[/code]Program fixed - all fine. I just like to have a compiler option for checking indexed out of bounds etc. without setting -debug, because debug includes all lines with D in column 7. By the way: How can I write to error-stream from an OC program? ---------------------------------------------------------------- In current OC 1.1, "-debug" does NOT include lines with "D" in column 7. You must specifically use "-fdebugging-line". To output to stderr - In SPECIAL-NAMES : SYSERR IS MYERROR Then : DISPLAY .... UPON MYERROR Roger ---------------------------------------------------------------- Subject: Open-Cobol 1.0 Installation Problem..plz help Hi i am abhijith ,a total newbie to the world of Linux and COBOL , we do have cobol and unix as our academic subjects this time, at our college we use Softek cobol v1.003 which runs under unix OS, for practicing at Home i tried searching for the softek compiler but couldn find anywhere or on net,and while searching i came to know about this OPen-cobol 1.0 compiler & downloaded and tried hard to install on my FEDORA 8 but was not successful , As i am new to both unix and cobol i hardly know how to install on linux and all that... Below i have mentioned how i tried installing... -- i logged in as Root , and in the terminal window i changed to the path of directory where open-cobol files were there -- then i ran 1 by 1 ./configure make make check make install -- i had downloaded gmp lib 4.12 ,libltdl and berkeley db RPM's .. (i doubled clicked the rpm's it installed i dunoo how and where it installs) -- then i wrote a CObol program and saved it as disp.cob and tried compiling it as $cobc disp.cob it should have compiled and then tried executing it as $./disp it shows = symbol lookup error :./disp :undefined symbol :cob_call_params --even tried $cobcrun disp but it shows libcob : ./disp.so :undefined symbol: disp -- on this forum i read that we got to edit etc/ld.so.conf and add "/usr/local/lib" to the file. and Rerun "ldconfig" .. i did but no effect -- i even ran the tests which will be in the dir "Tests" which is "open cobol 1.0 :test suite " it showed "35. cobcrun validation failed (misc at:199) " ===*** I am a total newbie please help me ,i haven understood a bit of it, plz explain the procedure to install the compiler from A to Z, coz my exams are coming up shortly i need to study and make sure i know something to pass in the exams Atleast...plz help :-( and even please write about compiling and executing *.cob files... I Thankyou in anticipation .... waiting for ur valuable replies and suggestions. Abhijith ---------------------------------------------------------------- Please read the README. (In particular the part that references "ldconfig") Roger ---------------------------------------------------------------- i read that ldconfig .. dint really understood .. i told u na i am a total newbie .. its been a month or so since i have been working on unix and cob.. plz be precise sir ---------------------------------------------------------------- As root: Edit /etc/ld.so.conf and add /usr/local/lib to the file. Rerun "ldconfig". ---------------------------------------------------------------- Subject: C$TOUPPER information needed Hello, I use this function in a ACU called program like this. [code]call "C$TOUPPER" using x-IoWin-Options value 80[/code] when compiling the same line with OC [code] attention : passing argument 2 of ‘CBL_TOUPPER’ makes integer from pointer without a cast[/code] And of course C$TOLOWER does the same. I don't understand what's wrong with my code ? Best Regards Bear ---------------------------------------------------------------- Nothing is wrong with your code :-) I screwed up BY VALUE processing. Fixed in current OC 1.1. (It was actually OK in 1.0) Roger ---------------------------------------------------------------- Subject: Make check of OC 1.1 Hi, when executing 'make check' of the lastest version of OC 1.1 I have 16 errors in the run test. The other tests pass without a problem. Is this normal? 32: LOCAL-STORAGE FAILED (misc.at:72) 33: EXTERNAL data item FAILED (misc.at:113) 34: EXTERNAL AS data item FAILED (misc.at:154) 35: cobcrun validation FAILED (misc.at:194) 47: CALL m1. CALL m2. CALL m1. FAILED (misc.at:480) 48: CALL binary literal parameter/LENGTH OF FAILED (misc.at:525) 74: Sticky LINKAGE FAILED (misc.at:1296) 75: COB_PRE_LOAD test FAILED (misc.at:1320) 76: COB_LOAD_CASE=UPPER test FAILED (misc.at:1342) 80: CALL with OMITTED parameter FAILED (misc.at:1445) 81: ANY LENGTH FAILED (misc.at:1481) 90: CALL USING file-name FAILED (extensions.at:367) 91: CALL unusual program-id. FAILED (extensions.at:415) 97: NUMBER-OF-CALL-PARAMETERS FAILED (extensions.at:625) 98: PROCEDURE DIVISION USING BY ... FAILED (extensions.at:677) 107: RETURN-CODE passing FAILED (return-code.at:76) I managed to install the lastest version of OC 1.1 and to compile the sources which are also compiled with the previous version. Best regards, Geert ---------------------------------------------------------------- No, this is not normal. A "make check" must run OK. Go to the tests/run.dir directory. There you will find sub-directories for the failed tests with names "032", "033", etc. Within each of these sub-directories there is a file "run.log". Post the contents of these files. (ie. from the tests/run.dir directory, do "cat */*.log" and send the output. You can chop out the lines that begin "---" and "+++") Also, what is your environment? OS versdion etc. Roger ---------------------------------------------------------------- Hi, Here are some data of my environment: [code] uname -m = 005AA76A4C00 uname -r = 2 uname -s = AIX uname -v = 5 /usr/bin/uname -p = powerpc /usr/bin/oslevel = 5.2.0.0 gcc (GCC) 3.3.2 Copyright (C) 2003 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [/code] The following lines contain the output of the log files. [code] 32. misc.at:46: testing ... misc.at:72: ${COMPILE_MODULE} callee.cob 0a1,5 > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DD > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DD > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. 32. misc.at:46: 32. LOCAL-STORAGE (misc.at:46): FAILED (misc.at:72) 33. misc.at:84: testing ... misc.at:113: ${COMPILE_MODULE} callee.cob 0a1,5 > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DD > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DD > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. 33. misc.at:84: 33. EXTERNAL data item (misc.at:84): FAILED (misc.at:113) 34. misc.at:123: testing ... misc.at:154: ${COMPILE_MODULE} callee.cob 0a1,5 > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DD > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DD > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. 34. misc.at:123: 34. EXTERNAL AS data item (misc.at:123): FAILED (misc.at:154) 35. misc.at:165: testing ... misc.at:194: ${COMPILE_MODULE} callee.cob 0a1,5 > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DD > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DD > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. 35. misc.at:165: 35. cobcrun validation (misc.at:165): FAILED (misc.at:194) 47. misc.at:446: testing ... misc.at:480: ${COMPILE_MODULE} m1.cob 0a1,5 > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DD > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DD > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. 47. misc.at:446: 47. CALL m1. CALL m2. CALL m1. (misc.at:446): FAILED (misc.at:480) 48. misc.at:492: testing ... misc.at:525: ${COMPILE_MODULE} dump.c 0a1,5 > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DD > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DD > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. 48. misc.at:492: 48. CALL binary literal parameter/LENGTH OF (misc.at:492): FAILED (misc.at:525) 74. misc.at:1257: testing ... misc.at:1296: ${COMPILE_MODULE} -conf=test.conf callee.cob 0a1,5 > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DD > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DD > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. 74. misc.at:1257: 74. Sticky LINKAGE (misc.at:1257): FAILED (misc.at:1296) 75. misc.at:1304: testing ... misc.at:1320: ${COMPILE_MODULE} callee.cob 0a1,5 > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DD > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DD > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. 75. misc.at:1304: 75. COB_PRE_LOAD test (misc.at:1304): FAILED (misc.at:1320) 76. misc.at:1326: testing ... misc.at:1342: ${COMPILE_MODULE} CALLEE.cob 0a1,5 > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DD > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DD > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. 76. misc.at:1326: 76. COB_LOAD_CASE=UPPER test (misc.at:1326): FAILED (misc.at:1342) 80. misc.at:1417: testing ... misc.at:1445: ${COMPILE_MODULE} callee.cob 0a1,5 > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DD > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DD > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. 80. misc.at:1417: 80. CALL with OMITTED parameter (misc.at:1417): FAILED (misc.at:1445) 81. misc.at:1453: testing ... misc.at:1481: ${COMPILE_MODULE} callee.cob 0a1,5 > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DD > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DD > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. 81. misc.at:1453: 81. ANY LENGTH (misc.at:1453): FAILED (misc.at:1481) 90. extensions.at:333: testing ... extensions.at:367: ${COMPILE_MODULE} setfilename.c 0a1,5 > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DD > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DD > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. 90. extensions.at:333: 90. CALL USING file-name (extensions.at:333): FAILED (extensions.at:367) 91. extensions.at:374: testing ... extensions.at:415: ${COMPILE_MODULE} A@B.cob 0a1,5 > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DD > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DD > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. 91. extensions.at:374: 91. CALL unusual program-id. (extensions.at:374): FAILED (extensions.at:415) 97. extensions.at:589: testing ... extensions.at:624: ${COMPILE} caller.cob extensions.at:625: ${COMPILE_MODULE} callee.cob 0a1,5 > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DD > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DD > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. 97. extensions.at:589: 97. NUMBER-OF-CALL-PARAMETERS (extensions.at:589): FAILED (extensions.at:625) 98. extensions.at:639: testing ... extensions.at:676: ${COMPILE} caller.cob extensions.at:677: ${COMPILE_MODULE} callee.cob 0a1,5 > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DD > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DD > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. 98. extensions.at:639: 98. PROCEDURE DIVISION USING BY ... (extensions.at:639): FAILED (extensions.at:677) 107. return-code.at:46: testing ... return-code.at:76: ${COMPILE_MODULE} mod1.cob 0a1,5 > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DD > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DI > ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DD > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. 107. return-code.at:46: 107. RETURN-CODE passing (return-code.at:46): FAILED (return-code.at:76) [/code] Best regards, Geert ---------------------------------------------------------------- Don't see any problems with XLC as well as with GCC 3.4.1 It might be GCC issue which is very bad on Power. Are you linking with static library or shared ? I saw only warnings. Have you tried to repeate some of those tests manually ? It might work and maybe it's just the matter of script reacting on warnings. Regards, Sergey ---------------------------------------------------------------- Subject: Size & Colors in Screen Management Do we have any possibility to avoid artistic coding like this following lines ? Of course it works, but passing foreground / background color values thru an identifier instead of an integer at each time would be nice. [code] *> How the SIZE is managed (Screen is supposed to be 80 characters wide) if x-labels-size NOT = 0 continue else move 0 to L inspect x-labels-value tallying L for trailing spaces compute x-labels-size = 80 - L end-compute end-if *> Then comes colors integers (all these may be shorter ...) evaluate x-labels-FColor when 0 evaluate x-labels-BColor when 0 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 00 background-color 00 end-display when 1 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 00 background-color 01 end-display when 2 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 00 background-color 02 end-display when 3 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 00 background-color 03 end-display when 4 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 00 background-color 04 end-display when 5 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 00 background-color 05 end-display when 6 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 00 background-color 06 end-display when 7 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 00 background-color 07 end-display end-evaluate when 1 evaluate x-labels-BColor when 0 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 01 background-color 00 end-display when 1 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 01 background-color 01 end-display when 2 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 01 background-color 02 end-display when 3 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 01 background-color 03 end-display when 4 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 01 background-color 04 end-display when 5 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 01 background-color 05 end-display when 6 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 01 background-color 06 end-display when 7 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 01 background-color 07 end-display end-evaluate when 2 evaluate x-labels-BColor when 0 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 02 background-color 00 end-display when 1 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 02 background-color 01 end-display when 2 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 02 background-color 02 end-display when 3 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 02 background-color 03 end-display when 4 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 02 background-color 04 end-display when 5 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 02 background-color 05 end-display when 6 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 02 background-color 06 end-display when 7 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 02 background-color 07 end-display end-evaluate when 3 evaluate x-labels-BColor when 0 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 03 background-color 00 end-display when 1 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 03 background-color 01 end-display when 2 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 03 background-color 02 end-display when 3 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 03 background-color 03 end-display when 4 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 03 background-color 04 end-display when 5 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 03 background-color 05 end-display when 6 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 03 background-color 06 end-display when 7 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 03 background-color 07 end-display end-evaluate when 4 evaluate x-labels-BColor when 0 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 04 background-color 00 end-display when 1 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 04 background-color 01 end-display when 2 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 04 background-color 02 end-display when 3 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 04 background-color 03 end-display when 4 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 04 background-color 04 end-display when 5 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 04 background-color 05 end-display when 6 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 04 background-color 06 end-display when 7 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 04 background-color 07 end-display end-evaluate when 5 evaluate x-labels-BColor when 0 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 05 background-color 00 end-display when 1 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 05 background-color 01 end-display when 2 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 05 background-color 02 end-display when 3 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 05 background-color 03 end-display when 4 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 05 background-color 04 end-display when 5 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 05 background-color 05 end-display when 6 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 05 background-color 06 end-display when 7 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 05 background-color 07 end-display end-evaluate when 6 evaluate x-labels-BColor when 0 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 02 background-color 00 end-display when 1 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 02 background-color 01 end-display when 6 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 06 background-color 02 end-display when 3 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 06 background-color 03 end-display when 4 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 06 background-color 04 end-display when 5 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 06 background-color 05 end-display when 6 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 06 background-color 06 end-display when 7 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 06 background-color 07 end-display end-evaluate when 7 evaluate x-labels-BColor when 0 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 07 background-color 00 end-display when 1 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 07 background-color 01 end-display when 2 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 07 background-color 02 end-display when 3 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 07 background-color 03 end-display when 4 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 07 background-color 04 end-display when 5 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 07 background-color 05 end-display when 6 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 07 background-color 06 end-display when 7 display x-labels-value (1:x-labels-size) line x-labels-line column x-labels-position with foreground-color 07 background-color 07 end-display end-evaluate end-evaluate .[/code] I think it's very easy to code [code] display x-label-value line x-labels-line column x-labels-position (with) size x-labels-size foreground-color x-labels-Fcolor background-color x-labels-BColor end-display . [/code] Best regards Bear ---------------------------------------------------------------- A couple of comments - This syntax is not part of any standard. The alternative ACCEPT/DISPLAY syntax is a MF extension. (Also note that SCREEN SECTION etc. is only an optional component according to the standard). In the case of colours on ACCEPT/DISPLAY, MF allows only integers here. However, I will take a look, time permitting. Re. SIZE. Yes, this clause is currently missing. However, for your particular example you can do - DISPLAY FUNCTION TRIM (x-label-value TRAILING) .... and delete the INSPECT. Roger ---------------------------------------------------------------- Thank You I do not understand what you meant by : [code] DISPLAY FUNCTION TRIM (x-label-value TRAILING) .... [/code] In the other side I think I must learn C to be able to create my own screen manager. I saw demo with windows and subwindows with ncurses with results very close to my AcuCobol programs... Best regards Bear ---------------------------------------------------------------- FUNCTION TRIM is an intrinsic function proposed/defined in the new 2008/working document. Excerpt - ---------------- The TRIM function returns a character string that contains the characters in the argument with leading spaces, trailing spaces, or both, deleted. 1) Argument-1 shall be a data item of class alphanumeric. 15.88.3 Returned values 1) If LEADING is specified, the returned value is a character string that consists of the characters in argument-1 beginning from the leftmost character position that does not contain a space character through the rightmost character position. 2) If TRAILING is specified, the returned value is a character string that consists of the characters in argument-1 beginning from the leftmost character position through the rightmost character position that does not contain a space character. 3) If neither LEADING nor TRAILING is specified, the returned value is a character string that consists of the characters in argument-1 beginning from the leftmost character position that does not contain a space character through the rightmost character position that does not contain a space character. -------------------- Try it :-) Roger ---------------------------------------------------------------- Thank you Roger All these informations are very important. My Cobol programming was very poor on functions, so I caught some more time to see a set of intrinsic functions allowed by OC. So in this particular case, I need the size variable so [code] move function stored-char-length (x-labels-value) to x-labels-size [/code] Does not solve my color problem, but some of my modules turned out to be lighter. I hope you'll have time to see a bit ACCEPT/DISPLAY statements in order to allow color management better than the strict standard. Best regards Bear ---------------------------------------------------------------- Subject: Linkage section using Variable Hi all, I searched the forum for a error I had with OC on the linkage section in executable programs. I found a solution for this: replace the "LINKAGE SECTION USING VAR" by "LINKAGE SECTION" and "ACCEPT VAR FROM COMMAND-LINE". Which works fine, but I have to change more then 2000 sources if I want that OC compiles them succesfully. I wonder if there is a possibility to add an option to the OC compiler so it will succesfully compile the "LINKAGE SECTION USING VAR" line. Maybe there is a possibility to add it into the MF dialect. We have had earlier tests with an older version of OC (0.29) which succesfully compiled those sources. With the lastest version there is added a check in the source code of OC, maybe there is a possibility to disable this check? Best regards, Geert ---------------------------------------------------------------- ????? LINKAGE SECTION USING What is that?? Not known to me. Roger ---------------------------------------------------------------- I'm sorry, I meant I searched on this forum a way to replace: [code] PROCEDURE DIVISION USING VAR. [/code] So I had to replace it by: [code] PROCEDURE DIVISION. ACCEPT VAR FROM COMMAND-LINE. [/code] Which works fine, but I have to change more then 2000 sources if I want that OC compiles them succesfully. I wonder if there is a possibility to add an option to the OC compiler so it will succesfully compile the "PROCEDURE DIVISION USING VAR" line. Maybe there is a possibility to add it into the MF dialect. We have had earlier tests with an older version of OC (0.29) which succesfully compiled those sources. With the lastest version there is added a check in the source code of OC, maybe there is a possibility to disable this check? Best regards, Geert ---------------------------------------------------------------- Hello Geert, I never had problems with linking programs. You must keep [code] identification division. program-id. goeswell. linkage section. 01 linkvar. 02 var1 pic ... 02 ... procedure division using linkvar. [/code] when compiling this program you should not use the "x" flag. but let cobc compile as a module ... (extension .so) Tell COB_LIBRARY_PATH to find modules in your library . Things must go better Bear ---------------------------------------------------------------- Hello, Thanks, but I have also some sources with the same structure as your example and it compiles when I don't use the -x option. But for the sources where I have the problem, in my case I need to use the -x option. OC has to create executable files. Geert ---------------------------------------------------------------- If nothing helps: - write a simple program in oc, that reads all your .cbl as line sequential file and rewrites the phrase mentioned above - use another tool to replace your phrase (for example a self written unix shell with read/cut/if/...) ---------------------------------------------------------------- I tried with ACU runnig this program, [code] 000100 IDENTIFICATION DIVISION. 000200 PROGRAM-ID. PARSER. 000500* 000600* TEST DU LINKAGE 000700* 000800 ENVIRONMENT DIVISION. 000900 CONFIGURATION SECTION. 001000 SOURCE-COMPUTER. DELL. 001100 OBJECT-COMPUTER. DELL. DATA DIVISION. 003900 WORKING-STORAGE SECTION. 77 I pic X. linkage section. 77 wprog pic X(8). 77 wlink pic X(10). 004200 PROCEDURE DIVISION using wprog wlink. 004300 DEBUT. call wprog using wlink on exception display "NIET !" not on exception display "OK" end-call accept i . ULTIME. EXIT PROGRAM. [/code] Runtime sends me back a runtime error like similar to : [code] Use of a linkage data item not passed by the caller [/code] BUT this program works [code] 000100 IDENTIFICATION DIVISION. 000200 PROGRAM-ID. PARSER. 000300 AUTHOR. HINIGER 000400 DATE-WRITTEN. Mai-08. 000500* 000600* TEST DU LINKAGE 000700* 000800 ENVIRONMENT DIVISION. 000900 CONFIGURATION SECTION. 001000 SOURCE-COMPUTER. DELL. 001100 OBJECT-COMPUTER. DELL. DATA DIVISION. 003900 WORKING-STORAGE SECTION. 77 I pic X. 77 wprog pic X(8). 77 wlink pic X(10). 77 wcmdline pic X(80). 004200 PROCEDURE DIVISION. 004300 DEBUT. accept wcmdline from command-line unstring wcmdline delimited by "%" into wprog wlink end-unstring call wprog using wlink on exception display "NIET !" not on exception display "OK" end-call accept i . ULTIME. EXIT PROGRAM. [/code] You can also try "C$NARG" in order to test # of arguments ... Best Regards Bear ---------------------------------------------------------------- Geert, can you explain why you think that a program with PROCEDURE DIVISION USING ... can/should be executed as a main program? Roger ---------------------------------------------------------------- Hi Roger, I think I know your point of view over this matter, I read a discussion about it on this forum. And I'm supporting your point of view. I also read in the documents of MF that this 'PROCEDURE DIVISION USING ...' should be used in case a cobol program calls another cobol program. But somehow MF has always permitted the use of 'PROCEDURE DIVISION USING ...' in main programs,which is actually not entirely correct. The sources I was talking about, are "succesfully" compiled by MF and a cobol compiler from IBM for mainframe. I believe the OC compiler is a very good compiler and my intentions are certainly not to change something about this. I'm only wondering if there is a possibility to add this into the dialect of MF. I know there has come a check in your sources of OC (since version 0.29), which checks if you're compiling a main program or not. Is it possible to pass this check without touching the integrity of OC? Best regards, Geert ---------------------------------------------------------------- * MF has always permitted the use of 'PROCEDURE DIVISION USING ...' in main programs,which is actually not entirely correct * It is not correct at all. And the behaviour with MF (assuming the prog accesses the USING parameter) is indeterminate. So, no, I cannot allow a USING for a main prog as that would in OC cause an immediate seg fault. Having said that, ACU (and OC) have a syntax which allows what you appear to want - PROCEDURE DIVISION CHAINING dataitem. dataitem must be in W/S (Not LINKAGE). CHAINING is only allowed for a main program. dataitem is filled with the command line parameters following the program execution call. Roger ---------------------------------------------------------------- I still don't understand why you say this isn't correct at all. But sometimes I miss the little bits. Seems perfectly proper behavior to me for a main program. Doesn't seem logic for a sub program. Isn't a main program a program that gets called by the OS? And why shouldn't the system pass it parms? Is it a technical reason OC can't do this? Yes, CHAINING seems to be similar but not exactly. The issue comes in when two main programs call each other. If the main program can't have linkage, it becomes difficult to pass parms . That's what I don't understand. Why shouldn't two main programs be able to call each other and pass parm to each other via linkage? ---------------------------------------------------------------- Indeed. If there is no technical reason, I do not see a reason why OC should not allow it. I know it's not the standard, but I don't see why a main program can not accept LINKAGE parameters. It could be an added value for OC too, if it's compatible with all other major cobol compilers. Regards, Joeri ---------------------------------------------------------------- But it is the standard on the mainframe. But isn't it also the standard period? Can't main programs call other main programs and pass parms while at the same time get called from the OS which passes on the parms from the cli? ---------------------------------------------------------------- NO, it is NOT the standard. Please read COBOL syntax. Roger ---------------------------------------------------------------- Subject: Attempting to compile MicroFocus COBOL code with OpenCobol I am attempting to compile our MicroFocus COBOL code with OpenCobol, but I am encountering a few problems: 1. I have a problem with a linkage statement that is redefined, error message is "Error: REDEFINES clause must follow entry-name". Snippet of code that is causing problems: 05 REDEF PIC S9(9) COMP. 05 CONTEXT-POINTER USAGE IS POINTER REDEFINES REDEF. 2. Are there functions in OpenCobol what will set and get environment variables? MicroFocus has functions cobgetenv() and cobsetenv() that we are currently using in our applications. Any suggestions would be greatly appreciated. :-) ---------------------------------------------------------------- Below applies to OC 1.1 - 1) Error message is correct. The REDEFINES should follow the data name according to the standard. ie. 05 CONTEXT-POINTER REDEFINES REDEF USAGE POINTER. However, if you compile with "-std=mf", this will get reduced to a warning. You do know that this code may have problems? - POINTER is 4 bytes on 32-bit systems and 8 bytes on 64-bit. 2) Yes, see the MF (and ACU) extended ACCEPT/DISPLAY syntax for manipulating environment variables. Roger ---------------------------------------------------------------- Subject: Dialect compatibilities Hi there, We are evaluating the possibility of migrating from MF to OC. An issue we have encountered is keyword compatibility. Our source is based on Cobol 85 and uses at least two variables names that are now considered keywords (INITIALIZED and NORMAL). For MF we use the -ans85 flag. I have tried using the -std=mf and I have tried using the -std=cobol85 flags for OC but using either flag still causes errors to be generated when the variable names (nee keywords) are detected. My question is, when using the -std=cobol85 compile flag, should this flag limit the keyword set to that of the Cobol 85 keyword set? OC doesn't appear to do this. Any thoughts or suggestions are appreciated. Thanks, Darin Ritchie. ---------------------------------------------------------------- You can do it with a config file. Copy and rename an existing conf file - eg. config/mf.conf -> /tmp/myconf.conf Edit /tmp/myconf.conf and add following lines somewhere at the end - not-reserved: INITIALIZED not-reserved: NORMAL Then compile with "-conf=/tmp/myconf.conf" If you want to compile with "-std=myconf" and not use the "-conf=", then copy "myconf.conf" to the install directory for the config files which is per default /usr/local/share/open-cobol/config. An example of "not-reserved" already exists in "config/mvs.conf". These definitions for various dialects are on my todo list. Roger ---------------------------------------------------------------- Subject: reference list Hi all, I wonder whether ther is some kind of [b]reference list[/b] for OpenCobol, listing the companies that use it. I require this information for our managers. If not, I would like to ask you to tell me the companies that us it. This is just for internal use at my company. I`d like to start the list with the company I work for: Leoni AG - http://www.leoni.com/ If you prefer not to name your company in public, I`d appreciate if you send me this information by mail to [i]patric[/i] D0T [i]sperling[/i] ADD [i]leoni[/i] D0T [i]com[/i] (dot and at are intentionally misspelled). Kind regards, Patric ---------------------------------------------------------------- Subject: PRINTER and literal Hi All, I am a newbie in cobol. I have chosen open-cobol 1.1.0 for my linux box at home (ubuntu-gutsy). I have some problems in compiling a program (consist of several copyfiles) which was compiled well in sun. 1) PRINTER as in: SELECT LLLFILE ASSIGN TO PRINTER LLL-TXT FILE STATUS IS FFFF-LLL. the cobc complains with error message: Error: syntax error, unexpected "Identifier", expecting SEQUENCE 2) literal as in: 03 FILLER PIC X(20) VALUE '12345678901234567890'. the cobc complains with error message: Error: syntax error, unexpected "Identifier", expecting EXTERNAL or GLOBAL Could you please suggest any correction or equivalent syntax in open cobol? Thank you, Ade ---------------------------------------------------------------- Sorry, I can not reproduce this. eg. IDENTIFICATION DIVISION. PROGRAM-ID. jtest. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT LLL-PRINT ASSIGN TO PRINTER LLL-TXT FILE STATUS IS LLL-STAT. DATA DIVISION. FILE SECTION. FD LLL-PRINT. 01 RAW-PRINT PIC X(132). WORKING-STORAGE SECTION. 01 LLL-STAT PIC XX. 01 LLL-TXT PIC X(20). 01 RAWSTAT2. 03 FILLER PIC X(20)VALUE '12345678901234567890'. PROCEDURE DIVISION. 001-MAIN-PROCEDURE. STOP RUN. roglinux:~ # cobc --version cobc (OpenCOBOL) 1.1.0 Build date Apr 23 2008 09:46:37 Copyright (C) 2001-2008 Keisuke Nishida / Roger While roglinux:~ # cobc -x jtest.cob roglinux:~ # Please post the preprocessed source of your program. ie. cobc -E yourprog.cob >preproc Then post the contents of preproc. Roger ---------------------------------------------------------------- I tried to compile your prog and I had the error message : [code] JTEST.CBL:16: Error: Invalid picture string JTEST.CBL:16: Error: syntax error, unexpected "Literal", expecting EXTERNAL or GLOBAL [/code] ... just because there is no space between PIC X(20) and VALUE Best regards Bear ---------------------------------------------------------------- Dear Roger and Bear, thank you for your reply. After seeing your cobc --version, i found out that my open-cobol 1.1.0 is not the same as yours because my previous cobc --version will give me: cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2007 Keisuke Nishida Copyright (C) 2007 Roger While So, i download the latest 1.1.0, and compiled it. Now, the PRINTER keyword is fine, and i found an example where the second error may occur. In my code, I have many indentation as shown below. It seem the empty spaces between keyword FILLER and PIC are too long. It give error message: TestError.cbl:16: Error: syntax error, unexpected "end of file", expecting EXTERNAL or GLOBAL Is it the current syntax restriction of open-cobol? meanwhile i just try to fix my code layout, removing any too long empty spaces between keyword. It works so far. Here is the example code which generate the error. IDENTIFICATION DIVISION. PROGRAM-ID. jtest. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT LLL-PRINT ASSIGN TO PRINTER LLL-TXT FILE STATUS IS LLL-STAT. DATA DIVISION. FILE SECTION. FD LLL-PRINT. 01 RAW-PRINT PIC X(132). WORKING-STORAGE SECTION. 01 LLL-STAT PIC XX. 01 LLL-TXT PIC X(20). 01 RAWSTAT2. 03 FILLER PIC X(20)VALUE '12345678901234567890'. PROCEDURE DIVISION. 001-MAIN-PROCEDURE. STOP RUN. Kind regards, Ade Azurat ---------------------------------------------------------------- 03 FILLER PIC X(20)VALUE '12345678901234567890'. There is a space missing between the closing bracket and VALUE. Roger ---------------------------------------------------------------- Sorry, i found that this forum editor eliminate the additional space that i made. To show the different, i replace the additional empty space with underscore. The error appear if i put too much spaces between FILLER and PIC, as seen below 03 FILLER _______________PIC X(20) VALUE '12345678901234567890'. PROCEDURE DIVISION. How ever if the space is still less than the length of PROCEDURE DIVISION, such as: 03 FILLER _____ PIC X(20) VALUE '12345678901234567890'. PROCEDURE DIVISION. it can be compiled. Otherwise no with error message: Error: syntax error, unexpected "end of file", expecting EXTERNAL or GLOBAL in some cases it says "unexpected "Identifier" Thank you, Ade Azurat ---------------------------------------------------------------- You are compiling with default fixed format, right? Assuming the "03" starts in column 12, then the statement overflows column 72 (Columns 73 to end of line get ignored). Roger ---------------------------------------------------------------- Thank you Roger, Now, some of the programs are compiled well. However, I still have small problem in SCREEN SECTION. SCREEN SECTION. 01 SCR-ROW-1. 03 LINE 01 PIC X(79) USING DISPLAY-TITLE-01. 01 SCR-ERROR. 03 LINE 23 VALUE IS x'07'. 03 PIC X(20) FROM ERR-MSG. 03 COL PLUS 3 VALUE IS 'Press Enter to continue... '. 03 PIC X TO ANY-CHAR. 01 SCR-CLEAR-ERROR. 03 LINE 23 BLANK LINE. perhaps the code above does not comply with the standard cobol. Could somebody please tell me the equivalent statements in openCobol? Another information is that the error message only says: "Invalid picture string" only one line, and pointed to the line after the above code. Thank you, ade ---------------------------------------------------------------- Subject: segmentation error Hello, I was trying this program : [code] IDENTIFICATION DIVISION. PROGRAM-ID. COLORS. *> *> TEST DES COULEURS *> ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. DELL. OBJECT-COMPUTER. DELL. DATA DIVISION. WORKING-STORAGE SECTION. 77 I pic X. *>78 noir value 01. *>78 bleu value 02. *>78 vert value 03. *>78 rouge value 04. *>78 magenta value 05. *>78 marron value 06. *>78 blanc value 07. PROCEDURE DIVISION. DEBUT. display "Bonjour" line 12 column 36 with foreground-color 2 background-color 5 end-display display "Monsieur" line 13 column 36 with foreground-color 1 background-color 7 end-display display "Le Professeur" line 14 column 35 with foreground-color 6 background-color 3 end-display . accept I line 24 column 30 with foreground-color 2 background-color 3 end-accept . ULTIME. EXIT PROGRAM. [/code] cobc -x -free -debug -ftraceall colors.cbl ./colors [code] PROGRAM-ID: COLORS: ENTRY COLORS PROGRAM-ID: COLORS: MAIN SECTION PROGRAM-ID: COLORS: DEBUT PROGRAM-ID: COLORS Line: 26 Statement: DISPLAY Erreur de segmentation [/code] Is there something I did wrong ? cobc (OpenCOBOL) 1.1.0 Build date May 7 2008 10:32:08 Copyright (C) 2001-2008 Keisuke Nishida / Roger While downloaded/installed today Best regards Bear ---------------------------------------------------------------- You know why ? because program-id is named COLORS. I changed to TSTCLR.CBL, compiled, and everything turned out to be OK Enjoy Bear ---------------------------------------------------------------- PROGRAM-ID should not be any reserved word (COLORS=reserved?). Compilercheck needed. ---------------------------------------------------------------- Actually, the problem is rather interesting and raises a serious question. There is NO reason why "COLORS" should NOT be a valid PROG-ID. And, in fact, this is NOTHING to do with reserved words. The problem lies in the (n)curses library. This has a field "COLORS" in the BSS section. So, when the screen initialization is done, the cob entry point "COLORS" is overriding the curses definition (being the first in the symbol resolution sequence). BANG! Now the question here is why is the (n)curses library making this symbol visible? AFAICS, this is not a user accessible element. It looks as though that (n)curses is not taking any particular care to restrict visible symbols. On GCC based implementations, one can do this with - __attribute__ ((visibility("hidden"))) (which we actually do in OC to restrict the OC library visible symbols to a minimum). So, what to do; nothing. There is no way to produce some sort of PROG-ID exception list considering all externalized symbols in curses, ncurses, pdcurses, BDB, GMP, (G)LIBC, etc. Note that MF/ACU carry their own internal versions of many packages. However, it is quite easy with MF to provoke with a PROG-ID that duplicates some symbol. Roger ---------------------------------------------------------------- Subject: File Open error We are attempting to open a sequencial file that does not exist with the EXTEND keyword. We are migrating from MF to OC. we get a status = 35 file does not exist error or if the file does exist, we get a status 44 = buffer overflow. How do we resolve this issue, any suggestions. They would be greatly appreciated. ---------------------------------------------------------------- Not enough information. Post the program, OC version and compile options. Roger ---------------------------------------------------------------- Issue: When the program is run and the TESTBATCH file does not exist, an error status=35 file does not exist occurs. When we compile this using MicroFocus and the file does not exist, it is created with a status of 5. OC version: 1.1 compiled using: cobc -x coboltest.cbl Program: IDENTIFICATION DIVISION. PROGRAM-ID. simpleFileTest. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM-RS-6000. OBJECT-COMPUTER. IBM-RS-6000. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT OUTPUT-FILE ASSIGN TO EXTERNAL TESTBATCH ORGANIZATION IS LINE SEQUENTIAL ACCESS MODE IS SEQUENTIAL FILE STATUS IS WS-FILE-STATUS. / DATA DIVISION. FILE SECTION. FD OUTPUT-FILE. 01 OUTPUT-LINE PIC X(256). WORKING-STORAGE SECTION. 01 WS-PROG-ID PIC X(16) VALUE "simpleFileTest". 01 WS-FILE-STATUS PIC X(02) VALUE "00". 88 IO-OK VALUE "00", "05". 88 END-OF-FILE VALUE "10". 88 NOT-FOUND VALUE "23". 88 SEVERE-ERROR VALUE "01" THRU "04" "06" THRU "09" "11" THRU "22" "24" THRU "99". 01 WS-TEST-LINE. 05 RESULT-OUT PIC X(20) VALUE "Test File Line ". 05 FILLER PIC X(14) VALUE "FILE STATUS = ". 05 WS-FILE-ERROR-STATUS PIC X(02). /************************************************************************ * Mainline Routine ************************************************************************* PROCEDURE DIVISION. MAINLINE. OPEN EXTEND OUTPUT-FILE MOVE WS-FILE-STATUS TO WS-FILE-ERROR-STATUS IF IO-OK OF WS-FILE-STATUS MOVE WS-TEST-LINE TO OUTPUT-LINE WRITE OUTPUT-LINE CLOSE OUTPUT-FILE ELSE MOVE "file NOT Created " to RESULT-OUT DISPLAY WS-TEST-LINE END-IF. STOP RUN. Any suggestions would be greatly appreciated. Thanks :-) ---------------------------------------------------------------- I changed: SELECT OUTPUT-FILE to: SELECT OPTIONAL OUTPUT-FILE The program compiled and ran as expected. This is the same behavior as with IBM's AIX Cobol. Curt ---------------------------------------------------------------- I will try that, but can you explain why "OPTIONAL" was added. What does it do? Thanks :-) ---------------------------------------------------------------- "OPTIONAL" just tells the application that the physical file may not exist at run time and, if not, continue processing. In the case of "OPEN EXTEND", without "OPTIONAL" the application looks at the missing file as some kind of failure. As a result no additional file processing is attempted, such as creating the file. Curt ---------------------------------------------------------------- Yes, and the behaviour is correct. The standard says (excerpt from SELECT) - ***** The OPTIONAL phrase applies only to files opened in the input, I-O, or extend mode. Its specification is required for physical files that are not necessarily present each time the runtime element is executed. ***** Roger ---------------------------------------------------------------- Subject: HOWTO OpenCobol 1.0 + Oracle Pro*Cobol 10.2.0.1 and higher HOWTO OpenCobol 1.0 + Oracle Pro*Cobol 10.2.0.1 and higher ========================================================== 0. OpenCobol has to be installed on the system * On 64bit systems it must be a 64bit executable which cobc | xargs file --> /usr/local/bin/cobc: ELF 64-bit LSB executable..... * a softlink to cob has to be generated in the same directory where cobc is located: which cobc --> /usr/local/bin/cobc ln -s /usr/local/bin/cobc /usr/local/bin/cob which cob --> /usr/local/bin/cob: symbolic link to `/usr/local/bin/cobc' 1. Oracle does *NOT* support officially OpenCobol List of certified compilers can be found inside Oracle Certified Compilers 2. HOWTO describes setup on - 10gR2 (10.2.0.1) - 11gR1 (11.1.0.6) - OS: Linux x86 & x86-64 2. To get OpenCobol and Pro*Cobol running, Pro*Cobol has to be installed properly including * the 64bit Pro*Cobol (when used on Linux x86-64) * the samples & makefiles contained in the - companion CD (10g) or - example CD (11g) how to do that, see Precompiler FAQ's in 10gR2 (10.2.0.1) Precompiler FAQ's in 11gR1 (11.1.0.6) -> See end of the HOWTO -------------------------------- Linux x86-64 ============ Please note that Pro*Cobol is supported on Linux x86-64 starting with 10.2.0.3 and that it hs to be explicitly build by doing cd $ORACLE_HOME/precomp/lib make -f ins_precomp.mk procob -------------------------------- 3. Login as Oracle software owner 4. When everything is installed properly, the three listed files should be found: $ORACLE_HOME/precomp/demo/procob2/sample1.pco $ORACLE_HOME/precomp/demo/procob2/demo_procob.mk $ORACLE_HOME/precomp/lib/env_precomp.mk 5. generate a testdirectory and copy cobol samples mkdir $HOME/mytest cd $HOME/mytest cp $ORACLE_HOME/precomp/demo/procob2/* . cp $ORACLE_HOME/precomp/lib/*.mk . 6. edit $HOME/mytest/demo_procob.mk i. change include $(ORACLE_HOME)/precomp/lib/env_precomp.mk to include env_precomp.mk ii. change MAKEFILE=$(ORACLE_HOME)/precomp/demo/procob2/demo_procob.mk to MAKEFILE=demo_procob.mk iii. add following lines at the bottom of the file # MICROFOCUS # COBFLAGS=-C IBMCOMP -C NESTCALL -t -x # OPENCOBOL COBFLAGS=-x 7. edit $HOME/mytest/env_precomp.mk i. replace DEMO_PROCOB_BUILD_SHARED=$(COB) $(COBFLAGS) -o $(EXE) $(COBS) $(LDPATHFLAG)$(LIBHOME) $(COBSQLINTF) $(COBOL_PROLDLIBS) DEMO_PROCOB_BUILD_STATIC=$(COB) $(COBFLAGS) -o $(EXE) $(COBS) $(LDPATHFLAG)$(LIBHOME) $(COBSQLINTF) $(COBOL_STATICPROLDLIBS) by ##### MICROFOCUS #DEMO_PROCOB_BUILD_SHARED=$(COB) $(COBFLAGS) -o $(EXE) $(COBS) $(LDPATHFLAG)$(LIBHOME) $(COBSQLINTF) $(COBOL_PROLDLIBS) ##### OPENCOBOL DEMO_PROCOB_BUILD_SHARED=$(COB) $(COBFLAGS) $(COBS) $(LDPATHFLAG)$(LIBHOME) $(COBSQLINTF) $(COBOL_PROLDLIBS) ##### MICROFOCUS #DEMO_PROCOB_BUILD_STATIC=$(COB) $(COBFLAGS) -o $(EXE) $(COBS) $(LDPATHFLAG)$(LIBHOME) $(COBSQLINTF) $(COBOL_STATICPROLDLIBS) ##### OPENCOBOL DEMO_PROCOB_BUILD_STATIC=$(COB) $(COBFLAGS) $(COBS) $(LDPATHFLAG)$(LIBHOME) $(COBSQLINTF) $(COBOL_STATICPROLDLIBS) 8. create $HOME/mytest/doit with following lines #!/bin/sh SAMPL=$1 export SAMPL rm -rf $SAMPL rm -rf $SAMPL".cob" rm -rf $SAMPL".lis" COBDIR=/usr/local export COBDIR PATH=$PATH:$COBDIR/bin export PATH LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/local/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH which cob which cob | xargs file make -f demo_procob.mk build COBS=$SAMPL".cob" EXE=$SAMPL file ./$SAMPL ./$SAMPL rm -rf $SAMPL rm -rf $SAMPL".cob" rm -rf $SAMPL".lis" 9. chmod u+x $HOME/mytest/doit 10. to build sample1.pco (or another sample) use Important: do not add the *.pco to the file to be build ! cd $HOME/mytest ./doit sample1 OUTPUT ====== /usr/local/bin/cob /usr/local/bin/cob: symbolic link to `/usr/local/bin/cobc' procob iname=sample1.pco Pro*COBOL: Release 10.2.0.4.0 - Production on Thu May 8 10:37:45 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved. System default option values taken from: /raid/home/vmware/64/oracle/db102x/app/ oracle/product/102/precomp/admin/pcbcfg.cfg cob -x sample1.cob -L/raid/home/vmware/64/oracle/db102x/app/oracle/product/102/l ib/ /raid/home/vmware/64/oracle/db102x/app/oracle/product/102/precomp/lib/cobsql intf.o -lclntsh `cat /raid/home/vmware/64/oracle/db102x/app/oracle/product/102/l ib/ldflags` `cat /raid/home/vmware/64/oracle/db102x/app/oracle/product/102/lib /sysliblist` -ldl -lm sample1.cob:17: Warning: 'GLOBAL' not implemented sample1.cob:21: Warning: 'GLOBAL' not implemented sample1.cob:25: Warning: 'GLOBAL' not implemented sample1.cob:28: Warning: 'GLOBAL' not implemented sample1.cob:67: Warning: 'GLOBAL' not implemented sample1.cob:192: Warning: 'GLOBAL' not implemented ./sample1: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linu x 2.4.0, dynamically linked (uses shared libs), not stripped CONNECTED TO ORACLE AS USER: SCOTT ENTER EMP NUMBER (0 TO QUIT): 7788 EMPLOYEE SALARY COMMISSION -------- ------ ---------- SCOTT 3000.00 NULL ENTER EMP NUMBER (0 TO QUIT): 0 TOTAL NUMBER QUERIED WAS 0001. HAVE A GOOD DAY. 11. Please note that two samples wont work - OpenCobol looks to be not supporting some MF capabilities. 12. Have a lots of fun - Tested the stuff on Linux x86/x86-64bit & Solaris Sparc 64bit and works. ----------------------------- Precompiler FAQ's in 10gR2 (10.2.0.1) Questions and Answers Q: What precompilers are installed when "Database Installation" is choosen ? A: Since 10gR2 only component "Precompilers" is showen in the Universal Installer - no separation of Pro*C, Pro*Cobol etc. By default Pro*C and Pro*Cobol are installed - independant if target is 32bit or 64bit OS. Furtheron, in case of 64bit OS only the 32bit Pro*Cobol is installed. If there is the need for 64bit Pro*Cobol , it is required to re-install from the "Client Installation" (*NOT* "Instant Client") and custom install type the Precompilers from the product "Oracle Programmer" on a former Database Installation - this will apply the Pro*Cobol 64bit (64bit OS) and the Pro*Fortran and SQL*Module for Ada additionally. Better strategy is to apply a separate Client because this contains directly the full Precompilers (except demos etc - see below). In cases where a patch has to be applied to a Client component, the Database can be up and running - otherwise has to be shutdown for relink. Q: Where are the makefiles and demos in 10gR2 ? A: Since Oracle 10gR1 there is a separate installation disk called "Companion CD" containg the makefiles and the demos. To get a complete Precompiler-Installation, in 9iR2 it was only needed to choose the Precompilers during Database Installation - to obtain this in 10gR2 it is needed first to install the Database software including Precompilers, then re-install the Precompilers from Client Installation and apply as last step the Companion Products including the makefiles and samples. Goal was to save time during normal installations and space on devices to provide customer more flexibility. After Installtion of the Companion CD the demos, makefiles and headers could be found at the same place as in 9iR2 - $ORACLE_HOME/precomp Q: There is no Pro*Cobol 10.2.0.1.0 Manual - only 9.2 - is this correct ? A: Yes. Pro*Cobol 10.2.0.1.0 has the same features as Pro*Cobol 9.2 and there was no need to provide a new manual. Same issue was questioned many time when Pro*C 8.1.7 was released - but only Pro*C 8.1.6 manual was shipped. References ------------------------------- Precompiler FAQ's in 11gR1 (11.1.0.6) Questions and Answers Q: What precompilers are installed when "Database Installation" is choosen ? A: Since 10gR1 (10.1.0.2) only component "Precompilers" is showen in the Universal Installer - no separation of Pro*C, Pro*Cobol etc. By default Pro*C and Pro*Cobol are installed - independant if target is 32bit or 64bit OS. Furtheron, in case of 64bit OS only the 32bit Pro*Cobol is installed. If there is the need for 64bit Pro*Cobol , it is required to re-install from the "Client Installation" (*NOT* "Instant Client") and custom install type the Precompilers from the product "Oracle Programmer" on a former Database Installation - this will apply the Pro*Cobol 64bit (64bit OS) and the Pro*Fortran and SQL*Module for Ada additionally. Better strategy is to apply a separate Client because this contains directly the full Precompilers (except demos etc - see below). In cases where a patch has to be applied to a Client component, the Database can be up and running - otherwise has to be shutdown for relink. Q: Where are the makefiles and demos in 11gR1 ? A: In Oracle 10gR1 (10.1.0.2) and Oracle 10gR2(10.2.0.1) there is a separate installation disk called "Companion CD" containg the makefiles and the demos. In Oracle 11gR1(11.1.0.6) the "Companion CD" was renamed to "Example CD". To get a complete Precompiler-Installation, in 9iR2 it was only needed to choose the Precompilers during Database Installation - to obtain this in 11gR1 it is needed first to install the Database software including Precompilers, then re-install the Precompilers from Client Installation and apply as last step the Example CD Products including the makefiles and samples. Goal was to save time during normal installations and space on devices to provide customer more flexibility. After Installtion of the Example CD the demos, makefiles and headers could be found at the same place as in 9iR2 - $ORACLE_HOME/precomp Q: Using valid SQL statements for the RDBMS with same release then Pro*C or Pro*Cobol could result in a error during precompilation and / or runtime - Why ? A: Precompilers and RDBMS parser were different in the past - beginning with 11.1.0.6 a sort of unified parser has been implemented which allows to use in a Precompiler application the same SQL statements as issued from SQL*Plus. The unified parser can be invoked by using precompiler option common_parser=yes. Q: Where is Pro*Cobol 1.8.x in $ORACLE_HOME/bin ? A: Pro*Cobol 1.8.x has been discontinued with Oracle 10.1.0.x and higher - Please use Pro*Cobol 11.1.0.6 instead. ---------------------------------------------------------------- Nice. Re: (11) - Which samples create problems and what are the problems? Roger ---------------------------------------------------------------- Oracle 10gR2: sample5.pco ----------- ..... sample5.cob:229: Error: Executable program requested but PROCEDURE/ENTRY has USI NG clause ..... sample13.pco ------------ ..... sample13.cob:295: Error: 'SQL-ITERS' undefined sample13.cob:296: Error: 'SQL-OFFSET' undefined sample13.cob:297: Error: 'SQL-OCCURS' undefined sample13.cob:299: Error: 'SQLCUD' undefined sample13.cob:300: Error: 'SQL-CUD' undefined sample13.cob:302: Error: 'SQLCA' undefined sample13.cob:303: Error: 'SQL-SQLEST' undefined sample13.cob:304: Error: 'SQL-SQLETY' undefined sample13.cob:310: Error: 'SQL-SQHSTV' undefined sample13.cob:311: Error: 'SQL-SQHSTL' undefined sample13.cob:312: Error: 'SQL-SQHSTS' undefined sample13.cob:313: Error: 'SQL-SQINDV' undefined sample13.cob:314: Error: 'SQL-SQINDS' undefined sample13.cob:315: Error: 'SQL-SQHARM' undefined sample13.cob:321: Error: 'SQL-SQHSTV' undefined sample13.cob:322: Error: 'SQL-SQHSTL' undefined sample13.cob:323: Error: 'SQL-SQHSTS' undefined sample13.cob:324: Error: 'SQL-SQINDV' undefined sample13.cob:325: Error: 'SQL-SQINDS' undefined sample13.cob:326: Error: 'SQL-SQHARM' undefined sample13.cob:328: Error: 'SQL-SQHSTV' undefined sample13.cob:329: Error: 'SQL-SQPHSV' undefined sample13.cob:331: Error: 'SQL-SQHSTL' undefined sample13.cob:332: Error: 'SQL-SQPHSL' undefined sample13.cob:334: Error: 'SQL-SQHSTS' undefined sample13.cob:335: Error: 'SQL-SQPHSS' undefined sample13.cob:337: Error: 'SQL-SQINDV' undefined sample13.cob:338: Error: 'SQL-SQPIND' undefined sample13.cob:340: Error: 'SQL-SQINDS' undefined sample13.cob:341: Error: 'SQL-SQPINS' undefined sample13.cob:343: Error: 'SQL-SQHARM' undefined sample13.cob:344: Error: 'SQL-SQPARM' undefined sample13.cob:346: Error: 'SQL-SQHARC' undefined sample13.cob:347: Error: 'SQL-SQPARC' undefined sample13.cob:350: Error: 'SQLCTX' undefined sample13.cob:351: Error: 'SQLEXD' undefined sample13.cob:352: Error: 'SQLFPN' undefined sample13.cob:354: Error: 'SQLCODE' in 'SQLCA' undefined sample13.cob:416: Error: 'SQ0002' undefined sample13.cob:416: Error: 'SQL-STMT' undefined sample13.cob:417: Error: 'SQL-ITERS' undefined sample13.cob:418: Error: 'SQL-OFFSET' undefined sample13.cob:419: Error: 'SQL-OCCURS' undefined sample13.cob:420: Error: 'SQL-SELERR' undefined sample13.cob:422: Error: 'SQLCUD' undefined sample13.cob:423: Error: 'SQL-CUD' undefined sample13.cob:425: Error: 'SQLCA' undefined sample13.cob:426: Error: 'SQL-SQLEST' undefined sample13.cob:427: Error: 'SQL-SQLETY' undefined sample13.cob:429: Error: 'DEPT-NUMBER' undefined sample13.cob:430: Error: 'SQL-SQHSTV' undefined sample13.cob:431: Error: 'SQL-SQHSTL' undefined sample13.cob:432: Error: 'SQL-SQHSTS' undefined sample13.cob:433: Error: 'SQL-SQINDV' undefined sample13.cob:434: Error: 'SQL-SQINDS' undefined sample13.cob:435: Error: 'SQL-SQHARM' undefined sample13.cob:437: Error: 'SQL-SQHSTV' undefined sample13.cob:438: Error: 'SQL-SQPHSV' undefined sample13.cob:440: Error: 'SQL-SQHSTL' undefined sample13.cob:441: Error: 'SQL-SQPHSL' undefined sample13.cob:443: Error: 'SQL-SQHSTS' undefined sample13.cob:444: Error: 'SQL-SQPHSS' undefined sample13.cob:446: Error: 'SQL-SQINDV' undefined sample13.cob:447: Error: 'SQL-SQPIND' undefined sample13.cob:449: Error: 'SQL-SQINDS' undefined sample13.cob:450: Error: 'SQL-SQPINS' undefined sample13.cob:452: Error: 'SQL-SQHARM' undefined sample13.cob:453: Error: 'SQL-SQPARM' undefined sample13.cob:455: Error: 'SQL-SQHARC' undefined sample13.cob:456: Error: 'SQL-SQPARC' undefined sample13.cob:459: Error: 'SQLCTX' undefined sample13.cob:460: Error: 'SQLEXD' undefined sample13.cob:461: Error: 'SQLFPN' undefined sample13.cob:463: Error: 'SQLCODE' in 'SQLCA' undefined sample13.cob: In paragraph 'FETCH-LOOP': sample13.cob:479: Error: 'SQL-ITERS' undefined sample13.cob:480: Error: 'SQL-OFFSET' undefined sample13.cob:481: Error: 'SQL-OCCURS' undefined sample13.cob:482: Error: 'SQL-SELERR' undefined sample13.cob:484: Error: 'SQLCUD' undefined sample13.cob:485: Error: 'SQL-CUD' undefined sample13.cob:487: Error: 'SQLCA' undefined sample13.cob:488: Error: 'SQL-SQLEST' undefined sample13.cob:489: Error: 'SQL-SQLETY' undefined sample13.cob:497: Error: 'SQL-SQHSTV' undefined sample13.cob:498: Error: 'SQL-SQHSTL' undefined sample13.cob:499: Error: 'SQL-SQHSTS' undefined sample13.cob:500: Error: 'SQL-SQINDV' undefined sample13.cob:501: Error: 'SQL-SQINDS' undefined sample13.cob:502: Error: 'SQL-SQHARM' undefined sample13.cob:506: Error: 'SQL-SQHSTV' undefined sample13.cob:507: Error: 'SQL-SQHSTL' undefined sample13.cob:508: Error: 'SQL-SQHSTS' undefined sample13.cob:509: Error: 'SQL-SQINDV' undefined sample13.cob:510: Error: 'SQL-SQINDS' undefined sample13.cob:511: Error: 'SQL-SQHARM' undefined sample13.cob:515: Error: 'SQL-SQHSTV' undefined sample13.cob:516: Error: 'SQL-SQHSTL' undefined sample13.cob:517: Error: 'SQL-SQHSTS' undefined sample13.cob:518: Error: 'SQL-SQINDV' undefined sample13.cob:519: Error: 'SQL-SQINDS' undefined sample13.cob:520: Error: 'SQL-SQHARM' undefined sample13.cob:522: Error: 'SQL-SQHSTV' undefined sample13.cob:523: Error: 'SQL-SQPHSV' undefined sample13.cob:525: Error: 'SQL-SQHSTL' undefined sample13.cob:526: Error: 'SQL-SQPHSL' undefined sample13.cob:528: Error: 'SQL-SQHSTS' undefined sample13.cob:529: Error: 'SQL-SQPHSS' undefined sample13.cob:531: Error: 'SQL-SQINDV' undefined sample13.cob:532: Error: 'SQL-SQPIND' undefined sample13.cob:534: Error: 'SQL-SQINDS' undefined sample13.cob:535: Error: 'SQL-SQPINS' undefined sample13.cob:537: Error: 'SQL-SQHARM' undefined sample13.cob:538: Error: 'SQL-SQPARM' undefined sample13.cob:540: Error: 'SQL-SQHARC' undefined sample13.cob:541: Error: 'SQL-SQPARC' undefined sample13.cob:544: Error: 'SQLCTX' undefined sample13.cob:545: Error: 'SQLEXD' undefined sample13.cob:546: Error: 'SQLFPN' undefined sample13.cob:547: Error: 'SQLCODE' in 'SQLCA' undefined sample13.cob:549: Error: 'SQLCODE' in 'SQLCA' undefined sample13.cob:553: Error: 'SQLERRD' undefined sample13.cob:558: Error: 'SQLERRD' undefined sample13.cob: In paragraph 'NO-MORE-DATA': sample13.cob:574: Error: 'SQLERRD' undefined sample13.cob:576: Error: 'SQLERRD' undefined sample13.cob:584: Error: 'SQL-ITERS' undefined sample13.cob:585: Error: 'SQL-OFFSET' undefined sample13.cob:586: Error: 'SQL-OCCURS' undefined sample13.cob:588: Error: 'SQLCUD' undefined sample13.cob:589: Error: 'SQL-CUD' undefined sample13.cob:591: Error: 'SQLCA' undefined sample13.cob:592: Error: 'SQL-SQLEST' undefined sample13.cob:593: Error: 'SQL-SQLETY' undefined sample13.cob:596: Error: 'SQLCTX' undefined sample13.cob:597: Error: 'SQLEXD' undefined sample13.cob:598: Error: 'SQLFPN' undefined sample13.cob:600: Error: 'SQLCODE' in 'SQLCA' undefined sample13.cob:620: Error: 'SQLERRMC' undefined sample13.cob:624: Error: 'SQL-ITERS' undefined sample13.cob:625: Error: 'SQL-OFFSET' undefined sample13.cob:626: Error: 'SQL-OCCURS' undefined sample13.cob:628: Error: 'SQLCUD' undefined sample13.cob:629: Error: 'SQL-CUD' undefined sample13.cob:631: Error: 'SQLCA' undefined sample13.cob:632: Error: 'SQL-SQLEST' undefined sample13.cob:633: Error: 'SQL-SQLETY' undefined sample13.cob:636: Error: 'SQLCTX' undefined sample13.cob:637: Error: 'SQLEXD' undefined sample13.cob:638: Error: 'SQLFPN' undefined ..... sample14.pco ------------ ...... sample14.cob:201: Error: Level 01 item 'EMP-REC-TABLE' cannot have OCCURS clause ...... Additional to 10gR2 in 11gR1 ============================= sample14.pco ------------ 10gR2: FAILS 01 EMP-REC-TABLE OCCURS 5 TIMES. 05 EMP-NUMBER PIC S9(4) COMP SYNC. 05 SALARY PIC S9(6)V99 DISPLAY SIGN LEADING SEPARATE. 05 EMP-NAME PIC X(10) VARYING. 11gR1: WORKS ! 01 EMP-REC-TABLE-M. 03 EMP-REC-TABLE OCCURS 5 TIMES. 05 EMP-NUMBER PIC S9(4) COMP SYNC. 05 SALARY PIC S9(6)V99 DISPLAY SIGN LEADING SEPARATE SYNC. 05 EMP-NAME PIC X(10) VARYING SYNC. db2arrdemo.pco -------------- Pro*Cobol flag db2_array=yes must be used - can be adden inside demo_procob.mk to PCCFLAGS lobdemo1.pco ------------ ..... lobdemo1.cob: In paragraph 'LIST-RECORDS-MAIN-PARA': lobdemo1.cob:860: Error: 'SQL-ITERS' undefined lobdemo1.cob:861: Error: 'SQL-OFFSET' undefined lobdemo1.cob:862: Error: 'SQL-OCCURS' undefined lobdemo1.cob:864: Error: 'SQLCUD' undefined lobdemo1.cob:865: Error: 'SQL-CUD' undefined lobdemo1.cob:867: Error: 'SQLCA' undefined lobdemo1.cob:868: Error: 'SQL-SQLEST' undefined lobdemo1.cob:869: Error: 'SQL-SQLETY' undefined lobdemo1.cob:875: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:876: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:877: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:878: Error: 'SQL-SQINDV' undefined lobdemo1.cob:879: Error: 'SQL-SQINDS' undefined lobdemo1.cob:880: Error: 'SQL-SQHARM' undefined lobdemo1.cob:882: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:883: Error: 'SQL-SQPHSV' undefined lobdemo1.cob:885: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:886: Error: 'SQL-SQPHSL' undefined lobdemo1.cob:888: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:889: Error: 'SQL-SQPHSS' undefined lobdemo1.cob:891: Error: 'SQL-SQINDV' undefined lobdemo1.cob:892: Error: 'SQL-SQPIND' undefined lobdemo1.cob:894: Error: 'SQL-SQINDS' undefined lobdemo1.cob:895: Error: 'SQL-SQPINS' undefined lobdemo1.cob:897: Error: 'SQL-SQHARM' undefined lobdemo1.cob:898: Error: 'SQL-SQPARM' undefined lobdemo1.cob:900: Error: 'SQL-SQHARC' undefined lobdemo1.cob:901: Error: 'SQL-SQPARC' undefined lobdemo1.cob:904: Error: 'SQLCTX' undefined lobdemo1.cob:905: Error: 'SQLEXD' undefined lobdemo1.cob:906: Error: 'SQLFPN' undefined lobdemo1.cob:908: Error: 'SQLCODE' in 'SQLCA' undefined lobdemo1.cob:915: Error: 'SQL-ITERS' undefined lobdemo1.cob:916: Error: 'SQL-OFFSET' undefined lobdemo1.cob:917: Error: 'SQL-OCCURS' undefined lobdemo1.cob:918: Error: 'SQL-SELERR' undefined lobdemo1.cob:920: Error: 'SQLCUD' undefined lobdemo1.cob:921: Error: 'SQL-CUD' undefined lobdemo1.cob:923: Error: 'SQLCA' undefined lobdemo1.cob:924: Error: 'SQL-SQLEST' undefined lobdemo1.cob:925: Error: 'SQL-SQLETY' undefined lobdemo1.cob:926: Error: 'SQL-SQCMOD' undefined lobdemo1.cob:929: Error: 'SQLCTX' undefined lobdemo1.cob:930: Error: 'SQLEXD' undefined lobdemo1.cob:931: Error: 'SQLFPN' undefined lobdemo1.cob:933: Error: 'SQLCODE' in 'SQLCA' undefined lobdemo1.cob: In paragraph 'GETROWS': lobdemo1.cob:943: Error: 'SQL-ITERS' undefined lobdemo1.cob:944: Error: 'SQL-OFFSET' undefined lobdemo1.cob:945: Error: 'SQL-OCCURS' undefined lobdemo1.cob:946: Error: 'SQL-SELERR' undefined lobdemo1.cob:948: Error: 'SQLCUD' undefined lobdemo1.cob:949: Error: 'SQL-CUD' undefined lobdemo1.cob:951: Error: 'SQLCA' undefined lobdemo1.cob:952: Error: 'SQL-SQLEST' undefined lobdemo1.cob:953: Error: 'SQL-SQLETY' undefined lobdemo1.cob:954: Error: 'SQL-SQFOFF' undefined lobdemo1.cob:955: Error: 'SQL-SQFMOD' undefined lobdemo1.cob:958: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:959: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:960: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:961: Error: 'SQL-SQINDV' undefined lobdemo1.cob:962: Error: 'SQL-SQINDS' undefined lobdemo1.cob:963: Error: 'SQL-SQHARM' undefined lobdemo1.cob:965: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:966: Error: 'SQL-SQPHSV' undefined lobdemo1.cob:968: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:969: Error: 'SQL-SQPHSL' undefined lobdemo1.cob:971: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:972: Error: 'SQL-SQPHSS' undefined lobdemo1.cob:974: Error: 'SQL-SQINDV' undefined lobdemo1.cob:975: Error: 'SQL-SQPIND' undefined lobdemo1.cob:977: Error: 'SQL-SQINDS' undefined lobdemo1.cob:978: Error: 'SQL-SQPINS' undefined lobdemo1.cob:980: Error: 'SQL-SQHARM' undefined lobdemo1.cob:981: Error: 'SQL-SQPARM' undefined lobdemo1.cob:983: Error: 'SQL-SQHARC' undefined lobdemo1.cob:984: Error: 'SQL-SQPARC' undefined lobdemo1.cob:987: Error: 'SQLCTX' undefined lobdemo1.cob:988: Error: 'SQLEXD' undefined lobdemo1.cob:989: Error: 'SQLFPN' undefined lobdemo1.cob:990: Error: 'SQLCODE' in 'SQLCA' undefined lobdemo1.cob:992: Error: 'SQLCODE' in 'SQLCA' undefined lobdemo1.cob: In paragraph 'NOTFOUND': lobdemo1.cob:1001: Error: 'SQL-ITERS' undefined lobdemo1.cob:1002: Error: 'SQL-OFFSET' undefined lobdemo1.cob:1003: Error: 'SQL-OCCURS' undefined lobdemo1.cob:1005: Error: 'SQLCUD' undefined lobdemo1.cob:1006: Error: 'SQL-CUD' undefined lobdemo1.cob:1008: Error: 'SQLCA' undefined lobdemo1.cob:1009: Error: 'SQL-SQLEST' undefined lobdemo1.cob:1010: Error: 'SQL-SQLETY' undefined lobdemo1.cob:1013: Error: 'SQLCTX' undefined lobdemo1.cob:1014: Error: 'SQLEXD' undefined lobdemo1.cob:1015: Error: 'SQLFPN' undefined lobdemo1.cob:1017: Error: 'SQLCODE' in 'SQLCA' undefined lobdemo1.cob: In paragraph 'GETSSS-COMMON-MAIN-PARA': lobdemo1.cob:1041: Error: 'SSS' undefined lobdemo1.cob:1046: Error: 'SQ0003' undefined lobdemo1.cob:1046: Error: 'SQL-STMT' undefined lobdemo1.cob:1047: Error: 'SQL-ITERS' undefined lobdemo1.cob:1048: Error: 'SQL-OFFSET' undefined lobdemo1.cob:1049: Error: 'SQL-OCCURS' undefined lobdemo1.cob:1050: Error: 'SQL-SELERR' undefined lobdemo1.cob:1052: Error: 'SQLCUD' undefined lobdemo1.cob:1053: Error: 'SQL-CUD' undefined lobdemo1.cob:1055: Error: 'SQLCA' undefined lobdemo1.cob:1056: Error: 'SQL-SQLEST' undefined lobdemo1.cob:1057: Error: 'SQL-SQLETY' undefined lobdemo1.cob:1060: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1061: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1062: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1063: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1064: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1065: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1067: Error: 'SSS' undefined lobdemo1.cob:1068: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1069: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1070: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1071: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1072: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1073: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1075: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1076: Error: 'SQL-SQPHSV' undefined lobdemo1.cob:1078: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1079: Error: 'SQL-SQPHSL' undefined lobdemo1.cob:1081: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1082: Error: 'SQL-SQPHSS' undefined lobdemo1.cob:1084: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1085: Error: 'SQL-SQPIND' undefined lobdemo1.cob:1087: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1088: Error: 'SQL-SQPINS' undefined lobdemo1.cob:1090: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1091: Error: 'SQL-SQPARM' undefined lobdemo1.cob:1093: Error: 'SQL-SQHARC' undefined lobdemo1.cob:1094: Error: 'SQL-SQPARC' undefined lobdemo1.cob:1097: Error: 'SQLCTX' undefined lobdemo1.cob:1098: Error: 'SQLEXD' undefined lobdemo1.cob:1099: Error: 'SQLFPN' undefined lobdemo1.cob:1101: Error: 'SQLCODE' in 'SQLCA' undefined lobdemo1.cob:1106: Error: 'SSSEXISTS' undefined lobdemo1.cob:1108: Error: 'SSSEXISTS' undefined lobdemo1.cob: In paragraph 'PRINTCRIME-COMMON-MAIN-PARA': lobdemo1.cob:1142: Error: 'SQL-ITERS' undefined lobdemo1.cob:1143: Error: 'SQL-OFFSET' undefined lobdemo1.cob:1144: Error: 'SQL-OCCURS' undefined lobdemo1.cob:1146: Error: 'SQLCUD' undefined lobdemo1.cob:1147: Error: 'SQL-CUD' undefined lobdemo1.cob:1149: Error: 'SQLCA' undefined lobdemo1.cob:1150: Error: 'SQL-SQLEST' undefined lobdemo1.cob:1151: Error: 'SQL-SQLETY' undefined lobdemo1.cob:1153: Error: 'LICENSE-TXT' undefined lobdemo1.cob:1154: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1155: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1156: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1157: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1158: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1159: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1162: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1163: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1164: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1165: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1166: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1167: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1169: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1170: Error: 'SQL-SQPHSV' undefined lobdemo1.cob:1172: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1173: Error: 'SQL-SQPHSL' undefined lobdemo1.cob:1175: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1176: Error: 'SQL-SQPHSS' undefined lobdemo1.cob:1178: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1179: Error: 'SQL-SQPIND' undefined lobdemo1.cob:1181: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1182: Error: 'SQL-SQPINS' undefined lobdemo1.cob:1184: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1185: Error: 'SQL-SQPARM' undefined lobdemo1.cob:1187: Error: 'SQL-SQHARC' undefined lobdemo1.cob:1188: Error: 'SQL-SQPARC' undefined lobdemo1.cob:1191: Error: 'SQLCTX' undefined lobdemo1.cob:1192: Error: 'SQLEXD' undefined lobdemo1.cob:1193: Error: 'SQLFPN' undefined lobdemo1.cob:1195: Error: 'SQLCODE' in 'SQLCA' undefined lobdemo1.cob:1204: Error: 'SQL-ITERS' undefined lobdemo1.cob:1205: Error: 'SQL-OFFSET' undefined lobdemo1.cob:1206: Error: 'SQL-OCCURS' undefined lobdemo1.cob:1208: Error: 'SQLCUD' undefined lobdemo1.cob:1209: Error: 'SQL-CUD' undefined lobdemo1.cob:1211: Error: 'SQLCA' undefined lobdemo1.cob:1212: Error: 'SQL-SQLEST' undefined lobdemo1.cob:1213: Error: 'SQL-SQLETY' undefined lobdemo1.cob:1216: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1217: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1218: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1219: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1220: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1221: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1223: Error: 'LICENSE-TXT' undefined lobdemo1.cob:1224: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1225: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1226: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1227: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1228: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1229: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1235: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1236: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1237: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1238: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1239: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1240: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1242: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1243: Error: 'SQL-SQPHSV' undefined lobdemo1.cob:1245: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1246: Error: 'SQL-SQPHSL' undefined lobdemo1.cob:1248: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1249: Error: 'SQL-SQPHSS' undefined lobdemo1.cob:1251: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1252: Error: 'SQL-SQPIND' undefined lobdemo1.cob:1254: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1255: Error: 'SQL-SQPINS' undefined lobdemo1.cob:1257: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1258: Error: 'SQL-SQPARM' undefined lobdemo1.cob:1260: Error: 'SQL-SQHARC' undefined lobdemo1.cob:1261: Error: 'SQL-SQPARC' undefined lobdemo1.cob:1264: Error: 'SQLCTX' undefined lobdemo1.cob:1265: Error: 'SQLEXD' undefined lobdemo1.cob:1266: Error: 'SQLFPN' undefined lobdemo1.cob:1268: Error: 'SQLCODE' in 'SQLCA' undefined lobdemo1.cob: In paragraph 'GET-RECORD-MAIN-PARA': lobdemo1.cob:1295: Error: 'SSSEXISTS' undefined lobdemo1.cob:1297: Error: 'SQL-ITERS' undefined lobdemo1.cob:1298: Error: 'SQL-OFFSET' undefined lobdemo1.cob:1299: Error: 'SQL-OCCURS' undefined lobdemo1.cob:1301: Error: 'SQLCUD' undefined lobdemo1.cob:1302: Error: 'SQL-CUD' undefined lobdemo1.cob:1304: Error: 'SQLCA' undefined lobdemo1.cob:1305: Error: 'SQL-SQLEST' undefined lobdemo1.cob:1306: Error: 'SQL-SQLETY' undefined lobdemo1.cob:1308: Error: 'LICENSE-TXT' undefined lobdemo1.cob:1309: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1310: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1311: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1312: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1313: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1314: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1316: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1317: Error: 'SQL-SQPHSV' undefined lobdemo1.cob:1319: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1320: Error: 'SQL-SQPHSL' undefined lobdemo1.cob:1322: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1323: Error: 'SQL-SQPHSS' undefined lobdemo1.cob:1325: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1326: Error: 'SQL-SQPIND' undefined lobdemo1.cob:1328: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1329: Error: 'SQL-SQPINS' undefined lobdemo1.cob:1331: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1332: Error: 'SQL-SQPARM' undefined lobdemo1.cob:1334: Error: 'SQL-SQHARC' undefined lobdemo1.cob:1335: Error: 'SQL-SQPARC' undefined lobdemo1.cob:1338: Error: 'SQLCTX' undefined lobdemo1.cob:1339: Error: 'SQLEXD' undefined lobdemo1.cob:1340: Error: 'SQLFPN' undefined lobdemo1.cob:1342: Error: 'SQLCODE' in 'SQLCA' undefined lobdemo1.cob:1348: Error: 'SQ0004' undefined lobdemo1.cob:1348: Error: 'SQL-STMT' undefined lobdemo1.cob:1349: Error: 'SQL-ITERS' undefined lobdemo1.cob:1350: Error: 'SQL-OFFSET' undefined lobdemo1.cob:1351: Error: 'SQL-OCCURS' undefined lobdemo1.cob:1352: Error: 'SQL-SELERR' undefined lobdemo1.cob:1354: Error: 'SQLCUD' undefined lobdemo1.cob:1355: Error: 'SQL-CUD' undefined lobdemo1.cob:1357: Error: 'SQLCA' undefined lobdemo1.cob:1358: Error: 'SQL-SQLEST' undefined lobdemo1.cob:1359: Error: 'SQL-SQLETY' undefined lobdemo1.cob:1365: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1366: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1367: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1368: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1369: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1370: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1372: Error: 'LICENSE-TXT' undefined lobdemo1.cob:1373: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1374: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1375: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1376: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1377: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1378: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1380: Error: 'SSS' undefined lobdemo1.cob:1381: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1382: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1383: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1384: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1385: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1386: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1388: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1389: Error: 'SQL-SQPHSV' undefined lobdemo1.cob:1391: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1392: Error: 'SQL-SQPHSL' undefined lobdemo1.cob:1394: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1395: Error: 'SQL-SQPHSS' undefined lobdemo1.cob:1397: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1398: Error: 'SQL-SQPIND' undefined lobdemo1.cob:1400: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1401: Error: 'SQL-SQPINS' undefined lobdemo1.cob:1403: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1404: Error: 'SQL-SQPARM' undefined lobdemo1.cob:1406: Error: 'SQL-SQHARC' undefined lobdemo1.cob:1407: Error: 'SQL-SQPARC' undefined lobdemo1.cob:1410: Error: 'SQLCTX' undefined lobdemo1.cob:1411: Error: 'SQLEXD' undefined lobdemo1.cob:1412: Error: 'SQLFPN' undefined lobdemo1.cob:1414: Error: 'SQLCODE' in 'SQLCA' undefined lobdemo1.cob:1420: Error: 'SSS' undefined lobdemo1.cob:1427: Error: 'SQL-ITERS' undefined lobdemo1.cob:1428: Error: 'SQL-OFFSET' undefined lobdemo1.cob:1429: Error: 'SQL-OCCURS' undefined lobdemo1.cob:1431: Error: 'SQLCUD' undefined lobdemo1.cob:1432: Error: 'SQL-CUD' undefined lobdemo1.cob:1434: Error: 'SQLCA' undefined lobdemo1.cob:1435: Error: 'SQL-SQLEST' undefined lobdemo1.cob:1436: Error: 'SQL-SQLETY' undefined lobdemo1.cob:1438: Error: 'LICENSE-TXT' undefined lobdemo1.cob:1439: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1440: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1441: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1442: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1443: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1444: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1446: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1447: Error: 'SQL-SQPHSV' undefined lobdemo1.cob:1449: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1450: Error: 'SQL-SQPHSL' undefined lobdemo1.cob:1452: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1453: Error: 'SQL-SQPHSS' undefined lobdemo1.cob:1455: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1456: Error: 'SQL-SQPIND' undefined lobdemo1.cob:1458: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1459: Error: 'SQL-SQPINS' undefined lobdemo1.cob:1461: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1462: Error: 'SQL-SQPARM' undefined lobdemo1.cob:1464: Error: 'SQL-SQHARC' undefined lobdemo1.cob:1465: Error: 'SQL-SQPARC' undefined lobdemo1.cob:1468: Error: 'SQLCTX' undefined lobdemo1.cob:1469: Error: 'SQLEXD' undefined lobdemo1.cob:1470: Error: 'SQLFPN' undefined lobdemo1.cob:1472: Error: 'SQLCODE' in 'SQLCA' undefined lobdemo1.cob: In paragraph 'ENTER-CHOICE': lobdemo1.cob:1522: Error: 'NEWCRIME-ARR' undefined lobdemo1.cob:1523: Error: 'NEWCRIME-LEN' undefined lobdemo1.cob: In paragraph 'APPENDTOCLOB-COMMON-MAIN-PARA': lobdemo1.cob:1565: Error: 'SQL-ITERS' undefined lobdemo1.cob:1566: Error: 'SQL-OFFSET' undefined lobdemo1.cob:1567: Error: 'SQL-OCCURS' undefined lobdemo1.cob:1569: Error: 'SQLCUD' undefined lobdemo1.cob:1570: Error: 'SQL-CUD' undefined lobdemo1.cob:1572: Error: 'SQLCA' undefined lobdemo1.cob:1573: Error: 'SQL-SQLEST' undefined lobdemo1.cob:1574: Error: 'SQL-SQLETY' undefined lobdemo1.cob:1576: Error: 'LICENSE-TXT' undefined lobdemo1.cob:1577: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1578: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1579: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1580: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1581: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1582: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1585: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1586: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1587: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1588: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1589: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1590: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1592: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1593: Error: 'SQL-SQPHSV' undefined lobdemo1.cob:1595: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1596: Error: 'SQL-SQPHSL' undefined lobdemo1.cob:1598: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1599: Error: 'SQL-SQPHSS' undefined lobdemo1.cob:1601: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1602: Error: 'SQL-SQPIND' undefined lobdemo1.cob:1604: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1605: Error: 'SQL-SQPINS' undefined lobdemo1.cob:1607: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1608: Error: 'SQL-SQPARM' undefined lobdemo1.cob:1610: Error: 'SQL-SQHARC' undefined lobdemo1.cob:1611: Error: 'SQL-SQPARC' undefined lobdemo1.cob:1614: Error: 'SQLCTX' undefined lobdemo1.cob:1615: Error: 'SQLEXD' undefined lobdemo1.cob:1616: Error: 'SQLFPN' undefined lobdemo1.cob:1618: Error: 'SQLCODE' in 'SQLCA' undefined lobdemo1.cob:1622: Error: 'NEWCRIME-LEN' undefined lobdemo1.cob:1629: Error: 'SQL-ITERS' undefined lobdemo1.cob:1630: Error: 'SQL-OFFSET' undefined lobdemo1.cob:1631: Error: 'SQL-OCCURS' undefined lobdemo1.cob:1633: Error: 'SQLCUD' undefined lobdemo1.cob:1634: Error: 'SQL-CUD' undefined lobdemo1.cob:1636: Error: 'SQLCA' undefined lobdemo1.cob:1637: Error: 'SQL-SQLEST' undefined lobdemo1.cob:1638: Error: 'SQL-SQLETY' undefined lobdemo1.cob:1641: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1642: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1643: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1644: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1645: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1646: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1648: Error: 'NEWCRIME-LEN' in 'NEWCRIME' undefined lobdemo1.cob:1650: Error: 'NEWCRIME-ARR' in 'NEWCRIME' undefined lobdemo1.cob:1652: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1653: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1654: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1655: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1656: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1657: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1659: Error: 'LICENSE-TXT' undefined lobdemo1.cob:1660: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1661: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1662: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1663: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1664: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1665: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1668: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1669: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1670: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1671: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1672: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1673: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1675: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1676: Error: 'SQL-SQPHSV' undefined lobdemo1.cob:1678: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1679: Error: 'SQL-SQPHSL' undefined lobdemo1.cob:1681: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1682: Error: 'SQL-SQPHSS' undefined lobdemo1.cob:1684: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1685: Error: 'SQL-SQPIND' undefined lobdemo1.cob:1687: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1688: Error: 'SQL-SQPINS' undefined lobdemo1.cob:1690: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1691: Error: 'SQL-SQPARM' undefined lobdemo1.cob:1693: Error: 'SQL-SQHARC' undefined lobdemo1.cob:1694: Error: 'SQL-SQPARC' undefined lobdemo1.cob:1697: Error: 'SQLCTX' undefined lobdemo1.cob:1698: Error: 'SQLEXD' undefined lobdemo1.cob:1699: Error: 'SQLFPN' undefined lobdemo1.cob:1701: Error: 'SQLCODE' in 'SQLCA' undefined lobdemo1.cob:1707: Error: 'SQ0005' undefined lobdemo1.cob:1707: Error: 'SQL-STMT' undefined lobdemo1.cob:1708: Error: 'SQL-ITERS' undefined lobdemo1.cob:1709: Error: 'SQL-OFFSET' undefined lobdemo1.cob:1710: Error: 'SQL-OCCURS' undefined lobdemo1.cob:1711: Error: 'SQL-SELERR' undefined lobdemo1.cob:1713: Error: 'SQLCUD' undefined lobdemo1.cob:1714: Error: 'SQL-CUD' undefined lobdemo1.cob:1716: Error: 'SQLCA' undefined lobdemo1.cob:1717: Error: 'SQL-SQLEST' undefined lobdemo1.cob:1718: Error: 'SQL-SQLETY' undefined lobdemo1.cob:1724: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1725: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1726: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1727: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1728: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1729: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1731: Error: 'SSS' undefined lobdemo1.cob:1732: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1733: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1734: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1735: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1736: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1737: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1739: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1740: Error: 'SQL-SQPHSV' undefined lobdemo1.cob:1742: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1743: Error: 'SQL-SQPHSL' undefined lobdemo1.cob:1745: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1746: Error: 'SQL-SQPHSS' undefined lobdemo1.cob:1748: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1749: Error: 'SQL-SQPIND' undefined lobdemo1.cob:1751: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1752: Error: 'SQL-SQPINS' undefined lobdemo1.cob:1754: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1755: Error: 'SQL-SQPARM' undefined lobdemo1.cob:1757: Error: 'SQL-SQHARC' undefined lobdemo1.cob:1758: Error: 'SQL-SQPARC' undefined lobdemo1.cob:1761: Error: 'SQLCTX' undefined lobdemo1.cob:1762: Error: 'SQLEXD' undefined lobdemo1.cob:1763: Error: 'SQLFPN' undefined lobdemo1.cob:1765: Error: 'SQLCODE' in 'SQLCA' undefined lobdemo1.cob:1769: Error: 'SSS' undefined lobdemo1.cob: In paragraph 'ADD-CRIME-MAIN-PARA': lobdemo1.cob:1792: Error: 'SSSEXISTS' undefined lobdemo1.cob:1794: Error: 'SQL-ITERS' undefined lobdemo1.cob:1795: Error: 'SQL-OFFSET' undefined lobdemo1.cob:1796: Error: 'SQL-OCCURS' undefined lobdemo1.cob:1798: Error: 'SQLCUD' undefined lobdemo1.cob:1799: Error: 'SQL-CUD' undefined lobdemo1.cob:1801: Error: 'SQLCA' undefined lobdemo1.cob:1802: Error: 'SQL-SQLEST' undefined lobdemo1.cob:1803: Error: 'SQL-SQLETY' undefined lobdemo1.cob:1805: Error: 'LICENSE-TXT' undefined lobdemo1.cob:1806: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1807: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1808: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1809: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1810: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1811: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1813: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1814: Error: 'SQL-SQPHSV' undefined lobdemo1.cob:1816: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1817: Error: 'SQL-SQPHSL' undefined lobdemo1.cob:1819: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1820: Error: 'SQL-SQPHSS' undefined lobdemo1.cob:1822: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1823: Error: 'SQL-SQPIND' undefined lobdemo1.cob:1825: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1826: Error: 'SQL-SQPINS' undefined lobdemo1.cob:1828: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1829: Error: 'SQL-SQPARM' undefined lobdemo1.cob:1831: Error: 'SQL-SQHARC' undefined lobdemo1.cob:1832: Error: 'SQL-SQPARC' undefined lobdemo1.cob:1835: Error: 'SQLCTX' undefined lobdemo1.cob:1836: Error: 'SQLEXD' undefined lobdemo1.cob:1837: Error: 'SQLFPN' undefined lobdemo1.cob:1839: Error: 'SQLCODE' in 'SQLCA' undefined lobdemo1.cob:1846: Error: 'SQ0006' undefined lobdemo1.cob:1846: Error: 'SQL-STMT' undefined lobdemo1.cob:1847: Error: 'SQL-ITERS' undefined lobdemo1.cob:1848: Error: 'SQL-OFFSET' undefined lobdemo1.cob:1849: Error: 'SQL-OCCURS' undefined lobdemo1.cob:1850: Error: 'SQL-SELERR' undefined lobdemo1.cob:1852: Error: 'SQLCUD' undefined lobdemo1.cob:1853: Error: 'SQL-CUD' undefined lobdemo1.cob:1855: Error: 'SQLCA' undefined lobdemo1.cob:1856: Error: 'SQL-SQLEST' undefined lobdemo1.cob:1857: Error: 'SQL-SQLETY' undefined lobdemo1.cob:1859: Error: 'LICENSE-TXT' undefined lobdemo1.cob:1860: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1861: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1862: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1863: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1864: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1865: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1867: Error: 'SSS' undefined lobdemo1.cob:1868: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1869: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1870: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1871: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1872: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1873: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1875: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1876: Error: 'SQL-SQPHSV' undefined lobdemo1.cob:1878: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1879: Error: 'SQL-SQPHSL' undefined lobdemo1.cob:1881: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1882: Error: 'SQL-SQPHSS' undefined lobdemo1.cob:1884: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1885: Error: 'SQL-SQPIND' undefined lobdemo1.cob:1887: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1888: Error: 'SQL-SQPINS' undefined lobdemo1.cob:1890: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1891: Error: 'SQL-SQPARM' undefined lobdemo1.cob:1893: Error: 'SQL-SQHARC' undefined lobdemo1.cob:1894: Error: 'SQL-SQPARC' undefined lobdemo1.cob:1897: Error: 'SQLCTX' undefined lobdemo1.cob:1898: Error: 'SQLEXD' undefined lobdemo1.cob:1899: Error: 'SQLFPN' undefined lobdemo1.cob:1901: Error: 'SQLCODE' in 'SQLCA' undefined lobdemo1.cob:1906: Error: 'SQL-ITERS' undefined lobdemo1.cob:1907: Error: 'SQL-OFFSET' undefined lobdemo1.cob:1908: Error: 'SQL-OCCURS' undefined lobdemo1.cob:1910: Error: 'SQLCUD' undefined lobdemo1.cob:1911: Error: 'SQL-CUD' undefined lobdemo1.cob:1913: Error: 'SQLCA' undefined lobdemo1.cob:1914: Error: 'SQL-SQLEST' undefined lobdemo1.cob:1915: Error: 'SQL-SQLETY' undefined lobdemo1.cob:1917: Error: 'LICENSE-TXT' undefined lobdemo1.cob:1918: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1919: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1920: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1921: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1922: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1923: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1925: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1926: Error: 'SQL-SQPHSV' undefined lobdemo1.cob:1928: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1929: Error: 'SQL-SQPHSL' undefined lobdemo1.cob:1931: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1932: Error: 'SQL-SQPHSS' undefined lobdemo1.cob:1934: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1935: Error: 'SQL-SQPIND' undefined lobdemo1.cob:1937: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1938: Error: 'SQL-SQPINS' undefined lobdemo1.cob:1940: Error: 'SQL-SQHARM' undefined lobdemo1.cob:1941: Error: 'SQL-SQPARM' undefined lobdemo1.cob:1943: Error: 'SQL-SQHARC' undefined lobdemo1.cob:1944: Error: 'SQL-SQPARC' undefined lobdemo1.cob:1947: Error: 'SQLCTX' undefined lobdemo1.cob:1948: Error: 'SQLEXD' undefined lobdemo1.cob:1949: Error: 'SQLFPN' undefined lobdemo1.cob:1951: Error: 'SQLCODE' in 'SQLCA' undefined lobdemo1.cob: In paragraph 'NEW-RECORD-MAIN-PARA': lobdemo1.cob:1974: Error: 'SSSEXISTS' undefined lobdemo1.cob:1981: Error: 'SQL-ITERS' undefined lobdemo1.cob:1982: Error: 'SQL-OFFSET' undefined lobdemo1.cob:1983: Error: 'SQL-OCCURS' undefined lobdemo1.cob:1985: Error: 'SQLCUD' undefined lobdemo1.cob:1986: Error: 'SQL-CUD' undefined lobdemo1.cob:1988: Error: 'SQLCA' undefined lobdemo1.cob:1989: Error: 'SQL-SQLEST' undefined lobdemo1.cob:1990: Error: 'SQL-SQLETY' undefined lobdemo1.cob:1992: Error: 'LICENSE-TXT' undefined lobdemo1.cob:1993: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:1994: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:1995: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:1996: Error: 'SQL-SQINDV' undefined lobdemo1.cob:1997: Error: 'SQL-SQINDS' undefined lobdemo1.cob:1998: Error: 'SQL-SQHARM' undefined lobdemo1.cob:2000: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:2001: Error: 'SQL-SQPHSV' undefined lobdemo1.cob:2003: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:2004: Error: 'SQL-SQPHSL' undefined lobdemo1.cob:2006: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:2007: Error: 'SQL-SQPHSS' undefined lobdemo1.cob:2009: Error: 'SQL-SQINDV' undefined lobdemo1.cob:2010: Error: 'SQL-SQPIND' undefined lobdemo1.cob:2012: Error: 'SQL-SQINDS' undefined lobdemo1.cob:2013: Error: 'SQL-SQPINS' undefined lobdemo1.cob:2015: Error: 'SQL-SQHARM' undefined lobdemo1.cob:2016: Error: 'SQL-SQPARM' undefined lobdemo1.cob:2018: Error: 'SQL-SQHARC' undefined lobdemo1.cob:2019: Error: 'SQL-SQPARC' undefined lobdemo1.cob:2022: Error: 'SQLCTX' undefined lobdemo1.cob:2023: Error: 'SQLEXD' undefined lobdemo1.cob:2024: Error: 'SQLFPN' undefined lobdemo1.cob:2026: Error: 'SQLCODE' in 'SQLCA' undefined lobdemo1.cob:2031: Error: 'SQ0007' undefined lobdemo1.cob:2031: Error: 'SQL-STMT' undefined lobdemo1.cob:2032: Error: 'SQL-ITERS' undefined lobdemo1.cob:2033: Error: 'SQL-OFFSET' undefined lobdemo1.cob:2034: Error: 'SQL-OCCURS' undefined lobdemo1.cob:2036: Error: 'SQLCUD' undefined lobdemo1.cob:2037: Error: 'SQL-CUD' undefined lobdemo1.cob:2039: Error: 'SQLCA' undefined lobdemo1.cob:2040: Error: 'SQL-SQLEST' undefined lobdemo1.cob:2041: Error: 'SQL-SQLETY' undefined lobdemo1.cob:2043: Error: 'SSS' undefined lobdemo1.cob:2044: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:2045: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:2046: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:2047: Error: 'SQL-SQINDV' undefined lobdemo1.cob:2048: Error: 'SQL-SQINDS' undefined lobdemo1.cob:2049: Error: 'SQL-SQHARM' undefined lobdemo1.cob:2052: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:2053: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:2054: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:2055: Error: 'SQL-SQINDV' undefined lobdemo1.cob:2056: Error: 'SQL-SQINDS' undefined lobdemo1.cob:2057: Error: 'SQL-SQHARM' undefined lobdemo1.cob:2059: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:2060: Error: 'SQL-SQPHSV' undefined lobdemo1.cob:2062: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:2063: Error: 'SQL-SQPHSL' undefined lobdemo1.cob:2065: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:2066: Error: 'SQL-SQPHSS' undefined lobdemo1.cob:2068: Error: 'SQL-SQINDV' undefined lobdemo1.cob:2069: Error: 'SQL-SQPIND' undefined lobdemo1.cob:2071: Error: 'SQL-SQINDS' undefined lobdemo1.cob:2072: Error: 'SQL-SQPINS' undefined lobdemo1.cob:2074: Error: 'SQL-SQHARM' undefined lobdemo1.cob:2075: Error: 'SQL-SQPARM' undefined lobdemo1.cob:2077: Error: 'SQL-SQHARC' undefined lobdemo1.cob:2078: Error: 'SQL-SQPARC' undefined lobdemo1.cob:2081: Error: 'SQLCTX' undefined lobdemo1.cob:2082: Error: 'SQLEXD' undefined lobdemo1.cob:2083: Error: 'SQLFPN' undefined lobdemo1.cob:2085: Error: 'SQLCODE' in 'SQLCA' undefined lobdemo1.cob:2090: Error: 'SQ0008' undefined lobdemo1.cob:2090: Error: 'SQL-STMT' undefined lobdemo1.cob:2091: Error: 'SQL-ITERS' undefined lobdemo1.cob:2092: Error: 'SQL-OFFSET' undefined lobdemo1.cob:2093: Error: 'SQL-OCCURS' undefined lobdemo1.cob:2094: Error: 'SQL-SELERR' undefined lobdemo1.cob:2096: Error: 'SQLCUD' undefined lobdemo1.cob:2097: Error: 'SQL-CUD' undefined lobdemo1.cob:2099: Error: 'SQLCA' undefined lobdemo1.cob:2100: Error: 'SQL-SQLEST' undefined lobdemo1.cob:2101: Error: 'SQL-SQLETY' undefined lobdemo1.cob:2103: Error: 'LICENSE-TXT' undefined lobdemo1.cob:2104: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:2105: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:2106: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:2107: Error: 'SQL-SQINDV' undefined lobdemo1.cob:2108: Error: 'SQL-SQINDS' undefined lobdemo1.cob:2109: Error: 'SQL-SQHARM' undefined lobdemo1.cob:2111: Error: 'SSS' undefined lobdemo1.cob:2112: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:2113: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:2114: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:2115: Error: 'SQL-SQINDV' undefined lobdemo1.cob:2116: Error: 'SQL-SQINDS' undefined lobdemo1.cob:2117: Error: 'SQL-SQHARM' undefined lobdemo1.cob:2119: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:2120: Error: 'SQL-SQPHSV' undefined lobdemo1.cob:2122: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:2123: Error: 'SQL-SQPHSL' undefined lobdemo1.cob:2125: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:2126: Error: 'SQL-SQPHSS' undefined lobdemo1.cob:2128: Error: 'SQL-SQINDV' undefined lobdemo1.cob:2129: Error: 'SQL-SQPIND' undefined lobdemo1.cob:2131: Error: 'SQL-SQINDS' undefined lobdemo1.cob:2132: Error: 'SQL-SQPINS' undefined lobdemo1.cob:2134: Error: 'SQL-SQHARM' undefined lobdemo1.cob:2135: Error: 'SQL-SQPARM' undefined lobdemo1.cob:2137: Error: 'SQL-SQHARC' undefined lobdemo1.cob:2138: Error: 'SQL-SQPARC' undefined lobdemo1.cob:2141: Error: 'SQLCTX' undefined lobdemo1.cob:2142: Error: 'SQLEXD' undefined lobdemo1.cob:2143: Error: 'SQLFPN' undefined lobdemo1.cob:2145: Error: 'SQLCODE' in 'SQLCA' undefined lobdemo1.cob:2150: Error: 'SSS' undefined lobdemo1.cob:2155: Error: 'SQL-ITERS' undefined lobdemo1.cob:2156: Error: 'SQL-OFFSET' undefined lobdemo1.cob:2157: Error: 'SQL-OCCURS' undefined lobdemo1.cob:2159: Error: 'SQLCUD' undefined lobdemo1.cob:2160: Error: 'SQL-CUD' undefined lobdemo1.cob:2162: Error: 'SQLCA' undefined lobdemo1.cob:2163: Error: 'SQL-SQLEST' undefined lobdemo1.cob:2164: Error: 'SQL-SQLETY' undefined lobdemo1.cob:2166: Error: 'LICENSE-TXT' undefined lobdemo1.cob:2167: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:2168: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:2169: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:2170: Error: 'SQL-SQINDV' undefined lobdemo1.cob:2171: Error: 'SQL-SQINDS' undefined lobdemo1.cob:2172: Error: 'SQL-SQHARM' undefined lobdemo1.cob:2174: Error: 'SQL-SQHSTV' undefined lobdemo1.cob:2175: Error: 'SQL-SQPHSV' undefined lobdemo1.cob:2177: Error: 'SQL-SQHSTL' undefined lobdemo1.cob:2178: Error: 'SQL-SQPHSL' undefined lobdemo1.cob:2180: Error: 'SQL-SQHSTS' undefined lobdemo1.cob:2181: Error: 'SQL-SQPHSS' undefined lobdemo1.cob:2183: Error: 'SQL-SQINDV' undefined lobdemo1.cob:2184: Error: 'SQL-SQPIND' undefined lobdemo1.cob:2186: Error: 'SQL-SQINDS' undefined lobdemo1.cob:2187: Error: 'SQL-SQPINS' undefined lobdemo1.cob:2189: Error: 'SQL-SQHARM' undefined lobdemo1.cob:2190: Error: 'SQL-SQPARM' undefined lobdemo1.cob:2192: Error: 'SQL-SQHARC' undefined lobdemo1.cob:2193: Error: 'SQL-SQPARC' undefined lobdemo1.cob:2196: Error: 'SQLCTX' undefined lobdemo1.cob:2197: Error: 'SQLEXD' undefined lobdemo1.cob:2198: Error: 'SQLFPN' undefined lobdemo1.cob:2200: Error: 'SQLCODE' in 'SQLCA' undefined lobdemo1.cob: In paragraph 'SQLERROR-COMMON-MAIN-PARA': lobdemo1.cob:2219: Error: 'SQLERRMC' undefined lobdemo1.cob:2221: Error: 'SQL-ITERS' undefined lobdemo1.cob:2222: Error: 'SQL-OFFSET' undefined lobdemo1.cob:2223: Error: 'SQL-OCCURS' undefined lobdemo1.cob:2225: Error: 'SQLCUD' undefined lobdemo1.cob:2226: Error: 'SQL-CUD' undefined lobdemo1.cob:2228: Error: 'SQLCA' undefined lobdemo1.cob:2229: Error: 'SQL-SQLEST' undefined lobdemo1.cob:2230: Error: 'SQL-SQLETY' undefined lobdemo1.cob:2233: Error: 'SQLCTX' undefined lobdemo1.cob:2234: Error: 'SQLEXD' undefined lobdemo1.cob:2235: Error: 'SQLFPN' undefined ..... cheers, Frank ---------------------------------------------------------------- OK. Sample 5 is clear. Either it is a main program in which case it can not have a PROCEDURE USING or it is a module called from somewhere else in which case it should be compiled as a module. Sample 14(10gR2) would have compiled with compile option "-std=mf". The 11g syntax, per standard, is correct. The Cobol standard disallows occurs at the 01 level. Do not know about the others. Looks like some preprocessor copies are missing. Incidentally, I have 10gR2 on a server here but do not have the demo diretory. (precomp is there). Can you tar the demo directory and put it for download somewhere? Roger ---------------------------------------------------------------- Hello, you can download then DB, Client and Companion software from http://www.oracle.com/technology/software/products/database/index.html Linux x86: [url=http://download.oracle.com/otn/linux/oracle10g/10201/10201_database_linux32.zip]Oracle Database 10g Release 2 (10.2.0.1.0) for Linux x86[/url] [url=http://download.oracle.com/otn/linux/oracle10g/10201/10201_companion_linux32.zip]Oracle Database 10g Companion CD Release 2 (10.2.0.1.0) for Linux x86[/url] [url=http://download.oracle.com/otn/linux/oracle10g/10201/10201_client_linux32.zip]Oracle Database 10g Client Release 2 (10.2.0.1.0) for Linux x86[/url] Linux x86-64: [url=http://www.oracle.com/technology/software/products/database/oracle10g/htdocs/10201linx8664soft.html]Linux x86-64 Download side[/url] I have uploaded the samples for 32bit & 64bit 10gR2 and 32bit 11gR1 including the sql scripts (calldemo.sql, sample11.sql etc - "sql" subdir) to be run as SCOTT user (to create scott use utlsampl.sql) here: [url=ftp://ftp.oracle.com/support/outgoing/opencobol/opencobol_procob.tar.gz]ftp://ftp.oracle.com/support/outgoing/opencobol/opencobol_procob.tar.gz[/url] the makefiles allready modified Frank ---------------------------------------------------------------- sample5.pco =========== 1. following lines MOVE SQL-IAPXIT-SUCCESS TO RTN-CODE. EXIT PROGRAM GIVING RTN-CODE. have to be replace by MOVE SQL-IAPXIT-SUCCESS TO RETURN-CODE. EXIT PROGRAM. 2. change inside demo_procob.mk COBFLAGS=-x to COBFLAGS=-m because its a shared library but not a standalone app :-D ---------------------------------------------------------------- Indeed :-) Yes, sample5 is a module. Roger ---------------------------------------------------------------- Using Pro*Cobol 11.2.0.2 and OpenCobol 1.1 *ALL* samples can now be build and run succesfully. ---------------------------------------------------------------- I can only hope that news like this could get a Berkeley DB exemption ala PHP and Perl, as we don't really ever "see" the library ... it's generated code that sees that layer. Having to release COBOL sources to stay in line with the GPL of 'commercial use' of libdb, is well, hard to justify really, when other languages have been given exclusions. If OpenCOBOL supports Oracle "outta da box", then I can only hope they wouldn't be overly ornery if an exemption request was put in again for indirectly using libdb. :-) Cheers, Brian ---------------------------------------------------------------- Subject: Conversion I am converting a bunch of COBOL programs. First problem on my list is COPY. I have copy syntax as: COPY {filename.ext}. That seems to confuse things. Any suggestions? Thanks for any help, and I am sure to be back! Mike ---------------------------------------------------------------- Hello Mike Try [code] copy "filename.ext". [/code] You can leave your copy in the same directory. If your copy file is NOT in the same directory you have to mention it in compilation command : [code] cobc -x -free -I CopyBookDirectory prog.cbl [/code] ---------------------------------------------------------------- Got that working. Thanks. ---------------------------------------------------------------- Subject: RECORD clause is ignored in FD section causing buffer overflow We are getting an error status=44 buffer overflow when we run the application. Sample code that creates the problem is: IDENTIFICATION DIVISION. PROGRAM-ID. simpleFileTest. DATE-COMPILED. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM-RS-6000. OBJECT-COMPUTER. IBM-RS-6000. INPUT-OUTPUT SECTION. FILE-CONTROL. * SELECT OPTIONAL OUTPUT-FILE SELECT OPTIONAL REPORT-FILE1 ASSIGN TO WS-CURRENT-REPORT-FILE-NAME ORGANIZATION IS LINE SEQUENTIAL. / DATA DIVISION. FILE SECTION. FD REPORT-FILE1 RECORD IS VARYING IN SIZE FROM 80 TO 180 CHARACTERS DEPENDING ON WS-CURRENT-COLUMN-SIZE. 01 REPORT-FILE1-REC PIC X(180). WORKING-STORAGE SECTION. 01 WS-PROG-ID PIC X(16) VALUE "simpleFileTest". 01 WS-CURRENT-REPORT-FILE-NAME PIC X(24). 01 WS-CURRENT-COLUMN-SIZE PIC 9(03) VALUE 132 COMP. 01 WS-TEMP-REPORT-LINE PIC X(180). 01 WS-FILE-STATUS PIC X(02) VALUE "00". 88 IO-OK VALUE "00", "05". 88 END-OF-FILE VALUE "10". 88 NOT-FOUND VALUE "23". 88 SEVERE-ERROR VALUE "01" THRU "04" "06" THRU "09" "11" THRU "22" "24" THRU "99". 01 WS-TEST-LINE. 05 RESULT-OUT PIC X(20) VALUE "Test File Line ". 05 FILLER PIC X(14) VALUE "FILE STATUS = ". 05 WS-FILE-ERROR-STATUS PIC X(02) VALUE "DM". /************************************************************************ * Mainline Routine ************************************************************************* PROCEDURE DIVISION. MAINLINE. MOVE "TestFile.txt" TO WS-CURRENT-REPORT-FILE-NAME OPEN EXTEND REPORT-FILE1 IF IO-OK OF WS-FILE-STATUS MOVE WS-TEST-LINE TO WS-TEMP-REPORT-LINE WRITE REPORT-FILE1-REC FROM WS-TEMP-REPORT-LINE AFTER ADVANCING PAGE CLOSE REPORT-FILE1 ELSE MOVE "file NOT Created " to RESULT-OUT DISPLAY WS-TEST-LINE END-IF. STOP RUN. When we compile it with "cobc -x coboltest.cbl" we get the following warning "coboltest.cbl:24: Warning: RECORD clause ignored for LINE SEQUENTIAL" Error message when application is run: libcob: Record overflow (STATUS = 44) File : 'TestFile.txt' WARNING - Implicit CLOSE of REPORT-FILE1 ("TestFile.txt") Anyone have a suggestion how to resolve this? We are migrating our current MicroFocus to OpenCobol. OC version: 1.1 Thanks :-) ---------------------------------------------------------------- Fixed in current 1.1. (You will still get the compile warning - It does not make any sense to have a RECORD clause on a LINE SEQUENTIAL file) Roger ---------------------------------------------------------------- Subject: ./configure gmp.h problem Running Windows XP with MINGW32 inside MSYS. I installed gmp-4.2.2 and now im trying to install open-cobol-1.0 checking gmp.h usability... no checking gmp.h presence... no checking for gmp.h... no configure: error: gmp.h is required Config log ---------------- This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by OpenCOBOL configure 1.0, which was generated by GNU Autoconf 2.59. Invocation command line was $ ./configure ## --------- ## ## Platform. ## ## --------- ## hostname = GMEDIACENTER uname -m = i686 uname -r = 1.0.10(0.46/3/2) uname -s = MINGW32_NT-5.1 uname -v = 2004-03-15 07:17 /usr/bin/uname -p = unknown /bin/uname -X = unknown /bin/arch = unknown /usr/bin/arch -k = unknown /usr/convex/getsysinfo = unknown hostinfo = unknown /bin/machine = unknown /usr/bin/oslevel = unknown /bin/universe = unknown PATH: . PATH: /usr/local/bin PATH: /mingw/bin PATH: /bin PATH: /mingw/bin PATH: /c/Perl/site/bin PATH: /c/Perl/bin PATH: /c/WINDOWS/system32 PATH: /c/WINDOWS PATH: /c/WINDOWS/System32/Wbem PATH: /c/Program Files/Intel/DMIX PATH: /c/Program Files/ATI Technologies/ATI Control Panel PATH: /c/Program Files/ATI Technologies/ATI.ACE/Core-Static PATH: /c/Program Files/QuickTime/QTSystem/ PATH: /c/Program Files/ESTsoft/ALZip/ PATH: /c/Program Files/ESTsoft/ALZip/ ## ----------- ## ## Core tests. ## ## ----------- ## configure:1594: checking for a BSD-compatible install configure:1649: result: /bin/install -c configure:1660: checking whether build environment is sane configure:1703: result: yes configure:1727: WARNING: `missing' script is too old or missing configure:1768: checking for gawk configure:1784: found /bin/gawk configure:1794: result: gawk configure:1804: checking whether make sets $(MAKE) configure:1824: result: yes configure:1992: checking whether to enable maintainer-specific portions of Makefiles configure:2001: result: no configure:2137: checking for gcc configure:2153: found /mingw/bin/gcc configure:2163: result: gcc configure:2407: checking for C compiler version configure:2410: gcc --version &5 gcc.exe (GCC) 3.4.5 (mingw special) Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. configure:2413: $? = 0 configure:2415: gcc -v &5 Reading specs from c:/mingw/bin/../lib/gcc/mingw32/3.4.5/specs Configured with: ../gcc-3.4.5/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-synchronization --enable-libstdcxx-debug Thread model: win32 gcc version 3.4.5 (mingw special) configure:2418: $? = 0 configure:2420: gcc -V &5 gcc.exe: `-V' option must have argument configure:2423: $? = 1 configure:2446: checking for C compiler default output file name configure:2449: gcc conftest.c >&5 configure:2452: $? = 0 configure:2498: result: a.exe configure:2503: checking whether the C compiler works configure:2509: ./a.exe configure:2512: $? = 0 configure:2529: result: yes configure:2536: checking whether we are cross compiling configure:2538: result: no configure:2541: checking for suffix of executables configure:2543: gcc -o conftest.exe conftest.c >&5 configure:2546: $? = 0 configure:2571: result: .exe configure:2577: checking for suffix of object files configure:2598: gcc -c conftest.c >&5 configure:2601: $? = 0 configure:2623: result: o configure:2627: checking whether we are using the GNU C compiler configure:2651: gcc -c conftest.c >&5 configure:2657: $? = 0 configure:2661: test -z || test ! -s conftest.err configure:2664: $? = 0 configure:2667: test -s conftest.o configure:2670: $? = 0 configure:2683: result: yes configure:2689: checking whether gcc accepts -g configure:2710: gcc -c -g conftest.c >&5 configure:2716: $? = 0 configure:2720: test -z || test ! -s conftest.err configure:2723: $? = 0 configure:2726: test -s conftest.o configure:2729: $? = 0 configure:2740: result: yes configure:2757: checking for gcc option to accept ANSI C configure:2827: gcc -c -g -O2 conftest.c >&5 configure:2833: $? = 0 configure:2837: test -z || test ! -s conftest.err configure:2840: $? = 0 configure:2843: test -s conftest.o configure:2846: $? = 0 configure:2864: result: none needed configure:2882: gcc -c -g -O2 conftest.c >&5 conftest.c:2: error: syntax error before "me" configure:2888: $? = 1 configure: failed program was: | #ifndef __cplusplus | choke me | #endif configure:3032: checking for style of include used by make configure:3060: result: GNU configure:3088: checking dependency style of gcc configure:3178: result: gcc3 configure:3200: checking how to run the C preprocessor configure:3235: gcc -E conftest.c configure:3241: $? = 0 configure:3273: gcc -E conftest.c conftest.c:13:28: ac_nonexistent.h: No such file or directory configure:3279: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "1.0" | #define PACKAGE_STRING "OpenCOBOL 1.0" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "1.0" | #define COB_DEBUG 1 | #define __USE_STRING_INLINES 1 | /* end confdefs.h. */ | #include configure:3318: result: gcc -E configure:3342: gcc -E conftest.c configure:3348: $? = 0 configure:3380: gcc -E conftest.c conftest.c:13:28: ac_nonexistent.h: No such file or directory configure:3386: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "1.0" | #define PACKAGE_STRING "OpenCOBOL 1.0" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "1.0" | #define COB_DEBUG 1 | #define __USE_STRING_INLINES 1 | /* end confdefs.h. */ | #include configure:3429: checking for egrep configure:3439: result: grep -E configure:3478: checking for ANSI C header files configure:3503: gcc -c -g -O2 conftest.c >&5 configure:3509: $? = 0 configure:3513: test -z || test ! -s conftest.err configure:3516: $? = 0 configure:3519: test -s conftest.o configure:3522: $? = 0 configure:3608: gcc -o conftest.exe -g -O2 conftest.c >&5 configure:3611: $? = 0 configure:3613: ./conftest.exe configure:3616: $? = 0 configure:3631: result: yes configure:3655: checking for sys/types.h configure:3671: gcc -c -g -O2 conftest.c >&5 configure:3677: $? = 0 configure:3681: test -z || test ! -s conftest.err configure:3684: $? = 0 configure:3687: test -s conftest.o configure:3690: $? = 0 configure:3701: result: yes configure:3655: checking for sys/stat.h configure:3671: gcc -c -g -O2 conftest.c >&5 configure:3677: $? = 0 configure:3681: test -z || test ! -s conftest.err configure:3684: $? = 0 configure:3687: test -s conftest.o configure:3690: $? = 0 configure:3701: result: yes configure:3655: checking for stdlib.h configure:3671: gcc -c -g -O2 conftest.c >&5 configure:3677: $? = 0 configure:3681: test -z || test ! -s conftest.err configure:3684: $? = 0 configure:3687: test -s conftest.o configure:3690: $? = 0 configure:3701: result: yes configure:3655: checking for string.h configure:3671: gcc -c -g -O2 conftest.c >&5 configure:3677: $? = 0 configure:3681: test -z || test ! -s conftest.err configure:3684: $? = 0 configure:3687: test -s conftest.o configure:3690: $? = 0 configure:3701: result: yes configure:3655: checking for memory.h configure:3671: gcc -c -g -O2 conftest.c >&5 configure:3677: $? = 0 configure:3681: test -z || test ! -s conftest.err configure:3684: $? = 0 configure:3687: test -s conftest.o configure:3690: $? = 0 configure:3701: result: yes configure:3655: checking for strings.h configure:3671: gcc -c -g -O2 conftest.c >&5 configure:3677: $? = 0 configure:3681: test -z || test ! -s conftest.err configure:3684: $? = 0 configure:3687: test -s conftest.o configure:3690: $? = 0 configure:3701: result: yes configure:3655: checking for inttypes.h configure:3671: gcc -c -g -O2 conftest.c >&5 configure:3677: $? = 0 configure:3681: test -z || test ! -s conftest.err configure:3684: $? = 0 configure:3687: test -s conftest.o configure:3690: $? = 0 configure:3701: result: yes configure:3655: checking for stdint.h configure:3671: gcc -c -g -O2 conftest.c >&5 configure:3677: $? = 0 configure:3681: test -z || test ! -s conftest.err configure:3684: $? = 0 configure:3687: test -s conftest.o configure:3690: $? = 0 configure:3701: result: yes configure:3655: checking for unistd.h configure:3671: gcc -c -g -O2 conftest.c >&5 configure:3677: $? = 0 configure:3681: test -z || test ! -s conftest.err configure:3684: $? = 0 configure:3687: test -s conftest.o configure:3690: $? = 0 configure:3701: result: yes configure:4567: checking whether ln -s works configure:4571: result: yes configure:4591: checking for a BSD-compatible install configure:4646: result: /bin/install -c configure:4739: checking build system type configure:4757: result: i686-pc-mingw32 configure:4765: checking host system type configure:4779: result: i686-pc-mingw32 configure:4787: checking for a sed that does not truncate output configure:4843: result: /bin/sed configure:4857: checking for ld used by gcc configure:4924: result: c:/mingw/mingw32/bin/ld.exe configure:4933: checking if the linker (c:/mingw/mingw32/bin/ld.exe) is GNU ld configure:4948: result: yes configure:4953: checking for c:/mingw/mingw32/bin/ld.exe option to reload object files configure:4960: result: -r configure:4978: checking for BSD-compatible nm configure:5027: result: /mingw/bin/nm configure:5031: checking how to recognize dependent libraries configure:5217: result: file_magic file format pei*-i386(.*architecture: i386)? configure:5491: checking for dlltool configure:5507: found /mingw/bin/dlltool configure:5518: result: dlltool configure:5571: checking for as configure:5587: found /mingw/bin/as configure:5598: result: as configure:5651: checking for objdump configure:5667: found /mingw/bin/objdump configure:5678: result: objdump configure:5711: checking dlfcn.h usability configure:5723: gcc -c -g -O2 conftest.c >&5 conftest.c:61:19: dlfcn.h: No such file or directory configure:5729: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "1.0" | #define PACKAGE_STRING "OpenCOBOL 1.0" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "1.0" | #define COB_DEBUG 1 | #define __USE_STRING_INLINES 1 | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define WITH_DB 3 | #define WITH_LFS64 1 | #define PATCH_LEVEL 0 | #define WITH_VARSEQ 0 | /* end confdefs.h. */ | #include | #if HAVE_SYS_TYPES_H | # include | #endif | #if HAVE_SYS_STAT_H | # include | #endif | #if STDC_HEADERS | # include | # include | #else | # if HAVE_STDLIB_H | # include | # endif | #endif | #if HAVE_STRING_H | # if !STDC_HEADERS && HAVE_MEMORY_H | # include | # endif | # include | #endif | #if HAVE_STRINGS_H | # include | #endif | #if HAVE_INTTYPES_H | # include | #else | # if HAVE_STDINT_H | # include | # endif | #endif | #if HAVE_UNISTD_H | # include | #endif | #include configure:5752: result: no configure:5756: checking dlfcn.h presence configure:5766: gcc -E conftest.c conftest.c:27:19: dlfcn.h: No such file or directory configure:5772: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "1.0" | #define PACKAGE_STRING "OpenCOBOL 1.0" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "1.0" | #define COB_DEBUG 1 | #define __USE_STRING_INLINES 1 | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define WITH_DB 3 | #define WITH_LFS64 1 | #define PATCH_LEVEL 0 | #define WITH_VARSEQ 0 | /* end confdefs.h. */ | #include configure:5792: result: no configure:5827: checking for dlfcn.h configure:5834: result: no configure:6090: checking the maximum length of command line arguments configure:6202: result: 8192 configure:6214: checking command to parse /mingw/bin/nm output from gcc object configure:6319: gcc -c -g -O2 conftest.c >&5 configure:6322: $? = 0 configure:6326: /mingw/bin/nm conftest.o \| sed -n -e 's/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)\{0,1\}$/\1 \2 \2/p' \> conftest.nm configure:6329: $? = 0 cannot find nm_test_var in conftest.nm configure:6319: gcc -c -g -O2 conftest.c >&5 configure:6322: $? = 0 configure:6326: /mingw/bin/nm conftest.o \| sed -n -e 's/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*_\([_A-Za-z][_A-Za-z0-9]*\)\{0,1\}$/\1 _\2 \2/p' \> conftest.nm configure:6329: $? = 0 configure:6381: gcc -o conftest.exe -g -O2 conftest.c conftstm.o >&5 configure:6384: $? = 0 configure:6422: result: ok configure:6426: checking for objdir configure:6441: result: .libs configure:6531: checking for ar configure:6547: found /mingw/bin/ar configure:6558: result: ar configure:6611: checking for ranlib configure:6627: found /mingw/bin/ranlib configure:6638: result: ranlib configure:6691: checking for strip configure:6707: found /mingw/bin/strip configure:6718: result: strip configure:6990: checking if gcc supports -fno-rtti -fno-exceptions configure:7011: gcc -c -g -O2 -fno-rtti -fno-exceptions conftest.c >&5 cc1.exe: warning: command line option "-fno-rtti" is valid for C++/ObjC++ but not for C configure:7015: $? = 0 configure:7025: result: no configure:7040: checking for gcc option to produce PIC configure:7272: result: -DDLL_EXPORT configure:7280: checking if gcc PIC flag -DDLL_EXPORT works configure:7301: gcc -c -g -O2 -DDLL_EXPORT -DPIC conftest.c >&5 configure:7305: $? = 0 configure:7315: result: yes configure:7343: checking if gcc static flag -static works configure:7371: result: yes configure:7381: checking if gcc supports -c -o file.o configure:7405: gcc -c -g -O2 -o out/conftest2.o conftest.c >&5 configure:7409: $? = 0 configure:7428: result: yes configure:7454: checking whether the gcc linker (c:/mingw/mingw32/bin/ld.exe) supports shared libraries configure:8438: result: yes configure:8459: checking whether -lc should be explicitly linked in configure:8464: gcc -c -g -O2 conftest.c >&5 configure:8467: $? = 0 configure:8482: gcc -shared conftest.o -v -o ./conftest -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker conftest 2\>\&1 \| grep -lc \>/dev/null 2\>\&1 configure:8485: $? = 1 configure:8497: result: yes configure:8505: checking dynamic linker characteristics configure:9107: result: Win32 ld.exe configure:9116: checking how to hardcode library paths into programs configure:9141: result: immediate configure:9155: checking whether stripping libraries is possible configure:9160: result: yes configure:9995: checking if libtool supports shared libraries configure:9997: result: yes configure:10000: checking whether to build shared libraries configure:10021: result: yes configure:10024: checking whether to build static libraries configure:10028: result: yes configure:10121: creating libtool configure:19325: checking whether make sets $(MAKE) configure:19345: result: yes configure:19356: checking for ANSI C header files configure:19509: result: yes configure:19534: checking for stdint.h configure:19539: result: yes configure:19534: checking for sys/types.h configure:19539: result: yes configure:19543: checking signal.h usability configure:19555: gcc -c -g -O2 conftest.c >&5 configure:19561: $? = 0 configure:19565: test -z || test ! -s conftest.err configure:19568: $? = 0 configure:19571: test -s conftest.o configure:19574: $? = 0 configure:19584: result: yes configure:19588: checking signal.h presence configure:19598: gcc -E conftest.c configure:19604: $? = 0 configure:19624: result: yes configure:19659: checking for signal.h configure:19666: result: yes configure:19543: checking fcntl.h usability configure:19555: gcc -c -g -O2 conftest.c >&5 configure:19561: $? = 0 configure:19565: test -z || test ! -s conftest.err configure:19568: $? = 0 configure:19571: test -s conftest.o configure:19574: $? = 0 configure:19584: result: yes configure:19588: checking fcntl.h presence configure:19598: gcc -E conftest.c configure:19604: $? = 0 configure:19624: result: yes configure:19659: checking for fcntl.h configure:19666: result: yes configure:19543: checking malloc.h usability configure:19555: gcc -c -g -O2 conftest.c >&5 configure:19561: $? = 0 configure:19565: test -z || test ! -s conftest.err configure:19568: $? = 0 configure:19571: test -s conftest.o configure:19574: $? = 0 configure:19584: result: yes configure:19588: checking malloc.h presence configure:19598: gcc -E conftest.c configure:19604: $? = 0 configure:19624: result: yes configure:19659: checking for malloc.h configure:19666: result: yes configure:19543: checking locale.h usability configure:19555: gcc -c -g -O2 conftest.c >&5 configure:19561: $? = 0 configure:19565: test -z || test ! -s conftest.err configure:19568: $? = 0 configure:19571: test -s conftest.o configure:19574: $? = 0 configure:19584: result: yes configure:19588: checking locale.h presence configure:19598: gcc -E conftest.c configure:19604: $? = 0 configure:19624: result: yes configure:19659: checking for locale.h configure:19666: result: yes configure:19543: checking stddef.h usability configure:19555: gcc -c -g -O2 conftest.c >&5 configure:19561: $? = 0 configure:19565: test -z || test ! -s conftest.err configure:19568: $? = 0 configure:19571: test -s conftest.o configure:19574: $? = 0 configure:19584: result: yes configure:19588: checking stddef.h presence configure:19598: gcc -E conftest.c configure:19604: $? = 0 configure:19624: result: yes configure:19659: checking for stddef.h configure:19666: result: yes configure:19543: checking wchar.h usability configure:19555: gcc -c -g -O2 conftest.c >&5 configure:19561: $? = 0 configure:19565: test -z || test ! -s conftest.err configure:19568: $? = 0 configure:19571: test -s conftest.o configure:19574: $? = 0 configure:19584: result: yes configure:19588: checking wchar.h presence configure:19598: gcc -E conftest.c configure:19604: $? = 0 configure:19624: result: yes configure:19659: checking for wchar.h configure:19666: result: yes configure:19534: checking for dlfcn.h configure:19539: result: no configure:19543: checking sys/time.h usability configure:19555: gcc -c -g -O2 conftest.c >&5 configure:19561: $? = 0 configure:19565: test -z || test ! -s conftest.err configure:19568: $? = 0 configure:19571: test -s conftest.o configure:19574: $? = 0 configure:19584: result: yes configure:19588: checking sys/time.h presence configure:19598: gcc -E conftest.c configure:19604: $? = 0 configure:19624: result: yes configure:19659: checking for sys/time.h configure:19666: result: yes configure:19681: checking for an ANSI C-conforming const configure:19748: gcc -c -g -O2 conftest.c >&5 configure:19754: $? = 0 configure:19758: test -z || test ! -s conftest.err configure:19761: $? = 0 configure:19764: test -s conftest.o configure:19767: $? = 0 configure:19778: result: yes configure:19788: checking whether byte ordering is bigendian configure:19815: gcc -c -g -O2 conftest.c >&5 configure:19821: $? = 0 configure:19825: test -z || test ! -s conftest.err configure:19828: $? = 0 configure:19831: test -s conftest.o configure:19834: $? = 0 configure:19858: gcc -c -g -O2 conftest.c >&5 conftest.c: In function `main': conftest.c:44: error: `not' undeclared (first use in this function) conftest.c:44: error: (Each undeclared identifier is reported only once conftest.c:44: error: for each function it appears in.) conftest.c:44: error: syntax error before "big" configure:19864: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "1.0" | #define PACKAGE_STRING "OpenCOBOL 1.0" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "1.0" | #define COB_DEBUG 1 | #define __USE_STRING_INLINES 1 | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define WITH_DB 3 | #define WITH_LFS64 1 | #define PATCH_LEVEL 0 | #define WITH_VARSEQ 0 | #define STDC_HEADERS 1 | #define HAVE_STDINT_H 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SIGNAL_H 1 | #define HAVE_FCNTL_H 1 | #define HAVE_MALLOC_H 1 | #define HAVE_LOCALE_H 1 | #define HAVE_STDDEF_H 1 | #define HAVE_WCHAR_H 1 | #define HAVE_SYS_TIME_H 1 | /* end confdefs.h. */ | #include | #include | | int | main () | { | #if BYTE_ORDER != BIG_ENDIAN | not big endian | #endif | | ; | return 0; | } configure:19999: result: no configure:20018: checking for size_t configure:20042: gcc -c -g -O2 conftest.c >&5 configure:20048: $? = 0 configure:20052: test -z || test ! -s conftest.err configure:20055: $? = 0 configure:20058: test -s conftest.o configure:20061: $? = 0 configure:20072: result: yes configure:20084: checking whether struct tm is in sys/time.h or time.h configure:20107: gcc -c -g -O2 conftest.c >&5 configure:20113: $? = 0 configure:20117: test -z || test ! -s conftest.err configure:20120: $? = 0 configure:20123: test -s conftest.o configure:20126: $? = 0 configure:20137: result: time.h configure:20148: checking for inline configure:20169: gcc -c -g -O2 conftest.c >&5 configure:20175: $? = 0 configure:20179: test -z || test ! -s conftest.err configure:20182: $? = 0 configure:20185: test -s conftest.o configure:20188: $? = 0 configure:20200: result: inline configure:20230: checking for working alloca.h configure:20251: gcc -o conftest.exe -g -O2 conftest.c >&5 conftest.c:38:20: alloca.h: No such file or directory configure:20257: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "1.0" | #define PACKAGE_STRING "OpenCOBOL 1.0" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "1.0" | #define COB_DEBUG 1 | #define __USE_STRING_INLINES 1 | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define WITH_DB 3 | #define WITH_LFS64 1 | #define PATCH_LEVEL 0 | #define WITH_VARSEQ 0 | #define STDC_HEADERS 1 | #define HAVE_STDINT_H 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SIGNAL_H 1 | #define HAVE_FCNTL_H 1 | #define HAVE_MALLOC_H 1 | #define HAVE_LOCALE_H 1 | #define HAVE_STDDEF_H 1 | #define HAVE_WCHAR_H 1 | #define HAVE_SYS_TIME_H 1 | #define COB_HAS_INLINE 1 | /* end confdefs.h. */ | #include | int | main () | { | char *p = (char *) alloca (2 * sizeof (int)); | ; | return 0; | } configure:20282: result: no configure:20292: checking for alloca configure:20333: gcc -o conftest.exe -g -O2 conftest.c >&5 configure:20339: $? = 0 configure:20343: test -z || test ! -s conftest.err configure:20346: $? = 0 configure:20349: test -s conftest.exe configure:20352: $? = 0 configure:20364: result: yes configure:20591: checking for vprintf configure:20648: gcc -o conftest.exe -g -O2 conftest.c >&5 conftest.c:63: warning: conflicting types for built-in function 'vprintf' configure:20654: $? = 0 configure:20658: test -z || test ! -s conftest.err configure:20661: $? = 0 configure:20664: test -s conftest.exe configure:20667: $? = 0 configure:20679: result: yes configure:20686: checking for _doprnt configure:20743: gcc -o conftest.exe -g -O2 conftest.c >&5 C:/DOCUME~1/GARYTE~1/LOCALS~1/Temp/ccEJAcaa.o: In function `main': C:/msys/1.0/home/Gary Tekulsky/open-cobol-1.0/conftest.c:80: undefined reference to `_doprnt' C:/msys/1.0/home/Gary Tekulsky/open-cobol-1.0/conftest.c:79: undefined reference to `_doprnt' collect2: ld returned 1 exit status configure:20749: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "1.0" | #define PACKAGE_STRING "OpenCOBOL 1.0" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "1.0" | #define COB_DEBUG 1 | #define __USE_STRING_INLINES 1 | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define WITH_DB 3 | #define WITH_LFS64 1 | #define PATCH_LEVEL 0 | #define WITH_VARSEQ 0 | #define STDC_HEADERS 1 | #define HAVE_STDINT_H 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SIGNAL_H 1 | #define HAVE_FCNTL_H 1 | #define HAVE_MALLOC_H 1 | #define HAVE_LOCALE_H 1 | #define HAVE_STDDEF_H 1 | #define HAVE_WCHAR_H 1 | #define HAVE_SYS_TIME_H 1 | #define COB_HAS_INLINE 1 | #define HAVE_ALLOCA 1 | #define HAVE_VPRINTF 1 | /* end confdefs.h. */ | /* Define _doprnt to an innocuous variant, in case declares _doprnt. | For example, HP-UX 11i declares gettimeofday. */ | #define _doprnt innocuous__doprnt | | /* System header to define __stub macros and hopefully few prototypes, | which can conflict with char _doprnt (); below. | Prefer to if __STDC__ is defined, since | exists even on freestanding compilers. */ | | #ifdef __STDC__ | # include | #else | # include | #endif | | #undef _doprnt | | /* Override any gcc2 internal prototype to avoid an error. */ | #ifdef __cplusplus | extern "C" | { | #endif | /* We use char because int might match the return type of a gcc2 | builtin and then its argument prototype would still apply. */ | char _doprnt (); | /* The GNU C library defines this for functions which it implements | to always fail with ENOSYS. Some functions are actually named | something starting with __ and the normal name is an alias. */ | #if defined (__stub__doprnt) || defined (__stub____doprnt) | choke me | #else | char (*f) () = _doprnt; | #endif | #ifdef __cplusplus | } | #endif | | int | main () | { | return f != _doprnt; | ; | return 0; | } configure:20774: result: no configure:20805: checking for memmove configure:20862: gcc -o conftest.exe -g -O2 conftest.c >&5 conftest.c:64: warning: conflicting types for built-in function 'memmove' configure:20868: $? = 0 configure:20872: test -z || test ! -s conftest.err configure:20875: $? = 0 configure:20878: test -s conftest.exe configure:20881: $? = 0 configure:20893: result: yes configure:20805: checking for memset configure:20862: gcc -o conftest.exe -g -O2 conftest.c >&5 conftest.c:65: warning: conflicting types for built-in function 'memset' configure:20868: $? = 0 configure:20872: test -z || test ! -s conftest.err configure:20875: $? = 0 configure:20878: test -s conftest.exe configure:20881: $? = 0 configure:20893: result: yes configure:20805: checking for regcomp configure:20862: gcc -o conftest.exe -g -O2 conftest.c >&5 C:/DOCUME~1/GARYTE~1/LOCALS~1/Temp/ccSwAcaa.o: In function `main': C:/msys/1.0/home/Gary Tekulsky/open-cobol-1.0/conftest.c:82: undefined reference to `regcomp' C:/msys/1.0/home/Gary Tekulsky/open-cobol-1.0/conftest.c:81: undefined reference to `regcomp' collect2: ld returned 1 exit status configure:20868: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "1.0" | #define PACKAGE_STRING "OpenCOBOL 1.0" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "1.0" | #define COB_DEBUG 1 | #define __USE_STRING_INLINES 1 | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define WITH_DB 3 | #define WITH_LFS64 1 | #define PATCH_LEVEL 0 | #define WITH_VARSEQ 0 | #define STDC_HEADERS 1 | #define HAVE_STDINT_H 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SIGNAL_H 1 | #define HAVE_FCNTL_H 1 | #define HAVE_MALLOC_H 1 | #define HAVE_LOCALE_H 1 | #define HAVE_STDDEF_H 1 | #define HAVE_WCHAR_H 1 | #define HAVE_SYS_TIME_H 1 | #define COB_HAS_INLINE 1 | #define HAVE_ALLOCA 1 | #define HAVE_VPRINTF 1 | #define HAVE_MEMMOVE 1 | #define HAVE_MEMSET 1 | /* end confdefs.h. */ | /* Define regcomp to an innocuous variant, in case declares regcomp. | For example, HP-UX 11i declares gettimeofday. */ | #define regcomp innocuous_regcomp | | /* System header to define __stub macros and hopefully few prototypes, | which can conflict with char regcomp (); below. | Prefer to if __STDC__ is defined, since | exists even on freestanding compilers. */ | | #ifdef __STDC__ | # include | #else | # include | #endif | | #undef regcomp | | /* Override any gcc2 internal prototype to avoid an error. */ | #ifdef __cplusplus | extern "C" | { | #endif | /* We use char because int might match the return type of a gcc2 | builtin and then its argument prototype would still apply. */ | char regcomp (); | /* The GNU C library defines this for functions which it implements | to always fail with ENOSYS. Some functions are actually named | something starting with __ and the normal name is an alias. */ | #if defined (__stub_regcomp) || defined (__stub___regcomp) | choke me | #else | char (*f) () = regcomp; | #endif | #ifdef __cplusplus | } | #endif | | int | main () | { | return f != regcomp; | ; | return 0; | } configure:20893: result: no configure:20805: checking for setlocale configure:20862: gcc -o conftest.exe -g -O2 conftest.c >&5 configure:20868: $? = 0 configure:20872: test -z || test ! -s conftest.err configure:20875: $? = 0 configure:20878: test -s conftest.exe configure:20881: $? = 0 configure:20893: result: yes configure:20805: checking for fcntl configure:20862: gcc -o conftest.exe -g -O2 conftest.c >&5 C:/DOCUME~1/GARYTE~1/LOCALS~1/Temp/ccULBcaa.o: In function `main': C:/msys/1.0/home/Gary Tekulsky/open-cobol-1.0/conftest.c:83: undefined reference to `fcntl' C:/msys/1.0/home/Gary Tekulsky/open-cobol-1.0/conftest.c:82: undefined reference to `fcntl' collect2: ld returned 1 exit status configure:20868: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "1.0" | #define PACKAGE_STRING "OpenCOBOL 1.0" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "1.0" | #define COB_DEBUG 1 | #define __USE_STRING_INLINES 1 | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define WITH_DB 3 | #define WITH_LFS64 1 | #define PATCH_LEVEL 0 | #define WITH_VARSEQ 0 | #define STDC_HEADERS 1 | #define HAVE_STDINT_H 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SIGNAL_H 1 | #define HAVE_FCNTL_H 1 | #define HAVE_MALLOC_H 1 | #define HAVE_LOCALE_H 1 | #define HAVE_STDDEF_H 1 | #define HAVE_WCHAR_H 1 | #define HAVE_SYS_TIME_H 1 | #define COB_HAS_INLINE 1 | #define HAVE_ALLOCA 1 | #define HAVE_VPRINTF 1 | #define HAVE_MEMMOVE 1 | #define HAVE_MEMSET 1 | #define HAVE_SETLOCALE 1 | /* end confdefs.h. */ | /* Define fcntl to an innocuous variant, in case declares fcntl. | For example, HP-UX 11i declares gettimeofday. */ | #define fcntl innocuous_fcntl | | /* System header to define __stub macros and hopefully few prototypes, | which can conflict with char fcntl (); below. | Prefer to if __STDC__ is defined, since | exists even on freestanding compilers. */ | | #ifdef __STDC__ | # include | #else | # include | #endif | | #undef fcntl | | /* Override any gcc2 internal prototype to avoid an error. */ | #ifdef __cplusplus | extern "C" | { | #endif | /* We use char because int might match the return type of a gcc2 | builtin and then its argument prototype would still apply. */ | char fcntl (); | /* The GNU C library defines this for functions which it implements | to always fail with ENOSYS. Some functions are actually named | something starting with __ and the normal name is an alias. */ | #if defined (__stub_fcntl) || defined (__stub___fcntl) | choke me | #else | char (*f) () = fcntl; | #endif | #ifdef __cplusplus | } | #endif | | int | main () | { | return f != fcntl; | ; | return 0; | } configure:20893: result: no configure:20805: checking for strerror configure:20862: gcc -o conftest.exe -g -O2 conftest.c >&5 configure:20868: $? = 0 configure:20872: test -z || test ! -s conftest.err configure:20875: $? = 0 configure:20878: test -s conftest.exe configure:20881: $? = 0 configure:20893: result: yes configure:20805: checking for strcasecmp configure:20862: gcc -o conftest.exe -g -O2 conftest.c >&5 configure:20868: $? = 0 configure:20872: test -z || test ! -s conftest.err configure:20875: $? = 0 configure:20878: test -s conftest.exe configure:20881: $? = 0 configure:20893: result: yes configure:20805: checking for strchr configure:20862: gcc -o conftest.exe -g -O2 conftest.c >&5 conftest.c:69: warning: conflicting types for built-in function 'strchr' configure:20868: $? = 0 configure:20872: test -z || test ! -s conftest.err configure:20875: $? = 0 configure:20878: test -s conftest.exe configure:20881: $? = 0 configure:20893: result: yes configure:20805: checking for strrchr configure:20862: gcc -o conftest.exe -g -O2 conftest.c >&5 conftest.c:70: warning: conflicting types for built-in function 'strrchr' configure:20868: $? = 0 configure:20872: test -z || test ! -s conftest.err configure:20875: $? = 0 configure:20878: test -s conftest.exe configure:20881: $? = 0 configure:20893: result: yes configure:20805: checking for strdup configure:20862: gcc -o conftest.exe -g -O2 conftest.c >&5 conftest.c:71: warning: conflicting types for built-in function 'strdup' configure:20868: $? = 0 configure:20872: test -z || test ! -s conftest.err configure:20875: $? = 0 configure:20878: test -s conftest.exe configure:20881: $? = 0 configure:20893: result: yes configure:20805: checking for strstr configure:20862: gcc -o conftest.exe -g -O2 conftest.c >&5 conftest.c:72: warning: conflicting types for built-in function 'strstr' configure:20868: $? = 0 configure:20872: test -z || test ! -s conftest.err configure:20875: $? = 0 configure:20878: test -s conftest.exe configure:20881: $? = 0 configure:20893: result: yes configure:20805: checking for strtol configure:20862: gcc -o conftest.exe -g -O2 conftest.c >&5 configure:20868: $? = 0 configure:20872: test -z || test ! -s conftest.err configure:20875: $? = 0 configure:20878: test -s conftest.exe configure:20881: $? = 0 configure:20893: result: yes configure:20805: checking for gettimeofday configure:20862: gcc -o conftest.exe -g -O2 conftest.c >&5 configure:20868: $? = 0 configure:20872: test -z || test ! -s conftest.err configure:20875: $? = 0 configure:20878: test -s conftest.exe configure:20881: $? = 0 configure:20893: result: yes configure:20921: gcc -c -g -O2 conftest.c >&5 configure:20927: $? = 0 configure:20931: test -z || test ! -s conftest.err configure:20934: $? = 0 configure:20937: test -s conftest.o configure:20940: $? = 0 configure:20994: checking for ld used by GCC configure:21058: result: c:/mingw/mingw32/bin/ld.exe configure:21067: checking if the linker (c:/mingw/mingw32/bin/ld.exe) is GNU ld configure:21080: result: yes configure:21086: checking for shared library run path origin configure:21099: result: done configure:21529: checking for iconv configure:21556: gcc -o conftest.exe -g -O2 conftest.c >&5 conftest.c:53:19: iconv.h: No such file or directory conftest.c: In function `main': conftest.c:57: error: `iconv_t' undeclared (first use in this function) conftest.c:57: error: (Each undeclared identifier is reported only once conftest.c:57: error: for each function it appears in.) conftest.c:57: error: syntax error before "cd" conftest.c:58: error: `cd' undeclared (first use in this function) configure:21562: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "1.0" | #define PACKAGE_STRING "OpenCOBOL 1.0" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "1.0" | #define COB_DEBUG 1 | #define __USE_STRING_INLINES 1 | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define WITH_DB 3 | #define WITH_LFS64 1 | #define PATCH_LEVEL 0 | #define WITH_VARSEQ 0 | #define STDC_HEADERS 1 | #define HAVE_STDINT_H 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SIGNAL_H 1 | #define HAVE_FCNTL_H 1 | #define HAVE_MALLOC_H 1 | #define HAVE_LOCALE_H 1 | #define HAVE_STDDEF_H 1 | #define HAVE_WCHAR_H 1 | #define HAVE_SYS_TIME_H 1 | #define COB_HAS_INLINE 1 | #define HAVE_ALLOCA 1 | #define HAVE_VPRINTF 1 | #define HAVE_MEMMOVE 1 | #define HAVE_MEMSET 1 | #define HAVE_SETLOCALE 1 | #define HAVE_STRERROR 1 | #define HAVE_STRCASECMP 1 | #define HAVE_STRCHR 1 | #define HAVE_STRRCHR 1 | #define HAVE_STRDUP 1 | #define HAVE_STRSTR 1 | #define HAVE_STRTOL 1 | #define HAVE_GETTIMEOFDAY 1 | #define HAVE_TIMEZONE 1 | /* end confdefs.h. */ | #include | #include | int | main () | { | iconv_t cd = iconv_open("",""); | iconv(cd,NULL,NULL,NULL,NULL); | iconv_close(cd); | ; | return 0; | } configure:21607: gcc -o conftest.exe -g -O2 conftest.c -liconv >&5 conftest.c:53:19: iconv.h: No such file or directory conftest.c: In function `main': conftest.c:57: error: `iconv_t' undeclared (first use in this function) conftest.c:57: error: (Each undeclared identifier is reported only once conftest.c:57: error: for each function it appears in.) conftest.c:57: error: syntax error before "cd" conftest.c:58: error: `cd' undeclared (first use in this function) configure:21613: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "1.0" | #define PACKAGE_STRING "OpenCOBOL 1.0" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "1.0" | #define COB_DEBUG 1 | #define __USE_STRING_INLINES 1 | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define WITH_DB 3 | #define WITH_LFS64 1 | #define PATCH_LEVEL 0 | #define WITH_VARSEQ 0 | #define STDC_HEADERS 1 | #define HAVE_STDINT_H 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SIGNAL_H 1 | #define HAVE_FCNTL_H 1 | #define HAVE_MALLOC_H 1 | #define HAVE_LOCALE_H 1 | #define HAVE_STDDEF_H 1 | #define HAVE_WCHAR_H 1 | #define HAVE_SYS_TIME_H 1 | #define COB_HAS_INLINE 1 | #define HAVE_ALLOCA 1 | #define HAVE_VPRINTF 1 | #define HAVE_MEMMOVE 1 | #define HAVE_MEMSET 1 | #define HAVE_SETLOCALE 1 | #define HAVE_STRERROR 1 | #define HAVE_STRCASECMP 1 | #define HAVE_STRCHR 1 | #define HAVE_STRRCHR 1 | #define HAVE_STRDUP 1 | #define HAVE_STRSTR 1 | #define HAVE_STRTOL 1 | #define HAVE_GETTIMEOFDAY 1 | #define HAVE_TIMEZONE 1 | /* end confdefs.h. */ | #include | #include | int | main () | { | iconv_t cd = iconv_open("",""); | iconv(cd,NULL,NULL,NULL,NULL); | iconv_close(cd); | ; | return 0; | } configure:21641: result: no, consider installing GNU libiconv configure:21743: checking for nl_langinfo and CODESET configure:21764: gcc -o conftest.exe -g -O2 conftest.c >&5 conftest.c:52:22: langinfo.h: No such file or directory conftest.c: In function `main': conftest.c:56: error: `CODESET' undeclared (first use in this function) conftest.c:56: error: (Each undeclared identifier is reported only once conftest.c:56: error: for each function it appears in.) conftest.c:56: warning: initialization makes pointer from integer without a cast configure:21770: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "1.0" | #define PACKAGE_STRING "OpenCOBOL 1.0" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "1.0" | #define COB_DEBUG 1 | #define __USE_STRING_INLINES 1 | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define WITH_DB 3 | #define WITH_LFS64 1 | #define PATCH_LEVEL 0 | #define WITH_VARSEQ 0 | #define STDC_HEADERS 1 | #define HAVE_STDINT_H 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SIGNAL_H 1 | #define HAVE_FCNTL_H 1 | #define HAVE_MALLOC_H 1 | #define HAVE_LOCALE_H 1 | #define HAVE_STDDEF_H 1 | #define HAVE_WCHAR_H 1 | #define HAVE_SYS_TIME_H 1 | #define COB_HAS_INLINE 1 | #define HAVE_ALLOCA 1 | #define HAVE_VPRINTF 1 | #define HAVE_MEMMOVE 1 | #define HAVE_MEMSET 1 | #define HAVE_SETLOCALE 1 | #define HAVE_STRERROR 1 | #define HAVE_STRCASECMP 1 | #define HAVE_STRCHR 1 | #define HAVE_STRRCHR 1 | #define HAVE_STRDUP 1 | #define HAVE_STRSTR 1 | #define HAVE_STRTOL 1 | #define HAVE_GETTIMEOFDAY 1 | #define HAVE_TIMEZONE 1 | /* end confdefs.h. */ | #include | int | main () | { | char* cs = nl_langinfo(CODESET); | ; | return 0; | } configure:21796: result: no configure:21811: checking for getopt_long_only configure:21868: gcc -o conftest.exe -g -O2 conftest.c >&5 C:/DOCUME~1/GARYTE~1/LOCALS~1/Temp/ccgnDcaa.o: In function `main': C:/msys/1.0/home/Gary Tekulsky/open-cobol-1.0/conftest.c:92: undefined reference to `getopt_long_only' C:/msys/1.0/home/Gary Tekulsky/open-cobol-1.0/conftest.c:91: undefined reference to `getopt_long_only' collect2: ld returned 1 exit status configure:21874: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "1.0" | #define PACKAGE_STRING "OpenCOBOL 1.0" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "1.0" | #define COB_DEBUG 1 | #define __USE_STRING_INLINES 1 | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define WITH_DB 3 | #define WITH_LFS64 1 | #define PATCH_LEVEL 0 | #define WITH_VARSEQ 0 | #define STDC_HEADERS 1 | #define HAVE_STDINT_H 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SIGNAL_H 1 | #define HAVE_FCNTL_H 1 | #define HAVE_MALLOC_H 1 | #define HAVE_LOCALE_H 1 | #define HAVE_STDDEF_H 1 | #define HAVE_WCHAR_H 1 | #define HAVE_SYS_TIME_H 1 | #define COB_HAS_INLINE 1 | #define HAVE_ALLOCA 1 | #define HAVE_VPRINTF 1 | #define HAVE_MEMMOVE 1 | #define HAVE_MEMSET 1 | #define HAVE_SETLOCALE 1 | #define HAVE_STRERROR 1 | #define HAVE_STRCASECMP 1 | #define HAVE_STRCHR 1 | #define HAVE_STRRCHR 1 | #define HAVE_STRDUP 1 | #define HAVE_STRSTR 1 | #define HAVE_STRTOL 1 | #define HAVE_GETTIMEOFDAY 1 | #define HAVE_TIMEZONE 1 | /* end confdefs.h. */ | /* Define getopt_long_only to an innocuous variant, in case declares getopt_long_only. | For example, HP-UX 11i declares gettimeofday. */ | #define getopt_long_only innocuous_getopt_long_only | | /* System header to define __stub macros and hopefully few prototypes, | which can conflict with char getopt_long_only (); below. | Prefer to if __STDC__ is defined, since | exists even on freestanding compilers. */ | | #ifdef __STDC__ | # include | #else | # include | #endif | | #undef getopt_long_only | | /* Override any gcc2 internal prototype to avoid an error. */ | #ifdef __cplusplus | extern "C" | { | #endif | /* We use char because int might match the return type of a gcc2 | builtin and then its argument prototype would still apply. */ | char getopt_long_only (); | /* The GNU C library defines this for functions which it implements | to always fail with ENOSYS. Some functions are actually named | something starting with __ and the normal name is an alias. */ | #if defined (__stub_getopt_long_only) || defined (__stub___getopt_long_only) | choke me | #else | char (*f) () = getopt_long_only; | #endif | #ifdef __cplusplus | } | #endif | | int | main () | { | return f != getopt_long_only; | ; | return 0; | } configure:21899: result: no configure:22089: checking gmp.h usability configure:22101: gcc -c -g -O2 conftest.c >&5 conftest.c:86:17: gmp.h: No such file or directory configure:22107: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "1.0" | #define PACKAGE_STRING "OpenCOBOL 1.0" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "1.0" | #define COB_DEBUG 1 | #define __USE_STRING_INLINES 1 | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define WITH_DB 3 | #define WITH_LFS64 1 | #define PATCH_LEVEL 0 | #define WITH_VARSEQ 0 | #define STDC_HEADERS 1 | #define HAVE_STDINT_H 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SIGNAL_H 1 | #define HAVE_FCNTL_H 1 | #define HAVE_MALLOC_H 1 | #define HAVE_LOCALE_H 1 | #define HAVE_STDDEF_H 1 | #define HAVE_WCHAR_H 1 | #define HAVE_SYS_TIME_H 1 | #define COB_HAS_INLINE 1 | #define HAVE_ALLOCA 1 | #define HAVE_VPRINTF 1 | #define HAVE_MEMMOVE 1 | #define HAVE_MEMSET 1 | #define HAVE_SETLOCALE 1 | #define HAVE_STRERROR 1 | #define HAVE_STRCASECMP 1 | #define HAVE_STRCHR 1 | #define HAVE_STRRCHR 1 | #define HAVE_STRDUP 1 | #define HAVE_STRSTR 1 | #define HAVE_STRTOL 1 | #define HAVE_GETTIMEOFDAY 1 | #define HAVE_TIMEZONE 1 | /* end confdefs.h. */ | #include | #if HAVE_SYS_TYPES_H | # include | #endif | #if HAVE_SYS_STAT_H | # include | #endif | #if STDC_HEADERS | # include | # include | #else | # if HAVE_STDLIB_H | # include | # endif | #endif | #if HAVE_STRING_H | # if !STDC_HEADERS && HAVE_MEMORY_H | # include | # endif | # include | #endif | #if HAVE_STRINGS_H | # include | #endif | #if HAVE_INTTYPES_H | # include | #else | # if HAVE_STDINT_H | # include | # endif | #endif | #if HAVE_UNISTD_H | # include | #endif | #include configure:22130: result: no configure:22134: checking gmp.h presence configure:22144: gcc -E conftest.c conftest.c:52:17: gmp.h: No such file or directory configure:22150: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "1.0" | #define PACKAGE_STRING "OpenCOBOL 1.0" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "1.0" | #define COB_DEBUG 1 | #define __USE_STRING_INLINES 1 | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define WITH_DB 3 | #define WITH_LFS64 1 | #define PATCH_LEVEL 0 | #define WITH_VARSEQ 0 | #define STDC_HEADERS 1 | #define HAVE_STDINT_H 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SIGNAL_H 1 | #define HAVE_FCNTL_H 1 | #define HAVE_MALLOC_H 1 | #define HAVE_LOCALE_H 1 | #define HAVE_STDDEF_H 1 | #define HAVE_WCHAR_H 1 | #define HAVE_SYS_TIME_H 1 | #define COB_HAS_INLINE 1 | #define HAVE_ALLOCA 1 | #define HAVE_VPRINTF 1 | #define HAVE_MEMMOVE 1 | #define HAVE_MEMSET 1 | #define HAVE_SETLOCALE 1 | #define HAVE_STRERROR 1 | #define HAVE_STRCASECMP 1 | #define HAVE_STRCHR 1 | #define HAVE_STRRCHR 1 | #define HAVE_STRDUP 1 | #define HAVE_STRSTR 1 | #define HAVE_STRTOL 1 | #define HAVE_GETTIMEOFDAY 1 | #define HAVE_TIMEZONE 1 | /* end confdefs.h. */ | #include configure:22170: result: no configure:22205: checking for gmp.h configure:22212: result: no configure:22222: error: gmp.h is required ## ---------------- ## ## Cache variables. ## ## ---------------- ## ac_cv_build=i686-pc-mingw32 ac_cv_build_alias=i686-pc-mingw32 ac_cv_c_bigendian=no ac_cv_c_compiler_gnu=yes ac_cv_c_const=yes ac_cv_c_inline=inline ac_cv_env_CC_set= ac_cv_env_CC_value= ac_cv_env_CFLAGS_set= ac_cv_env_CFLAGS_value= ac_cv_env_CPPFLAGS_set= ac_cv_env_CPPFLAGS_value= ac_cv_env_CPP_set= ac_cv_env_CPP_value= ac_cv_env_CXXCPP_set= ac_cv_env_CXXCPP_value= ac_cv_env_LDFLAGS_set= ac_cv_env_LDFLAGS_value= ac_cv_env_build_alias_set= ac_cv_env_build_alias_value= ac_cv_env_host_alias_set= ac_cv_env_host_alias_value= ac_cv_env_target_alias_set= ac_cv_env_target_alias_value= ac_cv_exeext=.exe ac_cv_func__doprnt=no ac_cv_func_alloca_works=yes ac_cv_func_fcntl=no ac_cv_func_getopt_long_only=no ac_cv_func_gettimeofday=yes ac_cv_func_memmove=yes ac_cv_func_memset=yes ac_cv_func_regcomp=no ac_cv_func_setlocale=yes ac_cv_func_strcasecmp=yes ac_cv_func_strchr=yes ac_cv_func_strdup=yes ac_cv_func_strerror=yes ac_cv_func_strrchr=yes ac_cv_func_strstr=yes ac_cv_func_strtol=yes ac_cv_func_vprintf=yes ac_cv_header_dlfcn_h=no ac_cv_header_fcntl_h=yes ac_cv_header_gmp_h=no ac_cv_header_inttypes_h=yes ac_cv_header_locale_h=yes ac_cv_header_malloc_h=yes ac_cv_header_memory_h=yes ac_cv_header_signal_h=yes ac_cv_header_stdc=yes ac_cv_header_stddef_h=yes ac_cv_header_stdint_h=yes ac_cv_header_stdlib_h=yes ac_cv_header_string_h=yes ac_cv_header_strings_h=yes ac_cv_header_sys_stat_h=yes ac_cv_header_sys_time_h=yes ac_cv_header_sys_types_h=yes ac_cv_header_unistd_h=yes ac_cv_header_wchar_h=yes ac_cv_host=i686-pc-mingw32 ac_cv_host_alias=i686-pc-mingw32 ac_cv_objext=o ac_cv_path_install='/bin/install -c' ac_cv_prog_AWK=gawk ac_cv_prog_CPP='gcc -E' ac_cv_prog_ac_ct_AR=ar ac_cv_prog_ac_ct_AS=as ac_cv_prog_ac_ct_CC=gcc ac_cv_prog_ac_ct_DLLTOOL=dlltool ac_cv_prog_ac_ct_OBJDUMP=objdump ac_cv_prog_ac_ct_RANLIB=ranlib ac_cv_prog_ac_ct_STRIP=strip ac_cv_prog_cc_g=yes ac_cv_prog_cc_stdc= ac_cv_prog_egrep='grep -E' ac_cv_prog_make_make_set=yes ac_cv_struct_tm=time.h ac_cv_type_size_t=yes ac_cv_working_alloca_h=no acl_cv_hardcode_direct=no acl_cv_hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' acl_cv_hardcode_libdir_separator= acl_cv_hardcode_minus_L=no acl_cv_libext=a acl_cv_path_LD=c:/mingw/mingw32/bin/ld.exe acl_cv_prog_gnu_ld=yes acl_cv_rpath=done acl_cv_shlibext=dll acl_cv_wl=-Wl, am_cv_CC_dependencies_compiler_type=gcc3 am_cv_func_iconv='no, consider installing GNU libiconv' am_cv_langinfo_codeset=no am_cv_lib_iconv=no lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= lt_cv_file_magic_cmd='$OBJDUMP -f' lt_cv_file_magic_test_file= lt_cv_ld_reload_flag=-r lt_cv_objdir=.libs lt_cv_path_LD=c:/mingw/mingw32/bin/ld.exe lt_cv_path_NM=/mingw/bin/nm lt_cv_path_SED=/bin/sed lt_cv_prog_compiler_c_o=yes lt_cv_prog_compiler_rtti_exceptions=no lt_cv_prog_gnu_ld=yes lt_cv_sys_global_symbol_pipe='sed -n -e '\''s/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*_\([_A-Za-z][_A-Za-z0-9]*\) \{0,1\}$/\1 _\2 \2/p'\''' lt_cv_sys_global_symbol_to_c_name_address='sed -n -e '\''s/^: \([^ ]*\) $/ {\"\1\", (lt_ptr) 0},/p'\'' -e '\''s/^[BCDEGRST] \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr) \&\2},/p'\''' lt_cv_sys_global_symbol_to_cdecl='sed -n -e '\''s/^. .* \(.*\)$/extern int \1;/p'\''' lt_cv_sys_max_cmd_len=8192 lt_lt_cv_prog_compiler_c_o='"yes"' lt_lt_cv_sys_global_symbol_pipe='"sed -n -e '\''s/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*_\\([_A-Za-z][_A-Za-z0-9]*\\) \\{0,1\\}\$/\\1 _\\2 \\2/p'\''"' lt_lt_cv_sys_global_symbol_to_c_name_address='"sed -n -e '\''s/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p'\'' -e '\''s/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'\''"' lt_lt_cv_sys_global_symbol_to_cdecl='"sed -n -e '\''s/^. .* \\(.*\\)\$/extern int \\1;/p'\''"' ## ----------------- ## ## Output variables. ## ## ----------------- ## ACLOCAL='aclocal-1.9' ALLOCA='' AMDEPBACKSLASH='\' AMDEP_FALSE='#' AMDEP_TRUE='' AMTAR='tar' AR='ar' AS='as' AUTOCONF='autoconf' AUTOHEADER='autoheader' AUTOMAKE='automake-1.9' AWK='gawk' CC='gcc' CCDEPMODE='depmode=gcc3' CFLAGS='-g -O2' COBC_LIBS='' COB_BIGENDIAN='' COB_CC='gcc' COB_CFLAGS='' COB_CONFIG_DIR='' COB_EXPORT_DYN='' COB_HAS_INLINE='' COB_LDFLAGS='' COB_LIBRARY_PATH='' COB_LIBS='' COB_MODULE_EXT='' COB_PIC_FLAGS='' COB_SHARED_OPT='' CPP='gcc -E' CPPFLAGS='' CXXCPP='' CYGPATH_W='echo' DEFS='' DEPDIR='.deps' DLLTOOL='dlltool' ECHO='echo' ECHO_C='' ECHO_N='-n' ECHO_T='' EGREP='grep -E' EXEEXT='.exe' GMSGFMT='' INSTALL_DATA='${INSTALL} -m 644' INSTALL_PROGRAM='${INSTALL}' INSTALL_SCRIPT='${INSTALL}' INSTALL_STRIP_PROGRAM='${SHELL} $(install_sh) -c -s' INTLLIBS='' LDFLAGS='' LIBCOB_CFLAGS='' LIBCOB_LIBS='-lm' LIBICONV='' LIBINTL='' LIBOBJS=' getopt.o getopt1.o' LIBS='' LIBTOOL='$(SHELL) $(top_builddir)/libtool' LN_S='ln -s' LTLIBICONV='' LTLIBINTL='' LTLIBOBJS='' MAINT='#' MAINTAINER_MODE_FALSE='' MAINTAINER_MODE_TRUE='#' MAKEINFO='makeinfo' MKINSTALLDIRS='' MSGFMT='' MSGMERGE='' OBJDUMP='objdump' OBJEXT='o' PACKAGE='open-cobol' PACKAGE_BUGREPORT='open-cobol-list@lists.sourceforge.net' PACKAGE_NAME='OpenCOBOL' PACKAGE_STRING='OpenCOBOL 1.0' PACKAGE_TARNAME='open-cobol' PACKAGE_VERSION='1.0' PATH_SEPARATOR=':' POSUB='' RANLIB='ranlib' SED='/bin/sed' SET_MAKE='' SHELL='/bin/sh' STRIP='strip' USE_NLS='' VERSION='1.0' XGETTEXT='' ac_ct_AR='ar' ac_ct_AS='as' ac_ct_CC='gcc' ac_ct_DLLTOOL='dlltool' ac_ct_OBJDUMP='objdump' ac_ct_RANLIB='ranlib' ac_ct_STRIP='strip' am__fastdepCC_FALSE='#' am__fastdepCC_TRUE='' am__include='include' am__leading_dot='.' am__quote='' am__tar='${AMTAR} chof - "$$tardir"' am__untar='${AMTAR} xf -' bindir='${exec_prefix}/bin' build='i686-pc-mingw32' build_alias='' build_cpu='i686' build_os='mingw32' build_vendor='pc' datadir='${prefix}/share' exec_prefix='NONE' host='i686-pc-mingw32' host_alias='' host_cpu='i686' host_os='mingw32' host_vendor='pc' includedir='${prefix}/include' infodir='${prefix}/info' install_sh='/home/Gary Tekulsky/open-cobol-1.0/install-sh' libdir='${exec_prefix}/lib' libexecdir='${exec_prefix}/libexec' localstatedir='${prefix}/var' mandir='${prefix}/man' mkdir_p='mkdir -p --' oldincludedir='/usr/include' prefix='NONE' program_transform_name='s,x,x,' sbindir='${exec_prefix}/sbin' sharedstatedir='${prefix}/com' sysconfdir='${prefix}/etc' target_alias='' ## ----------- ## ## confdefs.h. ## ## ----------- ## #define COB_DEBUG 1 #define COB_HAS_INLINE 1 #define HAVE_ALLOCA 1 #define HAVE_FCNTL_H 1 #define HAVE_GETTIMEOFDAY 1 #define HAVE_INTTYPES_H 1 #define HAVE_LOCALE_H 1 #define HAVE_MALLOC_H 1 #define HAVE_MEMMOVE 1 #define HAVE_MEMORY_H 1 #define HAVE_MEMSET 1 #define HAVE_SETLOCALE 1 #define HAVE_SIGNAL_H 1 #define HAVE_STDDEF_H 1 #define HAVE_STDINT_H 1 #define HAVE_STDINT_H 1 #define HAVE_STDLIB_H 1 #define HAVE_STRCASECMP 1 #define HAVE_STRCHR 1 #define HAVE_STRDUP 1 #define HAVE_STRERROR 1 #define HAVE_STRINGS_H 1 #define HAVE_STRING_H 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 #define HAVE_STRTOL 1 #define HAVE_SYS_STAT_H 1 #define HAVE_SYS_TIME_H 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_TIMEZONE 1 #define HAVE_UNISTD_H 1 #define HAVE_VPRINTF 1 #define HAVE_WCHAR_H 1 #define PACKAGE "open-cobol" #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" #define PACKAGE_NAME "OpenCOBOL" #define PACKAGE_STRING "OpenCOBOL 1.0" #define PACKAGE_TARNAME "open-cobol" #define PACKAGE_VERSION "1.0" #define PATCH_LEVEL 0 #define STDC_HEADERS 1 #define STDC_HEADERS 1 #define VERSION "1.0" #define WITH_DB 3 #define WITH_LFS64 1 #define WITH_VARSEQ 0 #define __USE_STRING_INLINES 1 configure: exit 1 ---------------------------------------------------------------- Looks like a GMP make/install problem. Make sure the GMP stuff is in the MinGW environment and not the MSYS environment. Roger ---------------------------------------------------------------- Not sure how to check that. I know that gmp install files are located under MSYS/1.0/home//gmp-4.2.2 and that there was one or 2 errors on its ./configure due to there being a space in my username ---------------------------------------------------------------- Hmm. That's wrong. When configuring/making/installing GMP, you should specify the MinGW directory as the prefix. (And try not to use path names with spaces. You will eventually hit problems anyway) Roger ---------------------------------------------------------------- ill redo gmp but MSYS contains the home directory for my MINGW command line environment ---------------------------------------------------------------- still have some problems GMP: MAKE CHECK la mkdir .libs libtool: link: cannot find the library `../libgmp.la' or unhandled argument `../libgmp.la' make[4]: *** [libtests.la] Error 1 make[4]: Leaving directory `/home/gmp-4.2.2/tests' make[3]: *** [check-am] Error 2 make[3]: Leaving directory `/home/gmp-4.2.2/tests' make[2]: *** [check-recursive] Error 1 make[2]: Leaving directory `/home/gmp-4.2.2/tests' make[1]: *** [check-recursive] Error 1 make[1]: Leaving directory `/home/gmp-4.2.2' make: *** [check] Error 2 ---------------------------------------------------------------- Subject: Formatting problem? I am converting from one dialect to Open Cobol. My next problem is linking error messages with the source. If I cobc -free -E sacpic1.cbl I get the source listed on the terminal, no errors. cobc -free -E sacpic1.cbl > sacpic1.lst I get the source in the file sacpic1.lst, no errors however if I enter cobc -free -x sacpic1.cbl I get sacpic1.cbl:113: Error: Invalid picture string sacpic1.cbl:113: Error: Invalid picture string sacpic1.cbl:113: Error: Invalid picture string sacpic1.cbl: In paragraph 'Nextitem': sacpic1.cbl:119: Error: syntax error, unexpected "Identifier" however no way I can find to link the errors back to the source. Any help will be appreciated. Mike ---------------------------------------------------------------- Can You tell us what is the picture in line 113. Post a part of your program between left_bracket+code+right_bracket (this is to start) .. your prog here .. .. left_bracket+/code+right_bracket (this is to end) Bear ---------------------------------------------------------------- left_bracket+code+right_bracket (this is to start) .. IDENTIFICATION DIVISION. PROGRAM-ID. sacpic1. AUTHOR. wei inc. INSTALLATION. Customer. DATE-WRITTEN. april 1992. DATE-COMPILED. when-compiled. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. intel-386dx. OBJECT-COMPUTER. intel-386dx. DATA DIVISION. WORKING-STORAGE SECTION. COPY "sacpic.w1" . LINKAGE SECTION. COPY "sacpic.l1" . SCREEN SECTION. COPY "sacpic.s1" . 01 database-maint-menu. 02 LINE menu-line4 col 22 foreground-color title-color highlight VALUE "Supervisory System Maintenance Menu". 02 LINE menu-line6 col menu-lit-col1 foreground-color heading-color highlight VALUE "Enter to perform.........". 02 LINE PLUS 1 col menu-lit-col1 foreground-color data-color VALUE "A Maintain Tank Master File". 02 LINE PLUS 1 col menu-lit-col1 foreground-color data-color VALUE "B Maintain Materials Master File". 02 LINE PLUS 1 col menu-lit-col1 foreground-color data-color VALUE "C Maintain Tank Assignment File". 02 LINE PLUS 1 col menu-lit-col1 foreground-color data-color VALUE "D Maintain Vendor File". 02 LINE PLUS 1 col menu-lit-col1 foreground-color data-color VALUE "E Maintain Operator File". 02 LINE PLUS 1 col menu-lit-col1 foreground-color data-color VALUE "F Maintain Log File". 02 LINE PLUS 1 col menu-lit-col1 foreground-color data-color VALUE "G Maintain Location File". 02 LINE PLUS 1 col menu-lit-col1 foreground-color data-color VALUE "H Maintain Recipe Archive". 02 LINE PLUS 1 col menu-lit-col1 foreground-color data-color VALUE "I List Online Error Log". 02 LINE PLUS 1 col menu-lit-col1 foreground-color data-color VALUE "J Maintain Closed Receivers". 02 LINE PLUS 1 col menu-lit-col1 foreground-color data-color VALUE "K Analyze OLTP Transactions". 02 LINE PLUS 1 col menu-lit-col1 foreground-color data-color VALUE "L Maintain Part Number File". 02 LINE PLUS 1 col menu-lit-col1 foreground-color data-color VALUE "M Maintain Shift Times". 02 LINE menu-line6 col menu-lit-col2 foreground-color heading-color highlight VALUE "Enter to perform.........". 02 LINE PLUS 1 col menu-lit-col2 foreground-color data-color VALUE "N Filler Parameter Maintenance". 02 LINE PLUS 2 col menu-lit-col2 foreground-color data-color VALUE "U Rebuild daily index". 02 LINE PLUS 1 col menu-lit-col2 foreground-color data-color VALUE "V Restore File Menu". 02 LINE PLUS 1 col menu-lit-col2 foreground-color data-color VALUE "W Backup File Menu". 02 LINE PLUS 1 col menu-lit-col2 foreground-color data-color VALUE "X Initialization Menu". 02 LINE PLUS 1 col menu-lit-col2 foreground-color data-color VALUE "Y Reorganization Menu". 02 LINE PLUS 1 col menu-lit-col2 foreground-color data-color VALUE "Z Return to previous menu". 02 LINE message-line col 1 foreground-color data-color VALUE "Enter Selection ". 02 col PLUS 1 PIC X foreground-color data-color auto USING action. 01 non-func. 02 LINE message-line col 1 BLANK LINE. 02 LINE message-line col 1 foreground-color warning-color VALUE "Function not available, contact engineering.". 02 col PLUS 1 VALUE " Hit any key to continue.. ". 02 col PLUS 1 PIC X auto USING action. PROCEDURE DIVISION. Nextitem. MOVE "sacpic1" TO program-name. DISPLAY screen-header1. DISPLAY database-maint-menu. ACCEPT database-maint-menu. INSPECT ALL action REPLACING lower-case BY upper-case. EVALUATE action WHEN "A" GO TO Calla WHEN "B" GO TO Callb WHEN "C" GO TO Callc WHEN "D" GO TO Calld WHEN "E" GO TO Calle WHEN "F" GO TO Callf WHEN "G" GO TO Callg WHEN "H" GO TO Callh WHEN "I" GO TO Calli WHEN "J" GO TO Callj WHEN "K" GO TO Callk WHEN "L" GO TO Calll WHEN "M" GO TO Callm WHEN "N" GO TO Calln WHEN "U" GO TO Callu WHEN "V" GO TO Callv WHEN "W" GO TO Callw WHEN "X" GO TO Callx WHEN "Y" GO TO Cally WHEN "Z" GO TO Alldone WHEN OTHER GO TO Nextitem END-EVALUATE. calla. CALL "sacpic1a" USING return-status. CANCEL "sacpic1A". GO TO Nextitem. callb. CALL "sacpic1b" USING return-status. CANCEL "sacpic1B". GO TO Nextitem. callc. CALL "sacpic1c" USING return-status. CANCEL "sacpic1C". GO TO Nextitem. calld. CALL "sacpic1d" USING return-status. CANCEL "sacpic1D". GO TO Nextitem. calle. CALL "sacpic1e" USING return-status. CANCEL "sacpic1e". GO TO Nextitem. callf. CALL "sacpic1f" USING return-status. CANCEL "sacpic1f". GO TO Nextitem. callg. CALL "sacpic1G" USING return-status. CANCEL "sacpic1G". GO TO Nextitem. callh. CALL "sacpic99" USING return-status. CANCEL "sacpic99". GO TO Nextitem. calli. CALL "sacpicrz" USING return-status. CANCEL "sacpicrz". GO TO Nextitem. callj. CALL "sacpic6a" USING return-status. CANCEL "sacpic6a". GO TO Nextitem. callk. CALL "sacpicia" USING return-status. CANCEL "sacpicia". GO TO Nextitem. calll. CALL "sacpic8e" USING return-status. CANCEL "sacpic8e". GO TO Nextitem. callm. CALL "sacpic8s" USING return-status. CANCEL "sacpic8s". GO TO Nextitem. calln. CALL "sacpic9a" USING return-status. CANCEL "sacpic9a". GO TO Nextitem. callu. CALL "sacpic89" USING return-status. CANCEL "sacpic89". GO TO Nextitem. callv. CALL "sacpic93" USING return-status. CANCEL "sacpic93". GO TO Nextitem. callw. CALL "sacpic94" USING return-status. CANCEL "sacpic94". GO TO Nextitem. callx. DISPLAY non-func. ACCEPT non-func. GO TO Nextitem. cally. CALL "sacpic91" USING return-status. CANCEL "sacpic91". GO TO Nextitem. alldone. MOVE 0 TO pass-status. EXIT PROGRAM. .. .. left_bracket+/code+right_bracket (this is to end) line 112 is PROCEDURE DIVISION. ---------------------------------------------------------------- [code] OC does not handle screen section. [/code] ---------------------------------------------------------------- Subject: SCREEN SECTION. Should I assume that the SCREEN SECTION is NOT in OpenCOBOL 1.1? If that is TRUE is there an alternate method of formatting screens in OpenCOBOL? Thanques! ---------------------------------------------------------------- Yes, There is no real support of screen section. Accept / Display is supported but not complete, SEE cobcurses in this forum Bear ---------------------------------------------------------------- Please try the current 1.1. Although SCREEN processing is not completely implemented, the current 1.1 may get you further. Roger ---------------------------------------------------------------- Subject: Help needed on C$NARG routine (CHAINING / USING ) Hello, I'm using C$NARG in a few programs. I used this module only in called programs (via linkage section). I recently found out that I can use it with CHAINING as mentioned below. [quote]CALL "C$NARG" USING NUM-PARAM "This data item is filled in with the # of parameters. If the calling program is a subprogram, then this will be the number of USING items in the CALL statement that initiated the program. If the calling program is a main program, then this will be the number of CHAINING parameters passed from the command line or the CHAIN statement that initiated the program. C$NARG works only when the program is a called subroutine." ...[/quote] So works my ACU (6.2). In fact C$NARG in OC does not deliver # of params when used with CHAINING. [code] IDENTIFICATION DIVISION. PROGRAM-ID. CHAINE. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. DATA DIVISION. WORKING-STORAGE SECTION. 77 wp1 pic X(30). 77 wp2 pic X(30). 77 wp3 pic X(30). 77 wNbP pic 9(05). 77 ZNbP pic zzbzz9. 77 I pic X. PROCEDURE DIVISION chaining wp1 wp2 wp3. DEBUT. call "C$NARG" using wNbp. move wNbP to ZnbP. display "This program chains " znbp " arguments" display "Argument 1 from command-line is ", wp1. display "Argument 2 from command-line is ", wp2. display "Argument 3 from command-line is ", wp3. accept I. STOP RUN. [/code] executing this program ./CHAINE aaaa bbbb cccc dddd [code] This program chains 0 arguments Argument 1 from command-line is aaaa Argument 2 from command-line is bbbb Argument 3 from command-line is cccc [/code] This is not something that is boring me, but ... who knows Best regards Bear (OpenCobol 1.1.0 Built May 7 2008) ---------------------------------------------------------------- Fixed in current 1.1 tarball. Roger ---------------------------------------------------------------- Thank you very much Roger You worked for me, so I worked a bit for the community. I post in this reply two programs I used to test C$NARG in CALL context. I Think it could be useful for newbies and others. First program is called CALLER.CBL [code] IDENTIFICATION DIVISION. PROGRAM-ID. CALLER. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. DATA DIVISION. WORKING-STORAGE SECTION. 77 wp1 pic X(30). 77 wp2 pic X(30). 77 wp3 pic X(30). 77 wp4 pic X(30). 77 wNbP pic 9(5). 77 ZNbP pic zzbzz9. 77 I pic X. PROCEDURE DIVISION. DEBUT. display "Hello, This Is The Caller Program Speaking" display "Test 1:3=Exact # of parameters are being transmitted" move "par#1 from CALLER" to wp1 move "par#2 from CALLER" to wp2 move "par#3 from CALLER" to wp3 call "CALLED" using wp1 wp2 wp3 on exception display "Something wrong happened in 1:3" end-display not on exception display "Everything is OK in 1:3" end-display end-call display "Hello, This Is The Caller Program Speaking Again" display "Test 2:3=More parameters are being transmitted" move "par#1 from CALLER" to wp1 move "par#2 from CALLER" to wp2 move "par#3 from CALLER" to wp3 move "par#4 from CALLER" to wp4 call "CALLED" using wp1 wp2 wp3 wp4 on exception display "Something wrong happened 2:3" end-display not on exception display "Everything is OK in 2:3" end-display end-call display "Hello, This Is Still The Caller Program Speaking " display "Test 3:3=ZERO parameter is being transmitted" move "par#1 from CALLER" to wp1 move "par#2 from CALLER" to wp2 move "par#3 from CALLER" to wp3 move "par#4 from CALLER" to wp4 call "CALLED" on exception display "Something wrong happened in 3:3" end-display not on exception display "Everything is OK in 3:3" end-display end-call display "Caller Program Says : You know what ? I'm Happy !" . accept I . FIN. exit program. [/code] ... and the is second is called CALLED.CBL [code] IDENTIFICATION DIVISION. PROGRAM-ID. CALLED. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. DATA DIVISION. WORKING-STORAGE SECTION. 77 wMax pic 9. 77 ZMax pic zzbzz9. 77 I pic X. 77 P pic 9. 01 wTbLnk. 02 wTbLnk-p1 pic X(30). 02 wTbLnk-p2 pic X(30). 02 wTbLnk-p3 pic X(30). 01 wTbLnk-R redefines wTbLnk. 02 wTbLnk-Item pic X(30) occurs 3. linkage section. 77 wp1 pic X(30). 77 wp2 pic X(30). 77 wp3 pic X(30). PROCEDURE DIVISION using wp1 wp2 wp3. DEBUT. call "C$NARG" using wMax. move wMax to ZMax. display " This program uses " zMax " arguments" evaluate wMax when 0 display " No arguments has been transmitted !" end-display when 1 move wp1 to wTbLnk-p1 when 2 move wp1 to wTbLnk-p1 move wp2 to wTbLnk-p2 when 3 move wp1 to wTbLnk-p1 move wp2 to wTbLnk-p2 move wp3 to wTbLnk-p3 when other display "More than THREE aguments has been transmitted" move wp1 to wTbLnk-p1 move wp2 to wTbLnk-p2 move wp3 to wTbLnk-p3 move 3 to wMax end-evaluate perform varying P from 1 by 1 until P > wMax display " Argument" P " is ", wTbLnk-Item (P), P end-display end-perform . FIN. exit program. [/code] And this is my test result after compiling with the last tarball cobc (OpenCOBOL) 1.1.0 Build date May 15 2008 09:54:38 Copyright (C) 2001-2008 Keisuke Nishida / Roger While Hello, This Is The Caller Program Speaking Test 1:3=Exact # of parameters are being transmitted This program uses 3 arguments Argument1 is par#1 from CALLER 1 Argument2 is par#2 from CALLER 2 Argument3 is par#3 from CALLER 3 Everything is OK in 1:3 Hello, This Is The Caller Program Speaking Again Test 2:3=More parameters are being transmitted This program uses 4 arguments More than THREE aguments has been transmitted Argument1 is par#1 from CALLER 1 Argument2 is par#2 from CALLER 2 Argument3 is par#3 from CALLER 3 Everything is OK in 2:3 Hello, This Is Still The Caller Program Speaking Test 3:3=ZERO parameter is being transmitted This program uses 0 arguments No arguments has been transmitted ! Everything is OK in 3:3 Caller Program Says : You know what ? I'm Happy ! To be complete next test concerns C$NARG in CHAINING context : [code] IDENTIFICATION DIVISION. PROGRAM-ID. CHAINED. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. DATA DIVISION. WORKING-STORAGE SECTION. 77 wNbP pic 9(05). 77 ZNbP pic zzbzz9. 77 I pic X. 77 wp1 pic X(30). 77 wp2 pic X(30). 77 wp3 pic X(30). PROCEDURE DIVISION chaining wp1 wp2 wp3. DEBUT. call "C$NARG" using wNbp. move wNbP to ZnbP. display "This program chains " znbp " arguments" display "Argument 1 is ", wp1. display "Argument 2 is ", wp2. display "Argument 3 is ", wp3. accept I. STOP RUN. [/code] And this the test results : ./CHAINED AAA BBB CCC This program chains 3 arguments Argument 1 is AAA Argument 2 is BBB Argument 3 is CCC ./CHAINED This program chains 0 arguments Argument 1 is Argument 2 is Argument 3 is ./CHAINED AAA BBB CCC DDD This program chains 4 arguments Argument 1 is AAA Argument 2 is BBB Argument 3 is CCC ----------------- ;-) I'm still happy. Last program tries to use "CHAIN" verb ... [code] IDENTIFICATION DIVISION. PROGRAM-ID. CHAINER. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. DATA DIVISION. WORKING-STORAGE SECTION. 77 wNbP pic 9(05). 77 ZNbP pic zzbzz9. 77 I pic X. 77 wp1 pic X(30). 77 wp2 pic X(30). 77 wp3 pic X(30). PROCEDURE DIVISION chaining wp1 wp2 wp3. DEBUT. call "C$NARG" using wNbp. move wNbP to ZnbP. display "This program chains " znbp " arguments" display "Argument 1 is ", wp1. display "Argument 2 is ", wp2. display "Argument 3 is ", wp3. chain "CHAINED" using wp1 wp2 wp3 on exeception display "Something wrong happened when chaining" end-display not on exception display "Everything is OK" end-chain . accept I. FIN. exit program. [/code] And result of compilation is Copyright (C) 2001-2008 Keisuke Nishida / Roger While CHAINER.CBL: In paragraph 'DEBUT': CHAINER.CBL:22: Error: 'chain' reserved word, but not supported yet CHAINER.CBL:22: Error: Unknown statement 'chain' Best regards Bear ---------------------------------------------------------------- Yep, we do not currently support the CHAIN verb. (Note CHAIN/CHAINING are non-standard extensions) There is a reason for current non-support of CHAIN. CHAIN syntax(ACU) states that the program to be chained be started as a seperate process AND that the current processs terminates. BUT, if the CHAIN does NOT succeed then the ON EXCEPTION should be executed. (Note there cannot logically be a NOT ON EXCEPTION for CHAIN). Now think about this. In order to prepare for a successful execution of the chained prog, then the equivalent of a STOP RUN must be done (releasing locks, closing open files, etc.). BUT having done that, if the process execution fails (eg. prog not found in path or whatever), then we need the original status/environment to continue execution. So, not easy. I maybe can see a way to do this on Posix systems but Win is going to be a problem. Roger ---------------------------------------------------------------- Then there should be a standard warning when using this or CHAIN should only be compiled if a special argument on cobc is used. ---------------------------------------------------------------- Human, what are you suggesting? It is quite clear that CHAIN is not supported and will not likely be so in the near future. The error messages are (I hope) quite clear :-) If, and when, it would be supported, then we do not need any special option. Roger ---------------------------------------------------------------- "I maybe can see a way to do this on Posix systems but Win is going to be a problem." So if it will be supported someday it should either work on windows-systems, too, or it should be only compiled if a special option is used. This is necessary for not going "somewhere unknown" with a program that was tested as working on unix systems and which is used on a windows machine. ---------------------------------------------------------------- OK. Note that CHAIN/CHAINING is not part of any standard. CHAINING was put in for an ACU user. I have not yet had any usage of CHAIN. (And it is most likely the wrong thing to be doing). Roger ---------------------------------------------------------------- Subject: Unable to find cobol module within dynamic library I am getting the following message: call_cobfunc: failed to call setenvtest - Cannot find module 'setenvtest'. Here is the sample code that is causing this problem. (Note: The logic within these sample code represents our current products.) mainmix code: #include #include static int (*call_cobfunc)( void ); int main( int argc, char** argv ) { void* libptr = dlopen( "./libmix.so", RTLD_LAZY ); if ( libptr ) { call_cobfunc = dlsym( libptr, "call_cobfunc" ); if ( call_cobfunc ) { call_cobfunc(); } dlclose( libptr ); } return 0; } call_cobfunc code: #include #include static int (*setenvtest)( void ); int call_cobfunc( void ) { cob_init( NULL, 0 ); /* find the module with PROGRAM-ID "say". */ setenvtest = cob_resolve( "setenvtest" ); if ( !setenvtest ) { printf( "call_cobfunc: failed to call setenvtest - %s\n", cob_resolve_error () ); return 1; } setenvtest(); return 0; } setenvtest code: IDENTIFICATION DIVISION. PROGRAM-ID. setenvtest. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 ENVTAG PIC X(15) VALUE "TEST=helloworld". LINKAGE SECTION. 01 WS-RESULT-STRING PIC X(160). 01 ENVIRON-VARIABLE PIC X(160). PROCEDURE DIVISION. CALL "setenv" USING BY REFERENCE ENVTAG. MOVE "TEST" TO ENVIRON-VARIABLE. CALL "getenvtest". DISPLAY "RESULT STRING " WS-RESULT-STRING. STOP RUN. getenvtest code: IDENTIFICATION DIVISION. PROGRAM-ID. getenvtest. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-ENVIRON-VARIABLE-STRING PIC X(31). 01 WS-ENVIRON-VARIABLE-LENGTH PIC 9(03). 01 WS-RESULT-STRING-POINTER USAGE POINTER. 01 WS-STRIP-RESULT-STRING PIC X(160). 01 WS-STRIP-RESULT-STRING-SIZE PIC S9(04) COMP. 01 WS-MAX-ENVIRON-VALUE-SIZE PIC 9(02) VALUE 30. LINKAGE SECTION. 01 WS-RESULT-STRING PIC X(160). 01 ENVIRON-VARIABLE PIC X(160). PROCEDURE DIVISION. MOVE 1 TO WS-ENVIRON-VARIABLE-LENGTH STRING ENVIRON-VARIABLE DELIMITED BY SPACE LOW-VALUE DELIMITED BY SIZE INTO WS-ENVIRON-VARIABLE-STRING WITH POINTER WS-ENVIRON-VARIABLE-LENGTH CALL "getenv" USING BY REFERENCE ENVIRON-VARIABLE RETURNING WS-RESULT-STRING-POINTER. DISPLAY "Environment value returned for " ENVIRON-VARIABLE " is: " WS-RESULT-STRING-POINTER IF WS-RESULT-STRING-POINTER <> NULL DISPLAY "pointer is not null " SET ADDRESS OF WS-RESULT-STRING TO WS-RESULT-STRING-POINTER UNSTRING WS-RESULT-STRING DELIMITED BY LOW-VALUE INTO WS-STRIP-RESULT-STRING COUNT IN WS-STRIP-RESULT-STRING-SIZE END-UNSTRING DISPLAY "Environment value returned for " ENVIRON-VARIABLE " is: " WS-STRIP-RESULT-STRING END-IF. The version of OC 1.1. command used to compile library: cobc -c setenvtest.cbl cobc -c getenvtest.cbl gcc -c call_cobfunc.c `cob-config --cflags` gcc -shared -o libmix.so call_cobfunc.o setenvtest.o setenvtest.o `cob-config --libs` command used to compile mixmain: gcc -o mixmain mixmain.c Any ideas how to get this to work would be appreciated. :-) ---------------------------------------------------------------- In AIX cobol world we have problems like this because the cobol compiler want to upper-case called module names (by default). Curt ---------------------------------------------------------------- So would I uppercase the function names in the COBOL code. If so, I tried this and is still cannot find the module. Any other suggestions. :-) ---------------------------------------------------------------- If I change the cob_callfunc code to the following it will execute the setenvtest function but then I get "libcob: Cannot find module 'getenvtest'". change to cob_callfunc code: #include #include extern int setenvtest( void ); int call_cobfunc( void ) { cob_init( 0, NULL ); setenvtest(); return 0; } Any ideas why libcob cannot find "getenvtest()". :-) ---------------------------------------------------------------- No, no, no. This is all wrong. Even if it did find the entry point, it would segfault as you are referencing LINKAGE parameters which have no linkage. Further your call to "setenv" is wrong (takes 3 params, env name, env value, overwrite flag). (Following using OC 1.1) Here is what will work - mixmain.c - /* Begin */ #include #include static int (*call_cobfunc)( void ); int main( int argc, char** argv ) { void* libptr = dlopen( "./libmix.so", RTLD_LAZY ); if ( libptr ) { call_cobfunc = dlsym( libptr, "call_cobfunc" ); if ( call_cobfunc ) { call_cobfunc(); } dlclose( libptr ); } return 0; } /* End */ call_cobfunc.c - /* Begin */ #include #include static int (*setenvtest)( void ); int call_cobfunc( void ) { cob_init( 0, NULL ); /* find the module with PROGRAM-ID "say". */ setenvtest = cob_resolve( "setenvtest" ); if ( !setenvtest ) { printf( "call_cobfunc: failed to call setenvtest - %s\n", cob_resolve_error () ); return 1; } setenvtest(); return 0; } /* End */ setenvtest.cob - IDENTIFICATION DIVISION. PROGRAM-ID. setenvtest. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-RESULT-STRING PIC X(160). 01 ENVIRON-VARIABLE PIC X(160). PROCEDURE DIVISION. CALL "setenv" USING "TEST" & X"00", "helloworld" & X"00", by content 1. MOVE "TEST" TO ENVIRON-VARIABLE. CALL "getenvtest" using ws-result-string environ-variable. DISPLAY "RESULT STRING " WS-RESULT-STRING. STOP RUN. getenvtest.cob - IDENTIFICATION DIVISION. PROGRAM-ID. getenvtest. ENVIRONMENT DIVISION. DATA DIVISION. LINKAGE SECTION. 01 WS-RESULT-STRING PIC X(160). 01 ENVIRON-VARIABLE PIC X(160). PROCEDURE DIVISION using ws-result-string environ-variable. ACCEPT WS-RESULT-STRING FROM ENVIRONMENT ENVIRON-VARIABLE. DISPLAY "ENVIRON-VARIABLE is: " WS-RESULT-STRING. Compile mixmain as usual. The rest you compile with - cobc -free -b -o libmix call_cobfunc.c setenvtest.cob getenvtest.cob Now do - export COB_PRE_LOAD=libmix ./mixmain ENVIRON-VARIABLE is: helloworld RESULT STRING helloworld Further, you do not need mixmain and call_cobfunc. Just do - cobc -free -b -o libmix setenvtest.cob getenvtest.cob export COB_PRE_LOAD=libmix cobcrun setenvtest Roger ---------------------------------------------------------------- Just so you know, the manual pages do not explain that you need to export COB_PRE_LOAD. I followed the instructions in the manual on how to create library. Thank you for the help. I got it to work. PS. The "setenv" should have been "putenv", sorry about that. :-) ---------------------------------------------------------------- Actually, you do not need COB_PRE_LOAD if the entry/module is available as a loadable object. So, using my examples - cobc -free setenvtest.cob cobc -free getenvtest.cob cobcrun setenvtest ie. The name of the loadable module is the same as the entry point (Prog-id). So, eg. If setenvtest.cob was renamed SETENVTEST.cob (but the Prog-id remains lower-case setenvtest), then - > rm -f setenvtest.so > cobc -free SETENVTEST.cob > cobcrun setenvtest libcob: Cannot find module 'setenvtest' > cobcrun SETENVTEST libcob: ./SETENVTEST.so: undefined symbol: SETENVTEST > export COB_PRE_LOAD=SETENVTEST > cobcrun setenvtest ENVIRON-VARIABLE is: helloworld RESULT STRING helloworld COB_PRE_LOAD is usually used for special situations eg. creating a "library" of modules. Also be careful when passing params to the normal C library routines (eg. setenv, putenv, etc.). Where string pointers are passed, these are (usually)expected to be null-terminated. This is NOT the case with Cobol data items. Even with 01 level items, there is no guarantee that the byte following the actual storage is actually a null-byte. Roger ---------------------------------------------------------------- Subject: Installation problem with screenio.o Hi, I'm trying to install OpenCobol 1.0 on Fedora 4. I ran configure without DB and then make which failed with the following error gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-screenio.lo -MD -MP -MF .deps/libcob_la-screenio.Tpo -c screenio.c -fPIC -DPIC -o .libs/libcob_la-screenio.o screenio.c: In function 'cob_screen_attr': screenio.c:107: error: 'chtype' undeclared (first use in this function) screenio.c:107: error: (Each undeclared identifier is reported only once screenio.c:107: error: for each function it appears in.) screenio.c:107: error: syntax error before 'styles' screenio.c:114: error: 'styles' undeclared (first use in this function) screenio.c:115: warning: implicit declaration of function 'attrset' screenio.c:115: error: 'A_NORMAL' undeclared (first use in this function) screenio.c:117: warning: implicit declaration of function 'clear' screenio.c:120: warning: implicit declaration of function 'clrtoeol' screenio.c:123: warning: implicit declaration of function 'clrtobot' screenio.c:126: warning: implicit declaration of function 'beep' screenio.c:129: error: 'A_REVERSE' undeclared (first use in this function) screenio.c:132: error: 'A_BOLD' undeclared (first use in this function) screenio.c:135: error: 'A_BLINK' undeclared (first use in this function) screenio.c:138: error: 'A_UNDERLINE' undeclared (first use in this function) screenio.c:140: warning: implicit declaration of function 'attron' screenio.c:147: error: 'COLOR_BLACK' undeclared (first use in this function) screenio.c:150: error: 'COLOR_BLUE' undeclared (first use in this function) screenio.c:153: error: 'COLOR_GREEN' undeclared (first use in this function) screenio.c:156: error: 'COLOR_CYAN' undeclared (first use in this function) screenio.c:159: error: 'COLOR_RED' undeclared (first use in this function) screenio.c:162: error: 'COLOR_MAGENTA' undeclared (first use in this function) screenio.c:165: error: 'COLOR_YELLOW' undeclared (first use in this function) screenio.c:168: error: 'COLOR_WHITE' undeclared (first use in this function) screenio.c:204: error: 'COLOR_PAIRS' undeclared (first use in this function) screenio.c:205: warning: implicit declaration of function 'pair_content' screenio.c:210: warning: implicit declaration of function 'init_pair' screenio.c:215: warning: implicit declaration of function 'COLOR_PAIR' screenio.c:216: warning: implicit declaration of function 'bkgdset' screenio.c: In function 'cob_screen_init': screenio.c:227: warning: implicit declaration of function 'initscr' screenio.c:231: warning: implicit declaration of function 'cbreak' screenio.c:232: warning: implicit declaration of function 'keypad' screenio.c:232: error: 'stdscr' undeclared (first use in this function) screenio.c:232: error: 'TRUE' undeclared (first use in this function) screenio.c:233: warning: implicit declaration of function 'nonl' screenio.c:234: warning: implicit declaration of function 'echo' screenio.c:239: warning: implicit declaration of function 'has_colors' screenio.c:240: warning: implicit declaration of function 'start_color' screenio.c:242: error: 'COLOR_PAIRS' undeclared (first use in this function) screenio.c:246: error: 'A_NORMAL' undeclared (first use in this function) screenio.c: In function 'cob_screen_terminate': screenio.c:256: warning: implicit declaration of function 'endwin' screenio.c: In function 'cob_screen_puts': screenio.c:267: warning: implicit declaration of function 'mvaddnstr' screenio.c:268: warning: implicit declaration of function 'refresh' screenio.c: In function 'cob_screen_gets': screenio.c:275: warning: implicit declaration of function 'mvgetnstr' ---------------------------------------------------------------- Install runtime AND development ncurses packages. Also, use OC 1.1. Roger ---------------------------------------------------------------- Subject: Evaluate Statement problems We are migrating our current MF COBOL applications to use OC 1.1. The issue we have run into is the EVALUATE statement is executing every WHEN. Here is a sample program that produces the issue we are having. trigger.c code: ************************************** #include #include extern int say( char* trigger ); int main( int argc, char** argv ) { char trigger = ' '; if ( argc != 2 ) { printf( "Usage: say \n" ); return 1; } trigger = *argv[1]; cob_init(0, NULL); say( (char*) &trigger ); return 0; } ******************************************** say.cbl code: ******************************************** IDENTIFICATION DIVISION. PROGRAM-ID. say. ENVIRONMENT DIVISION. DATA DIVISION. LINKAGE SECTION. 01 TRIGGER PIC X(01). 88 T-HELLO VALUE "A". 88 T-BYE VALUE "B". PROCEDURE DIVISION USING TRIGGER. MAINLINE. DISPLAY "TRIGGER = " TRIGGER. EVALUATE TRUE WHEN T-HELLO PERFORM 0100-HELLO-WORLD THRU 0100-EXIT WHEN T-BYE PERFORM 0200-BYE-WORLD THRU 0200-EXIT WHEN OTHER PERFORM 0300-CLUELESS THRU 0300-EXIT END-EVALUATE EXIT PROGRAM. *> Print hello world 0100-HELLO-WORLD. DISPLAY "HELLO WORLD!!". 0100-EXIT. EXIT. *> Print bye world 0200-BYE-WORLD. DISPLAY "BYE WORLD!!". 0200-EXIT. EXIT. *> Print not a clue 0300-CLUELESS. DISPLAY "NOT A CLUE WHAT YOU WANT.". 0300-EXIT. EXIT. ******************************************** If you execute the program "say B" the results are: TRIGGER = B BYE WORLD!! HELLO WORLD!! BYE WORLD!! NOT A CLUE WHAT YOU WANT. Why does it evaluate 4 times?? Now if I change the say.cbl code to the following I get the result I would expect. ************************************** IDENTIFICATION DIVISION. PROGRAM-ID. say. ENVIRONMENT DIVISION. DATA DIVISION. LINKAGE SECTION. 01 TRIGGER PIC X(01). 88 T-HELLO VALUE "A". 88 T-BYE VALUE "B". PROCEDURE DIVISION USING TRIGGER. MAINLINE. DISPLAY "TRIGGER = " TRIGGER. EVALUATE TRUE WHEN T-HELLO DISPLAY "HELLO WORLD!!" WHEN T-BYE DISPLAY "BYE WORLD!!" WHEN OTHER DISPLAY "NOT A CLUE WHAT YOU WANT." END-EVALUATE EXIT PROGRAM. ************************************** Results ************************************ TRIGGER = B BYE WORLD!! Any suggestions why this is happening? The current applications that I am trying to migrate to OC require the latter functionality but are designed like the first say.cbl code. Thanks :-) ---------------------------------------------------------------- You do not say how you are compiling both progs. Anyway, that is not the way I would do it. Try this - IDENTIFICATION DIVISION. PROGRAM-ID. say. ENVIRONMENT DIVISION. DATA DIVISION. working-storage SECTION. 01 TRIGGER PIC X(01). 88 T-HELLO VALUE "A". 88 T-BYE VALUE "B". procedure division. MAINLINE. accept trigger from command-line. DISPLAY "TRIGGER = " TRIGGER. EVALUATE TRUE WHEN T-HELLO PERFORM 0100-HELLO-WORLD THRU 0100-EXIT WHEN T-BYE PERFORM 0200-BYE-WORLD THRU 0200-EXIT WHEN OTHER PERFORM 0300-CLUELESS THRU 0300-EXIT END-EVALUATE goback. *> Print hello world 0100-HELLO-WORLD. DISPLAY "HELLO WORLD!!". 0100-EXIT. EXIT. *> Print bye world 0200-BYE-WORLD. DISPLAY "BYE WORLD!!". 0200-EXIT. EXIT. *> Print not a clue 0300-CLUELESS. DISPLAY "NOT A CLUE WHAT YOU WANT.". 0300-EXIT. EXIT. > cobc -free -x say.cob > ./say TRIGGER = NOT A CLUE WHAT YOU WANT. > ./say A TRIGGER = A HELLO WORLD!! > ./say B TRIGGER = B BYE WORLD!! or : > cobc -free say.cob > cobcrun say TRIGGER = NOT A CLUE WHAT YOU WANT. > cobcrun say A TRIGGER = A HELLO WORLD!! > cobcrun say B TRIGGER = B BYE WORLD!! Note - If you expect MF to return command line params on a PROCEDURE DIVISION USING ..., then this is undefined behaviour. It MAY work depending where particular pointers are on the stack. See forum thread on linkage section. The MF accepted method is as in the prog above with the command-line accept. Roger ---------------------------------------------------------------- [d]Roger, But isn't there still a problem? The evaluates clause he gave should only perform one of those paragraphs, shouldn't it?[/d] I figured I'd test this to see what was going on. Behaves as expected here. ---------------------------------------------------------------- Yes, this is really a hard error. Perform ... through ... within an evaluate clause seems to need a fix. It seems like OC does not do the exit program after evaluate clause. ---------------------------------------------------------------- Jason/Human, look closely at my example. It works correctly. If you look carefully at the orginal posted code, there is trigger.c and say.cob. But he executes using "say A". I would expect somehting like "trigger A". That's why I said, I need to see how the orginal was compiled/linked. (And this I believe to be the problem) Also note that I use "GOBACK" (Yes it is in the Cobol standard). If the program is implicitly/explicitly a main program, it operates as a STOP RUN; if the program is a module, it operates as an EXIT PROGRAM. From the standard for GOBACK - *** 1) If a GOBACK statement is executed in a program that is under the control of a calling runtime element, the program operates as if executing an EXIT PROGRAM statement with the RAISING phrase, if any, that is specified in the GOBACK statement. 2) If a GOBACK statement is executed in a program that is not under the control of a calling runtime element, the program operates as if executing a STOP statement without any optional phrases. A RAISING phrase, if specified, is ignored. *** From the standard for EXIT PROGRAM - *** 5) If the EXIT PROGRAM statement is executed in a program that is not under the control of a calling runtime element, the EXIT PROGRAM statement is treated as if it were a CONTINUE statement *** Roger ---------------------------------------------------------------- I compiled the programs as follows: cobc -c say.cbl xlc -c trigger.c -I/usr/local/include xlc -o say *.o -L/usr/local/lib -lcob I tried the GOBACK statement, it solves the problem in my sample program. The GOBACK statement is it a 2002 COBOL standard or an 85 COBOL standard? I believe all our current applications use the 85 COBOL standard. :-) ---------------------------------------------------------------- How about you actually define what you want to achieve? I also do conversions for a nominal fee :-) I do not see why you want a trigger program. GOBACK is 2002 standard. (And actually done by MF for some time). Roger ---------------------------------------------------------------- #include #include extern int say( char* trigger ); int main( int argc, char** argv ) { char trigger = ' '; if ( argc != 2 ) { printf( "Usage: say \n" ); return 1; } trigger = *argv[1]; cob_init(0, NULL); say( (char*) &trigger ); return 0; } How about - say(argv[1]); You should not pass a string pointer that is not (guarenteed) null terminated. This is a normal C requirement. Roger ---------------------------------------------------------------- As I cannot post our source code, I create sample programs that follow how the current code is designed and replicate the issue I am having in the actual code. Once I get a possible solution I implement into the actual code, test it and document the changes that are required. No, there is not point to the trigger program other than it replicated the problem I was having and followed the way the code is designed in the actual program. Thanks for you help. :-) ---------------------------------------------------------------- Some more notes. 1) Regarding EXIT PROGRAM and what is a "main" program. Well, you may say, but I compiled it as a module. This is, in fact, not relevant. Consider - cobc -x myprog.cob ./myprog or cobc myprog.cob cobcrun myprog In both cases we have a "main" program. (And in both cases EXIT PROGRAM becomes CONTINUE ie. a noop) This is equivalent to the original posted source whereby "trigger" is effectively "cobcrun". We actually determine what EXIT PROGRAM does by inspecting the cob_module structure. You can actually get the posted source to work with EXIT PROGRAM by modifying trigger.c to pretend it is a Cobol module - Insert somewhere in trigger.c - static cob_field *cob_user_parameters[COB_MAX_FIELD_PARAMS]; static cob_module module = { NULL, NULL, NULL, NULL, cob_user_parameters, 0, '.', '$', ',', 1, 1, 1, 0}; Then AFTER cob_init and BEFORE the call to "say", insert - module.next = cob_current_module; cob_current_module = &module; I do not recommend that you use internal OC structures in your own C code. This is just meant to clarify what is going on. OC structures may be subject to change. 2) Whenever possible use "cobc" to compile. It knows better than you do what C compile options are necessary. So (with modified trigger as above)- > cobc -x -free trigger.c say.cob -o say > ./say A > TRIGGER = A > HELLO WORLD!! or > cobc -x -free trigger.c say.cob produces an executable "trigger" - > ./trigger A > TRIGGER = A > HELLO WORLD!! If you use the "-v" option on the compile, you will see exactly the C compiler/linker commands that are being executed. Roger ---------------------------------------------------------------- Subject: set my-index to null Although usage of NULL here is dubious and strictly speaking not allowed, (and eg. MOVE NULL TO index-item), I have decided that we should allow this. (Otherwise there would be more problems with the parser). Fix is obvious. OC 1.1 tarball updated. (ChangeLog's follow later) Roger ---------------------------------------------------------------- [code]77 my-index usage is index. ... set my-index to null[/code]generates [quote](*(int *) (b_2738)) = (unsigned char *)NULL;[/quote]and gcc-compiler warning, while[code]set my-index to 0[/code] seems to be ok. Should the OC-Compiler give a message like "Index cannot be set to NULL" or is this behaviour wrong? ---------------------------------------------------------------- Subject: FOREGROUND-COLOR / BACKGROUND-COLOR ... Hello, Is there any possibility to have foreground and background color defined with a pic 9 in working or linkage . It will be very helpful to me to minimize code when managing colors in DISPLAY statements. OC does not accept this : [code] 77 wFore pic 9. 77 wBack pic 9. ... move 7 to wFore move 4 to wBack ... display "Hello World" line 10 column 20 with foreground-color wFore background-color wBack end-display [/code] You said it is not standard. I agree. But it is very BORING to code with 64 tests each time you have to display an item on the screen. I have a main program that calls a module in order to display items with colors defined by the caller. You can imagine how much tests are used ... I do not use screen section at all ... Best regards ... Bear :-( ---------------------------------------------------------------- Well, why don't you use a screen section? :-) Current tarball accepts data items as FG/BG objects. The extended (MF) ACCEPT/DISPLAY is somewhat more complicated :-( (And it's not anywhere near the top on my TODO) Roger ---------------------------------------------------------------- Hello Roger, Thank you for the current tarball. Why I not using screen section ? Because I have 2,500 programs written without any mention to a screen section ... I tested this little program : [code] identification division. program-id. TSTSCR. data division. working-storage section. 77 i pic 99. 77 j pic 99. 77 wLine pic 99. 77 wPosition pic 99. 77 wFore pic 9. 77 wBack pic 9. SCREEN SECTION. 01 item. 02 item-hello line wLine column wPosition foreground-color wFore background-color wback value " Hello ". PROCEDURE DIVISION. debut. perform varying j from 0 by 1 until j > 7 perform varying i from 1 by 1 until i > 7 add 1 i giving wLine compute wPosition = (7 * j) + 1 end-compute move j to wback move i to wfore display item end-perform end-perform . accept i . fin. EXIT PROGRAM. [/code] It works fine ! :-D ---------------------------------------------------------------- :-) :-) Well, of course, if people followed the standards instead of using vendor extensions then we would not have a problem :-) Having said that, the standard does not cover (even in proposed 2008 standard) things like interacting with the environment (environment variables, command line, etc.). Currently looking at the DISPLAY syntax. The problem is parsing the MF extension. The MF extension allows the optional screen attributes at any point following an identifier/literal. So, eg. DISPLAY "TEST " dataitem " TEST2 " dataitem2 AT LINE 3 " TEST3" AT LINE 4. Problem here is the lookahead for the parser. Roger ---------------------------------------------------------------- ... Yes, In other words if I need something to interact with OC in order to "replace" display & accepts, what method should I apply ? 1) Develop myself what I need in "C" ? 2) Some software exists, but I never heard about ? By the way ... I'm learning C ! It helps me to understand OC ... and other languages Best regards Bear ---------------------------------------------------------------- Not a C problem, it is a parser problem. Specifically cobc/parser.y. This may not be solveable at this level. Roger ---------------------------------------------------------------- To resume the situation, I must invest time for tools building, if I want my screen react to function keys, arrows, and escape. I want to add some line drawing, other than poor "+-|". In all cases I will need to solve my i-o on screen with calls. This is the way I should go Don't you think so ? Regards Bear ---------------------------------------------------------------- As I said, the MF extension is somewhat unparsable. If we talk about a single field, then I might be able to do something. Roger ---------------------------------------------------------------- As far as I'm concerned, I am 250 % OK for a single field ! If I need to display a dozen of fields in various colors, I have routines to do that and in fact my module consist of a dozen of DISPLAY of a single field !! Best regards Bear ---------------------------------------------------------------- OK. Stand by. Will try to get it in. (But only for as the moment one field, so people do not lambast me for not supporting MF syntax completely) Roger ---------------------------------------------------------------- OK. Give the current 1.1 tarball a shot. Should do what you want. Roger ---------------------------------------------------------------- Wow ! Thank you Roger, This is now going much better ! I have noticed that clearing screen with erase eos doesn't care about given instructions. for example : [code] display "Hello" line 02 column 02 with erase eos foreground-color is 1 background-color is 7 end-display [/code] background is kept remaining, only Hello is displayed. I tried some color management in ACCEPT statements (only single fields). I have elaborate better tests. Thank you again Bear :-) ---------------------------------------------------------------- I hope the following program will help you for tests. [code] IDENTIFICATION DIVISION. PROGRAM-ID. KOLORS. *> *> TESTING COLORS : I changed the name of Program-id. *> ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. DELL. OBJECT-COMPUTER. DELL. DATA DIVISION. WORKING-STORAGE SECTION. 77 I pic X. 78 noir value 01. 78 bleu value 02. 78 vert value 03. 78 rouge value 04. 78 magenta value 05. 78 marron value 06. 78 blanc value 07. PROCEDURE DIVISION. DEBUT. *> This statement does not work ------------------- display SPACES line 02 column 02 with blank screen foreground-color blanc background-color vert end-display *> These statements are going well ---------------- display "Bonjour" line 12 column 36 with foreground-color bleu background-color magenta end-display display "Monsieur" line 13 column 36 with foreground-color noir background-color blanc end-display display "Le Professeur" line 14 column 35 with foreground-color marron background-color vert end-display . FIN. accept I. *> This statement is never reached ---------------- display "This part of program is never reached !!!" line 23 column 02 with foreground-color marron highlight background-color rouge end-display . ULTIME. EXIT PROGRAM. [/code] Best regards Bear ---------------------------------------------------------------- OK. Try current 1.1 tarball. Note, temporarily, I have put a one second delay in when terminating screen programs. Otherwise, depending on things like terminal emulation, machine/screen speed and other factors, you may not get to see the last display as in the program above. Roger ---------------------------------------------------------------- Wonderful ! Its going better than best for coding ... I think we have still little problems with EOS and EOL options. I wrote a little program you can test with. [code] identification division. program-id. BLANKS. *> *> This program has been written in order to test *> the DISPLAY statement and BLANK SCREEN, ERASE EOS & EOL options *> DATA DIVISION. WORKING-STORAGE SECTION. 77 w80 pic X(080). 77 I pic 99. 77 J pic 99. 77 K pic 99. 77 L pic 99. PROCEDURE DIVISION. BEGIN. perform varying I from 0 by 1 until I > 7 display space with foreground-color 0 background-color I blank screen end-display call "C$SLEEP" using "1" perform varying J from 0 by 1 until J > 7 display "Here comes EOS" line 03 column 03 with foreground-color 0 background-color J erase EOS end-display perform varying K from 0 by 1 until K > 7 add 5 K giving L display "Here comes EOL" line L column 05 with foreground-color 0 background-color K erase EOL end-display end-perform call "C$SLEEP" using "1" end-perform end-perform . fin. EXIT PROGRAM. [/code] With respect Bear ---------------------------------------------------------------- A very colourful program :-) Can you try current 1.1 tarball. I have put in a quick fix that I will have to review later. Roger ---------------------------------------------------------------- Great ! Works fine Thank you ! Very fast & good work Roger I have other tests under way concerning ACCEPT statement. I will post you final results Best regards Bear :-) ---------------------------------------------------------------- Subject: cobc -v if I do:[code]cobc -v [...] 1>output.log 2>error.log[/code]I see all the information from -v option in error.log. Shouldn't -v output into >1 like --help? Using -v the gcc is called. Is there another option doing nothing (or only create c-files) but display the options that would be used for gcc like -v does? ---------------------------------------------------------------- To question 1 - No, because that would screw up the "-E" usage. To question 2 - Until you get to the point of actually doing something, it does not make much sense to report further possible options. Note that gcc itself does not do this. (Nor does any other C compiler that I am aware of) So you can do eg. cobc -v -fsyntax-only xxx.cob However if you want preprocessed source, then cobc -v -E xxx.cob 2>myvoptions (While the output is produced on stdout) Compile to C source - cobc -v (-x) -C xxx.cob (2>myvoptions) Roger ---------------------------------------------------------------- To 1st: Why does it screw up the -E usage? I'm nut sure but I think the 2nd stream is the error stream. If that is true -E and -v should output to 1st stream, not to 2nd. To 2nd: So -v is only passed by oc to the gcc, right? I just wanted to save the compiler options somewhere to compile the C sources with these options on another machine. new 3rd: Are these gcc-compile options different depending on the given COBOL source or only depending on the options used for cobc? ---------------------------------------------------------------- 1) No, -E ouputs to stdout (as should be) and anything else outputs to stderr. 2) No, -v shows what commands are being executed on THIS machine/environment. See below. 3) There is no dependence on OC options, BUT for different machines/environments you WILL get different results. eg. cobc -x -v -std=mf qwr.cob preprocessing qwr.cob into /tmp/cob1003_0.cob qwr.cob:20: Warning: RECORD clause ignored for LINE SEQUENTIAL translating /tmp/cob1003_0.cob into /tmp/cob1003_0.c gcc -pipe -c -I/usr/local/include -Wno-unused -fsigned-char -o /tmp/cob1003_0.o /tmp/cob1003_0.c gcc -pipe -Wl,--export-dynamic -o qwr /tmp/cob1003_0.o -L/usr/local/lib -lcob -lm -lgmp -lncurses -ldb -ldl BUT working in a test environment - roglinux:~ # cd /disk02/ocnew roglinux:/disk02/ocnew # cd tests roglinux:/disk02/ocnew/tests # . ./atconfig roglinux:/disk02/ocnew/tests # . ./atlocal roglinux:/disk02/ocnew/tests # cd roglinux:~ # cobc -x -v -std=mf qwr.cob preprocessing qwr.cob into /tmp/cob1012_0.cob qwr.cob:20: Warning: RECORD clause ignored for LINE SEQUENTIAL translating /tmp/cob1012_0.cob into /tmp/cob1012_0.c gcc -pipe -c -I/disk02/ocnew/tests/.. -I/usr/local/include -Wno-unused -fsigned-char -o /tmp/cob1012_0.o /tmp/cob1012_0.c gcc -pipe -L/disk02/ocnew/tests/.././libcob/.libs -Wl,--export-dynamic -o qwr /tmp/cob1012_0.o -L/disk02/ocnew/tests/.././libcob/.libs -lcob -lm -lgmp -lncurses -ldb -ldl So, you certainly cannot use the output from -v to try to second-guess somwhere else :-) Roger ---------------------------------------------------------------- OK, So I do not want to make this stuff any longer. But I don't get the point why -E (and --help) should be the only options that output to stdout. -v belongs there, too and not to stderr, doesn't it? ---------------------------------------------------------------- Subject: zero supression formatting issue We are migrating MF code to OC, but have encountered a problem when compiling with the following definition: 01 WS-RECORDS-READ-CNT-DISPLAY PIC Z(8)9 VALUE 0. Does OC 1.1 support this? Or is this a MF standard? Thanks :-) ---------------------------------------------------------------- It will compile, but it's not the ideal way to do things. For a start you're initializing an edited field with a numeric literal and you're defining it at 01 level. Both not really good practise, IMO. If you don't want to touch the level then at least change the VALUE clause to a string literal padded with 8 spaces (I used hyphens for illustration only): [code] 01 WS-RECORDS-READ-CNT-DISPLAY PIC Z(8)9 VALUE '--------0'. [/code] Personally, I would group together variables under a single 01 level then initialize them all at once at the beginning of the code: [code] WORKING-STORAGE SECTION. 01 WS-VARIABLES. 03 WS-RECORDS-READ-CNT-DISPLAY PIC Z(8)9. ... PROCEDURE DIVISION. INITIALIZE WS-VARIABLES [/code] Others may have different views... ---------------------------------------------------------------- Well actually, I do not see any problem except maybe that it is producing a warning. The generated code is correct. Questionable whether or not the warning should be produced. Roger ---------------------------------------------------------------- Warnings on incorrect values and moves are fine, because they are indeed wrong. ---------------------------------------------------------------- Subject: cobc compiler core dumped Statement used for compiling: cobc -x -c loadAdimmasterBS.cbl -std=mfm -Wall -I../../common/cobol/cbl -I../../common/cobol/cde -I../../common/cobol/cpy -I../../common/cobol/def - I../../common/cobol/ipc -I../../common/cobol/lnk -I../../common/cobol/rec -I. ./../common/cobol/tbl -I../../loadAdimmasterBS/cbl -I../../loadAdimmasterBS/cde -I../../loadAdimmasterBS/cpy -I../../loadAdimmasterBS/def -I../../loadAdimmasterBS/ipc -I../../loadAdimmasterBS/lnk -I../../loadAdimmasterBS/rec -I../../loadAdimmasterBS/tbl -I/usr/include -I /home/oracle/product/9.2.0.7/precomp/public -I /home/oracle/product/9.2.0.7/rdbms/public -I /home/oracle/product/9.2.0.7/rdbms/demo -I /home/oracle/product/9.2.0.7/plsql/public -I /home/oracle/product/9.2.0.7/network/public make: 1254-059 The signal code from the last command is 11. OC version 1.1 compiled using -g flag, then used dbx to retrieve the information from the core file that was created. Type 'help' for help. [using memory image in core] reading symbolic information ... Segmentation fault in output_class_name_definition at line 3252 in file "/open-cobol-1.1/cobc/codegen.c" ($t1) 3252 output ("f->data[i] == %d", data[i]); (dbx) where output_class_name_definition(p = 0x200200a8), line 3252 in "codegen.c" codegen(prog = 0x2001c9e8, nested = 0), line 4048 in "codegen.c" process_translate(fn = 0x2001a668), line 1090 in "cobc.c" main(argc = 33, argv = 0x2ff21814), line 1576 in "cobc.c" (dbx) Any ideas?? ---------------------------------------------------------------- We narrowed down the section in our code causing the problem but we do not understand why. This is the section of code causing the problem: SPECIAL-NAMES. CLASS ALPHA "A" THRU "Z", ",", "-", "'", "/", "\", " " CLASS ALPHA-NUMERIC "A" THRU "Z", "0" THRU "9", " " CLASS ALPHA-NUMERIC-SPECIAL "A" THRU "Z", "0" THRU "9", "`", "~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "+", "-", "=", "{", "}", "|", ":", QUOTE, "<", ">", "?", "[", "]", "\", ";", "'", ",", ".", "/", " " CLASS A-TEXT "A" THRU "Z", "a" THRU "z", "0" THRU "9", "`", "~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "+", "-", "=", "{", "}", "|", ":", QUOTE, "<", ">", "?", "[", "]", "\", ";", "'", ",", ".", "/", " " . Any ideas why this is causing the segmentation fault in the compiler?? :-) ---------------------------------------------------------------- Just a tip: when posting on the forum, you can use the '<>' button to mark-up code and maintain the formatting... ---------------------------------------------------------------- Try replacing the QUOTE literal with '"' - that is a single-quote ('), followed by a double-quote ("), followed by a single-quote (') ---------------------------------------------------------------- We figured it out, we needed to place quotes(") around QUOTE ("QUOTE") Thanks ---------------------------------------------------------------- I don't think that will work in the way it is intended. Special Names Classes are used to define ranges of characters - the intention of the QUOTE literal is to include a double-quote character in that class. Instead, you've added the characters Q-U-O-T-E to the class rather than a double-quote character. You should use my solution. ---------------------------------------------------------------- Fixed in current 1.1 tarball. Allows figurative constants QUOTE, SPACE, ZERO. One disadvantage in not using/having the gcc compiler is that we lose the ability to detect invalid casts which leads to the segfault/core dump. Using gcc, we get - codegen.c:3249: Invalid type cast from 'QUOTE' Tag 1 0 Tag 2 7 Aborting compile of qwr.cob at line 266 Which allows easier debugging. Roger ---------------------------------------------------------------- But gcc is still used when doing cobc, isn't it? ---------------------------------------------------------------- No, it uses whatever C compiler was used/detected/specified when configuring OC. In this case klreed is on AIX using the native C compiler (I believe). The cast checking relies on a gcc extension (It's at ca. line 217 in cobc/tree.h). Roger ---------------------------------------------------------------- Yes, we are using the native C compiler and not gcc. :-) ---------------------------------------------------------------- klreed - You might consider implementing the IBM gcc( and see following). Also, the AIX shell is ****. (Why?, how long does it take to do a "make check" in OC?) Consider replacing with bash. (Google will give you the answers) Roger ---------------------------------------------------------------- I can't do a make check I get the following (native C compiler): make check-recursive Making check in lib Target "check" is up to date. Making check in libcob Target "check" is up to date. Making check in cobc make check-am Target "check-am" is up to date. Making check in bin Target "check" is up to date. Making check in config Target "check" is up to date. Making check in copy Target "check" is up to date. Making check in po Target "check" is up to date. Making check in texi Target "check" is up to date. Making check in tests Making check in cobol85 Target "check" is up to date. make check-TESTS ././syntax[648]: cat: not found ././syntax[654]: cat: not found ././syntax[670]: cat: not found ././syntax[675]: find: not found ././syntax[684]: sed: not found ././syntax[684]: cat: not found ././syntax[725]: sed: not found ././syntax[725]: sed: not found ././syntax[729]: cat: not found syntax: error: cannot find cobc FAIL: ./syntax ././run[744]: cat: not found ././run[750]: cat: not found ././run[766]: cat: not found ././run[771]: find: not found ././run[780]: sed: not found ././run[780]: cat: not found ././run[821]: sed: not found ././run[821]: sed: not found ././run[825]: cat: not found run: error: cannot find cobc FAIL: ./run ## Run time tests with -O option ## /home/working/open-cobol-1.1/tests/run[744]: cat: not found /home/working/open-cobol-1.1/tests/run[750]: cat: not found /home/working/open-cobol-1.1/tests/run[766]: cat: not found /home/working/open-cobol-1.1/tests/run[771]: find: not found /home/working/open-cobol-1.1/tests/run[780]: sed: not found /home/working/open-cobol-1.1/tests/run[780]: cat: not found /home/working/open-cobol-1.1/tests/run[821]: sed: not found /home/working/open-cobol-1.1/tests/run[821]: sed: not found /home/working/open-cobol-1.1/tests/run[825]: cat: not found run: error: cannot find cobc FAIL: ./run-O ././data-rep[590]: cat: not found ././data-rep[596]: cat: not found ././data-rep[612]: cat: not found ././data-rep[617]: find: not found ././data-rep[626]: sed: not found ././data-rep[626]: cat: not found ././data-rep[667]: sed: not found ././data-rep[667]: sed: not found ././data-rep[671]: cat: not found data-rep: error: cannot find cobc FAIL: ./data-rep ## Data representation tests with -O option ## /home/working/open-cobol-1.1/tests/data-rep[590]: cat: not found /home/working/open-cobol-1.1/tests/data-rep[596]: cat: not found /home/working/open-cobol-1.1/tests/data-rep[612]: cat: not found /home/working/open-cobol-1.1/tests/data-rep[617]: find: not found /home/working/open-cobol-1.1/tests/data-rep[626]: sed: not found /home/working/open-cobol-1.1/tests/data-rep[626]: cat: not found /home/working/open-cobol-1.1/tests/data-rep[667]: sed: not found /home/working/open-cobol-1.1/tests/data-rep[667]: sed: not found /home/working/open-cobol-1.1/tests/data-rep[671]: cat: not found data-rep: error: cannot find cobc FAIL: ./data-rep-O ====================================================== 5 of 5 tests failed Please report to open-cobol-list@lists.sourceforge.net ====================================================== make: 1254-004 The error code from the last command is 1. Stop. make: 1254-004 The error code from the last command is 2. Stop. make: 1254-004 The error code from the last command is 1. Stop. make: 1254-004 The error code from the last command is 1. Stop. make: 1254-004 The error code from the last command is 2. Stop. I am not longer getting the core dump. I will try the gcc but I think I had other issues (not sure will recheck) :-) ---------------------------------------------------------------- "cat" not found? :-) Complain to IBM :-) IBM, I believe, have bash, gcc ports available. Roger ---------------------------------------------------------------- Subject: Open a file from the filesystem Hi everybody ! I've written a little code to try opening a local file with a cobol procedure (to see how it works) ... The program compiles and runs, but nothing is displayed ... Here is the code of the program : [code] *------- IDENTIFICATION DIVISION. PROGRAM-ID.fich. *------- ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT FTEST ASSIGN TO EXTERNAL fichier. *------- DATA DIVISION. FILE SECTION. FD FTEST. 01 LIGNE PIC X(80). WORKING-STORAGE SECTION. 77 NTESTEOF PIC X VALUE "0". 88 TESTEOF VALUE "1". *------- PROCEDURE DIVISION. 0-MAIN. PERFORM OPENF PERFORM TRAITE UNTIL TESTEOF PERFORM CLOSEF STOP RUN . OPENF. OPEN INPUT FTEST READ FTEST AT END SET TESTEOF TO TRUE END-READ . TRAITE. DISPLAY LIGNE READ FTEST AT END SET TESTEOF TO TRUE END-READ . CLOSEF. CLOSE FTEST . *-------[/code] Thanks for help :) ---------------------------------------------------------------- for testing: - use a file status (STATUS IS myvar) - take a 01 level for assign the file name - put the file to the same folder where executed program is - display the file status after every file operation - post your modified source and output ---------------------------------------------------------------- Hi, Here is the code modified : [code] *------- IDENTIFICATION DIVISION. PROGRAM-ID.fich. *------- ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT FTEST ASSIGN TO EXTERNAL fichier STATUS IS FILESTAT. *------- DATA DIVISION. FILE SECTION. FD FTEST. 01 LIGNE PIC X(80). WORKING-STORAGE SECTION. 77 FILESTAT PIC XX VALUE " ". 77 NTESTEOF PIC X VALUE "0". 88 TESTEOF VALUE "1". *------- PROCEDURE DIVISION. 0-MAIN. PERFORM OPENF PERFORM TRAITE UNTIL TESTEOF PERFORM CLOSEF STOP RUN . OPENF. OPEN INPUT FTEST DISPLAY "Status open : " FILESTAT READ FTEST AT END SET TESTEOF TO TRUE END-READ DISPLAY "Status read : " FILESTAT . TRAITE. DISPLAY LIGNE READ FTEST AT END SET TESTEOF TO TRUE END-READ DISPLAY "Status read : " FILESTAT . CLOSEF. CLOSE FTEST DISPLAY "Status close : " FILESTAT . *-------[/code] Here is the output : [code] Status open : 00 Status read : 10 Status close : 00 [/code] File is in the same folder and may be read by the user ... ---------------------------------------------------------------- Try: [code] SELECT FTEST ASSIGN TO "fichier" STATUS IS FILESTAT. [/code] ---------------------------------------------------------------- Deckard, the original code is perfectly OK. Arsthan, What is the actual content of the file "fichier"? You have defined it as a FIXED length file. So, if you just set up this file with an editor and inserted only 1 line less than 80 characters, then the result is (almost, see below) correct. If you want to read a text file, then you should specify ORGANIZATION IS LINE SEQUENTIAL. Actually, the code does not check for errors, so I would actually do something like this - [code] IDENTIFICATION DIVISION. PROGRAM-ID.fich. *------- ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT FTEST ASSIGN TO EXTERNAL fichier STATUS IS FILESTAT. *------- DATA DIVISION. FILE SECTION. FD FTEST. 01 LIGNE PIC X(80). WORKING-STORAGE SECTION. 01 FILESTAT PIC XX VALUE " ". 88 FILE-OK VALUE "00". 77 NTESTEOF PIC X VALUE "0". 88 TESTEOF VALUE "1". *------- PROCEDURE DIVISION. 0-MAIN. PERFORM OPENF IF FILE-OK PERFORM TRAITE UNTIL TESTEOF PERFORM CLOSEF END-IF STOP RUN . OPENF. OPEN INPUT FTEST DISPLAY "Status open : " FILESTAT . TRAITE. READ FTEST AT END SET TESTEOF TO TRUE END-READ IF NOT FILE-OK SET TESTEOF TO TRUE END-IF DISPLAY "Status read : " FILESTAT DISPLAY LIGNE . CLOSEF. CLOSE FTEST DISPLAY "Status close : " FILESTAT . [/code] Note the first part of the "TRAITE" paragraph could be coded - [code] READ FTEST END-READ IF NOT FILE-OK SET TESTEOF TO TRUE END-IF [/code] This example caused me to look at the handling for "short" reads of fixed-length sequential. In fact we should produce status "04" in this case and not "10" (according to the Cobol standard). This is fixed in current 1.1 tarball. Roger ---------------------------------------------------------------- I've modified the select like this [code]SELECT FTEST ASSIGN TO EXTERNAL fichier ORGANIZATION IS LINE SEQUENTIAL STATUS IS FILESTAT.[/code]And now it works fine :) thanks for help :) ---------------------------------------------------------------- Glad to help :-) It is useful to get reactions here. And, as such, feedback is very important! Roger ---------------------------------------------------------------- Hi, while talking about files, is there any support for VSAM files in open cobol ? ---------------------------------------------------------------- What do you mean with VSAM? Variable Sequential? - Yes, of course. Indexed Sequential? - Yes. Roger ---------------------------------------------------------------- [quote]Indexed Sequential? - Yes. Roger[/quote]But only via BDB (see README), your "old" files from MF/ACU/somewhat have to be unloaded and reloaded into the new BDB-Files. Am I right, Roger? ---------------------------------------------------------------- Correct. Generally speaking, when indexed sequential files are being ported, then you must unload on the old system and reload on the new system. We are still looking at C-ISAM(MF), D-ISAM, VBISAM portability. Roger ---------------------------------------------------------------- Hi, In VSAM organization (e.g. FB,LRECL=80), In VSAM, there is not separator (CR or/and NL codes) between every recording. After the first record 80 char, you have immediately the secund record; if you have this file type you can't read whith Cobol sequential read on Unix/Linux or Windows. After the first read you have "10" as FileStatus -> End of File (for your FMS you have only one record). The file transfert tool (from mainframe) must * convert EBDIC to ASCII and * add to every record a mark of the end of line mark. This file type is readable with "ORGANIZATION IS LINE SEQUENTIAL" in the SELECT clause. ... The notion of files with size record does not exist in Unix/Linux or Windows FMS, there is always a end mark (x0D x0A with M$) for the alphanumeric files. To simulate the work of OS390 or OS400 FMS, it nearly, in COBOL runtime, read / write blocks (disc sector) of the file and to perform the blockage / releasing. It is easy to work with files containing variable size records with a mark "End of Record". *It is managed by the guest system FMS for readings/writings; *This avoids supplementing all lines with spaces in your Text editor. For a Cobol source with identification of lines (columns 73 - 80), record makes physically 81 bytes (or 82 with windows) and logical 80 bytes. Regards, Jean-Michel PS: Excuse me for my bad english :-? ---------------------------------------------------------------- NO, NO ! This is a fixed length record. You can do a EBCDIC to ASCII translation. It still remains a FIXED length record. (And you certainly do NOT want to convert it to anything else). Roger ---------------------------------------------------------------- Subject: Moving 'spaced' numeric variables into other numeric variables Hello! Again, we have a problem with moving numeric variables into other numeric variables. In this case the source variables are filled with spaces, due to a redefine (see code below). Example program: [code]WORKING-STORAGE SECTION. 01 W-RECORD-STRUCTURE. 05 W-RECORD. 10 W-RECORD-TYPE PIC X(03) VALUE SPACE. 10 W-RECORD-DATA PIC X(97) VALUE SPACE. 10 W-RECORD-1 REDEFINES W-RECORD-DATA. 15 W-RECORD-1-ALPHA1 PIC X(02). 15 W-RECORD-1-ALPHA2 PIC X(09). 15 W-RECORD-1-NUM1 PIC 9(05). 15 W-RECORD-1-ALPHA3 PIC X(04). 15 W-RECORD-1-NUM2 PIC 9(06). 15 W-RECORD-1-ALPHA4 PIC X(14). 15 W-RECORD-1-FILLER PIC X(57). 10 W-RECORD-2 REDEFINES W-RECORD-DATA. 15 W-RECORD-2-ALPHA1 PIC X(09). 15 W-RECORD-2-ALPHA2 PIC X(04). 15 W-RECORD-2-NUM1 PIC 9(04). 15 W-RECORD-2-ALPHA3 PIC X(02). 15 W-RECORD-2-NUM2 PIC 9(05). 15 W-RECORD-2-ALPHA4 PIC X(10). 15 W-RECORD-2-FILLER PIC X(63). 01 W-FIELDS. 05 W-VAL1 PIC 9(05). 05 W-VAL2 PIC 9(03)V9(02). 05 W-VAL3 PIC 9(09). 05 W-VAL4 PIC 9(11)V9(02). 05 W-VAL5 PIC S9(05). 05 W-VAL6 PIC S9(03)V9(02). 05 W-VAL7 PIC S9(09). 05 W-VAL8 PIC S9(11)V9(02). 05 W-VAL9 PIC 9(05) COMP-3. 05 W-VAL10 PIC 9(03)V9(02) COMP-3. 05 W-VAL11 PIC 9(09) COMP-3. 05 W-VAL12 PIC 9(11)V9(02) COMP-3. 05 W-VAL13 PIC S9(05) COMP-3. 05 W-VAL14 PIC S9(03)V9(02) COMP-3. 05 W-VAL15 PIC S9(09) COMP-3. 05 W-VAL16 PIC S9(11)V9(02) COMP-3. PROCEDURE DIVISION. MOVE 'TYPSOMEDATA' TO W-RECORD. **** Let's have a look on how W-RECORD-1 looks after this MOVE DISPLAY 'W-RECORD-1-ALPHA1 [' W-RECORD-1-ALPHA1 ']'. DISPLAY 'W-RECORD-1-ALPHA2 [' W-RECORD-1-ALPHA2 ']'. DISPLAY 'W-RECORD-1-NUM1 [' W-RECORD-1-NUM1 ']*'. DISPLAY 'W-RECORD-1-ALPHA3 [' W-RECORD-1-ALPHA3 ']'. DISPLAY 'W-RECORD-1-NUM2 [' W-RECORD-1-NUM2 ']*'. DISPLAY 'W-RECORD-1-ALPHA4 [' W-RECORD-1-ALPHA4 ']'. **** How do the W-VAL*-variables look before any change DISPLAY 'W-VAL1 [' W-VAL1 '] before'. DISPLAY 'W-VAL2 [' W-VAL2 '] before'. DISPLAY 'W-VAL3 [' W-VAL3 '] before'. DISPLAY 'W-VAL4 [' W-VAL4 '] before'. DISPLAY 'W-VAL5 [' W-VAL5 '] before'. DISPLAY 'W-VAL6 [' W-VAL6 '] before'. DISPLAY 'W-VAL7 [' W-VAL7 '] before'. DISPLAY 'W-VAL8 [' W-VAL8 '] before'. DISPLAY 'W-VAL9 [' W-VAL9 '] before'. DISPLAY 'W-VAL10 [' W-VAL10 '] before'. DISPLAY 'W-VAL11 [' W-VAL11 '] before'. DISPLAY 'W-VAL12 [' W-VAL12 '] before'. DISPLAY 'W-VAL13 [' W-VAL13 '] before'. DISPLAY 'W-VAL14 [' W-VAL14 '] before'. DISPLAY 'W-VAL15 [' W-VAL15 '] before'. DISPLAY 'W-VAL16 [' W-VAL16 '] before'. **** Now we take the 'spaced' numeric variable W-RECORD-1-NUM1 **** to move it to the test variables W-VAL* MOVE W-RECORD-1-NUM1 TO W-VAL1 . MOVE W-RECORD-1-NUM1 TO W-VAL2 . MOVE W-RECORD-1-NUM1 TO W-VAL3 . MOVE W-RECORD-1-NUM1 TO W-VAL4 . MOVE W-RECORD-1-NUM1 TO W-VAL5 . MOVE W-RECORD-1-NUM1 TO W-VAL6 . MOVE W-RECORD-1-NUM1 TO W-VAL7 . MOVE W-RECORD-1-NUM1 TO W-VAL8 . MOVE W-RECORD-1-NUM1 TO W-VAL9 . MOVE W-RECORD-1-NUM1 TO W-VAL10. MOVE W-RECORD-1-NUM1 TO W-VAL11. MOVE W-RECORD-1-NUM1 TO W-VAL12. MOVE W-RECORD-1-NUM1 TO W-VAL13. MOVE W-RECORD-1-NUM1 TO W-VAL14. MOVE W-RECORD-1-NUM1 TO W-VAL15. MOVE W-RECORD-1-NUM1 TO W-VAL16. **** How do the W-VAL*-variables look after the moves DISPLAY 'W-VAL1 [' W-VAL1 '] after'. DISPLAY 'W-VAL2 [' W-VAL2 '] after'. DISPLAY 'W-VAL3 [' W-VAL3 '] after'. DISPLAY 'W-VAL4 [' W-VAL4 '] after'. DISPLAY 'W-VAL5 [' W-VAL5 '] after'. DISPLAY 'W-VAL6 [' W-VAL6 '] after'. DISPLAY 'W-VAL7 [' W-VAL7 '] after'. DISPLAY 'W-VAL8 [' W-VAL8 '] after'. DISPLAY 'W-VAL9 [' W-VAL9 '] after'. DISPLAY 'W-VAL10 [' W-VAL10 '] after'. DISPLAY 'W-VAL11 [' W-VAL11 '] after'. DISPLAY 'W-VAL12 [' W-VAL12 '] after'. DISPLAY 'W-VAL13 [' W-VAL13 '] after'. DISPLAY 'W-VAL14 [' W-VAL14 '] after'. DISPLAY 'W-VAL15 [' W-VAL15 '] after'. DISPLAY 'W-VAL16 [' W-VAL16 '] after'.[/code] Output: [code]W-RECORD-1-ALPHA1 [SO] W-RECORD-1-ALPHA2 [MEDATA ] W-RECORD-1-NUM1 [ ]* W-RECORD-1-ALPHA3 [ ] W-RECORD-1-NUM2 [ ]* W-RECORD-1-ALPHA4 [ ] W-VAL1 [00000] before W-VAL2 [00000] before W-VAL3 [000000000] before W-VAL4 [0000000000000] before W-VAL5 [00000+] before W-VAL6 [00000+] before W-VAL7 [000000000+] before W-VAL8 [0000000000000+] before W-VAL9 [00000] before W-VAL10 [00000] before W-VAL11 [000000000] before W-VAL12 [0000000000000] before W-VAL13 [00000+] before W-VAL14 [00000+] before W-VAL15 [000000000+] before W-VAL16 [0000000000000+] before W-VAL1 [ ] after W-VAL2 [ 00] after W-VAL3 [0000 ] after W-VAL4 [000000 00] after W-VAL5 [ M-`-] after W-VAL6 [ 00+] after W-VAL7 [0000 M-`-] after W-VAL8 [000000 00+] after W-VAL9 [?0?00] after W-VAL10 [?0000] after W-VAL11 [0000?0?00] after W-VAL12 [000000?0?0000] after W-VAL13 [?0?00+] after W-VAL14 [?0000+] after W-VAL15 [0000?0?00+] after W-VAL16 [000000?0?0000+] after [/code] Expected Output: Output: [code]W-RECORD-1-ALPHA1 [SO] W-RECORD-1-ALPHA2 [MEDATA ] W-RECORD-1-NUM1 [ ]* W-RECORD-1-ALPHA3 [ ] W-RECORD-1-NUM2 [ ]* W-RECORD-1-ALPHA4 [ ] W-VAL1 [00000] before W-VAL2 [00000] before W-VAL3 [000000000] before W-VAL4 [0000000000000] before W-VAL5 [00000+] before W-VAL6 [00000+] before W-VAL7 [000000000+] before W-VAL8 [0000000000000+] before W-VAL9 [00000] before W-VAL10 [00000] before W-VAL11 [000000000] before W-VAL12 [0000000000000] before W-VAL13 [00000+] before W-VAL14 [00000+] before W-VAL15 [000000000+] before W-VAL16 [0000000000000+] before W-VAL1 [00000] after W-VAL2 [00000] after W-VAL3 [000000000] after W-VAL4 [0000000000000] after W-VAL5 [00000+] after W-VAL6 [00000+] after W-VAL7 [000000000+] after W-VAL8 [0000000000000+] after W-VAL9 [00000] after W-VAL10 [00000] after W-VAL11 [000000000] after W-VAL12 [0000000000000] after W-VAL13 [00000+] after W-VAL14 [00000+] after W-VAL15 [000000000+] after W-VAL16 [0000000000000+] after[/code] cobc (OpenCOBOL) 1.1.0 Build date Apr 23 2008 16:14:56 using the -std=mf flag HP-UX machinename B.11.31 U ia64 3567537583 unlimited-user license Thanks for help... LeBoepp ---------------------------------------------------------------- This is undefined behaviour. eg. With MF SE 4.x - simlinux:~ # cob num.cob simlinux:~ # cobrun num W-RECORD-1-ALPHA1 [SO] W-RECORD-1-ALPHA2 [MEDATA ] W-RECORD-1-NUM1 [ ]* W-RECORD-1-ALPHA3 [ ] W-RECORD-1-NUM2 [ ]* W-RECORD-1-ALPHA4 [ ] W-VAL1 [ ] before W-VAL2 [ ] before W-VAL3 [ ] before W-VAL4 [ ] before W-VAL5 [ Execution error : file '/root/num.int' error code: 163, pc=16E, call=1, seg=0 163 Illegal character in numeric field or - simlinux:~ # cob -u num.cob simlinux:~ # cobrun num W-RECORD-1-ALPHA1 [SO] W-RECORD-1-ALPHA2 [MEDATA ] W-RECORD-1-NUM1 [ ]* W-RECORD-1-ALPHA3 [ ] W-RECORD-1-NUM2 [ ]* W-RECORD-1-ALPHA4 [ ] W-VAL1 [ ] before W-VAL2 [ ] before W-VAL3 [ ] before W-VAL4 [ ] before W-VAL5 [00000+] before W-VAL6 [00000+] before W-VAL7 [000000000+] before W-VAL8 [0000000000000+] before W-VAL9 [20202] before W-VAL10 [20202] before W-VAL11 [202020202] before W-VAL12 [2020202020202] before W-VAL13 [+20202] before W-VAL14 [+20202] before W-VAL15 [+202020202] before W-VAL16 [+2020202020202] before W-VAL1 [ ] after W-VAL2 [ 00] after W-VAL3 [0000 ] after W-VAL4 [000000 00] after W-VAL5 [00000+] after W-VAL6 [00000+] after W-VAL7 [000000000+] after W-VAL8 [0000000000000+] after W-VAL9 [00000] after W-VAL10 [00000] after W-VAL11 [000000000] after W-VAL12 [0000000000000] after W-VAL13 [+00000] after W-VAL14 [+00000] after W-VAL15 [+000000000] after W-VAL16 [+0000000000000] after Roger ---------------------------------------------------------------- Therefore you need [code] IF W-RECORD-1-NUM1 NUMERIC MOVE W-RECORD-1-NUM1 TO W-VAL1 ELSE initialize W-VAL1 END-IF[/code] ---------------------------------------------------------------- Changing all our sources was exactly the thing I wanted to avoid... :-( Of course, initializing non-numeric fields is a solution. I have done it so far as work-around in the obviously faulty programs. But indeed, I have no idea in how many other sources this behavior could lead to errors. Isn't there a possibility to tell OC that it should initialize numeric fields with non-numeric content to its default initial value (type dependant), when you try to fill it with illegal content? Thanks LeBoepp ---------------------------------------------------------------- No, this is a redefines and the standards are quite clear. I would like to see a BYTE display of the output. (Problem is that any specfic compiler may interpret within a DISPLAY a non valid as a specific value) So, recode to produce BYTE results. Also, note that variuous compilers produce for a DISPLAY a mutated display without producing a warning. Thanks Roger ---------------------------------------------------------------- I have now robustified handling of spaces in numeric fields. Try the latest 1.1 tarball. Roger ---------------------------------------------------------------- What means "robustified handling" in this case? ---------------------------------------------------------------- Well, the first thing is handling the sign byte (which in the case of space would lead to peculiar reults). Further, blindly doing a C construct of - intfield = byte - '0' doesnot lead to good results when byte is space. The real problem is that invalid content (and the standard Cobol defintion thereof) does not define what shoud happen. What I have done is to put some hooks in for space content. This is not strictly correct. We should have a compile option for this and extend this completely into the runtime. Roger ---------------------------------------------------------------- Subject: Using libraries and files in different folders I have the following files: -folder a ----myprog.so ----myprog2.so ----myfile.dat -folder b ----myprog.so ----myprog3.so ----myfile.dat ----myfile2.dat -folder c ----myfile.dat ----myfile3.dat ----myprog4.so How can I achieve, that if I do a call 'myprog4' all folders are searched for the library? And how is it possible that myprog4 can use myfile2.dat? The best solution would be, if everytime I do a call or open a file all folders are searched for the library/file. ---------------------------------------------------------------- Use filename mapping like MF. eg. assuming directories "a", "b", "c" are under a root directory "/home" - For "myprog4" - export DD_myfile=/home/c/myfile.dat export DD_myfile2=/home/b/myfile2.dat export DD_myfile3=/home/c/myfile3.dat Note the "DD_" prefix in the variable name may be lower case or even omitted - So "DD_myfile", "dd_myfile" and "myfile" are eqivalent and the variable name search is done in this order. I personally prefer the "DD_" variant as this easier to control when checking/listing/sorting the environment. Roger ---------------------------------------------------------------- OK. So I've to have a look myself where the files are (no possibility for having looked for the file in directory A, B, C, D and the first folder where the file is would be used), right? How can I call myprog4 from myprog3? Only by setting environment PATH to A:B:C:D:PATH? In this case all directories are searched for the programs. Is it possible to implement such stuff for the files, too? ---------------------------------------------------------------- 1) OC uses the environment variable COB_LIBRARY_PATH to locate modules :-). 2) Although MF offer this, I have been caught out by this at a customer site. Either you know where the file is or not. This "well it might be here or there" cost the customer 2 days of my time to diagnose. Note that with MF when creating the file only the first path is used :-) No, I do not want to get into this scenario. This can be perfectly handled in the environment. Roger ---------------------------------------------------------------- Subject: how to pass exit status to OS, and external files Hi. I have been playing with OpenCOBOL and really enjoy it. Two questions: 1) How to pass a non-zero return code to the OS? This might be more of a COBOL question; I apologize, as I haven't used COBOL in many years. 2) Accessing external files. It works if I do: ... assign to external "test.in" but I saw the post on using environment vars. I tried: ... assign to MYFILE and then in the shell set: export MYFILE=test.in but the open fails. What am I missing? Thanks. ---------------------------------------------------------------- I figured out #2 above after looking in "fileio.c". I needed to make it look like this: SELECT INFILE ASSIGN to external "MYFILE" and it worked as advertised. I would still appreciate help on #1 if you have a suggestion. ---------------------------------------------------------------- Try this:[code]exit program giving/returning zero[/code] ---------------------------------------------------------------- That didn't work, but it was close enough. What did work was: stop run returning 1. So now I can detect in my shell script when the COBOL program fails. Thanks. ---------------------------------------------------------------- There is also the internal register "RETURN-CODE" (ala. MF). ie. MOVE 1 TO RETURN-CODE. STOP RUN. Roger ---------------------------------------------------------------- The RETURN-CODE special register can be used to pass a return code to the calling program or operating system (or shell) when the current Cobol program ends. The RETURN-CODE special register has the implicit definition: 77 RETURN-CODE GLOBAL PICTURE S9(04) USAGE BINARY VALUE ZERO. (Part of Cobol Reference Manual, IBM 2006) Jean-Michel ---------------------------------------------------------------- Almost right :-) It's actually - 77 RETURN-CODE PIC S9(08) COMP-5 VALUE 0. (Alternatively in 2002 syntax - 77 RETURN-CODE USAGE BINARY-LONG SIGNED VALUE 0.) ie. It is a machine endian 4 byte signed integer. Also it is not GLOBAL. It is per program. Roger ---------------------------------------------------------------- Subject: SPLIT KEYS & UNLOCK Hello everybody, I was wondering if there was a way to use split keys? When inspecting the source code and fileio.c, it seems that this would be very difficult; am I wrong? I also need to support UNLOCK. As from V1.1, this seems rather simple (a LOT of difference from 0.33, kudos!!!). Is there an ongoing implementation? If not I am willing to do it. What would be the preferred way: - Add a member to cob_fileio_funcs - Or a kludge: add COB_READ_UNLOCK = 0x200, and emit a read(f, COB_READ_UNLOCK) Thanks for the hard work, Michel ---------------------------------------------------------------- A preliminary version of UNLOCK is in the current 1.1 tarball. What is missing here are the calls for EXTFH users (Empty WITH_SEQRA_EXTFH/WITH_INDEX_EXTFH idef's). I cannot put these in without breaking existing 1.0/1.1 EXTFH users. (ie. calls to new external extfh_index_onlock/extfh_seqra_unlock). This needs to be done post 1.1 release. Split keys, as you surmise, is somewhat more difficult. The compiler/parser part should not be too difficult (with the exception of handling the pseudo reference/field composing the composite key). The runtime is harder. Firstly we should, if possible, not change any fileio structures (because of EXTFH compatibility). To this extent, I am looking at reusing "linptr" in the structure. This is only used for LINAGE and can never be set for ISAM. The current 1.1 tarball contains some moves in this direction to cast this pointer for linage use. Eventually this can be renamed to something like "linorkeyptr" and defined as "void *" so that we can use it for split keys. As to the actual implementation, C-ISAM/D-ISAM/VBISAM all have native support for split keys. For BDB, we would have to code it ourselves. Roger ---------------------------------------------------------------- Subject: moving foreward I've been trying to get a collection of COBOL programs re-hosted onto a PC architecture. It is with great interest that I am following this program. It seems the best effort so far. Even the paid for systems are lacking. Not only are they lacking technically they are ridiculous in their pricing model. I realize this program is largely, if not completely, a volunteer effort. Most of us have day jobs and working on a program as complicated as a COBOL compiler must fit in with everything else. From this person, thank you. The compiler is a great piece of work and will solve a lot of problems for those of us porting and maintaining large COBOL based systems. One favor - can someone offer any insight on the plans for implementation? What features are coming and what will not be. If there is a hint of time frame it would be most appreciated. Mike ---------------------------------------------------------------- Well, that person is currently me :-) Thanks. As you rightly surmise, this is an "outside of job" effort. With 1.0/1.1, we are pretty near the 85 standard with a couple of exceptions (not including the, as optional defined, standard features). (No, I will not state what they are :-), nobody until yet has come across them). Over and above the 85 standard, we have several MF/ACU and 2002 extensions (eg. 2002 FUNCTION's and several MF/ACU specific library calls). Also, much to my disgust, I had to implement several parser variations for ported MF code. As to where we are going, this is somewhat dependent on my local TODO list. If you have a particular request, you can add it to the thread "OpenCOBOL 1.1 wishlist". Roger ---------------------------------------------------------------- I must say you've done a great job. I built a compiler ages ago; PL/M compiler written in Fortran running on a Honeywell computer generating code for the 8085 so I appreciate the complexity of your effort compiling COBOL. No mean feat! Two questions if I may; do you plan to handle the SCREEN SECTION? Also, where can I get the latest tarball? I am running on the latest Linux kernel. The distribution varies, now using Fedora 9. Mike ---------------------------------------------------------------- The latest tarball is always the link at the left side of this page under "Download", "OpenCOBOL 1.1 prerelease". The direct link is - http://www.sim-basis.de/open-cobol-1.1.tar.gz SCREEN SECTION - Most of the syntax side is done which means that you should be able to compile. What is missing is a good portion of the runtime. DISPLAY mostly works. ACCEPT is virtually non-existent. I will be looking at this over the next couple of weeks. Roger ---------------------------------------------------------------- Thanks Roger. I will work on build/test every time I see a new tarball. Thanks! Mike ---------------------------------------------------------------- One problem is the notification of updates. We do not have anything in place for this. The pre-release tarball is anyway provided as a courtesy by me such that it gets exposure. I regularly update this with current development/fixes. Usually, you can download late Sunday evening/early Monday morning (Middle European Time)to get (I hope) a fairly well tested tarball. Roger ---------------------------------------------------------------- Roger, I've told you that this would be no problem, if we would make a new category "experimental builds" in sourceforge and upload every build with your internal revision number, similar to that what winmerge does. You caqn found this example at http://sourceforge.net/project/showfiles.php?group_id=13216&package_id=92246 . If we would do it like this a) there could be a short note what was done in that tarball b) we would have a nice rss-feed for newer versions c) we would have stats and could see how often you do this good work of providing these and see how often the tarballs are downloaded ---------------------------------------------------------------- And I repeat that the tarball is immediately available. Not like SF. You must put it in a staging area which maybe updated sometime when. The problem is automating to SF. Roger ---------------------------------------------------------------- Here, with either a modem or a slow DSl, then you can wait till something happens. I put a request to SF to think about slow connections. However thay seem to think that everybody has a fat pipe. Geez. Tried it recentally? Roger ---------------------------------------------------------------- I do only uploads via svn to sf, this is quite fast (with a "fat pipe"). ---------------------------------------------------------------- Even taking into account the delay, one of the problems is a SF download. If you are clever enough then, sure, you can bypass going http. BUT, the only SAFE link is to the SF download which leads you into the SF http hell. Ever tried using SF with a P2 (Pentium II) with 256KB mem and W2K? I would suggest that all SF developers be forced to do this. (And, yes, One of my boxen does have this here) Roger ---------------------------------------------------------------- SF is getting slower and slower and needs more and more time to load, this is true and a good point. But to have these features for "fat pipes and pc" is maybe better to do not have it for anyone? Maybe we can bypass this if we put the tarball to a new svn folder as a download page, there we would have an upload time and a short description what was changed, you could upload the file via some fast svn-client, downloads would be available through svn-download or via http://open-cobol.svn.sourceforge.net/viewvc/open-cobol/tarballs (for example). CVS seems to be too slow for packed tarballs (does this make a difference?). Or we would just make an anouncement section on this website what was changed in the current tarball and let some script generate an rss-feed of this section. If this is not possible on this version of the system I may could help you update this xoops and board installation, there should be a rss-generation available now. What do you think about these points? ---------------------------------------------------------------- Keisuke is looking at an alternative. As I said, the pre-release is put as a coutesy from me. Otherwise you would have to build from source. The link is somewhat confusing agreed, however it leads to the current tarball. Tarballs are nice - For (Posix systems, including Cygwin) - wget http://www.sim-basis.de/open-cobol-1.1.tar.gz Push/Pull as I do. Roger ---------------------------------------------------------------- Subject: Manuals and Docs Hello, Is there a blurb anywhere that discusses the documentation plans. Unless I missed something, the Wiki UserManual page is a little shy of details. :) I can't offer to write an entire book or anything grand, but if you need help, I can probably find spare time to write up a chapter or two. I've only barely wet my toes but this system is definitely worthy of support, and thanks for that. Cheers, Brian Tiffin ---------------------------------------------------------------- Yes, indeed, doc is what we are lacking. The question is what should we document? The whole COBOL standard as per OC? Hmmm. The COBOL-2002 standard runs to 900+ pages. Remember that this is ONLY the syntax. NOT specific implementations. I think that we do not need to document COBOL syntax except where it differs from the standard/MF/ACU/mainframe. I am looking at providing a simple GETGOING document to aid in simple usage. Further stuff can/should be added to the texi/* files. Roger ---------------------------------------------------------------- Well, I try and not promise time to efforts that I may not be able to deliver on, but I sometimes do. :-( :-) Do you have anything that comes up as faqs that a few lines of documentation could save you time from repeatedly answering? Maybe as a first cut, I'll try writing up something for the interface to libcob (from scanning through libcob/system.def and documenting what I learn as I figure them out). Bear's help and pointing out C$SLEEP made me curious to try out the other library calls. [i]And here is where I open my mouth and maybe promise too much[/i] but I think a usage document that describes, in a few words or samples, the reserved words and notes on OpenCOBOL's implementation would be handy for new users. I'll admit; I'm rusty in COBOL so I'd like to keep expectations low for now, but this system is great and worthy of some volunteer time. Go ahead and post a tech writer request for anything (simple to figure out at this stage) that you feel will save you time for the important coding bits. I do look forward to plumbing the depths of OC 1.0/1.1. Cheers ---------------------------------------------------------------- Hope you don't mind Roger; but I updated the Install Guide wiki entry. Added a note about bash path cache to the bottom. Go ahead and change it (or dump it) as you see fit. Just FYI; my first make pass for 1.1 worked great, but $ cobc -V kept coming back with 1.0. $ strace cobc -V displayed 1.1, $ which cobc showed /usr/local/bin. I was confused and confounded for a few minutes. Then I remembered to $ hash -r to reset the path cache. This will rarely happen, (first time [i]make install[/i] when a pre-compiled package is installed and cobc has been executed out of /usr/bin within the same bash console session). Cheers ---------------------------------------------------------------- Haa Hash and everything :-) That's Posix! Not having looked at the changes, have you done compatible Cygwin/MinGW checks? Roger ---------------------------------------------------------------- I just tried it on my Cygwin setup. Same issue, but a rarer case for first time builders, as they would have had to mv a previous build to /usr/bin. I'll assume that brand of sophisticated user is less likely to get caught with the dual binary and the path cache problem. And nothing really to do with OC in particular. But, first time builders are the ones that don't need any extra complications. (He said, having been one recently) :) So it is more a gotcha warning than anything. Cheers ---------------------------------------------------------------- Btiffin, I've been following your posts the past couple of days. I'd be interested in working with you on the documentation process. Roger, Good work as always on OC and thanks for the job you and your team are doing. I do understand what you are saying about just what should be documented since we do have the standards. So with that in mind I'll give my thoughts. I think we probably have a few different types of folks trying to use OC. 1. COBOL Programmers that are still active. 2. COBOL Programmers like me and Btiffin that haven't used it in a while. 3. Folks new entirely to COBOL. Also of course there are different reasons for using OC. Some might want to convert existing COBOL programs to a FOSS alernative. Others (like me) want to start using it on new projects. Perhaps some want to learn about it, or have to for school. Since I am very rusty it took me a while to get going again. Finally I picked up Sams Teach Yourself Cobol in 24 Hours. Yes I know...ugh..but it's getting me going on the syntax again at least. Each couple of weeks I'll pick up another book. Was thinking of Murach's (looking for comments or suggestions please from anyone). Of course some of the code in the books doesn't quite work. But I'll worry about that eventually. In any case, Free Software I think (as has been said) needs Free Documentation. A first step would be to point folks to where we can find the standard. I've searched google but so far can only find such on ANSI's site. It's been a while since I looked and it seemed quite expensive. Having a tutorial or videos would be very useful for refreshers for those who have used COBOL and as basic training for those who havent. Essentially something additional beyond the get started we have now. So if you're willing to have some help Btiffin, and if you're ok with us putting our heads together on this Roger, I'd like to volunteer myself. Of course having your direction would be beneficial to make sure we meet your expections. Kind Regards. ---------------------------------------------------------------- Got the standard, think this is the right one: http://webstore.ansi.org/RecordDetail.aspx?sku=INCITS%2fISO%2fIEC+1989-2002 Well it's the 1989 - 2002 standard, not the 1985 one. ---------------------------------------------------------------- aoirthoir; This all sounds great! I've been focusing my relearning efforts on the parts of COBOL in OpenCOBOL that weren't around in the early 80's. Lots and Lots. Once I get my head round, and feel a deep enough understanding to try and explain things, I want to add a callable library "chapter" and an intrinsic function chapter to the open-cobol.texi file. I'll be honest, I could be many weeks getting my head round. ;) I agree about the need for three classes of documentation (or at the least, the writers keeping in mind the three different potential target audiences). And from the few days I've been playing so far, OpenCOBOL is exceeding my expectations on supported features. Lots to learn. In the meanwhile, I want to start an OpenCOBOL Open Copylib sample and example source code repository. Being new, I always feel a little shy starting into a volunteer effort, not wanting to rock anyone's boat, and not feeling grounded enough in regards to the overall group feelings about things, so I'll usually be unaggressive and wait for the nod from someone else before proceeding too far. [b]Next questions[/b]; what do the readers of the OpenCOBOL forum feel would be a worthwhile repository? Small standalone programs highlighting 1 or 2 items? Source code suitable for COPY and a template usage spec? Both types mixed in one? Separated? Do you have any suggested names for such a repository? OCOCl? [i]OpenCOBOL OpenCopylib[/i] for instance. Would it be worthwhile having an OpenCOBOL management application to go along with this/these libraries? Or has such an effort been started and I simply haven't read enough back posts to the forum or mailinglist? Thanks again aoirthoir; OpenCOBOL deserves a level of documentation that matches the level of the product. High bar that. Cheers Brian ---------------------------------------------------------------- Btiffin, All of that sounds great also. Maybe we can collaborate on IRC or phone somehow (assuming you are in the states) for more real time work. I'm in the same process of learning COBOL again as well. We were on the 72? standard when I coded, though it was already 87 by the time I started. And yes COBOL had already been..ahem "dead" at that time also. So learning together would be excellent. I am of the mind that real projects help people learn. When I started working for the company that taught me COBOL, I knew nothing about it or programming. One of the employees was instructed to teach me and he gave me a "how many gallons of paint will it take to paint this wall" program to code. And kept me on it for two weeks. Finally I told my boss to just give me something real to test. He did and I learned. So for the learning efforts real projects that we are interested in will help. If we need tools to work with OC, the more we code them in OC the better off we will be. Myself, I will be using OC to create my BLOG, a code generator for COBOL, MySQL and PHP. A blog is more in line with a new user, rather than a code generator. So if we could come up with similar type projects and go from there, that's just one suggestion. Also regarding your copylib question, I think having both apps and copylibs would be best. The 2002 standard implements User Defined Functions. I don't know if OC 1 has that as part of the "some of 2002" or not. If not I hope it moves in that direction. Frankly, I would rather see things like UDF's and SQL connections rather than Object Oriented implementations. Nevertheless if OC does implement UDFs, having many as part of a COPYLIB library would definitely improve OCs uptake for the younger programmers. Myself, any libraries or programs I contribute, I'd want to be released under the GNU GPL. But I think we are already on the same page there. ---------------------------------------------------------------- aoirthoir; I'm in Canada; Ottawa. New York timezone. Today, as part of my self teaching, I'm attempting to call libcurl from OC 1.1 and if I can work it out, I'll be trying to setup general libcurl bindings. OpenCOBOL sure is fun to work with. ;) Cheers ---------------------------------------------------------------- I'm interested in your success. I've been thinking, since OC has an attachment to C libraries capability, that it should be possible to use the MySQL libraries to interface with OC. The problem is that I know no C whatsoever. It's moved up in priority on my list. ---------------------------------------------------------------- aoirthoir; I haven't got to that part yet, but OC has linkage to Berkeley DB already. Not SQL, but a powerful database in its own right. And yes, bindings to MySQL should be quite possible. But let Roger do all the hard work and go with BDB. :) Cheers ---------------------------------------------------------------- aoirthoir et al; In tandem with producing more User Guide and Reference material, I was pondering starting the OpenCOBOL FAQ. If no one objects too loudly, the initial plan is to use Python's docutils ReStructedText. I find it powerful enough while keeping the raw sources very readable. First task will be to troll through the mailing list and this forum for all the tidbits of information scattered about. If anyone has pointers to what should be included (or information on previous attempts or hints on where to look for gems) please feel free to post ideas here. Cheers ---------------------------------------------------------------- Btiffin, I forgot to mention that I am in Cleveland, Ohio, so I am in eastern time zone as well. I think you and I are on the same track. I tried to make a bash script using wget to download all of the forum posts so that I can peruse them when I have no internet connection (certain coffee houses around here still dont have wifi). But in any case I agree with you that going through the forums would be very useful, as would having an FAQ. One interesting note about the standard, is that it actually requires documentation from the Cobol vendor. Of course this is a FOSS project. But I think having documentation that meets the standards requirement, would allow OC to gain a foothold. So we should start collaborating together and decide a format for the docs, so that we can just start adding as needed. Or maybe assign one part here and there to ourselves. Though I think working together at this stage is more practical. Especially considering my 20 years away from Cobol and thus my lack of skill in it right now. ---------------------------------------------------------------- Re the format. In terms of User Guide and any Refernence Manual, I think we should stick to expanding the existing open-cobol.texi (Texinfo) file. This can kinda be done as separate pieces here and there, but there will be a little work in merging any files to get the info nodes properly in sync. Given that, we should be able to partition any work, knowing the end-game of merging won't be automated. On the FAQ, I'd like to proceed with ReST. I like the readability of the source format, it produces skinnable HTML and does a fair job of LaTeX. For this, as long as anyone involved follows something like the PEP standard for section naming, the merge of any pieces will be close to automatic. And then there is the COPY repository and samples/examples which should be either simple files in a directory structure or perhaps (and I don't know yet if COPY id IN lib works) in OpenCOBOL copylib form. I just bumped into the /usr/local/share/open-cobol/copy directory today. :) And re the MySQL links, it looks like there is linkage already in OC for the Firebird SQL engine. Much to learn still. Cheers ---------------------------------------------------------------- A lot of those I've not worked with, like Rest or Latex. But if you're willing to point me where you need me to go and what you want me to do, I'll give it a shot. ---------------------------------------------------------------- Don't worry about LaTeX (well it is totally cool and worth knowing. Donald Knuth's TeX engine is "thee" type setting system), as the output emitters for ReST and Texinfo take care of the TeX. LaTeX is my preferred macro set for TeX. Great for writing book quality output and PDFs. You want to google [i]python docutils[/i] for a pointer to ReStructuredText. http://docutils.sourceforge.net/ http://docutils.sourceforge.net/rst.html Very simple readable input, producing nice quality outputs. rst-buildhtml and rst-buildlatex are the two programs that I use (Debian docutils package installs these). The other thing to google is [i]texinfo[/i]. http://www.gnu.org/software/texinfo/ http://www.gnu.org/software/texinfo/manual/texinfo/ Produces TeX and Info output from single sources. See the tarball /texi/ dir for the current open-cobol.texi file. info is the GNU preferred online doc format. I can't say I'm a fan, but if you like emacs (I chose vi a long time ago) texinfo will fit right in. There will be manual operations involved in getting the hyperlinks and menus setup properly if there are split pieces of text to merge. Not a biggy. Cheers ---------------------------------------------------------------- Note the proposed 2008 standard is (currently) freely available at - http://www.cobolstandard.info/j4/files/std.zip Roger ---------------------------------------------------------------- From aoirthoir's snip [quote] One interesting note about the standard, is that it actually requires documentation from the Cobol vendor. Of course this is a FOSS project. But I think having documentation that meets the standards requirement, would allow OC to gain a foothold. [/quote] And Roger's [quote] Note the proposed 2008 standard is (currently) freely available at - [/quote] So I was thinking about taking a kick at filling in requirements for the documentation parts of [i]an implementation shall provide ...[/i] Of course what I've read being 2008 standard text, but I can only assume an 85 or 02 document would have similar requirements (with different details). So, Roger (or Keisuke if you ever read here), do you have any burning desire to get an accredited '85 stamp (slower more prodding writing effort) or would it be better to write this up with a target audience of friendly developers and "just so you know"? Cheers, Brian ---------------------------------------------------------------- [quote] Yes, indeed, doc is what we are lacking. The question is what should we document? The whole COBOL standard as per OC? Hmmm. The COBOL-2002 standard runs to 900+ pages. Remember that this is ONLY the syntax. NOT specific implementations. I think that we do not need to document COBOL syntax except where it differs from the standard/MF/ACU/mainframe. I am looking at providing a simple GETGOING document to aid in simple usage. Further stuff can/should be added to the texi/* files. Roger [/quote] Roger, Not sure how you feel, I think that Brian is definitely on the right track. Regarding just what should be implemented, I know it's a big undertaking, ultimately though I think that the Open Cobol initiative should be a one stop shop for everything open cobol. Now this might mean a couple of websites as we've been talking about on other forum topics. But what I mean is that when the documentation is done (are docs ever done?) that a user of OC should be able to find everything they need to use OC right in the OC docs without having to resort to looking up other works. Of course having access to the standards docs helps. And having other cobol books with suggest this or that way of doing things would be beneficial as well. Even other code samples that arent provided by us. But basically I would like to see an OC user be able to just use our stuff and be able to hit it running. This is a pretty large undertaking of course. And it is something that is not going to be done over night. ---------------------------------------------------------------- Brian, I don't know how they feel and the direction they are taking OC....this is my thought if they care for it.. So far none of the COBOL compilers fully implements the 2002 standard. I also doubt that they will implement the 2008 standard. If Roger and Keisuke are moving towards implementing more and more of it, then OC could be the most modern COBOL compiler. I think along with that, it requires modern documentation, to the latest standard. ---------------------------------------------------------------- Subject: Open COBOL 1.1 alert The current tarball has a problem with ALTERNATE KEYS. I am trying to track this. Unless you are using ALTERNATE KEYS, then this should not affect you. (Bear, this does not affect your tests) Roger ---------------------------------------------------------------- OK. Alert over. Problem fixed. Current 1.1 tarball is fine. Roger ---------------------------------------------------------------- Subject: Rusty; questions and a seg fault Hello ladies and gentlemen, I'm rusty in COBOL and the farther I get the rustier I feel. Below is some code I'm playing with to show some younger folk the beauty of COBOL. It has to do with an all language exercise dealing with getting a line of input and then outputting each character with a beep and a one second delay. [code] * Beeper.cob for compsci.ca exercise ** Read a line of user input, display each character with a ** 1 second delay and a beep. IDENTIFICATION DIVISION. PROGRAM-ID. beeper IS INITIAL. AUTHOR. Brian Tiffin. DATE-WRITTEN. 11-June-2008. DATE-COMPILED. DATA DIVISION. WORKING-STORAGE SECTION. 01 USER-DATA PIC X(80) VALUE SPACES. 01 CHAR-COUNT PIC 99 VALUE ZEROES. 01 CHAR-INDEX PIC 99 VALUE ZEROES. *HHMMSSss where ss is 100ths of a second 01 CURRENT-TIME. 02 FILLER PIC 9999. 02 CURRENT-SSSS PIC 9999. * 03 CURRENT-SS PIC 99. * 03 FILLER PIC 99. 01 LAST-TIME. 02 FILLER PIC 9999. 02 LAST-SSSS PIC 9999. PROCEDURE DIVISION. DISPLAY ": " WITH NO ADVANCING. ACCEPT USER-DATA. * get the user input length by scanning back for non space PERFORM VARYING CHAR-COUNT FROM 80 BY -1 UNTIL USER-DATA(CHAR-COUNT:1) NOT = SPACE END-PERFORM * output each character with a beep and then pause PERFORM VARYING CHAR-INDEX FROM 1 BY 1 UNTIL CHAR-INDEX > CHAR-COUNT DISPLAY USER-DATA(CHAR-INDEX:1) WITH BELL ACCEPT LAST-TIME FROM TIME MOVE LAST-TIME TO CURRENT-TIME PERFORM HACK-DELAY UNTIL CURRENT-SSSS > LAST-SSSS + 100 END-PERFORM STOP RUN. * Hack of a delay procedure due to lack of docs and dumbness HACK-DELAY. ACCEPT CURRENT-TIME FROM TIME. * IF CURRENT-SSSS >= 5900 THEN * MOVE 60 TO CURRENT-SS. [/code] Item 1; for Roger This works, but if I remove the comments on CURRENT-SS and the FILLER (and the PIC clause from CURRENT-SSSS) I get a segmentation fault during cobc -x beeper.cob Excuse the rusty COBOL, but I want the hack delay to account for the 59 to 00 second rollover. Debian GNU/Linux 4, GCC 4.2.4, OC 1.1 tarball dl'ed 07-Jun-2008 Item 2; for anyone Is there a better way of doing a one second delay in OC? Item 3; DISPLAY and WITH; how do I add a NO ADVANCING clause along with the WITH BELL. Again it's been 20 years since I worked in COBOL and it seems that things have changed a little - my brain for one. Cheers Edit; added that the seg fault is during cobc. ---------------------------------------------------------------- Hello, I played a bit with your program, so I suppressed some lines and added some others. My tarball : $ cobc -V cobc (OpenCOBOL) 1.1.0 Build date Jun 11 2008 21:26:59 Copyright (C) 2001-2008 Keisuke Nishida / Roger While This is the result : [code] * Beeper.cob for compsci.ca exercise ** Read a line of user input, display each character with a ** 1 second delay and a beep. IDENTIFICATION DIVISION. PROGRAM-ID. beeper IS INITIAL. AUTHOR. Brian Tiffin & Bear. DATE-WRITTEN. 11-June-2008. DATE-COMPILED. DATA DIVISION. WORKING-STORAGE SECTION. 01 USER-DATA PIC X(80) VALUE SPACES. 01 CHAR-COUNT PIC 99 VALUE ZEROES. 01 CHAR-INDEX PIC 99 VALUE ZEROES. PROCEDURE DIVISION. begin. display space with foreground-color 3 background-color 1 blank screen end-display DISPLAY ": " WITH NO ADVANCING. ACCEPT USER-DATA. *> get the user input length by scanning back for non space PERFORM VARYING CHAR-COUNT FROM 80 BY -1 UNTIL USER-DATA(CHAR-COUNT:1) NOT = SPACE END-PERFORM *> output each character with a beep and then pause PERFORM VARYING CHAR-INDEX FROM 1 BY 1 UNTIL CHAR-INDEX > CHAR-COUNT DISPLAY USER-DATA(CHAR-INDEX:1) line 3 column char-index WITH BELL end-display call "C$SLEEP" using "1" *> This is the way to do a 1 second delay END-PERFORM . EXIT PROGRAM. [/code] This is one way to solve your problems ... I hope you'll enjoy. Bear ---------------------------------------------------------------- I did enjoy. Thanks Bear. Posted a FIXED form version to the other board, just to add a little history lesson. Cheers ---------------------------------------------------------------- Yes, Bears version is fine. Re. the segfault. Yes, I have fixed this in current 1.1 tarball. The problem is that then you are comparing a group item which is implicitly alphanumeric (PIC X(n)) against a numeric literal. The standards are unclear on this point. I will see if I can clarify this. Now, having said I fixed this, I believe there are some other corner cases that we are not checking. So, this goes onto my TODO list. Roger ---------------------------------------------------------------- Subject: Ring my bell ... ...and other features of DISPLAY/ACCEPT Hello, I answered recently btiffin's post about the BELL feature in DISPLAY statement. So I found out something I would like to submit in followin lines : [code] identification division. program-id. CLOCHE. *> *> This program was written in order to test *> the DISPLAY statement and BELL / BEEP features *> procedure division. begin. display "Do You Hear My Bell ? ..." with bell call "C$SLEEP" using "1" display "....I guess no ..." call "C$SLEEP" using "1" display "And now ? " line 05 column 38 with bell end-display display "I guess YES" line 07 column 38 end-display call "C$SLEEP" using "1" . fin. exit program. [/code] It beeps only when line/column is specified ?. Best regards Bear ---------------------------------------------------------------- He-he :-) I am ahead of you :-) I noticed that as well. Fixed in current 1.1 tarball. (As should be the segfault from btiffin) Roger ---------------------------------------------------------------- This is why you are the "CHEF" of our Cobol cuisine ! :-D Respect Bear ---------------------------------------------------------------- :-) And, of course, a few lines of example code to reproduce any problem are worth any amount of discussion. Thanks, Bear, for always providing sample code. ***** NOTE to all others - Please provide sample code for any problem ***** Just so long as you do NOT expect the ACCEPT to work as it should absolutely immediately :-) Yes, I am looking at it. Maybe have some code ready over the weekend. (For the technically minded, in libcob/screenio.c, we have to work with curses getch() and interpret input accordingly. Applies to SCREEN and MF ACCEPT. This will also allow function-key returns,screen positioning (for SCREEN) and correctly filling CRT STATUS and CURSOR fields) Roger ---------------------------------------------------------------- Of course, Bear, that does not mean that you cannot post a prog with ACCEPT that does not do what it should :-) Please do so :-) That saves me a lot of time as this screen stuff is something that cannot be autochecked in the "make check". Roger ---------------------------------------------------------------- Thank you Roger, I'm really glad to participate as a testing end-user programmer. So I noticed that PROMPT, UPDATE gives errors when compiling and AUTO stops at end of field and SECURE displays what is entered via the keyboard. I wrote a little program to show you that. [code] identification division. program-id. FIELDS. *> *> This program was written in order to test *> the ACCEPT statement in color environment *> + other features *> data division. working-storage section. 77 I pic 99. 77 J pic 99. 77 K pic 99. 77 L pic 99. 77 w pic X(010). procedure division. begin. perform varying I from 0 by 1 until I > 7 display SPACE with foreground-color I background-color I BLANK SCREEN end-display perform varying J from 0 by 1 until J > 7 add 2 J giving L add 1 J giving K evaluate J when 7 accept w line L column 5 with foreground-color J background-color I highlight auto end-accept when other accept w line L column 5 with foreground-color J background-color I highlight *> prompt end-accept end-evaluate end-perform end-perform . fin. exit program. [/code] So Roger I will continue until you stop me :-) Best Regards Bear ---------------------------------------------------------------- I need to change everything as regards curses. Stand by. Roger ---------------------------------------------------------------- Incidentally, that is a good prog :-) Problem is that your usage is NOT standard. Well, we know that you are trying to do what MF does. (Geez) (Just reply - no real problems) Roger ---------------------------------------------------------------- I found this : http://supportline.microfocus.com/documentation/books/sx22sp1/lrpubb.htm And I try to make the "format 5" work. Seems very close to what I use. I must tell you that I'm a bit lost when talk about standard. :-( In any case, single field management has much in common with screen section. We need to know when a key was pressed, for example Esc, F1,...F9, arrows, etc ... Best Regards Bear ---------------------------------------------------------------- Yep, however the 85 and 2002 standards cost money. But proposed 2008 is at - http://www.cobolstandard.info/wg4/open/WD1-10-pdf.zip Somewhat (regarding 85/2002) can be intuited from this. And the MF/ACU docs are online. Roger ---------------------------------------------------------------- OK. Bear, use this download - http://www.sim-basis.de/develop/open-cobol-1.1.tar.gz This is just a proof of concept. It breaks the SCREEN SECTION totally. For all other users, this download is high risk that is not even guaranteed to compile :-) In other words, this is for Bear only :-) For simple ACCEPT, it should do PROMPT, SECURE, AUTO. Interesting, I am about to follow up on the syntax for PROMPT with MF. It states in the doc (current for all versions) that on the ACCEPT clause and PROMPT, then the CHARACTER clause is optional. (Note that the CHARACTER is optional). That cannot be. You would be left with a "literal" which is a valid display field. It would not be parsable even under the ridiculous MF relaxed constraints. Will check. In the meantime, I have decided to delete the optional CHARACTER clause as related to PROMPT from OC. If we eventually need some other means to define this, then no problem. Roger ---------------------------------------------------------------- Also, for the aforemetioned download, then we update CURSOR and CRT STATUS if defined. eg. CONFIGURATION SECTION. SPECIAL-NAMES. CURSOR IS CRTPOS CRT STATUS IS CRTSTAT . Bear, you might want to include this in your test progs. Roger ---------------------------------------------------------------- Roger You astonished me ! I downloaded the link you've given, and tested in a hurry ! This is the source I used to detect some features (update, prompt). [code] identification division. program-id. FIELDS. *> *> This program was written in order to test *> the ACCEPT statement in color environment *> + other features. *> Strategic lines are commented. *> data division. working-storage section. 77 I pic 99. 77 J pic 99. 77 K pic 99. 77 L pic 99. 77 w pic X(010). procedure division. begin. perform varying I from 0 by 1 until I > 7 display SPACE with foreground-color I background-color I BLANK SCREEN end-display perform varying J from 0 by 1 until J > 7 add 2 J giving L add 1 J giving K evaluate J when 7 move "Last Line" to w *> Filling the field before accept accept w line L column 5 with *> 'Last Line' must appear in the field foreground-color J *> Corrections must be allowed at least background-color I *> with backspace highlight *> update *> reverse-video *> Works Fine & Really reverses the video end-accept when other accept w line L column 5 with *> field w must contain characters foreground-color J *> of the sequence typed or background-color I *> space if nothing has been entered highlight *> At least backspace must be allowed prompt auto secure *> end-accept *> display w line L column 20 with *> I display to what I entered foreground-color J *> background-color I *> highlight *> bell *> this is only for making "music" :-) end-display end-evaluate end-perform end-perform . fin. exit program. [/code] I hope it will help you to play some more ... Respect Bear ---------------------------------------------------------------- Another test with DISPLAY BLANK LINE [code] identification division. program-id. BLANKS. *> *> This program has been written in order to test *> the DISPLAY statement and BLANK SCREEN, BLANK LINE, *> ERASE EOS & EOL options *> DATA DIVISION. WORKING-STORAGE SECTION. 77 w80 pic X(080). 77 I pic 99. 77 J pic 99. 77 K pic 99. 77 L pic 99. PROCEDURE DIVISION. BEGIN. perform varying I from 0 by 1 until I > 7 display space with foreground-color 0 background-color I blank screen end-display call "C$SLEEP" using "1" perform varying J from 0 by 1 until J > 7 display "Here comes EOS" line 03 column 03 with foreground-color 0 background-color J erase EOS end-display perform varying K from 0 by 1 until K > 7 add 5 K giving L display "Here comes EOL" line L column 05 with foreground-color 0 background-color K erase EOL end-display add 15 K giving L display "Here comes BLANK LINE" line L column 30 with foreground-color 0 background-color K BLANK LINE end-display end-perform call "C$SLEEP" using "1" end-perform end-perform . fin. EXIT PROGRAM. [/code] BLANK LINE reasonably must blank the whole line, and that's not what is done. Best regards Bear ---------------------------------------------------------------- OK. New tarball up at the address as above. Covers the last posts plus adds in support for back space, cursor key left/right. Roger ---------------------------------------------------------------- In the mean time I have started to sort out the SCREEN SECTION. So, now both tarballs are the same. Bear, if I need to check something with you, then I will point you to the "develop" download. Roger ---------------------------------------------------------------- Thank you Roger ! I tested all the "BLANKS" program, and added a bit "HIGHLIGHT" so it make this program more colorful. ;-) [code] identification division. program-id. BLANKS. *> *> This program has been written in order to test *> the DISPLAY statement and BLANK SCREEN, BLANK LINE, *> ERASE EOS & EOL options *> DATA DIVISION. WORKING-STORAGE SECTION. 77 w80 pic X(080). 77 I pic 99. 77 J pic 99. 77 K pic 99. 77 L pic 99. PROCEDURE DIVISION. BEGIN. perform varying I from 0 by 1 until I > 7 display space with foreground-color I background-color I blank screen end-display call "C$SLEEP" using "1" perform varying J from 0 by 1 until J > 7 display "Here comes EOS" line 03 column 03 with foreground-color J background-color J highlight erase EOS end-display perform varying K from 0 by 1 until K > 7 add 5 K giving L display "Here comes EOL" line L column 05 with foreground-color K background-color K highlight erase EOL end-display add 15 K giving L display "Here comes BLANK LINE" line L column 30 with foreground-color K background-color K highlight BLANK LINE end-display end-perform call "C$SLEEP" using "1" end-perform end-perform . fin. EXIT PROGRAM. [/code] Locally I will add some blinks to see what happens. :-D For accept statements, when PROMPT is used and nothing typed, the field must be loaded with SPACE or 0 (ZERO) according to the PICTURE. when UPDATE is used, the DEL character seems to be ineffective, and BACKSPACE does not work on the last position of the field (the rightest). Reasonably HOME has to put the cursor at the beginning of the field and END at its latest position. Anyway, very good job, Roger. I will take a look on screenio.* to get ideas for tests. I suppose function keys (F1, F2, ... ESC, arrows) will come further. Do we need to open a new post for function keys . Very Best Regars Bear ---------------------------------------------------------------- F-Keys are reported if the CRT STATUS is defined (as said in previous post). I am looking at defining internal fields when (CRT STATUS and/or CURSOR are not defined) if it can be determined that, in this compilation unit, that some screen I/O is done. Re: Loading with space, I will check what happens with MF. HOME/END, Yep, coming! (As is the cursor manipulation between lines for SCREEN) Thanks once again for this super support. Roger ---------------------------------------------------------------- Thank your Roger. I think I'going to learn something with CRT STATUS. Because I never used it before. My skeleton of ACCEPT is : [code] accept accept_field ... on exception exception_field *> exception value like ESC goes directly into this integer not on exception continue end-accept . *> Here we are out from the accept statement, so we can test different values of exception_field evaluate ... end-evaluate [/code] With this syntax, no need of special-names . IF THERE IS ANOTHER WAY TO MANAGE THIS, I WILL ADOPT IT. Best regards Bear ---------------------------------------------------------------- OK. New tarball up. Back space looks like it works. At least it does what MF does. HOME/END keys work. INS/DEL character will have to wait until the weekend. If the user has not defined an explicit CRT STATUS item, then an item with name COB-CRT-STATUS will be generated. This can be tested for non-zero after an ACCEPT. Zero is normal return. Values 1001 to 1064 correspond to function keys 1 to 64. Currently only 0 and the above values are possible. However other values may possibly be implemented. The strange 1nnn codes are mandated by the standard. The standard defines the status as a 4 digit conceptual entity. 0000 is successful return, 1xxx are function keys, 2xxx are context-dependent keys, 8000 and 8001 are field entry failues and 9xxx are implementor-defined conditions. [NOT] ON EXCEPTION is implemented for ACCEPT. An exception is defined as a non-zero crt status. I am not sure what you mean about PROMPT. That has nothing to do with field contents. Have fun. Roger ---------------------------------------------------------------- Well Roger, you told me to have fun. So I wrote this funny program to test CRT STATUS & others ... I tested it in gnome terminal environment, and as you can imagine, F1 opens terminal help and pressing ESC, F11 or F9 gives same kind of behaviour. [code] identification division. program-id. ROGERS. *> *> Specially Built For Accept Statement Playing ;-D *> environment division. configuration section. source-computer. Debian-Etch. object-computer. Debian-Etch. data division. working-storage section. 01 w pic X(001). 01 funkey pic 9(04). procedure division. debut. display "TESTING Function Keys" *> I'm not shure that this text is really line 03 columns 33 with *> displayed at the right line/col position foreground-color 1 background-color 7 blank screen end-display . perform until w = "Q" or "q" display "Enter something : " line 10 col 32 with erase eos foreground-color 1 background-color 7 end-display accept w line 10 column 50 with foreground-color 2 background-color 7 prompt reverse-video auto on exception perform except-key not on exception perform normal-key end-accept end-perform go to fin. . except-key. move COB-CRT-STATUS to funkey *> Special word display "Exception Key = " line 12 column 30 end-display display funkey line 12 col 46 with foreground-color 7 background-color 4 highlight end-display call "C$SLEEP" using "1" . normal-key. move COB-CRT-STATUS to funkey display "Normal Key = " line 12 column 30 end-display display funkey line 12 col 43 with foreground-color 7 background-color 2 highlight end-display call "C$SLEEP" using "1" . fin. display "GAME OVER !" line 24 column 38 with foreground-color 7 background-color 4 highlight bell BLANK LINE end-display call "C$SLEEP" using "1" . ultime. exit program. [/code] I have noticed that Up/Down arrows & PgUp/Down are not detected as exception key. I tried to play with PuTTy, or Eric's Telnet98 (a fine emulator) with $TERM=ansi. I had some problems in both cases. I hope you'll play with this little OC toy. I had fun Best regards Bear ---------------------------------------------------------------- Up/Down arrows have no meaning for a single field accept. They will be necessary when I code up for the real SCREEN section ACCEPT. PgUp/Down will never be interpreted They have no meaning currently. We could conceivably map these to context-dependent input and use the "2xxx" status return. However, that is for much later. PuTTy works fine going to Linux if you set the PuTTy keyboard to "linux" and set TERM to "linux". Roger ---------------------------------------------------------------- Thank You Roger for informations about PuTTy context. Just to tell you if Up/Down arrows have no meaning for a single accept it is helpful inside a SEQUENCE of single accepts, particularly to go back/next to the previous/next (single) accept. So making them available will be nicer. Do we have access to the ESC ? Very Best Regards Bear ---------------------------------------------------------------- I think we can map unusual keys to a 2xxx status depending on an environment variable. Otherwise, anything that is not meaningful should be "beeped". ESC is somewhat special in curses history and in all termio. It usually signifies the start of a control sequence. To do this curses sets a timeout when the first character is ESC (Dependent on the curses initialization). So, generally speaking as regards Cobol, no you will never get an ESC. Roger ---------------------------------------------------------------- Bumping an old post to post questions about extended display / accept: [quote]OpenCOBOL-FAQ: External variables that influence screen handling include COB_SCREEN_EXCEPTIONS=Y To enable exceptions during ACCEPT. COB_SCREEN_ESCAPE=Y To enable handling of the escape key. [/quote] These must be set at compile time, right? If I do a accept with foreground-color, it always gets positioned at 0101 and the screen is blanked before. Therefore the following do not work as expected (Should it?): The first two display lines are missing. [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. 'TESTCRT'. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. CRT STATUS IS CRT-STATUS DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. * WORKING-STORAGE SECTION. * 77 mychar pic x. 77 crt-status pic 9(04). copy screenio. *----------------------------------------------------------------- LINKAGE SECTION. *----------------------------------------------------------------- PROCEDURE DIVISION. declaratives. end declaratives. *----------------------------------------------------------------- main section. 00. display "This is my interesting text" end-display display "The next one is very important and therefore, " "colored" end-display display "All fine" with foreground-color cob-color-green end-display accept mychar with foreground-color cob-color-red end-accept display crt-status end-display accept mychar end-accept * stop run * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program TESTCRT --------------------------------------[/code] Is there a way to get shortcuts like CTRL+H? Does somebody has a link to a newer draft? human ---------------------------------------------------------------- There would be a way for shortcuts with S-Lang. ;) It has support for keymaps and code hooks. I'm not sure if Warren's uber powerful cobcurses project supports hooked key maps or not. Cheers, Brian ---------------------------------------------------------------- If we could kick ncurses at all (dependency) and get these things, this could be nice. This could be a target for OC 1.2, if Roger accepts it and someone codes it. human ---------------------------------------------------------------- Subject: String lengths Why does [code]display length of "£"[/code] output "2"? I'm guessing it's a character-set encoding thing - is "£" not in standard 8-bit ASCII? This code doesn't work either - similar issue? [code] IDENTIFICATION DIVISION. PROGRAM-ID. test. DATA DIVISION. WORKING-STORAGE SECTION. 01 wv-variables. 03 field1 pic x(10). PROCEDURE DIVISION. a01-control SECTION. move '£10.00' to field1 display field1 inspect field1 replacing all "£" by "$" display field1 stop run . [/code] ---------------------------------------------------------------- Looks like you have a locale problem. The pound character is certainly present in the ISO 8 bit character sets. On my boxen, I use ISO encoding and not UTF. Here (after inserting the DISPLAY LENGTH), I get - roglinux:~ # ./pound 1 £10.00 $10.00 Roger ---------------------------------------------------------------- Subject: another file question Hello. Is there a way to connect a file to stdin for reading and another file for writing as stdout? I took a look at cob_file_open() and it doesn't appear that I can. This isn't a must have of course, but it would be nice to be able to do it. ---------------------------------------------------------------- Yes. We have the MF syntax for this - SELECT mystdin ASSIGN TO KEYBOARD. SELECT mystdout ASSIGN TO DISPLAY. The file type is automatically set to LINE SEQUENTIAL so you do not need to specify this. Roger ---------------------------------------------------------------- Subject: SOURCE FORMAT IS FREE - howto? Hello, How exactly (if still supported) is the [code] SOURCE FORMAT IS FREE [/code] directive used? I found a NEWS entry stating [code] >>SOURCE FORMAT IS FREE [/code] but that doesn't seem to work. And I'm a little lost reading through ppparse sources. Is DIRECTIVE a literal or a replacement? I've not been playing with 1.0 for awhile, but I think I had the same problem as I'm having with 1.1 Thanks Brian Tiffin ---------------------------------------------------------------- Do you mean the compiler option? [code] > cobc -h Usage: cobc [options] file... Options: --help Display this message --version, -V Display compiler version -v Display the programs invoked by the compiler -x Build an executable program -m Build a dynamically loadable module (default) -std= Compile for a specific dialect : cobol2002 Cobol 2002 cobol85 Cobol 85 ibm IBM Compatible mvs MVS Compatible bs2000 BS2000 Compatible mf Micro Focus Compatible default When not specified See config/default.conf and config/*.conf -free Use free source format -fixed Use fixed source format (default) -O, -O2, -Os Enable optimization -g Produce debugging information in the output -debug Enable all run-time error checking -o Place the output into -b Combine all input files into a single dynamically loadable module -E Preprocess only; do not compile, assemble or link -C Translation only; convert COBOL to C -S Compile only; output assembly file -c Compile and assemble, but do not link -t Generate and place a program listing into -I Add to copybook search path -L Add to library search path -l Link the library -D Pass to the C compiler -conf= User defined dialect configuration - See -std= --list-reserved Display all reserved words -save-temps Do not delete intermediate files -MT Set target file used in dependency list -MF Place dependency list into -ext Add default file extension -Wall Enable all warnings -Wobsolete Warn if obsolete features are used -Warchaic Warn if archaic features are used -Wcolumn-overflow Warn any text after column 72 -Wredefinition Warn redefinition of data items -Wconstant Warn inconsistent constant -Wparentheses Warn lacks of parentheses around AND within OR -Wterminator Warn lacks of scope terminator (END-XXX) -Wstrict-typing Warn type mismatch strictly -Wcall-params Warn non 01/77 items for CALL params (NOT set with -Wall) -Wtruncate Warn possible field truncation (NOT set with -Wall) -ftrace Include trace code in the output -fsyntax-only Syntax error checking only; don't emit any output -fstatic-call Output static function calls for the CALL statement -fdebugging-line Enable debugging lines -fsource-location Include source location in the output -fimplicit-init Do automatic initialization of the Cobol runtime system -fline-directive Include line directive in the output -fstatic-linkage Statically allocate non-USING LINKAGE parameters -fsign-ascii Numeric display sign ASCII (Default on ASCII machines) -fsign-ebcdic Numeric display sign EBCDIC (Default on EBCDIC machines) -fstack-check PERFORM stack checking (Turned on by -debug or -g) -fnotrunc Do not truncate binary fields according to PIC (ala MF) [/code] Set either of these (-fixed is default)... [code] -free Use free source format -fixed Use fixed source format (default) [/code] Example: [code] > cobc -x -free test.cbl [/code] Sorry, if that's not what you meant... ---------------------------------------------------------------- Thanks, but no. I'm up on -free but I've been following hints that there is a directive possible in the sources. NEWS entry (from 0.20) in the 1.1 tarball. And the ppparse files seem to have the strings. I've been mixing old fixed format files and the new free but I'd prefer to leave the directive in the source file, than have to look to see if -free is needed. Again, thanks. Brian Tiffin ---------------------------------------------------------------- Aaah yes, this source switching is somewhat tricky. Theoretically it should work. However there are practical details. Let me review this. Note there are certain conditions that must be met for the source to switch between modes. Roger ---------------------------------------------------------------- OK. Try the current 1.1 tarball. So, if you want to switch to free-format without specifying the compile time option, then you can insert as the first line - >>SOURCE FORMAT IS FREE Note that the first '>' must begin at column 8 or greater. Roger ---------------------------------------------------------------- Tada! Yeah, I had tried column 1, 2, 7, 8, 12. And now it works quite nicely. Thanks Roger. [i]Long live OpenCOBOL[/i] ---------------------------------------------------------------- Subject: Installation error on Solaris 10 x86 Hi! I have a machine with Solaris 10 5/08 installed, and I'm trying to install OpenCOBOL. I've compiled the libgmp as described on the GMP home page, then installed ncurses 5.6 from sunfreeware (package format), then libtool 1.5.24 from sunfreeware (package format too), and then db 4.4.2, from sunfreeware too. Then I've added the /usr/sfw/bin, /usr/local/bin and /usr/local/BerkeleyDB.4.4/bin to the PATH variable of the root user. Then I've added /usr/sfw/lib, /usr/local/lib, and /usr/local/BerkleyDB.4.4/lib to the LD_LIBRARY_PATH variable. I've linked /usr/sfw/bin/gmake to /usr/sfw/bin/make, /usr/sfw/bin/gld to /usr/sfw/bin/ld, /usr/sfw/bin/gar to /usr/sfw/bin/ar, and /usr/sfw/bin/gm4 to /usr/sfw/bin/m4. Then, uncompressed the open-cobol-1.0.tar.gz, untared it, and executed ./configure. After this, when trying to execute "make", I receive this error: if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -march=i686 -mtune=pentium3 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF ".deps/libcob_la-fileio.Tpo" -c -o libcob_la-fileio.lo `test -f 'fileio.c' || echo './'`fileio.c; \ then mv -f ".deps/libcob_la-fileio.Tpo" ".deps/libcob_la-fileio.Plo"; else rm -f ".deps/libcob_la-fileio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -march=i686 -mtune=pentium3 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF .deps/libcob_la-fileio.Tpo -c fileio.c -fPIC -DPIC -o .libs/libcob_la-fileio.o fileio.c:308: error: syntax error before "DB" fileio.c:308: warning: no semicolon at end of struct or union fileio.c:309: warning: type defaults to `int' in declaration of `key' fileio.c:309: warning: data definition has no type or storage class fileio.c:310: error: syntax error before "data" fileio.c:310: warning: type defaults to `int' in declaration of `data' fileio.c:310: warning: data definition has no type or storage class ... Does anybody something about some differences we must consider when installing OpenCOBOL in Solaris 10 5/08, for the x86 platform? Thanks a lot in advance for your attention!!! HeCSa. ---------------------------------------------------------------- You forgot the include paths. What you are doing seems enormously complicated. I would get gmp, ncurses and BDB installed directly under /usr then you will not have any problems. Roger ---------------------------------------------------------------- Subject: Questions from a volunteer tech writer Hello, I've opened this thread hoping to encapsulate some of the questions I'm having before I commit pen to paper to try and help write up some usage docs for OC1.0 and 1.1. This may take awhile, as I'm rusty and easily confused. ;) As I hope to cover quite a few issues (eventually), I'll try and tag each question so we don't have to chase numbers through the thread. It is also the intent to save time for the friendly OpenCOBOL dev team, not make work, so feel free to ignore, flame or fill in details as time permits. C$SLEEP: C$SLEEP. In seconds? Really? Not nano, micro or even milli? I tried changing the common.c sources to usleep (and the range limit; one week's worth of seconds), which works on my Debian 4 box, but that doesn't seem to be the intent for OpenCOBOL. So I thought I'd ask. I'm not sure if you have plans for a CBL_THREAD_SLEEP etc. [i]For Windows Sleep() compatibility; even a millisecond resolution would be nicer imho[/i]. Cheers, Brian ---------------------------------------------------------------- No, we cannot do that. The system routines (as defined in libcob/system.def) are basically split into two categories. Those that begin "CBL_" are from Microfocus syntax. Those that begin "C$" are ACU syntax. All of these have predefined usage and therefore may not be changed. We could set up some CBL_OC_xxx routines if required. Regarding sub-second sleeping - Here we could use nanosleep which is Posix conform unlike usleep. (And it is available under Win). Roger ---------------------------------------------------------------- Thank you sir. Now I know. And with the hint, I know a little more about where to look. Seconds it is then. And yes, I figure OpenCOBOL deserves its own flavour of extensions. But ... not to make work or anything. Cheers Roger, Brian P.S. Thanks for the SOURCE FORMAT IS fix, nice. ---------------------------------------------------------------- If I'm right C$SLEEP has also the ability of shorter times than a second:[code]CALL "C$SLEEP" USING 0.85[/code] should work, too. Is this possible with OC? ---------------------------------------------------------------- Hmm, from current ACU doc - --------- Parameter NUM-SEC Numeric or alphanumeric parameter The number of seconds to sleep. This parameter is a an unsigned fixed-point numeric parameter, or an alphanumeric data item containing an unsigned fixed-point number. --------- Whatever that is supposed to mean. Roger ---------------------------------------------------------------- I think this means, that all this should work (tested as working for ACU): [code]... SPECIAL-NAMES. DECIMAL-POINT IS COMMA. ... 77 mynvar1 pic 9 value 1. 77 mynvar2 pic 9v99 value 0,85. 77 mystrvar pic x(03) value "0.9". ... CALL "C$SLEEP" USING 0,85 CALL "C$SLEEP" USING "0.25" CALL "C$SLEEP" USING mynvar1 CALL "C$SLEEP" USING mynvar2 CALL "C$SLEEP" USING mystrvar[/code] Concerning ACU using [code] CALL "C$SLEEP" USING "0,25"[/code] seems to wait for ever, but this is a bug for me (no need to implement ACU-Bugs into OC...) How long does OC (current tarball) wait if we use these calls? ---------------------------------------------------------------- Well, without a DECIMAL POINT clause presence in SPECIAL-NAMES,it will not compile :-) However, OC gives (seconds), in the order of the sleeps, - 0 0 1 0 0 To be expected as OC only picks up the integer part. Roger ---------------------------------------------------------------- Should I make a new point on the wishlist: "pick up the whole number when using C$SLEEP"? ---------------------------------------------------------------- Nope, why worry about a broken and ill-defined interface. Lets do something like CBL_OC_SLEEP and use the Posix defined nanosleep. Just need to define the paramters for this. eg. 2 params; secs and nanosecs (<= 999999999) or 1 param with huge nanosecs. Roger ---------------------------------------------------------------- Hm, worry about C$SLEEP bacause if 0.85 is written and 0 seconds are waited is a little bit hard. What about implementing at least 1 decimal for C$SLEEP (for the old sources) and writing a new CBL_OC_SLEEP for the new written programs. Again: Should I post about these points in wishlist or could they stay here? ---------------------------------------------------------------- @human; I can't speak for Roger, but this conversation will definitely help with my side-plans of updating the open-cobol.texi file. Although it may get buried in other issues, so there is that angle. New tag CBL_ERROR_PROC: The docs I've read about CBL_ERROR_PROC state that setting RETURN-CODE to zero in the error procedure will disable all other error handlers (including RTS). I still get libcob: err-msg coming out at the end of a run, with MOVE 0 TO RETURN-CODE or with MOVE 1 TO RETURN-CODE. Design intent? Me not gettin' it? New tag DIVIDE-BY-ZERO: And as a side issue when sampling the CBL_ERROR_PROC, I was trying DIVIDE 10 BY 0 GIVING VAL. I'm not getting a run time error. (And thinking maybe the compiler was optimizing something away, tried with DIVIDE 10 BY DIVISOR GIVING VAL. with various ways of getting DIVISOR set to zero. All tests simply set VAL to 0. Again, is this me not gettin' it? New tag SAMPLE-PREFERENCE: How would you like sample programs bundled? In the open-cobol.texi and/or somewhere else? (Hoping that part of the answer has something to do with downloadable files off of opencobol.org - perhaps in the wiki section? Along with at least snippets in the info file?) Side issue with SAMPLE-PREFERENCE; And this is for everyone's opinion please. FIXED or FREE form source code? A combination of both? And should they be complete sources or would snippets suffice. (My prefs; BOTH forms (most FREE, some FIXED, one or two in both just to show the difference) and complete samples; perhaps with snippets in the info file for brevity). Cheers, Brian P.S. I'm liking OpenCOBOL more and more every minute. And I do hope to have a baby-steps version of an open-cobol.texi with a couple of library calls documented to show the OpenCOBOL project team shortly. The rust is flaking off now but the easily confused part is probably permanent. :) P.P.S For everyone; If you know anything that could help me figure this stuff out, go ahead and respond. Part of the objective is to free time for Roger's developments, not slow him down dealing with some chatty newb. ---------------------------------------------------------------- CBL_ERROR_PROC - Design intent. RETURN-CODE is a local (program) variable in OC. Actually I am not sure that MF does the correct thing in all instances here. Divide by zero - Why should you get a runtime error? The standard states that dividing by zero should raise an exception and, indeed, this is what happens. If you do not code an ON SIZE ERROR clause, then that is your problem :-) Preferences - We can put complete examples in a seperate "examples" or "samples" directory in the release. Regarding FREE/FIXED - Generally, if not specifically showing/demonstrating a particular feature of the format (eg. fixed line continuation, etc.) then complete programs should be compilable with both. This means restricting comments to whole line using a "*>" construct with the asterisk in column 7. Also, of course, no other use of the indicator column. Roger ---------------------------------------------------------------- CBL_ERROR_PROC; Thanks. Understood. DIVIDE-BY-ZERO; Ok, so maybe all the rust hasn't flaked off. :) I'll read up more. Sample-prefs; Cool. Will do. Cheers, Brian ---------------------------------------------------------------- :-) Sample-prefs - Note that, for complete programs, you can force the format (compatibly) with the ">>SOURCE FORMAT IS FREE/FIXED" beginning at column 8 as the first line in sources. (Note the word FORMAT and/or IS) are optional as per standard) Note you can also change within the source from one to the other (once again as per standard). Roger ---------------------------------------------------------------- Yep; thanks for that fix Roger. All my freeform OC source starts with >>SOURCE FORMAT IS FREE. (I just had it commented out until your recent tarball.) Changing within the source is definitely something I'll play with today. My last professional COBOL gig was in 1983. It all seems so new-fangled now. :) Happy. Cheers ---------------------------------------------------------------- Yea, :-) 85 standard is fairly OK. And we are in good shape with OC regarding this. I add in 2002 features as deemed necessary/appropiate/possible. Re SOURCE FORMAT changing within source - Yep, that should be OK. I tested it. Easiest way to code this is to put the ">>SOURCE ..." at column 8 REGARDLESS of what format you are currently in. Roger ---------------------------------------------------------------- ... so the beat goes on ... What about having a new CBL_OC_SLEEP with nanoseconds (should this really work on all machines?) and if there is a C$SLEEP found by the compiler just do a "sleep_acu_to_oc" where the given parameter is recalculated as nanoseconds and call CBL_OC_SLEEP? ---------------------------------------------------------------- Sure, but what shoud be the param(s) No probs to implement. Roger ---------------------------------------------------------------- C$SLEEP; @human; Most OS's will support nanosleep, but few architectures will offer true 1/10^9th timer resolution. So, I think (I'm just offering my opinion now) it would be nice to leave C$SLEEP in whole seconds and a new CBL_OC_NANOSLEEP call that accepts a single nanosecond argument. And either through an idiom (or preferably) Roger ;) sets, at run-time, a constant that holds the lowest supported timer resolution for the current machine. Roger; again only opining. The new CBL_OC_SLEEP (I'd call it _NANOSLEEP - just because), takes a single nanoseconds argument and if you feel up to it, support for the "after exception or interrupt" time remaining field as a flag that the POSIX nanosleep takes as its second NULL or timespec pointer field. I can't see needing super and sub seconds in the same call. For longer pauses, use C$SLEEP and a one second resolution. For subsecond pauses, use the new call with (usually) a nanoseconds count under 1000000000, but with a potential range of 4.2 (or 2.1) full seconds and sub range. Hmm, or go full out and accept both the sec and nsec on the actual call and let the new call cover both. Hmm. But, I think I'll still offer the opinion of single nanosecond param with the sec field of the timespec set to zero, and no remaining time flag at all. Fully rounded out with a magic SUPPORTED-TIMER-RESOLUTION (or some such COBOL standard naming) manifest or runtime constant. Cheers ---------------------------------------------------------------- CBL_NANOSLEEP it is then. One param - identifier/numeric literal specifying the number of nans to sleep (<= 999999999) As the nanosleep is Posix standard, there should not be any problems using this; however, I suppose I should check for this in configure. Roger ---------------------------------------------------------------- So CBL_NANOSLEEP can be called when less than a second is needed. Could OC devide the given params of C$SLEEP to full seconds=old processing and the rest to CBL_NANOSLEEP? With that processing we would have fully implemented C$SLEEP and a nice extension with CBL_NANOSLEEP. As I said before: there are problems if C$SLEEP using 0.4 waits 0 seconds and the program really need to wait. ---------------------------------------------------------------- No, the C$SLEEP was implemented as is because of customer request. It is in production. "Never change a working system" :-) You can be very sure that that the OC system interfaces (libcob/system.def) will not change. Roger ---------------------------------------------------------------- New tag CBL_EXIT_PROC: From scanning, it looks like the CBL_EXIT_PROC call only takes the install-control-flag and a procedure-pointer. Not the install-params structure subfielded by procedure-pointer and priority. Correct? Or, more to the point, it will accept the structure, but the priority is ignored, even on the install-control-flag value of 3? And the flag 2 "Query prio" feature is not supported? Not complaining, just asking as I write up a code sample. [b]Associated Bug Report[/b]; In common.c, CBL_EXIT_PROC, the COB_CHK_PARMS is called with CBL_ERROR_PROC instead of CBL_EXIT_PROC. Masked problem as they both accept 2. On C$SLEEP. Naming the NANOSLEEP, I didn't mean to suggest CBL_NANOSLEEP (I was lazy typing), I was thinking CBL_OC_NANOSLEEP, to allow for an entire class of CBL_OC_ extensions. Because I know you'll be giving us all kinds of goodies in the future. ;) But, as always, it's your call in the end. Cheers, Brian ---------------------------------------------------------------- Re #1. Correct. Re. Bug. - Good catch. Of course no amount of testing would pick this up. Corrected and tarball updated. Re. nano. OK. CBL_OC_NANOSLEEP it is. (Will post when something is there) Roger ---------------------------------------------------------------- Roger; I don't think you've made an official announcement yet (not that I've seen), but call "CBL_OC_NANOSLEEP" using "4000000000" end-call. works great! So does using "500" & "000000" (half-second), and 5000000000 (five seconds, which is a larger range than I was expecting). Nifty. Using the & compiler string catenation is going to come in handy for readability. Cheers ---------------------------------------------------------------- New tag; Debug Roger, what do D indicator lines allow? New tag; SELECT ASSIGN With something like [code] SELECT OUTFILE ASSIGN to DDNAME [/code] What the options for DDNAME? Can this be set from the environment from bash? Or does the DDNAME identifier need to be explicitly set from COBOL? I'm asking as the code will compile without DDNAME in a data division, but testing it, I can't get an [b]export DDNAME=file[/b] to work. Thanks, Brian ---------------------------------------------------------------- To Debug: If you put a D in column 7 OC handles this as a comment. These lines are only compiled if you run cobc with -fdebugging-line. By using this you can put some test messages etc. into your program that are only used if necessary (and therefore build with -fdebugging-line). ---------------------------------------------------------------- Debug; Thanks human. That answer will fit nicely in the FAQ. Cheers, Brian ---------------------------------------------------------------- Debug - Note this ONLY applies to fixed-format. There really is not an equivalent in free-format (at least not according to the standard). SELECT/ASSIGN - When this is an implicit/explicit identifier (as in your example), then it refers to either - a) implicit (ie. not defined as an item in the program) - An implicitly defined alphanumeric field with this name of length 1024. b) explicit (ie. you have a definition of this item) Exceptions - When identifier is either KEYBOARD or DISPLAY, then the file is automatically connected to stdin/stdout respectively. This is what MF does. When the ASSIGN is a literal (eg. "MYFILE"), then file name substitution may take place. Firstly, the environment is checked for variables of the form DD_MYFILE, dd_MYFILE or MYFILE (in this order). If it finds any of these then this value is substituted. Otherwise, the filename is as quoted, but may be further altered by the presence of the COB_FILE_PATH variable which can define a default directory for files that do not have an absolute path. Also what MF does. We also support use of environment variables within literal names (eg. ASSIGN "$MYDIR/myfile") Roger ---------------------------------------------------------------- Subject: PROMPT / UPDATE in ACCEPT Hello Roger, I opened another topic in relation with ACCEPT statement and this follows our conversation about "ring my bell ...". Here is my worldwide known FIELDS.CBL program ;-D [code] identification division. program-id. FIELDS. *> *> This program was written in order to test *> the ACCEPT statement in color environment *> + other features. *> Strategic lines are commented. *> data division. working-storage section. 77 I pic 99. 77 J pic 99. 77 L pic 99. 77 w pic X(010). procedure division. begin. *> --------------- Check #1------------------ perform varying I from 0 by 1 until I > 7 display "The PROMPT / UPDATE TEST" line 01 column 25 with foreground-color I background-color I HIGHLIGHT BLANK SCREEN end-display *> ----------------------- End of #1 -------------- *> --------------- Check #2 --------------- perform varying J from 0 by 1 until J > 7 add 4 J giving L evaluate J when 7 move "Last Line" to w *> Filling the field before accept "update" when other continue end-evaluate if w = spaces display "SPACES" line L column 01 with foreground-color J background-color I highlight end-display else display w line L column 01 with foreground-color J background-color I highlight end-display end-if evaluate J when 7 accept w line L column 15 with *> 'Last Line' must appear in the field foreground-color J *> Corrections must be allowed at least background-color I *> with backspace highlight *> update *> reverse-video *> Works Fine & Really reverses the video end-accept when other accept w line L column 15 with *> field w must contain characters foreground-color J *> of the sequence typed or background-color I *> space if nothing has been entered highlight *> At least backspace must be allowed prompt auto secure *> end-accept *> end-evaluate display w line L column 30 with *> I display to what I entered foreground-color J *> background-color I *> highlight *> bell *> this is only for making "music" :-) end-display end-perform end-perform . fin. exit program. *> ---------------- end of everything ----- [/code] First of all in #1 text is displayed at line 1 column 1 instead of line 1 & col 25. Second point the update feature which is fine but not the prompt. The prompt has incidence of the whole receiving field. So I slightly modified the program in order to display the field BEFORE and AFTER the accept. I Seems to act like update : Try to enter 'ABCDEFG' then 123 on the next accept, and you'll have 123DEFG instead of 123 . This must work like a "TO" parameter in screen section, and not like "using". This has been said, if just ENTER is pressed during the accept with prompt, it means that "nothing" has been sent to the receiving field and this field is erased. Don't You think So, Master ? Very Best Regards Bear PS In update, when "end" is typed, I must strike twice on backspace to activate. ---------------------------------------------------------------- Hmm. For #1 - The doc for MF states that the order for execution is (DISPLAY) : 1) The AT phrase 2) The BLANK phrase 3) The BELL phrase 4) The rest of the DISPLAY operation It states for the BLANK phrase - (excerpt) - All the screen is cleared and the cursor is placed at line 1 column 1. Therefore, according to the doc, we do the right thing. However, MF SE appears not to do this. It displays the field at col 25. Even stranger, MF changes the FG/BG only from beginning of line to end of field. Not sure what is right/wrong here. The doc or the software. For #2 - No, this is working as designed and is exactly what MF does. For #3 - I think this is correct. The first BS "opens up" the last character. Compare with no AUTO phrase. Roger ---------------------------------------------------------------- Hello Roger, First of all thank you for quick answer ! On #1, I will do my best. I tested with ACU and results are rigmarol ! I think that OC is right. For #2, with ACU, results are not what MF does. So I have to do with. For #3, I have other results but I work with ACU, so ... If the field is edited like most editors do (using DEL ..) this will not be a real problem. For some exception key you told something interesting about the use of an environment variable in order to get values. I must say this may be the real solution to access at Up/Down arrow, Up/Down page, ..., because it gives to the programmer possibilities when he needs. I use them (in ACU :-)) Best regards Bear ---------------------------------------------------------------- For #1 - I have decided that MF is inconsistent here. I will do the (re)positioning after the BLANK SCREEN. So, your example will correctly display at col 25. For #2 - I am still trying to work out all the intricacies here :-) There are some subtle interactions with PROMPT/SECURE/UPDATE. Not least of all as they change meaning dependent on whether or not the ACCEPT'ed item is in the SCREEN section :-( For exception keys - Working on something now :-) I will also (time permitting) provide a copy proc in the "copy" directory defining the exceptions; something like - 78 COB-SCR-OK VALUE 0. 78 COB-SCR-F1 VALUE 1001. 78 COB-SCR-F2 VALUE 1002. ... 78 COB-SCR-F64 VALUE 1064 78 COB-SCR-PAGE-UP VALUE 2001. 78 COB-SCR-PAGE-DOWN VALUE 2002. etc. I have yet to decide the 2xxx values. Roger ---------------------------------------------------------------- For #1 - I agree with you (2,500 % !) For #2 - I'm anxious to see the next tarball ! I think that there must be some place between 0 & 2999 to set someting like x027 :-D Respect ... Bear ---------------------------------------------------------------- Tarball is up. #1 fixed as said. #2 Proof of concept - For extended exceptions - Set/export COB_SCREEN_EXCEPTIONS=Y This activates the 2xxx exception codes. In copy/screenio.cpy there are the currently defined exception codes. (Current extended 2xxx exceptions - Pg Up/Down, Curs Up/Down) These can be extended as required. When time allows, I will go through the curses keys and see what else can/should be added. Roger ---------------------------------------------------------------- Roger, This is wonderful ! I set COB_SCREEN_EXCEPTIONS=Y into my /etc/profile and tested with success. The only thing I'm sitting on is the ESC key. How can I get the information through the accept that ESC key has been pressed ? Do I need to change my tests, and replace ESC by something else ? Best Regards Bear ---------------------------------------------------------------- Well, it is a bit unusual to use the ESC key. The reason, as I said, is that it can be the start of a sequence. So curses starts an internal timer when it sees the ESC so as to determine if it is the start of a sequence. We can theoretically check for ESC. Let me test it. Note that anyway there will be a perceptible delay between pressing the ESC and getting the reaction. (Shades of vi) Incidentally, I am not sure what Linux variant you are using but it is not usual to edit /etc/profile. Normally one edits (or creates if not there) /etc/profile.local. Check if your /etc/profile sources /etc/profile.local. If so put your preferences in /etc/profile.local because this will never be overwritten by a system update whereas /etc/profile maybe. Roger ---------------------------------------------------------------- Roger, Thank you for all the tips and tricks. My Linux is Debian Etch. I think that yours may be SUSE. Finally I reported all variables COB_ and DB_HOME in my home directory in .bashrc and I made a copy into .bashrc_save . Concerning ESC I will let you a bit time to test. I promise I won't bother you till the next time ... ;-D Best regards Bear ---------------------------------------------------------------- Re. bash - OK. Check /etc/bash.bashrc.local. It should be sourced from /etc/bash.bashrc. Re. ESC - Aside from the delay (1 sec with ncurses), I am getting false positives dependent on the emulator from certain keys. Professional emulator like SecureCRT are more or less OK (but not 100%). Putty is particularly bad (depending on which keypad is loaded). I am inclining to not do this. Can you use eg. F12 instead of ESC? Roger ---------------------------------------------------------------- Ok for F12 until something better can be found for ESC. This will enable me going forward. Just tell me what would be the theorical value of ESC in screenio.cpy : 1027 or 2027 ? Thank you for bash tips... You did great job Roger, thank you again. Bear ---------------------------------------------------------------- Well, at the moment I have it at 2005 being the next number :-) Roger ---------------------------------------------------------------- Well we find it on next tarball in copy ? Mine is : cobc (OpenCOBOL) 1.1.0 Build date Jun 25 2008 11:14:39 Copyright (C) 2001-2008 Keisuke Nishida / Roger While [code] *> Exception keys 78 COB-SCR-PAGE_UP VALUE 2001. 78 COB-SCR-PAGE_DOWN VALUE 2002. 78 COB-SCR-KEY-UP VALUE 2003. 78 COB-SCR-KEY-DOWN VALUE 2004. [/code] According to the wonderful job you have done, can I begin testing the screen section ? Very best regards Bear ---------------------------------------------------------------- He-he :-) The 2005 is only in my dev environment. Sure, test SCREEN SECTION. What will not work is any form of positioning (other than what you have with field accepts), although TAB should work. Note that all this screen I/O stuff only currently works with alphanumeric (PIC X) fields. Do not expect for 1.1 release anything else :-) (I know what has to be done and I have the roadmap) Roger ---------------------------------------------------------------- Should I presume from this, that right justified numeric input is a long way off (think Micro Focus Adisctrl) Jack ---------------------------------------------------------------- Subject: INSTALLING PROBLEM ? on screenio.c Yep, OK. Noted and will fix in next tarball. Note this does not in any way affect OC processing. Roger ---------------------------------------------------------------- Hello, I had this warning during 'make' process : just to report. screenio.c: In function 'cob_check_pos_status': screenio.c:290: warning: pointer targets in passing argument 1 of 'sprintf' differ in signedness screenio.c:305: warning: pointer targets in passing argument 1 of 'sprintf' differ in signedness screenio.c:309: warning: pointer targets in passing argument 1 of 'sprintf' differ in signedness Regards Bear ---------------------------------------------------------------- Subject: INSTALLING OPEN-COBOL PROGRAMS ON A SERVER Hello Worldwide What are the prerequisites to upload before installing my compiled programs on a server ? Thank you Bear ---------------------------------------------------------------- I'm still pretty new to the OC, but if you are using GNU/Linux, the ldd command shows the library dependencies for an executable. Using the beeper program you helped me with for example [code] $ ldd beeper linux-gate.so.1 => (0xffffe000) libcob.so.1 => /usr/local/lib/libcob.so.1 (0xb7f81000) libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb7f5c000) libgmp.so.3 => /usr/lib/libgmp.so.3 (0xb7f18000) libncurses.so.5 => /lib/libncurses.so.5 (0xb7ee7000) libdb-4.5.so => /usr/lib/libdb-4.5.so (0xb7dcd000) libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7c7f000) /lib/ld-linux.so.2 (0xb7fbf000) libdl.so.2 => /lib/i686/cmov/libdl.so.2 (0xb7c7b000) libpthread.so.0 => /lib/i686/cmov/libpthread.so.0 (0xb7c62000) [/code] So at least those libraries. There may be more. If you have Debian, the aptitude system will show the dependencies for the open-cobol 1.0 package. Windows equivs being [i]depends[/i] and/or [i]dumpbin[/i] Cheers, Brian ---------------------------------------------------------------- Very helpful informations Thank you Bear ---------------------------------------------------------------- Subject: LINE DRAWING Hello World, Has anybody a (good) idea for drawing vertical lines, horizontal, etc. This will change look and feel for boxes. In ACU a box is drawn by the display statement like [code] 012000 display BOX line 14 position 01 size 28 lines 04 left Title "BoxTitle" 003900 foreground-color 4 background-color 7 end-display [/code] Of course this is not standard, but it looks fine. After a week information in C langage I am trying to understand ncurses to provide a module doing this. [code] move 14 to box-line move 01 to box-position move 28 to box-size move 04 to box-height move 4 to box-fgcolor move 7 to box-bgcolor move "BoxTitle" to box-toptitle move "L" to box-topplace call "drawbox" using box-item on exception ... not on exception ... end-call [/code] Bear PS I have a lot of stupid ideas like that for windows, subwindows, etc... :-D ---------------------------------------------------------------- a) use ASCII Lines x'01' to x'06' b) use Cobcurses ---------------------------------------------------------------- a) I tried this : [code] identification division. program-id. TSTGPH. *> *> *> data division. working-storage section. 77 I pic 9. 77 L pic 99. 01 some. 02 some-01 pic X value X'01'. 02 some-02 pic X value X'02'. 02 some-03 pic X value X'03'. 02 some-04 pic X value X'04'. 02 some-05 pic X value X'05'. 02 some-06 pic X value X'06'. 01 some-r redefines some. 02 some-o pic X occurs 6. procedure division. debut. display "TESTING LINE DRAWING" line 01 column 30 with blank screen end-display perform varying I from 1 by 1 until I > 6 add 5 I giving L display I line L column 10 end-display display some-o (I) line L column 12 end-display call "C$SLEEP" using "1" end-perform . utlime. exit program. [/code] Results are ^A, ^B, etc b) I want only draw lines. Regards ---------------------------------------------------------------- Depending on the char table of your machine it may vary, but if You use the extended ascii (see http://www.asciitable.com/ for example) it could work. ---------------------------------------------------------------- Sorry, I had to be precise : cobc (OpenCOBOL) 1.1.0 Build date Jun 25 2008 11:14:39 Copyright (C) 2001-2008 Keisuke Nishida / Roger While Debian Etch $TERM=xterm / linux Regards ---------------------------------------------------------------- It's been a long time since I played with a VT and line drawing. Try ESC )0 or ESC (0 or ESC *0 or ESC +0 to set xterm G1, G2, G3 or G4 DEC special character set before the other codes. This always seemed like voodoo to me and very very terminal specific, but once figured, worked like a charm ... until the next time, then it all broke. :) Cheers Those are the character zero by the way. I think 'A' and 'B' do something too for British or American char sets. ---------------------------------------------------------------- Hello, Be sure I'm not going to rewrite terminfo in OC. Maybe I should ;-D ! I'm looking into C programs to create something, but I have the knowledge of a newbie. I'm studying ncurses (Dan Gookin's programmer's guide to ncurses). As you can see, when I talk about something I post an example to fix ideas. This forum is international, and people comes from Alaska, Japan, Spain, Canada, Argentina, France, and our master Roger maintains OC from Germany. For sure I forgot some other countries. My wish is that somebody can show me the way by posting a little C program (or a part of) to make my development more 'confortable'. In this post I'm not waiting help from Roger, who has a lot of things to do, and does it the best he can. I have great respect for him. I'm waiting for a "plug-in". If I'll write something in C that is functional, I will post it. Making a good toolbox will help OC to progress. Best regards Bear ---------------------------------------------------------------- Well, of course, we are now going into esoterics. I think, first of all, that we should concentrate on the Cobol language (including standard conformance) Nice idea, just not suited to what Cobol was/is. ACU designed their own interfaces targeted at the Win users. Which maybe explains why MF took over ACU :-) Roger ---------------------------------------------------------------- Correct Roger ! We should concentrate on the Cobol language. Just a parenthesis about ACU (which is now part of MF) In my job I develop with ACU on windows (because the compiler is installed there). Deployment is done on linux machines and users have generally putty emulator. I use 99.9 % characters windows (not graphical) and some of my machines ARE NOT RUNNING UNDER WINDOWS. All of my programs have F1-style-help and others to open windows, display lists, scroll up/down, etc. This is to explain my "deep attachment" ... ang why I wanted so much access to all kind of keys including escape. Regards Bear ---------------------------------------------------------------- Sure, I understand. With regard to ESC, sure, there is no problem in implementing it (I have it in my dev tree) BUT, what I am concerned about is the false positives resulting from emulators. Just an eg. - with Putty, as said, depending on loaded character set, we get (wrongly) ESC being pressed. In Putty, with default iso*1 this occurs. With iso*15 (which should get the euro symbol but doesn't) it occurs less. With win1252, I can get the euro symbol but other keys do not work and I get other false positives eg. with the Alt and/or AltGr key. In other words, I would not like to unconditionally do this. What I am thinking here is that users may be surprised by a false return. This maybe an exceptional case where we need yet another environment variable to define (only when extended status is defined). Acceptable? (COB_SCREEN_ESC=Y) (Only activated when also COB_SCREEN_EXCEPTIONS=Y) Roger ---------------------------------------------------------------- Acceptable Bear ---------------------------------------------------------------- Maybe it's better to read environment-vars for the interpreted sequence. With that it should be no problem if there's another emulation, you just have to define OC_KEY_ESC etc. with the right values. ---------------------------------------------------------------- Done. COB_SCREEN_ESC=Y with combination COB_SCREEN_EXCEPTIONS=Y will activate ESC. Up to you how this is interpreted. (Uptil now, I do not have a 100% interpretation of when/what provokes the ESC). However that is not my problem, that is emualtor/(n)(pd)curses problem. Tarball updated. Roger ---------------------------------------------------------------- Im testing new tarball cobc (OpenCOBOL) 1.1.0 Build date Jun 26 2008 18:15:13 Copyright (C) 2001-2008 Keisuke Nishida / Roger While Be careful when COB_SCREEN_ESC is not defined AND COB_SCREEN_EXCEPTION is defined it gives a segmentation error. As you said the ESC is slow, but acceptable. So I can define 88 Exit-Pressed 1012, 2005. ---------------------------------------------------------------- OK. Will check. Thanks Roger ---------------------------------------------------------------- Indeed, referencing a null pointer does not produce particularly good results :-( Fixed. Roger ---------------------------------------------------------------- Thank You, Roger As I told you, I'm playing with C and Ncurses. So I post my work so the community can have opinion and may use it. My first program TESTEG, written in OC calls CADRES, written in C and linked with ncurses. to compile TESTEG : cobc -x -free -I ../Copies -Wall $1.CBL where $1 represents TESTEG [code] identification division. program-id. TESTEG. *> *> caller for line drawing *> data division. working-storage section. 77 wl1 pic 99 comp-x. 77 wc1 pic 99 comp-x. 77 wl2 pic 99 comp-x. 77 wc2 pic 99 comp-x. 77 intro pic X. procedure division. debut. display "Testing box drawing" line 01 column 22 with foreground-color 1 background-color 7 blank screen end-display move 12 to wl1 move 10 to wc1 move 16 to wl2 move 70 to wc2 perform CADRES move 02 to wl1 move 30 to wc1 move 22 to wl2 move 40 to wc2 perform CADRES accept intro go to fin. . CADRES. call "CADRES" using wl1 wc1 wl2 wc2 on exception display "SOMETHING IS WRONG with CADRES" not on exception continue end-call . fin. ultime. exit program. [/code] I used comp-x, is there another format adapted.? The second program called CADRES is used in the same manner as if it was a OC_written dynamic module. cc -shared -o ../Library/$1.so -lncurses $1.c (with $1=CADRES) [code] /**************************************************************************** This program draws boxes according to the upper left coordinate L1,C1 and the lower right coordinate (L2,C2) of the "box". This program is written by a newbie so it is highly perfectible. It is a good illustration for what we can do with OC. ****************************************************************************/ #include void CADRES(int *ptr_L1,int *ptr_C1,int *ptr_L2,int *ptr_C2) { int L1=*ptr_L1; int C1=*ptr_C1; int L2=*ptr_L2; int C2=*ptr_C2; int l1, c1; int l2, c2; int i,j,imax,jmax ; imax=L2-L1; jmax=C2-C1; l1=L1-1; c1=C1-1; l2=L2-1; c2=C2-1; // initscr(); // No needed here because of BLANK SCREEN in the caller /* Corner localization according with values sent by Cobol */ move(l1,c1); addch(ACS_ULCORNER); move(l1,c2); addch(ACS_URCORNER); move(l2,c1); addch(ACS_LLCORNER); move(l2,c2); addch(ACS_LRCORNER); for (i=1;i ** Intentional error ** * won't get here. RTS error handler will stop run display "procedure division, following run-time error". display global-value. display reenter-value. exit program. ***************************************************************** ***************************************************************** * Exit procedure: entry "exit-proc". display "**CUSTOM EXIT HANDLER will pause**". call "C$SLEEP" using "3". exit program. ***************************************************************** * Error procedure: entry "err-proc" using err-msg. display "**error procedure entered**". * These lines are to demonstrate local and working storage display global-value. move 66 to global-value. display reenter-value. move 77 to reenter-value. * Process err-msg. ***** Determine Length of error Message perform varying ind from 1 by 1 until (err-msg(ind:1) = x"00") or (ind = length of err-msg) continue end-perform display err-msg(1:ind). * trap an error caused in error_proc if not been-here then set been-here to true display "** cause error inside error_proc **" call "erroneous" *> Intentional error end-if * In OpenCOBOL 1.1, the return-code is local and does * not influence further error handlers *move 1 to return-code. move 0 to return-code. display "**error procedure exit**". exit program. [/code] Expected Output: [quote] INTENTIONAL PROBLEM INSTALLING EXIT PROC 0001 DIVIDE BY ZERO EXCEPTION **error procedure entered** 99 11 Cannot find module 'erroneous'. ** cause error inside error_proc ** **error procedure entered** 66 11 Cannot find module 'erroneous'. **error procedure exit** libcob: Cannot find module 'erroneous' **CUSTOM EXIT HANDLER will pause** [/quote] At this stage, ruthless critique welcomed. Cheers, Brian ---------------------------------------------------------------- Another sample for critique. [code] >>SOURCE FORMAT IS FREE *> ************************************************************** *> OpenCOBOL Logical bit operation library call examples *> ************************************************************** *> *> Copyright (C) 2008 The OpenCOBOL Project *> *> This program is free software; you can redistribute it and/or *> modify it under the terms of the GNU General Public License as *> published by the Free Software Foundation; either version 2, *> or (at your option) any later version. *> *> This program is distributed in the hope that it will be *> useful, but WITHOUT ANY WARRANTY; without even the implied *> warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR *> PURPOSE. See the GNU General Public License for more details. *> *> You should have received a copy of the *> GNU General Public License along with this software; *> see the file COPYING. If not, write to *> the Free Software Foundation, 51 Franklin Street, Fifth Floor *> Boston, MA 02110-1301 USA *> ************************************************************** identification division. program-id. logicals. author. Brian Tiffin. date-written. 28-Jun-2008. data division. working-storage section. *> define an alphnum field large enough to hold call name 01 BITWISE pic x(8). *> results from library call are 32 bit integers 01 result pic x(4) comp-5. *> The default source is an 8 byte binary X'FFFF0000FFFF0000' *> default destination target 8 byte 0 *> length is passed by value, and for demo varies from 1 to 8 01 src pic s9(18) comp-5 value -281470681808896. 01 dst pic s9(18) comp-5 value 0. 01 len pic x(4) comp-5. *> org is defined to resest destination target for each len 01 org pic s9(18) comp-5 value 0. *> *> Demonstration of callable bitwise logical operators *> procedure division. display "Bitwise logical library calls". move "CBL_AND" to BITWISE. move -1 to org. perform demonstrate-bitwise. move "CBL_OR" to BITWISE. move 0 to org. perform demonstrate-bitwise. move "CBL_NOR" to BITWISE. move 0 to org. perform demonstrate-bitwise. move "CBL_XOR" to BITWISE. move 4294901760 to org. perform demonstrate-bitwise. move "CBL_IMP" to BITWISE. move 0 to org. perform demonstrate-bitwise. move "CBL_NIMP" to BITWISE. move 0 to org. perform demonstrate-bitwise. move "CBL_EQ" to BITWISE. move 0 to org. perform demonstrate-bitwise. *> *> NOT only uses the target field, no source *> move src to org. display "CBL_NOT". perform varying len from 1 by 1 until len > 8 move org to dst call "CBL_NOT" using dst by value len returning result display "org: ", org, ", dst: ", dst, ", len: ", len if result not equal 0 display "res: ", result end-if end-perform. exit program. stop run. *> *> ************************************************************** *> demonstrate-bitwise. display BITWISE perform varying len from 1 by 1 until len > 8 move org to dst call BITWISE using src dst by value len returning result display "src: ",src,", org: ",org,", dst: ",dst, ", len: ",len if result not equal 0 display "res: ", result end-if end-perform. [/code] Outputs [code] Bitwise logical library calls CBL_AND src: -000281470681808896, org: -000000000000000001, dst: -000000000000000256, len: 000000001 src: -000281470681808896, org: -000000000000000001, dst: -000000000000065536, len: 000000002 src: -000281470681808896, org: -000000000000000001, dst: -000000000000065536, len: 000000003 src: -000281470681808896, org: -000000000000000001, dst: -000000000000065536, len: 000000004 src: -000281470681808896, org: -000000000000000001, dst: -000001095216726016, len: 000000005 src: -000281470681808896, org: -000000000000000001, dst: -000281470681808896, len: 000000006 src: -000281470681808896, org: -000000000000000001, dst: -000281470681808896, len: 000000007 src: -000281470681808896, org: -000000000000000001, dst: -000281470681808896, len: 000000008 CBL_OR src: -000281470681808896, org: +000000000000000000, dst: +000000000000000000, len: 000000001 src: -000281470681808896, org: +000000000000000000, dst: +000000000000000000, len: 000000002 src: -000281470681808896, org: +000000000000000000, dst: +000000000016711680, len: 000000003 src: -000281470681808896, org: +000000000000000000, dst: +000000004294901760, len: 000000004 src: -000281470681808896, org: +000000000000000000, dst: +000000004294901760, len: 000000005 src: -000281470681808896, org: +000000000000000000, dst: +000000004294901760, len: 000000006 src: -000281470681808896, org: +000000000000000000, dst: +071776123356119040, len: 000000007 src: -000281470681808896, org: +000000000000000000, dst: -000281470681808896, len: 000000008 CBL_NOR src: -000281470681808896, org: +000000000000000000, dst: +000000000000000255, len: 000000001 src: -000281470681808896, org: +000000000000000000, dst: +000000000000065535, len: 000000002 src: -000281470681808896, org: +000000000000000000, dst: +000000000000065535, len: 000000003 src: -000281470681808896, org: +000000000000000000, dst: +000000000000065535, len: 000000004 src: -000281470681808896, org: +000000000000000000, dst: +000001095216726015, len: 000000005 src: -000281470681808896, org: +000000000000000000, dst: +000281470681808895, len: 000000006 src: -000281470681808896, org: +000000000000000000, dst: +000281470681808895, len: 000000007 src: -000281470681808896, org: +000000000000000000, dst: +000281470681808895, len: 000000008 CBL_XOR src: -000281470681808896, org: +000000004294901760, dst: +000000004294901760, len: 000000001 src: -000281470681808896, org: +000000004294901760, dst: +000000004294901760, len: 000000002 src: -000281470681808896, org: +000000004294901760, dst: +000000004278190080, len: 000000003 src: -000281470681808896, org: +000000004294901760, dst: +000000000000000000, len: 000000004 src: -000281470681808896, org: +000000004294901760, dst: +000000000000000000, len: 000000005 src: -000281470681808896, org: +000000004294901760, dst: +000000000000000000, len: 000000006 src: -000281470681808896, org: +000000004294901760, dst: +071776119061217280, len: 000000007 src: -000281470681808896, org: +000000004294901760, dst: -000281474976710656, len: 000000008 CBL_IMP src: -000281470681808896, org: +000000000000000000, dst: +000000000000000255, len: 000000001 src: -000281470681808896, org: +000000000000000000, dst: +000000000000065535, len: 000000002 src: -000281470681808896, org: +000000000000000000, dst: +000000000000065535, len: 000000003 src: -000281470681808896, org: +000000000000000000, dst: +000000000000065535, len: 000000004 src: -000281470681808896, org: +000000000000000000, dst: +000001095216726015, len: 000000005 src: -000281470681808896, org: +000000000000000000, dst: +000281470681808895, len: 000000006 src: -000281470681808896, org: +000000000000000000, dst: +000281470681808895, len: 000000007 src: -000281470681808896, org: +000000000000000000, dst: +000281470681808895, len: 000000008 CBL_NIMP src: -000281470681808896, org: +000000000000000000, dst: +000000000000000000, len: 000000001 src: -000281470681808896, org: +000000000000000000, dst: +000000000000000000, len: 000000002 src: -000281470681808896, org: +000000000000000000, dst: +000000000016711680, len: 000000003 src: -000281470681808896, org: +000000000000000000, dst: +000000004294901760, len: 000000004 src: -000281470681808896, org: +000000000000000000, dst: +000000004294901760, len: 000000005 src: -000281470681808896, org: +000000000000000000, dst: +000000004294901760, len: 000000006 src: -000281470681808896, org: +000000000000000000, dst: +071776123356119040, len: 000000007 src: -000281470681808896, org: +000000000000000000, dst: -000281470681808896, len: 000000008 CBL_EQ src: -000281470681808896, org: +000000000000000000, dst: +000000000000000255, len: 000000001 src: -000281470681808896, org: +000000000000000000, dst: +000000000000065535, len: 000000002 src: -000281470681808896, org: +000000000000000000, dst: +000000000000065535, len: 000000003 src: -000281470681808896, org: +000000000000000000, dst: +000000000000065535, len: 000000004 src: -000281470681808896, org: +000000000000000000, dst: +000001095216726015, len: 000000005 src: -000281470681808896, org: +000000000000000000, dst: +000281470681808895, len: 000000006 src: -000281470681808896, org: +000000000000000000, dst: +000281470681808895, len: 000000007 src: -000281470681808896, org: +000000000000000000, dst: +000281470681808895, len: 000000008 CBL_NOT org: -000281470681808896, dst: -000281470681808641, len: 000000001 org: -000281470681808896, dst: -000281470681743361, len: 000000002 org: -000281470681808896, dst: -000281470698455041, len: 000000003 org: -000281470681808896, dst: -000281474976645121, len: 000000004 org: -000281470681808896, dst: -000280379759984641, len: 000000005 org: -000281470681808896, dst: -000000004294901761, len: 000000006 org: -000281470681808896, dst: -071776123356119041, len: 000000007 org: -000281470681808896, dst: +000281470681808895, len: 000000008 [/code] Useful? Meaningless? And for Roger; while I'm here with this one. What are [b]CBL_XF4, CBL_XF5 and CBL_X91[/b] meant for? They seem to be 7-bit character shifts of some sort? My EBCDIC knowledge is near zero. Cheers ---------------------------------------------------------------- The CALL's X"F4", X"F5", X"91" are from MF. You can find them in the online MF doc under Library Routines. F4/F5 are for packing/unpacking bits from/to bytes. 91 is a multi-use call. Implemented are the subfunctions get/set cobol switches (11, 12) and get number of call params (16). Roger ---------------------------------------------------------------- Thanks Roger; Next one. Samples of C$JUSTIFY, C$TOUPPER, C$TOLOWER [code] >>SOURCE FORMAT IS FIXED *> ************************************************************** *> *> Copyright (C) 2008 The OpenCOBOL Project *> *> This program is free software; you can redistribute it and/or *> modify it under the terms of the GNU General Public License as *> published by the Free Software Foundation; either version 2, *> or (at your option) any later version. *> *> This program is distributed in the hope that it will be *> useful, but WITHOUT ANY WARRANTY; without even the implied *> warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR *> PURPOSE. See the GNU General Public License for more details. *> *> You should have received a copy of the *> GNU General Public License along with this software; *> see the file COPYING. If not, write to *> the Free Software Foundation, 51 Franklin Street, Fifth Floor *> Boston, MA 02110-1301 USA *> ************************************************************** identification division. program-id. justify. author. Brian Tiffin. security. none. date-written. 01-Jul-2008. environment division. configuration section. source-computer. IBMPC. object-computer. IBMPC. data division. working-storage section. 01 source-str pic x(80) value " this is a test of the internal voice communication - " system". 01 just-str pic x(80). 01 justification pic x. 01 result pic s9(8) comp-5. procedure division. move source-str to just-str. * Left justification move "L" to justification. perform demonstrate-justification. * case change to upper, demonstrate LENGTH verb call "C$TOUPPER" using just-str by value length just-str returning result. * Centre move "C" to justification. perform demonstrate-justification. * case change to lower call "C$TOLOWER" using just-str by value 80 returning result. * Right, default if no second argument call "C$JUSTIFY" using just-str returning result. * NOTE: The move "R" is solely for show-justification move "R" to justification. perform show-justification. exit program. stop run. ***************************************** demonstrate-justification. call "C$JUSTIFY" using just-str justification returning result end-call if result not equal 0 then display "Problem: " result stop run end-if perform show-justification . ***************************************** show-justification. evaluate justification when "L" display "Left justify" when "C" display "Centred (in UPPERCASE)" when other display "Right justify" end-evaluate display "|" source-str "|" display "|" just-str "|" display space . [/code] Producing... [code] Left justify | this is a test of the internal voice communication system | |this is a test of the internal voice communication system | Centred (in UPPERCASE) | this is a test of the internal voice communication system | | THIS IS A TEST OF THE INTERNAL VOICE COMMUNICATION SYSTEM | Right justify | this is a test of the internal voice communication system | | this is a test of the internal voice communication system| [/code] Once again, ruthless critiques welcome Cheers Brian Edit; fixed misspelling of communication ---------------------------------------------------------------- Brian, a comment :-) Please do not use AUTHOR, DATE-WRITTEN, DATE-MODIFIED,DATE-COMPILED, INSTALLATION, REMARKS or SECURITY in the ID division. These were obsoleted in the 85 standard. They are, of course, accepted and ignored. However we would not like to promote their usage. (They may at any time get removed). The same applies to certain legacy (mainframe) keywords - EJECT, SKIP1, SKIP2, SKIP3. Incidentally, did you know that the minimum valid (according to standard) source code is the one-liner - PROGRAM-ID. MYONELINER. :-) Compiles as either an executable or a module. Doesn't do much though :-) Roger ---------------------------------------------------------------- Thanks Roger. Will do (or more like, will don't) :) Cheers Brian ---------------------------------------------------------------- Hello Brian, Your example concerning text justification is very professional. Why don't you use the free format ? After some hesitation, I adopted because it's really easier to code ... Best Regards Bear ---------------------------------------------------------------- There are a lot of possible reasons for coding fixed format: 1. It's easier to code if you did it that way for a long time. 2. There are some COBOL-Editors (please don't ask me for them...) that need fixed format. 3. It's easier to read if posted here as CODE, because for lines with 150 chars (number of chars depending on the resolution of your monitor) you need to scroll horizontal. ---------------------------------------------------------------- Bear; I'll ditto Human, and in this particular case I wanted to demonstrate a continuation line. A lot of it is a 25 year old hold over to what I was used to. Plus my cobol.vim file always auto newlines any sources that go past column 72. :) But, I'll be using both forms for the samples. Opinion appreciated. Thanks. Cheers, ---------------------------------------------------------------- Heads up here - I was going to suggest to Brian that he try several ways of compiling test progs to detect differences in dialects and to try to standardize the test code as much as possible. On the lines of - cobc -x -Wall prog.cob cobc -x -Wall -std=mf prog.cob cobc -x -Wall -std=cobol85 prog.cob cobc -x -Wall -std=cobol2002 prog.cob One would aim for no errors/warnings on all these. (I know it is not always possible depending on extensions, in which case a comment line in the prog would be appropiate) I was somewhat baffled by the fact that for 85/2002 that OC was not spewing out the warnings it should have done. Specifically lack of statement terminators (END-xxx). Quickly reviewed the code and discovered an oversight in the END-xxx checking that has been latent for at least as far back as OC 0.23 :-( Fixed up rather hastily and tarball updated. So, Brian (and all), get the latest tarball and check your compatibility :-) Roger ---------------------------------------------------------------- It would be nice to have some markers (for example in column 73 if using fixed format) like[code] perform mf-things MARKMF perform 85-things MARK85 perform 2002-things MARK02[/code] For Doing things like[code] cobc -x -Wall -std=mf -inclMark=MARKMF -exclMark=MARK85 -exclMark=MARK02 prog.cob cobc -x -Wall -std=cobol85 -inclMark=MARK85 -exclMark=MARKMF -exclMark=MARK02 prog.cob cobc -x -Wall -std=cobol2002 -inclMark=MARK02 -exclMark=MARKMF -exclMark=MARK85 prog.cob[/code] (the -exclMark should be commented out, the -inclMark should be commented in) I think ACU had something like that. Has anybody an idea for doing that stuff in free format? With techniques like that we could have samples working on all std's ---------------------------------------------------------------- Note that OC (per Cobol standard) also supports floating comments in fixed-format. That means that the '*>' construct can also be used in fixed-format with the proviso that the asterisk must must be on column 7 or greater to be effective. Logical, as in fixed-format, columns 1 - 6 are stripped. Therefore it is quite valid in fixed-format to put a floating comment construct following a statement on the same line. Roger ---------------------------------------------------------------- Updated justify.cob that compiles without warning for -std mf, cobol85 and cobol2002 [code] >>SOURCE FORMAT IS FIXED *> ************************************************************** *> *> Copyright (C) 2008 The OpenCOBOL Project *> *> This program is free software; you can redistribute it and/or *> modify it under the terms of the GNU General Public License as *> published by the Free Software Foundation; either version 2, *> or (at your option) any later version. *> *> This program is distributed in the hope that it will be *> useful, but WITHOUT ANY WARRANTY; without even the implied *> warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR *> PURPOSE. See the GNU General Public License for more details. *> *> You should have received a copy of the *> GNU General Public License along with this software; *> see the file COPYING. If not, write to *> the Free Software Foundation, 51 Franklin Street, Fifth Floor *> Boston, MA 02110-1301 USA *> ************************************************************** *> Author: Brian Tiffin *> Date: 01-Jul-2008 *> Purpose: Demonstrate the usage of OpenCOBOL call library *> C$JUSTIFY, C$TOUPPER, C$TOLOWER *> Tectonics: cobc -x -Wall justify.cob *> Using OpenCOBOL 1.1, posted 02-Jul-2008 *> History: 02-Jul-2008, updated to remove warnings identification division. program-id. justify. environment division. configuration section. source-computer. IBMPC. object-computer. IBMPC. data division. working-storage section. 01 source-str pic x(80) value " this is a test of the internal voice communication - " system". 01 just-str pic x(80). 01 justification pic x. 01 result pic s9(8) comp-5. procedure division. move source-str to just-str. * Left justification move "L" to justification. perform demonstrate-justification. * case change to upper, demonstrate LENGTH verb call "C$TOUPPER" using just-str by value length just-str returning result end-call. * Centre move "C" to justification. perform demonstrate-justification. * case change to lower call "C$TOLOWER" using just-str by value 80 returning result end-call. * Right, default if no second argument call "C$JUSTIFY" using just-str returning result end-call. move "R" to justification. perform show-justification. exit program. stop run. ***************************************** demonstrate-justification. call "C$JUSTIFY" using just-str justification returning result end-call if result not equal 0 then display "Problem: " result end-display stop run end-if perform show-justification . ***************************************** show-justification. evaluate justification when "L" display "Left justify" end-display when "C" display "Centred (in UPPERCASE)" end-display when other display "Right justify" end-display end-evaluate display "|" source-str "|" end-display display "|" just-str "|" end-display display space end-display . [/code] Thanks once again to Mr. While. Cheers, Brian ---------------------------------------------------------------- This is probably the last of the samples I'll post here. Standard IO, TRIM, WHEN-COMPILED and a little INSPECT REPLACING. [code] >>SOURCE FORMAT IS FIXED *> ************************************************************** *> *> Copyright (C) 2008 The OpenCOBOL Project *> *> This program is free software; you can redistribute it and/or *> modify it under the terms of the GNU General Public License as *> published by the Free Software Foundation; either version 2, *> or (at your option) any later version. *> *> This program is distributed in the hope that it will be *> useful, but WITHOUT ANY WARRANTY; without even the implied *> warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR *> PURPOSE. See the GNU General Public License for more details. *> *> You should have received a copy of the *> GNU General Public License along with this software; *> see the file COPYING. If not, write to *> the Free Software Foundation, 51 Franklin Street, Fifth Floor *> Boston, MA 02110-1301 USA *> ************************************************************** *> *> ************************************************************** *> * Standard IO programming with OpenCOBOL * *> ************************************************************** *> Author: Brian Tiffin *> Date: 04-Jul-2008 *> Tectonics: cobc -x standardio.cob *> Usage: ./standardio *> or ./standardio output *> Notes: *> OpenCOBOL executables can use normal stdio redirection and *> with the ENVIROMENT variable extensions can also be used *> for web CGI server side programming. IDENTIFICATION DIVISION. PROGRAM-ID. standard-io. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 DATAREC PIC X(80). 01 ENVREC PIC X(32767). 01 DATEREC PIC XXXX/XX/XXBXX/XX/XXXXXXX/XX. PROCEDURE DIVISION. *> Get datetime of program compile MOVE FUNCTION WHEN-COMPILED TO DATEREC. *> The DISPLAY verb and PICTURE in OpenCOBOL makes output easy. *> (but, PIC does not allow colons, so ... *> replace the PIC /'s (after the B) with colons. INSPECT DATEREC REPLACING ALL "/" BY ":" AFTER INITIAL SPACE. DISPLAY "Intrinsic function WHEN-COMPILED returned " DATEREC END-DISPLAY. *> OpenCOBOL's DISPLAY verb includes most extended functionality *> NO ADVANCING supresses the default newline of DISPLAY DISPLAY "Input: " WITH NO ADVANCING END-DISPLAY. *> Simple console accept to an 80 character COBOL data record ACCEPT DATAREC END-ACCEPT. *> Trim the input for display using an intrinsic funtion *> TRIM is a new extension from proposed 2008 COBOL standard DISPLAY "|" FUNCTION TRIM(DATAREC) "|" END-DISPLAY. *> sysin can also be used, and is the same as the previous accept DISPLAY "Input: " WITH NO ADVANCING END-DISPLAY. ACCEPT DATAREC FROM SYSIN END-ACCEPT. *> Without trimming, OpenCOBOL will display all of DATAREC *> which is an 80 character alphanumeric field. DISPLAY "|" DATAREC "|" END-DISPLAY. *> OpenCOBOL supports the ACCEPT ... FROM ENVIRONMENT *> and DISPLAY ... UPON ENVIRONMENT extensions. *> This sample uses bash's usually long ls command coloring var ACCEPT ENVREC FROM ENVIRONMENT "LS_COLORS" END-ACCEPT. *> Without the trim, this would display a full 32K field DISPLAY "Value of LS_COLORS environment variable is: " FUNCTION TRIM(ENVREC) END-DISPLAY. EXIT PROGRAM. STOP RUN. [/code] With sample output [code] $ ./standardio Intrinsic function WHEN-COMPILED returned 2008/07/04 04:55:5100-04:00 Input: test |test| Input: test |test | Value of LS_COLORS environment variable is: no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35: ... [/code] I truncated the env var output so it wouldn't cause too much browser grief for everyone. This may be your last chance for ruthless critiques before these start getting added to OpenCOBOL releases, so ... :) Cheers Brian ---------------------------------------------------------------- Ok, last one wasn't the last. :) [code] >>SOURCE FORMAT IS FREE *> Author: Brian Tiffin for the OpenCOBOL Project *> and posts from opencobol.org *> Dated: 11-July-2008 *> Purpose: Count trailing spaces *> Tectonics: cobc trailingsp.cob *> cobcrun trailingsp *> Note: hard loop profiler, results will vary. IDENTIFICATION DIVISION. PROGRAM-ID. trailingsp. DATA DIVISION. WORKING-STORAGE SECTION. 01 START-PROFILE PIC 9(18). 01 END-PROFILE PIC 9(18). 01 SHOW-PROFILE PIC Z(5)9. 01 TITLE-PROFILE PIC X(18). 01 WAY PIC 9. 01 B-COUNT PIC 999 VALUE 0. 01 TEST-CASE PIC X(80) VALUE "This is my string.". PROCEDURE DIVISION. PERFORM VARYING WAY FROM 1 BY 1 UNTIL WAY > 4 ACCEPT START-PROFILE FROM TIME END-ACCEPT EVALUATE WAY WHEN 1 MOVE "PERFORM varying: " TO TITLE-PROFILE PERFORM ONE-WAY 10000 TIMES WHEN 2 MOVE "INSPECT reverse: " TO TITLE-PROFILE PERFORM TWO-WAY 10000 TIMES WHEN 3 MOVE "INSPECT trailing: " TO TITLE-PROFILE PERFORM THREE-WAY 10000 TIMES WHEN 4 MOVE "Trim and length: " TO TITLE-PROFILE PERFORM FOUR-WAY 10000 TIMES END-EVALUATE ACCEPT END-PROFILE FROM TIME END-ACCEPT SUBTRACT START-PROFILE FROM END-PROFILE GIVING START-PROFILE END-SUBTRACT MOVE START-PROFILE TO SHOW-PROFILE DISPLAY TITLE-PROFILE SHOW-PROFILE "ticks, " B-COUNT END-DISPLAY END-PERFORM. GOBACK. *> ****************************************************************** ONE-WAY. PERFORM VARYING B-COUNT FROM LENGTH OF TEST-CASE BY -1 UNTIL TEST-CASE(B-COUNT:1) NOT EQUAL SPACE END-PERFORM SUBTRACT B-COUNT FROM LENGTH OF TEST-CASE GIVING B-COUNT END-SUBTRACT . TWO-WAY. MOVE ZERO TO B-COUNT INSPECT FUNCTION REVERSE(TEST-CASE) TALLYING B-COUNT FOR ALL LEADING ' ' . THREE-WAY. MOVE ZERO TO B-COUNT INSPECT TEST-CASE TALLYING B-COUNT FOR TRAILING SPACE . FOUR-WAY. COMPUTE B-COUNT = LENGTH TEST-CASE - FUNCTION LENGTH(FUNCTION TRIM(TEST-CASE)) END-COMPUTE . [/code] Results will vary, maybe 0 on a lot of machines. [code] PERFORM varying: 8ticks, 062 INSPECT reverse: 4ticks, 062 INSPECT trailing: 4ticks, 062 Trim and length: 3ticks, 062 [/code] Cheers, Brian ---------------------------------------------------------------- Whilst this is OK for the defined value of TEST-CASE, consider the case when the content of TEST-CASE is unknown. eg. Set TEST-CASE to SPACES. In ONE-WAY, you will get undefined results. In a PERFORM/UNTIL using an index/subscript, always test (in the UNTIL phrase) the index/subscript for a possible exit condition BEFORE the condition using the index/subscript. ie. UNTIL check-index OR condition-using-index. Also note that OR evaluates left to right and therefore the above UNTIL conditions can NOT be reversed (You must check the index BEFORE using the index) Incidentally, this is one of the most prevalent mistakes made in Cobol programming. In FOUR-WAY, careful using FUNCTION TRIM. The default, with no second param defined, is to trim leading AND trailing spaces. So strictly speaking in this example it should be FUNCTION TRIM (TEST-CASE TRAILING). Roger ---------------------------------------------------------------- Thanks Roger. I fixed the TRIM, but I don't think I see the problem with ONE-WAY. I think. LENGTH OF will always return a valid index no? Something that will always be a valid reference for (IND:1)? That code will stop at 1 won't it? For all space? I tested with ZEROES too. The only weirdness is SPACES and FOUR-WAY returning 79 ?? ... I'm new to the trim bit, but should it return one space or no spaces after a trim? I definitely have to get used to running more test-cases. And I still can't rid of the truncation warnings. In this case START-PROFILE to SHOW-PROFILE. Is there a trick for that? And again, thanks for the heads up. Cheers, Brian. ---------------------------------------------------------------- Most definitely ONE-WAY has a problem. It relies on undefined behaviour. To demonstrate, replace your definition of TEST-CASE with something like this - [code] 01 MYTEST01. 03 MYFIRSTFLD PIC XXX VALUE SPACES. 03 TEST-CASE PIC X(80) VALUE SPACES. [/code] It will loop. Even worse, the behaviour is also dependent on whether or not B-COUNT is signed. If it is signed you will get a negative reference into MYFIRSTFLD. (Which only eventually terminates as the character in memory preceeding the 01 level is likely not to be space) Roger Roger ---------------------------------------------------------------- Well, well, well. So, luckily, I'm too dense to let being WRONG stop me. Corrected ONE-WAY (more like; Changed ONE-WAY). But now I'm off to read more refreshers. Hopefully I'll get to a point soon where you won't have to worry about me leading everyone too far into bug city. [i]"Those that can, do. Those that can't teach, write documentation."[/i] Please excuse the taint everyone. Learn by FAIL. :) Cheers, Brian ---------------------------------------------------------------- New version. Holy moly. BINARY-LONG data representation really is a performance changing choice. This version comes with a question still. Is the logical OR operation in ONE-WAY still safe for the TEST-CASE(B-COUNT:1) ? Does the OR short-circuit - meaning there is no need to check the other condition? By the way, changing B-COUNT from pic 99999 to binary-long had a huge impact on the performance values on this PC. So much so, I cranked up the time to loop by an order of magnitude. Oh, and thanks Roger, light bulbs came on yesterday re the VARYING clause. (Aside from feeling like an idiot) Thanks. Cheers, Brian [code] PERFORM varying: 9ticks, +000000062 INSPECT reverse: 34ticks, +000000062 INSPECT trailing: 27ticks, +000000062 Trim and length: 15ticks, +000000062 [/code] [code] >>SOURCE FORMAT IS FREE *> Author: Brian Tiffin for the OpenCOBOL Project *> Dated: 11-July-2008 *> Purpose: Count trailing spaces *> Tectonics: cobc trailingsp.cob *> cobcrun trailingsp *> Note: hard coded loop profiler, results will vary. *> Logic errors corrected thanks to Roger While IDENTIFICATION DIVISION. PROGRAM-ID. trailingsp. DATA DIVISION. WORKING-STORAGE SECTION. 78 TIMES-TO-PROFILE VALUE 100000. 01 START-PROFILE USAGE BINARY-LONG. 01 END-PROFILE USAGE BINARY-LONG. 01 SHOW-PROFILE PIC Z(5)9. 01 TITLE-PROFILE PIC X(18). 01 WAY PIC 9. 01 B-COUNT USAGE BINARY-LONG VALUE 0. 01 TEST-HOLDER. 02 TEST-HEAD PIC XXX. 02 TEST-CASE PIC X(80) VALUE "This is my string.". PROCEDURE DIVISION. PERFORM VARYING WAY FROM 1 BY 1 UNTIL WAY > 4 ACCEPT START-PROFILE FROM TIME END-ACCEPT EVALUATE WAY WHEN 1 MOVE "PERFORM varying: " TO TITLE-PROFILE PERFORM ONE-WAY TIMES-TO-PROFILE TIMES WHEN 2 MOVE "INSPECT reverse: " TO TITLE-PROFILE PERFORM TWO-WAY TIMES-TO-PROFILE TIMES WHEN 3 MOVE "INSPECT trailing: " TO TITLE-PROFILE PERFORM THREE-WAY TIMES-TO-PROFILE TIMES WHEN 4 MOVE "Trim and length: " TO TITLE-PROFILE PERFORM FOUR-WAY TIMES-TO-PROFILE TIMES END-EVALUATE ACCEPT END-PROFILE FROM TIME END-ACCEPT SUBTRACT START-PROFILE FROM END-PROFILE GIVING START-PROFILE END-SUBTRACT MOVE START-PROFILE TO SHOW-PROFILE DISPLAY TITLE-PROFILE SHOW-PROFILE "ticks, " B-COUNT END-DISPLAY END-PERFORM. GOBACK. *> ****************************************************************** ONE-WAY. PERFORM VARYING B-COUNT FROM LENGTH OF TEST-CASE BY -1 UNTIL (B-COUNT < 1) OR (TEST-CASE(B-COUNT:1) NOT EQUAL SPACE) END-PERFORM SUBTRACT B-COUNT FROM LENGTH OF TEST-CASE GIVING B-COUNT END-SUBTRACT . TWO-WAY. MOVE ZERO TO B-COUNT INSPECT FUNCTION REVERSE(TEST-CASE) TALLYING B-COUNT FOR ALL LEADING ' ' . THREE-WAY. MOVE ZERO TO B-COUNT INSPECT TEST-CASE TALLYING B-COUNT FOR TRAILING SPACE . FOUR-WAY. COMPUTE B-COUNT = LENGTH TEST-CASE - FUNCTION LENGTH(FUNCTION TRIM(TEST-CASE TRAILING)) END-COMPUTE . [/code] ---------------------------------------------------------------- Yes, if the condition to the left of the OR evaluates to TRUE, then the complete condition is TRUE and anything to the right is not evaluated. This is exactly what C does. Note however this is NOT true for AND. Conditions joined with AND may be evaluated in any order (Once again exactly as C does). I plan to to post on the Cobol Quiz thread a nice example of this :-) Not that it will bring much is this case, but you could also define "WAY" as BINARY-LONG. As to the timing results, they are to be expected. TWO/THREE/FOUR-WAY involve calls to (potentially compilcated) OC library routines whereas ONE-WAY is effectively inline. It IS totally inline if you specify the maximum optimization option (-O2) to the compile (And you might squeeze another few ticks out of it). Roger ---------------------------------------------------------------- I'll add a FAQ entry regarding the AND / OR evaluation predictability just to clarify for everyone. On profiling; Is there anything better than the 100th of a second resolution of ACCEPT from TIME? Hard coded profile loops seem a little bit grade-school along with being completely tied to hardware (and mine is usually not-current). So is there any way to get access to the HI-RES clock values? clock_gettime and clock_getres? clock_settime being outside what would be needed. Cheers, Brian ---------------------------------------------------------------- Well the AND/OR is a fundamental part of the COBOL language. Re HI-RES. Take off your Linux hat and put on your Posix/Windows hat :-) clock_gettime does not exist on Win. (I am not sure what the alternative is) Even on some Posix systems it may not actually be present (Some versions of MinGW, Solaris, MacOS, etc.) Even then, assuming it is present, we need help from the OC configure to determine in what library it is defined. It may be in the standard C library (libc), it may be in the realtime library (librt and therefore we need -lrt) or it maybe somewhere else. Having determined some compatible way to get around all of this, there remains the question of what we should return. We cannot return a nanosecond value based on the absolute values returned by clock_gettime. The seconds and nanosecond values are times since the Epoch (1970 generally). This means that the secs value is already 10 digits. If we multiply up and add nsecs, we are already overflowing a BINARY-DOUBLE (AKA PIC S9(18) COMP-5). Theoretically, we could, at execution start, prime up a static variable/structure and return a relative nanosec value relative to this value. Roger ---------------------------------------------------------------- Re: Profile timing I'm not sure if this is really worth pursuing but I found this snippet while searching about for QueryPerformanceCounter http://dev.mysql.com/sources/doxygen/mysql-5.1/my__getsystime_8c.html A more complete picture of the sources with the GNU copyright http://www.google.ca/codesearch?hl=en&q=my_getsystime+show:86kJT-M0wB8:8rR33jnAci0:U49IKPVTOlg&source=universal&cs_p=http://ftp.osuosl.org/pub/nslu2/sources/mysql-4.1.18.tar.gz&cs_f=mysql-4.1.18/mysys/my_getsystime.c#l24 Who made the world such a complicated place? :) Cheers, Brian ---------------------------------------------------------------- Everyone; After finding out some details on FUNCTION TRIM, and a zero-length field issue, FUNCTION TRIM will always result in at least one character, so a trim of all spaces will result in one space. The sample was data dependency broken. Before the code dump, I'd like to highlight some profiling numbers of note. The PERFORM VARYING with native data representation really kicks. [code] $ ./trailingsp PERFORM varying: 9ticks, +000000062 INSPECT reverse: 32ticks, +000000062 INSPECT trailing: 28ticks, +000000062 Trim and length: 15ticks, +000000062 [/code] With MOVE SPACES TO TEST-CASE. [code] $ ./trailingsp PERFORM varying: 12ticks, +000000080 INSPECT reverse: 42ticks, +000000080 INSPECT trailing: 34ticks, +000000080 Trim and length: 5ticks, +000000080 [/code] [code] >>SOURCE FORMAT IS FREE *> Author: Brian Tiffin for the OpenCOBOL Project *> Dated: 11-July-2008 *> Purpose: Count trailing spaces *> Tectonics: cobc trailingsp.cob *> cobcrun trailingsp *> Note: hard coded loop profiler, results will vary. *> Logic errors corrected thanks to Roger While; *> original did not properly test reference index in ONE-WAY. *> Issue of zero-length fields and the result of the trim function *> on all space fields was explained. The FUNCTION TRIM will *> return at least one space to avoid potential problems. IDENTIFICATION DIVISION. PROGRAM-ID. trailingsp. DATA DIVISION. WORKING-STORAGE SECTION. 78 TIMES-TO-PROFILE VALUE 100000. 01 START-PROFILE USAGE BINARY-LONG. 01 END-PROFILE USAGE BINARY-LONG. 01 SHOW-PROFILE PIC Z(5)9. 01 TITLE-PROFILE PIC X(18). 01 WAY PIC 9. 01 B-COUNT USAGE BINARY-LONG VALUE 0. 01 TEST-HOLDER. 02 TEST-HEAD PIC XXX. 02 TEST-CASE PIC X(80) VALUE "This is my string.". PROCEDURE DIVISION. MOVE SPACES TO TEST-CASE. PERFORM VARYING WAY FROM 1 BY 1 UNTIL WAY > 4 ACCEPT START-PROFILE FROM TIME END-ACCEPT EVALUATE WAY WHEN 1 MOVE "PERFORM varying: " TO TITLE-PROFILE PERFORM ONE-WAY TIMES-TO-PROFILE TIMES WHEN 2 MOVE "INSPECT reverse: " TO TITLE-PROFILE PERFORM TWO-WAY TIMES-TO-PROFILE TIMES WHEN 3 MOVE "INSPECT trailing: " TO TITLE-PROFILE PERFORM THREE-WAY TIMES-TO-PROFILE TIMES WHEN 4 MOVE "Trim and length: " TO TITLE-PROFILE PERFORM FOUR-WAY TIMES-TO-PROFILE TIMES END-EVALUATE ACCEPT END-PROFILE FROM TIME END-ACCEPT SUBTRACT START-PROFILE FROM END-PROFILE GIVING START-PROFILE END-SUBTRACT MOVE START-PROFILE TO SHOW-PROFILE DISPLAY TITLE-PROFILE SHOW-PROFILE "ticks, " B-COUNT END-DISPLAY END-PERFORM. GOBACK. *> ****************************************************************** ONE-WAY. PERFORM VARYING B-COUNT FROM LENGTH OF TEST-CASE BY -1 UNTIL (B-COUNT < 1) OR (TEST-CASE(B-COUNT:1) NOT EQUAL SPACE) END-PERFORM SUBTRACT B-COUNT FROM LENGTH OF TEST-CASE GIVING B-COUNT END-SUBTRACT . TWO-WAY. MOVE ZERO TO B-COUNT INSPECT FUNCTION REVERSE(TEST-CASE) TALLYING B-COUNT FOR ALL LEADING ' ' . THREE-WAY. MOVE ZERO TO B-COUNT INSPECT TEST-CASE TALLYING B-COUNT FOR TRAILING SPACE . FOUR-WAY. IF TEST-CASE EQUAL SPACES COMPUTE B-COUNT = LENGTH OF TEST-CASE ELSE COMPUTE B-COUNT = LENGTH OF TEST-CASE - FUNCTION LENGTH(FUNCTION TRIM(TEST-CASE TRAILING)) END-COMPUTE END-IF . [/code] Cheers ---------------------------------------------------------------- Playing with the SYSTEM library service Cheers [code] >>SOURCE FORMAT IS FREE *> ********************************************************************* *> Author: Brian Tiffin *> Date: 19-July 2008 *> Purpose: Play with SYSTEM CALL *> Tectonics: cobc -x systemcall.cbl *> ./systemcall cat say.cob *> easily broken, ./systemcall vi would probably do. identification division. program-id. systemcall. environment division. input-output section. file-control. select optional pipefile assign to tmpfile organization is line sequential. data division. file section. fd pipefile. 01 pipedata pic x(80). working-storage section. 01 pipestatus pic 9. 88 endofpipe value high-values. 01 stat pic s9(9). 01 commands pic x(256). 01 arguments pic x(241). 01 tmpfile pic x(1024). *> redirect a system call to a temp file and display results procedure division. accept arguments from command-line. if arguments equal spaces move "ls" to arguments end-if. call "tmpnam" using tmpfile returning stat. if stat = 0 display "tmpnam: |" stat "|" end-display end-if. string function trim(arguments trailing) delimited by size " > " delimited by size tmpfile delimited by space low-value delimited by size into commands end-string. display "|" function trim(commands trailing) "|" end-display. call "SYSTEM" using function trim(commands trailing) returning stat. if stat not = 0 display "SYSTEM: |" stat "|" end-display end-if. open input pipefile. read pipefile at end move high-values to pipestatus end-read. if pipestatus not equal high-values display "|" pipedata "|" end-display end-if. perform until pipestatus = high-values read pipefile at end move high-values to pipestatus end-read if pipestatus not = high-values display "|" pipedata "|" end-display end-if end-perform. close pipefile. call "remove" using tmpfile returning stat. if stat not = 0 display "remove: |" stat "|" end-display end-if. goback. [/code] using cat say.cob, should look something like [code] $ ./systemcall cat say.cob |cat say.cob > /tmp/fileLir4y3| | IDENTIFICATION DIVISION. | | PROGRAM-ID. say. | | ENVIRONMENT DIVISION. | | DATA DIVISION. | | LINKAGE SECTION. | | 01 HELLO PIC X(6). | | 01 WORLD PIC X(6). | | PROCEDURE DIVISION USING HELLO WORLD. | | DISPLAY HELLO WORLD. | | EXIT PROGRAM. | | | [/code] ---------------------------------------------------------------- Subject: Tips and Tricks Hello everyone, Starting another thread. This one to collect OpenCOBOL user tips, tricks and warnings. The plan ([i]if anyone likes the idea[/i]) is to add a section to the wiki and the Texinfo sources. Tips and tricks from a COBOL perspective, a development angle, conversion and migration shortcuts or anything that makes life with OpenCOBOL more fun than it already is. Things like [i]vim editor ex filter resequencer using perl[/i] [code] :%!perl -ne 'printf("\%06d\%s", $. * 10, substr($_, 6, -1) . "\n");' [/code] If you think it's a worthwhile proposal, post some snippets of wisdom and I'll try and put something together. Cheers ---------------------------------------------------------------- Subject: OpenCOBOL GPL legalese question Hello everyone, Not being a lawyer I was wondering if anyone could offer advice on copyright, indemnification notices and possibly stashing them away in copylib text instead of inline. given; [code] *> ************************************************************** *> *> Copyright (C) 2008 The OpenCOBOL Project *> *> This program is free software; you can redistribute it and/or *> modify it under the terms of the GNU General Public License as *> published by the Free Software Foundation; either version 2, *> or (at your option) any later version. *> *> This program is distributed in the hope that it will be *> useful, but WITHOUT ANY WARRANTY; without even the implied *> warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR *> PURPOSE. See the GNU General Public License for more details. *> *> You should have received a copy of the *> GNU General Public License along with this software; *> see the file COPYING. If not, write to *> the Free Software Foundation, 51 Franklin Street, Fifth Floor *> Boston, MA 02110-1301 USA *> ************************************************************** [/code] Would it be appropriate to have this in a COPY file? For instance, COPYLEFT-2008.CPY [code] * Include Free Software Notice COPY COPYLEFT-2008. [/code] Or does it need to be in the actual sources for lawyers to not go after Roger when one of the community samples bones up someone's multi-million dollar PC database? Not that that will ever happen; this is Murphy CYA imho. The other question is; is there a "The OpenCOBOL Project"? or should community contributions just put all the grief on Roger's shoulders and pass it on as [code]Copyright (C) 2008 Roger While[/code] ? or is there another way to copyleft something into the OpenCOBOL community without going as far as Public Domain? In my opinion the [code]AUTHOR. author-name.[/code] entry in the IDENTIFICATION DIVISION gives ample credit where credit is due, but these are legal questions, so I thought I'd ask here. Please excuse the interruption. Cheers ---------------------------------------------------------------- btiffin, For the best way to place your copyright notice the Free Software Foundation has guidelines here: http://www.gnu.org/licenses/gpl-howto.html ------ Now regarding whether you should place the notice Copyright (C) 2008 Roger While in programs you create. In the USA as soon as you have committed a work to fixed format, it is immediately copyrighted to you, with or without a copyright notice. Any changes you make to the files that Roger and the others have created, become a derivative work of their work. The GNU GPL grants you a license to make such changes. The changes would be copyrighted by you. Many projects to ease the notice of credit, rather than adding the names of the authors of each change to every file, list these in a separate file. I am not sure if Roger and the rest of the OC crew are doing this, but I think they are. If you create COBOL programs with OC, those programs are your work. So in that case you should note yourself as the copyright holder. In the USA you can assign copyrights to another, giving up your right to them. Usually there has to be some "consideration" for this to occur. Such as payment or trade of some sort. In addition any works you create in the USA are most often (unless stipulated otherwise by a contract) are work for hire and copyrighted by the person or company that is paying you. In some parts of the world an author also has moral rights. I've not figured out just what this means exactly, but as I understand those cannot even be given up. Hope this helps. ---------------------------------------------------------------- Thanks. Yeah, the howto page is where I snagged the text (before formatting it fixed, nothing past column 72). Your information does fill in some holes, but I'd like to keep the question open. Is it worthwhile worrying about transferring the copylefts to some group entity? Cheers ---------------------------------------------------------------- Sometimes it is worth transferring if you wish to see that your copyleft is enforced in the event that you would be unable to do so in the future. Sometimes people transfer this right to the Free Software Foundation just for this purpose. Also regarding my earlier comment about Moral Rights not being able to be given up, this doesnt mean that some of your copyrights cant be given up. They can. Just the moral rights are retained, something we don't have in the USA so I've not taken time to educate myself on them just yet. ---------------------------------------------------------------- Subject: Problems linking to libcurl Hello, As an experiment, I was playing with libcurl.so and it's beating me. Something (me probably) is trashing ram getting to the curl_easy_perform(handle) call. [code] identification division. program-id. showcurl. author. Brian Tiffin. data division. working-storage section. 01 handle usage is pointer. 01 result pic s9(8) comp-5. 01 url. 02 filler pic x(20) value 'http://opencobol.org'. 02 filler pic x(1) value X"00". 01 str-ptr usage is pointer. linkage section. 01 current-url pic x(21). procedure division. * 3 is CURL_GLOBAL_ALL call "curl_global_init" using by value 3 returning result. call "curl_easy_init" returning handle. display "handle: " handle. * 10002 is CURLOPT_URL call "curl_easy_setopt" using handle by value 10002 by reference url returning result. display "set url: " result. * Prove the curl handle is getting information * 1048577 is CURLINFO_EFFECTIVE_URL call "curl_easy_getinfo" using handle by value 1048577 by reference str-ptr returning result. set address of current-url to str-ptr. display "get url: " result ", " current-url. * memory trashed by something call "curl_easy_perform" using handle returning result. exit program. stop run. [/code] The call to curl_easy_perform segfaults or depending on the wind, detects heap corruption with a dump. [code] $ cobc -x -lcurl showcurl.cob [/code] On this dump, I've masked the actual addresses with &&& [code] handle: 0x080585e0 set url: +00000000 get url: +00000000, http://opencobol.org. *** glibc detected *** ./showcurl: free(): invalid pointer: 0x&&&&&&&& *** ======= Backtrace: ========= /lib/i686/cmov/libc.so.6[0x&&&&&&&&] /lib/i686/cmov/libc.so.6(cfree+0x90)[0x&&&&&&&&] /usr/lib/libcurl.so.4[0x&&&&&&&&] /usr/lib/libcurl.so.4[0x&&&&&&&&] /usr/lib/libcurl.so.4[0x&&&&&&&&] /usr/lib/libcurl.so.4[0x&&&&&&&&] /usr/lib/libcurl.so.4(curl_easy_perform+0x43)[0x&&&&&&&&] ./showcurl[0x&&&&&&&&] ./showcurl(showcurl+0x12)[0x&&&&&&&&] ./showcurl(main+0x27)[0x&&&&&&&&] /lib/i686/cmov/libc.so.6(__libc_start_main+0xe0)[0x&&&&&&&&] ./showcurl[0x&&&&&&&&] ============================ [/code] OC1.1 from a few days ago. libcurl 7.18.2 (SSL), Debian 4 lenny. And I'll admit, that I may well be passing things around incorrectly. The code simply segfaults at the point of the curl_easy_perform call (with -ftraceall or -g), or produces this dump without those compile options. [i]On the display, I'm a little unsure if the null terminator on the dereference of current-url is proper; DISPLAY seems to convert them to a period X"2e". (I think.)[/i] The expectation is that the HTML from the given URL is sent raw to stdout. The simple.c example from the libcurl site works fine here. So it leads me to believe I'm doing something wrong. I've got a curlwrap.c that does the init, set and perform in a single C function and calling it from OC works great, but I'd appreciate any hints on what I may be doing wrong between shared library calls. libcurl seems like a great path to web enabling OC with little fuss. Cheers ---------------------------------------------------------------- OK. A couple of things here. The basic problem is handling/passing a POINTER type. Remember that reference to a POINTER item is the address of the Cobol item NOT the content of the item. The way to get this working is to use the BY VALUE phrase. HOWEVER, there is/was a (non)bug in OC whereby passing a POINTER by VALUE did not do the correct thing. Fixed today in current OC 1.1 tarball. (I say non-bug, because it is non-standard). Then change all references of USING handle to USING BY VALUE handle. Then it should work. Note - libcurl is spectacularly unforgiving in it's parameter interpretation (It's even documented as such). One wrong param or even one wrong bit in a param and it is likely to blow in an explosive manner :-) There are anyway problems in using libcurl from Cobol as many params in libcurl are of "long" type. This, of course, is dependent on 32/64 bit. (Of course, C is no problem). The safe way to do this is through wrapper functions (If you are careful what you pass from Cobol and type cast appropiately). Roger ---------------------------------------------------------------- Woohoo! Thanks yet again Mr While. You sure make working in OC a productive and educational experience. Yeah, I had tried to get my head around by value, by content and by reference and experimented with them all while looking at the generated C code. The new release works like a charm and what I thought should work works. First try and OpenCOBOL displayed the opencobol.org webpage. Now to try and build something real while exploring. I was leaning towards the idea of "thick" wrappers that did a sequence of the libcurl calls inside C functions, but that has a pre-guessing developer intent downside. Now, from what you mentioned, thin wrappers will only need to be added if/when a stack parameter needs a little help. This is awesome. Cheers And Happy Canada Day from Ottawa. It's our birthday. ---------------------------------------------------------------- Hello Brian, This is really an educational experience. Can you post your program after corrections. I never heard about libcurl before ! Best regards Bear ---------------------------------------------------------------- Bear; why yes I can. [code] identification division. program-id. showcurl. author. Brian Tiffin. data division. working-storage section. 01 handle usage is pointer. 01 result pic s9(8) comp-5. 01 url. 02 filler pic x(20) value 'http://opencobol.org'. 02 filler pic x(1) value X"00". 01 str-ptr usage is pointer. linkage section. 01 current-url pic x(21). procedure division. * 3 is CURL_GLOBAL_ALL call "curl_global_init" using by value 3 returning result. call "curl_easy_init" returning handle. display "handle: " handle. * 10002 is CURLOPT_URL call "curl_easy_setopt" using by value handle by value 10002 by reference url returning result. display "set url: " result. * Prove the curl handle is getting information * 1048577 is CURLINFO_EFFECTIVE_URL call "curl_easy_getinfo" using by value handle by value 1048577 by reference str-ptr returning result. set address of current-url to str-ptr. display "get url: " result ", " current-url. * default operations is read the url and send to stdout call "curl_easy_perform" using by value handle returning result. display "perform: " result. * Clean up call "curl_easy_cleanup" using by value handle. exit program. stop run. [/code] I'll be setting up the manifest constants as symbols soon. [code] $ cobc -lcurl -x showcurl.cob $ ./showcurl $# Note; needs OC 1.1 tarball posted after June 30th. [/code] Sends the raw HTML of opencobol.org to stdout. libcurl provides a plethora of web enabling options. http://curl.haxx.se/libcurl/ for more info, but highlights include FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS and FILE. libcurl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, Kerberos4), file transfer resume, http proxy tunneling and more! On my Debian box, I installed libcurl4-openssl-dev to get at the header files. And that version of libcurl supports the https, and secure ftp etc. The libcurl3 runtime package was already installed, as [i]curl[/i] is a handy GNU/Linux command to have. There will be some work involved in getting true and proper OpenCOBOL bindings, but a worthy effort imho. And I'll be experimenting with getting data to files for COBOL reading or using the libcurl callbacks to get usable memory buffers. Cheers P.S. Bear, I'm hoping to get permission to include your source code postings into the hopefully soon forthcoming OpenCOBOL Copylib samples and examples collection. :) ---------------------------------------------------------------- Thank you Brian, I tested your program, Debian Etch, tarball from July 1st & libcurl3-openssl. I will be very glad to see my code in samples & examples. It is so useful to find tips & tricks in cobol for beginners. We are all beginners in something ;-) Bear ---------------------------------------------------------------- Thanks to you Bear. Here is another one. This one accepts the url from the command line. If no arg, prompts for it. If no data comes from the prompt, then use a default. [code] >>SOURCE FORMAT IS FIXED *> ************************************************************** *> *> Copyright (C) 2008 The OpenCOBOL Project *> *> This program is free software; you can redistribute it and/or *> modify it under the terms of the GNU General Public License as *> published by the Free Software Foundation; either version 2, *> or (at your option) any later version. *> *> This program is distributed in the hope that it will be *> useful, but WITHOUT ANY WARRANTY; without even the implied *> warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR *> PURPOSE. See the GNU General Public License for more details. *> *> You should have received a copy of the *> GNU General Public License along with this software; *> see the file COPYING. If not, write to *> the Free Software Foundation, 51 Franklin Street, Fifth Floor *> Boston, MA 02110-1301 USA *> ************************************************************** identification division. program-id. showcurl. author. Brian Tiffin. data division. working-storage section. 01 handle usage is pointer. 01 result pic s9(8) comp-5. 01 url. 02 filler pic x(20) value 'http://opencobol.org'. 02 filler pic x(1) value X"00". 01 user-url pic x(80). 01 ind pic 99. 01 str-ptr usage is pointer. 01 display-url pic x(80). linkage section. 01 current-url pic x(80). procedure division. * 3 is CURL_GLOBAL_ALL call "curl_global_init" using by value 3 returning result. call "curl_easy_init" returning handle. display "handle: " handle. * Get a url from the user or command line accept user-url from command-line. if user-url equal spaces then display "url: " with no advancing accept user-url if user-url equal spaces then move url to user-url end-if end-if. * take first piece as the actual url string user-url delimited by space into display-url. move display-url to user-url. * get the real length perform varying ind from length user-url by -1 until user-url(ind:1) not equal space end-perform. * Add a C null byte if ind equal length user-url then subtract 1 from length user-url giving ind. move X"00" to user-url(ind + 1:1). * tell cURL the url * 10002 is CURLOPT_URL call "curl_easy_setopt" using by value handle by value 10002 by reference user-url returning result. display "set url: " result. * Prove the curl handle is getting information * 1048577 is CURLINFO_EFFECTIVE_URL call "curl_easy_getinfo" using by value handle by value 1048577 by reference str-ptr returning result. set address of current-url to str-ptr. * skip the null terminator for display string current-url delimited by low-value into display-url. display "get url: " result ", " display-url. * default operations is read the url and send to stdout call "curl_easy_perform" using by value handle returning result. display "perform: " result. * Clean up call "curl_easy_cleanup" using by value handle. exit program. stop run. [/code] Example runs [code] $ ./showcurl wanip.org handle: 0x08059630 set url: +00000000 get url: +00000000, wanip.org 99.241.xxx.xxx perform: +00000000 $ ./showcurl handle: 0x08059630 url: wanip.org set url: +00000000 get url: +00000000, wanip.org 99.241.xxx.xxx perform: +00000000 $ ./showcurl wanip.org and then other command line stuff handle: 0x08059630 set url: +00000000 get url: +00000000, wanip.org 99.241.xxx.xxx perform: +00000000 $ ./showcurl handle: 0x08059630 url: somekindajunkurl set url: +00000000 get url: +00000000, somekindajunkurl perform: +00000006 [/code] I obfuscated my displayed ip address a little bit Cheers P.S. OpenCOBOL is a blast! :) ---------------------------------------------------------------- Brian, if you are going to follow up on this curl stuff, it might be useful to have a copy proc for the curl constants. eg. 78 CURLOPT_URL VALUE 10002. (I assume these are constant among installs?) The 78 level is not a standard but is in wide use. Comes from MF and defines constant items. References get replaced at compile time. (See copy/screenio.cpy for example of ACCEPT exception codes) Re. my thoughts about the "long" type. It is a pity that Cobol does not have a USAGE that varies in length according to 32/64 bit installation (As POINTERS do). Hmm, I wonder if we can adapt the 2002 bin field syntax a bit for a new type. 2002 bin (ie. COMP-5) fields are - BINARY-[CHAR, SHORT, LONG, DOUBLE] SIGNED/UNSIGNED corresponding to 1, 2, 4, 8 bytes native integers signed or unsigned (ie. PIC [S]9(n) COMP-5 where n is 1, 4, 8, 18 respectively). (Note SIGNED is the default) Hmm, how about BINARY-C-LONG [SIGNED/UNSIGNED] giving 4 or 8 bytes depending on 32/64 bit implementation. Should be relatively easy to do and would seem to be quite useful. Roger ---------------------------------------------------------------- Yes, I do plan on following up and working out the manifest and runtime constants. I'll have to investigate, but I hope (and assume) the typedef enums are constant and consistent across platforms/releases. Getting at most of them is a pain. They are generated by preprocessor macros and are not a simple read and port to COBOL. I got at the 10002 and the CURLOPT_URL by using printf. Same goes for error codes, though at least those are listed in curl.h as simple values. So I'll make up an error message table of some form or other as well (probably simple English only at first). I like the idea of datatyping the 4 or 8 byte (or other) requirements on the COBOL side and not having to worry about extra layers of wrapper. Anything you could work out would be marvelous. I'll know a lot more about the potential headaches over the next couple of days. The next step is to try and work out some of the callbacks and to use some operations a little more sophisticated than the manual (and relatively easy) experiments I've done so far. Cheers And once again; thank you sir. ---------------------------------------------------------------- OK. Current tarball has a speculative implementation of USAGE BINARY-C-LONG (SIGNED/UNSIGNED). SIGNED is default and does not have to be specified. Therefore, if you are interfacing to some stupid library that has "long"s as params, then you can - 01 MYCLONG USAGE BINARY-C-LONG. CALL "blahblah" USING BY VALUE MYCLONG. Which will generate the appropiate 4/8 byte values depending on OC generation. Roger ---------------------------------------------------------------- Yet again; that's awesome Roger! Questions for everyone: I've started a COPY source file for the libcurl bindings, but I'd like some opinions before proceeding too far. The result codes are sequentially numbered constants in curl.h but I'd also like to provide a corresponding error message string. Not too sure the best way to proceed with this. Once I get past this, I'll be writing a C program to generate the curlsym.cpy file. It'll just be easier in the long run that way, and it'll save trying to manually figure out the constants from the curl.h preprocessor macros. By the way ... the first (or second) libcurl app I plan on writing is an OpenCOBOL program to download the current 1.1 tarball. :) [code] *> manifest constants for libcurl bindings *> Usage: COPY curlsym inside data division *> Result codes 78 CURLE_OK VALUE 0. *> Error codes 78 CURLE_UNSUPPORTED_PROTOCOL value 1. 78 CURLE_FAILED_INIT value 2. 78 CURLE_URL_MALFORMAT value 3. 78 CURLE_OBSOLETE4 value 4. 78 CURLE_COULDNT_RESOLVE_PROXY value 5. 78 CURLE_COULDNT_RESOLVE_HOST value 6. 78 CURLE_COULDNT_CONNECT value 7. 78 CURLE_FTP_WEIRD_SERVER_REPLY value 8. *> Error strings 01 LIBCURL_ERRORS. 02 CURLEVALUES. 03 filler pic x(30) VALUE "CURLE_UNSUPPORTED_PROTOCOL ". 03 filler pic x(30) VALUE "CURLE_FAILED_INIT ". 03 filler pic x(30) VALUE "CURLE_URL_MALFORMAT ". 03 filler pic x(30) VALUE "CURLE_OBSOLETE4 ". 03 filler pic x(30) VALUE "CURLE_COULDNT_RESOLVE_PROXY ". 03 filler pic x(30) VALUE "CURLE_COULDNT_RESOLVE_HOST ". 03 filler pic x(30) VALUE "CURLE_COULDNT_CONNECT ". 03 filler pic x(30) VALUE "CURLE_FTP_WEIRD_SERVER_REPLY ". 01 filler redefines LIBCURL_ERRORS. 02 CURLEMSG occurs 8 times pic x(30). *> global init constants 78 CURL_GLOBAL_ALL VALUE 3. *> curl set option constants 78 CURLOPT_URL VALUE 10002. *> libcurl get option constants 78 CURLINFO_EFFECTIVE_URL VALUE 1048577. [/code] The above is very incomplete... Test usage... [code] >>SOURCE FORMAT IS FIXED *> ************************************************************** *> *> Copyright (C) 2008 The OpenCOBOL Project *> *> This program is free software; you can redistribute it and/or *> modify it under the terms of the GNU General Public License as *> published by the Free Software Foundation; either version 2, *> or (at your option) any later version. *> *> This program is distributed in the hope that it will be *> useful, but WITHOUT ANY WARRANTY; without even the implied *> warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR *> PURPOSE. See the GNU General Public License for more details. *> *> You should have received a copy of the *> GNU General Public License along with this software; *> see the file COPYING. If not, write to *> the Free Software Foundation, 51 Franklin Street, Fifth Floor *> Boston, MA 02110-1301 USA *> ************************************************************** *> Author: Brian Tiffin *> Date: 02-Jul-2008 *> Purpose: Experiment with and test libcurl bindings identification division. program-id. showcurl. data division. working-storage section. *> include the libcurl symbols copy curlsym. 01 handle usage is pointer. 01 result pic s9(8) comp-5. 01 url. 02 filler pic x(20) value 'http://opencobol.org'. 02 filler pic x(1) value X"00". 01 user-url pic x(80). 01 ind pic 99. 01 str-ptr usage is pointer. 01 display-url pic x(80). linkage section. 01 current-url pic x(80). procedure division. call "curl_global_init" using by value CURL_GLOBAL_ALL returning result end-call. call "curl_easy_init" returning handle end-call. display "handle: " handle end-display. * Get a url from the user or command line accept user-url from command-line end-accept. if user-url equal spaces then display "url: " with no advancing end-display accept user-url end-accept if user-url equal spaces then move url to user-url end-if end-if. * take first piece as the actual url string user-url delimited by space into display-url end-string. move display-url to user-url. * get the real length perform varying ind from length user-url by -1 until user-url(ind:1) not equal space end-perform. * Add a C null byte if ind equal length user-url then subtract 1 from length user-url giving ind end-subtract end-if. move X"00" to user-url(ind + 1:1). * tell cURL the url, the only mandatory easy field call "curl_easy_setopt" using by value handle by value CURLOPT_URL by reference user-url returning result end-call. display "set url: " result end-display * Prove the curl handle is getting information call "curl_easy_getinfo" using by value handle by value CURLINFO_EFFECTIVE_URL by reference str-ptr returning result end-call. set address of current-url to str-ptr. * skip the null terminator for display string current-url delimited by low-value into display-url end-string. display "get url: " result ", " display-url end-display. * default operations is read the url and send to stdout call "curl_easy_perform" using by value handle returning result end-call. if result not equal 0 then display "perform: " result ", " CURLEMSG(result) end-display end-if. * Clean up call "curl_easy_cleanup" using by value handle end-call exit program. stop run. [/code] Along the lines of [code] $ ./showcurl somebadurl handle: 0x08059630 set url: +00000000 get url: +00000000, somebadurl perform: +00000006, CURLE_COULDNT_RESOLVE_HOST [/code] But I think the messages should be localized, and instead of RTFM, I thought I'd Ask A Friendly Human first. Along with any hints about i18n and L10n, I have a question about a COPY source being FIXED of FREE form and how that should be handled? Cheers Brian ---------------------------------------------------------------- Looks good. Some comments about libcurl. I have never in all my life seen such an ill-conceived interface. Packing everything including the dog's dinner into one call is insane (curl_easy_setopt). Have you seen the prototype - ---------------------- #define curl_easy_setopt(handle, option, value) \ __extension__ ({ \ __typeof__ (option) _curl_opt = option; \ if (__builtin_constant_p(_curl_opt)) { \ if (_curl_is_long_option(_curl_opt) && !_curl_is_long(value)) \ _curl_easy_setopt_err_long(); \ if (_curl_is_off_t_option(_curl_opt) && !_curl_is_off_t(value)) \ _curl_easy_setopt_err_curl_off_t(); \ if (_curl_is_string_option(_curl_opt) && !_curl_is_string(value)) \ _curl_easy_setopt_err_string(); \ if (_curl_is_write_cb_option(_curl_opt) && !_curl_is_write_cb(value)) \ _curl_easy_setopt_err_write_callback(); \ if ((_curl_opt) == CURLOPT_READFUNCTION && !_curl_is_read_cb(value)) \ _curl_easy_setopt_err_read_cb(); \ if ((_curl_opt) == CURLOPT_IOCTLFUNCTION && !_curl_is_ioctl_cb(value)) \ _curl_easy_setopt_err_ioctl_cb(); \ if ((_curl_opt) == CURLOPT_SOCKOPTFUNCTION && !_curl_is_sockopt_cb(value))\ _curl_easy_setopt_err_sockopt_cb(); \ if ((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION && \ !_curl_is_opensocket_cb(value)) \ _curl_easy_setopt_err_opensocket_cb(); \ if ((_curl_opt) == CURLOPT_PROGRESSFUNCTION && \ !_curl_is_progress_cb(value)) \ _curl_easy_setopt_err_progress_cb(); \ if ((_curl_opt) == CURLOPT_DEBUGFUNCTION && !_curl_is_debug_cb(value)) \ _curl_easy_setopt_err_debug_cb(); \ if ((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION && \ !_curl_is_ssl_ctx_cb(value)) \ _curl_easy_setopt_err_ssl_ctx_cb(); \ if (_curl_is_conv_cb_option(_curl_opt) && !_curl_is_conv_cb(value)) \ _curl_easy_setopt_err_conv_cb(); \ if ((_curl_opt) == CURLOPT_SEEKFUNCTION && !_curl_is_seek_cb(value)) \ _curl_easy_setopt_err_seek_cb(); \ if (_curl_is_cb_data_option(_curl_opt) && !_curl_is_cb_data(value)) \ _curl_easy_setopt_err_cb_data(); \ if ((_curl_opt) == CURLOPT_ERRORBUFFER && !_curl_is_error_buffer(value)) \ _curl_easy_setopt_err_error_buffer(); \ if ((_curl_opt) == CURLOPT_STDERR && !_curl_is_FILE(value)) \ _curl_easy_setopt_err_FILE(); \ if (_curl_is_postfields_option(_curl_opt) && !_curl_is_postfields(value)) \ _curl_easy_setopt_err_postfields(); \ if ((_curl_opt) == CURLOPT_HTTPPOST && \ !_curl_is_arr((value), struct curl_httppost)) \ _curl_easy_setopt_err_curl_httpost(); \ if (_curl_is_slist_option(_curl_opt) && \ !_curl_is_arr((value), struct curl_slist)) \ _curl_easy_setopt_err_curl_slist(); \ if ((_curl_opt) == CURLOPT_SHARE && !_curl_is_ptr((value), CURLSH)) \ _curl_easy_setopt_err_CURLSH(); \ } \ curl_easy_setopt(handle, _curl_opt, value); \ }) ------------------------------------ And that only works for gcc. You do not get any sort of (pseudo) type checking with any other C compiler. Now back to Cobol use. More and more I am tending to say design a loose wrapper for libcurl. Here are some points - Let's start with the option parameter (eg. CURLOPT_URL) - defined as type "CURLoption". This is not, as you may think, an "int". It is actually an "enum". The C compiler is quite free to choose the resultant type after enumerating (sic) all the values. The only constraint is that the resultant type must be capable (obviously) of representing all the values. The "long" problem has already been mentioned. Now comes, to add to the fun, size_t, ssize_t, off_t. This last (off_t) is used natively (as off_t) and as curls version curl_off_t. Add into the fun things like fd_set and the socket stuff and it really looks like a big headache to use libcurl directly from Cobol. What is actually required is to define/design/implement a new binding for Cobol. (See Curl homepage for the 30 or so existing bindings /eg. Perl, Ada95, Pascal, etc.) Roger ---------------------------------------------------------------- They certainly did go overboard in trying to make things "easy". I've started a spec document. Thrash and swale now seems a poor way of attacking this one. It'll require a fair amount of background work before proceeding too fast into the proverbial painted corner. So, it is unlikely that there will anything of public release quality anytime soon. But, hopefully there will be usable little bits and pieces to post along the way. I was a forther most of my professional career so I was using the SP-Forth "bindings" as a base to start from. Thanks for the advice Roger. I still think libcurl will be a worthwhile toolkit for OC, and in the doing, may open doors to other major/minor library systems. For now I think it is back to the main goal of getting some docs written. :) Cheers Brian Edit; And yes you are right about the light wrapper. The OC libcurl bindings will be more appropriate as a module, not a direct interface to the the libcurl library itself. ---------------------------------------------------------------- Being the anal person I am, I made some changes while working with your very nice sample code. I changed the code that adds the null terminator to just use STRING. I also changed the call of "curl_easy_getinfo" to set the address of current-url directly in the call. I also got rid of all of the unneeded statement terminators. They are needed only for conditional code, and in my opinion just clutter things up when used in other cases. Also got rid of all of the 'then' clauses. Yuck! :-) Oh, and changed the 'pic s9(8) comp-5' to the more modern usage 'binary-long'. Anyway, nice program. Very useful! [code] >>SOURCE FORMAT IS FREE identification division. program-id. showcurl. data division. working-storage section. *> include the libcurl symbols copy curlsym. 01 handle usage is pointer. 01 result binary-long. 01 url. 02 filler pic x(20) value 'http://opencobol.org'. 02 filler pic x(1) value X"00". 01 user-url pic x(80). 01 display-url pic x(80). linkage section. 01 current-url pic x(80). procedure division. call "curl_global_init" using by value CURL_GLOBAL_ALL returning result call "curl_easy_init" returning handle display "handle: " handle *> Get a url from the user or command line accept user-url from command-line if user-url equal spaces display "url: " with no advancing accept user-url if user-url equal spaces move url to user-url end-if end-if. *> take first piece as the actual url *> terminate with C null terminator string user-url delimited by space x"00" delimited by size into display-url move display-url to user-url *> tell cURL the url, the only mandatory easy field call "curl_easy_setopt" using by value handle by value CURLOPT_URL by reference user-url returning result display "set url: " result *> Prove the curl handle is getting information call "curl_easy_getinfo" using by value handle by value CURLINFO_EFFECTIVE_URL by reference address of current-url returning result *> skip the null terminator for display string current-url delimited by low-value into display-url display "get url: " result ", " display-url *> default operations is read the url and send to stdout call "curl_easy_perform" using by value handle returning result if result not equal 0 display "perform: " result ", " CURLEMSG(result) end-if *> Clean up call "curl_easy_cleanup" using by value handle goback. [/code] Frank ---------------------------------------------------------------- Thanks Frank. I learned a few new tricks with that one. If you don't mind, your changes may well make it into the example/sample bundle (at Roger's leisure) that will probably grow along with OC development. We'll have to work out a shared credit scheme soon, as I want to add some of Bear's work and other posted snippets as well. Umm, on approval of course; the copyrights being transferred being one issue, along with honouring everyone's right to privacy, anonymity or use of pseudonym in the credits if desired. This kick at libcurl probably won't be the interface exposed to programmers if an actual binding layer is developed, but I think it may make a good demo of API calls and highlight the potential of OpenCOBOL. Your version has a cleaner, fresher smelling quality to it. :) Cheers Brian ---------------------------------------------------------------- I'm not concerned about credit. You did all the hard work. One additional change that might be interesting to others is to move current-url from the LINKAGE SECTION to the WORKING-STORAGE SECTION and make it a BASED data item. IE: 01 current-url pic x(80) based. In my opinion the LINKAGE SECTION should be used only for data items that are also specified on the PROCEDURE DIVISION USING statement. I understand why the LINKAGE SECTION is "mis-used" in this other manner, because it was required prior to the existance of the BASED clause. But now with BASED I prefer it this way. Or maybe it's just because I helped BASED get implemented in to OpenCobol. (Wait, perhaps I do like to get credit. :-) ) Frank ---------------------------------------------------------------- Your updates got me thinking: I'm using your enhanced version to write up a little piece on different ways of solving some problems and how handy the advancements can be. And credits where credits due. :) Thanks Frank. Cheers, Brian ---------------------------------------------------------------- Frank's comments are OK. However be careful with scope terminators (END-xxx) Here is (a not particularly good) example with the identation being what you think/want to happen - [code] CALL "blah" ON EXCEPTION DISPLAY "Blup" NOT ON EXCEPTION DISPLAY "Blup2" END-CALL. [/code] However, that is NOT how it is parsed due to DISPLAY also having an exception phrase. So it is actually - [code] CALL "blah" ON EXCEPTION DISPLAY "Blup" NOT ON EXCEPTION DISPLAY "Blup2" END-CALL. [/code] Therefore to be strictly correct as meant it should be - [code] CALL "blah" ON EXCEPTION DISPLAY "Blup" END-DISPLAY NOT ON EXCEPTION DISPLAY "Blup2" END-DISPLAY END-CALL. [/code] Roger ---------------------------------------------------------------- Subject: FAQ; Request for comments Hello, This is an initial cut of an OpenCOBOL FAQ using ReStructuredText. There are a few problems (the ReST interpreter could not handle some of the CLI options - so I flubbed them until I can figure out an explicit override) but I do like the readability of the raw source. PLEASE NOTE: This is no where near a first release of the FAQ. Solely posted here for group comment before proceeding too far. If you'd like to see the output HTML, install docutils, place this source in a directory ocfaq.txt and simply run rst-buildhtml (rst-buildhtml will scan the directory for any and all .txt files and produce .html outputs). Note, the ReST system will allow for CSS skinning and we'll be able to make this FAQ follow Look and Feel for the OpenCOBOL project. [code] ============= OpenCOBOL FAQ ============= .. Attention:: This is only a test :Authors: Brian Tiffin [btiffin]_ (with the invaluable assistance of many others) :Organization: The OpenCOBOL Project :Version: 0.0 :Status: Experimental - Not for public release :Copyright: |copyleft| OpenCOBOL --------- Q. What is OpenCOBOL_? OpenCOBOL is an open-source COBOL_ compiler. OpenCOBOL implements a substantial part of the `COBOL 85`_ and `COBOL 2002`_ standards, as well as many extensions of the existent COBOL compilers. OpenCOBOL translates COBOL into C and compiles the translated code using the native C compiler. You can build your COBOL programs on various platforms, including Unix/Linux, Mac OS X, and Microsoft Windows. Q. How is OpenCOBOL licensed? The compiler is licensed under GNU General Public License. The run-time library is licensed under GNU Lesser General Public License. History ------- Q. What is the development history of OpenCOBOL? OpenCOBOL was initially developed by Keisuke Nishida [Keisuke]_ . The first public release was version 0.9.0 on January 25th, 2002. Development continued apace, with version 0.30 released by Keisuke on August 8th, 2004. Roger While then took up the role as lead developer on October 30th, 2004. Version 0.31 was released February 1st, 2005. Q. What is the current version of OpenCOBOL? OpenCOBOL 1.0 was released December 27th, 2007 by Roger While [Roger]_ OpenCOBOL 1.1 pre-release is currently in active development, and can be found at `OpenCOBOL 1.1`_ Using OpenCOBOL --------------- Q. How does the OpenCOBOL compiler work? OpenCOBOL is a command line driven compiler. It produces intermediate C source code that is then passed to a configured C compiler, the GNU C compiler, **gcc** being a standard. The main tool, **cobc**, by defaulti, produces linkable object files. Usage: cobc [options] file... Options: --help Display this message --version, -V Display compiler version -v Display the programs invoked by the compiler -x Build an executable program -m Build a dynamically loadable module (default) --std= Compile for a specific dialect --std=cobol2002 COBOL 2002 --std=cobol85 COBOL 85 --std=ibm IBM Compatible --std=mvs MVS Compatible --std=bs200 BS200 Compatible --std=mf MicroFocus --std=default See config/default.conf and config/`*`.conf -free Use free source format -fixed Use fixed source format default -O, --O2, --Os Enable optimization -g Produce debugging information in the output -debug Enable all run-time error checking -o Place the output into -b Combine all input files into a single dynamically loadable module -E Preprocess only; do not compile, assemble or link -C Translation only; convert COBOL to C -S Compile only; output assembly file -c Compile and assemble, but do not link -t Generate and place a program listing into -I Add to copybook search path -L Add to library search path -l Link the library -D Pass to the C compiler --conf= User defined dialect configuration - See -std= --list-reserved Display all reserved words -save-temps Do not delete intermediate files --MT Set target file used in dependency list --MF Place dependency list into --ext Add default file extension -Wall Enable all warnings -Wobsolete Warn if obsolete features are used -Warchaic Warn if archaic features are used -Wcolumn-overflow Warn if any text after column 72 -Wredefinition Warn incompatible redefinition of data items -Wconstant Warn inconsistent constant -Wparentheses Warn lack of parentheses around AND within OR -Wterminator Warn lack of scope terminator (END-XXX) -Wstrict-typing Warn type mismatch strictly -Wimplicit-define Warn implicitly defined data items -Wcall-params Warn non 01/77 items for CALL params (NOT set with -Wall) -Wtruncate Warn possible field truncation (NOT set with -Wall) -ftrace Generate trace code (Executed SECTION/PARAGRAPH) -ftraceall Generate trace code (Executed SECTION/PARAGRAPH/STATEMENTS) -fsyntax-only Syntax error checking only; don't emit any output -fstatic-call Output static function calls for the CALL statement -fdebugging-line Enable debugging lines ('D' in indicator column) -fsource-location Generate source location code (Turned on by -debug or -g) -fimplicit-init Do automatic initialization of the Cobol runtime system -fstatic-linkage Statically allocate non-USING LINKAGE parameters -fsign-ascii Numeric display sign ASCII (Default on ASCII machines) -fsign-ebcdic Numeric display sign EBCDIC (Default on EBCDIC machines) -fstack-check PERFORM stack checking (Turned on by -debug or -g) -ffold-copy-lower Fold COPY subject to lower case (Default no transformation) -ffold-copy-upper Fold COPY subject to upper case (Default no transformation) -fnotrunc Do not truncate binary fields according to PIC (ala MF) -fnull-param Pass extra NULL terminating pointers on CALL statements Authors ------- .. [Keisuke] Keisuke Nishida Initial developer and creator of OpenCOBOL .. [Roger] Roger While OpenCOBOL 1.1 is currently in development, and Roger is the lead programmer. .. [btiffin] Brian Tiffin Initial FAQ .. _OpenCOBOL: http://opencobol.org/ .. _`OpenCOBOL 1.1`: http://www.opencobol.org/modules/mydownloads/singlefile.php?cid=1&lid=2 .. _COBOL: http://en.wikipedia.org/wiki/COBOL .. _`COBOL 85`: http://cantfindtheproper.org .. _`COBOL 2002`: http://cantfindtheproper.org .. |copysym| unicode:: 0xA9 .. |copyleft| replace:: Copyright |copysym| 2008 The OpenCOBOL Project [/code] Edit; removed Keisuke's email address. My bad. ---------------------------------------------------------------- The posted sample uses a Definition List for the main Q and As. That will change. Cheers ---------------------------------------------------------------- Looks fine. Brian, can you tar up your posted examples (after checking the warnings/errors) and send me. I can not post my actual adrress here. Go to OC on SourceForge and you can find my SF mailing address there. I will start to setup a samples/examples directory. Re. warnings etc. This is being pedantic but there are a couple of warnings that are not automatically turned on with -Wall (see cobc --help) So to be strictly correct :-) you should check with -Wall -Wcall-params -Wtruncate. Roger ---------------------------------------------------------------- Sounds like a plan. Since your post I've been using this [i]check[/i] shell script. [code] #!/bin/bash echo "MF" cobc -x -Wall -Wcall-params -Wtruncate -std=mf $* echo "cobol85" cobc -x -Wall -Wcall-params -Wtruncate -std=cobol85 $* echo "cobol2002" cobc -x -Wall -Wcall-params -Wtruncate -std=cobol2002 $* echo "opencobol" cobc -x -Wall -Wcall-params -Wtruncate $* [/code] I just added the two new warning options, and yes they picked up an S9(8) vs S9(9) problem. :) Cheers P.S. I'll reconfirm first, but I'd like to bag up some of Bear's posted SCREEN SECTION samples as well. ---------------------------------------------------------------- Sent two of the samples that compile warning free across the dialects. JUSTIFY and LOGICALS More soon. Cheers Brian Edit; Oh yeah, feel free to rename, duff them over, change credits, whatever. These are project donations. ---------------------------------------------------------------- To anyone interested in adding to the FAQ. I found this link today, http://docutils.sourceforge.net/FAQ.html#how-can-i-mark-up-a-faq-or-other-list-of-questions-answers from the author of ReST. I'd like to follow the section title option he suggests. It'll index nicely, it reads nice and it'll make marking up the answers a free and easy (all features allowed) procedure. The definition lists I used in the posted sample hinder some of the more advanced features for the answers as they require indentation, breaking some of the ease of use rules. The only limitation with that format is that questions will need to be on a single line. For those rare long questions, a shortform could be used for the section title with a more complete version of the question in the section body. Section titles are easy in ReST. [code] This is a section title ----------------------- [/code] As long as the dashes are the same length as the proceeding text, ReST assumes a section title. You can even use over and under lining [code] --------------------- Q. What is OpenCOBOL? --------------------- [/code] To make the raw source even more readable. Any 7bit clean ASCII character can be used for these over/under lines but ReST keeps track of section/sub/subsubsection leveling by initial appearance in the document. I'd like to pick a FAQ standard of = (top level title) - (minus - for section) and . (period - for sub sections) After that, I think just going by first user to need subsub sectioning gets to choose and conflicts can be worked out with a global search replace before merge. Section bodies are simply blank line delimited paragraphs. Easy on the eyes and easy on the typing. Cheers everyone, Brian Note; the over/under lines look a lot better with a fixed-width font. It is the character count that counts. ---------------------------------------------------------------- New FAQ for comment [code] ************* OpenCOBOL FAQ ************* .. Attention:: This is only a test .. Sectnum:: :Authors: Brian Tiffin [btiffin]_ (with the invaluable assistance of many others) :Organization: The OpenCOBOL Project :Version: 0.0 :Status: Experimental - Not for public release :Copyright: |copyleft| :Changelog: changelog_ .. Contents:: FAQ Index ========= OpenCOBOL ========= Q. What is OpenCOBOL_? ---------------------- OpenCOBOL is an open-source COBOL_ compiler. OpenCOBOL implements a substantial part of the `COBOL 85`_ and `COBOL 2002`_ standards, as well as many extensions of the existent COBOL compilers. OpenCOBOL translates COBOL into C and compiles the translated code using the native C compiler. You can build your COBOL programs on various platforms, including Unix/Linux, Mac OS X, and Microsoft Windows. Q. How is OpenCOBOL licensed? ----------------------------- The compiler is licensed under GNU General Public License. The run-time library is licensed under GNU Lesser General Public License. ======= History ======= Q. What is the development history of OpenCOBOL? ------------------------------------------------ OpenCOBOL was initially developed by Keisuke Nishida [Keisuke]_ The first public release was version 0.9.0 on January 25th, 2002. Development continued apace, with version 0.30 released by Keisuke on August 8th, 2004. Roger While then took up the role as lead developer on October 30th, 2004. Version 0.31 was released February 1st, 2005. Q. What is the current version of OpenCOBOL? -------------------------------------------- OpenCOBOL 1.0 was released December 27th, 2007 by Roger While [Roger]_ OpenCOBOL 1.1 pre-release is currently in active development, and can be found at `OpenCOBOL 1.1`_ =============== Using OpenCOBOL =============== Q. How does the OpenCOBOL compiler work? ---------------------------------------- OpenCOBOL is a command line driven compiler. It produces intermediate C source code that is then passed to a configured C compiler, the GNU C compiler, **gcc** being a standard. The main tool, **cobc**, by defaulti, produces linkable object files. Q. What compiler options are supported? --------------------------------------- Usage: cobc [options] file... Options: --help Display this message --version, -V Display compiler version -v Display the programs invoked by the compiler -x Build an executable program -m Build a dynamically loadable module (default) --std= Compile for a specific dialect --std=cobol2002 COBOL 2002 --std=cobol85 COBOL 85 --std=ibm IBM Compatible --std=mvs MVS Compatible --std=bs200 BS200 Compatible --std=mf MicroFocus --std=default See config/default.conf and config/`*`.conf -free Use free source format -fixed Use fixed source format default -O, --O2, --Os Enable optimization -g Produce debugging information in the output -debug Enable all run-time error checking -o Place the output into -b Combine all input files into a single dynamically loadable module -E Preprocess only; do not compile, assemble or link -C Translation only; convert COBOL to C -S Compile only; output assembly file -c Compile and assemble, but do not link -t Generate and place a program listing into -I Add to copybook search path -L Add to library search path -l Link the library -D Pass to the C compiler --conf= User defined dialect configuration - See -std= --list-reserved Display all reserved words -save-temps Do not delete intermediate files --MT Set target file used in dependency list --MF Place dependency list into --ext Add default file extension -Wall Enable all warnings -Wobsolete Warn if obsolete features are used -Warchaic Warn if archaic features are used -Wcolumn-overflow Warn if any text after column 72 -Wredefinition Warn incompatible redefinition of data items -Wconstant Warn inconsistent constant -Wparentheses Warn lack of parentheses around AND within OR -Wterminator Warn lack of scope terminator (END-XXX) -Wstrict-typing Warn type mismatch strictly -Wimplicit-define Warn implicitly defined data items -Wcall-params Warn non 01/77 items for CALL params (NOT set with -Wall) -Wtruncate Warn possible field truncation (NOT set with -Wall) -ftrace Generate trace code (Executed SECTION/PARAGRAPH) -ftraceall Generate trace code (Executed SECTION/PARAGRAPH/STATEMENTS) -fsyntax-only Syntax error checking only; don't emit any output -fstatic-call Output static function calls for the CALL statement -fdebugging-line Enable debugging lines ('D' in indicator column) -fsource-location Generate source location code (Turned on by -debug or -g) -fimplicit-init Do automatic initialization of the Cobol runtime system -fstatic-linkage Statically allocate non-USING LINKAGE parameters -fsign-ascii Numeric display sign ASCII (Default on ASCII machines) -fsign-ebcdic Numeric display sign EBCDIC (Default on EBCDIC machines) -fstack-check PERFORM stack checking (Turned on by -debug or -g) -ffold-copy-lower Fold COPY subject to lower case (Default no transformation) -ffold-copy-upper Fold COPY subject to upper case (Default no transformation) -fnotrunc Do not truncate binary fields according to PIC (ala MF) -fnull-param Pass extra NULL terminating pointers on CALL statements ======= Authors ======= .. [Keisuke] Keisuke Nishida Initial developer and creator of OpenCOBOL .. [Roger] Roger While OpenCOBOL 1.1 is currently in development, and Roger is the lead programmer. .. [btiffin] Brian Tiffin Initial FAQ ========= Changelog ========= Experimental version for commnent; 02-July-2008 .. _OpenCOBOL: http://opencobol.org/ .. _`OpenCOBOL 1.1`: http://www.opencobol.org/modules/mydownloads/singlefile.php?cid=1&lid=2 .. _COBOL: http://en.wikipedia.org/wiki/COBOL .. _`COBOL 85`: http://cantfind.org .. _`COBOL 2002`: http://catfind.org .. |copysym| unicode:: 0xA9 .. |copyleft| replace:: Copyright |copysym| 2008 The OpenCOBOL Project [/code] I'm liking this, but please note that in this copy the options Usage section is incorrect (still flubbed the -std and -O2 entries for instance). Cheers Brian ---------------------------------------------------------------- Ladies, Gentlemen; Here is the 0.0a pre-alpha copy of the OpenCOBOL FAQ. I apologize in advance for the size of the post. I apologize in advance for the TODO's not yet TODONE. But I get excited. :-) The html can be viewed by running $ rst-buildhtml in the working dir of where you file ocfaq.txt. Note: rst-buildhtml is aggressive. It will scan the dir for any and all .txt files, so it has a tendency of littering the file system with .html files when run from the wrong working dir. --stylesheet=ocfaq.css is pending. I'd really appreciate comments before I find a permanent home for the FAQ and start posting to comp.lang.cobol etc This 0.0a version has TODO items, will have bugs, falsehoods, near falsehoods, omissions, and needs verification... [code] ************* OpenCOBOL FAQ ************* .. Formatted for docutils, ReStructuredText. rst-buidhtml .. Attention:: This is the 0.0a pre alpha release of the OpenCOBOL FAQ .. Sectnum:: :Authors: Brian Tiffin [btiffin]_ (with the invaluable assistance of many others) :Organization: The OpenCOBOL Project :Version: 0.0a :Status: Experimental - Not for public release :Copyright: |copyleft| :Changelog: changelog_ .. Contents:: FAQ Index ========= OpenCOBOL ========= Q. What is OpenCOBOL_? ---------------------- OpenCOBOL is an open-source COBOL_ compiler. OpenCOBOL implements a substantial part of the `COBOL 85`_ and `COBOL 2002`_ standards, as well as many extensions of the existent COBOL compilers. OpenCOBOL translates COBOL into C and compiles the translated code using the native C compiler. You can build your COBOL programs on various platforms, including Unix/Linux, Mac OS X, and Microsoft Windows. Q. What is COBOL_? ------------------ COBOL is an acronym for COmmon Business Oriented Language. This author has always thought of it as "Common Business" Oriented more than Common "Business Oriented", but that emphasis is perhaps up to the readers point of view. Q. How is OpenCOBOL licensed? ----------------------------- The compiler is licensed under `GNU General Public License`_. The run-time library is licensed under `GNU Lesser General Public License`_. Q. What platforms are supported by OpenCOBOL? --------------------------------------------- `OpenCOBOL 1.0`_ the current official release version, hosted on SourceForge.net, compiles on: * All 32-bit MS Windows (95/98/NT/2000/XP) * All POSIX (Linux/BSD/UNIX-like OSes) * OS/X `OpenCOBOL 1.1`_ also hosted on SourceForge.net, has been tested on * MS Windows * POSIX Systems * OS/X Q. How complete is OpenCOBOL? ----------------------------- `OpenCOBOL 1.0`_ implements a substantial portion of COBOL 85, supports many of the advances and clarifications of COBOL 2002, and includes many extensions in common use from Micro Focus COBOL, ACUCOBOL and other exsistent compilers. `OpenCOBOL 1.1`_ implements a more substantial portion of the COBOL 85 Dialect, COBOL 2002 and a growing number of vendor extensions. Some proposed COBOL 2008 features have also been implemented. Compatibility support includes: * MF for Micro Focus * IBM for IBM compatibility * MVS * BS2000 OpenCOBOL also includes some advanced features allowing source code such as :: CALL "cfunction" USING BY REFERENCE ADDRESS OF VAR-IN-LINKAGE-SECTION. Passing the equivalent of char**, pointer to pointer to char. Just as an small example of the level of coverage provided by OpenCOBOL. Q. Will I be amazed? -------------------- This author believes so. For an open source implementation of COBOL, OpenCOBOL may surprise you in the depth and breadth of it's COOBOL standard feature support, usability and robustness. Q. Does OpenCOBOL include a Test Suite? --------------------------------------- Why yes it does. 74 syntax tests, 170 coverage tests, and 16 data representation tests at last count. From the development tarball, **$ make check** will evaluate and report on the test suite. Q. Does OpenCOBOL pass the NIST Test Suite? ------------------------------------------- .. Attention:: Look into this Q. Can OpenCOBOL be used for CGI? --------------------------------- Yes. Through standard IO redirection and the extended **ACCEPT ... FROM ENVIRONMENT ...** feature, OpenCOBOL is more than capable of supporting advanced CGI programming. Q. Can OpenCOBOL by used for production applications? ----------------------------------------------------- Depends. OpenCOBOL is still in active development. Feature coverage is growing, and while the current implementation offers great coverage, applicability to any given situation would need to analyzed and risks evaluated before commitment to production use. The licensing allows for commercial use, but OpenCOBOL also ships with notice of indemnity, meaning that there are no guarantees when using OpenCOBOL, directly or indirectly. There may be a time when commercial support of OpenCOBOL is offered, but at the time of writing no known offering exists. .. Attention:: Look into this Q. Where can I get more information about COBOL? ------------------------------------------------ The `COBOL FAQ`_ by William M Klein is a great place to start. A google of the search words "COBOL" or "OpenCOBOL" are bound to lead to enough days worth of reading of in-depth articles, opinions and technical information to satisfy the greatest of curiosities. Q. Where can I get more information about OpenCOBOL? ---------------------------------------------------- The opencobol.org_ website is probably the best place to find out more about the OpenCOBOL system. Q. Do you know any good jokes? ------------------------------ Maybe. * A computer without COBOL and Fortran is like chocolate cake without ketchup and mustard. *Author: unknown* * A determined coder can write COBOL programs in any language. *Author: unknown* * Rumour has it that the object oriented specification for COBOL was code named *ADD 1 TO COBOL GIVING COBOL.* *Author: unknown* * Eat COBOL, three quadrillion transactions can't be wrong. *Author: Brian Tiffin* * What did COBOL yell to the escaping thief? **STOP RUN RETURNING NOW.** *Author: Brian Tiffin* * What did COBOL reply to the executive? Why yes, I can *PERFORM JUMPS THRU HOOPS.* *Author: Brian Tiffin* * What did OpenCOBOL reply to the executive? Sir, I can *PERFORM JUMPS THRU FLAMING-HOOPS UNTIL HELL-FREEZES-OVER.* And being COBOL, I have to show you how little code it takes: :: identification division. program-id. freeze. data division. working-storage section. 01 hell pic 9. 88 hell-freezes-over value 1. procedure division. perform jumps thru flaming-hoops until hell-freezes-over. stop run. jumps. flaming-hoops. divide 1 by 0 giving hell. *Author: Brian Tiffin* ======= History ======= Q. What is the development history of OpenCOBOL? ------------------------------------------------ OpenCOBOL was initially developed by Keisuke Nishida [Keisuke]_ The first public release was version 0.9.0 on January 25th, 2002. Development continued apace, with version 0.30 released by Keisuke on August 8th, 2004. Roger While then took up the role as lead developer on October 30th, 2004. Version 0.31 was released February 1st, 2005. Q. What is the current version of OpenCOBOL? -------------------------------------------- OpenCOBOL 1.0 was released December 27th, 2007 by Roger While [Roger]_. The decision to go 1.0 from the 0.33 version followed the 0.32 release of 05-May-2005. A Debian apt binary package exists for OpenCOBOL 1.0 as **open-cobol** and lists dependencies of * libc6 (>= 2.7-1), * libcob1, * libcob1-dev (= 1.0-1), * libdb4.5 (>= 4.5.20-3), * libdb4.5-dev, * libgmp3-dev, * libgmp3c2, * libltdl3-dev, * libncurses5 (>= 5.6+20071006-3) Thanks to the gracious efforts of Bart Martens, bartm on Debian's .org domain. OpenCOBOL 1.1 pre-release became active on December 27th, 2007 and is currently in active development. The pre-release source tar can be found at `OpenCOBOL 1.1`_ with installer instructions at `OpenCOBOL Install`_ and in the INSTALLING text file of the sources. Q. Are there pre-built OpenCOBOL packages ----------------------------------------- Yes. Debian APT, and RPM packages exist. Packages for NetBSD. Many. Google *opencobol packages* for any late breaking news. =============== Using OpenCOBOL =============== Q. How do I install OpenCOBOL? ------------------------------ Installation instructions can be found at `OpenCOBOL Install`_. Q. Does OpenCOBOL have any other dependencies? ---------------------------------------------- OpenCOBOL relies on a native C compiler with POSIX compatibility. GCC being a freely available compiler collection supported by most operating systems currently in use. OpenCOBOL requires the following external libraries to be installed: GNU MP (libgmp) 4.1.2 or later libgmp is used to implement decimal arithmetic. GNU MP is licensed under GNU Lesser General Public License. GNU Libtool (libltdl) libltdl is used to implement dynamic CALL statements. GNU Libtool is licensed under GNU Lesser General Public License. NOTE - Libtool is not required for Linux and Windows (including MinGW and Cygwin) The following libraries are optional: Berkeley DB (libdb) 1.85 or later libdb can be used to implement indexed file I/O and SORT/MERGE. Berkeley DB is licensed under the original BSD License (1.85) or their own open-source license (2.x or later). Note that, as of 2.x, if you linked your software with Berkeley DB, you must distribute the source code of your software along with your software, or you have to pay royalty to Oracle Corporation. For more information about Oracle Berkeley DB dual licensing go to : Oracle / Embedded / Oracle Berkeley DB Ncurses (libncurses) 5.2 or later libncurses can be used to implement SCREEN SECTION. Ncurses is licensed under a BSD-style license. Q. How does the OpenCOBOL compiler work? ---------------------------------------- OpenCOBOL is a multi-stage command line driven compiler. Command line options control what stages are performed during processing. 1. Preprocess #. Translate #. Compile #. Assemble #. Link #. Build OpenCOBOL produces intermediate C source code that is then passed to a configured C compiler and other tools. the GNU C compiler, **gcc** being a standard. The main tool, **cobc**, by default, produces modules, linkable shared object files. Example :: $ cat hello.cob Original source code; :: 000100* HELLO.COB OpenCOBOL FAQ example 000200 IDENTIFICATION DIVISION. 000300 PROGRAM-ID. hello. 000400 PROCEDURE DIVISION. 000500 DISPLAY "Hello World!". 000600 STOP RUN. OpenCOBOL stages; :: $ cobc -E hello.cob Preprocess only; produces :: # 1 "hello.cob" IDENTIFICATION DIVISION. PROGRAM-ID. hello. PROCEDURE DIVISION. DISPLAY "Hello World!". STOP RUN. to standard out. :: $ cobc -C hello.cob Translate only; preprocesses and then translates the COBOL sources into C. You can examine these files to get a good sense of how the OpenCOBOL environment interacts with the native C facilities. OpenCOBOL 1.1 produced **hello.c.h** and **hello.c**. :: $ cobc -S hello.cob Compile only; outputs assembly file. Produces **hello.s**. :: $ cobc -c hello.cob Compile and assemble, do not link. Produces **hello.o**. :: $ cobc -m hello.cob Build dynamically loadable module. The is the *default behaviour*. This example produces **hello.so** or **hello.dll**. .. Attention:: Need a little OS/X info here :: $ cobc -x hello.cob Build an executable program. This examples produces **hello** or **hello.exe**. **This is important**. *cobc* produces a shared library by default. *To create executables*, you need to use **-x**. :: $ ./hello Hello World! OpenCOBOL also supports features for multiple source, multiple language programming, detailed in the FAQ at `Q. Does OpenCOBOL support modules?`_. Q. What compiler options are supported? --------------------------------------- .. Note to maintainers. Build with $ cobc --help and indent 4 spaces. :: Usage: cobc [options] file... Options: --help Display this message --version, -V Display compiler version -v Display the programs invoked by the compiler -x Build an executable program -m Build a dynamically loadable module (default) -std= Compile for a specific dialect : cobol2002 Cobol 2002 cobol85 Cobol 85 ibm IBM Compatible mvs MVS Compatible bs2000 BS2000 Compatible mf Micro Focus Compatible default When not specified See config/default.conf and config/\*.conf -free Use free source format -fixed Use fixed source format (default) -O, -O2, -Os Enable optimization -g Produce debugging information in the output -debug Enable all run-time error checking -o Place the output into -b Combine all input files into a single dynamically loadable module -E Preprocess only; do not compile, assemble or link -C Translation only; convert COBOL to C -S Compile only; output assembly file -c Compile and assemble, but do not link -t Generate and place a program listing into -I Add to copybook search path -L Add to library search path -l Link the library -D Pass to the C compiler -conf= User defined dialect configuration - See -std= --list-reserved Display all reserved words -save-temps Do not delete intermediate files -MT Set target file used in dependency list -MF Place dependency list into -ext Add default file extension -Wall Enable all warnings -Wobsolete Warn if obsolete features are used -Warchaic Warn if archaic features are used -Wcolumn-overflow Warn if any text after column 72 -Wredefinition Warn incompatible redefinition of data items -Wconstant Warn inconsistent constant -Wparentheses Warn lack of parentheses around AND within OR -Wterminator Warn lack of scope terminator (END-XXX) -Wstrict-typing Warn type mismatch strictly -Wimplicit-define Warn implicitly defined data items -Wcall-params Warn non 01/77 items for CALL params (NOT set with -Wall) -Wtruncate Warn possible field truncation (NOT set with -Wall) -ftrace Generate trace code (Executed SECTION/PARAGRAPH) -ftraceall Generate trace code (Executed SECTION/PARAGRAPH/STATEMENTS) -fsyntax-only Syntax error checking only; don't emit any output -fstatic-call Output static function calls for the CALL statement -fdebugging-line Enable debugging lines ('D' in indicator column) -fsource-location Generate source location code (Turned on by -debug or -g) -fimplicit-init Do automatic initialization of the Cobol runtime system -fstatic-linkage Statically allocate non-USING LINKAGE parameters -fsign-ascii Numeric display sign ASCII (Default on ASCII machines) -fsign-ebcdic Numeric display sign EBCDIC (Default on EBCDIC machines) -fstack-check PERFORM stack checking (Turned on by -debug or -g) -ffold-copy-lower Fold COPY subject to lower case (Default no transformation) -ffold-copy-upper Fold COPY subject to upper case (Default no transformation) -fnotrunc Do not truncate binary fields according to PIC (ala MF) -fnull-param Pass extra NULL terminating pointers on CALL statements Q. What are the OpenCOBOL reserved words? ----------------------------------------- COBOL_ is a reserved word rich language. The OpenCOBOL compiler recognizes: .. Note to maintainers. Built with $ cobc --list-reserved, followed by a 74 column wide reformat and 4 space indent. The counts were calculated from $ wc and grepping for the literal "-1" in the cobc/reserved.c source. :: ACCEPT ACCESS ACTIVE-CLASS ADD ADDRESS ADVANCING AFTER ALIGNED ALL ALLOCATE ALPHABET ALPHABETIC ALPHABETIC-LOWER ALPHABETIC-UPPER ALPHANUMERIC ALPHANUMERIC-EDITED ALSO ALTER ALTERNATE AND ANY ANYCASE ARE AREA AREAS ARGUMENT-NUMBER ARGUMENT-VALUE ARITHMETIC AS ASCENDING ASSIGN AT ATTRIBUTE AUTO AUTOMATIC B-AND B-NOT B-OR B-XOR BACKGROUND-COLOR BASED BEFORE BELL BINARY BINARY-C-LONG BINARY-CHAR BINARY-DOUBLE BINARY-LONG BINARY-SHORT BIT BLANK BLINK BLOCK BOOLEAN BOTTOM BY BYTE-LENGTH CALL CANCEL CD CENTER CF CH CHAIN CHAINING CHARACTER CHARACTERS CLASS CLASS-ID CLASSIFICATION CLOSE CODE CODE-SET COL COLLATING COLS COLUMN COLUMNS COMMA COMMAND-LINE COMMIT COMMON COMMUNICATION COMP COMP-1 COMP-2 COMP-3 COMP-4 COMP-5 COMP-X COMPUTATIONAL COMPUTATIONAL-1 COMPUTATIONAL-2 COMPUTATIONAL-3 COMPUTATIONAL-4 COMPUTATIONAL-5 COMPUTATIONAL-X COMPUTE CONDITION CONFIGURATION CONSTANT CONTAINS CONTENT CONTINUE CONTROL CONTROLS CONVERTING COPY CORR CORRESPONDING COUNT CRT CURRENCY CURSOR CYCLE DATA DATA-POINTER DATE DAY DAY-OF-WEEK DE DEBUGGING DECIMAL-POINT DECLARATIVES DEFAULT DELETE DELIMITED DELIMITER DEPENDING DESCENDING DESTINATION DETAIL DISABLE DISK DISPLAY DIVIDE DIVISION DOWN DUPLICATES DYNAMIC EBCDIC EC EGI ELSE EMI ENABLE END END-ACCEPT END-ADD END-CALL END-COMPUTE END-DELETE END-DISPLAY END-DIVIDE END-EVALUATE END-IF END-MULTIPLY END-OF-PAGE END-PERFORM END-READ END-RECEIVE END-RETURN END-REWRITE END-SEARCH END-START END-STRING END-SUBTRACT END-UNSTRING END-WRITE ENTRY ENTRY-CONVENTION ENVIRONMENT ENVIRONMENT-NAME ENVIRONMENT-VALUE EO EOL EOP EOS EQUAL EQUALS ERASE ERROR ESCAPE ESI EVALUATE EXCEPTION EXCEPTION-OBJECT EXCLUSIVE EXIT EXPANDS EXTEND EXTERNAL FACTORY FALSE FD FILE FILE-CONTROL FILE-ID FILLER FINAL FIRST FLOAT-EXTENDED FLOAT-LONG FLOAT-SHORT FOOTING FOR FOREGROUND-COLOR FOREVER FORMAT FREE FROM FULL FUNCTION FUNCTION-ID GENERATE GET GIVING GLOBAL GO GOBACK GREATER GROUP GROUP-USAGE HEADING HIGH-VALUE HIGH-VALUES HIGHLIGHT I-O I-O-CONTROL ID IDENTIFICATION IF IGNORING IMPLEMENTS IN INDEX INDEXED INDICATE INHERITS INITIAL INITIALIZE INITIALIZED INITIATE INPUT INPUT-OUTPUT INSPECT INTERFACE INTERFACE-ID INTO INTRINSIC INVALID INVOKE IS JUST JUSTIFIED KEY LABEL LAST LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME LEADING LEFT LENGTH LESS LIMIT LIMITS LINAGE LINAGE-COUNTER LINE LINE-COUNTER LINES LINKAGE LOCAL-STORAGE LOCALE LOCK LOW-VALUE LOW-VALUES LOWLIGHT MANUAL MEMORY MERGE MESSAGE METHOD METHOD-ID MINUS MODE MOVE MULTIPLE MULTIPLY NATIONAL NATIONAL-EDITED NATIVE NEGATIVE NESTED NEXT NO NONE NORMAL NOT NULL NULLS NUMBER NUMBERS NUMERIC NUMERIC-EDITED OBJECT OBJECT-COMPUTER OBJECT-REFERENCE OCCURS OF OFF OMITTED ON ONLY OPEN OPTIONAL OPTIONS OR ORDER ORGANIZATION OTHER OUTPUT OVERFLOW OVERLINE OVERRIDE PACKED-DECIMAL PADDING PAGE PAGE-COUNTER PARAGRAPH PERFORM PF PH PIC PICTURE PLUS POINTER POSITION POSITIVE PRESENT PREVIOUS PRINTER PRINTING PROCEDURE PROCEDURE-POINTER PROCEDURES PROCEED PROGRAM PROGRAM-ID PROGRAM-POINTER PROMPT PROPERTY PROTOTYPE PURGE QUEUE QUOTE QUOTES RAISE RAISING RANDOM RD READ RECEIVE RECORD RECORDING RECORDS RECURSIVE REDEFINES REEL REFERENCE RELATION RELATIVE RELEASE REMAINDER REMOVAL RENAMES REPLACE REPLACING REPORT REPORTING REPORTS REPOSITORY REQUIRED RESERVE RESET RESUME RETRY RETURN RETURNING REVERSE-VIDEO REWIND REWRITE RF RH RIGHT ROLLBACK ROUNDED RUN SAME SCREEN SD SEARCH SECONDS SECTION SECURE SEGMENT SELECT SELF SEND SENTENCE SEPARATE SEQUENCE SEQUENTIAL SET SHARING SIGN SIGNED SIGNED-INT SIGNED-LONG SIGNED-SHORT SIZE SORT SORT-MERGE SOURCE SOURCE-COMPUTER SOURCES SPACE SPACES SPECIAL-NAMES STANDARD STANDARD-1 STANDARD-2 START STATEMENT STATUS STEP STOP STRING STRONG SUB-QUEUE-1 SUB-QUEUE-2 SUB-QUEUE-3 SUBTRACT SUM SUPER SUPPRESS SYMBOL SYMBOLIC SYNC SYNCHRONIZED SYSTEM-DEFAULT TABLE TALLYING TAPE TERMINAL TERMINATE TEST TEXT THAN THEN THROUGH THRU TIME TIMES TO TOP TRAILING TRUE TYPE TYPEDEF UCS-4 UNDERLINE UNIT UNIVERSAL UNLOCK UNSIGNED UNSIGNED-INT UNSIGNED-LONG UNSIGNED-SHORT UNSTRING UNTIL UP UPDATE UPON USAGE USE USER-DEFAULT USING UTF-16 UTF-8 VAL-STATUS VALID VALIDATE VALIDATE-STATUS VALUE VALUES VARYING WHEN WITH WORKING-STORAGE WRITE YYYYDDD YYYYMMDD ZERO ZEROES ZEROS 511 words in OC 1.1, 136 of which are marked not yet implemented. 375 functional reserved words, as of July 2008. Q. Does OpenCOBOL support modules? ---------------------------------- Yes. Quite nicely in fact. Dynamically! *Or when using the **-fstatic_call** compiler option, Statically! for optimal performance*. COBOL_ modules, and object files of many other languages are linkable. As OpenCOBOL uses intermediate C, linkage to other languages is well supported across many platforms. The OpenCOBOL CALL_ instruction maps COBOL USAGE_ to many common C stack frame data representations. Multipart, complex system development is well integrated in the OpenCOBOL model. :: $ cobc -b hello.cob goodbye.cob Combines both source files into a single dynamically loadable module. Example produces **hello.so**. Using the **-l** link library option, OpenCOBOL has access to most shared libraries supported on it's platforms. :: $ cobc -x -lcurl showcurl.cob Will link the /usr/lib/libcurl.so (*from the cURL project*) to showcurl. The OpenCOBOL CALL_ verb will use this linked library to resolve calls at runtime. Large scale systems are at the heart of COBOL development and OpenCOBOL is no exception. Q. Is there a C interface to OpenCOBOL? --------------------------------------- Most definitely. See http://www.opencobol.org/modules/bwiki/index.php?cmd=read&page=UserManual%2F2_3#content_1_0 for details. Q. Does OpenCOBOL support COPY includes? ---------------------------------------- Yes. COPY is supported, but some limitations to the REPLACING adverb may be encountered. .. Attention:: Look into this The **-I** compiler option influences the copybook search path. Q. Does OpenCOBOL support WHEN-COMPILED? ---------------------------------------- Both as a noun and as an intrinsic function. :: DISPLAY WHEN-COMPILED. DISPLAY FUNCTION WHEN-COMPILED. 07/05/0805.15.20 2008070505152000-0400 Q. What source formats are accepted by OpenCOBOL? ------------------------------------------------- Both FIXED and FREE COBOL source formats are supported. FIXED format follows the 1-6, 7, 8-72 special columns of the COBOL standards. The compiler directives: :: Column 12345678901234567890 >> SOURCE FORMAT IS FREE >> SOURCE FORMAT IS FIXED can be used as the first line of any source files. The directive must occur at column 8 or beyond. Continuation indicators in column 7 are not applicable to FREE format and are not supported in this mode of translation. The special *> till end of line comment is supported in both FREE and FIXED forms, but by necessity will need to be placed at column 7 or greater in FIXED format sources <*. The **-free** and **-fixed** options to **cobc** also influence the expected source formats, with the default being FIXED. Q. What is the shortest OpenCOBOL program? ------------------------------------------ All that is needed is a program-id. Doesn't do much. :: identification division. program-id. a. Q. How do I get those nifty sequential sequence numbers in a source file? ------------------------------------------------------------------------- FIXED format COBOL uses the first 6 positions of each line as a programmer defined **sequence** field. This field is stripped as part of the preprocessing and is not validated. Historically, the sequence numbers were used to verify that card punch cards were read into a card reader in the proper order. Many legacy COBOL programs have sequentially numbered sequence values. Here is a little **vi** trick to renumber the sequence field by 100s. Given :: 000005* HELLO.COB OpenCOBOL FAQ example 000010 IDENTIFICATION DIVISION. 000020 PROGRAM-ID. hello. 000030 PROCEDURE DIVISION. 000040 DISPLAY "Hello World!". 000100 STOP RUN. Running the following **ex** filter :%!perl -ne 'printf("\\%06d\\%s\\n", $. * 100, substr($_, 6, -1));' .. Note to readers of the plain text of this FAQ. ReStructuredText uses backslash to escape certain features. That line is actually :%!perl -ne 'printf("\%06d\%s\n", $. * 100, substr($_, 6, -1));' produces a nicely resequenced source file. :: 000100* HELLO.COB OpenCOBOL FAQ example 000200 IDENTIFICATION DIVISION. 000300 PROGRAM-ID. hello. 000400 PROCEDURE DIVISION. 000500 DISPLAY "Hello World!". 000600 STOP RUN. * Note: Only use this on already FIXED form source. If used on any FREE format COBOL, the first 6 columns will be damaged. This has no effect on the compilation process, it only effects the appearance of the sources. ===== Notes ===== .. These are the internal, non question information nodes. CALL ---- The OpenCOBOL CALL verb accepts literal or identifier stored names when resolving the transfer address. The USING phrase allows argument passing and OpenCOBOL includes internal rules for the data representation of the call stack entities that depend on the COBOL PICTURE_ and USAGE_ clauses. Return values are captured with RETURNING identifier. For more information see http://www.opencobol.org/modules/bwiki/index.php?cmd=read&page=UserManual%2F2_3#content_1_0 PICTURE ------- Full standards support of all alpha, alphanumeric and numeric storage specifiers as well as full support for edit and numeric-edit clauses. USAGE ----- OpenCOBOL uses standard big-endian_ internal storage by default. USAGE clauses influence the data representation. The INTEL architecture uses little-endian_ form and OpenCOBOL programmers developing for this common chipset may need to pay heed to this for performance purposes. As per the standards, OpenCOBOL supports COMPUTATIONAL-5 native usage. OpenCOBOL enables use of one to eight byte binary representations in both big and little endian forms. Along with full support of all common COBOL_ PICTURE_ clauses both storage and display, OpenCOBOL supports USAGE claues of: * BINARY .. Attention:: TODO big-endian ---------- Binary values stored with the most significant byte at the lowest memory address. **Big End First**. See http://en.wikipedia.org/wiki/Endianness for more details. The OpenCOBOL compiler *default* storage format for USAGE_ BINARY and COMP. little-endian ------------- Binary values stored with the most significant byte at the highest memory address. **Little End First**. http://en.wikipedia.org/wiki/Endianness for more details. This is the common Intel architecture form, and USAGE_ clauses of COMPUTATIONAL-5, BINARY-CHAR, BINARY-SHORT, BINARY-LONG, BINARY-DOUBLE are a true performance boost on this hardware. See http://www.opencobol.org/modules/bwiki/index.php?cmd=read&page=UserManual%2F4#content_1_0 for some details. EBCDIC ------ Extended Binary Coded Decimal Interchange Code. A character encoding common to mainframe systems, therefore COBOL, therefore OpenCOBOL. Different than ASCII_ and OpenCOBOL supports both through efficient mappings. See http://en.wikipedia.org/wiki/EBCDIC for more info. ASCII ----- American Symbolic Code for Information Interchange. The character encoding common to personal computers and the Internet Age, therefore OpenCOBOL. OpenCOBOL also supports the EBCDIC_ character encoding so some data transfers and keyboard handling or console display programs may need programmer attention to detail. Although this is a rare case as OpenCOBOL operates using an intelligent choice of encoding for each platform build. .. Attention:: Look into this See http://en.wikipedia.org/wiki/American_Standard_Code_for_Information_Interchange for more info. ======= Authors ======= .. [Keisuke] Keisuke Nishida Initial developer and creator of OpenCOBOL. |KeisukeActive| was the primary developer and OpenCOBOL project lead. His efforts are greatly appreciated by the userbase of OpenCOBOL. .. [Roger] Roger While OpenCOBOL 1.1 is currently in development, and Roger is the lead programmer. |RogerActive|, Roger has been very active on the opencobol.org_ website, and is open to feature requests and clarifications to the implementation. =========== Maintainers =========== .. [btiffin] Brian Tiffin Initial FAQ, sample programs for OpenCOBOL 1.1. ========= Changelog ========= 02-July-2008 Experimental version for commnent 06-July-2008 First 0.0 pre-alpha release .. These are the external link substitutions. .. _OpenCOBOL: http://opencobol.org/ .. _opencobol.org: http://opencobol.org/ .. _`OpenCOBOL 1.0`: http://opencobol.org/modules/mydownloads/singlefile.php?cid=1&lid=3 .. _`OpenCOBOL 1.1`: http://www.opencobol.org/modules/mydownloads/singlefile.php?cid=1&lid=2 .. _COBOL: http://en.wikipedia.org/wiki/COBOL .. _`COBOL 85`: http://cantfind.org .. _`COBOL 2002`: http://cantfind.org .. _`COBOL FAQ`: http://home.comcast.net/~wmklein/FAQ/COBOLFAQ.htm .. _`OpenCOBOL Install`: http://www.opencobol.org/modules/bwiki/index.php?InstallGuide .. _`OpenCOBOL Wiki`: http://www.opencobol.org/modules/bwiki/ .. _`OpenCOBOL Forum`: http://www.opencobol.org/modules/newbb/ .. _`OpenCOBOL News`: http://www.opencobol.org/modules/news/ .. _`GNU General Public License`: http://www.gnu.org/licenses/gpl.html .. _`GNU Lesser General Public License`: http://www.gnu.org/licenses/lgpl.html .. This section holds replacements and special symbols. .. |copysym| unicode:: 0xA9 .. |copyleft| replace:: Copyright |copysym| 2008 The OpenCOBOL Project .. |KeisukeActive| replace:: From the 1990s through 2004 .. |RogerActive| replace:: From early 2004 up till today, and tomorrow [/code] Cheers ---------------------------------------------------------------- Brian, Excellent FAQ. I like the direction this is going. Compiled fine. For those running Ubuntu you want to: sudo apt-get install python-docutils Then copy the text Brian has created into a directory and run rst-htmlbuild As Brian mentions, make sure you don't have other text files in there, or it will try to process them all. I know the FAQ is a work in progress and you've probably thought about some of the things I am about to mention. So here we go. Some requests for the FAQ: It would be useful to provide some examples in the text of the FAQ itself. Such as the sections 1.9 (CGI) and 4.1 (CALL). I can work up a CGI example or two. Just have to remember how I did it last year. Section 1.13: Add 1 to COBOL giving COBOL...could also add: Add 1 to COBOL. (I added that on wikipedia since its the equivalent and nearly as concise as c++....) Section 3.5: List the keywords separately that are not yet implemented, even if recognized. Section 3.12: I think I could write a program in OC to add numbering. It would have to check to see if the file is numbered, if it is labeled >>free format, and if the positions contain anything besides numbers. It would be useful to have the program statically linked so it was the only binary needed. I'll keep you posted. Short suggestions since you've done a splendid job on this. Thanks for the work. ---------------------------------------------------------------- Thanks aoirthoir. I've updated the jokes section. :) And I agree, small code snippets will make for a nicer FAQ. I won't inflict the entire file on the august readers of the forum anymore, but I'll be posting some new questions, highlighting just how easy it will be for anyone to add a question and answer or two. I'll take a crack at pulling out the reserved words marked as NYI. I think I missed some too, perhaps not reserved words, but supported, like the WHEN-COMPILED noun. It would be nice if that Answer section eventually becomes hyperlink heavy, with either links to the OpenCOBOL Reference Manual or some friendly external source. An OpenCOBOL program that did that vi perl resequencer trick ... that would be cool. So would a CGI sample. Looking forward to continuing. Once again, thanks aoirthoir. Next step is hunt for a home to host the HTML (and perhaps PDF versions), and I'll wait for a little more approval and a correction pass before this gets tagged true 0.1alpha and posted to usenet. Cheers, Brian ---------------------------------------------------------------- New bits. This text file should show off how easy it will be for everyone to take part in the FAQ. :-) After this, I'll probably post diffs instead. Note the change to upper and under lining. Way easier to grok for questions. Nice feature of ReST imho. Cheers, Brian. [code] ---------------- Q. What is cobc? ---------------- **cobc** is the OpenCOBOL compiler. See `Q. What compiler options are supported`_ for more information. ------------------- Q. What is cobcrun? ------------------- **cobcrun** is the OpenCOBOL driver program that allows the execution of programs stored in OpenCOBOL modules. The **cobc** compiler, by default, produces modules (the *-m* option). These modules are linkable shared libraries. Using GNU/Linux for example:: $ cobc -x hello.cob $ ./hello Hello World! $ cobc hello.cob $ cobcrun hello Hello World! The **cobc -x hello.cob** built an executable binary called hello. The **cobc hello.cob** produced a shared library hello.so, and cobcrun resolves the entry point and executes the code, right from the shared library. **cobcrun** *is the compiler author's preferred way to manage OpenCOBOL development.* It alleviates knowing which source file needs *-x* and encourages proper modular programming, a mainstay of OpenCOBOL. ---------------------- Q. What is cob-config? ---------------------- **cob-config** is a program that can be used to find the C compiler flags and libraries required for compiling. Using GNU/Linux for example:: $ cob-config --libs -L/usr/local/lib -lcob -lm -lgmp -lncurses -ldb You may need to use these features during mixed source language development, usually by back-ticking the command output inline with other **gcc** commands. ---------------------------------- Q. Can I use ctags with OpenCOBOL? ---------------------------------- Yes. Use the Exuberant version of ctags. Exhuberant ctags recognizes COBOL, producing a TAGS or tags file suitable for **emacs**, **vi**, **nedit** or other editors that support the ctags format. ctags, by default, only supports the competition, C and Fortran. After running ctags program.cob:: $ vi -t WORKING-STORAGE will open program.cob and start at the line defining the working-storage section. Note: tags are case-sensitive and for larger projects, the above vi command would start an edit of the *first* file with an occurrence of WORKING-STORAGE found in the tags. ---------------------------------------------------------------------- Q. What are some idioms for dealing with C char * data from OpenCOBOL? ---------------------------------------------------------------------- *Thanks to Frank Swarbrick for pointing these idioms out* To add or remove a null terminator, use the STRING verb. For example:: * Add a null for calling C STRING current-url DELIMITED BY SPACE X"00" DELIMITED BY SIZE INTO display-url MOVE display-url TO current-url * Remove a null for display STRING current-url DELIMITED BY LOW-VALUE INTO display-url. Or to make changes in place:: * Change nulls to spaces INSPECT current-url REPLACING ALL X"00" WITH SPACE. Or there is also modified references in OpenCOBOL:: * Assume IND is the first trailing space (or picture limit). * Note: OpenCOBOL auto initializes working-storage to SPACES or ZEROES * depending on numeric or non-numeric pictures. * Remove null MOVE SPACE TO current-url(IND:1). * Add a zero terminator MOVE X"00" TO current-url(IND:1). When a parameter needs to be passed between C and OpenCOBOL, you can use the BASED optional clause in WORKING-STORAGE:: * Create a BASED allocation WORKING-STORAGE SECTION. 01 current-url PIC X(80) BASED. This may be a cleaner solution than:: LINKAGE SECTION. 01 current-url PIC X(80). And a SET ADDRESS OF CARG ... sequence. With the CALL verb, use ADDRESS OF and/or BY REFERENCE:: CALL "CFUNCTION" USING BY REFERENCE ADDRESS OF current-url. --------------------------------------------- Q. What is the OpenCOBOL LINKAGE SECTION for? --------------------------------------------- Argument passing in COBOL is normally accomplished through the **LINKAGE SECTION**. This section does not allocate or initialize memory as would definitions in the WORKING-STORAGE SECTION. Care must be taken to inform COBOL of the actual source address of these variables before use. Influences CHAINING and USING phrases. See CALL_ for more details. --------------------------------------------------------------- Q. What does the -fstatic-linkage OpenCOBOL compiler option do? --------------------------------------------------------------- Good question. .. Attention:: Look into this. ----------------------------------------- Q. Does OpenCOBOL support SCREEN SECTION? ----------------------------------------- Yes. The OpenCOBOL 1.1 pre-release now includes support for SCREEN SECTIONs. Experimental release for this support occurred in early July, 2008. ------------------------------------------ Q. Does OpenCOBOL implement Report Writer? ------------------------------------------ Not at this time. *July, 2008* ---------------------------------------------------- Q. Does OpenCOBOL implement any Intrinsic Functions? ---------------------------------------------------- Yes, many. As of the July 2008 1.1 pre-release:: ABS, ACOS, ANNUITY, ASIN, ATAN, BYTE-LENGTH, CHAR, COS, CURRENT-DATE, DATE-OF-INTEGER, DATE-TO-YYYYMMDD, DAY-OF-INTEGER, DAY-TO-YYYYDDD, E, EXCEPTION-FILE, EXCEPTION-LOCATION, EXCEPTION-STATEMENT, EXCEPTION-STATUS, EXP, EXP10, FACTORIAL, FRACTION-PART, INTEGER, INTEGER-OF-DATE, INTEGER-OF-DAY, INTEGER-PART, LENGTH, LOCALE-DATE, LOCALE-TIME, LOG, LOG10, LOWER-CASE, MAX, MEAN, MEDIAN, MIDRANGE, MIN, MOD, NUMVAL, NUMVAL-C, ORD, ORD-MAX, ORD-MIN, PI, PRESENT-VALUE, RANDOM, RANGE, REM, REVERSE, SECONDS-FROM-FORMATTED-TIME, SECONDS-PAST-MIDNIGHT, SIGN, SIN, SQRT, STANDARD-DEVIATION, STORED-CHAR-LENGTH, SUM, TAN, TEST-DATE-YYYYMMDD, TEST-DATE-YYYYMMDD, TRIM, UPPER-CASE, VARIANCE, WHEN-COMPILED, YEAR-TO-YYYY ---------------------------------------------------------------------- Q. What is the difference between the LENGTH verb and FUNCTION LENGTH? ---------------------------------------------------------------------- Good question. .. Attention:: Look into this. ------------------------------------------------------------------- Q. Does OpenCOBOL support the Object features of the 2002 standard? ------------------------------------------------------------------- Not yet. *July 2008* --------------------------------------- Q. Does OpenCOBOL implement PICTURE 78? --------------------------------------- Yes. PICTURE 78 clauses can be used for constants, translated at compile time. This common non-standard extension is supported in OpenCOBOL. ------------------------------------------------- Q. Does OpenCOBOL support mixed case source code? ------------------------------------------------- Absolutely, kind of. Mixed case and mixed format, ASCII_ and EBCDIC_. Most COBOL compilers have not required uppercase only source code for quite a few years now, but OpenCOBOL folds the source to uppercase before translating. The compiler is case insensitive to names:: 000100 identification division. 000200 program-id. mixcase. 000300 data division. 000400 working-storage section. 000500 01 SOMEUPPER pic x(9). 000600 01 SomeUpper pic x(9). 000700 01 someupper pic x(9). 000800 000900 procedure division. 001000 move "SOMEUPPER" to SOMEUPPER. 001100 move "SomeUpper" to SomeUpper. 001200 move "someupper" to someupper. 001300 display "SOMEUPPER: " SOMEUPPER end-display. 001400 display "SomeUpper: " SomeUpper end-display. 001500 display "someupper: " someupper end-display. 001600 stop run. $ cobc -x mixcase.cob mixcase.cob:10: Error: 'SOMEUPPER' ambiguous; need qualification mixcase.cob:5: Error: 'SOMEUPPER' defined here mixcase.cob:6: Error: 'SOMEUPPER' defined here mixcase.cob:7: Error: 'SOMEUPPER' defined here Note; that although the folded declarations conflict, the DISPLAY quoted strings will NOT be folded, and would display as expected. *Case sensitivity is also at the mercy of operating system conventions*. Under GNU/Linux, OpenCOBOL's dynamic link loader is case sensitive. :: CALL "C$JUSTIFY" USING center-string "C" END-CALL is not the same as:: CALL "c$justify" USING center-string "C" END-CALL. In support of case folding and COPY libraries, OpenCOBOL supports *-ffold-copy-lower* and *-ffold-copy-upper*. For mixing and matching legacy sources. Trivia The expressions *uppercase* and *lowercase* date back to early moveable type. Typographers would keep two cases of metal casted letters, Capitalized and normal. Usually set on stacked shelves over the workbench. The small letters, being used more frequently, ended up on the lower shelf; the lower case letters. [/code] ---------------------------------------------------------------- Brian, some comments - 1) References to "shared library". Strictly speaking what we create is a DSO (Dynamic Shared Object). There is a subtle difference between the two. 2) "When a parameter needs to be passed between C and OpenCOBOL, you can use the BASED optional clause in WORKING-STORAGE::" No, no. That has nothing whatsoever to do with C. BASED states that the item initially does not have any permanent storage area. "And a SET ADDRESS OF CARG ... sequence." I think you mean "current-url" not "CARG" Also, you still have to do this for BASED. (Not clear with the sentences what the "And" is referring to. 3) "What is the difference between the LENGTH verb and FUNCTION LENGTH?" The standard only defines FUNCTION LENGTH. The LENGTH OF phrase is an extension (from MF) 4) "Q. What does the -fstatic-linkage OpenCOBOL compiler option do?" This relates to LINKAGE items that are NOT referred to in the USING phrase of the PROCEDURE DIVISION. It also only has relevance when the program is CALL'ed from another prog. This means that the addressability of these items must be programmed (usually with SET ADDRESS) before reference. Per default, the item loses it's addressability on exit from the program. This option causes the module to retain the item's address between CALL invocations of the program. Roger ---------------------------------------------------------------- Thanks Roger; 1) Will correct the nomenclature. 2) You got me. My copy has Attention:: No Clue. I'll find out a way of learning it so I can explain it and fix. :) 3) Thanks and 4) Thanks. Cheers, Brian ---------------------------------------------------------------- Just an aside here - Generally speaking one can use LOW-VALUE instead of X"00" in phrases and, in fact, are interchangeable in Brian's snippets/examples. Now one for the Cobolers out there :-) Under what circumstances/constructs is it necessary to specifically use X"00"? Roger ---------------------------------------------------------------- I think x'00' can always be replaced by the verb low-value, the same for x'FF' and high-value. But it's nice if you want to have a defined length of x'00'. For a length of 3 x'00' You could write[code] 77 myvar pic x(500). 77 strpoint pic 9(03) value 1. 77 var3 pic x(03). 01 filler pic 9. 88 using-lv-yes value 0. 88 using-lv-no value 1. ... 01. if using-lv-yes move all low-values to var3 else move all x'00' to var3 end-if string var3 delimited by size into myvar with pointer strpoint end-string continue. 02. if using-lv-yes string low-value low-value low-value delimited by size into myvar with pointer strpoint end-string else string x'00' x'00' x'00' delimited by size into myvar with pointer strpoint end-string end-if continue. 03. string x'000000' delimited by size into myvar with pointer strpoint end-string[/code]The last one (paragraph 03) seems most readable for me ---------------------------------------------------------------- Brian, I have reviewed "-fstatic-linkage" once again. I am just wondering if we should make this the default and kick out the option altogether. I can't think of any reason why we should not. Let me go back over my notes from way-back-when to see if a light bulb goes on (eg. Aaahhh, that's why we do it so). Human, No, there is at least one case where X"00" can NOT be replaced with LOW-VALUE :-) The case that I am thinking of will compile and will execute, it will not, however, produce the same result. Roger ---------------------------------------------------------------- Roger, please stop let guessing me and post your case. ---------------------------------------------------------------- Naa, let's give other people in different timezones a chance to think about this one. Incidentally, the case that I am thinking of is perfectly according to standard. Roger ---------------------------------------------------------------- No clue about LOW-VALUE versus X"00". But to be honest, I've usually used "\0" in C, instead of NULL as a grok highlight, so in the cases where a C interface is involved, you may see other snippets using X"00", either on purpose or, old dog new tricks. :) Question for anyone; I'd like to keep the FAQ clean for emailing, newline at 80 or less. ReST structure may break if not. But some urls are longer than 80. Any advice? Is it a worthy concern? [i]Did I break a cardinal rule of FAQing by trying to use markup?[/i] Cheers, Brian ---------------------------------------------------------------- This pulled me from lurking to curious. I seem to remember that some collating sequences do not always represent low-values as x"00", or high-values as x"ff". btw. This project sounds like it is really gaining traction. Time to dust off the accounting apps and try another compile session. ---------------------------------------------------------------- Brian, Really good work with the FAQ. I would also like to start to categorize everything in the forum. And also to have a way to mark forum topics SOLVED, COMPLETED, DEPRECATED and such like that. This way if a forum topic just no longer applies others can know it. And this is another idea, we get a lot of cross posting with our conversations in these threads. I think it might help, if we have ideas that aren't specifically on topic to the thread in question, to start a new topic. That way when the documentation team needs to find answers, it will be easier to do so. (Just a suggestion) Also if the FAQ can't be hosted here, or its mechanism for creating it and allowing contributions, I've about a billion gigabytes at dreamhost (ok 350 give or take or something like that) that I'd be glad to share. I'm going to be really really busy the next couple of weeks cleaning up lots of legacy data on my personal system and my servers at work, so I won't be able to help much just yet. Once that cleans up, I'll be able to help though. ---------------------------------------------------------------- aoirthoir; Thanks again and I should be making a serious pass at finding a home for the generated HTML/PDF over the next few weeks. OpenCOBOL is a huge system in terms of breadth and depth of details. Lots of questions can be answered, so there will be a few more pre-alpha stabs at the FAQ before unleashing it on the world. On that point; [i]Does anyone have a nice logo for OpenCOBOL?[/i] And/or skill at CSS to make for an attractive page. Skinning the ReST output is dirt easy technically, but artistically it's outside my normal comfort zone. A mascot? SUIT; a COBOL flavoured Tux? Or a dinosaur with borg parts? Or ... ;-) Cheers Brian ---------------------------------------------------------------- I have a few guys that might be willing to contribute the design. Also as mentioned if you need space I have it. As far as the logo, I'd suggest something non-linux specific, since OC runs on a lot of other OSes as well. As a suggestion I also own the domains cultcobol.com and add1tocobol.com so if we wanted to use those we could. I can also register, any domain that Roger would want us to use for the Open Cobol Documentation effort. Something else, can we find out how many folks are willing to help us with this? Maybe send out a note to the mailing list and let's try to stir up interest. Your doing a great one man job right now, but eventually there is going to be a lot of docs. The cobol standard said somewhere that for a compiler to be standards compliant it also had to have documentation. So I'd like to see the language itself, as implemented by OC, as well as its extensions and extensions borrowed from other compilers, documented. Maybe even a course. So it's going to get pretty extensive if we have the help. And of course keeping it well organized as you have done with the FAQ alpha, is going to make it much easier for us all. ---------------------------------------------------------------- aoirthoir; Sounds great (having a potential home) and organized efforts for the bigger picture. Roger; Do you (or Keisuke) have any preferences as to the direction this should take? Cheers, Brian ---------------------------------------------------------------- Subject: OC for windows : Cygwin or MinGW ? Hello, From the beginning I was always testing on Linux (Debian or Ubuntu). I'm getting some holidays in a couple of days and I installed OC (July 2nd) in Cygwin environment. [code] wget ... gunzip tar cd open-cobol.... ./configure make make check make install [/code] I found some difference when compiling with -Wall switch. It displays often messages like [code] DISPLAY statement not terminated by END-DISPLAY CALL statement not terminated by END-CALL [/code] Did I forgot doing something ? Best regards Bear ---------------------------------------------------------------- No :-) You are just using the new tarball that correctly diagnoses missing END-xxx. Did you see my heads up at the bottom of page 1 on the thread "Example Sample program ...". If it annoys you, you can individually turn options off with -Wno-xxxx (where xxx is the option) So, -Wall -Wno-terminator Roger ---------------------------------------------------------------- Oooops ! I was comparing the behaviour of two different tarballs :-D To be forgivable I wrote this little code to help illustrate the use of -Wall -... options. [code] identification division. program-id. BOOM. *> *> This program Booms *> data division. working-storage section. 77 I pic S9. 77 W pic X. procedure division. debut. display "The Booooooom" line 01 column 30 with foreground-color 1 background-color 7 blank screen end-display perform varying I from 5 by -1 until I < 0 call "C$SLEEP" using "1" on exception display "C$SLEEP has a problem" line 24 column 2 with foreground-color 7 highlight background-color 4 blank line end-display accept W line 24 column 40 with prompt end-accept move 0 to I not on exception continue end-call display I line 12 column 41 end-display end-perform display "BOOM !" line 12 column 38 end-display accept W . fin. ultime. exit program. [/code] Thank you Roger Do you have any preference between Cygwin & MinGW ? Bear ---------------------------------------------------------------- :-) Cygwin & MinGW - Depends what you want to do. MinGW as it's description says, is a minimalistic environment with just enough to be able to configure/make other packages (maybe). That means you have to gen the OC prerequisites yourself (GMP, BDB, pdcurses - note not ncurses). Do not expect many (in fact very few) of the usual command-line(shell) tools. Cygwin, however, is a fairly complete implementation of a Posix(Linux) environment. Of course it has the necessary prerequisites (runtime and development) for OC. It also has a very rich assortment of the usual tools. Alone from the above, you can see why I prefer Cygwin. In fact I usually do a total install of all available components. Careful here, thats a multi xxxMB download and the install goes over a GB. The Cygwin setup.exe is a little idiosyncratic to use. As always read the avaiable doc before doing anything. Roger ---------------------------------------------------------------- Excuse the interruption, but I'd like to add: One of the key differences between MinGW and Cygwin is the existence of the cygwin.dll. That dll provides the POSIX compatibility layer, making the port of many GNU and other tools easier on the programmer (many times without source changes). MinGW applications rely solely on the Windows API using standard Windows header files. So there are less MinGW tools, but they can actually end up being a little more stable on the Windows platform (using native system services). And MinGW apps are true standalone Windows EXEs, Cygwin apps will need the cygwin.dll (and associated registry entries, so you may tie the customer to installing Cygwin). In my book, it's never a bad thing to nudge society towards POSIX. I prefer Cygwin, and never fly without using rxvt. The rxvt console has a dual-mode personality that allows it to run as an "xterm", without X11, using Windows calls. Far nicer experience than the default Windows cmd shell. imho. Better yet, bury Windows under a GRUB dual-boot and use an actual GNU/Linux distro. If I had to make a decision for a production environment, and MinGW tools were available for the task at hand, it might be a safer bet. In my personal experience the bugs in the cygwin.dll, once discovered, are fairly predictable and with proper care can be avoided. A notorious one for me was a getty/curses problem that would crash Win98 after using Cygwin vi and man in the same session. And to close, I'm kinda talking out my rear. I have near zero MinGW experience; Cygwin being one of the first things I install on any Windows machine. :) Cheers Brian ---------------------------------------------------------------- Thank you Brian, Roger I compiled a few progs in OC, including those using ncurses like the BOOM.CBL I wrote little modules in C to be linked with ncurses. I get some "undefined reference to `_stdscr'" and so. I think that gcc does not find ncurses. [code] gcc -shared -o ../Library/$1.dll -lncurses ./$1.c [/code] I understand that this has nothing to do with OC directly, but I cannot go foreward installing my tests in Cygwin environment ... I have no idea what to do. :-( Best regards Bear ---------------------------------------------------------------- Compile it with cobc :-) With -x for an executable, without for a module. If you add the -v option you will see exactly what options are passed to the compiler/linker. Roger ---------------------------------------------------------------- [code] $ cobc -x -v PANEAU.c gcc -pipe -c -I/usr/local/include -Wno-unused -fsigned-char -o /cygdrive/c/DOCUME~1/Essais/LOCALS~1/Temp/cob576_0.o PANEAU.c gcc -pipe -Wl,--export-all-symbols -Wl,--enable-auto-import -o PANEAU /cygdrive/c/DOCUME~1/Essais/LOCALS~1/Temp/cob576_0.o -L/usr/local/lib -lcob -lm -lgmp -lintl -lncurses -ldb /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../libcygwin.a(libcmain.o):(.text+0xab): undefined reference to `_WinMain@16' collect2: ld returned 1 exit status [/code] Looks Like Chinese to me . :-( Bear ---------------------------------------------------------------- Hmm. Works fine here - Test prog - #include #include main() { int n; initscr (); addch ('A'); n = getch (); endwin (); } cobc -x -v testcurse.c gcc -pipe -c -I/usr/local/include -Wno-unused -fsigned-char -o /cygdrive/c/DOKUME~1/simrw/LOKALE~1/Temp/cob15112_0.o testcurse.c gcc -pipe -Wl,--export-all-symbols -Wl,--enable-auto-import -o testcurse /cygdrive/c/DOKUME~1/simrw/LOKALE~1/Temp/cob15112_0.o -L/usr/local/lib -lcob -lm -lgmp -lintl -lncurses -ldb What Win are you using? Can you post the C code. Aaahhh, wait a minute, that is not a main program is it? If I am right, drop the -x. Roger ---------------------------------------------------------------- Your program works fine. This is the marvelous program, that works file on linux. My windows is XP Pro service Pack 2 (Dell inspiron 8100). [code] /************************** Programme Paneau (he wi) ***************************/ #include void PANEAU (int *ptr_L1,int *ptr_C1,int *ptr_L2,int *ptr_C2,char *wField, char *wSubtitle) { int L1=*ptr_L1; int C1=*ptr_C1; int L2=*ptr_L2; int C2=*ptr_C2; int l1, c1; int l2, c2; int i,j,k,imin,imax,jmax ; imin=L1; imax=L2-L1; jmax=C2-C1; l1=L1-1; c1=C1-1; l2=L2-1; c2=C2-1; // First of all we need to display the SubTitle move (l1+1,c1); for (k=0;k<80;k++) { if (wField[k] == '\0') { k=10; break; } { addch(wSubtitle[k]); } } refresh(); // Then we have to draw the first (l1), the mid line (l+2) & the last one (l2) for (j=0;j' : move (l1,c1+j); addch (ACS_ULCORNER); move (l1+2,c1+j); addch (ACS_LTEE); move (l2,c1+j); addch (ACS_LLCORNER); // Then comes vertical lines for (i=0;i Compile with ... -x *> Execute with ./prog *> OR *> Compile with .... *> Execute with cobcrun prog Roger ---------------------------------------------------------------- If you have only one main program and some sub-programs, I personally would cobc -x the main program for one project and compile other stuff (called programs, programs for more than one project) as modules. ---------------------------------------------------------------- Subject: File IO, LINAGE sample. I have some questions before sending to Roger Hello everyone; Here is a File and LINAGE usage sample. But I have a question again. P.S. This sample fails. Off by one horsing around with a write inside an END-OF-PAGE; I'll get to that (or feel free to shoot this down if it is just bad wrong). What's a smooth way of avoiding ... [code] opencobol linage.cob: In paragraph 'readwrite-loop': linage.cob:126: Warning: Some digits may be truncated linage.cob:127: Warning: 'LC_mini-report' defined here as PIC 9(9) linage.cob:61: Warning: 'body-tag' defined here as PIC 9(6) linage.cob:131: Warning: Some digits may be truncated linage.cob:132: Warning: 'LC_mini-report' defined here as PIC 9(9) linage.cob:68: Warning: 'header-tag' defined here as PIC 9(6) [/code] LC_mini-report is the LINAGE-COUNTER noun (some say special-register), but I'd just like 6 digits. [code] *> ************************************************************** *> *> Copyright (C) 2008 The OpenCOBOL Project *> *> This program is free software; you can redistribute it and/or *> modify it under the terms of the GNU General Public License as *> published by the Free Software Foundation; either version 2, *> or (at your option) any later version. *> *> This program is distributed in the hope that it will be *> useful, but WITHOUT ANY WARRANTY; without even the implied *> warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR *> PURPOSE. See the GNU General Public License for more details. *> *> You should have received a copy of the *> GNU General Public License along with this software; *> see the file COPYING. If not, write to *> the Free Software Foundation, 51 Franklin Street, Fifth Floor *> Boston, MA 02110-1301 USA *> ************************************************************** ***************************************************************** * Example of LINAGE File Descriptor * Author: Brian Tiffin * Date: 10-July-2008 * Tectonics: $ cocb -x linage.cob * $ ./linage * $ cat -n mini-report ***************************************************************** IDENTIFICATION DIVISION. PROGRAM-ID. linage-demo. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. select optional data-file assign to file-name organization is line sequential file status is data-file-status. select mini-report assign to "mini-report". data division. file section. FD data-file. 01 data-record. 88 endofdata value high-values. 02 data-line pic x(80). FD mini-report linage is 16 lines with footing at 15 lines at top 2 lines at bottom 2. 01 report-line pic x(80). WORKING-STORAGE SECTION. 01 command-arguments pic x(1024). 01 file-name pic x(160). 01 data-file-status pic 99. 01 report-line-blank. 02 filler pic x(20). 02 filler pic x(35) VALUE "THIS PAGE INTENTIONALLY LEFT BLANK". 01 report-line-data. 02 body-tag pic 9(6). 02 line-3 pic x(74). 01 report-line-header. 02 filler pic x(6) VALUE "PAGE: ". 02 page-no pic 9999. 02 filler pic x(24). 02 filler pic x(5) VALUE " LC: ". 02 header-tag pic 9(6). 02 filler pic x(23). 02 filler pic x(6) VALUE "DATE: ". 02 page-date pic x(6). 01 page-count pic 9999. PROCEDURE DIVISION. accept command-arguments from command-line end-accept. string command-arguments delimited by space into file-name end-string. if file-name equal spaces move "linage.cob" to file-name end-if. open input data-file. read data-file at end display "File: " function trim(file-name) " open error" end-display perform early-exit end-read. open output mini-report. write report-line from report-line-blank end-write. move 1 to page-count. accept page-date from date end-accept. move page-count to page-no. write report-line from report-line-header after advancing page end-write. perform readwrite-loop until endofdata. display "Normal termination, file name: " function trim(file-name) " ending status: " data-file-status end-display. close mini-report. * Goto considered harmful? Bah! :) early-exit. close data-file. exit program. stop run. **************************************************************** readwrite-loop. move data-record to report-line-data move linage-counter to body-tag write report-line from report-line-data end-of-page add 1 to page-count end-add move page-count to page-no move linage-counter to header-tag write report-line from report-line-header after advancing page end-write end-write read data-file at end set endofdata to true end-read . ***************************************************************** * Commentary * LINAGE is set at a 20 line logical page * 16 body lines * 2 top lines * A footer line at 15 (inside the body count) * 2 bottom lines * Build with: * $ cobc -x -Wall -Wtruncate linage.cob * Evaluate with: * $ ./linage * This will read in linage.cob and produce a useless mini-report * $ cat -n mini-report [/code] Cheers, Brian ---------------------------------------------------------------- Subject: OC Logo Roger, On the FAQ forum Brian brought up whether OC has a logo. If not we've folks here that could create one, or we could toss it out to a larger group. Is that cool? ---------------------------------------------------------------- Why not? If we have one, we could make an ascii-version of it and put it in the new FAQ. ---------------------------------------------------------------- If Roger and the rest of yall are game, we could attempt to start working on it over the next few weeks. I'm not sure if I can do an ASCII version or not, I will have to start to look into a program for conversion. Though I will talk to a couple of our designers and see what they have to say. Depending on the nature of the Logo, it might just be ascii from the rip... Anyone have any Ideas? Do you want something more businessy looking? Something more like the icons with all the flair and rounded looking stuff? Something with some COBOL code right in the logo, perhaps overlayed? Maybe a mascot or spokesperson? Maybe [u][url=http://colbowdesign.com/blog2/?p=100]Avatars?[/url][/u] All ideas are welcome... ---------------------------------------------------------------- If I had my druthers, for the FAQ; A nice corporate 3d full color glossy of [i]OpenCOBOL[/i] Next, time permitting, an iconic OC suitable for list bullets. And a mascot if anyone is up for it. I envision a Bull in a SUIT. Perhaps carrying ketchup and mustard. Cheers, Brian ---------------------------------------------------------------- That gets me thinking about a mix of the old and the new. The Cultcobol.com site is going to be a bit aggressive...showing the new breed of cobol developers. Kinda like this: (me) http://twitter.com/aoirthoir The bull for the open cobol I like, i imagine i dressed in a business suit..so kinda old school cobol, kinda new. ---------------------------------------------------------------- Subject: OC Chat room? Not yet, but, #add1tocobol on Freenode in the meantime. EDITED TO ADD: I'll be on Freenode IRC in the channel #add1tocobol all the time now. Please stop in and join us. #add1tocobol is not an OC sponsored chat room. But it is a place for some of us to talk about OC. You can use the web as a shortcut to downloading an IRC client. Simply go to http://www.add1tocobol.com and choose the link on the left I-O Control. Or the direct link is: http://www.add1tocobol.com/i_o_control.php Since we opened a lot of people have come and gone. It is true we've only a small number of folks there right now. Often, as is common on IRC, we're also off busy doing other things while we're hanging our hats in the channel. So I just wanted to let everyone that's come in know, if you hang out a bit eventually we'll see you and strike up a conversation. If you have the ability to join and hang your hat as well, that would be excellent. It will give us all an opportunity to get to know each other better. ORIGINAL MESSAGE: Roger, Some time ago I had wanted to set up a chat room on IRC for Open Cobol. I know you don't wnat folks confused into thinking it's an official place for support so I stopped that effort. But the documentation effort is getting a bit in the hump by Brian and he's really moving that forward and doing a good job on it. So I think that this, combined with the great strides you've made in OC over the last year moving towards version 1.1, are going to create a need for us to all be able to get together in more real time. So if there is any way we could adjust that position, or make a room that is an "about" room. This means it's about open cobol but not necessarily supported by the OC project, that would at least give us one more avenue to communicate with each other. ---------------------------------------------------------------- I think 1. There would be not enough people on chat and an empty chat room isn't very "cool". 2. Support belongs to the forum and I'd rather like to read the "about questions" here, too. 3. Read forum entries is nicer than reading chat-logs. ---------------------------------------------------------------- Human, I agree to everything you said. Actually though, chat rooms for projects often start out near empty, and grow from there. If we had one on Freenode, I'd be there every day all day. I could populate it with a handful of others on my team that are needing to learn Cobol as well. As to Support, I'm thinking more in 2 different cases. For the documentation team, it would allow us more real time collaboration. Also though, for support in general when we need an answer much faster than usual. Although, as mentioned this is more in line for the documentation team, because as we answer our questions, back and forth, those answers will be put into the docs, FAQ, Users Guide, and such. Hope that helps. ---------------------------------------------------------------- I'd like to bring this to the forefront again. I have at least 3 folks that could man the OC room all of the time. If we got several of us there, even if we were just sitting in the room, we'd be able to man a steadily popular room. It would also allow for instance feedback from each other. This would help us move projects along much faster. I could also set up bitchx or another tool to record the chats for future review. Roger, this would really help us with these things a LOT. In the least, my team, would be able to use it. We're moving rapidly towards using OC for our projects. All that it's going to take is for my team to be back up on their cobol skills, and those that have never used cobol, to get to using it. So a chat room helps bring us together for this. I'd also like to arrange an online meeting on webex (and eventually when they have a linux client dim dim) between those involved in these projects. Of course we're all volunteers, so it might be hard to arrange. I'm more fortunate because I'm salaried, so I can be flexible and meet whenever yall need. Having this time will help uptake as well. ---------------------------------------------------------------- I'll be on Freenode IRC in the channel #add1tocobol all the time now. Please stop in and join us. #add1tocobol is not an OC sponsored chat room. But it is a place for some of us to talk abou OC. ---------------------------------------------------------------- Since we opened a lot of people have come and gone. It is true we've only a small number of folks there right now. Often, as is common on IRC, we're also off busy doing other things while we're hanging our hats in the channel. So I just wanted to let everyone that's come in know, if you hang out a bit eventually we'll see you and strike up a conversation. If you have the ability to join and hang your hat as well, that would be excellent. It will give us all an opportunity to get to know each other better. ---------------------------------------------------------------- You can use the web as a shortcut to downloading an IRC client. Simply go to http://www.add1tocobol.com and choose the link on the left I-O Control. Or the direct link is: http://www.add1tocobol.com/i_o_control.php ---------------------------------------------------------------- Just reminding people that this is here...since someone asked: This has more information Aktso1: http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=264&forum=1 But you can get it on freenode IRC at the channel: #add1tocobol You can also access from the web here: http://www.add1tocobol.com/i_o_control.php ---------------------------------------------------------------- Subject: OC Documentation, samples site? Roger, As Brian gets the FAQ going, I think that is going to snowball into a lot more documentation and samples as others begin to contribute help. So we're wondering would those things best be hosted here, or would you prefer another site? If hosted here, is there any kind of backup and download system that could be set up, should the site ever close, we'd have an archive of all of these changes? ---------------------------------------------------------------- aoirthoir; If you'd like to try something for me? It's the FAQ with just the tiniest amount of skinning. [code] $ rst2html --stylesheet ocfaq.css ocfaq.txt ocfaq.html [/code] with ocfaq.css [code] /* :Author: Brian Tiffin :Contact: Post a note on opencobol.org to btiffin :Copyright: This stylesheet has been placed in the public domain. Stylesheet for use with Docutils. In support of ocfaq.txt, the OpenCOBOL Frequently Asked Questions file. */ @import url(html4css1.css); /* Your customizations go here. For example: */ h1, h2, h3, h4, h5, h6, p.topic-title { font-family: Palantino, Verdana, arial, sans-serif; } p {font-family: Verdana, Palantino, arial, sans-serif;} /* body {background-color: #A5CEEC;} pre.literal-block, pre.doctest-block { margin-left: 2em ; margin-right: 2em ; background-color: #A5CEff } tt.docutils { background-color: #bbbbbb } */ [/code] and html4css1.css included in the docutils install. I found my local copy at [code] /usr/share/pyshared/docutils/writers/html4css1/html4css1.css [/code] Please excuse the size of the code section here. I bungled an svn, and can't send a diff from the last fatty. So I'm sending yet another hopefully last fatty. If you could run the rst2html (I done use rst-buildhtml much anymore.) Too aggressive. :) and plop this somewhere hidden for a trial? Or not? I can probably wait. Cheers, Brian P.S. 98% promise I won't inflict this size of post on the forum henceforth. [code] ************* OpenCOBOL FAQ ************* .. Formatted for docutils, ReStructuredText. rst-buidhtml .. Attention:: This is the 0.0c pre alpha release of the OpenCOBOL FAQ .. Sectnum:: :Authors: Brian Tiffin [btiffin]_ (with the invaluable assistance of many others) :Organization: The OpenCOBOL Project :Version: 0.0c :Status: Experimental - Not for public release :Copyright: |copyleft| :Changelog: changelog_ .. Contents:: FAQ Index ========= OpenCOBOL ========= ---------------------- Q. What is OpenCOBOL_? ---------------------- OpenCOBOL is an open-source COBOL_ compiler. OpenCOBOL implements a substantial part of the `COBOL 85`_ and `COBOL 2002`_ standards, as well as many extensions of the existent COBOL compilers. OpenCOBOL translates COBOL into C and compiles the translated code using the native C compiler. You can build your COBOL programs on various platforms, including Unix/Linux, Mac OS X, and Microsoft Windows. ------------------ Q. What is COBOL_? ------------------ COBOL is an acronym for COmmon Business Oriented Language. This author has always thought of it as "Common Business" Oriented more than Common "Business Oriented", but that emphasis is perhaps up to the readers point of view. ----------------------------- Q. How is OpenCOBOL licensed? ----------------------------- The compiler is licensed under `GNU General Public License`_. The run-time library is licensed under `GNU Lesser General Public License`_. --------------------------------------------- Q. What platforms are supported by OpenCOBOL? --------------------------------------------- `OpenCOBOL 1.0`_ the current official release version, hosted on SourceForge.net, compiles on: * All 32-bit MS Windows (95/98/NT/2000/XP) * All POSIX (Linux/BSD/UNIX-like OSes) * OS/X `OpenCOBOL 1.1`_ also hosted on SourceForge.net, has been tested on * MS Windows * POSIX Systems * OS/X ----------------------------- Q. How complete is OpenCOBOL? ----------------------------- `OpenCOBOL 1.0`_ implements a substantial portion of COBOL 85, supports many of the advances and clarifications of COBOL 2002, and includes many extensions in common use from Micro Focus COBOL, ACUCOBOL and other exsistent compilers. `OpenCOBOL 1.1`_ implements a more substantial portion of the COBOL 85 Dialect, COBOL 2002 and a growing number of vendor extensions. Some proposed COBOL 2008 features have also been implemented. Compatibility support includes: * MF for Micro Focus * IBM for IBM compatibility * MVS * BS2000 OpenCOBOL also includes some advanced features allowing source code such as :: CALL "cfunction" USING BY REFERENCE ADDRESS OF VAR-IN-LINKAGE-SECTION. Passing the equivalent of char**, pointer to pointer to char. Just as a small example of the level of coverage provided by OpenCOBOL. --------------------------------- Q. Will I be amazed by OpenCOBOL? --------------------------------- This author believes so. For an open source implementation of COBOL, OpenCOBOL may surprise you in the depth and breadth of it's COBOL standard feature support, usability and robustness. --------------------------------------- Q. Does OpenCOBOL include a Test Suite? --------------------------------------- Why yes it does. 74 syntax tests, 170 coverage tests, and 16 data representation tests at last count. From the development tarball, **$ make check** will evaluate and report on the test suite. ------------------------------------------- Q. Does OpenCOBOL pass the NIST Test Suite? ------------------------------------------- .. Attention:: Look into this --------------------------------------- Q. What about OpenCOBOL and benchmarks? --------------------------------------- .. Attention:: Look into this --------------------------------- Q. Can OpenCOBOL be used for CGI? --------------------------------- Yes. Through standard IO redirection and the extended **ACCEPT ... FROM ENVIRONMENT ...** feature, OpenCOBOL is more than capable of supporting advanced CGI programming. ----------------------------------------------------- Q. Can OpenCOBOL by used for production applications? ----------------------------------------------------- Depends. OpenCOBOL is still in active development. Feature coverage is growing, and while the current implementation offers great coverage, applicability to any given situation would need to analyzed and risks evaluated before commitment to production use. The licensing allows for commercial use, but OpenCOBOL also ships with notice of indemnity, meaning that there are no guarantees when using OpenCOBOL, directly or indirectly. There may be a time when commercial support of OpenCOBOL is offered, but at the time of writing no known offering exists. *Search google just in case!* And yes, OpenCOBOL is used in production environments. .. Attention:: Look into this ------------------------------------------------ Q. Where can I get more information about COBOL? ------------------------------------------------ The `COBOL FAQ`_ by William M Klein is a great place to start. A google of the search words "COBOL" or "OpenCOBOL" are bound to lead to enough days worth of reading of in-depth articles, opinions and technical information to satisfy the greatest of curiosities. ---------------------------------------------------- Q. Where can I get more information about OpenCOBOL? ---------------------------------------------------- The opencobol.org_ website is probably the best place to find out more about the OpenCOBOL system. ------------------------------ Q. Do you know any good jokes? ------------------------------ Maybe. * A computer without COBOL and Fortran is like chocolate cake without ketchup and mustard. *Author: unknown* * A determined coder can write COBOL programs in any language. *Author: unknown* * Rumour has it that the object oriented specification for COBOL was code named *ADD 1 TO COBOL GIVING COBOL.* *Author: unknown* A less verbose, more concise version; *very unCOBOL that* *ADD 1 TO COBOL.* *Thanks to aoirthoir* * Eat COBOL, three quadrillion transactions can't be wrong. *Brian Tiffin* * What did COBOL yell to the escaping thief? **STOP RUN RETURNING NOW.** *Brian Tiffin* * What did COBOL reply to the executive? *Why yes, I can* **PERFORM JUMPS THRU HOOPS.** *Brian Tiffin* * What did OpenCOBOL reply to the executive? *Sir, I can* **PERFORM JUMPS THRU FLAMING-HOOPS UNTIL HELL-FREEZES-OVER.** *And being COBOL, I have to show you how little code it takes:* :: identification division. program-id. freeze. data division. working-storage section. 01 hell pic 9. 88 hell-freezes-over value 1. procedure division. perform jumps thru flaming-hoops until hell-freezes-over. stop run. jumps. flaming-hoops. divide 1 by 0 giving hell. *Brian Tiffin* ======= History ======= ------------------------------------------------ Q. What is the development history of OpenCOBOL? ------------------------------------------------ OpenCOBOL was initially developed by Keisuke Nishida [Keisuke]_ The first public release was version 0.9.0 on January 25th, 2002. Development continued apace, with version 0.30 released by Keisuke on August 8th, 2004. Roger While [Roger]_ then took up the role as lead developer on October 30th, 2004. Version 0.31 was released February 1st, 2005. -------------------------------------------- Q. What is the current version of OpenCOBOL? -------------------------------------------- OpenCOBOL 1.0 was released December 27th, 2007 by Roger While [Roger]_. The decision to go 1.0 from the 0.33 version followed the 0.32 release of 05-May-2005. OpenCOBOL 1.1 pre-release became active on December 27th, 2007 and is currently in active development. The pre-release source tar can be found at `OpenCOBOL 1.1`_ with installer instructions at `OpenCOBOL Install`_ and in the INSTALLING text file of the sources. ----------------------------------------- Q. Are there pre-built OpenCOBOL packages ----------------------------------------- Yes. Debian APT, and RPM packages exist. Packages for NetBSD. Many. Google *opencobol packages* for any late breaking news. A Debian apt binary package exists for OpenCOBOL 1.0 as **open-cobol** and lists dependencies of * libc6 (>= 2.7-1), * libcob1, * libcob1-dev (= 1.0-1), * libdb4.5 (>= 4.5.20-3), * libdb4.5-dev, * libgmp3-dev, * libgmp3c2, * libltdl3-dev, * libncurses5 (>= 5.6+20071006-3) Thanks to the gracious efforts of Bart Martens, bartm on Debian's .org domain. =============== Using OpenCOBOL =============== ------------------------------ Q. How do I install OpenCOBOL? ------------------------------ Installation instructions can be found at `OpenCOBOL Install`_. Debian The Debian binary package makes installing OpenCOBOL 1.0 a snap. From **root** or using sudo:: $ apt-get open-cobol Windows Build from sources under Cygwin or MinGW. Follow the instructions from the site listed above. ---------------------------------------------- Q. Does OpenCOBOL have any other dependencies? ---------------------------------------------- OpenCOBOL relies on a native C compiler with POSIX compatibility. GCC being a freely available compiler collection supported by most operating systems currently in use. OpenCOBOL requires the following external libraries to be installed: GNU MP (libgmp) 4.1.2 or later libgmp is used to implement decimal arithmetic. GNU MP is licensed under GNU Lesser General Public License. GNU Libtool (libltdl) libltdl is used to implement dynamic CALL statements. GNU Libtool is licensed under GNU Lesser General Public License. NOTE - Libtool is not required for Linux and Windows (including MinGW and Cygwin) The following libraries are optional: Berkeley DB (libdb) 1.85 or later libdb can be used to implement indexed file I/O and SORT/MERGE. Berkeley DB is licensed under the original BSD License (1.85) or their own open-source license (2.x or later). Note that, as of 2.x, if you linked your software with Berkeley DB, you must distribute the source code of your software along with your software, or you have to pay royalty to Oracle Corporation. For more information about Oracle Berkeley DB dual licensing go to : Oracle / Embedded / Oracle Berkeley DB Ncurses (libncurses) 5.2 or later libncurses can be used to implement SCREEN SECTION. Ncurses is licensed under a BSD-style license. ---------------------------------------- Q. How does the OpenCOBOL compiler work? ---------------------------------------- OpenCOBOL is a multi-stage command line driven compiler. Command line options control what stages are performed during processing. 1. Preprocess #. Translate #. Compile #. Assemble #. Link #. Build OpenCOBOL produces intermediate C source code that is then passed to a configured C compiler and other tools. the GNU C compiler, **gcc** being a standard. The main tool, **cobc**, by default, produces modules, linkable shared object files. Example :: $ cat hello.cob Original source code; :: 000100* HELLO.COB OpenCOBOL FAQ example 000200 IDENTIFICATION DIVISION. 000300 PROGRAM-ID. hello. 000400 PROCEDURE DIVISION. 000500 DISPLAY "Hello World!". 000600 STOP RUN. OpenCOBOL stages:: $ cobc -E hello.cob Preprocess only; For one thing, FIXED format becomes FREE format. For another COPY is processed. Displays :: # 1 "hello.cob" IDENTIFICATION DIVISION. PROGRAM-ID. hello. PROCEDURE DIVISION. DISPLAY "Hello World!". STOP RUN. to standard out. :: $ cobc -C hello.cob Translate only; preprocesses and then translates the COBOL sources into C. You can examine these files to get a good sense of how the OpenCOBOL environment interacts with the native C facilities. OpenCOBOL 1.1 produced **hello.c.h** and **hello.c**. :: $ cobc -S hello.cob Compile only; outputs assembly file. Produces **hello.s**. :: $ cobc -c hello.cob Compile and assemble, do not link. Produces **hello.o**. :: $ cobc -m hello.cob Build dynamically loadable module. The is the *default behaviour*. This example produces **hello.so** or **hello.dll**. :: $ cobcrun hello Will scan the DSO_ hello.so, and then link, load, and execute hello. .. Attention:: Need a little OS/X info here :: $ cobc -x hello.cob Build an executable program. This examples produces **hello** or **hello.exe**. **This is important**. *cobc* produces a *Dynamic Shared Object* by default. *To create executables*, you need to use **-x**. :: $ ./hello Hello World! OpenCOBOL also supports features for multiple source, multiple language programming, detailed in the FAQ at `Q. Does OpenCOBOL support modules?`_. ---------------- Q. What is cobc? ---------------- **cobc** is the OpenCOBOL compiler. See `Q. What compiler options are supported?`_ for more information. ------------------- Q. What is cobcrun? ------------------- **cobcrun** is the OpenCOBOL driver program that allows the execution of programs stored in OpenCOBOL modules. The **cobc** compiler, by default, produces modules (the *-m* option). These modules are linkable dynamic shared objects. Using GNU/Linux for example:: $ cobc -x hello.cob $ ./hello Hello World! $ cobc hello.cob $ cobcrun hello Hello World! The **cobc -x hello.cob** built an executable binary called hello. The **cobc hello.cob** produced a DSO_ hello.so, and cobcrun resolves the entry point and executes the code, right from the DSO_. **cobcrun** *is the compiler author's preferred way to manage OpenCOBOL development.* It alleviates knowing which source file needs *-x* while encouraging proper modular programming, a mainstay of OpenCOBOL. ---------------------- Q. What is cob-config? ---------------------- **cob-config** is a program that can be used to find the C compiler flags and libraries required for compiling. Using GNU/Linux for example:: $ cob-config Usage: cob-config [OPTIONS] Options: [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--libs] [--cflags] $ cob-config --libs -L/usr/local/lib -lcob -lm -lgmp -lncurses -ldb $ cob-config --cflags -I/usr/local/include You may need to use these features during mixed source language development, usually by back-ticking the command output inline with other **gcc** commands. --------------------------------------- Q. What compiler options are supported? --------------------------------------- .. Note to maintainers. Build with $ cobc --help and indent 4 spaces. :: Usage: cobc [options] file... Options: --help Display this message --version, -V Display compiler version -v Display the programs invoked by the compiler -x Build an executable program -m Build a dynamically loadable module (default) -std= Compile for a specific dialect : cobol2002 Cobol 2002 cobol85 Cobol 85 ibm IBM Compatible mvs MVS Compatible bs2000 BS2000 Compatible mf Micro Focus Compatible default When not specified See config/default.conf and config/\*.conf -free Use free source format -fixed Use fixed source format (default) -O, -O2, -Os Enable optimization -g Produce debugging information in the output -debug Enable all run-time error checking -o Place the output into -b Combine all input files into a single dynamically loadable module -E Preprocess only; do not compile, assemble or link -C Translation only; convert COBOL to C -S Compile only; output assembly file -c Compile and assemble, but do not link -t Generate and place a program listing into -I Add to copybook search path -L Add to library search path -l Link the library -D Pass to the C compiler -conf= User defined dialect configuration - See -std= --list-reserved Display all reserved words -save-temps Do not delete intermediate files -MT Set target file used in dependency list -MF Place dependency list into -ext Add default file extension -Wall Enable all warnings -Wobsolete Warn if obsolete features are used -Warchaic Warn if archaic features are used -Wcolumn-overflow Warn if any text after column 72 -Wredefinition Warn incompatible redefinition of data items -Wconstant Warn inconsistent constant -Wparentheses Warn lack of parentheses around AND within OR -Wterminator Warn lack of scope terminator (END-XXX) -Wstrict-typing Warn type mismatch strictly -Wimplicit-define Warn implicitly defined data items -Wcall-params Warn non 01/77 items for CALL params (NOT set with -Wall) -Wtruncate Warn possible field truncation (NOT set with -Wall) -ftrace Generate trace code (Executed SECTION/PARAGRAPH) -ftraceall Generate trace code (Executed SECTION/PARAGRAPH/STATEMENTS) -fsyntax-only Syntax error checking only; don't emit any output -fstatic-call Output static function calls for the CALL statement -fdebugging-line Enable debugging lines ('D' in indicator column) -fsource-location Generate source location code (Turned on by -debug or -g) -fimplicit-init Do automatic initialization of the Cobol runtime system -fstatic-linkage Statically allocate non-USING LINKAGE parameters -fsign-ascii Numeric display sign ASCII (Default on ASCII machines) -fsign-ebcdic Numeric display sign EBCDIC (Default on EBCDIC machines) -fstack-check PERFORM stack checking (Turned on by -debug or -g) -ffold-copy-lower Fold COPY subject to lower case (Default no transformation) -ffold-copy-upper Fold COPY subject to upper case (Default no transformation) -fnotrunc Do not truncate binary fields according to PIC (ala MF) -fnull-param Pass extra NULL terminating pointers on CALL statements ----------------------------------------- Q. What are the OpenCOBOL reserved words? ----------------------------------------- COBOL_ is a reserved word rich language. The OpenCOBOL compiler recognizes: .. Note to maintainers. Built with $ cobc --list-reserved, followed by a 74 column wide reformat and 4 space indent. The counts were calculated from $ wc and grepping for the literal "-1" in the cobc/reserved.c source. :: ACCEPT ACCESS ACTIVE-CLASS ADD ADDRESS ADVANCING AFTER ALIGNED ALL ALLOCATE ALPHABET ALPHABETIC ALPHABETIC-LOWER ALPHABETIC-UPPER ALPHANUMERIC ALPHANUMERIC-EDITED ALSO ALTER ALTERNATE AND ANY ANYCASE ARE AREA AREAS ARGUMENT-NUMBER ARGUMENT-VALUE ARITHMETIC AS ASCENDING ASSIGN AT ATTRIBUTE AUTO AUTOMATIC B-AND B-NOT B-OR B-XOR BACKGROUND-COLOR BASED BEFORE BELL BINARY BINARY-C-LONG BINARY-CHAR BINARY-DOUBLE BINARY-LONG BINARY-SHORT BIT BLANK BLINK BLOCK BOOLEAN BOTTOM BY BYTE-LENGTH CALL CANCEL CD CENTER CF CH CHAIN CHAINING CHARACTER CHARACTERS CLASS CLASS-ID CLASSIFICATION CLOSE CODE CODE-SET COL COLLATING COLS COLUMN COLUMNS COMMA COMMAND-LINE COMMIT COMMON COMMUNICATION COMP COMP-1 COMP-2 COMP-3 COMP-4 COMP-5 COMP-X COMPUTATIONAL COMPUTATIONAL-1 COMPUTATIONAL-2 COMPUTATIONAL-3 COMPUTATIONAL-4 COMPUTATIONAL-5 COMPUTATIONAL-X COMPUTE CONDITION CONFIGURATION CONSTANT CONTAINS CONTENT CONTINUE CONTROL CONTROLS CONVERTING COPY CORR CORRESPONDING COUNT CRT CURRENCY CURSOR CYCLE DATA DATA-POINTER DATE DAY DAY-OF-WEEK DE DEBUGGING DECIMAL-POINT DECLARATIVES DEFAULT DELETE DELIMITED DELIMITER DEPENDING DESCENDING DESTINATION DETAIL DISABLE DISK DISPLAY DIVIDE DIVISION DOWN DUPLICATES DYNAMIC EBCDIC EC EGI ELSE EMI ENABLE END END-ACCEPT END-ADD END-CALL END-COMPUTE END-DELETE END-DISPLAY END-DIVIDE END-EVALUATE END-IF END-MULTIPLY END-OF-PAGE END-PERFORM END-READ END-RECEIVE END-RETURN END-REWRITE END-SEARCH END-START END-STRING END-SUBTRACT END-UNSTRING END-WRITE ENTRY ENTRY-CONVENTION ENVIRONMENT ENVIRONMENT-NAME ENVIRONMENT-VALUE EO EOL EOP EOS EQUAL EQUALS ERASE ERROR ESCAPE ESI EVALUATE EXCEPTION EXCEPTION-OBJECT EXCLUSIVE EXIT EXPANDS EXTEND EXTERNAL FACTORY FALSE FD FILE FILE-CONTROL FILE-ID FILLER FINAL FIRST FLOAT-EXTENDED FLOAT-LONG FLOAT-SHORT FOOTING FOR FOREGROUND-COLOR FOREVER FORMAT FREE FROM FULL FUNCTION FUNCTION-ID GENERATE GET GIVING GLOBAL GO GOBACK GREATER GROUP GROUP-USAGE HEADING HIGH-VALUE HIGH-VALUES HIGHLIGHT I-O I-O-CONTROL ID IDENTIFICATION IF IGNORING IMPLEMENTS IN INDEX INDEXED INDICATE INHERITS INITIAL INITIALIZE INITIALIZED INITIATE INPUT INPUT-OUTPUT INSPECT INTERFACE INTERFACE-ID INTO INTRINSIC INVALID INVOKE IS JUST JUSTIFIED KEY LABEL LAST LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME LEADING LEFT LENGTH LESS LIMIT LIMITS LINAGE LINAGE-COUNTER LINE LINE-COUNTER LINES LINKAGE LOCAL-STORAGE LOCALE LOCK LOW-VALUE LOW-VALUES LOWLIGHT MANUAL MEMORY MERGE MESSAGE METHOD METHOD-ID MINUS MODE MOVE MULTIPLE MULTIPLY NATIONAL NATIONAL-EDITED NATIVE NEGATIVE NESTED NEXT NO NONE NORMAL NOT NULL NULLS NUMBER NUMBERS NUMERIC NUMERIC-EDITED OBJECT OBJECT-COMPUTER OBJECT-REFERENCE OCCURS OF OFF OMITTED ON ONLY OPEN OPTIONAL OPTIONS OR ORDER ORGANIZATION OTHER OUTPUT OVERFLOW OVERLINE OVERRIDE PACKED-DECIMAL PADDING PAGE PAGE-COUNTER PARAGRAPH PERFORM PF PH PIC PICTURE PLUS POINTER POSITION POSITIVE PRESENT PREVIOUS PRINTER PRINTING PROCEDURE PROCEDURE-POINTER PROCEDURES PROCEED PROGRAM PROGRAM-ID PROGRAM-POINTER PROMPT PROPERTY PROTOTYPE PURGE QUEUE QUOTE QUOTES RAISE RAISING RANDOM RD READ RECEIVE RECORD RECORDING RECORDS RECURSIVE REDEFINES REEL REFERENCE RELATION RELATIVE RELEASE REMAINDER REMOVAL RENAMES REPLACE REPLACING REPORT REPORTING REPORTS REPOSITORY REQUIRED RESERVE RESET RESUME RETRY RETURN RETURNING REVERSE-VIDEO REWIND REWRITE RF RH RIGHT ROLLBACK ROUNDED RUN SAME SCREEN SD SEARCH SECONDS SECTION SECURE SEGMENT SELECT SELF SEND SENTENCE SEPARATE SEQUENCE SEQUENTIAL SET SHARING SIGN SIGNED SIGNED-INT SIGNED-LONG SIGNED-SHORT SIZE SORT SORT-MERGE SOURCE SOURCE-COMPUTER SOURCES SPACE SPACES SPECIAL-NAMES STANDARD STANDARD-1 STANDARD-2 START STATEMENT STATUS STEP STOP STRING STRONG SUB-QUEUE-1 SUB-QUEUE-2 SUB-QUEUE-3 SUBTRACT SUM SUPER SUPPRESS SYMBOL SYMBOLIC SYNC SYNCHRONIZED SYSTEM-DEFAULT TABLE TALLYING TAPE TERMINAL TERMINATE TEST TEXT THAN THEN THROUGH THRU TIME TIMES TO TOP TRAILING TRUE TYPE TYPEDEF UCS-4 UNDERLINE UNIT UNIVERSAL UNLOCK UNSIGNED UNSIGNED-INT UNSIGNED-LONG UNSIGNED-SHORT UNSTRING UNTIL UP UPDATE UPON USAGE USE USER-DEFAULT USING UTF-16 UTF-8 VAL-STATUS VALID VALIDATE VALIDATE-STATUS VALUE VALUES VARYING WHEN WITH WORKING-STORAGE WRITE YYYYDDD YYYYMMDD ZERO ZEROES ZEROS 511 words in OC 1.1, 136 of which are marked not yet implemented. 375 functional reserved words, as of July 2008. ---------------------------------- Q. Does OpenCOBOL support modules? ---------------------------------- Yes. Quite nicely in fact. Dynamically! *Or when using the **-fstatic_call** compiler option, Statically! for optimal performance*. COBOL_ modules, and object files of many other languages are linkable. As OpenCOBOL uses intermediate C, linkage to other languages is well supported across many platforms. The OpenCOBOL CALL_ instruction maps COBOL USAGE_ to many common C stack frame data representations. Multipart, complex system development is well integrated in the OpenCOBOL model. :: $ cobc -b hello.cob goodbye.cob Combines both source files into a single dynamically loadable module. Example produces **hello.so**. Using the **-l** link library option, OpenCOBOL has access to most shared libraries supported on it's platforms. :: $ cobc -x -lcurl showcurl.cob Will link the /usr/lib/libcurl.so (*from the cURL project*) to showcurl. The OpenCOBOL CALL_ verb will use this linked library to resolve calls at runtime. Large scale systems are at the heart of COBOL development and OpenCOBOL is no exception. --------------------------------------------- Q. What is the OpenCOBOL LINKAGE SECTION for? --------------------------------------------- Argument passing in COBOL is normally accomplished through the **LINKAGE SECTION**. This section does not allocate or initialize memory as would definitions in the WORKING-STORAGE SECTION. Care must be taken to inform COBOL of the actual source address of these variables before use. Influences CHAINING and USING phrases. See CALL_ for more details. --------------------------------------------------------------- Q. What does the -fstatic-linkage OpenCOBOL compiler option do? --------------------------------------------------------------- Under normal conditions, the *LINKAGE SECTION* is unallocated and uninitialized. When a LINKAGE SECTION variable, that is not part of the *USING* phrase (not a named calling argument), any memory that has been addressed becomes unaddressable across calls. *-fstatic-linkage* creates static addressing to the LINKAGE SECTION. From [Roger]_:: This relates to LINKAGE items that are NOT referred to in the USING phrase of the PROCEDURE DIVISION. It also only has relevance when the program is CALL'ed from another prog. This means that the addressability of these items must be programmed (usually with SET ADDRESS) before reference. Per default, the item loses it's addressability on exit from the program. This option causes the module to retain the item's address between CALL invocations of the program. With some rumours that this may become the default in future releases of OpenCOBOL, and the *-fstatic-linkage* option may be deprecated. ----------------------------------------- Q. Does OpenCOBOL support SCREEN SECTION? ----------------------------------------- Yes. The OpenCOBOL 1.1 pre-release now includes support for SCREEN SECTIONs. Experimental release for this support occurred in early July, 2008. ------------------------------------------ Q. Does OpenCOBOL implement Report Writer? ------------------------------------------ Not at this time. *July, 2008* But it does support LINAGE. See `Q. Does OpenCOBOL implement LINAGE?`_ ----------------------------------- Q. Does OpenCOBOL implement LINAGE? ----------------------------------- Yes. LINAGE sets up logical pages inside file descriptors enhancing the WRITE operations and enabling the END-OF-PAGE clause. :: FILE SECTION. FD A-REPORT LINAGE IS 13 LINES TOP 2 FOOTING 2 BOTTOM 3. LINAGE clauses can set:: TOP LINES FOOTING BOTTOM The LINAGE-COUNTER_ noun is maintained during writes to LINAGE output files. ---------------------------------------------------- Q. Does OpenCOBOL implement any Intrinsic Functions? ---------------------------------------------------- Yes, many. As of the July 2008 1.1 pre-release:: ABS, ACOS, ANNUITY, ASIN, ATAN, BYTE-LENGTH, CHAR, COS, CURRENT-DATE, DATE-OF-INTEGER, DATE-TO-YYYYMMDD, DAY-OF-INTEGER, DAY-TO-YYYYDDD, E, EXCEPTION-FILE, EXCEPTION-LOCATION, EXCEPTION-STATEMENT, EXCEPTION-STATUS, EXP, EXP10, FACTORIAL, FRACTION-PART, INTEGER, INTEGER-OF-DATE, INTEGER-OF-DAY, INTEGER-PART, LENGTH, LOCALE-DATE, LOCALE-TIME, LOG, LOG10, LOWER-CASE, MAX, MEAN, MEDIAN, MIDRANGE, MIN, MOD, NUMVAL, NUMVAL-C, ORD, ORD-MAX, ORD-MIN, PI, PRESENT-VALUE, RANDOM, RANGE, REM, REVERSE, SECONDS-FROM-FORMATTED-TIME, SECONDS-PAST-MIDNIGHT, SIGN, SIN, SQRT, STANDARD-DEVIATION, STORED-CHAR-LENGTH, SUM, TAN, TEST-DATE-YYYYMMDD, TEST-DATE-YYYYMMDD, TRIM, UPPER-CASE, VARIANCE, WHEN-COMPILED, YEAR-TO-YYYY ---------------------------------------------------- Q. Can you clarify the use of FUNCTION in OpenCOBOL? ---------------------------------------------------- Yes. This information is from [Roger]_, posted to the opencobol_ forums. :: Just to clarify the use of FUNCTION. (Applies to 0.33) FUNCTION (generally speaking, there are exceptions) can be used anywhere where a source item is valid. It always results in a new temporary field. This will have the desired characteristics dependant on the parameters. eg. FUNCTION MIN (x, y, z) with x PIC 99 y PIC 9(8) COMP z PIC 9(6)V99 will result in returning a field that has at least 8 positions before the (implied) decimal point and 2 after. It does NOT ever change the contents of parameters to the function. FUNCTION's are nestable. eg. DISPLAY FUNCTION REVERSE (FUNCTION UPPER-CASE (myfield)). ---------------------------------------------------------------------- Q. What is the difference between the LENGTH verb and FUNCTION LENGTH? ---------------------------------------------------------------------- From [Roger]_:: The standard only defines FUNCTION LENGTH. The LENGTH OF phrase is an extension (from MF) ---------------------------------- Q. Can I use ctags with OpenCOBOL? ---------------------------------- Yes. Use the Exuberant version of ctags. Exhuberant ctags recognizes COBOL, producing a TAGS or tags file suitable for **emacs**, **vi**, **nedit** and other editors that support the ctags format. *ctags, by default, only supports the competition, C and Fortran.* After running ctags program.cob:: $ vi -t WORKING-STORAGE will open program.cob and start at the line defining the working-storage section. Note: tags are case-sensitive and for larger projects, the above vi command would start an edit of the *first* file with an occurrence of WORKING-STORAGE found in the tags. ------------------------------------------- Q. What about debugging OpenCOBOL programs? ------------------------------------------- OpenCOBOL internal runtime checks are enabled with **-debug**. Support for gdb_ is enabled with **-g**. :: $ gdb hello GNU gdb 6.7.1-debian Copyright (C) 2007 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i486-linux-gnu"... Using host libthread_db library "/lib/i686/cmov/libthread_db.so.1". (gdb) break 106 Breakpoint 1 at 0xOBFUSCA: file hello.c, line 106. (gdb) break 109 Breakpoint 2 at 0xTETHESY: file hello.c, line 109. (gdb) run Starting program: /home/brian/writing/cobol/hello [Thread debugging using libthread_db enabled] [New Thread 0xSTEMADDR (LWP 5782)] [Switching to Thread 0xESSES6b0 (LWP 5782)] Breakpoint 1, hello_ (entry=0) at hello.c:106 106 cob_new_display (0, 1, 1, &c_1); (gdb) cont Continuing. Hello World! Breakpoint 2, hello_ (entry=0) at hello.c:109 109 cob_set_location ("hello", "hello.cob", 6, "MAIN SECTION", "MAIN PARAGRAPH", "STOP"); (gdb) cont Continuing. Program exited normally. (gdb) Setting a break at line 106 and 109 was found by a quick look through the C code from **$ cobc -S hello.cob** and seeing where the DISPLAY call and STOP RUN was located. Note: just because; the gdb displayed addresses were obfuscated from this listing. --------------------------------------- Q. Is there a C interface to OpenCOBOL? --------------------------------------- Most definitely. See http://www.opencobol.org/modules/bwiki/index.php?cmd=read&page=UserManual%2F2_3#content_1_0 for details. ---------------------------------------------------------------------- Q. What are some idioms for dealing with C char * data from OpenCOBOL? ---------------------------------------------------------------------- *Thanks to Frank Swarbrick for pointing these idioms out* To add or remove a null terminator, use the STRING verb. For example:: * Add a null for calling C STRING current-url DELIMITED BY SPACE X"00" DELIMITED BY SIZE INTO display-url MOVE display-url TO current-url * Remove a null for display STRING current-url DELIMITED BY LOW-VALUE INTO display-url. Or to make changes in place:: * Change nulls to spaces INSPECT current-url REPLACING ALL X"00" WITH SPACE. Or there is also modified references in OpenCOBOL:: * Assume IND is the first trailing space (or picture limit). * Note: OpenCOBOL auto initializes working-storage to SPACES or ZEROES * depending on numeric or non-numeric pictures. * Remove null MOVE SPACE TO current-url(IND:1). * Add a zero terminator MOVE X"00" TO current-url(IND:1). [Roger]_ While points out: *X"00" is almost always interchangeable with LOW-VALUE*. In all of the above snippets, the source code X"00" can be replaced by the COBOL noun **LOW-VALUE** or *LOW-VALUES*. .. Note to maintainers. This section is just wrong. BASED is a different thing altogether and simply means the item does not have any permanent storage area. .. When a parameter needs to be passed between C and OpenCOBOL, you can use .. the BASED optional clause in WORKING-STORAGE:: .. .. * Create a BASED allocation .. WORKING-STORAGE SECTION. .. 01 current-url PIC X(80) BASED. .. .. This may be a cleaner solution than:: .. .. LINKAGE SECTION. .. 01 current-url PIC X(80). .. .. And a SET ADDRESS OF CARG ... sequence. With the CALL verb, use ADDRESS OF and/or BY REFERENCE:: CALL "CFUNCTION" USING BY REFERENCE ADDRESS OF current-url. The above being equivalent to char** in C. COBOL, by it's nature, passes all arguments by reference. That can be overridden with the **BY VALUE** clause and the **BY CONTENT** clause. --------------------- Q. What is CobCurses? --------------------- CobCurses is a package designed to allow Open-Cobol programmers to create screens on open system platforms, or those (like Windows) that can use PDCurses. Since handcrafting screens is tedious work, this package includes a "Screen Designer" utility. See http://sourceforge.net/projects/cobcurses for full details. This is a major piece of work by Warren Gay, ve3wwg. ---------------------------------------- Q. Does OpenCOBOL support COPY includes? ---------------------------------------- Yes. COPY is supported, but some limitations to the REPLACING adverb may be encountered. .. Attention:: Look into this The **-I** compiler option influences the copybook search path and **-E** can be used to examine the after COPY preprocessor output. There is also **-ffold-copy-upper** and **-ffold-copy-lower** compiler controls. ---------------------------------------- Q. Does OpenCOBOL support WHEN-COMPILED? ---------------------------------------- Both as a noun and as an intrinsic function. :: DISPLAY WHEN-COMPILED. DISPLAY FUNCTION WHEN-COMPILED. 07/05/0805.15.20 2008070505152000-0400 --------------------------- Q. What is PI in OpenCOBOL? --------------------------- With OpenCOBOL 1.1:: DISPLAY FUNCTION PI. 3.1415926535897932384626433832795029 DISPLAY FUNCTION E. 2.7182818284590452353602874713526625 Thats 34 digits after the decimal. Developers that need to know the tolerances for use in calculations are directed to poke around the freely available source code, and to read up on GMP_. ------------------------------------------------------------------- Q. Does OpenCOBOL support the Object features of the 2002 standard? ------------------------------------------------------------------- Not yet. *July 2008* --------------------------------------- Q. Does OpenCOBOL implement PICTURE 78? --------------------------------------- Yes. PICTURE 78 clauses can be used for constants, translated at compile time. This common non-standard extension is supported in OpenCOBOL. ------------------------------------------------- Q. What source formats are accepted by OpenCOBOL? ------------------------------------------------- Both FIXED and FREE COBOL source formats are supported. FIXED format follows the 1-6, 7, 8-72 special columns of the COBOL standards. The compiler directives: :: Column 12345678901234567890 >> SOURCE FORMAT IS FREE >> SOURCE FORMAT IS FIXED can be used as the first line of any source files. The directive must occur at column 8 or beyond. Continuation indicators in column 7 are not applicable to FREE format and are not supported in this mode of translation. String catenation can always use the **&** operator. The special \*> *till end of line* comment is supported in both FREE and FIXED forms, but by necessity will need to be placed at column 7 or greater in FIXED format sources. .. Note to readers. The comment operator is *> the backslash is for ReST The **-free** and **-fixed** options to **cobc** also influence the expected source formats, with the default being mandated by the standards as FIXED. --------------------------------------------- Q. Does OpenCOBOL support continuation lines? --------------------------------------------- Yes. A dash **-** in column 7 can be used for continuation lines. But, by necessity continuation lines only apply in FIXED format source code. FREE format COBOL does not support continuation as there is no real meaning to *column 7* in FREE form source. Note that there is no terminating quote on string continuations, but there is an extra starting quote following the dash. For example:: 123456789012345678901234567890123456789012345678901234567890123456789012 identification division. program-id. longcont. data division. working-storage section. 01 longstr pic X(80) value "This will all be one string in FIXED forma -"t source code". 01 otherstr pic X(148) value "this -"string will have spaces between the words THIS and STRING, as -"continuation lines always fill to column 72.". procedure division. display longstr. display length longstr. display function length(function trim(longstr)). display otherstr(1:72). display otherstr(73:75). display length otherstr. display function length(function trim(otherstr)). goback. $ cobc longcont.cob $ cobcrun longcont This will all be one string in FIXED format source code 80 00000055 this string will have spaces between the words THIS and STRING, as continuation lines always fill to column 72. 148 00000139 *Note: The DISPLAY of* **otherstr** *was split to avoid any wide browser scrolling, not for any COBOL reasons.* ----------------------------------------------- Q. Does OpenCOBOL support string concatenation? ----------------------------------------------- Absolutely. Sources that need long strings, or even simply enhance readability, can use the **&** operator:: identification division. program-id. longstr. data division. working-storage section. 01 longstr pic X(80) value "This " & "will " & "all " & "be " & "one " & "string " & "in both FIXED and FREE" & " format source code". procedure division. display longstr. goback. $ cobc longstr.cob $ cobcrun longstr This will all be one string in both FIXED and FREE format source code $ cobc -free longstr.cob $ cobcrun longstr This will all be one string in both FIXED and FREE format source code ------------------------------------------------- Q. Does OpenCOBOL support mixed case source code? ------------------------------------------------- Absolutely, kind of. Mixed case and mixed format, ASCII_ and EBCDIC_. Most COBOL compilers have not required uppercase only source code for quite a few years now. Still, most COBOL compilers including OpenCOBOL folds parts of the source to uppercase *with certain rules* before translating. The compiler is case insensitive to names:: 000100 identification division. 000200 program-id. mixcase. 000300 data division. 000400 working-storage section. 000500 01 SOMEUPPER pic x(9). 000600 01 SomeUpper pic x(9). 000700 01 someupper pic x(9). 000800 000900 procedure division. 001000 move "SOMEUPPER" to SOMEUPPER. 001100 move "SomeUpper" to SomeUpper. 001200 move "someupper" to someupper. 001300 display "SOMEUPPER: " SOMEUPPER end-display. 001400 display "SomeUpper: " SomeUpper end-display. 001500 display "someupper: " someupper end-display. 001600 stop run. $ cobc -x mixcase.cob mixcase.cob:10: Error: 'SOMEUPPER' ambiguous; need qualification mixcase.cob:5: Error: 'SOMEUPPER' defined here mixcase.cob:6: Error: 'SOMEUPPER' defined here mixcase.cob:7: Error: 'SOMEUPPER' defined here Note; that although the folded declarations conflict, the DISPLAY quoted strings will NOT be folded, and would display as expected. *Case sensitivity is also at the mercy of operating system conventions*. Under GNU/Linux, OpenCOBOL's dynamic link loader is case sensitive. :: CALL "C$JUSTIFY" USING center-string "C" END-CALL. is not the same as:: CALL "c$justify" USING center-string "C" END-CALL. In support of case folding and COPY libraries, OpenCOBOL supports *-ffold-copy-lower* and *-ffold-copy-upper*. For mixing and matching legacy sources. Trivia The expressions *uppercase* and *lowercase* date back to early moveable type. Typographers would keep two cases of metal casted letters, Capitalized and normal. Usually set on stacked shelves over the workbench. The small letters, being used more frequently, ended up on the lower shelf; the lower case letters. ------------------------------------------ Q. What is the shortest OpenCOBOL program? ------------------------------------------ All that is needed is a program-id. Doesn't do much. :: identification division. program-id. a. ------------------------------------------------------------------------- Q. How do I get those nifty sequential sequence numbers in a source file? ------------------------------------------------------------------------- FIXED format COBOL uses the first 6 positions of each line as a programmer defined **sequence** field. This field is stripped as part of the preprocessing and is not validated. Historically, the sequence numbers were used to verify that card punch cards were read into a card reader in the proper order. Many legacy COBOL programs have sequentially numbered sequence values. Here is a little **vi** trick to renumber the sequence field by 100s. Given :: 000005* HELLO.COB OpenCOBOL FAQ example 000010 IDENTIFICATION DIVISION. 000020 PROGRAM-ID. hello. 000030 PROCEDURE DIVISION. 000040 DISPLAY "Hello World!". 000100 STOP RUN. Running the following **ex** filter :%!perl -ne 'printf("\\%06d\\%s\\n", $. * 100, substr($_, 6, -1));' .. Note to readers of the plain text of this FAQ. ReStructuredText uses backslash to escape certain features. That line is actually :%!perl -ne 'printf("\%06d\%s\n", $. * 100, substr($_, 6, -1));' produces a nicely resequenced source file. :: 000100* HELLO.COB OpenCOBOL FAQ example 000200 IDENTIFICATION DIVISION. 000300 PROGRAM-ID. hello. 000400 PROCEDURE DIVISION. 000500 DISPLAY "Hello World!". 000600 STOP RUN. * Note: Only use this on already FIXED form source. If used on any FREE format COBOL, the first 6 columns will be damaged. This has no effect on the compilation process, it only effects the appearance of the sources. -------------------------------------------------------------------------- Q. Is there a way to count trailing spaces in data fields using OpenCOBOL? -------------------------------------------------------------------------- Yes. Quite a few. But instead of resorting to a PERFORM VARYING sequence try:: 01 B-COUNT PIC 999 VALUE 0. 01 TEST-CASE PIC X(80) VALUE "This is my string.". ONE-WAY. INSPECT FUNCTION REVERSE(TEST-CASE) TALLYING B-COUNT FOR LEADING ' '. DISPLAY B-COUNT. TWO-WAY. INSPECT TEST-CASE TALLYING B-COUNT FOR TRAILING SPACE. DISPLAY B-COUNT. THREE-WAY. COMPUTE B-COUNT = LENGTH TEST-CASE - FUNCTION LENGTH(FUNCTION TRIM(TEST-CASE)) END-COMPUTE DISPLAY B-COUNT. produces:: 062 124 062 The second value is 124 as TWO-WAY accumulates another 62 after ONE-WAY. The INSPECT verb does not initialize a TALLYING variable. Information modified from opencobol.org_ forum post. ===== Notes ===== .. These are the internal, non question information nodes. ---- CALL ---- The OpenCOBOL CALL verb accepts literal or identifier stored names when resolving the transfer address. The USING phrase allows argument passing and OpenCOBOL includes internal rules for the data representation of the call stack entities that depend on the COBOL PICTURE_ and USAGE_ clauses. Return values are captured with RETURNING identifier. For more information see http://www.opencobol.org/modules/bwiki/index.php?cmd=read&page=UserManual%2F2_3#content_1_0 ------- PICTURE ------- Full standards support of all alpha, alphanumeric and numeric storage specifiers as well as full support for edit and numeric-edit clauses. ----- USAGE ----- OpenCOBOL uses standard big-endian_ internal storage by default. USAGE clauses influence the data representation. The INTEL architecture uses little-endian_ form and OpenCOBOL programmers developing for this common chipset may need to pay heed to this for performance purposes. As per the standards, OpenCOBOL supports COMPUTATIONAL-5 native usage. OpenCOBOL enables use of one to eight byte binary representations in both big and little endian forms. Along with full support of all common COBOL_ PICTURE_ clauses both storage and display, OpenCOBOL supports USAGE clauses of: * BINARY * COMPUTATIONAL, COMP * COMP-1 * COMP-2 * COMP-3 * COMP-4 * COMP-5 * COMP-X * DISPLAY * INDEX * PACKED-DECIMAL * POINTER * PROGRAM-POINTER * SIGNED-SHORT * SIGNED-INT * SIGNED-LONG * UNSIGNED-SHORT * UNSIGNED-INT * UNSIGNED-LONG * BINARY-CHAR SIGNED * BINARY-CHAR UNSIGNED * BINARY-CHAR * BINARY-SHORT SIGNED * BINARY-SHORT UNSIGNED * BINARY-SHORT * BINARY-LONG SIGNED * BINARY-LONG UNSIGNED * BINARY-LONG * BINARY-DOUBLE SIGNED * BINARY-DOUBLE UNSIGNED * BINARY-DOUBLE * BINARY-C-LONG SIGNED * BINARY-C-LONG UNSIGNED * BINARY-C-LONG -------------- LINAGE-COUNTER -------------- An internal OpenCOBOL noun, or *Special Register*. Value is readonly and is maintained during WRITEs to files that have a LINAGE clause. Useful for quick reports and logical page layouts. ---------- big-endian ---------- Binary values stored with the most significant byte at the lowest memory address. **Big End First**. See http://en.wikipedia.org/wiki/Endianness for more details. The OpenCOBOL compiler *default* storage format for USAGE_ BINARY and COMP. ------------- little-endian ------------- Binary values stored with the most significant byte at the highest memory address. **Little End First**. http://en.wikipedia.org/wiki/Endianness for more details. This is the common Intel architecture form, and USAGE_ clauses of COMPUTATIONAL-5, BINARY-CHAR, BINARY-SHORT, BINARY-LONG, BINARY-DOUBLE are a true performance boost on this hardware. See http://www.opencobol.org/modules/bwiki/index.php?cmd=read&page=UserManual%2F4#content_1_0 for some details. ------ EBCDIC ------ Extended Binary Coded Decimal Interchange Code. A character encoding common to mainframe systems, therefore COBOL, therefore OpenCOBOL. Different than ASCII_ and OpenCOBOL supports both through efficient mappings. See http://en.wikipedia.org/wiki/EBCDIC for more info. ----- ASCII ----- American Symbolic Code for Information Interchange. The character encoding common to personal computers and the Internet Age, therefore OpenCOBOL. OpenCOBOL also supports the EBCDIC_ character encoding so some data transfers and keyboard handling or console display programs may need programmer attention to detail. Although this is a rare case as OpenCOBOL operates using an intelligent choice of encoding for each platform build. .. Attention:: Look into this .. Attention:: Unicode? See http://en.wikipedia.org/wiki/American_Standard_Code_for_Information_Interchange for more info. --- DSO --- Dynamic Shared Objects. Similar to but subtlety different from *share libraries*. --- gdb --- The GNU symbolic debugger. Big, deep, wide. :: $ info gdb for the details. or visit http://www.gnu.org/software/gdb/documentation/ --- GMP --- GNU MP libgmp. GNU Library for decimal arithmetic. See http://gmplib.org/ for complete details on the library advertised as *Arithmetic without limitations*. ======= Authors ======= .. [Keisuke] Keisuke Nishida Initial developer and creator of OpenCOBOL. |KeisukeActive| was the primary developer and OpenCOBOL project lead. His efforts are greatly appreciated by the userbase of OpenCOBOL. .. [Roger] Roger While OpenCOBOL 1.1 is currently in development, and Roger is the lead programmer. |RogerActive|, Roger has been very active on the opencobol.org_ website, and is open to feature requests and clarifications to the implementation. Roger has, since January 2008, actively monitored an OpenCOBOL 1.1 wishlist on the opencobol.org_ OpenCOBOL forum. =========== Maintainers =========== .. [btiffin] Brian Tiffin Initial FAQ, sample programs for OpenCOBOL 1.1. ========= Changelog ========= 02-July-2008 Experimental version for commnent 06-July-2008 First 0.0 pre-alpha release 07-July-2008 Second 0.0 pre-alpha. 11-July-2008 Last 0.0 pre-alpha. Checked in for diffs. .. These are the external link substitutions. .. _OpenCOBOL: http://opencobol.org/ .. _opencobol.org: http://opencobol.org/ .. _`OpenCOBOL 1.0`: http://opencobol.org/modules/mydownloads/singlefile.php?cid=1&lid=3 .. _`OpenCOBOL 1.1`: http://www.opencobol.org/modules/mydownloads/singlefile.php?cid=1&lid=2 .. _COBOL: http://en.wikipedia.org/wiki/COBOL .. _`COBOL 85`: http://cantfind.org .. _`COBOL 2002`: http://cantfind.org .. _`COBOL FAQ`: http://home.comcast.net/~wmklein/FAQ/COBOLFAQ.htm .. _`OpenCOBOL Install`: http://www.opencobol.org/modules/bwiki/index.php?InstallGuide .. _`OpenCOBOL Wiki`: http://www.opencobol.org/modules/bwiki/ .. _`OpenCOBOL Forum`: http://www.opencobol.org/modules/newbb/ .. _`OpenCOBOL News`: http://www.opencobol.org/modules/news/ .. _`GNU General Public License`: http://www.gnu.org/licenses/gpl.html .. _`GNU Lesser General Public License`: http://www.gnu.org/licenses/lgpl.html .. This section holds replacements and special symbols. .. |copysym| unicode:: 0xA9 .. |copyleft| replace:: Copyright |copysym| 2008 The OpenCOBOL Project .. |KeisukeActive| replace:: From the 1990s through 2004 .. |RogerActive| replace:: From early 2004 up till today, and tomorrow [/code] ---------------------------------------------------------------- Test DIFF. [code] Index: ocfaq.txt =================================================================== --- ocfaq.txt (revision 4) +++ ocfaq.txt (working copy) @@ -688,7 +688,6 @@ --------------------------------------------- Q. What is the OpenCOBOL LINKAGE SECTION for? --------------------------------------------- - Argument passing in COBOL is normally accomplished through the **LINKAGE SECTION**. This section does not allocate or initialize memory as would definitions in the WORKING-STORAGE SECTION. @@ -1319,71 +1318,38 @@ and display, OpenCOBOL supports USAGE clauses of: * BINARY - * COMPUTATIONAL, COMP - * COMP-1 - * COMP-2 - * COMP-3 - * COMP-4 - * COMP-5 - * COMP-X - * DISPLAY - * INDEX - * PACKED-DECIMAL - * POINTER - * PROGRAM-POINTER - * SIGNED-SHORT - * SIGNED-INT - * SIGNED-LONG - * UNSIGNED-SHORT - * UNSIGNED-INT - * UNSIGNED-LONG - * BINARY-CHAR SIGNED - * BINARY-CHAR UNSIGNED - * BINARY-CHAR - * BINARY-SHORT SIGNED - * BINARY-SHORT UNSIGNED - * BINARY-SHORT - * BINARY-LONG SIGNED - * BINARY-LONG UNSIGNED - * BINARY-LONG - * BINARY-DOUBLE SIGNED - * BINARY-DOUBLE UNSIGNED - * BINARY-DOUBLE - * BINARY-C-LONG SIGNED - * BINARY-C-LONG UNSIGNED - * BINARY-C-LONG -------------- @@ -1443,20 +1409,20 @@ OpenCOBOL operates using an intelligent choice of encoding for each platform build. -.. Attention:: Look into this - -.. Attention:: Unicode? - See http://en.wikipedia.org/wiki/American_Standard_Code_for_Information_Interchange for more info. +.. Attention:: Look into this + +.. Attention:: Unicode? + --- DSO --- Dynamic Shared Objects. -Similar to but subtlety different from *share libraries*. +Similar to but subtlely different from *share libraries*. --- gdb @@ -1520,6 +1486,9 @@ 11-July-2008 Last 0.0 pre-alpha. Checked in for diffs. +13-July-2008 + Last-last 0.0 pre-alpha. Verify DIFF functionality. + .. These are the external link substitutions. .. _OpenCOBOL: http://opencobol.org/ .. _opencobol.org: http://opencobol.org/ [/code] ---------------------------------------------------------------- Brian, I will do this setup tomorrow at the office. I went out last night and I'm still recovering so I want to make sure I do it right. Also if you want I can as well set up an SVN repository. I've had one of mine set to do a dump whenever I committed, so even if I messed up the repo, I was able to recover to any point (yes I am nuts about backups). I will have to hunt up the code that I used to do that. ---------------------------------------------------------------- Groovy. Umm, not sure how much this would be effecting "on the clock time", but if you do have artistic types, let them know that they have complete keys to the ocfaq.css, that snippet being public. Yeah, an accessible repo would be great. Being an open project, it would be neat to have non-anonymous public updates. Cheers, Brian ---------------------------------------------------------------- Second diff. P.S. Need more/better (more better) jokes. Cheers [code] Index: ocfaq.txt =================================================================== --- ocfaq.txt (revision 5) +++ ocfaq.txt (working copy) @@ -3,7 +3,7 @@ ************* .. Formatted for docutils, ReStructuredText. rst-buidhtml -.. Attention:: This is the 0.0c pre alpha release of the OpenCOBOL FAQ +.. Attention:: This is the 0.0d pre alpha release of the OpenCOBOL FAQ .. Sectnum:: :Authors: @@ -13,7 +13,7 @@ :Organization: The OpenCOBOL Project :Version: - 0.0c + 0.0d :Status: Experimental - Not for public release :Copyright: @@ -72,13 +72,13 @@ ----------------------------- Q. How complete is OpenCOBOL? ----------------------------- -`OpenCOBOL 1.0`_ implements a substantial portion of COBOL 85, -supports many of the advances and clarifications of COBOL 2002, +`OpenCOBOL 1.0`_ implements a substantial portion of `COBOL 85`_, +supports many of the advances and clarifications of `COBOL 2002`_, and includes many extensions in common use from Micro Focus COBOL, ACUCOBOL and other exsistent compilers. -`OpenCOBOL 1.1`_ implements a more substantial portion of the COBOL 85 -Dialect, COBOL 2002 and a growing number of vendor extensions. +`OpenCOBOL 1.1`_ implements a more substantial portion of the `COBOL 85_` +Dialect, `COBOL 2002`_ and a growing number of vendor extensions. Some proposed COBOL 2008 features have also been implemented. Compatibility support includes: @@ -113,7 +113,14 @@ ------------------------------------------- Q. Does OpenCOBOL pass the NIST Test Suite? ------------------------------------------- +Don't know. +The National Institute of Standards and Technology, NIST, maintains a +COBOL 85 implementation verification suite of tests. An archive of the tests +can be found at + +http://www.itl.nist.gov/div897/ctg/cobol_form.htm + .. Attention:: Look into this --------------------------------------- @@ -165,6 +172,39 @@ The opencobol.org_ website is probably the best place to find out more about the OpenCOBOL system. +--------------------------------------------- +Q. Can I help out with the OpenCOBOL project? +--------------------------------------------- +Absolutey. Visit the opencobol.org_ website and either post a message asking +what needs to be done, or perhaps join the development mailing list to find +out the current state of development. See +`Q. Is there an OpenCOBOL mailing list?`_ for some details. OpenCOBOL is a +GPL licensed open source project and while [Roger]_ is the lead developer he +is quite open to code submissions. Having a central point of development +allows for consistency and the very high level of quality control enjoyed by +OpenCOBOL users. + +-------------------------------------- +Q. Is there an OpenCOBOL mailing list? +-------------------------------------- +Yes. Visit opencobol.org_ for details. The OpenCOBOL development mailing +list is graciously hosted by SourceForge. The ML archive is available at +http://sourceforge.net/mailarchive/forum.php?forum_name=open-cobol-list +and once you have subscribed, the list will accept messages at +the open-cobol-list email destination at lists.sourceforge.net. + +----------------------------------------------------------- +Q. Where can I find more information about COBOL standards? +----------------------------------------------------------- +The `COBOL 85`_ standard is documented in + +* ANSI X3.23-1985 +* ISO 1989-1985 +* ANSI X3.23a-1989 +* ANSI X3.23b-1993 + +.. Attention:: Look into this + ------------------------------ Q. Do you know any good jokes? ------------------------------ @@ -192,6 +232,21 @@ *Thanks to aoirthoir* +* A common dis of COBOL jokes that the acronym is: + + Completely Obsolete Business Oriented Language. + *Author unkown* + + We know better. The reality is: + + Can't Obsolesce Because Of Legacy. + + *Brian Tiffin* + +* Ruby on Rails? Don't forget COBOL ON COGS. + + http://www.coboloncogs.org/INDEX.HTM + * Eat COBOL, three quadrillion transactions can't be wrong. *Brian Tiffin* @@ -501,7 +556,6 @@ --------------------------------------- Q. What compiler options are supported? --------------------------------------- - .. Note to maintainers. Build with $ cobc --help and indent 4 spaces. :: @@ -575,7 +629,34 @@ -ffold-copy-upper Fold COPY subject to upper case (Default no transformation) -fnotrunc Do not truncate binary fields according to PIC (ala MF) -fnull-param Pass extra NULL terminating pointers on CALL statements - + +-------------------------------------------- +Q. What dialects are supported by OpenCOBOL? +-------------------------------------------- +Using the **std=** compiler option, OpenCOBOL can be configured to +compile using specific historical COBOL compiler features and quirks. + +Supported dialects include: + +* default +* cobol85 +* cobol2002 +* ibm +* mvs +* mf +* bs2000 + +For details on what options and switches are used to support these dialect +compiles, see the **config/** directory of your OpenCOBOL installation. For +Debian GNU/Linux, that will be **/usr/share/open-cobol/config/** if you used +APT to install an OpenCOBOL package or **/usr/local/share/open-cobol/config/** +after a build from the source archive. + +For example: the *bs2000.conf* file restricts data representations to 2, 4 or +8 byte binary while *mf.conf* allows data representations from 1 thru 8 bytes. +*cobol85.conf* allows debugging lines, *cobol2002.conf* configures the +compiler to warn that this feature is obsolete. + ----------------------------------------- Q. What are the OpenCOBOL reserved words? ----------------------------------------- @@ -813,6 +894,111 @@ The standard only defines FUNCTION LENGTH. The LENGTH OF phrase is an extension (from MF) +--------------------------------------------------- +Q. What standard CALL library does OpenCOBOL offer? +--------------------------------------------------- +OpenCOBOL 1.0 ships with quite a few callable features. See CALL_ +Looking through the source code, you'll find the current list of service +calls in:: + + libcob/system.def + +With the 1.1 pre-release of July 2008, that list included:: + + /* COB_SYSTEM_GEN (external name, number of parameters, internal name) */ + + COB_SYSTEM_GEN ("SYSTEM", 1, SYSTEM) + COB_SYSTEM_GEN ("CBL_ERROR_PROC", 2, CBL_ERROR_PROC) + COB_SYSTEM_GEN ("CBL_EXIT_PROC", 2, CBL_EXIT_PROC) + COB_SYSTEM_GEN ("CBL_OPEN_FILE", 5, CBL_OPEN_FILE) + COB_SYSTEM_GEN ("CBL_CREATE_FILE", 5, CBL_CREATE_FILE) + COB_SYSTEM_GEN ("CBL_READ_FILE", 5, CBL_READ_FILE) + COB_SYSTEM_GEN ("CBL_WRITE_FILE", 5, CBL_WRITE_FILE) + COB_SYSTEM_GEN ("CBL_CLOSE_FILE", 1, CBL_CLOSE_FILE) + COB_SYSTEM_GEN ("CBL_FLUSH_FILE", 1, CBL_FLUSH_FILE) + COB_SYSTEM_GEN ("CBL_DELETE_FILE", 1, CBL_DELETE_FILE) + COB_SYSTEM_GEN ("CBL_COPY_FILE", 2, CBL_COPY_FILE) + COB_SYSTEM_GEN ("CBL_CHECK_FILE_EXIST", 2, CBL_CHECK_FILE_EXIST) + COB_SYSTEM_GEN ("CBL_RENAME_FILE", 2, CBL_RENAME_FILE) + COB_SYSTEM_GEN ("CBL_GET_CURRENT_DIR", 3, CBL_GET_CURRENT_DIR) + COB_SYSTEM_GEN ("CBL_CHANGE_DIR", 1, CBL_CHANGE_DIR) + COB_SYSTEM_GEN ("CBL_CREATE_DIR", 1, CBL_CREATE_DIR) + COB_SYSTEM_GEN ("CBL_DELETE_DIR", 1, CBL_DELETE_DIR) + COB_SYSTEM_GEN ("CBL_AND", 3, CBL_AND) + COB_SYSTEM_GEN ("CBL_OR", 3, CBL_OR) + COB_SYSTEM_GEN ("CBL_NOR", 3, CBL_NOR) + COB_SYSTEM_GEN ("CBL_XOR", 3, CBL_XOR) + COB_SYSTEM_GEN ("CBL_IMP", 3, CBL_IMP) + COB_SYSTEM_GEN ("CBL_NIMP", 3, CBL_NIMP) + COB_SYSTEM_GEN ("CBL_EQ", 3, CBL_EQ) + COB_SYSTEM_GEN ("CBL_NOT", 2, CBL_NOT) + COB_SYSTEM_GEN ("CBL_TOUPPER", 2, CBL_TOUPPER) + COB_SYSTEM_GEN ("CBL_TOLOWER", 2, CBL_TOLOWER) + COB_SYSTEM_GEN ("\364", 2, CBL_XF4) + COB_SYSTEM_GEN ("\365", 2, CBL_XF5) + COB_SYSTEM_GEN ("\221", 2, CBL_X91) + COB_SYSTEM_GEN ("C$NARG", 1, cob_return_args) + COB_SYSTEM_GEN ("C$PARAMSIZE", 1, cob_parameter_size) + COB_SYSTEM_GEN ("C$MAKEDIR", 1, cob_acuw_mkdir) + COB_SYSTEM_GEN ("C$CHDIR", 2, cob_acuw_chdir) + COB_SYSTEM_GEN ("C$SLEEP", 1, cob_acuw_sleep) + COB_SYSTEM_GEN ("C$COPY", 3, cob_acuw_copyfile) + COB_SYSTEM_GEN ("C$FILEINFO", 2, cob_acuw_file_info) + COB_SYSTEM_GEN ("C$DELETE", 2, cob_acuw_file_delete) + COB_SYSTEM_GEN ("C$TOUPPER", 2, CBL_TOUPPER) + COB_SYSTEM_GEN ("C$TOLOWER", 2, CBL_TOLOWER) + COB_SYSTEM_GEN ("C$JUSTIFY", 1, cob_acuw_justify) + COB_SYSTEM_GEN ("CBL_OC_NANOSLEEP", 1, cob_oc_nanosleep) + +Note the "SYSTEM". This CALL sends a command string to the shell. + +------------------------------------------- +Q. What are the XF4, XF5, and X91 routines? +------------------------------------------- +From opencobol.org_ + +:: + + The CALL's X"F4", X"F5", X"91" are from MF. + You can find them in the online MF doc under + Library Routines. + + F4/F5 are for packing/unpacking bits from/to bytes. + 91 is a multi-use call. Implemented are the subfunctions + get/set cobol switches (11, 12) and get number of call params (16). + + Roger + +Use + +:: + + CALL X"F4" USING + BYTE-VAR + ARRAY-VAR + RETURNING STATUS-VAR + +to pack the last bit of each byte in the 8 byte ARRAY-VAR into corresponding +bits of the 1 byte BYTE-VAR. + +The X"F5" routine takes the eight bits of byte and moves them to the +corresponding occurrence within array. + +X"91" is a multi-function routine. + +:: + + CALL X"91" USING + RESULT-VAR + FUNCTION-NUM + PARAMETER-VAR + RETURNING STATUS-VAR + +As mentioned by Roger, OpenCOBOL supports FUNCTION-NUM of 11, 12 and 16. + +11 and 12 get and set the stats of the 8 (eight) run-time OpenCOBOL switches +definable in the SPECIAL-NAMES_ paragraph. + ---------------------------------- Q. Can I use ctags with OpenCOBOL? ---------------------------------- @@ -874,7 +1060,7 @@ (gdb) Setting a break at line 106 and 109 was found by a quick look through the C -code from **$ cobc -S hello.cob** and seeing where the DISPLAY call and +code from **$ cobc -C hello.cob** and seeing where the DISPLAY call and STOP RUN was located. Note: just because; the gdb displayed addresses were obfuscated from this listing. @@ -1122,6 +1308,24 @@ $ cobcrun longstr This will all be one string in both FIXED and FREE format source code +-------------------------------------------------- +Q. Does OpenCOBOL support D indicator debug lines? +-------------------------------------------------- +Yes, but only for FIXED FORMAT sources. As for continuation lines, column +7 has no meaning for SOURCE FORMAT IS FREE source code. Use **D** lines as +a conditional include of a source code line. These debug lines will only +be compiled if the *-fdebugging-line* compiler switch is used. + +From human on opencobol.org_ + +:: + + If you put a D in column 7 OC handles this as a comment. These lines are + only compiled if you run cobc with -fdebugging-line. + + By using this you can put some test messages etc. into your program that + are only used if necessary (and therefore build with -fdebugging-line). + ------------------------------------------------- Q. Does OpenCOBOL support mixed case source code? ------------------------------------------------- @@ -1263,7 +1467,7 @@ THREE-WAY. COMPUTE B-COUNT = LENGTH TEST-CASE - - FUNCTION LENGTH(FUNCTION TRIM(TEST-CASE)) + FUNCTION LENGTH(FUNCTION TRIM(TEST-CASE TRAILING)) END-COMPUTE DISPLAY B-COUNT. @@ -1291,11 +1495,17 @@ resolving the transfer address. The USING phrase allows argument passing and OpenCOBOL includes internal rules for the data representation of the call stack entities that depend on the COBOL PICTURE_ and USAGE_ clauses. -Return values are captured with RETURNING identifier. +Return values are captured with RETURNING identifier. See +`Q. What standard CALL library does OpenCOBOL offer?`_. For more information see http://www.opencobol.org/modules/bwiki/index.php?cmd=read&page=UserManual%2F2_3#content_1_0 +------------- +SPECIAL-NAMES +------------- +OpenCOBOL supports a fair complete set of the SPECIAL-NAMES in common use. + ------- PICTURE ------- @@ -1489,6 +1699,9 @@ 13-July-2008 Last-last 0.0 pre-alpha. Verify DIFF functionality. +17-July-2008 + Last-last-last 0.0 pre-alpha. Second DIFF. + .. These are the external link substitutions. .. _OpenCOBOL: http://opencobol.org/ .. _opencobol.org: http://opencobol.org/ [/code] Brian ---------------------------------------------------------------- Brian, There are a number of typos here as well as some non-accurate stuff. Can you send per Email at my address the current status so that I can check it over. Oh, and incidentally, check also your Emails :-) Roger ---------------------------------------------------------------- Done. Thanks Roger. Don't want a FAQ full of Lies. :) Cheers, Brian ---------------------------------------------------------------- Subject: Running OC in safe mode Hello, I was wondering how we can run an OC program in safe mode. This will preserve hanging up with ^C. It is specially useful when running applications in multi-user environment. I imagine the best way to run applications is using cobcrun ? Best regards Bear ---------------------------------------------------------------- Just set the (shell) environment to ignore CTRL-C before executing the program. Depending on the shell/OS - trap "" 2 or trap "" INT The last if your shell/OS supports symbolic signal numbers. Roger ---------------------------------------------------------------- Subject: C + GTK + COBOL how to?? Dear friends... I've compiled "Hello World" example routine, but! when I try to compile C + GTK code I have this error: #gcc -c `cob-config --cflags` `gtk-config --cflags` `gtk-config --libs` hello.c <- good # cobc -c -static say.cob <- good # cobc -x -o hello hello.o say.o <- error hello.o: In function `destroy': hello.c:(.text+0x1f): undefined reference to `gtk_main_quit' hello.o: In function `main': hello.c:(.text+0x3d): undefined reference to `gtk_init' hello.c:(.text+0x47): undefined reference to `gtk_window_new' hello.c:(.text+0x7f): undefined reference to `gtk_type_check_object_cast' hello.c:(.text+0xa5): undefined reference to `gtk_signal_connect' hello.c:(.text+0xaa): undefined reference to `gtk_container_get_type' hello.c:(.text+0xb5): undefined reference to `gtk_type_check_object_cast' hello.c:(.text+0xc2): undefined reference to `gtk_container_set_border_width' hello.c:(.text+0xcc): undefined reference to `gtk_button_new_with_label' hello.c:(.text+0x104): undefined reference to `gtk_type_check_object_cast' hello.c:(.text+0x12a): undefined reference to `gtk_signal_connect' hello.c:(.text+0x12f): undefined reference to `gtk_container_get_type' hello.c:(.text+0x13a): undefined reference to `gtk_type_check_object_cast' hello.c:(.text+0x146): undefined reference to `gtk_container_add' hello.c:(.text+0x14f): undefined reference to `gtk_widget_show' hello.c:(.text+0x158): undefined reference to `gtk_widget_show' hello.c:(.text+0x15d): undefined reference to `gtk_main' any ideas? any help? ---------------------------------------------------------------- Hi Christian, I think you'll need to look at -l and -L on the final cobc. Inform cobc where the libraries are. Too new to fill you on details or know if this is right, but that's where I would start. I'm not sure if the gcc link sequence carries through to the -x? Just tested, no it doesn't. And come think, -c says don't link so you will need to move the -l -L down to the cobc. (I've only linked to libcurl before so ...) $ gcc -c `cob-config --cflags` hello.c $ cobc -x -o hello -lcurl hello.o say.o where my hello.c calls a curl_easy_init for a test [code] $ cobc -x -o hello hello.o say.o hello.o: In function `main': hello.c:(.text+0xb8): undefined reference to `curl_easy_init' collect2: ld returned 1 exit status $ cobc -lcurl -x -o hello hello.o say.o $ [/code] The output from gtk-config --libs should work backticked into the cobc command. Cheers Brian ---------------------------------------------------------------- It's was very easy... thanks so much!!!! This is the commands I've excuted: cc -c `cob-config --cflags` `gtk-config --cflags` `gtk-config --libs` hello.c cobc -c -static say.cob cobc -lgtk -lgdk -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm -x -o hello hello.o say.o :-D ---------------------------------------------------------------- That's great Christian. If you do this a lot, it might be beneficial to change the cobc -x to [code] $ cobc `gtk-config --libs` -x -o hello hello.o say.o [/code] [i]But between you and me, I learn more not using the helper commands until, well, later.[/i] :) Cheers, Brian ---------------------------------------------------------------- Subject: COBOL Quiz/Tidbits As I went a bit off-topic with LOW-VALUE versus X"00" in another thread, I thought we might like to start a new thread for stuff like this. If you have a new quiz/tidbit, put somewhere on a seperate line [Quiz nnn] or [Tidbit nnn] (with the brackets and where nnn is the ascending number within this thread). When replying, just refer to Qnnn, Tnnn respectively. To get the ball rolling - [Quiz 1] [code] >>SOURCE FIXED IDENTIFICATION DIVISION. PROGRAM-ID. EXM. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DATA DIVISION. WORKING-STORAGE SECTION. 01 FLD PIC X(16). PROCEDURE DIVISION. STRING "ls" DELIMITED SIZE LOW-VALUE DELIMITED SIZE INTO FLD END-STRING CALL "SYSTEM" USING FLD END-CALL STOP RUN . [/code] What lines must be ADDED to the above to prevent it producing the desired result? (More than one solutuon) Note, you may NOT change any of the above code. You may only add lines. What is the minimal solution(in terms of characters in the added lines) ? Roger ---------------------------------------------------------------- add [code] " > /dev/null " delimited by size [/code] before LOW-VALUE DELIMITED BY SIZE Bear ---------------------------------------------------------------- Re. Q1 - Yes, that is one way. A variant of Bear's solution is to tack on a literal directly after the "ls" causing a "command not found" error eg. (As Bear's code, before the LOW-VALUE phrase) [code] "BLAHBLAH" DELIMITED BY SIZE [/code] There are at least three other distinct (distinct in the sense that they are not variants of each other and are completely different methods) to achieve a solution. Bear's solution is not the minimal solution. I have decided to start a seperate thread for Info/Tidbits - See thread Cobol Info/Tidbits. We will use this current thread for quiz type posts. Roger ---------------------------------------------------------------- Re: Q1 Here are a few keywords to get the grey cells cranked up - syntax, expression, evaluation, figurative, sequence, element, condition, exception, imperative, exception, content, value. Roger ---------------------------------------------------------------- OK. Seeing that you are all stumped, here is one solution that is NOT the minimal solution. After CONFIGURATION SECTION add - [code] OBJECT-COMPUTER. Linux PROGRAM COLLATING SEQUENCE IS MYSEQ. [/code] After SPECIAL-NAMES add - [code] ALPHABET MYSEQ IS "A". [/code] :-) So, ignoring changes to the STRING and the above, what other solutions do we have? Roger ---------------------------------------------------------------- Also not the minimal solution, but maybe starts you thinking - After the PROCEDURE DIVISION add - [code] PERFORM 0 TIMES [/code] and BEFORE the terminating period (".") add - [code] END-PERFORM [/code] :-) Roger ---------------------------------------------------------------- Q1; In that vein would [code] IF 0 = 1 [/code] before the CALL [code] END-IF [/code] after, count? Cheers P.S. I don't think I've taken part in a [i]break this code[/i] challenge before. :) Edit; better to use code that compiles. ---------------------------------------------------------------- Well we are almost there. If you put the IF 0 = 1 immediately after the PROCEDURE DIVSION, then you do not need the END-IF. It is not quite the minimal solution. Roger ---------------------------------------------------------------- [Quiz 2] Consider - [code] COMPUTE BA = 5 + 2 * 4 ** 3 + 1. [/code] where BA is a sufficiently large numeric field eg. PIC 9(8). Can you determine by inspection alone the value of BA after executing this statement. (You can of course check your answer by running a prog that does this) Where must matching parentheses ie. '(', ')' be inserted into the construct such that after execution BA has a value of 2198? ---------------------------------------------------------------- [Quiz 3] [code] IDENTIFICATION DIVISION. PROGRAM-ID. EXM3. PROCEDURE DIVISION. A-START. PERFORM B-DISPLAY 2 TIMES EXIT PROGRAM . B-DISPLAY. DISPLAY "Test" . [/code] This code when compiled/executed with either - cobc -x EXM3.cob ./EXM3 or cobc EXM3.cob cobcrun EXM3 displays "Test" 3 times. Why? What syntax should be used so that "Test" only gets displayed 2 times in all circumstances. ---------------------------------------------------------------- Change EXIT PROGRAM into GOBACK Regards Bear ---------------------------------------------------------------- Q2 first part; [i]Can you determine...[/i] No! :) I was only off by 21819 on my first guess. Us REBOL and/or Forth programmers don't use operator precedence. In the languages I've been [i]mostly[/i] using for the last 20 years, the answer would be 21953, not some silly algebraically correct number. :-x Second part I'll leave to others to play with, with a small hint that it has something to do with 13. Cheers P.S. REBOL has zero in common with COBOL (aside from being cool that is). ---------------------------------------------------------------- [Quiz 4] Inspired by btiffin's thread Advocacy/blog - Assuming a PROG-ID of "Hello", what is the minimum "Hello World" program in terms of lines/characters in Cobol? The solution I have also works with MF and may surprise you. Roger ---------------------------------------------------------------- Is the given answer right? If yes, why? GOBACK should only replace EXIT PROGRAM and STOP RUN, both should be the same if used there, shouldn't they? ---------------------------------------------------------------- Re Quiz 3- Yes, GOBACK is correct. That gives correct behaviour regardless whether this prog is executed as a "main" prog or 'CALL'ed from some other Cobol prog. And this actually leads to the answer to Quiz 1. The idea to insert immediately after the PROCEDURE DIVISION IF 0 = 1 is not bad. Ignoring leading spaces that's 8 characters. We can do a minimal with GOBACK Now get your teeth around the "Hello World" problem :-) Should be obvious, but a first hint is to use free format (ie. start in column 1). Roger ---------------------------------------------------------------- [Q 4] [code] program-id.hello.procedure division.display "hello world". [/code] free format of course. MF allows even program-id missing. ---------------------------------------------------------------- Yes, that answer for Q4 is correct and valid according to the standard. Re. MF. They really allow stupid things. Did you know that with MF you can compile and execute a source file with ZERO bytes? - roglinux:~ # ls -l empty2.cob -rw-r--r-- 1 root root 0 Jul 31 18:03 empty2.cob roglinux:~ # cob empty2.cob roglinux:~ # cobrun empty2 Geez. Roger ---------------------------------------------------------------- [Quiz 5] [code] CALL "MYSUB" ON EXCEPTION DISPLAY "MYSUB not callable" NOT ON EXCEPTION DISPLAY "MYSUB was callable" . [/code] Why is the above code not doing what you think it should be doing? Roger ---------------------------------------------------------------- Because of missing end-displays, the compiler does the following:[code]CALL "MYSUB" ON EXCEPTION DISPLAY "MYSUB not callable" NOT ON EXCEPTION DISPLAY "MYSUB was callable" .[/code] The code should look like[code]CALL "MYSUB" ON EXCEPTION DISPLAY "MYSUB not callable" END-DISPLAY NOT ON EXCEPTION DISPLAY "MYSUB was callable" END-DISPLAY END-CALL[/code] ---------------------------------------------------------------- Subject: COBOL Info/Tidbits I have decided we should seperate info/tidbits from the "Quiz" thread. [Info 1] The following not only applies to OC, it also applies to MF/ACU. When using an item as a subscript/index/counter/switch, it is optimal to define the item as a whole word machine integer at the 01 level. The "01" level guarantees a natural alignment for the item. eg. [code] 01 MYINDEX USAGE BINARY-LONG. *> AKA PIC S9(9) COMP-5 [/code] Note - The following only applies to binary type fields. Other usage like simple numeric ( PIC 9(n) ) or PACKED ( COMP-3 )are always suboptimal as they (at runtime) have to be converted, operated upon and reconverted. Discussion - To understand this we must look at the target machine architecture. There are two things that are relevant here. The first is the "alignment tolerance" of the machine. The second is the "endianness" of the machine. Alignment tolerance - This defines whether or not an architecture can address an object at other than it's natural alignment ie. at an address that is/is not divisible by a (1 or possibly more) multiple of the objects size. In our Cobol example above we are dealing with a 4 byte item (equivalent in C to "signed int"). Intel/AMD x86(_64) (and a couple of others) are alignment tolerant ( referred to below as (*1) ). The rest are not ( referred to below as (*2) ). In Cobol code, this has relevance when defining the level of an item. Example - [code] 01 MYREC. 03 FILLER PIC X. 03 MYCOUNTER USAGE BINARY-LONG. [/code] (Note, MYCOUNTER could have any (integer) binary usage) For (*1), there is no downside (however, see "endianness" below). For (*2), the item has to be moved out, operated upon and moved back. Endianness - Ignoring the old PDP machines which had a really peculiar endianness, we have big-endian and little-endian. Endianness defines how the architecture physically represents objects. For our purpose, we will look at machine integers (In C - short, int, long long). Definition - MSB - Most Significant Byte LSB - Least Significant BYte Big-endian stores objects in MSB to LSB order. Little-endian stores objects in LSB to MSB order. Little-endian examples ( referred to as (*3) ) - Intel/AMD x86(_64) and others (There are some architectures that are bi-endian and can be bootstrapped in either mode). Big-endian will be referred to as (*4). Example - [code] 01 MYFLD PIC S9(9) BINARY *> AKA COMP [/code] A quick aside here - The Cobol standard allows the implementor to define the representation of COMP/BINARY items; however, all current Cobols that I know about represent COMP/BINARY as big-endian. So - For (*3) we have to "byteswap" the item, operate upon it and "byteswap" back. For (*4) there is no downside. You may notice that, ONLY on big-endian architecture, COMP/BINARY is equivalent to COMP-5 (or the equivalent BINARY-SHORT, BINARY-LONG, BINARY-DOUBLE). Combining all this together, you can see why the example posted at the top is optimal. Note - If you have an item definition that has an OCCURS phrase and also an INDEXED BY phrase, then the INDEXED BY item is automatically generated as a native machine integer and is therefore optimal. Roger ---------------------------------------------------------------- Roger, Thanks for these posts, I like the Tidbits and Quiz series. Based on this tidbit, would my [url=http://www.opencobol.org/modules/newbb/viewtopic.php?viewmode=flat&topic_id=271&forum=1]99 Beers Post[/url] be better in this format? I had originally had them as Level 01 but moved to Level 05 to kind of group them, but not for any reason or benefit other than it seemed logical to me. Thanks ---------------------------------------------------------------- [Info 2] An inline PERFORM/END-PERFORM (ie. not a perform of a section/paragraph) is ALWAYS faster than an out-of-line PERFORM (ie. section/paragraph). Roger ---------------------------------------------------------------- [Info 3] If you are using a constant that does not change, then you can define it as (and this is optimal) (eg.) - [code] 78 MYCONST VALUE 1. [/code] or - [code] 78 MYCONST VALUE "myliteral". [/code] The level 78 is legacy/MF compatible. 78 levels are operated upon at compile time and directly replace the value. Consider - [code] 01 MYCONST .... VALUE 1. [/code] where ... is a numeric definition. At runtime, with this definition, we have to retrieve the contents of MYCONST. [code] 01 MYCONST PIC X(..). [/code] The Cobol standard for this is "CONSTANT" which I have not quite got round to implementing :-) Roger ---------------------------------------------------------------- This is quite useful with an integer if you put myconst after occurs. [code]... 01 filler. 05 something occurs myconst. 10 filler pic 9. ... if somevar <= myconst add 1 to something (somevar) end-if[/code] ---------------------------------------------------------------- Hi! I've never seen 78-levels before since I've only worked with IBM mainframes. Following the standards, couldn't you just use [code] REPLACE [/code] ? /Martin Ancher Holm ---------------------------------------------------------------- More to constants - In current OC 1.1 tarball is implemented a subset of the 2002 CONSTANT clause. This is equivalent of the the legacy 78 level. eg. [code] 01 MYCONST CONSTANT AS 1. 01 MYALPHA CONSTANT AS "myalpha". [/code] Note that 78 level and CONSTANT names must be defined before they are used (Also a restriction in MF). Roger ---------------------------------------------------------------- [Info 4] I have a Cobol module ie. a prog with a PROCEDURE DIVISION USING P1 P2 ... Can I detect if a parameter has been supplied? Yes, with the 2002 standard conditional eg. [code] IF P1 OMITTED [/code] or the reverse - [code] IF P1 NOT OMITTED [/code] Can I specify a CALL with an omitted parameter? Yes, by specifying "OMITTED" as a parameter on the CALL. eg. [code] CALL "MYSUB" USING P1 OMITTED P3. [/code] NOTE here, it is up to you to check validity of the second param in "MYSUB" as what actually happens is passing of a null pointer and any reference to this without checking will lead to a spectacular crash. Roger ---------------------------------------------------------------- [Info 5] I have a Cobol module (ie. with PROCEDURE DIVISION USING P1 ...) that needs to react to various lengths of P1. Is this possible? Yes. Discussion - Normally (and according to the standard), the definition of parameters used on a CALL statement in the calling program must agree with with the definition of the parameters in the LINKAGE/PROCEDURE DIVISION USING of the called program. ie. simplified - [code] 01 MYFLD PIC X(80). CALL "MYSUB" USING MYFLD. [/code] In MYSUB [code] LINKAGE SECTION. 01 MYFLD PIC X(80). PROCEDURE DIVISION USING MYFLD. .... Do something with MYFLD [/code] Now suppose you want to call MYSUB with some other field definition. If this definition is less than 80 bytes, then you will use/overwrite an undefined area possibly leading to a crash. If it is greater than 80 bytes then only the first 80 bytes will be recognized. HOWEVER, we have a nice Cobol standard syntax for this - In The module eg MYSUB - [code] LINKAGE SECTION. 01 MYFLD PIC X ANY LENGTH. PROCEDURE DIVISION USING MYFLD. .... Do something with MYFLD [/code] Roger ---------------------------------------------------------------- [Info 4] OMITTED is part of the 85 standard, isn't it? In 85 OMITTED can only be used in call if there is an OPTIONAL clause in the procedure devision of the called program. Is this true for 2002 or should all items of the procedure devision be checked? How should the optional params be checked in 85 standard? [Info 5] What standard is ANY LENGTH? ---------------------------------------------------------------- Subject: problems with BerkleyDB 4.7 configure script acknowledges 4.5 but not 4.6 and 4.7 [code] Use gettext for international messages: yes Use Berkeley DB for file I/O: no Use enhanced Berkeley DB (>= 4.1) no Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: yes [/code] When I changed configure and replaced 4.5 by 4.7, then an error with test #66: First READ on empty SEQUENTIAL INDEXED file FAILED (misc.at:992) [code] Use gettext for international messages: yes Use Berkeley DB for file I/O: no Use enhanced Berkeley DB (>= 4.1) yes Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: yes [/code] ---------------------------------------------------------------- On what system/OS ? How was BDB installed ? Per rpm/deb or hand-rolled? If hand-rolled, what were your configure options for BDB? Roger ---------------------------------------------------------------- OS: Suse9.3 BDB: new from source with default configuration OC script configure has no rules for BDB > 4.5 ---------------------------------------------------------------- And there is your problem - The BDB default configure does NOT install into the usual /usr/local or /usr. OC configure scripts does have rules for the include/library when db.h and libdb are available in the system default locations. Do a ./configure --prefix=/usr for BDB. And check if you possibly need other options ie. read the docs :-) Actually why do you want to do this? 9.3 has a perfectly good 4.x version. Roger ---------------------------------------------------------------- There is the output : [code] COB_LIBS -L${exec_prefix}/lib -lcob -lm -lgmp -lncurses -ldb-4.3 -ldl COB_CONFIG_DIR ${prefix}/share/open-cobol/config COB_COPY_DIR ${prefix}/share/open-cobol/copy COB_LIBRARY_PATH .:${exec_prefix}/lib/open-cobol COB_MODULE_EXT so COB_SHARED_OPT -shared COB_PIC_FLAGS -fPIC -DPIC COB_EXPORT_DYN -Wl,--export-dynamic COB_STRIP_CMD strip --strip-unneeded Dynamic loading System Use gettext for international messages: yes Use Berkeley DB for file I/O: yes Use enhanced Berkeley DB (>= 4.1) no Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: yes [/code] read configure ;-) there is no use for 4.6 or 4.7 I'll have to port it to other linux, later. Only the following after use --with-db=/usr/lib/Berkley4.7 [code] 66: First READ on empty SEQUENTIAL INDEXED file FAILED (misc.at:1062)[/code] changing configure script to 4.7 and USE_DB41=yes every directive is set to yes and all tests except #66 are ok. [code] CC gcc COB_CC gcc CFLAGS -O2 -march=i686 -mcpu=pentium4 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k COB_CFLAGS -I/usr/local/include COB_EXTRA_FLAGS -march=i686 -mcpu=pentium4 LDFLAGS COB_LDFLAGS COB_LIBS -L${exec_prefix}/lib -lcob -lm -lgmp -lncurses -ldl COB_CONFIG_DIR ${prefix}/share/open-cobol/config COB_COPY_DIR ${prefix}/share/open-cobol/copy COB_LIBRARY_PATH .:${exec_prefix}/lib/open-cobol COB_MODULE_EXT so COB_SHARED_OPT -shared COB_PIC_FLAGS -fPIC -DPIC COB_EXPORT_DYN -Wl,--export-dynamic COB_STRIP_CMD strip --strip-unneeded Dynamic loading System Use gettext for international messages: yes Use Berkeley DB for file I/O: yes Use enhanced Berkeley DB (>= 4.1) yes Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: yes [/code] ---------------------------------------------------------------- As I see in line COB_LIBS no use of db-4.7 is noted. Is this odd or BDB is not used? ---------------------------------------------------------------- No, no. You misunderstood. I meant reconfigure BDB with ./configure --prefix=/usr Roger ---------------------------------------------------------------- simrw, I've did it, already. as you can see, no BDB links are noted [code] COB_LIBS -L${exec_prefix}/lib -lcob -lm -lgmp -lncurses -ldl[/code] was the change of configure script successful? ---------------------------------------------------------------- I repeat, why are you doing this? Suse 9.3 has development/runtime RPM's for BDB 4.3. Install these and you will have no problem with OC. From a 9.3 system in /usr/lib - -rwxr-xr-x 1 root root 947048 Mar 19 2005 /usr/lib/libdb-4.3.so lrwxrwxrwx 1 root root 12 Aug 20 2005 /usr/lib/libdb-4.so -> libdb-4.3.so -rw-r--r-- 1 root root 1258626 Mar 19 2005 /usr/lib/libdb.a lrwxrwxrwx 1 root root 12 Aug 20 2005 /usr/lib/libdb.so -> libdb-4.3.so Roger ---------------------------------------------------------------- Roger, I ask if this is a problem or not. BDB is now in v4.7, OC supports this version? It seems it doesn't. If it does please tell me how. Thanks, Konnos ---------------------------------------------------------------- It is NOT an OC problem. If Oracle (previously Sleepycat) choose to install in non-standard directories with non-standard-names then that is NOT my problem. Standard distro rpm/deb installs will do the right thing. All this configure nonsense that is currently in OC for BDB will be ripped out shortly. There will only be a test for a libdb and db.h. Incidentally, OC works perfectly well with 4.7 :-) (If you know how to manipulate the BDB install) Roger ---------------------------------------------------------------- Roger, I've replaced 4.5 with 4.7 in your configuration file and it seems it's working. Thanks ---------------------------------------------------------------- Subject: 99 Bottles of Beer on the Wall [b] NOTE: I've updated this post several times as I changed the code. I've still not found a good search and replace function inside of COBOL yet, but the TRIM() function does help to eliminate beginning and ending blanks. See Roger's example below. Search and replace is important though because we won't just be doing so at the beginning and ending of a section. Most of the code is the same. However I did move my variables from 05 level to 01 binary usage based on [u][url=http://www.opencobol.org/modules/newbb/viewtopic.php?viewmode=flat&topic_id=269&forum=1]Roger's Tidbit about Binary-Long[/url][/u]. Note: Per Roger's comments Author is obsolete as of the 85 standard. At any newer standard it may be dropped entirely, though right now it is ignored. To maintain my name, I've kept Author. but as a comment. [/b] The site [u][url=http://99-bottles-of-beer.net/c.html]99 Bottles of Beer[/url][/u] lists some programs in COBOL to display the lyrics of the song. This is my attempt. I'm not fully satisfied with it though. So I ponder the question to anyone that would know, is there a way in COBOL to do easy string replaces? Such as: bottles with bottle, 0 bottles with no more bottles 9 with 9 (space 9 through 1 with just 9 through 1) Thanks kindly [code] IDENTIFICATION DIVISION. PROGRAM-ID. 99-Bottles-of-Beer-On-The-Wall. *AUTHOR. Joseph James Frantz. *COMMENTS. ****************************************************************** * PURPOSE: * This is a sample COBOL program to display the lyrics of the * song "99 Bottles of Beer on the Wall." * This version of the COBOL 99 beers program demonstrates a few * features of COBOL: * * 1. PERFORM VARYING, Cobol's version of a Loop. * 2. ADD/SUBTRACT with GIVING for math calculations. * 3. EVALUATE/WHEN, Cobol's version of Case. * 4. INSPECT/TALLYING, which finds the number of specified * characters in a variable. * 5. Reference Modification: * Var-name(Start character:Number of characters) * which is essentially Cobol's version of text subscripting. * 6. Long descriptive variable names. * 7. Use of SPACES and ZEROES for field/display values. * 8. Highlight the self documenting nature of COBOL. ****************************************************************** DATA DIVISION. WORKING-STORAGE SECTION. 01 Bottles USAGE BINARY-LONG. 01 Remaining-Bottles USAGE BINARY-LONG. 01 Disp-Bottles PIC 99 VALUE 0. 01 Disp-Remaining-Bottles PIC 99 VALUE 0. 01 Counting PIC 99 VALUE 0. 01 Start-Position PIC 99 VALUE 0. 01 Positions PIC 99 VALUE 0. PROCEDURE DIVISION. PASS-AROUND-THOSE-BEERS. PERFORM VARYING Bottles FROM 99 BY -1 UNTIL Bottles = -1 DISPLAY SPACES SUBTRACT 1 FROM Bottles GIVING Remaining-Bottles EVALUATE Bottles WHEN 0 DISPLAY "No more bottles of beer on the wall, " "no more bottles of beer." DISPLAY "Go to the store and buy some more, " "99 bottles of beer on the wall." WHEN 1 DISPLAY "1 bottle of beer on the wall, " "1 bottle of beer." DISPLAY "Take one down and pass it around, " "no more bottles of beer on the wall." WHEN 2 Thru 99 MOVE Bottles TO Disp-Bottles MOVE Remaining-Bottles TO Disp-Remaining-Bottles MOVE ZEROES TO Counting INSPECT Disp-Bottles, TALLYING Counting FOR LEADING ZEROES ADD 1 TO Counting GIVING Start-Position SUBTRACT Counting FROM 2 GIVING Positions DISPLAY Disp-Bottles(Start-Position:Positions) " bottles of beer on the wall, " Disp-Bottles(Start-Position:Positions) " bottles of beer." MOVE ZEROES TO Counting INSPECT Disp-Remaining-Bottles TALLYING Counting FOR LEADING ZEROES ADD 1 TO Counting GIVING Start-Position SUBTRACT Counting FROM 2 GIVING Positions DISPLAY "Take one down and pass it around, " Disp-Remaining-Bottles(Start-Position:Positions) " bottles of beer on the wall." END-EVALUATE END-PERFORM STOP RUN. [/code] ---------------------------------------------------------------- The string verb may help here. Curt ---------------------------------------------------------------- Curt, Thanks. I'd tried string but couldn't quite figure out what I needed to do. If I did: STRING bottles DELIMITED BY ZEROES "bottles of beer...." END-STRING Then I am going to get nothing from the bottles variable...basically I want to do string with some kind of reverse...... I even attempted UNSTRING..but I think I would end up with many statements...whereas I'm trying to get it down to as few as possible. But I think if I play with it some more, perhaps with STRING/UNSTRING I'll figure it out... Though all suggestions are still gratefully sought. ---------------------------------------------------------------- FUNCTION TRIM(var LEADING) provides a temp with all leading spaces removed. Or in-place with CALL "C$JUSTIFY" USING var "L". (May require a move to a pic x field - details I've gotta look into for the justify.cob sample.) For plurals, a paragraph that strings "s"? Or a routine that strings "no bottles" or "n bottles" or "1 bottle"? Nice looking version of 99-beers as is imho. :) Cheers, Brian ---------------------------------------------------------------- Brian, Thanks, testing now, will modify the code when done. ---------------------------------------------------------------- Brian and Curt Thanks for your tips. This is the second version. Actually I think the first is easier to follow, at least for me, and less work. Thanks for the compliment also Brian. Second Version: [code] IDENTIFICATION DIVISION. PROGRAM-ID. 99-Bottles-of-Beer-On-The-Wall. AUTHOR. Joseph James Frantz. *COMMENTS. ****************************************************************** * PURPOSE: * This is a sample COBOL program to display the lyrics of the * song "99 Bottles of Beer on the Wall." ****************************************************************** DATA DIVISION. WORKING-STORAGE SECTION. 01 Keeping-Track-Variables. 05 Count-Bottles PIC S99 VALUE 0. 05 Bottles PIC Z9 VALUE SPACES. 05 Remaining-Bottles PIC Z9 VALUE SPACES. 01 Lyric-Variables. 05 Lyric-Bottles PIC X(15) VALUE SPACES. 05 Lyric-Remaining-Bottles PIC X(15) VALUE SPACES. 05 Lyric-Pass-or-Buy PIC X(35) VALUE SPACES. 05 Lyric-Line PIC X(70) VALUE SPACES. PROCEDURE DIVISION. PASS-AROUND-THOSE-BEERS. PERFORM VARYING Count-Bottles FROM 99 BY -1 UNTIL Count-Bottles = -1 MOVE SPACES TO Lyric-Variables MOVE "Take one down and pass it around," TO Lyric-Pass-or-Buy EVALUATE Count-Bottles WHEN 0 MOVE "No more bottles" TO Lyric-Bottles MOVE "99 bottles" TO Lyric-Remaining-Bottles MOVE "Go TO the store and buy some more," TO Lyric-Pass-or-Buy WHEN 1 MOVE "1 bottle" TO Lyric-Bottles MOVE "no more bottles" TO Lyric-Remaining-Bottles WHEN 2 MOVE "2 bottles" TO Lyric-Bottles MOVE "1 bottle" TO Lyric-Remaining-Bottles WHEN 3 THRU 99 MOVE Count-Bottles TO Bottles SUBTRACT 1 FROM Count-Bottles GIVING Remaining-Bottles STRING FUNCTION TRIM(Bottles) " bottles" INTO Lyric-Bottles END-STRING STRING FUNCTION TRIM(Remaining-Bottles) " bottles" INTO Lyric-Remaining-Bottles END-STRING END-EVALUATE DISPLAY SPACES DISPLAY FUNCTION TRIM(Lyric-Bottles), " of beer on the wall, ", FUNCTION TRIM(Lyric-Bottles), " of beer." DISPLAY FUNCTION TRIM(Lyric-Pass-or-Buy) " " FUNCTION TRIM(Lyric-Remaining-Bottles) " of beer on the wall" END-PERFORM STOP RUN. [/code] ---------------------------------------------------------------- Here's another variant without using STRING - [code] IDENTIFICATION DIVISION. PROGRAM-ID. bottles. DATA DIVISION. WORKING-STORAGE SECTION. 01 BOTTLES USAGE BINARY-LONG. 01 NEXTBOTTLES USAGE BINARY-LONG. 01 PLURAL PIC X(7). 01 NEXTPLURAL PIC X(7). 01 DISPBOTTLE. 03 NUMBOTTLE PIC Z(6)9. 01 NEXTDISPBOTTLE. 03 NEXTNUMBOTTLE PIC Z(6)9. 01 DISPLINE1 PIC X(80). PROCEDURE DIVISION. PASS-AROUND-THOSE-BEERS. MOVE "Take one down and pass it around," TO DISPLINE1 PERFORM VARYING BOTTLES FROM 99 BY -1 UNTIL BOTTLES < 0 DISPLAY SPACES SUBTRACT 1 FROM BOTTLES GIVING NEXTBOTTLES EVALUATE BOTTLES WHEN 0 MOVE "bottles" TO PLURAL NEXTPLURAL MOVE 99 TO NEXTNUMBOTTLE MOVE "no more" TO DISPBOTTLE MOVE "Go to the store and buy some more," TO DISPLINE1 WHEN 1 MOVE "bottle" TO PLURAL MOVE "bottles" TO NEXTPLURAL MOVE 1 TO NUMBOTTLE MOVE "no more" TO NEXTDISPBOTTLE WHEN 2 MOVE "bottles" TO PLURAL MOVE "bottle" TO NEXTPLURAL MOVE BOTTLES TO NUMBOTTLE MOVE NEXTBOTTLES TO NEXTNUMBOTTLE WHEN OTHER MOVE "bottles" TO PLURAL NEXTPLURAL MOVE BOTTLES TO NUMBOTTLE MOVE NEXTBOTTLES TO NEXTNUMBOTTLE END-EVALUATE DISPLAY FUNCTION TRIM (DISPBOTTLE) SPACE FUNCTION TRIM (PLURAL) SPACE "of beer on the wall, " FUNCTION TRIM (DISPBOTTLE) SPACE FUNCTION TRIM (PLURAL) SPACE "of beer." DISPLAY FUNCTION TRIM (DISPLINE1) SPACE FUNCTION TRIM (NEXTDISPBOTTLE) SPACE FUNCTION TRIM (NEXTPLURAL) SPACE "of beer on the wall." END-PERFORM. STOP RUN. [/code] Roger ---------------------------------------------------------------- Roger, Thanks! I like your version a lot...It lends itself to more centralization of what is displayed for the rest of the lyrics. I'm off to really analyze it. I've updated my original one at the top, which I liked better than the second. And I submitted it to the 99 beers site. If you want to post yours that would be cool, it helps drum up interest in OC. ---------------------------------------------------------------- Roger, They accepted my first version at their site. I've not sent my second yet. I think your version is much better. It would be really cool if you posted it and then linked back to opencobol.org. Here is the link to mine: [url=http://www.99-bottles-of-beer.net/language-cobol-1820.html]http://www.99-bottles-of-beer.net/language-cobol-1820.html[/url] ---------------------------------------------------------------- Well done Joseph. Congrats. Cheers, Brian ---------------------------------------------------------------- Subject: Database Dump of Forums for Documentation Team? Roger, Is there any possibility we could get a database dump of the Forum topics? It would allow me to load them on my system and run through them a lot faster than over the web. It would also enable me to start to organize similar topics together. Much appreciated and Kind Regards, Joseph James Frantz ---------------------------------------------------------------- Subject: I have CodeBase sources. Can I use it with OC? Sure, we already have the hooks for external file handlers in place (OC 1.1). Take a look at libcob/fileio.c and search for "extfh". The OC configure is already set up for external stuff (--with-seqra-extfh for non-ISAM files, --with-index-extfh for ISAM files) Roger ---------------------------------------------------------------- I have CodeBase sources, which I've already incorporated to MFCOBOL File Handler. Can I incorporate them with OC as another FileHandler? Has anyone done it, or willing to help me? Then, it would be easy for me to migrate from MFCOBOL. ---------------------------------------------------------------- Subject: MySQL [quote] And yes, bindings to MySQL should be quite possible. But let Roger do all the hard work and go with BDB. :) [/quote] True that. But all of our stuff is in MySQL right now. So whenever we have that option, it's just going to make us even happier... ---------------------------------------------------------------- Subject: Standards Documentation Does anyone know the rules regarding the standards documentation? It seems to me for instance if you look at the standards docs for the MOVE statement, and IBM's they are so nearly the same as to be the same. There are only so many ways you can say certain things after all. ---------------------------------------------------------------- Subject: Quiz related bug report. After testing the IF NOT TRUE Q1 response [code] identification division. program-id. ifnot. procedure division. if not true display "impossible" end-if. goback. [/code] That source kakks the current 1.1 cobc with a seg fault. :( (Anything but -E; -c, -S, -m, -x etc all fault). cobc (OpenCOBOL) 1.1.0 Build date Jul 2 2008 18:46:36 And that reminds me, the Build date; could you change that to your archive datetime instead (or along with)?. Not a real biggy. Cheers, Brian ---------------------------------------------------------------- Fixed in current OC 1.1 tarball. The build date was requested as seen. Roger ---------------------------------------------------------------- Builds ok, a signedness warning in [code] typeck.c: In function ‘cb_validate_program_environment’: typeck.c:1184: warning: pointer targets in passing argument 1 of ‘cb_build_alphanumeric_literal’ differ in signedness typeck.c:1189: warning: pointer targets in passing argument 1 of ‘cb_build_alphanumeric_literal’ differ in signedness [/code] make checks ok. catches that IF NOT TRUE syntax error. Thank you once again Roger Cheers, Brian ---------------------------------------------------------------- If you would have an archive datetime I would really like to have it in cobc info. Either replacing the build date or adding the info. Should I put it on the wishlist? ---------------------------------------------------------------- Subject: Acucobol compatible? Dear Friends I've trying to compile with OpenCobol an application working in Acucobol The first lines of this code are: IDENTIFICATION DIVISION. PROGRAM-ID. OPEMBL19. AUTHOR. CHRISTIAN. SECURITY. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA CONSOLE IS CRT CRT STATUS IS ESTADO. INPUT-OUTPUT SECTION. But, when I try to compile, I get this: cobc -std=mf opl19.cob opl19.cob:9: Error: 'ESTADO' CRT STATUS is not 4 characters long Why this doesn't work??? Best Regards!!! :-D ---------------------------------------------------------------- Hi Christian, I can't really speak as to why it doesn't work with other sizes, but to get it working make sure estado is a pic 9(4) or binary-long or equivalent. I'd seems to have to do with OpenCOBOL wanting a CRT STATUS of 4 numerics. Seems reasonable to me. Other implementations documented as only accepting a 3 character group data field for crt-status-code, so check for that. And of course looking through for usages of estado; just in case. Cheers, Brian Beware; inexperienced OC user talking. Other may have much better details. ---------------------------------------------------------------- The problem is that ESTADO has never been used before CRT STATUS IS ESTADO in Acucobol it works rare? ---------------------------------------------------------------- Works fine here. [code] IDENTIFICATION DIVISION. PROGRAM-ID. TESTCRT. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA CONSOLE IS CRT CRT STATUS IS ESTADO. DATA DIVISION. WORKING-STORAGE SECTION. 01 ESTADO PIC 9(4). PROCEDURE DIVISION. GOBACK. [/code] Roger ---------------------------------------------------------------- Right!! it's true!! The code was written like this: 01 ESTADO PIC 9(2). Changed by 01 ESTADO PIC 9(4). It's works... Thanks!!!!!!!!!!!!!! :-D ---------------------------------------------------------------- Subject: Other "trouble" Dear friends... (again) When I try to compile a COBOL program, I get this error: cobc -x opl19.cob opl19.cob: In paragraph 'ACEPTA-CODIGO': opl19.cob:232: Error: syntax error, unexpected "Identifier" The code is like this: 228: ACEPTA-CODIGO. 229: MOVE SPACES TO CODIGO-WS 230: 231: ACCEPT CODIGO-WS LINE 13 COL 41 WITH 232: UPDATE AUTO-SKIP HIGHLIGHT REVERSE-VIDEO 233: END-ACCEPT The application in the native Acucobol, displays a screen, maybe opencobol is not compatible? Thanks! :-) ---------------------------------------------------------------- No idea what AUTO-SKIP is supposed to be. Take it out. Roger ---------------------------------------------------------------- Or change AUTO-SKIP to [b]AUTO[/b]? I think that will have the desired effect in OC. Cheers, Brian ---------------------------------------------------------------- ACU has a plethora of synonyms for standard reserved words. For "AUTO", ACU has synonyms "AUTO-SKIP", "AUTOTERMINATE". Another one is ACU's "BEEP" for "BELL". I may or may not put one or more of these into OC's reserved word list. The danger here is that these words may duplicate user-defined items in existing programs. What we could do is define a new dialect - -std=acu. This could eg. be equivalent to -std=mf and activate ACU's synonyms. Roger ---------------------------------------------------------------- Sounds marvellous. ---------------------------------------------------------------- Yes ! This will help OC to understand multiple dialects. I am very optimistic of that ... Kind regards Bear ---------------------------------------------------------------- Subject: COBOL question: use of "through" in if/when/until... I can code[code]... 77 mytext pic x(12). 77 testtext pic x(02). 88 text-is-01to12 value '01' through '12'. ... move mytext (1:2) to testtext. if text-is-01to12 ... move mytext (4:2) to testtext. if text-is-01to12 ...[/code] But I rather would like to code something like this:[code] if mytext (4:2) = '01' through '12' ...[/code] Is there any possibility in COBOL to do stuff like that? PS: I do not want to redefine parts of mytext as 9(02) for asking [code] if mytext-part4to2 >= 1 and mytext-part4to2 <= 12 ...[/code] ---------------------------------------------------------------- I think a code structure like [code] EVALUATE MYTEXT(4:2) WHEN '01' thru '12' DO-SOMETHING END-EVALUATE [/code] might be what you are looking for. EVALUATE and it's ALSO clause can make for some pretty complex yet still readable decision tables. human; I'm still relearning and haven't got my head around all the use cases for the WHEN clauses, but I tried [code] 01 mytext pic x(6) value '123456'. evaluate mytext(4:2) when '40' through '50' display "yep" when other display "nope" end-evaluate. evaluate mytext(4:2) when '46' thru '50' display "yep" when other display "nope" end-evaluate. evaluate mytext(4:2) when 45 display "yep" when other display "nope" end-evaluate. [/code] It seemed to work; with a yep, nope, yep. More analysis will be required before I'd be [i]sure fer sure[/i] about the details. Cheers, Brian ---------------------------------------------------------------- Thanks for your reply! Actually this code should be part of a BIGBIGBIG evaluate and I cannot put all the different parts of mytext in the evaluate clause. The compare of some parts of mytext are linked to other vars like[code]when ((mytext(4:2) ='01' or ... or '12') and (varA = 12 and varB = 99 and ... ) ) do stuff[/code]. ---------------------------------------------------------------- From what I've read about EVALUATE ALSO, I'll bet you could :) It might have to include some placeholder truth code but EVALUATE seemed pretty powerful when I read about it yesterday. Not sure if there could be cascade case explosion with OR / AND logic, but I don't think so. [code] EVALUATE mytext(4:2) also varA also VarB also .. WHEN 01 thru 12 also 12 also 99 also .. do-something WHEN 13 also any also not 4 also .. do-case2 WHEN OTHER do-the-other END-EVALUATE. [/code] And for complex subexpression you could [code] EVALUATE TRUE ALSO ... WHEN (varA = 12) and (varB = 99) ALSO ... ... [/code] I think. Again, not totally up on the capabilities. Cheers, Brian ---------------------------------------------------------------- This looks like a analysis/design problem, not a Cobol problem. Post exactly what you are trying to do. Some possibilities/hints - Look at the ALSO phrase within EVALUATE. Make your reference-modification variable. ie. mytext (mystart : mylength) and then EVALUATE on that. Use multiple 88 levels. Combining all the above should get you somewhere. Note, this is only based on what you posted. It might be more interesting to know where and how the contents of mytext are set. Roger ---------------------------------------------------------------- Thank you for your replies and thoughts. This is a small capture of the whole thing:[code] evaluate myvar when '1stThing' perform first-thing when '2ndThingA' when '2ndThingB' perform second-thing when 'Wow1' move 1 to wow perform wow-thing when 'Wow2'' move 2 to wow perform wow-thing * ... this goes on like this for about 600! different cases when other evaluate true when ((myvar (01:05) = 'ABCDE' or 'DEFGH' or 'IJKLS' ) and (myvar (06:02) numeric ) and (myvar (06:02) not = spaces ) and (myvar (08: ) = spaces ) ) * when ((myvar (01:06) = 'JKLMNO' or 'PQRSTU' or 'AAVVVD' or 'GGAAEG' ) and (myvar (07:02) numeric ) and (myvar (07:02) not = spaces ) and (myvar (09: ) = spaces ) ) * when ((myvar (01:07) = 'aLLVVAA' or 'ggwwffg' ) and (myvar (08:02) numeric ) and (myvar (08:02) not = spaces ) and (myvar (10: ) = spaces ) ) perform somtehing-special-a * when ((myvar (01:04) = 'jkpa' ) and (myvar (05:02) numeric ) and (myvar (05:02) not = spaces ) and (myvar (07:01) = 'G' ) and (myvar (08: ) = spaces ) ) * when ((myvar (01:04) = 'ffaa' ) and (myvar (05:02) numeric ) and (myvar (05:02) not = spaces ) and (myvar (07:01) = '1' or '2' or '3') and (myvar (08: ) = 'B' or 'BC' ) ) perform somtehing-special-b * ... this goes on like this for about 30 different special cases end-evaluate end-evaluate[/code] The things like that[code]... (myvar (05:02) numeric ) and (myvar (05:02) not = spaces ) and ...[/code] should be replaced for '01' or '02' or '03' or ... or '10' and for '12' or '13' or ... or '45' So putting different 88er vars (value '01' thru '12'...) for the different parts of myvar is indeed possible, but I'm not sure if this is kind of code would be easy readable and fast working code. I've event thought about putting the about 600 different "easy" cases as seen above to 88 vars and do evaluate true from the beginning. Would this be easier to read / would it work faster at all? I'm quite unsure what to do about the 30 special cases... ---------------------------------------------------------------- Nice :-) But you still have not posted the actual case :-) This is most definitely an analysis/design problem. Start with a flow-chart. Then try to do a normal reduction on that. I repeat, this is not a Cobol problem. You would have the same decisions in any language. And no, we are not going to do your (maybe paid for) coding for you :-) Of course, for any project, I am available for hire :-) Roger ---------------------------------------------------------------- If you have six hundred cases, is there any kind of commonality that you can reduce down? eg. If I were trying to convert 1 to one, 2 to two etc..I could reduce that down. So as Roger said, if we understood the actual problem first, then perhaps a particular solution could be coded. What does myvar represent? ---------------------------------------------------------------- Myvar is just a text string of 12 chars. That evaluate is the main section of the program and just do performs of other sections(sometime an index is set before the perform) depending on the content of myvar and it's that big evaluate that seems a little bit ... weird. Here are the detailed questions: 1. Concerning the "special cases" (2nd part of posted code): Is there any possibility for asking (if a = '01' through '12') without multiple 88 levels? It seems like: no. 2. Concerning the "different cases" (1st part of posted code): Is it faster/slower to have multiple 88er levels and do an evaluate true / when case1 / when case2 / ... than to do an evaluate myvar / when "string1" / when "string2"? PS: I'm not paid for thinking of how to rearrange such cobol structures, but I would like to have a better solution than the actual code (that you've indeed seen, only the names are a bit different and some other when / performs are did in the same way I have posted.) Maybe there are some other ideas but I think question 1 is solved. What about question 2? ---------------------------------------------------------------- Sorry, but you have still not answered the question where and how the data is being interpreted. This is really totally off-topic for the OC forum. This is a classic case of analysis. Roger ---------------------------------------------------------------- 1. The answer is yes: EVALUATE myvar WHEN 1 Through 12 But as Roger said you still have to explain the actual problem you are trying to solve. Rather you're trying to explain one method you are using to solve the problem. ---------------------------------------------------------------- @aoirthoir: As I said there are different parts of myvar that need to be checked together. All in all I want to have nicer variants than evaluate all different versions, so I did[code] evaluate true when ((myvar (01:05) = 'ABCDE' or 'DEFGH' or 'IJKLS' ) and (myvar (06:02) numeric ) and (myvar (06:02) not = spaces ) and (myvar (08: ) = spaces ) ) ... * when ((myvar (01:04) = 'ffaa' ) and (myvar (05:02) numeric ) and (myvar (05:02) not = spaces ) and (myvar (07:01) = '1' or '2' or '3') and (myvar (08: ) = 'B' or 'BC' ) ) ... end-evaluate[/code]instead of[code] evaluate myvar when 'ABCDE01' when 'ABCDE02' when 'ABCDE03' when 'ABCDE04' when 'ABCDE05' when 'ABCDE06' when 'ABCDE07' when 'ABCDE08' when 'ABCDE09' when 'ABCDE10' when 'ABCDE11' when 'ABCDE12' when 'DEFGH01' when 'DEFGH02' when 'DEFGH03' when 'DEFGH04' when 'DEFGH05' when 'DEFGH06' when 'DEFGH07' when 'DEFGH08' when 'DEFGH09' when 'DEFGH10' when 'DEFGH11' when 'DEFGH12' ... * when 'ffaa141B' when 'ffaa142B' when 'ffaa143B' when 'ffaa141BC' when 'ffaa142BC' when 'ffaa143BC' when 'ffaa151B' when 'ffaa152B' when 'ffaa153B' when 'ffaa151BC' when 'ffaa152BC' when 'ffaa153BC' when 'ffaa161B' when 'ffaa162B' when 'ffaa163B' when 'ffaa161BC' when 'ffaa162BC' when 'ffaa163BC' ... end-evaluate[/code] What I can think of now is to maybe replace the second evaluate (evaluate true) against [code]evaluate true also myvar (5:2) also myvar (6:2) also myvar (7:1) also ...[/code]but I think this will be neither more readable nor faster. I'd just searched for a nice way to evaluate different substrings of one string in multiple combinations but it seem like the only fine variant is the beginning code. The only thing that can maybe be solved is question two [quote]human wrote: 2. Concerning the "different cases" (1st part of posted code): Is it faster/slower to have multiple 88er levels and do an evaluate true / when case1 / when case2 / ... than to do an evaluate myvar / when "string1" / when "string2"?[/quote] ---------------------------------------------------------------- Subject: download open-cobol-1.0.tar.gz using OpenCOBOL Hello everyone. This code is really rough, but I think it's kinda neat. To follow the tectonics, you'll need to save the COBOL as curlcob.cob, the C as wrapper.c and have access to a development install of libcurl with headers and libraries in default locations. I took the tar url from SourceForge direct link. Your sourceforge mirror tests may provide different urls. [b]Don't run this in a directory that has a wanip.html or open-cobol-1.0.tar.gz that you want to keep.[/b] [code] *> ************************************************************** *> * access to libcurl *> ************************************************************** *> Author: Brian Tiffin *> Date: 17-July-2008 *> Purpose: Sample calls to curlcob curl wrapper *> Wasn't designed to be called a binding *> Tectonics: gcc -c wrapper.c *> cobc -b -lcurl curlcob.cob wrapper.o *> cobcrun curlcob identification division. program-id. curlcob. environment division. input-output section. file-control. select htmlfile assign to filename organization is record sequential. data division. file section. fd htmlfile. 01 htmldata. 02 buffer pic x(32767). local-storage section. 01 result pic s9(9) comp-5. 01 args pic x(1024). 01 url. 02 urlstr pic x(20) value 'http://www.wanip.org'. 02 filler pic x value X"00". 01 filestru. 02 filename pic x(10) value 'wanip.html'. 02 filler pic x value X"00". 01 oc10. 02 oc10url pic x(84) value "http://voxel.dl.sourceforge.net/sourceforge/open-cobol/op -"en-cobol-1.0.tar.gz". 02 filler pic x value X"00". 01 ocfilestru. 02 ocfile pic x(21) value 'open-cobol-1.0.tar.gz'. 02 filler pic x value X"00". 01 filestat. 02 filesize pic 9(18) usage binary. 02 filler pic x(8). 01 showsize pic z(17)9. 01 starting pic s9(9) comp-5. 01 range pic s9(9) comp-5. 01 iplen pic s9(9) comp-5. 01 starttime pic s9(9) comp-5. 01 endtime pic s9(9) comp-5. procedure division. accept starttime from time. *> Call libcurl through wrapper.c function *> read a url and write to file call "geturl" using by reference url by reference filename returning result. if not result = 0 display "wrapper: ", result end-if. accept endtime from time. subtract starttime from endtime giving starttime end-subtract. *> COBOL sees this is a file of 32K records. call "C$FILEINFO" using by reference filestru by reference filestat returning result. move filesize to showsize. display "from: " urlstr " " "saved: " filename, ", " function trim (showsize leading) " bytes," " in " starttime end-display. open input htmlfile. read htmlfile. inspect buffer tallying starting for characters before initial ">". compute range = length of buffer - starting. inspect buffer(starting + 2:range) tallying iplen for characters before initial "<". display "wanip.org reports global ip address of " buffer(starting + 2:iplen) end-display. close htmlfile. *> Download the open-cobol-1.0 tape archive display "Fetching ... " oc10url. accept starttime from time. call "geturl" using by reference oc10 by reference ocfile returning result. if not result = 0 display "wrapper: ", result end-if. accept endtime from time. subtract starttime from endtime giving starttime end-subtract. call "C$FILEINFO" using by reference ocfilestru by reference filestat returning result. move filesize to showsize. display "saved: " ocfile, ", " function trim (showsize leading) " bytes," " in " starttime end-display. goback. [/code] and the C wrapper [code] /* wrap some common curl * for use with OpenCOBOL */ #include #include struct UrlStruc { const char *filename; FILE *stream; }; static size_t wrap_fwrite(void *buffer, size_t size, size_t nmemb, void *stream) { struct UrlStruc *out=(struct UrlStruc *)stream; if(out && !out->stream) { /* open file for writing */ out->stream=fopen(out->filename, "wb"); if(!out->stream) return -1; /* failure, can't open file to write */ } return fwrite(buffer, size, nmemb, out->stream); } int geturl(char *theurl, char *thefile) { CURL *curl; CURLcode res; struct UrlStruc urlstruc={ "cobcurldefault.html", /* default filename */ NULL /* stream */ }; /* for this test, just point to the COBOL field */ urlstruc.filename = thefile; curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, theurl); /* Define our callback to get called when there's data to be written */ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, wrap_fwrite); /* Set a pointer to our struct to pass to the callback */ curl_easy_setopt(curl, CURLOPT_WRITEDATA, &urlstruc); /* Switch on full protocol/debug output curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); */ res = curl_easy_perform(curl); /* always cleanup */ curl_easy_cleanup(curl); } if(urlstruc.stream) fclose(urlstruc.stream); /* close the local file */ return (int)res; } [/code] Output should match something like [code] $ cobcrun curlcob from: http://www.wanip.org saved: wanip.html, 37 bytes, in +000000067 wanip.org reports global ip address of xxx.xxx.xxx.xxx Fetching ... http://voxel.dl.sourceforge.net/sourceforge/open-cobol/open-cobol-1.0.tar.gz saved: open-cobol-1.0.tar.gz, 934641 bytes, in +000001683 [/code] Cheers ---------------------------------------------------------------- Nice stuff. You do need opencobol 1.1 prerelease to compile and run this stuff, so I think you want to download the new oc-prerelease from http://www.sim-basis.de/open-cobol-1.1.tar.gz Maybe you can first determine the file date and download (and delte the old version) of oc only if the file is newer than the local version. ---------------------------------------------------------------- Changed for open-cobol-1.1.tar.gz. Thanks human. This will be handier and actually usable for trying to keep up with Roger. Cheers, Brian [code] *> ************************************************************** *> * access to libcurl *> ************************************************************** *> Author: Brian Tiffin *> Date: 17-July-2008 *> Purpose: Sample calls to curlcob curl wrapper *> Wasn't designed to be called a binding *> Tectonics: gcc -c wrapper.c *> cobc -b -lcurl curlcob.cob wrapper.o *> cobcrun curlcob identification division. program-id. curlcob. environment division. input-output section. file-control. select htmlfile assign to filename organization is record sequential. data division. file section. fd htmlfile. 01 htmldata. 02 buffer pic x(32767). local-storage section. 01 result pic s9(9) comp-5. 01 args pic x(1024). 01 url. 02 urlstr pic x(20) value 'http://www.wanip.org'. 02 filler pic x value X"00". 01 filestru. 02 filename pic x(10) value 'wanip.html'. 02 filler pic x value X"00". 01 oc11. 02 oc11url pic x(45) value "http://www.sim-basis.de/open-cobol-1.1.tar.gz". 02 filler pic x value X"00". 01 ocfilestru. 02 ocfile pic x(21) value 'open-cobol-1.1.tar.gz'. 02 filler pic x value X"00". 01 filestat. 02 filesize pic 9(18) usage binary. 02 filler pic x(8). 01 showsize pic z(17)9. 01 starting pic s9(9) comp-5. 01 range pic s9(9) comp-5. 01 iplen pic s9(9) comp-5. 01 starttime pic s9(9) comp-5. 01 endtime pic s9(9) comp-5. procedure division. accept starttime from time. *> Call libcurl through wrapper.c function *> read a url and write to file call "geturl" using by reference url by reference filename returning result. if not result = 0 display "wrapper: ", result end-if. accept endtime from time. subtract starttime from endtime giving starttime end-subtract. *> COBOL sees this is a file of 32K records. call "C$FILEINFO" using by reference filestru by reference filestat returning result. move filesize to showsize. display "from: " urlstr " " "saved: " filename, ", " function trim (showsize leading) " bytes." " in " starttime end-display. open input htmlfile. read htmlfile. inspect buffer tallying starting for characters before initial ">". compute range = length of buffer - starting. inspect buffer(starting + 2:range) tallying iplen for characters before initial "<". display "wanip.org reports global ip address of " buffer(starting + 2:iplen) end-display. close htmlfile. *> Download the open-cobol-1.1 tape archive display "Fetching ... " oc11url. accept starttime from time. call "geturl" using by reference oc11 by reference ocfile returning result. if not result = 0 display "wrapper: ", result end-if. accept endtime from time. subtract starttime from endtime giving starttime end-subtract. call "C$FILEINFO" using by reference ocfilestru by reference filestat returning result. move filesize to showsize. display "saved: " ocfile, ", " function trim (showsize leading) " bytes." " in " starttime end-display. goback. [/code] ---------------------------------------------------------------- Brian be careful using constructs like - [code] if not result = 0 [/code] This is once again a case of precedence and standards. In this simple case it does not matter, however, please code explicit item not-equal tests as - [code] if result not = 0 [/code] Roger ---------------------------------------------------------------- As an example consider - [code] IF NOT item1 = "lit" AND item2 = "lit" [/code] versus [code] IF item1 NOT = "lit" AND item2 = "lit" [/code] Roger ---------------------------------------------------------------- @btiffin: can you check the file timestamps in some way and maybe only download the tar if not newer than the local version? Maybe Roger can upload and update some timestamp.file which you can check first. We neither want to put nonsense traffic to the oc-prerelease (and slow the download down) nor to put to much traffic and installs on our own. ---------------------------------------------------------------- One way to do this on Posix systems is to set up a daily cron job script that does a "wget" of the tarball and then checks the size of the retrieved file against the last known size. If different notify/send mail, whatever. It is EXTREMELY unlikely (but theoretically possible) that the sizes are identical. Roger ---------------------------------------------------------------- But by putting a daily wget the tar would be daily downloaded, wouldn't it? I want to find a way around this (therefore reading the timestamp.file). Maybe we could get libcurl to just get the server timestamp of the tar-file directly (I do not know this)? ---------------------------------------------------------------- "wget -N" man wget Roger ---------------------------------------------------------------- @Roger; Thanks again. I'll have to be careful. My coder brain hasn't had to deal with operator precedence very often. So yeah, (not thing) = 0 isn't the same as not (thing = 0). I'll read up and start paying more heed. :) @human; I was just looking at CURL_GETINFO and CURLINFO_FILETIME. I'll experiment to see if the data is real and usable or faked for what we would need. My first guess is that it'll be real. Cheers, Brian ---------------------------------------------------------------- New version. Still hacking. This one uses libcurl's FILETIME (the seconds since 1970 bobloblaw) and TIMECONDITION IFMODSINCE feature. As I scan I'll ask for info on how to change the C$FILEINFO 4byte date 4byte time to a "seconds since" long? I just hardcoded a modtime that was returned by a run of this new updateOpenCOBOL routine. @Roger; binary-c-long displays as 9 digits. Needs 10. :) [code] $ cobcrun curlcob url: http://www.sim-basis.de/open-cobol-1.1.tar.gz size: 963865 date: 020080719 time: 000345500 0x09ffb2b0 +216382376 return modtime 1216382377 +216382377 [/code] That is from a run with MOVE 1216382376 TO MODTIME And this is from a run with MOVE 1216382377 TO MODTIME. No transfer occurred as the tar was not IFMODSINCE. So yes, we can test the local tar, and only pester sim-basis.de when necessary. [i]Note this code doesn't do that yet. Need to convert the date times.[/i] [code] $ cobcrun curlcob url: http://www.sim-basis.de/open-cobol-1.1.tar.gz size: 963865 date: 020080719 time: 000345500 0x0816b2b0 +216382377 return modtime -1 -000000001 [/code] New wrapper.c with a updateOpenCOBOL routine [code] /* wrap some common curl * for use with OpenCOBOL */ #include #include struct LocalFileStruc { const char *filename; FILE *stream; }; static size_t wrap_fwrite(void *buffer, size_t size, size_t nmemb, void *stream) { struct LocalFileStruc *out=(struct LocalFileStruc *)stream; if(out && !out->stream) { /* open file for writing */ out->stream=fopen(out->filename, "wb"); if(!out->stream) return -1; /* failure, can't open file to write */ } return fwrite(buffer, size, nmemb, out->stream); } /* Handle fetch and release */ CURL* getcurl() { return curl_easy_init(); } void releasecurl(CURL *curl) { curl_easy_cleanup(curl); } /* Ease of use; read url, write to file */ long updateOpenCOBOL(CURL *curl, char *url, char *file, long modtime) { CURLcode res; long urlstamp; struct LocalFileStruc localfile={ "opencobol-1.1default.tar.gz", /* default filename */ NULL /* stream */ }; /* for this test, just point to the COBOL field */ localfile.filename = file; if (!curl) { curl = curl_easy_init(); } if (curl) { curl_easy_setopt(curl, CURLOPT_URL, url); /* Only fetch new */ curl_easy_setopt(curl, CURLOPT_FILETIME, 1L); curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE); curl_easy_setopt(curl, CURLOPT_TIMEVALUE, modtime); /* Define our callback to get called when there's data to be written */ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, wrap_fwrite); /* Set a pointer to our struct to pass to the callback */ curl_easy_setopt(curl, CURLOPT_WRITEDATA, &localfile); res = curl_easy_perform(curl); if (res != 0) { printf("%s %d\n", "failed perform", (int)res); return -1L; /* (long)res; */ } res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &urlstamp); if (res != 0) { printf("%si %d\n", "failed getinfo", (int)res); return -1L; } else { printf("%s %ld\n", "return modtime", urlstamp); return urlstamp; } } else { printf("%s\n", "failed curl"); return -1L; } } /* Fetch a url to a local file */ int geturl(CURL *curl, char *theurl, char *thefile) { CURLcode res; long urlstamp; struct LocalFileStruc localfile={ "curlcob.default", /* default filename */ NULL /* stream */ }; /* for this test, just point to the COBOL field */ localfile.filename = thefile; /* curl = curl_easy_init(); */ if(curl) { curl_easy_setopt(curl, CURLOPT_URL, theurl); curl_easy_setopt(curl, CURLOPT_FILETIME, 1L); /* Define our callback to get called when there's data to be written */ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, wrap_fwrite); /* Set a pointer to our struct to pass to the callback */ curl_easy_setopt(curl, CURLOPT_WRITEDATA, &localfile); /* Switch on full protocol/debug output curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); */ res = curl_easy_perform(curl); res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &urlstamp); printf("%s %ld\n", "Filetime: ", urlstamp); /* always cleanup */ /* curl_easy_cleanup(curl); */ } if(localfile.stream) fclose(localfile.stream); /* close the local file */ return (int)res; } /* The plan is to return a structure with all curl INFO fields filled */ int getinfo(CURL *curl, char *theurl, char *thedata) { CURLcode res; long urlstamp; if (curl) { curl_easy_setopt(curl, CURLOPT_URL, theurl); res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &urlstamp); printf("%s %ld\n", "Filetime: ", urlstamp); } else { return -1; } return (int)res; } [/code] New test head [code] *> ************************************************************** *> * access to libcurl *> ************************************************************** *> Author: Brian Tiffin *> Date: 17-July-2008 *> Purpose: Sample calls to curlcob curl wrapper *> Wasn't designed to be called a binding *> Tectonics: gcc -c wrapper.c *> cobc -b -lcurl curlcob.cob wrapper.o *> cobcrun curlcob identification division. program-id. curlcob. environment division. input-output section. file-control. select htmlfile assign to filename organization is record sequential. data division. file section. fd htmlfile. 01 htmldata. 02 buffer pic x(32767). local-storage section. 01 curl usage pointer. 01 result pic s9(9) comp-5. 01 args pic x(1024). 01 url. 02 urlstr pic x(20) value 'http://www.wanip.org'. 02 filler pic x value X"00". 01 filestru. 02 filename pic x(10) value 'wanip.html'. 02 filler pic x value X"00". 01 oc11. 02 oc11url pic x(45) value "http://www.sim-basis.de/open-cobol-1.1.tar.gz". * 02 oc11url pic x(23) value * "http://www.sim-basis.de". 02 filler pic x value X"00". 01 ocfilestru. 02 ocfile pic x(21) value 'open-cobol-1.1.tar.gz'. 02 filler pic x value X"00". 01 filestat. 02 filesize pic 9(18) usage binary. 02 filedate pic 9(9) usage binary. 02 filetime pic 9(9) usage binary. 01 showsize pic z(17)9. 01 starting pic s9(9) comp-5. 01 range pic s9(9) comp-5. 01 iplen pic s9(9) comp-5. 01 starttime pic s9(9) comp-5. 01 endtime pic s9(9) comp-5. 01 modtime usage binary-c-long. procedure division. call "C$FILEINFO" using by reference ocfilestru by reference filestat returning result. move filesize to showsize. display "url: " oc11 end-display. display "size: " showsize " date: " filedate " time: " filetime end-display. call "getcurl" returning curl. display curl. *> VALUE FOR TESTING...NOT FOR SENSITIVE EYES move 1216382377 to modtime. display modtime. accept starttime from time. call "updateOpenCOBOL" using by value curl by reference oc11 by reference ocfile by value modtime returning modtime. display modtime. *> ****************************************************** call "releasecurl" using by value curl. stop run. [/code] ---------------------------------------------------------------- Subject: Program does nothing Hi Folks, I have some problems with the actual open cobol 1.1 release. I compile following small cobol program with cobc -x test.cob IDENTIFICATION DIVISION. PROGRAM-ID. SequenceProgram. AUTHOR. Michael Coughlan. DATA DIVISION. WORKING-STORAGE SECTION. 01 Num1 PIC 9 VALUE ZEROS. 01 Num2 PIC 9 VALUE ZEROS. 01 Result PIC 99 VALUE ZEROS. PROCEDURE DIVISION. CalculateResult. ACCEPT Num1. ACCEPT Num2. MULTIPLY Num1 BY Num2 GIVING Result. DISPLAY "Result is = ", Result. STOP RUN. Under Mac OS X I've got an executeable called "test" and under windows XP with cygwin I've got a test.exe. If I execute these programs on both systems and nothing happens. I still got the prompt back, on both systems. No Error message, nothing. What went wrong? Compiler options? Thanx Thomas ---------------------------------------------------------------- Works fine here with Cygwin under XP - [code] $ cat tesr.cob IDENTIFICATION DIVISION. PROGRAM-ID. SequenceProgram. AUTHOR. Michael Coughlan. DATA DIVISION. WORKING-STORAGE SECTION. 01 Num1 PIC 9 VALUE ZEROS. 01 Num2 PIC 9 VALUE ZEROS. 01 Result PIC 99 VALUE ZEROS. PROCEDURE DIVISION. CalculateResult. ACCEPT Num1. ACCEPT Num2. MULTIPLY Num1 BY Num2 GIVING Result. DISPLAY "Result is = ", Result. STOP RUN. simrw@simrog ~ $ cobc -x -free tesr.cob simrw@simrog ~ $ ls -l tesr* -rw-r--r-- 1 simrw Kein 351 Jul 18 12:26 tesr.cob -rwxr-xr-x 1 simrw Kein 16728 Jul 18 12:28 tesr.exe simrw@simrog ~ $ ./tesr 9 9 Result is = 81 [/code] Roger ---------------------------------------------------------------- Thanx, but it does not run in my enwironments. I have deleted the "," in the DISPLAY line and it runs?! So now it seems to run. Thanx for testing, Thomas ---------------------------------------------------------------- No, that should not be. Are you sure you have a (relatively actual) 1.1? What does cobc --version say? And what compile options were used? Roger ---------------------------------------------------------------- Hello Roger, cobc -V says: cobc -V cobc (OpenCOBOL) 1.1.0 Build date Jul 12 2008 22:31:52 Copyright (C) 2001-2008 Keisuke Nishida / Roger While But you are right, now it works (with- or withot the ","). Its a kind of strange?! If it will repeat, I'll try to get it. Best regards, Thomas ---------------------------------------------------------------- Subject: SCREEN SECTION ? Does OC still has not support for SCREEN SECTION? If not, here is what we could do, convert SS to DISPLAY and ACCEPT commands. Is there somebody who done it already or has a tool? Does anyone wants to participate? ---------------------------------------------------------------- Recent OC1.1 archives have initial support for SCREEN SECTION as far as I know. I tried one compile pass of some net snagged sample, and I haven't read what is supposed to be supported, but OC1.1 didn't like LINE 4 +1 OCCURS 12 TIMES field specs ... but was ok when changed to simpler LINE 4 field specs ... Cheers, Brian ---------------------------------------------------------------- Hello, Can you post an example we can work on ? I'm a AcuCobol Developper, but I do not use screen section. I can help you and doing this I hope it will help Roger and the OC community. Best regards Bear ---------------------------------------------------------------- Here's one sample. First attempt at a screen section. Probably bugs and unwanteds living here. Cheers, Brian [code] >>SOURCE FREE *> This program is one example of the use of the Screen Section. *> tectonics: cobc -x demoscreen.cbl identification division. program-id. demoscreen. data division. working-storage section. 78 black value 0. 78 blue value 1. 78 green value 2. 78 cyan value 3. 78 red value 4. 78 magenta value 5. 78 yellow value 6. 78 white value 7. 01 test-record. 05 last-name pic x(10). 05 first-name pic x(10). 05 soc-sec-no pic x(9). 05 comment pic x(25). 01 a-message pic x(35) value spaces. 01 field-1-color pic 9. 01 hek pic x value spaces. screen section. 01 blank-screen. 05 filler line 1 blank screen. 01 entry-screen. 05 filler line 1 column 5 value "Enter Last Name". 05 screen-last-name pic x(10) using last-name line 2 column 5 foreground-color field-1-color. 05 filler line 3 column 5 value "Enter First Name". 05 screen-first-name pic x(10) using first-name line 4 column 5 foreground-color blue HIGHLIGHT. 05 filler line 5 column 5 value "Enter Social Sec". 05 screen-soc-sec-no pic x(9) using soc-sec-no line 6 column 5 foreground-color red REVERSE-VIDEO SECURE. 05 filler line 7 column 5 value "Enter Comment". 05 screen-comment pic x(25) using comment line 8 column 5 foreground-color yellow HIGHLIGHT. 05 screen-message pic x(80) from a-message line 10 column 5 foreground-color white. 01 exit-screen. 05 filler line 1 blank screen. 05 filler line 2 column 5 value "You entered:". 05 filler line 4 column 5 value " Last name:". 05 exit-last-name pic x(10) from last-name line 4 column 18. 05 exit-first-name pic x(10) from first-name line 5 column 18. 05 exit-soc pic x(9) from soc-sec-no line 6 column 18. 05 exit-comment pic x(25) from comment line 7 column 18. 05 filler line 24 column 1 value "hit enter". 05 exit-hek pic x using hek line 24 column 40. procedure division. display blank-screen. move magenta to field-1-color. screen-loop. display entry-screen. accept entry-screen. if last-name(1:1) not equal "q" move green to field-1-color move "Last name must begin with q to exit" to a-message display entry-screen go to screen-loop end-if. display exit-screen. accept exit-screen. goback. [/code] ---------------------------------------------------------------- Just a note for everyone. For ACCEPT screen, current OpenCOBOL doesn't support ON ESCAPE, but does implement CRT STATUS and includes a copy/screenio.cpy file of status 78 level constants. I just bumped into http://www.infogoal.com/cbd/cbdprj.htm and the date.zip file on that website. I'm not going to post the code, as I'm not sure about the license. Anyway, a bunch of date routines with a nice SCREEN SECTION, but also using ACCEPT screen ON ESCAPE ... So, aside from changing the COPY DATEW.COB. to COPY DATEW. all that was needed was some simple changes to the ACCEPTS and using CRT STATUS. [code] CONFIGURATION SECTION. SPECIAL-NAMES. CRT STATUS IS SCREEN-STATUS. WORKING-STORAGE SECTION. COPY screenio. 01 SCREEN-STATUS PIC 9(4). and then ACCEPT MENU-SCREEN ON ESCAPE MOVE 1 TO WS-ESCAPE-FLAG GO TO 000100-EXIT. becomes ACCEPT MENU-SCREEN. IF SCREEN-STATUS = COB-SCR-F12 MOVE 1 TO WS-ESCAPE-FLAG GO TO 000100-EXIT. [/code] Change all the ON ESCAPE lines to IF SCREEN-STATUS = COB-SCR-F12, place a period on the ACCEPT line and it should all work out. Pretty cool. Cheers, Brian ---------------------------------------------------------------- I've done it with no luck. Also I've put set/export COB_SCREEN_EXCEPTIONS=Y in my env. I, also, expect anxiously the ms/mf syntax "ACCEPT ( lin, col ) value ". with lin = current line number and col = current column number or literals Thanks. ---------------------------------------------------------------- You'll need a recent 1.1 release, but yes these features are in. This post http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=250&forum=1 and this one http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=253&forum=1 have some of the details. Cheers, Brian ---------------------------------------------------------------- Of course I've installed 1.1 my problem is escape codes ---------------------------------------------------------------- Sorry, what kind of problem with escape codes? It might be a terminal emulation config issue. But just in case, what do you get from this snippet? It seems to be working quite nicely here. Cheers, Brian [code] >>SOURCE FORMAT IS FIXED ****************************************************************** * Author: Brian Tiffin * Date: 20-July-2008 * Purpose: Demonstrate screen section and crt status codes * Tectonics: $ cobc -x screencodes.cbl * $ export COB_SCREEN_EXCEPTIONS=Y * $ export COB_SCREEN_ESC=Y * $ ./screencodes 2>screencodes.key * Notes: Displays to syserr. ncurses may hide that so a * redirection may be in order, then cat the file * On my Debian PC, ESC (code 2005) takes a while to * trigger. ****************************************************************** identification division. program-id. screencodes. environment division. configuration section. special-names. crt status is screen-status. data division. working-storage section. copy screenio. 78 red value 4. 78 yellow value 6. 01 screen-status pic 9(4). 01 counter pic 9. 01 hitanykey pic x. screen section. 01 entry-screen. 02 blank screen. 02 line 2 column 20 value "Hit some keys and function keys - loops 8 times". 02 line 10 column 30 value "Key code:". 02 screen-code pic x(4) from screen-status line 10 column 40 foreground-color yellow highlight. 02 screen-count pic x from counter line 10 column 46. 02 filler pic x using hitanykey line 14 column 40 foreground-color red. procedure division. perform varying counter from 1 by 1 until counter > 8 display entry-screen accept entry-screen display screen-status upon syserr end-perform. goback. [/code] EDIT: I've been informed that DISPLAY screen ACCEPT screen is redundant. ACCEPT screen assumes a display of the screen. Cheers again. ---------------------------------------------------------------- Oh, and again, just in case; Check http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=151&forum=1 for info on the CobCurses project. Can't speak to having tried it, so I don't know if the current CobCurses builds with the current OpenCOBOL 1.1. But CobCurses was a fair sized endeavour it seems. Cheers ---------------------------------------------------------------- See This program may help you [code] identification division. program-id. ROGERS. *> *> Specially Built For Accept Statement Playing ;-D *> environment division. configuration section. source-computer. Debian-Etch. object-computer. Debian-Etch. data division. working-storage section. 01 w pic X(001). 01 funkey pic 9(04). procedure division. debut. display "TESTING Function Keys" line 03 columns 33 with foreground-color 1 background-color 7 blank screen end-display . perform until w = "Q" or "q" display "Enter something : " line 10 col 32 with erase eos foreground-color 1 background-color 7 end-display accept w line 10 column 50 with foreground-color 2 background-color 7 prompt reverse-video auto on exception perform except-key not on exception perform normal-key end-accept end-perform go to fin. . except-key. move COB-CRT-STATUS to funkey *> Special word display "Exception Key = " line 12 column 30 end-display display funkey line 12 col 46 with foreground-color 7 background-color 4 highlight end-display call "C$SLEEP" using "1" . normal-key. move COB-CRT-STATUS to funkey display "Normal Key = " line 12 column 30 end-display display funkey line 12 col 43 with foreground-color 7 background-color 2 highlight end-display call "C$SLEEP" using "1" . fin. display "GAME OVER !" line 24 column 38 with foreground-color 7 background-color 4 highlight bell BLANK LINE end-display call "C$SLEEP" using "1" . ultime. exit program. [/code] Kind regards Bear ---------------------------------------------------------------- TERM=xterm Done it and it returns 2005 for every key I pressed. F1 returns nothing. Also, Up Arrow and Down Arrow do not accept screen. ---------------------------------------------------------------- Hi konenas. Need more details now I think. OS, Emulator, shell, etc... If you go into vi, insert mode, ctrl-v and then hit a function key, what do you see? Normal sequences (in the GNU/Linux world) being ^[OP or ^[[11~ for F1, ^[[24~ for F12. This could be a timing issue. Roger hinted somewhere that the ESC handling could get wonky, as ESC is used as the first character for the function keys, so ncurses may detect a delay between the ^[ and the OP (or [11~) as a normal ESC key, code 2005. On my tests, the Esc key comes with a fair delay before the screen section or Bear's accept demo display the key code; function keys reacting much faster. How does the COB_SCREEN_ESCAPE= setting influence things? Dunno really, but it seems like something that we can get figured out. Re the arrow keys; on a screen section those are mapped to field focus and don't terminate the accept, as far as I know. Not overly sure about that one either. Cheers Brian ---------------------------------------------------------------- F1 =ESC O M F2 =ESC O N F3 =ESC O P screen-io does need terminfo or termcap ? I can change my F keys appropriately. ---------------------------------------------------------------- Cob-curses project is dated early 2007. Sources are for 0.32 opencobol Do you know anything more? Have you compile it? Do you use it? ---------------------------------------------------------------- konenas; Sorry. I only found out enough about CobCurses to make an entry in the FAQ. I was impressed by the amount of code and the level of professionalism that Warren put into it. I've been spending more time trying to keep up with Bear and Roger on the exended ACCEPT, DISPLAY and the new SCREEN SECTION. I can't see the porting (if any) of CobCurses to OC1.1 being much effort, but SCREEN SECTION may have made the project somewhat redundant; not sure, not knowing much about the features. I would recommend a perusal by anyone that needed to do screens using OpenCOBOL though, just in case. Cheers, Brian ---------------------------------------------------------------- As you maybe can see from these screens http://sourceforge.net/project/screenshots.php?group_id=186285 cobcurses do a lot more than the screen section will do in oc for long time. It gives you a full screen editor which pulls out some copy's with the screens and after procedures. See also the wiki http://cobcurses.wiki.sourceforge.net/ for documentation. For OC 1.1 there may be some code optimisations, in particular if there is support for "after procedure is" clause, but I think it'll work as it is. PS: Last Cobcurses (0.95) is dated October 2007. ---------------------------------------------------------------- Subject: Wow- real good work fellows... I just popped in today to check on the status of this project, and to my amazement, found a 1.1 release sitting there. I could not resist downloding and installing it on a handy Linux box sitting around here. It works really well- I am more than impressed. I am amazed. It took about an hour to install and write a little test suite, including importing a few thousand records and writing a nice little Ajax web page. Page didn't do much, but the OpenCOBOL programs behind it ran like greased lightening. :) No problem with environment variables, stdout/stdin, indexed file access with a plethora of indices and lots of STARTs in the program. Did I say impressive?? Thanks for all your hard work guys... I am indeed very much impressed. Is anyone using this in a production environment yet? And are there any plans to include embedded SQL? Yours, -Paul ---------------------------------------------------------------- Subject: Help running cygwin on windows for OpenCOBOL Hello, I am trying to run cygwin in order to use OpenCOBOL on windows XP. I tried running cygwin but whenever I type anything in the README file I get the message Bash: ... command not found How do you use cygwin as just an emulator? Any help would be appreciated. Thanks!!! Siegel ---------------------------------------------------------------- Basically cygwin is a dynamic library that implements POSIX on Windows, and provides all the GNU tools on that layer. After downloading, run setup.exe. That will install the base system. And you should get a Green/Black Cygwin Icon on the desktop. This icon will start up a console session running the Cygwin version of bash. When running you should have a console window with some form of $ prompt. At that prompt you can type the GNU commands like [i]cat, ls, make[/i] etc. [i]To be honest, I dislike the default Windows console and usually install rxvt.[/i] One issue I can see here would be ensuring that your XP account (user or admin) has the correct settings in terms of the command path etc. For building OpenCOBOL, along with the gcc and binutils, you may need to install some other packages; libgmp, libdb, libncurses. Cygwin also has a X11 layer for graphics, but the environment works great as a simple command line console. rxvt will work as a nice windowed terminal even without X. setup.exe is also used as a package manager, providing a great big list of compilers, interpreters, utilities and lots of other goodies. So keep that setup.exe icon handy. It will update any existing packages along with letting you choose new ones. Cygwin is a fair sized subsystem, lots to see and do. :) Cheers, Brian ---------------------------------------------------------------- Hello Siegel, I have installed cygwin without any problems and my bash is starting automatically if I double click on the cygwin icon. After selection some libs with the setup.exe comes from cygwin, I am able to compile open cobol without problems. (The ./configure script tells you, what libs a requiert). You should deinstall and install cygwin again with the default configuration. Ciao, Thomas ---------------------------------------------------------------- Thanks for the reply. I'm sorry that I wasn't clear before, but I'm a complete newbie. I've never used Cygwin. In fact, I've never used linux at all.:oops: I'm running Cygwin just because I want to be able to compile COBOL in Windows. I don't know any commands at all. Can you please just tell me exactly what to type in? What are the commands I'm supposed to use?:-? I also have no idea how to find out if I need any packages, let alone actually installing them. (Although I did install EVERYTHING when I installed Cygwin.) PLEASE HELP!!! Thanks again. ---------------------------------------------------------------- seigel; First off, welcome to the world of the command line. :) Second; this could take a few back and forth posts. I'm ok with that if you are. Third; you've started with reading the Install Guide? http://www.opencobol.org/modules/bwiki/index.php?InstallGuide Fourth; you've seen the green/black Cygwin icon and clicked it? And then seen the black terminal with a funky prompt ending in $ Fifth; from your terminal, Cygwin should have given you a user account. Usually this is whatever name XP thought you were when you installed Cygwin. Could be Administator. Doesn't really matter. Do me a favour and part of Six will be to create a working directory. Call it build. So the command lines will be; [code] $ cd $ mkdir build [/code] (don't type the dollars)... Again; you'll type [i]cd[/i] and [i]mkdir build[/i] cd is Change Directory and all by itself always takes you to your "home" directory. mkdir is the make directory command, and build will be the directory that is created. At this point I'd like to find out how things are going, but if you can't wait (who can) here is the rest. But we can chat more if it doesn't work out. So lastly (for now); snag a copy of the open-cobol-1.1.tar.gz, plop it in the ~/build directory and try a go. [code] $ cd ~/build $ wget http://www.sim-basis.de/open-cobol-1.1.tar.gz $ tar xvf open-cobol-1.1.tar.gz $ cd open-cobol-1.1 $ ./configure $ make $ make check $ make install [/code] and now you should be able to run the compiler, cobc. [code] $ cobc -x theNextGreatThing.cbl [/code] Note: I only run Cygwin when I am forced to run Windows. I'm not sure if the make install needs any super user privileges. Also, all that assumes you really do have an Everything Cygwin Install and make and make check complete without error. If not, what you need is in the Install Guide. But we can chat more if need be. Cheers, Brian ---------------------------------------------------------------- Thank you very much for all your help. I have now successfully installed OpenCobol onto the computer. However I am still having trouble running OpenCobol. When I go into C:/cygwin/usr/local/bin and click on the cobc.exe or the cobcrun.exe it gives me the message: "This application has failed because cygwin1.dll was not found. Re-installing the application may fix this problem." From the bash shell I tried various forms of cobc.exe -x and it gives me different messages but none of them work. I also tried using the run command and nothing happened - no project running or error message. Thanks again. Siegel ---------------------------------------------------------------- [quote] When I go into C:/cygwin/usr/local/bin and click on the cobc.exe or the cobcrun.exe it gives me the message: "This application has failed because cygwin1.dll was not found. Re-installing the application may fix this problem." From the bash shell I tried various forms of cobc.exe -x and it gives me different messages but none of them work. I also tried using the run command and nothing happened - no project running or error message. [/quote] You have to be a little careful. Cygwin wants to be "in environment"; so start the bash terminal and try simply [code] $ cobc -x filename.cbl [/code] And you should be golden. Skip cobc.exe, the cygwin bash won't like the .exe part. And Windows won't let you double-click the icon. The windows program launch won't be setup properly for the Cygwin environment. Try and look at the properties of the green/black Cygwin icon to see what it does. It starts up the windows console running the Cygwin bash (and that is where the "in environment" part comes in). It sounds like you are 99 steps out of 100 on the road to OpenCOBOL. :) EDIT: I lied. I'm in Windows right now. boohiss. :) From the console, cobc.exe works ok. What you need is to feed it some COBOL. For instance [code] identification division. program-id. simple. procedure division. display "simple". goback. [/code] Save that as simple.cbl and try [code] $ cobc -x -free simple.cbl $ ./simple [/code] the -free option tells OC to compile FREE format source code. END-EDIT Cheers, Brian P.S. Windows is a locked-in "my way or the highway" OS. Install a GNU/Linux distro. ;) You can leave Windows as a dual-boot option from the GRUB menu, but if you are like me then Windows gets booted into if and only if there are no alternatives. With the plethora of high quality open source apps now-a-days, the if and only if gets rarer and rarer. Plus, WINE (a windows binary emulator for GNU/Linux) is now 1.0 so many many windows programs can be executed right from Linux. ---------------------------------------------------------------- Thanks for all your help! Just a couple more question? Is there an ide for OpenCobol? Also is there a way to run compiled OpenCobol executables directly from windows? (In case I want to give an executable to a friend) Thanks again, Siegel ---------------------------------------------------------------- Edit: After playing in Cygwin for a few minutes. This post is mostly for crap. I didn't and don't know what I'm talking about in this area. [quote] Is there an ide for OpenCobol? Also is there a way to run compiled OpenCobol executables directly from windows? (In case I want to give an executable to a friend) [/quote] 1) I usually eschew IDEs. They detract from creative development (imho). But last I heard someone built a COBOL extension for Eclipse. Acucorp has a link at http://www.acucorp.com/company/press/releases/2005/2005_pr_4.php but there is a non-commercial effort as well. As I don't run Eclipse, I can't say for sure about the COBOL plugin, but Eclipse seems to get a lot of good press and has some pretty big players backing it. I'll opine; Unix has always been the best Interactive Development Environment. It is also the world's most powerful text processor. So once again, I'll suggest a GNU/Linux install. Failing that, Cygwin is not a bad second-cousin. 2) Yes. Once built it should function. There is a Cygwin command ldd that will show dependencies. Windows has a depends commands. [i]Sorry, I have to do a family guy giggle ... depends ... heehee he said diaper.[/i] :) Those commands will tell you what will be needed on any target computers. OpenCOBOL will function from MinGW as well. That should generate .exes that do not require cygwin.dll but I've only read about MinGW and have no actual experience. I always install Cygwin and would suggest such to any developer stuck on an MS platform. There is a Cygwin gcc switch -mno-cygwin, but I'm not sure how that could be passed through from cobc. Roger; Is there a way of passing -mno-cygwin through to gcc? (I'll ask this on the mailing list too, it'll make for a good FAQ entry). And Seigel; it may already do this, dunno. I'm not experienced enough to know if there is a way to produce "all linked in" executables with OpenCOBOL. A few experiments may be in order. Cheers ---------------------------------------------------------------- It works!!!! Thank you very Much for all your help! It is much appreciated. Siegel ---------------------------------------------------------------- need help i stuck after i type compile i receive an error here what shows after i type compile checking for BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... gawk checking whether make sets $(MAKE)... no checking whether to enable maintainer specific portions of Makefile... no checking for gcc... no checking for xlc... no checking cc... no configure: error: no acceptable C compiler found in $PATH sorry if im stuck with this im a newbie ---------------------------------------------------------------- Hello christian, 1st: warmly welcome at OpenCOBOL.org 2nd: You obviously used the search function: very well. To your problem: install all the necessary tools (especially gcc) and libs that are listed in the README (both devel and runtime) via the cygwin setup.exe. Afterwards start cygwin again and try ./configure again, it will tell you what's still missing. If there is something missing, go to cygwin setup.exe and install the missing stuff. Depending on your machine and internet connection you should've set up cygwin and OC within 15-45 minutes. As it seems that you aren't familiar with cygwin I suggest to think about using either MS VC Express together with the win binaries that can be found at http://www.kiska.net/opencobol/1.1/ , titled with "x86 Windows (32-bit)" [not the VS 2008 version] or the prepared MinGW package that can be found in the Wiki (navigation on the left under "Assorted Documents", grab the zip archive). They may both have some bugs you won't have with the cygwin version but they're the right thing for using OpenCOBOL fast (at least for the first weeks). human ---------------------------------------------------------------- TACMIN is an organization with Japan-Vietnam partnership providing support to enhance competitiveness and identity of Vietnamese artisan crafts for products, craft persons, skills and Traditional values, thereby hoping quality of life of the people will be improved. Please visit us by these links below; [url=http://www.tacmin.net/]ベトナム 工芸[/url] [url=http://www.tacmin.net/]Vietnam crafts[/url] [url=http://www.tacmin.net/]Designers Interior products Hanoi[/url] [url=http://www.tacmin.net/]Souvenir Hanoi[/url] [url=http://www.tacmin.net/]Vietnamese handicrafts[/url] [url=http://www.tacmin.net/]お土産 ハノイ[/url] [url=http://www.tacmin.net/]デザイナーズインテリアアイテム ハノイ[/url] TACMIN is an intermingling of English, Japanese, and Vietnamese meanings that perfectly reflects the company’s vision. In English, TACMIN is the acronym for Traditional Artisan Craft Movement with Initiatives and Network, while in Japanese it rhymes with “takumi” meaning extraordinary skill in creating beautiful objects. In Vietnamese, TACMIN combines “tac” meaning “to make” and “minh” meaning “fine.” TACMIN is the first step to realizing the vision to connect Vietnam, Japan, and the rest of the world through traditional artisan crafts. ---------------------------------------------------------------- Subject: libcurl Refresh OC1.1 source archive Hello everyone; Baby steps continue on a libcurl wrapper. This occurlrefresh COBOL program has a very rudimentary command line argument handler. Options are [-v or -vv] -v for verbose, -vv for veryverbose [url file] [-v or -vv url file] So it counts one arg as the verbosity option two args as url to scan file to save - no verbosity three args as verbosity and url and file Default url and file are suitable for open-cobol-1.1.tar.gz One again, I apologize for the size of the post. Usage: $ ./occurlrefresh -vv to get chatty output and a progress indicator. You can actually use occurlrefresh to conditionally download any url to a given filename but it's main purpose is for refreshing the open-cobol-1.1 tar without abusing the server too too much. Cheers, Brian First the current occurl.c wrapper [code] /**********************************************************************/ /* wrap some common curl operations for use with OpenCOBOL 1.1 */ /* Author: Brian Tiffin */ /* Date: 21-July-2008 */ /* Version: 0.1 */ /* Purpose: Provide some net access to OpenCOBOL */ /* Tectonics: gcc -c occurl.c */ /* with libcurl dev installed */ /**********************************************************************/ #include #include #include /* Support structure for the file callbacks */ struct LocalFileStruc { const char *filename; FILE *stream; }; /* Progress tracking */ double *Bar; /* libcurl call back for file write */ static size_t wrap_fwrite(void *buffer, size_t size, size_t nmemb, void *stream) { struct LocalFileStruc *out=(struct LocalFileStruc *)stream; if(out && !out->stream) { /* open file for writing */ out->stream=fopen(out->filename, "wb"); if(!out->stream) return -1; /* failure, can't open file to write */ } return fwrite(buffer, size, nmemb, out->stream); } /* Progress */ int progress_callback(char *Bar, double t, double d, double ultotal, double ulnow) { int oe; double val; if (t == 0) t = 1.0; val = d / t * 100; oe = (int)val; if (oe & 1) { putc('\\', stdout); } else { putc('/', stdout); } printf("%03.0f%%\b\b\b\b\b\b\b\b", val); fflush(stdout); return 0; } /* Routines to get and release CURL handles from OpenCOBOL */ /* Usage: */ /* DATA DIVISION. */ /* 01 handle usage is pointer. */ /* PROCEDURE DIVISION. */ /* CALL "occurl_init" RETURNING handle. */ CURL* occurl_init() { return curl_easy_init(); } /* Usage: */ /* CALL "occurl_cleanup" USING BY VALUE handle. */ void occurl_cleanup(CURL *curl) { curl_easy_cleanup(curl); } /* Set verbosity */ /* Usage: vflag being 0 or 1 */ /* CALL "occurl_verbose" USING BY VALUE vflag. */ void occurl_verbose(CURL *curl, int vflag) { /* Switch on or off full protocol/debug output */ if (curl) { curl_easy_setopt(curl, CURLOPT_VERBOSE, (long)vflag); } } /* Set progress display on/off */ /* Usage: pflag being 0 or 1 */ /* CALL "occurl_verbose" USING BY VALUE pflag. */ void occurl_progress(CURL *curl, int pflag) { /* Switch on or off progress display */ if (curl) { if (pflag) { curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L); curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_callback); curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &Bar); } else { curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L); curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, NULL); curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, NULL); } } } /* Ease of use; check mod-times, if since then read url, write to file */ /* Retrieve URL and save to local file after checking timestamps */ /* Usage: */ /* DATA DIVISION. */ /* 01 handle USAGE IS POINTER. */ /* 01 url. */ /* 02 urlname PIC x(21) VALUE "http://opencobol.org/". */ /* 02 filler PIC x VALUE X"00". */ /* 01 filename */ /* 02 PIC x(). */ /* 02 filler pic x value low-value. */ /* 01 modtime USAGE IS BINARY-C-LONG */ /* PROCEDURE DIVISION. */ /* CALL "curl_retrieve_file" USING BY VALUE handle */ /* BY REFERENCE url */ /* BY REFERENCE filename */ /* BY REFERENCE modtime */ /* RETURNING result. */ /* Pass modtime of 0 to get local mtime field, */ /* modtime is modified with value from url if available */ int occurl_retrieve_file(CURL *curl, char *url, char *file, long *modtime) { CURLcode res; long urlstamp; struct stat st; struct LocalFileStruc localfile={ "occurl.default", /* default filename */ NULL /* stream */ }; /* point to the COBOL passed filename */ if (file) { localfile.filename = file; } /* if modtime is zero, get local file modtime */ if (*modtime == 0) { if (stat (file, &st) == 0) { *modtime = st.st_mtime; } } /* let libcurl do all the real work */ if (curl) { curl_easy_setopt(curl, CURLOPT_URL, url); /* Only fetch new */ curl_easy_setopt(curl, CURLOPT_FILETIME, 1L); curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE); curl_easy_setopt(curl, CURLOPT_TIMEVALUE, *modtime); /* Define our callback to get called when there's data to be written */ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, wrap_fwrite); /* Set a pointer to our struct to pass to the callback */ curl_easy_setopt(curl, CURLOPT_WRITEDATA, &localfile); /* After all the setopts, perform the operation */ res = curl_easy_perform(curl); /* close off any file pointers */ if (localfile.stream) { fclose(localfile.stream); /* close the local file */ } /* return error results */ if (res != 0) { return (int)res; } /* retrieve response code */ res = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &urlstamp); if (res != 0) { return (int)res; } else { if (urlstamp == 404) { return CURLE_REMOTE_FILE_NOT_FOUND; } } /* retrieve filetime for return value */ res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &urlstamp); if (res != 0) { return (int)res; } else { *modtime = urlstamp; return 0; } } else { return CURLE_FAILED_INIT; } return 0; } /* Fetch a url to a local file */ int occurl_get_url(CURL *curl, char *theurl, char *thefile) { CURLcode res; long urlstamp; struct LocalFileStruc localfile = { "occurl.default", /* default filename */ NULL /* stream */ }; /* point to the COBOL field */ localfile.filename = thefile; if (curl) { curl_easy_setopt(curl, CURLOPT_URL, theurl); curl_easy_setopt(curl, CURLOPT_FILETIME, 1L); /* Define our callback to get called when there's data to be written */ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, wrap_fwrite); /* Set a pointer to our struct to pass to the callback */ curl_easy_setopt(curl, CURLOPT_WRITEDATA, &localfile); res = curl_easy_perform(curl); /* close the local file */ if (localfile.stream) { fclose(localfile.stream); } /* return error results */ if (res != 0) { return (int)res; } /* retrieve response code */ res = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &urlstamp); if (res != 0) { return (int)res; } else { if (urlstamp == 404) { return CURLE_REMOTE_FILE_NOT_FOUND; } } } else { return CURLE_FAILED_INIT; } return 0; } /* The plan is to return a structure with all curl INFO fields filled */ int occurl_getinfo(CURL *curl, char *theurl, char *thedata) { CURLcode res; long urlstamp; if (curl) { curl_easy_setopt(curl, CURLOPT_URL, theurl); res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &urlstamp); } else { return -1; } return (int)res; } [/code] And a COPY text for libcurl status codes and messages, save as occurlsym.cpy [code] *> manifest constants for libcurl *> Usage: COPY occurlsym inside data division *> Result codes 78 CURLE_OK VALUE 0. *> Error codes 78 CURLE_UNSUPPORTED_PROTOCOL VALUE 1. 78 CURLE_FAILED_INIT VALUE 2. 78 CURLE_URL_MALFORMAT VALUE 3. 78 CURLE_OBSOLETE4 VALUE 4. 78 CURLE_COULDNT_RESOLVE_PROXY VALUE 5. 78 CURLE_COULDNT_RESOLVE_HOST VALUE 6. 78 CURLE_COULDNT_CONNECT VALUE 7. 78 CURLE_FTP_WEIRD_SERVER_REPLY VALUE 8. 78 CURLE_REMOTE_ACCESS_DENIED VALUE 9. 78 CURLE_OBSOLETE10 VALUE 10. 78 CURLE_FTP_WEIRD_PASS_REPLY VALUE 11. 78 CURLE_OBSOLETE12 VALUE 12. 78 CURLE_FTP_WEIRD_PASV_REPLY VALUE 13. 78 CURLE_FTP_WEIRD_227_FORMAT VALUE 14. 78 CURLE_FTP_CANT_GET_HOST VALUE 15. 78 CURLE_OBSOLETE16 VALUE 16. 78 CURLE_FTP_COULDNT_SET_TYPE VALUE 17. 78 CURLE_PARTIAL_FILE VALUE 18. 78 CURLE_FTP_COULDNT_RETR_FILE VALUE 19. 78 CURLE_OBSOLETE20 VALUE 20. 78 CURLE_QUOTE_ERROR VALUE 21. 78 CURLE_HTTP_RETURNED_ERROR VALUE 22. 78 CURLE_WRITE_ERROR VALUE 23. 78 CURLE_OBSOLETE24 VALUE 24. 78 CURLE_UPLOAD_FAILED VALUE 25. 78 CURLE_READ_ERROR VALUE 26. 78 CURLE_OUT_OF_MEMORY VALUE 27. 78 CURLE_OPERATION_TIMEDOUT VALUE 28. 78 CURLE_OBSOLETE29 VALUE 29. 78 CURLE_FTP_PORT_FAILED VALUE 30. 78 CURLE_FTP_COULDNT_USE_REST VALUE 31. 78 CURLE_OBSOLETE32 VALUE 32. 78 CURLE_RANGE_ERROR VALUE 33. 78 CURLE_HTTP_POST_ERROR VALUE 34. 78 CURLE_SSL_CONNECT_ERROR VALUE 35. 78 CURLE_BAD_DOWNLOAD_RESUME VALUE 36. 78 CURLE_FILE_COULDNT_READ_FILE VALUE 37. 78 CURLE_LDAP_CANNOT_BIND VALUE 38. 78 CURLE_LDAP_SEARCH_FAILED VALUE 39. 78 CURLE_OBSOLETE40 VALUE 40. 78 CURLE_FUNCTION_NOT_FOUND VALUE 41. 78 CURLE_ABORTED_BY_CALLBACK VALUE 42. 78 CURLE_BAD_FUNCTION_ARGUMENT VALUE 43. 78 CURLE_OBSOLETE44 VALUE 44. 78 CURLE_INTERFACE_FAILED VALUE 45. 78 CURLE_OBSOLETE46 VALUE 46. 78 CURLE_TOO_MANY_REDIRECTS VALUE 47. 78 CURLE_UNKNOWN_TELNET_OPTION VALUE 48. 78 CURLE_TELNET_OPTION_SYNTAX VALUE 49. 78 CURLE_OBSOLETE50 VALUE 50. 78 CURLE_PEER_FAILED_VERIFICATION VALUE 51. 78 CURLE_GOT_NOTHING VALUE 52. 78 CURLE_SSL_ENGINE_NOTFOUND VALUE 53. 78 CURLE_SSL_ENGINE_SETFAILED VALUE 54. 78 CURLE_SEND_ERROR VALUE 55. 78 CURLE_RECV_ERROR VALUE 56. 78 CURLE_OBSOLETE57 VALUE 57. 78 CURLE_SSL_CERTPROBLEM VALUE 58. 78 CURLE_SSL_CIPHER VALUE 59. 78 CURLE_SSL_CACERT VALUE 60. 78 CURLE_BAD_CONTENT_ENCODING VALUE 61. 78 CURLE_LDAP_INVALID_URL VALUE 62. 78 CURLE_FILESIZE_EXCEEDED VALUE 63. 78 CURLE_USE_SSL_FAILED VALUE 64. 78 CURLE_SEND_FAIL_REWIND VALUE 65. 78 CURLE_SSL_ENGINE_INITFAILED VALUE 66. 78 CURLE_LOGIN_DENIED VALUE 67. 78 CURLE_TFTP_NOTFOUND VALUE 68. 78 CURLE_TFTP_PERM VALUE 69. 78 CURLE_REMOTE_DISK_FULL VALUE 70. 78 CURLE_TFTP_ILLEGAL VALUE 71. 78 CURLE_TFTP_UNKNOWNID VALUE 72. 78 CURLE_REMOTE_FILE_EXISTS VALUE 73. 78 CURLE_TFTP_NOSUCHUSER VALUE 74. 78 CURLE_CONV_FAILED VALUE 75. 78 CURLE_CONV_REQD VALUE 76. 78 CURLE_SSL_CACERT_BADFILE VALUE 77. 78 CURLE_REMOTE_FILE_NOT_FOUND VALUE 78. 78 CURLE_SSH VALUE 79. 78 CURLE_SSL_SHUTDOWN_FAILED VALUE 80. 78 CURLE_AGAIN VALUE 81. *> Error strings 01 LIBCURL_ERRORS. 02 CURLEVALUES. 03 FILLER PIC X(30) VALUE "CURLE_UNSUPPORTED_PROTOCOL ". 03 FILLER PIC X(30) VALUE "CURLE_FAILED_INIT ". 03 FILLER PIC X(30) VALUE "CURLE_URL_MALFORMAT ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE4 ". 03 FILLER PIC X(30) VALUE "CURLE_COULDNT_RESOLVE_PROXY ". 03 FILLER PIC X(30) VALUE "CURLE_COULDNT_RESOLVE_HOST ". 03 FILLER PIC X(30) VALUE "CURLE_COULDNT_CONNECT ". 03 FILLER PIC X(30) VALUE "CURLE_FTP_WEIRD_SERVER_REPLY ". 03 FILLER PIC X(30) VALUE "CURLE_REMOTE_ACCESS_DENIED ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE10 ". 03 FILLER PIC X(30) VALUE "CURLE_FTP_WEIRD_PASS_REPLY ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE12 ". 03 FILLER PIC X(30) VALUE "CURLE_FTP_WEIRD_PASV_REPLY ". 03 FILLER PIC X(30) VALUE "CURLE_FTP_WEIRD_227_FORMAT ". 03 FILLER PIC X(30) VALUE "CURLE_FTP_CANT_GET_HOST ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE16 ". 03 FILLER PIC X(30) VALUE "CURLE_FTP_COULDNT_SET_TYPE ". 03 FILLER PIC X(30) VALUE "CURLE_PARTIAL_FILE ". 03 FILLER PIC X(30) VALUE "CURLE_FTP_COULDNT_RETR_FILE ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE20 ". 03 FILLER PIC X(30) VALUE "CURLE_QUOTE_ERROR ". 03 FILLER PIC X(30) VALUE "CURLE_HTTP_RETURNED_ERROR ". 03 FILLER PIC X(30) VALUE "CURLE_WRITE_ERROR ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE24 ". 03 FILLER PIC X(30) VALUE "CURLE_UPLOAD_FAILED ". 03 FILLER PIC X(30) VALUE "CURLE_READ_ERROR ". 03 FILLER PIC X(30) VALUE "CURLE_OUT_OF_MEMORY ". 03 FILLER PIC X(30) VALUE "CURLE_OPERATION_TIMEDOUT ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE29 ". 03 FILLER PIC X(30) VALUE "CURLE_FTP_PORT_FAILED ". 03 FILLER PIC X(30) VALUE "CURLE_FTP_COULDNT_USE_REST ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE32 ". 03 FILLER PIC X(30) VALUE "CURLE_RANGE_ERROR ". 03 FILLER PIC X(30) VALUE "CURLE_HTTP_POST_ERROR ". 03 FILLER PIC X(30) VALUE "CURLE_SSL_CONNECT_ERROR ". 03 FILLER PIC X(30) VALUE "CURLE_BAD_DOWNLOAD_RESUME ". 03 FILLER PIC X(30) VALUE "CURLE_FILE_COULDNT_READ_FILE ". 03 FILLER PIC X(30) VALUE "CURLE_LDAP_CANNOT_BIND ". 03 FILLER PIC X(30) VALUE "CURLE_LDAP_SEARCH_FAILED ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE40 ". 03 FILLER PIC X(30) VALUE "CURLE_FUNCTION_NOT_FOUND ". 03 FILLER PIC X(30) VALUE "CURLE_ABORTED_BY_CALLBACK ". 03 FILLER PIC X(30) VALUE "CURLE_BAD_FUNCTION_ARGUMENT ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE44 ". 03 FILLER PIC X(30) VALUE "CURLE_INTERFACE_FAILED ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE46 ". 03 FILLER PIC X(30) VALUE "CURLE_TOO_MANY_REDIRECTS ". 03 FILLER PIC X(30) VALUE "CURLE_UNKNOWN_TELNET_OPTION ". 03 FILLER PIC X(30) VALUE "CURLE_TELNET_OPTION_SYNTAX ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE50 ". 03 FILLER PIC X(30) VALUE "CURLE_PEER_FAILED_VERIFICATION". 03 FILLER PIC X(30) VALUE "CURLE_GOT_NOTHING ". 03 FILLER PIC X(30) VALUE "CURLE_SSL_ENGINE_NOTFOUND ". 03 FILLER PIC X(30) VALUE "CURLE_SSL_ENGINE_SETFAILED ". 03 FILLER PIC X(30) VALUE "CURLE_SEND_ERROR ". 03 FILLER PIC X(30) VALUE "CURLE_RECV_ERROR ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE57 ". 03 FILLER PIC X(30) VALUE "CURLE_SSL_CERTPROBLEM ". 03 FILLER PIC X(30) VALUE "CURLE_SSL_CIPHER ". 03 FILLER PIC X(30) VALUE "CURLE_SSL_CACERT ". 03 FILLER PIC X(30) VALUE "CURLE_BAD_CONTENT_ENCODING ". 03 FILLER PIC X(30) VALUE "CURLE_LDAP_INVALID_URL ". 03 FILLER PIC X(30) VALUE "CURLE_FILESIZE_EXCEEDED ". 03 FILLER PIC X(30) VALUE "CURLE_USE_SSL_FAILED ". 03 FILLER PIC X(30) VALUE "CURLE_SEND_FAIL_REWIND ". 03 FILLER PIC X(30) VALUE "CURLE_SSL_ENGINE_INITFAILED ". 03 FILLER PIC X(30) VALUE "CURLE_LOGIN_DENIED ". 03 FILLER PIC X(30) VALUE "CURLE_TFTP_NOTFOUND ". 03 FILLER PIC X(30) VALUE "CURLE_TFTP_PERM ". 03 FILLER PIC X(30) VALUE "CURLE_REMOTE_DISK_FULL ". 03 FILLER PIC X(30) VALUE "CURLE_TFTP_ILLEGAL ". 03 FILLER PIC X(30) VALUE "CURLE_TFTP_UNKNOWNID ". 03 FILLER PIC X(30) VALUE "CURLE_REMOTE_FILE_EXISTS ". 03 FILLER PIC X(30) VALUE "CURLE_TFTP_NOSUCHUSER ". 03 FILLER PIC X(30) VALUE "CURLE_CONV_FAILED ". 03 FILLER PIC X(30) VALUE "CURLE_CONV_REQD ". 03 FILLER PIC X(30) VALUE "CURLE_SSL_CACERT_BADFILE ". 03 FILLER PIC X(30) VALUE "CURLE_REMOTE_FILE_NOT_FOUND ". 03 FILLER PIC X(30) VALUE "CURLE_SSH ". 03 FILLER PIC X(30) VALUE "CURLE_SSL_SHUTDOWN_FAILED ". 03 FILLER PIC X(30) VALUE "CURLE_AGAIN ". 01 FILLER REDEFINES LIBCURL_ERRORS. 02 CURLEMSG OCCURS 81 TIMES PIC X(30). [/code] And finally to end this too long of a post post, a sample to refresh any open-cobol-1.1.tar.gz [code] *> ************************************************************** *> * access libcurl to update current OC1.1 source archive *> ************************************************************** *> Author: Brian Tiffin *> Date: 22-July-2008 *> Purpose: Sample calls to occurl wrapper *> Wasn't designed to be called a binding *> Tectonics: gcc -c -Wall occurl.c *> cobc -b -lcurl oc11refresh.cbl occurl.o *> cobcrun occurlrefresh [-v] [url file] [-v url file] identification division. program-id. occurlrefresh. environment division. input-output section. data division. working-storage section. copy occurlsym. 01 args pic x(1024). 01 urlarg pic x(255). 01 filearg pic x(255). 01 verbarg pic x(255). 01 argcount pic s9(9) comp-5. 01 verbosity pic 9(9) usage binary. 88 verbose value 1 thru 2. 88 veryverbose value 2. 01 ocurl pic x(45) value "http://www.sim-basis.de/open-cobol-1.1.tar.gz". 01 ocfile pic x(21) value 'open-cobol-1.1.tar.gz'. local-storage section. 01 curl usage pointer. 01 result pic s9(9) comp-5. 01 curlurl pic x(256). 01 curlfile pic x(256). 01 starttime pic s9(7)v99 comp-5. 01 endtime pic s9(7)v99 comp-5. 01 showtime pic z(6)9.99. 01 modtime usage binary-c-long. *> Update the OC 1.1 tar if applicable by modification time procedure division. *> Pull any command line arguments accept args from command-line end-accept. unstring args delimited by all spaces into verbarg urlarg filearg tallying in argcount end-unstring. *> no args is still argcount 1 if verbarg equals spaces subtract 1 from argcount end-subtract end-if. if argcount = 0 move ocurl to urlarg move ocfile to filearg end-if. if argcount = 1 evaluate verbarg when "-v" move 1 to verbosity when "-vv" move 2 to verbosity when other move 1 to verbosity end-evaluate move ocurl to urlarg move ocfile to filearg end-if. if argcount = 2 move urlarg to filearg move verbarg to urlarg end-if. if argcount = 3 evaluate verbarg when "-v" move 1 to verbosity when "-vv" move 2 to verbosity when other move 1 to verbosity end-evaluate end-if. *> null terminate the strings for C string urlarg delimited by space low-value delimited by size into curlurl end-string. string filearg delimited by space low-value delimited by size into curlfile end-string. *> parameters ready if verbose display "file: " function trim(filearg trailing) " from url: " function trim(urlarg trailing) end-display end-if *> let libcurl do all the hard work call "occurl_init" returning curl end-call. if veryverbose call "occurl_verbose" using by value curl by value verbosity end-call call "occurl_progress" using by value curl by value verbosity end-call end-if *> move zero to modtime, retrieve_file will test local modtime move 0 to modtime. accept starttime from time end-accept. call "occurl_retrieve_file" using by value curl by reference curlurl by reference curlfile by reference modtime returning result end-call. if verbose accept endtime from time end-accept subtract starttime from endtime giving starttime end-subtract divide starttime by 100 giving starttime end-divide move starttime to showtime display "Done in " showtime end-display if result not = 0 display "result: " result " - " CURLEMSG(result) end-display end-if end-if call "occurl_cleanup" using by value curl end-call. stop run giving result. exit program. [/code] ---------------------------------------------------------------- Seems to be a real nice piece of code! I would suggest the following direct changes to the cobol [code] *> ************************************************************** *> * access libcurl to update current OC1.1 source archive *> ************************************************************** *> Author: Brian Tiffin *> Date: 22-July-2008 *> Purpose: Sample calls to occurl wrapper *> Wasn't designed to be called a binding *> Tectonics: gcc -c -Wall occurl.c *> cobc -b -lcurl oc11refresh.cbl occurl.o *> cobcrun occurlrefresh [-v] [url file] [-v url file] identification division. program-id. occurlrefresh. environment division. input-output section. data division. working-storage section. copy occurlsym. 01 args pic x(1024). 01 urlarg pic x(255). 88 url arg-oc value 'http://www.sim-basis.de/open-cobol-1.1.tar.gz'. 01 filearg pic x(255). 88 filearg-oc value 'open-cobol-1.1.tar.gz'. 01 verbarg pic x(255). 01 argcount pic s9(9) comp-5. 01 verbosity pic 9(9) usage binary. 88 verbose value 1 thru 2. 88 veryverbose value 2. local-storage section. 01 curl usage pointer. 01 result pic s9(9) comp-5. 01 curlurl pic x(256). 01 curlfile pic x(256). 01 starttime pic s9(7)v99 comp-5. 01 endtime pic s9(7)v99 comp-5. 01 showtime pic z(6)9.99. 01 modtime usage binary-c-long. *> Update the OC 1.1 tar if applicable by modification time procedure division. *> Pull any command line arguments accept args from command-line end-accept unstring args delimited by all spaces into verbarg urlarg filearg tallying in argcount end-unstring *> no args is still argcount 1 if verbarg equals spaces subtract 1 from argcount end-subtract end-if evaluate argcount when 0 set urlarg-oc to true set filearg-oc to true when 1 evaluate verbarg when "-v" set verbose to true when "-vv" set veryverbose to true when other move 1 to verbosity end-evaluate set urlarg-oc to true set filearg-oc to true when 2 move urlarg to filearg move verbarg to urlarg when 3 evaluate verbarg when "-v" set verbose to true when "-vv" set veryverbose to true when other move 1 to verbosity end-evaluate end-evaluate *> null terminate the strings for C string urlarg delimited by space low-value delimited by size into curlurl end-string string filearg delimited by space low-value delimited by size into curlfile end-string *> parameters ready if verbose display "file: " function trim(filearg trailing) " from url: " function trim(urlarg trailing) end-display end-if *> let libcurl do all the hard work call "occurl_init" returning curl end-call. if veryverbose call "occurl_verbose" using by value curl by value verbosity end-call call "occurl_progress" using by value curl by value verbosity end-call end-if *> move zero to modtime, retrieve_file will test local modtime move 0 to modtime accept starttime from time end-accept call "occurl_retrieve_file" using by value curl by reference curlurl by reference curlfile by reference modtime returning result end-call if verbose accept endtime from time end-accept subtract starttime from endtime giving starttime end-subtract divide starttime by 100 giving starttime end-divide move starttime to showtime display "Done in " showtime end-display if result not = 0 display "result: " result " - " CURLEMSG(result) end-display end-if end-if call "occurl_cleanup" using by value curl end-call stop run giving result continue. exit program. [/code] Additional changes could be made for checking the given args (not more than 3, verbose-arg correct, ...) and for implementing a verbose-off mode. I would suggest the verbose arg as last parameter (so that it is optional) and url as 2nd arg (so that it is also optional). So that we get the following tectonics: *> cobcrun occurlrefresh [local filename] [url file] [-v | -vv] I would prefer using cobc -x but that's just the way I would compile and use it. ---------------------------------------------------------------- human; That's awesome. Yeah, I'm not proud of the cli argument parsing. Lots of holes and very resistant to changes and enhancements. But I didn't want to overwhelm the sample with something more professional. [i]Yeah ... that's my excuse ... really[/i] ;) Cheers, Brian ---------------------------------------------------------------- Would you take the modified sample if I would edit this as mentioned above? ---------------------------------------------------------------- human: [quote]Would you take the modified sample if I would edit this as mentioned above?[/quote] Absolutely! Your changes demonstrate some wicked good coding practices. And I was thinking; the progress display should really be part of verbose and not just the veryverbose sequence so that CALL could move out of the libcurl VERBOSE call conditional. Cheers, Brian ---------------------------------------------------------------- Hello everyone, After a few runs of the refresh program, I've changed the mode of operation a bit. Now defaults to display some of the run status. -v turns on the libcurl verbosity, -q makes the run quiet. Many thanks to aoirthoir for the updates too. Cheers, Brian [code] *> ************************************************************** *> * access libcurl to update current OC1.1 source archive *> ************************************************************** *> Authors: Brian Tiffin, Joseph James Frantz *> Dates: 22-July-2008, 29-July-2008 *> Purpose: Sample calls to occurl wrapper *> Wasn't designed to be called a binding *> Tectonics: gcc -c -Wall occurl.c *> cobc -x -lcurl occurlrefresh.cbl occurl.o *> ./occurlrefresh [-v|-q] [url file] [-v|-q url file] identification division. program-id. occurlrefresh. environment division. input-output section. data division. working-storage section. copy occurlsym. 01 args pic x(1024). 01 urlarg pic x(255). 88 urlarg-oc value 'http://www.sim-basis.de/open-cobol-1.1.tar.gz'. 01 filearg pic x(255). 88 filearg-oc value 'open-cobol-1.1.tar.gz'. 01 verbarg pic x(255). 01 argcount pic s9(9) comp-5. 01 verbosity pic 9(9) usage binary value 1. 88 quiet value 0. 88 verbose value 1 thru 2. 88 veryverbose value 2. local-storage section. 01 curl usage pointer. 01 result pic s9(9) comp-5. 01 curlurl pic x(256). 01 curlfile pic x(256). 01 starttime pic s9(7)v99 comp-5. 01 endtime pic s9(7)v99 comp-5. 01 showtime pic z(6)9.99. 01 modtime usage binary-c-long. *> Update the OC 1.1 tar if applicable by modification time procedure division. *> Pull any command line arguments accept args from command-line end-accept unstring args delimited by all spaces into verbarg urlarg filearg tallying in argcount end-unstring *> no args is still argcount 1 if verbarg equals spaces subtract 1 from argcount end-subtract end-if evaluate argcount when 0 set urlarg-oc to true set filearg-oc to true when 1 evaluate verbarg when "-q" set quiet to true when "-v" set veryverbose to true when other move 1 to verbosity end-evaluate set urlarg-oc to true set filearg-oc to true when 2 move urlarg to filearg move verbarg to urlarg when 3 evaluate verbarg when "-q" set quiet to true when "-v" set veryverbose to true when other move 1 to verbosity end-evaluate end-evaluate *> null terminate the strings for C string urlarg delimited by space low-value delimited by size into curlurl end-string string filearg delimited by space low-value delimited by size into curlfile end-string *> parameters ready if verbose display "file: " function trim(filearg trailing) " from url: " function trim(urlarg trailing) end-display end-if *> let libcurl do all the hard work call "occurl_init" returning curl end-call. *> Set some verbosity options if verbose call "occurl_progress" using by value curl by value verbosity end-call end-if if veryverbose call "occurl_verbose" using by value curl by value verbosity end-call end-if *> move zero to modtime, retrieve_file will test local modtime move 0 to modtime accept starttime from time end-accept call "occurl_retrieve_file" using by value curl by reference curlurl by reference curlfile by reference modtime returning result end-call if verbose accept endtime from time end-accept subtract starttime from endtime giving starttime end-subtract divide starttime by 100 giving starttime end-divide move starttime to showtime display "Done in " showtime end-display if result not = 0 display "result: " result " - " CURLEMSG(result) end-display end-if end-if call "occurl_cleanup" using by value curl end-call stop run giving result continue. exit program. [/code] ---------------------------------------------------------------- Hello Brian, While compiling, gcc notifies me : [code] gcc -Wall -c occurl.c occurl.c: In function ‘occurl_retrieve_file’: occurl.c:171: erreur: ‘CURLE_REMOTE_FILE_NOT_FOUND’ undeclared (first use in this function) occurl.c:171: erreur: (Each undeclared identifier is reported only once occurl.c:171: erreur: for each function it appears in.) occurl.c: In function ‘occurl_get_url’: occurl.c:228: erreur: ‘CURLE_REMOTE_FILE_NOT_FOUND’ undeclared (first use in this function) [/code] curl has been installed with debian etch distibution pakages. Regards Bear ---------------------------------------------------------------- I'll look into this, but this morning we are off to watch the Flugtag nutters drop their homemade "planes" into the Ottawa river. It may be libcurl version issue, but CURLE_REMOTE_FILE_NOT_FOUND should be in /usr/include/curl/curl.h Maybe I missed an instruction about installing libcurl_dev? More soon. Cheers ---------------------------------------------------------------- Re; missing error symbol. My /usr/include/curl/curl.h came in the libcurl4-openssl-dev package. I'll have to guess it's a versioning problem, as your compile doesn't trip on any of the CURLOPT... symbols. I'll update the tectonics or work out a different plan. Thanks for the heads up Bear. And a wierd part is that the NOT_FOUND return is really just a nicety wrapped on 404. Cheers ---------------------------------------------------------------- You're right Brian, Debian Etch has still libcurl3-*. Regards ---------------------------------------------------------------- Bear; How do you think this should proceed to the next baby step? Do I regress my libcurl dev copy to V3? Or is it ok to lead people to more recent builds? I think I'm ok with either path, but I'm not sure what everyone else might think about this kind of issue. Another question for everyone. Should a libcurl wrapper allow the callbacks to write to a memory buffer? Or is the filesystem an ok(ish) interface? The filesystem alleviates me trying to work out the best approach to interfacing OpenCOBOL to unknown quantities of RAM, streaming and all that hairyness. If rarely needed or used, I'd rather skip it ... for now. Cheers, Brian ---------------------------------------------------------------- I think harddisk is fine and should be able to be used. But a [u]possibility[/u] to give a pointer and a varlength would be fine. So we can do something like set libcurl_out_pointer to adress of myvar move length of myvar to libcurl_out_length set libcurl_in_pointer to adress of myvar2 move length of myvar2 to libcurl_in_length call libcurl using libcurl_pointers ---------------------------------------------------------------- Hello Brian, If we need to change something, its libcurl from repository. Don't regress. One of these days Debian will give us an upgrade ... Regards Bear ---------------------------------------------------------------- I was hoping you'd say that Bear. :) Oh, and human, thanks for the opinion on buffering things by the way. I'll be dipping in again this weekend. Cheers, Brian ---------------------------------------------------------------- Hey Bear, what about the buffering? I've tried with cygwin (packages curl and curl-devel needed) and used[code]cobc -c occurl.c cobc -x -lcurl occurlrefresh.cbl occurl.c ./occurlrefresh.exe[/code]works fine. ---------------------------------------------------------------- As part of a standardization push, all extensions are now requested to use an CBL_OC_XXXXX entry point naming convention. This will help as OpenCOBOL evolves into the future. So, that is CBL_OC_UPPERCASE_ENTRYPOINT These sources can be downloaded from http://oldsite.add1tocobol.com/tiki-list_file_gallery.php?galleryId=2 Tectonics are still the same; as the lowercase filenames are not as pressing an issue as consistent entry point naming. (Although that could change as we learn a little more). Cheers, Brian [i]Note: Added a hack to get round curl3-dev vs curl4-dev error code changes[/i] [b]occurl.c[/b] [code] /**********************************************************************/ /* wrap some common curl operations for use with OpenCOBOL 1.1 */ /* Author: Brian Tiffin */ /* Date: 21-July-2008, 24-Nov-2008 */ /* Version: 0.5 */ /* Purpose: Provide some net access to OpenCOBOL */ /* Tectonics: gcc -c occurl.c */ /* with libcurl dev installed */ /**********************************************************************/ #include #include #include /* A release bump changed/merged some error codes, and this is a hack */ #ifndef CURLE_REMOTE_FILE_NOT_FOUND #define CURLE_REMOTE_FILE_NOT_FOUND 78 #endif /* Support structure for the file callbacks */ struct LocalFileStruc { const char *filename; FILE *stream; }; /* Progress tracking */ double *Bar; /* libcurl call back for file write */ static size_t wrap_fwrite(void *buffer, size_t size, size_t nmemb, void *stream) { struct LocalFileStruc *out=(struct LocalFileStruc *)stream; if(out && !out->stream) { /* open file for writing */ out->stream=fopen(out->filename, "wb"); if(!out->stream) return 0; /* failure, can't open file to write */ } return fwrite(buffer, size, nmemb, out->stream); } /* Progress */ int progress_callback(char *Bar, double t, double d, double ultotal, double ulnow) { int oe; double val; if (t == 0) t = 1.0; val = d / t * 100; oe = (int)val; if (oe & 1) { putc('\\', stdout); } else { putc('/', stdout); } printf("%03.0f%%\b\b\b\b\b\b\b\b", val); fflush(stdout); return 0; } /* Routines to get and release CURL handles from OpenCOBOL */ /* Usage: */ /* DATA DIVISION. */ /* 01 handle usage is pointer. */ /* PROCEDURE DIVISION. */ /* CALL "occurl_init" RETURNING handle. */ CURL* CBL_OC_CURL_INIT() { return curl_easy_init(); } /* Usage: */ /* CALL "occurl_cleanup" USING BY VALUE handle. */ void CBL_OC_CURL_CLEANUP(CURL *curl) { curl_easy_cleanup(curl); } /* Set verbosity */ /* Usage: vflag being 0 or 1 */ /* CALL "CBL_OC_CURL_VERBOSE" USING BY VALUE vflag. */ void CBL_OC_CURL_VERBOSE(CURL *curl, int vflag) { /* Switch on or off full protocol/debug output */ if (curl) { curl_easy_setopt(curl, CURLOPT_VERBOSE, (long)vflag); } } /* Set progress display on/off */ /* Usage: pflag being 0 or 1 */ /* CALL "CBL_OC_CURL_PROGRESS" USING BY VALUE pflag. */ void CBL_OC_CURL_PROGRESS(CURL *curl, int pflag) { /* Switch on or off progress display */ if (curl) { if (pflag) { curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L); curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_callback); curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &Bar); } else { curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L); curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, NULL); curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, NULL); } } } /* Ease of use; check mod-times, if since then read url, write to file */ /* Retrieve URL and save to local file after checking timestamps */ /* Usage: */ /* DATA DIVISION. */ /* 01 handle USAGE IS POINTER. */ /* 01 url. */ /* 02 urlname PIC x(21) VALUE "http://opencobol.org/". */ /* 02 filler PIC x VALUE X"00". */ /* 01 filename */ /* 02 PIC x(). */ /* 02 filler pic x value low-value. */ /* 01 modtime USAGE IS BINARY-C-LONG */ /* PROCEDURE DIVISION. */ /* CALL "CBL_OC_CURL_RETRIEVE_FILE" USING BY VALUE handle */ /* BY REFERENCE url */ /* BY REFERENCE filename */ /* BY REFERENCE modtime */ /* RETURNING result. */ /* Pass modtime of 0 to get local mtime field, */ /* modtime is modified with value from url if available */ int CBL_OC_CURL_RETRIEVE_FILE(CURL *curl, char *url, char *file, long *modtime) { CURLcode res; long urlstamp; struct stat st; struct LocalFileStruc localfile={ "occurl.default", /* default filename */ NULL /* stream */ }; /* point to the COBOL passed filename */ if (file) { localfile.filename = file; } /* if modtime is zero, get local file modtime */ if (*modtime == 0) { if (stat (file, &st) == 0) { *modtime = st.st_mtime; } } /* let libcurl do all the real work */ if (curl) { curl_easy_setopt(curl, CURLOPT_URL, url); /* Only fetch new */ curl_easy_setopt(curl, CURLOPT_FILETIME, 1L); curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE); curl_easy_setopt(curl, CURLOPT_TIMEVALUE, *modtime); /* Define our callback to get called when there's data to be written */ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, wrap_fwrite); /* Set a pointer to our struct to pass to the callback */ curl_easy_setopt(curl, CURLOPT_WRITEDATA, &localfile); /* After all the setopts, perform the operation */ res = curl_easy_perform(curl); /* close off any file pointers */ if (localfile.stream) { fclose(localfile.stream); /* close the local file */ } /* return error results */ if (res != 0) { return (int)res; } /* retrieve response code */ res = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &urlstamp); if (res != 0) { return (int)res; } else { if (urlstamp == 404) { return CURLE_REMOTE_FILE_NOT_FOUND; } } /* retrieve filetime for return value */ res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &urlstamp); if (res != 0) { return (int)res; } else { *modtime = urlstamp; return 0; } } else { return CURLE_FAILED_INIT; } return 0; } /* Fetch a url to a local file */ int CBL_OC_CURL_GET_URL(CURL *curl, char *theurl, char *thefile) { CURLcode res; long urlstamp; struct LocalFileStruc localfile = { "occurl.default", /* default filename */ NULL /* stream */ }; /* point to the COBOL field */ localfile.filename = thefile; if (curl) { curl_easy_setopt(curl, CURLOPT_URL, theurl); curl_easy_setopt(curl, CURLOPT_FILETIME, 1L); /* Define our callback to get called when there's data to be written */ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, wrap_fwrite); /* Set a pointer to our struct to pass to the callback */ curl_easy_setopt(curl, CURLOPT_WRITEDATA, &localfile); res = curl_easy_perform(curl); /* close the local file */ if (localfile.stream) { fclose(localfile.stream); } /* return error results */ if (res != 0) { return (int)res; } /* retrieve response code */ res = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &urlstamp); if (res != 0) { return (int)res; } else { if (urlstamp == 404) { return CURLE_REMOTE_FILE_NOT_FOUND; } } } else { return CURLE_FAILED_INIT; } return 0; } /* The plan is to return a structure with all curl INFO fields filled */ int CBL_OC_CURL_GETINFO(CURL *curl, char *theurl, char *thedata) { CURLcode res; long urlstamp; if (curl) { curl_easy_setopt(curl, CURLOPT_URL, theurl); res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &urlstamp); } else { return -1; } return (int)res; } [/code] [b]occurlrefresh.cbl[/b] [code] *> ************************************************************** *> * access libcurl to update current OC1.1 source archive *> ************************************************************** *> Authors: Brian Tiffin, Joseph James Frantz *> Dates: 22-July-2008, 29-July-2008, 19-November-2008 *> Purpose: Sample calls to occurl wrapper *> Wasn't designed to be called a binding *> Tectonics: cobc -c -Wall occurl.c *> cobc -x -lcurl occurlrefresh.cbl occurl.o *> ./occurlrefresh [-v|-q] [url file] [-v|-q url file] identification division. program-id. occurlrefresh. environment division. input-output section. data division. working-storage section. copy occurlsym. 78 newline value x"0a". 01 args pic x(1024). 01 urlarg pic x(255). 88 urlarg-oc value 'http://www.sim-basis.de/open-cobol-1.1.tar.gz'. 01 filearg pic x(255). 88 filearg-oc value 'open-cobol-1.1.tar.gz'. 01 verbarg pic x(255). 01 argcount pic s9(9) comp-5. 01 verbosity pic 9(9) usage binary value 1. 88 quiet value 0. 88 verbose value 1 thru 2. 88 veryverbose value 2. local-storage section. 01 curl usage pointer. 01 result pic s9(9) comp-5. 01 curlurl pic x(256). 01 curlfile pic x(256). 01 starttime pic s9(7)v99 comp-5. 01 endtime pic s9(7)v99 comp-5. 01 showtime pic z(6)9.99. 01 modtime usage binary-c-long. *> Update the OC 1.1 tar if applicable by modification time procedure division. *> Pull any command line arguments accept args from command-line end-accept unstring args delimited by all spaces into verbarg urlarg filearg tallying in argcount end-unstring *> no args is still argcount 1 if verbarg equals spaces subtract 1 from argcount end-subtract end-if evaluate argcount when 0 set urlarg-oc to true set filearg-oc to true when 1 evaluate verbarg when "-q" set quiet to true when "-v" set veryverbose to true when other move 1 to verbosity end-evaluate set urlarg-oc to true set filearg-oc to true when 2 move urlarg to filearg move verbarg to urlarg when 3 evaluate verbarg when "-q" set quiet to true when "-v" set veryverbose to true when other move 1 to verbosity end-evaluate end-evaluate *> null terminate the strings for C string urlarg delimited by space low-value delimited by size into curlurl end-string string filearg delimited by space low-value delimited by size into curlfile end-string *> parameters ready if verbose display "file: " function trim(filearg trailing) " from url: " function trim(urlarg trailing) end-display end-if *> let libcurl do all the hard work call "CBL_OC_CURL_INIT" returning curl end-call. *> Set some verbosity options if verbose call "CBL_OC_CURL_PROGRESS" using by value curl by value verbosity end-call end-if if veryverbose call "CBL_OC_CURL_VERBOSE" using by value curl by value verbosity end-call end-if *> move zero to modtime, retrieve_file will test local modtime move 0 to modtime accept starttime from time end-accept call "CBL_OC_CURL_RETRIEVE_FILE" using by value curl by reference curlurl by reference curlfile by reference modtime returning result end-call if verbose accept endtime from time end-accept subtract starttime from endtime giving starttime end-subtract divide starttime by 100 giving starttime end-divide move starttime to showtime display newline "Done in " showtime end-display if result not = 0 display "result: " result " - " CURLEMSG(result) end-display end-if end-if call "CBL_OC_CURL_CLEANUP" using by value curl end-call stop run giving result continue. exit program. [/code] [b]occurlsym.cpy[/b] [code] *> manifest constants for libcurl *> Usage: COPY occurlsym inside data division *> Result codes 78 CURLE_OK VALUE 0. *> Error codes 78 CURLE_UNSUPPORTED_PROTOCOL VALUE 1. 78 CURLE_FAILED_INIT VALUE 2. 78 CURLE_URL_MALFORMAT VALUE 3. 78 CURLE_OBSOLETE4 VALUE 4. 78 CURLE_COULDNT_RESOLVE_PROXY VALUE 5. 78 CURLE_COULDNT_RESOLVE_HOST VALUE 6. 78 CURLE_COULDNT_CONNECT VALUE 7. 78 CURLE_FTP_WEIRD_SERVER_REPLY VALUE 8. 78 CURLE_REMOTE_ACCESS_DENIED VALUE 9. 78 CURLE_OBSOLETE10 VALUE 10. 78 CURLE_FTP_WEIRD_PASS_REPLY VALUE 11. 78 CURLE_OBSOLETE12 VALUE 12. 78 CURLE_FTP_WEIRD_PASV_REPLY VALUE 13. 78 CURLE_FTP_WEIRD_227_FORMAT VALUE 14. 78 CURLE_FTP_CANT_GET_HOST VALUE 15. 78 CURLE_OBSOLETE16 VALUE 16. 78 CURLE_FTP_COULDNT_SET_TYPE VALUE 17. 78 CURLE_PARTIAL_FILE VALUE 18. 78 CURLE_FTP_COULDNT_RETR_FILE VALUE 19. 78 CURLE_OBSOLETE20 VALUE 20. 78 CURLE_QUOTE_ERROR VALUE 21. 78 CURLE_HTTP_RETURNED_ERROR VALUE 22. 78 CURLE_WRITE_ERROR VALUE 23. 78 CURLE_OBSOLETE24 VALUE 24. 78 CURLE_UPLOAD_FAILED VALUE 25. 78 CURLE_READ_ERROR VALUE 26. 78 CURLE_OUT_OF_MEMORY VALUE 27. 78 CURLE_OPERATION_TIMEDOUT VALUE 28. 78 CURLE_OBSOLETE29 VALUE 29. 78 CURLE_FTP_PORT_FAILED VALUE 30. 78 CURLE_FTP_COULDNT_USE_REST VALUE 31. 78 CURLE_OBSOLETE32 VALUE 32. 78 CURLE_RANGE_ERROR VALUE 33. 78 CURLE_HTTP_POST_ERROR VALUE 34. 78 CURLE_SSL_CONNECT_ERROR VALUE 35. 78 CURLE_BAD_DOWNLOAD_RESUME VALUE 36. 78 CURLE_FILE_COULDNT_READ_FILE VALUE 37. 78 CURLE_LDAP_CANNOT_BIND VALUE 38. 78 CURLE_LDAP_SEARCH_FAILED VALUE 39. 78 CURLE_OBSOLETE40 VALUE 40. 78 CURLE_FUNCTION_NOT_FOUND VALUE 41. 78 CURLE_ABORTED_BY_CALLBACK VALUE 42. 78 CURLE_BAD_FUNCTION_ARGUMENT VALUE 43. 78 CURLE_OBSOLETE44 VALUE 44. 78 CURLE_INTERFACE_FAILED VALUE 45. 78 CURLE_OBSOLETE46 VALUE 46. 78 CURLE_TOO_MANY_REDIRECTS VALUE 47. 78 CURLE_UNKNOWN_TELNET_OPTION VALUE 48. 78 CURLE_TELNET_OPTION_SYNTAX VALUE 49. 78 CURLE_OBSOLETE50 VALUE 50. 78 CURLE_PEER_FAILED_VERIFICATION VALUE 51. 78 CURLE_GOT_NOTHING VALUE 52. 78 CURLE_SSL_ENGINE_NOTFOUND VALUE 53. 78 CURLE_SSL_ENGINE_SETFAILED VALUE 54. 78 CURLE_SEND_ERROR VALUE 55. 78 CURLE_RECV_ERROR VALUE 56. 78 CURLE_OBSOLETE57 VALUE 57. 78 CURLE_SSL_CERTPROBLEM VALUE 58. 78 CURLE_SSL_CIPHER VALUE 59. 78 CURLE_SSL_CACERT VALUE 60. 78 CURLE_BAD_CONTENT_ENCODING VALUE 61. 78 CURLE_LDAP_INVALID_URL VALUE 62. 78 CURLE_FILESIZE_EXCEEDED VALUE 63. 78 CURLE_USE_SSL_FAILED VALUE 64. 78 CURLE_SEND_FAIL_REWIND VALUE 65. 78 CURLE_SSL_ENGINE_INITFAILED VALUE 66. 78 CURLE_LOGIN_DENIED VALUE 67. 78 CURLE_TFTP_NOTFOUND VALUE 68. 78 CURLE_TFTP_PERM VALUE 69. 78 CURLE_REMOTE_DISK_FULL VALUE 70. 78 CURLE_TFTP_ILLEGAL VALUE 71. 78 CURLE_TFTP_UNKNOWNID VALUE 72. 78 CURLE_REMOTE_FILE_EXISTS VALUE 73. 78 CURLE_TFTP_NOSUCHUSER VALUE 74. 78 CURLE_CONV_FAILED VALUE 75. 78 CURLE_CONV_REQD VALUE 76. 78 CURLE_SSL_CACERT_BADFILE VALUE 77. 78 CURLE_REMOTE_FILE_NOT_FOUND VALUE 78. 78 CURLE_SSH VALUE 79. 78 CURLE_SSL_SHUTDOWN_FAILED VALUE 80. 78 CURLE_AGAIN VALUE 81. *> Error strings 01 LIBCURL_ERRORS. 02 CURLEVALUES. 03 FILLER PIC X(30) VALUE "CURLE_UNSUPPORTED_PROTOCOL ". 03 FILLER PIC X(30) VALUE "CURLE_FAILED_INIT ". 03 FILLER PIC X(30) VALUE "CURLE_URL_MALFORMAT ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE4 ". 03 FILLER PIC X(30) VALUE "CURLE_COULDNT_RESOLVE_PROXY ". 03 FILLER PIC X(30) VALUE "CURLE_COULDNT_RESOLVE_HOST ". 03 FILLER PIC X(30) VALUE "CURLE_COULDNT_CONNECT ". 03 FILLER PIC X(30) VALUE "CURLE_FTP_WEIRD_SERVER_REPLY ". 03 FILLER PIC X(30) VALUE "CURLE_REMOTE_ACCESS_DENIED ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE10 ". 03 FILLER PIC X(30) VALUE "CURLE_FTP_WEIRD_PASS_REPLY ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE12 ". 03 FILLER PIC X(30) VALUE "CURLE_FTP_WEIRD_PASV_REPLY ". 03 FILLER PIC X(30) VALUE "CURLE_FTP_WEIRD_227_FORMAT ". 03 FILLER PIC X(30) VALUE "CURLE_FTP_CANT_GET_HOST ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE16 ". 03 FILLER PIC X(30) VALUE "CURLE_FTP_COULDNT_SET_TYPE ". 03 FILLER PIC X(30) VALUE "CURLE_PARTIAL_FILE ". 03 FILLER PIC X(30) VALUE "CURLE_FTP_COULDNT_RETR_FILE ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE20 ". 03 FILLER PIC X(30) VALUE "CURLE_QUOTE_ERROR ". 03 FILLER PIC X(30) VALUE "CURLE_HTTP_RETURNED_ERROR ". 03 FILLER PIC X(30) VALUE "CURLE_WRITE_ERROR ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE24 ". 03 FILLER PIC X(30) VALUE "CURLE_UPLOAD_FAILED ". 03 FILLER PIC X(30) VALUE "CURLE_READ_ERROR ". 03 FILLER PIC X(30) VALUE "CURLE_OUT_OF_MEMORY ". 03 FILLER PIC X(30) VALUE "CURLE_OPERATION_TIMEDOUT ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE29 ". 03 FILLER PIC X(30) VALUE "CURLE_FTP_PORT_FAILED ". 03 FILLER PIC X(30) VALUE "CURLE_FTP_COULDNT_USE_REST ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE32 ". 03 FILLER PIC X(30) VALUE "CURLE_RANGE_ERROR ". 03 FILLER PIC X(30) VALUE "CURLE_HTTP_POST_ERROR ". 03 FILLER PIC X(30) VALUE "CURLE_SSL_CONNECT_ERROR ". 03 FILLER PIC X(30) VALUE "CURLE_BAD_DOWNLOAD_RESUME ". 03 FILLER PIC X(30) VALUE "CURLE_FILE_COULDNT_READ_FILE ". 03 FILLER PIC X(30) VALUE "CURLE_LDAP_CANNOT_BIND ". 03 FILLER PIC X(30) VALUE "CURLE_LDAP_SEARCH_FAILED ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE40 ". 03 FILLER PIC X(30) VALUE "CURLE_FUNCTION_NOT_FOUND ". 03 FILLER PIC X(30) VALUE "CURLE_ABORTED_BY_CALLBACK ". 03 FILLER PIC X(30) VALUE "CURLE_BAD_FUNCTION_ARGUMENT ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE44 ". 03 FILLER PIC X(30) VALUE "CURLE_INTERFACE_FAILED ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE46 ". 03 FILLER PIC X(30) VALUE "CURLE_TOO_MANY_REDIRECTS ". 03 FILLER PIC X(30) VALUE "CURLE_UNKNOWN_TELNET_OPTION ". 03 FILLER PIC X(30) VALUE "CURLE_TELNET_OPTION_SYNTAX ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE50 ". 03 FILLER PIC X(30) VALUE "CURLE_PEER_FAILED_VERIFICATION". 03 FILLER PIC X(30) VALUE "CURLE_GOT_NOTHING ". 03 FILLER PIC X(30) VALUE "CURLE_SSL_ENGINE_NOTFOUND ". 03 FILLER PIC X(30) VALUE "CURLE_SSL_ENGINE_SETFAILED ". 03 FILLER PIC X(30) VALUE "CURLE_SEND_ERROR ". 03 FILLER PIC X(30) VALUE "CURLE_RECV_ERROR ". 03 FILLER PIC X(30) VALUE "CURLE_OBSOLETE57 ". 03 FILLER PIC X(30) VALUE "CURLE_SSL_CERTPROBLEM ". 03 FILLER PIC X(30) VALUE "CURLE_SSL_CIPHER ". 03 FILLER PIC X(30) VALUE "CURLE_SSL_CACERT ". 03 FILLER PIC X(30) VALUE "CURLE_BAD_CONTENT_ENCODING ". 03 FILLER PIC X(30) VALUE "CURLE_LDAP_INVALID_URL ". 03 FILLER PIC X(30) VALUE "CURLE_FILESIZE_EXCEEDED ". 03 FILLER PIC X(30) VALUE "CURLE_USE_SSL_FAILED ". 03 FILLER PIC X(30) VALUE "CURLE_SEND_FAIL_REWIND ". 03 FILLER PIC X(30) VALUE "CURLE_SSL_ENGINE_INITFAILED ". 03 FILLER PIC X(30) VALUE "CURLE_LOGIN_DENIED ". 03 FILLER PIC X(30) VALUE "CURLE_TFTP_NOTFOUND ". 03 FILLER PIC X(30) VALUE "CURLE_TFTP_PERM ". 03 FILLER PIC X(30) VALUE "CURLE_REMOTE_DISK_FULL ". 03 FILLER PIC X(30) VALUE "CURLE_TFTP_ILLEGAL ". 03 FILLER PIC X(30) VALUE "CURLE_TFTP_UNKNOWNID ". 03 FILLER PIC X(30) VALUE "CURLE_REMOTE_FILE_EXISTS ". 03 FILLER PIC X(30) VALUE "CURLE_TFTP_NOSUCHUSER ". 03 FILLER PIC X(30) VALUE "CURLE_CONV_FAILED ". 03 FILLER PIC X(30) VALUE "CURLE_CONV_REQD ". 03 FILLER PIC X(30) VALUE "CURLE_SSL_CACERT_BADFILE ". 03 FILLER PIC X(30) VALUE "CURLE_REMOTE_FILE_NOT_FOUND ". 03 FILLER PIC X(30) VALUE "CURLE_SSH ". 03 FILLER PIC X(30) VALUE "CURLE_SSL_SHUTDOWN_FAILED ". 03 FILLER PIC X(30) VALUE "CURLE_AGAIN ". 01 FILLER REDEFINES LIBCURL_ERRORS. 02 CURLEMSG OCCURS 81 TIMES PIC X(30). [/code] ---------------------------------------------------------------- Brian, there is one thing missing: a message that open-cobol-1.1.tar.gz is recent / that there is no newer open-cobol-1.1.tar.gz on the server. Can you implement this? ---------------------------------------------------------------- Yep. The next update of occurlrefresh will include a notice of nothing new and command line argument(s) to attempt an extract and build. With recent developments in the compiler technology, the progress indicator can now be an exposed callback and we can use COBOL for the \/ twiddle bits. Yippee. For now, I've changed this version a little bit to add a newline (x"0a") to the DISPLAY "Done in" phrase, so at least you can still see the 0% complete; which (usually) means nothing new. I'd almost like to use the Regina Rexx layer for the extract and build; but as things are all still too new, it'll probably be CALL "SYSTEM" and POSIX shell commands. Written in my normal; close eyes, clod through and believe everything will work style. ;) Cheers ---------------------------------------------------------------- Is there already a "next update [with included] notice of nothing new"? I'd like to see have different return values according to done=0, error=1, nothing to update=2, error in external call (extract/build) = 3 ... Different call SYSTEM would be fine, let the OS/tools do the work. Just some suggestions. human ---------------------------------------------------------------- As I am working on a nice update-oc.sh where I'd like to include occurlrefresh I ask again. [quote] human wrote: Is there already a "next update [with included] notice of nothing new"? I'd like to see have different return values according to done=0, error=1, nothing to update=2, error in external call (extract/build) = 3 ...[/quote] Along with that I'd like to vote for two additional commands --version/-v for version information and --help/-h/-? for usage of the program itself. human ---------------------------------------------------------------- human; Sorry for missing this before. Yeah, good ideas. I'll get a chance to update occurlrefresh to use John's uber cool command line argument idiom. In the meanwhile. Here is a hacked up version I was horsing around with. (Not quite right yet, but it has a little screen section in it). [code] *> ************************************************************** *> * access libcurl to update current OC1.1 source archive *> ************************************************************** *> Authors: Brian Tiffin, Joseph James Frantz *> Dates: 22-Jul-2008, 29-Jul-2008, 19-Nov-2008, 22-Jan-2009 *> Purpose: Sample calls to occurl wrapper to fetch OC1.1 tar *> Wasn't designed to be called a binding *> Tectonics: cobc -c -Wall occurl.c *> cobc -x -lcurl occurlrefresh.cbl occurl.o *> ./occurlrefresh [-v|-q|-b] [url file] [-v|-q url file] replace ==#display-attributes#== by ==background-color 7 foreground-color 0==. identification division. program-id. occurlrefresh. data division. working-storage section. copy occurlsym. 01 newline constant as x"0a". 01 args pic x(1024). 01 urlarg pic x(255). 88 urlarg-oc value 'http://www.sim-basis.de/open-cobol-1.1.tar.gz'. 01 filearg pic x(255). 88 filearg-oc value 'open-cobol-1.1.tar.gz'. 01 verbarg pic x(255). 01 argcount pic s9(9) comp-5. 01 verbosity pic 9(9) usage binary value 1. 88 quiet value 0. 88 verbose value 1 thru 2. 88 veryverbose value 2. 01 builder pic 9 usage binary value 0. 88 building value 1. 01 buildit pic x. 01 hitanykey pic x. local-storage section. 01 curl usage pointer. 01 result pic s9(9) comp-5. 01 curlurl pic x(256). 01 curlfile pic x(256). 01 starttime pic s9(7)v99 comp-5. 01 endtime pic s9(7)v99 comp-5. 01 showtime pic z(6)9.99. 01 modtime usage binary-c-long. 01 progress-callback-pointer usage procedure-pointer. *> Update the OC 1.1 tar if applicable by modification time procedure division. *> Pull any command line arguments accept args from command-line end-accept unstring args delimited by all spaces into verbarg urlarg filearg tallying in argcount end-unstring *> no args is still argcount 1 if verbarg equals spaces subtract 1 from argcount end-subtract end-if evaluate argcount when 0 set urlarg-oc to true set filearg-oc to true when 1 evaluate verbarg when "--help" perform helping when "-h" perform helping when "-q" set quiet to true when "-v" set veryverbose to true when "-b" set building to true move 1 to verbosity when other move 1 to verbosity end-evaluate set urlarg-oc to true set filearg-oc to true when 2 move urlarg to filearg move verbarg to urlarg when 3 evaluate verbarg when "--help" perform helping when "-h" perform helping when "-q" set quiet to true when "-v" set veryverbose to true when other move 1 to verbosity end-evaluate end-evaluate *> null terminate the strings for C string urlarg delimited by space low-value delimited by size into curlurl end-string string filearg delimited by space low-value delimited by size into curlfile end-string *> parameters ready if verbose display function concatenate ( "file: " function trim(filearg trailing) " from url: " function trim(urlarg trailing) ) at 0101 with #display-attributes# blank screen end-display end-if *> let libcurl do all the hard work call "CBL_OC_CURL_INIT" returning curl end-call. *> point to the progress callback set progress-callback-pointer to address of program "progress-callback" *> Set some verbosity options if verbose call "CBL_OC_CURL_PROGRESS" using by value curl by value verbosity by value progress-callback-pointer end-call end-if if veryverbose call "CBL_OC_CURL_VERBOSE" using by value curl by value verbosity end-call end-if *> move zero to modtime, retrieve_file will test local modtime move 0 to modtime accept starttime from time end-accept call "CBL_OC_CURL_RETRIEVE_FILE" using by value curl by reference curlurl by reference curlfile by reference modtime returning result end-call *> report the results if verbose accept endtime from time end-accept subtract starttime from endtime giving starttime end-subtract divide starttime by 100 giving starttime end-divide move starttime to showtime display function concatenate( "Done in " showtime) at 0301 with #display-attributes# end-display if result not = 0 display "result: " result " - " CURLEMSG(result) end-display end-if end-if *> release the libcurl resources call "CBL_OC_CURL_CLEANUP" using by value curl end-call *> if results not good, end the run if result not = 0 stop run returning result end-if *> if building, call the system to configure and make OC if building display "Do a build? (y/N):" with no advancing end-display accept buildit end-accept if function upper-case(buildit) = "Y" call "SYSTEM" using by reference function concatenate( "mv open-cobol-1.1 open-cobol-1.1-" function current-date(1:14) "; tar xvf "; function trim(filearg trailing); " && cd open-cobol-1.1" " && ./configure && make") returning result if result not = 0 stop run returning result end-if display "OpenCOBOL 1.1 ready to install in open-cobol-1.1" end-display end-if end-if *> we're done display "Hit any key..." at 0401 with #display-attributes# end-display *> Rely on fact that curses still active call "noecho" end-call call "cbreak" end-call call "getch" end-call move result to return-code goback. *> the help paragraph helping. display "./occurlrefresh [-h|-v|-q|-b] [url file]" & " [-h|-v|-q url file]" end-display display "Where: -h or --help displays this help" end-display display " -v turns on maximum verbosity" end-display display " -q turns off output" end-display display " -b builds OpenCOBOL" end-display display "Defaults are:" end-display set urlarg-oc to true set filearg-oc to true display " url: " function trim(urlarg) end-display display " file: " function trim(filearg) end-display display "build in: open-cobol-1.1 " & "archive in open-cobol-1.1-YYYMMDDhhmmss" end-display move 0 to return-code goback. *> *************************************************************** end program occurlrefresh. *> *************************************************************** *> Author: Brian Tiffin *> Date: 20090313 *> Purpose: callback for progress display *> *************************************************************** identification division. program-id. progress-callback. data division. working-storage section. 01 percent pic 999v99. 01 progress pic 999. 01 progress-bar pic x(51) value all "+". 01 display-bar pic x(51) value spaces. local-storage section. linkage section. 01 bar usage float-long. 01 dltotal usage float-long. 01 dlnow usage float-long. 01 ultotal usage float-long. 01 ulnow usage float-long. *> *************************************************************** procedure division using by value size 4 bar by value size 8 dltotal by value size 8 dlnow by value size 8 ultotal by value size 8 ulnow. compute percent = dlnow / dltotal * 100. move percent to progress move progress-bar ( 1 : 1 + percent / 2) to display-bar display progress at 0201 with #display-attributes# end-display display display-bar at 0205 with #display-attributes# end-display goback. end program progress-callback. [/code] [b]N.B.[/b] a work in progress. But when finished will allow for 'nothing to update' status. (COBOL can now tell by the values in the progress callback as to how much work was done). More soon. Cheers, Brian ---------------------------------------------------------------- Sounds good, I'll wait (hopefully not too long). Please take care that the program is still able to run without advanced DISPLAY/ACCEPT and without any Screen-IO at all (maybe by using special switches). Switches for help and version number would be nice, too. What "uber cool command line argument idiom" are you talking about? Is it even able to recognize GNU/UNIX/whatever command line abbreviations (If you have switches that are longer than 1 char, you only have to use only so much chars that they distinguish between all possible switches [like you have in OC with -f --> too short -fr (-free) -fi (fixed)])? human ---------------------------------------------------------------- For command-line, http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=419&forum=1#forumpost2240 It's not at a level of getopts or anything, but it's a handy way of handling arguments and not worrying too too much about order etc... Cheers, Brian ---------------------------------------------------------------- Subject: Stream files and a silly marquee Hello everyone. Another sample. This demonstrates the CBL_OPEN_FILE and CBL_READ_FILE byte stream file operations. And just for fun, wraps it in a marquee style screen section. As always, please feel free to critique (ruthlessly). Cheers, Brian [code] >>SOURCE FORMAT IS FIXED * Author: Brian Tiffin * Date: 25-July-2008 * Purpose: Demonstrate OpenCOBOL byte stream files * Tectonics: cobc -x streams.cbl identification division. program-id. streams. environment division. configuration section. special-names. crt status is user-control. data division. working-storage section. 78 READ-ONLY value 1. 78 WRITE-ONLY value 2. 78 READ-WRITE value 3. 01 filehandle usage is pointer. 01 filename pic x(40). 01 cfile pic x(41). 01 access-mode usage binary-long. 01 file-lock pic x. 01 device pic x. 01 result usage binary-long. 01 file-offset pic 9(18) comp. 01 read-length pic 9(8) comp. 01 file-flags binary-char. 01 read-buffer pic x(40). 01 marquee pic x(40). 01 marquee-limit pic 9(4). 01 operation-status pic s9(9). 01 user-control pic 9(4). 01 exit-message pic x(10) value spaces. screen section. 01 file-screen. 05 blank screen. 05 line 1 column 24 value "OpenCOBOL byte stream files". 05 line 3 column 10 value "File:". 05 line 3 column 19 using filename pic x(40). 05 line 3 column 62 from operation-status pic s9(9). 05 line 4 column 10 value "limit:". 05 line 4 column 19 using marquee-limit pic 9(4). 05 line 4 column 30 value "<- limits marquee loop". 05 line 6 column 19 from marquee pic x(40) reverse-video. 05 line 7 column 19 pic x(10) from exit-message. 05 line 7 column 30 pic 9(4) from user-control. ****************************************************************** procedure division. move "streams.cbl" to filename. move 128 to marquee-limit. move -1 to operation-status. accept file-screen end-accept. if user-control not = 0 move "Leaving..." to exit-message display file-screen end-display call "C$SLEEP" using "2" end-call goback end-if. move READ-ONLY to access-mode. string filename delimited by space low-value delimited by size into cfile end-string. call "CBL_OPEN_FILE" using cfile access-mode file-lock device filehandle returning result end-call. move result to operation-status. display file-screen end-display. * This debug section demonstrates the file-flags option * If 128 is in file-flags, CBL_READ_FILE will place * the actual file length into the file-offset field on * completion of the read. Dmove 0 to file-offset. Dmove 32 to read-length. Dmove 128 to file-flags. Ddisplay "Result: " result ", " file-offset ", " D read-length ", " read-buffer Dend-display. Dcall "CBL_READ_FILE" using filehandle D file-offset D read-length D file-flags D read-buffer D returning result. Ddisplay "Result: " result ", " file-offset ", " D read-length ", " read-buffer Dend-display. display file-screen end-display. move 0 to file-flags. move 40 to read-length. perform varying file-offset from 0 by 1 until (operation-status not = 0) or (file-offset > marquee-limit) call "CBL_READ_FILE" using filehandle file-offset read-length file-flags read-buffer returning operation-status end-call move read-buffer to marquee inspect marquee replacing all x"0d0a" by " " inspect marquee replacing all x"0a" by space display file-screen end-display call "CBL_OC_NANOSLEEP" using 170000000 end-call end-perform call "CBL_CLOSE_FILE" using filehandle returning result end-call. move result to operation-status. move "Leaving..." to exit-message. display file-screen end-display. call "C$SLEEP" using "2" end-call. goback. exit program. [/code] ---------------------------------------------------------------- Subject: Advocacy. Dealing with TOTALLY misleading blogs? So, how do you fight the uninformed unwashed masses? :) http://duckdown.blogspot.com/2008/06/mainframe-is-not-evil-but-cobol-is.html The blog entry is being referenced by other bloggers. What a joke. It's like a round of mickeysoft FUD all over again. Arrggg. The fourth bullet point subtly linking COBOL to buffer overflow attacks. Arrrgghhh!!! And the last point about counting the lines of a COBOL Hello World program. An "enterprise architect" that can't count to 4. Yeah, hire that guy to analyze your business ... [i]into the ground[/i]. Use Java? 50 years from now you'd still be using corporate level Java? And that will make your life soooo much better than keeping legacy COBOL? Joke. It's not that ANY programming languages are bad, it's the [i]chase the technology ... it will save us![/i] mentality that gets under my skin. ALL programming is cool and can be done well, built to last, or it can be a podge; built to be rebuilt. Thinking that a code base needs to be replaced [i]just because[/i] or [i]it might be hard to maintain or change[/i], is bad business imho. I lived through an era of "retooling" to C++. 30 million dollar FAIL. The polyFORTH (and sister COBOL project) applications still run ... 21 years (and multiple attempts at replacement) later. And it's oooh so hurtful to the IT bottom line. Nothing like the oh so profitable 30 million dollar FAIL. Joke. Sorry for the rant folks, but I had to unload somewhere. Cheers, Brian :-) ---------------------------------------------------------------- Subject: /usr/bin/ld: cannot find -ldb Hi, some times ago I installed your cobc and I used this with success and with satisfaction until few weeks ago. but today I can not more compile my cobol sources because this error: danilo@quad-desktop:~/x_cvastoj/cvastoj_src$ cobc -version cobc (OpenCOBOL) 1.1.0 Build date May 14 2008 13:55:45 Copyright (C) 2001-2008 Keisuke Nishida / Roger While danilo@quad-desktop:~/x_cvastoj/cvastoj_src$ cobc -x -o /home/danilo/x_cvastoj/cvastoj/{crtjcl.lst} crtjcl.cbl /usr/bin/ld: cannot find -ldb collect2: ld returned 1 exit status danilo@quad-desktop:~/x_cvastoj/cvastoj_src$ do You know what for? and the solution? my OS is linux ubuntu 8.04 (x86) thanks in advance for your courtesy. danilo ---------------------------------------------------------------- One of the soft links may have been changed by another package install. If you do an [code] $ ls /usr/lib/libdb* [/code] What shows up? Various packages on my Debian system have installed libdb-4.2 through libdb-4.6 And just for fun, look into [b]ldconfig[/b] It can correct the runtime bindings sometimes. There should be enough details from man ldconfig to help. ldconfig is usually a superuser command so you'll need to change to root before executing the command. And a rebuild from ./configure, and make may help as well. Cheers, Brian ---------------------------------------------------------------- thanks for your quickly answer. really few days before I installed mySQL (with some troubles) danilo@quad-desktop:~$ ls /usr/lib/libdb* /usr/lib/libdb-4.3.so /usr/lib/libdbus-1.so.3 /usr/lib/libdb-4.6.so /usr/lib/libdbus-1.so.3.4.0 /usr/lib/libdbus-1.a /usr/lib/libdbus-glib-1.so.2 /usr/lib/libdbus-1.so /usr/lib/libdbus-glib-1.so.2.1.0 danilo@quad-desktop:~$ danilo@quad-desktop:~$ there is the log after ./configure and make with a few problems: danilo@quad-desktop:~/open-cobol-1.1$ ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking whether to enable maintainer-specific portions of Makefiles... no checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking how to run the C preprocessor... gcc -E checking for egrep... grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking whether ln -s works... yes checking for a BSD-compatible install... /usr/bin/install -c checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking for a sed that does not truncate output... /bin/sed checking for ld used by gcc... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for /usr/bin/ld option to reload object files... -r checking for BSD-compatible nm... /usr/bin/nm -B checking how to recognize dependent libraries... pass_all checking dlfcn.h usability... yes checking dlfcn.h presence... yes checking for dlfcn.h... yes checking the maximum length of command line arguments... 98304 checking command to parse /usr/bin/nm -B output from gcc object... ok checking for objdir... .libs checking for ar... ar checking for ranlib... ranlib checking for strip... strip checking if gcc supports -fno-rtti -fno-exceptions... no checking for gcc option to produce PIC... -fPIC checking if gcc PIC flag -fPIC works... yes checking if gcc static flag -static works... yes checking if gcc supports -c -o file.o... yes checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking for shl_load... no checking for shl_load in -ldld... no checking for dlopen... no checking for dlopen in -ldl... yes checking whether a program can dlopen itself... yes checking whether a statically linked program can dlopen itself... no checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes configure: creating libtool checking whether make sets $(MAKE)... (cached) yes checking for ANSI C header files... (cached) yes checking for stdint.h... (cached) yes checking for sys/types.h... (cached) yes checking signal.h usability... yes checking signal.h presence... yes checking for signal.h... yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking malloc.h usability... yes checking malloc.h presence... yes checking for malloc.h... yes checking locale.h usability... yes checking locale.h presence... yes checking for locale.h... yes checking stddef.h usability... yes checking stddef.h presence... yes checking for stddef.h... yes checking wchar.h usability... yes checking wchar.h presence... yes checking for wchar.h... yes checking for dlfcn.h... (cached) yes checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking for an ANSI C-conforming const... yes checking whether byte ordering is bigendian... no checking for size_t... yes checking whether struct tm is in sys/time.h or time.h... time.h checking for inline... inline checking for working alloca.h... yes checking for alloca... yes checking for vprintf... yes checking for _doprnt... no checking for memmove... yes checking for memset... yes checking for regcomp... yes checking for setlocale... yes checking for fcntl... yes checking for strerror... yes checking for strcasecmp... yes checking for strchr... yes checking for strrchr... yes checking for strdup... yes checking for strstr... yes checking for strtol... yes checking for gettimeofday... yes checking for ld used by GCC... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for shared library run path origin... done checking for iconv... yes checking for iconv declaration... extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); checking for nl_langinfo and CODESET... yes checking for getopt_long_only... yes checking kpathsea/getopt.h usability... no checking kpathsea/getopt.h presence... no checking for kpathsea/getopt.h... no checking getopt.h usability... yes checking getopt.h presence... yes checking for getopt.h... yes checking gmp.h usability... yes checking gmp.h presence... yes checking for gmp.h... yes checking for __gmp_randinit in -lgmp... yes checking whether NLS is requested... yes checking for msgfmt... /usr/bin/msgfmt checking for gmsgfmt... /usr/bin/msgfmt checking for xgettext... /usr/bin/xgettext checking for msgmerge... /usr/bin/msgmerge checking whether NLS is requested... yes checking for GNU gettext in libc... yes checking whether to use NLS... yes checking where the gettext function comes from... libc checking ncurses.h usability... no checking ncurses.h presence... no checking for ncurses.h... no checking pdcurses.h usability... no checking pdcurses.h presence... no checking for pdcurses.h... no checking ncurses/ncurses.h usability... no checking ncurses/ncurses.h presence... no checking for ncurses/ncurses.h... no checking curses.h usability... no checking curses.h presence... no checking for curses.h... no checking for initscr in -lncurses... no checking for initscr in -lpdcurses... no checking for initscr in -lcurses... no checking db.h usability... no checking db.h presence... no checking for db.h... no checking db_185.h usability... no checking db_185.h presence... no checking for db_185.h... no checking db3/db_185.h usability... no checking db3/db_185.h presence... no checking for db3/db_185.h... no checking db4/db_185.h usability... no checking db4/db_185.h presence... no checking for db4/db_185.h... no checking db4.1/db_185.h usability... no checking db4.1/db_185.h presence... no checking for db4.1/db_185.h... no checking db4.2/db_185.h usability... no checking db4.2/db_185.h presence... no checking for db4.2/db_185.h... no checking db4.3/db_185.h usability... no checking db4.3/db_185.h presence... no checking for db4.3/db_185.h... no checking db4.4/db_185.h usability... no checking db4.4/db_185.h presence... no checking for db4.4/db_185.h... no checking db4.5/db_185.h usability... no checking db4.5/db_185.h presence... no checking for db4.5/db_185.h... no checking for __db_open in -ldb-4.5... no checking for dbopen in -ldb-4.5... no checking for __db_open in -ldb-4.4... no checking for dbopen in -ldb-4.4... no checking for __db_open in -ldb-4.3... yes checking for dlopen in -lc... no checking for dlopen in -ldl... (cached) yes configure: creating ./config.status chmod: changing permissions of `./config.status': Operation not permitted config.status: creating cob-config config.status: creating Makefile config.status: creating lib/Makefile config.status: creating libcob/Makefile config.status: creating cobc/Makefile config.status: creating bin/Makefile config.status: creating po/Makefile.in config.status: creating texi/Makefile config.status: creating config/Makefile config.status: creating copy/Makefile config.status: creating tests/atlocal config.status: creating tests/Makefile config.status: creating tests/cobol85/Makefile config.status: creating config.h config.status: config.h is unchanged config.status: executing tests/atconfig commands ./config.status: line 1286: tests/atconfig: Permission denied config.status: executing depfiles commands config.status: executing default-1 commands config.status: creating po/POTFILES config.status: creating po/Makefile ./config.status: line 1487: po/Makefile: Permission denied OpenCOBOL Configuration: CC gcc COB_CC gcc CFLAGS -O2 -march=i686 -mtune=pentium4 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k COB_CFLAGS -I/usr/local/include COB_EXTRA_FLAGS -march=i686 -mtune=pentium4 LDFLAGS COB_LDFLAGS COB_LIBS -L${exec_prefix}/lib -lcob -lm -lgmp -ldb-4.3 -ldl COB_CONFIG_DIR ${prefix}/share/open-cobol/config COB_COPY_DIR ${prefix}/share/open-cobol/copy COB_LIBRARY_PATH .:${exec_prefix}/lib/open-cobol COB_MODULE_EXT so COB_SHARED_OPT -shared COB_PIC_FLAGS -fPIC -DPIC COB_EXPORT_DYN -Wl,--export-dynamic COB_STRIP_CMD strip --strip-unneeded Dynamic loading System Use gettext for international messages: yes Use Berkeley DB for file I/O: yes Use enhanced Berkeley DB (>= 4.1) no Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: no danilo@quad-desktop:~/open-cobol-1.1$ danilo@quad-desktop:~/open-cobol-1.1$ make Creating defaults.h... make all-recursive make[1]: Entering directory `/home/danilo/open-cobol-1.1' Making all in lib make[2]: Entering directory `/home/danilo/open-cobol-1.1/lib' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/home/danilo/open-cobol-1.1/lib' Making all in libcob make[2]: Entering directory `/home/danilo/open-cobol-1.1/libcob' if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF ".deps/libcob_la-common.Tpo" -c -o libcob_la-common.lo `test -f 'common.c' || echo './'`common.c; \ then mv -f ".deps/libcob_la-common.Tpo" ".deps/libcob_la-common.Plo"; else rm -f ".deps/libcob_la-common.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF .deps/libcob_la-common.Tpo -c common.c -fPIC -DPIC -o .libs/libcob_la-common.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF .deps/libcob_la-common.Tpo -c common.c -o libcob_la-common.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF ".deps/libcob_la-call.Tpo" -c -o libcob_la-call.lo `test -f 'call.c' || echo './'`call.c; \ then mv -f ".deps/libcob_la-call.Tpo" ".deps/libcob_la-call.Plo"; else rm -f ".deps/libcob_la-call.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF .deps/libcob_la-call.Tpo -c call.c -fPIC -DPIC -o .libs/libcob_la-call.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF .deps/libcob_la-call.Tpo -c call.c -o libcob_la-call.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF ".deps/libcob_la-fileio.Tpo" -c -o libcob_la-fileio.lo `test -f 'fileio.c' || echo './'`fileio.c; \ then mv -f ".deps/libcob_la-fileio.Tpo" ".deps/libcob_la-fileio.Plo"; else rm -f ".deps/libcob_la-fileio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF .deps/libcob_la-fileio.Tpo -c fileio.c -fPIC -DPIC -o .libs/libcob_la-fileio.o fileio.c:310: error: expected specifier-qualifier-list before 'DB' fileio.c: In function 'cob_sync': fileio.c:653: error: 'struct indexed_file' has no member named 'db' fileio.c:654: error: 'struct indexed_file' has no member named 'db' fileio.c:654: error: 'struct indexed_file' has no member named 'db' fileio.c:659: error: 'struct indexed_file' has no member named 'db' fileio.c:663: error: 'struct indexed_file' has no member named 'db' fileio.c:663: error: 'struct indexed_file' has no member named 'db' fileio.c: In function 'indexed_open': fileio.c:1890: error: 'struct indexed_file' has no member named 'db' fileio.c:1890: error: 'DB' undeclared (first use in this function) fileio.c:1890: error: (Each undeclared identifier is reported only once fileio.c:1890: error: for each function it appears in.) fileio.c:1890: error: expected expression before ')' token fileio.c:1895: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:1896: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:1897: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:1906: error: 'BTREEINFO' undeclared (first use in this function) fileio.c:1906: error: expected ';' before 'info' fileio.c:1939: error: 'info' undeclared (first use in this function) fileio.c:1941: error: 'R_DUP' undeclared (first use in this function) fileio.c:1952: error: 'struct indexed_file' has no member named 'db' fileio.c:1952: warning: implicit declaration of function 'dbopen' fileio.c:1952: error: 'DB_BTREE' undeclared (first use in this function) fileio.c:1953: error: 'struct indexed_file' has no member named 'db' fileio.c:1959: error: 'struct indexed_file' has no member named 'db' fileio.c:1959: error: 'struct indexed_file' has no member named 'db' fileio.c:1966: error: 'struct indexed_file' has no member named 'db' fileio.c:1967: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:1968: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:1980: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:1981: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:1989: error: 'struct indexed_file' has no member named 'key' fileio.c:1989: error: 'DBT' undeclared (first use in this function) fileio.c:1990: error: 'struct indexed_file' has no member named 'data' fileio.c:2006: error: 'struct indexed_file' has no member named 'db' fileio.c:2006: error: 'struct indexed_file' has no member named 'db' fileio.c:2006: error: 'struct indexed_file' has no member named 'key' fileio.c:2006: error: 'struct indexed_file' has no member named 'data' fileio.c:2006: error: 'R_FIRST' undeclared (first use in this function) fileio.c:2009: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2009: error: 'struct indexed_file' has no member named 'key' fileio.c:2009: error: 'struct indexed_file' has no member named 'key' fileio.c:2011: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_close': fileio.c:2055: error: 'struct indexed_file' has no member named 'db' fileio.c:2056: error: 'struct indexed_file' has no member named 'db' fileio.c:2056: error: 'struct indexed_file' has no member named 'db' fileio.c:2058: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2059: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2066: error: 'struct indexed_file' has no member named 'db' fileio.c:2067: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2068: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2069: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c: In function 'indexed_start_internal': fileio.c:2108: error: 'struct indexed_file' has no member named 'key' fileio.c:2108: error: 'struct indexed_file' has no member named 'key' fileio.c:2117: error: 'struct indexed_file' has no member named 'db' fileio.c:2117: error: 'struct indexed_file' has no member named 'db' fileio.c:2117: error: 'struct indexed_file' has no member named 'key' fileio.c:2117: error: 'struct indexed_file' has no member named 'data' fileio.c:2117: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:2122: error: 'struct indexed_file' has no member named 'key' fileio.c:2130: error: 'struct indexed_file' has no member named 'db' fileio.c:2130: error: 'struct indexed_file' has no member named 'db' fileio.c:2130: error: 'struct indexed_file' has no member named 'key' fileio.c:2130: error: 'struct indexed_file' has no member named 'data' fileio.c:2130: error: 'R_LAST' undeclared (first use in this function) fileio.c:2136: error: 'struct indexed_file' has no member named 'db' fileio.c:2136: error: 'struct indexed_file' has no member named 'db' fileio.c:2136: error: 'struct indexed_file' has no member named 'key' fileio.c:2136: error: 'struct indexed_file' has no member named 'data' fileio.c:2136: error: 'R_PREV' undeclared (first use in this function) fileio.c:2145: error: 'struct indexed_file' has no member named 'db' fileio.c:2145: error: 'struct indexed_file' has no member named 'db' fileio.c:2145: error: 'struct indexed_file' has no member named 'key' fileio.c:2145: error: 'struct indexed_file' has no member named 'data' fileio.c:2147: error: 'struct indexed_file' has no member named 'key' fileio.c:2151: error: 'struct indexed_file' has no member named 'db' fileio.c:2151: error: 'struct indexed_file' has no member named 'db' fileio.c:2151: error: 'struct indexed_file' has no member named 'key' fileio.c:2151: error: 'struct indexed_file' has no member named 'data' fileio.c:2157: error: 'struct indexed_file' has no member named 'key' fileio.c:2158: error: 'struct indexed_file' has no member named 'db' fileio.c:2158: error: 'struct indexed_file' has no member named 'db' fileio.c:2158: error: 'struct indexed_file' has no member named 'key' fileio.c:2158: error: 'struct indexed_file' has no member named 'data' fileio.c:2158: error: 'R_NEXT' undeclared (first use in this function) fileio.c:2165: error: 'struct indexed_file' has no member named 'db' fileio.c:2165: error: 'struct indexed_file' has no member named 'db' fileio.c:2165: error: 'struct indexed_file' has no member named 'key' fileio.c:2165: error: 'struct indexed_file' has no member named 'data' fileio.c:2171: error: 'struct indexed_file' has no member named 'db' fileio.c:2171: error: 'struct indexed_file' has no member named 'db' fileio.c:2171: error: 'struct indexed_file' has no member named 'key' fileio.c:2171: error: 'struct indexed_file' has no member named 'data' fileio.c:2177: error: 'struct indexed_file' has no member named 'key' fileio.c:2181: error: 'struct indexed_file' has no member named 'db' fileio.c:2181: error: 'struct indexed_file' has no member named 'db' fileio.c:2181: error: 'struct indexed_file' has no member named 'key' fileio.c:2181: error: 'struct indexed_file' has no member named 'data' fileio.c:2192: error: 'struct indexed_file' has no member named 'key' fileio.c:2194: error: 'struct indexed_file' has no member named 'data' fileio.c:2196: error: 'struct indexed_file' has no member named 'key' fileio.c:2196: error: 'struct indexed_file' has no member named 'data' fileio.c:2197: error: 'struct indexed_file' has no member named 'key' fileio.c:2198: error: 'struct indexed_file' has no member named 'db' fileio.c:2198: error: 'struct indexed_file' has no member named 'db' fileio.c:2198: error: 'struct indexed_file' has no member named 'key' fileio.c:2198: error: 'struct indexed_file' has no member named 'data' fileio.c:2232: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2232: error: 'struct indexed_file' has no member named 'key' fileio.c:2234: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2236: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2236: error: 'struct indexed_file' has no member named 'key' fileio.c:2238: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c: In function 'indexed_read': fileio.c:2476: error: 'struct indexed_file' has no member named 'data' fileio.c:2477: error: 'struct indexed_file' has no member named 'data' fileio.c:2477: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_read_next': fileio.c:2737: error: 'R_NEXT' undeclared (first use in this function) fileio.c:2749: error: 'R_LAST' undeclared (first use in this function) fileio.c:2751: error: 'R_PREV' undeclared (first use in this function) fileio.c:2754: error: 'R_FIRST' undeclared (first use in this function) fileio.c:2766: error: 'struct indexed_file' has no member named 'data' fileio.c:2779: error: 'struct indexed_file' has no member named 'key' fileio.c:2780: error: 'struct indexed_file' has no member named 'key' fileio.c:2780: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2784: error: 'struct indexed_file' has no member named 'db' fileio.c:2784: error: 'struct indexed_file' has no member named 'db' fileio.c:2784: error: 'struct indexed_file' has no member named 'key' fileio.c:2784: error: 'struct indexed_file' has no member named 'data' fileio.c:2788: error: 'struct indexed_file' has no member named 'data' fileio.c:2790: error: 'struct indexed_file' has no member named 'key' fileio.c:2790: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2790: error: 'struct indexed_file' has no member named 'key' fileio.c:2791: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2795: error: 'struct indexed_file' has no member named 'db' fileio.c:2795: error: 'struct indexed_file' has no member named 'db' fileio.c:2795: error: 'struct indexed_file' has no member named 'key' fileio.c:2795: error: 'struct indexed_file' has no member named 'data' fileio.c:2797: error: 'struct indexed_file' has no member named 'data' fileio.c:2800: error: 'struct indexed_file' has no member named 'key' fileio.c:2800: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2800: error: 'struct indexed_file' has no member named 'key' fileio.c:2801: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2802: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2802: error: 'struct indexed_file' has no member named 'data' fileio.c:2807: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2807: error: 'struct indexed_file' has no member named 'data' fileio.c:2810: error: 'struct indexed_file' has no member named 'key' fileio.c:2811: error: 'struct indexed_file' has no member named 'key' fileio.c:2811: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2812: error: 'struct indexed_file' has no member named 'db' fileio.c:2812: error: 'struct indexed_file' has no member named 'db' fileio.c:2812: error: 'struct indexed_file' has no member named 'key' fileio.c:2812: error: 'struct indexed_file' has no member named 'data' fileio.c:2849: error: 'struct indexed_file' has no member named 'key' fileio.c:2850: error: 'struct indexed_file' has no member named 'key' fileio.c:2850: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2854: error: 'struct indexed_file' has no member named 'db' fileio.c:2854: error: 'struct indexed_file' has no member named 'db' fileio.c:2854: error: 'struct indexed_file' has no member named 'key' fileio.c:2854: error: 'struct indexed_file' has no member named 'data' fileio.c:2854: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:2873: error: 'struct indexed_file' has no member named 'key' fileio.c:2873: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2873: error: 'struct indexed_file' has no member named 'key' fileio.c:2875: error: 'struct indexed_file' has no member named 'data' fileio.c:2877: error: 'struct indexed_file' has no member named 'key' fileio.c:2877: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2877: error: 'struct indexed_file' has no member named 'key' fileio.c:2878: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2882: error: 'struct indexed_file' has no member named 'db' fileio.c:2882: error: 'struct indexed_file' has no member named 'db' fileio.c:2882: error: 'struct indexed_file' has no member named 'key' fileio.c:2882: error: 'struct indexed_file' has no member named 'data' fileio.c:2884: error: 'struct indexed_file' has no member named 'data' fileio.c:2902: error: 'struct indexed_file' has no member named 'key' fileio.c:2902: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2902: error: 'struct indexed_file' has no member named 'key' fileio.c:2903: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2929: error: 'struct indexed_file' has no member named 'db' fileio.c:2929: error: 'struct indexed_file' has no member named 'db' fileio.c:2929: error: 'struct indexed_file' has no member named 'key' fileio.c:2929: error: 'struct indexed_file' has no member named 'data' fileio.c:2946: error: 'struct indexed_file' has no member named 'key' fileio.c:2946: error: 'struct indexed_file' has no member named 'key' fileio.c:2948: error: 'struct indexed_file' has no member named 'data' fileio.c:2950: error: 'struct indexed_file' has no member named 'key' fileio.c:2950: error: 'struct indexed_file' has no member named 'data' fileio.c:2951: error: 'struct indexed_file' has no member named 'key' fileio.c:2952: error: 'struct indexed_file' has no member named 'db' fileio.c:2952: error: 'struct indexed_file' has no member named 'db' fileio.c:2952: error: 'struct indexed_file' has no member named 'key' fileio.c:2952: error: 'struct indexed_file' has no member named 'data' fileio.c:2991: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2991: error: 'struct indexed_file' has no member named 'key' fileio.c:2991: error: 'struct indexed_file' has no member named 'key' fileio.c:2993: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2995: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2995: error: 'struct indexed_file' has no member named 'key' fileio.c:2997: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:3011: error: 'struct indexed_file' has no member named 'data' fileio.c:3012: error: 'struct indexed_file' has no member named 'data' fileio.c:3012: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'get_dupno': fileio.c:3027: error: 'struct indexed_file' has no member named 'key' fileio.c:3027: error: 'struct indexed_file' has no member named 'key' fileio.c:3028: error: 'struct indexed_file' has no member named 'key' fileio.c:3028: error: 'struct indexed_file' has no member named 'key' fileio.c:3033: error: 'struct indexed_file' has no member named 'db' fileio.c:3033: error: 'struct indexed_file' has no member named 'db' fileio.c:3033: error: 'struct indexed_file' has no member named 'key' fileio.c:3033: error: 'struct indexed_file' has no member named 'data' fileio.c:3033: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:3035: error: 'struct indexed_file' has no member named 'key' fileio.c:3035: error: 'struct indexed_file' has no member named 'key' fileio.c:3036: error: 'struct indexed_file' has no member named 'data' fileio.c:3040: error: 'struct indexed_file' has no member named 'db' fileio.c:3040: error: 'struct indexed_file' has no member named 'db' fileio.c:3040: error: 'struct indexed_file' has no member named 'key' fileio.c:3040: error: 'struct indexed_file' has no member named 'data' fileio.c:3040: error: 'R_NEXT' undeclared (first use in this function) fileio.c: In function 'check_alt_keys': fileio.c:3059: error: 'struct indexed_file' has no member named 'key' fileio.c:3059: error: 'struct indexed_file' has no member named 'key' fileio.c:3060: error: 'struct indexed_file' has no member named 'db' fileio.c:3060: error: 'struct indexed_file' has no member named 'db' fileio.c:3060: error: 'struct indexed_file' has no member named 'key' fileio.c:3060: error: 'struct indexed_file' has no member named 'data' fileio.c:3063: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_write_internal': fileio.c:3112: error: 'struct indexed_file' has no member named 'key' fileio.c:3112: error: 'struct indexed_file' has no member named 'key' fileio.c:3129: error: 'struct indexed_file' has no member named 'data' fileio.c:3130: error: 'struct indexed_file' has no member named 'data' fileio.c:3131: error: 'struct indexed_file' has no member named 'db' fileio.c:3131: error: 'struct indexed_file' has no member named 'db' fileio.c:3131: error: 'struct indexed_file' has no member named 'key' fileio.c:3131: error: 'struct indexed_file' has no member named 'data' fileio.c:3131: error: 'R_NOOVERWRITE' undeclared (first use in this function) fileio.c:3137: error: 'struct indexed_file' has no member named 'data' fileio.c:3137: error: 'struct indexed_file' has no member named 'key' fileio.c:3139: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:3149: error: 'struct indexed_file' has no member named 'data' fileio.c:3150: error: 'struct indexed_file' has no member named 'data' fileio.c:3159: error: 'struct indexed_file' has no member named 'key' fileio.c:3159: error: 'struct indexed_file' has no member named 'key' fileio.c:3160: error: 'struct indexed_file' has no member named 'db' fileio.c:3160: error: 'struct indexed_file' has no member named 'db' fileio.c:3160: error: 'struct indexed_file' has no member named 'key' fileio.c:3160: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_write': fileio.c:3235: error: 'struct indexed_file' has no member named 'key' fileio.c:3235: error: 'struct indexed_file' has no member named 'key' fileio.c:3237: error: 'struct indexed_file' has no member named 'key' fileio.c:3239: error: 'struct indexed_file' has no member named 'key' fileio.c:3239: error: 'struct indexed_file' has no member named 'key' fileio.c:3242: error: 'struct indexed_file' has no member named 'key' fileio.c:3242: error: 'struct indexed_file' has no member named 'key' fileio.c: In function 'indexed_delete_internal': fileio.c:3255: error: 'DBT' undeclared (first use in this function) fileio.c:3255: error: expected ';' before 'prim_key' fileio.c:3302: error: 'struct indexed_file' has no member named 'key' fileio.c:3302: error: 'struct indexed_file' has no member named 'key' fileio.c:3303: error: 'struct indexed_file' has no member named 'db' fileio.c:3303: error: 'struct indexed_file' has no member named 'db' fileio.c:3303: error: 'struct indexed_file' has no member named 'key' fileio.c:3303: error: 'struct indexed_file' has no member named 'data' fileio.c:3308: error: 'prim_key' undeclared (first use in this function) fileio.c:3308: error: 'struct indexed_file' has no member named 'key' fileio.c:3311: error: 'struct indexed_file' has no member named 'data' fileio.c:3313: error: 'struct indexed_file' has no member named 'key' fileio.c:3313: error: 'struct indexed_file' has no member named 'key' fileio.c:3314: error: 'struct indexed_file' has no member named 'key' fileio.c:3314: error: 'struct indexed_file' has no member named 'key' fileio.c:3317: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:3317: error: 'struct indexed_file' has no member named 'key' fileio.c:3317: error: 'struct indexed_file' has no member named 'key' fileio.c:3318: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:3323: error: 'struct indexed_file' has no member named 'db' fileio.c:3323: error: 'struct indexed_file' has no member named 'db' fileio.c:3323: error: 'struct indexed_file' has no member named 'key' fileio.c:3325: error: expected ';' before 'sec_key' fileio.c:3331: error: 'struct indexed_file' has no member named 'db' fileio.c:3331: error: 'struct indexed_file' has no member named 'db' fileio.c:3331: error: 'struct indexed_file' has no member named 'key' fileio.c:3331: error: 'struct indexed_file' has no member named 'data' fileio.c:3331: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:3333: error: 'sec_key' undeclared (first use in this function) fileio.c:3333: error: 'struct indexed_file' has no member named 'key' fileio.c:3334: error: 'struct indexed_file' has no member named 'key' fileio.c:3336: error: 'struct indexed_file' has no member named 'data' fileio.c:3341: error: 'struct indexed_file' has no member named 'db' fileio.c:3341: error: 'struct indexed_file' has no member named 'db' fileio.c:3341: error: 'struct indexed_file' has no member named 'key' fileio.c:3347: error: 'struct indexed_file' has no member named 'db' fileio.c:3347: error: 'struct indexed_file' has no member named 'db' fileio.c:3347: error: 'struct indexed_file' has no member named 'key' fileio.c:3347: error: 'struct indexed_file' has no member named 'data' fileio.c:3347: error: 'R_NEXT' undeclared (first use in this function) fileio.c:3364: error: 'struct indexed_file' has no member named 'db' fileio.c:3364: error: 'struct indexed_file' has no member named 'db' fileio.c: In function 'indexed_rewrite': fileio.c:3529: error: 'struct indexed_file' has no member named 'key' fileio.c:3529: error: 'struct indexed_file' has no member named 'key' make[2]: *** [libcob_la-fileio.lo] Error 1 make[2]: Leaving directory `/home/danilo/open-cobol-1.1/libcob' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/danilo/open-cobol-1.1' make: *** [all] Error 2 danilo@quad-desktop:~/open-cobol-1.1$ maybe I have to uninstall mySQL ? bye danilo ---------------------------------------------------------------- I doubt uninstalling mySQL would help. I'll have to admit to being a little inexperienced with install problems, as I've never had any ... so I've never actually had to dig in and figure anything out. I might try installing the open-cobol package which is OpenCOBOL 1.0 (with Debian lenny), and see if aptitude showed any missing dependencies, as it does look like something got rid of or moved your berkeley db. A package install may fix it, and aptitude is usually pretty good at checking all the dependencies. After the 1.0 install, (which will go to /usr/bin), try a make of the 1.1, (which uses /usr/local/bin). Maybe. Again, I've not yet had to track any problems, so I'm kinda guessing. Cheers Brian ---------------------------------------------------------------- Hi, I reinstalled open-cobol via Sympatic, and now all works well again. thanks and bye danilo ---------------------------------------------------------------- Subject: 99 Bottles of Beer on the Wall #2 Another version with everything in working storage. [code] IDENTIFICATION DIVISION. PROGRAM-ID. 99-Bottles-of-Beer-On-The-Wall. AUTHOR. KONENAS. ************************************************************************ ******* PURPOSE: ******* This is a sample COBOL program to display the lyrics of the ******* song "99 Bottles of Beer on the Wall." ******* COMPILATION: ******* cobc -x -free 99.cbl ******* COMMENTS: ******* It runs on every 85 COBOL compiler only check formatting ************************************************************************ DATA DIVISION. WORKING-STORAGE SECTION. 01 Working-Variables. 05 Bottles pic S99 value 0. 05 Bottles-1 pic S99 value 0. 05 W-Bottles1 pic 9 value zeros. 05 W-Bottles2 pic 99 value zeros. 01 Lyric-Variables. 05 L-No-Bottles pic x(15) value spaces. 05 L-Bottles pic x(15) value spaces. 05 L-Line pic x(70) value spaces. 01 Lyric-Static. 05 Title pic x(37) value "Lyrics of the song 99 Bottles of Beer". 05 ofbeeron pic x(20) value " of beer on the wall". 05 ofbeer pic x(09) value " of beer.". 05 takeone pic x(34) value "Take one down and pass it around, ". 05 nomore pic x(8) value "No more ". 05 buysome pic x(35) value "Go to the store and buy some more, ". 05 bottle-s pic x(7) value " bottle". 05 bottle-p pic x(8) value " bottles". PROCEDURE DIVISION. Write-Lyrics. move Title to L-Line display L-Line. perform varying Bottles from 99 by -1 until Bottles = 0 move Bottles to Bottles-1 perform Write-line1 subtract 1 from Bottles Giving Bottles-1 perform Write-line2 end-perform perform Write-line1 move spaces to L-Line move 99 to Bottles-1 perform Write-line2 stop run. ******* Here we check how many bottles of beer lyrics ******* Write-line1. move spaces to L-Line display L-Line perform Fix-Bottles string L-No-Bottles L-Bottles ofbeeron ", " L-No-Bottles L-Bottles ofbeer delimited by " " into L-Line display L-Line. Write-line2. perform Fix-Bottles string takeone L-No-Bottles L-Bottles ofbeeron "." delimited by " " into L-Line display L-Line. Fix-Bottles. evaluate Bottles-1 when 0 move nomore to L-No-Bottles when 1 thru 9 move Bottles-1 to W-Bottles1 move W-Bottles1 to L-No-Bottles when other move Bottles-1 to W-Bottles2 move W-Bottles2 to L-No-Bottles end-evaluate evaluate Bottles-1 when 1 move bottle-s to L-Bottles when other move bottle-p to L-Bottles end-evaluate. [/code] ---------------------------------------------------------------- Nice one by the way konenas. Cheers, Brian ---------------------------------------------------------------- The code looks good. I just could not get it to run. I might have copied it wrong, so when I awake I will do so in the morning. ---------------------------------------------------------------- Subject: SCREEN SECTION wishlist Hello. I'm glad to see that screen section begin to be implemented. Running the code below the word "TEST" should appear white on blue and highlighted applying a kind of ATTRIBUTE INHERITANCE. Waiting comments. Cheers Leo [code] ... screen section. 01 s-parent background-color 1 foreground-color 7 highlight. 02 s-child line 4 column 4 value "TEST". ... display s-parent. ... [/code] ---------------------------------------------------------------- Hi Roger, Inserting the following lines in parser.y it seems to work... What do you think about ? Cheers Leo inserted at #2324 [code] if (current_field->parent) { current_field->screen_foreg = current_field->parent->screen_foreg; } if (current_field->parent) { current_field->screen_backg = current_field->parent->screen_backg; } [/code] ---------------------------------------------------------------- #2 I would like to add another useful feature to the wishlist: (from MF) [code] If a screen description contains a BLANK SCREEN clause, and either contains a BACKGROUND-COLOR clause or is subordinate to one that does, when the screen item is displayed by a DISPLAY statement the specified color becomes the default background color. It remains the default background color until either another screen item with this combination of options is displayed (whether in the same DISPLAY statement or another). (... same for FOREGROUND-COLOR) [/code] I will investigate the sources... (hoping that I'll have the time) Cheers Leo ---------------------------------------------------------------- FORE/BACKGROUND for subordinate items should be fixed in current OC 1.1 tarball. Roger ---------------------------------------------------------------- Oops! Sorry, I should have downloaded the last tarball before... However it was a funny time studying OC sources. I downloaded it and *yes*... FORE/BACKGROUND colors are now inherited by subordinate items. This is the mini-program used for testing. Leo. scrtest02.cob [code] ****************************************************************** * screen section test * fore/background inheritance ****************************************************************** identification division. program-id. scrtest02. environment division. configuration section. special-names. crt status is crt-status. data division. working-storage section. 01 crt-status pic 9(4). 01 any-char pic x. 01 w-user pic x(3) value "Leo". 01 w-tty pic x(3) value "001". screen section. **-- **-- I want the screen white on blue **-- 01 s-main background-color 1 foreground-color 7. 02 s-clear line 1 column 1 blank screen. **-- **-- display a title/status bar at top **-- **-- I have to use back and fore colors here **-- instead of reverse-video **-- because i want an uninterrupted **-- reverse-video line 02 s-title background-color 7 foreground-color 1. N * reverse-video. 03 line 1 column 1 blank line. 03 column 10 pic x(10) from w-user. 03 column plus 4 value "PROGRAM NAME". 03 column 75 pic x(3) from w-tty. **-- **-- display some labels cyan on blue **-- 02 s-labels foreground-color 3. 03 line 4 column 10 value "Field #1 .....[". 03 line 4 column 36 value "]". 03 line 6 column 10 value "Field #2 .....[". 03 line 6 column 36 value "]". 03 line 8 column 10 value "Field #3 .....[". 03 line 8 column 36 value "]". **-- **-- display some fields hilighted **-- 02 s-fields highlight. 03 line 4 column 25 value "AAAAAAAAAAA". 03 line 6 column 25 value "BBBBBBBBBBB". 03 line 8 column 25 value "CCCCCCCCCCC". **-- **-- display a message-bar at bottom **-- red on white 02 s-wait-char background-color 7 foreground-color 4. 03 line 24 column 1 blank line. 03 value "type any char to close [". 03 pic x using any-char auto. 03 value "]". procedure division. display s-main. accept s-main. goback. [/code] ---------------------------------------------------------------- Thank you for posting your prog. cobc (OpenCOBOL) 1.1.0 Built Jul 30 2008 20:47:13 Packaged Wed Jul 30 13:22:15 CEST 2008 Copyright (C) 2001-2008 Keisuke Nishida / Roger While I see only white characters + some highlights on black background. Have you tried accept on numeric fields with/without screen section ? Regards Bear ---------------------------------------------------------------- Hi Bear. (1) [code] cobc (OpenCOBOL) 1.1.0 Built Jul 31 2008 19:19:42 Packaged Thu Jul 31 18:18:33 CEST 2008 Copyright (C) 2001-2008 Keisuke Nishida / Roger While [/code] I compiled with the above and it works as expected. (2) Not yet... I will try some tests in the week-end Cheers Leo ---------------------------------------------------------------- Can copy/screenio.cpy include named color constants? Is there a way to bypass the termcap init and deinit, (-X setting of LESS is how I know what I want, but can't explain) of ncurses? Along with this, is there a way to send DISPLAY UPON CONSOLE so that it shows up after a screen section GOBACK? Umm, the backspace seems to get stuck if on the last character position of a field edit. But I'm not sure if this is just my settings and certain terminal control handling and thought I'd ask here before diggin' in. Cheers cobc (OpenCOBOL) 1.1.0 Built Aug 1 2008 23:30:49 Packaged Fri Aug 1 17:46:28 CEST 2008 Copyright (C) 2001-2008 Keisuke Nishida / Roger While ---------------------------------------------------------------- ACCEPT ON NUMERIC FIELDS A few tests showed up that OC does NEED some enhancements in the accept routine (I guess cob_screen_get_all function) So I would like to add such enhancements to the wishlist. Are there any plans about? Can we talk about this? Cheers Leo ---------------------------------------------------------------- FIELD ACCEPT IN SCREEN SECTION Hello Roger. I confirm the behaviour of backspace reported by btiffin. Playing around, I changed a few lines in screenio.c (cob_screen_get_all function) The new behaviour is that backspace shifts one position to left all the characters from current cursor position to the end of field and the last character becomes a space. Is this acceptable ? I think we should plan a different accept routine for numeric fields. I'll post later on this issue. Cheers Leo diff -Nu screenio_20080728.c screenio.c [code] --- screenio_20080728.c 2008-07-28 16:22:55.000000000 +0200 +++ screenio.c 2008-08-09 13:30:30.000000000 +0200 @@ -388,6 +388,7 @@ struct cob_inp_struct *sptr; cob_screen *s; unsigned char *p; + unsigned char *pc; int keyp; int sline; int scolumn; @@ -396,6 +397,7 @@ int rightpos; int ateof; int gotbacksp; + int offset; sptr = cob_base_inp; s = sptr->scr; @@ -546,14 +548,24 @@ getyx (stdscr, cline, ccolumn); if (keyp == KEY_BACKSPACE || keyp == ('H' & 037)) { if (ccolumn > scolumn) { - if (gotbacksp || ccolumn != rightpos) { - ccolumn--; - } else { - ateof = 0; + + /* shift left all chars from current position to the end of field */ + for ( offset = ccolumn - scolumn - 1; offset < s->field->size; offset++ ) { + p = s->field->data + offset; + pc = p + 1; + *p = *pc; + move (cline, scolumn + offset); + addch ( *pc ); } - gotbacksp = 0; - move (cline, ccolumn); - addch (' '); + + /* put a space at end of field */ + p = s->field->data + s->field->size; + *p = ' '; + move (cline, scolumn + s->field->size); + addch ( ' ' ); + + /* update pointer */ + ccolumn--; move (cline, ccolumn); p = s->field->data + ccolumn - scolumn; continue; [/code] ---------------------------------------------------------------- FIELD ACCEPT uhmmmm... with respect to the changes I propose to screenio.c I'm afraid I forgot handling of COB_SCREEN_SECURE attribute... So an [code] if (s->attr & COB_SCREEN_SECURE) [/code] condition should be present before calling addch to display an '*' where appropriate. Sorry... Anyway I think that the behavior I propose for the backspace should be taken into account... Cheers Leo ---------------------------------------------------------------- NUMERIC ACCEPT Hello. I'm here again, hoping do not disturb :) As a COmmon Business Oriented user, I have a lot of numeric input in my applications (most of the time currency values and date values) so I'm coming back to my wishes of a friendly interface which should facilitate my job. Since an example is much more than thousands of words I post here a little program to explain what I mean. Forgive any bug and/or inelegance :) There are other aspects on this issue which we have to talking about... ...but we are not in a hurry. Anyone interested, please add a comment. Cheers Leo scrtest04.cob [code] ****************************************************************** **-- scrtest04.cob **-- **-- author: Leonardo Epifani - COmmon Business Oriented LEO :) **-- date: 13 Ago 2008 **-- **-- info: shows the wished behaviour of accept stmt **-- on a numeric S9(6)V9(3) field **-- with a virtually provided numeric edited **-- screen picture of -Z(5)9,999 **-- **-- cobc scrtest04.cob **-- cobcrun scrtest04 **-- ****************************************************************** identification division. program-id. scrtest04. environment division. configuration section. special-names. decimal-point is comma crt status is crt-status. data division. working-storage section. 01 w-current-pos pic 99. 88 in-sign-area value 1. 88 in-int-area values 2 thru 7. 88 in-dp-area value 8. 88 in-dec-area values 9 thru 11. 88 at-eof value 12. 01 w-digits pic 99 value 9. 01 w-scale pic 9 value 3. 01 w-int-digits pic 99. 01 w-int-count pic 99. 01 w-dec-count pic 99. 01 w-getch pic x. 01 w-ch-buff pic x. **-- 01 w-current-column pic 99. 01 w-sign-pos pic 99 value 1. 01 w-dp-pos pic 99 value 8. 01 w-start-pos pic 99. 01 w-pos pic 99. 01 w-count pic 99. 01 w-count2 pic 99. 01 w-decimal pic S9(6)V999. 01 x-decimal pic X(11). 01 filler redefines x-decimal. 03 w-ch occurs 11 pic x. 01 crt-status pic 9(4). 01 w-message pic x(60). 01 w-help pic x(80). 01 w-char pic x. 01 w-user pic x(3) value "Leo". 01 w-tty pic x(3) value "001". 01 w-blank-c pic x value space. screen section. **-- 01 s-main background-color 1 foreground-color 7. 02 s-clear line 1 column 1 blank screen. **-- 02 s-title reverse-video. 03 line 1 column 1 picture x(80) from w-blank-c. 03 line 1 column 1 pic x(10) from w-user. 03 column plus 4 value "ACCEPT ON NUMERIC FIELDS - a proposal". 03 column 75 pic x(4) from w-tty. **-- 02 s-hints. 03 line 3 column 2 value "This program shows a possible ". 03 value "behaviour of the accept routine ". 03 line plus 1 column 2 value "on a numeric field with ". 03 value "a screen picture -Z(5)9,999 ". 03 line plus 2 column 2 value "ACCEPT is done char by char ". 03 value "into the array x-decimal.". 03 line plus 2 column 2 value "w-decimal shows the result of ". 03 value "MOVE x-decimal TO w-decimal". 03 line plus 1 column 2 value "... see the source for more details". 03 line plus 2 column 2 value "allowed chars: [0-9] . , + -". 03 line plus 1 column 2 value "NOTE: backspace (F12) works mostly as Delete". 03 value " here.". 03 line plus 1 column 2 value "Period and comma both act as dec.sep.". 02 s-labels foreground-color 3. 03 line 16 column 10 value "x-decimal = [". 03 line 16 column 37 value "]". 03 line 18 column 10 value "w-decimal = [". 03 line 18 column 37 value "]". **-- 02 s-fields highlight. 03 s-number. 05 line 16 column 25 picture X from w-ch(1). 05 picture X from w-ch(2). 05 picture X from w-ch(3). 05 picture X from w-ch(4). 05 picture X from w-ch(5). 05 picture X from w-ch(6). 05 picture X from w-ch(7). 05 picture X from w-ch(8). 05 picture X from w-ch(9). 05 picture X from w-ch(10). 05 picture X from w-ch(11). 03 line 18 column 25 pic -Z(5)9,999 from w-decimal. 02 s-getch highlight line 16 column w-current-column picture X auto using w-ch-buff. **--debug stuff N * 02 s-info. N * 03 line 20 column 4 N * value "w-int-digits=". N * 03 N * picture 99 N * from w-int-digits. N * 03 N * value " current-pos=". N * 03 N * picture 99 N * from w-current-pos. N * 03 N * value " w-int-count=". N * 03 N * picture 99 N * from w-int-count. N * 03 N * value " w-dec-count=". N * 03 N * picture 99 N * from w-dec-count. N * 03 N * value " w-count=". N * 03 N * picture 99 N * from w-count. N * 03 N * value " w-count2=". N * 03 N * picture 99 N * from w-count2. N * 03 N * value " ". N * 03 N * picture x N * using w-char. 02 s-help. 03 s-clear-help line 23 column 1 blank line. 03 picture x(80) from w-help. **-- 02 s-wait-char background-color 7 foreground-color 4. 03 line 24 column 1 blank line. 03 picture x(60) from w-message. 03 value "[". 03 pic x using w-char bell auto. 03 value "]". procedure division. main-section section. main-paragraph. **-- **-- INIT STUFF **-- move space to w-message. string "F12=Bcksp " "F5=LeftArrow " "F6=RightArrow " "F4=Clear " "F10=send " delimited size into w-message. **-- TODO **-- maybe w-int-digits, w-digits, w-dp-pos, w-scale **-- could be initialized by parsing a provided picture **-- for the field compute w-int-digits = w-digits - w-scale. compute w-start-pos = w-dp-pos - 1. perform clear-field. display s-main. **-- **-- MAIN LOOP **-- perform until function upper-case (w-char) = "Y" display s-fields DEBUG * display s-info compute w-current-column = w-current-pos + 24 move w-ch(w-current-pos) to w-ch-buff accept s-getch move w-ch-buff to w-getch move w-ch(w-current-pos) to w-ch-buff display s-getch evaluate crt-status also w-getch when 0 also "0" thru "9" perform process-digit when 0 also "-" move "-" to w-ch(w-sign-pos) when 0 also "+" move " " to w-ch(w-sign-pos) when 0 also "," when 0 also "." if in-int-area compute w-current-pos = w-dp-pos + 1 end-if when 1004 also any perform clear-field when 1005 also any perform process-left-arrow when 1006 also any perform process-right-arrow when 1012 also any perform process-backspace when 1010 also any move "Y" to w-char end-evaluate move x-decimal to w-decimal display s-number end-perform. move "type any char to close" to w-message. display s-clear-help. display s-wait-char. accept s-wait-char. **-- **-- STOP RUN **-- goback. ****************************************************************** ****************************************************************** *----------------------------------------------------------------* process-digit. **-- if in-int-area **-- TODO ? **-- if we reached the end of int part **-- send the digit to dec part if w-int-count < w-int-digits * **-- shift digits from right to left * **-- to insert the new one at w-current-pos compute w-pos = w-int-digits - w-int-count * **-- if sign leading add 1 to start position add 1 to w-pos perform varying w-count from w-pos by 1 until w-count = w-current-pos compute w-count2 = w-count + 1 move w-ch(w-count2) to w-ch(w-count) DEBUG * display s-info DEBUG * accept s-info end-perform * *-- insert new digit * *-- but a zero on leftmost pos if not (w-int-count = 0 and w-getch = zero) add 1 to w-int-count move w-getch to w-ch(w-current-pos) end-if end-if end-if. if in-dec-area * *-- store/replace digit at current pos move w-getch to w-ch(w-current-pos) add 1 to w-current-pos end-if. **-- some checks... if in-dp-area add 1 to w-current-pos. if at-eof subtract 1 from w-current-pos. *----------------------------------------------------------------* process-backspace. if in-int-area and w-int-count > 0 * *-- find the leftmost digit compute w-pos = w-int-digits - w-int-count + 2 subtract 1 from w-int-count * *-- if we already are at the leftmost digit... if w-current-pos = w-pos if w-int-count = 0 move zero to w-ch(w-pos) else move space to w-ch(w-pos) add 1 to w-current-pos end-if else * *-- shift digits from left to right perform with test after varying w-count from w-current-pos by -1 until w-count = (w-pos) compute w-count2 = w-count - 1 move w-ch(w-count2) to w-ch(w-count) end-perform * *-- blank the leftmost one move space to w-ch(w-pos) end-if end-if. if in-dec-area compute w-pos = w-dp-pos + w-scale perform varying w-count from w-current-pos by 1 until w-count = w-pos compute w-count2 = w-count + 1 if w-ch(w-count2) = space move zero to w-ch(w-count2) end-if move w-ch(w-count2) to w-ch(w-count) end-perform move "0" to w-ch(w-pos) * **-- if the last significant digit was deleted * **-- move 1 pos left perform varying w-count from w-pos by -1 until w-count < w-current-pos or w-ch(w-count) > "0" end-perform if w-count < w-current-pos subtract 1 from w-current-pos end-if * **-- skip dec.point if in-dp-area subtract 1 from w-current-pos end-if end-if. *----------------------------------------------------------------* process-left-arrow. compute w-pos = w-int-digits - w-int-count + 2. * * 1 pos added for leading sign if w-current-pos > w-pos subtract 1 from w-current-pos end-if. if in-dp-area subtract 1 from w-current-pos end-if. *----------------------------------------------------------------* process-right-arrow. add 1 to w-current-pos. if in-dp-area add 1 to w-current-pos end-if. if at-eof subtract 1 from w-current-pos end-if. *----------------------------------------------------------------* clear-field. move " 0,000" to x-decimal. move 0 to w-int-count w-dec-count. move w-start-pos to w-current-pos. [/code] ---------------------------------------------------------------- Our company is interested in a GTK screen section so that we can have graphical COBOL programs. Just wondering if anyone else here is interested. ---------------------------------------------------------------- If you have a company behind you are maybe able to do the GTK and GTK-GUI wrapper as described in [url=ttp://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=307&forum=1]Priorities from the cheap seats[/url]. As btiffin says there [quote]I was just logging in to say that GTK may have to wait. Looking at the scale of it, if started now, other tasks may not get finished. To avoid overfilling the plate, I'll be limiting the gtk effort to simple study, pondering and asking of questions for now. After progressing more on the MQ wrappers, libCURL and getting the FAQ published, I'll revisit. Would definitely be biting off more than I could chew.[/quote] and Roger pointing out (I share his opinion, just as btiffin does) [quote]Main priority must/should be the FAQ with the aim to get that in texi format for inclusion into 1.1 release.[/quote] so there will be no efforts for the wrappers from this side for long time. I really like the idea of having a GTK-frontend to the screen section and thought about this yesterday, too. Most of us aren't able to force developments in this direction, but as I said before, maybe you have some GTK or at least C developers to write the wrappers together with you. ---------------------------------------------------------------- We've not got C developers ATM. Though I do have a fellow that once I set him on something can tackle it like nobody's business. We're in the middle of a project, which he has taken over, freeing me to focus on all the other things we need, MySQL clustering, OpenCobol and the like. Once we're done with that project, at the end of the year I could probably set him to learning GTK. He knows enough C that it wouldn't take him long to pick it up, but he'd have to familiarize himself with Roger's environment. Additionally, if someone else wanted to tackle it and was able to provide a quote, I could give this to our company. I've already forward that thought to Roger, among a list of other things we'd like. GTK Screen section isn't a priority for us either. Rather SQL connectivity is (MySQL in particular). So GTK Screen Section is just a wishlist atm. ---------------------------------------------------------------- from human, re GTK+; [quote]so there will be no efforts for the wrappers from this side for long time.[/quote] Oh, don't think that. ;) I'm still keen on taking a kick at GTK, so "long time" will be measured in days, weeks, not months I hope. I just didn't want to promise something that would cause an overload for the next few days. [i]To not pollute this Screen Section thread too much the remainder of this response will be in the Priorities thread.[/i] Cheers, Brian ---------------------------------------------------------------- Don't want to push the GTK+ Screen Section parser but want to ask if there are efforts of implementing (?) DISPLAY ... UPON CONSOLE END-DISPLAY. Currently it displays as every other DISPLAY does (somebody asked to have these lines displayed after STOP RUN). For every other DISPLAY UPON ... there has to be a SPECIAL-NAMES entry. Has somebody some useful samples for that? ---------------------------------------------------------------- human; If you mean to be able to DISPLAY UPON during an ncurses "screen clear" and have it show when the virtual terminal "unclears". No go at this point, as far as I know, and a fairly extensive (but not yet exhaustive) source code read and experiments have shown. CONSOLE is treated identical to SYSOUT for DISPLAY. Cheers, Brian ---------------------------------------------------------------- Subject: OpenCOBOL FAQ nearing 1.0beta Hello everyone; I'm starting to think that the ocfaq.txt file is nearly at a stage where it can move from pre-alpha to 1.0beta. I'd post it here but, luckily for everyone, it now exceeds the 64K forum post limit. So I'm only posting the current DIFF (revision 7 - relative to the original post at http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=258&forum=1&viewmode=flat&order=ASC&start=10) Our good friend aoirthoir has offered hosting of the ReST generated HTML and after one or two more typo/error passes, I'll be posting the text to the wild. I'll also be striving to remove all Look into this sections before offering the FAQ for the awesome OpenCOBOL system to the world. If you get a chance, please nitpick the file for typos and errors and feel free to post suggestions for Q and A entries, especially if you feel that there is something missing to rate this as a 1.0beta FAQ for public consumption. Cheers, Brian [code] Index: ocfaq.txt =================================================================== --- ocfaq.txt (revision 2) +++ ocfaq.txt (working copy) @@ -3,17 +3,19 @@ ************* .. Formatted for docutils, ReStructuredText. rst-buidhtml -.. Attention:: This is the 0.0a pre alpha release of the OpenCOBOL FAQ +.. Attention:: This is the 0.0f pre alpha release of the OpenCOBOL FAQ .. Sectnum:: :Authors: Brian Tiffin [btiffin]_ + Joseph James Frantz [aoirthoir]_ + Roger While [Roger]_ (with the invaluable assistance of many others) :Organization: The OpenCOBOL Project :Version: - 0.0a + 0.0f :Status: Experimental - Not for public release :Copyright: @@ -53,6 +55,13 @@ The run-time library is licensed under `GNU Lesser General Public License`_. +All source codes are copyright by the respective authors. + +OpenCOBOL is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + --------------------------------------------- Q. What platforms are supported by OpenCOBOL? --------------------------------------------- @@ -72,13 +81,13 @@ ----------------------------- Q. How complete is OpenCOBOL? ----------------------------- -`OpenCOBOL 1.0`_ implements a substantial portion of COBOL 85, -supports many of the advances and clarifications of COBOL 2002, +`OpenCOBOL 1.0`_ implements a substantial portion of `COBOL 85`_, +supports many of the advances and clarifications of `COBOL 2002`_, and includes many extensions in common use from Micro Focus COBOL, ACUCOBOL and other exsistent compilers. -`OpenCOBOL 1.1`_ implements a more substantial portion of the COBOL 85 -Dialect, COBOL 2002 and a growing number of vendor extensions. +`OpenCOBOL 1.1`_ implements a more substantial portion of the `COBOL 85`_ +Dialect, `COBOL 2002`_ and a growing number of vendor extensions. Some proposed COBOL 2008 features have also been implemented. Compatibility support includes: @@ -93,16 +102,29 @@ CALL "cfunction" USING BY REFERENCE ADDRESS OF VAR-IN-LINKAGE-SECTION. -Passing the equivalent of char**, pointer to pointer to char. Just as an +Passing the equivalent of char**, pointer to pointer to char. Just as a small example of the level of coverage provided by OpenCOBOL. --------------------------------- Q. Will I be amazed by OpenCOBOL? --------------------------------- This author believes so. For an open source implementation of COBOL, -OpenCOBOL may surprise you in the depth and breadth of it's COBOL standard +OpenCOBOL may surprise you in the depth and breadth of its COBOL standard feature support, usability and robustness. +-------------------------------- +Q. Who do I thank for OpenCOBOL? +-------------------------------- +Many people. In particular Keisuke Nishida and Roger While. + +See the THANKS file in the source code archive for more names of people +that have worked on the OpenCOBOL project. Roger points out that the list +is woefully incomplete. To quote:: + + The OC project would not have been where it is today without the + significant/enormous help from many-many persons. The THANKS + file does not even do justice to this. + --------------------------------------- Q. Does OpenCOBOL include a Test Suite? --------------------------------------- @@ -113,6 +135,26 @@ ------------------------------------------- Q. Does OpenCOBOL pass the NIST Test Suite? ------------------------------------------- +Almost all. OpenCOBOL achieves a very high level of COBOL 85 conformance. + +The National Institute of Standards and Technology, NIST, maintains a +COBOL 85 implementation verification suite of tests. An archive of the tests +can be found at + +http://www.itl.nist.gov/div897/ctg/cobol_form.htm + +Instructions for use of the NIST suite is included in the build archive under:: + + tests/cobol85/README + +Basically, it is a simple **uncompress** and **make** then sit back and +relax. The scripts run OpenCOBOL over some 364 programs/modules and +includes many thousands of test passes. + +--------------------------------------- +Q. What about OpenCOBOL and benchmarks? +--------------------------------------- + .. Attention:: Look into this --------------------------------- @@ -136,8 +178,26 @@ There may be a time when commercial support of OpenCOBOL is offered, but at the time of writing no known offering exists. -.. Attention:: Look into this +*Search google just in case!* + +And yes, OpenCOBOL is used in production environments. + +From [Roger]_: + +:: + + Incidentally, OC has been (and still is) used in production + environments since 2005. + (This includes projects that I personally worked on plus other +   projects reported to me; these worldwide) + + The OC project would not have been where it is today without the + significant/enormous help from many-many persons. The THANKS + file does not even do justice to this. + +.. Attention:: Look into this - need more entries + ------------------------------------------------ Q. Where can I get more information about COBOL? ------------------------------------------------ @@ -153,6 +213,39 @@ The opencobol.org_ website is probably the best place to find out more about the OpenCOBOL system. +--------------------------------------------- +Q. Can I help out with the OpenCOBOL project? +--------------------------------------------- +Absolutely. Visit the opencobol.org_ website and either post a message asking +what needs to be done, or perhaps join the development mailing list to find +out the current state of development. See +`Q. Is there an OpenCOBOL mailing list?`_ for some details. OpenCOBOL is a +GPL licensed open source project and while [Roger]_ is the lead developer he +is quite open to code submissions. Having a central point of development +allows for consistency and the very high level of quality control enjoyed by +OpenCOBOL users. + +-------------------------------------- +Q. Is there an OpenCOBOL mailing list? +-------------------------------------- +Yes. Visit opencobol.org_ for details. The OpenCOBOL development mailing +list is graciously hosted by SourceForge. The ML archive is available at +http://sourceforge.net/mailarchive/forum.php?forum_name=open-cobol-list +and once you have subscribed, the list will accept messages at +the open-cobol-list email destination at lists.sourceforge.net. + +----------------------------------------------------------- +Q. Where can I find more information about COBOL standards? +----------------------------------------------------------- +The `COBOL 85`_ standard is documented in + +* ANSI X3.23-1985 +* ISO 1989-1985 +* ANSI X3.23a-1989 +* ANSI X3.23b-1993 + +.. Attention:: Look into this + ------------------------------ Q. Do you know any good jokes? ------------------------------ @@ -174,12 +267,27 @@ *Author: unknown* - A less verbose, more concise version *very unCOBOL that* + A less verbose, more concise version; *very unCOBOL that* *ADD 1 TO COBOL.* *Thanks to aoirthoir* +* A common dis of COBOL jokes that the acronym is: + + Completely Obsolete Business Oriented Language. + *Author unkown* + + We know better. The reality is: + + Can't Obsolesce Because Of Legacy. + + *Brian Tiffin* + +* Ruby on Rails? Don't forget COBOL ON COGS. + + http://www.coboloncogs.org/INDEX.HTM + * Eat COBOL, three quadrillion transactions can't be wrong. *Brian Tiffin* @@ -190,17 +298,17 @@ *Brian Tiffin* -* What did COBOL reply to the executive? Why yes, I can +* What did COBOL reply to the executive? *Why yes, I can* - *PERFORM JUMPS THRU HOOPS.* + **PERFORM JUMPS THRU HOOPS.** *Brian Tiffin* -* What did OpenCOBOL reply to the executive? Sir, I can +* What did OpenCOBOL reply to the executive? *Sir, I can* - *PERFORM JUMPS THRU FLAMING-HOOPS UNTIL HELL-FREEZES-OVER.* + **PERFORM JUMPS THRU FLAMING-HOOPS UNTIL HELL-FREEZES-OVER.** - And being COBOL, I have to show you how little code it takes: + *And being COBOL, I have to show you how little code it takes:* :: @@ -230,21 +338,44 @@ Q. What is the development history of OpenCOBOL? ------------------------------------------------ OpenCOBOL was initially developed by Keisuke Nishida [Keisuke]_ +from work on TinyCOBOL_ originally developed by Rildo Pragana. The first public release was version 0.9.0 on January 25th, 2002. + Development continued apace, with version 0.30 released by Keisuke on August 8th, 2004. -Roger While then took up the role as lead developer on October 30th, 2004. -Version 0.31 was released February 1st, 2005. +Roger While [Roger]_ then took up the role as lead developer on +October 30th, 2004. +Version 0.31 + was released February 1st, 2005. +Version 0.32 + was released May 12th, 2005. +Version 0.33 + started on May 13th, 2005. +Version 1.0 + was released on December 27th, 2007. + -------------------------------------------- Q. What is the current version of OpenCOBOL? -------------------------------------------- -OpenCOBOL 1.0 was released December 27th, 2007 by Roger While [Roger]_. The -decision to go 1.0 from the 0.33 version followed the 0.32 release of -05-May-2005. +OpenCOBOL 1.0 was released December 27th, 2007 by Roger While [Roger]_. +The decision to go 1.0 from the 0.33 version followed many incremental +enhancements from 2005 through till late in 2007. + +OpenCOBOL 1.1 pre-release became active on December 27th, 2007 and is +currently in active development. The pre-release source tar can be found +at `OpenCOBOL 1.1`_ with installer instructions at `OpenCOBOL Install`_ and +in the INSTALLING text file of the sources. + +----------------------------------------- +Q. Are there pre-built OpenCOBOL packages +----------------------------------------- +Yes. Debian APT, and RPM packages exist. Packages for NetBSD. Many. +Google *opencobol packages* for any late breaking news. + A Debian apt binary package exists for OpenCOBOL 1.0 as **open-cobol** and lists dependencies of @@ -260,17 +391,6 @@ Thanks to the gracious efforts of Bart Martens, bartm on Debian's .org domain. -OpenCOBOL 1.1 pre-release became active on December 27th, 2007 and is -currently in active development. The pre-release source tar can be found -at `OpenCOBOL 1.1`_ with installer instructions at `OpenCOBOL Install`_ and -in the INSTALLING text file of the sources. - ------------------------------------------ -Q. Are there pre-built OpenCOBOL packages ------------------------------------------ -Yes. Debian APT, and RPM packages exist. Packages for NetBSD. Many. -Google *opencobol packages* for any late breaking news. - =============== Using OpenCOBOL =============== @@ -280,6 +400,16 @@ ------------------------------ Installation instructions can be found at `OpenCOBOL Install`_. +Debian + The Debian binary package makes installing OpenCOBOL 1.0 a snap. + From **root** or using sudo:: + + $ apt-get open-cobol + +Windows + Build from sources under Cygwin or MinGW. Follow the instructions + from the site listed above. + ---------------------------------------------- Q. Does OpenCOBOL have any other dependencies? ---------------------------------------------- @@ -315,7 +445,6 @@ libncurses can be used to implement SCREEN SECTION. Ncurses is licensed under a BSD-style license. - ---------------------------------------- Q. How does the OpenCOBOL compiler work? ---------------------------------------- @@ -352,13 +481,11 @@ 000500 DISPLAY "Hello World!". 000600 STOP RUN. -OpenCOBOL stages; +OpenCOBOL stages:: -:: - $ cobc -E hello.cob -Preprocess only; produces +Preprocess only; For one thing, FIXED format becomes FREE format. For another COPY is processed. Displays :: @@ -399,6 +526,13 @@ Build dynamically loadable module. The is the *default behaviour*. This example produces **hello.so** or **hello.dll**. + +:: + + $ cobcrun hello + +Will scan the DSO_ hello.so, and then link, load, and execute hello. + .. Attention:: Need a little OS/X info here :: @@ -447,8 +581,8 @@ the entry point and executes the code, right from the DSO_. **cobcrun** *is the compiler author's preferred way to manage OpenCOBOL -development.* It alleviates knowing which source file needs *-x* and -encourages proper modular programming, a mainstay of OpenCOBOL. +development.* It alleviates knowing which source file needs *-x* while +encouraging proper modular programming, a mainstay of OpenCOBOL. ---------------------- Q. What is cob-config? @@ -456,8 +590,18 @@ **cob-config** is a program that can be used to find the C compiler flags and libraries required for compiling. Using GNU/Linux for example:: + $ cob-config + Usage: cob-config [OPTIONS] + Options: + [--prefix[=DIR]] + [--exec-prefix[=DIR]] + [--version] + [--libs] + [--cflags] $ cob-config --libs -L/usr/local/lib -lcob -lm -lgmp -lncurses -ldb + $ cob-config --cflags + -I/usr/local/include You may need to use these features during mixed source language development, usually by back-ticking the command output inline with other **gcc** commands. @@ -465,7 +609,6 @@ --------------------------------------- Q. What compiler options are supported? --------------------------------------- - .. Note to maintainers. Build with $ cobc --help and indent 4 spaces. :: @@ -527,7 +670,6 @@ -ftrace Generate trace code (Executed SECTION/PARAGRAPH) -ftraceall Generate trace code (Executed SECTION/PARAGRAPH/STATEMENTS) -fsyntax-only Syntax error checking only; don't emit any output - -fstatic-call Output static function calls for the CALL statement -fdebugging-line Enable debugging lines ('D' in indicator column) -fsource-location Generate source location code (Turned on by -debug or -g) -fimplicit-init Do automatic initialization of the Cobol runtime system @@ -539,7 +681,34 @@ -ffold-copy-upper Fold COPY subject to upper case (Default no transformation) -fnotrunc Do not truncate binary fields according to PIC (ala MF) -fnull-param Pass extra NULL terminating pointers on CALL statements - + +-------------------------------------------- +Q. What dialects are supported by OpenCOBOL? +-------------------------------------------- +Using the **std=** compiler option, OpenCOBOL can be configured to +compile using specific historical COBOL compiler features and quirks. + +Supported dialects include: + +* default +* cobol85 +* cobol2002 +* ibm +* mvs +* mf +* bs2000 + +For details on what options and switches are used to support these dialect +compiles, see the **config/** directory of your OpenCOBOL installation. For +Debian GNU/Linux, that will be **/usr/share/open-cobol/config/** if you used +APT to install an OpenCOBOL package or **/usr/local/share/open-cobol/config/** +after a build from the source archive. + +For example: the *bs2000.conf* file restricts data representations to 2, 4 or +8 byte binary while *mf.conf* allows data representations from 1 thru 8 bytes. +*cobol85.conf* allows debugging lines, *cobol2002.conf* configures the +compiler to warn that this feature is obsolete. + ----------------------------------------- Q. What are the OpenCOBOL reserved words? ----------------------------------------- @@ -618,8 +787,7 @@ ---------------------------------- Q. Does OpenCOBOL support modules? ---------------------------------- -Yes. Quite nicely in fact. Dynamically! *Or when using the **-fstatic_call** -compiler option, Statically! for optimal performance*. COBOL_ modules, and +Yes. Quite nicely in fact. Dynamically! COBOL_ modules, and object files of many other languages are linkable. As OpenCOBOL uses intermediate C, linkage to other languages is well supported across many platforms. The OpenCOBOL CALL_ instruction maps COBOL USAGE_ to many common @@ -652,7 +820,6 @@ --------------------------------------------- Q. What is the OpenCOBOL LINKAGE SECTION for? --------------------------------------------- - Argument passing in COBOL is normally accomplished through the **LINKAGE SECTION**. This section does not allocate or initialize memory as would definitions in the WORKING-STORAGE SECTION. @@ -670,7 +837,7 @@ memory that has been addressed becomes unaddressable across calls. *-fstatic-linkage* creates static addressing to the LINKAGE SECTION. -From Roger While:: +From [Roger]_:: This relates to LINKAGE items that are NOT referred to in the USING phrase of the PROCEDURE DIVISION. @@ -693,16 +860,117 @@ SCREEN SECTIONs. Experimental release for this support occurred in early July, 2008. +The compiler recognizes most (if not all) of the +*Screen description entry* of the COBOL 2008 Draft standard. + +External variables that influence screen handling include + +COB_SCREEN_EXCEPTIONS=Y + To enable exceptions during ACCEPT. + +COB_SCREEN_ESCAPE=Y + To enable handling of the escape key. + +See `Q. Does OpenCOBOL support CRT STATUS?`_ for more information on +key codes and exception handling. + +According to the standard a SCREEN SECTION ACCEPT does not need to be +proceeded by a DISPLAY. The extra DISPLAY won't hurt, but is not +necessary. + +------------------------------------------------------- +Q. What are the OpenCOBOL SCREEN SECTION colour values? +------------------------------------------------------- +The FOREGROUND-COLOR and BACKGROUND-COLOR clauses will accept + +:: + + 78 black value 0. + 78 blue value 1. + 78 green value 2. + 78 cyan value 3. + 78 red value 4. + 78 magenta value 5. + 78 brown value 6. + 78 white value 7. + +The display of these colours are also influenced by HIGHLIGHT, LOWLIGHT +and REVERSE-VIDEO options. For instance, brown will display as yellow +when HIGHLIGHT is used. + +------------------------------------- +Q. Does OpenCOBOL support CRT STATUS? +------------------------------------- +Yes. + +:: + + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + SPECIAL-NAMES. + CRT STATUS IS screen-status. + + DATA DIVISION. + WORKING-STORAGE SECTION. + COPY screenio. + 01 screen-status pic 9(4). + + PROCEDURE DIVISION. + ACCEPT screen-sample. + IF screen-status = COB-SCR-F1 + ... + +There is also a special OpenCOBOL variable, **COB-CRT-STATUS** +which can be used instead of the CRT STATUS special name. + +There is also a COPY text that ships with OpenCOBOL, copy/screenio.cpy +that can be included in the DATA DIVISION and provides 78 level constants +for supported key status codes. Some values include: + +* COB-SCR-F1 thru +* COB-SCR-F64 +* COB-SCR-ESC + +examine the file to see the other values. + ------------------------------------------ Q. Does OpenCOBOL implement Report Writer? ------------------------------------------ Not at this time. *July, 2008* +But it does support LINAGE. See `Q. Does OpenCOBOL implement LINAGE?`_ + +----------------------------------- +Q. Does OpenCOBOL implement LINAGE? +----------------------------------- +Yes. LINAGE sets up logical pages inside file descriptors enhancing +the WRITE operations and enabling the END-OF-PAGE clause. + +:: + + FILE SECTION. + FD A-REPORT + LINAGE IS 13 LINES + TOP 2 + FOOTING 2 + BOTTOM 3. + +LINAGE clauses can set:: + + TOP + LINES + FOOTING + BOTTOM + +The LINAGE-COUNTER_ noun is maintained during writes to LINAGE output files. + ---------------------------------------------------- Q. Does OpenCOBOL implement any Intrinsic Functions? ---------------------------------------------------- -Yes, many. As of the July 2008 1.1 pre-release:: +Yes, many. As of the July 2008 1.1 pre-release +:: + ABS, ACOS, ANNUITY, ASIN, ATAN, BYTE-LENGTH, CHAR, COS, CURRENT-DATE, DATE-OF-INTEGER, DATE-TO-YYYYMMDD, DAY-OF-INTEGER, DAY-TO-YYYYDDD, E, EXCEPTION-FILE, EXCEPTION-LOCATION, EXCEPTION-STATEMENT, EXCEPTION-STATUS, @@ -714,14 +982,194 @@ STANDARD-DEVIATION, STORED-CHAR-LENGTH, SUM, TAN, TEST-DATE-YYYYMMDD, TEST-DATE-YYYYMMDD, TRIM, UPPER-CASE, VARIANCE, WHEN-COMPILED, YEAR-TO-YYYY +.. Note: More TODO here + +ABS + Absolute value. + +ACOS + The ACOS function returns a numeric value (in radians) that + approximates the arccosine of the argument. + + The domain of the arccosine function is -1 to +1. Domain errors + return a result of 0. The inverse cosine function returns a range + of 0 thru |PI|. + + DISPLAY FUNCTION ACOS(-1). + +---------------------------------------------------- +Q. Can you clarify the use of FUNCTION in OpenCOBOL? +---------------------------------------------------- +Yes. This information is from [Roger]_, posted to the opencobol_ forums. + +:: + + Just to clarify the use of FUNCTION. + (Applies to 0.33) + FUNCTION (generally speaking, there are exceptions) can + be used anywhere where a source item is valid. + It always results in a new temporary field. + This will have the desired characteristics dependant + on the parameters. + eg. FUNCTION MIN (x, y, z) + with x PIC 99 + y PIC 9(8) COMP + z PIC 9(6)V99 + will result in returning a field that has + at least 8 positions before the (implied) decimal + point and 2 after. + + It does NOT ever change the contents of parameters + to the function. + + FUNCTION's are nestable. + eg. + + DISPLAY FUNCTION REVERSE (FUNCTION UPPER-CASE (myfield)). + +One clarification to the above quote was pointed out by Roger. The line:: + + be used anywhere where a source item is valid. + +should be:: + + be used anywhere where a sending field is valid. + ---------------------------------------------------------------------- Q. What is the difference between the LENGTH verb and FUNCTION LENGTH? ---------------------------------------------------------------------- -From Roger While:: +From [Roger]_:: The standard only defines FUNCTION LENGTH. The LENGTH OF phrase is an extension (from MF) +--------------------------------------------------- +Q. What standard CALL library does OpenCOBOL offer? +--------------------------------------------------- +OpenCOBOL 1.0 ships with quite a few callable features. See CALL_ +Looking through the source code, you'll find the current list of service +calls in:: + + libcob/system.def + +With the 1.1 pre-release of July 2008, that list included:: + + /* COB_SYSTEM_GEN (external name, number of parameters, internal name) */ + + COB_SYSTEM_GEN ("SYSTEM", 1, SYSTEM) + COB_SYSTEM_GEN ("CBL_ERROR_PROC", 2, CBL_ERROR_PROC) + COB_SYSTEM_GEN ("CBL_EXIT_PROC", 2, CBL_EXIT_PROC) + COB_SYSTEM_GEN ("CBL_OPEN_FILE", 5, CBL_OPEN_FILE) + COB_SYSTEM_GEN ("CBL_CREATE_FILE", 5, CBL_CREATE_FILE) + COB_SYSTEM_GEN ("CBL_READ_FILE", 5, CBL_READ_FILE) + COB_SYSTEM_GEN ("CBL_WRITE_FILE", 5, CBL_WRITE_FILE) + COB_SYSTEM_GEN ("CBL_CLOSE_FILE", 1, CBL_CLOSE_FILE) + COB_SYSTEM_GEN ("CBL_FLUSH_FILE", 1, CBL_FLUSH_FILE) + COB_SYSTEM_GEN ("CBL_DELETE_FILE", 1, CBL_DELETE_FILE) + COB_SYSTEM_GEN ("CBL_COPY_FILE", 2, CBL_COPY_FILE) + COB_SYSTEM_GEN ("CBL_CHECK_FILE_EXIST", 2, CBL_CHECK_FILE_EXIST) + COB_SYSTEM_GEN ("CBL_RENAME_FILE", 2, CBL_RENAME_FILE) + COB_SYSTEM_GEN ("CBL_GET_CURRENT_DIR", 3, CBL_GET_CURRENT_DIR) + COB_SYSTEM_GEN ("CBL_CHANGE_DIR", 1, CBL_CHANGE_DIR) + COB_SYSTEM_GEN ("CBL_CREATE_DIR", 1, CBL_CREATE_DIR) + COB_SYSTEM_GEN ("CBL_DELETE_DIR", 1, CBL_DELETE_DIR) + COB_SYSTEM_GEN ("CBL_AND", 3, CBL_AND) + COB_SYSTEM_GEN ("CBL_OR", 3, CBL_OR) + COB_SYSTEM_GEN ("CBL_NOR", 3, CBL_NOR) + COB_SYSTEM_GEN ("CBL_XOR", 3, CBL_XOR) + COB_SYSTEM_GEN ("CBL_IMP", 3, CBL_IMP) + COB_SYSTEM_GEN ("CBL_NIMP", 3, CBL_NIMP) + COB_SYSTEM_GEN ("CBL_EQ", 3, CBL_EQ) + COB_SYSTEM_GEN ("CBL_NOT", 2, CBL_NOT) + COB_SYSTEM_GEN ("CBL_TOUPPER", 2, CBL_TOUPPER) + COB_SYSTEM_GEN ("CBL_TOLOWER", 2, CBL_TOLOWER) + COB_SYSTEM_GEN ("\364", 2, CBL_XF4) + COB_SYSTEM_GEN ("\365", 2, CBL_XF5) + COB_SYSTEM_GEN ("\221", 2, CBL_X91) + COB_SYSTEM_GEN ("C$NARG", 1, cob_return_args) + COB_SYSTEM_GEN ("C$PARAMSIZE", 1, cob_parameter_size) + COB_SYSTEM_GEN ("C$MAKEDIR", 1, cob_acuw_mkdir) + COB_SYSTEM_GEN ("C$CHDIR", 2, cob_acuw_chdir) + COB_SYSTEM_GEN ("C$SLEEP", 1, cob_acuw_sleep) + COB_SYSTEM_GEN ("C$COPY", 3, cob_acuw_copyfile) + COB_SYSTEM_GEN ("C$FILEINFO", 2, cob_acuw_file_info) + COB_SYSTEM_GEN ("C$DELETE", 2, cob_acuw_file_delete) + COB_SYSTEM_GEN ("C$TOUPPER", 2, CBL_TOUPPER) + COB_SYSTEM_GEN ("C$TOLOWER", 2, CBL_TOLOWER) + COB_SYSTEM_GEN ("C$JUSTIFY", 1, cob_acuw_justify) + COB_SYSTEM_GEN ("CBL_OC_NANOSLEEP", 1, cob_oc_nanosleep) + +Note the "SYSTEM". This CALL sends a command string to the shell. It acts +as a wrapper to the standard C library "system" call. "SYSTEM" removes +any trailing spaces from the argument and appends the null terminator +required for the C library "system" call. Shell access opens yet another +powerful door for the OpenCOBOL programmer but diligent programmers will +still need to pay some heed to cross platform issues. + +------------------------------------------- +Q. What are the XF4, XF5, and X91 routines? +------------------------------------------- +From opencobol.org_ + +:: + + The CALL's X"F4", X"F5", X"91" are from MF. + You can find them in the online MF doc under + Library Routines. + + F4/F5 are for packing/unpacking bits from/to bytes. + 91 is a multi-use call. Implemented are the subfunctions + get/set cobol switches (11, 12) and get number of call params (16). + + Roger + +Use + +:: + + CALL X"F4" USING + BYTE-VAR + ARRAY-VAR + RETURNING STATUS-VAR + +to pack the last bit of each byte in the 8 byte ARRAY-VAR into corresponding +bits of the 1 byte BYTE-VAR. + +The X"F5" routine takes the eight bits of byte and moves them to the +corresponding occurrence within array. + +X"91" is a multi-function routine. + +:: + + CALL X"91" USING + RESULT-VAR + FUNCTION-NUM + PARAMETER-VAR + RETURNING STATUS-VAR + +As mentioned by Roger, OpenCOBOL supports FUNCTION-NUM of 11, 12 and 16. + +11 and 12 get and set the on off status of the 8 (eight) run-time OpenCOBOL +switches definable in the SPECIAL-NAMES_ paragraph. + +------------------------------------------------------ +Q. What is CBL_OC_NANOSLEEP OpenCOBOL library routine? +------------------------------------------------------ +CBL_OC_NANOSLEEP allows (upto) nanosecond sleep timing. It accepts a 64 bit +integer value. + +:: + + CALL "CBL_OC_NANOSLEEP" USING "500000000" + RETURNING STATUS + END-CALL + +Would wait one-half second. *It may be easier to grok if the source code +uses string catenation. "500" & "000000" for example.* + +And of course you can also use (preferred) numeric literals here. + ---------------------------------- Q. Can I use ctags with OpenCOBOL? ---------------------------------- @@ -740,6 +1188,66 @@ the above vi command would start an edit of the *first* file with an occurrence of WORKING-STORAGE found in the tags. +------------------------------------------- +Q. What about debugging OpenCOBOL programs? +------------------------------------------- +OpenCOBOL internal runtime checks are enabled with **-debug**. + +Support for tracing is enabled with **-ftrace** and **-ftraceall**. + +Source line location is enabled with **-fsource-location**. + +Activation of FIXED format **D** indicator debug lines is enabled with +**-fdebugging-line**. + +**-fstack-check** will perform stack checking when **-debug** or **-g** is +used. + +**-fsyntax-only** will ask the compiler to only check for syntax errors, +and not emit any output. + +Support for gdb_ is enabled with **-g**. + +:: + + $ gdb hello + GNU gdb 6.7.1-debian + Copyright (C) 2007 Free Software Foundation, Inc. + License GPLv3+: GNU GPL version 3 or later + This is free software: you are free to change and redistribute it. + There is NO WARRANTY, to the extent permitted by law. Type "show copying" + and "show warranty" for details. + This GDB was configured as "i486-linux-gnu"... + Using host libthread_db library "/lib/i686/cmov/libthread_db.so.1". + (gdb) break 106 + Breakpoint 1 at 0xOBFUSCA: file hello.c, line 106. + (gdb) break 109 + Breakpoint 2 at 0xTETHESY: file hello.c, line 109. + (gdb) run + Starting program: /home/brian/writing/cobol/hello + [Thread debugging using libthread_db enabled] + [New Thread 0xSTEMADDR (LWP 5782)] + [Switching to Thread 0xESSES6b0 (LWP 5782)] + + Breakpoint 1, hello_ (entry=0) at hello.c:106 + 106 cob_new_display (0, 1, 1, &c_1); + (gdb) cont + Continuing. + Hello World! + + Breakpoint 2, hello_ (entry=0) at hello.c:109 + 109 cob_set_location ("hello", "hello.cob", 6, "MAIN SECTION", "MAIN PARAGRAPH", "STOP"); + (gdb) cont + Continuing. + + Program exited normally. + (gdb) + +Setting a break at line 106 and 109 was found by a quick look through the C +code from **$ cobc -C hello.cob** and seeing where the DISPLAY call and +STOP RUN was located. Note: just because; the gdb displayed addresses were +obfuscated from this listing. + --------------------------------------- Q. Is there a C interface to OpenCOBOL? --------------------------------------- @@ -783,15 +1291,17 @@ * Add a zero terminator MOVE X"00" TO current-url(IND:1). -Roger While points out: +[Roger]_ While points out: *X"00" is almost always interchangeable with LOW-VALUE*. In all of the above snippets, the source code X"00" can be replaced by the -COBOL noun **LOW-VALUE** or *LOW-VALUES*. +COBOL noun **LOW-VALUE** or *LOW-VALUES*. *Except when a program collating +sequence is active and where the first character is not X"00"*. -.. Note to maintainers. This section is just wrong. BASED is a different - thing altogether and simply means the item does not have any permanent - storage area. +.. Note to maintainers. The section below is just wrong. BASED is a + different thing altogether and simply means the item does not have any + permanent storage area. Entry commented out until corrected. + .. When a parameter needs to be passed between C and OpenCOBOL, you can use .. the BASED optional clause in WORKING-STORAGE:: .. @@ -824,17 +1334,21 @@ handcrafting screens is tedious work, this package includes a "Screen Designer" utility. -See http://sourceforge.net/projects/cobcurses +See http://sourceforge.net/projects/cobcurses for full details. This is a +major piece of work by Warren Gay, ve3wwg. ---------------------------------------- Q. Does OpenCOBOL support COPY includes? ---------------------------------------- -Yes. COPY is supported, but some limitations to the REPLACING adverb -may be encountered. -.. Attention:: Look into this +Yes. COPY is fully supported, all variations from the standards up to and +including the proposed 2008 standards. -The **-I** compiler option influences the copybook search path. +The **-I** compiler option influences the copybook search path and +**-E** can be used to examine the *after* COPY preprocessor output. +There is also **-ffold-copy-upper** and **-ffold-copy-lower** compiler +controls. + ---------------------------------------- Q. Does OpenCOBOL support WHEN-COMPILED? ---------------------------------------- @@ -848,6 +1362,24 @@ 07/05/0805.15.20 2008070505152000-0400 +Note: The noun WHEN-COMPILED is non-standard and was deemed obsolete in the +pre 85 standard. + +--------------------------- +Q. What is PI in OpenCOBOL? +--------------------------- +With OpenCOBOL 1.1:: + + DISPLAY FUNCTION PI. + 3.1415926535897932384626433832795029 + + DISPLAY FUNCTION E. + 2.7182818284590452353602874713526625 + +Thats 34 digits after the decimal. Developers that need to know the +tolerances for use in calculations are directed to poke around the freely +available source code, and to read up on GMP_. + ------------------------------------------------------------------- Q. Does OpenCOBOL support the Object features of the 2002 standard? ------------------------------------------------------------------- @@ -859,6 +1391,16 @@ Yes. PICTURE 78 clauses can be used for constants, translated at compile time. This common non-standard extension is supported in OpenCOBOL. +-------------------------------------- +Q. Does OpenCOBOL implement CONSTANT? +-------------------------------------- +Current OC 1.1 has preliminary support for a subset of the standard +conforming "CONSTANT" phrase. eg:: + + 01  MYCONST CONSTANT AS 1. + +Note: there is a syntax difference between 78 and CONSTANT. + ------------------------------------------------- Q. What source formats are accepted by OpenCOBOL? ------------------------------------------------- @@ -870,22 +1412,124 @@ Column 12345678901234567890 - >> SOURCE FORMAT IS FREE - >> SOURCE FORMAT IS FIXED + >>SOURCE FORMAT IS FREE + >>SOURCE FORMAT IS FIXED -can be used as the first line of any source files. The directive must -occur at column 8 or beyond. +can be used. The directive must occur at column 8 or beyond if the ACTIVE +scan format is FIXED. As per the 2002 standard this directive can be used +to switch formats multiple times within a compilation unit. Continuation indicators in column 7 are not applicable to FREE format and -are not supported in this mode of translation. +are not supported in this mode of translation. String catenation can always +be used; the **&** operator. -The special *> till end of line comment is supported in both FREE and +The special \*> *till end of line* comment is supported in both FREE and FIXED forms, but by necessity will need to be placed at column 7 or greater -in FIXED format sources <*. +in FIXED format sources. +.. Note to readers. The comment operator is *> + the backslash is for ReST + The **-free** and **-fixed** options to **cobc** also influence the expected -source formats, with the default being FIXED. +source formats, with the default being mandated by the standards as FIXED. +--------------------------------------------- +Q. Does OpenCOBOL support continuation lines? +--------------------------------------------- +Yes. A dash **-** in column 7 can be used for continuation lines. But, by +necessity continuation lines only apply in FIXED format source code. FREE +format COBOL does not support continuation as there is no real meaning to +*column 7* in FREE form source. + +Note that in this example there is no terminating quote on the string +continuations, but there is an extra starting quote following the dash:: + + 123456789012345678901234567890123456789012345678901234567890123456789012 + identification division. + program-id. longcont. + + data division. + working-storage section. + 01 longstr pic X(80) + value "This will all be one string in FIXED forma + -"t source code". + 01 otherstr pic X(148) value "this + -"string will have spaces between the words THIS and STRING, as + -"continuation lines always fill to column 72.". + procedure division. + display longstr. + display length longstr. + display function length(function trim(longstr trailing)). + display otherstr(1:72). + display otherstr(73:75). + display length otherstr. + display function length(function trim(otherstr trailing)). + goback. + + $ cobc longcont.cob + $ cobcrun longcont + This will all be one string in FIXED format source code + 80 + 00000055 + this string will have spaces between the words + THIS and STRING, as continuation lines always fill to column 72. + 148 + 00000139 + +*Note: The DISPLAY of* **otherstr** *was split to avoid any wide +browser scrolling, not for any COBOL reasons.* + +*Also note that the rules for continuation lines are quite difficult to +describe simply and concerned OpenCOBOL programmers are urged to read +through the standards documents for full details.* + +----------------------------------------------- +Q. Does OpenCOBOL support string concatenation? +----------------------------------------------- +Absolutely. Sources that need long strings, or even simply enhance +readability, can use the **&** operator:: + + identification division. + program-id. longstr. + + data division. + working-storage section. + 01 longstr pic X(80) + value "This " & "will " & "all " & "be " & + "one " & + "string " & "in both FIXED and FREE" & + " format source code". + procedure division. + display longstr. + goback. + +Run this with:: + + $ cobc longstr.cob + $ cobcrun longstr + This will all be one string in both FIXED and FREE format source code + $ cobc -free longstr.cob + $ cobcrun longstr + This will all be one string in both FIXED and FREE format source code + +-------------------------------------------------- +Q. Does OpenCOBOL support D indicator debug lines? +-------------------------------------------------- +Yes, but only for FIXED FORMAT sources. As for continuation lines, column +7 has no meaning for SOURCE FORMAT IS FREE source code. Use **D** lines as +a conditional include of a source code line. These debug lines will only +be compiled if the *-fdebugging-line* compiler switch is used. + +From human on opencobol.org_ + +:: + + If you put a D in column 7 OC handles this as a comment. These lines are + only compiled if you run cobc with -fdebugging-line. + + By using this you can put some test messages etc. into your program that + are only used if necessary (and therefore build with -fdebugging-line). + ------------------------------------------------- Q. Does OpenCOBOL support mixed case source code? ------------------------------------------------- @@ -951,7 +1595,6 @@ :: - identification division. program-id. a. ------------------------------------------------------------------------- @@ -1002,6 +1645,50 @@ This has no effect on the compilation process, it only effects the appearance of the sources. +-------------------------------------------------------------------------- +Q. Is there a way to count trailing spaces in data fields using OpenCOBOL? +-------------------------------------------------------------------------- +Yes. Quite a few. But instead of resorting to a PERFORM VARYING sequence +try:: + + 01 B-COUNT PIC 999 VALUE 0. + 01 TEST-CASE PIC X(80) + VALUE "This is my string.". + + ONE-WAY. + INSPECT FUNCTION REVERSE(TEST-CASE) + TALLYING B-COUNT + FOR LEADING ' '. + DISPLAY B-COUNT. + + TWO-WAY. + INSPECT TEST-CASE + TALLYING B-COUNT + FOR TRAILING SPACE. + DISPLAY B-COUNT. + + THREE-WAY. + IF TEST-CASE EQUAL SPACES + COMPUTE B-COUNT = LENGTH OF TEST-CASE + ELSE + COMPUTE + B-COUNT = LENGTH TEST-CASE - + FUNCTION LENGTH(FUNCTION TRIM(TEST-CASE TRAILING)) + END-COMPUTE + END-IF + DISPLAY B-COUNT. + +produces:: + + 062 + 124 + 062 + +The second value is 124 as TWO-WAY accumulates another 62 after ONE-WAY. +The INSPECT verb does not initialize a TALLYING variable. + +Information modified from opencobol.org_ forum post. + ===== Notes ===== @@ -1015,11 +1702,17 @@ resolving the transfer address. The USING phrase allows argument passing and OpenCOBOL includes internal rules for the data representation of the call stack entities that depend on the COBOL PICTURE_ and USAGE_ clauses. -Return values are captured with RETURNING identifier. +Return values are captured with RETURNING identifier. See +`Q. What standard CALL library does OpenCOBOL offer?`_. For more information see http://www.opencobol.org/modules/bwiki/index.php?cmd=read&page=UserManual%2F2_3#content_1_0 +------------- +SPECIAL-NAMES +------------- +OpenCOBOL supports a fair complete set of the SPECIAL-NAMES in common use. + ------- PICTURE ------- @@ -1029,7 +1722,6 @@ ----- USAGE ----- - OpenCOBOL uses standard big-endian_ internal storage by default. USAGE clauses influence the data representation. The INTEL architecture uses little-endian_ form and OpenCOBOL programmers developing for this common @@ -1040,11 +1732,49 @@ big and little endian forms. Along with full support of all common COBOL_ PICTURE_ clauses both storage -and display, OpenCOBOL supports USAGE claues of: +and display, OpenCOBOL supports USAGE clauses of: * BINARY +* COMPUTATIONAL, COMP +* COMP-1 +* COMP-2 +* COMP-3 +* COMP-4 +* COMP-5 +* COMP-X +* DISPLAY +* INDEX +* PACKED-DECIMAL +* POINTER +* PROGRAM-POINTER +* SIGNED-SHORT +* SIGNED-INT +* SIGNED-LONG +* UNSIGNED-SHORT +* UNSIGNED-INT +* UNSIGNED-LONG +* BINARY-CHAR SIGNED +* BINARY-CHAR UNSIGNED +* BINARY-CHAR +* BINARY-SHORT SIGNED +* BINARY-SHORT UNSIGNED +* BINARY-SHORT +* BINARY-LONG SIGNED +* BINARY-LONG UNSIGNED +* BINARY-LONG +* BINARY-DOUBLE SIGNED +* BINARY-DOUBLE UNSIGNED +* BINARY-DOUBLE +* BINARY-C-LONG SIGNED +* BINARY-C-LONG UNSIGNED +* BINARY-C-LONG -.. Attention:: TODO +-------------- +LINAGE-COUNTER +-------------- +An internal OpenCOBOL noun, or *Special Register*. Value is readonly and is +maintained during WRITEs to files that have a LINAGE clause. Useful for +quick reports and logical page layouts. ---------- big-endian @@ -1084,7 +1814,6 @@ OpenCOBOL. Different than ASCII_ and OpenCOBOL supports both through efficient mappings. See http://en.wikipedia.org/wiki/EBCDIC for more info. - ----- ASCII ----- @@ -1096,6 +1825,11 @@ need programmer attention to detail. Although this is a rare case as OpenCOBOL operates using an intelligent choice of encoding for each platform build. + +See +http://en.wikipedia.org/wiki/American_Standard_Code_for_Information_Interchange +for more info. + .. Attention:: Look into this .. Attention:: Unicode? @@ -1105,13 +1839,27 @@ --- Dynamic Shared Objects. -Similar to but subtlety different from *share libraries*. +Similar to but subtlely different from *share libraries*. +--- +gdb +--- +The GNU symbolic debugger. Big, deep, wide. -See -http://en.wikipedia.org/wiki/American_Standard_Code_for_Information_Interchange -for more info. +:: + $ info gdb for the details. + +or visit http://www.gnu.org/software/gdb/documentation/ + +--- +GMP +--- +GNU MP libgmp. GNU Library for decimal arithmetic. See http://gmplib.org/ +for complete details on the library advertised as +*Arithmetic without limitations*. + + ======= Authors ======= @@ -1139,6 +1887,10 @@ Initial FAQ, sample programs for OpenCOBOL 1.1. +.. [aoirthoir] Joseph James Frantz + + Hosting, support. + ========= Changelog ========= @@ -1152,14 +1904,32 @@ 07-July-2008 Second 0.0 pre-alpha. +11-July-2008 + Last 0.0 pre-alpha. Checked in for diffs. + +13-July-2008 + Last-last 0.0 pre-alpha. Verify DIFF functionality. + +17-July-2008 + Last-last-last 0.0 pre-alpha. Second DIFF. + +20-July-2008 + Corrections pass. + +24-July-2008 + Expanded the SCREEN SECTION questions. + +28-July-2008 + Another correction pass, with clarifications from Roger While + .. These are the external link substitutions. .. _OpenCOBOL: http://opencobol.org/ .. _opencobol.org: http://opencobol.org/ .. _`OpenCOBOL 1.0`: http://opencobol.org/modules/mydownloads/singlefile.php?cid=1&lid=3 .. _`OpenCOBOL 1.1`: http://www.opencobol.org/modules/mydownloads/singlefile.php?cid=1&lid=2 .. _COBOL: http://en.wikipedia.org/wiki/COBOL -.. _`COBOL 85`: http://cantfind.org -.. _`COBOL 2002`: http://cantfind.org +.. _`COBOL 85`: http://www.cobolstandards.com/ +.. _`COBOL 2002`: http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=28805 .. _`COBOL FAQ`: http://home.comcast.net/~wmklein/FAQ/COBOLFAQ.htm .. _`OpenCOBOL Install`: http://www.opencobol.org/modules/bwiki/index.php?InstallGuide .. _`OpenCOBOL Wiki`: http://www.opencobol.org/modules/bwiki/ @@ -1168,10 +1938,14 @@ .. _`GNU General Public License`: http://www.gnu.org/licenses/gpl.html .. _`GNU Lesser General Public License`: http://www.gnu.org/licenses/lgpl.html - + +.. _TinyCOBOL: http://tiny-cobol.sourceforge.net/index.php + .. This section holds replacements and special symbols. .. |copysym| unicode:: 0xA9 .. |copyleft| replace:: Copyright |copysym| 2008 The OpenCOBOL Project +.. |PI| unicode:: 0x03C0 + .. |KeisukeActive| replace:: From the 1990s through 2004 .. |RogerActive| replace:: From early 2004 up till today, and tomorrow [/code] ---------------------------------------------------------------- Brian, You want to ring me tomorrow to remind me to get the subversion up and set you up an account? I assume we want it to be a public subversion? Also then, I will use svn export to grab the current version of the faq and always have it up to date... ---------------------------------------------------------------- Sounds groovy Joseph. I'm holding a talk about REBOL at the Ottawa Canada Linux User Group next Tuesday. http://oclug.on.ca And the end of the session I'm going to offer to put on an OpenCOBOL (primary goal) and/or ReStructuredText discussion. Having something on the weeb by Sept 2nd would be beautiful for that. I've piqued Roland's interest about ReST already, but I hope the group shows some interest in hearing about OpenCOBOL first and foremost. Cheers, Brian P.S. I don't know if you ever saw the commercial, but quite a few years ago there was a spot joking about how bad/sad computer salespeople were ... [i]Buy our machine and before you know it, you'll be surfin' the weeb.[/i] ---------------------------------------------------------------- Subject: COPY text or CALL USING for OCCAN? If we start to build up an OpenCOBOL community contribution library, being useful utilities and not just how-to samples, would you prefer COPY library texts or compilable modules? I hope the OCCAN (made up name, but the OpenCOBOL Comprehensive Archive Network acronymn has a nice ring to it) would support both, but what would be your preference? I envision that first up will be Search and Replace, a hex dump, and perhaps the libcurl accessor. So ... preferences? And if we do start this up, what would be the preferred naming conventions? Cheers, Brian ---------------------------------------------------------------- Subject: Plotting. gnuplot or R? Hello everyone; Another question. I was writing up a FAQ entry on some of the trig intrinsics and it got me thinking about plotting data. What would you prefer to see; an OpenCOBOL program that generated a [i]gnuplot[/i] or an [i]R[/i] script? gnuplot http://www.gnuplot.info/ R http://www.r-project.org/ The simple plan being; OC runs through a data sample and generates a text datafile and kicker script then calls "SYSTEM" using "gnuplot -persist script.gp" So far I've tested with gnuplot; pretty cool. R does offer quite a bit of power as well and a script runner similar to gnuplot, but may lead an OpenCOBOL programmer astray ... into the power of the R programming language. :) Again, this will not be an interface. Just writing text files and invoking the other apps. Anyone seriously into plotting would be better off using mustard and not our ketchup. Cheers, Brian P.S. For first time readers or those that didn't get that: [i]A computer without COBOL and Fortran is like a piece of chocolate cake without ketchup or mustard.[/i] John Krueger. I was just about to type that I was still trying to track down the author of that quote for the FAQ. Just found it ... along with these beauties: [i]COBOL has almost no fervent enthusiasts. As a programming tool, it has roughly the sex appeal of a wrench.[/i] Charles Petzold. [i]COBOL is a very bad language, but all the others (for business data processing) are so much worse.[/i] Robert Glass. And the page I finally found it on; http://sysprog.net/quotcob.html really highlights the fact that Edsger Dijkstra really didn't like COBOL much. ;) That, and that we really really need someone to start writing positive quips about COBOL. :) Excuse the ramble. I'd still like to know if the OC community prefers gnuplot or R or even "Don't care, don't bother, I'll use mustard". ---------------------------------------------------------------- gnuplot it is. :) You'll need a gnuplot installation to run this sample. The plot window is persisted, so you'll need to close it manually. Any range and domain issues are left as an exercise to those that wish to change what values are set into y-value. I'm not going to claim any expertise with gnuplot. prog.gp may be a poor choice of name for the script. There will be options to make this look cooler. 2000 data points may be overkill. The code should write the prog.gp on the fly and allow for plot options ... yada yada bobloblaw. :-) And there is always the truth that this particular sine wave data set can simply be plotted with [i]plot sin(x)[/i] in gnuplot, but what fun would that be. Cheers, Brian prog.gp[code] plot 'gpdata.txt' with lines [/code] sinewave.cob[code] >>SOURCE FORMAT IS FIXED ****************************************************************** * Author: Brian Tiffin * Date: 29-July-2008 * Purpose: Plot a sine curve * Tectonics: requires access to gnuplot. http://www.gnuplot.info * prog.gp is "plot 'gpdata.txt' with lines" * cobc -Wall -x sinewave.cob ****************************************************************** identification division. program-id. sinewave. environment division. input-output section. file-control. select outfile assign to "gpdata.txt" organization is line sequential. data division. file section. fd outfile. 01 outrec. 03 x-value pic -zzzzzz9.99. 03 filler pic x. 03 y-value pic -zzzz9.9999. working-storage section. 01 result pic s9(9). 01 float pic s9(7)v99. 01 gplot pic x(24) value is 'gnuplot -persist prog.gp'. procedure division. open output outfile. move spaces to outrec. perform varying float from -10 by 0.01 until float > 10 move float to x-value move function sin(float) to y-value write outrec end-perform. close outfile. call "SYSTEM" using gplot returning result end-call. if result not = 0 display "Problem: " result end-display end-if. goback. [/code] ---------------------------------------------------------------- Hello Brian, Gnuplot seems fine. Thank you for posting such examples. Bear ---------------------------------------------------------------- New plots; two windows, sin(x) and cos(x) and then an Income/Expense/Worth report plot. Note; I was more into tweaking the gnuplot info, and I didn't look into the best way of overlaying the use of gpdata.txt with the two output record formats, or if there was a cleaner way to generate the gnuplot script lines. Like a DISPLAY UPON somefile? Cheers, Brian [code] >>SOURCE FORMAT IS FIXED ****************************************************************** * Author: Brian Tiffin * Date: 29-July-2008 * Purpose: Plot trig and a random income/expense/worth report * Tectonics: requires access to gnuplot. http://www.gnuplot.info * cobc -Wall -x plotworth.cob * OVERWRITES prog.gp and gpdata.txt ****************************************************************** identification division. program-id. plotworth. environment division. input-output section. file-control. select scriptfile assign to "prog.gp" organization is line sequential. select outfile assign to "gpdata.txt" organization is line sequential. select moneyfile assign to "gpdata.txt" organization is line sequential. data division. file section. fd scriptfile. 01 gnuplot-command pic x(82). fd outfile. 01 outrec. 03 x-value pic -zzzzzz9.99. 03 filler pic x. 03 sin-value pic -zzzz9.9999. 03 filler pic x. 03 cos-value pic -zzzz9.9999. fd moneyfile. 01 moneyrec. 03 timefield pic 9(8). 03 filler pic x. 03 income pic -zzzzzz9.99. 03 filler pic x. 03 expense pic -zzzzzz9.99. 03 filler pic x. 03 networth pic -zzzzzz9.99. working-storage section. 01 angle pic s9(7)v99. 01 dates pic 9(8). 01 days pic s9(9). 01 worth pic s9(9). 01 amount pic s9(9). 01 gplot pic x(80) value is 'gnuplot -persist prog.gp'. 01 result pic s9(9). procedure division. * Create the script to plot sin and cos open output scriptfile. move "plot 'gpdata.txt' using 1:2 with lines title 'sin(x)'" - to gnuplot-command. write gnuplot-command. move "replot 'gpdata.txt' using 1:3 with lines title 'cos(x)'" - to gnuplot-command. write gnuplot-command. close scriptfile. * Create the sinoidal data open output outfile. move spaces to outrec. perform varying angle from -10 by 0.01 until angle > 10 move angle to x-value move function sin(angle) to sin-value move function cos(angle) to cos-value write outrec end-perform. close outfile. * Invoke gnuplot call "SYSTEM" using gplot returning result. if result not = 0 display "Problem: " result stop run returning result end-if. * Generate script to plot the random networth open output scriptfile. move "set xdata time" to gnuplot-command. write gnuplot-command. move 'set timefmt "%Y%m%d"' to gnuplot-command. write gnuplot-command. move 'set format x "%m"' to gnuplot-command. write gnuplot-command. move 'set title "Income and expenses"' to gnuplot-command. write gnuplot-command. move 'set xlabel "2008 / 2009"' to gnuplot-command. write gnuplot-command. move 'plot "gpdata.txt" using 1:2 with boxes title "Income" -' linecolor rgb "green"' to gnuplot-command. write gnuplot-command. move 'replot "gpdata.txt" using 1:3 with boxes title "Expense" -' linecolor rgb "red"' to gnuplot-command. write gnuplot-command. move 'replot "gpdata.txt" using 1:4 with lines title "Worth"' - to gnuplot-command. write gnuplot-command. close scriptfile. * Generate a bi-weekly dataset with date, income, expense, worth open output moneyfile. move spaces to moneyrec. move function integer-of-date(20080601) to dates. move function random(0) to amount. perform varying days from dates by 14 until days > dates + 365 move function date-of-integer(days) to timefield compute amount = function random() * 2000 compute worth = worth + amount move amount to income compute amount = function random() * 1800 compute worth = worth - amount move amount to expense move worth to networth write moneyrec end-perform. close moneyfile. * Invoke gnuplot again. Will open new window. call "SYSTEM" using gplot returning result. if result not = 0 display "Problem: " result stop run returning result end-if. goback. [/code] ---------------------------------------------------------------- Subject: make : warnings at installation Hello I was installing a new post of OC when I noticed this warning : [code] make[3]: entrant dans le répertoire « /home/soft/open-cobol-1.1/cobc » if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium3 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-cobc.o -MD -MP -MF ".deps/cobc-cobc.Tpo" -c -o cobc-cobc.o `test -f 'cobc.c' || echo './'`cobc.c; \ then mv -f ".deps/cobc-cobc.Tpo" ".deps/cobc-cobc.Po"; else rm -f ".deps/cobc-cobc.Tpo"; exit 1; fi cobc.c:195: warning: pointer targets in initialization differ in signedness cobc.c:196: warning: pointer targets in initialization differ in signedness [/code] cobc (OpenCOBOL) 1.1.0 Build date Jul 30 2008 09:48:51 Copyright (C) 2001-2008 Keisuke Nishida / Roger While Kind regards Bear (back from holidays) ---------------------------------------------------------------- Fixed in current 1.1 tarball. As and added bonus you get the package date - > cobc --version cobc (OpenCOBOL) 1.1.0 Built Jul 30 2008 12:15:39 Packaged Wed Jul 30 11:23:52 CEST 2008 Copyright (C) 2001-2008 Keisuke Nishida / Roger While Also in genned C code (and the header xxx.c.h) - /* Generated from systemcall.cob by cobc 1.1.0 */ /* Built - Jul 30 2008 12:15:39 */ /* Packaged - Wed Jul 30 11:23:52 CEST 2008 */ Roger ---------------------------------------------------------------- Thank you Roger, It's useful to have this information. Regards Bear ---------------------------------------------------------------- Subject: OC1.1 compile with vbISAM Hello, It became an error as follows though OC1.1 was compiled applying the configure option of `--with-vbisam'. [quote] ... gcc -O2 -march=i386 -mcpu=i686 -march=i686 -mtune=pentium4 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -Wl,--export-dynamic -o .libs/cobcrun cobcrun-cobcrun.o -L/usr/src/redhat/BUILD/open-cobol-1.1/libcob /usr/src/redhat/BUILD/open-cobol-1.1/libcob/.libs/libcob.so -lm -lgmp -lncurses -lvbisam /usr/src/redhat/BUILD/open-cobol-1.1/libcob/.libs/libcob.so: undefined reference to `isfullclose' [/quote] Perhaps, when "# ifdef WITH_VBISAM" in three places was removed, it was possible to compile because there was no `isfullclose' in vbISAM 1.03beta, and it was guessed that it was a cause in `isclose' it was. Is it safe in this correspondence? ---------------------------------------------------------------- NO. Use http://www.sim-basis.de/vbisam-2.0.tar.gz No version < 2.0 is supported. This is without any guarantee that this is stable. It DOES pass OC/NIST 85 tests. (And a customer provided simulated multi-user-test) Roger ---------------------------------------------------------------- Thanks, Roger It downloads now and it tries. The spec file for the rpm package etc. are made (If everyone still is not making it). Hiroki ---------------------------------------------------------------- Subject: Fail to compile my first program. I fail to compile my first COBOL source code. The source code is shown below: [code] IDENTIFICATION DIVISION. PROGRAM-ID. Hello. PROCEDURE DIVISION. DISPLAY "Hello.". STOP RUN. [/code] When I compile the program with command: cobc test.cob I got this [quote] test.cob:1: Warning: Invalid indicator 'F' at column 7 test.cob:4: Warning: Invalid indicator 'Y' at column 7 test.cob:1: Error: syntax error, unexpected WORD, expecting PROGRAM_ID [/quote] How can I correct this? Thank you very much. ---------------------------------------------------------------- Read the COBOL standard :-) Roger ---------------------------------------------------------------- Don't mind Roger, yong. He's trying to get us all to understand COBOL. Little does he realize that we want him to do most (all) of the hard work and deep thinking, so we can just enjoy the ride. :) Anyway, insert 7 spaces on every line (COBOL uses a FIXED source format by default). A COBOL source line is historically 6 characters of sequence number, column 7 for indicators, like * comments or - continuation lines and the actual source code starts in column 8 (and should really only go to column 72). That is fairly old school COBOL (but is still the default as per the standards). You can also insert a compiler directive [code] columns 12345678901234567890 >>SOURCE FORMAT IS FREE [/code] as the first line of the file. Where the word columns and the numbers are just there to highlight the fact that the SOURCE FREE directive needs to start in column 8 (as the compiler will still be assuming FIXED format source) or you can use the -free compile switch. [code] $ cobc -x -free hello.cob [/code] to tell the compiler to expect FREE format source by default. Cheers, Brian ---------------------------------------------------------------- yeah, it works :D Thank you very much and best regards : ) ---------------------------------------------------------------- The hello word does not works ! I do also the same and I got the same mistake. What is the correct hello world ? ---------------------------------------------------------------- Subject: Advocacy. A promotional talk at OCLUG Hello everyone, I'll (very probably) be holding a short talk on the topic of OpenCOBOL at the next Ottawa Canada Linux User Group monthly meeting, Sept 2. Information will be posted at http://oclug.on.ca when I finalize the arrangements with Roland. I'll post a reminder once the details are online, but for now I'd like to ask if anyone here has suggestions on any key talking points that should be covered or perhaps a short paragraph on how best to advertise the discussion on the OCLUG website. Meetings are held in a college campus lecture room with speakers given access to the network and a screen projector. I'll likely ask for a 30 minute time slot. Cheers, Brian ---------------------------------------------------------------- Brian, excellent. I'm looking forward to your results. Hopefully you can record it? About November I will begin programming classes for our web design meetup. If the other programmers step up to the plate, then we might be using a more traditional web language like php. If not, they are going to learn cobol. ---------------------------------------------------------------- Just got the go ahead from the OCLUG moderator. September 2nd. Scheduled for a 30 minute talk. Soonish, there will be a blurb posted to http://oclug.on.ca I'll see if I can't wrangle some form of recording. Cheers everyone, Brian ---------------------------------------------------------------- Very exciting news. ---------------------------------------------------------------- Tomorrow at 7pm. Ottawa, Algonquin College, Woodroffe Campus, room T177. http://oclug.on.ca for more details. Be prepared to see OpenCOBOL adoption rates drop to near zero sometime around 8pm. :-) Cheers, Brian ---------------------------------------------------------------- How'd it go? ---------------------------------------------------------------- It went well (I think). I'll know more about the impact at next month's meeting. Oct 7. I'll be signing up to do a talk on ReST for that one, but I should find out if anyone in the group tried OpenCOBOL then. One thing that really got me; In a room full of techies, when I asked the group who knew what COBOL was an acronym for (expecting one or two of the younger hands to go up) over half the crowd seemed to shake their heads not knowing. I don't understand. What it is with the kids now-a-days? (Average age of crowd ... probably 30+). :-) CGI seemed to garner the most questions; with more questions around that topic than anything else. But I'm all confused. What technically minded person doesn't know about COBOL? Until tonight I would have guessed under 10%. WRONG! It's like the two hundred thousand million lines of code are buried in secret banking and government systems or something. :) Now, to be fair; this is a pro open source GNU/Linux crowd, and perhaps the predominance of the commercial COBOL tools just isn't on the group's day to day radar. OpenCOBOL is on that map now. At least for these few people ... I hope. Cheers, Brian ---------------------------------------------------------------- Brian, I'm not surprised. Every time a programmer hears that I am into COBOL, they have a list of objects. So far every object is wrong. The only one that MIGHT be close to being right, is that COBOL is more verbose than other languages. Well it's also more verbose than Regular Expressions. A lot of good that will do you fifty years from now when you want to change one of those guys. Even so though, I've found that most of the time my programs are not more verbose than others. Some of the time they are. In all cases it is far easier to figure out what I did and make changes in COBOL than it is with a less verbose language. Additionally I do not have to concern myself all of the time about adding extra comments, just to say what I did. Some claims that have been made to me about COBOL: It won't do XML. False. It won't output HTML. False. It cannot connect to an SQL DBMS. False (WHERE does this one even come from? IBM? DB2? ANYBODY?) It suffers from code injection. False. What? Seriously folks. Someone that uses PHP talking to a COBOL guy about the potential for code injection? (I'm not disrespecting PHP but let's know the facts)> It only runs in console. False. (Currently OC does, but that's going to change real soon). It's not used. False. It's difficult for people to learn. FALSE with a capital NO WAY JOSE and a big red cloak. It's not OOP. False. The spec exists for oop and a couple of the compilers support some of this. OC does not yet as far as I know, but that will change soon. I could go on. But so far every claim has just been wrong, and most are downright silly. What language CANT be used to generate text, thus HTML? The kids just have to be taught. ---------------------------------------------------------------- Subject: Asynchronous calls to the system Using Call 'SYSTEM' the COBOL program executes the command and waits for the command to complete. This is often very useful. But what about running asynchronous, so that the command runs independently of the COBOL program? If I'm right, there was some stuff like that in ACU called 'C$RUN'/'C$SYSTEM', where 'C$RUN' is called like 'SYSTEM' is and 'C$SYSTEM' had to be called with some special flags for running like 'C$RUN' or 'SYSTEM' (maybe there were other flags, too). Is there something available for running asynchronous commands in OC? ---------------------------------------------------------------- How much control do you need? A quick and dirty (under GNU/Linux) is to simply append "&" to end of your system command pipeline. It'll pass the command to a background process and give control back to OpenCOBOL almost immediately. Result value may not be usable - etc so there are issues with this method. Cheers, Brian For example: [code] identification division. program-id. hack-asynch. data division. working-storage section. 01 result pic s9(9). procedure division. display "Sleep for 2". call "SYSTEM" using "time sleep 2" returning result. display "First: " result. display "Sleep for 4 in background". call "SYSTEM" using "time sleep 4&" returning result. display "Second: " result. goback. [/code] [code] brian@sylvester:~/writing/cobol$ ./hack-asynch Sleep 2 real 0m2.001s user 0m0.000s sys 0m0.000s First: +000000000 Sleep 4 in background Second: +000000000 brian@sylvester:~/writing/cobol$ real 0m4.002s user 0m0.000s sys 0m0.004s [/code] ---------------------------------------------------------------- Interesting! But I like to do stuff like this on all OS, so there are some "native" things of OC necessary. Are there any? ---------------------------------------------------------------- I did a little digging. Signals won't help here I don't think. Until Roger answers, I'm not sure, but another option is to conditionally (dependant on Windows - not even sure how to tell in an all cases reliable way) use "... &" for real operating systems or "START /B ..." on the toy OS. START should be supported on all Windows versions from 95 up. MacOS and Cygwin shell should support "&" with the SYSTEM call. Dunno, but would be surprised if not. For Cygwin you'd include "bash -c ...&" of some form or other. And I haven't had a Mac since MacOS 7 - a few moons ago now. I'm not too sure how a result could be set with an asynch callback, even if you coded up a C wrapper. I'm flailing; can you tell. ;) Perhaps I should just shutup and wait for a pro to speak up. Cheers ---------------------------------------------------------------- Thank you for your responses. About result: exit status = 0 can be all fine (program started) and all others mean there went something wrong. If all the things you've set could be coded into one line of a n OC-call we would have the same result like C$RUN (but working also on UNIX machines, I think concerning ACU this works only in C$SYSTEM). Concerning an OC-solution we've to wait for Rogers response, maybe there is some function already available. ---------------------------------------------------------------- So any ideas by Roger or someone else? ---------------------------------------------------------------- I've found the [url=http://www.acucorp.com/support/supported/docs/800_pdf/ACUCOBOL-GT_Appendices_v8.pdf]online-documentation[/url]. C$SYSTEM is described on pages 538-543. It's possible to do asynchronous calls to the system with that routine on all machines. Maybe it can be implemented with some flags (at least CSYS-ASYNC) or a new OC call can be done. human ---------------------------------------------------------------- I don't know if this helps or not, but you mightwant to look at: - The Micro Focus "CHAIN" statement - the '02 Standard CALL-CONVENTION direcitve Possibly one or the other would give you "portable" syntax to do what you want. ---------------------------------------------------------------- I am not getting into the whole "C$xxx" ball of wax. With CALL "SYSTEM", I have given anybody enough rope to hang themself :-) Now to "asynchronous" processes. For the purposes of the following assume that your COBOL proggie does a - [code] CALL "SYSTEM" USING whatever END-CALL. STOP RUN. [/code] This equates in the command shell to - [code] whatever exit [/code] So lets assume that "whatever" is "sleep 3600". Both in the proggie and the shell we sit around for an hour :-) Now lets make that "sleep 3600 &". What that does is to put the command into the background. HOWEVER, the command is STILL connected to the parent process as a "child". When the parent process dies, so do the children (per default). Try it. Enter "sleep 3600 &" (without quotes) in the shell and then exit. On relogin or another session, you will not find any "sleep" process. That is where the "nohup" command comes to our rescue. (Short for no hangup). Prefixing "nohup" to the command makes the command immune to foreground process termination. So - nohup sleep 3600 & and then immediately exit, will allow the sleep process to continue and not be affected by the exit/logout/termination. BUT that is not the end of the story. What's with my standard input/output/error. You should/must always redirect stdin/stdout/stderr. But, you might say, I never expect input. Sure? If what you are starting is a script, then ANY command may provoke a response from stdin. eg. The "rm" command when you have insufficient permissions. Also we are usually interested in any output from the command. So, generally, anything passed to "SYSTEM" would normally have the form [code] nohup whatever 0mystdout 2>mystderr & [/code] Assuming that no input is expected. Also note that then "mystdout" and "mystderr" are relative to the current directory as being executed. Roger ---------------------------------------------------------------- First, let me say thank you for the relevant information you gave. 'the whole "C$xxx" ball of wax' is to have one call for all different systems. If I'm right the things suggested by you wouldn't work on windows systems for example. So IF a call C$BallOfWax would be implemented with a possibility to have asynchronous calls and the first implementation would be only for UNIX systems (with the underlying things you've described) it would be fine and could be improved for other systems later on. Is it clear what I'm talking about? ---------------------------------------------------------------- human; Someone else wrote the ball of wax. ;) These should work everywhere that Glib works POSIX, Windows, MacOS (at least). http://library.gnome.org/devel/glib/2.18/glib-Spawning-Processes.html You'll want to look at g_spawn_command_line_async() first, then maybe dig into the others when more control / higher security is required. http://library.gnome.org/devel/glib/2.18/glib-Spawning-Processes.html#g-spawn-async-with-pipes looks like it'll cover any and all needs. For instance (and this doesn't do full shell pipelines, so for demo I used a script to get the effect). With CALL "SYSTEM" I would have used "sleep 1; ls -l; sleep 1" but this glib function uses a single command with params, so I cheat and use a script to demonstrate the asynchrony by interleaving the waits and displays. A few warnings; GError is a glib struct; mapping C struct to COBOL records layouts is a little bit voodoo a little bit luck and a whole lotta testing and verification. The error pointer array is the same kinda fragile thing. Cheers, Brian [b]pauser.sh[/b] needs to be chmod u+x [code] date sleep 1 ls async* -l sleep 1 date [/code] [b]async.cob[/b] [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20090308 *> Purpose: Asychronous command calls *> Tectonics: cobc -x async.cob -lglib-2.0 *> *************************************************************** identification division. program-id. async. environment division. configuration section. repository. function all intrinsic. data division. working-storage section. 01 result usage binary-long. 01 errorptrs. 03 errorptr usage pointer occurs 16 times. 01 GError based. 03 GQuark usage binary-long. 03 errorcode usage binary-long. 03 gmsg usage pointer. 01 errorbuffer pic x(256) based. 01 errormsg pic x(256). *> *************************************************************** procedure division. 00-main. call "g_spawn_command_line_async" using "./pauser.sh" & x"00" by reference errorptrs returning result end-call if errorptr(1) not equal null set address of Gerror to errorptr(1) if gmsg not equal null set address of errorbuffer to gmsg string errorbuffer delimited by x"00" into errormsg end-string display "Err: " trim(errormsg trailing) end-display end-if end-if perform 4 times display current-date end-display call "CBL_OC_NANOSLEEP" using 500000000 end-call end-perform . 00-finish. goback. end program async. [/code] Outputs [code] brian@homenode:~/writing/cobol$ ./async Sun Mar 8 20:45:23 EDT 2009 2009030820452330-0400 2009030820452380-0400 2009030820452430-0400 -rwxr-xr-x 1 brian brian 10598 2009-03-08 20:37 async -rw-r--r-- 1 brian brian 1916 2009-03-08 20:37 async.cob -rw-r--r-- 1 brian brian 478 2008-08-07 11:05 asynch.cob 2009030820452480-0400 brian@homenode:~/writing/cobol$ Sun Mar 8 20:45:25 EDT 2009 [/code] And with the weird error message controls; changing [b]pauser.sh[/b] to [b]nonexist.sh[/b] [code] brian@homenode:~/writing/cobol$ ./async Err: Failed to execute child process "./nonexist.sh" (No such file or directory) 2009030820481264-0400 2009030820481314-0400 2009030820481364-0400 2009030820481414-0400 brian@homenode:~/writing/cobol$ [/code] ---------------------------------------------------------------- This sounds nice. Could this be implemented to OC and be called via CALL "C$SYSTEM"/"CBL_ASYNC"/... ? ---------------------------------------------------------------- Yes we can have a CALL wrapper. I'm not sure if we want glib as part of the "mandatory" dependencies, so I wouldn't want it as part of the system.def file but yep. For now, more learning ... I had the wrong take on the GError double pointer (I think; being in the self-doubt phase) and it only returns a single structure, if any, not a potential array. And it requires deallocation. So...this one straightens out a few issues, and returns any command errors to the shell. Note; this is not the "value" of the command, but errorcodes. The value is not passed up the chain of this glib call. [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20090310 *> Purpose: Asynchronous command calls *> Tectonics: cobc -x async.cob -lglib-2.0 *> *************************************************************** identification division. program-id. async. environment division. configuration section. repository. function all intrinsic. data division. working-storage section. 01 result usage binary-long. 01 shell-result usage binary-long value zero. 01 errorptr usage pointer. 01 GError based. 03 GQuark usage binary-long. 03 errorcode usage binary-long. 03 gmsg usage pointer. 01 errorbuffer pic x(256) based. 01 errormsg pic x(256). *> *************************************************************** procedure division. 00-main. *> *> parse a command and spawn it asynchronously. *> *> Windows developers note that the command parse uses Unix rules *> backslashes and spaces in directories will require quoting. *> *> A pointer to a pointer to error structure is passed and will *> contain error information on failure. Any non-null value *> will be used as a preallocated GError struct, but we rely *> on glib for the allocation if required. *> call "g_spawn_command_line_async" using "./pauser.sh" & x"00" by reference errorptr returning result end-call *> *> the error pointer may now hold an address of a GError struct *> the based GError record will now be set to this address *> and we then have access to Domain, error code and error msg *> this structure requires deallocation. *> A non-true result could also be used to test for failure *> if errorptr not equal null set address of Gerror to errorptr if gmsg not equal null set address of errorbuffer to gmsg string errorbuffer delimited by x"00" into errormsg end-string display "Err: " GQuark space errorcode space trim(errormsg trailing) end-display end-if move errorcode to shell-result call "g_error_free" using by value errorptr end-call end-if *> a loop to interleave output to demonstrate asychrony perform 4 times display current-date end-display call "CBL_OC_NANOSLEEP" using 500000000 end-call end-perform . *> and we are done 00-finish. move shell-result to return-code goback. end program async. [/code] Cheers, Brian ---------------------------------------------------------------- Subject: Open Cobol Vs Microfocus cobol Hello, We are trying to decide if we should pay the the very hefty price that Microfocus wants or try to develop using Open Cobol. Quite frankly, we are not sure what to do. What does Microfocus Cobol have that Open cobol does not have? If Open Cobol is comprable to Microfocus Cobol and does not cost anything, how does Microfocus Cobol stay in business? Thanks. ---------------------------------------------------------------- Hi palladt, I can't speak to much of this yet, having not been in a professional position regarding COBOL in some 25 years. But I'll opine; [quote] What does Microfocus Cobol have that Open cobol does not have?[/quote] Documentation, support contracts, corporate backing. But, given that "in theory", I'd bet Roger will fix a production show stopper bug faster than the large corporation more times than not. [quote] If Open Cobol is comprable to Microfocus Cobol and does not cost anything, how does Microfocus Cobol stay in business?[/quote] Why does Microsoft own the lion's share of the PC industry? People are weird, scared and addicted to money. :) Open Source is at a tipping point. Companies can bet the farm on it now, and are starting to realize that failure is just as likely with proprietary systems as it is with community efforts. Having said my piece, someone with actual current MF experience will no doubt have a less facetious, more professional answer. Cheers, Brian ---------------------------------------------------------------- To all the things Brian said are some other points that must be regarded concerning MF: COBOL-Source debugger available (you need to debug C if you want to do so in OC) and surely a lot of extensions / a lot of possible data formats (not only MF-ISAM). There is no real window management available for OC (only a graphical version of console). Do you want to develop for PC/Mainframe/...? ---------------------------------------------------------------- Hi Palladt, I understand your questions because I was in the same case a few months ago. I am a Cobol Developer and I still work with ACU, another. Open Cobol represents a very thin part in our company, but I hope this will go increasing. The problem of Cobol in general (before OpenCobol) is the price. In the past 30 years if we had cobol compilers as we had MBasic, the face of this language will not be what it is now. Don't worry, maybe it's not too late. You know that lot of guys do not imagine that we can marry COBOL with HTML ! Generally I must demonstrate my argues. God Bless the Foolish people like Roger to give us this tool. I think you must start a "little" independent application with OC, work on it, build your tools : this is sometimes very helpful, because it will be the moment to include things you've thought years ago. And then promote OpenCobol as an alternative. ... And do not forget to think in OpenCobol when writing with your usual compiler. Examples and tools are welcome in this forum. For every Coboler : don't be shy during inscription. At least tell us the country you're living. Kind regards Bear ---------------------------------------------------------------- OC is not yet an opponent to MF, it still has a lot of work. http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=341&forum=1 ---------------------------------------------------------------- I never said opponent, I say alternative. The interest of OC is development of light solutions in Cobol without the weight of huge costs. If the spirit of Opencobol have existed twenty years ago, I think the face of Cobol would have been changed. Anyway this is just an opinion. Kind regards Bear ---------------------------------------------------------------- @Bear Maybe in 20 years from now... I think that OC can and will be an opponent of MF or any other COBOL dialect, if and only if, people engage it as MF opponent, so fix that problems, make new enhancements and do not try to stop OC development. Konenas ---------------------------------------------------------------- Subject: Calling All COBOLers (Magazine Article) Some of yall might be interested in this article: [url=http://weblog.infoworld.com/tech-bottom-line/archives/2008/08/calling_all_cob.html]Calling All Cobolers[/url] I gave my comment in COBOL Code. It's interesting because I JUST had a conversation with some young whipper snapper today about COBOL. Don't get me wrong, he sounds like he is really good at what he does, and he knows stuff that I don't. But as is often true about folks actually using COBOL, I know stuff he doesn't about it. He claimed he'd used it before. I imagine just in school. In any case, he was surprised that you could output HTML from COBOL. This is the one that always gets me, it's a DATA language. HTML is really ultimately just data. Nothing to complex here folks. ---------------------------------------------------------------- :-) Nice entry aoirthoir. Cheers, Brian ---------------------------------------------------------------- Sounds like discussions I can have with another "young whipper snapper" : my son ! Regards Bear ---------------------------------------------------------------- Subject: VIM and free format source. Does anyone have a cobol.vim syntax highlighting file for Vim71 that will work correctly with free format COBOL source files? Thanks, Brad ---------------------------------------------------------------- I use one that I found here; http://vim.wikia.com/wiki/Cobol_editing_with_Vim It's older, doesn't know about some keywords, but works better than the one that shipped with 7.1 imho, so I stopped looking once I found the "good enough is good enough". Cheers, Brian ---------------------------------------------------------------- Subject: CGI Environment display Hello team, This may or may not be the way to go with CGI, but this program will display most (all?) of the environment variables I know about. By the way; On DISPLAY, what is the best way to replicate \n\n functionality. Browsers want two newlines (a blank line) after the Content-type, and well, DISPLAY of x'0a' works for me here, but doesn't seem very robust. Cheers, [code] >>SOURCE FORMAT IS FIXED ****************************************************************** * Author: Brian Tiffin * Date: 08-Aug-2008 * Purpose: Display the CGI environment space * Tectonics: cobc -x cgienv.cob * Move cgienv to the cgi-bin directory as cgienv.cgi * browse http://localhost/cgi-bin/cgienv.cgi ****************************************************************** identification division. program-id. cgienv. data division. working-storage section. 78 name-count value 24. 01 name-index pic 99 usage comp-5. 01 value-string pic x(256). 01 environment-names. 02 name-strings. 03 filler pic x(20) value 'DOCUMENT_ROOT'. 03 filler pic x(20) value 'GATEWAY_INTERFACE'. 03 filler pic x(20) value 'HTTP_ACCEPT'. 03 filler pic x(20) value 'HTTP_ACCEPT_CHARSET'. 03 filler pic x(20) value 'HTTP_ACCEPT_ENCODING'. 03 filler pic x(20) value 'HTTP_ACCEPT_LANGUAGE'. 03 filler pic x(20) value 'HTTP_CONNECTION'. 03 filler pic x(20) value 'HTTP_HOST'. 03 filler pic x(20) value 'HTTP_USER_AGENT'. 03 filler pic x(20) value 'PATH'. 03 filler pic x(20) value 'QUERY_STRING'. 03 filler pic x(20) value 'REMOTE_ADDR'. 03 filler pic x(20) value 'REMOTE_PORT'. 03 filler pic x(20) value 'REQUEST_METHOD'. 03 filler pic x(20) value 'REQUEST_URI'. 03 filler pic x(20) value 'SCRIPT_FILENAME'. 03 filler pic x(20) value 'SCRIPT_NAME'. 03 filler pic x(20) value 'SERVER_ADDR'. 03 filler pic x(20) value 'SERVER_ADMIN'. 03 filler pic x(20) value 'SERVER_NAME'. 03 filler pic x(20) value 'SERVER_PORT'. 03 filler pic x(20) value 'SERVER_PROTOCOL'. 03 filler pic x(20) value 'SERVER_SIGNATURE'. 03 filler pic x(20) value 'SERVER_SOFTWARE'. 02 filler redefines name-strings. 03 name-string pic x(20) occurs name-count times. 01 newline pic x value x'0a'. procedure division. * Always send out the Content-type before any other IO display "Content-type: text/html" newline end-display. display "
" end-display.
      * Accept and display some of the known CGI environment values
       perform varying name-index from 1 by 1
           until name-index > name-count
               accept value-string from environment
                   name-string(name-index)
               end-accept
               display function trim
                   (name-string(name-index) trailing)
                   ": "
                   with no advancing
               end-display
               display function trim
                   (value-string trailing)
               end-display
       end-perform.
       display "
" end-display. goback. [/code] A test run of [i]http://localhost/cgi-bin/cgienv.cgi?this=test&that=OpenCOBOL[/i] produced (with a little obfuscation) [code] DOCUMENT_ROOT: /xxx/xxx/www/ GATEWAY_INTERFACE: CGI/1.1 HTTP_ACCEPT: text/html, image/jpeg, image/png, text/*, image/*, */* HTTP_ACCEPT_CHARSET: utf-8, utf-8;q=0.5, *;q=0.5 HTTP_ACCEPT_ENCODING: x-gzip, x-deflate, gzip, deflate HTTP_ACCEPT_LANGUAGE: en HTTP_CONNECTION: Keep-Alive HTTP_HOST: localhost HTTP_USER_AGENT: Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.9 (like Gecko) (Debian) PATH: /usr/local/bin:/usr/bin:/bin QUERY_STRING: this=test&that=OpenCOBOL REMOTE_ADDR: 127.0.0.1 REMOTE_PORT: xxxxx REQUEST_METHOD: GET REQUEST_URI: /cgi-bin/cgienv.cgi SCRIPT_FILENAME: /xxx/cgi-bin/cgienv.cgi SCRIPT_NAME: /cgi-bin/cgienv.cgi SERVER_ADDR: 127.0.0.1 SERVER_ADMIN: webmaster@localhost SERVER_NAME: localhost SERVER_PORT: xxxx SERVER_PROTOCOL: HTTP/1.1 SERVER_SIGNATURE: Apache/x.x.x (Debian) PHP/x.x.x-x Server at localhost Port xx SERVER_SOFTWARE: Apache/x.x.x (Debian) PHP/x.x.x-x [/code] ---------------------------------------------------------------- Hello Brian, Download http://www.hiniger.eu/CGI_OC.tgz . It's a bit old now, but this can be the beginning of a good example. opnweb.cgi is a script that displays the requested lines for CGI.1. before and after executing the program passed by parameter $1. I hope you'll enjoy. This may help the community to understand how we can mix html and open-cobol. I hope this will encourage posting other examples. Regards Bear. ---------------------------------------------------------------- Thanks Bear; And I used occurlrefresh to download it, just for fun. OC is going to be quite the Net ready COBOL sooner than later I think. Cheers, Brian ---------------------------------------------------------------- No doubt about this. Brian, do you have some examples for printing files ?. Up to the moment I still create sequential files in a special directory, then I use a call "SYSTEM" using ... to print this file. As an ACU user, I define printers in a configuration file or an environment variable like this (using CUPS) PRINTER -P lp -s -ocpi=20 -opage-left=5 -dPDF PRINTER0 -P lp -s -ocpi=22 -olpi=8 -olandscape -dDELL-GTC PDF and DELL-GTC are printers defines with CUPS In my cobol prog : select MYPRINTER assign to print, "PRINTER0". (This is enough to say that the device will be DELL-GTC !) fd MYPRINTER. 01 MYLINE. 02 filler ... pic X(254). open output MYPRINTER. write MYLINE before ... close MYPRINTER. Any Idea ? Regards Bear ---------------------------------------------------------------- Subject: install error ..help me.. OS: CentOS 5.1 USER: better [better@HOST CobolTools]$ pwd /home/better/soft/CobolTools [better@HOST CobolTools]$ ll drwxr-xr-x 16 better gpbetter 4096 08-09 17:42 gmp-4.2.3 -rw-r--r-- 1 better gpbetter 2294379 2008-08-09 gmp-4.2.3.tar.gz drwxr-xr-x 5 better gpbetter 4096 08-09 17:46 libtool-2.2.4 -rw-r--r-- 1 better gpbetter 2840967 2008-08-09 libtool-2.2.4.tar.gz drwxrwxrwx 11 root root 4096 08-09 19:12 open-cobol-1.0 -rw-r--r-- 1 better gpbetter 934641 2008-08-10 open-cobol-1.0.tar.gz drwxrwxrwx 12 root root 4096 08-09 19:31 open-cobol-1.1 -rw-r--r-- 1 better gpbetter 964154 2008-08-10 open-cobol-1.1.tar.gz #./configure --------------------------------- checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether to enable maintainer-specific portions of Makefiles... no checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking how to run the C preprocessor... gcc -E checking for egrep... grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking whether ln -s works... yes checking for a BSD-compatible install... /usr/bin/install -c checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking for a sed that does not truncate output... /bin/sed checking for ld used by gcc... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for /usr/bin/ld option to reload object files... -r checking for BSD-compatible nm... /usr/bin/nm -B checking how to recognize dependent libraries... pass_all checking dlfcn.h usability... yes checking dlfcn.h presence... yes checking for dlfcn.h... yes checking the maximum length of command line arguments... 98304 checking command to parse /usr/bin/nm -B output from gcc object... ok checking for objdir... .libs checking for ar... ar checking for ranlib... ranlib checking for strip... strip checking if gcc supports -fno-rtti -fno-exceptions... no checking for gcc option to produce PIC... -fPIC checking if gcc PIC flag -fPIC works... yes checking if gcc static flag -static works... yes checking if gcc supports -c -o file.o... yes checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking for shl_load... no checking for shl_load in -ldld... no checking for dlopen... no checking for dlopen in -ldl... yes checking whether a program can dlopen itself... yes checking whether a statically linked program can dlopen itself... no checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes configure: creating libtool checking whether make sets $(MAKE)... (cached) yes checking for ANSI C header files... (cached) yes checking for stdint.h... (cached) yes checking for sys/types.h... (cached) yes checking signal.h usability... yes checking signal.h presence... yes checking for signal.h... yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking malloc.h usability... yes checking malloc.h presence... yes checking for malloc.h... yes checking locale.h usability... yes checking locale.h presence... yes checking for locale.h... yes checking stddef.h usability... yes checking stddef.h presence... yes checking for stddef.h... yes checking wchar.h usability... yes checking wchar.h presence... yes checking for wchar.h... yes checking for dlfcn.h... (cached) yes checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking for an ANSI C-conforming const... yes checking whether byte ordering is bigendian... no checking for size_t... yes checking whether struct tm is in sys/time.h or time.h... time.h checking for inline... inline checking for working alloca.h... yes checking for alloca... yes checking for vprintf... yes checking for _doprnt... no checking for memmove... yes checking for memset... yes checking for regcomp... yes checking for setlocale... yes checking for fcntl... yes checking for strerror... yes checking for strcasecmp... yes checking for strchr... yes checking for strrchr... yes checking for strdup... yes checking for strstr... yes checking for strtol... yes checking for gettimeofday... yes checking for ld used by GCC... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for shared library run path origin... done checking for iconv... yes checking for iconv declaration... extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); checking for nl_langinfo and CODESET... yes checking for getopt_long_only... yes checking kpathsea/getopt.h usability... no checking kpathsea/getopt.h presence... no checking for kpathsea/getopt.h... no checking getopt.h usability... yes checking getopt.h presence... yes checking for getopt.h... yes checking gmp.h usability... yes checking gmp.h presence... yes checking for gmp.h... yes checking for __gmp_randinit in -lgmp... yes checking whether NLS is requested... yes checking for msgfmt... /usr/bin/msgfmt checking for gmsgfmt... /usr/bin/msgfmt checking for xgettext... /usr/bin/xgettext checking for msgmerge... /usr/bin/msgmerge checking whether NLS is requested... yes checking for GNU gettext in libc... yes checking whether to use NLS... yes checking where the gettext function comes from... libc checking ncurses.h usability... no checking ncurses.h presence... no checking for ncurses.h... no checking pdcurses.h usability... no checking pdcurses.h presence... no checking for pdcurses.h... no checking ncurses/ncurses.h usability... no checking ncurses/ncurses.h presence... no checking for ncurses/ncurses.h... no checking curses.h usability... no checking curses.h presence... no checking for curses.h... no checking for initscr in -lncurses... no checking for initscr in -lpdcurses... no checking for initscr in -lcurses... no checking db.h usability... no checking db.h presence... no checking for db.h... no checking db_185.h usability... no checking db_185.h presence... no checking for db_185.h... no checking db3/db_185.h usability... no checking db3/db_185.h presence... no checking for db3/db_185.h... no checking db4/db_185.h usability... no checking db4/db_185.h presence... no checking for db4/db_185.h... no checking db4.1/db_185.h usability... no checking db4.1/db_185.h presence... no checking for db4.1/db_185.h... no checking db4.2/db_185.h usability... no checking db4.2/db_185.h presence... no checking for db4.2/db_185.h... no checking db4.3/db_185.h usability... no checking db4.3/db_185.h presence... no checking for db4.3/db_185.h... no checking db4.4/db_185.h usability... no checking db4.4/db_185.h presence... no checking for db4.4/db_185.h... no checking db4.5/db_185.h usability... no checking db4.5/db_185.h presence... no checking for db4.5/db_185.h... no checking for __db_open in -ldb-4.5... no checking for dbopen in -ldb-4.5... no checking for __db_open in -ldb-4.4... no checking for dbopen in -ldb-4.4... no checking for __db_open in -ldb-4.3... yes checking for dlopen in -lc... no checking for dlopen in -ldl... (cached) yes configure: creating ./config.status config.status: creating cob-config config.status: creating Makefile config.status: creating lib/Makefile config.status: creating libcob/Makefile config.status: creating cobc/Makefile config.status: creating bin/Makefile config.status: creating po/Makefile.in config.status: creating texi/Makefile config.status: creating config/Makefile config.status: creating tests/atlocal config.status: creating tests/Makefile config.status: creating tests/cobol85/Makefile config.status: creating config.h config.status: config.h is unchanged config.status: executing tests/atconfig commands config.status: executing depfiles commands config.status: executing default-1 commands config.status: creating po/POTFILES config.status: creating po/Makefile OpenCOBOL Configuration: CC gcc COB_CC gcc CFLAGS -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-str ings -Wmissing-prototypes -Wno-format-y2k COB_CFLAGS -I/usr/local/include -O2 COB_EXTRA_FLAGS LDFLAGS COB_LDFLAGS COB_LIBS -L${exec_prefix}/lib -lcob -lm -lgmp -ldb-4.3 -ldl COB_CONFIG_DIR ${prefix}/share/open-cobol/config COB_LIBRARY_PATH .:${exec_prefix}/lib/open-cobol COB_MODULE_EXT so COB_SHARED_OPT -shared COB_PIC_FLAGS -fPIC -DPIC COB_EXPORT_DYN -Wl,--export-dynamic COB_STRIP_CMD strip --strip-unneeded Dynamic loading System Use gettext for international messages: yes Use Berkeley DB for file I/O: yes Use enhanced Berkeley DB (>= 4.1) no Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: no -------------------------------- I do not use DB. but next :-( #make --------------------------------- make all-recursive make[1]: Entering directory `/home/better/soft/CobolTools/open-cobol-1.0' Making all in lib make[2]: Entering directory `/home/better/soft/CobolTools/open-cobol-1.0/lib' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/home/better/soft/CobolTools/open-cobol-1.0/lib' Making all in libcob make[2]: Entering directory `/home/better/soft/CobolTools/open-cobol-1.0/libcob' if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prot otypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF ".deps/libcob_la-fileio.Tpo" -c -o libcob _la-fileio.lo `test -f 'fileio.c' || echo './'`fileio.c; \ then mv -f ".deps/libcob_la-fileio.Tpo" ".deps/libcob_la-fileio.Plo"; else rm -f ".deps/libc ob_la-fileio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF .deps/libcob_la-fileio.Tpo -c fileio.c -fPIC -DPIC -o .libs/libcob_la-fileio.o fileio.c:308: error: expected specifier-qualifier-list before 'DB' fileio.c: In function 'cob_sync': fileio.c:651: error: 'struct indexed_file' has no member named 'db' fileio.c:651: error: 'struct indexed_file' has no member named 'db' fileio.c:658: error: 'struct indexed_file' has no member named 'db' fileio.c:658: error: 'struct indexed_file' has no member named 'db' fileio.c: In function 'indexed_open': fileio.c:1849: error: 'struct indexed_file' has no member named 'db' fileio.c:1849: error: 'DB' undeclared (first use in this function) fileio.c:1849: error: (Each undeclared identifier is reported only once fileio.c:1849: error: for each function it appears in.) fileio.c:1849: error: expected expression before ')' token fileio.c:1854: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:1855: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:1856: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:1865: error: 'BTREEINFO' undeclared (first use in this function) fileio.c:1865: error: expected ';' before 'info' fileio.c:1898: error: 'info' undeclared (first use in this function) fileio.c:1900: error: 'R_DUP' undeclared (first use in this function) fileio.c:1911: error: 'struct indexed_file' has no member named 'db' fileio.c:1911: warning: implicit declaration of function 'dbopen' fileio.c:1911: error: 'DB_BTREE' undeclared (first use in this function) fileio.c:1912: error: 'struct indexed_file' has no member named 'db' fileio.c:1918: error: 'struct indexed_file' has no member named 'db' fileio.c:1918: error: 'struct indexed_file' has no member named 'db' fileio.c:1925: error: 'struct indexed_file' has no member named 'db' fileio.c:1926: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:1927: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:1939: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:1940: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:1948: error: 'DBT' undeclared (first use in this function) fileio.c:1948: error: 'struct indexed_file' has no member named 'key' fileio.c:1948: error: 'struct indexed_file' has no member named 'key' fileio.c:1948: error: 'struct indexed_file' has no member named 'key' fileio.c:1949: error: 'struct indexed_file' has no member named 'data' fileio.c:1949: error: 'struct indexed_file' has no member named 'data' fileio.c:1949: error: 'struct indexed_file' has no member named 'data' fileio.c:1965: error: 'struct indexed_file' has no member named 'db' fileio.c:1965: error: 'struct indexed_file' has no member named 'db' fileio.c:1965: error: 'struct indexed_file' has no member named 'key' fileio.c:1965: error: 'struct indexed_file' has no member named 'data' fileio.c:1965: error: 'R_FIRST' undeclared (first use in this function) fileio.c:1968: error: 'struct indexed_file' has no member named 'key' fileio.c:1968: error: 'struct indexed_file' has no member named 'key' fileio.c:1968: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:1968: error: 'struct indexed_file' has no member named 'key' fileio.c:1968: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:1968: error: 'struct indexed_file' has no member named 'key' fileio.c:1968: error: 'struct indexed_file' has no member named 'key' fileio.c:1968: error: 'struct indexed_file' has no member named 'key' fileio.c:1968: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:1968: error: 'struct indexed_file' has no member named 'key' fileio.c:1968: error: 'struct indexed_file' has no member named 'key' fileio.c:1968: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:1968: error: 'struct indexed_file' has no member named 'key' fileio.c:1968: error: 'struct indexed_file' has no member named 'key' fileio.c:1968: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:1968: error: 'struct indexed_file' has no member named 'key' fileio.c:1968: error: 'struct indexed_file' has no member named 'key' fileio.c:1970: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_close': fileio.c:2014: error: 'struct indexed_file' has no member named 'db' fileio.c:2015: error: 'struct indexed_file' has no member named 'db' fileio.c:2015: error: 'struct indexed_file' has no member named 'db' fileio.c:2017: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2018: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2025: error: 'struct indexed_file' has no member named 'db' fileio.c:2026: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2027: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2028: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c: In function 'indexed_start_internal': fileio.c:2067: error: 'struct indexed_file' has no member named 'key' fileio.c:2067: error: 'struct indexed_file' has no member named 'key' fileio.c:2076: error: 'struct indexed_file' has no member named 'db' fileio.c:2076: error: 'struct indexed_file' has no member named 'db' fileio.c:2076: error: 'struct indexed_file' has no member named 'key' fileio.c:2076: error: 'struct indexed_file' has no member named 'data' fileio.c:2076: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:2081: error: 'struct indexed_file' has no member named 'key' fileio.c:2089: error: 'struct indexed_file' has no member named 'db' fileio.c:2089: error: 'struct indexed_file' has no member named 'db' fileio.c:2089: error: 'struct indexed_file' has no member named 'key' fileio.c:2089: error: 'struct indexed_file' has no member named 'data' fileio.c:2089: error: 'R_LAST' undeclared (first use in this function) fileio.c:2095: error: 'struct indexed_file' has no member named 'db' fileio.c:2095: error: 'struct indexed_file' has no member named 'db' fileio.c:2095: error: 'struct indexed_file' has no member named 'key' fileio.c:2095: error: 'struct indexed_file' has no member named 'data' fileio.c:2095: error: 'R_PREV' undeclared (first use in this function) fileio.c:2104: error: 'struct indexed_file' has no member named 'db' fileio.c:2104: error: 'struct indexed_file' has no member named 'db' fileio.c:2104: error: 'struct indexed_file' has no member named 'key' fileio.c:2104: error: 'struct indexed_file' has no member named 'data' fileio.c:2106: error: 'struct indexed_file' has no member named 'key' fileio.c:2110: error: 'struct indexed_file' has no member named 'db' fileio.c:2110: error: 'struct indexed_file' has no member named 'db' fileio.c:2110: error: 'struct indexed_file' has no member named 'key' fileio.c:2110: error: 'struct indexed_file' has no member named 'data' fileio.c:2116: error: 'struct indexed_file' has no member named 'key' fileio.c:2117: error: 'struct indexed_file' has no member named 'db' fileio.c:2117: error: 'struct indexed_file' has no member named 'db' fileio.c:2117: error: 'struct indexed_file' has no member named 'key' fileio.c:2117: error: 'struct indexed_file' has no member named 'data' fileio.c:2117: error: 'R_NEXT' undeclared (first use in this function) fileio.c:2124: error: 'struct indexed_file' has no member named 'db' fileio.c:2124: error: 'struct indexed_file' has no member named 'db' fileio.c:2124: error: 'struct indexed_file' has no member named 'key' fileio.c:2124: error: 'struct indexed_file' has no member named 'data' fileio.c:2130: error: 'struct indexed_file' has no member named 'db' fileio.c:2130: error: 'struct indexed_file' has no member named 'db' fileio.c:2130: error: 'struct indexed_file' has no member named 'key' fileio.c:2130: error: 'struct indexed_file' has no member named 'data' fileio.c:2136: error: 'struct indexed_file' has no member named 'key' fileio.c:2140: error: 'struct indexed_file' has no member named 'db' fileio.c:2140: error: 'struct indexed_file' has no member named 'db' fileio.c:2140: error: 'struct indexed_file' has no member named 'key' fileio.c:2140: error: 'struct indexed_file' has no member named 'data' fileio.c:2151: error: 'struct indexed_file' has no member named 'key' fileio.c:2151: error: 'struct indexed_file' has no member named 'key' fileio.c:2151: error: 'struct indexed_file' has no member named 'key' fileio.c:2151: error: 'struct indexed_file' has no member named 'key' fileio.c:2153: error: 'struct indexed_file' has no member named 'data' fileio.c:2153: error: 'struct indexed_file' has no member named 'data' fileio.c:2153: error: 'struct indexed_file' has no member named 'data' fileio.c:2153: error: 'struct indexed_file' has no member named 'data' fileio.c:2155: error: 'struct indexed_file' has no member named 'key' fileio.c:2155: error: 'struct indexed_file' has no member named 'data' fileio.c:2156: error: 'struct indexed_file' has no member named 'key' fileio.c:2157: error: 'struct indexed_file' has no member named 'db' fileio.c:2157: error: 'struct indexed_file' has no member named 'db' fileio.c:2157: error: 'struct indexed_file' has no member named 'key' fileio.c:2157: error: 'struct indexed_file' has no member named 'data' fileio.c:2191: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2191: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2191: error: 'struct indexed_file' has no member named 'key' fileio.c:2191: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2191: error: 'struct indexed_file' has no member named 'key' fileio.c:2191: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2191: error: 'struct indexed_file' has no member named 'key' fileio.c:2191: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2191: error: 'struct indexed_file' has no member named 'key' fileio.c:2193: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2193: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2193: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2193: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2193: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2195: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2195: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2195: error: 'struct indexed_file' has no member named 'key' fileio.c:2195: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2195: error: 'struct indexed_file' has no member named 'key' fileio.c:2195: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2195: error: 'struct indexed_file' has no member named 'key' fileio.c:2195: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2195: error: 'struct indexed_file' has no member named 'key' fileio.c:2197: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c: In function 'indexed_read': fileio.c:2435: error: 'struct indexed_file' has no member named 'data' fileio.c:2436: error: 'struct indexed_file' has no member named 'data' fileio.c:2436: error: 'struct indexed_file' has no member named 'data' fileio.c:2436: error: 'struct indexed_file' has no member named 'data' fileio.c:2436: error: 'struct indexed_file' has no member named 'data' fileio.c:2436: error: 'struct indexed_file' has no member named 'data' fileio.c:2436: error: 'struct indexed_file' has no member named 'data' fileio.c:2436: error: 'struct indexed_file' has no member named 'data' fileio.c:2436: error: 'struct indexed_file' has no member named 'data' fileio.c:2436: error: 'struct indexed_file' has no member named 'data' fileio.c:2436: error: 'struct indexed_file' has no member named 'data' fileio.c:2436: error: 'struct indexed_file' has no member named 'data' fileio.c:2436: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_read_next': fileio.c:2696: error: 'R_NEXT' undeclared (first use in this function) fileio.c:2708: error: 'R_LAST' undeclared (first use in this function) fileio.c:2710: error: 'R_PREV' undeclared (first use in this function) fileio.c:2713: error: 'R_FIRST' undeclared (first use in this function) fileio.c:2725: error: 'struct indexed_file' has no member named 'data' fileio.c:2738: error: 'struct indexed_file' has no member named 'key' fileio.c:2739: error: 'struct indexed_file' has no member named 'key' fileio.c:2739: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2743: error: 'struct indexed_file' has no member named 'db' fileio.c:2743: error: 'struct indexed_file' has no member named 'db' fileio.c:2743: error: 'struct indexed_file' has no member named 'key' fileio.c:2743: error: 'struct indexed_file' has no member named 'data' fileio.c:2747: error: 'struct indexed_file' has no member named 'data' fileio.c:2747: error: 'struct indexed_file' has no member named 'data' fileio.c:2747: error: 'struct indexed_file' has no member named 'data' fileio.c:2747: error: 'struct indexed_file' has no member named 'data' fileio.c:2749: error: 'struct indexed_file' has no member named 'key' fileio.c:2749: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2749: error: 'struct indexed_file' has no member named 'key' fileio.c:2750: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2754: error: 'struct indexed_file' has no member named 'db' fileio.c:2754: error: 'struct indexed_file' has no member named 'db' fileio.c:2754: error: 'struct indexed_file' has no member named 'key' fileio.c:2754: error: 'struct indexed_file' has no member named 'data' fileio.c:2756: error: 'struct indexed_file' has no member named 'data' fileio.c:2756: error: 'struct indexed_file' has no member named 'data' fileio.c:2756: error: 'struct indexed_file' has no member named 'data' fileio.c:2756: error: 'struct indexed_file' has no member named 'data' fileio.c:2759: error: 'struct indexed_file' has no member named 'key' fileio.c:2759: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2759: error: 'struct indexed_file' has no member named 'key' fileio.c:2760: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2761: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2761: error: 'struct indexed_file' has no member named 'data' fileio.c:2766: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2766: error: 'struct indexed_file' has no member named 'data' fileio.c:2769: error: 'struct indexed_file' has no member named 'key' fileio.c:2770: error: 'struct indexed_file' has no member named 'key' fileio.c:2770: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2771: error: 'struct indexed_file' has no member named 'db' fileio.c:2771: error: 'struct indexed_file' has no member named 'db' fileio.c:2771: error: 'struct indexed_file' has no member named 'key' fileio.c:2771: error: 'struct indexed_file' has no member named 'data' fileio.c:2808: error: 'struct indexed_file' has no member named 'key' fileio.c:2809: error: 'struct indexed_file' has no member named 'key' fileio.c:2809: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2813: error: 'struct indexed_file' has no member named 'db' fileio.c:2813: error: 'struct indexed_file' has no member named 'db' fileio.c:2813: error: 'struct indexed_file' has no member named 'key' fileio.c:2813: error: 'struct indexed_file' has no member named 'data' fileio.c:2813: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:2832: error: 'struct indexed_file' has no member named 'key' fileio.c:2832: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2832: error: 'struct indexed_file' has no member named 'key' fileio.c:2834: error: 'struct indexed_file' has no member named 'data' fileio.c:2834: error: 'struct indexed_file' has no member named 'data' fileio.c:2834: error: 'struct indexed_file' has no member named 'data' fileio.c:2834: error: 'struct indexed_file' has no member named 'data' fileio.c:2836: error: 'struct indexed_file' has no member named 'key' fileio.c:2836: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2836: error: 'struct indexed_file' has no member named 'key' fileio.c:2837: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2841: error: 'struct indexed_file' has no member named 'db' fileio.c:2841: error: 'struct indexed_file' has no member named 'db' fileio.c:2841: error: 'struct indexed_file' has no member named 'key' fileio.c:2841: error: 'struct indexed_file' has no member named 'data' fileio.c:2843: error: 'struct indexed_file' has no member named 'data' fileio.c:2843: error: 'struct indexed_file' has no member named 'data' fileio.c:2843: error: 'struct indexed_file' has no member named 'data' fileio.c:2843: error: 'struct indexed_file' has no member named 'data' fileio.c:2861: error: 'struct indexed_file' has no member named 'key' fileio.c:2861: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2861: error: 'struct indexed_file' has no member named 'key' fileio.c:2862: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2888: error: 'struct indexed_file' has no member named 'db' fileio.c:2888: error: 'struct indexed_file' has no member named 'db' fileio.c:2888: error: 'struct indexed_file' has no member named 'key' fileio.c:2888: error: 'struct indexed_file' has no member named 'data' fileio.c:2905: error: 'struct indexed_file' has no member named 'key' fileio.c:2905: error: 'struct indexed_file' has no member named 'key' fileio.c:2905: error: 'struct indexed_file' has no member named 'key' fileio.c:2905: error: 'struct indexed_file' has no member named 'key' fileio.c:2905: error: 'struct indexed_file' has no member named 'key' fileio.c:2905: error: 'struct indexed_file' has no member named 'key' fileio.c:2905: error: 'struct indexed_file' has no member named 'key' fileio.c:2905: error: 'struct indexed_file' has no member named 'key' fileio.c:2905: error: 'struct indexed_file' has no member named 'key' fileio.c:2905: error: 'struct indexed_file' has no member named 'key' fileio.c:2905: error: 'struct indexed_file' has no member named 'key' fileio.c:2905: error: 'struct indexed_file' has no member named 'key' fileio.c:2907: error: 'struct indexed_file' has no member named 'data' fileio.c:2907: error: 'struct indexed_file' has no member named 'data' fileio.c:2907: error: 'struct indexed_file' has no member named 'data' fileio.c:2907: error: 'struct indexed_file' has no member named 'data' fileio.c:2909: error: 'struct indexed_file' has no member named 'key' fileio.c:2909: error: 'struct indexed_file' has no member named 'data' fileio.c:2910: error: 'struct indexed_file' has no member named 'key' fileio.c:2911: error: 'struct indexed_file' has no member named 'db' fileio.c:2911: error: 'struct indexed_file' has no member named 'db' fileio.c:2911: error: 'struct indexed_file' has no member named 'key' fileio.c:2911: error: 'struct indexed_file' has no member named 'data' fileio.c:2950: error: 'struct indexed_file' has no member named 'key' fileio.c:2950: error: 'struct indexed_file' has no member named 'key' fileio.c:2950: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2950: error: 'struct indexed_file' has no member named 'key' fileio.c:2950: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2950: error: 'struct indexed_file' has no member named 'key' fileio.c:2950: error: 'struct indexed_file' has no member named 'key' fileio.c:2950: error: 'struct indexed_file' has no member named 'key' fileio.c:2950: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2950: error: 'struct indexed_file' has no member named 'key' fileio.c:2950: error: 'struct indexed_file' has no member named 'key' fileio.c:2950: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2950: error: 'struct indexed_file' has no member named 'key' fileio.c:2950: error: 'struct indexed_file' has no member named 'key' fileio.c:2950: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2950: error: 'struct indexed_file' has no member named 'key' fileio.c:2950: error: 'struct indexed_file' has no member named 'key' fileio.c:2952: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2952: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2952: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2952: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2952: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2954: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2954: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2954: error: 'struct indexed_file' has no member named 'key' fileio.c:2954: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2954: error: 'struct indexed_file' has no member named 'key' fileio.c:2954: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2954: error: 'struct indexed_file' has no member named 'key' fileio.c:2954: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2954: error: 'struct indexed_file' has no member named 'key' fileio.c:2956: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2970: error: 'struct indexed_file' has no member named 'data' fileio.c:2971: error: 'struct indexed_file' has no member named 'data' fileio.c:2971: error: 'struct indexed_file' has no member named 'data' fileio.c:2971: error: 'struct indexed_file' has no member named 'data' fileio.c:2971: error: 'struct indexed_file' has no member named 'data' fileio.c:2971: error: 'struct indexed_file' has no member named 'data' fileio.c:2971: error: 'struct indexed_file' has no member named 'data' fileio.c:2971: error: 'struct indexed_file' has no member named 'data' fileio.c:2971: error: 'struct indexed_file' has no member named 'data' fileio.c:2971: error: 'struct indexed_file' has no member named 'data' fileio.c:2971: error: 'struct indexed_file' has no member named 'data' fileio.c:2971: error: 'struct indexed_file' has no member named 'data' fileio.c:2971: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'get_dupno': fileio.c:2986: error: 'struct indexed_file' has no member named 'key' fileio.c:2986: error: 'struct indexed_file' has no member named 'key' fileio.c:2987: error: 'struct indexed_file' has no member named 'key' fileio.c:2987: error: 'struct indexed_file' has no member named 'key' fileio.c:2987: error: 'struct indexed_file' has no member named 'key' fileio.c:2987: error: 'struct indexed_file' has no member named 'key' fileio.c:2987: error: 'struct indexed_file' has no member named 'key' fileio.c:2987: error: 'struct indexed_file' has no member named 'key' fileio.c:2987: error: 'struct indexed_file' has no member named 'key' fileio.c:2987: error: 'struct indexed_file' has no member named 'key' fileio.c:2987: error: 'struct indexed_file' has no member named 'key' fileio.c:2987: error: 'struct indexed_file' has no member named 'key' fileio.c:2987: error: 'struct indexed_file' has no member named 'key' fileio.c:2987: error: 'struct indexed_file' has no member named 'key' fileio.c:2992: error: 'struct indexed_file' has no member named 'db' fileio.c:2992: error: 'struct indexed_file' has no member named 'db' fileio.c:2992: error: 'struct indexed_file' has no member named 'key' fileio.c:2992: error: 'struct indexed_file' has no member named 'data' fileio.c:2992: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:2994: error: 'struct indexed_file' has no member named 'key' fileio.c:2994: error: 'struct indexed_file' has no member named 'key' fileio.c:2995: error: 'struct indexed_file' has no member named 'data' fileio.c:2995: error: 'struct indexed_file' has no member named 'data' fileio.c:2995: error: 'struct indexed_file' has no member named 'data' fileio.c:2995: error: 'struct indexed_file' has no member named 'data' fileio.c:2999: error: 'struct indexed_file' has no member named 'db' fileio.c:2999: error: 'struct indexed_file' has no member named 'db' fileio.c:2999: error: 'struct indexed_file' has no member named 'key' fileio.c:2999: error: 'struct indexed_file' has no member named 'data' fileio.c:2999: error: 'R_NEXT' undeclared (first use in this function) fileio.c: In function 'check_alt_keys': fileio.c:3018: error: 'struct indexed_file' has no member named 'key' fileio.c:3018: error: 'struct indexed_file' has no member named 'key' fileio.c:3019: error: 'struct indexed_file' has no member named 'db' fileio.c:3019: error: 'struct indexed_file' has no member named 'db' fileio.c:3019: error: 'struct indexed_file' has no member named 'key' fileio.c:3019: error: 'struct indexed_file' has no member named 'data' fileio.c:3022: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_write_internal': fileio.c:3071: error: 'struct indexed_file' has no member named 'key' fileio.c:3071: error: 'struct indexed_file' has no member named 'key' fileio.c:3088: error: 'struct indexed_file' has no member named 'data' fileio.c:3089: error: 'struct indexed_file' has no member named 'data' fileio.c:3090: error: 'struct indexed_file' has no member named 'db' fileio.c:3090: error: 'struct indexed_file' has no member named 'db' fileio.c:3090: error: 'struct indexed_file' has no member named 'key' fileio.c:3090: error: 'struct indexed_file' has no member named 'data' fileio.c:3090: error: 'R_NOOVERWRITE' undeclared (first use in this function) fileio.c:3096: error: 'struct indexed_file' has no member named 'data' fileio.c:3096: error: 'struct indexed_file' has no member named 'key' fileio.c:3098: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:3108: error: 'struct indexed_file' has no member named 'data' fileio.c:3109: error: 'struct indexed_file' has no member named 'data' fileio.c:3118: error: 'struct indexed_file' has no member named 'key' fileio.c:3118: error: 'struct indexed_file' has no member named 'key' fileio.c:3119: error: 'struct indexed_file' has no member named 'db' fileio.c:3119: error: 'struct indexed_file' has no member named 'db' fileio.c:3119: error: 'struct indexed_file' has no member named 'key' fileio.c:3119: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_write': fileio.c:3194: error: 'struct indexed_file' has no member named 'key' fileio.c:3194: error: 'struct indexed_file' has no member named 'key' fileio.c:3196: error: 'struct indexed_file' has no member named 'key' fileio.c:3198: error: 'struct indexed_file' has no member named 'key' fileio.c:3198: error: 'struct indexed_file' has no member named 'key' fileio.c:3201: error: 'struct indexed_file' has no member named 'key' fileio.c:3201: error: 'struct indexed_file' has no member named 'key' fileio.c:3201: error: 'struct indexed_file' has no member named 'key' fileio.c:3201: error: 'struct indexed_file' has no member named 'key' fileio.c:3201: error: 'struct indexed_file' has no member named 'key' fileio.c:3201: error: 'struct indexed_file' has no member named 'key' fileio.c:3201: error: 'struct indexed_file' has no member named 'key' fileio.c:3201: error: 'struct indexed_file' has no member named 'key' fileio.c:3201: error: 'struct indexed_file' has no member named 'key' fileio.c:3201: error: 'struct indexed_file' has no member named 'key' fileio.c:3201: error: 'struct indexed_file' has no member named 'key' fileio.c:3201: error: 'struct indexed_file' has no member named 'key' fileio.c: In function 'indexed_delete_internal': fileio.c:3214: error: 'DBT' undeclared (first use in this function) fileio.c:3214: error: expected ';' before 'prim_key' fileio.c:3261: error: 'struct indexed_file' has no member named 'key' fileio.c:3261: error: 'struct indexed_file' has no member named 'key' fileio.c:3262: error: 'struct indexed_file' has no member named 'db' fileio.c:3262: error: 'struct indexed_file' has no member named 'db' fileio.c:3262: error: 'struct indexed_file' has no member named 'key' fileio.c:3262: error: 'struct indexed_file' has no member named 'data' fileio.c:3267: error: 'prim_key' undeclared (first use in this function) fileio.c:3267: error: 'struct indexed_file' has no member named 'key' fileio.c:3270: error: 'struct indexed_file' has no member named 'data' fileio.c:3272: error: 'struct indexed_file' has no member named 'key' fileio.c:3272: error: 'struct indexed_file' has no member named 'key' fileio.c:3273: error: 'struct indexed_file' has no member named 'key' fileio.c:3273: error: 'struct indexed_file' has no member named 'key' fileio.c:3276: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:3276: error: 'struct indexed_file' has no member named 'key' fileio.c:3276: error: 'struct indexed_file' has no member named 'key' fileio.c:3277: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:3282: error: 'struct indexed_file' has no member named 'db' fileio.c:3282: error: 'struct indexed_file' has no member named 'db' fileio.c:3282: error: 'struct indexed_file' has no member named 'key' fileio.c:3284: error: expected ';' before 'sec_key' fileio.c:3290: error: 'struct indexed_file' has no member named 'db' fileio.c:3290: error: 'struct indexed_file' has no member named 'db' fileio.c:3290: error: 'struct indexed_file' has no member named 'key' fileio.c:3290: error: 'struct indexed_file' has no member named 'data' fileio.c:3290: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:3292: error: 'sec_key' undeclared (first use in this function) fileio.c:3292: error: 'struct indexed_file' has no member named 'key' fileio.c:3293: error: 'struct indexed_file' has no member named 'key' fileio.c:3295: error: 'struct indexed_file' has no member named 'data' fileio.c:3300: error: 'struct indexed_file' has no member named 'db' fileio.c:3300: error: 'struct indexed_file' has no member named 'db' fileio.c:3300: error: 'struct indexed_file' has no member named 'key' fileio.c:3306: error: 'struct indexed_file' has no member named 'db' fileio.c:3306: error: 'struct indexed_file' has no member named 'db' fileio.c:3306: error: 'struct indexed_file' has no member named 'key' fileio.c:3306: error: 'struct indexed_file' has no member named 'data' fileio.c:3306: error: 'R_NEXT' undeclared (first use in this function) fileio.c:3323: error: 'struct indexed_file' has no member named 'db' fileio.c:3323: error: 'struct indexed_file' has no member named 'db' fileio.c: In function 'indexed_rewrite': fileio.c:3488: error: 'struct indexed_file' has no member named 'key' fileio.c:3488: error: 'struct indexed_file' has no member named 'key' make[2]: *** [libcob_la-fileio.lo] 错误 1 make[2]: Leaving directory `/home/better/soft/CobolTools/open-cobol-1.0/libcob' make[1]: *** [all-recursive] 错误 1 make[1]: Leaving directory `/home/better/soft/CobolTools/open-cobol-1.0' make: *** [all] 错误 2 ------------------------------- :-( :-( why ? help me ... ---------------------------------------------------------------- Hi Betteronly; If you don't mind installing a few optionals, this is how I went about getting OC1.1 There is a Debian package for OC 1.0 # apt-get open-cobol This will drag in the optional ncurses and bdb required for a fuller OpenCOBOL experience (Roger has been hard at it adding support for SCREEN SECTION along with all the other goodies); but apt does install to /usr/bin and it can be a little wasteful, as the 1.1 will install to /usr/local/bin. A small price to pay to let someone else do all the deep thinking imho. Then snag the tarball to a build directory and [code] $ ./configure $ make $ make check $ su # make install # exit [/code] (I build with my user account, and only run the 1.1 install to /usr/local/bin using the root account). This has worked great for me. If you are not on a DEB based system, you may want to look into getting a more recent bdb (along with ncurses). I'll be honest and say I've never had problems, so I rarely have to dig into the details. But my configure simply links to -ldb (which is v4.5) so I'm curious as to why your config wants to link to 4.3, but says >= 4.1 is no. If you need more info, don't hesitate to ask and we'll get it worked out. Cheers, Brian ---------------------------------------------------------------- Where is the problem with the install dir? [quote]README wrote: The "make install" will default to "/usr/local" as the install path. You may override this by specifying "--prefix=" to the "./configure" command.[/quote] ---------------------------------------------------------------- @human; No problem from my perspective. I let APT put things in /usr/bin and whereever the packagers have worked out, and the stuff I build from sources I prefer in /usr/local/bin or /home/... I only mentioned it as it was a side-effect of how I did the initial installs of OC 1.0 and 1.1. That and I'm a lazy git and prefer to avoid figuring out details whenever possible; and OpenCOBOL has been smooth sailing for me so far. :) Cheers, Brian ---------------------------------------------------------------- thank you very much,, i will have a try tonight .. :-D ---------------------------------------------------------------- sorry , also error. my install setps is: [better@HOST bin]$ ll 总计 1240 -rwxr-xr-x 1 root root 209664 08-09 22:27 libtool -rwxr-xr-x 1 root root 65055 08-09 22:08 libtoolize -rw-r--r-- 1 root root 964154 08-09 22:35 open-cobol-1.1.tar.gz [better@HOST bin]$ su 口令: [root@HOST bin]# tar -zxf open-cobol-1.1.tar.gz [root@HOST bin]# ll 总计 1248 -rwxr-xr-x 1 root root 209664 08-09 22:27 libtool -rwxr-xr-x 1 root root 65055 08-09 22:08 libtoolize drwxrwxrwx 12 root root 4096 08-09 17:11 open-cobol-1.1 -rw-r--r-- 1 root root 964154 08-09 22:35 open-cobol-1.1.tar.gz [root@HOST bin]# cd open-cobol-1.1 [root@HOST open-cobol-1.1]# ./configure checking for dlopen in -ldl... (cached) yes configure: creating ./config.status config.status: creating cob-config config.status: creating Makefile config.status: creating lib/Makefile config.status: creating libcob/Makefile config.status: creating cobc/Makefile config.status: creating bin/Makefile config.status: creating po/Makefile.in config.status: creating texi/Makefile config.status: creating config/Makefile config.status: creating copy/Makefile config.status: creating tests/atlocal config.status: creating tests/Makefile config.status: creating tests/cobol85/Makefile config.status: creating config.h config.status: executing tests/atconfig commands config.status: executing depfiles commands config.status: executing default-1 commands config.status: creating po/POTFILES config.status: creating po/Makefile OpenCOBOL Configuration: CC gcc COB_CC gcc CFLAGS -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k COB_CFLAGS -I/usr/local/include COB_EXTRA_FLAGS LDFLAGS COB_LDFLAGS COB_LIBS -L${exec_prefix}/lib -lcob -lm -lgmp -ldb-4.3 -ldl COB_CONFIG_DIR ${prefix}/share/open-cobol/config COB_COPY_DIR ${prefix}/share/open-cobol/copy COB_LIBRARY_PATH .:${exec_prefix}/lib/open-cobol COB_MODULE_EXT so COB_SHARED_OPT -shared COB_PIC_FLAGS -fPIC -DPIC COB_EXPORT_DYN -Wl,--export-dynamic COB_STRIP_CMD strip --strip-unneeded Dynamic loading System Use gettext for international messages: yes Use Berkeley DB for file I/O: yes Use enhanced Berkeley DB (>= 4.1) no Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: no [root@HOST open-cobol-1.1]# make ... fileio.c:3409: error: 'struct indexed_file' has no member named 'db' fileio.c:3409: error: 'struct indexed_file' has no member named 'key' fileio.c:3409: error: 'struct indexed_file' has no member named 'data' fileio.c:3409: error: 'R_NEXT' undeclared (first use in this function) fileio.c:3426: error: 'struct indexed_file' has no member named 'db' fileio.c:3426: error: 'struct indexed_file' has no member named 'db' fileio.c: In function 'indexed_rewrite': fileio.c:3591: error: 'struct indexed_file' has no member named 'key' fileio.c:3591: error: 'struct indexed_file' has no member named 'key' make[2]: *** [libcob_la-fileio.lo] 错误 1 make[2]: Leaving directory `/usr/local/bin/open-cobol-1.1/libcob' make[1]: *** [all-recursive] 错误 1 make[1]: Leaving directory `/usr/local/bin/open-cobol-1.1' make: *** [all] 错误 2 [root@HOST open-cobol-1.1]# i don't anderstand. you said @You may override this by specifying "--prefix=" to the "./configure" command.@ that is change the file ./configure with ac_default_prefix=/usr/local to ac_default_prefix=/usr/local/bin/opencobol-1.1 ? but the result is same.. where is the problem, i don't understand.. sorry. :-( ---------------------------------------------------------------- Sorry Betteronly, Two different issues. The conversation human and I had, was only a discussion of my concern that OpenCOBOL 1.0 would be installed to /usr/bin, while a make of the new 1.1 would install to /usr/local/bin. To me it's not an issue, but I wanted to raise the point. Your problem still goes back to the first response. # apt-get open-cobol This will install everything you need for a full on OpenCOBOL build - with little deep thinking required. (ncurses and the various ISAM file access). Then try the tar xvf ... and ./configure (without any changes). All should go well after that. Or, if you do feel like digging in, try installing a more recent Berkeley db and perhaps ncurses individually. I just found apt-get open-cobol to be quick and easy. The point human was making, is that, if desired, and installing from root, you can run the ./configure to install to /usr/bin. But that is just not how I do things here. Personal preference. I like to keep by APT installs separate from local built tools. It just avoids any weirdness with apt-get remove or apt-get purge or the update tests, as the packages will be consistent with the versions that the good people of the Debian Team have tested against. Cheers, Brian ---------------------------------------------------------------- Berkeley DB is the problem. Where and how was this installed on the system? When building BDB yourself note that BDB, per default, does NOT install into the usual place (ie. /usr/local or /usr). Roger ---------------------------------------------------------------- Subject: Printing with OpenCOBOL [quote] Brian, do you have some examples for printing files ?. Up to the moment I still create sequential files in a special directory, then I use a call "SYSTEM" using ... to print this file. As an ACU user, I define printers in a configuration file or an environment variable like this (using CUPS) PRINTER -P lp -s -ocpi=20 -opage-left=5 -dPDF PRINTER0 -P lp -s -ocpi=22 -olpi=8 -olandscape -dDELL-GTC PDF and DELL-GTC are printers defines with CUPS In my cobol prog : select MYPRINTER assign to print, "PRINTER0". (This is enough to say that the device will be DELL-GTC !) fd MYPRINTER. 01 MYLINE. 02 filler ... pic X(254). open output MYPRINTER. write MYLINE before ... close MYPRINTER. Any Idea ? Regards Bear [/quote] I opened this thread in the hopes that we can all learn something. But no, sorry Bear, no idea. I'm actually quite a few hundred kilometres away from my main computer systems and don't even have a printer here, so I've never tried. Having just looked, OC does define a PRINTER device in reserved.c but it seems to simply map to SYSOUT. If it is a direct connect parallel printer, routing output to /dev/lp0 (or /lp1) may be a simple solution (but I can't test that hypothesis and no doubt there will be issues with PCL or whatever the printer expects for control codes). [i]Anyone with more information, or reports of trials and tribulations, please add to the thread.[/i] Cheers Brian ---------------------------------------------------------------- Hello. Thanks Brian, I find this thread very interesting (same as for almost all of your posts). I think that the capability of addressing a printer and send data to it is somehow related to the matter of open a pipe and communicate with it. I don't know very much of Open Cobol (just learning). Are there plans to implement pipes? Or even are pipes already implemented? As an MF (old products) user I was used to do 1) set an environment variable dd_PRINTER1=">lp -dPRINTER1" exported from the system (or even better dinamically created from the cobol prg, via cobputenv() function) 2) from the cobol prg ... SELECT PRINTPIPE ASSIGN TO EXTERNAL PRINTER1 organization line sequential ... OPEN OUTPUT PRINTPIPE ... WRITE PRINTPIPE-REC ... CLOSE PRINTPIPE Just for talking about old funny tribulations... Cheers Leo ---------------------------------------------------------------- OK Everybody, I tried to write a skeleton of what we are talking about. This posted example creates a file named "| lp -dDELL-GTC" [code] >>SOURCE FORMAT IS FREE *> ***************************************************************** *> * Author: François Hiniger (Bear) *> * Date: 10-Aug-2008 *> * Purpose: Testing printers assignations *> * Tectonics: cobc -x printest.cob *> * ./printest *> * DELL-GTC is defined via CUPS, so "lp -dDELL-GTC somefile" works. *> ****************************************************************** identification division. program-id. printest. environment division. configuration section. source-computer. Debian-Etch. object-computer. Debian-Etch. input-output section. file-control. select PRN-File assign to printer w-printer. data division. file section. fd PRN-File. 01 prn-item. 02 filler pic X(256). working-storage section. 77 w-printer pic X(030) value "| lp -dDELL-GTC". 77 I pic 99. procedure division. begin. open output PRN-File perform varying I from 1 by 1 until I > 50 move "123456789*123456789*123456789*123456789*123456789*123456789*123456789*" to prn-item write prn-item before 1 end-perform close PRN-File . ultime. exit program. [/code] Kind regards. Bear ---------------------------------------------------------------- Actually, the easiest way is to externalize the process. Remember we can plug a file directly onto stdout by doing - SELECT .... ASSIGN TO DISPLAY. Note, This also works with MF and ACU. Now you can do what you want with the output. eg. Onto the terminal - $COBEXEC myprog Into the bit bucket - $COBEXEC myprog >/dev/null Into some file - $COBEXEC myprog >myfile Print it - $COBEXEC myprog | lp -d... ... What's this $COBEXEC you ask? Simple, I certainly am not going to write seperate scripts for OC, MF, ACU. Therefore, I use environment variables which get appropiately set accoring to the compiler/runtime (In this case, "cobcrun" for OC, "cobrun" for MF, "runcbl" for ACU). Roger ---------------------------------------------------------------- Hello. Roger's info was very useful! So I want to share my tries here. I created this simple shell printest.sh [code] PRINTER=`line` echo "printing on $PRINTER" >> printest.log #cat > $PRINTER lp -d$PRINTER [/code] According to Roger's lights I changed a bit Bear's prog to give more flexibility to the system. (see below) compile... don't forget chmod 755 printest.sh... run... [code] leonardo@ubuntu804:~/oc_tests$ cobcrun printest | ./printest.sh [/code] it works... Thanks you all. Leo printest.cob NOTE: the first line sent to DISPLAY contains the name of the file/queue [code] >>SOURCE FORMAT IS FREE *> ***************************************************************** *> * Author: François Hiniger (Bear) *> * Date: 10-Aug-2008 *> * Purpose: Testing printers assignations *> * Tectonics: cobc -x printest.cob *> * ./printest *> * DELL-GTC is defined via CUPS, so "lp -dDELL-GTC somefile" works. *> ****************************************************************** identification division. program-id. printest. environment division. configuration section. source-computer. Debian-Etch. object-computer. Debian-Etch. input-output section. file-control. *> *CHANGE* select PRN-File assign to DISPLAY. data division. file section. fd PRN-File. 01 prn-item. 02 filler pic X(256). working-storage section. 77 w-printer pic X(030) value "| lp -dDELL-GTC". 77 I pic 99. procedure division. begin. open output PRN-File *> CHANGE move "myprinter" to prn-item write prn-item before 1 perform varying I from 1 by 1 until I > 50 move "123456789*123456789*123456789*123456789*123456789*123456789*123456789*" to prn-item write prn-item before 1 end-perform close PRN-File. ultime. exit program. [/code] ---------------------------------------------------------------- To Roger : Magician is still here ! To Coboleo : I appreciate. This solution is very useful in batch or CGI mode. It's rather less realistic in a program that includes other DISPLAY statements for example in a program that shows first a list of printers before starting printing. Kind regards Bear ---------------------------------------------------------------- Bear - Not really. Just use - DISPLAY .... UPON SYSERR. That shoves the display to stderr (which can also then be redirected/piped or whatever). Also valid for MF and ACU. If you have many displays, it may be better to define a mnemonic name in special-names - SPECIAL-NAMES. SYSERR IS MYSTDERR. .. DISPLAY ... UPON MYSTDERR. Then, if for some reason you want the displays on stdout, you just need to change one place in the special-names (SYSERR -> SYSOUT). Actually, this is useful in CGI mode as well, as (per default) stderr stuff usually gets put into the webserver log. Roger ---------------------------------------------------------------- Hello again. Just for fun... this is what I played on created a named pipe [code] leonardo@ubuntu804:~/oc_tests$ mkfifo prnfifo [/code] some changes to Bear's prog [code] >>SOURCE FORMAT IS FREE *> ***************************************************************** *> * Author: François Hiniger (Bear) *> * Date: 10-Aug-2008 *> * Purpose: Testing printers assignations *> * Tectonics: cobc -x printest.cob *> * ./printest *> * DELL-GTC is defined via CUPS, so "lp -dDELL-GTC somefile" works. *> ****************************************************************** identification division. program-id. printest. environment division. configuration section. source-computer. Debian-Etch. object-computer. Debian-Etch. input-output section. file-control. *> *CHANGE* select PRN-File assign to "prnfifo" organization line sequential. data division. file section. fd PRN-File. 01 prn-item. 02 filler pic X(256). working-storage section. 77 w-printer pic X(030) value spaces. 77 I pic 99. 77 sys-cmd pic X(60). procedure division. begin. *> **-- put the pipe on (background mode) move "./printest.sh < prnfifo&" to sys-cmd. call "SYSTEM" using sys-cmd. *> **-- test standard input/output display "Please enter file/printer name: " with no advancing. accept w-printer. open output PRN-File *> CHANGE move w-printer to prn-item write prn-item before 1. perform varying I from 1 by 1 until I > 50 move "123456789*123456789*123456789*123456789*123456789*123456789*123456789*" to prn-item write prn-item before 1 end-perform close PRN-File. ultime. exit program. [/code] for printest.sh see my previous post Not totally sure... although it seems to work maybe Roger could confirm or not... Cheers Leo ---------------------------------------------------------------- Subject: Bug report? FUNCTION CHAR Ok, I was writing up the CHAR entry for the FAQ. I'm not sure if this is simply mental methane or a bug report. Cheers [code] >>SOURCE FORMAT IS FIXED ****************************************************************** * Author: Brian Tiffin * Date: 09-Aug-2008 * Purpose: Demonstrate the intrinsic FUNCTION CHAR * Tectonics: cobc -x char.cob ****************************************************************** identification division. program-id. char. data division. working-storage section. 01 letter-number pic 999 value 66. 01 char-val pic x. procedure division. move function char(letter-number) to char-val. display char-val end-display. goback. exit program. [/code] $ cobc -x char.cob is returning [code] /tmp/cob9329_0.c:19: error: two or more data types in declaration specifiers /tmp/cob9329_0.c:19: error: expected identifier or ‘(’ before ‘void’ /tmp/cob9329_0.c: In function ‘main’: /tmp/cob9329_0.c:25: error: expected expression before ‘char’ /tmp/cob9329_0.c: At top level: /tmp/cob9329_0.c:31: error: two or more data types in declaration specifiers /tmp/cob9329_0.c:31: error: expected identifier or ‘(’ before ‘)’ token [/code] And while I'm at it, not having really got my head around the required details and semantics of collating and ALPHABET in OpenCOBOL. Here is the FAQ entry, and I'd appreciate any corrections or more accurate terminology from a seasoned professional. [code] .... CHAR .... The CHAR function returns a ONE character alphanumeric field whose value is the character in the current collating sequence having the ordinal position equal to the value of the integer argument. The argument must be greater than 0 and less than or equal to the number of positions in the collating sequence. Errors in the argument range return 0 (the LOW-VALUE by default). See ASCII_ or EBCDIC_ and details of the ALPHABET_ clause. DISPLAY FUNCTION CHAR(66). Would output **A** in the ASCII character set. Note this may be different than what some expect. OpenCOBOL CHAR is 1 thru 128 not 0 thru 127 as a C programmer may be used to. *And to add a little confusion, most personal computers use an extended character set, usually erroneously called ASCII with a range of 0 to 255. A more appropriate name may be ISO-8859-1 Latin 1.* See ASCII_ for more accurate details. This author is often guilty of this misnomer of the use of the term ASCII. [/code] ---------------------------------------------------------------- He-he :-) You cannot use names for the prog source and the prog-id that have meaning in the C language. ie. "char". The same thing would happen with eg. "short", "long", "struct", etc. Roger ---------------------------------------------------------------- Can we put a warning like -Wcwords for these things to cobc (just compare with a keyword list)? Are there other places where c-words are not allowed? ---------------------------------------------------------------- Thanks for the info Roger. And I'll ditto human's comments. In the meantime, I'll try and write up an entry in the FAQ about limiting names for PROGRAM-ID. and modules. Starting with: auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned void volatile while and the GNU and C99 extensions asm, typeof, inline, restrict I'll leave the Microsoft users on their own for naked and others. Cheers, Brian Edit; Or re-thinking, perhaps a simple entry of [b]Don't use C keywords[/b] and leave the list up to the developer and particular compiler? Hmmm. ---------------------------------------------------------------- Already checked for in current 1.1 tarball (cobc/cobc.c is where the list is defined). Taken from the ISO C standard with a few gcc extensions thrown in. Applies to the base name of files passed to the compiler as well as PROGRAM-ID's. Note it is not only C keywords that can cause problems. Names/defines that are pulled in with standard includes (eg. stdio.h, sys/types.h, etc.) are problematic. Tip - stick to uppercase filenames and corresponding PROGRAM-ID's. (eg. MYPROG.cob with PROGRAM-ID. MYPROG.) It is unlikely that uppercase names will conflict with any headers/defines/system libs. (Although MF/ACU do not use the C compiler, it is still possible to trip both of these up with specific PROGRAM-ID's) Roger ---------------------------------------------------------------- Cool. Worked great by the way. Both on a PROGRAM-ID. char. and module name "char.cob" test. Roger, if you don't mind, I'll snag that info and the tip for the FAQ. Cheers, Brian ---------------------------------------------------------------- Subject: Mainframe migration and OpenCobol Folks, First, congratulation for developer team. I have been looking for COBOL compilers, paid or not. I always used Microfocus version but it is very expensive. Last days I downloaded the OC version and I was surprised with the generated source and the facilities to use them. My focus is create tools to migrate mainframe application to Linux/Unix and Windows. I am developing a telnet server that traffic TN3270 protocol, something like a CICS and 3270 terminal. I am running with success older programs that was developed for CICS Command Level. I would like to receive a feedback from companies that are using OC product. http://mainframeipl.blogspot.com Thank you Gaeta, Daniel MVS System Programmer ---------------------------------------------------------------- Subject: Priorities from the cheap seats Hello team, Along with all the other fun and nifty things going on, I'd like to take initial kicks at one or two more service library wrappers. I was reading through the libxml2 docs today. Looks like a candidate, but to be honest, XML doesn't hold a huge pile of interest for me, so I'd probably end up writing less than robust coverage. Other options are zlib, crypto, oh, lots and lots. Any preferences? Umm, that can include a push to finalize libcurl if anyone is waiting for it to grow. Or to hurry up and get the FAQ to a beta state. (Currently documenting through the intrinsic FUNCTION list) Cheers, Brian Edit; I tried taking a kick at POSIX ipc message queues. Not ready for publication, but the next service helper will be a wrapper for mq_* I've got a few tests to run to see how/if timeout send, receive and the notify sequence will work, but the basics are testing out fairly well. If you are on Debian and curious, man mq_overview gives a little hint of what's to come. ---------------------------------------------------------------- Brian, I think it's becoming more and more important for all of us somehow to get together. I think a live chat at least every couple weeks to kick around ideas would be beneficial. This project is going to grow pretty large, and make cobol development much easier for many of us. Thanks for your help so far. ---------------------------------------------------------------- I'll agree Joseph. But I'll also add, that time for OpenCOBOL (while happily lots currently), may or may not be a hit or miss situation any given week. Entirely depends on how draining real life gets. And we should also, perhaps, discuss fund raising; think about ways of finding Roger a few days pay for his awesome works. By the way, regarding my current side-trip down Message Queue lane. It turns out the form I'm building against, POSIX IPC, versus the older SYSV XSI IPC, won't be officially supported in Cygwin until [i] the hopefully, soon to be released[/i] 1.7. Oh well. Fat happy penguins beat non-transparent panes of glass anyway, imho. :-) Cheers, Brian ---------------------------------------------------------------- Ok, one more new thing will fill my plate and I'll have enough to keep from getting bored while not overwhelmed as I backfill the other service libraries and docs up to publishable standards. So, for this week I'd like to take a kick at encryption. The SSL crypto library is chock full of goodies, but I have no real feel for what be most useful in the field. MD5 seems fairly ubiquitous but the docs state sha-1 or ripemd is better for new developments of hashing digest values. I'd appreciate any use cases people may have, as I was thinking MD5 would be first up. But if it is already broken, that may be a waste of implementation and testing time. I'll try and implement the actual data encryption with EVP, and BLOWFISH as the first engine target. Again, any real life use cases or preferences would be appreciated. After that, I'll probably take a break from new services until at least a few of the current items are finalized. That means digging into details, and while necessary, will make it look like things are slowing down a little. So, if you are eagerly wishing for any external service hooked into OpenCOBOL, this may be a good time to ask for a change to the priorities. Don't be shy. I don't mind and would much rather try to build something developers would find useful in the field than produce code that may just sit on a shelf. libxml2 is still an option and while I can see it being useful, I'll reiterate that for reasons unknown, it is a service that holds little personal interest. Cheers, Brian ---------------------------------------------------------------- MD5 is used in often in software, even for interfaces between software (to verify the given data). For this reason I think it needs years until MD5 is dead. Blowfish for de-/encryption would be nice. For all of them it would be useful if the program does file and string (maybe a maximum of 10240 chars?) de-/encryption. IF there would be a working xml tool I would try it for personal use (some BDB-ISAM-Files are rearranged and put into xml). At the moment this program uses a lot of string with pointer to do this, but a more handy way would be nice. To read xml-files seems to be a lot of harder in cobol (for example: what are the attributes of one xml-root; What value has attribute xyz?), so a good tool would be valuable there, too. Again: a better way for writing xml files would be interesting for me. I think about something like:[code]perform generate-xml-header move 'Firsttag' to XML-Tag perform add-xml-opening-tag move 'FirstDownTag' to XML-TAG move 'FirstDownName' to XML-AttribName move '123' to XML-AttribValue perform add-xml-attrib move 'SecondDownName' to XML-AttribName move 'ABC' to XML-AttribValue perform add-xml-attrib perform add-xml-opening-tag move 'HeresContent' to XML-TAG mobe 'This Is The Content' to XML-Input perform add-xml-complete-tag perform close-xml-tag perform close-xml-tag perform generate-xml-foot[/code] (Maybe the attributes can be set as an array, maybe there could be a perform close-all-open-tags, ... maybe it could be done all in a better way,...) What do you had in mind about writing xml?? ---------------------------------------------------------------- If (it'll happen, just depends on when) I did an XML service, it would mostly be exposing the functions in libxml2. It is a fairly large API, and I'd probably leave most of the memory management inside the C layer. http://xmlsoft.org/html/index.html, and at first, http://xmlsoft.org/html/libxml-tree.html So it would provide a root node data element, access to the plethora of tree API functions, and me being me, the first pass would be a simple reader and writer. One of the early tasks would be wrapping one of the data encoding methods, as way back when, when I did XML for a C++ middleware project, I couldn't believe there was no way of native XML handling binary zero. I think it has something to do with why XML never became a favourite. Seemed so promising. Perhaps I'd relish it a little more, seeing if things have gotten better since the days I was using the libraries posted by IBM on Alphaworks. :) The primary goal would be some level of ease of use from an OpenCOBOL developer perspective, then later an attempt at complete coverage of the fiddily bits. Maybe it'll be a library provided sooner rather than later with an implementation covering the easy stuff while I dig in and complete the other service offerings. Cheers, Brian ---------------------------------------------------------------- I've become intrigued by Qt and GTK+. I normally use KDE so was leaning toward Qt (it has functionality for full XML, networking, and lot and lots of goodies) but it is natively C++ and not-quite truly "open". GTK+ is C and as a GNU project is totally open, so today I'm leaning toward the Gnome Tool Kit (benefits include the much less restrictive license scheme - which sounds weird coming from the point of view of GPL). OpenCOBOL developers would be able to commercialize applications without talking with TrollTech (Nokia?). Would a wrapper of the Gnome Tool Kit be worth waiting for? It'll be a fair monster of a job, and me being me, it would come in bits and pieces. First attempt would be something suitable for popping up Hello OpenCOBOL in a GUI window with a Bye button. After that, the sky's the limit. The API for printing looks cool - even if Linus thinks it's overly complicated :) These frameworks buy a lot, for a little. key=value pair config parsing, XML (Qt full blown, GTK simple), URL and file handling and on and on, along with the cross-platform GUI. But it will be a large wrapper (or binding if that'll make sense in the end). Large. Cheers, Brian ---------------------------------------------------------------- Maybe it's a good idea to have different small wrappers for the different jobs (XML/GUI/...) or, if this isn't possible, to have a WRAPPER-Master Program (maybe with PROGID GTKPMASTER) and to have small wrappers for each job calling GRKPMASTER. I would surely try this, if there are anything possible things with XML or GUI. Maybe this lead to an OpenCOBOL - GUI, which can be simply used for the programmer. ---------------------------------------------------------------- GTK+; Yeah, I spent an hour with the libgtk2.0-dev package last night. Writing up the bindings will take a while, and they will definitely be "in pieces". gtk.h includes some 179 other header files. And the first one of those, gdk.h includes 21 others. The first baby step will be getting a wrapper on some of the various g datatypes. And if this works, yes OpenCOBOL will have access to a GUI toolkit. But this will require a little spec work on how much C helper code should be in the bindings. GTK is heavy in the signal and function callbacks, and I'd initially like to plan for as many of those being OpenCOBOL procedure templates as possible; while avoiding the issue of diminishing returns. Joseph; this should map nicely with your GIMP workshops. GTK is short for GIMP Tool Kit. :) Cheers, Brian ---------------------------------------------------------------- So first GUI and then XML? Just do as you need to go forward. ---------------------------------------------------------------- human; that's good timing for that question. I was just logging in to say that GTK may have to wait. Looking at the scale of it, if started now, other tasks may not get finished. To avoid overfilling the plate, I'll be limiting the gtk effort to simple study, pondering and asking of questions for now. After progressing more on the MQ wrappers, libCURL and getting the FAQ published, I'll revisit. Would definitely be biting off more than I could chew. [i]Might be a nice leg up on any possible future Object Oriented OpenCOBOL features; hint, hint, wink, wink; as the entire glib is based on object oriented C programming.[/i] So, now I can't really say if XML or GUI comes first. A first cut libxml2 is probably an easier, (well, time wise), task, but if the simple XML parser in the GTK is sufficient (dunno - part of the pondering), it might be an issue of managing time to the goal. So, for the next bit, priorities are working on the tasks already in the job jar. Cheers, Brian ---------------------------------------------------------------- Main priority must/should be the FAQ with the aim to get that in texi format for inclusion into 1.1 release. (Aim to merge/update existing open-cobol.texi) Roger ---------------------------------------------------------------- Thanks Roger; Some strong and crisp decision making is nice incentive and good for the motivation and focus. [i]You know you've help develop something that is just way too much fun to explore, eh?[/i] :-) So, I'll try and go to town on the .texi file and start shipping out drafts. Cheers, Brian ---------------------------------------------------------------- One priority would probably be SQL/MySQL connectivity. Oracle, DB2, MS SQL and others would be nice for some, but those are rather expensive to test for if you've not got it at work. XML is part of the COBOL 2002 standard? I'm not sure. I just know that I've read that COBOL was set to handle it. If it is, and XML is incorporated, I'd suggest it not be a wrapper but be standards compliant. If a wrapper were created in the meantime might I suggest the following. Whether it be for SQL, XML, ISAM or any of the others, depending on how the spec goes, these could/should? probably be incorporated as part of file section. Maybe some kind of flag to state what type of file it is, and of course any additional parameters needed for that file format. The main point being that READS, OPENS etc should be able to be done without special commands. When we are accessing files, we should access them exactly as we would in normal COBOL without calling all sorts of libraries. Or, the calling of the libraries should be seamless and in the background, having been handled already by paramaters in FILE SECTION. GTK is of course a big project as well. I'd suggest GTK screen section in another post for the *wishlist*. Though also even simple GTK DISPLAYs would be nice. I think again it should be seemless. I'm assuming that normal displays without screen section just get sent to console and not to NCURSES. So we'd have 3 versions of output right there. Console, Ncurses, GTK. So, I am wondering if OC has any kind of plans for a PLUGGABLE framework. This would apply right now to the FILE SECTION and to the SCREEN SECTION/DISPLAY/ACCEPT. By having a plugable framework, a few paramaters could be set, or compile time switches, and different architectures could be used (XML/SQL/ISAM or Console/SQL/XML). With a pluggable architecture, in the future anyone could write a wrapper that could then be used by any STANDARDS based COBOL statements. I am talking out of my ear though because at the moment I don't know C and of course thus the OC framework. The gimp workshops are more right now of a study group, since I'm a data guy not a designer or a systems level analyst/programmer like yall. http://webdesign.meetup.com/396 for the group. But one of the designers just took over as Graphics Coordinator, so my design skills will really pick up, as will the entire team's. (This is the meetup team, not work team, and that's the team that's helping us with the OC logo if Roger is so inclined to accept any samples we bring to him). I agree GTK should wait. It's on the wishlist, not the priority list. Folks that NEED a GUI right now could just do what I am going to do, output HTML. It's pretty simple to do that, and to set your own file extension with Apache. I did it about 2 years ago when I first started playing with OC to see its viability. I am also going to start working on a CODE GENERATOR soon, compiling COBOL code in OC, to of course generate COBOL code. I've been a big fan of meta-programming since I started programming years ago, and now I'm finally getting down to my framework. We discussed opening sourcing that at my company yesterday, so as soon as I have actual code I can send it yall's way. OOP OC....I'm very keen on this. Mostly, and I think one of the most important priorities, should be to bring OC up to the 2002 spec, and then 2008. We're willing to contribute to this effort, financially for now and coding in the future when I learn C, or we have others on board that have C experience. My desire is to see OC be much more feature rich, and robust, than all of the other Cobol compilers. Whatever we can do to help, we're ready. I agree with Roger. Our goal is to get the documentation going first of all, regardless of all of these other features. It won't do us much good to have lots of features, and no documented way of using them. As part of the web design group, lots of folks have asked me for programming training. I've told them, if they want PHP or RUBY then someone else has to step up to the plate and teach them, and I've sent that to all the developers in the group also. None have. So they get me and COBOL and best practices and programming concepts. Which means real programming, with a focus on data, not script kiddies. But they will be good testers for our documentation, and will absolutely contribute to the entire affair with us. Brian, all you have to do in order to have these things appear on the website is set the files that are ready to go live to a certain directory. I'd do an SVN EXPORT of those and we'd be done. I will hash out details with you here, or in email and on the phone. I'm working from home thursdays through sunday. Also, this is part of my job now, since the other dev's taken over the application at our office. I've much more time available. If you go on FREENODE IRC you can reach me in the chat room #add1tocobol. And the domain add1tocobol.com can host any files we want or dbs that are needed for this effort. ---------------------------------------------------------------- Re GTK and the other issues; We'll get an OC 1.1 FAQ published to 1.0rc pretty soon. A full-fledged User Guide, Reference Manual. Well, that's a different beasty as far as I'm concerned. A first cut at such will be what I've coined a "spelling bee" manual in my head. Spell the reserved word, use it in a sentence. :) Perhaps Quick Reference is a more appropriate working title. Now that add1tocobol.com has been kind enough to offer some space, it will make generating the docs and the samples bundles a lot easier; as there will be a place to put tests and organize a structure as we prep things for possible inclusion in OpenCOBOL. Re; SQL; I think the Firebird preprocessor would probably be the fastest path to that goal. From my limited study, all that needs to be fixed is a little assistance from the Firebird team and fix / reason for the isc_sqlcode_s and isc_sqlcode symbol issue and then some testing? Note, I only spent enough time to verify the symbol problem, but it seemed to be very close. Putting GTK on hold (from my point of view) was simply a decision to ensure some of the other tasks are completed. Incentive and motivations are in place, for that. And GTK is one of many possibilities for wrappers; so much exciting stuff (to ignore for now - that could the hardest part) in OC's future. Cheers, Brian ---------------------------------------------------------------- Brian, You can commit to the SVN repo even as you are still in testing phase. I've created two directories under /ocdocs which are joe/ and brian/. Just drop your stuff in brian/ until we get a more formal structure. I think it's good to add to the repo as we go along so that there is always something to go back to when we need. The idea of a spelling me gives me an idea. COBOL being mostly English, I think we could write the future docs to be similar to learning English perhaps. Grammar, vocabulary, that kind of thing. Just a thought. We need a couple of things. Of course the FAQ. Then a quick reference. I want a pocket guide of the oreilly likes. If we have the text, it is enough enough to put that into a PDF and upload to LULU.com. I'd suggest charging a bit more, and sending the profits to Roger. Besides the spelling bee, we want lots of code examples. These have to have been tested in OC and shown to work. I am going to be going over the spec today. I finally printed it out. It was exhausting to read online. But now that I can see the structure better, I'll have no problem getting through it. Once I do I can start testing things more. My other books should arrive in a week according to Amazon. When that happens, I might just start the COBOL course immediately with anyone that's wanting to learn from our teams. So as I said, they will then help with the documentation. I want a hit the ground running set of docs. No need to look elsewhere to use OC. Of course you could look elsewhere to get extra tricks, or advice, or code examples or industry specific suggestions (how to code a double entry accounting system, how to code a patient tracking HIPPA compliant system etc). But to actually use OC, we should be the definitive source. I've not used firebird but I am ok with trying. All of our stuff is in MySQL so eventually I will need that (and would be willing to pay for it, again as I mentioned to Roger). But as I mentioned here, I think rather than having a single system, a plugable interface might do us well. I'm emphasizing compliance with the standard here. Not too much non-standard code to make it work. Gotcha about the gtk on hold and what you mean by it. I think you are right, if we start going off in too many directions, especially since some of us cannot contribute to that side of things, it's going to become a hodge podge and less will get done, not more. Perhaps it's time we started doing things in the COBOL way? Lay out plans, flowchart things, posts the plans and flowcharts for review, then tackle one thing at a time in an orderly fashion. Just some more ideas. #add1tocobol on Freenode chat. ---------------------------------------------------------------- Just found Pandoc. 0.47 (out of the source repo) includes a Texinfo writer and a ReST reader. So, version 0.0h of the FAQ is now in .texi form, and depending on approval, will become OpenCOBOL FAQ 1.0rc with lots and lots of user choice of formats. So, work starts this weekend on the OpenCOBOL reserved word "spelling bee" document. Something as a quick reference sample of each of the reserved words used in a sentence. With a plan for a BNF reference built up slowly from that. Along with the FAQ, work (the thinking about the work part of the work) has started to post a nice summary of some key opencobol.org forum posts from raw data. Cheers, Brian ---------------------------------------------------------------- Hello, The spelling bee doc will look like this. If you think there may be a way of increasing the usefulness, please feel free to advise or opine. This will take a little while to pull together. Using ReST, output is definition list form. and converts nicely to .texi with Pandoc. Cheers, Brian [code] ACCEPT ACCEPT variable FROM CONSOLE. ACCEPT variable FROM ENVIRONMENT "path". ACCEPT variable FROM COMMAND LINE. ACCEPT screen-variable. ACCESS SELECT filename ASSIGN TO "filename.dat" ACCESS MODE IS RANDOM RELATIVE KEY IS keyfield. ACTIVE-CLASS Not yet implemented. Object COBOL feature. ADD ADD 1 TO variable GIVING variable END-ADD. ADDRESS SET pointer-variable TO ADDRESS OF linkage-store. ADVANCING DISPLAY "Legend: " WITH NO ADVANCING END-DISPLAY. WRITE printrecord AFTER ADVANCING PAGE END-WRITE. AFTER PERFORM WITH TEST AFTER VARYING variable FROM 1 BY 1 UNTIL variable > 10 DISPLAY variable END-DISPLAY END-PERFORM. ALIGNED todo ALL INSPECT variable REPLACING ALL "123" WITH "456". ALLOCATE todo ALPHABET CONFIGURATION SECTION. SPECIAL-NAMES. ALPHABET name IS 2 4 1 3 5 6 7 8 9. ALPHABETIC ALPHABETIC-LOWER ALPHABETIC-UPPER ... YYYYMMDD ZERO ZEROES ZEROS [/code] ---------------------------------------------------------------- Ah! Basically you are talking about a dictionary no? We could easily expand on that if this is the case. Include in it, the definition, as well as quoted examples. ---------------------------------------------------------------- Subject: Alignment between COBOL and C Folks, I am trying to use COBOL and C, under CYGWIN. I have been success with CALL command and parameter list, like : CALL "prog1" using p1,p2,p3.... But when I am trying to use P1 as a group item I am having problens with alignment. In a mainframe, we have this problem but normally I am be able to solve this issue. My question is does anybody knows the rule to use this facility ? COBOL calling : 01 wk-block. 05 field1 pic x(04). 05 filler pic x(01). 05 field3 pic s9(09) comp. 05 field4 pic s9(09) comp. 05 field5 pic s9(09) comp. 05 field6 pic s9(09) comp. 05 field7 pic s9(09) comp. 05 field8 pic x(01). call "prog1" using wk-block. struct stcbmain { char eyecb[4]; char eyecb_z[1]; int sock; int action; int rc; int piclen; int piciolen; char picaid[1]; }; int cxx(void *parm1) { struct stcbmain *cblist; cblist=(struct stcbmain *)parm1; .. .. return(0); } Daniel Gaeta MVS System Programmer IBM/BR ---------------------------------------------------------------- There are few issues here; and I'll admit, I'm not that experienced, as I rarely bump into problems that require deep thinking so far. First thing to try COMP in OpenCOBOL is BigEndian. Intel native form in LittleEndian. Try COMP-5 or drop the PIC and try USAGE BINARY-LONG (for 4 byte ints). That should align the numeric integers. Next up may be more difficult, and this I'm really clueless about. The structure alignment may include padding between elements (outside normal COBOL FILLER), but if I remember correctly that will only influence performance and not cause alignment faults (unless you happen to be on a 68K or similar processor) so I don't think that your field3 will be misaligned between COBOL and C (experiments will tell you and if they are, removing the one byte filler field2 should fix that - but that is only by manual inspection of the structure - not a reliable all-cases fix). See if a COMP-5 (or BINARY-LONG) change gets you to where you want to be and post your findings. If it happens to be the second case, internal padding, maybe check the C translation output from cobc -C to see what the output C code looks like. [b]BEWARE[/b], [i]if the COBOL and your C module share a fileprefix[/i] [b]cobc -C can whack over your source code with the generated file[/b] [i]and that can put a real downer on your day.[/i] It will overwrite your hand editted myprog.c with the output of the translation of myprog.cob (creating the translation output of myprog.c) so take care to either mv your sources or don't use similar names. [b]Seriously[/b] ... it can be a drag to get that "[b]oh no[/b], I just overwrote a days c programming". Cheers, Brian ---------------------------------------------------------------- Brian is correct regarding COMP representation, however the statement "That should align the numeric integers" is WRONG. See below (and also first post in Topic Cobol Info/Tidbits). (Note that discussion here also applies to MF/ACU) Some basics here - Cobol (per default) does NOT insert padding in record descriptions. So - DISPLAY FUNCTION LENGTH (wk-block). gives "26". On the other hand C (per default) DOES insert padding into structures. So - printf ("Struct size %d\n", sizeof (struct stcbmain)); gives "Struct size 32". There are several ways to deal with this. Obviously, the best way is to carefully define your Cobol record items to take into account any padding issues. Other possibilities (not especially recommended) are - a) In the C code, force byte alignment within the structure. Depending on C compiler, this is usually done with either a "#pragma" directive or (eg. gcc) with a __attribute__ specification. b) In the C code, use "char [4]" instead of "int". Note then that you will have to move (memcpy) these into local "int"'s before use. c) In the Cobol code, use the "SYNC" clause on the first integer field ie. 05 field3 pic s9(09) comp sync. NOTE that, with the exeception of (a) above, the complete structure size will be padded to a natural size if necessary. Therefore it may be necessary to add FILLER items at the end of the Cobol record description to take this into account. Note that, if in the C code you only ever refer to the structure members, this is not strictly necessary (however, technically correct); BUT, if you refer to the structure as a whole (eg. memcpy'ing it), then you MUST have the correct size in the Cobol code. Just to confuse matters, things get interesting with pointer fields (which vary according to 32/64 bit). [code] 01 myrec. 03 fld1 PIC X. 03 fld2 USAGE POINTER. 03 fld2 PIC X. [/code] On 32 bit systems, myrec is 6 bytes and on 64 bit systems myrec is 10 bytes. Equivalent C - [code] struct myrec { char fld1; void *fld2; char fld3; }; [/code] On 32 bit systems myrec is 12 bytes and on 64 bit systems 24 bytes. Roger ---------------------------------------------------------------- Re the "should align the numeric integers". Daniel; You read Roger's response I hope? I waited awhile before adding this, as I didn't want to dillute the importance of Roger's correction. My post should have read, "should pass the integers in the proper byte-order". The choice of the word [i]align[/i] in that case was worthy of, and deserved, a good smack-down. :) As Roger has verified, your problem is two-fold. Big and little endian, and internal structural padding. The byte-order issue is far easier to deal with, COMP-5. The padding being a little trickier, and will require following the advice Roger posted. My thanks to Roger for pointing out the very WRONGness of the initial response. I think I knew what I meant to impart, but failed. Sure is nice having people that know what they are talking about around. Cheers, Brian P.S. To everyone else. I hope this highlights the importance of technically accurate information, and why I will never mind, and depend on, sober second thought and corrections by others for any of the samples and documents I add to the OpenCOBOL forums. (While trying to not make too, too much work for Roger; watching over and herding the cats). :-) ---------------------------------------------------------------- Brian, No problem!!! Don't worry! I have appreciated by your feedback! You choose the corret subject for my question. I tried to align my integers and cobol COMP fields, but I didn't have success. BTW now I am using to parameter list, where each field is a item in USING statement. :( Thank you Daniel Gaeta MVS System Programmer ---------------------------------------------------------------- Using your example, do as follows - 01 wk-block. 05 field1 pic x(04). 05 FILLER PIC X(04). 05 field3 USAGE BINARY-LONG. 05 field4 USAGE BINARY-LONG. 05 field5 USAGE BINARY-LONG. 05 field6 USAGE BINARY-LONG. 05 field7 USAGE BINARY-LONG. 05 field8 pic x(01). 05 FILLER PIC X(03). struct stcbmain { char eyecb[4]; /* Align */ char eyecb_z[4]; int sock; int action; int rc; int piclen; int piciolen; char picaid[1]; char filrest[3]; }; Roger ---------------------------------------------------------------- Subject: OpenCOBOL 1.1 pre-release build fails on AIX Hi! The current OpenCOBOL 1.1 pre-release from www.opencobol.org fails to build on AIX 5.3 with the native cc (with gmp in 32 bit mode): --------------------------------------------- generating symbol list for `libcob.la' /usr/bin/nm -B -BCpg .libs/libcob_la-common.o .libs/libcob_la-call.o .libs/libcob_la-strings.o .libs/libcob_la-move.o .libs/libcob_la-numeric.o .libs/libcob_la-intrinsic.o .libs/libcob_la-fileio.o .libs/libcob_la-termio.o .libs/libcob_la-screenio.o | awk '{ if ((($2 == "T") || ($2 == "D") || ($2 == "B")) && (substr($3,1,1) != ".")) { print $3 } }' | sort -u > .libs/libcob.exp cc -Wl,-bM:SRE -o .libs/libcob.so.1 .libs/libcob_la-common.o .libs/libcob_la-call.o .libs/libcob_la-strings.o .libs/libcob_la-move.o .libs/libcob_la-numeric.o .libs/libcob_la-intrinsic.o .libs/libcob_la-fileio.o .libs/libcob_la-termio.o .libs/libcob_la-screenio.o -Wl,-blibpath:/mike/miked03/frink/gmp/lib:/mike/miked03/frink/gmp/lib:/usr/lpp/xlopt:/usr/lib:/lib -L/mike/miked03/frink/gmp/lib -lm -lgmp -lcurses -lc -Wl,-bnoentry -Wl,-bexpfull -Wl,-bE:.libs/libcob.exp ${wl}-bernotok ld: 0711-317 ERROR: Undefined symbol: .main ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. make: 1254-004 The error code from the last command is 8. Stop. make: 1254-004 The error code from the last command is 1. Stop. make: 1254-004 The error code from the last command is 2. Stop. --------------------------------------------- If I remove -no-undefined in the line libcob_la_LDFLAGS = -version-info 1:0:0 -no-undefined from libcob/Makefile, make is successful. ---------------------------------------------------------------- Need more info. Do the following - Run a "make distclean". Redirect the output of "env" into a file (1). Run "configure" (2), "make" (3) redirecting stdout/stderr into files. If using any options to configure, please state what they are. Send (1), (2), (3) and also "config.log", "defaults.h", "config.h", "libcob/Makefile". You have my mail address. Roger ---------------------------------------------------------------- Requested files have been sent by mail. ---------------------------------------------------------------- Subject: Problems with cobc -x in windows (bug?) - solved Maybe anybody can help me, maybe there is/was (I use OC 1.0) a bug in cobc. [code]cobc -C -Wall -I myfolder\cpy -o myfolder\c\hallo.c myfolder\cbl\hallo.CBL[/code] works fine. [code]cobc -c -Wall -I myfolder\cpy -o myfolder\hallo.exe myfolder\cbl\hallo.CBL[/code] does not. There is always a call to cl.exe. So I've thought "no problem" and put the bin of my MS VC9Express into environment PATH. Then cl.exe misses stdio.h and libcob.h so I've put the include of both VC9Express and opencobol into environment INCLUDE. Now cl.exe gives me the fatal error 'LINK: could not find "libcob.lib"'. Then I've tried cobc ... -L mypath\opencobol\lib but cl.exe complains about 'unknown option "-Lmypath\opencobol\lib" is ignored'. I've set LIB into environment with the lib-folders of VC and OC, now some win32-libs are missing (I'll get them from PSDK and report tomorrow). Any suggestions how I can use cobc -X with mingw only (no VC)? Is this bug ("cobc -L something" leading to "cl -Lsomething") already known for OC 1.0? ---------------------------------------------------------------- Got all the stuff from PSDK and compiling worked but a lot of dlls and other things are needed to compile and to run my hallo.exe. So I removed the whole MSVC stuff and did [code]cobc -x -C -Wall -I myfolder\cpy -o myfolder\c\hallo.c myfolder\cbl\hallo.CBL[/code]together with[code]gcc -o myfolder\exe\hallo.exe myfolder\c\hallo.c -I x:\opencobol\INCLUDE -I x:\opencobol\INCLUDE\libcob -s -enable-auto-import x:\opencobol\lib\libcob.dll -enable-auto-import x:\opencobol\lib\gmp.dll[/code]instead of [code]gcc -o myfolder\exe\hallo.exe myfolder\c\hallo.c -I x:\opencobol\INCLUDE -I x:\opencobol\INCLUDE\libcob -s -enable-auto-import -L x:\opencobol\lib -lcob -lgmp[/code] So fine this way. ---------------------------------------------------------------- Subject: Multithread and resources shared Is anybody had some experience using to OC in a multithread solution? I have a deamon that share the same module loaded using by cob_resolve in a separated thread. My concern is regarding OC static variables. Until the moment I didn't have any deadlock problems. Daniel Gaeta MVS System Programmer ---------------------------------------------------------------- OC is not thread safe, not least of all, because the software prequisites are not thread safe. Roger ---------------------------------------------------------------- Which prerequisites are causing problems? GMP should be thread-safe, and BDB as well. ---------------------------------------------------------------- Alex, Thank you for your response and sorry my delay. I am researching about future problems with deadlock when we are running COBOL task in multithread solution. Something like a COBOL socket send/receive a stream in a thread. Until today I didn't have any problem yet. :-D Thanks ---------------------------------------------------------------- Subject: UNICODE Support Dear OC-Users, I have noticed that oc does not have support for UNICODE. From my experience, the following keywords aren't supported, yet: - (USAGE) NATIONAL (Data Division) - NATIONAL-OF, DISPLAY-OF - INSPECT .... NX'...' My question - are there any short or long-term plans to include UNICODE-Support in OC? What about the effort of including it? Often, the lack of UNICODE-Support is a "Show-Stopper" for international projects selecting a COBOL-Compiler. Thanks so far, Joe ---------------------------------------------------------------- Hi all, I also want to know if UNICODE-support is planned to be a future feature of OC? For example: - PIC N - ... I found no info about it on this forum and the sourceforge project page. Can you please give some info about it? Thanks in advance, kind regards, Geert ---------------------------------------------------------------- Unicode has problems. I've ported before [url=http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=348&forum=1][b]here is my post[/b][/url] ---------------------------------------------------------------- Subject: Suggestions and Improvements Hi Team, On more time.. Congratulations... I am working on solutions using to OC. I would like to suggest something to development team. Would be possible create a callback, for example, in command EXEC.. END-EXEC? In this case, for example, callback would receive two parameters, char *strexec and int *strlen. I believe that this option is very interesting to create new features for OC. Thank you Daniel Gaeta MVS System Programmer ---------------------------------------------------------------- Not sure what you want here. Can you provide a concrete example and an explanation what you want it to do. Roger ---------------------------------------------------------------- Hi Roger, Sorry and thank you by your patience. I will try to show a example for you. I was thinking in something like : COBOL : program-id. mycob. working-storage section. 01 myfield1 pic x(10). 01 idcod pic 9(03). procedure division. ... commands ... move 1 to idcod. exec sql select * from table1 where idcod=:idcod end-exec. ... commands ... exec gui (<-graphical user interface) show form end-exec. In mainframe, for example, there are a lot of translators that convert EXEC statements in CALLs statements to do something. I would like to suggest instead of translate statements, for each EXEC would be called a C function (as callback model). For each "EXEC command END-EXEC" the OC will call a DLL or a function within static object, passing *command parameter. int callback_exec(char *command) { // the command char array would have the following text : // first call, "sql select * from table1 where idcod=1" // second call, "gui show form" ... my code to do this action.. return(0); <- this value would be moved to RETURN-CODE } Please, let me know if you have questions or comments. Thank you Daniel Gaeta ---------------------------------------------------------------- Subject: cuil.com search engine; COBOL keyword. :-) We need a nice OC logo. If you do a cuil.com [b]COBOL[/b] search, OpenCOBOL is front and centre (today at least). cuil.com is a google employee spinoff. I don't think their model will get anywhere near the google number of visits, (limited entries per page and other issues), but it's kinda cool (cuil). They advertise 121 thousand million pages scanned. I have also been informed by a very bright student, that although they advertise a "Safe Search: ON" by default, some results may be deemed (as they put it on compsci.ca), NSFW, Not Safe For Work. I have no idea what keywords he tested, but just so ya know. Cheers, Brian ---------------------------------------------------------------- I will bring it up tonight at our meeting. ---------------------------------------------------------------- Subject: Open Cobol IDE? I think one thing we definitely need is an IDE. Code highlighting would alone be very valuable, as would project management, debugging and so forth. Here is an example screenshot from the Kobol project for the Eclipse IDE. I think perhaps yall see what I mean then? I purchased their standard Kobol product a couple years ago. The editor I got was very plain. http://www.thekompany.com/products/kobol/eclipse/_img/screenshots/eclipse1.png?PHPSESSID=2c268db893fdcee113d04bef91ea3338 ---------------------------------------------------------------- What about this? http://www.eclipse.org/cobol/ It is little abandoned but better tha beggining from scratch. Regards. ---------------------------------------------------------------- I didn't say anything, as I have a lot of respect for aoirthoir, but I eschew IDEs. GNU/Linux makes an awesome interactive development environment imho. I'd not object to anyone building such a tool, might even help out, but I'd rarely if ever use such a application. I find they hide too much information whereas a command line toolkit doesn't (as much). Very personal preference. I tried Eclipse, and tossed it as bloat after about 15 minutes. Having said that, other developers may well be able to use such a product to run rings around the rest of us, personally I just get lost. Cheers, Brian ---------------------------------------------------------------- Brian, I'm thinking more along the lines of what you had with VI, except I'm not a vi user. Something that had syntax coloring would be perfect. If it also offered code completion (for say reserved words and variables) that would be an extra little bonus, but I don't use code completion much. Lastly code folding would be nice. Other than that I don't do a whole lot with IDEs. So perhaps I should have said editor:) But I won't ever mind you disagreeing with me, or even taking me to task if I am wrong. ssamayoa, I'm with Brian on the bloat of Eclipse. I tried it with php and just felt it was too slow. Maybe it is time I got on my butt and learned vi? Did the vi cobol thingy add colors? ---------------------------------------------------------------- Yes, colours are added. But nothing about code folding and code completion (as far as I know). To be able to use vi is good, but this cannot be the suggestion for new OpenCOBOLers... It would be possible to compile if eclipse would be used (or another unknown fast IDE, if available with cvs/svn support as eclipse has). You only need to have cobc / cobcrun available (native linux or compiled for MinGW). These are the point why I would prefer an IDE instead of an editor. ---------------------------------------------------------------- human and aoirthoir; We'll never all come to a concensus on IDE vs no IDE. Very personal choices and goose/gander. So I suggest we work on both, being all inclusive. I'll be in the no IDE camp setting up a big purple tent. :-) On using vim; First, vi is my editor of choice. :help will lead you to a tutorial. There is also an online copy of a Vim book at ftp://ftp.vim.org/pub/vim/doc/book/vimbook-OPL.pdf I'm finally getting round to updating my copy of syntax/cobol.vim, but I'd appreciate help with the regular expressions. I don't mind looking dumb here, so ... Built-in Library calls; Does anyone have a more efficient way of doing [code] syn match cobolWatch /\(["']\)SYSTEM\1/ syn match cobolWatch /\(["']\)CBL_ERROR_PROC\1/ syn match cobolWatch /\(["']\)CBL_EXIT_PROC\1/ ... [/code] for the 40ish built-ins? Plus the complication of the three x"F1" type names? FUNCTION; I'm also playing with colouring the intrinsics. syn keyword cobolWatch COS CURRENT-DATE DATE-OF-INTEGER DATE-TO-YYYYMMDD But, I'd really like to separate the actual reserved word LENGTH from the FUNCTION LENGTH (for instance), so I'm hunting for a practical regex that has [i]any-case FUNCTION and whitespace[/i] followed by the any-case function name. Plus, I may be going overboard using cobolWATCH (it is really meant for quick groks - so I'll be playing with what colours as what). I've posted today's copy (hopefully not breaching any copyrights as I've not talked with any of the previous maintainers, but I'll assume a VIM syntax file is copyleft. If not, I'm a no-good snook) Tomorrows copy will have a separate list of the implemented and non-implemented reserved words and some of the other niceties. Treat this as a Work In Progress, and to get people used to Vim syntax files for OpenCOBOL. After installing vim (I have 7.1), copy the original syntax file somewhere - just in case. (You'll need root access if you used APT to install). [code] # cp /usr/share/vim/vim71/syntax/cobol.vim /mystash/ [/code] then place this file in the syntax dir as [b]/usr/share/vim/vim71/syntax/cobol.vim[/b] then, in your vimrc, [b]~/.vimrc[/b] add [code] syntax enable [/code] And you should be good to go whenever you vi a .cob or .cbl file. [code] " Vim syntax file " Language: COBOL " Maintainers: Davyd Ondrejko " (formerly Sitaram Chamarty " James Mitchell " Last change: 2001 Sep 02 " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded " Stephen Gennard " - added keywords - AS, REPOSITORY " - added extra cobolCall bits " Brian Tiffin " - modified for OpenCOBOL 1.1 August 2008 if version < 600 syntax clear elseif exists("b:current_syntax") finish endif " MOST important - else most of the keywords wont work! if version < 600 set isk=@,48-57,- else setlocal isk=@,48-57,- endif syn case ignore if exists("cobol_legacy_code") syn match cobolKeys "^\a\{1,6\}" contains=cobolReserved else syn match cobolKeys "" contains=cobolReserved endif syn keyword cobolReserved contained ACCEPT ACCESS ADD ADDRESS ADVANCING AFTER ALPHABET ALPHABETIC syn keyword cobolReserved contained ALPHABETIC-LOWER ALPHABETIC-UPPER ALPHANUMERIC ALPHANUMERIC-EDITED ALS syn keyword cobolReserved contained ALTERNATE AND ANY ARE AREA AREAS ASCENDING ASSIGN AT AUTHOR BEFORE BINARY syn keyword cobolReserved contained BLANK BLOCK BOTTOM BY CANCEL CBLL CD CF CH CHARACTER CHARACTERS CLASS syn keyword cobolReserved contained CLOCK-UNITS CLOSE COBOL CODE CODE-SET COLLATING COLUMN COMMA COMMON syn keyword cobolReserved contained COMMUNICATIONS COMPUTATIONAL COMPUTE CONFIGURATION CONTENT CONTINUE syn keyword cobolReserved contained CONTROL CONVERTING CORR CORRESPONDING COUNT CURRENCY DATA DATE DATE-COMPILED syn keyword cobolReserved contained DATE-WRITTEN DAY DAY-OF-WEEK DE DEBUG-CONTENTS DEBUG-ITEM DEBUG-LINE syn keyword cobolReserved contained DEBUG-NAME DEBUG-SUB-1 DEBUG-SUB-2 DEBUG-SUB-3 DEBUGGING DECIMAL-POINT syn keyword cobolReserved contained DELARATIVES DELETE DELIMITED DELIMITER DEPENDING DESCENDING DESTINATION syn keyword cobolReserved contained DETAIL DISABLE DISPLAY DIVIDE DIVISION DOWN DUPLICATES DYNAMIC EGI ELSE EMI syn keyword cobolReserved contained ENABLE END-ADD END-COMPUTE END-DELETE END-DIVIDE END-EVALUATE END-IF syn keyword cobolReserved contained END-MULTIPLY END-OF-PAGE END-PERFORM END-READ END-RECEIVE END-RETURN syn keyword cobolReserved contained END-REWRITE END-SEARCH END-START END-STRING END-SUBTRACT END-UNSTRING syn keyword cobolReserved contained END-WRITE ENVIRONMENT EQUAL ERROR ESI EVALUATE EVERY EXCEPTION syn keyword cobolReserved contained EXTEND EXTERNAL FALSE FD FILE FILE-CONTROL FILLER FINAL FIRST FOOTING FOR FROM syn keyword cobolReserved contained GENERATE GIVING GLOBAL GREATER GROUP HEADING HIGH-VALUE HIGH-VALUES I-O syn keyword cobolReserved contained I-O-CONTROL IDENTIFICATION IN INDEX INDEXED INDICATE INITIAL INITIALIZE syn keyword cobolReserved contained INITIATE INPUT INPUT-OUTPUT INSPECT INSTALLATION INTO IS JUST syn keyword cobolReserved contained JUSTIFIED KEY LABEL LAST LEADING LEFT LENGTH LOCK MEMORY syn keyword cobolReserved contained MERGE MESSAGE MODE MODULES MOVE MULTIPLE MULTIPLY NATIVE NEGATIVE NEXT NO NOT syn keyword cobolReserved contained NUMBER NUMERIC NUMERIC-EDITED OBJECT-COMPUTER OCCURS OF OFF OMITTED ON OPEN syn keyword cobolReserved contained OPTIONAL OR ORDER ORGANIZATION OTHER OUTPUT OVERFLOW PACKED-DECIMAL PADDING syn keyword cobolReserved contained PAGE PAGE-COUNTER PERFORM PF PH PIC PICTURE PLUS POSITION POSITIVE syn keyword cobolReserved contained PRINTING PROCEDURE PROCEDURES PROCEDD PROGRAM PROGRAM-ID PURGE QUEUE QUOTES syn keyword cobolReserved contained RANDOM RD READ RECEIVE RECORD RECORDS REDEFINES REEL REFERENCE REFERENCES syn keyword cobolReserved contained RELATIVE RELEASE REMAINDER REMOVAL REPLACE REPLACING REPORT REPORTING syn keyword cobolReserved contained REPORTS RERUN RESERVE RESET RETURN RETURNING REVERSED REWIND REWRITE RF RH syn keyword cobolReserved contained RIGHT ROUNDED SAME SD SEARCH SECTION SECURITY SEGMENT SEGMENT-LIMITED syn keyword cobolReserved contained SELECT SEND SENTENCE SEPARATE SEQUENCE SEQUENTIAL SET SIGN SIZE SORT syn keyword cobolReserved contained SORT-MERGE SOURCE SOURCE-COMPUTER SPECIAL-NAMES STANDARD syn keyword cobolReserved contained STANDARD-1 STANDARD-2 START STATUS STRING SUB-QUEUE-1 SUB-QUEUE-2 syn keyword cobolReserved contained SUB-QUEUE-3 SUBTRACT SUM SUPPRESS SYMBOLIC SYNC SYNCHRONIZED TABLE TALLYING syn keyword cobolReserved contained TAPE TERMINAL TERMINATE TEST TEXT THAN THEN THROUGH THRU TIME TIMES TO TOP syn keyword cobolReserved contained TRAILING TRUE TYPE UNIT UNSTRING UNTIL UP UPON USAGE USE USING VALUE VALUES syn keyword cobolReserved contained VARYING WHEN WITH WORDS WORKING-STORAGE WRITE " new syn keyword cobolReserved contained AS LOCAL-STORAGE LINKAGE SCREEN ENTRY " new - btiffin syn keyword cobolReserved contained END-ACCEPT END-DISPLAY " new syn keyword cobolReserved contained environment-name environment-value argument-number syn keyword cobolReserved contained call-convention identified pointer syn keyword cobolReserved contained external-form division wait national " new -- oo stuff syn keyword cobolReserved contained repository object class method-id method object static syn keyword cobolReserved contained class-id class-control private inherits object-storage syn keyword cobolReserved contained class-object protected delegate syn keyword cobolReserved contained try catch raise end-try super property syn keyword cobolReserved contained override instance equals " new - new types syn match cobolTypes "condition-value"hs=s,he=e syn match cobolTypes "binary-char"hs=s,he=e syn match cobolTypes "binary-c-long"hs=s,he=e syn match cobolTypes "binary-long"hs=s,he=e syn match cobolTypes "binary-short"hs=s,he=e syn match cobolTypes "binary-double"hs=s,he=e syn match cobolTypes "procedure-pointer"hs=s,he=e syn match cobolTypes "object reference"hs=s,he=e syn match cobolReserved contained "\" syn match cobolReserved contained "\<\(IF\|ELSE|INVALID\|END\|EOP\)\>" syn match cobolReserved contained "\" syn keyword cobolConstant SPACE SPACES NULL ZERO ZEROES ZEROS LOW-VALUE LOW-VALUES if exists("cobol_legacy_code") syn match cobolMarker "^.\{6\}" syn match cobolBadLine "^.\{6\}[^ D\-*$/].*"hs=s+6 " If comment mark somehow gets into column past Column 7. syn match cobolBadLine "^.\{6\}\s\+\*.*" endif syn match cobolNumber "\<-\=\d*\.\=\d\+\>" contains=cobolMarker,cobolComment syn match cobolPic "\" contains=cobolMarker,cobolComment syn match cobolPic "\<$*\.\=9\+\>" contains=cobolMarker,cobolComment syn match cobolPic "\" contains=cobolMarker,cobolComment syn match cobolPic "\" contains=cobolMarker,cobolComment syn match cobolPic "\<9\+V\>" contains=cobolMarker,cobolComment syn match cobolPic "\<-\+[Z9]\+\>" contains=cobolMarker,cobolComment syn match cobolTodo "todo" contained if exists("cobol_mf_syntax") syn region cobolComment start="*>" end="$" contains=cobolTodo,cobolMarker endif syn keyword cobolGoTo GO GOTO syn keyword cobolCopy COPY " cobolBAD: things that are BAD NEWS! syn keyword cobolBAD ALTER ENTER RENAMES " cobolWatch: things that are important when trying to understand a program syn keyword cobolWatch OCCURS DEPENDING VARYING BINARY COMP REDEFINES syn keyword cobolWatch REPLACING THROW syn match cobolWatch "COMP-[123456XN]" " new - btiffin, added Intrinsics syn keyword cobolWatch ABS ACOS ANNUITY ASIN ATAN BYTE-LENGTH CHAR syn keyword cobolWatch COS CURRENT-DATE DATE-OF-INTEGER DATE-TO-YYYYMMDD syn keyword cobolWatch DAY-OF-INTEGER DAY-TO-YYYYDDD E EXCEPTION-FILE syn keyword cobolWatch EXCEPTION-LOCATION EXCEPTION-STATEMENT syn keyword cobolWatch EXCEPTION-STATUS EXP EXP10 FACTORIAL FRACTION-PART syn keyword cobolWatch INTEGER INTEGER-OF-DATE INTEGER-OF-DAY INTEGER-PART syn keyword cobolWatch LENGTH LOCALE-DATE LOCALE-TIME LOG LOG10 LOWER-CASE syn keyword cobolWatch MAX MEAN MEDIAN MIDRANGE MIN MOD NUMVAL NUMVAL-C syn keyword cobolWatch ORD ORD-MAX ORD-MIN PI PRESENT-VALUE RANDOM RANGE syn keyword cobolWatch REM REVERSE SECONDS-FROM-FORMATTED-TIME syn keyword cobolWatch SECONDS-PAST-MIDNIGHT SIGN SIN SQRT syn keyword cobolWatch STANDARD-DEVIATION STORED-CHAR-LENGTH SUM TAN syn keyword cobolWatch TEST-DATE-YYMMDD TEST-DAY-YYYYDDD TRIM UPPER-CASE syn keyword cobolWatch VARIANCE WHEN-COMPILED YEAR-TO-YYYY syn region cobolEXECs contains=cobolLine start="EXEC " end="END-EXEC" syn match cobolComment "^.\{6\}\*.*"hs=s+6 contains=cobolTodo,cobolMarker syn match cobolComment "^.\{6\}/.*"hs=s+6 contains=cobolTodo,cobolMarker syn match cobolComment "^.\{6\}C.*"hs=s+6 contains=cobolTodo,cobolMarker if exists("cobol_legacy_code") syn match cobolCompiler "^.\{6\}$.*"hs=s+6 syn match cobolDecl "^.\{6} \{1,8}\(0\=1\|77\|78\) "hs=s+7,he=e-1 contains=cobolMarker syn match cobolDecl "^.\{6} \+[1-8]\d "hs=s+7,he=e-1 contains=cobolMarker syn match cobolDecl "^.\{6} \+0\=[2-9] "hs=s+7,he=e-1 contains=cobolMarker syn match cobolDecl "^.\{6} \+66 "hs=s+7,he=e-1 contains=cobolMarker syn match cobolWatch "^.\{6} \+88 "hs=s+7,he=e-1 contains=cobolMarker else syn match cobolWhiteSpace "^*[ \t]" syn match cobolCompiler "$.*"hs=s,he=e contains=cobolWhiteSpace,cobolTypes syn match cobolDecl "0\=[1-9] *$"hs=s,he=e-1 contains=cobolWhiteSpace,cobolTypes syn match cobolDecl "66 *$"hs=s,he=e-1 contains=cobolWhiteSpace,cobolTypes syn match cobolWatch "88 *$"hs=s,he=e-1 contains=cobolWhiteSpace,cobolTypes endif syn match cobolBadID "\k\+-\($\|[^-A-Z0-9]\)" syn keyword cobolCALLs CALL CANCEL GOBACK INVOKE PERFORM END-PERFORM END-CALL RUN syn match cobolCALLs "STOP \+RUN" syn match cobolCALLs "EXIT \+PROGRAM" syn match cobolCALLs "EXIT \+PROGRAM \+RETURNING" syn match cobolCALLs "EXIT \+PERFORM" syn match cobolCALLs "EXIT \+METHOD" syn match cobolCALLs "EXIT \+SECTION" syn match cobolCALLs "STOP " contains=cobolString syn match cobolExtras /\= 508 || !exists("did_cobol_syntax_inits") if version < 508 let did_cobol_syntax_inits = 1 command -nargs=+ HiLink hi link else command -nargs=+ HiLink hi def link endif HiLink cobolBAD Error HiLink cobolBadID Error HiLink cobolBadLine Error HiLink cobolMarker Comment HiLink cobolCALLs Function HiLink cobolComment Comment HiLink cobolKeys Comment HiLink cobolCompiler PreProc HiLink cobolEXECs PreProc HiLink cobolCondFlow Special HiLink cobolCopy PreProc HiLink cobolDecl Type HiLink cobolTypes Type HiLink cobolExtras Special HiLink cobolGoTo Special HiLink cobolConstant Constant HiLink cobolNumber Constant HiLink cobolPic Constant HiLink cobolReserved Statement HiLink cobolString Constant HiLink cobolTodo Todo HiLink cobolWatch Special delcommand HiLink endif let b:current_syntax = "cobol" " vim: ts=6 nowrap [/code] Cheers, Brian P.S. Note; I've made no attempt at supporting anything other than OpenCOBOL or vims other than 7.1, so please make sure you archive your existing syntax file for a quick recovery before trying this. ---------------------------------------------------------------- Brian, Human, I think yall have provided me a better perspective than I had. While I am looking for something to meet my needs, I do not want to leave out others. First I do want to thank Brian for the instructions on Vi. It's not as bad as I thought and now I at least have Code Highlighting. Now we have several considerations. I would like as much feedback as I can get. First, we do need an IDE for those folks that want one. it is VERY convenient to do everything from one program. So I am going to list some ideas for requirements. 1. New OC users should be able to get the ground running, even if they have no Cobol or programming experience. 2. Syntax Highlighting. 3. Code Folding. 4. Code Completion. 4a. Variable/Procedure/Paragraph completion. (recognizes existing constructs and presents them to the user). 5. Code Hinting. 6. Linking to OC documentation. 7. Code Snippets/Samples. 8. Compile, Link, Make?, Run right from in the IDE. (Currently I do everything as cobc -x so I'm not really sure how the whole MAKE thing really works in OC, or GNU/Linux at all.) 9. Project Management. (Directories, named, so all files pertinent to a project can be accessed) 10. Run Debugger from the IDE? For me the most important of these is Syntax Highlighting. Now that I've got Vim going, I have that so I'm happy. Other users are going to want more. I have no issue working with Eclipse or another IDE, or if we created our own (much longer time frame.) Geany looks good, but it seems you cannot just add files? to do code highlighting. It seemed a bit more complex that it should have, but I might be missing something. Above all the most important in any of these is that the IDE or Editor should be SIMPLE to use. Nothing complicated to set up. We want to drive OC towards that as well. This is much easier in a .deb environment. One of us can simply make packages. But not all distros are going to be as easy. Also, I think that we should unify and settle on a common IDE. Whichever one we choose, we need it to kind of be the official OC IDE. While at the same time, offering files for other IDEs. So let's say Eclipse became our IDE of choice, that's fine. Then we can still have persons work on code highlighters for other IDEs and editors out there. The advantage to this two pronged approach is that we allow advanced developers to slide right into OC without having to learn a new environment. While those that do not have a specific IDE, or experience with one, and new programmers, will likewise be able to slide into using OC with a very simple IDE. This will help uptake at both ends of the spectrum for OC. ---------------------------------------------------------------- I should add that a useful feature would be to print the code in color based on the syntax highlighting. Can Vim do that Brian? ---------------------------------------------------------------- I'm going to take a look at PIDA. (The PIDA Loves You motto kinda took me aback a little, but that feeling will dissolve, I'm sure). I like Python utility kits, and PyGTK is something I wanted to study before attempting the GTK+ wrappers. Again, I'll help out if possible with building up an IDE but I'm unlikely to use an IDE to do it. GNU/Linux is THEE IDE. :) For Eclipse, I'd start at http://www.eclipse.org/cobol/ and see how that project fares. It would mean Java development, and there might be some politics (but I doubt it). From the CLI front, I think it might be best to simply document up some "best tools" from the Cygwin/GNU/Linux side. The FAQ already mentions Exuberant ctags and vi / emacs handle these beautifully. I haven't found a suitable cxref utility yet, and need to check out ROBODoc's COBOL support vi handles Folding, but I rarely use the feature. We could build some vi macros (abbreviations) to emulate code completion, but that could be a headache finding the abbreviations and isn't quite as intuitive as hitting tab. We need to educate someone up to a level regarding configure and make, so we can build up some COBOL project Makefile templates too I think. I'll try and add some notes to the FAQ, and then publish the snippets here. Cheers, Brian ---------------------------------------------------------------- Re printing; Yep, the :hardcopy command. Or with gvim, the File/Print menu. Windows users get a print dialog, otherwise a postscript is generated and the 'printexpr' is used, usually lpr. Cheers, Brian Sorry about this thread's width by the way. I didn't want to breakup that one long line in the syntax file. ---------------------------------------------------------------- Long length is ok...no issues. I also think that maybe we could write our own IDE in OC. Just a thought. It would just be a wrapper for something like Vi. ---------------------------------------------------------------- Sounds nice, I'm really interested how cvs/svn-integration would be done :-) I'll have a look at this vi-scheme, is it possible to install and use it without root rights and with vim64? How can I add more file types like cpy and others? There are no folding or source completion in it, are they (if yes: how to use them)? ---------------------------------------------------------------- Using this scheme as no root with all files you like (you need to save cobol.vim somewhere before, old cobol.vim stays where it was): mkdir ~/.vim mkdir ~/.vim/syntax cp cobol.vim ~/.vim/syntax vi some.cpy "+set syn=cobol" How can I add file types permanent, what about folding and source completion? ---------------------------------------------------------------- Folding; This will require a little detail digging. The syntax file I'm using is returning "E488 Trailing Characters" when I experiment with folding. This happens with the syntax file that ships with vim7.1 as well. Inside vi, [b]:help folding[/b] has the docs. :fold-manual works along with the plethora of z sub-commands, but :fold-syntax, :fold-indent etc, is triggering the E488. Code completion; Again, more digging. abbreviations are one way [b]:help abbreviations[/b] and [b]:help completions[/b] is another. But for omni-completion, we'll probably need to invent a function. Deets on ^X^O is in the help. Sorry about lack of details, but I've never taken a serious kick at using these features. It seems we may be the team that updates the COBOL support for vim in this area, but I'm sure if we pester the vim.org people they will want to help. And before we go too too far. vi is productivity editor for sure, but it's quirky. Maybe we should check out emacs' cobol.el and see if it may be a more appropriate choice? emacs is far closer to the full screen editors that many Windows people would be used to, having no command mode, insert mode split personality. The lisp macros really do make for a fun time with editor scripting and emacs is nearly as ubiquitous as vim. (I made my preference choice back in the Coherent days, but perhaps we should offer up options to anyone not yet stuck in their ways.) Cheers, Brian ---------------------------------------------------------------- Colour scheme is nice. There is one thing that doesn't work for me: colouring the whole line as "bad line" if there is the * in column 6 or 8. Maybe it's better to have different colours for intrinsics, libcob calls, ... I can contribute 3 lists I've made some time ago, maybe you can check if these are in your cobol.vim already (By the way: 3 colours would be nice: some for 85, a small different colour for 85to2002 and a different one for ACU-things). Maybe other people can contribute reserved words of MF or others. 85:[code]- * ** / + < <= = > >= ACCEPT ACCESS ADD ADVANCING AFTER ALL ALPHABET ALPHABETIC ALPHABETIC-LOWER ALPHABETIC-UPPER ALPHANUMERIC ALPHANUMERIC-EDITED ALSO ALTER ALTERNATE AND ANY ARE AREA AREAS ASCENDING ASSIGN AT AUTHOR BEFORE BINARY BLANK BLOCK BOTTOM BY CALL CANCEL CD CF CH CHARACTER CHARACTERS CLASS CLOCK-UNITS CLOSE COBOL CODE CODE-SET COLLATING COLUMN COMMA COMMON COMMUNICATION COMP COMPUTATIONAL COMPUTE CONFIGURATION CONTAINS CONTENT CONTINUE CONTROL CONTROLS CONVERTING COPY CORR CORRESPONDING COUNT CURRENCY DATA DATE DATE-COMPILED DATE-WRITTEN DAY DAY-OF-WEEK DE DEBUG-CONTENTS DEBUGGING DEBUG-ITEM DEBUG-LINE DEBUG-NAME DEBUG-SUB-1 DEBUG-SUB-2 DEBUG-SUB-3 DECIMAL-POINT DECLARATIVES DELETE DELIMITED DELIMITER DEPENDING DESCENDING DESTINATION DETAIL DISABLE DISPLAY DIVIDE DIVISION DOWN DUPLICATES DYNAMIC EGI ELSE EMI ENABLE END END-ADD END-CALL END-COMPUTE END-DELETE END-DIVIDE END-EVALUATE END-IF END-MULTIPLY END-OF-PAGE END-PERFORM END-READ END-RECEIVE END-RETURN END-REWRITE END-SEARCH END-START END-STRING END-SUBTRACT END-UNSTRING END-WRITE ENTER ENVIRONMENT EOP EQUAL ERROR ESI EVALUATE EVERY EXCEPTION EXIT EXTEND EXTERNAL FALSE FD FILE FILE-CONTROL FILLER FINAL FIRST FOOTING FOR FROM GENERATE GIVING GLOBAL GO GREATER GROUP HEADING HIGH-VALUE HIGH-VALUES IDENTIFICATION IF IN INDEX INDEXED INDICATE INITIAL INITIALIZE INITIATE INPUT INPUT-OUTPUT INSPECT INSTALLATION INTO INVALID I-O I-O-CONTROL IS JUST JUSTIFIED KEY LABEL LAST LEADING LEFT LENGTH LESS LIMIT LIMITS LINAGE LINAGE-COUNTER LINE LINE-COUNTER LINES LINKAGE LOCK LOW-VALUE LOW-VALUES MEMORY MERGE MESSAGE MODE MODULES MOVE MULTIPLE MULTIPLY NATIVE NEGATIVE NEXT NO NOT NUMBER NUMERIC NUMERIC-EDITED OBJECT-COMPUTER OCCURS OF OFF OMITTED ON OPEN OPTIONAL OR ORDER ORGANIZATION OTHER OUTPUT OVERFLOW PACKED-DECIMAL PADDING PAGE PAGE-COUNTER PERFORM PF PH PIC PICTURE PLUS POINTER POSITION POSITIVE PRINTING PROCEDURE PROCEDURES PROCEED PROGRAM PROGRAM-ID PURGE QUEUE QUOTE QUOTES RANDOM RD READ RECEIVE RECORD RECORDS REDEFINES REEL REFERENCE REFERENCES RELATIVE RELEASE REMAINDER REMOVAL RENAMES REPLACE REPLACING REPORT REPORTING REPORTS RERUN RESERVE RESET RETURN REVERSED REWIND REWRITE RF RH RIGHT ROUNDED RUN SAME SD SEARCH SECTION SECURITY SEGMENT SEGMENT-LIMIT SELECT SEND SENTENCE SEPARATE SEQUENCE SEQUENTIAL SET SIGN SIZE SORT SORT-MERGE SOURCE SOURCE-COMPUTER SPACE SPACES SPECIAL-NAMES STANDARD STANDARD-1 STANDARD-2 START STATUS STOP STRING SUB-QUEUE-1 SUB-QUEUE-2 SUB-QUEUE-3 SUBTRACT SUM SUPPRESS SYMBOLIC SYNC SYNCHRONIZED TABLE TALLYING TAPE TERMINAL TERMINATE TEST TEXT THAN THEN THROUGH THRU TIME TIMES TO TOP TRAILING TRUE TYPE UNIT UNSTRING UNTIL UP UPON USAGE USE USING VALUE VALUES VARYING WHEN WITH WORDS WORKING-STORAGE WRITE ZERO ZEROES ZEROS[/code] 85to2002:[code]& *> :: >> ACTIVE-CLASS ADDRESS ALIGNED ALLOCATE ANYCASE AS B-AND BASED BINARY-CHAR BINARY-DOUBLE BINARY-LONG BINARY-SHORT BIT B-NOT BOOLEAN B-OR B-XOR CLASS-ID COL COLS COLUMNS COMP-1 COMP-2 COMP-3 COMP-4 COMP-X CONDITION CONSTANT CRT CURSOR DATA-POINTER DEFAULT EC END-ACCEPT END-DISPLAY EO EXCEPTION-OBJECT FACTORY FLOAT-EXTENDED FLOAT-LONG FLOAT-SHORT FORMAT FREE FUNCTION FUNCTION-ID GET GOBACK GROUP-USAGE INHERITS INTERFACE INTERFACE-ID INVOKE LOCALE LOCAL-STORAGE METHOD METHOD-ID MINUS NATIONAL NATIONAL-EDITED NESTED NULL OBJECT OBJECT-REFERENCE OPTIONS OVERRIDE PRESENT PROGRAM-POINTER PROPERTY PROTOTYPE RAISE RAISING REPOSITORY RESUME RETRY RETURNING SCREEN SELF SHARING SOURCES SUPER SYSTEM-DEFAULT TYPEDEF UNIVERSAL UNLOCK USER-DEFAULT VALID VALIDATE VALIDATE-STATUS VAL-STATUS[/code] acu:[code]ACTION ACTION-COPY ACTION-CUT ACTION-DELETE ACTION-PASTE ACTION-UNDO ALIGNMENT ADDRESS APPLY ASSEMBLY-NAME ATTRIBUTE AUTO AUTO-DECIMAL AUTO-MINIMIZE AUTO-RESIZE AUTO-SKIP AUTOMATIC AUTOTERMINATE AX-EVENT-LIST BACKGROUND-COLOR BACKGROUND-COLOUR BACKGROUND-HIGH BACKGROUND-LOW BACKGROUND-STANDARD BACKWARD BEEP BELL BIND BINARY BITMAP BITMAP-HANDLE BITMAP-NUMBER BLINK BLINKING BOLD BOX BOXED BULK-ADDITION CCOL CELL CELLS CENTERED CENTURY-DATE CENTURY-DAY CHECK-BOX CHAIN CHAINING CHART CLASS-NAME CLINE CLINES COL COLOR COLOUR COMMAND-LINE COMMIT COMP-1 COMP-2 COMP-3 COMP-4 COMP-5 COMP-6 COMP-N COMP-X COMPRESSION COMPUTATIONAL-1 COMPUTATIONAL-2 COMPUTATIONAL-3 COMPUTATIONAL-4 COMPUTATIONAL-5 COMPUTATIONAL-6 COMPUTATIONAL-N COMPUTATIONAL-X CONSOLE CONSTRUCTOR CONTROLS CONTROLS-UNCROPPED CONVERSION CONVERT CREATE CRT CSIZE CULTURE CURSOR CURSOR-COL CURSOR-ROW CYCLE DATA-COLUMNS DATE YYYYMMDD DAY YYYYDDD DEFAULT DESCRIPTOR DESTROY DISPLAY-COLUMNS DIVIDERS DOUBLE DOWN DRAW ECHO EMPTY-CHECK ENABLED ENCRYPTION END-ACCEPT END-CHAIN END-DISPLAY END-MODIFY END-MOVE END-USE END-WAIT ENDING ENGRAVED ENTRY ENTRY-FIELD EOL EOS ERASE ESCAPE EVENT EVENT-LIST EXCEPTION-VALUE EXCLUDE-EVENT-LIST EXCLUSIVE EXTENDED-SEARCH EXTERNAL-FORM FILE-ID FILE-LIMIT FILE-LIMITS FILE-PATH FILE-PREFIX FLAT FLOAT FLOATING FONT FOREGROUND-COLOR FOREGROUND-COLOUR FRAME FRAMED FREE FULL FULL-HEIGHT GOBACK GRAPHICAL GROUP-VALUE GRID HANDLE HEAVY HEIGHT HELP-ID HIGH HIGHLIGHT ICON ID IDENTIFIED INDEPENDENT INQUIRE INSERTION-INDEX ITEM-TO-ADD ITEM-TO-DELETE ITEM-VALUE KEPT LAYOUT-DATA LAYOUT-MANAGER LEFT-TEXT LEFTLINE LENGTH-CHECK LINK LIST-BOX LOCK-HOLDING LOW LOWERED LOWLIGHT MANUAL MASS-UPDATE MAX-LINES MAX-SIZE MAX-TEXT MAX-VAL MENU MESSAGE MESSAGES MIN-LINES MIN-SIZE MIN-VAL MODAL MODELESS MODIFY MODULE MULTILINE NAMESPACE NO-AUTOSEL NO-CLOSE NO-ECHO NO-GROUP-TAB NO-KEY-LETTER NOTIFY NOTIFY-DBLCLICK NOTIFY-SELCHANGE NULL NULLS NUMERIC-FILL OBJECT ONLY OTHERS OVERLAPPED OVERLINE PAGED PARAGRAPH PIXEL PIXELS POP-UP POS PREVIOUS PRINT-CONTROL PRIORITY PROMPT PROPERTY PROTECTED PUSH-BUTTON QUERY-INDEX RADIO-BUTTON RAISED READERS RECORD-POSITION RECORDING REMARKS REQUIRED RESET-LIST RESIDENT RESIZABLE REVERSE REVERSE-VIDEO RIMMED SCREEN SCROLL SEARCH-TEXT SECURE SEEK SELECTION-INDEX SELECTION-TEXT SELF-ACT SEPARATION SHADOW SIGNED-INT SIGNED-LONG SIGNED-SHORT SORT-ORDER SQUARE STRONG-NAME STYLE STYLES SUBWINDOW SYSERR SYSTEM SYSTEM-INFO TAB TABLE TALLY TERMINAL-INFO TERMINATION-VALUE THREAD THREADS TITLE TITLE-BAR TOOL-BAR TRANSACTION TRANSACTION-STATUS TRANSPARENT TYPE UNDERLINE UNDERLINED UNFRAMED UNLOCK UNSIGNED-INT UNSIGNED-LONG UNSIGNED-SHORT UNSORTED UPDATE USER-COLORS USE-RETURN USER-GRAY USER-WHITE UPDATERS UPPER VERSION VERY-HEAVY VISIBLE VSCROLL-BAR VTOP WAIT WIDE WIDTH WINDOW WRAP WRITERS ZERO-FILL[/code] Is this contribution useful? PS: I'm no vi freak, but start to like it. Having nice schemes and stuff for many well editors could not be bad anyway (never tried emacs). ---------------------------------------------------------------- Well I went ahead and installed Pida. From the rip it gives you VIM or EMACS capability. I imagine you can plug in other editors as well. I think emacs might be easier for new users, since there is only one mode, as far as the user understands. But I will play around and let you know. One issue, I cannot see how to change the font size in the editor. I'll see if I figure that out. If not I will email them. I do have to say Pida has REALLY grown up from when I used it. They've put a lot of work into it. This kind of thing would be nice to do with OC on our own. But that's a lot of work and something for a project in a couple years. ---------------------------------------------------------------- Human, can you post that to a new post as well, just entitled RESERVED WORDS? I will need that as a resource. Later on I will want us to make posts on how to use each reserved word. Brian, that would be our manual per our phone conversation. Human THANKS for posting that, it's great. I agree that having different colors might be nice for the different versions of the spect. ---------------------------------------------------------------- Why put up a new topic with some words? IF we someday have a list/examples how to use the reserved words, there maybe could some help in the IDE/editor we used, taking just the part that is needed. For information to the lists I gave: 85: out from standard 85to2002: out from standard and diffed against 85 (only newer words) acu: an old list from acu found somewhere, together with acu words I've seen in acu code (so this part is not complete, maybe around 75% - just guessing). ---------------------------------------------------------------- Having the list of words available and more importantly easy to find is what I was thinking. If there is someplace that you gathered the list from that resource would also be great. Getting just the reserved word list has been a bear because the spec is not terribly easy to use. But since we're getting dumps now of the forum topics, I could run through the dump for RESERVED WORDS and find posts relevant to that topic. I also think having that list, would encourage us to provide examples in other topics. MOVE EVALUATE etc. ---------------------------------------------------------------- Reserved words; Thanks human. One thing I'd like to do is separate the syntax highlighting of implemented from the pending reserved words and automate the generation. Joseph; I think all you need is [i]--list-reserved[/i] When/if I work on the cobol.vim today, I'll start with [code] $ cobc --list-reserved [/code] then squirrel through cobc/reserved.c and pull out the reserved words marked with -1 (Not Yet Implemented). I did a rough count for a FAQ entry, but some shell and awk scripting could very well be in the cards for tonight. And you will have to excuse me a little bit. I plan on building up my expertise in COBOL with OpenCOBOL and all the ACU and MF and ... issues are going to be secondary or tertiary to any efforts I put in. :) Cheers, Brian P.S. Tracking down this vim E488 on the folding is going to be a pain. One of the ex commands is getting an argument it doesn't like and I'm a little clueless when it comes to vim -D and :debug. ---------------------------------------------------------------- Brian, Gotcha bout the reserved word list. I am with you on the COBOL skills itself with a focus on the standard. THough having MF and ACCU reserved words also has its uses, to increase uptake. I am purchasing the vim pocket guide. I also have Safari http://safari.oreilly.com/ This has thousands of books online. If you can stand to read a book online, it is a great resource. If anyone else has this, I'd suggest we start contacting them and let them know that we want COBOL books. Two VIM books there: VIM pocket guide: http://safari.oreilly.com/1565924975 Learning the vi and Vim Editors, 7th Edition http://safari.oreilly.com/9780596529833 Sams Teach Yourself COBOL in 24 hours is there also. http://safari.oreilly.com/9780768685510 So my VIM skills should pick up. I will also be in freenode on #pida from now on. I'll keep you posted what I learn. Changing font size in Pida: :set guifont=Monospace\ 18 ---------------------------------------------------------------- Re vim code folding and completion. Folding works; the E488 ex error was due to my blatant misunderstanding of the commands. [i]:help folding[/i] for full details, but it mostly through z vi commands, and a few set options. Completion works in insert mode with ^P. [i]:help completion[/i] for details, but I found creating a text file with [code] $ cobc --list-reserved >~/.vim/reserved.lis [/code] and using [code] :set ignorecase :set infercase :set complete=k~/.vim/reserved.lis [/code] then Ctrl-P in insert mode works with a nice pulldown in vim, after just a few characters. [i]Where ~/.vim/ is whatever directory you like to stash things in.[/i] More on folding; [code] :set foldmethod=manual[/code] will allow use of the visual marking of source and then the zc command keys will close the fold. zo to open. Seems very session dependant and unless stashed, the manual folds go poof on exit. [code] :set fdm=marker[/code] will allow marker set folds, but that means gunking up the source. So, that leads to [code] :set fdm=indent[/code] Works well, from my limited experience, it is what I've started using in my ~/.vimrc file. [code] :set fdm=syntax[/code] Doesn't work, as there are no [i]fold[/i] attributes in the cobol.vim syntax file. That could change, given a little effort on our part. I haven't looked into fold-diff or fold-expr. All told, I think the console OpenCOBOL "IDE", could be setup (documented, more like) as a great productivity enhancing tool box. [i]The output from exuberant ctags -x, seems like a tantalizing data format for someone wanting to write an OpenCOBOL cross reference tool.[/i] Cheers, Brian Edit; corrected the :set complete= instructions. ---------------------------------------------------------------- If we have a VIM based console IDE, then everything you've done and we do in the future in VIM will apply to PIDA as well. I am still waiting for my books to come in. SHould be some time next week. Got to finish that project this weekend, all unit tests are done so it should be a breeze. Then I am ready to dedicate full time to this. ---------------------------------------------------------------- More fun with Vim. I spent a lot of years working on Decterminals and OpenVMS. TPU EVE was by far my favourite editor. I've been searching high and wide for "unbound cursor", where motion of cursor is not limited to end of line. It can go anywhere on the screen. Little did I know the keyword for vim is virtualedit. [code] :set virtualedit=all [/code] Happy man. Cheers, Brian So, to help anyone else in their google, I'm adding a few keywords to this post. eve tpu vms set cursor free set cursor bound unbound vim virtualedit ---------------------------------------------------------------- virtualedit=all is exactly the kind of thing I needed for my block edits. Perfect and I love it. Thanks man. I just need to find out how to do it in .vimrc. Will be googling more soon. ---------------------------------------------------------------- In ~/.vimrc [code] set virtualedit=all [/code] There are options; all, block, insert or onemore. Side note: I've been sidetracked in vim space over the last few days. My history is vi, but I never spent much time looking into the Vim related materials. Lots and lots of material. Now, if I can just use the timesaving features to make up for time spent, it'll have been worthwhile. :-) Cheers, Brian ---------------------------------------------------------------- Most definitely. Our tools are uber important man. ---------------------------------------------------------------- Does vim have many levels of undo? auto save? multi copy autosave? ---------------------------------------------------------------- Undo Levels; Set by undolevels, mine defaults to 1000. Funky, u command undo, Ctrl-R or :redo to redo. It smartly branches when you make changes being undo's. Query with [code] :set undolevels? :help undo [/code] Auto save; Marked as TODO in 7.1 autowrite will write between file changes. There is updatetime and updatecount controls as well, but it effects the recovery swapfile, not the actual file on disk. vim is pretty good at recovery. [code] :help autowrite [/code] versioning auto-save; I don't know, but it could be vim scripted quite easily and there may already be one in the www.vim.org repository until it gets into vim. vim has a fair sized suite of autocommands. Cheers, Brian ---------------------------------------------------------------- The Vim edit/compile/error cycle When you are into a fair sized dev cycle, say the code is being freshly ported and the compile errors could be higher than normal, try the vim [i]quickfix[/i] features. [code] $ cobc errors.cob 2>errorfile.lis $ cat errorfile.lis errors.cob:38: Error: 'makeanerror' undefined errors.cob:39: Error: 'data-file' undefined errors.cob:39: Error: 'data-file' is not a file name $ vi -q errorfile.lis [/code] Will tell vim to start up the editor in quickfix mode, reading errorfile.lis and seeing errors.cob line 38. Opens up errors.cob at that line. [b]:cnext[/b] will go to the next error message from the error message file. Nice of Keisuke and Roger to follow the positive trends. :) [b]:help quickfix[/b] for all the deets. This is all linked with the builtin [b]:make[/b] vim ex command for when you really really want to stay in the edit/compile/fix cycle. Cheers, Brian ---------------------------------------------------------------- The daily Vim. :-) Another feature to know about when using Vim. If autoindent is turned on, pasting text (code) can be a little grief stricken. gVim handles paste properly, but console Vim gets confused as it cannot differentiate pasted text from user entered. So ... [code] :set paste [/code] do the paste (highly dependant on console or using the vim keys "+gP) and then [code] :set nopaste [/code] As it goes, this is not a mode to place in your ~/.vimrc. The paste setting turns off too many other handy features. Cheers, Brian P.S. :h 42 ---------------------------------------------------------------- KDE gui, KATE and KWrite Syntax highlighter Here is a first cut (pre-pre-alpha) of a COBOL syntax highlighter for KATE. Based on work by Frachin Matteo and fortran.xml. So it has lots missing, many fortran specific features still in the file etc. I'll be updating this as I figure out edge-cases, end of region sequences, play with the colouring and word groupings etc... If you'd like to be a guinea pig alpha tester; place this in /usr/share/apps/katepart/syntax/cobol.xml [b]Warning; if you have a cobol.xml already, archive it. This file will be bug ridden.[/b] With a file loaded, use KATE menu Tools/Highlighting/Sources/COBOL [b]Note: To avoid an overly wide post, I split the language dtd element between extensions and mimetype with an extraneous carriage return.[/b] Cheers, Brian [code] access active-class add address advancing after aligned all allocate alphabet alphabetic alphabetic-lower alphabetic-upper alphanumeric alphanumeric-edited also alter alternate and any anycase are area areas argument-number argument-value arithmetic as ascending assign at attribute auto auto-skip automatic autoterminate b-and b-not b-or b-xor background-color based beep before bell binary binary-c-long binary-char binary-double binary-long binary-short bit blank blink block boolean bottom by byte-length call cancel cd center cf ch chain chaining character characters class class-id classification close code code-set col collating cols column columns comma command-line commit common communication comp comp-1 comp-2 comp-3 comp-4 comp-5 comp-x computational computational-1 computational-2 computational-3 computational-4 computational-5 computational-x compute condition configuration constant contains content continue control controls converting copy corr corresponding count crt currency cursor cycle data data-pointer date day day-of-week de debugging decimal-point declaratives default delete delimited delimiter depending descending destination detail disable disk divide division down duplicates dynamic ebcdic ec egi else emi enable end end-add end-call end-compute end-delete end-divide end-evaluate end-if end-multiply end-of-page end-perform end-read end-receive end-return end-rewrite end-search end-start end-string end-subtract end-unstring end-write entry entry-convention environment environment-name environment-value eo eol eop eos equal equals erase error escape esi evaluate exception exception-object exclusive exit expands extend external factory false fd file file-control file-id filler final first float-extended float-long float-short footing for foreground-color forever format free from full function function-id generate get giving global go goback greater group group-usage heading high-value high-values highlight i-o i-o-control id identification if ignoring implements in index indexed indicate inherits initial initialize initialized initiate input input-output inspect interface interface-id into intrinsic invalid invoke is just justified key label last lc_all lc_collate lc_ctype lc_messages lc_monetary lc_numeric lc_time leading left length less limit limits linage linage-counter line line-counter lines linkage local-storage locale lock low-value low-values lowlight manual memory merge message method method-id minus mode move multiple multiply national national-edited native negative nested next no none normal not null nulls number numbers numeric numeric-edited object object-computer object-reference occurs of off omitted on only open optional options or order organization other output overflow overline override packed-decimal padding page page-counter paragraph perform pf ph pic picture plus pointer position positive present previous printer printing procedure procedure-pointer procedures proceed program program-id program-pointer prompt property prototype purge queue quote quotes raise raising random rd read receive record recording records recursive redefines reel reference relation relative release remainder removal renames replace replacing report reporting reports repository required reserve reset resume retry return returning reverse-video rewind rewrite rf rh right rollback rounded run same screen sd search seconds section secure segment select self send sentence separate sequence sequential set sharing sign signed signed-int signed-long signed-short size sort sort-merge source source-computer sources space spaces special-names standard standard-1 standard-2 start statement status step stop string strong sub-queue-1 sub-queue-2 sub-queue-3 subtract sum super suppress symbol symbolic sync synchronized system-default table tallying tape terminal terminate test text than then through thru time times to top trailing true type typedef ucs-4 underline unit universal unlock unsigned unsigned-int unsigned-long unsigned-short unstring until up update upon usage use user-default using utf-16 utf-8 val-status valid validate validate-status value values varying when with working-storage write yyyyddd yyyymmdd zero zeroes zeros accept close display end-accept end-display open read rewind rewrite write unit end err fmt iostat status advance size eor unit iostat err file status access form recl blank position action delim pad unit iostat err file exist opened number named name access sequential direct form formatted unformatted recl nextrec blank position action read write readwrite delim pad based binary binary-c-long binary-char binary-double binary-long binary-short comp comp-1 comp-2 comp-3 comp-4 comp-5 comp-x computational computational-1 computational-2 computational-3 computational-4 computational-5 computational-x index packed-decimal pointer program-pointer signed-short signed-int signed-long unsigned-short unsigned-int unsigned-long abs cabs dabs iabs aimag aint dint anint dnint ceiling cmplx dcmplx dimag floor nint idnint int idint ifix real float sngl dble dreal aprime dconjg dfloat ddmim rand modulo conjg dprod dim ddim idim max amax0 amax1 max0 max1 dmax1 min amin0 amin1 min0 min1 dmin1 mod amod dmod sign dsign isign acos dacos asin dasin atan datan atan2 datan2 cos ccos dcos cosh dcosh exp cexp dexp log alog dlog clog log10 alog10 dlog10 sin csin dsin sinh dsinh sqrt csqrt dsqrt tan dtan tanh dtanh achar char iachar ichar lge lgt lle llt adjustl adjustr index len_trim scan verify logical exponent fraction nearest rrspacing scale set_exponent spacing btest iand ibclr ibits ibset ieor ior ishft ishftc not mvbits merge associated present kind len digits epsilon huge maxexponent minexponent precision radix range tiny bit_size allocated lbound ubound shape size repeat trim selected_int_kind selected_real_kind transfer dot_product matmul all any count maxval minval product sum pack unpack reshape spread cshift eoshift transpose maxloc minloc date_and_time system_clock random_number random_seed [/code] ---------------------------------------------------------------- Hi Works well in vim 7.0 as well. Just one little change for fixed format, I think you meant if ! exists("cobol_legacy_code") " catch junk in columns 1-6 for modern code syn match cobolBAD "^ \{0,5\}[^ ].*" endif rather than if exists("cobol_legacy_code") " catch junk in columns 1-6 for modern code syn match cobolBAD "^ \{0,5\}[^ ].*" endif Cheers Greg ---------------------------------------------------------------- That is inherited. I still study this file. Mainly clueless. But I do like the comments ... catch junk ... the original author may not have known about sequence numbers. :) Hopefully this file will evolve as more people bump into it and I would like to add z command fold regions. Cheers, Brian ---------------------------------------------------------------- I use the multi platform spf editor clone, The Hybrid Editor XE. It's awesome and supports syntax hilighting. Google "The Hybrid Editor XE". ---------------------------------------------------------------- Here is the [url=http://cobolforgcc.cvs.sourceforge.net/viewvc/*checkout*/cobolforgcc/gcc/cobol/cobol.el?revision=1.4&pathrev=HEAD]emacs-file from Cobol for GCC[/url], maybe there is somebody who wants to have a look at it:[code];;; Cobol mode for GNU Emcas (version 2.00, Mar 01, 2000) ;;; There does not seem to be a maintainer for this mode, and none ;;; of the email addresses for it are good. So, I've made it ;;; what I think it should be. This includes adding ;;; color syntax highlighting (basically the only major change). ;;; ;;; Matthew Vanecek ;;; Please feel free to send suggestions or improvements. ;;; ;;; The changelog is down at the bottom. ;;; ;;; Cobol mode for GNU Emacs (version 1.01, Jun 21, 1988) ;;; Copyright (c) 1987 Free Software Foundation, Inc. ;;; Written by Robert A Sutterfield (bob@cis.ohio-state.edu) and ;;; Paul W. Placeway (paul@tut.cis.ohio-state.edu), as changes to fortran.el ;;; Bugs to bug-cobol-mode@cis.ohio-state.edu ;;; [0) the left column is column 1] ;;; + 1) newline should indent to the same column as the start of ;;; the previous line ;;; + 2) tabs at 8 and every four thereafter (12, 16, 20, etc.) ;;; + 3) tabs should be expanded to spaces on input ;;; + (3a) no tabs should appear in the buffer ;;; no 4) right margin bell at 72 (hard to do) ;;; + 5) (optional) flash matching parentheses ;;; + 6) no auto-fill (WHY -- PWP) (not by default) ;;; * 7) auto startup on .cob files ;;; To do this, the expression ("\\.cob$" . cobol-mode) must be ;;; added to loaddefs.el in the gnu-emacs lisp directory, and ;;; loaddefs must be re-byte-code-compiled. ;;; Also, an autoload must be set up for cobol-mode in loaddefs.el; ;;; see the loaddefs.el file in this directory. ;;; + 8) auto indent to that of the last line (more magic than that...) ;;; + 9) delete on a blank line should go back to LAST tab stop ;;; + 10) C-c C-c moves cursor to ARG (or prompted) column, adding ;;; spaces to get there if needed ;;; 11) C-c C-l does (goto-line) ;;; ;;; COBOL mode adapted from: ;;;: Fortran mode for GNU Emacs (beta test version 1.21, Oct. 1, 1985) ;;;; Copyright (c) 1986 Free Software Foundation, Inc. ;;;; Written by Michael D. Prange (mit-eddie!mit-erl!prange). ;;;; Author acknowledges help from Stephen Gildea ;; This file is not part of the GNU Emacs distribution (yet). ;; This file is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY. No author or distributor ;; accepts responsibility to anyone for the consequences of using it ;; or for whether it serves any particular purpose or works at all, ;; unless he says so in writing. Refer to the GNU Emacs General Public ;; License for full details. ;; Everyone is granted permission to copy, modify and redistribute ;; this file, but only under the conditions described in the ;; GNU Emacs General Public License. A copy of this license is ;; supposed to have been given to you along with GNU Emacs so you ;; can know your rights and responsibilities. It should be in a ;; file named COPYING. Among other things, the copyright notice ;; and this notice must be preserved on all copies. ;; Bugs to bug-cobol-mode@cis.ohio-state.edu. (defvar cobol-do-indent 4 "*Extra indentation applied to `do' blocks.") (defvar cobol-if-indent 4 "*Extra indentation applied to `if' blocks.") (defvar cobol-continuation-indent 6 "*Extra indentation applied to `continuation' lines.") (defvar cobol-pic-column 50 "*The column that PIC clauses should be aligned to.") (defvar cobol-indent-increment 4 "*Amount of indentation to add to a line when it can be indented.") (defvar cobol-comment-indent-style 'fixed "*nil forces comment lines not to be touched, 'fixed produces fixed comment indentation to comment-column, and 'relative indents to current cobol indentation plus comment-column.") (defvar cobol-comment-line-column 6 "*Indentation for text in comment lines.") (defvar comment-line-start "**" "*Delimiter inserted to start new full-line comment.") (defvar comment-line-start-skip "^......\\*" "*Regexp to match the start of a full-line comment.") (defvar cobol-minimum-statement-indent 7 ;;; this puts it in column 8 "*Minimum indentation for cobol statements.") (defvar cobol-minimum-area-b-indent 11 ;;; this puts it in column 12 "*Minimum indentation for cobol statements that should be in Area B.") ;; Note that this is documented in the v18 manuals as being a string ;; of length one rather than a single character. ;; The code in this file accepts either format for compatibility. (defvar cobol-comment-indent-char " " "*Character to be inserted for Cobol comment indentation. Normally a space.") (defvar cobol-line-number-indent 1 "*Maximum indentation for Cobol line numbers. 6 means right-justify them within their six-column field.") (defvar cobol-check-all-num-for-matching-do nil "*Non-nil causes all numbered lines to be treated as possible do-loop ends.") (defvar cobol-continuation-char ?- "*Character which is inserted in column 7 by \\[cobol-split-line] to begin a continuation line. Normally ?-") (defvar cobol-comment-region " ** " "*String inserted by \\[cobol-comment-region] at start of each line in region.") (defvar cobol-electric-line-number t "*Non-nil causes line number digits to be moved to the correct column as typed.") (defvar cobol-startup-message t "*Non-nil displays a startup message when cobol-mode is first called.") (defvar cobol-column-ruler (concat "0 00 1 2 3 4 5 6 7 2\n" "1.../67..0..../....0..../....0..../....0..../....0..../....0..../....0..\n") "*String displayed above current line by \\[cobol-column-ruler].") (defconst cobol-mode-version "2.00") (defvar cobol-mode-syntax-table nil "Syntax table in use in cobol-mode buffers.") (if cobol-mode-syntax-table () (setq cobol-mode-syntax-table (make-syntax-table)) (modify-syntax-entry ?\; "w" cobol-mode-syntax-table) (modify-syntax-entry ?+ "." cobol-mode-syntax-table) ; (modify-syntax-entry ?- "." cobol-mode-syntax-table) ; Turn a dash into a word character (modify-syntax-entry ?- "w" cobol-mode-syntax-table) ; (modify-syntax-entry ?* "." cobol-mode-syntax-table) ; We need a "*" to mark the beginning of a comment ; Apostrophe's use in comments are treated as open quotes without this (modify-syntax-entry ?* "<" cobol-mode-syntax-table) (modify-syntax-entry ?/ "." cobol-mode-syntax-table) (modify-syntax-entry ?\' "\"" cobol-mode-syntax-table) (modify-syntax-entry ?\" "\"" cobol-mode-syntax-table) ; '\' should not be an escape character in COBOL (modify-syntax-entry ?\\ "_" cobol-mode-syntax-table) (modify-syntax-entry ?. "w" cobol-mode-syntax-table) (modify-syntax-entry ?\n ">" cobol-mode-syntax-table)) (defvar cobol-mode-map () "Keymap used in cobol mode.") (if cobol-mode-map () (setq cobol-mode-map (make-sparse-keymap)) ; this SHOULD be a real keymap (define-key cobol-mode-map ";" 'cobol-abbrev-start) (define-key cobol-mode-map "\C-c;" 'cobol-comment-region) (define-key cobol-mode-map "\e\C-a" 'beginning-of-cobol-subprogram) (define-key cobol-mode-map "\e\C-e" 'end-of-cobol-subprogram) (define-key cobol-mode-map "\e;" 'cobol-indent-comment) (define-key cobol-mode-map "\e\C-h" 'mark-cobol-subprogram) (define-key cobol-mode-map "\e\n" 'cobol-split-line) (define-key cobol-mode-map "\e\C-q" 'cobol-indent-subprogram) (define-key cobol-mode-map "\C-c\C-w" 'cobol-window-create) (define-key cobol-mode-map "\C-c\C-r" 'cobol-column-ruler) (define-key cobol-mode-map "\C-c\C-p" 'cobol-previous-statement) (define-key cobol-mode-map "\C-c\C-n" 'cobol-next-statement) (define-key cobol-mode-map "\C-c\C-c" 'cobol-goto-column) (define-key cobol-mode-map "\C-cc" 'cobol-goto-column) ; avoid confusion (define-key cobol-mode-map "\C-c\C-l" 'goto-line) ; for Sam (define-key cobol-mode-map "\C-cl" 'goto-line) ; avoid confusion (define-key cobol-mode-map "\t" 'cobol-indent-line) (define-key cobol-mode-map "\C-m" 'newline-and-indent) ; magic RET key (let ((n ?\ )) (while (< n 127) (define-key cobol-mode-map (char-to-string n) 'cobol-self-insert) (setq n (1+ n)))) (define-key cobol-mode-map "\177" 'cobol-back-delete) ; magic DEL key too ; (define-key cobol-mode-map "0" 'cobol-electric-line-number) ; (define-key cobol-mode-map "1" 'cobol-electric-line-number) ; (define-key cobol-mode-map "2" 'cobol-electric-line-number) ; (define-key cobol-mode-map "3" 'cobol-electric-line-number) ; (define-key cobol-mode-map "4" 'cobol-electric-line-number) ; (define-key cobol-mode-map "5" 'cobol-electric-line-number) ; (define-key cobol-mode-map "6" 'cobol-electric-line-number) ; (define-key cobol-mode-map "7" 'cobol-electric-line-number) ; (define-key cobol-mode-map "8" 'cobol-electric-line-number) ; (define-key cobol-mode-map "9" 'cobol-electric-line-number) ) (defvar cobol-mode-abbrev-table nil) (if cobol-mode-abbrev-table () (define-abbrev-table 'cobol-mode-abbrev-table ()) (let ((abbrevs-changed nil)) (define-abbrev cobol-mode-abbrev-table ";b" "byte" nil) (define-abbrev cobol-mode-abbrev-table ";ch" "character" nil) (define-abbrev cobol-mode-abbrev-table ";cl" "close" nil) (define-abbrev cobol-mode-abbrev-table ";c" "continue" nil) (define-abbrev cobol-mode-abbrev-table ";cm" "common" nil) (define-abbrev cobol-mode-abbrev-table ";cx" "complex" nil) (define-abbrev cobol-mode-abbrev-table ";di" "dimension" nil) (define-abbrev cobol-mode-abbrev-table ";do" "double" nil) (define-abbrev cobol-mode-abbrev-table ";dc" "double complex" nil) (define-abbrev cobol-mode-abbrev-table ";dp" "double precision" nil) (define-abbrev cobol-mode-abbrev-table ";dw" "do while" nil) (define-abbrev cobol-mode-abbrev-table ";e" "else" nil) (define-abbrev cobol-mode-abbrev-table ";ed" "enddo" nil) (define-abbrev cobol-mode-abbrev-table ";el" "elseif" nil) (define-abbrev cobol-mode-abbrev-table ";en" "endif" nil) (define-abbrev cobol-mode-abbrev-table ";eq" "equivalence" nil) (define-abbrev cobol-mode-abbrev-table ";ex" "external" nil) (define-abbrev cobol-mode-abbrev-table ";ey" "entry" nil) (define-abbrev cobol-mode-abbrev-table ";f" "format" nil) (define-abbrev cobol-mode-abbrev-table ";fu" "function" nil) (define-abbrev cobol-mode-abbrev-table ";g" "goto" nil) (define-abbrev cobol-mode-abbrev-table ";im" "implicit" nil) (define-abbrev cobol-mode-abbrev-table ";ib" "implicit byte" nil) (define-abbrev cobol-mode-abbrev-table ";ic" "implicit complex" nil) (define-abbrev cobol-mode-abbrev-table ";ich" "implicit character" nil) (define-abbrev cobol-mode-abbrev-table ";ii" "implicit integer" nil) (define-abbrev cobol-mode-abbrev-table ";il" "implicit logical" nil) (define-abbrev cobol-mode-abbrev-table ";ir" "implicit real" nil) (define-abbrev cobol-mode-abbrev-table ";inc" "include" nil) (define-abbrev cobol-mode-abbrev-table ";in" "integer" nil) (define-abbrev cobol-mode-abbrev-table ";intr" "intrinsic" nil) (define-abbrev cobol-mode-abbrev-table ";l" "logical" nil) (define-abbrev cobol-mode-abbrev-table ";op" "open" nil) (define-abbrev cobol-mode-abbrev-table ";pa" "parameter" nil) (define-abbrev cobol-mode-abbrev-table ";pr" "program" nil) (define-abbrev cobol-mode-abbrev-table ";p" "print" nil) (define-abbrev cobol-mode-abbrev-table ";re" "real" nil) (define-abbrev cobol-mode-abbrev-table ";r" "read" nil) (define-abbrev cobol-mode-abbrev-table ";rt" "return" nil) (define-abbrev cobol-mode-abbrev-table ";rw" "rewind" nil) (define-abbrev cobol-mode-abbrev-table ";s" "stop" nil) (define-abbrev cobol-mode-abbrev-table ";su" "subroutine" nil) (define-abbrev cobol-mode-abbrev-table ";ty" "type" nil) (define-abbrev cobol-mode-abbrev-table ";w" "write" nil))) (defvar not-a-comment "^......[^\\*\\n]") ;(defvar is-a-comment "^......\\*") (defvar is-a-comment "^ *\\*") (defvar cobol-usage-words "[ \t]+\\(USAGE\\([ \t]+\\(IS\\)?\\)?\\)[ \t]+") (defvar cobol-modifier-words "[ \t]+\\(\\(A\\|DE\\)SCENDING\\([ \t]+KEY\\)?\\|DYNAMIC\\|JUSTIFIED\\)") (defvar cobol-debugging-statements "[ \t]+DEBUG\\(-\\(CONTENTS\\|ITEM\\|LINE\\|NAME\\|SUB\\(-\\[123]\\)\\)\\|GING\\)") (defvar cobol-data-types (concat "[ \t]+\\<\\(ALPHA\\(\\(BET\\(IC\\(-LOWER\\|-UPPER\\)?\\)\\)?\\|NUMERIC\\(-EDITED\\)?\\)" "\\|BINARY\\(-\\(COB_CHAR\\|SHORT\\|LONG\\|DOUBLE\\)\\)?\\|COMP\\(\\(UTATIONAL\\)?-[0-9Xx]\\)?" "\\|NEGATIVE\\|PACKED-DECIMAL\\|POSITIVE\\)[^-A-Za-z0-9]")) (defvar cobol-scope-delimiters (concat "[ \t]+\\(END-\\(ADD\\|C\\(ALL\\|OMPUTE\\)\\|D\\(ELETE\\|IVIDE\\)\\|" "E\\(VALUATE\\|XEC\\)\\|IF\\|MULTIPLY\\|PERFORM\\|RE\\(AD\\|CEIVE\\|TURN\\|WRITE\\)\\|" "S\\(EARCH\\|T\\(ART\\|RING\\)\\|UBTRACT\\)\\|UNSTRING\\|WRITE\\)\\)")) (defvar cobol-verbs (concat ; "[^-A-Za-z0-9\n]\\< "\\b\\(A\\(CCEPT\\|DD\\|ND\\|SSIGN\\|T\\)\\|" "C\\(A\\(LL\\(-CONVENTION\\)?\\|NCEL\\)\\|LOSE\\|O\\(MPUTE\\|NTAINS\\|NTINUE\\|PY\\)\\)\\|" "D\\(E\\(CLARE\\|ETE\\|PENDING[ \t]+ON\\|LIMITED[ \t]+BY\\)\\|I\\(SPLAY\\|VIDE\\)\\)\\|" "E\\(LSE\\|NTRY\\|VALUATE\\|X\\(IT\\|EC[ \t]+SQL\\)\\)\\|F\\(OR\\|ROM\\)\\|" "G\\(IVING\\|O\\(BACK\\)?\\)\\|" "I\\(F\\|N\\(ITIALIZE\\|TO\\|SPECT\\|DEX\\(ED[ \t]+BY\\)?\\)\\|S\\)\\|LESS\\|" "M\\(ERGE\\|OVE\\|ULTIPLY\\)\\|NEXT[ \t]SENTENCE\\|O\\(CCURS\\|PEN\\|R\\)\\|" "P\\(ERFORM\\|IC\\|OCOB_INTER\\)\\|" "R\\(E\\(AD\\|DEFINES\\|MAINDER\\|NAMES\\|PLAC\\(E\\|ING\\)\\|TURN\\(S\\|ING\\)?\\|WRITE\\)\\|" "OUNDED\\|UN\\)\\|" "S\\(E\\(ARCH\\|LECT\\|QUENTIAL\\|T\\)\\|ORT\\(-MERGE\\)?\\|PECIAL-NAMES\\|" "T\\(OP\\|RING\\|ART\\|ATUS\\)\\)" "\\|T\\(ALLYING\\|H\\(EN\\|AN\\|ROUGH\\|RU\\)\\|O\\|RAILING\\)\\|" "U\\(N\\(STRING\\|TIL\\)\\|PON\\|S\\(E\\|ING\\)\\)\\|VA\\(LUE\\|RYING\\)\\|" "W\\(HEN\\|ITH\\|RITE\\)\\)\\b" ;[ \.\n]" ;[^-_A-Za-z0-9]?" )) (defvar cobol-divisions (concat not-a-comment "[ \t]*\\(IDENTIFICATION\\|DATA\\|ENVIRONMENT\\|PROCEDURE\\)[ \t]+\\(DIVISION\\)" )) (defvar cobol-prog-info (concat not-a-comment "[ \t]*\\(AUTHOR\\|PROGRAM-ID\\|DATE-COMPILED\\|DATE-WRITTEN\\|SOURCE-COMPUTER\\|OBJECT-COMPUTER\\)")) (defvar cobol-sections (concat not-a-comment "[ \t]*\\([-A-Za-z0-9]+\\)[ \t]+\\(SECTION\\)\\.")) (defvar cobol-paragraphs (concat not-a-comment "\\([-A-Za-z0-9]+\\)\\.$")) (defvar cobol-constants (concat "[ \t]+\\(DATE\\|FALSE\\|FILLER\\|HIGH-VALUE\\(S\\)?\\|LENGTH\\|LOW-VALUE\\(S\\)?\\|" "SPACE\\(S\\)?\\|TRUE\\|ZERO\\(S\\|ES\\)?\\)" )) (defvar cobol-font-lock-keywords (list (list cobol-data-types '(1 font-lock-type-face nil)) (list cobol-verbs '(1 font-lock-keyword-face nil)) (list cobol-scope-delimiters '(1 font-lock-keyword-face nil)) (list cobol-modifier-words '(1 font-lock-keyword-face nil)) (list cobol-usage-words '(1 font-lock-type-face nil)) (list cobol-divisions '(1 font-lock-constant-face nil) '(2 font-lock-string-face nil)) (list cobol-sections '(1 font-lock-constant-face nil) '(2 font-lock-string-face nil)) (list cobol-paragraphs '(1 font-lock-constant-face nil)) (list cobol-constants '(1 font-lock-constant-face nil)) (list cobol-prog-info '(1 font-lock-reference-face nil)) '("^......\\(\\*.*\\)" 1 font-lock-comment-face t) )) ;;;###autoload (defun cobol-mode () "Major mode for editing cobol code. Tab indents the current cobol line correctly. Type `;?' or `;\\[help-command]' to display a list of built-in abbrevs for Cobol keywords. Variables controlling indentation style and extra features: comment-start Should allways be nil in Cobol mode. Cobol has no in-line comments. cobol-do-indent Extra indentation within do blocks. (default 4) cobol-if-indent Extra indentation within if blocks. (default 4) cobol-continuation-indent Extra indentation appled to continuation statements. (default 6) cobol-indent-increment Amount of indentation to add to a line when it can be indented (default 4) cobol-comment-line-column Amount of indentation for text within full-line comments. (default 6) cobol-comment-indent-style nil means don't change indentation of text in full-line comments, fixed means indent that text at column cobol-comment-line-column relative means indent at cobol-comment-line-column beyond the indentation for a line of code. Default value is fixed. cobol-comment-indent-char Character to be inserted instead of space for full-line comment indentation. (default SPC) cobol-minimum-statement-indent Minimum indentation for cobol statements. (default 8) cobol-line-number-indent Maximum indentation for line numbers. A line number will get less than this much indentation if necessary to avoid reaching column 5. (default 1) cobol-check-all-num-for-matching-do Non-nil causes all numbered lines to be treated as possible 'continue' statements. (default nil) cobol-continuation-char character to be inserted in column 5 of a continuation line. (default is ?-) cobol-comment-region String inserted by \\[cobol-comment-region] at start of each line in region. (default \" ** \") cobol-electric-line-number Non-nil causes line number digits to be moved to the correct column as typed. (default t) cobol-startup-message Set to nil to inhibit message first time cobol-mode is used. Turning on Cobol mode calls the value of the variable cobol-mode-hook with no args, if that value is non-nil. \\{cobol-mode-map}" (interactive) (kill-all-local-variables) (setq mode-name "Cobol") (setq major-mode 'cobol-mode) (if cobol-startup-message (message "Emacs Cobol mode ver. %s. Mail bugs to linux4us@home.com" cobol-mode-version)) (setq cobol-startup-message nil) ; (setq local-abbrev-table cobol-mode-abbrev-table) ;; no abbrevs for now (set-syntax-table cobol-mode-syntax-table) (use-local-map cobol-mode-map) (make-local-variable 'indent-line-function) (setq indent-line-function 'cobol-indent-line) (make-local-variable 'comment-indent-function) (setq comment-indent-function 'cobol-comment-hook) (make-local-variable 'comment-line-start-skip) ; (setq comment-line-start-skip "^ *\\*") ; The only way to do a comment is a * in column 7 (setq comment-line-start-skip is-a-comment) (make-local-variable 'comment-line-start) (setq comment-line-start "** ") ; (setq comment-line-start is-a-comment) (make-local-variable 'comment-start-skip) (setq comment-start-skip "![ \t]*") (make-local-variable 'comment-start) (setq comment-start nil) ; COBOL has no in-line comments (make-local-variable 'comment-column) (setq comment-column cobol-comment-line-column) (make-local-variable 'require-final-newline) (setq require-final-newline t) (make-local-variable 'write-file-hooks) (setq write-file-hooks (cons 'cobol-no-tabs-hook write-file-hooks)) (make-local-variable 'find-file-hooks) (setq find-file-hooks (cons 'cobol-no-tabs-hook find-file-hooks)) (make-local-variable 'abbrev-all-caps) (setq abbrev-all-caps t) (make-local-variable 'indent-tabs-mode) (setq indent-tabs-mode nil) (make-local-variable 'fill-column) (setq fill-column 70) ;; Font lock support (make-local-variable 'font-lock-defaults) (setq font-lock-defaults '(cobol-font-lock-keywords nil t)) (make-local-variable 'lazy-lock-defer-on-scrolling) (make-local-variable 'lazy-lock-defer-contextually) (make-local-variable 'lazy-lock-stealth-time) (make-local-variable 'lazy-lock-stealth-lines) (make-local-variable 'lazy-lock-stealth-verbose) (make-local-variable 'lazy-lock-defer-time) (make-local-variable 'lazy-lock-minimum-size) (make-local-variable 'font-lock-support-mode) (setq font-lock-support-mode 'lazy-lock-mode) (setq lazy-lock-defer-on-scrolling nil) (setq lazy-lock-defer-contextually nil) (setq lazy-lock-stealth-time 5) (setq lazy-lock-stealth-lines 100) (setq lazy-lock-minimum-size 204800) (setq lazy-lock-stealth-verbose t) (setq lazy-lock-defer-time 0.25) (run-hooks 'cobol-mode-hook)) (defun cobol-comment-hook () cobol-comment-line-column) ; ALWAYS comment in the comment column (defun cobol-self-insert (arg) "Do a self-insert-command, and check for the right margin, ringing the bell if it is reached." (interactive "*p") (let ((column (current-column))) (self-insert-command arg) (if (and (< column fill-column) (>= (current-column) fill-column)) (beep 't)))) (defun cobol-goto-column (arg) "Goto column ARG, counting from column 1, adding spaces to the end of the line if needed" (interactive "NGoto column: ") (if (> arg 0) (progn (end-of-line) (if (> (current-column) (- arg 1)) (progn (beginning-of-line) (forward-char (- arg 1))) (insert-char ? (- arg (current-column) 1)))))) (defun cobol-back-delete (arg &optional killp) "Slightly magic version of backward-delete-char-untabify" (interactive "*p\nP") (let (atws (column (current-column))) (insert-char ?\n 1) (forward-char -1) (beginning-of-line) (if (looking-at "[ \t]*$") (progn (if (= (% (+ column 1) cobol-indent-increment) 0) (setq column (max cobol-minimum-statement-indent (- column cobol-indent-increment))) (setq column (max cobol-minimum-statement-indent (* (/ column cobol-indent-increment) cobol-indent-increment)))) (delete-horizontal-space) (insert-char (if (stringp cobol-comment-indent-char) (aref cobol-comment-indent-char 0) cobol-comment-indent-char) column)) (progn (end-of-line) (backward-delete-char-untabify arg killp))) (end-of-line) (delete-char 1))) (defun cobol-no-tabs-hook () "Hook for write file that removes all tabs from the buffer. This function must return nil so that the file will actually be written." (save-excursion ; the following code is stolen from tabify.el... (goto-char (point-min)) (while (search-forward "\t" nil t) ; faster than re-search (let ((start (point)) (column (current-column)) (indent-tabs-mode nil)) (skip-chars-backward "\t") (delete-region start (point)) (indent-to column)))) nil) ; just in case to make sure file is written (defun cobol-indent-comment () "Align or create comment on current line. Existing comments of all types are recognized and aligned. If the line has no comment, a side-by-side comment is inserted and aligned if the value of comment-start is not nil. Otherwise, a separate-line comment is inserted, on this line or on a new line inserted before this line if this line is not blank." (interactive) (beginning-of-line) ;; Recognize existing comments of either kind. (cond ((looking-at comment-line-start-skip) (delete-horizontal-regexp " \t\\*") ; kill the old comment stuff (indent-to (cobol-comment-hook)) (insert comment-line-start)) ;; No existing comment. ;; Insert separate-line comment, making a new line if nec. (t (if (looking-at "^[ \t]*$") (delete-horizontal-space) (beginning-of-line) (insert "\n") (forward-char -1)) (indent-to (cobol-comment-hook)) (insert comment-line-start) ))) ;; (insert-char (if (stringp cobol-comment-indent-char) ;; (aref cobol-comment-indent-char 0) ;; cobol-comment-indent-char) ;; (- (calculate-cobol-indent) (current-column)))))) (defun cobol-comment-region (beg-region end-region arg) "Comments every line in the region. Puts cobol-comment-region at the beginning of every line in the region. BEG-REGION and END-REGION are args which specify the region boundaries. With non-nil ARG, uncomments the region." (interactive "*r\nP") (let ((end-region-mark (make-marker)) (save-point (point-marker))) (set-marker end-region-mark end-region) (goto-char beg-region) (beginning-of-line) (if (not arg) ;comment the region (progn (insert cobol-comment-region) (delete-char 7) ; we would like to maintain the original ; alignment as closely as possible (while (and (= (forward-line 1) 0) (< (point) end-region-mark)) (insert cobol-comment-region) (delete-char 7)))) (goto-char save-point) (set-marker end-region-mark nil) (set-marker save-point nil))) (defun cobol-uncomment-region (beg-region end-region arg) "Uncomments every line in the region. Deletes cobol-comment-region from the beginning of every line in the region. BEG-REGION and END-REGION are args which specify the region boundaries." (interactive "*r\nP") (let ((end-region-mark (make-marker)) (save-point (point-marker))) (set-marker end-region-mark end-region) (goto-char beg-region) (beginning-of-line) (if (not arg) ;comment the region (let ( ( com ( regexp-quote cobol-comment-region ) ) ) ;uncomment the region (if ( looking-at com ) (progn (goto-char (- (match-end 0) 1)) (delete-backward-char 2))) (while (and (= (forward-line 1) 0) (< (point) end-region-mark)) (if (looking-at com) (progn (goto-char (- (match-end 0) 1)) (delete-backward-char 2)))))) (goto-char save-point) (set-marker end-region-mark nil) (set-marker save-point nil))) (defun cobol-abbrev-start () "Typing \";\\[help-command]\" or \";?\" lists all the cobol abbrevs. Any other key combination is executed normally." ;\\[help-command] is just a way to print the value of the variable help-char. (interactive) (let (c) (insert last-command-char) (if (or (= (setq c (read-char)) ??) ;insert char if not equal to `?' (= c help-char)) (cobol-abbrev-help) (setq unread-command-events c)))) (defun cobol-abbrev-help () "List the currently defined abbrevs in Cobol mode." (interactive) (message "Listing abbrev table...") (require 'abbrevlist) (list-one-abbrev-table cobol-mode-abbrev-table "*Help*") (message "Listing abbrev table...done")) (defun cobol-column-ruler () "Inserts a column ruler momentarily above current line, till next keystroke. The ruler is defined by the value of cobol-column-ruler. The key typed is executed unless it is SPC." (interactive) (momentary-string-display cobol-column-ruler (save-excursion (beginning-of-line) (point)) nil "Type SPC or any command to erase ruler.")) (defun cobol-window-create () "Makes the window 72 columns wide." (interactive) (let ((window-min-width 2)) (split-window-horizontally 73)) (other-window 1) (switch-to-buffer " cobol-window-extra" t) (select-window (previous-window))) (defun cobol-split-line () "Break line at point and insert continuation marker and alignment." (interactive) (delete-horizontal-space) (if (save-excursion (beginning-of-line) (looking-at comment-line-start-skip)) (insert ?\n comment-line-start ?\ ) (insert ?\n cobol-continuation-char)) (cobol-indent-line)) (defun delete-horizontal-regexp (chars) "Delete all characters in COB_CHARS around point. COB_CHARS is like the inside of a [...] in a regular expression except that ] is never special and \ quotes ^, - or \." (interactive "*s") (skip-chars-backward chars) (delete-region (point) (progn (skip-chars-forward chars) (point)))) (defun cobol-electric-line-number (arg) "Self insert, but if part of a Cobol line number indent it automatically. Auto-indent does not happen if a numeric arg is used." (interactive "P") (if (or arg (not cobol-electric-line-number)) (self-insert-command arg) (if (or (save-excursion (re-search-backward "[^ \t0-9]" (save-excursion (beginning-of-line) (point)) t)) ;not a line number (looking-at "[0-9]")) ;within a line number (insert last-command-char) (skip-chars-backward " \t") (insert last-command-char) (cobol-indent-line)))) (defun beginning-of-cobol-subprogram () "Moves point to the beginning of the current cobol subprogram." (interactive) (let ((case-fold-search t)) (beginning-of-line -1) (re-search-backward "^[ \t0-9]*end\\b[ \t]*[^ \t=(a-z]" nil 'move) (if (looking-at "^[ \t0-9]*end\\b[ \t]*[^ \t=(a-z]") (forward-line 1)))) (defun end-of-cobol-subprogram () "Moves point to the end of the current cobol subprogram." (interactive) (let ((case-fold-search t)) (beginning-of-line 2) (re-search-forward "^[ \t0-9]*end\\b[ \t]*[^ \t=(a-z]" nil 'move) (goto-char (match-beginning 0)) (forward-line 1))) (defun mark-cobol-subprogram () "Put mark at end of cobol subprogram, point at beginning. The marks are pushed." (interactive) (end-of-cobol-subprogram) (push-mark (point)) (beginning-of-cobol-subprogram)) (defun cobol-previous-statement () "Moves point to beginning of the previous cobol statement. Returns 'first-statement if that statement is the first non-comment Cobol statement in the file, and nil otherwise." (interactive) (let (not-first-statement continue-test) (beginning-of-line) (setq continue-test (looking-at (concat " " (regexp-quote (char-to-string cobol-continuation-char))))) (while (and (setq not-first-statement (= (forward-line -1) 0)) ;; (or (looking-at comment-line-start-skip)) (looking-at "[ \t]*$"))) (cond ((and continue-test (not not-first-statement)) (message "Incomplete continuation statement.")) (continue-test (cobol-previous-statement)) ((not not-first-statement) 'first-statement)))) (defun cobol-next-statement () "Moves point to beginning of the next cobol statement. Returns 'last-statement if that statement is the last non-comment Cobol statement in the file, and nil otherwise." (interactive) (let (not-last-statement) (beginning-of-line) (while (and (setq not-last-statement (= (forward-line 1) 0)) (or (looking-at comment-line-start-skip) (looking-at "[ \t]*$") ))) (if (not not-last-statement) 'last-statement))) (defun cobol-indent-line () "Indents current cobol line based on its contents and on previous lines." (interactive) (if (or (eq last-command 'cobol-indent-line) ; if we just did a tab (let (atws) (insert-char ?\n 1) (forward-char -1) (beginning-of-line) (setq atws (looking-at "[ \t]*$")) (end-of-line) (delete-char 1) (not atws))) (insert-char (if (stringp cobol-comment-indent-char) (aref cobol-comment-indent-char 0) cobol-comment-indent-char) (- cobol-indent-increment (% (+ (current-column) 1) cobol-indent-increment))) (let ((do-another-tab nil) (cfi (calculate-cobol-indent)) (cur-col (current-column))) ; we did NOT just do a tab (save-excursion (beginning-of-line) (if (not (= cfi (current-indentation))) (cobol-indent-to-column cfi) ; else the line is indented correctly; check for a comment (beginning-of-line) (if (re-search-forward comment-start-skip (save-excursion (end-of-line) (point)) 'move) (cobol-indent-comment) ; else not looking at a comment; make another tab (if (= cur-col cfi) (setq do-another-tab 't))))) (if do-another-tab (insert-char (if (stringp cobol-comment-indent-char) (aref cobol-comment-indent-char 0) cobol-comment-indent-char) (- cobol-indent-increment (% (+ (current-column) 1) cobol-indent-increment)))) ;; Never leave point in left margin. (if (< (current-column) cfi) (move-to-column cfi))))) (defun cobol-indent-subprogram () "Properly indents the Cobol subprogram which contains point." (interactive) (save-excursion (mark-cobol-subprogram) (message "Indenting subprogram...") (indent-region (point) (mark) nil)) (message "Indenting subprogram...done.")) (defun calculate-cobol-indent () "Calculates the cobol indent column based on previous lines." (let (icol first-statement (special-col nil) (case-fold-search t)) (save-excursion (setq first-statement (cobol-previous-statement)) (if first-statement (setq icol cobol-minimum-statement-indent) (progn (if (= (point) (point-min)) (setq icol cobol-minimum-statement-indent) (setq icol (cobol-current-line-indentation))) (if (looking-at "[ \t]*\\*") ; if looking a at comment (setq special-col 't)) (skip-chars-forward " \t0-9") (cond ((looking-at "if[ \t]*(") (if (or (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t(=a-z0-9]") (let (then-test) ;multi-line if-then (while (and (= (forward-line 1) 0) ;search forward for then (looking-at " [^ 0]") (not (setq then-test (looking-at ".*then\\b[ \t]*[^ \t(=a-z0-9]"))))) then-test)) (setq icol (+ icol cobol-if-indent)))) ((looking-at "\\(else\\|elseif\\)\\b") (setq icol (+ icol cobol-if-indent))) ((looking-at "do\\b") (setq icol (+ icol cobol-do-indent))))))) (save-excursion (beginning-of-line) (cond ((looking-at "[ \t]*$")) ; blank lines do nothing ((looking-at comment-line-start-skip) ; junk for comments (setq icol cobol-comment-line-column) (setq special-col t)) ((looking-at (concat " " (regexp-quote (char-to-string cobol-continuation-char)))) (setq icol cobol-continuation-indent) (setq special-col t)) (first-statement) ;if first in the file, don't do anything ((and cobol-check-all-num-for-matching-do (looking-at "[ \t]*[0-9]+") (cobol-check-for-matching-do)) (setq icol (- icol cobol-do-indent))) (t (skip-chars-forward " \t") ; skip to first real stuff (cond ;;; The following are for special names that MUST ;;; start in area A (column 8-11) ((looking-at "[a-z]+ +division") ; divisions in area A (setq icol cobol-minimum-statement-indent)) ((looking-at "[-0-9a-z]+ +section") ; sections in area A (setq icol cobol-minimum-statement-indent)) ;; this SHOULD get paragraph names ((looking-at "[-a-z0-9]+\\.") ; paragraphs (if (looking-at "end-[a-z]") ;; Cover all "end-*" scope delimiters (setq icol (- icol cobol-if-indent)) (if (looking-at "exit\\.") (setq icol (+ 4 cobol-minimum-statement-indent)) (setq icol cobol-minimum-statement-indent)))) ((looking-at "fd ") ; fd's in area A (setq icol cobol-minimum-statement-indent)) ((looking-at "sd ") ; sd's in area A (setq icol cobol-minimum-statement-indent)) ((looking-at "rd ") ; rd's in area A (setq icol cobol-minimum-statement-indent)) ((looking-at "cd ") ; cd's in area A (setq icol cobol-minimum-statement-indent)) ((looking-at "01 ") ; 01 level numbers in A too (setq icol cobol-minimum-statement-indent)) ((looking-at "77 ") ; and 77 level numbers (setq icol cobol-minimum-statement-indent)) ((looking-at "88 ") ; and 88 level numbers, too (if (cobol-match-last-statement "88 ") (setq icol (cobol-last-statement-indent)) (setq icol (+ cobol-indent-increment (cobol-last-statement-indent))))) ;;; the following are for end-of-block detection ;; ((looking-at "end-if\\b") ;; No good if it ends with a period ((looking-at "end-if") (setq icol (- icol cobol-if-indent))) ((looking-at "else\\b") (setq icol (- icol cobol-if-indent))) ((looking-at "end-[a-z]") ;; Cover all "end-*" scope delimiters (setq icol (- icol cobol-if-indent))) ((and (looking-at "continue\\b") (cobol-check-for-matching-do)) (setq icol (- icol cobol-do-indent))) ((looking-at "end[ \t]*do\\b") (setq icol (- icol cobol-do-indent))) ((and (looking-at "end\\b[ \t]*[^ \t=(a-z]") (not (= icol cobol-minimum-statement-indent))) (message "Warning: `end' not in column %d. Probably an unclosed block." cobol-minimum-statement-indent)) (t ; in the case of normal lines nil) )))) (if special-col icol (max cobol-minimum-statement-indent icol)))) (defun cobol-match-last-statement (arg) "Match the start of line of the last non-comment/non-blank statement. Return `t' or `nil`." (interactive) (defvar com " *") (save-excursion (beginning-of-line) (forward-line -1) (while (or (looking-at (regexp-quote com)) (looking-at "[ \t]*$")) (forward-line -1)) (skip-chars-forward " \t") (if (looking-at arg) t))) (defun cobol-last-statement-indent () "Returns the column of the last non-comment statement" (interactive) (defvar com " *") (defvar col 0) (save-excursion (beginning-of-line) (forward-line -1) (while (or (looking-at (regexp-quote com)) (looking-at "[ \t]*$")) (forward-line -1)) (skip-chars-forward " \t") (looking-at "A-Za-z0-9") (setq col (current-column))) (max col cobol-minimum-area-b-indent)) (defun current-line () "Return the vertical position of point..." (interactive) (defvar cur-line 0) (save-excursion (setq cur-line (+ (count-lines (point-min) (point)) (if (= (current-column) 0) 1 0)))) cur-line) (defun cobol-current-line-indentation () "Indentation of current line, ignoring Cobol line number or continuation. This is the column position of the first non-whitespace character aside from the line number and/or column 5 line-continuation character. For comment lines, returns indentation of the first non-indentation text within the comment." (current-indentation)) ; (save-excursion ; (beginning-of-line) ; (cond ((looking-at comment-line-start-skip) ; (goto-char (match-end 0)) ; (skip-chars-forward ; (if (stringp cobol-comment-indent-char) ; cobol-comment-indent-char ; (char-to-string cobol-comment-indent-char)))) ; ((looking-at " [^ 0\n]") ; (goto-char (match-end 0))) ; (t ; ;; Move past line number. ; (move-to-column 5))) ; ;; Move past whitespace. ; ; (message-box "1 current line = %d" (current-line)) ; (forward-line 1) ; ; (message-box "2 current line = %d" (current-line)) ; (beginning-of-line) ; (skip-chars-forward " \t") ; (current-column))) (defun cobol-indent-to-column (col) "Indents current line with spaces to column COL. notes: 1) A minus sign character in column 6 indicates a continuation line, and this continuation character is retained on indentation; 2) If cobol-continuation-char is the first non-whitespace character, this is a continuation line; 3) A non-continuation line which has a number as the first non-whitespace character is a numbered line." (save-excursion (beginning-of-line) (if (looking-at comment-line-start-skip) (if cobol-comment-indent-style (let ((char (if (stringp cobol-comment-indent-char) (aref cobol-comment-indent-char 0) cobol-comment-indent-char))) (delete-horizontal-space) (insert-char char cobol-comment-line-column))) ;; (if (looking-at " [^ 0\n]") ;; (forward-char 8) ;; (delete-horizontal-space) ;; ;; Put line number in columns 0-4 ;; ;; or put continuation character in column 5. ;; (cond ((eobp)) ;; ((= (following-char) cobol-continuation-char) ;; (indent-to 5) ;; (forward-char 1)) ;; ((looking-at "[0-9]+") ;; (let ((extra-space (- 5 (- (match-end 0) (point))))) ;; (if (< extra-space 0) ;; (message "Warning: line number exceeds 5-digit limit.") ;; (indent-to (min cobol-line-number-indent extra-space)))) ;; (skip-chars-forward "0-9")))) ;; Point is now after any continuation character or line number. ;; Put body of statement where specified. (delete-horizontal-space) (indent-to col) ;; Indent any comment following code on the same line. ;; (if (re-search-forward comment-start-skip ;; (save-excursion (end-of-line) (point)) t) ;; (progn (goto-char (match-beginning 0)) ;; (if (not (= (current-column) (cobol-comment-hook))) ;; (progn (delete-horizontal-space) ;; (indent-to (cobol-comment-hook)))))) ))) (defun cobol-line-number-indented-correctly-p () "Return t if current line's line number is correctly indente. Do not call if there is no line number." (save-excursion (beginning-of-line) (skip-chars-forward " \t") (and (<= (current-column) cobol-line-number-indent) (or (= (current-column) cobol-line-number-indent) (progn (skip-chars-forward "0-9") (= (current-column) 5)))))) (defun cobol-check-for-matching-do () "When called from a numbered statement, returns t if matching 'do' is found, and nil otherwise." (let (charnum (case-fold-search t)) (save-excursion (beginning-of-line) (if (looking-at "[ \t]*[0-9]+") (progn (skip-chars-forward " \t") (skip-chars-forward "0") ;skip past leading zeros (setq charnum (buffer-substring (point) (progn (skip-chars-forward "0-9") (point)))) (beginning-of-line) (and (re-search-backward (concat "\\(^[ \t0-9]*end\\b[ \t]*[^ \t=(a-z]\\)\\|\\(^[ \t0-9]*do[ \t]*0*" charnum "\\b\\)\\|\\(^[ \t]*0*" charnum "\\b\\)") nil t) (looking-at (concat "^[ \t0-9]*do[ \t]*0*" charnum)))))))) ;;************************************************************ ;; CHANGELOG-------------------------------------------------* ;; ;; 08/08/00 M Vanecek ;; - Changed a '-' in the cobol-mode-syntax table to be a word ;; character instead of a punctuation character, because a ;; '-' is so often used in data item and paragraph names ;; - Changed the syntax highlighting so that successive categories ;; do not overlay previously evaluated categories of syntax ;; ;; 08/13/00 M Vanecek ;; - Redefined comment-line-start-skip from nil to "^......\\*" ;; - Added (define-key cobol-mode-map "\t" 'cobol-indent-line) ;; - Redefined is-a-comment from " \\*" to "^ *\\*" ;; - Fixed a typo in the calculate-cobol-indent function--extra ;; parentheses ;; - [/code] ---------------------------------------------------------------- Here are some files for [url=http://notepad-plus.sourceforge.net/]Notepad++[/url]. The benefits are: - auto completion - syntax highlighting - code folding (for if/evaluate/compute/..., which will lead you to use always end-if/end-evaluate/...) The big problems are: - not capable of comment line by * in column 7, therefore all compute with * seems to be comments - not capable of spaces in keywords, therefore sections are not foldable According to the website it should possible to code some plugin which maybe could fix these and other problems. If you have developed something like that, just post here :-) For syntax highlighting and code folding add the following to %APPDATA%\Notepad++\userDefineLang.xml[code] 000000 ACCEPT ADD CALL COMPUTE DELETE DISPLAY DIVIDE EVALUATE IF MULTIPLY PERFORM READ RECEIVE RETURN REWRITE SEARCH START STRING SUBTRACT UNSTRING WRITE END-ACCEPT END-ADD END-CALL END-COMPUTE END-DELETE END-DISPLAY END-DIVIDE END-EVALUATE END-IF END-MULTIPLY END-PERFORM END-READ END-RECEIVE END-RETURN END-REWRITE END-SEARCH END-START END-STRING END-SUBTRACT END-UNSTRING END-WRITE ( ) . / + < = > 1 1 2 2 0*> 0* + < <= = > >= ACCESS ADVANCING AFTER ALL ALPHABET ALPHABETIC ALPHABETIC-LOWER ALPHABETIC-UPPER ALPHANUMERIC ALPHANUMERIC-EDITED ALSO ALTER ALTERNATE AND ANY ARE AREA AREAS ASCENDING ASSIGN AT AUTHOR BEFORE BINARY BLANK BLOCK BOTTOM BY CANCEL CD CF CH CHARACTER CHARACTERS CLASS CLOCK-UNITS CLOSE COBOL CODE CODE-SET COLLATING COLUMN COMMA COMMON COMMUNICATION COMP COMPUTATIONAL CONFIGURATION CONTAINS CONTENT CONTINUE CONTROL CONTROLS CONVERTING COPY CORR CORRESPONDING COUNT CURRENCY DATA DATE DATE-COMPILED DATE-WRITTEN DAY DAY-OF-WEEK DE DEBUG-CONTENTS DEBUGGING DEBUG-ITEM DEBUG-LINE DEBUG-NAME DEBUG-SUB-1 DEBUG-SUB-2 DEBUG-SUB-3 DECIMAL-POINT DECLARATIVES DELIMITED DELIMITER DEPENDING DESCENDING DESTINATION DETAIL DISABLE DIVISION DOWN DUPLICATES DYNAMIC EGI ELSE EMI ENABLE END END-OF-PAGE END-PERFORM ENTER ENVIRONMENT EOP EQUAL ERROR ESI EVERY EXCEPTION EXIT EXTEND EXTERNAL FALSE FD FILE FILE-CONTROL FILLER FINAL FIRST FOOTING FOR FROM GENERATE GIVING GLOBAL GO GREATER GROUP HEADING HIGH-VALUE HIGH-VALUES IDENTIFICATION IN INDEX INDEXED INDICATE INITIAL INITIALIZE INITIATE INPUT INPUT-OUTPUT INSPECT INSTALLATION INTO INVALID I-O I-O-CONTROL IS JUST JUSTIFIED KEY LABEL LAST LEADING LEFT LENGTH LESS LIMIT LIMITS LINAGE LINAGE-COUNTER LINE LINE-COUNTER LINES LINKAGE LOCK LOW-VALUE LOW-VALUES MEMORY MERGE MESSAGE MODE MODULES MOVE MULTIPLE NATIVE NEGATIVE NEXT NO NOT NUMBER NUMERIC NUMERIC-EDITED OBJECT-COMPUTER OCCURS OF OFF OMITTED ON OPEN OPTIONAL OR ORDER ORGANIZATION OTHER OUTPUT OVERFLOW PACKED-DECIMAL PADDING PAGE PAGE-COUNTER PERFORM PF PH PIC PICTURE PLUS POINTER POSITION POSITIVE PRINTING PROCEDURE PROCEDURES PROCEED PROGRAM PROGRAM-ID PURGE QUEUE QUOTE QUOTES RANDOM RD RECORD RECORDS REDEFINES REEL REFERENCE REFERENCES RELATIVE RELEASE REMAINDER REMOVAL RENAMES REPLACE REPLACING REPORT REPORTING REPORTS RERUN RESERVE RESET REVERSED REWIND RF RH RIGHT ROUNDED RUN SAME SD SECTION SECURITY SEGMENT SEGMENT-LIMIT SELECT SEND SENTENCE SEPARATE SEQUENCE SEQUENTIAL SET SIGN SIZE SORT SORT-MERGE SOURCE SOURCE-COMPUTER SPACE SPACES SPECIAL-NAMES STANDARD STANDARD-1 STANDARD-2 START STATUS STOP SUB-QUEUE-1 SUB-QUEUE-2 SUB-QUEUE-3 SUM SUPPRESS SYMBOLIC SYNC SYNCHRONIZED TABLE TALLYING TAPE TERMINAL TERMINATE TEST TEXT THAN THEN THROUGH THRU TIME TIMES TO TOP TRAILING TRUE TYPE UNIT UNTIL UP UPON USAGE USE USING VALUE VALUES VARYING WHEN WITH WORDS WORKING-STORAGE ZERO ZEROES ZEROS & *> :: <> >> ACTIVE-CLASS ADDRESS ALIGNED ALLOCATE ANYCASE AS B-AND BASED BINARY-CHAR BINARY-DOUBLE BINARY-LONG BINARY-SHORT BIT B-NOT BOOLEAN B-OR B-XOR CLASS-ID COL COLS COLUMNS COMP-1 COMP-2 COMP-3 COMP-4 COMP-X CONDITION CONSTANT CRT CURSOR DATA-POINTER DEFAULT EC EO EXCEPTION-OBJECT FACTORY FLOAT-BINARY-16 FLOAT-BINARY-34 FLOAT-BINARY-7 FLOAT-DECIMAL-16 FLOAT-DECIMAL-34 FLOAT-EXTENDED FLOAT-LONG FLOAT-SHORT FORMAT FREE FUNCTION FUNCTION-ID FUNCTION-POINTER GET GOBACK GROUP-USAGE INFINITY INHERITS INTERFACE INTERFACE-ID INVOKE LOCALE LOCAL-STORAGE METHOD METHOD-ID MINUS NATIONAL NATIONAL-EDITED NESTED NULL OBJECT OBJECT-REFERENCE OPTIONS OVERRIDE PRESENT PROGRAM-POINTER PROPERTY PROTOTYPE RAISE RAISING REPOSITORY REPRESENTS-NOT-A-NUMBER RESUME RETRY RETURNING SCREEN SELFs SHARING SOURCES SUPER SYSTEM-DEFAULT TYPEDEF UNIVERSAL UNLOCK USER-DEFAULT VALID VALIDATE VALIDATE-STATUS VAL-STATUS ARITHMETIC ATTRIBUTE AUTO AUTOMATIC AWAY-FROM-ZERO BACKGROUND-COLOR BELL BLINK BYTE-LENGTH CAPACITY CENTER CLASSIFICATION CYCLE ENTRY-CONVENTION EOL EOS ERASE EXPANDS FOREGROUND-COLOR FOREVER FULL HIGHLIGHT IGNORING IMPLEMENTS INDIRECT INITIALIZED INTERMEDIATE INTRINSIC LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME LOWLIGHT MANUAL MULTIPLE NEAREST-AWAY-FROM-ZERO NEAREST-EVEN NEAREST-TOWARD-ZERO NEGATIVE-INFINITY NONE NORMAL NOT-A-NUMBER NUMBERS ONLY PARAGRAPH POSITIVE-INFINITY PREFIXED PREVIOUS PROHIBITED RECURSIVE RELATION REQUIRED REVERSE-VIDEO ROUNDING SECONDS SECURE SET SIGNED STANDARD-BINARY STANDARD-DECIMAL STATEMENT STEP STRONG SYMBOL TOWARD-GREATER TOWARD-LESSER TRUNCATION UCS-4 UNDERLINE UNSIGNED UTF-16 UTF-8 YYYYDDD YYYYMMDD ACTION ACTION-COPY ACTION-CUT ACTION-DELETE ACTION-PASTE ACTION-UNDO ALIGNMENT APPLY ASSEMBLY-NAME AUTO-DECIMAL AUTO-MINIMIZE AUTO-RESIZE AUTO-SKIP AUTOTERMINATE AX-EVENT-LIST BACKGROUND-COLOUR BACKGROUND-HIGH BACKGROUND-LOW BACKGROUND-STANDARD BACKWARD BEEP BIND BITMAP BITMAP-HANDLE BITMAP-NUMBER BLINKING BOLD BOX BOXED BULK-ADDITION CCOL CELL CELLS CENTERED CENTURY-DATE CENTURY-DAY CHAIN CHAINING CHART CHECK-BOX CLASS-NAME CLINE CLINES COLOR COLOUR COMMAND-LINE COMMIT COMP-5 COMP-6 COMP-N COMPRESSION COMPUTATIONAL-1 COMPUTATIONAL-2 COMPUTATIONAL-3 COMPUTATIONAL-4 COMPUTATIONAL-5 COMPUTATIONAL-6 COMPUTATIONAL-N COMPUTATIONAL-X CONSOLE CONSTRUCTOR CONTROLS-UNCROPPED CONVERSION CONVERT CREATE CSIZE CULTURE CURSOR-COL CURSOR-ROW DATA-COLUMNS DESCRIPTOR DESTROY DISPLAY-COLUMNS DIVIDERS DOUBLE DRAW ECHO EMPTY-CHECK ENABLED ENCRYPTION END-CHAIN ENDING END-MODIFY END-MOVE END-USE END-WAIT ENGRAVED ENTRY ENTRY-FIELD ESCAPE EVENT EVENT-LIST EXCEPTION-VALUE EXCLUDE-EVENT-LIST EXCLUSIVE EXTENDED-SEARCH EXTERNAL-FORM FILE-ID FILE-LIMIT FILE-LIMITS FILE-PATH FILE-PREFIX FLAT FLOAT FLOATING FONT FOREGROUND-COLOUR FRAME FRAMED FULL-HEIGHT GRAPHICAL GRID GROUP-VALUE HANDLE HEAVY HEIGHT HELP-ID HIGH ICON ID IDENTIFIED INDEPENDENT INQUIRE INSERTION-INDEX ITEM-TO-ADD ITEM-TO-DELETE ITEM-VALUE KEPT LAYOUT-DATA LAYOUT-MANAGER LEFTLINE LEFT-TEXT LENGTH-CHECK LINK LIST-BOX LOCK-HOLDING LOW LOWERED MASS-UPDATE MAX-LINES MAX-SIZE MAX-TEXT MAX-VAL MENU MESSAGE MESSAGES MIN-LINES MIN-SIZE MIN-VAL MODAL MODELESS MODIFY MODULE MULTILINE NAMESPACE NO-AUTOSEL NO-CLOSE NO-ECHO NO-GROUP-TAB NO-KEY-LETTER NOTIFY NOTIFY-DBLCLICK NOTIFY-SELCHANGE NULLS NUMERIC-FILL OTHERS OVERLAPPED OVERLINE PAGED PIXEL PIXELS POP-UP POS PRINT-CONTROL PRIORITY PROMPT PROTECTED PUSH-BUTTON QUERY-INDEX RADIO-BUTTON RAISED READERS RECORDING RECORD-POSITION REMARKS RESET-LIST RESIDENT RESIZABLE REVERSE RIMMED SCROLL SEARCH-TEXT SEEK SELECTION-INDEX SELECTION-TEXT SELF-ACT SEPARATION SHADOW SIGNED-INT SIGNED-LONG SIGNED-SHORT SORT-ORDER SQUARE STRONG-NAME STYLE STYLES SUBWINDOW SYSERR SYSTEM SYSTEM-INFO TAB TALLY TERMINAL-INFO TERMINATION-VALUE THREAD THREADS TITLE TITLE-BAR TOOL-BAR TRANSACTION TRANSACTION-STATUS TRANSPARENT UNDERLINED UNFRAMED UNSIGNED-INT UNSIGNED-LONG UNSIGNED-SHORT UNSORTED UPDATE UPDATERS UPPER USER-COLORS USE-RETURN USER-GRAY USER-WHITE VERSION VERY-HEAVY VISIBLE VSCROLL-BAR VTOP WAIT WIDE WIDTH WINDOW WRAP WRITERS ZERO-FILL [/code] For auto completion save the following into npp-dir\plugins\APIs\cobol.xml[code] [/code] Always go on coding COBOL! ---------------------------------------------------------------- I have mounted my Cobol project via a Samba share on my XP box and edit Cobol source with jEdit. It's a great Java-based editor. It has a Cobol mode which at least does nice syntax highlighting. Of course the Eclipse IDE for Java with code completion and permanent syntax checking makes you way more productive, but I did not find an open source IDE for Cobol that compares with Eclipse for Java. There is also a new December 18, 2008 beta of Eclipse Cobol: http://www.eclipse.org/cobol/ ---------------------------------------------------------------- Has anyone found out how to install this eclipse plugin without the Fujitsu stuff and how to enable the COBOL Syntax highlighting in eclipse? ---------------------------------------------------------------- Im am using UltraEdit (Windows) for editing and compiling OC Source-Code. You need to edit the "wordfile.txt" within the UE Directory. [code] /L20"COBOL Source Code" COBOL_LANG EnableSpellasYouType Line Comment = * Line Comment Valid Columns = [7] String Chars = " File Extensions = COB CBL CPY /Function String = "% ^{ +^(*^) SECTION.$^}^{ +^(*^)PROCEDURE DIVISION ^}" /Delimiters = ~!@$%^&*()_+=|\/{}[]:;"'<> ,.?/ /Indent Strings = "SECTION." /Unindent Strings = "EXIT." /Open Brace Strings = "(" /Close Brace Strings = ")" /Open Fold Strings = "EVALUATE" "IF" "SECTION." "SECTION." "UNTIL" "CALL" "#beg" /Close Fold Strings = "END-EVALUATE" "END-IF" "EXIT." "PROGRAM." "END-PERFORM" "END-CALL" "#end" /Variable String = "^{%[R ]+*[0-9][0-9] * PIC^}^{%[R ]+*[0-9][0-9] * VALUE^}*$" /C1"COBOL KEYWORDS" ACCEPT ACCESS ACTIVE-CLASS ADD ADDRESS ADVANCING AFTER ALL ALLOCATE ALPHABET ALPHABETIC ALPHABETIC-LOWER ALPHABETIC-UPPER ALPHANUMERIC ALPHANUMERIC-EDITED ALSO ALTER ALTERNATE AND ANY ANYCASE ARE AREA AREAS AS ASCENDING ASSIGN AT AUTHOR B-AND B-NOT B-OR B-XOR BASED BEFORE BEGINNING BINARY BINARY-CHAR BINARY-DOUBLE BINARY-LONG BINARY-SHORT BIT BLANK BLOCK BOOLEAN BOTTOM BY BYTE-LENGTH CALL CANCEL CBL-CTR CF CH CHARACTER CHARACTERS CHECKING CLASS CLASS-ID CLOCK-UNITS CLOSE CODE CODE-SET COL COLLATING COLS COLUMN COLUMNS COMMA COMMIT COMMON COMMUNICATION COMP COMP-1 COMP-2 COMP-3 COMP-5 COMPUTATIONAL COMPUTATIONAL-1 COMPUTATIONAL-2 COMPUTATIONAL-3 COMPUTATIONAL-5 COMPUTE CONDITION CONFIGURATION CONSTANT CONTAINS CONTENT CONTINUE CONTROL CONTROLS CONVERTING COPY CORR CORRESPONDING COUNT CREATING CRT CURRENCY CURSOR DATA DATA-POINTER DATABASE-KEY DATABASE-KEY-LONG DATE DATE-COMPILED DATE-WRITTEN DAY DAY-OF-WEEK DE DEBUG-CONTENTS DEBUG-ITEM DEBUG-LINE DEBUG-NAME DEBUG-SUB-1 DEBUG-SUB-2 DEBUG-SUB-3 DEBUGGING DECIMAL-POINT DECLARATIVES DEFAULT DELETE DELIMITED DELIMITER DEPENDING DESCENDING DETAIL DISABLE DISC DISPLAY DIVIDE DIVISION DOWN DUPLICATES DYNAMIC EBCDIC EC ELSE ENABLE END END-ACCEPT END-ADD END-CALL END-COMPUTE END-DELETE END-DISPLAY END-DIVIDE END-EVALUATE END-IF END-INVOKE END-MULTIPLY END-OF-PAGE END-PERFORM END-READ END-RECEIVE END-RETURN END-REWRITE END-SEARCH END-START END-STRING END-SUBTRACT END-UNSTRING END-WRITE ENDING ENTRY ENVIRONMENT EO EOP EQUAL ERASE ERROR EVALUATE EVERY EXCEPTION EXCEPTION-OBJECT EXIT EXTEND EXTENDED EXTERNAL FACTORY FALSE FD FILE FILE-CONTROL FILLER FINAL FIRST FLOAT-EXTENDED FLOAT-LONG FLOAT-SHORT FOOTING FOR FORMAT FREE FROM FUNCTION FUNCTION-ID GENERATE GET GIVING GLOBAL GO GOBACK GREATER GROUP GROUP-USAGE HEADING HIGH-VALUE HIGH-VALUES I-O I-O-CONTROL ID IDENTIFICATION IF IGNORING IN INDEX INDEXED INDICATE INHERITS INITIAL INITIALIZE INITIATE INPUT INPUT-OUTPUT INSPECT INSTALLATION INTERFACE INTERFACE-ID INTO INVALID INVOKE IS JUST JUSTIFIED KEY LABEL LAST LEADING LEFT LENGTH LESS LIMITS LINAGE LINE LINE-COUNTER LINES LINKAGE LOCAL-STORAGE LOCALE LOCK LOW-VALUE LOW-VALUES MEMORY MERGE MESSAGE METHOD METHOD-ID MINUS MODE MODULES MORE-LABELS MOVE MULTIPLE MULTIPLY NATIONAL NATIONAL-EDITED NATIVE NEGATIVE NESTED NEXT NO NOT NULL NUMBER NUMERIC NUMERIC-EDITED OBJECT OBJECT-COMPUTER OBJECT-REFERENCE OCCURS OF OFF OMITTED ON OPEN OPTIONAL OPTIONS OR ORDER ORGANIZATION OTHER OUTPUT OVERFLOW OVERRIDE PACKED-DECIMAL PADDING PAGE PAGE-COUNTER PERFORM PF PH PIC PICTURE PLUS POINTER POSITION POSITIVE PRESENT PRINT-SWITCH PRINTING PROCEDURE PROCEED PROGRAM PROGRAM-ID PROGRAM-POINTER PROPERTY PROTOTYPE PURGE QUOTE QUOTES RAISE RAISING RANDOM RD READ RECEIVE RECORD RECORDING RECORDS REDEFINES REEL REFERENCE RELATIVE RELEASE REMAINDER REMOVAL RENAMES REPEATED REPLACE REPLACING REPORT REPORTING REPORTS REPOSITORY RERUN RESERVE RESET RESUME RETRY RETURN RETURNING REVERSED REWIND REWRITE RF RH RIGHT ROLLBACK ROUNDED RUN SAME SCREEN SD SEARCH SECTION SECURITY SEGMENT-LIMIT SELECT SELF SEND SENTENCE SEPARATE SEQUENCE SEQUENTIAL SET SHARING SIGN SIZE SORT SORT-MERGE SORT-TAPE SORT-TAPES SOURCE SOURCE-COMPUTER SOURCES SPACE SPACES SPECIAL-NAMES STANDARD STANDARD-1 STANDARD-2 START STATUS STOP STRING SUBTRACT SUM SUPER SUPPRESS SYMBOLIC SYNC SYNCHRONIZED SYSTEM-DEFAULT TABLE TALLY TALLYING TAPE TAPES TERMINAL TERMINATE TEST THAN THEN THROUGH THRU TIME TIMES TO TOP TRAILING TRUE TRY TYPE TYPEDEF UNIT UNITS UNIVERSAL UNLOCK UNSTRING UNTIL UP UPON USAGE USE USER-DEFAULT USING VAL-STATUS VALID VALIDATE VALIDATE-STATUS VALUE VALUES VARYING WHEN WITH WORDS WORKING-STORAGE WRITE ZERO ZEROES ZEROS /C2 CASE CONNECT CURRENT DATABASE-EXCEPTION DB DISCONNECT DUPLICATE EMPTY END-EXEC ESCAPE EXCLUSIVE EXEC FETCH FIND FINISH INCLUDING KEEP LIMITED MATCHING MEMBER MEMBERS MEMBERSHIP MODIFY OCCURENCE OWNER PERMANENT PRIOR PROTECTED READY REALM REALM-NAME RESULT RETAINING RETRIEVAL SELECTIVE SET-SELECTION SETS SORTED SQL STORE SUB-SCHEMA SUPPRESSING SYSTEM TENANT UPDATE USAGE-MODE VIA WITHIN /C3"COBOL Functions" ACOS ADDR ANNUITY ASIN ATAN BYTE-LENGTH CHAR CHAR-NATIONAL COS CURRENT-DATE DATE-OF-INTEGER DATE-TO-YYYYDDD DAY-OF-INTEGER DAY-TO-YYYYDDD DISPLAY-OF EXCEPTION-STATUS FACTORIAL INTEGER INTEGER-OF-DATE INTEGER-OF-DAY INTEGER-PART LENGTH LOG LOG10 LOWER-CASE MAX MEAN MEDIAN MIDRANGE MIN MOD NATIONAL-OF NUMVAL NUMVAL-C ORD ORD-MAX ORD-MIN PRESENT-VALUE RANDOM RANGE REM REVERSE SIN SQRT STANDARD-DEVIATION SUM TAN UPPER-CASE VARIANCE WHEN-COMPILED YEAR-TO-YYYY [/code] If you would like to compile the source, you have to add a tool with a link to the cygwin directory with the cobc.exe and the dll's needed to run... ---------------------------------------------------------------- I just found that the 'cream' text editor has a cobol syntax highlighting setting (menu: settings, filetype, [C], COBOL). Cream is based on vim, but don't worry it looks like a normal text editor so is not nearly as difficult to use. ---------------------------------------------------------------- Ok, I've been holding off on these ones as they need to be done consciencely (and are best suited to lazy fingered coders). ;) [b]Vim typing made faster[/b]... To swap the Escape and CapLock keys, so that the little finger doesn't need to stretch so far (and closer to where the Esc key was on the keyboard when Bill Joy first developed vi) [b]~/bin/.capswap[/b] [code] ! Swap caps lock and escape remove Lock = Caps_Lock keysym Escape = Caps_Lock keysym Caps_Lock = Escape add Lock = Caps_Lock [/code] [b]~/bin/capswap[/b] [code] xmodmap ~/bin/.capswap [/code] After a $ export PATH=~/bin:$PATH and a $ chmod u+x ~/bin/capswap, you can just type $ capswap at the start of a session when you'd like to vi in speed mode, and $ capswap to put things back to normal when finished. This is a tricky one to leave in an init file, though if you really do like swapping CapLock and Escape, this can be plopped into an xinitrc file, but that could well confuse the neighbours. I find it best to just type [b]capswap[/b] before edit sessions. Works great in tandem with mapping semicolon to colon [b] in ~/.vimrc[/b] [code] map ; : " if you like the ; repeat f, t find key " use the next bit and double semicolon will work " but it means semicolon will " pause while vi tries to resolve the double character " ambiguity, so I just give up having access to ; " and skip the noremap entry noremap ;; ; [/code] [i]Vim really is the best thing since sliced bread.[/i] ;) But these changes are not for those [i]familiar[/i] with normal vi edits. I just find these changes keep my wandering hands on the home row more often than not. Cheers, Brian ---------------------------------------------------------------- Yet another vim trick. Preload templates on new files. in [b]~/.vimrc[/b] [code] " Auto load COBOL template autocmd BufNewFile *.cob 0r ~/writing/cobol/headfix.cob [/code] Now [b]$ vi newcode.cob[/b] will load up your favourite startup empty program file. The example here reads in [i]headfix.cob[/i] from /home/brian/writing/cobol, so the filename after the 0r command will probably need to be customized. ;) Cheers, Brian ---------------------------------------------------------------- We gots to gits these in the add 1 repo.:D ---------------------------------------------------------------- A new interesting ide suitable for opencobol is Geany It uses the (great !) GTK libraries (like GtkCOBOL) and seems to be very useful for us... have a look at.. http://www.geany.org/Download/Releases#windowsBinaries Federico ---------------------------------------------------------------- Not very new (actually it's listed in the [url=http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=315&forum=1#forumpost1736]first page of this thread[/url]). Would be more interesting, if you could provide a debugging interface - see http://plugins.geany.org/debugger.html - for it (letting Geany handle the screen i/o). Simon 'human' Sobisch ---------------------------------------------------------------- For debugging I did that..just added the "animate" option [code] animate -x %e -k [/code] and then using the execute it runs the ani compiled build. it simple and runs fine. Could be useful upload an Opencobol-install (all-in-one) with editor, debugger and compiler just configured for windows users .. Federico ---------------------------------------------------------------- Has anyone looked at [url=http://ynohoo.braindog.org/CobTree/]CobTree[/url]? ---------------------------------------------------------------- @Federico: I meant to not use the source viewer of animator but of Geany (there is a contact address to the developer how to call the Geany debug interface). @GolfCat: I currently switch the Editor depending on my needs, with the right plugins Notepad++ is really nice. From a quick test CobTree seems only to work well if one uses COBOL-only files (problems in three view when header is in a copy file etc.), always uses sections (at least one is needed for seeing the paragraphs in the tree correct) and a paragraph directly after section definition is not shown. I miss syntax highlighting most. But all in all it seems to do what it should. Simon 'human' Sobisch ---------------------------------------------------------------- @Human: does the Notepad++ execute the cobc build from inside ? @GolfCat: Thanks for the information you sent but although specific for cobol, in my opinion, maybe it's too poor of features if compared to Notepad ++, PSPad or Geany. I miss syntax highlighting too. Federico ---------------------------------------------------------------- @federico: You can execute anything in Npp with the NppExec Plugin (and I guess you will do that for animator, too). See [url=http://iitdu.forumsmotion.com/t131-standard-c-compiler-in-notepad]this link[/url] for installation instructions+intro and [url=http://iitdu.forumsmotion.com/t131-standard-c-compiler-in-notepad#11678]that link (last post)[/url] for a sample script (in most environments I use, it would be important to set COB_COPY_DIR before executing cobc). While PSPad is nice (especially the log parser [leading you to the cobol source lines of cobc's messages] - if you find anything like that for NPP, please let me know) and has most features "out-of-the-box", it has some disturbing bugs. Simon 'human' Sobisch ---------------------------------------------------------------- Subject: MacOS X 10.5: absolute addressing not allowed in slidable image? Hi, I'm trying to compile OpenCOBOL 1.0 on MacOS 10.5 and getting an error about "absolute addressing not allowed in slidable image". Can anyone offer me any hints on what this means and what I should do to try to fix it? Is it a problem with the libgmp supplied with 10.5? Do I need to pass some extra flags somewhere? Also, I'm not sure why configure says "Use enhancedBerkeley DB (>= 4.1) no" when I have 4.7 installed. Configure and make output below. Thanks, Sarah 576$ export LDFLAGS='-L/usr/local/BerkeleyDB.4.7/lib' /usr/local/src/open-cobol-1.0 577$ ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... no checking for mawk... no checking for nawk... no checking for awk... awk checking whether make sets $(MAKE)... yes checking whether to enable maintainer-specific portions of Makefiles... no checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking how to run the C preprocessor... gcc -E checking for egrep... grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking whether ln -s works... yes checking for a BSD-compatible install... /usr/bin/install -c checking build system type... i386-apple-darwin9.4.0 checking host system type... i386-apple-darwin9.4.0 checking for a sed that does not truncate output... /usr/bin/sed checking for ld used by gcc... /usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld checking if the linker (/usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld) is GNU ld... no checking for /usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld option to reload object files... -r checking for BSD-compatible nm... /usr/bin/nm -p checking how to recognize dependent libraries... pass_all checking dlfcn.h usability... yes checking dlfcn.h presence... yes checking for dlfcn.h... yes checking the maximum length of command line arguments... 196608 checking command to parse /usr/bin/nm -p output from gcc object... rm: conftest.dSYM: is a directory rm: conftest.dSYM: is a directory rm: conftest.dSYM: is a directory rm: conftest.dSYM: is a directory ok checking for objdir... .libs checking for ar... ar checking for ranlib... ranlib checking for strip... strip rm: conftest.dSYM: is a directory rm: conftest.dSYM: is a directory checking if gcc supports -fno-rtti -fno-exceptions... rm: conftest.dSYM: is a directory no checking for gcc option to produce PIC... -fno-common checking if gcc PIC flag -fno-common works... rm: conftest.dSYM: is a directory yes checking if gcc static flag -static works... rm: conftest.dSYM: is a directory no checking if gcc supports -c -o file.o... rm: conftest.dSYM: is a directory yes checking whether the gcc linker (/usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld) supports shared libraries... yes checking dynamic linker characteristics... darwin9.4.0 dyld checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking for dlopen in -ldl... yes checking whether a program can dlopen itself... yes checking whether a statically linked program can dlopen itself... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes configure: creating libtool checking whether make sets $(MAKE)... (cached) yes checking for ANSI C header files... (cached) yes checking for stdint.h... (cached) yes checking for sys/types.h... (cached) yes checking signal.h usability... yes checking signal.h presence... yes checking for signal.h... yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking malloc.h usability... no checking malloc.h presence... no checking for malloc.h... no checking locale.h usability... yes checking locale.h presence... yes checking for locale.h... yes checking stddef.h usability... yes checking stddef.h presence... yes checking for stddef.h... yes checking wchar.h usability... yes checking wchar.h presence... yes checking for wchar.h... yes checking for dlfcn.h... (cached) yes checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking for an ANSI C-conforming const... yes checking whether byte ordering is bigendian... no checking for size_t... yes checking whether struct tm is in sys/time.h or time.h... time.h checking for inline... inline checking for working alloca.h... yes checking for alloca... yes checking for vprintf... yes checking for _doprnt... no checking for memmove... yes checking for memset... yes checking for regcomp... yes checking for setlocale... yes checking for fcntl... yes checking for strerror... yes checking for strcasecmp... yes checking for strchr... yes checking for strrchr... yes checking for strdup... yes checking for strstr... yes checking for strtol... yes checking for gettimeofday... yes checking for ld used by GCC... /usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld checking if the linker (/usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld) is GNU ld... no checking for shared library run path origin... done checking for iconv... yes checking how to link with libiconv... -liconv checking for iconv declaration... extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); checking for nl_langinfo and CODESET... yes checking for getopt_long_only... yes checking kpathsea/getopt.h usability... no checking kpathsea/getopt.h presence... no checking for kpathsea/getopt.h... no checking getopt.h usability... yes checking getopt.h presence... yes checking for getopt.h... yes checking gmp.h usability... yes checking gmp.h presence... yes checking for gmp.h... yes checking for __gmp_randinit in -lgmp... yes checking whether NLS is requested... yes checking for msgfmt... no checking for gmsgfmt... : checking for xgettext... no checking for msgmerge... no checking whether NLS is requested... yes checking for GNU gettext in libc... no checking for iconv... (cached) yes checking how to link with libiconv... -liconv checking for GNU gettext in libintl... no checking whether to use NLS... no checking ncurses.h usability... yes checking ncurses.h presence... yes checking for ncurses.h... yes checking pdcurses.h usability... no checking pdcurses.h presence... no checking for pdcurses.h... no checking ncurses/ncurses.h usability... no checking ncurses/ncurses.h presence... no checking for ncurses/ncurses.h... no checking curses.h usability... yes checking curses.h presence... yes checking for curses.h... yes checking for initscr in -lncurses... yes checking db.h usability... yes checking db.h presence... yes checking for db.h... yes checking db_185.h usability... no checking db_185.h presence... no checking for db_185.h... no checking db3/db_185.h usability... no checking db3/db_185.h presence... no checking for db3/db_185.h... no checking db4/db_185.h usability... no checking db4/db_185.h presence... no checking for db4/db_185.h... no checking db4.1/db_185.h usability... no checking db4.1/db_185.h presence... no checking for db4.1/db_185.h... no checking db4.2/db_185.h usability... no checking db4.2/db_185.h presence... no checking for db4.2/db_185.h... no checking db4.3/db_185.h usability... no checking db4.3/db_185.h presence... no checking for db4.3/db_185.h... no checking db4.4/db_185.h usability... no checking db4.4/db_185.h presence... no checking for db4.4/db_185.h... no checking db4.5/db_185.h usability... no checking db4.5/db_185.h presence... no checking for db4.5/db_185.h... no checking for __db_open in -ldb-4.5... no checking for dbopen in -ldb-4.5... no checking for __db_open in -ldb-4.4... no checking for dbopen in -ldb-4.4... no checking for __db_open in -ldb-4.3... no checking for dbopen in -ldb-4.3... no checking for __db_open in -ldb-4.2... no checking for dbopen in -ldb-4.2... no checking for __db_open in -ldb-4.1... no checking for dbopen in -ldb-4.1... no checking for __db_open in -ldb-4... yes checking for dlopen in -lc... yes configure: creating ./config.status config.status: creating cob-config config.status: creating Makefile config.status: creating lib/Makefile config.status: creating libcob/Makefile config.status: creating cobc/Makefile config.status: creating bin/Makefile config.status: creating po/Makefile.in config.status: creating texi/Makefile config.status: creating config/Makefile config.status: creating tests/atlocal config.status: creating tests/Makefile config.status: creating tests/cobol85/Makefile config.status: creating config.h config.status: config.h is unchanged config.status: executing tests/atconfig commands config.status: executing depfiles commands config.status: executing default-1 commands config.status: creating po/POTFILES config.status: creating po/Makefile OpenCOBOL Configuration: CC gcc COB_CC gcc CFLAGS -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k COB_CFLAGS -I/usr/local/include -O2 COB_EXTRA_FLAGS LDFLAGS -L/usr/local/BerkeleyDB.4.7/lib COB_LDFLAGS -L/usr/local/BerkeleyDB.4.7/lib COB_LIBS -L/usr/local/BerkeleyDB.4.7/lib -L${exec_prefix}/lib -lcob -lm -lgmp -lncurses -ldb-4 COB_CONFIG_DIR ${prefix}/share/open-cobol/config COB_LIBRARY_PATH .:${exec_prefix}/lib/open-cobol COB_MODULE_EXT dylib COB_SHARED_OPT -bundle -flat_namespace -undefined suppress COB_PIC_FLAGS -fno-common -DPIC COB_EXPORT_DYN COB_STRIP_CMD strip -x Dynamic loading System Use gettext for international messages: no Use Berkeley DB for file I/O: yes Use enhanced Berkeley DB (>= 4.1) no Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: yes /usr/local/src/open-cobol-1.0 578$ make Creating defaults.h... make all-recursive Making all in lib if gcc -DHAVE_CONFIG_H -I. -I. -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT dummymac.o -MD -MP -MF ".deps/dummymac.Tpo" -c -o dummymac.o dummymac.c; \ then mv -f ".deps/dummymac.Tpo" ".deps/dummymac.Po"; else rm -f ".deps/dummymac.Tpo"; exit 1; fi rm -f libsupport.a ar cru libsupport.a dummymac.o ranlib libsupport.a Making all in libcob if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF ".deps/libcob_la-common.Tpo" -c -o libcob_la-common.lo `test -f 'common.c' || echo './'`common.c; \ then mv -f ".deps/libcob_la-common.Tpo" ".deps/libcob_la-common.Plo"; else rm -f ".deps/libcob_la-common.Tpo"; exit 1; fi mkdir .libs gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF .deps/libcob_la-common.Tpo -c common.c -fno-common -DPIC -o .libs/libcob_la-common.o common.c: In function 'cob_accept_time': common.c:1437: warning: format '%2.2ld' expects type 'long int', but argument 3 has type 'int' gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF .deps/libcob_la-common.Tpo -c common.c -o libcob_la-common.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF ".deps/libcob_la-call.Tpo" -c -o libcob_la-call.lo `test -f 'call.c' || echo './'`call.c; \ then mv -f ".deps/libcob_la-call.Tpo" ".deps/libcob_la-call.Plo"; else rm -f ".deps/libcob_la-call.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF .deps/libcob_la-call.Tpo -c call.c -fno-common -DPIC -o .libs/libcob_la-call.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF .deps/libcob_la-call.Tpo -c call.c -o libcob_la-call.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF ".deps/libcob_la-strings.Tpo" -c -o libcob_la-strings.lo `test -f 'strings.c' || echo './'`strings.c; \ then mv -f ".deps/libcob_la-strings.Tpo" ".deps/libcob_la-strings.Plo"; else rm -f ".deps/libcob_la-strings.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF .deps/libcob_la-strings.Tpo -c strings.c -fno-common -DPIC -o .libs/libcob_la-strings.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF .deps/libcob_la-strings.Tpo -c strings.c -o libcob_la-strings.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-move.lo -MD -MP -MF ".deps/libcob_la-move.Tpo" -c -o libcob_la-move.lo `test -f 'move.c' || echo './'`move.c; \ then mv -f ".deps/libcob_la-move.Tpo" ".deps/libcob_la-move.Plo"; else rm -f ".deps/libcob_la-move.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-move.lo -MD -MP -MF .deps/libcob_la-move.Tpo -c move.c -fno-common -DPIC -o .libs/libcob_la-move.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-move.lo -MD -MP -MF .deps/libcob_la-move.Tpo -c move.c -o libcob_la-move.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF ".deps/libcob_la-numeric.Tpo" -c -o libcob_la-numeric.lo `test -f 'numeric.c' || echo './'`numeric.c; \ then mv -f ".deps/libcob_la-numeric.Tpo" ".deps/libcob_la-numeric.Plo"; else rm -f ".deps/libcob_la-numeric.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF .deps/libcob_la-numeric.Tpo -c numeric.c -fno-common -DPIC -o .libs/libcob_la-numeric.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF .deps/libcob_la-numeric.Tpo -c numeric.c -o libcob_la-numeric.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic.lo -MD -MP -MF ".deps/libcob_la-intrinsic.Tpo" -c -o libcob_la-intrinsic.lo `test -f 'intrinsic.c' || echo './'`intrinsic.c; \ then mv -f ".deps/libcob_la-intrinsic.Tpo" ".deps/libcob_la-intrinsic.Plo"; else rm -f ".deps/libcob_la-intrinsic.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic.lo -MD -MP -MF .deps/libcob_la-intrinsic.Tpo -c intrinsic.c -fno-common -DPIC -o .libs/libcob_la-intrinsic.o intrinsic.c: In function 'cob_intr_current_date': intrinsic.c:822: warning: format '%2.2ld' expects type 'long int', but argument 3 has type 'int' gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic.lo -MD -MP -MF .deps/libcob_la-intrinsic.Tpo -c intrinsic.c -o libcob_la-intrinsic.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF ".deps/libcob_la-fileio.Tpo" -c -o libcob_la-fileio.lo `test -f 'fileio.c' || echo './'`fileio.c; \ then mv -f ".deps/libcob_la-fileio.Tpo" ".deps/libcob_la-fileio.Plo"; else rm -f ".deps/libcob_la-fileio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF .deps/libcob_la-fileio.Tpo -c fileio.c -fno-common -DPIC -o .libs/libcob_la-fileio.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF .deps/libcob_la-fileio.Tpo -c fileio.c -o libcob_la-fileio.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-termio.lo -MD -MP -MF ".deps/libcob_la-termio.Tpo" -c -o libcob_la-termio.lo `test -f 'termio.c' || echo './'`termio.c; \ then mv -f ".deps/libcob_la-termio.Tpo" ".deps/libcob_la-termio.Plo"; else rm -f ".deps/libcob_la-termio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-termio.lo -MD -MP -MF .deps/libcob_la-termio.Tpo -c termio.c -fno-common -DPIC -o .libs/libcob_la-termio.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-termio.lo -MD -MP -MF .deps/libcob_la-termio.Tpo -c termio.c -o libcob_la-termio.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-screenio.lo -MD -MP -MF ".deps/libcob_la-screenio.Tpo" -c -o libcob_la-screenio.lo `test -f 'screenio.c' || echo './'`screenio.c; \ then mv -f ".deps/libcob_la-screenio.Tpo" ".deps/libcob_la-screenio.Plo"; else rm -f ".deps/libcob_la-screenio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-screenio.lo -MD -MP -MF .deps/libcob_la-screenio.Tpo -c screenio.c -fno-common -DPIC -o .libs/libcob_la-screenio.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-screenio.lo -MD -MP -MF .deps/libcob_la-screenio.Tpo -c screenio.c -o libcob_la-screenio.o >/dev/null 2>&1 /bin/sh ../libtool --tag=CC --mode=link gcc -DSUPER_OPTIMIZE -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -L/usr/local/BerkeleyDB.4.7/lib -o libcob.la -rpath /usr/local/lib -version-info 1:0:0 -no-undefined libcob_la-common.lo libcob_la-call.lo libcob_la-strings.lo libcob_la-move.lo libcob_la-numeric.lo libcob_la-intrinsic.lo libcob_la-fileio.lo libcob_la-termio.lo libcob_la-screenio.lo -lm -lgmp -lncurses -ldb-4 gcc -dynamiclib -o .libs/libcob.1.0.0.dylib .libs/libcob_la-common.o .libs/libcob_la-call.o .libs/libcob_la-strings.o .libs/libcob_la-move.o .libs/libcob_la-numeric.o .libs/libcob_la-intrinsic.o .libs/libcob_la-fileio.o .libs/libcob_la-termio.o .libs/libcob_la-screenio.o -L/usr/local/BerkeleyDB.4.7/lib -lm /usr/local/lib/libgmp.a -lncurses -ldb-4 -install_name /usr/local/lib/libcob.1.dylib -compatibility_version 2 -current_version 2.0 ld: absolute addressing (perhaps -mdynamic-no-pic) used in ___gmpn_add_n from /usr/local/lib/libgmp.a(add_n.o) not allowed in slidable image. Use '-read_only_relocs suppress' to enable text relocs collect2: ld returned 1 exit status make[2]: *** [libcob.la] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 /usr/local/src/open-cobol-1.0 579$ ---------------------------------------------------------------- Well, it looks like it is probably a linker issue between GMP and MacOS X: http://gmplib.org/macos.html Sadly, the GMP people say "it's not our problem, talk to Apple"... which probably wouldn't help either. I thought maybe if I compiled my own copy of GMP, I could get it to work... so I tried that. GMP built ok with the defaults, but still wouldn't link. Then I tried building GMP with --disable-shared, but then OpenCOBOL's configure couldn't find the static library. From reading the description of the problem on the GMP page, it's still not entirely clear to me exactly how fixable this problem really is, since the GMP page says in part, "Apple uses unique conventions for position independent code (PIC) on X86/32. The GMP assembly code does not yet handle this." So, I guess I'm still stuck... :-( Sarah ---------------------------------------------------------------- See http://gmp.darwinports.com/ or alternatively from fink - http://pdb.finkproject.org/pdb/browse.php?summary=gmp For the BDB thing, you correctly specified LDFLAGS but forgot CPPFLAGS, see ./configure --help Roger ---------------------------------------------------------------- Thanks, Roger, your tips did the trick! It's working now. I can't believe I forgot the CPPFLAGS; I haven't had to build stuff from source in quite a while, I guess! Just for reference for the next person who's stuck on this, here are my notes on what I did to get everything to work. Thanks again, Sarah # # How to build OpenCOBOL for MacOS 10.5 # Starting with generic 10.5 install with developer tools installed # Note: these are notes, not a script! # # # 1. Install MacPorts... installed via gui # # http://www.portcode.com/darwinports/DarwinPorts-1.6.0-10.5-Leopard.dmg # # 2. Install gmp via macports # cd /opt/local/bin sudo ./port install gmp # Puts libs in /opt/local/lib # Puts headers in /opt/local/include # # 3. Download berkeley db, the unpack in /usr/local/src # # http://www.oracle.com/technology/software/products/berkeley-db/db/index.html cd /usr/local/src/db-4.7.25/build_unix ../dist/configure make make install # Puts libs in /usr/local/BerkeleyDB.4.7/lib # Puts headers in /usr/local/BerkeleyDB.4.7/include # # 4. Download OpenCOBOL 1.0, then unpack in /usr/local/src # export LDFLAGS="-L/usr/local/BerkeleyDB.4.7/lib -L/opt/local/lib" export CPPFLAGS="-I/usr/local/BerkeleyDB.4.7/include -I/opt/local/include" cd /usr/local/src/open-cobol-1.0 ./configure make make install # # 5. Did it work? # ls /usr/local/bin/cobc /usr/local/bin/cobc -h ---------------------------------------------------------------- Good to know. I see Oracle still have not changed their default install directory, geez. You can change that by specifying --prefix to the BDB configure eg. ../dist/configure --prefix=/usr/local (or /usr if you prefer) If the specified directory is automatically searched for includes/libs by the system, then you do not need to specify the xxFLAGS for the OC configure. For OC, do not forget (ie. always do) a "make check" at some point after the "make" or "make install". I also recommend running the NIST 85 test suite as well as mentioned in the main README; see tests/cobol85/README. Roger ---------------------------------------------------------------- Subject: POSIX Message Queues Hello team, Found a little time to polish a first cut of a Message Queue example. Hard to make short examples, so excuse the longish post once again. Note; NOTIFY not yet ready for publication, so more soon. Plus, this example is a single process so not really indicative of real interprocess communications, so even more reason for more soon. Cygwin users will need 1.7 and that release is still in beta, but if you are really really jonesin' to try it, google Cygwin setup-1.7 for instructions AND WARNINGS ABOUT SCREWING UP 1.5 installs. $ man mq_overview for details on accessing the queues from Debian's filesystem with tools like rm, cat, echo > etc. Cheers, Brian P.S. Still feel like an amateur, so comments welcome. Two parts, C code module and a sample [code] /* OpenCOBOL access to POSIX Message Queues */ /* Author: Brian Tiffin */ /* Date: August, 2008 */ /* Build: gcc -c ocmq.c */ /* Usage: cobc -x -lrt program.cob ocmq.o */ #include /* For O_* constants */ #include /* For mode constants */ #include /* Access to error values */ #include /* The message queues */ #include #include /* For strerror */ /* Return C runtime global errno */ int ERRORNUMBER() { return errno; } /* Load a COBOL field with an error string */ int ERRORSTRING(char *errbuff, int buflen) { void *temperr; temperr = strerror(errno); memcpy((void *)errbuff, temperr, buflen); return strlen(temperr); } /* /* Open Message Queue */ int MQOPEN(char *mqname, int oflags) { mqd_t mqres; errno = 0; mqres = mq_open(mqname, oflags); return (int)mqres; } /* Creating a queue requires two extra arguments, permissions and attributes */ int MQCREATE(char *mqname, int oflags, int perms, char *mqattr) { mqd_t mqres; errno = 0; mqres = mq_open(mqname, oflags, (mode_t)perms, (struct mq_attr *)mqattr); return (int)mqres; } /* Get current queue attributes */ int MQGETATTR(int mqid, char *mqattr) { mqd_t mqres; errno = 0; mqres = mq_getattr((mqd_t)mqid, (struct mq_attr *)mqattr); return (int)mqres; } /* Set current queue attributes */ /* only accepts mqflags of 0 or MQO-NONBLOCK once created */ int MQSETATTR(int mqid, char *mqattr, char *oldattr) { mqd_t mqres; errno = 0; mqres = mq_setattr((mqd_t)mqid, (struct mq_attr *)mqattr, (struct mq_attr *)oldattr); return (int)mqres; } /* Send a message to the queue */ int MQSEND(int mqid, char *message, int length, unsigned int mqprio) { mqd_t mqres; errno = 0; mqres = mq_send((mqd_t)mqid, message, (size_t)length, mqprio); return (int)mqres; } /* Read the highest priority message */ int MQRECEIVE(int mqid, char *msgbuf, int buflen, int *retprio) { ssize_t retlen; errno = 0; retlen = mq_receive((mqd_t)mqid, msgbuf, buflen, retprio); return (int)retlen; } /* Close a queue */ int MQCLOSE(int mqid) { mqd_t mqres; errno = 0; mqres = mq_close((mqd_t)mqid); return (int)mqres; } /* Unlink a queue */ int MQUNLINK(char *mqname) { mqd_t mqres; errno = 0; mqres = mq_unlink(mqname); return (int)mqres; } [/code] [code] >>SOURCE FORMAT IS FIXED ****************************************************************** * Author: Brian Tiffin * Date: August 2008 * Purpose: Demonstration of OpenCOBOL message queues * Tectonics: gcc -c ocmq.c * cobc -Wall -x -lrt mqsample.cob ocmq.o ****************************************************************** identification division. program-id. mqsample. data division. working-storage section. * Constants for the Open Flags 01 MQO-RDONLY constant as 0. 01 MQO-WRONLY constant as 1. 01 MQO-RDWR constant as 2. 01 MQO-CREAT constant as 64. 01 MQO-EXCL constant as 128. 01 MQO-NONBLOCK constant as 2048. * Constants for the protection/permission bits 01 MQS-IREAD constant as 256. 01 MQS-IWRITE constant as 128. * Need a better way of displaying newlines 01 newline pic x value x'0a'. * Message Queues return an ID, maps to int 01 mqid usage binary-long. 01 mqres usage binary-long. * Queue names end up in an mqueue virtual filesystem on GNU/Linux 01 mqname. 02 name-display pic x(5) value "/ocmq". 02 filler pic x value x'00'. 01 mqopenflags usage binary-long. 01 mqpermissions usage binary-long. 01 default-message pic x(20) value 'OpenCOBOL is awesome'. 01 user-message pic x(80). 01 send-length usage binary-long. 01 urgent-message pic x(20) value 'Urgent OpenCOBOL msg'. * Data members for access to C global errno and error strings 01 errnumber usage binary-long. 01 errstr pic x(256). * legend to use with the error reporting 01 operation pic x(7). * Debian GNU/Linux defaults to Message Queue entry limit of 8K 01 msgbuf pic x(8192). 01 msglen usage binary-long value 8192. * Priorities range from 0 to 31 on many systems, can be more 01 msgprio usage binary-long. * MQ attributes. See /usr/include/bits/mqueue.h 01 mqattr. 03 mqflags usage binary-long. 03 mqmaxmsg usage binary-long. 03 mqmsgsize usage binary-long. 03 mqcurmsqs usage binary-long. 03 filler usage binary-long occurs 4 times. 01 oldattr. 03 mqflags usage binary-long. 03 mqmaxmsg usage binary-long. 03 mqmsgsize usage binary-long. 03 mqcurmsqs usage binary-long. 03 filler usage binary-long occurs 4 times. procedure division. * The ocmq API support MQCREATE and MQOPEN. * This example uses non blocking, non exclusive create * read/write by owner and default attributes compute mqopenflags = MQO-RDWR + MQO-CREAT + MQO-NONBLOCK end-compute. compute mqpermissions = MQS-IREAD + MQS-IWRITE end-compute. * Sample shows the two types of open, but only evaluates create if zero = zero call "MQCREATE" using mqname by value mqopenflags by value mqpermissions by value 0 returning mqid end-call else call "MQOPEN" using mqname by value mqopenflags returning mqid end-call end-if. move "create" to operation. perform show-error. * Show the attributes after initial create perform show-attributes. * Create a temporary queue, will be removed on close call "MQUNLINK" using mqname returning mqres end-call. move "unlink" to operation. perform show-error. * Use the command line arguments or a default message accept user-message from command-line end-accept. if user-message equal spaces move default-message to user-message end-if. move function length (function trim(user-message trailing)) to send-length. * Queue up an urgent message (priority 31) call "MQSEND" using by value mqid by reference urgent-message by value 20 by value 31 end-call. move "send-31" to operation. perform show-error. * Queue up a low priority message (1) call "MQSEND" using by value mqid by reference user-message by value send-length by value 1 returning mqres end-call. move "send-1" to operation. perform show-error. * Queue up a middle priority message (16) inspect urgent-message replacing leading "Urgent" by "Middle". call "MQSEND" using by value mqid by reference urgent-message by value 20 by value 16 returning mqres end-call. move "send-16" to operation. perform show-error. * Redisplay the queue attributes perform show-attributes. * Pull highest priority message off queue call "MQRECEIVE" using by value mqid by reference msgbuf by value msglen by reference msgprio returning mqres end-call. display newline "recieve len: " mqres " prio: " msgprio end-display. if mqres > 0 display "priority 31 message: " msgbuf(1:mqres) end-display end-if. move "receive" to operation. perform show-error. * Pull the middling priority message off queue call "MQRECEIVE" using by value mqid by reference msgbuf by value msglen by reference msgprio returning mqres end-call. display newline "recieve len: " mqres " prio: " msgprio end-display. if mqres > 0 display "priority 16 message: " msgbuf(1:mqres) end-display end-if. move "receive" to operation. perform show-error. * ** INTENTIONAL ERROR msglen param too small ** * Pull message off queue call "MQRECEIVE" using by value mqid by reference msgbuf by value 1024 by reference msgprio returning mqres end-call. display newline "recieve len: " mqres " prio: " msgprio end-display. if mqres > 0 display "no message: " msgbuf(1:mqres) end-display end-if. move "receive" to operation. perform show-error. * Pull the low priority message off queue, in blocking mode move 0 to mqflags of mqattr. call "MQSETATTR" using by value mqid by reference mqattr by reference oldattr returning mqres end-call move "setattr" to operation. perform show-error. perform show-attributes. call "MQRECEIVE" using by value mqid by reference msgbuf by value msglen by reference msgprio returning mqres end-call. display newline "recieve len: " mqres " prio: " msgprio end-display. if mqres > 0 display "priority 1 message: " msgbuf(1:mqres) end-display end-if. move "receive" to operation. perform show-error. * Close the queue. As it is set unlinked, it will be removed call "MQCLOSE" using by value mqid returning mqres end-call. move "close" to operation. perform show-error. goback. ****************************************************************** * Information display of the Message Queue attributes. show-attributes. call "MQGETATTR" using by value mqid by reference mqattr returning mqres end-call move "getattr" to operation. perform show-error. * Display the message queue attributes display name-display " attributes:" newline "flags: " mqflags of mqattr newline "max msg: " mqmaxmsg of mqattr newline "mqs size: " mqmsgsize of mqattr newline "cur msgs: " mqcurmsqs of mqattr end-display . * The C global errno error display paragraph show-error. call "ERRORNUMBER" returning mqres end-call if mqres > 0 display operation " errno: " mqres end-display call "ERRORSTRING" using errstr by value length errstr returning mqres end-call if mqres > 0 display " strerror: " errstr(1:mqres) end-display end-if end-if . [/code] Sample run [code] /ocmq attributes: flags: +0000002048 max msg: +0000000010 mqs size: +0000008192 cur msgs: +0000000000 /ocmq attributes: flags: +0000002048 max msg: +0000000010 mqs size: +0000008192 cur msgs: +0000000003 recieve len: +0000000020 prio: +0000000031 priority 31 message: Urgent OpenCOBOL msg recieve len: +0000000020 prio: +0000000016 priority 16 message: Middle OpenCOBOL msg recieve len: -0000000001 prio: +0000000016 receive errno: +0000000090 strerror: Message too long /ocmq attributes: flags: +0000000000 max msg: +0000000010 mqs size: +0000008192 cur msgs: +0000000001 recieve len: +0000000020 prio: +0000000001 priority 1 message: OpenCOBOL is awesome [/code] ---------------------------------------------------------------- Hello good people, Once again, excuse the length of the post. I think I'm posting this a little early. (Well, I know I am). I'd like to get rid of the hardcoded signal handling procedure name, MQPROCESSOR. The C code will also eventually need WIN32 conditionals, so treat this a .9 beta tester release. Next one should be a complete 1.0. Hopefully the real release will alleviate burden of C null bytes from the OpenCOBOL development side, the error message buflen requirement, etc... This example posts an MQNOTIFY inside a server. Requires a secondary process to send to the IPC message queue. Waits 8 times for one minute. The sample mqsender sends three messages per run. So the server will finish after 8 minutes or three runs of mqsender (with the last message dropped and forgotten from the unlinked queue). Note the MQPROCESSOR source code is included with the mqserver example. OpenCOBOL is pretty cool. Could have included COPY text for sharing between mqserver and mqsender but didn't. Also note, that usually messages are pulled as written. They may not be prioritized as the previous sample as there is usually only one. Timed Send and Timed Receive for BLOCKING message queues are supported as well. Adds seconds to current epoch time and sets nanos. Unlike absolute times of the actual mq_timedsend and mq_timedreceive calls. No sample of BLOCKING queues. Left as an execise for the reader. Read up on mq_notify to see how it will only fire when an EMPTY queue gets a message. If you post messages then call the mqserver example, nothing will happen until the the queue is emptied and then written to. Only GNU/Linux as yet. Cheers, Brian [code] /* OpenCOBOL access to POSIX Message Queues */ /* Author: Brian Tiffin */ /* Date: August, 2008 */ /* Build: gcc -c ocmq.c */ /* Usage: cobc -x -lrt program.cob ocmq.o */ #include /* For O_* constants */ #include /* For mode constants */ #include /* Access to error values */ #include /* The message queues */ #include /* for notification */ #include /* for the timed versions */ #include #include /* For strerror */ #include /* for cob_resolve */ /* Forward declarations */ static void ocmq_handler(int, siginfo_t *, void *); static void (*MQHANDLER)(int *mqid); /* Return C runtime global errno */ int ERRORNUMBER() { return errno; } /* Load a COBOL field with an error string */ int ERRORSTRING(char *errbuff, int buflen) { void *temperr; temperr = strerror(errno); memcpy((void *)errbuff, temperr, buflen); return strlen(temperr); } /* /* Open Message Queue */ int MQOPEN(char *mqname, int oflags) { mqd_t mqres; errno = 0; mqres = mq_open(mqname, oflags); return (int)mqres; } /* Creating a queue requires two extra arguments, permissions and attributes */ int MQCREATE(char *mqname, int oflags, int perms, char *mqattr) { mqd_t mqres; errno = 0; mqres = mq_open(mqname, oflags, (mode_t)perms, (struct mq_attr *)mqattr); return (int)mqres; } /* Get current queue attributes */ int MQGETATTR(int mqid, char *mqattr) { mqd_t mqres; errno = 0; mqres = mq_getattr((mqd_t)mqid, (struct mq_attr *)mqattr); return (int)mqres; } /* Set current queue attributes */ /* only accepts mqflags of 0 or MQO-NONBLOCK once created */ int MQSETATTR(int mqid, char *mqattr, char *oldattr) { mqd_t mqres; errno = 0; mqres = mq_setattr((mqd_t)mqid, (struct mq_attr *)mqattr, (struct mq_attr *)oldattr); return (int)mqres; } /* Send a message to the queue */ int MQSEND(int mqid, char *message, int length, unsigned int mqprio) { mqd_t mqres; errno = 0; mqres = mq_send((mqd_t)mqid, message, (size_t)length, mqprio); return (int)mqres; } /* Read the highest priority message */ int MQRECEIVE(int mqid, char *msgbuf, int buflen, int *retprio) { ssize_t retlen; errno = 0; retlen = mq_receive((mqd_t)mqid, msgbuf, buflen, retprio); return (int)retlen; } /* Timeout send */ int MQTIMEDSEND(int mqid, char *message, int length, unsigned int mqprio, int secs, long nanos) { mqd_t mqres; struct timespec mqtimer; struct timeval curtime; /* Expect seconds and nanos to wait, not absolute. Add the OpenCOBOL values */ gettimeofday(&curtime, NULL); mqtimer.tv_sec = curtime.tv_sec + (time_t)secs; mqtimer.tv_nsec = nanos; errno = 0; mqres = mq_timedsend((mqd_t)mqid, message, (size_t)length, mqprio, &mqtimer); return (int)mqres; } /* Read the highest priority message */ int MQTIMEDRECEIVE(int mqid, char *msgbuf, int buflen, int *retprio, int secs, long nanos) { ssize_t retlen; struct timespec mqtimer; struct timeval curtime; /* Expect seconds and nanos to wait, not absolute. Add the OpenCOBOL values */ gettimeofday(&curtime, NULL); mqtimer.tv_sec = curtime.tv_sec + (time_t)secs; mqtimer.tv_nsec = nanos; errno = 0; retlen = mq_timedreceive((mqd_t)mqid, msgbuf, buflen, retprio, &mqtimer); return (int)retlen; } /* Notify of new message written to queue */ int MQNOTIFY(int mqid, char *procedure) { struct sigevent ocsigevent; struct sigaction ocsigaction; /* Install signal handler for the notify signal - fill in a * sigaction structure and pass it to sigaction(). Because the * handler needs the siginfo structure as an argument, the * SA_SIGINFO flag is set in sa_flags. */ ocsigaction.sa_sigaction = ocmq_handler; ocsigaction.sa_flags = SA_SIGINFO; sigemptyset(&ocsigaction.sa_mask); if (sigaction(SIGUSR1, &ocsigaction, NULL) == -1) { fprintf(stderr, "%s\n", "Error posting sigaction"); return -1; } /* Set up notification: fill in a sigevent structure and pass it * to mq_notify(). The queue ID is passed as an argument to the * signal handler. */ ocsigevent.sigev_signo = SIGUSR1; ocsigevent.sigev_notify = SIGEV_SIGNAL; ocsigevent.sigev_value.sival_int = (int)mqid; if (mq_notify((mqd_t)mqid, &ocsigevent) == -1) { fprintf(stderr, "%s\n", "Error posting notify"); return -1; } return 0; } /* Close a queue */ int MQCLOSE(int mqid) { mqd_t mqres; errno = 0; mqres = mq_close((mqd_t)mqid); return (int)mqres; } /* Unlink a queue */ int MQUNLINK(char *mqname) { mqd_t mqres; errno = 0; mqres = mq_unlink(mqname); return (int)mqres; } /* The signal handling section */ /* signal number */ /* signal information */ /* context unused (required by posix) */ static void ocmq_handler(int sig, siginfo_t *pInfo, void *pSigContext) { struct sigevent ocnotify; mqd_t mqid; /* Get the ID of the message queue out of the siginfo structure. */ mqid = (mqd_t) pInfo->si_value.sival_int; /* The MQPROCESSOR is a hardcoded OpenCOBOL resolvable module name */ /* It must accept an mqd_t pointer */ cob_init(0, NULL); MQHANDLER = cob_resolve("MQPROCESSOR"); if (MQHANDLER == NULL) { /* What to do here? */ fprintf(stderr, "%s\n", "Error resolving MQPROCESSOR"); return; } /* Request notification again; it resets each time a notification * signal goes out. */ ocnotify.sigev_signo = pInfo->si_signo; ocnotify.sigev_value = pInfo->si_value; ocnotify.sigev_notify = SIGEV_SIGNAL; if (mq_notify(mqid, &ocnotify) == -1) { /* What to do here? */ fprintf(stderr, "%s\n", "Error posting notify"); return; } /* Call the cobol module with the message queue id */ MQHANDLER(&mqid); return; } [/code] The server OpenCOBOL. Waits for mqsender to post messages to the queue. If it abends before unlinking the queue and restarts, the notify will NOT fire. Notify only fires if an EMPTY queue gets messages. [code] >>SOURCE FORMAT IS FIXED ****************************************************************** * Author: Brian Tiffin * Date: August 2008 * Purpose: Demonstration of OpenCOBOL message queues * Tectonics: gcc -c ocmq.c * cobc -Wall -x -lrt mqserver.cob ocmq.o ****************************************************************** identification division. program-id. mqserver. data division. working-storage section. * Constants for the Open Flags 01 MQO-RDONLY constant as 0. 01 MQO-WRONLY constant as 1. 01 MQO-RDWR constant as 2. 01 MQO-CREAT constant as 64. 01 MQO-EXCL constant as 128. 01 MQO-NONBLOCK constant as 2048. * Constants for the protection/permission bits 01 MQS-IREAD constant as 256. 01 MQS-IWRITE constant as 128. * Need a better way of displaying newlines 01 newline pic x value x'0a'. * Need a better way to handle verbosity 01 verbosity pic 9 value 1. 88 verbose value 1. * Message Queues return an ID, maps to int 01 mqid usage binary-long. 01 mqres usage binary-long. * Queue names end up in an mqueue virtual filesystem on GNU/Linux 01 mqname. 02 name-display pic x(5) value "/ocmq". 02 filler pic x value x'00'. 01 mqopenflags usage binary-long. 01 mqpermissions usage binary-long. * Place name of MQNOTIFY OpenCOBOL signal handler procedure here * NOT YET IMPLEMENTED. ocmq assumes hardcoded MQPROCESSOR 01 mqprocedure. 02 procedure-name pic x(11) value "MQPROCESSOR". 02 filler pic x value low-value. 01 default-message pic x(20) value 'OpenCOBOL is awesome'. 01 user-message pic x(80). 01 send-length usage binary-long. 01 urgent-message pic x(20) value 'Urgent OpenCOBOL msg'. * Data members for access to C global errno and error strings 01 errnumber usage binary-long. 01 errstr pic x(256). * legend to use with the error reporting 01 operation pic x(7). * Setup a waiting loop for 9 one minute intervals 01 loopy pic 9. * Debian GNU/Linux defaults to Message Queue entry limit of 8K 01 msgbuf pic x(8192). 01 msglen usage binary-long value 8192. * Priorities range from 0 to 31 on many systems, can be more 01 msgprio usage binary-long. * MQ attributes. See /usr/include/bits/mqueue.h 01 mqattr. 03 mqflags usage binary-long. 03 mqmaxmsg usage binary-long. 03 mqmsgsize usage binary-long. 03 mqcurmsqs usage binary-long. 03 filler usage binary-long occurs 4 times. 01 oldattr. 03 mqflags usage binary-long. 03 mqmaxmsg usage binary-long. 03 mqmsgsize usage binary-long. 03 mqcurmsqs usage binary-long. 03 filler usage binary-long occurs 4 times. procedure division. * The ocmq API support MQCREATE and MQOPEN. * This example uses non blocking, non exclusive create * read/write by owner and default attributes compute mqopenflags = MQO-RDWR + MQO-CREAT + MQO-NONBLOCK end-compute. compute mqpermissions = MQS-IREAD + MQS-IWRITE end-compute. * Sample shows the two types of open, but only evaluates create if zero = zero call "MQCREATE" using mqname by value mqopenflags by value mqpermissions by value 0 returning mqid end-call else call "MQOPEN" using mqname by value mqopenflags returning mqid end-call end-if. move "create" to operation. perform show-error. * Show the attributes after initial create if verbose perform show-attributes end-if. * Register notification call "MQNOTIFY" using by value mqid by reference mqprocedure returning mqres end-call. move "notify" to operation. perform show-error. * Main sleeper loop. Expectation is to awake on NOTIFY signal * In this example, sleep in 1 minute intervals, looping 8 times perform varying loopy from 1 by 1 until loopy > 8 display "Waiting... " loopy end-display call "CBL_OC_NANOSLEEP" using 60000000000 returning mqres end-call end-perform. * Close the queue. When unlinked, it will be removed call "MQCLOSE" using by value mqid returning mqres end-call. move "close" to operation. perform show-error. * Will be removed on last close, but no new opens allowed call "MQUNLINK" using mqname returning mqres end-call. move "unlink" to operation. perform show-error. goback. ****************************************************************** * Information display of the Message Queue attributes. show-attributes. call "MQGETATTR" using by value mqid by reference mqattr returning mqres end-call move "getattr" to operation. perform show-error. * Display the message queue attributes display name-display " attributes:" newline "flags: " mqflags of mqattr newline "max msgs: " mqmaxmsg of mqattr newline "msg size: " mqmsgsize of mqattr newline "cur msgs: " mqcurmsqs of mqattr end-display . * The C global errno error display paragraph show-error. call "ERRORNUMBER" returning mqres end-call if mqres > 0 display operation " errno: " mqres end-display call "ERRORSTRING" using errstr by value length errstr returning mqres end-call if mqres > 0 display " strerror: " errstr(1:mqres) end-display end-if end-if . end program mqserver. ****************************************************************** * Author: Brian Tiffin * Date: August 2008 * Purpose: Demonstration of OpenCOBOL message queue notification * Tectonics: See mqserver above. * NOTE: The procedure MQPROCESSOR is hardcoded * in ocmq, in the ocmq_handler signal function ****************************************************************** identification division. program-id. MQPROCESSOR. data division. working-storage section. 01 msgbuf pic x(8192). 01 msglen usage binary-long value 8192. 01 msgprio usage binary-long. 01 mqres usage binary-long. linkage section. 01 mqid usage binary-long. * This procedure is called from within an mq_notify signal * handler, and the MQPROCESSOR module name is hard coded * in ocmq.c procedure division using mqid. * Pull all messages from queue, * highest priority message will pull off first perform with test after until mqres <= 0 call "MQRECEIVE" using by value mqid by reference msgbuf by value msglen by reference msgprio returning mqres end-call if mqres > 0 display "recieve len: " mqres " prio: " msgprio end-display display "message: " msgbuf(1:mqres) end-display end-if * move "receive" to operation * perform show-error end-perform. goback. end program MQPROCESSOR. [/code] And a sample message sender, mqsender.cob. Sends three messages per run. Lots of superfluous code here... [code] >>SOURCE FORMAT IS FIXED ****************************************************************** * Author: Brian Tiffin * Date: August 2008 * Purpose: Demonstration of OpenCOBOL message queues * Tectonics: gcc -c ocmq.c * cobc -Wall -x -lrt mqsender.cob ocmq.o ****************************************************************** identification division. program-id. mqsender. data division. working-storage section. * Constants for the Open Flags 01 MQO-RDONLY constant as 0. 01 MQO-WRONLY constant as 1. 01 MQO-RDWR constant as 2. 01 MQO-CREAT constant as 64. 01 MQO-EXCL constant as 128. 01 MQO-NONBLOCK constant as 2048. * Constants for the protection/permission bits 01 MQS-IREAD constant as 256. 01 MQS-IWRITE constant as 128. * Need a better way of displaying newlines 01 newline pic x value x'0a'. * Message Queues return an ID, maps to int 01 mqid usage binary-long. 01 mqres usage binary-long. * Queue names end up in an mqueue virtual filesystem on GNU/Linux 01 mqname. 02 name-display pic x(5) value "/ocmq". 02 filler pic x value x'00'. 01 mqopenflags usage binary-long. 01 mqpermissions usage binary-long. 01 default-message pic x(20) value 'OpenCOBOL is awesome'. 01 user-message pic x(80). 01 send-length usage binary-long. 01 urgent-message pic x(20) value 'Urgent OpenCOBOL msg'. * Data members for access to C global errno and error strings 01 errnumber usage binary-long. 01 errstr pic x(256). * legend to use with the error reporting 01 operation pic x(7). * Debian GNU/Linux defaults to Message Queue entry limit of 8K 01 msgbuf pic x(8192). 01 msglen usage binary-long value 8192. * Priorities range from 0 to 31 on many systems, can be more 01 msgprio usage binary-long. * MQ attributes. See /usr/include/bits/mqueue.h 01 mqattr. 03 mqflags usage binary-long. 03 mqmaxmsg usage binary-long. 03 mqmsgsize usage binary-long. 03 mqcurmsqs usage binary-long. 03 filler usage binary-long occurs 4 times. 01 oldattr. 03 mqflags usage binary-long. 03 mqmaxmsg usage binary-long. 03 mqmsgsize usage binary-long. 03 mqcurmsqs usage binary-long. 03 filler usage binary-long occurs 4 times. procedure division. * The ocmq API support MQCREATE and MQOPEN. * This example uses non blocking, non exclusive create * read/write by owner and default attributes compute mqopenflags = MQO-RDWR + MQO-CREAT + MQO-NONBLOCK end-compute. compute mqpermissions = MQS-IREAD + MQS-IWRITE end-compute. * Sample shows the two types of open, but only evaluates open if 0 = 1 call "MQCREATE" using mqname by value mqopenflags by value mqpermissions by value 0 returning mqid end-call else call "MQOPEN" using mqname by value mqopenflags returning mqid end-call end-if. move "open" to operation. perform show-error. * Show the attributes after initial create perform show-attributes. * Use the command line arguments or a default message accept user-message from command-line end-accept. if user-message equal spaces move default-message to user-message end-if. move function length (function trim(user-message trailing)) to send-length. * Queue up an urgent message (priority 31) display "Send priority 31" end-display. call "MQSEND" using by value mqid by reference urgent-message by value 20 by value 31 end-call. move "send-31" to operation. perform show-error. * Queue up a low priority message (1) display "Send priority 1" end-display. call "MQSEND" using by value mqid by reference user-message by value send-length by value 1 returning mqres end-call. move "send-1" to operation. perform show-error. * Queue up a middle priority message (16) display "Send priority 16" end-display. inspect urgent-message replacing leading "Urgent" by "Middle". call "MQSEND" using by value mqid by reference urgent-message by value 20 by value 16 returning mqres end-call. move "send-16" to operation. perform show-error. * Redisplay the queue attributes perform show-attributes. * Close the queue. As it is set unlinked, it will be removed call "MQCLOSE" using by value mqid returning mqres end-call. move "close" to operation. perform show-error. goback. ****************************************************************** * Information display of the Message Queue attributes. show-attributes. call "MQGETATTR" using by value mqid by reference mqattr returning mqres end-call move "getattr" to operation. perform show-error. * Display the message queue attributes display name-display " attributes:" newline "flags: " mqflags of mqattr newline "max msg: " mqmaxmsg of mqattr newline "mqs size: " mqmsgsize of mqattr newline "cur msgs: " mqcurmsqs of mqattr end-display . * The C global errno error display paragraph show-error. call "ERRORNUMBER" returning mqres end-call if mqres > 0 display operation " errno: " mqres end-display call "ERRORSTRING" using errstr by value length errstr returning mqres end-call if mqres > 0 display " strerror: " errstr(1:mqres) end-display end-if end-if . end program mqsender. [/code] And the sample output, created by running ./mqsender from a seperate console. [code] ~/writing/cobol$ ./mqserver /ocmq attributes: flags: +0000002048 max msgs: +0000000010 msg size: +0000008192 cur msgs: +0000000000 Waiting... 1 recieve len: +0000000020 prio: +0000000031 message: Urgent OpenCOBOL msg Waiting... 2 recieve len: +0000000020 prio: +0000000001 message: OpenCOBOL is awesome Waiting... 3 recieve len: +0000000020 prio: +0000000016 message: Middle OpenCOBOL msg Waiting... 4 recieve len: +0000000020 prio: +0000000031 message: Urgent OpenCOBOL msg Waiting... 5 recieve len: +0000000020 prio: +0000000001 message: OpenCOBOL is awesome Waiting... 6 recieve len: +0000000020 prio: +0000000016 message: Middle OpenCOBOL msg Waiting... 7 recieve len: +0000000020 prio: +0000000031 message: Urgent OpenCOBOL msg Waiting... 8 recieve len: +0000000020 prio: +0000000001 message: OpenCOBOL is awesome ~/writing/cobol$ [/code] ---------------------------------------------------------------- Great stuff. A couple of nitpicks and one caution. In the C code - Move the static function to the top then you do not need a forward decl. MQHANDLER can be local to the static func. It might be better to rename ERROR(NUMBER/STRING) as MQERROR(NUMBER/STRING) Now the caution. With every CALL (either without a RETURNING, or with a RETURNING that uses a numeric item), the internal register RETURN-CODE is also updated. This is passed upwards in the call chain until we terminate the program where we return it's final value to the environment (shell). This is exactly what MF does. So, let's look at mqsender. The last thing it does is show-error. The last relevant thing(s) that does is CALL ERRORNUMBER and maybe ERRORSTRING. If mqres is 0, then RETURN-CODE is also 0, if not then RETURN-CODE is also non-zero. This means a non-zero execution status which may not be what is wanted. We ALL do check our execution status or ? :-) ./mqsender if [$? -ne 0 ] then ... fi Note, you can set RETURN-CODE explicitly before the terminating STOP RUN/GOBACK to affect further actions in the wrapping script. Roger ---------------------------------------------------------------- Thanks Roger; Forward reference and ERRNO name; Will do. Return values; I've been a little confused on how best to ensure the status codes are propagated properly. That info will help. I have to read up a little more. The signal info value is a union, int sival_int or void * sival_ptr. I'd like to be able to pass both the message queue id, (currently using the sival_int) and the signal handling procedure string for cob_resolve to play with, to get rid of the nasty hardcoded "MQPROCESSOR". But last night I got a little confused on where best to stash the structure. I might just rely on an address into WORKING-STORAGE. That change along with the conditionals to get the source code ready for a Cygwin 1.7 release will give me the warm fuzzy to document the Message Queue service as a 1.0 release candidate. Along with that, I got thinking about using Message Queues and the notify sequence to generate OpenCOBOL based Domain Specific Languages. A tiny server that can just sleep until passed a set of commands over a queue. Along with the awesome CALL interface built into OpenCOBOL, could be a real dam buster. :) Cheers ---------------------------------------------------------------- Hi Brian, do message queues in cygwin 1.7 work for you? I downloaded cygwin 1.7 but unfortunately, it seems cygwin 1.7 message queues only allows me to open 1 message queue. If I try to open a second one, it fails with "Permission denied". Below is the test I used: #include #include #include main() { int flags = O_RDWR | O_NONBLOCK | O_CREAT | O_EXCL; struct mq_attr attr; char queue[33]; char *e; mode_t mode = strtoul("644", &e, 8); mqd_t mqd; memset((void *) &attr, 0, sizeof(struct mq_attr)); attr.mq_maxmsg = (long) 10; attr.mq_msgsize = (long) 24; strcpy(queue, "/queue0"); mq_unlink(queue); mqd = mq_open(queue, flags, mode, &attr); strcpy(queue, "/queue1"); mq_unlink(queue); mqd = mq_open(queue, flags, mode, &attr); // IT ALWAYS FAIL HERE WITH "Permission denied" perror("mq_open"); } If you know what the problem is, please let me know. Thank you, Linh ---------------------------------------------------------------- I can't tell what's wrong, but I can verify the bug. Only one open queue allowed with 1.7 (0.186/5/3). Even using separate processes, with or without create, with or without unlink using a variety of permission modes. /dev/mqueue accumulates the named queues across runs, but never more than one open stream allowed. Sorry, but this will require more information from a Cygwin maintainer I think. So, for now, the ocmq service is very much GNU/Linux only. But, I do have faith that as 1.7 approaches release, this will be remedied. (Faith? Hmmm, Hope.) Cheers, Brian ---------------------------------------------------------------- Cygwin 1.7 problem, see - http://marc.info/?l=cygwin&m=121913898031480&w=2 Roger ---------------------------------------------------------------- Thanks for the link Roger. My googling last night came up nada. So, faith and hope spring eternal. :) Cheers, Brian ---------------------------------------------------------------- Subject: Technical questions; Support for cob_field and signals Roger; Support for cob_field in external C code; Is support for cob_field in a C program as simple as #include <libcob.h>? If I start playing around with this, am I going to make your life more difficult? I'm looking at some of the interfacing restrictions for the way I've been attacking the wrappers. Requirements to pass string length, the null bytes, burden of code on the OpenCOBOL side. I'm wondering if it may be easier on developers to try a cob_field route for some args. But not if it upsets any internals. Signals, sleep and mq_notify; Support for notification of message queue writes uses signals. If an OpenCOBOL process is inside CBL_OC_NANOSLEEP, will a signal make it through as advertised by nanosleep()? Better just to call clib "pause"? Umm, or better to not even try using the function address of cob_resolve in a sigevent? I'm asking, because I'm lazy and want to know what you think before I set up the test. Cheers, Brian ---------------------------------------------------------------- Signals; Tried a test. It works with CBL_OC_NANOSLEEP and MQNOTIFY [i]and a convoluted COBOL -> C -> C -> COBOL sequence.[/i] :-) I'll post a bigger badder POSIX Message Queues sample soon. I'll leave the question open, as I'm still not all warm and fuzzy about races/edge cases/etc, and when I post the code you may get a better picture of what I've tried. With this working, I'll add the Timed Send and Timed Receive for BLOCKING queues and that should cover the entire mq_* API. Cheers, Brian ---------------------------------------------------------------- Subject: Open Cobol Branding and Logo Discussion Ideas Brian, at our GIMP study group yesterday the team discussed putting together a logo for Open Cobol. We also tossed around the idea of branding as well. First a bit of history. Some time back I registered the domains Add1toCOBOL.com/.org. This is of course a play on the C++ concept, since it's been jokingly said that oop COBOL would be called Add 1 to COBOL giving COBOL. While true, the form Add 1 to COBOL is equally valid, more succint and more in line with the C++ concept. While Add 1 to COBOL giving COBOL would be more like C = C + 1. Though OC and other Cobols might move towards OOP, my intent with those names was to emphasize what modern COBOL could do, contrary to all the silly claims made about it. "You mean COBOL can output HTML?" as an example. So this emphasis is not just on OOP, but on all the ++ that is the modern COBOL compiler. Now I think that there are hardly any of us that are not simply awestruck with the work that the duo have put into Open Cobol. It's clean, robust, extensible, fast, produces rich error messages, and growing in features and functionality all of the time. In short OC IS add 1 to COBOL in a technical sense. Whereas my sites are meant to be add1tocobol in a human sense. Users of COBOL saying, Hey, this aint you're grand-dad's cobol. So for a long time the branding of add1tocobol.com was going to be humans. Something along the lines of Viking, Celtic, African, Native American and other Warriors, men and women, all wearing business suits. So a merging of a kind of gruff sensibility that says we use COBOL because by hell we can, but the suits moving that to a by golly we can kinda theme. A nice somewhat silly, somewhat serious contradiction. And we will be moving forward with those plans very soon. We'll be having a photo shoot in the next couple of weeks. The logo for Add1tocobol will be a silhouette of one of these immages. It's also likely to change over time. ---Now to Open Cobol. I gave all the information above to kind of give an impression about how I feel about COBOL in general. Open Cobol is the first compiler that allows my dream of using COBOL fully to be realized. So I think it needs a modern, yet, distinctive and most importantly EVOCATIVE logo. Something that provides three feelings, a sense of OC being a modern language that competes head to head with any language such as PHP, Ruby and others, and is able to do so well. A sense of something that harkens back to an earlier time (1960s/70sish). And a complete sense that OC is the RIGHT tool for BUSINESSES. That last point is especially salient for us to consider. Business should make decisions on principles that last, that will endure and keep the moving forward. As we all know the efforts to convert from COBOL to Java or C or PHP or other languages is often extremely costly, and waste. Well, if converting to these languages is costly, often writing to them in the first place, for BUSINESS and DATA programs is as well costly. So OC is, and needs to be seen, as a business tool. Using it, is just good business. Now along those lines the LOGO for OC needs to be something professional. It can include a mascot if you like. Yesterday it was suggested that the norse troll might be a nice mascot. The spelling we have of that is Kobol. I think if we chose this, then we could just change it to Cobol and be fine. (There is a commercial product called Kobol, which is a COBOL compiler). If this was chosen, I might also suggest a business suit for the critter. So long as yall don't see this as conflicting or competing too much with add1tocobol.com. Though as I said add1tocobol is more about the social aspects, getting people involved, rather than the actual technology itself. Consider add1tocobol a COBOL evangelist if you will, with special efforts directed at Open Cobol. Other than the mascot we'd not had time to get too much more in detail about what we should present as possible logo ideas. I am thinking an O and a C somehow wrapped around each other with something orbiting them? Or the O wrapped around the C, with the O drawn in such a fashion as to appear to be orbiting the C. Thus a bright some at some part of the O and the rest of the O from there on, being the tail of the orbit. Or simply vice versa with the C being the orbitter. Another thought is OpenCobol in Three-D letters, nice and wide, crushing something below it..or stacking in a thunderous manner. I'd like as many ideas as yall have. We have some really good artists on our team and they sound very glad to participate. Roger, if you have any commentary here please add, we'll want you're guidance because it is your project. ---------------------------------------------------------------- I toggle between thinking cutesy and serious. Serious should probably take precedent, but I still have an image of a anthropomorphic Bull in a suit carrying ketchup and mustard. :) The logo I see as shiny ice-cold steel / electric blue, with (functionally efficient) rivets aplenty, but it would be nice if it also brands in simple black and white or silhouette. My two cents. Cheers, Brian ---------------------------------------------------------------- I like the rivets, it carries an idea of getting stuff done. ---------------------------------------------------------------- Subject: Books to Buy? Is this list good? These are some books I am thinking of getting. The Power of COBOL: for Systems Developers of the 21st Century Rui Bivar De Oliveira Murach's Mainframe COBOL Mike Murach COBOL for the 21st Century Nancy Stern Sams Teach Yourself COBOL in 24 Hours Thane Hubbel (Already have this one). And of course I have the ANSI standard. I wanted opinions before I chunk down the money on these. A lot of the books on Amazon are quite old (to be expected). That's not an issue, but they are not all available directly from Amazon, so I'd really be ordering from a third party. So if I can get these from Amazon, I want to do that instead, if they are good books. Any suggestions? ---------------------------------------------------------------- Well I have teach yourself cobol in 21 days. (SAMS) it is an excellent book. starts from beginning to end. covers everything and the code is compatible with Kobol, Open-cobol, tiny-cobol and acu, mscobol, rmcobol. some with very minor code changes. it's the only book i use. u can download it off the net free....just search "tyci21d" u will find it. it's and html soucre. ---------------------------------------------------------------- You cannot legally download for free any of the "SAMS Teach yourself" series. There are copyright issues and it has been removed (or the link points nowhere) on most, if not all, of the freebook sites. Roger ---------------------------------------------------------------- Roger, The links I posted were for a paid service that is legal and approved by the publishing companies. It's produced by Oreilly. In order to read the books online at that site you have to pay a monthly service fee. I believe in copyrights so would not direct people to links that do not respect the copyrights of others. ---------------------------------------------------------------- dave, if you go to amazon you can find people selling original runs of that book. These are legal and the price is very cheap. I'm with roger about not getting copyrighted materials for free, I'd just prefer to have the right thing in hand. ---------------------------------------------------------------- Subject: Available types of ISAM (BDB/VBISAM/...) in OC There was a post about experimental support of VBISAM some months ago. The standard ISAM, as we all know is supported via BDB. So three open questions here: 1. Are there possibilities to use ISAM in OC without BDB? 2. If I can suggest a new type to support: What about SQLITE? It seems to be fast, supports many things, is open source, ... 3. "Real" ISAM from MF/ACU/... couldn't be supported because of copyrights, could they? ---------------------------------------------------------------- [quote]simrw wrote: As to the actual implementation, C-ISAM/D-ISAM/VBISAM all have native support for split keys. For BDB, we would have to code it ourselves.[/quote] What is the current state of these implementations? Are they just try-outs or "fully" usable ("fully" as BDB is)? Are split keys usable with these environments? As seen in [url=http://www.db5.org/ref/am/opensub.html]BDB-Docs[/url] there is a possibility to put different databases into one file - [quote]Applications may create multiple databases within a single physical file. This is useful when [...] it is desirable to include secondary index databases in the same file as the primary index database.[/quote] Is there an implementation for all Key files in one file (BDB)? ---------------------------------------------------------------- Subject: Simple Accounting Program? The company I work for uses several accounting programs which are all fairly big on the scale. But we're creating a separate company that right now has minimal receivables. So we were looking at something on the scale of GNUCASH or QUICKBOOKS or even QUICKEN to handle our accounting. Then it dawned on me. Why not in COBOL? So I am curious if anyone knows of any code, that is free and open source for such a thing? If not then it's time for the planning stages, I'll kick it to the partners. ---------------------------------------------------------------- Hello, I developed an accounting software in cobol(s). The first release ran under CP/M with microsoft cobol ! Then over Ms-Dos, with minor changes (286, you remember ?) Then over Unix System-V (NCR Tower) with RM/Cobol. Then over AIX (this is the portage under ACU 2.1 !) Then over AIX (I changed some programs, as a "renewal" ACU 4.1) Then I started using extensions of ACU like using character-built windows. And here we are. My project is re-writing an accounting software with OC. The main problem today is windowing. I started html development, but this much difficult for me, and I need to work with my son, a internet programmer. So as everybody understands, windowing tips & tricks are welcome ! Kind regards Bear ---------------------------------------------------------------- Bear, Do you own all of the copyrights on this program (I am assuming you do, just clarifying). If so, would you be willing to open source it? GNU GPL is my preference. COBOL needs a LOT of FOSS projects to make it really hit mainstream again. An accounting program that is licensed with the GNU GPL would also help uptake of OC. Other projects would also. My COBOL is very rusty, but I am improving rapidly. So if you consider releasing your project as FOSS, I'd definitely like to take a look at it. (I'd recommend verifying everything about that just to make sure, before deciding). I'm not a designer yet, but I've enough experience on the HTML/CSS end that I can assist with a web front end. I'd actually like to have OC folks work together to create a series of Libraries for HTML/Web output. But that's just a bit away. We need to come up with game plans for all of these projects. ---------------------------------------------------------------- Hello aoirthoir, Initially my project was to create the software "from zero", using OC in French, for frenchies. The "from zero" because of copyrights. I think that I have to internationalize a bit. Bear ---------------------------------------------------------------- Bear, that's exactly what I want to do. There are, for instance, some excellent accounting applications out there. However, not many are FOSS. And many of the foss ones are written in languages that are just not designed to work with business data. As I've oft complained, data is in most languages, an afterthought. So I would like to start working on some serious foss projects that meet real business needs, in OC. ---------------------------------------------------------------- OK, Suppose we start today. Do you think that project could be finalized on December-January ? We need to build up our own methodology. Can you bring up your essential needs. My email is in Bear's account for contact. So I have to take a good dictionary. If some people may enlighten us in french to english and english to french technical terminology, this will be helpful ! Regards Bear ---------------------------------------------------------------- We can use google to attempt some translations. I am not sure how soon we could finish the project, because we would have to evaluate our needs to understand the fool scope of the project. Now I understand what you meant by starting from 0. No code at all, all brand new code. I like that idea best. Are you good with it being FOSS? Additionally I think if we are going to do this, a lot depends on how urgent we have of a need for accounting programs right now? I would rather first start to create a list of standard practices like the php pear group has done. But this would be for our COBOL coding. Of course testing with a live app does give us a way to put the practices through their paces. I will email you, but I would also like to keep the conversation open here so that others may participate. Kind Regards, French: Nous pouvons utiliser Google pour tenter une traduction. Je ne suis pas sûr combien de temps nous pourrions terminer le projet, parce que nous devons évaluer nos besoins de comprendre l'idiot portée du projet. Je comprends maintenant ce que vous souhaitiez en partant de 0. Aucun code à tous, tous tout nouveau code. J'aime mieux cette idée. Êtes-vous bien avec les logiciels libres étant? En outre je pense que si nous allons faire cela, beaucoup dépend de la façon dont nous avons d'urgence d'un besoin de logiciels comptables pour le moment? Je préfère d'abord de créer une liste de pratiques comme le PHP PEAR groupe a fait. Mais ce serait pour notre COBOL codage. Bien entendu, des tests avec un app vivre ne nous donner un moyen de mettre les pratiques par le biais de leurs rythmes. Je vous e-mail, mais je voudrais aussi garder ouverte la conversation ici afin que d'autres participent mai. ---------------------------------------------------------------- [i]Opinion Piece[/i] I was thinking about this a little bit. If the end goal is SimplyOpenCOBOLAccounting, then this post is somewhat meaningless, if not ... One of the strengths of COBOL is the vertical software market. One of, unique, purposeful applications. A weakness, as I perceive it, is horizontal development. COBOL doesn't lend itself as well to generic solutions. It could, but that isn't playing to the strengths of COBOL's inherent attention to detail. So if advocacy and promotion of OpenCOBOL is one of the side goals of accounting software, I suggest building up an accounting software toolkit. This will widen the vertical appeal, letting developers use OpenCOBOL to build customer specific applications. An even wider appeal may come from the development of SimplyOpenCOBOLAccounting using the Simple Accounting OpenCOBOL toolbox. But ... also perhaps my perception, development of generic systems in COBOL will be far more time consuming than development of a single purpose production application. In and of itself, if done properly, a single OpenCOBOL application could well become a world famous program but I think, in terms of promoting OpenCOBOL usage, developer tools and templates may have more effect. Cheers, Brian ---------------------------------------------------------------- Brian, Actually that's exactly what I want to do. I'd like to have lots of modules available that a COBOL coder can use to hit the ground running for custom applications. Despite the prevalence of large scape projects, most programming has always been custom programming. In any of these cases I am not thinking, hey let's make said app and distribute it. Rather, here are the toolboxes that a developer can use. (I like that terminology a lot). So we are on the same page. But as far as creating a tool box, we can do so, and then use those toolboxes to create our apps. So, I need a small accounting app anyhow, might as well code and test it. Then use it for the new business here that my boss is starting. Additionally a more accounting, business world specific project will help us test this bad boy. If anyone is interested we could start planning. But, if we are creating toolboxes, I think crerating a methodolgy, a ruleset, is most important first. Thoughts? ---------------------------------------------------------------- Hello World, ;-) I'm preparing some shots. I need a few days. I'll be back ASAP. Kind regards Bear ---------------------------------------------------------------- What are shots? ---------------------------------------------------------------- Oooops ! I meant screen shots ! I'm still working on ... I'll post it on my site. Bear ---------------------------------------------------------------- Bear sorry man. I shoulda known what you meant. Sometimes I feel dumb. Anyhow if you could join us in #add1tocobol on Freenode, we will be talking about this and other projects soon. We have at least 4 of us interested in this. ---------------------------------------------------------------- Subject: COBOL Tools (Hardware, flow charting, graph paper etc) I'm looking for some resources that would be an all in one stop so that I could buy COBOL oriented productivity tools. I need Flowcharting templates. Graph Paper. Report writer overlays. Any direction is greatly appreciated. ---------------------------------------------------------------- http://www.helixusa.com/Products/Helix/Technical+Drawing/Templates/Details/08771.html and http://www.staples.com/office/supplies/StaplesProductDisplay?storeId=10001&jspStoreDir=Staples&productId=97970&cmSearchKeyword=flowchart&fromUrl=home&cmArea=SEARCH&catalogId=10051&langId=-1 More to come later. ---------------------------------------------------------------- Google: printer spacing chart and you will find links to printable spacing charts. They are in a variety of formats, PDF, XLS, XML, RTF, Open Office. Hope that helps, it's helping me. I'm still looking for one on plastic though that I can overlay an existing document with. ---------------------------------------------------------------- If you want soft; dia is a pretty good flowcharting engine. You're GIMP group may like it, as that what it's based on. Similar interface. xfig is not bad for getting figures. But all this is outside my domain. dia has a sister package, dia2code $ dia2code -t cobol is maybe something we could work on someday, in the far off mythical spaces of spare time holes. The generate_code_ada.c is only 24K and most of the language generators are in the 12K of source code range. Cheers, Brian ---------------------------------------------------------------- [quote]$ dia2code -t cobol[/quote]Sounds marvellous. To bad, that I'm coding no C. ---------------------------------------------------------------- Brian, We checked out dia for our projects and had decided we were going to be using it. For starters though for users we are using FreeMind mindmap. It removes the complexities of flow charting from them and puts it in our park (developers). It saves in XML so we might be able to write a routine to convert from that to Dia, which would be great. Does dia2code support -t cobol already? If not we would be able to write that? If so then that might work as a starting point for the project (Sead) that I emailed you about. I am all about meta programming. In the least, if nothing else, once a standard has been developed, then a quick form to fill in app name, author that kinda thing, which then generates from a template the layout we all have agreed to, based on your other thread. But of course if dia2code and sead work the way I intend a couple years from now, a lot more code would be automated. ---------------------------------------------------------------- No, dia2code doesn't do COBOL (yet) and yes I think we could write one. The C code I looked over for generating Ada didn't look overly scary. This would be somewhat of a frill, I'm pretty sure dia2code won't produce full apps from pictures. :) Cheers, Brian ---------------------------------------------------------------- I think it's more of an interesting experiment than anything else. I'd not spend time on that for a year at least. The code generator I emailed you about would be based on templates, not flow charting. ---------------------------------------------------------------- Subject: Stock OpenCOBOL source templates Hello everyone I'd like the board to kick around some source code templates, and then have the group pick one for inclusion in the OpenCOBOL samples bundle. I'll start with mine, but this really should be by concensus. One for free form. [code] >>SOURCE FORMAT IS FREE *> ********************************************************************* *> Author: *> Date: *> Purpose: *> Tectonics: cobc *> ********************************************************************* identification division. program-id. . environment division. configuration section. input-output section. file-control. select assign to organization is . data division. file section. fd . 01 . working-storage section. local-storage section. linkage section. screen section. procedure division. goback. exit program . [/code] One for fix form; my favourite. [code] >>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: *> Date: *> Purpose: *> Tectonics: cobc *> *************************************************************** identification division. program-id. . environment division. configuration section. input-output section. file-control. select assign to organization is . data division. file section. fd . 01 . working-storage section. local-storage section. linkage section. screen section. *> ************************************************************** procedure division. goback. exit program . [/code] and the same in upper [code] >>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: *> Date: *> Purpose: *> Tectonics: cobc *> *************************************************************** IDENTIFICATION DIVISION. PROGRAM-ID. . ENVIRONMENT DIVISION. CONFIGURATION SECTION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT ASSIGN TO ORGANIZATION IS . DATA DIVISION. FILE SECTION. FD . 01 . WORKING-STORAGE SECTION. LOCAL-STORAGE SECTION. LINKAGE SECTION. SCREEN SECTION. *> ************************************************************** PROCEDURE DIVISION. GOBACK. EXIT PROGRAM . [/code] Concerns would be; group decision on use of Tectonics to document the build instructions. Too little? Too much? Need more initial paragraph and ending rules? "What are you nuts? Standard COBOL looks like ..." Cheers, Brian ---------------------------------------------------------------- I've a tendency to like the most english like, mixed case for example in sentences. UPPERCASE for section names. Paragraph names mixed case. This gets me thinking that we could use some standards for code accepted for inclusion as samples? Or as part of larger projects. ---------------------------------------------------------------- Hello, My favorite is free source format because of it's greather readability. Generally I use uppercases to name the source and .CBL as extension. For example "MYPROG.CBL", so of course this will give [code] identification division. program-id. MYPROG. [/code] As I am still developing (ACU) for my company, I changed my format in order to apply the free one. Now even if I write ACU I think OC. Regards Bear ---------------------------------------------------------------- Just went through the updated version of the FAQ. Based on what I've read there my conclusion is that we use FIXED FORMAT. This way we have the option to use D for debugging in column 7. If we use free format, we will not have this option available. Additionally, we lose the ability to do a line continuation character. However, if we do free format, will we be restricted in the number of columns we can go wide? Are we able to go unlimited or past column 72? Even if the answer is yes, I still believe that fixed is better as a result of adding ability to do conditional compiles of the D debugging lines. --- Now as to the upper and lower case. We have three different opinions it looks like. One prefers UPPER, the other lower, and the other mixed case. Since I'm always right, I'll defer to yall in this one instance :D In seriousness I'm ok with all three. I'm of course tempted to suggest all upper all the time because one of the complaints I hear about COBOL is that everything has to be uppercase. Then when I hear that I hit my head on my desk. Still I would like to knock out a format we can agree on for code submissions for shared FOSS projects. ---------------------------------------------------------------- Subject: Mainframe to Linux with OC Hi. I’m working in a Project to establish if OC could be used to port some application from a mainframe environment to Linux, with confidence. The first test that we have done looks great, because OC works fine with Oracle Pro*Cobol (Oracle 9i and Oracle 10g), one of the most important requirement we have. At this point, we are writing a final report for our customer, but I need some information, and perhaps someone could help here : - I see in the FAQ, that OC is used in production environment since 2005. Any information of these cases would be very helpful for us (Number and size of Projects, Number of final users, goals achieved with OC, …) - Support to correct bugs (if necessary), and to use the compiler (this is less important, because we are learning a lot) ?? - OC v1.1. When will be released ?? - Is there any plan to certify OC with Oracle Pro*Cobol ?? I don’t know if this is possible, or then requirements (and cost if any) of Oracle, but I think that this way could be very interesting for a lot of companies. - Is there any plan to satisfy an standard in the future ( Cobol85, Cobol2002) ?? Thanks a lot for the help. Regards. Javier ---------------------------------------------------------------- Roger's got it mostly up to standard already. SQL isn't an option yet as far as I know (unless this has changed recently). But a number of us have requested an SQL connector. However, if C has an SQL connector, you might be able to use the OpenCOBOl CALL functionality to achieve what you want. You'd have to know C, I'm not much help there. Not sure about the certs attempts, that would be up to Roger. ---------------------------------------------------------------- Subject: OpenCOBOL FAQ 1.0rc posted Check out http://www.add1tocobol.com/opencobol/docs/ Many thanks to Joseph Frantz for the resources. I've tagged this 1.0rc, even though it still has TODO items and incomplete sections and probably some bugs. The plan is for this FAQ to have version 2, 3, etc... as it builds up (and I'm impatient and want to see the FAQ out in the wild). :) This is dual streaming and perhaps a little less professional than the form the FAQ will take when it gets included in any OC1.1 release bundles. As an aside; the OpenCOBOL OCLUG discussion blurb for Sept. 2 is posted at http://oclug.on.ca Cheers, Brian ---------------------------------------------------------------- NICE job man I love it! ---------------------------------------------------------------- Thank You Brian, This is VERY good job. I will finish to read it completely. Bear ---------------------------------------------------------------- New one posted. Started the Reserved Words table. (3.9) Added a whole bunch of back to Index links to ease navigation. http://add1tocobol.com/opencobol/docs/ocfaq.html Cheers, Brian ---------------------------------------------------------------- This is good work! Suggestions in general: 1. Remove the leading "Q." because most points are questions and the answers weren't titled as "A." 2. Change the (minor) version number every time you do something (1.0rc, 1.0rc2, ...). 3. If possible: use images for "back to index links" 4. If possible: remove all backlinks via css if file is printed. ---------------------------------------------------------------- Thanks human; I've copied your post into the FAQ sources as a TODO comment and reminder section. EDIT; 2. Yep, good idea. That'll be the scheme until the official release. 3 and 4 fixed. Don't need to add external nav links. ReST comes with a :backlinks: option for the contents: directive. Every topic is a backlink now. 1. Not sure. I use the Q. for grep, wc, and fast grokking. Perhaps they will be removed once the next major push at adding content is completed. Cheers, Brian ---------------------------------------------------------------- Hello Brian, As I told you a few days ago, Marvellous Job. I did not found any "file-status" list. Maybe my eyes are a bit tired on this end of week ? Regards François Good Bear : Not A Grizzly :-D ---------------------------------------------------------------- Subject: openCOBOL use I'm new to this forum and am looking at different COBOL compilers. openCOBOL looks like it could be a good alternative to existing commercial COBOL compilers. I understand that openCOBOL is under the GPL License. Are there any proprietary, commercially available COBOL applications being built and supported using openCOBOL? Would this sort of use be allowed under the openCOBOL license? Are there any openCOBOL built applications in production use, particularly in high volume on line transaction processing environments? Any information you can provide would be really appreciated. Thanks. ---------------------------------------------------------------- CHHC: The recently released article entitled "A Practical Guide to GPL Compliance" by the Software Freedom Law Center may be of great use to you: http://www.softwarefreedom.org/resources/2008/compliance-guide.html Open Cobol is licensed with GNU GPL and its libraries use the GNU Lesser GPL. Generally speaking you are allowed in these cases to create proprietary software with the compiler. If the libraries were also GNU GPL, then there would be a greater chance that you would need to likewise distribute your software under the GNU GPL. Be forewarned though, check the libraries just in case. If your Open Cobol program uses other libraries, you'll potentially fall under their licensing requirements. I don't know of COBOL software compiled with OC that is being distributed just yet. But several of us are tossing around the idea of creating libraries of COBOL code for ourselves and others. Probably licensed with the GNU GPL. But it's going to take a while to prepare that. ---------------------------------------------------------------- I appreciate the information you've provided. I've heard that terms of use of GPL licensed software can be somewhat tricky when it comes to using with proprietary software, so I need to be a bit cautious before starting any projects. Do you know whether the authors of openCOBOL have stated that OC can be used to compile proprietary programs, or were you offering a personal opinion? Thanks. ---------------------------------------------------------------- Well as I understand Open Cobol is based on pre-existing code. That's the thing with GPL software, it ensures that even later developers cannot 'give an opinion' in the sense of allowing you to do something with the code that the GPL would not. Even if they wanted to they could not. However, I am not speaking for Roger and the other developers of Open Cobol. As mentioned the GNU Lesser GPL used in libraries does allow for use in proprietary projects. Since Open Cobol uses the GNU LGPL for its libraries then you should be fine there. If you wanted to change and distribute the Open Cobol compiler, then you would be required to do that under the GNU GPL. But programs compiled in OC should mostly be fine as proprietary. Again though the caveat is, what *other* libraries would you be using. If you used readline, then you most likely would not want to chance using that in a proprietary project, since it uses GPL not LGPL. Also though, I really have to know what you mean by "proprietary". Do you mean to use inhouse for your own company's programs. That is software that is not distributed? If so, then the GPL is not activated. GPL is only activated when you distribute. A company is under no obligation to distribute modifications to a program that is licensed with the GNU GPL. If they choose to distribute the program though, then an offer for source must accompany it. On the other hand, if you are going to be distributing software to other parties (companies, clients, etc), then the provisions of the GPL are effective at the time of distibution. Remember though, the *libraries* of OC are under the LGPL. So, if you are not using libraries from other projects, outside of OC, then you are most likely fine. Just to clarify, I am not a lawyer, nor do I speak for the Open Cobol project. These are just some basic observations about the GNU GPL. If you plan to distribute, I would heartily suggest having a lawyer look at your plans. Gather as much info as you can for the lawyer. Links like the one I gave you above. That will save you some of the hourly. We are about to do that here at our office. ---------------------------------------------------------------- Subject: CGI and Screen Section : standard compatible ? Hello, Is the use of SCREEN SECTION compatible with CGI programming ? I was playing with cgienv.cob, introducing a screen section. I think that screen section, when encoutered generates some ncurses initscr() that is not compatible with cgi programming ... [code] >>SOURCE FORMAT IS FREE *>***************************************************************** *> Author: Brian Tiffin / Francois Hiniger *> Date: 08-Aug-2008 *> Purpose: Display the CGI environment space *> Tectonics: cobc -x cgienv.cob *> Move cgienv to the cgi-bin directory as cgienv.cgi *> browse http://localhost/cgi-bin/cgienv.cgi *>***************************************************************** identification division. program-id. cgienv. data division. working-storage section. 78 name-count value 24. 01 name-index pic 99 usage comp-5. 01 value-string pic x(256). 01 environment-names. 02 name-strings. 03 filler pic x(20) value 'DOCUMENT_ROOT'. 03 filler pic x(20) value 'GATEWAY_INTERFACE'. 03 filler pic x(20) value 'HTTP_ACCEPT'. 03 filler pic x(20) value 'HTTP_ACCEPT_CHARSET'. 03 filler pic x(20) value 'HTTP_ACCEPT_ENCODING'. 03 filler pic x(20) value 'HTTP_ACCEPT_LANGUAGE'. 03 filler pic x(20) value 'HTTP_CONNECTION'. 03 filler pic x(20) value 'HTTP_HOST'. 03 filler pic x(20) value 'HTTP_USER_AGENT'. 03 filler pic x(20) value 'PATH'. 03 filler pic x(20) value 'QUERY_STRING'. 03 filler pic x(20) value 'REMOTE_ADDR'. 03 filler pic x(20) value 'REMOTE_PORT'. 03 filler pic x(20) value 'REQUEST_METHOD'. 03 filler pic x(20) value 'REQUEST_URI'. 03 filler pic x(20) value 'SCRIPT_FILENAME'. 03 filler pic x(20) value 'SCRIPT_NAME'. 03 filler pic x(20) value 'SERVER_ADDR'. 03 filler pic x(20) value 'SERVER_ADMIN'. 03 filler pic x(20) value 'SERVER_NAME'. 03 filler pic x(20) value 'SERVER_PORT'. 03 filler pic x(20) value 'SERVER_PROTOCOL'. 03 filler pic x(20) value 'SERVER_SIGNATURE'. 03 filler pic x(20) value 'SERVER_SOFTWARE'. 02 filler redefines name-strings. 03 name-string pic x(20) occurs name-count times. 01 newline pic x value x'0a'. screen section. *> Definition of a table 01 header-screen. 02 value "CGI Environment Variables". 02 value "Name of VariableValue of variable". procedure division. *> Always send out the Content-type before any other IO display "Content-type: text/html" newline end-display . display "" end-display display "CGI Environment Variables with Open-Cobol" end-display display "
" end-display
    .
*>Accept and display some of the known CGI environment values
   display "" newline end-display
*>   display ""
*>   display "" end-display

*> Next sentence does not appear in the html page <*
   display header-screen end-display
   display "" newline end-display
   perform varying name-index from 1 by 1
    until name-index > name-count
        accept value-string from environment
            name-string(name-index)
        end-accept
        display "" newline "" newline end-display
   end-perform.
   display "
CGI Environment Variables
Name of VariableValue of variable
" display function trim (name-string(name-index) trailing) ": " with no advancing end-display display "" display function trim (value-string trailing) end-display display "
" end-display display "
" end-display. goback. [/code] So I don't know if whe can do something for standard compatibility. OC_CGI_ENABLED = somevalue ? Brian, I put my name in your program, just because I've posted very close example some few months ago .. This must be my ego :-)). Best Regards to All Of You Bear ---------------------------------------------------------------- Bear; no worries. I snagged a bit of your OC_CGI.tgz file to add POST handling to the example. The example is now in my local copy of the FAQ. I credited Bear, I'll update it to Francois :) Re the actual problem; yeah that makes sense. SCREEN SECTION kinda snags the DISPLAY functionality. We'll have to work out something for DISPLAY UPON or OPEN and WRITE with a sysout file. That probably makes sense for this idiom. Put in both OPEN INPUT webin and OPEN OUTPUT webout for the demo. Have to experiment. Cheers, Brian Edit; Actually, having just looked at it, I'm not sure anymore. Combining SCREEN and CGI seems, umm, weird; at least in a sample. ---------------------------------------------------------------- Ok Brian, I'm not worrying any more. I have updated my account in this forum, by giving my real name, and a website (in construction - better than blank). Doing that I'm not going to be anonymous ... ;-). So back to the subject, I not so sure about the weird. In fact using screen section allows better integrations of html tags, specially when you can generate this part. I think that can be more readable. The question is standard or not. I still believe that OC needs ncurses when the compiler encounters "screen section", and consequently generates initscr(); witch makes html garbage. I'm sure Roger has an opinion. Best regards François the Bear ---------------------------------------------------------------- Bear I too am not sure what you are trying to accomplish by using a terminal interface to generate/manage HTML. The 'initscr' problem may be solved with a non-standard terminfo entry that has an empty terminal initialization value. You would need to set the 'TERM' environmental variable to this fake terminal entry name (my linux default is 'xterm'). This may have to be done with a script wrapper if 'initscr' is called before the PROCEDURE division is entered. You might be better off writing a CGI helper library instead of going through the SCREEN section. The problems you are confronting illustrate how inappropriate Cobol is for CGI. Although the most fun I have had programming in Cobol is making it do something it is not supposed to be able to achieve. Curt ---------------------------------------------------------------- [quote]The problems you are confronting illustrate how inappropriate Cobol is for CGI. Although the most fun I have had programming in Cobol is making it do something it is not supposed to be able to achieve. Curt[/quote] I'm not sure I agree with the first part of that statment. COBOL is as appropriate for CGI as any other language, imho. STRING and UNSTRING, ACCEPT and DISPLAY along with the ENVIRONMENT handling makes OpenCOBOL a good fit, again imho. And I see OpenCOBOL in particular as a [i]common gateway[/i] to all kinds of functionality that may not be standard COBOL fare. I'll completely agree with the second part. :-) Cheers, Brian ---------------------------------------------------------------- Some clarification - The presence of a SCREEN section does NOT imply any curses calls. Curses is used (and automatically initialized if necessary) when the (screen oriented) ACCEPT/DISPLAY is executed. Also remember the facility to connect files to stdin/stdout with the extended SELECT syntax - SELECT ... ASSIGN TO KEYBOARD. and SELECT ... ASSIGN TO DISPLAY. which connects the files (which are automatically LINE SEQUENTIAL) to stdin/stdout respectively. Roger ---------------------------------------------------------------- Subject: STANDARD Copybooks Looking at the CGIENV example just posted it made me realize we need a series of standard copybooks. For things like Environment variables, keystrokes and so on. Just a thought. ---------------------------------------------------------------- Subject: Qualified Reference Modification with Expression Hello everyone, A sample program to demonstrate the power of reference modification expressions, followed by a sample of the gory of refmod when the power is not used with care. Cheers, Brian [code] >>SOURCE FORMAT IS FIXED ****************************************************************** * Author: Brian Tiffin * Date: 01-Sep-2006 * Purpose: Qualified Reference Modification with Expressions * Tectonics: cobc -x refmod.cob ****************************************************************** identification division. program-id. refmod. data division. working-storage section. 01 newline constant as x'0a'. 01 datastore. 03 indexer pic 999. 03 counter pic 999. 01 otherstore. 03 indexer pic 999. 03 counter pic 999. 01 teststring pic x(80). 01 expr. 03 ind pic 999. 03 cnt pic 999. 01 nums pic x(30). ***************************************************************** procedure division. move 2 to indexer of datastore. move 5 to counter of datastore. move 7 to indexer of otherstore. move 7 to counter of otherstore. move "abcdefghijklmnopqrstuvwxyz" & x'0a' to teststring. move 1 to ind. move 0 to cnt. move "123456789012345678901234567890" to nums. * Demonstrate qualified reference modification with expressions display "Datastore: " teststring(indexer of datastore + 5:counter of datastore * 2) newline "Otherstore: " teststring(indexer of otherstore:counter of otherstore + 13) end-display. * Demonstrate order of evaluation rules for ref mod expressions * 5:9 display "Expr: " nums(ind * 2 + 6 / 2:cnt + 8 + 2 / 2) end-display. goback. exit program. end program refmod. [/code] Outputs [code] Datastore: ghijklmnop Otherstore: ghijklmnopqrstuvwxyz Expr: 567890123 [/code] And this sample is just wrong. [code] >>SOURCE FORMAT IS FIXED ****************************************************************** * Author: Brian Tiffin * Date: 01-Sep-2006 * Purpose: Qualified Reference Modification with Expressions * Tectonics: cobc -x refmodbad.cob ****************************************************************** identification division. program-id. refmodbad. data division. working-storage section. 01 indexer pic 999. 01 counter pic 999. 01 teststring pic x(26). 01 overwrite pic x(10). ***************************************************************** procedure division. move "abcdefghijklmnopqrstuvwxyz" to teststring. move 10 to indexer. move 20 to counter. * Demonstrate the danger of reference modification move teststring(indexer:counter * 2) to overwrite. display "Overwrite: " overwrite end-display. move teststring to overwrite(indexer * 2:counter). display "Overwrite: " overwrite(indexer * 2:counter) end-display. goback. exit program. end program refmodbad. [/code] Note; The output of incorrect reference modification is unlikely to be reproducible across systems. That is, if a crash doesn't occur first. [code] Overwrite: jklmnopqrs Overwrite: abcdbcdhcdhldhlphlpt [/code] ---------------------------------------------------------------- Note, however, that compiling with "-debug" will detect this at runtime - refmodbad.cob:26: libcob: Length of 'teststring' out of bounds: 40 Roger ---------------------------------------------------------------- Subject: visualize cobol I'm searching for the easiest way to make html-gui programs using COBOL. Can we have text, combo, lists, date-time, input boxes as part of the screen section? ---------------------------------------------------------------- konenas; Short answer, No. Medium answer, I'm not going to pretend to know what's what with this yet (it is right near the top of the things todo for the FAQ, so I should know more soon), but Warren Gay (ve3wwg) has developed CobCurses. Search for CobCurses here in the forum for his announcements. Or check http://cobcurses.wiki.sourceforge.net/Welcome for some details. Well documented. It's a major piece of work, but we'll have to see what it takes to merge this with the current OC 1.1 bundle. It didn't take on my first try (I only spent 30 seconds trying). CGI seems well enough supported, (but as noted here, some feel COBOL is a little inappropriate for CGI work - not myself - but I can see that point of view being worthy of consideration). Long (time) answer, Or in the (hopefully not too) far off future of spare time finding, work will commence on OpenCOBOL GTK+ wrappers or bindings. That will give OC a true GUI toolkit. Maybe. Shouldn't (and can't) promise anything. But my suggestion for now, is to give Warren's code and the wiki docs mentioned above a good going over. Lots of nifty things in his toolbox. Cheers, Brian ---------------------------------------------------------------- Actually, while SCREEN SECTION does not map to HTML, you can output any HTML you want from an OPEN COBOL program. So you could read from a template if you wish. You could store the template as a text file or in a file, (ISAM?) of your choice. Lastly you could just do it directly with DISPLAY. So if you did this: DISPLAY "

TEST

". You would get html output. Thus your combo boxes, inputs, text areas and so on can be output just fine with OC. See this section of the release candidate FAQ: http://www.add1tocobol.com/opencobol/docs/ocfaq.html#q-can-opencobol-be-used-for-cgi ---------------------------------------------------------------- Subject: Fun with SORTing Hello campers, Hope everyone's Back To School Days are going well. Here is a sample program that plays around with the SORT verb. A few things you can change if you experiment with it. It defines an ALPHABET to control the sort. Mixed-case in this case. And for a twist, it sorts lower-case before upper-case; [b]except for A, which sorts upper before lower[/b]. You can comment out the COLLATING SEQUENCE IS line to have a default sort sequencer. [i]Note: this is not a full ALPHABET, simply an example.[/i] You can also play with USING and GIVING and the INPUT PROCEDURE IS and OUTPUT PROCEDURE IS phrases. In this (useless) example; the INPUT PROCEDURE maps the input records to LOWER-CASE for the sort, and the OUTPUT PROCEDURE maps the sorted records to UPPER-CASE. As per the standard, you can have a USING clause OR an INPUT PROCEDURE (not both, so one of the lines needs to be commented out of the sample.) Same goes for GIVING and the OUTPUT PROCEDURE lines. Only one from each pair is allowed. But you can have USING with an OUTPUT PROCEDURE or an INPUT PROCEDURE with GIVING and the various combinations thereof. If you want to use this for any actual real sorting, drop or "correct and flesh out" the collating sequence and remove the display of the SORT-RETURN value. [i]Note: This is a very arbitrary sample.[/i] With the INPUT and OUTPUT PROCEDURE clauses, some wicked powerful sorts can be accomplished using our beloved OpenCOBOL. Cheers, Brian [code] *>>SOURCE FORMAT IS FIXED ****************************************************************** * Author: Brian Tiffin * Date: 02-Sep-2008 * Rights: Copyright (c) 2008, Brian Tiffin. Licensed GPL. * Purpose: An OpenCOBOL SORT verb example * Tectonics: cobc -x sorting.cob * ./sorting output * or simply * ./sorting * for keyboard and screen demos ****************************************************************** identification division. program-id. sorting. environment division. configuration section. special-names. alphabet mixed is " AabBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTu -"UvVwWxXyYzZ0123456789". input-output section. file-control. select sort-in assign keyboard organization line sequential. select sort-out assign display organization line sequential. select sort-work assign "sortwork". data division. file section. fd sort-in. 01 in-rec pic x(255). fd sort-out. 01 out-rec pic x(255). sd sort-work. 01 work-rec pic x(255). working-storage section. 01 loop-flag pic 9 value low-value. procedure division. sort sort-work on ascending key work-rec collating sequence is mixed using sort-in * input procedure is sort-transform giving sort-out. * output procedure is output-uppercase. display sort-return end-display. goback. ****************************************************************** sort-transform. move low-value to loop-flag open input sort-in read sort-in at end move high-value to loop-flag end-read perform until loop-flag = high-value move FUNCTION LOWER-CASE(in-rec) to work-rec release work-rec read sort-in at end move high-value to loop-flag end-read end-perform close sort-in . ****************************************************************** output-uppercase. move low-value to loop-flag open output sort-out return sort-work at end move high-value to loop-flag end-return perform until loop-flag = high-value move FUNCTION UPPER-CASE(work-rec) to out-rec write out-rec end-write return sort-work at end move high-value to loop-flag end-return end-perform close sort-out . exit program. end program sorting. [/code] Sample run from keyboard $ ./sorting [code] abc ABC abc ABC def DEF def DEF [/code] gives [code] ABC ABC abc abc def def DEF DEF +000000000 [/code] ---------------------------------------------------------------- Subject: COBOL User/Coder Meeting happening RIGHT NOW. Howdy yall! We've been talking about all the exciting things that Roger has done with Open Cobol. Thanks to his hard work and dedication OC is really a workable solution for so many of us and so many projects that we have in mind. More and more of us are starting to talk and collaborate on using OC to compile COBOL programs that meet the needs of all of us at large. Some examples include a potential code generator, some open Accounting modules, Payroll, employee timeclocks and lots of other things. We're also talking about battering out some standards for how, we as a group that share COBOL code with each other, write our code. Copybooks are something that we most definitely need. Such as a copybook for connecting to MySQL or Postgres, even Oracle. Since OC has an excellent CALL statement, we could use this to achieve our ends without burdening Roger. Copybooks for web server variables, GETS and POSTS or for sending web pages back out (CGI) are a desired goal as well. Of course, this is just a brief list of ideas and we've not fleshed them out here. I'm just throwing them to yall so that you can get an idea of the scope several of us OC users are thinking. In all of this of course we have a lot of practical considerations. To achieve and sort of real success we need to put our minds together. Of course those of us involved so far, are leaning towards our combined code being FOSS (GNU GPL2/3?). So anyone that participates, and even those that do not, would be able to take our work, expand upon it and use it in interesting ways. With that in mind a few of us are going to meet on an upcoming Saturday in IRC. After we are together I might connect up WEBEX just so we can talk in voice. Or perhaps just SKYPE or some similar tool. However IRC should be enough to get us going on these tasks. Even if you are new to COBOL, or are just interested in watching the proceedings, or throwing out ideas for tools you would like to see developed, you are more than welcome to come. The more the merrier. Where: [b]FREENODE IRC[/b] Channel: [b]#add1tocobol[/b] Date: [b]Sunday September 21st[/b] Time: [b]2:00pm (14:00) UTC[/b] Please keep in mind the time is UTC, and adjust for your time zone. For instance the America's Eastern Zone is UTC-5. So they would join us at 9:00am in their local zone. We have a lot to start knocking out and look forward to all that wish to come. I do want to emphasize this is not a projected supported or endorsed by Roger or Open Cobol. We're just some folks getting together on our own. Also we wont be working on the Open COBOL compiler code. Rather, we will be working on code in COBOL itself. Any questions feel to email me or contact us via #add1tocobol on Freenode. If you go into the channel, msg me directly and be aware please you might have to wait a while. Lots of us that are there are very busy. But if you are patient and wait, we'll say hi as soon as we are at our computers and see you there. ---------------------------------------------------------------- If you have something you would like to be added to the agenda, please add it here. Some things: 1. Settling on a recommended IDE and shared IDE tools. 2. Project process rules (doing things the COBOL way...) 2a. Program spec. 2b. Flowchart. 2c. Coding. 2d. Documentation. Basically what I am suggesting here is that we follow the process we did back in the old days. We might have lots of people contributing and we need to understand it is not just a matter of jumping in and writing code. We have to be able to maintain this code probably over the next 50 or 100 years. That's what I am shooting for. So we want everyone on the various teams to do it right from the start. 3. Coding Standards. free? fixed? format? var names code structure when to use what type of RESERVED words when to put something into a copybook when to use oop (when its available) 4. Sample Code. 5. Sample Data. 6. Modules in COBOL: 6a. Open Accounting. 6b. Payroll 6c. Employee Time Clock. 7. Copybooks 8. Screen Section. 8a. Ncurses (Roger) 8b. Cobcurses. 8c. GUI 8ca. GTK? 8cb. Q? --- More to come later. If anyone adds suggestions and they seem viable I will edit this one. ---------------------------------------------------------------- I'll add my opinions; 1) Choose more than one and build them up. 2) Agree; but I'd like to merge a,b and c,d flowcharts part of the spec and documentation in the sources (along with external docs). I've been checking out doxygen and I think we can work out an OpenCOBOL cool docstring format and perhaps an OpenCOBOL app that pulls them out. 3) Back to; choose more than one. Formatting code and document style are very personal. The flexibility of OpenCOBOL should be embraced. I find Francois' choice of source formatting easy to read, but I may not write things that way. I would not like to force my style on Bear, nor would I appreciate anyone dissin' my code solely due to style. I'd also try to follow Bear style if I was to come in after and do a maintenance pass. On the same vein, I won't mind if a maintainer reformats any of my source if it makes them more productive while working out problems. Within limits of course. The balance of Freedom To and Freedom From. 4) When I've been doing samples, I actually try different styles (within my comfort zone) for each one. It is part of highlighting the flexibility inherent in OpenCOBOL, and it helps me learn the ins and outs as I go. We need more samples, yes, and I'll include in that, samples of various development styles. 5) This is something that we should duke out and narrow down to very few choices. Different apps should have a common ground and data forms may well be that common ground. Building up an assortment of interoperable tools will have a better chance of success. 6) Yep. 7) Yep. And this is perhaps one area of the source code where developer choice is more restricted than what I mentioned in 3. 8) Yep. But with 8cb, I think Qt bindings will be more of an uphill battle that the GIMP Tool Kit. GTK+ is "object oriented C", the bindings will be easier to envision and implement (imho) than trying to bend Qt's C++ to the ways of C. 8d. cURL and perhaps other net enabling technology. Gee, perhaps we should look forward to GRID computing and get in on the CERN LCG. 8e. Encryption 8e. More POSIX. POSIX MQ (while not yet release ready - was a fairly short development effort). 8f. A big one. Step back and write up a document / examples of clean wrappers for cob_field. That'll move the burden of the C stack frame and zero terminated strings out of the OpenCOBOL space and onto the shoulders of an extension writer. I've not done that with anything I've written so far, but I think the benefits to developers will be worth the upfront effort. With an added benefit of making for more "pure" COBOL. Plus the benefit of fielding is the removal of a lot of security worry associated with C buffer overflow etc. This is something I will (try to) be doing before publishing the POSIX Message Queues layer (I dislike forcing the OpenCOBOL side to worry about the zero terminated errno strings, and I'd like a safer, simpler structure for getting the callback address moved around). 8g. Get the Firebird GPRE working. Embedded SQL seems to be one symbol (isc_sqlcode_s) away from being ready to roll and start a down and dirty debug pass on. Firebird may not be the most popular open SQL engine, but I've rarely heard anything but rave reviews from users. (Including one of my REBOL heroes, Graham Chui who uses it to run an open and online Medical Record system) 8h. Scripting. Start a research pass on adding a callable scripting engine. LUA and Falcon (Giancarlo really seems to be pulling off some miracles and seems worthy of support) is where I would start. Forth (Ficl), REBOL/3 (not released yet - but if it was, it would be where I would really start (and end) - love REBOL), and others to be named would also be options. Unfortunately embedded Ch is not open. Scripting from COBOL in and of itself would be worthy of a thesis paper, but I think we could narrow down a synopsis document after a few days of google time and the odd heated argument. Looking forward... Cheers, Brian ---------------------------------------------------------------- Oh, by the way. If this is going to be a group meeting on IRC; I suggest we get used to the formalism of Robert's Rules of Order. It can be a pain at first, but it really does keep meetings on track and focused. Being online, and perhaps split over many days of electronic communications, and not around an actual table, I use a relaxed form of Robert's Rules when I chair the REBOL user group meetings. I coined the term Bob's Rules for that. Anyone that doesn't know about RRoO, check out http://www.robertsrules.com/ for details. Basically it is what you see when you watch CSPAN (CPAC for us Canadians). A chair recognizes a speaker and that speaker has the floor until relinquished. Agenda items are forwarded and are not on the table until seconded. No speaker gets a second turn until all other members have had a chance to speak to an issue. And this is where Robert becomes the slightly less formal Bob. Participants may not see who is actually in the "room", so more than one issue can be active. It also means nothing is decided until a majority vote decides. And the chair can call points of order to calm things down when needed. Or not. Semi organized Chaos gets things done too, but may lead to more side chats and off topic discussion than Bob's Rules of Order forces on a group dynamic. Cheers, Brian ---------------------------------------------------------------- I'm out of time (vacations without computers), but I like to add "[url=http://www.opencobol.org/modules/newbb/viewtopic.php?viewmode=flat&topic_id=321&forum=1]Available types of ISAM (BDB/VBISAM/...) in OC[/url]" to the agenda. Maybe anybody knows some facts or at least good rumours about this topic. ---------------------------------------------------------------- Brian, 1. Agree. 2. Makes sense. The more we can do to make sure we have everything documented the better off we will be. 3. I am split on this. One of my concerns is that when we need to debug we dont want to have to reformat just to add the D. I am not particularly thinking of things like Caps or not. But even so using caps could tell us things. Certain ways of prefacing a var will tell us the type of var, without having to go to the copybook or the working storage section, we can tell instantly right in the code that A_somvar is an alpha. That's not what I am suggesting, but just some kind of way to help us instantly know what the other person did and meant in addition to the code reading itself. I'm thinking of PHP pear as the idea here. Not using their methods but their concept...if you want code included you have to do it this way..so we dont have to spend time trying to analyse your code if we need tow ork with it. With cobol this becomes even easier. But since I dont have a standard myself, I'm not set in stone on this. 4. Yeah you have some really great examples. I want to put those rather than in the FAQ only, into a downloadable resource. Something automatic where people can post their code. 5. Yes. Some way to have data so we can test our apps. I think it should be on a field bases...here is logic (or premanufactured) first names, addresses, zips, FAKE credit card numbers (there's actually a set of standards that are publicly available for this to make sure your app catches bad credit card numbers) That kind of thing 7. This is definitely the most important areas for coding standards. So I agree.. 8. Excellent! 8h. From our conversation: (12:09:46 PM) aoirthoir: what do you mean scripting engine though? (12:10:34 PM) btiffin: Umm, CALL "LUA" USING "this-script.lua" (12:11:03 PM) btiffin: where this-script.lua could be generated on the fly as "text" (12:11:12 PM) aoirthoir: ah (12:11:31 PM) aoirthoir: ok so CALL "PHP" USING "myfile.php" Bobs rules of order...we can even voice if we need to. The one good thing is that we can log the chat..so we're set there Human, I have to find the link but there is something with vbisam that Roger posted. ---------------------------------------------------------------- Licensing: Programs and documentation. I'd prefer both be copylefted. I dont want to have to ask permission if I include some piece of something we've all created together, to include that in a commercial client's app either. So I think a GNU GPL/FDL is my preference. ---------------------------------------------------------------- [quote](12:11:03 PM) btiffin: where this-script.lua could be generated on the fly as "text"[/quote] More info; By "text" and with an embedded script language that does not mean a textfile, but sourced directly out of OpenCOBOL WORKING-STORAGE or LINKAGE SECTION. For a sample of calling scripts with textfiles, see the gnuplot sample at http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=293&forum=1 We can do that today, right out of the OC1.1 box. I'd envision a much tighter integration than that with an embedded system. Cheers, Brian ---------------------------------------------------------------- To 3rd: Most time you can see the type of a var because[code]if a = 1[/code]tells you it is numeric. Anyway I prefer suffixes for type hints. For redefined vars it's usable to have definitions like[code] 01 some-var-x pic x(03). 01 some-var-9 redefines some-var-x pic 9(03).[/code] If there are 'special' types used, like comp/binary/... it would be usable to have names like some-var-b, some-var-c3, some-var-cx, some-var-c5 and so on. What ever we are going to do, var-names like some-var or i1 should be blamed, because nobody knows what is meant. Var-names like count-var1 or tmp-text1 are better, names like file1-status hit the point. ---------------------------------------------------------------- Agreed on ALL of that human. I had not thought of suffixes. It makes searching for your var names easier. Count me dumb sometimes. Also this: [quote]What ever we are going to do, var-names like [b]some-var or i1 should be blamed[/b], because nobody knows what is meant. Var-names like [b]count-var1 or tmp-text1[/b] are better, names like [b]file1-status[/b] hit the point.[/quote] I am amazed at the number of programmers who program this way. What's going to happen with Open Cobol and add1tocobol, is that we are going to suddenly see an influx of folks that never programmed and folks that have but that never programmed in COBOL before. The ones that never programmed of course need standards because it will make their coding easier. They won't have to think, should I call this I or Z, because they will know to call it what it means. FILE-STATUS. DONE. So we would be starting them off with good habits from the rip. That's what I mean when I say the COBOL way. But we will also get an influx of folks that already have ingrained bad habits from other languages. So if we have standards that are *required* for inclusion, we can make sure that their bad practices won't be allowed to carry over. Now, it might be things like naming of vars, procedures and so on. In fact your example shows it will. But it will also include some other things. Not sure what yet, we have our agenda growing though for sure. ---------------------------------------------------------------- Some other things of "my" coding standards that I see as usefully, maybe we want to agree to some of them: 3.h01 use as less paragraphs as possible 3.h02 use sections and things like "exit perform" instead 3.h03 do not use "go to depending on" but instead do an "evaluate thisspecialvar" with "when 01 perform thisspecialsection01" 3.h04 use "go to" only for beginning and end of a section 3.h05 have always a paragraph "00." at the beginning and "ex." at the end of a section (maybe kick the "ex." out and use "exit section" instead, if it's the same - I've never used it before) 3.h06 use the point "." only where necessary (because it's silly if you want to put some old code into an if/evaluate/perform/... and have to remove all points at the line end) 3.h70 use always the corresponding end-..., if there are some. 3.h08 put every code that can be valuable for other programs into sub programs (for example calculations for date/time with working days, days, ...) 3.h09 if possible use a copy with 1 level 01 var for linkage of sub programs 3.h10 use always some 'remnants' in linkage of sub programs: if there is some new functionality of the sub program and a new item in linkage is needed one can use part of the unused remnant stuff. Only the sub program and all programs that uses the new functionality have to be recompiled, because the size and the items (one 01 level) of the linkage does not change. What do you think about these? ---------------------------------------------------------------- Another point to talk about / research before the meeting: I've tested the needed memory with early OC1.0 and found out, that if you do a CALL and CANCEL 'MYBIGPROG' with big working storage; the used memory stays the same. If you do this in a huge application with a lot of programs the memory is flooded with OC. Does this problem still exists? If yes: Does this depends on the system where OC is used? Are there any solves for that? I've did the following with these progs and two consoles: run TESTPGM, see memory usage with top, press enter and see memory usage again, ... It rises and rises until stop run is performed. [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. 'TESTPGM'. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. * WORKING-STORAGE SECTION. * 77 mychar pic x. *----------------------------------------------------------------- LINKAGE SECTION. *----------------------------------------------------------------- PROCEDURE DIVISION. declaratives. end declaratives. *----------------------------------------------------------------- main section. 00. display 'TESTPGM loaded' accept mychar * call 'BIGPROG1' cancel 'BIGPROG1' display 'BIGPPROG1 was cancelled' accept mychar * call 'BIGPROG2' cancel 'BIGPROG2' display 'BIGPPROG2 was cancelled' accept mychar * stop run * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program TESTPGM --------------------------------------[/code][code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. BIGPROG1. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. * WORKING-STORAGE SECTION. * 77 mychar pic x. 77 somebigthing pic x(9999999). *----------------------------------------------------------------- LINKAGE SECTION. *----------------------------------------------------------------- PROCEDURE DIVISION. declaratives. end declaratives. *----------------------------------------------------------------- main section. 00. display 'BIGPROG1 loaded' accept mychar * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program BIGPROG1 -------------------------------------[/code][code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. BIGPROG2. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. * WORKING-STORAGE SECTION. * 77 mychar pic x. 77 somebigthing pic x(9999999). *----------------------------------------------------------------- LINKAGE SECTION. *----------------------------------------------------------------- PROCEDURE DIVISION. declaratives. end declaratives. *----------------------------------------------------------------- main section. 00. display 'BIGPROG2 loaded' accept mychar * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program BIGPROG2 -------------------------------------[/code] I think this is a big problem for using OC in a production environment. Do you agree? ---------------------------------------------------------------- Human I like your suggestions and will incorporate them into the agenda for the 20th. ---------------------------------------------------------------- The original post on the forums is here: http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=333&forum=1 I stated the following regarding time and place: Where: FREENODE IRC Channel: #add1tocobol When: To be announced. Please let me know your preference. If at all possible please state your time and time zone UTC. Most likely though we are leaning towards Morning, about 9am Eastern Time. That's UTC - 5 hours. So UTC Time is: 2:00pm (14:00). I've not gotten back feedback on the times that people prefer. I chose the time I did because I know that we have some folks coming from other parts of the world. But, this time will make it difficult if anyone is on the west coast of the United States. It really comes down to who is coming from where, and what times we can all manage. So I am putting out the call now and closing it on Weds. If I don't get back and feedback I will go ahead with the 9am time. Also to help keep this list clear of the projects we are working on we'll be moving these discussions to the add1tocobol mailing list. If you want to join that please send me a message at aoirthoir@add1tocobol.com with the subject line reading "JOIN add1tocobol MAILING LIST" As always, comments welcome. -- Joseph James Frantz (Aoirthoir) September 20, 2008 add1tocobol meeting at: #add1tocobol on Freenode IRC. add1tocobol.com ---------------------------------------------------------------- We have our final schedule. Where: [b]FREENODE IRC[/b] Channel: [b]#add1tocobol[/b] Date: [b]Sunday September 21st[/b] Time: [b]2:00pm (14:00) UTC[/b] Please keep in mind the time is UTC, and adjust for your time zone. For instance the America's Eastern Zone is UTC-5. So they would join us at 9:00am in their local zone. ---------------------------------------------------------------- Potential automatic conversion tools for code written for other compilers to OC (standards) compliant code. See this thread as an example discussion: http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=341&forum=1 I replied there: [quote]This could actually be something that we set up as one of our side projects on add1tocobol. If there are a significant number of people that need to move from MF to OC and have these issues then we could work on them as a team. It might be a simple adjustment of some code in certain cases, or require significant meta-programming conversions in others. I will add it to the agenda.[/quote] ---------------------------------------------------------------- 1. IDE: There was an Eclipse COBOL IDE project (http://www.eclipse.org/cobol/), I don't think this was stable but may form the basis of an OC IDE project. 3. Whilst I agree that a style guide may be useful, every shop has a different style, for example in my last company it was a sacking offense to use a goto or alter anywhere, and we had a precompile checker that enforced this, and my first company banned them in 1978 - it was considered unprofessional to use them then. Good style should include things like: i. No section labels, gotos or alters in the procedure division. ii. Use (short) paragraphs to modularise the structure using 'structured programming' methodology (a paragraph should do one and only one thing and ideally be no more than about 20 lines (unless it is something really simple like a collection of related move statements) - you should be able to 'see' the unit of logic in one screen in one go without scrolling). iii. Use a full stop (.) only on its own line at the end of the paragraph. iv. Use a matching end- for every if/perform/evaluate/subtract etc. and indent code between them. v. The top paragraph should be not much more than: perform a-init perform b-main perform c-end goback . vi. Sub paragraphs should be named according to where they are performed from e.g. aa-open-files ... ca-close-files with z... indicating common modules (this also gives a quick visual indication of where you are in the code structure and makes the code you are looking for easier to find when maintaining an unfamiliar program) Another company I worked at did use section labels and goto's and long rambling sections (the longest I had to deal with was about 2000 lines), you can guess which made for clearer more readable/maintainable code and which was hell to maintain and full of bugs. I think that the entry level for contributing to a COBOL project is an understanding of structured programming. ---------------------------------------------------------------- canalside Good points. I will add them to the list. Are you on the add1tocobol list? If not email to aoirthoir@add1tocobol.com with a subject line of "JOIN add1tocobol MAILING LIST" Hopefully you can join us on Sunday. We'd love to be able to have your input. ---------------------------------------------------------------- I think having COBOL training videos and OC training and so on would help. It would also help the uptake of OC if we had videos on Youtube. ---------------------------------------------------------------- Regarding a couple other things: 1. Test Driven Development. 2. Unit Tests. 3. OC Uptake and SME viability. 4. Potential business models for add1 and others. Here is a snippet of a conversation between me and Btiffin: (12:42:44 AM) aoirthoir: are you familiar with test driven development? (12:42:50 AM) btiffin: He and Keisuke have built a tool that add1 can support and bet on. (12:43:00 AM) aoirthoir: right..exactly (12:43:30 AM) btiffin: Yep. I use tests inline with coding. I'm a fan of D because of it. (12:43:44 AM) aoirthoir: ok (12:43:53 AM) aoirthoir: the one type that I was explained..not sure if it is similar (12:44:00 AM) aoirthoir: what you do is..instead of writing the code for what you want (12:44:22 AM) btiffin: In REBOL we have Run (REBOL UNit test) (12:44:35 AM) aoirthoir: you write code to test the results of what you expect..then, you write code that fails the test to make sure your test says HEY..this is the wrong data, or result etc..then finally you write the code to do the right thing and run it through the test (12:44:41 AM) aoirthoir: exactly (12:44:46 AM) aoirthoir: ok so then you are talking about the same thing (12:44:57 AM) btiffin: Yeah, I can (12:45:27 AM) btiffin: Yeah, I can't say I follow TDD, but I follow Test During Development (12:45:43 AM) aoirthoir: most of our tests are by hand (12:45:46 AM) aoirthoir: and the users.. (12:46:05 AM) btiffin: My Forther days ... write one word. test one word. write next word. test it, then test both, then write third etc... (12:46:08 AM) aoirthoir: but there is always something they miss..so I think if we start adding automatic testing..both of the software..and of the users testing..taht would be good (12:46:15 AM) aoirthoir: ah (12:47:15 AM) btiffin: I've accelerated the extensions for OC. What I post is not what I would "publish". Those will have autodoc, crossplatform conditionals and the unit tests. (12:48:11 AM) aoirthoir: ok i think then that unit tests might be something we should consider as a part of add1 (12:49:08 AM) btiffin: absolutely. especially for regression tests. One character change to code can break unexpected things. Best to have a tool find that out before releasing. ;) (12:50:06 AM) aoirthoir: Well especially if add1 moves more into the area that we are talking (12:50:32 AM) aoirthoir: that is becomes a serious source for SME support, and developers (maybe a collective? of sorts as well as a business model) (12:50:58 AM) btiffin: As canalside recently (and human before) stated. PitL (Programming in the Large) comes with a very large set of potential problems. (12:51:17 AM) aoirthoir: then I think unit tests and having them be a requirement, might be a good idea..the more we can expect to know what code is going to look like..the more we can easily write tests, and maintain code (12:51:45 AM) aoirthoir: right..I dont know if canalside signed up for our list or not..i hope they come to the meetin on sunday (12:52:10 AM) btiffin: I'd like to clone the OC test case manager and perhaps the NIST test runners. (12:52:42 AM) aoirthoir: im going to grab this and add it to the agenda if you are ok with me just copying? (12:52:51 AM) btiffin: Those routines are pretty good. (12:53:25 AM) aoirthoir: yeah see I really need a complete walk through on all of this..there is a lot to OC that I just do not know about..our conversations here are helping me with that (12:54:11 AM) btiffin: go to town. Anything in this channel is public .. ---------------------------------------------------------------- We are having the meeting right now. All are welcome to join us. Info: Where: FREENODE IRC Channel: #add1tocobol Date: Sunday September 21st Time: 2:00pm (14:00) UTC web access: http://www.add1tocobol.com/i_o_control.php Sorry for the confusion about the time everyone. I am in UTC-5 but I think that we are using Daylight Savings Time which may have messed up our UTC and put us at UTC-6. I am not sure and will investigate the issue for next meeting. ---------------------------------------------------------------- I've updated my Cygwin OC installation at home and tested this thing about missing memory clean-up there. It still exists. Because of [quote][url=http://www.add1tocobol.com/chatlogs/2008-09-21.html]Roger wrote[/url]: [...] nobody asked when OC 1.1 is going to be released [...] Actually, regardless of outstanding things, as soon as I have ironed out a couple of bugs, it will be done[/quote] I really hope this one is part of the bugs that will be ironed out for 1.1 release. Human (from vacations) ---------------------------------------------------------------- Subject: New Member Introduction Hi. I have been a COBOL programmer for many years, with my background ranging from small RM-Cobol systems (CPM, MPM, DOS, Novell and XENIX...yes, I said "years") to big iron (IBM 3090 series). I currently work with Lawson software, which they call "Lawson 4 G/L", which is of course nothing more than pseudo-compiled MicroFocus COBOL with a modified run-time monitor. I have written a complete general ledger system for my own books under RM-Cobol with indexed data files which I now run under a Qemu emulation of Dos620, and I would like to translate this to OpenCobol so that I may execute it directly under Linux. I'm looking into screen position handling of DISPLAY and ACCEPT as being the biggest hurdle to jump for translation, as the RM-Cobol system uses "LINE" and "POSITION" parameters, along with some other "CONTROL" values. I have not used the more esoteric control features extensively in my system, as it is pretty generic, but I still need to understand what is available under OC and how to use it. (Actually, most of the code is generated by a source code generator that I wrote in RM-Cobol 20+ years ago, which is based on correcting what I saw as deficiencies in the one being used by the guys I was working with.) Anyway, does anyone here have an example program which shows how to control those elements under OC or documentation of same? Examples of indexed data file definition would be handy as well as caveats on setting the system up to use them. Stuart ---------------------------------------------------------------- Hello Stuart; I'll start by saying that I am amazed by OpenCOBOL. Everything I have tried has worked. With a caveat. I'm only pushing OpenCOBOL where I want to play. This can be different than having a defined problem that needs to be somewhere and using the product to get there. I look forward to being in that position someday - boss or team members breathing down neck, deadlines looming - but for now, everthing attempted has been supported and functional. Our good Bear (Francois) has posted up some nice display examples; Try http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=250&forum=1 http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=282&forum=1 http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=253&forum=1 http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=328&forum=1 and look at http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=290&forum=1 I posted a useless marquee style sample at http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=286&forum=1 And look for posts from coboleo; good stuff those. Note; these particular snippets mention troubles as well as successes. SCREEN SECTION support is pretty new, and will evolve I assume. But even without screen section the DISPLAY verb can be positioned. And if that doesn't fly - Warren Gay did a fairly huge CobCurses project, a release announcement at http://www.opencobol.org/modules/newbb/viewtopic.php?viewmode=flat&topic_id=151&forum=1 As human points out, there may be some issues with OC1.1 integration, but if asked to help, someone here (not always, but usually) steps up. Cheers, Brian ---------------------------------------------------------------- Stuart, I'm not much help there yet. But you are already doing some things we are talking about in another thread. If you are interested in working with us on similar things and would like it to be FOSS, check out the thread here and see if the meeting time meets your schedule (all online) http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=333&forum=1 Welcome to OC! ---------------------------------------------------------------- My schedule is extremely tight right now...just got handed two major reports that need to be in production in less than a month, so it is not likely that I can address much of this now. I just learned of these reports after I wrote my intro. My system has matured over the 20-odd years I have been using it. It started under RM-Cobol Ansi74(?) and migrated to 85 when it was available. I have even written a set of math sub-programs to do SIN, COS, TAN, LN and their inverses in a decimal arithmetic method which is more accurate than any inherent floating point calculations. These were written to ANSI 68 standard, so are VERY generic. I haven't used those in years. My code generator works with a "skeleton" program, so changes can be made to the "skeleton" and all unmodified programs can be regenerated/recompiled in one step to incorporate a global change quickly. My menu system is a 100-option flexible menu with 9 security levels for users. It operates multi-user except that a record deadlock will occur if a user stays on a record on an update screen and walks away...nun w/ruler time. I also worked briefly with the Realia workbench too on a project where I hand wrote a replacement program for a defective IEF piece of code for a phonetic encoding algorithm. Anyway, I've been around the block a few times and I look forward to getting OC up and running on my Linux box...hopefully by the time I retire from the rat race...the rats keep winning. ---------------------------------------------------------------- thanks. I'll check these out as I have time. ---------------------------------------------------------------- Ok, I quickly tried the "fields.cob" test, and it won't compile. It appears that the "with" clause of the display is tripping it up, so I must be missing something. Any tips? ---------------------------------------------------------------- What version of OpenCOBOL? Pretty much everthing we talk about in here is OC1.1 which we build from Roger's nicely frequent tarball. See the OpenCOBOL 1.1 pre-release download. I only ran the 1.0 system for about five minutes. Long enough to know I wanted to support the cause and then snagged the latest and greatest. :) Cheers, Brian ---------------------------------------------------------------- Subject: Using info from the COBOL Standard? I bumped into this snippet on the cobolforgcc page; http://cobolforgcc.sourceforge.net/cobol_2.html#SEC6 [quote] Any organization interested in reproducing the COBOL standard and specifications in whole or in part, using ideas from this document as the basis for an instruction manual or for any other purpose, is free to do so. However, all such organizations are requested to reproduce the following acknowledgment paragraphs in their entirety as part of the preface to any such publication: COBOL is an industry language and is not the property of any company or group of companies, or of any organization or group of organizations. No warranty, expressed or implied, is made by any contributor or by the CODASYL COBOL Committee as to the accuracy and functioning of the programming system and language. Moreover, no responsibility is assumed by any contributor, or by the committee, in connection therewith. The authors and copyright holders of the copyrighted materials used herein FLOW-MATIC (trademark of Sperry Rand Corporation), Programming for the UNIVAC (R) I and II, Data Automation Systems copyrighted 1958, 1959, by Sperry Rand Corporation; IBM Commercial Translator Form No. F28-8013, copyrighted 1959 by IBM; FACT, DSI 27A5260-2760, copyrighted 1960 by Minneapolis-Honeywell have specifically authorized the use of this material, in whole or in part, in the COBOL specifications. Such authorization extends to the reproduction and use of COBOL specifications in programming manuals or similar publications. [/quote] Is that for real? If so, I assume it means I can snag a copy of COBOL-85 (or does this go back to -68? It can't be -2002 can it?) and then start writing up an OpenCOBOL compliance document by simply marking up where necessary? I'll admit I'm a little confused, but if this is true, it's going to save me 100's of hours of work (or more honestly, will mean we'll actually get a far more complete set of docs than if I have to write everything from first principles.) Anyone in the know; I'd like to get this cleared up, and again if true ... I know what I'm doing next weekend. :) Note; opinions will be treated suspiciously. I'll need some fairly hard legal advice before I'd risk the OpenCOBOL project to any future problems. But I'm hopeful ... which of course means I gotta be very careful. Cheers, Brian ---------------------------------------------------------------- Brian, We need to get on this. I am busy tomorrow..way busy. So I will have to check it out next week. If we are able to get the spec for free and DISTRIBUTE it for free that would be great. I paid only 30 bucks for it from ANSI..but that wasn't even the issue. FINDING it on their site was. Also we need to find out just what license it has, could we include it with GNU FDL docs? That kind of thing. ---------------------------------------------------------------- Subject: Playing with integers & dates Hello, This post is mostly for Brian's FAQ building, how to and So On. [code] >>SOURCE FORMAT FREE *>********************************************************************* *> Author: Bear (Francois Hiniger) *> Date: 05-Sept-2008 *> Purpose: Playing with Functions date-of-integer / integer-of-date *> Tectonics: cobc -x datefun.cob *> ./datefun *>********************************************************************* identification division. program-id. datefun. data division. working-storage section. 77 date-d pic 9(08). 77 date-r pic 9(08). 77 N pic 9(03). procedure division. debut. move 20080101 to date-d. perform varying N from 0 by 1 until N > 60 compute date-r = function date-of-integer (function integer-of-date (date-d) + N) end-compute display date-d (7:2) "/" date-d (5:2) "/" date-d (1:4) " + " N " = " date-r (7:2) "/" date-r (5:2) "/" date-r (1:4) end-display end-perform . fin. exit program. [/code] I tried with another compiler, It Works Fine. Best Regards "Good" Bear ... :-D ---------------------------------------------------------------- Nice one Bear. Added it to the "still to be properly organized" samples. Joseph (aoirthoir) has been doing some great work on add1tocobol.com and along with anything officially accepted by Keisuke and Roger (K&R) for OpenCOBOL this sort of thing will also make its way to the FILE SECTION of aoirthoir's promotional site. Cheers, Brian ---------------------------------------------------------------- Some more fun with dates to display a calendar. [code] *>********************************************************************* *> Author: jrls (John Ellis) *> Date: 05-Sept-2008 *> Purpose: Using the functions date-of-integer / integer-of-date *> and mod to write a calendar. *>********************************************************************* identification division. program-id. datefun. data division. working-storage section. * 01 date-a pic 9(08) value zero. * 01 date-s. 05 date-s-ym pic 9(06). 05 filler pic 9(02) value 1. 01 startdate redefines date-s pic 9(8). 01 date-s2 redefines date-s. 05 ds-year pic 9(4). 05 ds-month pic 99. 05 ds-day pic 99. 01 daysub pic 99. 01 wksub pic 9. 01 date-c pic 9(08). 01 day-s pic 99. 01 wscurrent. 05 cdate pic 9(8). 05 filler pic x(20). 01 calendar. 05 cmonth. 10 mday pic 9(8) value zero occurs 42 times. 05 cweek redefines cmonth occurs 6. 10 cday pic 9(8) occurs 7 times. 05 cdays redefines cmonth occurs 42 times. 10 cdays-ym pic 9(6). 10 filler pic 99. 01 out-week. 05 owday occurs 7 times. 10 weekday pic zzz value zero. 10 filler pic x value spaces. 01 months. 05 filler pic x(9) value "January". 05 filler pic x(9) value "February". 05 filler pic x(9) value "March". 05 filler pic x(9) value "April". 05 filler pic x(9) value "May". 05 filler pic x(9) value "June". 05 filler pic x(9) value "July". 05 filler pic x(9) value "August". 05 filler pic x(9) value "September". 05 filler pic x(9) value "October". 05 filler pic x(9) value "November". 05 filler pic x(9) value "December". 01 months2 redefines months. 05 wmonth pic x(9) occurs 12 times. procedure division. 0100-start. display "Enter date or 0 to get current day>>" with no advancing. accept date-a. if date-a = 0 move function current-date to wscurrent move cdate to date-a. compute date-s-ym = date-a / 100. compute date-c = function integer-of-date(startdate). compute day-s = function mod(date-c,7). perform 0110-loadCalendar. perform 0120-writeCalendar. stop run. 0110-loadCalendar. compute daysub = day-s + 1. perform varying daysub from daysub by 1 until daysub > 42 compute mday(daysub) = function date-of-integer(date-c) if cdays-ym(daysub) <> date-s-ym move 0 to mday(daysub) move 43 to daysub end-if add 1 to date-c end-perform. 0120-writeCalendar. display wmonth(ds-month) " " ds-year. display "sun mon tue wed thu fri sat". perform varying wksub from 1 by 1 until wksub > 6 perform varying daysub from 1 by 1 until daysub > 7 if cday(wksub, daysub) = 0 move zero to weekday(daysub) else compute weekday(daysub) = function mod (cday(wksub, daysub), 100) end-if end-perform display out-week end-perform. [/code] ---------------------------------------------------------------- Thanks John, that's cool. I've snagged it for the samples. Modifications; I added a line 1 >>SOURCE FORMAT IS FREE but that isn't really necessary and changed comments lines 13, 15 (14, 16) to *> Before publishing, might change the prompt to include a YYYYMMDD expected input hint. Other than that; builds nice and well ... yay! Cheers, Brian ---------------------------------------------------------------- Subject: I-O SELECT The following returns errors : CPY/a.sel:5: Error: 'THISKEY' undefined CPY/a.sel:6: Error: 'stat' undefined although STAT is defined in WS command: cobc -x -free -ICPY a.cob version: 1.1 [code] select THISFILE assign to disk organization is indexed access mode is dynamic record key THISKEY file status STAT. ... fd THISFILE label records are standard value of file-id THISFILEID. 01 THISREC. 03 filler pic xx. 03 THISKEY pic x(5). 03 filler pic x(505). [/code] ---------------------------------------------------------------- hello Konenas, This is your program : [code] >>SOURCE FORMAT FREE identification division. program-id. konenas. environment division. input-output section. file-control. select THISFILE assign to disk organization is indexed access mode is dynamic record key THISKEY file status STAT. data division. file section. fd THISFILE label records are standard value of file-id THISFILEID. 01 THISREC. 03 filler pic xx. 03 THISKEY pic x(5). 03 filler pic x(505). working-storage section. 77 stat pic XX. 77 ThisFileId pic X(30). procedure division. begin. move "ThisName" to ThisFileId open input THISFILE display ThisFileId "Status=" stat end-display close THISFILE. ultimate. exit program. [/code] ~$ cobc -V cobc (OpenCOBOL) 1.1.0 Built Aug 25 2008 16:16:05 Packaged Thu Aug 21 18:15:31 CEST 2008 Copyright (C) 2001-2008 Keisuke Nishida / Roger While cobc -x konenas.cob No Errors Regards Bear ---------------------------------------------------------------- Bear, you are absolutely right. Comments in the copy files included made the problem. Erasing them, everything went fine. Thanks. PS. I was expecting OC to ignore 80 columns limit with -free directive. ---------------------------------------------------------------- Subject: Screen I/O in KDE Konsole I was somewhat flumoxed to find that the screen I/O appeared to work fine on a native terminal, but not in the GUI terminal (I am using Mandriva Linux, Konsole terminal emulator). The problem, however, seems to be solved. To get things working correctly in Konsole, the terminal type must be set to VT100. Executing it with the command "konsole -tn vt100" will cure the problem Donald ---------------------------------------------------------------- Thanks for posting the fix . ---------------------------------------------------------------- Looks like a Mandriva problem. Works fine on all KDE's that I can test (Suse, Redhat, Ubuntu). What exactly are the symptoms? Can you post the output from "infocmp" run within the emulator. Roger ---------------------------------------------------------------- Subject: add1tocobol list. As many of you know, several of us OpenCobol lovers have started to plan some projects using the compiler. We have a lot of ideas and plans in the works. Many of them are directly related to OC. But some of them are things that I fear will clutter Roger's list. So I have set up a separate list specifically for these projects. If you are interested in participating then email me at aoirthoir@add1tocobol.com and I will add you to our mailing list. As always we're very excited about the path that Roger's taken OC and can't wait to really get started hunkering down with it. I believe this list will help us to do just that. ---------------------------------------------------------------- Subject: gnat Ada interface example Hello coders, One way of calling Ada (gnat) procedures and functions from OpenCOBOL. This works for me with Debian 4.0, OC1.1 (recent), gnat 4.3 The idea is to compile object, bind, compile bound object and then let OpenCOBOL do its thing linking the gnat lib, the Ada body object and the Ada binding object (-n for no main on the gnatbind). [code] $ gnatgcc -c helloada.adb $ gnatbind -n helloada $ gnatgcc -c b~helloada.adb $ cobc -x -lgnat caller.cob helloada.o b~helloada.o [/code] Cheers, Brian [b]caller.cob[/b] [code] >>SOURCE FORMAT IS FIXED ****************************************************************** * Author: Brian Tiffin * Date: 08-Sep-2008 * Purpose: Demonstrate using Ada sub-programs * Tectonics: gnatgcc -c helloada.adb * gnatbind -n helloada * gnatgcc -c b~helloada.abd * cobc -x -lgnat caller.cob helloada.o b~helloada.o ****************************************************************** identification division. program-id. caller. data division. working-storage section. 01 ada-message pic x(10) value "Ada echo" & x'0a' & x'00'. 01 result pic s9(9) value high-value. ***************************************************************** procedure division. begin. call "adainit" end-call call "hello" using by value 42 end-call call "echo" using by reference ada-message returning result end-call display "Ada return: " result end-display call "adafinal" end-call goback . end program caller. [/code] With a sample Ada Spec, [b]helloada.ads[/b] [code] with Interfaces.C; use Interfaces.C; package HelloAda is procedure hello(value : in integer); function echo(message : in char_array) return integer; pragma export(C, hello); pragma export(C, echo); end HelloAda; [/code] And body [b]helloada.adb[/b] [code] with Ada.Text_IO, Ada.Integer_Text_IO, Interfaces.C; use Ada.Text_IO, Ada.Integer_Text_IO, Interfaces.C; package body HelloAda is procedure hello(value : in integer) is begin Put_Line("Hello WORLD! from Ada and OpenCOBOL"); Put("OpenCOBOL passed: "); Put(value); New_Line; end hello; function echo(message : in char_array) return integer is begin Put(To_Ada(message, true)); return To_Ada(message, true)'length; end echo; end HelloAda; [/code] Outputting ... [code] Hello WORLD! from Ada and OpenCOBOL OpenCOBOL passed: 42 Ada echo Ada return: +000000009 [/code] Note; the adafinal seems to toss an extra newline, at least here. ---------------------------------------------------------------- Subject: MF syntax and OC support * MF: ACCEPT ( lin, col ) identifier WITH ... But parenthesis are not in OC syntax. Also lin and col could be special identifiers that note current line and column respectively. ----------- MF: READ file WAIT OPEN LOCKING IS EXCLUSIVE/AUTOMATIC/MANUAL OC does not support WAIT verb, also the LOCKING is not supported. ---------- in SELECT statement locking exclusive and ALTERNATE KEY are not supported yet. ----------- MF: copy gpmf.ios. OC copy 'gpmf.ios'. ------------ MF: * in column 1 acts as comment ------------ OC version=1.1 * Can compiler just ignore them with warnings instead of aborting with errors? Parenthesis are not significant, also LOCKING and WAIT. * By the way, where could I find OC supported - or not - commands? ---------------------------------------------------------------- > MF: ACCEPT ( lin, col ) identifier WITH ... No idea what this is. The syntax is not accepted by any MF to which I have access and is not in any documentation that I can find. > READ file WAIT MF extension. Maybe possible to implement although the standard has defined other ways to achieve the same effect. > OPEN LOCKING IS EXCLUSIVE/AUTOMATIC/MANUAL No idea what this is. Only MF syntax I can find is the WITH LOCK clause. This implicitly causes an exclusive lock on the OPEN. Should be possible to implement (although, once again, the standard defines other ways to do this). > in SELECT statement locking exclusive and ALTERNATE KEY are not supported yet. WRONG. Both are supported. > MF: > copy gpmf.ios. > OC > copy 'gpmf.ios'. Correct. Will not be changed. MF violates the standards here. > MF: > * in column 1 acts as comment Violation of the standard regardless whether FIXED or FREE format. We will NOT ever implement this in OC. Consider - [code] COMPUTE MYVAR1 = MYVAR2 * MYVAR3 [/code] Using OC, when compiling as fixed format, we (correctly) get an "invalid expression" error. When compiling as free format, we (correctly) evaluate the COMPUTE as the product of the two variables. Using MF, regardless of fixed/free format, the second line is (silently) ignored. This leads to a maybe unintended result in fixed format and a wrong result in free format. Roger ---------------------------------------------------------------- The MF-COBOL version is : MS COBOL, MF COBOL, COBOL/2 1. ACCEPT ( LIN, COL ) identifier WITH (It is an MS extension) http://www.emunix.emich.edu/info/cobol/books/atamso.htm At paragraph 10.4 or 10.4.1 [img align=left]http://supportline.microfocus.com/documentation/books/sx50/lhdmso04.gif[/img] [img align=left]http://supportline.microfocus.com/documentation/books/sx50/lhdmso06.gif[/img] 2. WAIT verb Show me a way to ignore it (perhaps -ignore=WAIT directive to ignore NOT IMPLEMENTED ) 3. OPEN LOCKING IS ... same as above (-ignore=LOCKING, to much code with it for me to change) 4. LOCKING EXCLUSIVE Maybe I'm not using the latest OC1.1 sources (I use Jul 11, 2007 version) Where can I find the newest version? 5. ALTERNATE KEY Supported but not SPLIT alternate KEY that I'm using a lot. 6. COPY OK MF violates the standard. But to much code with it for me and others to change. 7. comments in column 1 Can we use free and mf directives together? (to much code with it for me to change) If I can contribute in some way with that, please let me know. ---------------------------------------------------------------- 2. 3. 6. 7. ==> we all have to change our old code. It's better to do that instead of riddling OC. Implementing some "ignore NOT IMPLEMENTED" would not help at all: The old code has some intention when WAIT was used, so you shouldn't ignore it. As Roger wrotes: some MF extentions could be implemented (this would help both OC and people porting from MF). If you want to achieve the same now, you have to recode it in the way the standard says it should be done. 5. Is really an important point. The latest tarball from svn can be found at [url=http://www.opencobol.org/modules/mydownloads/visit.php?cid=1&lid=2]the link that is also given on the left side "Downloads --> OpenCOBOL 1.1 pre-release"[/url] (the build stamp could be seen by doing "cobc -version" and should always be given if posting a bug or a feature request). ---------------------------------------------------------------- @human We can't change old code. It's working. If we have to change it significantly, then it's better to stay with old good COBOL/2. I think the hole project would be one or two changes that work under both languages, if we see it cleverly. We maintain 500 programs with 5-10000 lines each. I thought if I could contribute with a special directive it would be effortless. I'm not the only one who has that problems. ---------------------------------------------------------------- If you change it to the "standard way" it works on mostly every system. ---------------------------------------------------------------- @human That's not an answer. We are talking about OC not the "standard way". ---------------------------------------------------------------- This sounds suspiciously like "We are afraid of our code, so we cannot touch it". A simple script to move a "*" comment from column 1 to column 7 would be a no brainer. Changing "copy book" to "copy 'book'" would require a brain, but not make it work too hard. Same for brackets in accept/display statements. The wait and locking statements will require a brain since the move from existing platform to oc based platform will require thinking about the backend db behavior before performing (minor) code changes. The biggest whine I've heard from programmers (starting in 1979) about cobol code is that it cannot be changed without the sky falling. Of course it can change and the change can even be automated, just like the testing that will follow. I spent a good part of my career refactoring cobol code. (Wish I had know the word 'refactoring' back then. Maybe I would have felt special instead of just calling my job 'grunt work'...but I digress). If there are no resources assigned to make/test the changes then conversion to oc is not a real attempt to improve the code base. Leave it where it is. Of course the in-house resources can be diverted to modify oc for a one-time problem. Your in-house resources will have gained a better understanding of the compiler (that's got to be good for the old resume). But the actual code base does not improve. Regards, Gerald. ---------------------------------------------------------------- This is really an example though of why we want to avoid using proprietary extensions in our code, regardless of language. Remember the MS "extensions" to Java. Devs would use those and then suddenly their "portable" java would work only on windows. gchudyk gave the best advice: [quote]If there are no resources assigned to make/test the changes then conversion to oc is not a real attempt to improve the code base. Leave it where it is.[/quote] While I am going to be using OC as my compiler of choice, as is the add1tocobol project, you need to evaluate why you are moving. If the point is to save money by using a FOSS OS, then I can see the benefits. There will be initial costs of conversion though. In this way I would not do it by hand, but use meta-programming techniques, so the conversion is mostly automatic. Then a human should eyeball and test it. As well you could set up test cases to be automated. Extensions I do not mind so much and would be happy to have them implemented in OC. However, things that break the standard, rather than extend it, I am of the opinion, should be avoided at all costs. Just my not so humble opinion. edited to add: This could actually be something that we set up as one of our side projects on add1tocobol. If there are a significant number of people that need to move from MF to OC and have these issues then we could work on them as a team. It might be a simple adjustment of some code in certain cases, or require significant meta-programming conversions in others. I will add it to the agenda. ---------------------------------------------------------------- konenas; Re getting OC1.1 After you've done your first build of 1.1, you can snag the source code from the occurlrefresh thread. http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=285&forum=1#forumpost1601 Compile those snippets, and a quick ./occurlrefresh will fetch the latest and greatest tarball, playing nice with Roger's servers. Add a few call "SYSTEM" lines to the COBOL and you could untar, run configure and make etc.... :-) Fun stuff this compiler. The tool is cool. Re the general case of syntax support. I can only speak as someone that has no codebase to fret over. If I did, I would definitely want as much support in the compiler as possible. But I don't have a codebase, so ... [i]ignorance is bliss[/i]. Cheers, Brian ---------------------------------------------------------------- You have a point for commenting from col 1 to col 7. But changing code to change it is a waste of time. It would be better ways to waste our time and money, like going to a trip. If your job is refactoring ours isn't. Thank you for your time. ---------------------------------------------------------------- konenas I apologize for the condescending tone in my last post. I reread it this morning and immediately kicked myself. Making assumptions about an unknown situation is very bad form in our business. Gerald. ---------------------------------------------------------------- Apology accepted. No hard feelings. Konenas ps. But does not solves any problem at all. ---------------------------------------------------------------- Further comments - To (7) MF comment - Asterisk at column 1 Consider - [code] IDENTIFICATION DIVISION. PROGRAM-ID. disp. DATA DIVISION. WORKING-STORAGE SECTION. 01 MYVAR PIC 99. PROCEDURE DIVISION. COMPUTE MYVAR = 1 * 2 DISPLAY MYVAR . [/code] Compiled with MF free format (-C sourceformat=free) and executed, gives 01. WRONG. Compiled with OC free format (-free) and executed, gives 02. CORRECT. I may raise this with MF as this should not be happening in free format mode. I may look at providing an option to enable MF comment ONLY in FIXED format mode (eg. -fmf-comment). (Note I said "may", I have other priorities than things like this). To (6) COPY - Consider - COPY contents in MYCOPY [code] MYVAR PIC XX. 01 [/code] Program - [code] COPY MYCOPY.MYVAR2 PIC XX. [/code] First some clarification. The period (.) is required when the syntax for the statement states that it is required for termination. The COPY syntax states that the period is required to terminate the clause. Note also that a period is implicitly a seperator. The above example is perfectly valid code. MF will NOT compile it. OC WILL compile it (correctly). Note that if you change the program thus - [code] COPY "MYCOPY".MYVAR2 PIC XX. [/code] Then both MF and OC will compile it. This is somewhat analagous to shell programming with environment variables. Typically we do something like - MYVAR1=xxx MYVAR2=yyy MYVAR3=zzz and use them - echo "My vars $MYVAR1 $MYVAR2 $MYVAR3" The problem comes when we (eg.) do some form of concatenation without considering what actually happens - MYNEWVAR="$MYVAR1_$MYVAR2_$MAYVAR3" How much better that would be done such - MYNEWVAR="${MYVAR1}_${MYVAR2}_${MAYVAR3}" Note this is also a case of "terminators" and "delimiting" the variable. Roger ---------------------------------------------------------------- I'm pleased to see that mf compiles both COPY "MYCOPY.CPY". and COPY MYCOPY.CPY. my code was copy mycopy.cpy. and mf doesn't compiled copy "mycopy.cpy". but it compiles copy "MYCOPY.CPY". Thanks Roger, I'll change it. So, ok with 6 & 7 What about 1, or 2-5? Can we have a solution? Can I help? ---------------------------------------------------------------- Subject: Testing GTK+ and yet another calendar Hello people, This is strictly a proof of concept from my point of view, and a coming to grips with GTK+ 2.0. After a few more of these, and some group discussion, we can make plans on a complete GIMP Took Kit binding and a copybook library. It's going to be a fair sized object file when we finish. Playing with a GTK Calendar widget. And I do mean "playing". This is not professional, coded with too many unknowns, showing impatience before doing all the reading. :) Discoveries; - Really need to get cob_field coded up - I don't yet know where the delineation between wrapper/binder will be and what burden to place on the OpenCOBOL developer. - Will the call to get a window pointer do the gtk init for for instance? - Really need a way to cleanly access C functions for passing to the GTK signal handlers. cob_resolve will probably come to the rescue on that one, but it means the callbacks will be visible symbols in the linker etc... Requirements to try this on my Debian box was apt-get of libgtk2.0-dev and libglib2.0-dev packages. More soon [b]ocgtk.c[/b] [code] /* OpenCOBOL GTK+ 2.0 wrapper experiments */ /* First up, a calendar widget */ /* Tectonics: gcc -c `pkg-config --cflags gtk+-2.0` ocgtk.c */ #include #include /* user data for the calendar info, a little bit of it anyway */ typedef struct _calendar_data { guint year; guint month; guint day; } gtkcalendar_data; /*-- This function allows the program to exit properly when the window is closed --*/ gint destroyapp (GtkWidget *widget, gpointer gdata) { gtk_main_quit(); return (FALSE); } /* get the data and close the window on double click */ void calendar_day_selected_double_click(GtkCalendar *calendar, gtkcalendar_data *data) { gtk_calendar_get_date(calendar, &data->year, &data->month, &data->day); g_print("Y: %d M: %d D: %d\n", data->year, data->month + 1, data->day); gtk_main_quit(); } /* get the data on click */ void calendar_day_selected(GtkCalendar *calendar, gtkcalendar_data *data) { gtk_calendar_get_date(calendar, &data->year, &data->month, &data->day); g_print("Y: %d M: %d D: %d\n", data->year, data->month + 1, data->day); } /* Main GTK module for OpenCOBOL call */ int gtkcalendar() { /*-- Declare the GTK Widgets used in the program --*/ GtkWidget *window; GtkWidget *calendar; /* user data */ gtkcalendar_data calendar_data; /*-- Initialize GTK --*/ // gtk_init (&argc, &argv); gtk_init(0, NULL); /*-- Create the new widget --*/ calendar = gtk_calendar_new(); /*-- Create the new window --*/ window = gtk_window_new(GTK_WINDOW_TOPLEVEL); /* set the title */ gtk_window_set_title(GTK_WINDOW(window), "OpenCOBOL GTK Calendar"); /* get initial calendar values, although close will refetch current */ gtk_calendar_get_date(GTK_CALENDAR(calendar), &calendar_data.year, &calendar_data.month, &calendar_data.day); /*-- Connect the window to the destroyapp function --*/ gtk_signal_connect(GTK_OBJECT(window), "delete_event", GTK_SIGNAL_FUNC(destroyapp), NULL); /*-- Add the calendar to the window --*/ gtk_container_add(GTK_CONTAINER(window), calendar); /* connect the double click and click callbacks */ gtk_signal_connect(GTK_OBJECT(calendar), "day_selected_double_click", GTK_SIGNAL_FUNC(calendar_day_selected_double_click), &calendar_data); gtk_signal_connect(GTK_OBJECT(calendar), "day_selected", GTK_SIGNAL_FUNC(calendar_day_selected), &calendar_data); /*-- Display the widgets --*/ gtk_widget_show(calendar); gtk_widget_show(window); /*-- Start the GTK event loop --*/ gtk_main(); /*-- Return the yyyymmdd as an int --*/ return (int)calendar_data.year * 10000 + (calendar_data.month + 1) * 100 + calendar_data.day; } [/code] [b]gtkcaller.cob[/b] [code] ****************************************************************** >>SOURCE FORMAT IS FIXED ****************************************************************** * Author: Brian Tiffin * Date: 09-Sep-2008 * Purpose: Demonstrate a GTK+ wrapper * Tectonics: gcc -c ocgtk.c `pkg-config --cflags gtk+-2.0` * cobc -x `pkg-config --libs gtk+-2.0` gtkcaller.cob ocgtk.o ****************************************************************** identification division. program-id. gtkcaller. data division. working-storage section. 01 result pic s9(9). ***************************************************************** procedure division. call "gtkcalendar" returning result end-call. display "Returned: " result end-display goback. exit program. end program gtkcaller. [/code] and [b]tectonic[/b]. A shell script chmod +x I use a Makefile, but it's pretty full with random targets now. [code] gcc -c `pkg-config --cflags gtk+-2.0` ocgtk.c cobc -x `pkg-config --libs gtk+-2.0` gtkcaller.cob ocgtk.o [/code] Can't show the sample run without posting images, but here is a sample stdout. ./gtkcaller change the year and back, the month and back, click a fews days and then close. Double click will select and close in one go. [code] Y: 2009 M: 9 D: 9 Y: 2008 M: 9 D: 9 Y: 2008 M: 8 D: 9 Y: 2008 M: 9 D: 9 Y: 2008 M: 9 D: 30 Y: 2008 M: 9 D: 9 Y: 2008 M: 9 D: 20 Returned: +020080920 [/code] Cheers, Brian ---------------------------------------------------------------- Tested. Works. Amazed. ---------------------------------------------------------------- Yeah, well this is the dirt easy version. :) Making generic bindings for OpenCOBOL developers without forcing them into C ... that'll be the nifty bit. Cheers, Brian ---------------------------------------------------------------- Not sure if this is of any use, but it seems from first impressions that the GTK interface might already have been done for us. have a look at [url=www.gtk-server.org]gtk-server[/url]. ---------------------------------------------------------------- Subject: Embedded javascript - spidermonkey Hello gentlefolk, This is way early proof of concept again. Mozilla spidermonkey javascript evaluation from an OpenCOBOL field. Simple integer return. This is right out of the Mozilla/js/ boilerplate page. I needed spidermonkey-bin, and libsmjs-dev (which I think is an old name for mozjs-dev). This demo never runs the 22 / 7. ;) EDIT; this may require libmozjs-dev and libmozjs too. Both -dev packages work. I think its a rename, but I'm not read up on the topic. [b]If you have libmozjs-dev instead, change tectonic to -I/usr/include/mozjs and the cobc command -lmozjs[/b] Cheers, Brian [b]ocjs.c[/b] [code] /* OpenCOBOL with embedded spidermonkey javascript */ /* gcc -c -I/usr/include/smjs ocjs.c */ /* cobc -x -lsmjs jscaller.cob */ #include #include #define XP_UNIX #include "jsapi.h" int ocjs(char *script) { JSRuntime *rt; JSContext *cx; JSObject *global; JSClass global_class = { "global",0, JS_PropertyStub,JS_PropertyStub,JS_PropertyStub,JS_PropertyStub, JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub }; /* * You always need: * a runtime per process, * a context per thread, * a global object per context, * standard classes (e.g. Date). */ rt = JS_NewRuntime(0x100000); cx = JS_NewContext(rt, 0x1000); global = JS_NewObject(cx, &global_class, NULL, NULL); JS_InitStandardClasses(cx, global); /* * Now suppose script contains some JS to evaluate, say "22/7" as a * bad approximation for Math.PI, or something longer, such as this: * "(function fact(n){if (n <= 1) return 1; return n * fact(n-1)})(5)" * to compute 5! */ if (script == NULL) { script = "22 / 7"; } jsval rval; JSString *str; JSBool ok; char *filename = "ocjstest.txt"; int lineno; printf("evaluating : %s\n", script); ok = JS_EvaluateScript(cx, global, script, strlen(script), filename, lineno, &rval); str = JS_ValueToString(cx, rval); printf("smjs result: %s\n", JS_GetStringBytes(str)); return strlen(JS_GetStringBytes(str)); } [/code] And the [b]jscaller.cob[/b] [code] >>SOURCE FORMAT IS FIXED ****************************************************************** * Author: Brian Tiffin * Date: 11-Sep-2008 * Purpose: Embed some javascript * Tectonics: gcc -c -I/usr/include/smjs ocjs.c * cobc -x -l/smjs jscaller.cob ocjs.o ****************************************************************** identification division. program-id. jscaller. data division. working-storage section. 78 newline value x"0a". 01 result pic s9(9). 01 javascript pic x(17) value '"Open" + "COBOL"' & x"00". ****************************************************************** procedure division. *Evaluate spidermonkey code, expect the length of js result back call "ocjs" using by reference javascript returning result end-call display "OpenCOBOL recieved: " result newline end-display move "new Date()" & x"00" to javascript call "ocjs" using by reference javascript returning result end-call display "OpenCOBOL recieved: " result end-display goback. end program jscaller. [/code] [b]tectonic[/b] [code] gcc -c -I/usr/include/smjs ocjs.c cobc -x -lsmjs jscaller.cob ocjs.o [/code] or maybe... [code] gcc -c -I/usr/include/mozjs ocjs.c cobc -x -lmozjs jscaller.cob ocjs.o [/code] and output [code] evaluating : "Open" + "COBOL" smjs result: OpenCOBOL OpenCOBOL recieved: +000000009 evaluating : new Date() smjs result: Thu Sep 11 2008 20:07:48 GMT-0400 (EDT) OpenCOBOL recieved: +000000039 [/code] ---------------------------------------------------------------- Thanks. Tested and works. This is starting to get more exciting. ---------------------------------------------------------------- baby step 2; Sorry folks, the code is picking up litter, but I still want to show the sample. [b]ocjs.c[/b] [code] /* OpenCOBOL with embedded spidermonkey javascript */ /* gcc -c -I/usr/include/smjs ocjs.c */ /* cobc -x -lsmjs jscaller.cob */ /* somepeople found mozjs before smjs */ #include #include #include #define XP_UNIX #include "jsapi.h" int ocjs(char *script) { JSRuntime *rt; JSContext *cx; JSObject *global; JSClass global_class = { "global",0, JS_PropertyStub,JS_PropertyStub,JS_PropertyStub,JS_PropertyStub, JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub }; /* * You always need: * a runtime per process, * a context per thread, * a global object per context, * standard classes (e.g. Date). */ rt = JS_NewRuntime(0x100000); cx = JS_NewContext(rt, 0x1000); global = JS_NewObject(cx, &global_class, NULL, NULL); JS_InitStandardClasses(cx, global); /* * Now suppose script contains some JS to evaluate, say "22/7" as a * bad approximation for Math.PI, or something longer, such as this: * "(function fact(n){if (n <= 1) return 1; return n * fact(n-1)})(5)" * to compute 5! */ if (script == NULL) { script = "22 / 7"; } jsval rval; JSString *str; JSBool ok; char *filename = "ocjstest.txt"; int lineno; printf("evaluating : %s\n", script); ok = JS_EvaluateScript(cx, global, script, strlen(script), filename, lineno, &rval); str = JS_ValueToString(cx, rval); printf("smjs result: %s\n", JS_GetStringBytes(str)); return strlen(JS_GetStringBytes(str)); } int ocjsString(char *script, char *result, int length) { JSRuntime *rt; JSContext *cx; JSObject *global; JSClass global_class = { "global",0, JS_PropertyStub,JS_PropertyStub,JS_PropertyStub,JS_PropertyStub, JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub }; /* * You always need: * a runtime per process, * a context per thread, * a global object per context, * standard classes (e.g. Date). */ rt = JS_NewRuntime(0x100000); cx = JS_NewContext(rt, 0x1000); global = JS_NewObject(cx, &global_class, NULL, NULL); JS_InitStandardClasses(cx, global); /* * Now suppose script contains some JS to evaluate, say "22/7" as a * bad approximation for Math.PI, or something longer, such as this: * "(function fact(n){if (n <= 1) return 1; return n * fact(n-1)})(5)" * to compute 5! */ if (script == NULL) { script = "22 / 7"; } jsval rval; JSString *str; JSBool ok; char *filename = "ocjstest.txt"; int lineno = 0; printf("evaluating : %s\n", script); ok = JS_EvaluateScript(cx, global, script, strlen(script), filename, lineno, &rval); str = JS_ValueToString(cx, rval); printf("smjs result: %s\n", JS_GetStringBytes(str)); memcpy(result, JS_GetStringBytes(str), length <= strlen(JS_GetStringBytes(str)) ? length : strlen(JS_GetStringBytes(str)) ); return strlen(JS_GetStringBytes(str)); } [/code] and the [b]jscaller.cob[/b] demonstrating a little [b]regex[/b]. [code] >>SOURCE FORMAT IS FIXED ****************************************************************** * Author: Brian Tiffin * Date: 11-Sep-2008 * Purpose: Embed some javascript * Tectonics: gcc -c -I/usr/include/smjs ocjs.c * cobc -x -l/smjs jscaller.cob ocjs.o ****************************************************************** identification division. program-id. jscaller. data division. working-storage section. 78 newline value x"0a". 01 result pic s9(9). 01 javascript pic x(1024) value '"Open" + "COBOL"' & x"00". 01 result-field pic x(81). ****************************************************************** procedure division. *Evaluate spidermonkey code, expect the length of js result back string "pat = /\d+\s\d+/; " delimited by size 'a = "123abcdefghijkl $56.78 90 mnopqrstuvwxyz"; ' delimited by size "a.search(pat);" delimited by size x"00" delimited by size into javascript end-string call "ocjsString" using javascript result-field by value function length(result-field) returning result end-call display "OpenCOBOL result-field: " result-field end-display display "OpenCOBOL recieved : " result newline end-display string "re = /(\w+)\s(\w+)/; " delimited by size 'str = "John Smith"; ' delimited by size 'newstr = str.replace(re, "$2, $1"); ' delimited by size "newstr;" delimited by size x"00" delimited by size into javascript end-string call "ocjsString" using javascript result-field by value function length(result-field) returning result end-call display "OpenCOBOL result-field: " result-field end-display display "OpenCOBOL recieved : " result newline end-display move "new Date()" & x"00" to javascript call "ocjs" using by reference javascript returning result end-call display "OpenCOBOL recieved: " result end-display goback. end program jscaller. [/code] Sample output [code] evaluating : pat = /\d+\s\d+/; a = "123abcdefghijkl $56.78 90 mnopqrstuvwxyz"; a.search(pat); smjs result: 20 OpenCOBOL result-field: 20 OpenCOBOL recieved : +000000002 evaluating : re = /(\w+)\s(\w+)/; str = "John Smith"; newstr = str.replace(re, "$2, $1"); newstr; smjs result: Smith, John OpenCOBOL result-field: Smith, John OpenCOBOL recieved : +000000011 evaluating : new Date() smjs result: Fri Sep 12 2008 02:50:32 GMT-0400 (EDT) OpenCOBOL recieved: +000000039 [/code] Cheers, Brian ---------------------------------------------------------------- New version; with the fencing in place. Please note, the tectonics for this will change as more spidermonkey secrets are uncovered. Still need an EvaluateScript with a filename, the cheat line defining XP_UNIX will be removed, the script display lines includes the C null, etc... [b]Edit[/b]; As of the OC1.1 tarball posted after Sept 14, 2008 the tectonics have changed. Instead of calling [b]gcc[/b] directly, the [b]cobc[/b] command can be used for C sources as well. It is a much safer way of building the systems, and will do the right thing, even if gcc is not the configured native C compiler, along with passing through proper options. Calling: ocjsInitialize(0, 0) res = ocjsEvaluate(script, resultfield, len) ... res = ocjsEvaluate(script, resultfield, len) ocjsRunDown() or ocjsString(script, resultfield, len) for one-time calls with a fresh js runtime, each call. Currently you can not mix ocjsInitialize and ocjsString without calling ocjsRunDown before ocjsString. Cheers, Brian [b]tectonic[/b] [code] cobc -c -I/usr/include/smjs ocjs.c cobc -x -lsmjs jscaller.cob ocjs.o [/code] [b]ocjs.c[/b] [code] /* OpenCOBOL with embedded spidermonkey javascript */ /* cobc -c -I/usr/include/smjs ocjs.c * cobc -x -lsmjs jscaller.cob * some people found mozjs before smjs */ #include #include /* javascript api requires an environment type */ #define XP_UNIX #if (defined(XP_WIN) || defined(XP_UNIX) || defined(XP_BEOS) || defined(XP_OS2)) #include "jsapi.h" #else #error "Must define one of XP_BEOS, XP_OS2, XP_WIN or XP_UNIX" #endif /* Error codes */ #define OCJS_ERROR_RUNTIME -1 #define OCJS_ERROR_CONTEXT -2 #define OCJS_ERROR_GLOBAL -3 #define OCJS_ERROR_STANDARD -4 #define OCJS_ERROR_EVALUATE -5 /* OpenCOBOL main CALL interface */ /* javascript layer requires * a runtime per process, * a context per thread, * a global object per context * and will initialize * standard classes. */ static JSRuntime *rt; static JSContext *cx; static JSObject *global; static JSClass global_class = { "global",0, JS_PropertyStub,JS_PropertyStub,JS_PropertyStub,JS_PropertyStub, JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub }; /* Initialize the engine resources */ int ocjsInitialize(int rtsize, int cxsize) { JSBool ok; /* one zero sizes, pick reasonable values */ if (rtsize == 0) { rtsize = 0x100000; } if (cxsize == 0) { cxsize = 0x1000; } /* Initialize a runtime space */ rt = JS_NewRuntime(rtsize); if (rt == NULL) { return OCJS_ERROR_RUNTIME; } /* Attach a context */ cx = JS_NewContext(rt, cxsize); if (cx == NULL) { return OCJS_ERROR_CONTEXT; } /* And a default global */ global = JS_NewObject(cx, &global_class, NULL, NULL); if (global == NULL) { return OCJS_ERROR_GLOBAL; } /* Load standard classes */ ok = JS_InitStandardClasses(cx, global); /* Return success or standard class load error */ return (ok == JS_TRUE) ? 0 : OCJS_ERROR_STANDARD; } /* Evaluate script */ int ocjsEvaluate(char *script, char *result, int length) { jsval rval; JSString *str; int reslen = OCJS_ERROR_EVALUATE; JSBool ok; /* filename and line number, not reported */ char *filename = NULL; int lineno = 0; /* clear the result field */ memset(result, ' ', length); /* Evaluate javascript */ ok = JS_EvaluateScript(cx, global, script, strlen(script), filename, lineno, &rval); /* Convert js result to JSString form */ if (ok == JS_TRUE) { str = JS_ValueToString(cx, rval); reslen = strlen(JS_GetStringBytes(str)); if (length < reslen) { reslen = length; } /* convert down to char and move to OpenCOBOl result field */ memcpy(result, JS_GetStringBytes(str), reslen); } return reslen; } /* release js engine */ int ocjsRunDown() { if (cx != NULL) { JS_DestroyContext(cx); } if (rt != NULL) { JS_DestroyRuntime(rt); } JS_ShutDown(); return 0; } /* Quick call; start engine, evaluate, release engine */ int ocjsString(char *script, char *result, int length) { int reslen; reslen = ocjsInitialize(0, 0); if (reslen < 0) { return reslen; } reslen = ocjsEvaluate(script, result, length); ocjsRunDown(); return reslen; } [/code] [b]jscaller.cob[/b] [code] >>SOURCE FORMAT IS FIXED *>**************************************************************** *>Author: Brian Tiffin *>Date: 11-Sep-2008 *>Purpose: Embed some javascript *>Tectonics: cobc -c -I/usr/include/smjs ocjs.c *> cobc -x -l/smjs jscaller.cob ocjs.o *>**************************************************************** identification division. program-id. jscaller. data division. working-storage section. 78 ocjs-error-runtime value -1. 78 ocjs-error-context value -2. 78 ocjs-error-global value -3. 78 ocjs-error-standard value -4. 78 ocjs-error-evaluate value -5. 78 newline value x"0a". 01 source-data pic x(40) value "----+----1----+-$56.78 90----3----+----4". 01 result pic s9(9). 01 result-field pic x(81). 01 javascript pic x(1024). 01 safety-null pic x value x"00". *>**************************************************************** *> Evaluate spidermonkey code, return the length of js result procedure division. display "js> " with no advancing end-display accept javascript end-accept call "ocjsString" using javascript result-field by value function length(result-field) returning result end-call display "OpenCOBOL result-field: " result-field end-display display "OpenCOBOL recieved : " result newline end-display *> Initialize the javascript engine call "ocjsInitialize" using by value 65536 by value 1024 returning result end-call if result less 0 stop run returning result end-if *> find (zero offest) dollar amount, space, number move spaces to javascript string "pat = /\$\d+\.\d+\s\d+/; " 'a = "' delimited by size source-data delimited by size '"; ' delimited by size "a.search(pat); " delimited by size x"00" delimited by size into javascript end-string display "Script: " function trim(javascript, trailing) end-display call "ocjsEvaluate" using javascript result-field by value function length(result-field) returning result end-call display "OpenCOBOL result-field: " result-field end-display display "OpenCOBOL recieved : " result newline end-display *> values help in js engine across calls move spaces to javascript string 'a;' delimited by size x"00" delimited by size into javascript end-string display "Script: " function trim(javascript, trailing) end-display call "ocjsEvaluate" using javascript result-field by value function length(result-field) returning result end-call display "OpenCOBOL result-field: " result-field end-display display "OpenCOBOL recieved : " result newline end-display *> erroneous script move spaces to javascript string 'an error of some kind;' delimited by size x"00" delimited by size into javascript end-string display "Script: " function trim(javascript, trailing) end-display call "ocjsEvaluate" using javascript result-field by value function length(result-field) returning result end-call if result equal ocjs-error-evaluate display " *** script problem ***" end-display end-if display "OpenCOBOL result-field: " result-field end-display display "OpenCOBOL recieved : " result newline end-display *> Rundown the js engine call "ocjsRunDown" returning result *> take first name last name, return last "," first move spaces to javascript string "re = /(\w+)\s(\w+)/; " delimited by size 'str = "John Smith"; ' delimited by size 'newstr = str.replace(re, "$2, $1"); ' delimited by size "newstr;" delimited by size x"00" delimited by size into javascript end-string display "Script: " function trim(javascript, trailing) end-display call "ocjsString" using javascript result-field by value function length(result-field) returning result end-call display "OpenCOBOL result-field: " result-field end-display display "OpenCOBOL recieved : " result newline end-display *> split a string using numbers return array (as js string form) move spaces to javascript string 'myString = "Hello 1 word. Sentence number 2."; ' delimited by size 'splits = myString.split(/(\d)/); ' delimited by size 'splits;' delimited by size x"00" delimited by size into javascript end-string display "Script: " function trim(javascript, trailing) end-display call "ocjsString" using javascript result-field by value function length(result-field) returning result end-call display "OpenCOBOL result-field: " result-field end-display display "OpenCOBOL recieved : " result newline end-display *> Get javascript date move "new Date()" & x"00" to javascript display "Script: " function trim(javascript, trailing) end-display call "ocjsString" using javascript result-field by value function length(result-field) returning result end-call display "OpenCOBOL result-field: " result-field end-display display "OpenCOBOL recieved : " result end-display goback. end program jscaller. [/code] And the sample [i]output[/i] [code] js> 123 * 456 + 789 OpenCOBOL result-field: 56877 OpenCOBOL recieved : +000000005 Script: pat = /\$\d+\.\d+\s\d+/; a = "----+----1----+-$56.78 90----3----+----4"; a.search(pat); OpenCOBOL result-field: 16 OpenCOBOL recieved : +000000002 Script: a; OpenCOBOL result-field: ----+----1----+-$56.78 90----3----+----4 OpenCOBOL recieved : +000000040 Script: an error of some kind; *** script problem *** OpenCOBOL result-field: OpenCOBOL recieved : -000000005 Script: re = /(\w+)\s(\w+)/; str = "John Smith"; newstr = str.replace(re, "$2, $1"); newstr; OpenCOBOL result-field: Smith, John OpenCOBOL recieved : +000000011 Script: myString = "Hello 1 word. Sentence number 2."; splits = myString.split(/(\d)/); splits; OpenCOBOL result-field: Hello ,1, word. Sentence number ,2,. OpenCOBOL recieved : +000000036 Script: new Date() OpenCOBOL result-field: Mon Sep 15 2008 04:16:06 GMT-0400 (EDT) OpenCOBOL recieved : +000000039 [/code] ---------------------------------------------------------------- Subject: File status undefined error This seems too simple to be a problem, but I cannot resolve this on my own. I have a program that declares a variable for file status in each select statement: 000690 Select WI-FILE assign to "\wo\WINPUT.DTA" 000700 Organization is INDEXED 000710 Access mode is DYNAMIC 000720 Record key is WI-KEY 000730 File Status is WI-STAT. Then at the top of working-storage there is a data item: 003820 01 WI-STAT Pic XX. The compiler reports: WRKORDER.CBL:73: Error: 'WI-STAT' undefined This is strange because the source file is very old and has compiled on many different o/s (DOS, OS/2, win, etc). In fact it was written on a Victor 9000 to run on one of the first IBM AT machines to arrive in this city, but I digress. I think it has always compiled on some version of mf, but may have taken a turn on other compilers that I have forgotten. I am attempting the compile on OpenBSD 4.3 current using the following version of oc: cobc (OpenCOBOL) 1.1.0 Built Sep 6 2008 21:24:18 Packaged Thu Aug 21 18:15:31 CEST 2008 Copyright (C) 2001-2008 Keisuke Nishida / Roger While With the command: cobc -std=mf -x WRKORDER.CBL I'm not sure that it matters, but I have the following package installed: db-4.6.21 Berkeley DB package, revision 4 I'm hoping that greater minds here can point out the error of my ways. Thanks to all, Gerald. ---------------------------------------------------------------- New Berkeley DB packages have problems with OC look here: http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=270&forum=1 ---------------------------------------------------------------- [quote] konenas wrote: New Berkeley DB packages have problems with OC look here: http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=270&forum=1 [/quote] I understand that there will be database issues when I attempt to link and run the program. I didn't expect syntax error messages to pop up over this issue though. ---------------------------------------------------------------- Nothing to do with BDB. This is the compiler. Not enough information to determine the problem. Please post the complete program. Roger ---------------------------------------------------------------- Ahem...mumble, mumble, some File Section copy files had * comments in position 1. ---------------------------------------------------------------- Subject: Install OC when Non root? (eg: dreamhost?) SOLVED - read last post. Roger, Is there a way to install OC when we do not have root AND when certain libraries are missing? I suppose we would have to install those libraries. Since we do not have root, we cannot install them the typical way. Can they just be dropped into a home dir say /home/user/lib and then have that path added to the libpath? At this stage I am completely lost on how to proceed, but I would like to get OC to work on any host that at least allows compiling, like Dreamhost does. ---------------------------------------------------------------- Response from Dreamhost: From my dreamhost support guys: Hello, > Thank you again for the information you gave me here. I have a few other > questions. > > Open Cobol requires a few libraries that appear not to be installed on > dreamhost, > such as ncurses. It also wants to install some things in /lib I am supposing. > > My question is, does a way exist for me to put those libraries that I need in > my > home directory? Perhaps /home/me/lib and then ajoin that to the libpath or > something? It seems that even a number of linux people tell me it cannot > be done. Unfortunately assistance with custom installations is a little beyond the scope of our support. However, I believe it should be possible with the right tweaking (but I have no experience setting up open cobol or it's libraries). You have the right idea though, simply install the libraries into your user's home directory and update the applicable path variables in your environment to include their new location. > I am willing to pay for support if this can be helped. Or willing to pay if > the > needed libraries would be willing to be installed by dreamhost personel > on your servers. Sorry, unfortunately we do not offer consultations for customers. You may want to ask around our customer forums for assistance with this though (perhaps someone's already tried to do what you've done). http://discussion.dreamhost.com/ ---------------------------------------------------------------- Roger, [b]NOTE: PARTLY SOLVED PLEASE SEE NEXT REPLY[/b] Per our meeting yesterday I followed these steps: [quote] Basically, you start with the prequisites - GMP etc. you do for the prequisites a ./configure --prefix=/home/user/ configure options that may be necessary Be careful with BDB, it likes to specify subdirectories under include/lib for it's install. You then do your normal make/make install for the prerequisites. It's best if you redirect the output from all the "make" and "make install", with >> bla Now comes the fun. export CPPFLAGS=-I/home/user/include export LDFLAGS=/home/user/lib that picks up for the configure/make the include/libs for GMP etc. For OC you also do a ./configure --prefix=/home/roger Also here is a tip that I will post on the forum thread Tips - If you want to test a different version of OC without actually doing the "make install" and overwriting some previous version, here is what you do - You do the normal "configure" and "make". What follows is incidentally excatly what a "make check" and also the ANSI85 test do. From your new OC directory you do - cd tests . ./atconfig . ./atlocal [/quote] Had some difficulty with some conflicts. As it turns out, I THINK ncurses is installed and it bdb is definitely there. So I just compiled gmp and then from there open cobol apps compile JUST fine. More in the next messages ---------------------------------------------------------------- Alright the apps compile, but when I run them I get this msg: [quote] ~$ ./blig ./blig: error while loading shared libraries: libcob.so.1: cannot open shared object file: No such file or directory [/quote] I copied blig to my local computer and it ran just fine. Since my hosting service had a different version of dbd than I did, I did have to create this soft link (on MY computer): [quote] :/usr/lib# ln -s libdb-4.5.so libdb-4.3.so [/quote] SO...the long and the short is that it is MOSTLY working. I just have to get this one finally issue solved and we are good to go. Open Cobol compiles fine, just that on the service I cannot run the programs that I've compiled...yet. Any help is appreciated. ---------------------------------------------------------------- Removed... ---------------------------------------------------------------- Removed ?? A couple of things look wrong in the instructions. Don't put a trailing "/" on the --prefix option to the configure (prerequisites). LDFLAGS should be export LDFLAGS=-L/home/usr/lib (assuming /home/usr is the install directory on --prefix) After the OC "make" (or "make install"), run a "make check" to see that the basic OC installation is OK. If OK, then to start using OC, set these variables - (assuming /home/usr is the install directory) export PATH=/home/usr/bin:$PATH export LD_LIBRARY_PATH=/home/usr/lib:$LD_LIBRARY_PATH Roger ---------------------------------------------------------------- Roger, Thanks, will do. I did "removed" because I had pasted quite a lot, but I solved the issue that I had pasted on, so was left only with that small one. Will test everything in a moment, and thanks for the advice again. ---------------------------------------------------------------- Roger, The exports were the last two bits that I needed. The path of course allows me to run cobc. While the library allows me to run apps created with the Open Cobol Compiler. I will detail the exact steps in a little bit, and now that I know what to do, the steps are actually very easy. I went ahead and set up another user with those exports, and applications work quiet well from those users as well. Thus, I will make an announcement soon, for folks that want to have an OC account available. I will give them a sub domain on add1tocobol.com to test. More to follow soon. Roger, thanks for the help! ---------------------------------------------------------------- Please read this entire thread to get an understanding of what is happening. These steps detail how to get this to work on a Dreamhost server ( http://www.dreamhost.com ). They are my provider and I'm very pleased with them. So I did not want to have to change in order to use Open Cobol. It was my hope to get OC working on their servers. Thanks to Roger I was able to do it. These are the steps I took. I chose to put all bin/ lib/ include/ etc under a single subdirectory in my home dir, rather than having those listed in my home dir itself. This way I could have a nice clean home to review, and if I mess up I can merely delete that one dir. So change the dirs if you choose not to do this. The directory name I chose was programs. If you desire to have these placed instead in another, then rename. Additionally change the username cobol to the one that most is fitting for you. Additionally I have tested with other users of mine that are in the same group, and they are able to run cobc and open cobol apps if I export the path and library. The only additional library I had to install was GMP. I have placed everything in a script, the code of which follows. I have named the script dreamhost_opencobol_install.sh. To run simply load to your dreamhost account then log in and run: [code] . ./dreamhost_opencobol_install.sh [/code] The extra dot and space will allow the exported paths at the end of the script to become immediately effective. So that right away you can run cobc -V or a compile and an app. Here is the code of the script: [code] #! /bin/bash cd ~ mkdir downloads mkdir downloads/installers cd downloads wget ftp://ftp.gnu.org/gnu/gmp/gmp-4.2.4.tar.gz wget http://www.sim-basis.de/open-cobol-1.1.tar.gz cd installers tar -xzf ../gmp-4.2.4.tar.gz tar -xzf ../open-cobol-1.1.tar.gz cd gmp-4.2.4/ ./configure --prefix=/home/cobol/programs make make install cd ../open-cobol-1.1 export CPPFLAGS=-I/home/cobol/programs/include export LDFLAGS=-L/home/cobol/programs/lib ./configure --prefix=/home/cobol/programs make make install cd ~ echo "# For Open Cobol Compiling and Running: export PATH=/home/cobol/programs/bin:$PATH export LD_LIBRARY_PATH=/home/cobol/programs/lib:$LD_LIBRARY_PATH" >> .bashrc export PATH=/home/cobol/programs/bin:$PATH export LD_LIBRARY_PATH=/home/cobol/programs/lib:$LD_LIBRARY_PATH [/code] ---------------------------------------------------------------- Looks good. One nit - Drop the trailing slash on the directory specified in PATH/LD_LIBRARY_PATH variables. Roger ---------------------------------------------------------------- Roger, Thanks kindly, I missed that. Done. Thanks for the help. I've just sent out an email announcement, and now making a forum post about free space. Hopefully this will provide a quick way for some to learn Open Cobol. ---------------------------------------------------------------- Alright, further success! In order to run Open Cobol programs we need to have an environment variable set. Btiffin had set up a custom script to accomplish this. So the .sh would be called from the browser which would then call the compiled cob. So we knew that would work. But what we wanted was a generic way to accomplish this for all OC programs. Unfortunately with my tests I could not do the Content-type: text/html from within my app. I must have been doing something wrong. So I just moved that to the script. This is a temporary solution until we are able to do it directly from the OC program. I know it can be done, I'd done it before. So I must be doing something wrong. In any case here are my test cases. In the root of your domain on dreamhost (not your home dir) add the following two files: .htaccess [code] Options -Indexes RewriteEngine on RewriteBase / RewriteRule ^(.+)\.cobc$ cob_execute.cgi RewriteRule ^(.+)\.add1$ cob_execute.cgi RedirectMatch 403 /\..*$ ErrorDocument 400 /404.php ErrorDocument 401 /404.php ErrorDocument 403 /404.php ErrorDocument 404 /404.php ErrorDocument 500 /404.php [/code] This will route all files with an extension of .cobc or .add1 to the script cob_execute, which will also be placed in your domain's root directory. Additionally the error documents route to a php error. Soon to be a .cobc error of course. cob_execute.cgi: [code] #!/bin/sh if [ -f .$REDIRECT_URL ] then export LD_LIBRARY_PATH=/home/opencobol/programs/lib/:$LD_LIBRARY_PATH echo "Content-type: text/html" echo echo .$REDIRECT_URL exit fi [/code] This first checks to see if the originally called file (the .cobc or .add1) even exists. If not all of this is skipped and the user will get a 404 error. Then it exports the path that Open Cobol programs need to access Roger's libcob files. Then it outputsd the content type so that the page will display and finally it runs the original script and exits. I have not tested yet to see if the script picks up the query string, but it should. That will come tomorrow. Here are two sample programs I tested with: helloworld.cob (generates helloworld.cobc): [code] identification division. program-id. hello. environment division. data division. procedure division. DISPLAY "" DISPLAY "

HELLO WORLD

" DISPLAY "

This is a test to see if the web works." DISPLAY " That's all.

" DISPLAY "" STOP RUN . [/code] helloeire.cob (generates helloeire.add1): [code] identification division. program-id. hello. environment division. data division. procedure division. DISPLAY "" DISPLAY "

HELLO IRELAND!!!!!!!!!!!!

" DISPLAY "

This is a test to see if the web works." DISPLAY " That's all.

" DISPLAY "" STOP RUN . [/code] Of course these are very simplistic examples. But they do work as expected and you can test if you like: http://www.add1tocobol.com/TEST/helloworld.cobc http://www.add1tocobol.com/TEST/helloeire.add1 All suggestions welcome. We're one step closer to starting a Cobol based CMS. [b]Thanks Roger for the help[/b] Alright here was the issue...my original code contained this: [code] DISPLAY "Content-type: text/html" DISPLAY SPACES DISPLAY SPACES [/code] When it should have been: [code] DISPLAY "Content-type: text/html" DISPLAY "" [/code] So see the next post for the proper scripts now. ---------------------------------------------------------------- Corrected scripts: .htaccess: [code] Options -Indexes RewriteEngine on RewriteBase / RewriteRule ^(.+)\.cobc$ cob_execute.cgi RewriteRule ^(.+)\.add1$ cob_execute.cgi RedirectMatch 403 /\..*$ ErrorDocument 400 /404.php ErrorDocument 401 /404.php ErrorDocument 403 /404.php ErrorDocument 404 /404.php ErrorDocument 500 /404.php [/code] cob_execute.cgi: [code] #!/bin/sh if [ -f .$REDIRECT_URL ] then export LD_LIBRARY_PATH=/home/opencobol/programs/lib/:$LD_LIBRARY_PATH .$REDIRECT_URL exit fi [/code] helloworld.cob (generates helloworld.cobc): [code] identification division. program-id. hello. environment division. data division. procedure division. DISPLAY "Content-type: text/html" DISPLAY "" DISPLAY "" DISPLAY "

HELLO WORLD

" DISPLAY "

This is a test to see if the web works." DISPLAY " That's all.

" DISPLAY "" STOP RUN . [/code] helloeire.cob (generates helloeire.add1): [code] identification division. program-id. hello. environment division. data division. procedure division. DISPLAY "Content-type: text/html" DISPLAY "" DISPLAY "" DISPLAY "

HELLO IRELAND!!!!!!!!!!!!

" DISPLAY "

This is a test to see if the web works." DISPLAY " That's all.

" DISPLAY "" STOP RUN . [/code] http://www.add1tocobol.com/TEST/helloworld.cobc http://www.add1tocobol.com/TEST/helloeire.add1 Ideally of course I want to create an Open Cobol library that handles outputting the content-type and other useful things. But for now, the point is that we are set. This week I will begin with our designer on a new, COBOL based add1tocobol.com site. It will have a CMS that will make contributing to the add1 project much easier. ---------------------------------------------------------------- aoirhtoir: Thanks for all the info. When I ran the script (of course modifying the path) I get the following errors. [quote][ernieball]$ make check make check-recursive make[1]: Entering directory `/home/pantherl/downloads/installers/open-cobol-1.1' Making check in lib make[2]: Entering directory `/home/pantherl/downloads/installers/open-cobol-1.1/lib' make[2]: Nothing to be done for `check'. make[2]: Leaving directory `/home/pantherl/downloads/installers/open-cobol-1.1/lib' Making check in libcob make[2]: Entering directory `/home/pantherl/downloads/installers/open-cobol-1.1/libcob' if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/pantherl/occobol/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF ".deps/libcob_la-fileio.Tpo" -c -o libcob_la-fileio.lo `test -f 'fileio.c' || echo './'`fileio.c; \ then mv -f ".deps/libcob_la-fileio.Tpo" ".deps/libcob_la-fileio.Plo"; else rm -f ".deps/libcob_la-fileio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/pantherl/occobol/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF .deps/libcob_la-fileio.Tpo -c fileio.c -fPIC -DPIC -o .libs/libcob_la-fileio.o fileio.c:311: error: expected specifier-qualifier-list before 'DB' fileio.c: In function 'cob_sync': fileio.c:639: error: 'struct indexed_file' has no member named 'db' fileio.c:640: error: 'struct indexed_file' has no member named 'db' fileio.c:640: error: 'struct indexed_file' has no member named 'db' fileio.c:645: error: 'struct indexed_file' has no member named 'db' fileio.c:649: error: 'struct indexed_file' has no member named 'db' fileio.c:649: error: 'struct indexed_file' has no member named 'db' fileio.c: In function 'indexed_open': fileio.c:1899: error: 'BTREEINFO' undeclared (first use in this function) fileio.c:1899: error: (Each undeclared identifier is reported only once fileio.c:1899: error: for each function it appears in.) fileio.c:1899: error: expected ';' before 'info' fileio.c:1954: error: 'struct indexed_file' has no member named 'db' fileio.c:1954: error: 'DB' undeclared (first use in this function) fileio.c:1954: error: expected expression before ')' token fileio.c:1959: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:1960: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:1961: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:2000: error: 'info' undeclared (first use in this function) fileio.c:2002: error: 'R_DUP' undeclared (first use in this function) fileio.c:2013: error: 'struct indexed_file' has no member named 'db' fileio.c:2013: warning: implicit declaration of function 'dbopen' fileio.c:2013: error: 'DB_BTREE' undeclared (first use in this function) fileio.c:2014: error: 'struct indexed_file' has no member named 'db' fileio.c:2020: error: 'struct indexed_file' has no member named 'db' fileio.c:2020: error: 'struct indexed_file' has no member named 'db' fileio.c:2027: error: 'struct indexed_file' has no member named 'db' fileio.c:2028: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2029: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2041: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2042: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2050: error: 'struct indexed_file' has no member named 'key' fileio.c:2050: error: 'DBT' undeclared (first use in this function) fileio.c:2051: error: 'struct indexed_file' has no member named 'data' fileio.c:2067: error: 'struct indexed_file' has no member named 'db' fileio.c:2067: error: 'struct indexed_file' has no member named 'db' fileio.c:2067: error: 'struct indexed_file' has no member named 'key' fileio.c:2067: error: 'struct indexed_file' has no member named 'data' fileio.c:2067: error: 'R_FIRST' undeclared (first use in this function) fileio.c:2070: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2070: error: 'struct indexed_file' has no member named 'key' fileio.c:2070: error: 'struct indexed_file' has no member named 'key' fileio.c:2072: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_close': fileio.c:2115: error: 'struct indexed_file' has no member named 'db' fileio.c:2116: error: 'struct indexed_file' has no member named 'db' fileio.c:2116: error: 'struct indexed_file' has no member named 'db' fileio.c:2118: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2119: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2126: error: 'struct indexed_file' has no member named 'db' fileio.c:2127: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2128: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2129: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c: In function 'indexed_start_internal': fileio.c:2169: error: 'struct indexed_file' has no member named 'key' fileio.c:2169: error: 'struct indexed_file' has no member named 'key' fileio.c:2178: error: 'struct indexed_file' has no member named 'db' fileio.c:2178: error: 'struct indexed_file' has no member named 'db' fileio.c:2178: error: 'struct indexed_file' has no member named 'key' fileio.c:2178: error: 'struct indexed_file' has no member named 'data' fileio.c:2178: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:2183: error: 'struct indexed_file' has no member named 'key' fileio.c:2191: error: 'struct indexed_file' has no member named 'db' fileio.c:2191: error: 'struct indexed_file' has no member named 'db' fileio.c:2191: error: 'struct indexed_file' has no member named 'key' fileio.c:2191: error: 'struct indexed_file' has no member named 'data' fileio.c:2191: error: 'R_LAST' undeclared (first use in this function) fileio.c:2197: error: 'struct indexed_file' has no member named 'db' fileio.c:2197: error: 'struct indexed_file' has no member named 'db' fileio.c:2197: error: 'struct indexed_file' has no member named 'key' fileio.c:2197: error: 'struct indexed_file' has no member named 'data' fileio.c:2197: error: 'R_PREV' undeclared (first use in this function) fileio.c:2206: error: 'struct indexed_file' has no member named 'db' fileio.c:2206: error: 'struct indexed_file' has no member named 'db' fileio.c:2206: error: 'struct indexed_file' has no member named 'key' fileio.c:2206: error: 'struct indexed_file' has no member named 'data' fileio.c:2208: error: 'struct indexed_file' has no member named 'key' fileio.c:2212: error: 'struct indexed_file' has no member named 'db' fileio.c:2212: error: 'struct indexed_file' has no member named 'db' fileio.c:2212: error: 'struct indexed_file' has no member named 'key' fileio.c:2212: error: 'struct indexed_file' has no member named 'data' fileio.c:2218: error: 'struct indexed_file' has no member named 'key' fileio.c:2219: error: 'struct indexed_file' has no member named 'db' fileio.c:2219: error: 'struct indexed_file' has no member named 'db' fileio.c:2219: error: 'struct indexed_file' has no member named 'key' fileio.c:2219: error: 'struct indexed_file' has no member named 'data' fileio.c:2219: error: 'R_NEXT' undeclared (first use in this function) fileio.c:2226: error: 'struct indexed_file' has no member named 'db' fileio.c:2226: error: 'struct indexed_file' has no member named 'db' fileio.c:2226: error: 'struct indexed_file' has no member named 'key' fileio.c:2226: error: 'struct indexed_file' has no member named 'data' fileio.c:2232: error: 'struct indexed_file' has no member named 'db' fileio.c:2232: error: 'struct indexed_file' has no member named 'db' fileio.c:2232: error: 'struct indexed_file' has no member named 'key' fileio.c:2232: error: 'struct indexed_file' has no member named 'data' fileio.c:2238: error: 'struct indexed_file' has no member named 'key' fileio.c:2242: error: 'struct indexed_file' has no member named 'db' fileio.c:2242: error: 'struct indexed_file' has no member named 'db' fileio.c:2242: error: 'struct indexed_file' has no member named 'key' fileio.c:2242: error: 'struct indexed_file' has no member named 'data' fileio.c:2253: error: 'struct indexed_file' has no member named 'key' fileio.c:2255: error: 'struct indexed_file' has no member named 'data' fileio.c:2257: error: 'struct indexed_file' has no member named 'key' fileio.c:2257: error: 'struct indexed_file' has no member named 'data' fileio.c:2258: error: 'struct indexed_file' has no member named 'key' fileio.c:2259: error: 'struct indexed_file' has no member named 'db' fileio.c:2259: error: 'struct indexed_file' has no member named 'db' fileio.c:2259: error: 'struct indexed_file' has no member named 'key' fileio.c:2259: error: 'struct indexed_file' has no member named 'data' fileio.c:2293: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2293: error: 'struct indexed_file' has no member named 'key' fileio.c:2295: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2297: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2297: error: 'struct indexed_file' has no member named 'key' fileio.c:2299: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c: In function 'indexed_read': fileio.c:2534: error: 'struct indexed_file' has no member named 'data' fileio.c:2535: error: 'struct indexed_file' has no member named 'data' fileio.c:2535: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_read_next': fileio.c:2794: error: 'R_NEXT' undeclared (first use in this function) fileio.c:2806: error: 'R_LAST' undeclared (first use in this function) fileio.c:2808: error: 'R_PREV' undeclared (first use in this function) fileio.c:2811: error: 'R_FIRST' undeclared (first use in this function) fileio.c:2823: error: 'struct indexed_file' has no member named 'data' fileio.c:2836: error: 'struct indexed_file' has no member named 'key' fileio.c:2837: error: 'struct indexed_file' has no member named 'key' fileio.c:2837: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2841: error: 'struct indexed_file' has no member named 'db' fileio.c:2841: error: 'struct indexed_file' has no member named 'db' fileio.c:2841: error: 'struct indexed_file' has no member named 'key' fileio.c:2841: error: 'struct indexed_file' has no member named 'data' fileio.c:2845: error: 'struct indexed_file' has no member named 'data' fileio.c:2847: error: 'struct indexed_file' has no member named 'key' fileio.c:2847: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2847: error: 'struct indexed_file' has no member named 'key' fileio.c:2848: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2852: error: 'struct indexed_file' has no member named 'db' fileio.c:2852: error: 'struct indexed_file' has no member named 'db' fileio.c:2852: error: 'struct indexed_file' has no member named 'key' fileio.c:2852: error: 'struct indexed_file' has no member named 'data' fileio.c:2854: error: 'struct indexed_file' has no member named 'data' fileio.c:2857: error: 'struct indexed_file' has no member named 'key' fileio.c:2857: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2857: error: 'struct indexed_file' has no member named 'key' fileio.c:2858: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2859: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2859: error: 'struct indexed_file' has no member named 'data' fileio.c:2864: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2864: error: 'struct indexed_file' has no member named 'data' fileio.c:2867: error: 'struct indexed_file' has no member named 'key' fileio.c:2868: error: 'struct indexed_file' has no member named 'key' fileio.c:2868: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2869: error: 'struct indexed_file' has no member named 'db' fileio.c:2869: error: 'struct indexed_file' has no member named 'db' fileio.c:2869: error: 'struct indexed_file' has no member named 'key' fileio.c:2869: error: 'struct indexed_file' has no member named 'data' fileio.c:2906: error: 'struct indexed_file' has no member named 'key' fileio.c:2907: error: 'struct indexed_file' has no member named 'key' fileio.c:2907: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2911: error: 'struct indexed_file' has no member named 'db' fileio.c:2911: error: 'struct indexed_file' has no member named 'db' fileio.c:2911: error: 'struct indexed_file' has no member named 'key' fileio.c:2911: error: 'struct indexed_file' has no member named 'data' fileio.c:2911: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:2930: error: 'struct indexed_file' has no member named 'key' fileio.c:2930: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2930: error: 'struct indexed_file' has no member named 'key' fileio.c:2932: error: 'struct indexed_file' has no member named 'data' fileio.c:2934: error: 'struct indexed_file' has no member named 'key' fileio.c:2934: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2934: error: 'struct indexed_file' has no member named 'key' fileio.c:2935: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2939: error: 'struct indexed_file' has no member named 'db' fileio.c:2939: error: 'struct indexed_file' has no member named 'db' fileio.c:2939: error: 'struct indexed_file' has no member named 'key' fileio.c:2939: error: 'struct indexed_file' has no member named 'data' fileio.c:2941: error: 'struct indexed_file' has no member named 'data' fileio.c:2959: error: 'struct indexed_file' has no member named 'key' fileio.c:2959: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2959: error: 'struct indexed_file' has no member named 'key' fileio.c:2960: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2986: error: 'struct indexed_file' has no member named 'db' fileio.c:2986: error: 'struct indexed_file' has no member named 'db' fileio.c:2986: error: 'struct indexed_file' has no member named 'key' fileio.c:2986: error: 'struct indexed_file' has no member named 'data' fileio.c:3003: error: 'struct indexed_file' has no member named 'key' fileio.c:3003: error: 'struct indexed_file' has no member named 'key' fileio.c:3005: error: 'struct indexed_file' has no member named 'data' fileio.c:3007: error: 'struct indexed_file' has no member named 'key' fileio.c:3007: error: 'struct indexed_file' has no member named 'data' fileio.c:3008: error: 'struct indexed_file' has no member named 'key' fileio.c:3009: error: 'struct indexed_file' has no member named 'db' fileio.c:3009: error: 'struct indexed_file' has no member named 'db' fileio.c:3009: error: 'struct indexed_file' has no member named 'key' fileio.c:3009: error: 'struct indexed_file' has no member named 'data' fileio.c:3048: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:3048: error: 'struct indexed_file' has no member named 'key' fileio.c:3048: error: 'struct indexed_file' has no member named 'key' fileio.c:3050: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:3052: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:3052: error: 'struct indexed_file' has no member named 'key' fileio.c:3054: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:3068: error: 'struct indexed_file' has no member named 'data' fileio.c:3069: error: 'struct indexed_file' has no member named 'data' fileio.c:3069: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'get_dupno': fileio.c:3084: error: 'struct indexed_file' has no member named 'key' fileio.c:3084: error: 'struct indexed_file' has no member named 'key' fileio.c:3085: error: 'struct indexed_file' has no member named 'key' fileio.c:3085: error: 'struct indexed_file' has no member named 'key' fileio.c:3090: error: 'struct indexed_file' has no member named 'db' fileio.c:3090: error: 'struct indexed_file' has no member named 'db' fileio.c:3090: error: 'struct indexed_file' has no member named 'key' fileio.c:3090: error: 'struct indexed_file' has no member named 'data' fileio.c:3090: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:3092: error: 'struct indexed_file' has no member named 'key' fileio.c:3092: error: 'struct indexed_file' has no member named 'key' fileio.c:3093: error: 'struct indexed_file' has no member named 'data' fileio.c:3097: error: 'struct indexed_file' has no member named 'db' fileio.c:3097: error: 'struct indexed_file' has no member named 'db' fileio.c:3097: error: 'struct indexed_file' has no member named 'key' fileio.c:3097: error: 'struct indexed_file' has no member named 'data' fileio.c:3097: error: 'R_NEXT' undeclared (first use in this function) fileio.c: In function 'check_alt_keys': fileio.c:3116: error: 'struct indexed_file' has no member named 'key' fileio.c:3116: error: 'struct indexed_file' has no member named 'key' fileio.c:3117: error: 'struct indexed_file' has no member named 'db' fileio.c:3117: error: 'struct indexed_file' has no member named 'db' fileio.c:3117: error: 'struct indexed_file' has no member named 'key' fileio.c:3117: error: 'struct indexed_file' has no member named 'data' fileio.c:3120: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_write_internal': fileio.c:3168: error: 'struct indexed_file' has no member named 'key' fileio.c:3168: error: 'struct indexed_file' has no member named 'key' fileio.c:3185: error: 'struct indexed_file' has no member named 'data' fileio.c:3186: error: 'struct indexed_file' has no member named 'data' fileio.c:3187: error: 'struct indexed_file' has no member named 'db' fileio.c:3187: error: 'struct indexed_file' has no member named 'db' fileio.c:3187: error: 'struct indexed_file' has no member named 'key' fileio.c:3187: error: 'struct indexed_file' has no member named 'data' fileio.c:3187: error: 'R_NOOVERWRITE' undeclared (first use in this function) fileio.c:3193: error: 'struct indexed_file' has no member named 'data' fileio.c:3193: error: 'struct indexed_file' has no member named 'key' fileio.c:3195: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:3205: error: 'struct indexed_file' has no member named 'data' fileio.c:3206: error: 'struct indexed_file' has no member named 'data' fileio.c:3215: error: 'struct indexed_file' has no member named 'key' fileio.c:3215: error: 'struct indexed_file' has no member named 'key' fileio.c:3216: error: 'struct indexed_file' has no member named 'db' fileio.c:3216: error: 'struct indexed_file' has no member named 'db' fileio.c:3216: error: 'struct indexed_file' has no member named 'key' fileio.c:3216: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_write': fileio.c:3292: error: 'struct indexed_file' has no member named 'key' fileio.c:3292: error: 'struct indexed_file' has no member named 'key' fileio.c:3294: error: 'struct indexed_file' has no member named 'key' fileio.c:3296: error: 'struct indexed_file' has no member named 'key' fileio.c:3296: error: 'struct indexed_file' has no member named 'key' fileio.c:3299: error: 'struct indexed_file' has no member named 'key' fileio.c:3299: error: 'struct indexed_file' has no member named 'key' fileio.c: In function 'indexed_delete_internal': fileio.c:3312: error: 'DBT' undeclared (first use in this function) fileio.c:3312: error: expected ';' before 'prim_key' fileio.c:3359: error: 'struct indexed_file' has no member named 'key' fileio.c:3359: error: 'struct indexed_file' has no member named 'key' fileio.c:3360: error: 'struct indexed_file' has no member named 'db' fileio.c:3360: error: 'struct indexed_file' has no member named 'db' fileio.c:3360: error: 'struct indexed_file' has no member named 'key' fileio.c:3360: error: 'struct indexed_file' has no member named 'data' fileio.c:3365: error: 'prim_key' undeclared (first use in this function) fileio.c:3365: error: 'struct indexed_file' has no member named 'key' fileio.c:3368: error: 'struct indexed_file' has no member named 'data' fileio.c:3370: error: 'struct indexed_file' has no member named 'key' fileio.c:3370: error: 'struct indexed_file' has no member named 'key' fileio.c:3371: error: 'struct indexed_file' has no member named 'key' fileio.c:3371: error: 'struct indexed_file' has no member named 'key' fileio.c:3374: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:3374: error: 'struct indexed_file' has no member named 'key' fileio.c:3374: error: 'struct indexed_file' has no member named 'key' fileio.c:3375: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:3380: error: 'struct indexed_file' has no member named 'db' fileio.c:3380: error: 'struct indexed_file' has no member named 'db' fileio.c:3380: error: 'struct indexed_file' has no member named 'key' fileio.c:3382: error: expected ';' before 'sec_key' fileio.c:3388: error: 'struct indexed_file' has no member named 'db' fileio.c:3388: error: 'struct indexed_file' has no member named 'db' fileio.c:3388: error: 'struct indexed_file' has no member named 'key' fileio.c:3388: error: 'struct indexed_file' has no member named 'data' fileio.c:3388: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:3390: error: 'sec_key' undeclared (first use in this function) fileio.c:3390: error: 'struct indexed_file' has no member named 'key' fileio.c:3391: error: 'struct indexed_file' has no member named 'key' fileio.c:3393: error: 'struct indexed_file' has no member named 'data' fileio.c:3398: error: 'struct indexed_file' has no member named 'db' fileio.c:3398: error: 'struct indexed_file' has no member named 'db' fileio.c:3398: error: 'struct indexed_file' has no member named 'key' fileio.c:3404: error: 'struct indexed_file' has no member named 'db' fileio.c:3404: error: 'struct indexed_file' has no member named 'db' fileio.c:3404: error: 'struct indexed_file' has no member named 'key' fileio.c:3404: error: 'struct indexed_file' has no member named 'data' fileio.c:3404: error: 'R_NEXT' undeclared (first use in this function) fileio.c:3421: error: 'struct indexed_file' has no member named 'db' fileio.c:3421: error: 'struct indexed_file' has no member named 'db' fileio.c: In function 'indexed_rewrite': fileio.c:3584: error: 'struct indexed_file' has no member named 'key' fileio.c:3584: error: 'struct indexed_file' has no member named 'key' make[2]: *** [libcob_la-fileio.lo] Error 1 make[2]: Leaving directory `/home/pantherl/downloads/installers/open-cobol-1.1/libcob' make[1]: *** [check-recursive] Error 1 make[1]: Leaving directory `/home/pantherl/downloads/installers/open-cobol-1.1' make: *** [check] Error 2 [ernieball]$ [/quote] so basically it is failing at "make" [quote]cd ../open-cobol-1.1 export CPPFLAGS=-I/home/cobol/programs/include export LDFLAGS=-L/home/cobol/programs/lib ./configure --prefix=/home/cobol/programs make make install[/quote] Any ideas? Thanks a mil! ---------------------------------------------------------------- The script should have something like [code]./configure --prefix=/home/cobol/programs if test "$?" != "0"; then echo "Error in configure"; exit 1; fi make if test "$?" != "0"; then echo "Error in make"; exit 1; fi make install if test "$?" != "0"; then echo "Error in make install"; exit 1; fi[/code] @DamonH: What error messages do you get from make? I think there is a problem with BDB (you could use VBISAM instead, should work for most ISAM access). human ---------------------------------------------------------------- Good question. I'll be upfront. I am a total noob at this an following the directions in this thread. I don't know what BDB is. heh. As for the errors I posted the entire output I got when I ran the make. I am on the same provider as aoirthoir. So, I figured if I follow his script it should work. One thing to note. The script posted is using 1.1 so after trying a couple of times I cleaned everything and redid this using 1.0. Same issues. So it is probably something I am not aware of... Another library or app I need to install? I surely do appreciate all the help I am getting. I just want to write cobol and bet web apps going. Cheers ---------------------------------------------------------------- Good question. I'll be upfront. I am a total noob at this an following the directions in this thread. I don't know what BDB is. heh. As for the errors I posted the entire output I got when I ran the make. I am on the same provider as aoirthoir. So, I figured if I follow his script it should work. One thing to note. The script posted is using 1.1 so after trying a couple of times I cleaned everything and redid this using 1.0. Same issues. So it is probably something I am not aware of... Another library or app I need to install? I surely do appreciate all the help I am getting. I just want to write cobol and bet web apps going. Cheers ---------------------------------------------------------------- You posted the output from make check, but as OC doesn't work at all you should do ./configure again and post the output from this here. It's very likely that configure will tell you what's missing (and I'm quite sure it's some BDB-stuff). If we know that, we can search for possible solutions. human ---------------------------------------------------------------- [quote] DamonH wrote: I am on the same provider as aoirthoir. So, I figured if I follow his script it should work. One thing to note. The script posted is using 1.1 so after trying a couple of times I cleaned everything and redid this using 1.0. Same issues. So it is probably something I am not aware of... Another library or app I need to install? Cheers[/quote] Except the script as posted no longer works. It worked when I posted it of course :D. Since posting that script Dreamhost moved us all to other servers. So I am not sure if that had something to do with the script failure or not. After the meeting on the 29th, I will work on fixing this issue with OC on dreamhost and also push the move ahead for an Ubuntu Virtual machine to be distrubuted via the server that JCurrey set up for us (that is running on Debian). I do apologize for the delay but scraping together rent :D, and a lot of the other tasks I am working on (including finding some appropriate service for webconferencing via Ubuntu or Windows worst case) are tying up a lot of my time. After the meeting on the 29th I will know more who is and is not able to donate what time to the OCKit and other OC related things. Then I will start to create a schedule for my time to dedicate to this. Anyone can find me on skype as Aoirthoir though, if you want a face to face before the 29th. Kind Regards, Aoirthoir ---------------------------------------------------------------- Aoirthoir, Thanks a mil. I can wait. I fully understand that rent and food must come first. Heh, Been there done that, and still doing. ;) Anyway, I will post my .configure info for you and humana later this evening after I get home from work. Wish I knew more so I could dig further into this without having to bother you folks. I truly appreciate an active group in open source. Take care. ---------------------------------------------------------------- Hey human. Here is the output from the configure: [quote] [ernieball]$ more configure.output checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether to enable maintainer-specific portions of Makefiles... no checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking how to run the C preprocessor... gcc -E checking for egrep... grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking whether ln -s works... yes checking for a BSD-compatible install... /usr/bin/install -c checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking for a sed that does not truncate output... /bin/sed checking for ld used by gcc... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for /usr/bin/ld option to reload object files... -r checking for BSD-compatible nm... /usr/bin/nm -B checking how to recognize dependent libraries... pass_all checking dlfcn.h usability... yes checking dlfcn.h presence... yes checking for dlfcn.h... yes checking the maximum length of command line arguments... 98304 checking command to parse /usr/bin/nm -B output from gcc object... ok checking for objdir... .libs checking for ar... ar checking for ranlib... ranlib checking for strip... strip checking if gcc supports -fno-rtti -fno-exceptions... no checking for gcc option to produce PIC... -fPIC checking if gcc PIC flag -fPIC works... yes checking if gcc static flag -static works... yes checking if gcc supports -c -o file.o... yes checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking for shl_load... no checking for shl_load in -ldld... no checking for dlopen... no checking for dlopen in -ldl... yes checking whether a program can dlopen itself... yes checking whether a statically linked program can dlopen itself... no checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes configure: creating libtool checking whether make sets $(MAKE)... (cached) yes checking for ANSI C header files... (cached) yes checking for stdint.h... (cached) yes checking for sys/types.h... (cached) yes checking signal.h usability... yes checking signal.h presence... yes checking for signal.h... yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking malloc.h usability... yes checking malloc.h presence... yes checking for malloc.h... yes checking locale.h usability... yes checking locale.h presence... yes checking for locale.h... yes checking stddef.h usability... yes checking stddef.h presence... yes checking for stddef.h... yes checking wchar.h usability... yes checking wchar.h presence... yes checking for wchar.h... yes checking for dlfcn.h... (cached) yes checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking for an ANSI C-conforming const... yes checking whether byte ordering is bigendian... no checking for size_t... yes checking whether struct tm is in sys/time.h or time.h... time.h checking for inline... inline checking for working alloca.h... yes checking for alloca... yes checking for vprintf... yes checking for _doprnt... no checking for memmove... yes checking for memset... yes checking for regcomp... yes checking for setlocale... yes checking for fcntl... yes checking for strerror... yes checking for strcasecmp... yes checking for strchr... yes checking for strrchr... yes checking for strdup... yes checking for strstr... yes checking for strtol... yes checking for gettimeofday... yes checking for ld used by GCC... /usr/bin/ld -m elf_x86_64 checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes checking for shared library run path origin... done checking for iconv... yes checking for iconv declaration... extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); checking for nl_langinfo and CODESET... yes checking for getopt_long_only... yes checking kpathsea/getopt.h usability... no checking kpathsea/getopt.h presence... no checking for kpathsea/getopt.h... no checking getopt.h usability... yes checking getopt.h presence... yes checking for getopt.h... yes checking gmp.h usability... yes checking gmp.h presence... yes checking for gmp.h... yes checking for __gmp_randinit in -lgmp... yes checking whether NLS is requested... yes checking for msgfmt... /usr/bin/msgfmt checking for gmsgfmt... /usr/bin/msgfmt checking for xgettext... /usr/bin/xgettext checking for msgmerge... /usr/bin/msgmerge checking whether NLS is requested... yes checking for GNU gettext in libc... yes checking whether to use NLS... yes checking where the gettext function comes from... libc checking ncurses.h usability... yes checking ncurses.h presence... yes checking for ncurses.h... yes checking pdcurses.h usability... no checking pdcurses.h presence... no checking for pdcurses.h... no checking ncurses/ncurses.h usability... no checking ncurses/ncurses.h presence... no checking for ncurses/ncurses.h... no checking curses.h usability... yes checking curses.h presence... yes checking for curses.h... yes checking for initscr in -lncurses... yes checking db.h usability... no checking db.h presence... no checking for db.h... no checking db_185.h usability... no checking db_185.h presence... no checking for db_185.h... no checking db3/db_185.h usability... no checking db3/db_185.h presence... no checking for db3/db_185.h... no checking db4/db_185.h usability... no checking db4/db_185.h presence... no checking for db4/db_185.h... no checking db4.1/db_185.h usability... no checking db4.1/db_185.h presence... no checking for db4.1/db_185.h... no checking db4.2/db_185.h usability... no checking db4.2/db_185.h presence... no checking for db4.2/db_185.h... no checking db4.3/db_185.h usability... no checking db4.3/db_185.h presence... no checking for db4.3/db_185.h... no checking db4.4/db_185.h usability... no checking db4.4/db_185.h presence... no checking for db4.4/db_185.h... no checking db4.5/db_185.h usability... no checking db4.5/db_185.h presence... no checking for db4.5/db_185.h... no checking for __db_open in -ldb-4.5... yes checking for dlopen in -lc... yes configure: creating ./config.status config.status: creating cob-config config.status: creating Makefile config.status: creating lib/Makefile config.status: creating libcob/Makefile config.status: creating cobc/Makefile config.status: creating bin/Makefile config.status: creating po/Makefile.in config.status: creating texi/Makefile config.status: creating config/Makefile config.status: creating tests/atlocal config.status: creating tests/Makefile config.status: creating tests/cobol85/Makefile config.status: creating config.h config.status: config.h is unchanged config.status: executing tests/atconfig commands config.status: executing depfiles commands config.status: executing default-1 commands config.status: creating po/POTFILES config.status: creating po/Makefile OpenCOBOL Configuration: CC gcc COB_CC gcc CFLAGS -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototype -Wno-format-y2k COB_CFLAGS -I/home/pantherl/occobol/programs/include -I/home/pantherl/occobol/programs/include -O2 COB_EXTRA_FLAGS LDFLAGS -L/home/pantherl/occobol/programs/lib COB_LDFLAGS -L/home/pantherl/occobol/programs/lib COB_LIBS -L/home/pantherl/occobol/programs/lib -L${exec_prefix}/lib -lcob -lm -lgmp -lncurses -ldb-4.5 COB_CONFIG_DIR ${prefix}/share/open-cobol/config COB_LIBRARY_PATH .:${exec_prefix}/lib/open-cobol COB_MODULE_EXT so COB_SHARED_OPT -shared COB_PIC_FLAGS -fPIC -DPIC COB_EXPORT_DYN -Wl,--export-dynamic COB_STRIP_CMD strip --strip-unneeded Dynamic loading System Use gettext for international messages: yes Use Berkeley DB for file I/O: yes Use enhanced Berkeley DB (>= 4.1) no Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: yes [/quote] After looking at this it does look like anything to do with db or db4 is not available. Should I attempt to install the berkley db libs? Thanks ---------------------------------------------------------------- Looks quite OK, except that BDB 4.5 is used but "Use enhanced Berkeley DB (>= 4.1) no" is set. But there's no error in configure (if not in the configure script itself). What does the output of make look like? human ---------------------------------------------------------------- here is the make output: [quote] [ernieball]$ make Creating defaults.h... make all-recursive make[1]: Entering directory `/home/pantherl/downloads/installers/open-cobol-1.1' Making all in lib make[2]: Entering directory `/home/pantherl/downloads/installers/open-cobol-1.1/lib' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/home/pantherl/downloads/installers/open-cobol-1.1/lib' Making all in libcob make[2]: Entering directory `/home/pantherl/downloads/installers/open-cobol-1.1/libcob' if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/pantherl/occobol/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF ".deps/libcob_la-common.Tpo" -c -o libcob_la-common.lo `test -f 'common.c' || echo './'`common.c; \ then mv -f ".deps/libcob_la-common.Tpo" ".deps/libcob_la-common.Plo"; else rm -f ".deps/libcob_la-common.Tpo"; exit 1 ; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/pantherl/occobol/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall - Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF .deps/libcob_la-common.Tpo -c common. c -fPIC -DPIC -o .libs/libcob_la-common.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/pantherl/occobol/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall - Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF .deps/libcob_la-common.Tpo -c common. c -o libcob_la-common.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/pantherl/occobol/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -M D -MP -MF ".deps/libcob_la-call.Tpo" -c -o libcob_la-call.lo `test -f 'call.c' || echo './'`call.c; \ then mv -f ".deps/libcob_la-call.Tpo" ".deps/libcob_la-call.Plo"; else rm -f ".deps/libcob_la-call.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/pantherl/occobol/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall - Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF .deps/libcob_la-call.Tpo -c call.c -fP IC -DPIC -o .libs/libcob_la-call.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/pantherl/occobol/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall - Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF .deps/libcob_la-call.Tpo -c call.c -o l ibcob_la-call.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/pantherl/occobol/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF ".deps/libcob_la-strings.Tpo" -c -o libcob_la-strings.lo `test -f 'strings.c' || echo './'`strings.c; \ then mv -f ".deps/libcob_la-strings.Tpo" ".deps/libcob_la-strings.Plo"; else rm -f ".deps/libcob_la-strings.Tpo"; exi t 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/pantherl/occobol/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall - Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF .deps/libcob_la-strings.Tpo -c strin gs.c -fPIC -DPIC -o .libs/libcob_la-strings.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/pantherl/occobol/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall - Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF .deps/libcob_la-strings.Tpo -c strin gs.c -o libcob_la-strings.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/pantherl/occobol/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF ".deps/libcob_la-numeric.Tpo" -c -o libcob_la-numeric.lo `test -f 'numeric.c' || echo './'`numeric.c; \ then mv -f ".deps/libcob_la-numeric.Tpo" ".deps/libcob_la-numeric.Plo"; else rm -f ".deps/libcob_la-numeric.Tpo"; exi t 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/pantherl/occobol/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall - Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF .deps/libcob_la-numeric.Tpo -c numer ic.c -fPIC -DPIC -o .libs/libcob_la-numeric.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/pantherl/occobol/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall - Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF .deps/libcob_la-numeric.Tpo -c numer ic.c -o libcob_la-numeric.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/pantherl/occobol/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic. lo -MD -MP -MF ".deps/libcob_la-intrinsic.Tpo" -c -o libcob_la-intrinsic.lo `test -f 'intrinsic.c' || echo './'`intrinsic.c; \ then mv -f ".deps/libcob_la-intrinsic.Tpo" ".deps/libcob_la-intrinsic.Plo"; else rm -f ".deps/libcob_la-intrinsic.Tpo "; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/pantherl/occobol/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall - Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic.lo -MD -MP -MF .deps/libcob_la-intrinsic.Tpo -c i ntrinsic.c -fPIC -DPIC -o .libs/libcob_la-intrinsic.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/pantherl/occobol/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall - Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic.lo -MD -MP -MF .deps/libcob_la-intrinsic.Tpo -c i ntrinsic.c -o libcob_la-intrinsic.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/pantherl/occobol/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF ".deps/libcob_la-fileio.Tpo" -c -o libcob_la-fileio.lo `test -f 'fileio.c' || echo './'`fileio.c; \ then mv -f ".deps/libcob_la-fileio.Tpo" ".deps/libcob_la-fileio.Plo"; else rm -f ".deps/libcob_la-fileio.Tpo"; exit 1 ; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/pantherl/occobol/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall - Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF .deps/libcob_la-fileio.Tpo -c fileio. c -fPIC -DPIC -o .libs/libcob_la-fileio.o fileio.c:311: error: expected specifier-qualifier-list before 'DB' fileio.c: In function 'cob_sync': fileio.c:639: error: 'struct indexed_file' has no member named 'db' fileio.c:640: error: 'struct indexed_file' has no member named 'db' fileio.c:640: error: 'struct indexed_file' has no member named 'db' fileio.c:645: error: 'struct indexed_file' has no member named 'db' fileio.c:649: error: 'struct indexed_file' has no member named 'db' fileio.c:649: error: 'struct indexed_file' has no member named 'db' fileio.c: In function 'indexed_open': fileio.c:1899: error: 'BTREEINFO' undeclared (first use in this function) fileio.c:1899: error: (Each undeclared identifier is reported only once fileio.c:1899: error: for each function it appears in.) fileio.c:1899: error: expected ';' before 'info' fileio.c:1954: error: 'struct indexed_file' has no member named 'db' fileio.c:1954: error: 'DB' undeclared (first use in this function) fileio.c:1954: error: expected expression before ')' token fileio.c:1959: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:1960: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:1961: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:2000: error: 'info' undeclared (first use in this function) fileio.c:2002: error: 'R_DUP' undeclared (first use in this function) fileio.c:2013: error: 'struct indexed_file' has no member named 'db' fileio.c:2013: warning: implicit declaration of function 'dbopen' fileio.c:2013: error: 'DB_BTREE' undeclared (first use in this function) fileio.c:2014: error: 'struct indexed_file' has no member named 'db' fileio.c:2020: error: 'struct indexed_file' has no member named 'db' fileio.c:2020: error: 'struct indexed_file' has no member named 'db' fileio.c:2027: error: 'struct indexed_file' has no member named 'db' fileio.c:2028: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2029: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2041: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2042: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2050: error: 'struct indexed_file' has no member named 'key' fileio.c:2050: error: 'DBT' undeclared (first use in this function) fileio.c:2051: error: 'struct indexed_file' has no member named 'data' fileio.c:2067: error: 'struct indexed_file' has no member named 'db' fileio.c:2067: error: 'struct indexed_file' has no member named 'db' fileio.c:2067: error: 'struct indexed_file' has no member named 'key' fileio.c:2067: error: 'struct indexed_file' has no member named 'data' fileio.c:2067: error: 'R_FIRST' undeclared (first use in this function) fileio.c:2070: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2070: error: 'struct indexed_file' has no member named 'key' fileio.c:2070: error: 'struct indexed_file' has no member named 'key' fileio.c:2072: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_close': fileio.c:2115: error: 'struct indexed_file' has no member named 'db' fileio.c:2116: error: 'struct indexed_file' has no member named 'db' fileio.c:2116: error: 'struct indexed_file' has no member named 'db' fileio.c:2118: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2119: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2126: error: 'struct indexed_file' has no member named 'db' fileio.c:2127: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2128: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2129: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c: In function 'indexed_start_internal': fileio.c:2169: error: 'struct indexed_file' has no member named 'key' fileio.c:2169: error: 'struct indexed_file' has no member named 'key' fileio.c:2178: error: 'struct indexed_file' has no member named 'db' fileio.c:2178: error: 'struct indexed_file' has no member named 'db' fileio.c:2178: error: 'struct indexed_file' has no member named 'key' fileio.c:2178: error: 'struct indexed_file' has no member named 'data' fileio.c:2178: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:2183: error: 'struct indexed_file' has no member named 'key' fileio.c:2191: error: 'struct indexed_file' has no member named 'db' fileio.c:2191: error: 'struct indexed_file' has no member named 'db' fileio.c:2191: error: 'struct indexed_file' has no member named 'key' fileio.c:2191: error: 'struct indexed_file' has no member named 'data' fileio.c:2191: error: 'R_LAST' undeclared (first use in this function) fileio.c:2197: error: 'struct indexed_file' has no member named 'db' fileio.c:2197: error: 'struct indexed_file' has no member named 'db' fileio.c:2197: error: 'struct indexed_file' has no member named 'key' fileio.c:2197: error: 'struct indexed_file' has no member named 'data' fileio.c:2197: error: 'R_PREV' undeclared (first use in this function) fileio.c:2206: error: 'struct indexed_file' has no member named 'db' fileio.c:2206: error: 'struct indexed_file' has no member named 'db' fileio.c:2206: error: 'struct indexed_file' has no member named 'key' fileio.c:2206: error: 'struct indexed_file' has no member named 'data' fileio.c:2208: error: 'struct indexed_file' has no member named 'key' fileio.c:2212: error: 'struct indexed_file' has no member named 'db' fileio.c:2212: error: 'struct indexed_file' has no member named 'db' fileio.c:2212: error: 'struct indexed_file' has no member named 'key' fileio.c:2212: error: 'struct indexed_file' has no member named 'data' fileio.c:2218: error: 'struct indexed_file' has no member named 'key' fileio.c:2219: error: 'struct indexed_file' has no member named 'db' fileio.c:2219: error: 'struct indexed_file' has no member named 'db' fileio.c:2219: error: 'struct indexed_file' has no member named 'key' fileio.c:2219: error: 'struct indexed_file' has no member named 'data' fileio.c:2219: error: 'R_NEXT' undeclared (first use in this function) fileio.c:2226: error: 'struct indexed_file' has no member named 'db' fileio.c:2226: error: 'struct indexed_file' has no member named 'db' fileio.c:2226: error: 'struct indexed_file' has no member named 'key' fileio.c:2226: error: 'struct indexed_file' has no member named 'data' fileio.c:2232: error: 'struct indexed_file' has no member named 'db' fileio.c:2232: error: 'struct indexed_file' has no member named 'db' fileio.c:2232: error: 'struct indexed_file' has no member named 'key' fileio.c:2232: error: 'struct indexed_file' has no member named 'data' fileio.c:2238: error: 'struct indexed_file' has no member named 'key' fileio.c:2242: error: 'struct indexed_file' has no member named 'db' fileio.c:2242: error: 'struct indexed_file' has no member named 'db' fileio.c:2242: error: 'struct indexed_file' has no member named 'key' fileio.c:2242: error: 'struct indexed_file' has no member named 'data' fileio.c:2253: error: 'struct indexed_file' has no member named 'key' fileio.c:2255: error: 'struct indexed_file' has no member named 'data' fileio.c:2257: error: 'struct indexed_file' has no member named 'key' fileio.c:2257: error: 'struct indexed_file' has no member named 'data' fileio.c:2258: error: 'struct indexed_file' has no member named 'key' fileio.c:2259: error: 'struct indexed_file' has no member named 'db' fileio.c:2259: error: 'struct indexed_file' has no member named 'db' fileio.c:2259: error: 'struct indexed_file' has no member named 'key' fileio.c:2259: error: 'struct indexed_file' has no member named 'data' fileio.c:2293: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2293: error: 'struct indexed_file' has no member named 'key' fileio.c:2295: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2297: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2297: error: 'struct indexed_file' has no member named 'key' fileio.c:2299: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c: In function 'indexed_read': fileio.c:2534: error: 'struct indexed_file' has no member named 'data' fileio.c:2535: error: 'struct indexed_file' has no member named 'data' fileio.c:2535: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_read_next': fileio.c:2794: error: 'R_NEXT' undeclared (first use in this function) fileio.c:2806: error: 'R_LAST' undeclared (first use in this function) fileio.c:2808: error: 'R_PREV' undeclared (first use in this function) fileio.c:2811: error: 'R_FIRST' undeclared (first use in this function) fileio.c:2823: error: 'struct indexed_file' has no member named 'data' fileio.c:2836: error: 'struct indexed_file' has no member named 'key' fileio.c:2837: error: 'struct indexed_file' has no member named 'key' fileio.c:2837: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2841: error: 'struct indexed_file' has no member named 'db' fileio.c:2841: error: 'struct indexed_file' has no member named 'db' fileio.c:2841: error: 'struct indexed_file' has no member named 'key' fileio.c:2841: error: 'struct indexed_file' has no member named 'data' fileio.c:2845: error: 'struct indexed_file' has no member named 'data' fileio.c:2847: error: 'struct indexed_file' has no member named 'key' fileio.c:2847: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2847: error: 'struct indexed_file' has no member named 'key' fileio.c:2848: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2852: error: 'struct indexed_file' has no member named 'db' fileio.c:2852: error: 'struct indexed_file' has no member named 'db' fileio.c:2852: error: 'struct indexed_file' has no member named 'key' fileio.c:2852: error: 'struct indexed_file' has no member named 'data' fileio.c:2854: error: 'struct indexed_file' has no member named 'data' fileio.c:2857: error: 'struct indexed_file' has no member named 'key' fileio.c:2857: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2857: error: 'struct indexed_file' has no member named 'key' fileio.c:2858: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2859: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2859: error: 'struct indexed_file' has no member named 'data' fileio.c:2864: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2864: error: 'struct indexed_file' has no member named 'data' fileio.c:2867: error: 'struct indexed_file' has no member named 'key' fileio.c:2868: error: 'struct indexed_file' has no member named 'key' fileio.c:2868: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2869: error: 'struct indexed_file' has no member named 'db' fileio.c:2869: error: 'struct indexed_file' has no member named 'db' fileio.c:2869: error: 'struct indexed_file' has no member named 'key' fileio.c:2869: error: 'struct indexed_file' has no member named 'data' fileio.c:2906: error: 'struct indexed_file' has no member named 'key' fileio.c:2907: error: 'struct indexed_file' has no member named 'key' fileio.c:2907: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2911: error: 'struct indexed_file' has no member named 'db' fileio.c:2911: error: 'struct indexed_file' has no member named 'db' fileio.c:2911: error: 'struct indexed_file' has no member named 'key' fileio.c:2911: error: 'struct indexed_file' has no member named 'data' fileio.c:2911: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:2930: error: 'struct indexed_file' has no member named 'key' fileio.c:2930: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2930: error: 'struct indexed_file' has no member named 'key' fileio.c:2932: error: 'struct indexed_file' has no member named 'data' fileio.c:2934: error: 'struct indexed_file' has no member named 'key' fileio.c:2934: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2934: error: 'struct indexed_file' has no member named 'key' fileio.c:2935: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2939: error: 'struct indexed_file' has no member named 'db' fileio.c:2939: error: 'struct indexed_file' has no member named 'db' fileio.c:2939: error: 'struct indexed_file' has no member named 'key' fileio.c:2939: error: 'struct indexed_file' has no member named 'data' fileio.c:2941: error: 'struct indexed_file' has no member named 'data' fileio.c:2959: error: 'struct indexed_file' has no member named 'key' fileio.c:2959: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2959: error: 'struct indexed_file' has no member named 'key' fileio.c:2960: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2986: error: 'struct indexed_file' has no member named 'db' fileio.c:2986: error: 'struct indexed_file' has no member named 'db' fileio.c:2986: error: 'struct indexed_file' has no member named 'key' fileio.c:2986: error: 'struct indexed_file' has no member named 'data' fileio.c:3003: error: 'struct indexed_file' has no member named 'key' fileio.c:3003: error: 'struct indexed_file' has no member named 'key' fileio.c:3005: error: 'struct indexed_file' has no member named 'data' fileio.c:3007: error: 'struct indexed_file' has no member named 'key' fileio.c:3007: error: 'struct indexed_file' has no member named 'data' fileio.c:3008: error: 'struct indexed_file' has no member named 'key' fileio.c:3009: error: 'struct indexed_file' has no member named 'db' fileio.c:3009: error: 'struct indexed_file' has no member named 'db' fileio.c:3009: error: 'struct indexed_file' has no member named 'key' fileio.c:3009: error: 'struct indexed_file' has no member named 'data' fileio.c:3048: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:3048: error: 'struct indexed_file' has no member named 'key' fileio.c:3048: error: 'struct indexed_file' has no member named 'key' fileio.c:3050: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:3052: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:3052: error: 'struct indexed_file' has no member named 'key' fileio.c:3054: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:3068: error: 'struct indexed_file' has no member named 'data' fileio.c:3069: error: 'struct indexed_file' has no member named 'data' fileio.c:3069: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'get_dupno': fileio.c:3084: error: 'struct indexed_file' has no member named 'key' fileio.c:3084: error: 'struct indexed_file' has no member named 'key' fileio.c:3085: error: 'struct indexed_file' has no member named 'key' fileio.c:3085: error: 'struct indexed_file' has no member named 'key' fileio.c:3090: error: 'struct indexed_file' has no member named 'db' fileio.c:3090: error: 'struct indexed_file' has no member named 'db' fileio.c:3090: error: 'struct indexed_file' has no member named 'key' fileio.c:3090: error: 'struct indexed_file' has no member named 'data' fileio.c:3090: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:3092: error: 'struct indexed_file' has no member named 'key' fileio.c:3092: error: 'struct indexed_file' has no member named 'key' fileio.c:3093: error: 'struct indexed_file' has no member named 'data' fileio.c:3097: error: 'struct indexed_file' has no member named 'db' fileio.c:3097: error: 'struct indexed_file' has no member named 'db' fileio.c:3097: error: 'struct indexed_file' has no member named 'key' fileio.c:3097: error: 'struct indexed_file' has no member named 'data' fileio.c:3097: error: 'R_NEXT' undeclared (first use in this function) fileio.c: In function 'check_alt_keys': fileio.c:3116: error: 'struct indexed_file' has no member named 'key' fileio.c:3116: error: 'struct indexed_file' has no member named 'key' fileio.c:3117: error: 'struct indexed_file' has no member named 'db' fileio.c:3117: error: 'struct indexed_file' has no member named 'db' fileio.c:3117: error: 'struct indexed_file' has no member named 'key' fileio.c:3117: error: 'struct indexed_file' has no member named 'data' fileio.c:3120: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_write_internal': fileio.c:3168: error: 'struct indexed_file' has no member named 'key' fileio.c:3168: error: 'struct indexed_file' has no member named 'key' fileio.c:3185: error: 'struct indexed_file' has no member named 'data' fileio.c:3186: error: 'struct indexed_file' has no member named 'data' fileio.c:3187: error: 'struct indexed_file' has no member named 'db' fileio.c:3187: error: 'struct indexed_file' has no member named 'db' fileio.c:3187: error: 'struct indexed_file' has no member named 'key' fileio.c:3187: error: 'struct indexed_file' has no member named 'data' fileio.c:3187: error: 'R_NOOVERWRITE' undeclared (first use in this function) fileio.c:3193: error: 'struct indexed_file' has no member named 'data' fileio.c:3193: error: 'struct indexed_file' has no member named 'key' fileio.c:3195: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:3205: error: 'struct indexed_file' has no member named 'data' fileio.c:3206: error: 'struct indexed_file' has no member named 'data' fileio.c:3215: error: 'struct indexed_file' has no member named 'key' fileio.c:3215: error: 'struct indexed_file' has no member named 'key' fileio.c:3216: error: 'struct indexed_file' has no member named 'db' fileio.c:3216: error: 'struct indexed_file' has no member named 'db' fileio.c:3216: error: 'struct indexed_file' has no member named 'key' fileio.c:3216: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_write': fileio.c:3292: error: 'struct indexed_file' has no member named 'key' fileio.c:3292: error: 'struct indexed_file' has no member named 'key' fileio.c:3294: error: 'struct indexed_file' has no member named 'key' fileio.c:3296: error: 'struct indexed_file' has no member named 'key' fileio.c:3296: error: 'struct indexed_file' has no member named 'key' fileio.c:3299: error: 'struct indexed_file' has no member named 'key' fileio.c:3299: error: 'struct indexed_file' has no member named 'key' fileio.c: In function 'indexed_delete_internal': fileio.c:3312: error: 'DBT' undeclared (first use in this function) fileio.c:3312: error: expected ';' before 'prim_key' fileio.c:3359: error: 'struct indexed_file' has no member named 'key' fileio.c:3359: error: 'struct indexed_file' has no member named 'key' fileio.c:3360: error: 'struct indexed_file' has no member named 'db' fileio.c:3360: error: 'struct indexed_file' has no member named 'db' fileio.c:3360: error: 'struct indexed_file' has no member named 'key' fileio.c:3360: error: 'struct indexed_file' has no member named 'data' fileio.c:3365: error: 'prim_key' undeclared (first use in this function) fileio.c:3365: error: 'struct indexed_file' has no member named 'key' fileio.c:3368: error: 'struct indexed_file' has no member named 'data' fileio.c:3370: error: 'struct indexed_file' has no member named 'key' fileio.c:3370: error: 'struct indexed_file' has no member named 'key' fileio.c:3371: error: 'struct indexed_file' has no member named 'key' fileio.c:3371: error: 'struct indexed_file' has no member named 'key' fileio.c:3374: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:3374: error: 'struct indexed_file' has no member named 'key' fileio.c:3374: error: 'struct indexed_file' has no member named 'key' fileio.c:3375: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:3380: error: 'struct indexed_file' has no member named 'db' fileio.c:3380: error: 'struct indexed_file' has no member named 'db' fileio.c:3380: error: 'struct indexed_file' has no member named 'key' fileio.c:3382: error: expected ';' before 'sec_key' fileio.c:3388: error: 'struct indexed_file' has no member named 'db' fileio.c:3388: error: 'struct indexed_file' has no member named 'db' fileio.c:3388: error: 'struct indexed_file' has no member named 'key' fileio.c:3388: error: 'struct indexed_file' has no member named 'data' fileio.c:3388: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:3390: error: 'sec_key' undeclared (first use in this function) fileio.c:3390: error: 'struct indexed_file' has no member named 'key' fileio.c:3391: error: 'struct indexed_file' has no member named 'key' fileio.c:3393: error: 'struct indexed_file' has no member named 'data' fileio.c:3398: error: 'struct indexed_file' has no member named 'db' fileio.c:3398: error: 'struct indexed_file' has no member named 'db' fileio.c:3398: error: 'struct indexed_file' has no member named 'key' fileio.c:3404: error: 'struct indexed_file' has no member named 'db' fileio.c:3404: error: 'struct indexed_file' has no member named 'db' fileio.c:3404: error: 'struct indexed_file' has no member named 'key' fileio.c:3404: error: 'struct indexed_file' has no member named 'data' fileio.c:3404: error: 'R_NEXT' undeclared (first use in this function) fileio.c:3421: error: 'struct indexed_file' has no member named 'db' fileio.c:3421: error: 'struct indexed_file' has no member named 'db' fileio.c: In function 'indexed_rewrite': fileio.c:3584: error: 'struct indexed_file' has no member named 'key' fileio.c:3584: error: 'struct indexed_file' has no member named 'key' make[2]: *** [libcob_la-fileio.lo] Error 1 make[2]: Leaving directory `/home/pantherl/downloads/installers/open-cobol-1.1/libcob' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/pantherl/downloads/installers/open-cobol-1.1' make: *** [all] Error 2 [/quote] ---------------------------------------------------------------- While aoirthoir checks the details of BDB problems (I guess you have to add some paths by hand) you can try to compile vbisam (get it from http://www.sim-basis.de/vbisam-2.0.tar.gz and unpack it, do ./configure and make in the vbisam directory) and compile OC with vbisam afterwards (by add the vbisam paths before doing ./configure --with-vbisam and make/make check/make install). human ---------------------------------------------------------------- OK. SO I know when I am in over my head. I did wget on the vbisam2.0 you indicated. Did a tar -xvf on it. cd vbsiam2.0 and did the ./configure when I did a make I got the following: [quote] [ernieball]$ make make all-recursive make[1]: Entering directory `/home/pantherl/downloads/installers/vbisam-2.0' Making all in libvbisam make[2]: Entering directory `/home/pantherl/downloads/installers/vbisam-2.0/libvbisam' if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/pantherl/occobol/programs/include -I .. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libvbisam_la-ishelp er.lo -MD -MP -MF ".deps/libvbisam_la-ishelper.Tpo" -c -o libvbisam_la-ishelper.lo `test -f 'ishelper.c' || echo './'`ishelpe r.c; \ then mv -f ".deps/libvbisam_la-ishelper.Tpo" ".deps/libvbisam_la-ishelper.Plo"; else rm -f ".deps/libvbisam_la-ishelp er.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/pantherl/occobol/programs/include -I.. -g -O2 -finline-functions -fsigned-char -Wal l -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libvbisam_la-ishelper.lo -MD -MP -MF .deps/libvbisam_la-ishelper.T po -c ishelper.c -fPIC -DPIC -o .libs/libvbisam_la-ishelper.o ishelper.c:147: error: conflicting types for 'isrelrec' ../vbisam.h:221: error: previous declaration of 'isrelrec' was here ishelper.c:195: error: conflicting types for 'issetunique' ../vbisam.h:229: error: previous declaration of 'issetunique' was here ishelper.c:226: error: conflicting types for 'isuniqueid' ../vbisam.h:232: error: previous declaration of 'isuniqueid' was here make[2]: *** [libvbisam_la-ishelper.lo] Error 1 make[2]: Leaving directory `/home/pantherl/downloads/installers/vbisam-2.0/libvbisam' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/pantherl/downloads/installers/vbisam-2.0' make: *** [all] Error 2 [ernieball]$ [/quote] So, it seems there is more going on with Dreamhost. I am going to wait until aoirthoir has time to muck around with them. No sense in pursuing this when I am in way over my head and someone who knows what they are doing will be able to deal with this. I do appreciate the patients you have shown with all this human. I just do not want to waste more of your time. Once all this is up and working I will be able to contribute more in the area of OC modules and copybooks. In the mean time I am focusing on the following: Documenting MAC OS X install MAC OS X web development XAMP with OC (For working on Win7) Cheers ---------------------------------------------------------------- Subject: Problem with installation: warning and errors in screenio.c / .h I've tried to install OpenCobol in a new cygwin environment. Got the recent cygwin setup.exe, made a small install with gcc4, libdb4.2, libgmp3, libintl and make. With the newly downloaded tarball from the left I did ./configure, this went fine: [quote]OpenCOBOL Configuration: CC gcc COB_CC gcc CFLAGS -g -O2 -march=i686 -mtune=pentium4 -finline-functions -fs igned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k COB_CFLAGS -I/usr/local/include COB_EXTRA_FLAGS -march=i686 -mtune=pentium4 LDFLAGS COB_LDFLAGS COBC_LIBS -lintl COB_LIBS -L${exec_prefix}/lib -lcob -lm -lgmp -lintl -ldb COB_CONFIG_DIR ${prefix}/share/open-cobol/config COB_COPY_DIR ${prefix}/share/open-cobol/copy COB_LIBRARY_PATH .:${exec_prefix}/lib/open-cobol COB_MODULE_EXT dll COB_SHARED_OPT -shared COB_PIC_FLAGS -DDLL_EXPORT -DPIC COB_EXPORT_DYN -Wl,--export-all-symbols -Wl,--enable-auto-import COB_STRIP_CMD strip --strip-unneeded Dynamic loading System Use gettext for international messages: yes Use Berkeley DB for file I/O: yes Use enhanced Berkeley DB (>= 4.1) yes Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: no[/quote] Now I tried make and the following errors occured. [quote]screenio.c:916: warning: no previous prototype for 'cob_screen_init' screenio.c:926: error: conflicting types for 'cob_field_display' screenio.h:84: error: previous declaration of 'cob_field_display' was here screenio.c:926: error: conflicting types for 'cob_field_display' screenio.h:84: error: previous declaration of 'cob_field_display' was here screenio.c:931: error: conflicting types for 'cob_field_accept' screenio.h:86: error: previous declaration of 'cob_field_accept' was here screenio.c:931: error: conflicting types for 'cob_field_accept' screenio.h:86: error: previous declaration of 'cob_field_accept' was here make[2]: *** [libcob_la-screenio.lo] Error 1 make[2]: Leaving directory `/tmp/install_files/open-cobol-1.1/libcob' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/tmp/install_files/open-cobol-1.1' make: *** [all] Error 2[/quote] Is there something missing in the configure-script? What can I do? ---------------------------------------------------------------- I do not know if this information is valuable to kick this problem out: lncurses8 (5.3.3) is used ---------------------------------------------------------------- OK. It should be possible to compile without curses. This has been fixed in current 1.1 tarball. This will get over the make problem. Now as to why curses is not being detected. Have you got both runtime AND development ncurses packages installed? Look for file ncurses.h somewhere below /usr/include. Roger ---------------------------------------------------------------- Tried current tarball, make works without curses know. I didn't had development ncurses installed, after doing this ./configure says what it should: [quote] Use gettext for international messages: yes Use Berkeley DB for file I/O: yes Use enhanced Berkeley DB (>= 4.1) yes Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: yes[/quote]So all fine here. ---------------------------------------------------------------- Subject: OC encoding UTF-8 problems I tried to compile with utf-8 Greek characters but didn't compiled. The following error occured: [code]Error: syntax error, unexpected "end of file", expecting LEADING or TRAILING[/code] Then I realized that some Greek characters acted as EOF. The behavior is very strange because they aren't the same from time to time. Also I have the same problem with ISO8859-7 (GREEK). Greek characters under 8859-7 follow : [code] ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ αβγδεζηθικλμνξοπρστυφχψω άέήίόύώ ΆΈΉΊΌΎΏ ϊϋΪΫ [/code] ---------------------------------------------------------------- When I insert Greek from command line argument, everything goes fine, but when I try to input data using COBOL accept statement, I get rubbish. Also ACCEPT ... UPDATE doesn't response appropriate. ---------------------------------------------------------------- just a shot in the dark. Have you tried using the trim function on the accepted field before moving it into the UTF-8 field? [code] move function trim(flda) to fldb. [/code] ---------------------------------------------------------------- jrls, Today, trying what you recommended and worked, I thought if it was another error and tested again. Everything worked! Without the use of trim function too. Therefore ACCEPT works. Just tested and the original problem with utf-8 or iso8859-7 character set in source compiling OpenCOBOL again and worked, too! Thanks for your reply. ---------------------------------------------------------------- Subject: first try.. Excuse maybe my question but I just install opencobol on my ubuntu and try the hello world exemple I have many mistake I don't know what is wrong. cb@cbbur07:~/temp/cobol$ cobc -x hello.cob cobc: hello.cob: Aucun fichier ou dossier de ce type cb@cbbur07:~/temp/cobol$ cobc -x test.cob test.cob:1: Warning: Invalid indicator 'S' at column 7 test.cob:1: Error: syntax error, unexpected WORD, expecting PROGRAM_ID cb@cbbur07:~/temp/cobol$ cobc -x test.cob test.cob:1: Warning: Invalid indicator 'I' at column 7 test.cob:1: Error: syntax error, unexpected WORD, expecting PROGRAM_ID cb@cbbur07:~/temp/cobol$ cobc -x test.cob test.cob:1: Error: syntax error, unexpected WORD, expecting PROGRAM_ID cb@cbbur07:~/temp/cobol$ cobc -x test.cob test.cob:1: Error: syntax error, unexpected WORD, expecting PROGRAM_ID cb@cbbur07:~/temp/cobol$ cobc -x test.cob test.cob:1: Error: syntax error, unexpected WORD, expecting PROGRAM_ID cb@cbbur07:~/temp/cobol$ cobc -x test.cob test.cob:1: Error: syntax error, unexpected WORD, expecting PROGRAM_ID cb@cbbur07:~/temp/cobol$ cobc -x test.cob test.cob:1: Error: syntax error, unexpected WORD, expecting PROGRAM_ID cb@cbbur07:~/temp/cobol$ cobc -x test.cob test.cob:1: Error: syntax error, unexpected WORD, expecting PROGRAM_ID Of course I try to change the code but where is the rule. Aparently it expect some word and at certain position. I expected the exemple working or maybe My copy was wrong. ---------------------------------------------------------------- I Change the Hello world exemple and I have that now IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. PROCEDURE DIVISION. DISPLAY "Hello World!". STOP RUN. And I can go one step later but I have : cobc -x hello.cob /usr/bin/ld: cannot find -lncurses collect2: ld a retourné 1 code d'état d'exécution What is wrong ? Just notice that the 7 space at the begining is not showing in this forum. ---------------------------------------------------------------- Welcome to OC! For writing source code here you should always use the CODE-Tag (The symbol <>), then everything is shown like it was typed (also spaces). Try to edit your post in this way. If you use accept/display you have to install ncurses, like said in the README [quote] Ncurses (libncurses) 5.2 or later http://www.gnu.org/software/ncurses/ncurses.html libncurses is used to implement SCREEN SECTION and extended ACCEPT/DISPLAY. Ncurses is distributed under a BSD style license.[/quote] After doing that, make a new install: [code] make clean ./configure make make install[/code] ---------------------------------------------------------------- Sorry I did not know hot to put code I try .. but no !!! Thanks I installed libncurses5-dev. But now I have other problems.. [code] ./hello ./hello: symbol lookup error: /usr/lib/libcob.so.1: undefined symbol: dlopen[/code] OK I found : it is [code] but not I promess now in my next post it will be clean :< But I did not know how to change my old question sorry I am using ubuntu it it helps you and I make my install byt apt-get install open-cobol ---------------------------------------------------------------- Hi aktos! Just open a terminal from Applications>Accesories>Terminal and type: sudo apt-get install ncurses-base ncurses-bin libncurses5-dev open-cobol mcedit If you already have one of these installed apt-get warns you about, but nobody will get hurt. Also, just to mention it, my favourite editor is, of course, mcedit. My mother`s tonge is Spanish, so please forgive my english mistakes. ---------------------------------------------------------------- Incidentally, due to open-cobol reliance on gcc and friends (C/C++ compiler, libraries, headers and tools) you should install them with: sudo apt-get install build-essentials ---------------------------------------------------------------- You'll probably need [b]libdb[/b] as well. And [b]libgmp[/b]. If you have [i]locate[/i] installed [code]$ locate libcob.so[/code] and if necessary [code]$ export LD_LIBRARY_PATH=/where/is/it/:$LD_LIBRARY_PATH[/code] But not finding libcob means the install is kinda broken. libcob.so in installed in /usr/lib/ by the open-cobol 1.0 Debian package I used. When and if you build from the tarball, by default, things will go into /usr/local/lib (along with /usr/local/bin). For more info http://opencobol.add1tocobol.com/ocfaq.html Cheers Brian ---------------------------------------------------------------- Yes, I agree with Brian. If you are installing from a package (rpm, deb), then any problems you have should be directed to the package creator. Also Brian has pointed out the differing install directories. Be careful when doing a tarball install when previously a package install was done (or vice-versa). Basically means uninstalling one or the other. Packagers usually get OC dependencies wrong. Here is a snip from an RPM spec file which describes the correct OC dependencies (for a reasonably current Linux) [code] BuildRequires: gcc BuildRequires: glibc-devel BuildRequires: glibc BuildRequires: gmp-devel >= 4.1.4 BuildRequires: gmp >= 4.1.4 BuildRequires: db-devel >= 4.1.24 BuildRequires: db >= 4.1.24 BuildRequires: ncurses-devel >= 5.4 BuildRequires: ncurses >= 5.4 Requires: gcc Requires: glibc Requires: glibc-devel Requires: gmp >= 4.1.4 Requires: gmp-devel >= 4.1.4 Requires: db >= 4.1.24 Requires: ncurses >= 5.4 [/code] OC is somewhat unique in requiring development packages for the runtime. So it is almost impossible to split as OC and OC-devel. (Actually rpmlint complains heavily about the above specs) Roger ---------------------------------------------------------------- Subject: IRC or chat room ? Do you know where I can find chat room with people discusting about technical issue about open cobol. I would like to make my hello word today and It is not easy to know what is wrong and how to correct it hte manual is not for beginer . ---------------------------------------------------------------- This has more information Aktso1: http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=264&forum=1 But you can get it on freenode IRC at the channel: #add1tocobol You can also access from the web here: http://www.add1tocobol.com/i_o_control.php ---------------------------------------------------------------- Subject: mysql access example using libdbi This shows how you could access a database. Its my first try so its not the best code I'm sure. I'm using libdgi from http://libdbi.sourceforge.net/ c source dbm.c [code] #include #include dbi_conn dbOpen (char *connType, char *host, char *user, char *pass, char *dbName, char *encoding) { dbi_conn *conn; dbi_initialize(NULL); printf("type=%s host=%s user=%s\n", connType, host, user); conn = dbi_conn_new(connType); dbi_conn_set_option(conn, "host", host); dbi_conn_set_option(conn, "username", user); dbi_conn_set_option(conn, "password", pass); dbi_conn_set_option(conn, "dbname", dbName); dbi_conn_set_option(conn, "encoding", encoding); if (dbi_conn_connect(conn) < 0) { printf("Could not connect. Please check the option settings\n"); } return conn; } int dbExec(dbi_conn *conn) { dbi_result result; int id; int regionId; const char *parish; result = dbi_conn_queryf(conn, "SELECT * FROM parishregion;"); if (result) { while (dbi_result_next_row(result)) { id = dbi_result_get_uint(result, "id"); regionId = dbi_result_get_uint(result, "region"); parish = dbi_result_get_string(result, "parish"); printf("region %i is in %s parish id=%i\n", regionId, parish, id); } dbi_result_free(result); } return 0; } int dbClose (dbi_conn *conn) { dbi_conn_close(conn); return 0; } [/code] cobol source sqltest.cob [code] *>>source free *>********************************************************************* *> Author: jrls (John Ellis) *> Date: 17-Sept-2008 *> Purpose: Testing a possible way to use SQLITE. *> *>********************************************************************* identification division. program-id. sqlitetest. data division. working-storage section. 01 dbConn usage pointer sync. 01 dbType pic x(5) value "mysql". 01 dbHost pic x(9) value "localhost". 01 dbUser pic x(6) value "ocuser". 01 dbPass pic x(9) value "*********" 01 dbName pic x(4) value "pfdb". 01 dbEncode pic x(5) value "UTF-8". 01 dbCode pic 9(8) comp value zero. procedure division. 0000-start. display "open". call "dbOpen" using by reference dbType, by reference dbHost, by reference dbUser, by reference dbPass, by reference dbName, by reference dbEncode, returning dbConn. display "open code>>" dbConn. display "exec". call "dbExec" using by value dbConn returning dbCode. display "exec code" dbCode. display "close". call "dbClose" using by value dbConn returning dbCode. display "close code>>" dbCode. stop run. [/code] compiled linked as follows then executed [code] cc -c dbm.c cobc -x -free -lm -ldl -ldbi sqltest.cob dbm.o ./sqltest open type=mysql host=localhost user=ocuser open code>>0x0978ab60 exec region 4 is in Acadia parish id=0 region 5 is in Allen parish id=1 region 2 is in Ascension parish id=2 region 3 is in Assumption parish id=3 region 6 is in Avoyelles parish id=4 region 5 is in Beauregard parish id=5 region 7 is in Bienville parish id=6 region 7 is in Bossier parish id=7 region 7 is in Caddo parish id=8 region 5 is in Calcasieu parish id=9 region 8 is in Caldwell parish id=10 region 5 is in Cameron parish id=11 region 6 is in Catahoula parish id=12 region 7 is in Claiborne parish id=13 region 6 is in Concordia parish id=14 region 7 is in De Soto parish id=15 region 2 is in East Baton Rouge parish id=16 region 8 is in East Carroll parish id=17 region 2 is in East Feliciana parish id=18 region 4 is in Evangeline parish id=19 region 8 is in Franklin parish id=20 region 6 is in Grant parish id=21 region 4 is in Iberia parish id=22 region 2 is in Iberville parish id=23 region 8 is in Jackson parish id=24 region 10 is in Jefferson parish id=25 region 5 is in Jefferson Davis parish id=26 region 6 is in La Salle parish id=27 region 4 is in Lafayette parish id=28 region 3 is in Lafourche parish id=29 region 8 is in Lincoln parish id=30 region 9 is in Livingston parish id=31 region 8 is in Madison parish id=32 region 8 is in Morehouse parish id=33 region 7 is in Natchitoches parish id=34 region 1 is in Orleans parish id=35 region 8 is in Ouachita parish id=36 region 1 is in Plaquemines parish id=37 region 2 is in Pointe Coupee parish id=38 region 6 is in Rapides parish id=39 region 7 is in Red River parish id=40 region 8 is in Richland parish id=41 region 7 is in Sabine parish id=42 region 1 is in St. Bernard parish id=43 region 3 is in St. Charles parish id=44 region 9 is in St. Helena parish id=45 region 3 is in St. James parish id=46 region 3 is in St. John The Baptist parish id=47 region 4 is in St. Landry parish id=48 region 4 is in St. Martin parish id=49 region 3 is in St. Mary parish id=50 region 9 is in St. Tammany parish id=51 region 9 is in Tangipahoa parish id=52 region 8 is in Tensas parish id=53 region 3 is in Terrebonne parish id=54 region 8 is in Union parish id=55 region 4 is in Vermilion parish id=56 region 6 is in Vernon parish id=57 region 9 is in Washington parish id=58 region 7 is in Webster parish id=59 region 2 is in West Baton Rouge parish id=60 region 8 is in West Carroll parish id=61 region 2 is in West Feliciana parish id=62 region 6 is in Winn parish id=63 exec code00000000 close close code>>00000000 [/code] ---------------------------------------------------------------- Thanks for this example. Actually looking at it and the ones yall have posted before I am beginning to get the idea of C. Since it's similar to php I expected I would understand it. But the parts that are going to take me figuring are the .h files. Also I see some ways I could modify to allow passing of the SQL statement for instance. This is getting exciting..we are going to have some serious stuff soon. ---------------------------------------------------------------- NO, NO, NO. The example is wrong and only works by accident. COBOL does NOT, repeat NOT, terminate fields with a NULL character. C, however, generally expects strings to be NULL terminated. Lets look at the generated C code from the Cobol prog (genned with the "-C" option on Linux with gcc compiler) sqlitetest.c.h (snip) [code] /* PROGRAM-ID : sqlitetest */ static unsigned char b_13[4] __attribute__((aligned)); /* COB-CRT-STATUS */ static unsigned char b_1[4] __attribute__((aligned)); /* RETURN-CODE */ static unsigned char b_2[4] __attribute__((aligned)); /* SORT-RETURN */ static unsigned char b_3[4] __attribute__((aligned)); /* NUMBER-OF-CALL-PARAMETERS */ static unsigned char b_5[4] __attribute__((aligned)); /* dbConn */ static unsigned char b_6[5] __attribute__((aligned)); /* dbType */ static unsigned char b_7[9] __attribute__((aligned)); /* dbHost */ static unsigned char b_8[6] __attribute__((aligned)); /* dbUser */ static unsigned char b_9[9] __attribute__((aligned)); /* dbPass */ static unsigned char b_10[4] __attribute__((aligned)); /* dbName */ static unsigned char b_11[5] __attribute__((aligned)); /* dbEncode */ static unsigned char b_12[4] __attribute__((aligned)); /* dbCode */ [/code] and the initialization sqlitetest.c (snip) [code] (*(int *) (b_1)) = 0; (*(int *) (b_2)) = 0; (*(int *) (b_3)) = 0; memset (b_5, 0, 4); memcpy (b_6, "mysql", 5); memcpy (b_7, "localhost", 9); memcpy (b_8, "ocuser", 6); memset (b_9, 42, 9); memcpy (b_10, "pfdb", 4); memcpy (b_11, "UTF-8", 5); memset (b_12, 0, 4); memset (b_13, 48, 4); [/code] Note that the fields are allocated exactly according to definition and initialized as per value clause (If the value is smaller than the definition then the field is space filled to the end). Note that there are no NULL terminators anywhere. Even allowing for for gcc's "attribute" extension, there is no guarantee that "slack" bytes (if any!!) between the fields are set to the NULL value. Defining a field at the 01 level only guarantees alignment. Nothing else. So eg. [code] 01 MYDBVARS. 03 dbType pic x(5) value "mysql". 03 dbHost pic x(9) value "localhost". 03 dbUser pic x(6) value "ocuser". 03 dbPass pic x(9) value "*********". 03 dbName pic x(4) value "pfdb". 03 dbEncode pic x(5) value "UTF-8". 03 dbCode pic 9(8) comp value zero. [/code] is doomed to failure. When passing strings from Cobol to C (assuming that the C code is expecting null-terminated strings as in this case) then the Cobol code must prepare these. There are several ways to achieve this in Cobol. In this case, the easiest is to use Cobol string concatenation combined with increasing the field sizes by one character - [code] 01 dbType pic x(6) value "mysql" & X"00". 01 dbHost pic x(10) value "localhost" & X"00". 01 dbUser pic x(7) value "ocuser" & X"00". 01 dbPass pic x(10) value "*********" & X"00". 01 dbName pic x(5) value "pfdb" & X"00". 01 dbEncode pic x(6) value "UTF-8" & X"00". 01 dbCode pic 9(8) comp value zero. [/code] Roger ---------------------------------------------------------------- Thanks Roger, I posted to get the feedback. Your critique explains a lot and my experience with C is limited. John ---------------------------------------------------------------- I've tried to run the example, but I got the following, after I [code] open type=mysql host=localhost user=root database=pfdb encoding=UTF-8 Could not connect. Please check the option settings [(null)] open code>>0x00000000 exec exec code00000000 close close code>>00000000 [/code] but [code] mysql> connect pfdb Connection id: 4171 Current database: pfdb mysql> select * from parishregion; +----+--------+---------------+ | id | region | parish | +----+--------+---------------+ | 1 | Dafne | Thers | | 2 | Athens | Santa Barbara | +----+--------+---------------+ 2 rows in set (0.02 sec) [/code] ---------------------------------------------------------------- In your parishregion table you have region as character data. Change from dbi_result_get_uint to dbi_result_get_string. exec function snip [code] int dbExec(dbi_conn *conn) { dbi_result result; int id; const char *regionId; const char *parish; result = dbi_conn_queryf(conn, "SELECT * FROM parishregion;"); if (result) { while (dbi_result_next_row(result)) { id = dbi_result_get_uint(result, "id"); regionId = dbi_result_get_string(result, "region"); parish = dbi_result_get_string(result, "parish"); printf("region %i is in %s parish id=%i\n", regionId, parish, id); } dbi_result_free(result); } return 0; } [/code] Hope that works for you. John ---------------------------------------------------------------- The problem was connecting to mysql not accessing it, but thanks for your comment you are absolutely right. I've read carefully libdbi make instructions and everything is fine. Thanks again, konenas ---------------------------------------------------------------- John, Do you know what is the best way to return the data and to manipulate it from OC? Regards, Konenas ---------------------------------------------------------------- I'm not sure if this will help with libdbi but here some test code I put together to access mysql with OC. You need to download the mysql runtime libraries (and link). There is NO data type/length checking. Curt [code] /******************************************************************************* ** oc_mysql.c *******************************************************************************/ #include #include #include #include /* #include "oc_mysql.h" */ /******************************************************************************* ** oc_mysql.h *******************************************************************************/ #define OC_DBNAME_LENGTH 80 #define OC_HOSTNAME_LENGTH 80 #define OC_LOGINNAME_LENGTH 80 #define OC_PASSWORD_LENGTH 80 static MYSQL mysqlHandle ; static MYSQL_RES *mysqlResult = NULL ; static MYSQL_FIELD *mysqlFields ; /******************************************************************************* ** delimit *******************************************************************************/ static void delimit ( char *dest , char *src , int src_length ) { while (src_length-- > 0) { if (*src == ' ') { break ; } *(dest++) = *(src++) ; } *dest = '\0' ; } /* delimit */ /******************************************************************************* ** oc_mysql_connect *******************************************************************************/ int oc_mysql_connect ( char *HostName , char *DBName , char *LoginName , char *Password ) { int result ; char hostname[(OC_HOSTNAME_LENGTH + 1)] ; char dbname[(OC_DBNAME_LENGTH + 1)] ; char loginname[(OC_LOGINNAME_LENGTH + 1)] ; char password[(OC_PASSWORD_LENGTH + 1)] ; if (! mysql_init (&mysqlHandle)) /* required set up */ { fprintf (stderr , "mysql_init failed: %s\n" , mysql_error (&mysqlHandle)) ; return (-1) ; } delimit (hostname, HostName, OC_HOSTNAME_LENGTH) ; delimit (dbname, DBName, OC_DBNAME_LENGTH) ; delimit (loginname, LoginName, OC_LOGINNAME_LENGTH) ; delimit (password, Password, OC_PASSWORD_LENGTH) ; if (! mysql_real_connect /* connect to DB */ (&mysqlHandle , hostname , dbname , loginname , password , 0 , NULL , 0)) { fprintf (stderr , "mysql_real_connect failed: %s\n" , mysql_error (&mysqlHandle)) ; return (-1) ; } return (0) ; } /* oc_mysql_connect */ /******************************************************************************* ** oc_mysql_close *******************************************************************************/ int oc_mysql_close () { oc_mysql_finish () ; /* free query */ mysql_close (&mysqlHandle) ; /* disconnect */ return (0) ; } /* oc_mysql_close */ /******************************************************************************* ** oc_mysql_query *******************************************************************************/ int oc_mysql_query ( char *Query ) { if (mysqlResult) { /* finish prior query */ mysql_free_result (mysqlResult) ; mysqlResult = NULL ; } if (mysql_query (&mysqlHandle, Query)) /* process query */ { /* SQL error */ return (mysql_errno (&mysqlHandle)) ; } if (mysqlResult = mysql_store_result (&mysqlHandle)) { /* got result set */ mysqlFields = mysql_fetch_fields (mysqlResult) ; /* field data */ } return (mysql_errno (&mysqlHandle)) ; } /* oc_mysql_query */ /******************************************************************************* ** oc_mysql_fetch *******************************************************************************/ int oc_mysql_fetch ( char *FirstDest , /* at least 1 parm is required */ ... ) { MYSQL_ROW mysqlRow ; unsigned long *field_lengths ; unsigned int field_count ; unsigned int field_idx ; va_list ap ; char *dest ; if (! mysqlResult) { return (-1) ; /* missing result */ } if (! (mysqlRow = mysql_fetch_row (mysqlResult))) { /* fetch error (EOD?) */ mysql_free_result (mysqlResult) ; mysqlResult = NULL ; return (100) ; /* end of data */ } field_count = mysql_num_fields (mysqlResult) ; field_lengths = mysql_fetch_lengths (mysqlResult) ; dest = FirstDest ; /* 1st parameter */ va_start (ap, FirstDest) ; /* valiable parameter output */ for (field_idx = 0 ; field_idx < field_count ; field_idx++) { /* move field data to caller fields */ if (field_lengths[field_idx] > 0) { /* may not work for nulls */ memcpy (dest, mysqlRow[field_idx], field_lengths[field_idx]) ; } if (field_idx < (field_count - 1)) { dest = va_arg (ap, char *) ; /* next output field */ } } va_end (ap) ; return (0) ; } /* oc_mysql_fetch */ /******************************************************************************* ** oc_mysql_finish *******************************************************************************/ int oc_mysql_finish () { if (mysqlResult) { mysql_free_result (mysqlResult) ; mysqlResult = NULL ; } return (0) ; } /* oc_mysql_finish */ [/code] [code] IDENTIFICATION DIVISION. PROGRAM-ID. "sqltest" . DATA DIVISION. WORKING-STORAGE SECTION. 01 HOST-NAME PIC X(80) VALUE 'localhost'. 01 DB-NAME PIC X(80) VALUE 'sqltest'. 01 LOGIN-NAME PIC X(80) VALUE 'sqltest'. 01 PASSWORD PIC X(80) VALUE 'sqltest'. 01 SQL-QUERY PIC X(1000). 01 RESULT PIC X VALUE SPACES. 01 0-WORK-AREA. 05 0-INPUT-EOF-FLAG PIC X VALUE 'N'. 88 0-INPUT-EOF-88 VALUE 'Y'. 01 2-SQL-DATA. 05 2-RESULT PIC 9(11) BINARY. 05 2-ID PIC X(10). 05 2-FIRST-NAME PIC X(30). 05 2-MIDDLE-NAME PIC X(30). 05 2-LAST-NAME PIC X(30). PROCEDURE DIVISION. 0-MAIN-SECTION SECTION. 0-MAIN. * PERFORM 1-INITIALIZE THRU 1-INITIALIZE-EXIT. * PERFORM 2-PROCESS-INPUT THRU 2-PROCESS-INPUT-EXIT. * PERFORM 1-SHUT-DOWN THRU 1-SHUT-DOWN-EXIT. * GOBACK. * 0-MAIN-EXIT. EXIT. ****************************************************************** 1-INITIALIZE. * *---- Connect to mysql database ----* * CALL "oc_mysql_connect" USING HOST-NAME , DB-NAME , LOGIN-NAME , PASSWORD GIVING 2-RESULT END-CALL. DISPLAY "Connect Rslt:" 2-RESULT. * *---- Query set up ----* * STRING "SELECT" " names.id," " names.first," " names.last" " FROM names" " ORDER BY names.last" x"00" DELIMITED BY SIZE INTO SQL-QUERY. CALL "oc_mysql_query" USING SQL-QUERY GIVING 2-RESULT END-CALL. DISPLAY "Query Rslt:" 2-RESULT. * 1-INITIALIZE-EXIT. EXIT. ****************************************************************** 1-SHUT-DOWN. * *---- Close connection to DB ----* * CALL "oc_mysql_close" GIVING 2-RESULT END-CALL. * 1-SHUT-DOWN-EXIT. EXIT. ****************************************************************** 2-PROCESS-INPUT. * *---- Fetch 1st row data ----* * PERFORM 29-NEXT-ROW THRU 29-NEXT-ROW-EXIT. * PERFORM UNTIL 0-INPUT-EOF-88 DISPLAY 2-ID " " 2-FIRST-NAME " " 2-LAST-NAME PERFORM 29-NEXT-ROW THRU 29-NEXT-ROW-EXIT END-PERFORM. * 2-PROCESS-INPUT-EXIT. EXIT. ****************************************************************** 29-NEXT-ROW. * INITIALIZE 2-SQL-DATA. CALL "oc_mysql_fetch" USING 2-ID , 2-FIRST-NAME , 2-LAST-NAME GIVING 2-RESULT END-CALL. * IF 2-RESULT NOT = ZERO SET 0-INPUT-EOF-88 TO TRUE END-IF. * 29-NEXT-ROW-EXIT. EXIT. [/code] ---------------------------------------------------------------- Curt, please provide us compile parameters. Regards, Konenas ---------------------------------------------------------------- Set up and compile (Fedora 8) Compile: [code] gcc -c -I/usr/include/mysql oc_mysql.c cobc -x -L/usr/lib/mysql sqltest.cob oc_mysql.o -lmysqlclient [/code] MySQL (also add sqltest user): [code] CREATE TABLE IF NOT EXISTS `names` ( `id` varchar(10) NOT NULL, `last` varchar(30) NOT NULL, `first` varchar(30) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `names` -- INSERT INTO `names` (`id`, `last`, `first`) VALUES ('1', 'Timmerman', 'Curt'); [/code] Test [code] ./sqltest Connect Rslt:00000000000 Query Rslt:00000000000 1 Curt Timmerman [/code] ---------------------------------------------------------------- /usr/include/mysql doesnot exist here :( Linux CentOS 5.3 can you please point me where to get it? TIA. ---------------------------------------------------------------- This goes way back. I believe this came from the Fedora distribution disk. Searched for mysql and installed the mysql development source files. Did you try the mysql web site? Curt ---------------------------------------------------------------- irado-sp; I'm not real up on CentOS but here are a few things to try. Make sure you have both MySQL and MySQL-dev packages After that, or if you already have; Look around the file system for mysql.h. [code] $ su # cd / # find . -name mysql.h -print # exit [/code] [i]that can take a while, and to get around read permissions, I usually do this as root (ergo the su)[/i] or install the [b]locate[/b] package, have it run it's [b]updatedb[/b] and then [code] $ locate mysql.h [/code] This should tell you where CentOS likes to install MySQL. If you built MySQL from sources it may well be stashed in [b]/usr/local/include[/b], but again I'm not used to the CentOS default layouts Cheers, Brian ---------------------------------------------------------------- not yet, will do it just now. tks ---------------------------------------------------------------- root@irado/# : find . -name mysql.h -print root@irado/# : seems that it doesnot exist here; will try at mysql site and peruse other packets (also the source) to find it and any other *h available. tks. ---------------------------------------------------------------- finally found it; I googled again and got lots of info on this missed file, at various Linux distribution and forums. For CentOS you must use yum as follows: # yum -y install --nogpgcheck mysql-devel root@irado/# : updatedb root@irado/# : locate mysql.h /usr/include/mysql/mysql.h for other distributions the package name vary as many as we have stars in the sky ;) thank you to all of you :) ---------------------------------------------------------------- Should this work under Cygwin? I am having problems (which are probably self inflicted) but wanted to check that I'm not trying to do something which is not supported. Using native Windows I got nowhere; under Cygwin have got to link stage. I don't have much C knowledge and am rusty on unix. ---------------------------------------------------------------- cannot compile the dbm.c, got some errors and I am completely blind in 'c' language: $ cc -Wall dbm.c -o ../aplicativos/dbm.o dbm.c:2:21: error: dbi/dbi.h: file not found dbm.c:4: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'dbOpen' dbm.c:20: error: expected ')' before '*' token dbm.c:38: error: expected ')' before '*' token note (lack of dbi.h): It is installed on CentOS via yum, so supposed existent but it is not :( and cannot found it. Maybe it is adequate to remove (via yum) and install from the downloadable package from http://libdbi.sourceforge.net/ ?? resume: I can download the regular package but cannot fix the source code :(. It was not retyped, I simply copy/paste from the first post on this thread. What can/must I do? SOLVED by myself; asked "yum info libdbi*" and libdbi-devel appears as not installed. I simply installed libdbi-devel and now it compiles like a charm. TIA ---------------------------------------------------------------- I'm brand new to Open Cobol. Was looking for a way to make consol apps that interacted with a database and after thrashing around a while, thought about returning to my roots (COBOL) and landed on this site. I couldn't find any posts via Google that explained how to do what I wanted to do, but this came the closest. I figured I would post here to list some of the things I have figured out to help others who are looking for the same things. I haven't put it all together yet, so this is still a work in progress, but it's a start and I figured that if there is anyone else working on this then they could contribute to the thread and we'd all be the richer for it. Environment: Ubuntu Linux MySql database Open Cobol Gcc Purpose: Access mysql data from c/c++ Paint a data-entry screen Interface c/mysql/cobol You need to install the relevant packages. mysql-dev is the first one. Once you have that installed, then you need to know how to access the mysql database in c and then how to compile the c program correctly Here is a sample c program to access a table and list some of the fields in the table. It is made to stand alone. [code] /* Program: example_mysql.c Purpose: Demonstrate how to access a MySql database from c using the MySql-dev libraries Notes: Database connection parameters are fictional :-) (c) John Dovey, February 2010 email: john@justdone.co.za website: http://www.justdone.co.za/ */ #include #include #include int main(void) { MYSQL *conn; MYSQL_RES *result; MYSQL_ROW row; /* Database Connection info */ char *server = "host.your-server.co.za"; char *user = "anyuser"; char *password = "anypassword"; char *database = "mydatabase"; if (mysql_library_init(0, NULL, NULL)) { fprintf(stderr, "could not initialize MySQL library\n"); exit(1); } conn = mysql_init(NULL); /* Connect to database */ if (!mysql_real_connect(conn, server, user, password, database, 0, NULL, 0)) { fprintf(stderr, "%s\n", mysql_error(conn)); exit(1); } /* send SQL query */ if (mysql_query(conn, "select * from ps_customer")) { fprintf(stderr, "%s\n", mysql_error(conn)); exit(1); } result = mysql_use_result(conn); /* output Customer List */ printf("Customer List:\n"); while ((row = mysql_fetch_row(result)) != NULL) // 0 = Customer ID, 3 = Customer Email Address, 7 = Customer Surname printf("%s, %s, %s \n", row[0], row[3], row[7]); /* close connection */ mysql_free_result(result); mysql_close(conn); mysql_library_end(); return 0; } [/code] To compile this program (and others) I created a little shell script called com: [code] gcc -o $1 $(mysql_config --cflags) $1.c $(mysql_config --libs) [/code] What's nifty about this is that it adds the required compilation flags and libraries automagically. Just use it with the name of your c program without the extension and you have a standalone executable. There are a number of other simple things you can do, such as listing fields etc, using the natice mysql libraries. More here [url=http://dev.mysql.com/doc/refman/5.0/en/c.html]MySql Development - C API Reference[/url] As I get further along, and get the interaction between Open Cobol and C to work, I'll post more (if anyone is interested... ) John ---------------------------------------------------------------- Ok, A little further along. Just calling a c program from Cobol to display a list of records from MySql. Sample C prgram: example_mysql_rtn.c [code] /* Program: example_mysql.c Purpose: Demonstrate how to access a MySql database from c using the MySql-dev libraries (c) John Dovey, February 2010 email: john@justdone.co.za website: http://www.justdone.co.za/ */ #include #include #include int dbMySql(char *server, char *user, char *password, char *database) { MYSQL *conn; MYSQL_RES *result; MYSQL_ROW row; /* Database Connection info is passed from calling program */ if (mysql_library_init(0, NULL, NULL)) { fprintf(stderr, "could not initialize MySQL library\n"); exit(1); } conn = mysql_init(NULL); /* Connect to database */ if (!mysql_real_connect(conn, server, user, password, database, 0, NULL, 0)) { fprintf(stderr, "%s\n", mysql_error(conn)); exit(1); } /* send SQL query */ if (mysql_query(conn, "select * from ps_customer")) { fprintf(stderr, "%s\n", mysql_error(conn)); exit(1); } result = mysql_use_result(conn); /* output Customer List */ printf("Customer List:\n"); while ((row = mysql_fetch_row(result)) != NULL) // 0 = Customer ID, 3 = Customer Email Address, 7 = Customer Surname printf("%s, %s, %s \n", row[0], row[3], row[7]); /* close connection */ mysql_free_result(result); mysql_close(conn); mysql_library_end(); return 0; } [/code] Compile this program with [code] gcc -c example_mysql.c $(mysql_config --libs) $(mysql_config --cflags) [/code] Sample Cobol Program: mysqltest.cbl [code] *>>source free *>********************************************************************* *> Author: boondock (John Dovey) boondock@justdone.co.za *> Based on: Example program by jrls (John Ellis) *> Date: 08-February-2010 *> Purpose: Testing connection between Open Cobol and MySql *>********************************************************************* identification division. program-id. mysqltest. data division. working-storage section. 01 dbServer pic x(25) value "myhost.your-server.co.za" & X"00". 01 dbUser pic x(9) value "mydbuser" & X"00". 01 dbPass pic x(9) value "*******" & X"00". 01 dbName pic x(11) value "mydbname" & X"00". 01 dbResult usage pointer sync. procedure division. 0000-start. display "Run External Program". call "dbMySql" using by reference dbserver, by reference dbUser, by reference dbPass, by reference dbName, returning dbResult. display "Result: " dbResult. stop run. [/code] Compile and link with [code] cobc -x -free -lm -ldl -lmysqlclient mysqltest.cbl example_mysql_rtn.o [/code] With MY db connection etc, I get the following output: [code] john@john-desktop:~/Desktop/c$ ./mysqltest Run External Program Customer List: 1, boondock@justdone.co.za, DOVEY 3, xxxx@icfr.unp.ac.za, XXXX (snipped) 1898, xxxx@atponline.co.za, KRUGER Result: 0x00000000 [/code] Ok... so now I know how to write a C program that accesses the MySql database, is a callable routine with DB connection parameters passed in. I know how to compile it to an object file. I know how to write a Cobol program that calls the C routine, how to compile the Cobol program and link it to the c program's object file. What I DON'T know, is how to 1. return some sort of recordset back to the Cobol program 2. accept that recordset 3. use the recordset once I have it. Any input? :-D Thanks John aka BoonDock ---------------------------------------------------------------- BoonDock, Assuming that your goal is to gain access to MySQL through OpenCOBOL and that you are not set on libdbi, you may want to review 3 posts that "marcr" contributed (search for marcr in the forum). The post that starts with "How to communicate" outlines how we have accomplished the chore. He makes an ammendment in a later post. I hope that this helps. jimc ---------------------------------------------------------------- [quote] jcurrey wrote: BoonDock, Assuming that your goal is to gain access to MySQL through OpenCOBOL and that you are not set on libdbi, you may want to review 3 posts that "marcr" contributed (search for marcr in the forum). The post that starts with "How to communicate" outlines how we have accomplished the chore. He makes an ammendment in a later post. I hope that this helps. jimc[/quote] Thanks a million. That's perfect. I did search before I posted. This thread was the closest I came.. John ---------------------------------------------------------------- BoonDock, We have pretty much adapted the view that we want to "Select *" instead of specifying individual columns. Our copybooks now have a "MySQL_fetch_record" feature that tells you when you have fetched an entire row but have not specified enough columns. With that in mind we are working to develop a simple PreProcessor to generate SQL code based upon macro tags that would be placed in the source code. The programmer places his commands in the Cobol source, then runs the preprocessor against the source. The preprocessor generates a new intermediate file that you then compile. We are not ready to FOSS this yet (partially because we don't want to donate junk), but are willing to let some people use it so that we can test it more thoroughly. Let me know if you are interested. jimc ---------------------------------------------------------------- Jim; Re SQL preprocessing Spawning a new thread Cheers, Brian ---------------------------------------------------------------- Subject: Ingress Embedded SQL Preprocessor for COBOL Did you've tried it? ---------------------------------------------------------------- Has anyone tried the Ingress Open Source Database 'Embedded SQL Preprocessor for COBOL' with OpenCOBOL yet? http://docs.ingres.com/cmdref/esqlcblCommandInvokeEmbeddedSQLPreprocessorforCOBOL ---------------------------------------------------------------- Subject: Add1 OpenCOBOL Documentation Committee Hello, This is the beginning of a community effort aimed at adequate and acceptable documentation for the [i]OpenCOBOL project[/i] and documentation to further the advocacy aims of the [i]ADD1TOCOBOL initiative[/i]. Subcommittees will be formed covering at least [b]User Guides[/b]; New to COBOL, New to OpenCOBOL, FAQ [b]Developer Guides[/b]; Building OpenCOBOL, Extending OpenCOBOL, Assisting in development of OpenCOBOL [b]Best Practices[/b]; Established Programming in the Large and Long Run COBOL development principles and guidelines, with style suggestions and some freedoms of choice. [b]ADD1TOCOBOL Source Code Repository Peer Review and Acceptance Standards[/b]. Strict adherence before submissions will be published. This includes license choices, a checklist of peer signoffs and community veto or vote to accept. Suggested source format for documentation is [i]ReStructuredText[/i]. A reference implementation being included in Python's docutils. ReST markup can emit, among others, (CSS controlled) [b]HTML[/b] and LaTex. A Haskell application, Pandoc, can be used to read ReST and output a plethora of formats, including the critical [b]Texinfo[/b] sources. More soon and thanks for listening. Cheers, Brian Tiffin ---------------------------------------------------------------- Brian, I would like to sign up for the documentation committee. ---------------------------------------------------------------- aoirthoir; great. See if you like [url=http://docutils.sourceforge.net/rst.html]ReStructuredText[/url] See if we can't have a few skins for the HTML. Something business, something pleasure? Sadly, we miss indexing in ReST, it'll become an issue. Everyone. A sample of the input sources for the ocfaq can be found at http://add1tocobol.com/opencobol/docs/ocfaq.rst The current FAQ (may be more recent than the sources linked above) is at http://add1tocobol.com/opencobol/docs/ocfaq.html Cheers ---------------------------------------------------------------- I would be glad to help out Brian and will be looking at ReST tonight. How can I get the COBOL editing tools you've done for VIM? john ---------------------------------------------------------------- cobol.vim that I use is posted here; http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=315&forum=1 but it will make itself known on the add1tocobol.com File Section soon I imagine. This still needs work. There is a KATE file (broken hack of Fortran.xml) for a nice gui edit as well. I don't know how to explain it really; I find ReST relaxing to write and maintain. Cheers Brian ---------------------------------------------------------------- Subject: Windows Install (Sergey Kashyrin's binaries)? I downloaded Sergey Kashyrin's binaries and I'm now at a loss as to how to install them. They don't include a README or a HOWTO and I can't find instructions on his site. Does anyone have a link to the install instructions? ---------------------------------------------------------------- Anyone? ---------------------------------------------------------------- Sorry for the moment Joe, I don't use Windows. But can you give me a link to where you got the binaries? ---------------------------------------------------------------- Subject: Indicator area help please I'm having 2 problems in the indicator area column, one with debugging mode, the other with free source format, any advice would be appreciated please: 1. With this fixed format program called hello.cob * Sample COBOL program IDENTIFICATION DIVISION. PROGRAM-ID. hello. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. LINUX WITH DEBUGGING MODE. DATA DIVISION. WORKING-STORAGE SECTION. PROCEDURE DIVISION. DISPLAY "Hello World!" D DISPLAY "Goodbye cruel World!" STOP RUN. compile & run with: cobc hello.cob cobcrun hello gives: Hello World! The second display statement does not happen. 2. Converting the above fixed format source code to free format with the bash command: expand hello.cob | sed 's/^ //' > hello.cobfree then compile with: cobc -free hello.cobfree gives this error: hello.cobfree:1: Error: syntax error, unexpected '*', expecting "PROGRAM-ID" removing the first comment line then compiling again gives this error: hello.cobfree:10: Error: 'D' undefined ---------------------------------------------------------------- row 1 & 11 start in column 7 - the forum stripped the spaces off the front of the mail. ---------------------------------------------------------------- and the sed command has six spaces after the ^ - again stripped off by the forum post. ---------------------------------------------------------------- You mean like this - [code] * Sample COBOL program IDENTIFICATION DIVISION. PROGRAM-ID. hello. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. LINUX WITH DEBUGGING MODE. DATA DIVISION. WORKING-STORAGE SECTION. PROCEDURE DIVISION. DISPLAY "Hello World!" D DISPLAY "Goodbye cruel World!" STOP RUN. [/code] With default fixed format that's fine and displays one line. To display the debug line, you need to compile with an extra option. cobc --help shows you options and one of them is - [code] -fdebugging-line Enable debugging lines ('D' in indicator column) [/code] So compile with -fdebugging-line and you will get both displays (regardless of what is defined in SOURCE-COMPUTER). Now to free format. There is no "indicator column" in free format. All columns are evaluated. A so-called floating-comment sequence specifies the beginning of a comment. This is the *> sequence. Debugging lines are indicated by the >>D directive. So, your prog changed so that it compiles as BOTH free and fixed format - [code] *> Sample COBOL program IDENTIFICATION DIVISION. PROGRAM-ID. hello. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. LINUX WITH DEBUGGING MODE. DATA DIVISION. WORKING-STORAGE SECTION. PROCEDURE DIVISION. DISPLAY "Hello World!" *> This is floating comment >>D DISPLAY "Goodbye cruel World!" STOP RUN. [/code] Notice that the asterisk and the 'D' remain in column 7 so enabling it to be compiled as fixed format. Quick test - [code] roglinux:~ # cobc -x wrt.cob roglinux:~ # ./wrt Hello World! roglinux:~ # cobc -x -fdebugging-line wrt.cob roglinux:~ # ./wrt Hello World! Goodbye cruel World! roglinux:~ # cobc -x -free wrt.cob roglinux:~ # ./wrt Hello World! roglinux:~ # cobc -x -fdebugging-line -free wrt.cob roglinux:~ # ./wrt Hello World! Goodbye cruel World! [/code] Of course you can move everything over to column 1 but that will only compile with free format - [code] *> Sample COBOL program IDENTIFICATION DIVISION. PROGRAM-ID. hello. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. LINUX WITH DEBUGGING MODE. DATA DIVISION. WORKING-STORAGE SECTION. PROCEDURE DIVISION. DISPLAY "Hello World!" *> This is floating comment >>D DISPLAY "Goodbye cruel World!" STOP RUN. [/code] To post code as above, start with a line containing an open square bracket, the word code and a close square bracket. End with a line containing an open square bracket, a slash, the word code and a close square bracket. You can see this if you right click on the area above in your browser and select "show source text" (or something like that). Roger ---------------------------------------------------------------- Thanks Roger Regarding the free source format I'm obviously out of date, I was thinking of this format: http://epq.com.co/softw_internet/cobol/books/lrintr.htm Is there anything else in the format that you are using? - like directives? ---------------------------------------------------------------- That link describes MF version of what it thinks free format is. The Cobol standard defines something else as I demonstrated. I will NOT take over MF's misuse of column 1 as an indicator column. This is not standard conform. Other than the debugging line >>D which is a sort of directive, currently OC only supports the >>SOURCE directive. Syntax - [code] >> SOURCE [FORMAT] [IS] { FIXED | FREE } [/code] There may be exactly zero or one space between the >> and the SOURCE word. You may switch between formats within one source file. Obviously when in fixed format, the directive must start at column 8 or greater. So - [code] >>SOURCE FIXED *> Sample COBOL program IDENTIFICATION DIVISION. PROGRAM-ID. hello. >>SOURCE FREE ENVIRONMENT DIVISION. CONFIGURATION SECTION. >>SOURCE FIXED SOURCE-COMPUTER. LINUX WITH DEBUGGING MODE. DATA DIVISION. WORKING-STORAGE SECTION. PROCEDURE DIVISION. DISPLAY "Hello World!" *> This is floating comment >>D DISPLAY "Goodbye cruel World!" STOP RUN. [/code] For the currently defined Cobol standard directives, planned is for support of the >>IF, >>ELSE, >>END-IF directives (post 1.1 release). I maybe will look at >>DEFINE although I can not see any good reason for this as the current compile option -D will eventually be extended for use in the >>IF etc. Other directives may or may not be added as deemed necessary Roger Roger ---------------------------------------------------------------- Subject: sqlite access - updated Hello, Hmmm, seems people have to scratch this itch. :-) This example required libsqlite3 and libsqlite3-dev. If you have sqlite (2..) you'll have to change all the the sqlite3 calls includes to sqlite (and it should work, dunno for sure). The SQL game is afoot. Cheers, Brian [b]tectonic[/b] [code] cobc -c ocsqlite.c cobc -x -lsqlite3 sqlcaller.cob ocsqlite.o [/code] [b]ocsqlite.c[/b] [code] /* OpenCOBOL SQLite/3 interface * Author: Brian Tiffin * Date: 16-Sep-2008 * Rights: Copyright (c) 2008 OpenCOBOL project * Requires: libsqlite3, sqlite3-dev * Tectonics: cobc -c ocsqlite.c * cobc -x -lsqlite3 sqlcaller.cob ocsqlite.o */ #include #include #include /* Need to stash the COBOL callback procedure address and name/value lengths */ /* This routine sends an unused pointer, field count, field index, name, value */ static int (*ocsql_callback)(void*, int*, int*, char*, char*); static int ocsql_namelen; static int ocsql_datalen; /* wrap the COBOL callback */ static int cobolback(void *NotUsed, int argc, char **argv, char **azColName) { int i, recnum, ret; char name[ocsql_namelen]; char value[ocsql_datalen]; /* we are changing the nature of the callback for OpenCOBOL */ for (i = 0; i < argc; i++) { memset(name, ' ', ocsql_namelen); memset(value, ' ', ocsql_datalen); strncpy(name, azColName[i], ocsql_namelen); /* The strncpy keeps the null if there is room, * and COBOL can use this? or should it be spaced? */ //if (name[ocsql_namelen-1] == '\0') { // name[ocsql_namelen-1] = ' '; //} strncpy(value, argv[i], ocsql_datalen); //if (value[ocsql_datalen-1] == '\0') { // value[ocsql_datalen-1] = ' '; //} ret = ocsql_callback(NotUsed, &argc, &i, name, value); } return ret; } /* Open a database */ int sqlopen(sqlite3 **db, char *dbname, char *errstr, int errlen) { int rc; rc = sqlite3_open(dbname, db); if (rc) { memset(errstr, ' ', errlen); strncpy(errstr, sqlite3_errmsg(*db), errlen); if (errlen > 0 && errstr[errlen-1] == '\0') { errstr[errlen-1] = ' '; } sqlite3_close(*db); } return rc; } // int sqlexec(sqlite3 *db, int (*ocback)(void*, int, char**, char**), char *query, int qlen, // char *errstr, int errlen) { /* the wrapped sqlite exec function */ int sqlexec(sqlite3 *db, int (*ocback)(void*, int*, int*, char*, char*), char *query, int qlen, char *errstr, int errlen, int namelen, int datalen) { int rc; char *errmsg = 0; /* Stash away the COBOL callback and field data and field name lengths */ ocsql_namelen = namelen; ocsql_datalen = datalen; ocsql_callback = ocback; /* Evaluate the sql query, wrapping the callback */ rc = sqlite3_exec(db, query, cobolback, 0, &errmsg); if (rc != SQLITE_OK) { if (errmsg != NULL) { memset(errstr, ' ', errlen); strncpy(errstr, errmsg, errlen); if (errlen > 0 && errstr[errlen-1] == '\0') { errstr[errlen-1] = ' '; } sqlite3_free(errmsg); } } return rc; } /* Close a db connection */ int sqlclose(sqlite3 *db) { int rc; rc = sqlite3_close(db); return rc; } [/code] [b]sqlcaller.cob[/b] [code] >>SOURCE FORMAT IS FIXED *> *************************************************************** *><* Author: Brian Tiffin *><* Date: 17-Sep-2008 *><* Purpose: Demonstrate SQLite in OpenCOBOL *><* Tectonics: cobc -c ocsqlite.c *><* cobc -x -lsqlite3 sqlcaller.cob ocsqlite.o *><* $ sqlite3 test.db *><* sqlite3> *><* CREATE TABLE trial( *><* id integer primary key, *><* field1 varchar(20), *><* field2 date *><* ); *><* INSERT TABLE trial values (null, "best", "20080101"); *><* Needs: libsqlite3-dev and sqlite3 packages *> *************************************************************** identification division. program-id. sqlcaller. data division. working-storage section. 01 name-length constant 20. 01 value-length constant 80. 01 database pic x(8) value 'test.db' & x'00'. 01 db usage pointer. 01 callback-proc usage procedure-pointer. 01 errstr pic x(80). 01 result pic s9(9). 01 query pic x(255). 01 zquery pic x(256). *> *************************************************************** procedure division. call "sqlopen" using db database by reference errstr by value function length(errstr) returning result end-call display "Open result: " result end-display if result not equal zero display "Err: " errstr end-display end-if move "select * from unknown;" & x"00" to zquery perform ocsql-exec move "drop table trial; vacuum;" & x"00" to zquery perform ocsql-exec move "create table trial (first integer primary key, " & "second varchar(16), third date);" & x"00" to zquery perform ocsql-exec move 'insert into trial (first, second, third) values ' & '(null,"jest", "20080401"); ' & 'insert into trial values (null, "better", "20080501"); ' & x"00" to zquery perform ocsql-exec move "select * from trial;" & x"00" to zquery perform ocsql-exec call "sqlclose" using by value db returning result end-call display "Close result: " result end-display goback. *> *************************************************************** ocsql-exec. move spaces to query string zquery delimited by low-value into query display "Attempting: " end-display display function trim(query) end-display set callback-proc to entry "callback" call "sqlexec" using by value db callback-proc by reference zquery by value function length(zquery) by reference errstr by value function length(errstr) by value name-length by value value-length returning result end-call display "Exec result: " result end-display if result not equal 0 display "Err: " errstr end-display end-if . end program sqlcaller. *> *************************************************************** *> Callback procedure. C is called for each row with *> void *, int fields, char **, char ** *> mapped to void *, int *, int *, char *name, char *value *> for each field *> *************************************************************** identification division. program-id. callback. data division. working-storage section. 01 count-display pic z9. 01 index-display pic z9. 01 name-display pic x(name-length). 01 value-display pic x(value-length). 01 legend pic x(8). linkage section. 01 nada usage pointer. 01 field-count pic s9(9) usage comp-5. 01 field-index pic s9(9) usage comp-5. 01 field-name pic x(name-length). 01 field-data pic x(value-length). *> *************************************************************** procedure division using nada field-count field-index field-name field-data. add zero to field-count giving count-display add 1 to field-index giving index-display display index-display " of " count-display end-display move spaces to name-display string field-name delimited by low-value into name-display end-string move spaces to value-display string field-data delimited by low-value into value-display end-string move name-display to legend display legend * function trim(name-display trailing) " = " function trim(value-display trailing) end-display move 0 to return-code goback. end program callback. [/code] [b]Sample Run[/b] [code] $ ./sqlcaller Open result: +000000000 Attempting: select * from unknown; Exec result: +000000001 Err: no such table: unknown Attempting: drop table trial; vacuum; Exec result: +000000000 Attempting: create table trial (first integer primary key, second varchar(16), third date); Exec result: +000000000 Attempting: insert into trial (first, second, third) values (null,"jest", "20080401"); insert into trial values (null, "better", "20080501"); Exec result: +000000000 Attempting: select * from trial; 1 of 3 first = 1 2 of 3 second = jest 3 of 3 third = 20080401 1 of 3 first = 2 2 of 3 second = better 3 of 3 third = 20080501 Exec result: +000000000 Close result: +000000000 [/code] ---------------------------------------------------------------- [quote] Hello, Hmmm, seems people have to scratch this itch. This example required libsqlite3 and libsqlite3-dev. If you have sqlite (2..) you'll have to change all the the sqlite3 calls includes to sqlite (and it should work, dunno for sure). [b]The SQL game is afoot.[/b] Cheers, Brian [/quote] Brian my good man, you ain't kiddin'! Thanks to your initial posts about firebird and sqlite (and another feller's) this is really taking off. We went from having no SQL to suddenly having proofs of concept it several sqls. THANK all of yall that are driving this forward! ---------------------------------------------------------------- Is it possible to replace BDB for and use sqlite for ISAM in OC instead? ---------------------------------------------------------------- I think you need ISAM to be make OC compliant to ANSI. ---------------------------------------------------------------- Yes, but BDB is a real DB-System and is used as ISAM in OC. sqlite could be used, too (this needs development in OC source, of course) and is preferable because of no need too install extra stuff like with BDB and because of Oracle licensing BDB. ---------------------------------------------------------------- don't get me wrong I like sqlite. With sqlite not having datatypes, wouldn't this be a problem using it as an isam engine? It would be cool though. I think there are plans for OC to retrofit another opensource index file solution. ---------------------------------------------------------------- Yes, Roger works on [url=https://sourceforge.net/projects/vbisam/]VB-ISAM[/url], he wrote that it passes already all ANSI tests but there are some problems left. I think nobody but him knows about a time schedule for a OC release with full support for ISAM via VB-ISAM. ---------------------------------------------------------------- Ok, this is yet another early post; SQLite wrapper is now a near clone (or will be) of the sqlite> console in terms of functionality. I'm only posting the OpenCOBOL as a sample. Find the C code at http://opencobol.add1tocobol.com/ocshell.c and the sample at http://opencobol.add1tocobol.com/sqshell.cob It's pretty broken - lots of fprintf functions to enclose ... but this is usable as a demonstration. Have to figure out if trailing newlines should come out the callback. ocshell.c will simplify before it becomes ocsqlite.c and the sample has no ocdoc yet. Cheers, Brian [b]tectonics[/b] [code] cobc -c ocshell.c cobc -x -lsqlite3 sqshell.cob ocshell.o [/code] [b]sqshell.cob[/b] [code] >>SOURCE FORMAT IS FIXED *> *************************************************************** *><* Author: Brian Tiffin *><* Date: 17-Sep-2008 *><* Purpose: Demonstrate SQLite in OpenCOBOL *><* Tectonics: cobc -c ocshell.c *><* cobc -x -lsqlite3 sqshell.cob ocshell.o *><* Needs: libsqlite3-dev and sqlite3 packages *> *************************************************************** identification division. program-id. sqlcaller. data division. working-storage section. 01 name-length constant 20. 01 value-length constant 80. 01 database pic x(8) value 'test.db' & x'00'. 01 db usage pointer. 01 callback-proc usage procedure-pointer. 01 errstr pic x(80). 01 result pic s9(9). 01 query pic x(255). 01 zquery pic x(256). *> *************************************************************** procedure division. call "ocsqlite_init" using db database by reference errstr by value function length(errstr) returning result end-call if result not equal zero display "Result: " result end-display end-if move ".echo on" to query perform ocsql-exec move ".tables" to query perform ocsql-exec move ".help" to query perform ocsql-exec *> move ".mode html" to query *> perform ocsql-exec *> move ".timer on" to query *> perform ocsql-exec move ".mode column" to query perform ocsql-exec move ".width 10 20 20" to query perform ocsql-exec move "select * from trial;" to query perform ocsql-exec move 'insert into trial values (null, "string", "2008-10-10");' to query perform ocsql-exec move "select * from thisfails;" to query perform ocsql-exec move "drop table trial;" to query perform ocsql-exec move "create table trial (first integer primary key, " & "second char(20), third date);" to query perform ocsql-exec move "pragma count_changes=1;" to query perform ocsql-exec move "pragma database_list;" to query perform ocsql-exec move 'insert into trial (first, second, third) values ' & '(null, random(), datetime()); ' & 'insert into trial values (null, "something",' & ' datetime());' to query perform ocsql-exec move "select * from trial;" to query perform ocsql-exec move "pragma count_changes=0;" to query perform ocsql-exec move "pragma database_list;" to query perform ocsql-exec move 'insert into trial (first, second, third) values ' & '(null,random(), datetime()); ' & 'insert into trial values (null, "something",' & ' datetime());' to query perform ocsql-exec move "select * from trial;" to query perform ocsql-exec goback. call "ocsqlite_close" using by value db returning result end-call move result to return-code goback. *> *************************************************************** ocsql-exec. move spaces to zquery string function trim(query trailing) delimited by size x"00" delimited by size into zquery end-string set callback-proc to entry "callback" call "ocsqlite" using by value db callback-proc by reference zquery by value function length(zquery) by reference errstr by value function length(errstr) returning result end-call if result not equal 0 display "Err: " errstr end-display end-if . end program sqlcaller. *> *************************************************************** *> *************************************************************** *> Callback procedure. C is called for each row with *> void *, int fields, char **, char ** *> mapped to void *, int *, char *data, int *len *> for each row *> *************************************************************** identification division. program-id. callback. data division. working-storage section. 01 count-display pic z9. 01 index-display pic z9. 01 value-display pic x(132). 01 main-record. 03 field-1 pic x(10). 03 filler pic xx. 03 field-2 pic x(20). 03 filler pic xx. 03 field-3 pic x(20). 03 filler pic x(78). linkage section. 01 nada usage pointer. 01 field-count pic s9(9) usage comp-5. 01 row-data pic x(value-length). 01 row-length pic s9(9) usage comp-5. *> *************************************************************** procedure division using nada field-count row-data row-length. *> add zero to field-count giving count-display *> display count-display " fields" end-display move spaces to value-display string row-data delimited by low-value into value-display end-string inspect value-display replacing all x"0a" by space move value-display to main-record display "[" function trim(main-record trailing) "]" end-display move 0 to return-code goback. end program callback. [/code] [b]./sqshell[/b] [code] .tables trial .help .bail ON|OFF Stop after hitting an error. Default OFF .databases List names and files of attached databases .dump ?TABLE? ... Dump the database in an SQL text format .echo ON|OFF Turn command echo on or off .exit Exit this program .explain ON|OFF Turn output mode suitable for EXPLAIN on or off. .header(s) ON|OFF Turn display of headers on or off .help Show this message .import FILE TABLE Import data from FILE into TABLE .indices TABLE Show names of all indices on TABLE .load FILE ?ENTRY? Load an extension library .mode MODE ?TABLE? Set output mode where MODE is one of: csv Comma-separated values column Left-aligned columns. (See .width) html HTML code insert SQL insert statements for TABLE line One value per line list Values delimited by .separator string tabs Tab-separated values tcl TCL list elements .nullvalue STRING Print STRING in place of NULL values .output FILENAME Send output to FILENAME .output stdout Send output to the screen .prompt MAIN CONTINUE Replace the standard prompts .quit Exit this program .read FILENAME Execute SQL in FILENAME .schema ?TABLE? Show the CREATE statements .separator STRING Change separator used by output mode and .import .show Show the current values for various settings .tables ?PATTERN? List names of tables matching a LIKE pattern .timeout MS Try opening locked tables for MS milliseconds .timer ON|OFF Turn the CPU timer measurement on or off .width NUM NUM ... Set column widths for "column" mode .mode column .width 10 20 20 select * from trial; [1 -4423965285695204790 2008-10-09 07:49:30] [2 something 2008-10-09 07:49:30] [3 -8479941797654095541 2008-10-09 07:49:30] [4 something 2008-10-09 07:49:30] insert into trial values (null, "string", "2008-10-10"); select * from thisfails; Err: no such table: thisfails drop table trial; create table trial (first integer primary key, second char(20), third date); pragma count_changes=1; pragma database_list; [0 main /home/brian/writing/] [1 temp /var/tmp/etilqs_HhL1] insert into trial (first, second, third) values (null, random(), datetime()); insert into trial values (null, "something", datetime()); [1] [1] select * from trial; [1 1443210454302946227 2008-10-09 07:50:10] [2 something 2008-10-09 07:50:10] pragma count_changes=0; pragma database_list; [0 main /home/brian/writing/] [1 temp /var/tmp/etilqs_HhL1] insert into trial (first, second, third) values (null,random(), datetime()); insert into trial values (null, "something", datetime()); select * from trial; [1 1443210454302946227 2008-10-09 07:50:10] [2 something 2008-10-09 07:50:10] [3 -8626150091603073626 2008-10-09 07:50:10] [4 something 2008-10-09 07:50:10] [/code] ---------------------------------------------------------------- Subject: Invitation for Free Online Open Cobol WebSpace. Howdy Yall! This is an open invitation for all of those that have wanted to test Open Cobol, but just have not had time to run an install, or for those who want to put it through its paces online. I am offering a subdomain to anyone that wants it on add1tocobol.com. I have Open Cobol set up there and working just fine. When I create your user account, I will modify your .bashrc file to point to the proper libraries. So it will be a very simple process for you to jump right in with both feet and start playing with Open Cobol. Additionally, it will give you a chance to start joining with the add 1 to cobol team in our projects, by creating projects of your own. There are of course some guidelines, some of which are laid down by my hosting provider. 1. You have to use the same for some kind of website. (Their rule) 2. At least part of the website must be generated with programs compiled in Open Cobol. (My Rule) 3. Please be careful of processes that take up a lot of resources. (This is shared hosting) 4. I will limit the amount of storage, but I've not decided how much just yet. Don't worry it will be at least a couple hundred meg, but I am leaning towards half a gig. (I've lots of space available) 5. Do not use this as a backup. (Their rule) The hosting is on GNU/Linux (Debian Distribution). If you want to find out more of the features that they offer you can go here: http://www.dreamhost.com/hosting-features.html Alright now why am I making this offer? I believe, that the more of us that are using Open Cobol for web implementations, the greater support we can offer each other. Cobol has stood the test of time, and there really is no project that the web languages are doing that Open Cobol could not do. Blogs, Forums, Content Management System, Aggregators, Enterprise eCommerce Systems, and thousands of other online apps could readily be run with Open Cobol apps on the back end. While we are looking forward with keen anticipation for a GTK GUI, the web provides us, as Cobol coders, an IMMEDIATE GUI for our users. So I believe (and hope) that offering this space will encourage many others to start reaching for that goal. If you are interested just shoot me an email at aoirthoir@add1tocobol.com. Please provide the following: Name: Preferred subdomain: Preferred username (please provide a few, the more unique the better, many common ones are already taken): Contact email: Basic COBOL goals of your domain (even an "I'm not sure just yet" is ok): That's really all. Once I have all of that (as time allows) I will set you up. It's going to take me a couple days to get the basic howto up. Once I have that then I will start setting up users that have requests in. Hope this is of use to at least some of yall out there. ---------------------------------------------------------------- Subject: Expert's synopsis of exceptions wanted for the FAQ Hello, I just added this bit to the ocfaq, [i]not yet posted to[/i], http://add1tocobol.com/opencobol/docs/ [code] .............. EXCEPTION-FILE .............. This special-register holds the error number and name of the source file that caused an input output exception. See EXCEPTION-STATUS_ for an example. .................. EXCEPTION-LOCATION .................. This special-register can be queried for the location of the last exception. See FUNCTION EXCEPTION-STATUS_ for example source code. **Note:** This feature requires compilation with *-fsource-location* compiler switch. This option is also turned on with *-g* debugging info compiles. Information includes PROGRAM-ID, section and source line. ................... EXCEPTION-STATEMENT ................... This special-register holds the statement that was executing when the latest exception was raised. See FUNCTION EXCEPTION-STATUS_ for an example. **Note:** This feature requires compilation with *-fsource-location* compiler switch. This option is also turned on with *-g* debugging info compiles. ................ EXCEPTION-STATUS ................ This FUNCTION returns the current exception status. The example below is courtesy of Roger While, from a post he made announcing the *FUNCTION EXCEPTION-* features. Source format is free, compile with *cobc -x -g -free except.cob*:: IDENTIFICATION DIVISION. PROGRAM-ID. MINIPROG. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. LINUX. OBJECT-COMPUTER. LINUX. SPECIAL-NAMES. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT PRINTFILE ASSIGN TO "XXRXWXX" FILE STATUS RXWSTAT. DATA DIVISION. FILE SECTION. FD PRINTFILE. 01 PRINTREC PIC X(132). WORKING-STORAGE SECTION. 01 RXWSTAT PIC XX. PROCEDURE DIVISION. A00-MAIN SECTION. 001-MAIN-PROCEDURE. OPEN INPUT PRINTFILE. DISPLAY "File Status: " RXWSTAT. DISPLAY "EXCEPTION-FILE: " FUNCTION EXCEPTION-FILE. DISPLAY "Return Length: " FUNCTION LENGTH (FUNCTION EXCEPTION-FILE). DISPLAY "EXCEPTION-STATUS: " FUNCTION EXCEPTION-STATUS. DISPLAY "EXCEPTION-STATEMENT: " FUNCTION EXCEPTION-STATEMENT. STRING "TOOLONG" DELIMITED SIZE INTO RXWSTAT. DISPLAY "EXCEPTION-STATUS: " FUNCTION EXCEPTION-STATUS. DISPLAY "EXCEPTION-STATEMENT: " FUNCTION EXCEPTION-STATEMENT. DISPLAY "EXCEPTION-LOCATION: " FUNCTION EXCEPTION-LOCATION. STOP RUN. Example output:: File Status: 35 EXCEPTION-FILE: 35PRINTFILE Return Length: 00000011 EXCEPTION-STATUS: EC-I-O-PERMANENT-ERROR EXCEPTION-STATEMENT: OPEN EXCEPTION-STATUS: EC-OVERFLOW-STRING EXCEPTION-STATEMENT: STRING EXCEPTION-LOCATION: MINIPROG; 001-MAIN-PROCEDURE OF A00-MAIN; 29 .. TIP:: See the source file libcob/exception.def for a list of the plethora of run-time exceptions supported by OpenCOBOL. [/code] And well, I don't quite have the background to explain how exception handling is supposed to work or developer expectations, let alone the OpenCOBOL implementation. If anyone could drop a short note or overview, suitable for a FAQ answer or programmer's guide, of their understanding of the issue, I'd greatly appreciate it. Bonus points for involving the DECLARATIVES section and some of the ON phrases and ???. I'll RTFM, but every once in a while, it is just nice to Ask A Friendly Human. In this case, cap in hand to the Wisened. Cheers, Brian P.S. Please assume posts may be published in the FAQ, with credits. ---------------------------------------------------------------- Subject: Converting from CA-Realia Cobol Hi, I'm converting a few programs from CA-Realia Cobol to OC 1.1 and I've problem finding a replacement for the following built in functions: DOS_FIND_FIRST DOS_FIND_NEXT I'll appreciate any help. ---------------------------------------------------------------- Explain what these functions do. ---------------------------------------------------------------- I think you may need to wrap a small call to a Windows DLL. (I can only assume Microsoft? with the DOS... name) handle FindFirstFile(LPCTSTR in, LPWIN32_FILE_DATA out) handle should work as a POINTER. LPCTSTR maps to const char * so normal by reference will work LPWIN32_FILE_DATA is hmm, dunno..., MSDN page freezes inside my Konqueror... ... It is a pointer to [code] typedef struct _WIN32_FIND_DATA { DWORD dwFileAttributes; FILETIME ftCreationTime; FILETIME ftLastAccessTime; FILETIME ftLastWriteTime; DWORD nFileSizeHigh; DWORD nFileSizeLow; DWORD dwReserved0; DWORD dwReserved1; TCHAR cFileName[MAX_PATH]; TCHAR cAlternateFileName[14]; } WIN32_FIND_DATA, *PWIN32_FIND_DATA, *LPWIN32_FIND_DATA; [/code] So, unless you simply want the handle, you'll have to build a structure... I don't use windows but http://msdn.microsoft.com/en-us/library/aa364418(VS.85).aspx and, after it freezing before giving me links, I gave up... but that page will give you all the deets on the structs and how to size the COBOL working store. with OpenCOBOL this will be something along the lines of [code] 01 handle-ptr usage pointer. 01 wildcard pic x(12) value "*.*". 01 file-data. *> needs to be based memory 02 ... 01 file-data-ptr usage pointer. [/code] (and being windows kernel32.dll has them in A and W(ide) forms... [code] call "FindFirstFileA" using wildcard file-data-ptr returning handle-ptr set address of file-data to file-data-ptr [/code] check the handle and struct... [code] call "FindNextFileA" using by value handle-ptr by value file-data-ptr returning (some BOOL WINAPI thingy char? char *? int?) [/code] Untested, untried, lotta holes, but something like that should work out though. cobc may or may not need -lkernel32.dll dunno the Windows side... and under Cygwin, I can't say it even works. Never tried, never looked. Hope all that wishy-washiness helped... [i]P.S. If the COBOL is running on DOS ... then an int 21H is order ... Something like mov ah, 4EH for FIND_FIRST. But that would only apply if OpenCOBOL worked under DOS.[/i] Cheers, Brian ---------------------------------------------------------------- 10x brian. I'll try it. I thought that the there's an OC built-in function like CBL_CHECK_FILE_EXIST. ---------------------------------------------------------------- There is. From the source tarball [b]libcob/system.def[/b] [code] /* COB_SYSTEM_GEN (external name, number of parameters, internal name) */ COB_SYSTEM_GEN ("SYSTEM", 1, SYSTEM) COB_SYSTEM_GEN ("CBL_ERROR_PROC", 2, CBL_ERROR_PROC) COB_SYSTEM_GEN ("CBL_EXIT_PROC", 2, CBL_EXIT_PROC) COB_SYSTEM_GEN ("CBL_OPEN_FILE", 5, CBL_OPEN_FILE) COB_SYSTEM_GEN ("CBL_CREATE_FILE", 5, CBL_CREATE_FILE) COB_SYSTEM_GEN ("CBL_READ_FILE", 5, CBL_READ_FILE) COB_SYSTEM_GEN ("CBL_WRITE_FILE", 5, CBL_WRITE_FILE) COB_SYSTEM_GEN ("CBL_CLOSE_FILE", 1, CBL_CLOSE_FILE) COB_SYSTEM_GEN ("CBL_FLUSH_FILE", 1, CBL_FLUSH_FILE) COB_SYSTEM_GEN ("CBL_DELETE_FILE", 1, CBL_DELETE_FILE) COB_SYSTEM_GEN ("CBL_COPY_FILE", 2, CBL_COPY_FILE) COB_SYSTEM_GEN ("CBL_CHECK_FILE_EXIST", 2, CBL_CHECK_FILE_EXIST) COB_SYSTEM_GEN ("CBL_RENAME_FILE", 2, CBL_RENAME_FILE) COB_SYSTEM_GEN ("CBL_GET_CURRENT_DIR", 3, CBL_GET_CURRENT_DIR) COB_SYSTEM_GEN ("CBL_CHANGE_DIR", 1, CBL_CHANGE_DIR) COB_SYSTEM_GEN ("CBL_CREATE_DIR", 1, CBL_CREATE_DIR) COB_SYSTEM_GEN ("CBL_DELETE_DIR", 1, CBL_DELETE_DIR) COB_SYSTEM_GEN ("CBL_AND", 3, CBL_AND) COB_SYSTEM_GEN ("CBL_OR", 3, CBL_OR) COB_SYSTEM_GEN ("CBL_NOR", 3, CBL_NOR) COB_SYSTEM_GEN ("CBL_XOR", 3, CBL_XOR) COB_SYSTEM_GEN ("CBL_IMP", 3, CBL_IMP) COB_SYSTEM_GEN ("CBL_NIMP", 3, CBL_NIMP) COB_SYSTEM_GEN ("CBL_EQ", 3, CBL_EQ) COB_SYSTEM_GEN ("CBL_NOT", 2, CBL_NOT) COB_SYSTEM_GEN ("CBL_TOUPPER", 2, CBL_TOUPPER) COB_SYSTEM_GEN ("CBL_TOLOWER", 2, CBL_TOLOWER) COB_SYSTEM_GEN ("\364", 2, CBL_XF4) COB_SYSTEM_GEN ("\365", 2, CBL_XF5) COB_SYSTEM_GEN ("\221", 2, CBL_X91) COB_SYSTEM_GEN ("C$NARG", 1, cob_return_args) COB_SYSTEM_GEN ("C$PARAMSIZE", 1, cob_parameter_size) COB_SYSTEM_GEN ("C$MAKEDIR", 1, cob_acuw_mkdir) COB_SYSTEM_GEN ("C$CHDIR", 2, cob_acuw_chdir) COB_SYSTEM_GEN ("C$SLEEP", 1, cob_acuw_sleep) COB_SYSTEM_GEN ("C$COPY", 3, cob_acuw_copyfile) COB_SYSTEM_GEN ("C$FILEINFO", 2, cob_acuw_file_info) COB_SYSTEM_GEN ("C$DELETE", 2, cob_acuw_file_delete) COB_SYSTEM_GEN ("C$TOUPPER", 2, CBL_TOUPPER) COB_SYSTEM_GEN ("C$TOLOWER", 2, CBL_TOLOWER) COB_SYSTEM_GEN ("C$JUSTIFY", 1, cob_acuw_justify) COB_SYSTEM_GEN ("CBL_OC_NANOSLEEP", 1, cob_oc_nanosleep) [/code] But afaik, none of these will help scanning a dir by wildcard...which is the only time I've used the FIND_FIRST FIND_NEXT in DOS land. And reading into [b]libcob/fileio.c[/b] [code] int CBL_CHECK_FILE_EXIST (char *file_name, char *file_info) [/code] So it takes in a filename (null terminated by the caller or not, but it needs to fit in a COB_MEDIUM_BUFFER (8K on my build)) and fills in a structure of file_info data. Looking further, file_info seems to want a 16 byte buffer. A return value of 35 means the POSIX call to stat() returned less than 0, and the ever popular clib errno global has some error code in it; which you do not get. But take a 35 as the standard COBOL status of "file doesn't exist". But ... you can use OpenCOBOL, OPEN and FUNCTION EXCEPTION-STATUS to get at this type of functionality if I'm not mistaken. EXCEPTION-STATUS and the other FUNCTION EXCEPTION-xxxx information was put in the FAQ just yesterday. http://opencobol.add1tocobol.com/ocfaq.html Section 3.20 And by the way ... I'm slowly documenting the system services in system.def so that information is comming "real soon now" ... slowly. See section 3.23 for what is there today. [i]Note: I'm striving to keep the section numbers across releases of the FAQ, but as it moves from RC to true 1.0, things could change.[/i] If the numbers change the questions in the TOC are 3.20 Q. Does OpenCOBOL implement any Intrinsic FUNCTIONs? 3.23 Q. What standard CALL library does OpenCOBOL offer? Cheers, Brian ---------------------------------------------------------------- Thanks for the help. I'm still checking the functions and will keep the forum updated. ---------------------------------------------------------------- Subject: Embedding Tcl/TK from Rildo Pragana Hello, I'm excited. I bumped into tctcl. Tcl/Tk for TinyCOBOL. Well, Rildo sent me [quote] Hi Brian, Of course, you may do what you wish with my free software. Go ahead and make the needed changes to make it interoperate with OpenCobol. ... [/quote] [i]I'm name dropping. Rildo Pragana wrote the compiler that became TinyCOBOL that became OpenCOBOL.[/i] Ok, so I had already done that. Almost zero effort. So install tcl8.5 (or 8.4, just change tectonics, both work) tcl8.5-dev tk8.5 and tk8.5-dev Then get a copy of tctcl from http://pragana.net:8888/ or http://opencobol.add1tocobol.com/tctcl-20040415.tar.gz (temporary) [code] $ tar xvf tctcl-20040415.tar.gz $ cd tctcl [/code] Replace this bit: [b]tclgui.cob[/b] [code] IDENTIFICATION DIVISION. PROGRAM-ID. tclgui. AUTHOR. Rildo Pragana. *> REMARKS. *> Example tcl/tk GUI program for Cobol. *> ENVIRONMENT DIVISION. DATA DIVISION. *> WORKING-STORAGE SECTION. 01 DATA-BLOCK. 05 NAME PIC X(40). 05 W-ADDRESS PIC X(50). 05 PHONE PIC X(15). 05 END-PGM PIC X. 05 QUICK-RET PIC X. 01 SITE-INFO. 05 TITLE PIC X(20). 05 URL PIC X(50). 77 GUI-01 PIC X(64) VALUE "formA.tcl". 77 GUI-02 PIC X(64) VALUE "formB.tcl". 77 END-OF-STRING pic X value LOW-VALUES. 77 T-SCRIPT PIC X(128). 77 T-RESULT PIC X(80). 01 dummy pic X value X"00". PROCEDURE DIVISION. CALL "initTcl" *> test for stcleval function *> string "expr 12 * 34" END-OF-STRING into T-SCRIPT *> call "stcleval" using T-SCRIPT T-RESULT *> display "eval by tcl: " T-RESULT MOVE "Your name here" to NAME MOVE "Your address" TO W-ADDRESS MOVE "Phone number" to PHONE *> this variable tells Cobol that the user required an exit MOVE "0" to END-PGM MOVE "1" to QUICK-RET MOVE "Afonso Pena" to NAME *> now we may have the script name as a variable, terminated by a space CALL "tcleval" USING DATA-BLOCK "./formA.tcl " MOVE "Deodoro da Fonseca" to NAME CALL "tcleval" USING DATA-BLOCK GUI-01 MOVE "Rui Barbosa" to NAME CALL "tcleval" USING DATA-BLOCK GUI-01 MOVE "Frei Caneca" to NAME CALL "tcleval" USING DATA-BLOCK GUI-01 MOVE "0" to QUICK-RET MOVE "Your name here" to NAME. 100-restart. *> call C wrapper, passing data block and size of data CALL "tcleval" USING DATA-BLOCK GUI-01 DISPLAY "Returned data:" DISPLAY "NAME [" NAME "]" DISPLAY "ADDRESS [" W-ADDRESS "]" DISPLAY "PHONE [" PHONE "]" *> if not end of program required, loop if END-PGM = 0 go to 100-restart. *> to start a new GUI (graphical interface), call this first call "newGui" MOVE "Title of the site" to TITLE MOVE "URL (http://..., ftp://..., etc)" to URL *> now we may draw other main window... CALL "tcleval" USING SITE-INFO GUI-02 DISPLAY "Returned data:" DISPLAY "TITLE [" TITLE "]" DISPLAY "URL [" URL "]" STOP RUN. [/code] (simply a change of comment characters from the original. and run this [b]tectonic[/b] in the dir where you untar. [code] cobc -c -I/usr/include/tcl8.5/ tctcl.c cobc -x -free -ltcl8.5 -ltk8.5 tclgui.cob tctcl.o [/code] That's it. We have embedded Tcl and the Tk GUI. Run ./tclgui for the sample. Note; the [b]cobc -c -I/...[/b] functions best with the latest OC1.1 pre-release (after mid Sept). If you don't have the newest, use the [b]gcc[/b] command instead. Plus you get some type casting warnings on the C compile. That'll get fixed but the code tests ok and should work fine. More soon. I posted this even earlier than I normally would, all giddy. Cheers, Brian ---------------------------------------------------------------- Hello, I'm still excited. The addition of [b]Tcl/Tk[/b] to the [b]OpenCOBOL[/b] mix seems to be a very powerful combination. Not only do we have access to graphical interfaces now, [i]tcllib[/i] will open up encryption ... networking ... a plethora of features. And [i]tklib[/i] is none too shabby in adding extra widgets. OpenCOBOL [i]running the business side and data processing logic[/i], and tctcl [i]running the interface and networking[/i], this could be big. Cheers, Brian ---------------------------------------------------------------- Brian, I'd tried to make your example, but with no luck. [code] Makefile:37: ../config/C.rules.in: No such file or directory Makefile:38: ../config/COB.rules.in: No such file or directory Makefile:39: ../config/COB.build.tmpl.in: No such file or directory make: *** No rule to make target `../config/COB.build.tmpl.in'. Stop. [/code] and executing an old (2004) example [code] ./tclgui: error while loading shared libraries: libhtcobol.so.0: cannot open shared object file: No such file or directory [/code] ---------------------------------------------------------------- konenas; yeah, I posted this a little too early. The archive is still very TinyCOBOL. But it'll work. You can't use make or the Makefile, and the tclgui binary in the Rildo bundle is actually for TinyCOBOL 0.63 ish. So... The tclgui.cob needs to change as it uses * comments in column 1. I posted a new version with the * 's replaced by *> and compiling -free. Then there are the two build commands ... [code] cobc -c -I/usr/include/tcl8.5/ tctcl.c cobc -x -free -ltcl8.5 -ltk8.5 tclgui.cob tctcl.o [/code] The first one, using [b]cobc[/b] to do the C compile ... will need a fairly recent build for the -I include path directive to work properly. [b]gcc -c ...[/b] instead of [b]cobc -c ...[/b] will give the same results in this case. Then there is the issue of tcl8.5 versus tcl8.4 Most sites have 8.4 still. libtk8.5 looks better, but is not really needed. All three 8.5 entries (the C include and the two library links) and be changed to 8.4 [code] gcc -c -I/usr/include/tcl8.4/ tctcl.c cobc -x -free -ltcl8.4 -ltk8.4 tclgui.cob tctcl.o [/code] And being all giddy, and not testing anything outside my blinders ... I found out that some installations have /usr/lib/libtcl84 not /usr/lib/libtcl8.4, in which case that would have to change for the tectonics as well. Hope that helps. I'll try and prep a more OpenCOBOL specific version of this utility soon. Cheers, Brian ---------------------------------------------------------------- I can't find tk.h in my include files. Where the heck is it? What libs should I have? Regards, Konenas ---------------------------------------------------------------- Sorry about the grief Konenas, On my Debian system, I have tk-dev, tk8.4-dev, tk8.5-dev, tk, tk8.4, tk8.5 (and tkcon, and tklib). [code] $ locate tk.h .. /usr/include/tcl8.4/tk.h /usr/include/tcl8.4/tk-private/generic/tk.h /usr/include/tcl8.5/tk.h /usr/include/tcl8.5/tk-private/generic/tk.h ... [/code] I still have to prep a better setup and test document. Hope that helps, and will opine that I think it'll be worth the effort to get this linkage working. Cheers, Brian ---------------------------------------------------------------- Subject: Documentation First Steps Good morning, I'd like to get working on some newbie documentation. There has been plenty of discussion here and there, including in the recent weekly meeting and some mailing list communications. This is a big topic, and I defer to Brian if we want to take particular facets of it offline, or at least split into a different thread. For this thread, however, I'd like to solicit some feedback on the format of the newbie docs. For my intended content of the first guide, see the bottom of this post. Public Q1: What format or format(s) do we want to offer this in? Basic HTML? PDF? Ugly man pages :)? I'm a geek for pretty PDFs, so I can certainly make that happen. Public Q2: What format(s) do we want to use for the working docs? Public Q3: Where do we want to store these as WIPs? Is there a public doc sharing repository we could use (such as Google docs)? Or do we want to pass around from person-to-person? Thanks! sublimonym [i]Note on intended content: What I'd like to start with is a greenfield how-to guide. It would include the following steps: 1. Quick background on what openCOBOL actually is. 2. How to install openCOBOL on a Debian system (I use Ubuntu). This includes getting depencies for utilities available through apt-get, plus some step-by-step instructions on some of the ./config tweaking necessary for the Berkeley DB and GMP library manual installations. 3. How to install VIM and get a COBOL profile set up. 4. The basic hello world program. Of course, this is already posted [/i] [url=http://www.opencobol.org/modules/bwiki/index.php?cmd=read&page=UserManual%2F1#content_1_1]here (OC Wiki)[/url] ---------------------------------------------------------------- This is great sublimonym. Have you seen the current FAQ? http://opencobol.add1tocobol.com/ocfaq.html and the associated raw source? http://opencobol.add1tocobol.com/ocfaw.rst Public Q1. As many as we can, but minimum txt, html, pdf, and to play nice with GNU, Texinfo is what OpenCOBOL ships with. Public Q2 For this I've been using [b]ReStructuredText[/b] raw source. I like the look and feel of the markup. docutils has rst2html, rst2latex and a Haskell app, Pandoc does rst to .texi One thing lacking, and marked as ToDo is Index entries in RST. There are things that can be done to prepare for when .. Index: becomes supported as it will eventually become an issue. I am also a fan of freedom of choice. Someone wants to write in Open Office or Word ... that would be their problem and we can work with that. :) Public Q3. [b]add1tocobol.com[/b] will soon (days ... minutes) have an access point for svn. I like the list of content intentions. At first I thought about avoiding overlap. I'm not sure that is a valid concern with New To and How To. If I poorly write a blurb on compiling Hello World, then 10% of readers may "get it". If they have access to two different writer's style and flair then 90% may get it. Plus it can't hurt perception when OpenCOBOL garners a level of interest from the community that more than one person is writing New To How To. Cheers and thanks sublimonym, Brian ---------------------------------------------------------------- Be sure to be at Sunday's meeting. I am going crazy reading the SVN docs to make sure I know what it has to help us work as a team. Docs are most important at this stage. SVN will be ready soon. Now regarding the docs, has anyone checked out the pocket guides from Oreilly? I would really like us to make that be our FIRST publication. I would even suggest changing the FAQ to a pocket guide, because as it stands right now, it's not necessarily an FAQ. In the case of what Brian wants, with a one stop for everything, I would suggest we call it the OpenCobol Guide. That can contain sections, New to OC Guide, New to Cobol Guide and so on. Most of the publications out there for cobol are HUGE. And this would become huge. What happens then is we have 2 versions. A regular one and a pocket guide which has just quick info taken from the main publication. Oreilly does this on a LOT of its books. Most of the Pocket Guides come from one of their bigger manuals. Format IS important because we really need these to be Free and Open Content Docs. That way we can print them, or allow others to do so. Having a restriction such as "not for commercial use," will really hamper this. What if I want to print up a nice copy at Lulu.com for all of my clients that I write COBOL apps for in the future? Such a restriction would prevent that. So I suggest GNU FDL right from the start. Or a dual licensing GNU FDL & CC BY-SA. Each of these will prevent someone from restricting another down the line. In each of these cases, having a common, shared file format is important. ReST it seems, allows us to convert to many forms. I would propose that having it in a ReST format will allow us to focus on the CONTENT, rather than the FORM of the documentation. Too often, if we use something like Word or Open Office Writer, we get lost in the design and forget that the important thing is what we are saying. Along those lines does ReST allow for inclusion of images? Additionally we need VIDEOS. Cobol from the start has been a hands on language where one tech taught another directly. Having videos imitates this format. Just some ideas. A word on the pocket guide, it would give us something we could carry around. This would be a RIGHT TO THE POINT document on how to do this and that in cobol. I have learned a LOT from pocket guides, without the author's need to add extra things. Here are some examples: http://search.oreilly.com/?q=pocket+guides ---------------------------------------------------------------- [quote]because as it stands right now, it's not necessarily an FAQ.[/quote] True, I was noticing that. I was hoping to have an all-in, but it'll get too unwieldy for the reader. So, the next step will be separate FAQ and Guide. [quote]Along those lines does ReST allow for inclusion of images?[/quote] Yes. As [code] .. image:: picture.png [/code] or more control with [code] .. image:: picture.jpeg :height: 100 :width: 200 :scale: 50 :alt: alternate text :align: right :target: http://add1tocobol.com [/code] but, again, the one piece is the lack of .. index:: and I hope that ReST ToDo is marked done soon. I'll take a look at automating the pulling apart of the current ocfaq.rst. More real soon. Cheers, Brian ---------------------------------------------------------------- As far as it being called a FAQ, I just say that because the Subversion manual reminded me that really those are typically just that, frequently asked questions. Much of what you have in there is and much are questions we would be asking. Still I think a pocket guide would be very helpful. It could be something we could have done in a month. Also does ReST allow for combining ReSTful documents? Then each of us could work on our own little piece of the pie. ---------------------------------------------------------------- [quote]Also does ReST allow for combining ReSTful documents?[/quote]Yes. Using [code] .. include:: filename .. include:: [/code] These files are processed. The caveat being that section headers must conform. I've been using[code] === for top level --- for questions ... for sub sections within questions[/code] ReST uses a simple header with matching line of symbols and the order they appear in the document is the ordering of section, sub-section, subsub-section. Cheers, Brian ---------------------------------------------------------------- To summarize: Use SVN to share, ReST to write, Docutils to 'compile'. ReST doesn't support a native index metadata type but should soon. Someone (James? Brian?) is trying to get an SVN server set up on the add1tocobol website. For those unfamiliar with these utilities (as I was about 2 hours ago): [b]SVN[/b] (SubVersion) is a utility for collaborative file editing. Files are stored in a repository on a server. Files and directories are checked out, but [i]not[/i] locked. Multiple people can therefore work on the same file or set of files at the same time. On check-in files are merged. If there are conflicts, human users decide how to resolve them. Like IRC in the communication realm, the basic implementation is command-line, but there are numerous [url=http://subversion.tigris.org/links.html#clients][b][color=0000AA]clients[/b][/color][/url] available with various levels of gui-ness. The SVN project homepage is [url=http://subversion.tigris.org/][b][color=0000AA]here[/b][/color][/url] and you can read or download a complete O'Reilly eBook for free [url=http://svnbook.red-bean.com/][b][color=0000AA]here[/b][/color][/url]. [b]Docutils[/b] is a Python utility that converts plain (or nearly plain) text files to nicer formats like html or LaTeX for presentation and publication. It is optimized to use [b]ReST[/b] (ReStructured Text) files as the source text file. ReST is a lightweight markup format. In short, you can pack in a lot of metadata and whatnot without turning the basic text into a tag-laden mess. Check out the [b][url=http://docutils.sourceforge.net/index.html][color=0000AA]docutils homepage[/color][/url][/b], or jump to the [url=http://docutils.sourceforge.net/README.html#quick-start][color=0000AA][b]quick start guide[/color][/b][/url]. A good example of ReST / docutils put to work is the openCOBOL FAQ. Compare the [url=http://opencobol.add1tocobol.com/ocfaq.rst][b][color=0000AA]ReST doc[/color][/b][/url] to both the source and presentation of the converted [url=http://opencobol.add1tocobol.com/ocfaq.html][b][color=0000AA]xml version[/color][/b][/url]. ---------------------------------------------------------------- sublimonym, I will be setting up the SVN. It's rather easy, we are just discussing the methods of doing so. Separate repos for different things? shared repos? Decisions to come this week. (Joseph James, thus the James. I usually go by, Hey you! Who the heck are you and why are you eating my chocolates?!) :D The SVN book you linked to is Free and Open Content, thankfully. It is a good read. SVN is POWERFUL. For those that want to contribute, they are going to have to demonstrate that key ideas there they have learned and understand. svn checkout, svn commit, svn update, svn cp/mv/switch. All of these on the server, not just their working copy. The reason is, svn cp olddir newdir does not provide the same level of tracking as svn cp http://somerepo/oldir http://somerepo/newdir. So knowing these tricks will help us track changes over the life of the project. I had not learned all of them myself until just this past weekend. But the projects I've worked on at my job were only two devs, so it did not matter as much. Now that we will have a team of a handful to a dozen or more (and hopefully many more this year), we have to follow proper procedures. Now back to ReST for me. ---------------------------------------------------------------- Subject: Does OC preserve COBOL efficiency? Just curious: COBOL is often hailed for its speed and efficiency in mass data processing. But openCOBOL actually converts the code to C before compiling (in C). Does this nullify the advantages that COBOL has / would have when compiled directly? Similarly, how much of COBOL's reputed effectiveness is derived from the particular implementation of directly compiling COBOL source to native MVS-OS/360-z/OS binary? The language and the IBM platform have developed in tandem for decades. Does that particular combination really provide the performance edge that IBM would have us all believe? Thanks, sublimonym ---------------------------------------------------------------- In my few tests and humble opinion ... OC is very efficient. I'll admit that I've not done many large scales tests, but nothing has disappointed. Even though it is COBOL -> C -> binary, it is still binary and not something like JVM. By default COBOL is a big-endian system. On Intel, this can slow things down. There are things developers can do to help/hurt efficient runtime. [code] 01 loop-count pic 9(6). 01 loop-count pic 9(6) usage comp-5. [/code] The second will be far more effecient in a tallying loop. Taking a look at the output from -C may help. The translator produces very clean and efficient looking C code. In short OpenCOBOL holds its own. ABOVE POST: PERSONAL OPINION somewhat UNFOUNDED lacking TESTS and TRIALS Cheers, Brian ---------------------------------------------------------------- Adding another personal opinion - without having measured OpenCobol. In general COBOL should be faster - since all storage is allocated at compile/link time. Result being efficient adressing of your variables. Never langauages like Java allocate memory at run time - therefore using some kind of MemoryAdministrator during allocation and GarbageCollectors when deallocating. On our IBM mainframe we generally use COBOL - but thought we might gain speed and flexibility from using some C++ subroutines. Flexibility we got - but on the cost of lots of cpu for MALLOC's ---------------------------------------------------------------- Subject: ChatLogs from add1tocobol Meetings Several have asked so here is the link: http://www.add1tocobol.com/chatlogs/ ---------------------------------------------------------------- Subject: Opinions on a documentation experiment Hello, I was horsing around today, trying to finish the "btiffin style of OpenCOBOL doc writing" and suggestions on how to best manage a volunteer team effort without being too heavy with the axe regarding style and tool usage. So, I still like ReStructuredText. Here is a crack at source code autodoc. Is this completely bogus in the COBOL kingdom? Useful and worth the small extra effort for the planned OpenCOBOL samples bundle? By the way; I still can't finish the "btiffin" how-to. In short it'll be Write a document with the ReST citations using the (imho) very simple indentation rules and directives, and include a top level document title as [code] document title is simply the text and an underline of exactly the same length. ================================= My document title uses equal sign ================================= section titles (such as questions for a FAQ, included in table of contents) use minus signs for the underline (and optional overline ... they are optional). ---------- A question ---------- sub-sections with periods .................. Reserved Word List .................. sub-sub-sections with, well whoever needs these first ... shout load and shout fast your choice of symbol. ReST allows a lot of choice, and I'll admit it is somewhat a personal choice. Within a markover transformation pass, the order the symbols are discovered in the source, sets the sectioning level. Pretty neat, but will require group co-operation for documents destined to be merged. If you want to add a guide or question I think we can work together independently. [/code] So now the autodoc experiment... [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *><* ======================= *><* autodoc.cob usage guide *><* ======================= *><* :Author: Brian Tiffin *><* :Date: 30-Sep-2008 *><* :Rights: Copyright (c) 2008, Brian Tiffin. *><* GNU FDL License. *><* :Purpose: Extract usage document lines from COBOL sources *><* :Tectonics: cobc -x autodoc.cob *><* *><* ---------------------- *><* Command line arguments *><* ---------------------- *><* The autodoc command takes an input file, output file and an *><+ verbosity option "-v" *><* *><* Example:: *><* *><* $ ./autodoc autodoc.cob autodoc.rst -v *><* *><* ----------------- *><* What is extracted *><* ----------------- *><* - Lines that begin with \*><\*, *ignoring spaces*, are *><+ extracted. *><* *><* - Lines that begin with \*><+ are appended to the *><+ previous output line. As lines are trimmed of trailing *><+ spaces, and **autodoc** removes the space following the *><+ extract triggers, you may need two spaces after an *><+ autodoc append. *><* *><* ----------- *><* Source code *><* ----------- *><* *><* .. include:: autodoc.cob *><* :literal: *> *************************************************************** identification division. program-id. autodoc. environment division. configuration section. input-output section. file-control. select source-input assign to source-name organization is line sequential . select doc-output assign to doc-name organization is line sequential . data division. file section. fd source-input. 01 source-record pic x(256). fd doc-output. 01 doc-record pic x(256). working-storage section. 01 arguments pic x(256). 01 source-name pic x(256). 01 doc-name pic x(256). 01 verbosity pic x(8). 88 verbose values "-v" "--v" "-verbose". 01 trimmed pic x(256). 01 doc-buffer pic x(256). 01 buffer-offset pic 999 usage comp-5 value 1. 01 buffer-flag pic x value low-value. 88 buffer-empty value low-value. 88 buffered-output value high-value. 01 counter pic 999 usage comp-5. 01 len-of-comment pic 999 usage comp-5. 01 first-part pic x(256). 88 special values "*><*" "*><+". 88 autodoc value "*><*". 88 autoappend value "*><+". 01 rst-command pic x(256). 01 result usage binary-long. *> *************************************************************** procedure division. accept arguments from command-line end-accept unstring arguments delimited by all spaces into source-name doc-name verbosity end-unstring open input source-input open output doc-output set buffer-empty to true move 1 to buffer-offset move spaces to doc-record read source-input at end move high-values to source-record end-read perform until source-record = high-values move function trim(source-record leading) to trimmed unstring trimmed delimited by all spaces into first-part count in counter end-unstring evaluate true when special if autoappend and buffer-empty move spaces to doc-record move 1 to buffer-offset end-if if autodoc and buffered-output write doc-record end-write if verbose display function trim(doc-record trailing) end-display end-if move spaces to doc-record set buffer-empty to true move 1 to buffer-offset end-if *> Adding two skips over the assumed space after a special tag add 2 to counter compute len-of-comment = function length(trimmed) - counter end-compute if len-of-comment > 0 move trimmed(counter : len-of-comment) to doc-buffer else move spaces to doc-buffer end-if string function trim(doc-buffer trailing) delimited by size into doc-record with pointer buffer-offset on overflow display "truncation" end-display end-string set buffered-output to true end-evaluate read source-input at end move high-values to source-record end-read end-perform if buffered-output set buffer-empty to true move 1 to buffer-offset write doc-record end-write if verbose display function trim(doc-record trailing) end-display end-if move spaces to doc-record end-if close doc-output close source-input string "rst2html " delimited by size doc-name delimited by space " " delimited by size doc-name delimited by "." ".html" delimited by space into rst-command end-string call "SYSTEM" using rst-command returning result end-call if verbose display "Input : " function trim(source-name) end-display display "Output : " function trim(doc-name) end-display display "Command: " function trim(rst-command trailing) end-display if result not equal zero display "HTML generate failed: " result end-display end-if end-if goback. end program autodoc. *><* *><* Don't forget to check out http://opencobol.org *><* *><* Cheers [/code] [b]$ ./autodoc autodoc.cob autodoc.rst[/b] creates this .rst file and generates [b]autodoc.html[/b] if rst2html is installed. [code] ======================= autodoc.cob usage guide ======================= :Author: Brian Tiffin :Date: 30-Sep-2008 :Rights: Copyright (c) 2008, Brian Tiffin. GNU FDL License. :Purpose: Extract usage document lines from COBOL sources :Tectonics: cobc -x autodoc.cob ---------------------- Command line arguments ---------------------- The autodoc command takes an input file, output file and an verbosity option "-v" Example:: $ ./autodoc autodoc.cob autodoc.rst -v ----------------- What is extracted ----------------- - Lines that begin with \*><\*, *ignoring spaces*, are extracted. - Lines that begin with \*><+ are appended to the previous output line. As lines are trimmed of trailing spaces, and **autodoc** removes the space following the extract triggers, you may need two spaces after an autodoc append. ----------- Source code ----------- .. include:: autodoc.cob :literal: Don't forget to check out http://opencobol.org Cheers [/code] [i]Note; for the forum, I split the one long append comment to keep the side scrolling to a minimum[/i] The HTML generated by the [b]rst2html[/b] CALL "SYSTEM" can be seen at http://opencobol.add1tocobol.com/au1.html [b]Bigger Note:[/b]Don't run this sample on a .cob file that you may already have a .html file for. This sample code can [b]overwrite[/b] existing .html. Plus the sample may break in other grand mysterious ways, so ... Cheers, Brian Edit; fixed link to show older version ---------------------------------------------------------------- My opinion: nice stuff. This could make it easier to understand the source code better (if right used, because it can lead the programmer to write comments about what he does) and does something for documentation. It's necessary to have links the documentations of all the programs called in the source file. These links are very useful in html and pdf-files. Maybe you have a sample for that? Just an idea: For all file types that can do stuff like that it would be nice to be able to show some passages like the source code not from beginning (like in html/css 'visible:false', 'a.onclick {visible:true}). ---------------------------------------------------------------- Good work and I think its best for now to keep it simple. As you say you don't want to be heavy handed to people who just want to help out. take care john ---------------------------------------------------------------- I'm going to continue with this then. ;) See the new version's doc output at http://opencobol.add1tocobol.com/autodoc2.html which comes with a link to this source now [b]autodoc.cob[/b] [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *><* ======================= *><* autodoc.cob usage guide *><* ======================= *><* .. sidebar:: Table of Contents *><* *><* .. contents:: :local: *><* *><* :Author: Brian Tiffin *><* :Date: 30-Sep-2008 *><* :Rights: Copyright (c) 2008, Brian Tiffin. *><* GNU FDL License. *><* :Purpose: Extract usage document lines from COBOL sources *><* :Tectonics: cobc -x autodoc.cob *> *************************************************************** identification division. program-id. AUTODOC. environment division. input-output section. file-control. select standard-input assign to KEYBOARD. select standard-output assign to DISPLAY. select source-input assign to source-name organization is line sequential . select doc-output assign to doc-name organization is line sequential . data division. file section. fd standard-input. 01 stdin-record pic x(256). fd standard-output. 01 stdout-record pic x(256). fd source-input. 01 source-record pic x(256). fd doc-output. 01 doc-record pic x(256). working-storage section. 01 arguments pic x(256). 01 source-name pic x(256). 01 doc-name pic x(256). 01 result-name pic x(256). 01 style-name pic x(256). 01 verbosity pic x(9). 88 verbose values "-v" "--v" "-verbose" "--verbose". 01 filter-flag pic x value low-value. 88 filtering value high-value. 01 line-count usage binary-long. 01 line-display pic z(8)9. 01 trimmed pic x(256). 01 doc-buffer pic x(256). 01 buffer-offset pic 999 usage comp-5 value 1. 01 buffer-flag pic x value low-value. 88 buffer-empty value low-value. 88 buffered-output value high-value. 01 counter pic 999 usage comp-5. 01 len-of-comment pic 999 usage comp-5. 01 first-part pic x(256). 88 special values "*><*" "*><+". 88 autodoc value "*><*". 88 autoappend value "*><+". 01 rst-command pic x(256). 01 result usage binary-long. *> *************************************************************** procedure division. accept arguments from command-line end-accept *> Determine if this is running as a filter if arguments not equal spaces unstring arguments delimited by all spaces into source-name doc-name result-name style-name verbosity end-unstring open input source-input open output doc-output else set filtering to true open input standard-input open output standard-output end-if set buffer-empty to true move 1 to buffer-offset move spaces to doc-record move 0 to line-count *> filtering requires different reader loop if filtering read standard-input at end move high-values to stdin-record end-read move stdin-record to source-record else read source-input at end move high-values to source-record end-read end-if perform until source-record = high-values add 1 to line-count move function trim(source-record leading) to trimmed unstring trimmed delimited by all spaces into first-part count in counter end-unstring evaluate true when special if autoappend and buffer-empty move spaces to doc-record move 1 to buffer-offset end-if if autodoc and buffered-output if filtering move doc-record to stdout-record write stdout-record end-write else write doc-record end-write end-if if verbose display function trim(doc-record trailing) end-display end-if move spaces to doc-record set buffer-empty to true move 1 to buffer-offset end-if *> Adding 2 skips over the assumed space after a special tag add 2 to counter compute len-of-comment = function length(trimmed) - counter end-compute if len-of-comment > 0 move trimmed(counter : len-of-comment) to doc-buffer else move spaces to doc-buffer end-if string function trim(doc-buffer trailing) delimited by size into doc-record with pointer buffer-offset on overflow move line-count to line-display display "*** truncation *** reading line " line-display end-display end-string set buffered-output to true end-evaluate if filtering read standard-input at end move high-values to stdin-record end-read move stdin-record to source-record else read source-input at end move high-values to source-record end-read end-if end-perform if buffered-output set buffer-empty to true move 1 to buffer-offset if filtering move doc-record to stdout-record write stdout-record end-write else write doc-record end-write end-if if verbose display function trim(doc-record trailing) end-display end-if move spaces to doc-record end-if if filtering close standard-output close standard-input else close doc-output close source-input end-if if verbose display "Input : " function trim(source-name) end-display display "Output : " function trim(doc-name) end-display end-if move spaces to rst-command if result-name not equal spaces if style-name equal spaces string "rst2html " delimited by size doc-name delimited by space " " delimited by size result-name delimited by space into rst-command end-string else string "rst2html --stylesheet=" delimited by size style-name delimited by space " " delimited by size doc-name delimited by space " " delimited by size result-name delimited by space into rst-command end-string end-if if verbose display "Command: " function trim(rst-command trailing) end-display end-if call "SYSTEM" using rst-command returning result end-call if verbose if result not equal zero display "HTML generate failed: " result end-display end-if end-if end-if goback. end program AUTODOC. *><* *><* ------------ *><* Command line *><* ------------ *><* *autodoc* runs in two forms. *><* *><* Without arguments, *autodoc* will act as a pipe filter. *><* Reading from standard in and writing the extract to standard *><+ out. *><* *><* The *autodoc* command also takes an input file, an extract *><+ filename, an optional result file (with optional *><+ stylesheet) and a verbosity option *-v*. *><* If a result file is given, autodoc will automatically *><* run an *rst2html* command using the SYSTEM service. *><* *><* Due to an overly simplistic argument handler, you can only *><+ turn on verbosity when using all four filenames. *><* *><* Examples:: *><* *><* $ cat autodoc.cob | autodoc >autodoc.rst *><* $ ./autodoc autodoc.cob autodoc.rst *><+ autodoc.html skin.css -v *><* ... *><* Input : autodoc.cob *><* Output : autodoc.rst *><* Command: rst2html --stylesheet=skin.css *><+ autodoc.rst autodoc.html *><* *><* ----------------- *><* What is extracted *><* ----------------- *><* - Lines that begin with \*><\* *ignoring spaces*, are *><+ extracted. *><* *><* - Lines that begin with \*><+ are appended to the *><+ previous output line. As lines are trimmed of trailing *><+ spaces, and *autodoc* removes the space following the *><+ extract triggers, you may need two spaces after an *><+ autodoc append. *><* *><* ----------- *><* Source code *><* ----------- *><* `Download autodoc.cob *><+ `_ *><* *><* .. include:: autodoc.cob *><* :literal: *><* *><* Don't forget to visit http://opencobol.org *><* *><* Cheers [/code] ---------------------------------------------------------------- This gets better every time. Please: Do either edit your old post or make all versions of the html-output available. ---------------------------------------------------------------- Ok, last one. Adds source insertion. Name change. ocdoc instead of autodoc from now on. See results at http://opencobol.add1tocobol.com/ocdoc.html See results with --fixed form with sequence numbers at http://opencobol.add1tocobol.com/ocdocseq.html This sample also demonstrates source code annotations. This is about as complex as things should ever look with the ocdoc model. On the name change. autodoc was a misnomer. This is manual documentation at its finest. ocdoc could also be called [i]usagedoc[/i] as I think using it simply to generate usage html, is the way to go. Argument parsing is still overly simple. Sequence numbered fixed source requires [b]--fixed[/b] command option. But you need to use all four filenames to get --fixed as the fifth parameter. My bad, my lazy. Cheers [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *><* ===================== *><* ocdoc.cob usage guide *><* ===================== *><* .. sidebar:: Table of Contents *><* *><* .. contents:: :local: *><* *><* :Author: Brian Tiffin *><* :Date: 30-Sep-2008 *><* :Rights: Copyright (c) 2008, Brian Tiffin. *><* GNU FDL License. *><* :Purpose: Extract usage document lines from COBOL sources. *><* Using OpenCOBOL 1.1pr. OpenCOBOL is tasty. *><* :Tectonics: cobc -x ocdoc.cob *> *************************************************************** *><* *><* ------------ *><* Command line *><* ------------ *><* *ocdoc* runs in two forms. *><* *><* Without arguments, *ocdoc* will act as a pipe filter. *><* Reading from standard in and writing the extract to standard *><+ out. *><* *><* The *ocdoc* command also takes an input file, an extract *><+ filename, an optional result file (with optional *><+ stylesheet) and a verbosity option *-v* or a *><+ special *-fixed* flag (to force skipping sequence numbers). *><* If a result file is given, ocdoc will automatically *><* run an *rst2html* command using the SYSTEM service. *><* *><* Due to an overly simplistic argument handler, you can only *><+ turn on verbosity or -fixed when using all four filenames. *><* *><* Examples:: *><* *><* $ cat ocdoc.cob | ocdoc >ocdoc.rst *><* $ ./ocdoc ocdoc.cob ocdoc.rst *><* $ ./ocdoc ocdoc.cob ocdoc.rst *><+ ocdoc.html skin.css -fixed *><* ... *><* Input : ocdoc.cob *><* Output : ocdoc.rst *><* Command: rst2html --stylesheet=skin.css *><+ ocdoc.rst ocdoc.html *><* *><* ----------------- *><* What is extracted *><* ----------------- *><* - Lines that begin with \*><\* *ignoring spaces*, are *><+ extracted. *><* *><* - Lines that begin with \*><+ are appended to the *><+ previous output line. As lines are trimmed of trailing *><+ spaces, and *ocdoc* removes the space following the *><+ extract triggers, you may need two spaces after an *><+ ocdoc append. *><* *><* - Lines that begin with \*><[ begin a here document *><+ with lines that follow extracted as is. *><* *><* - Lines that begin with \*><] close a here document. *><+ Here document start and end lines are excluded from the *><+ extract. *><* *><* ----------- *><* Source code *><* ----------- *><* `Download ocdoc.cob *><+ `_ *><* *><* *><* ----------------------- *><* identification division *><* ----------------------- *><* *><* :: *><* *><[ identification division. program-id. OCDOC. environment division. input-output section. file-control. select standard-input assign to KEYBOARD. select standard-output assign to DISPLAY. select source-input assign to source-name organization is line sequential . select doc-output assign to doc-name organization is line sequential . *><] *><* *><* ------------- *><* data division *><* ------------- *><* *><* :: *><* *><[ data division. file section. fd standard-input. 01 stdin-record pic x(256). fd standard-output. 01 stdout-record pic x(256). fd source-input. 01 source-record pic x(256). fd doc-output. 01 doc-record pic x(256). working-storage section. 01 arguments pic x(256). 01 source-name pic x(256). 01 doc-name pic x(256). 01 result-name pic x(256). 01 style-name pic x(256). 01 verbosity pic x(9). 88 verbose values "-v" "--v" "-verbose" "--verbose". 88 skipseqnum values "-fix" "-fixed" "--fix" "--fixed". 01 usagehelp pic x(6). 88 helping values "-h" "--h" "-help" "--help". 01 filter-flag pic x value low-value. 88 filtering value high-value. 01 line-count usage binary-long. 01 line-display pic z(8)9. *><] *><* *><* Note the conditional test for end of here doc *><* *><* :: *><* *><[ 01 trimmed pic x(256). 88 herestart value "*><[". 88 hereend value "*><]". 01 hereflag pic x value low-value. 88 heredoc value high-value. 88 herenone value low-value. *><] *><* *><* Note the here-record adds an ocdoc extract to lines that *><+ follow. *><* *><* :: *><* *><[ 01 here-record. 02 filler pic x(5) value "*><* ". 02 here-data pic x(251). 01 seq-record. 02 filler pic x(7) value " ". 02 seq-data pic x(249). 01 doc-buffer pic x(256). 01 buffer-offset pic 999 usage comp-5 value 1. 01 buffer-flag pic x value low-value. 88 buffer-empty value low-value. 88 buffered-output value high-value. 01 counter pic 999 usage comp-5. 01 len-of-comment pic 999 usage comp-5. 01 first-part pic x(8). 88 special values "*><*" "*><+". 88 autodoc value "*><*". 88 autoappend value "*><+". 01 rst-command pic x(256). 01 result usage binary-long. *><] *><* *><* ------------------ *><* procedure division *><* ------------------ *><* *><* :: *><* *><[ *> *************************************************************** procedure division. *><] *><* *><* Accept command line arguments. See if help requested. *><* *><* :: *><* *><[ accept arguments from command-line end-accept move arguments to usagehelp if helping display "$ ./ocdoc source markover [output [skin [--fixed]]]" end-display display "$ ./ocdoc" end-display display " without arguments extracts stdin to stdout" end-display goback end-if *><] *><* *><* Either run as filter or open given files. Two filenames *><+ will generate an extract. Three will run the extract *><+ through *rst2html* using an optional fourth filename *><+ as a stylesheet. *><* *><* :: *><* *><[ *> Determine if this is running as a filter if arguments not equal spaces unstring arguments delimited by all spaces into source-name doc-name result-name style-name verbosity end-unstring open input source-input open output doc-output else set filtering to true open input standard-input open output standard-output end-if *><] *><* *><* Initialize the output buffer, and line count. *><* *><* :: *><* *><[ set buffer-empty to true move 1 to buffer-offset move spaces to doc-record move 0 to line-count *><] *><* *><* The read is either from file or stdin. Start with the *><+ first record. *><* *><* :: *><* *><[ *> filtering requires different reader loop if filtering read standard-input at end move high-values to stdin-record end-read move stdin-record to source-record else read source-input at end move high-values to source-record end-read end-if *><] *><* *><* The main loop starts here, having done a pre-read to start *><+ things off. *><* *><* :: *><* *><[ perform until source-record = high-values add 1 to line-count *><] *><* *><* Small wrinkle if processing fixed form with sequence numbers, *><+ as the heredoc end marker needs to be recognized *><+ but we still want the sequence numbers in the heredoc. *><* *><* So files processed --fixed play some data shuffling games. *><* *><* :: *><* *><[ if skipseqnum if heredoc move source-record(7 : 248) to trimmed move source-record to seq-data move seq-record to source-record else move source-record(7 : 248) to source-record move source-record to trimmed end-if else move function trim(source-record leading) to trimmed end-if *><] *><* *><* First to check for here doc start and end, setting flag *><+ if trimmed conditional the heredoc start or heredoc end *><+ strings. *><* *><* :: *><* *><[ if herestart set heredoc to true end-if if hereend set herenone to true end-if *><] *><* *><* Inside the loop, we skip over heredoc entries. *><+ If it is normal, than check for heredoc and include *><+ source lines that follow, by prepending the extract tag *><* *><* :: *><* *><[ if (not herestart) and (not hereend) if heredoc move source-record to here-data move here-record to trimmed end-if *><] *><* *><* Unstring the line, looking for special tags in the first *><+ part. *><* *><* :: *><* *><[ unstring trimmed delimited by all spaces into first-part count in counter end-unstring *><] *><* *><* If special, we either buffer or append to buffer *><* *><* :: *><* *><[ evaluate true when special if autoappend and buffer-empty move spaces to doc-record move 1 to buffer-offset end-if if autodoc and buffered-output if filtering move doc-record to stdout-record write stdout-record end-write else write doc-record end-write end-if if verbose display function trim(doc-record trailing) end-display end-if move spaces to doc-record set buffer-empty to true move 1 to buffer-offset end-if *><] *><* *><* Skip over where the tag was found plus an extra space. *><* Adding 2 skips over the assumed space after a special tag *><* *><* :: *><* *><[ add 2 to counter compute len-of-comment = function length(trimmed) - counter end-compute if len-of-comment > 0 move trimmed(counter : len-of-comment) to doc-buffer else move spaces to doc-buffer end-if *><] *><* *><* Buffer the line, either to position 1 or appending to last. *><* *><* :: *><* *><[ string function trim(doc-buffer trailing) delimited by size into doc-record with pointer buffer-offset on overflow move line-count to line-display display "*** truncation *** reading line " line-display end-display end-string set buffered-output to true end-evaluate end-if *><] *><* *><* Again, we either read the next record from file or stdin. *><* *><* :: *><* *><[ if filtering read standard-input at end move high-values to stdin-record end-read move stdin-record to source-record else read source-input at end move high-values to source-record end-read end-if end-perform *><] *><* *><* We may or may not end up with buffered data *><* *><* :: *><* *><[ if buffered-output set buffer-empty to true move 1 to buffer-offset if filtering move doc-record to stdout-record write stdout-record end-write else write doc-record end-write end-if if verbose display function trim(doc-record trailing) end-display end-if move spaces to doc-record end-if *><] *><* *><* Close the OpenCOBOL files *><* *><* :: *><* *><[ if filtering close standard-output close standard-input else close doc-output close source-input end-if if verbose display "Input : " function trim(source-name) end-display display "Output : " function trim(doc-name) end-display end-if *><] *><* *><* If we have a result file, use the SYSTEM service to *><+ generate an HTML file, possibly with stylesheet. *><* *><* :: *><* *><[ *> pass the extract through a markover, in this case ReST move spaces to rst-command if result-name not equal spaces if style-name equal spaces string "rst2html " delimited by size doc-name delimited by space " " delimited by size result-name delimited by space into rst-command end-string else string "rst2html --stylesheet=" delimited by size style-name delimited by space " " delimited by size doc-name delimited by space " " delimited by size result-name delimited by space into rst-command end-string end-if if verbose display "Command: " function trim(rst-command trailing) end-display end-if call "SYSTEM" using rst-command returning result end-call if result not equal zero display "HTML generate failed: " result end-display end-if end-if *><] *><* *><* And before you know it, we are done. *><* *><* :: *><* *><[ goback. end program OCDOC. *><] *><* *><* Don't forget to visit http://opencobol.org *><* *><* Cheers *><* *><* *Last edit:* 03-Oct-2008 [/code] ---------------------------------------------------------------- Subject: Known Bugs in OC 1.1 pre-release This thread was started as ToDo list for OC 1.1 Release because of [quote][url=http://www.add1tocobol.com/chatlogs/2008-09-21.html]Roger wrote[/url]: [...] nobody asked when OC 1.1 is going to be released [...] Actually, regardless of outstanding things, as soon as I have ironed out a couple of bugs, it will be done[/quote] Please post [b]ONLY Bugs[/b] (that you've checked with recent pre-release), each one as a new post with a subject, that shortly describes the problem. If possible submit full sample code that leads to the bug and tell us which system you've used. ---------------------------------------------------------------- I found out, that if you do a CALL and CANCEL 'MYBIGPROG' with big working storage; the used memory stays the same. If you do this in a huge application with a lot of programs the memory is flooded with OC. Does this depends on the system where OC is used? Are there any solves for that? I've did the following with these progs and two consoles/taskmanager: run TESTPGM, see memory usage with top/taskmanager, press enter and see memory usage again, ... It rises and rises until stop run is performed. [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. 'TESTPGM'. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. * WORKING-STORAGE SECTION. * 77 mychar pic x. *----------------------------------------------------------------- LINKAGE SECTION. *----------------------------------------------------------------- PROCEDURE DIVISION. declaratives. end declaratives. *----------------------------------------------------------------- main section. 00. display 'TESTPGM loaded' accept mychar * call 'BIGPROG1' cancel 'BIGPROG1' display 'BIGPPROG1 was cancelled' accept mychar * call 'BIGPROG2' cancel 'BIGPROG2' display 'BIGPPROG2 was cancelled' accept mychar * stop run * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program TESTPGM --------------------------------------[/code][code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. BIGPROG1. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. * WORKING-STORAGE SECTION. * 77 mychar pic x. 77 somebigthing pic x(9999999). *----------------------------------------------------------------- LINKAGE SECTION. *----------------------------------------------------------------- PROCEDURE DIVISION. declaratives. end declaratives. *----------------------------------------------------------------- main section. 00. display 'BIGPROG1 loaded' accept mychar * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program BIGPROG1 -------------------------------------[/code][code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. BIGPROG2. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. * WORKING-STORAGE SECTION. * 77 mychar pic x. 77 somebigthing pic x(9999999). *----------------------------------------------------------------- LINKAGE SECTION. *----------------------------------------------------------------- PROCEDURE DIVISION. declaratives. end declaratives. *----------------------------------------------------------------- main section. 00. display 'BIGPROG2 loaded' accept mychar * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program BIGPROG2 -------------------------------------[/code] Tested with cygwin/WinXP (recent 1.1 prerelease and SLES 10 with OC1.0) [b]WORKAROUND:[/b] USE BASED vars / LOCAL-STORAGE SECTION ---------------------------------------------------------------- [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. 'TESTUND'. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. * WORKING-STORAGE SECTION. * 77 mychar pic x. 01 mytable. 05 filler occurs 10 descending key is myvar indexed by myindex. 10 myvar pic x. *----------------------------------------------------------------- LINKAGE SECTION. *----------------------------------------------------------------- PROCEDURE DIVISION. declaratives. end declaratives. *----------------------------------------------------------------- main section. 00. search mytable when myvar (myindex) = 'A' continue end-search * stop run * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program TESTUND --------------------------------------[/code] leads to [quote]$ cobc -x TESTUND.cbl parser.y:2132: Invalid type cast from 'null' Tag 1 0 Tag 2 11 Aborting compile of TESTUND.cbl at line 18[/quote]Better would be something like "TESTUND.cbl:30: MYTABLE: not a table" [b]FIXED[/b], compiler says now [quote]$ cobc -x TESTUND.cbl TESTUND.cbl: In paragraph '00': TESTUND.cbl:30: Error: 'mytable' not indexed TESTUND.cbl:15: Error: 'mytable' defined here[/quote] ---------------------------------------------------------------- The search problem is fixed in current 1.1 tarball. I will discuss CANCEL on tomorrows (Oct 12) online meeting. Roger ---------------------------------------------------------------- Subject: make errors using cygwin with winXP and version 1.1 of openCobol ./configure seems to go off without a hitch, but when running make, it wimpers out with the following error(s). --------------- libtool: link: cannot find the library '' or unhandled argument 'and' make[2]: ***[cobcrun.exe] Error 1 make[1]: ***[all-recursive] Error 1 make: ***[all] Error 2 --------------- Any Ideas? ---------------------------------------------------------------- Does ./configure leads to something like this, and if yes: what is shown there? [quote]OpenCOBOL Configuration: CC gcc COB_CC gcc CFLAGS -g -O2 -march=i686 -mtune=pentium4 -finline-functions -fs igned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k COB_CFLAGS -I/usr/local/include COB_EXTRA_FLAGS -march=i686 -mtune=pentium4 LDFLAGS COB_LDFLAGS COBC_LIBS -lintl COB_LIBS -L${exec_prefix}/lib -lcob -lm -lgmp -lintl -ldb COB_CONFIG_DIR ${prefix}/share/open-cobol/config COB_COPY_DIR ${prefix}/share/open-cobol/copy COB_LIBRARY_PATH .:${exec_prefix}/lib/open-cobol COB_MODULE_EXT dll COB_SHARED_OPT -shared COB_PIC_FLAGS -DDLL_EXPORT -DPIC COB_EXPORT_DYN -Wl,--export-all-symbols -Wl,--enable-auto-import COB_STRIP_CMD strip --strip-unneeded Dynamic loading System Use gettext for international messages: yes Use Berkeley DB for file I/O: yes Use enhanced Berkeley DB (>= 4.1) yes Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: no[/quote] ---------------------------------------------------------------- it does. that portion is : ---------------- OpenCOBOL Configuration: CC gcc COB_CC gcc CFLAGS -g -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k COB_CFLAGS -I/usr/local/include COB_EXTRA_FLAGS -march=i686 -mtune=pentium4 LDFLAGS COB_LDFLAGS COBC_LIBS -lintl COB_LIBS -L${exec_prefix}/lib -lcob -lm -lgmp -lintl -lncurses -ldb COB_CONFIG_DIR ${prefix}/share/open-cobol/config COB_COPY_DIR ${prefix}/share/open-cobol/copy COB_LIBRARY_PATH .:${exec_prefix}/lib/open-cobol COB_MODULE_EXT dll COB_SHARED_OPT -shared COB_PIC_FLAGS -DDLL_EXPORT -DPIC COB_EXPORT_DYN -Wl,--export-all-symbols -Wl,--enable-auto-import COB_STRIP_CMD strip --strip-unneeded Dynamic loading System Use gettext for international messages: yes Use Berkeley DB for file I/O: yes Use enhanced Berkeley DB (>= 4.1) yes Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: yes ---------------------------------------------------------------- I cannot reproduce this. The end part of the configure is exactly the same as I have. Q1) Did you add any options to the configure? Q2) What Cygwin version? Roger ---------------------------------------------------------------- uname -a gives me CYGWIN_NT-5.1 JBEAUMONT2-1 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 Cygwin the cygwin installation is about 2 years old, but I used the latest version of the installer to add the required libraries for openCobol, if it's of any consequence. ---------------------------------------------------------------- Subject: exit program returning variable I have already worked around this by using a different return method, but I wonder what I am doing wrong? Thanks, Gerald. gc@puffer:~/cobol/postgresql$ cobc -V cobc (OpenCOBOL) 1.1.0 Built Sep 26 2008 11:55:07 Packaged Fri Sep 19 20:44:25 CEST 2008 Copyright (C) 2001-2008 Keisuke Nishida / Roger While 01 intResult pic 9(9) comp-5. exit program returning intResult. psql.cbl:215: Error: syntax error, unexpected RETURNING exit program giving intResult psql.cbl:215: Error: syntax error, unexpected GIVING goback returning intResult. psql.cbl:215: Error: syntax error, unexpected RETURNING goback giving intResult. psql.cbl:215: Error: syntax error, unexpected GIVING ---------------------------------------------------------------- Hello Gerald, [code] STOP RUN RETURNING code [/code] or [code] MOVE code to RETURN-CODE GOBACK or EXIT PROGRAM or STOP RUN [/code] OpenCOBOL tracks and returns RETURN-CODE, both to the OS and from a PROCEDURE DIVISION called sub-program; if I am not mistaken. Cheers, Brian ---------------------------------------------------------------- [quote] Jean-M wrote: The RETURN-CODE special register can be used to pass a return code to the calling program or operating system (or shell) when the current Cobol program ends. The RETURN-CODE special register has the implicit definition[/quote] [quote] simrw wrote: 77 RETURN-CODE PIC S9(08) COMP-5 VALUE 0. (Alternatively in 2002 syntax - 77 RETURN-CODE USAGE BINARY-LONG SIGNED VALUE 0.) ie. It is a machine endian 4 byte signed integer. Also it is not GLOBAL. It is per program.[/quote] ---------------------------------------------------------------- So...I guess I will have to toss my NCR IMOS COBOL Pocket Reference, third edition, circa 1979. It will be missed. ---------------------------------------------------------------- NOOOOOOOOOOOOOOOOOO.... Save that book. If you honestly do not want it I will buy it from you G. Legacy Cobol books are high on my agenda. ---------------------------------------------------------------- [quote] aoirthoir wrote: NOOOOOOOOOOOOOOOOOO.... Save that book. If you honestly do not want it I will buy it from you G. Legacy Cobol books are high on my agenda.[/quote] To tease you even further, I have the NCR IMOS COBOL Student Text, fourth edition, circa 1981 which was both a valuable reference manual and teaching tool. It also documents the rudimentary (but essential) text editor and o/s commands. This was on IMOS V, a huge improvement over the previous IMOS III o/s. I quote: "The COBOL Compiler requires 21K bytes, not including roll memory requirements." Since we had upgraded to 256K of ram, we were not as concerned about running out of memory in our batch environment. Not that this ever happened to me, but it was possible to delete every file on a disk pack by typing 'del' and accidentally hitting the enter key before typing a specific file name or wild card. I may have been heard moaning 'NOooo' and seen running to the computer room where I frantically punched the Halt, Reset, Compute, Compute buttons on the processor to halt and restart it. Funny how I can still remember that button sequence... Gerald. ---------------------------------------------------------------- Subject: set variable to value of pointer I am trying to save the value of a pointer in a variable. I thought a pic 9(9) comp-5 was equivalent to a pointer variable and the set statement would allow moving the value. I guess I was wrong. How do I save/restore the value of the pointer (not the contents it points to)? Relevant (I hope) bits: gc@puffer:~/cobol/postgresql$ cobc -V cobc (OpenCOBOL) 1.1.0 Built Sep 26 2008 11:55:07 Packaged Fri Sep 19 20:44:25 CEST 2008 Copyright (C) 2001-2008 Keisuke Nishida / Roger While 01 lsConnHandle pic 9(9) comp-5. 01 ptrPGconn usage pointer. . set lsConnHandle to ptrPGconn. . psql.cbl:237: Error: Invalid source for MOVE ---------------------------------------------------------------- Hello, For what purpose? Can IsConnHandle not be declared as USAGE POINTER? In which case the SET will work. If you need this for a C library call for instance... [code] 01 db-handle usage pointer. 01 result usage binary-long. // Set pointer to pointer to database int get-handle(dataBase **db) { db = pointer_to_dbhandle; return 0; } // Use pointer int use-handle(dataBase *db) { return somefunc(db) } call "get-handle" using db-handle returning result call "use-handle" using BY VALUE db-handle returning result [/code] (I hope I have the C datatype specs right ... maybe not ... didn't test ... poor form) The reason I showed that code, [i]craftily avoiding answering the actual question you posted,[/i] the first call passes the pointer by reference (effectively a **db) (and it can be written to) and from then on, use BY VALUE to give C (or a proc div) the value of the pointer. If you have more dubious plans for the IsConnHandle, then we should be able to work it through. Cheers, Brian ---------------------------------------------------------------- [quote] btiffin wrote: For what purpose? Can IsConnHandle not be declared as USAGE POINTER? In which case the SET will work. [/quote] You're right of course. It was stuck in my mind that I shouldn't put a pointer in the linkage section, but it compiles fine. Right now that is all I'm shooting for. Thanks, Gerald. ---------------------------------------------------------------- Subject: add CMS to Cobol. Sunday October 12th Online Meeting. One of the things we need as part of the Open Cobol documentation effort and the Add 1 to COBOL series of projects, is a serious website. I am not simply talking about the design here, though that too is important and we are already preparing the stages of that. But in this case I mean a series of online tools that will allow us to interact with each other in a centralized location, upload and test files and so forth. I am already near to completing part of this with our tests to get Open Cobol running on Dreamhost and to get it working on the web. Also, as many of yall know, I have offered a free SSH account, and subdomain on add1tocobol.com specifically for folks that want to test this kind of technology. Thus much of the groundwork has already been laid. I have decided to go ahead and use the .cobol file extension for our web apps delivered via Add1tocobol.com or any of its subsidiary sites. So for instance on my other sites, which are not about cobol, by having a .cobol extension, I will be advertising to the world, and especially the tech world, that yes ineed cobol is still being used. If you want a different extension on subdomains of add1tocobol that I give you, you are more than welcome to create them:). Now, we need some more tools. A part of that is definitely a Content Management System, or a CMS. Of course all of our tools, including the CMS should be written in COBOL. And they should be compiled with Open Cobol. So the name of our CMS will be: Add CMS to Cobol. This maintains the add 1 to cobol flavor of names. It makes it recognizable as the same family of folks. I think also it is superior to add 1 to CMS. Again with the intention to continually be saying, YES Cobol IS still being used and is being used for more than just legacy apps. Alright so with all of this in mind, our meeting Sunday will focus exclusively on this CMS. I will try to have our Designer there, just this one time, so that he can help direct how the meeting goes. There are after all a number of things we have to consider for a CMS. Such as: 1. HTML Template. 2. CSS Template. 3. Cobol to Javascript. 4. HTML Editor such as: TinyMCE fckEditor WYMeditor. 5. File Uploads 6. User Manageable Email list. 7. Add Forum to Cobol (simply...no wasted code or cutsy crap). There are a number of other things we need in a CMS for our purposes. Yes we could install something else (Joomla, Mambo and such), but that is contrary to part of the goal being, to have a Cobol site, be written in Cobol. So this week's meeting will address these and many other issues regarding a CMS. To attend here is the info you need: Where: FREENODE IRC Channel: #add1tocobol Access from the web: http://www.add1tocobol.com/i_o_control.php Date: Sunday October 12th. Time: 9:00am Eastern ::::::::NOTE IMPORTANT:::::::::: There has been some confusion as to the time. I believe this is because the United States uses Daylight Savings Time. On top of this the Government recently extended the dates that EDT (eastern daylight time) would run. So to be sure that you make it at 9am Eastern, I have this link: http://www.timeanddate.com/worldclock/city.html?n=179 That shows the time in New York City at the moment of viewing. It also explains the current UTC offset for the Eastern Zone in the United States. Simply compare the current time that site states, with your current time and you will know how far off we are from you. :::::::::::::::::::::::::::::::: Many thanks and I hope to see all of yall there this Sunday. ---------------------------------------------------------------- Joseph, My view on some options; 1 and 2 and SQLite. I've been modifying shell.c, [i]the interactive sqlite3> command line processor[/i], and so far OpenCOBOL has support for all the meta-commands, (but not all sub-features yet), and row return on the callback. .mode support for line, list, column, [b]html[/b] Of importance [code].mode column .width n n n ...[/code] And then returning data groups [code] 01 main-record. 03 field-1 pic S9(10). 03 filler pic xx. 03 field-2 pic x(10). 03 filler pic xx. 03 field-3 pic x(19). move ".schema trial" to query perform ocsql-meta CREATE TABLE trial (first integer primary key, second char(10), third date); move ".mode line" to query perform ocsql-meta move ".width 10 10 19" to query perform ocsql-meta move "select * trial;" to query perform ocsql-exec in a callback OpenCOBOL sub-program with linkage user-pointer, field-count, row, row-length called per row. move row to main-record display field-2 end-display [/code] It's coming along pretty well. 100ish [i]fprintf stdout[/i] functions moved to a [i]snprintf[/i] sequence, with about 30ish ported and tested. And all that rambling was to say, OpenCOBOL SQLite now supports HTML output. Simply use a "bag of text" main-record and ".mode html" before a query. ;) 3 Spidermonkey. Aside from access to the DOM, we can execute the javascript from within OpenCOBOL. Any expertise built up with code gen in this area, could help with future OpenCOBOL toolkits. 4 I use Quanta+ when forced into gui Web work. Otherwise and even with Q+, mostly by hand. Not a huge fan of generators for the structure, just the fillings. 5 Either tctcl or libCURL. We lack server sockets from inside OC, but can use the tickle sockets or fall back to CGI or CALL "SYSTEM" wraps around scp. 6 no idea. I'd use REBOL or something else that already has the IMAP, POP and SMTP protocols along with MIME type handlers. 7 I like opencobol.org to be honest. A forum can be coded fairly quicky, but [i]good[/i] forum software is a major piece of work, imho, and it'll take some hours. This is personal opinion, but I prefer some colour and flavour on boards I hang out on. This weekend is Thanksgiving up here in the great white north...may or may not be online for Sunday morning. Cheers, Brian ---------------------------------------------------------------- To clarify the time for us people "east of the pond", the meet time of 9:00 Eastern is (currently) UTC - 4. This means - a) For the UK which is currently UTC + 1, that we start at 14:00 (2 PM). b) For central europe which is currently at UTC + 2, that we start at 15:00 (3 PM). After the posted agenda has been completed, I will be available to answer/discuss anything OC related or indeed anything generally COBOL related. Roger ---------------------------------------------------------------- Roger, Thanks for posting the times. We will be relying on your guidance as we design this, to make sure we do not break any cobol rules. ---------------------------------------------------------------- Open ID? Rather than direct login? ---------------------------------------------------------------- Chat log: http://www.add1tocobol.com/chatlogs/2008-10-12.html ---------------------------------------------------------------- Subject: Nested subprogram GLOBAL storage support I'm looking into converting a large number of COBOL programs (around 120 million lines) from MF to Open COBOL. A trial of this has gone quite well, but one thing (actually, the only thing) that's tripping us up is the lack of GLOBAL support for nested sub programs. Is this on the radar at all? If not, can someone give me even a brief going over of what areas within OC would be affected and what the issues might be so I can perhaps look at adding this myself. I notice that the nested subprograms are implemented in the C file as a function, so is it perhaps that data items marked GLOBAL need to be defined outside of main() and referenced in the nested sub program as usual. I don't know, I'm speculating and I might have missed the boat completely. Thanks for the help, and for the great compiler so far. ---------------------------------------------------------------- Please give a short example how this GLOBAL sub program looks like and how to call these (for everybody who does not MF, like me). ---------------------------------------------------------------- Okay, this is as short as it gets. You can see the MYITEM defined in the outer program, and it's being used both there, and in the inner program BTEST. This is what the GLOBAL data item allows. This is pasted into one source file called atest.cbl: [font=Courier] identification division. program-id. atest. data division. working-storage section. 01 myitem pic x(10) GLOBAL. procedure division. a-main1 section. move 'hello' to myitem display 'a-main1 atest' display myitem call 'btest' display 'bye' goback. identification division. program-id. btest. data division. working-storage section. procedure division. b-main1 section. display 'b-main1 atest' display myitem. goback. end program btest. end program atest. [/font] *********************************************************** This is what we get with MF: ~/test> cobrun ./atest.int a-main1 atest hello b-main1 atest hello bye edit: sorry, I couldn't keep the indenting intact.. other edit: I'm use Open COBOL, the following version: ~/test> cobc --version cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2008 Keisuke Nishida / Roger While Built Oct 08 2008 08:24:05 Packaged Oct 05 2008 18:43:45 CEST ---------------------------------------------------------------- You can use external:[code]identification division. program-id. atest. data division. working-storage section. 01 myitem pic x(10) external. procedure division. a-main1 section. move 'hello' to myitem display 'a-main1 atest' display myitem call 'btest' display 'bye' goback. identification division. program-id. btest. data division. working-storage section. 01 myitem pic x(10) external. procedure division. b-main1 section. display 'b-main1 atest' display myitem. goback. end program btest. end program atest.[/code] The first program that uses an external var defines it's size and value, all other programs can read it / change it / what ever you like. The only problem is that you need to change all programs that OC complains about undefined vars. ---------------------------------------------------------------- That's interesting. I think we can do something with that technique. Thanks! Pity about the need to define the data items in the subprogram as well. Might be able to automate the adding of those though... Hmm. Food for thought. ---------------------------------------------------------------- Hm, the semantics of external are quite different to GLOBAL. With EXTERNAL data items, they're common within the whole run unit, which would cause all kinds of problems. With GLOBALs they're only common within the program unit they're defined in. If Open COBOL can do externals though, I think global is just the same but with narrower scope and only one storage definition. I'm going to take another look at the OC source. ---------------------------------------------------------------- OK, now I see the differences. Maybe you can distribute a GLOBAL var-patch. ---------------------------------------------------------------- Subject: Support for 'CANCEL ALL' (ACU) If I use [code]CANCEL ALL[/code] OC says [quote]Error: syntax error, unexpected ALL[/quote] CANCEL ALL cancels all programs that have been called and left with GOBACK or EXIT PROGRAM. Is there a way how to do that in OC? ---------------------------------------------------------------- Subject: OC 1.1 no compiler warning given on comp-5 usage on field with edit mask I am helping with user documentation and I found a small inconsistency within the compiler. [code] 01 dfield pic zzz,zz9.99 comp-5 value zero. [/code] Of course doesn't work because edit fields need to be display usage. You should get a warning during the compile as you do using comp or comp-4. The other usages correctly give errors. [code] 01 dfield pic zzz,zz9.99 comp value zero. $ cobc -x -free doctest.cob doctest.cob:13: Warning: 'dfield' not numeric item [/code] ---------------------------------------------------------------- Actually, on any sort of binary or packed field it must be an error not a warning. Fixed in current 1.1 tarball. Roger ---------------------------------------------------------------- Subject: Online Meeting Sunday October 12 As aoirthoir posted in the thread add CMS to Cobol, there is an online meeting on Sunday October 12 at 9:00 USA Eastern Time which is UTC - 4. This is 14:00 (2 PM) UK time (UTC + 1) and 15:00 (3 PM) Central European time (UTC + 2). No software is necessary other than a browser :-) To get a large chat window in your browser enter - [code] http://www.add1tocobol.com/i_o_control_big.php [/code] No registration is necessary; fire it up and go (A meaningful nickname is useful). After the posted agenda, we are free to discuss general topics. Hope to hear from you (Or just sit back and watch). Roger ---------------------------------------------------------------- Subject: for the OC faq Some rudimentary pic strings & inspect examples. [code] >>source format is free *>********************************************************************* *> Author: jrls (John Ellis) *> Date: Oct-2008 *> Purpose: formated output examples using pic strings. *>********************************************************************* identification division. program-id. picstring. data division. working-storage section. *> 01 header. 05 f pic xxx value "ln". 05 f pic x(11) value " disp1". 05 f pic x(11) value " disp2". 05 f pic x(11) value " disp3". 05 f pic x(11) value " disp4". 05 f pic x(12) value " disp5". 05 f pic x(9) value " an1". 05 f pic x(14) value " phone". 05 f pic x(10) value " date". *> 01 headerLines pic x(90) value all "-". *> 01 displayformats. 05 linenum pic 99 value 1. 05 disp1 pic zzz,zz9.99 value zero. 05 f pic x value spaces. 05 disp2 pic $zz,zz9.99 value zero. 05 f pic x value spaces. 05 disp3 pic ---,--9.99 value zero. 05 f pic x value spaces. 05 disp4 pic $-z,zz9.99 value zero. 05 f pic x value spaces. 05 disp5 pic -zz,zz9.zz- blank zero value zero. 05 f pic x value spaces. *><*an1 is actually a string field because of the embedded blanks, thus you put value spaces. 05 an1 pic 99b99b99 value spaces. 05 f pic x value spaces. 05 phone pic bxxxbxxxbxxxx value spaces. 05 f pic x value spaces. 05 dispdate pic 99/99/9999 value zero. *> procedure division. 0000-start. *> display headerLines. display header. display headerLines. *><**************************************************** move 220.22 to disp1, disp2. move -220.22 to disp3, disp4, disp5. inspect disp5 replacing first "-" by "(", first "-" by ")". move 10122008 to dispdate. *><**************************************************** *><*Please note the results of moving 'abcd' to an1. *><*an1 will show up as 00 00 00 because alpha data was *><*moved into instead of numeric data. *><* *><*The phone field will display " abc def ghij" because *><*'b' in the pic string. *><**************************************************** move "abcd" to an1. move "abcdefghij" to phone. display displayformats. add 1 to linenum. move zero to disp4, disp5. *><**************************************************** *><*Here after moving data to an1 and phone, I use the *><*inspect statement to replace the blanks. *><**************************************************** move "123456" to an1. move "5555551234" to phone. inspect an1 replacing all " " by "-". inspect phone replacing first " " by "(", first " " by ")", first " " by "-". display displayformats. inspect phone converting "23456789" to "adgjmptw". display phone. perform 0010-endProgram. *> 0010-endProgram. stop run. *> output ------------------------------------------------------------------------------------------ ln disp1 disp2 disp3 disp4 disp5 an1 phone date ------------------------------------------------------------------------------------------ 01 220.22 $220.22 -220.22 $-220.22 (220.22) 00 00 00 abc def ghij 10/12/2008 02 220.22 $220.22 -220.22 $ 0.00 12-34-56 (555)555-1234 10/12/2008 (jjj)jjj-1adg [/code] take care john ---------------------------------------------------------------- Nice example. Note that if you compile with "-Wall", then the alpha to numeric move is picked up - [code] picstring.cob:15: Warning: Redefinition of 'f' picstring.cob:14: Warning: 'f' previously defined here picstring.cob:16: Warning: Redefinition of 'f' picstring.cob:14: Warning: 'f' previously defined here picstring.cob:17: Warning: Redefinition of 'f' picstring.cob:14: Warning: 'f' previously defined here picstring.cob:18: Warning: Redefinition of 'f' picstring.cob:14: Warning: 'f' previously defined here picstring.cob:19: Warning: Redefinition of 'f' picstring.cob:14: Warning: 'f' previously defined here picstring.cob:20: Warning: Redefinition of 'f' picstring.cob:14: Warning: 'f' previously defined here picstring.cob:21: Warning: Redefinition of 'f' picstring.cob:14: Warning: 'f' previously defined here picstring.cob:22: Warning: Redefinition of 'f' picstring.cob:14: Warning: 'f' previously defined here picstring.cob:31: Warning: Redefinition of 'f' picstring.cob:29: Warning: 'f' previously defined here picstring.cob:33: Warning: Redefinition of 'f' picstring.cob:29: Warning: 'f' previously defined here picstring.cob:35: Warning: Redefinition of 'f' picstring.cob:29: Warning: 'f' previously defined here picstring.cob:37: Warning: Redefinition of 'f' picstring.cob:29: Warning: 'f' previously defined here picstring.cob:40: Warning: Redefinition of 'f' picstring.cob:29: Warning: 'f' previously defined here picstring.cob:42: Warning: Redefinition of 'f' picstring.cob:29: Warning: 'f' previously defined here picstring.cob: In paragraph '0000-start': picstring.cob:70: Warning: Numeric value is expected picstring.cob:39: Warning: 'an1' defined here as PIC 99B99B99 picstring.cob:82: Warning: Numeric value is expected picstring.cob:39: Warning: 'an1' defined here as PIC 99B99B99 [/code] You can also replace all occurrences of the field name "f" with nothing to get rid of the redefinition warnings. ie. [code] 01 header. 05 pic xxx value "ln". 05 pic x(11) value " disp1". 05 pic x(11) value " disp2". 05 pic x(11) value " disp3". 05 pic x(11) value " disp4". 05 pic x(12) value " disp5". 05 pic x(9) value " an1". 05 pic x(14) value " phone". 05 pic x(10) value " date". *> 01 headerLines pic x(90) value all "-". *> 01 displayformats. 05 linenum pic 99 value 1. 05 disp1 pic zzz,zz9.99 value zero. 05 pic x value spaces. 05 disp2 pic $zz,zz9.99 value zero. 05 pic x value spaces. 05 disp3 pic ---,--9.99 value zero. 05 pic x value spaces. 05 disp4 pic $-z,zz9.99 value zero. 05 pic x value spaces. 05 disp5 pic -zz,zz9.zz- blank zero value zero. 05 pic x value spaces. *><*an1 is actually a string field because of the embedded blanks, thus you put value spaces. 05 an1 pic 99b99b99 value spaces. 05 pic x value spaces. 05 phone pic bxxxbxxxbxxxx value spaces. 05 pic x value spaces. 05 dispdate pic 99/99/9999 value zero. [/code] Roger ---------------------------------------------------------------- Added to the FAQ. Added to the yet to be exposed samples bundle as well. Thanks John (with Roger's suggestions merged in). Cheers, Brian ---------------------------------------------------------------- [quote] simrw wrote: [...]You can also replace all occurrences of the field name "f" with nothing to get rid of the redefinition warnings. ie. [code] 01 header. 05 pic xxx value "ln". 05 pic x(11) value " disp1". 05 pic x(11) value " disp2". 05 pic x(11) value " disp3". 05 pic x(11) value " disp4". 05 pic x(12) value " disp5". 05 pic x(9) value " an1". 05 pic x(14) value " phone". 05 pic x(10) value " date". *> 01 headerLines pic x(90) value all "-". *> 01 displayformats. 05 linenum pic 99 value 1. 05 disp1 pic zzz,zz9.99 value zero. 05 pic x value spaces. 05 disp2 pic $zz,zz9.99 value zero. 05 pic x value spaces. 05 disp3 pic ---,--9.99 value zero. 05 pic x value spaces. 05 disp4 pic $-z,zz9.99 value zero. 05 pic x value spaces. 05 disp5 pic -zz,zz9.zz- blank zero value zero. 05 pic x value spaces. *><*an1 is actually a string field because of the embedded blanks, thus you put value spaces. 05 an1 pic 99b99b99 value spaces. 05 pic x value spaces. 05 phone pic bxxxbxxxbxxxx value spaces. 05 pic x value spaces. 05 dispdate pic 99/99/9999 value zero. [/code] Roger[/quote]This looks a little bit weird to me. Why not using the reserved word "filler" as it's supposed to be used? [code] 01 header. 05 filler pic xxx value "ln". 05 filler pic x(11) value " disp1". 05 filler pic x(11) value " disp2". 05 filler pic x(11) value " disp3". 05 filler pic x(11) value " disp4". 05 filler pic x(12) value " disp5". 05 filler pic x(9) value " an1". 05 filler pic x(14) value " phone". 05 filler pic x(10) value " date". *> 01 headerLines pic x(90) value all "-". *> 01 displayformats. 05 linenum pic 99 value 1. 05 disp1 pic zzz,zz9.99 value zero. 05 filler pic x value spaces. 05 disp2 pic $zz,zz9.99 value zero. 05 filler pic x value spaces. 05 disp3 pic ---,--9.99 value zero. 05 filler pic x value spaces. 05 disp4 pic $-z,zz9.99 value zero. 05 filler pic x value spaces. 05 disp5 pic -zz,zz9.zz- blank zero value zero. 05 pic x value spaces. *><*an1 is actually a string field because of the embedded blanks, thus you put value spaces. 05 an1 pic 99b99b99 value spaces. 05 filler pic x value spaces. 05 phone pic bxxxbxxxbxxxx value spaces. 05 filler pic x value spaces. 05 dispdate pic 99/99/9999 value zero. [/code] For an example it could be useful to show the line extension and using of constants like [code] 78 header value " ln disp1 disp2 disp3 disp4 disp5 - " an1 phone date ". [/code] Be sure to start at line 7/8/12 in the FAQ, if your examples should be usable in FIXED format, too. Is there also a line extension sign like the "-" in FREE format available? ---------------------------------------------------------------- > This looks a little bit weird to me. Why not using the reserved word "filler" as it's supposed to be used? Matter of personal preference. Do whatever you feel comfortable with. There is actually a line extension sequence defined in the standard for FREE (also applies to FIXED). Not yet implemented in OC. However, remember that with FREE you can (currently) have lines up to 255 characters. Plus you can do literal concatenation eg. [code] 78 header value "ln" & " disp1 " & " disp2 " & " disp3 " & " disp4 " & " disp5 " & " an1 " & " phone " & " date". [/code] Note that concatenation can be done in FIXED mode as well. Roger ---------------------------------------------------------------- Human, The standard allows that FILLER is optional now. If no varname is provided, then FILLER is assumed. I am debating back and forth on this, because without FILLER it kind of looks cleaner. However, for a search, we are left out in the cold without use of filler. So I think I am leaning towards preferring it. ---------------------------------------------------------------- [quote]simrw wrote: [...]There is actually a line extension sequence defined in the standard for FREE (also applies to FIXED). Not yet implemented in OC. However, remember that with FREE you can (currently) have lines up to 255 characters.[...][/quote] What do you mean with "Not yet implemented in OC.", what is not implemented yet? My COBOL book says that there us another possibility about writing literals in different lines (FREE format only): [code]78 header value "ln"- " disp1 "- " disp2 "- " disp3 "- " disp4 "- " disp5 "- " an1 "- " phone "- " date". [/code] According to the book it is only important that the literal ends with "- or '-. I think examples are best if they can be compiled in every format (if possible without ">>SOURCE FORMAT IS FREE" directive), so what is possible to do here with ANSI85 (fixed) and 2002 (free)? ---------------------------------------------------------------- Subject: October 19th Meeting Agenda... & Logs Please add your desires for the next meeting here. http://www.add1tocobol.com/chatlogs/2008-10-19.html ---------------------------------------------------------------- 1) Critical Path Analysis for the road to OpenCOBOL 1.1 Where can we best support Roger, or at the least, where to get out of the way. 2) Can we include cobcurses 0.95 in or along with the official distribution? Cheers, Brian Edit; Item 2 added ---------------------------------------------------------------- Status (as I see what happened today): We glossed over the Critical Path Analysis, item will remain open. aoirthoir has started to open up SVN access on add1tocobol.com for interested OpenCOBOL developers. Rough repository map plan posted to pastebin, and the link can be provided to interested parties. Along with docs, we'll be planning to store development sources for extensions that include CGI copybooks and web templates libCURL libDBI SQLite (in a form that emulates the sqlite> shell) SpiderMonkey javascript (no dom - core classes) A port of Rildo's TinyCOBOL Tcl/Tk wrapper tkhtml widget wrapper for an OpenCOBOL controlled browser A cob_perl interface CobXREF POSIX Message Queues gnuplot script calling templates more...lots and lots more ;) All of these extensions will strive (and can be rejected outright by the development community for failing) to meet or exceed current OpenCOBOL 1.1, and Warren's CobCurses package, quality control standards. This includes proper integration to existant [i]configure[/i] and [i]make[/i] standards. Including [i]make test[/i]. Along with A suite of porting utilities that will assist developers moving large chunks of source code from other compilers. And potentially a digitally signed repository along with MD5 digests for storage of trusted pre-built OC 1.1 binary packages. *** Joseph has also started to dig into legacy opencobol.org forum posts. After dissemination, key information will be moved to the docs. Seeing as Software Freedom Day fast approaches, the add1 team will be busied out over the next 10 days or so. Foundations are started, but rough framing will occur through November. That is my version of today's IRC meetup anyway. Chat log link will be posted soon I imagine. Noted that as the world's fiscals fluctuate downwards, now is a good time to advocate OpenCOBOL to small / medium (or big) business. Cheers, Brian ---------------------------------------------------------------- Everyone, Btiffin (Brian) is spot on about the meeting today. The link for the chat log is: http://www.add1tocobol.com/chatlogs/2008-10-19.html I posted it in the first post of this thread as well, so folks can find it right away. I am busy wrapping up http://www.softwarefreedomday-cleveland.org/ and so I have a LOT to do this week. Once that is settled, then next week I can begin in force. I will be here for next Sunday's meeting as well. But will have to move through it quickly like we did this week. Additionally, once the SFD-CLE 2008 event is finished, I will be setting up user accounts on dreamhost for folks to start testing themselves. If someone wants acccess to the SVN please let me know. I do ask everyone to respect everyone else's directories and projects. ONLY create directories under projectname/branch/YOURSIGNON if it is not your project. This week I will have a brief faq up explaining how to use the structure that we have created. I am hoping that everyone already knows SVN. If you do not, I can give you free materials, and a play area if needed, outside of the official SVN just to make sure you have time to practice.l Regards ---------------------------------------------------------------- Subject: OpenCOBOL SQLite in need of testers Hello, I've modified the shell.c program that implements the sqlite3> interactive command mode for use with OpenCOBOL. http://opencobol.add1tocobol.com/ocshell.c http://opencobol.add1tocobol.com/sqlscreen.cob http://opencobol.add1tocobol.com/sqlscreen.html Requires sqlite3 and libsqlite3-dev packages under Debian [code] $ cobc -c ocshell.c $ cobc -x -lsqlite3 sqlscreen.cob ocshell.o [/code] After creating test.db if needed and playing about with some tests and inserts, sqlscreen should display 4 screens from 4 records (the result of a single query). On a test ISP host, the SQLite core functions don't seem to be compiled in, and the load extension is disabled. (This is all good for security I imagine) I was wondering if anyone could tell me if their version of sqlite3 supports randomblob() and/or julianday() functions? Any opinions on how low chasing "lowest common denominator" should go with demos like this one? [code] $ cobc -c -DSQLITE_OMIT_LOAD_EXTENSION ocshell.c [/code]will be required for installs that don't have load. [code] $ cobc -x -fdebugging-line -lsqlite3 sqlscreen.cob ocshell.o [/code]can also be used to turn on a few more examples in the demo run. And I'd like to ask if anyone feels like mucking about with the new engine before I pump out a beta. Cheers, Brian ---------------------------------------------------------------- Hello Brian, I tried. [code] cobc -x -lsqlite3 sqlscreen.cob ocshell.o[/code] sqlite3 -version 3.3.8 in use cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2008 Keisuke Nishida / Roger While Built Oct 11 2008 20:16:19 Packaged Oct 11 2008 14:18:55 CEST result of ./sqlscreen : [code]Erreur de segmentation[/code] That means segmentation error ;-) Regards ---------------------------------------------------------------- Yeah, Roger is trying to help me out with a mixed-language PROCEDURE DIVISION [b]USING var BY VALUE[/b] issue. These work with OpenCOBOL to OpenCOBOL, but when C wants to make a [b]callback[/b] that includes raw integers, there is a technically hairy stack frame issue. Work progresses but this feature is in development. So, grab this OC1.1 build. It's better for this alpha. cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2008 Keisuke Nishida / Roger While Built Oct 13 2008 12:34:38 Packaged Oct 13 2008 07:48:43 CEST Thanks for trying it out Bear. I'd like to think it will be worth the bleeding edge efforts. ;) Cheers, Brian ---------------------------------------------------------------- Hello btiffin, Big problem whit this line: set callback-proc to entry "callback" Obtain this message: o@o-desktop:~/cobol$ cobc -x -fdebugging-line -lsqlite3 sqlscreen.cob ocshell.o sqlscreen.cob: In paragraph 'ocsql-exec': sqlscreen.cob:297: Error: syntax error, unexpected ENTRY Thanks for your works on OC and SQLite very interesting Cordialement. ---------------------------------------------------------------- I'm going to install OC1.1, instead of OC1.0 and I think it will be better A+ ---------------------------------------------------------------- Thanks oliv. :-) Yes, I rarely use OpenCOBOL 1.0. OC 1.1 has a lot of features that I rely on. You've made me realize that I'll have to advertise that fact as part of the requirements. AND; there is now a libDBI Database abstraction layer released by jrls_swla. He's been testing against MySQL, but DBI also supports drivers for Postgres, FireBird, as well as SQLite. So the game is definitely afoot. AND; I'm hoping that after today's IRC meeting, we'll be announcing a new community developer and OpenCOBOL advocacy site to the world at large. With the important caveat, that it'll be an auxiliary site, with opencobol.org still very much the front line. Cheers, Brian ---------------------------------------------------------------- Subject: How to update an existing version of OC If you have already an OC installation on your machine and want to update it (for example because you have got a more recent pre-release with [url=http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=285&forum=1]occurlrefresh[/url]) you can either do [code]make clean ./configure make make install[/code] or just do [code]./configure make make install[/code] Which solution is better? Is there a possibility (and would this be usefull) to do [code] ./configure make update[/code] in some later version? ---------------------------------------------------------------- human; I can't speak to [i]make update[/i] but I have noticed one thing. My normal mode of operation is [code] ~/build$ ./occurlrefresh ~/build$ tar xvf open-cobol-1.1.tar.gz ~/build$ cd open-cobol-1.1 ~/build/open-cobol-1.1$ ./configure ~/build/open-cobol-1.1$ make ~/build/open-cobol-1.1$ make check ~/build/open-cobol-1.1$ cd tests/cobol85 ~/build/open-cobol-1.1/tests/cobol85$ make test ~/build/open-cobol-1.1/tests/cobol85$ cd ../.. ~/build/open-cobol-1.1$ su /home/brian/build/open-cobol-1.1# make install /home/brian/build/open-cobol-1.1# exit [/code] I every once in a while do a [i]make dist-clean[/i] before the ./configure, but that has the side effect of removing the COBOL85 test report summary files. (You need to have done a [i]make install[/i] for those files to be placed in the correct sub-dirs.) It seems a little strange to have had to do an install before verification of the NIST test suite. (But I can see the reasoning) So, without the [i]clean[/i], you can snag an update tarball and verify the NIST tests before the install. With the clean, the NIST tests have to wait until after an install (or manual copy of a few .txt files and a perl script) Cheers, Brian ---------------------------------------------------------------- Subject: Install on Solaris 10 SPARC - GMP 3 required... Hi, First, sorry my poor English. I trying install the opencobol 1.1 on the Solaris 10 SPARC. The packages [b]gmp-4.2.1-sol10-sparc-local[/b] and [b]libtool-1.5.24-sol10-sparc-local[/b] already instaled (downloaded from www.sunfreeware.com): [code] SunOS.000sv022 root:/dados/open-cobol-1.1# pkginfo | grep gmp application SMCgmp gmp SunOS.000sv022 root:/dados/open-cobol-1.1# pkginfo | grep libtool application SMClibt libtool [/code] But when I run the ./configure , it stop with this error: [code] checking getopt.h presence... yes checking for getopt.h... yes checking gmp.h usability... yes checking gmp.h presence... yes checking for gmp.h... yes checking for __gmp_randinit in -lgmp... no configure: error: GMP 3 or later is required [/code] Looking for this error on the forum, found only old messages about this situation, but none solution.... I don't know what more information I can put here to get help, so , if need more information, just said to me... Thanks Cesar Inacio Martins ---------------------------------------------------------------- Sorry guys, 1 minute after post the topic I found the (simple and stupid) solution.... Before the post I take a look on the config.log and not see anything wrong... maybe got a temporary blindness . Looking again I found this message: [code] configure:21977: result: yes configure:21995: checking for __gmp_randinit in -lgmp configure:22025: gcc -o conftest -g -O2 conftest.c -lgmp >&5 ld: fatal: library -lgmp: not found ld: fatal: File processing errors. No output written to conftest collect2: ld returned 1 exit status configure:22031: $? = 1 [/code] So, I just set the LD_LIBRARY_PATH and pass this step sussefully! ---------------------------------------------------------------- Subject: How to use BASED/ALLOCATE/FREE (save Memory) With OC, according to COBOL 2002 it is possible to do:[code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. 'MEMALL'. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. * WORKING-STORAGE SECTION. * 77 mychar pic x. 01 REC-TEST BASED. 03 REC-TEST-PART1 PIC X(5500000) value all 'A'. 03 REC-TEST-PART2 PIC X(0100000). 03 REC-TEST-PART3 PIC X(1200000). 03 REC-TEST-PART4 PIC X(1200000). 03 REC-TEST-PART5 PIC X(1700000). *----------------------------------------------------------------- LINKAGE SECTION. *----------------------------------------------------------------- PROCEDURE DIVISION. declaratives. end declaratives. *----------------------------------------------------------------- main section. 00. FREE ADDRESS OF REC-TEST display 'MEMALL loaded and REC-TEST FREEd before ALLOCATE' accept mychar * IF ADDRESS OF REC-TEST = NULL display 'REC-TEST was not allocated before' ELSE display 'REC-TEST was allocated before' END-IF accept mychar * * Test for segmentation fault: D move 2 to mynumeric D accept mychar (mynumeric:1) D move 'test' to REC-TEST D display 'MEMALL loaded and REC-TEST used before ALLOCATE' D accept mychar * ALLOCATE REC-TEST display 'REC-TEST allocated, filled with ' REC-TEST (1:9) end-display accept mychar * initialize REC-TEST all to value display 'REC-TEST initalized all to value, filled with ' REC-TEST (1:9) end-display accept mychar * ALLOCATE REC-TEST move all 'B' to REC-TEST display 'REC-TEST allocated again and filled with ' REC-TEST (1:9) end-display accept mychar * IF ADDRESS OF REC-TEST = NULL display 'REC-TEST was not allocated before' ALLOCATE REC-TEST display 'REC-TEST allocated again, filled with ' REC-TEST (1:9) end-display ELSE display 'REC-TEST was allocated before' END-IF accept mychar * * FREE ADDRESS OF REC-TEST display 'REC-TEST FREEd' accept mychar * stop run * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program MEMALL --------------------------------------- [/code] As you can see with taskmanager/top/... the memory needed goes up and down. This works on UNIX and even on WINDOWS! As you can see, too, you should be sure, that the memory was not allocated before, cause on every time you allocate memory it is initialized again. You can do this by coding [code]IF ADDRESS OF REC-TEST = NULL[/code] Also have a look at the possibility to use value in BASED items, too. I can be done by [code]INITIALIZE REC-TEST ALL VALUE[/code] ---------------------------------------------------------------- human; I just included this snippet in the FAQ. ;) I always like to ask permission, but I got keen. Keen enough to know that I may have to undo some typing if you don't want it included in the ocfaq. S'okay? Cheers, Brian ---------------------------------------------------------------- I herewith allow you to use every code snipped posted by me in this forum for the OC-FAQ (mentioned were it is from would be nice, maybe with a foot note [so that all supporters are mentioned just once]). There was a mistake in FAQ-Entry for ALLOCATE: You could use it with or without INITIALIZED, with or without RETURNING pointer var. So it would be better to write[code]ALLOCATE based-var [INITIALIZED] [RETURNING pointer-var][/code] And please: get rid of all not necessary points in your examples. Thank you. ---------------------------------------------------------------- Thanks again; I've been using the ReST Citation markup for credits. It accumulates the names into a sequence kind of like a footnote. Yeah, I originally planned the Reserved Words section as a [i]spelling bee[/i] style section. List the word and then use it in a sample sentence. Some entries are like that, but I'd like to flesh more of them out with actual programs now or to eventually do a complete Backus-Naur for the entire section. Anyway, the spelling bee entries are incomplete and only show one or two example usage lines. I picked word and sentence as when I started it looked fairly overwhelming. That decreases as each entry goes in. Hmm, getting rid of unnecessary points; A conciseness pass is in the plan, but for now I'm kind of treating the FAQ as an information garbage can. Everything gets thrown in. Good advice human. Cheers, Brian ---------------------------------------------------------------- Also note the alternate form of ALLOCATE - [code] ALLOCATE arithmetic-expression CHARACTERS [INITIALIZED] RETURNING data-pointer. [/code] Which allows arbitrary use outside of BASED items. Roger ---------------------------------------------------------------- Can you please give a sample what you mean? ---------------------------------------------------------------- Sure - [code] IDENTIFICATION DIVISION. PROGRAM-ID. ac8. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DATA DIVISION. WORKING-STORAGE SECTION. 01 MYPTR USAGE POINTER. LINKAGE SECTION. 01 NOTALLOCED PIC X(64). PROCEDURE DIVISION. AA-MAIN SECTION. A00. ALLOCATE FUNCTION LENGTH (NOTALLOCED) CHARACTERS RETURNING MYPTR. SET ADDRESS OF NOTALLOCED TO MYPTR. MOVE "ABCD" TO NOTALLOCED. DISPLAY NOTALLOCED. GOBACK. [/code] Roger ---------------------------------------------------------------- OK. You pass something via LINKAGE SECTION and do not use USING the var in PROCEDURE DEVISION. Then you ALLOCATE the var. Why should one use this (Memory of LINKAGE items is used from the program, that called ac8, isn't it)? ---------------------------------------------------------------- No, you misunderstand. The example works fine as a "main" program. LINKAGE items that are NOT referenced in the PROCEDURE DIVISION USING clause do not have any storage (ie. address) associated with them and, similar to BASED, must have an address assigned to them before use. It is irrelevant whether or not this is a "main" program. Think of this as an alternative to BASED. Roger ---------------------------------------------------------------- Added Segmentation fault and possibility for using VALUE in BASED items. ---------------------------------------------------------------- Subject: error, trying compiling opencobol on Solaris. Hi, I'm trying install the opencobol 1.1 on Solaris 10 SPARC. The command "./configure" execute sussefully and finish with this output: [code] ... config.status: executing depfiles commands config.status: executing default-1 commands config.status: creating po/POTFILES config.status: creating po/Makefile OpenCOBOL Configuration: CC gcc COB_CC gcc CFLAGS -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k COB_CFLAGS -I/usr/local/include COB_EXTRA_FLAGS LDFLAGS COB_LDFLAGS COB_LIBS -L${exec_prefix}/lib -lcob -lm -lgmp -lncurses -ldb-4.2 COB_CONFIG_DIR ${prefix}/share/open-cobol/config COB_COPY_DIR ${prefix}/share/open-cobol/copy COB_LIBRARY_PATH .:${exec_prefix}/lib/open-cobol COB_MODULE_EXT so COB_SHARED_OPT -shared COB_PIC_FLAGS -fPIC -DPIC COB_EXPORT_DYN Dynamic loading System Use gettext for international messages: no Use Berkeley DB for file I/O: yes Use enhanced Berkeley DB (>= 4.1) no Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: yes [/code] When the make are executed, a compiling error occur on the file [b]fileio.c[/b] : [code] SunOS.000sv022 root:/dados/open-cobol-1.1# make make all-recursive Making all in lib if gcc -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT dummymac.o -MD -MP -MF ".deps/dummymac.Tpo" -c -o dummymac.o dummymac.c; \ then mv -f ".deps/dummymac.Tpo" ".deps/dummymac.Po"; else rm -f ".deps/dummymac.Tpo"; exit 1; fi rm -f libsupport.a ar cru libsupport.a dummymac.o ranlib libsupport.a Making all in libcob if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF ".deps/libcob_la-common.Tpo" -c -o libcob_la-common.lo `test -f 'common.c' || echo './'`common.c; \ then mv -f ".deps/libcob_la-common.Tpo" ".deps/libcob_la-common.Plo"; else rm -f ".deps/libcob_la-common.Tpo"; exit 1; fi mkdir .libs gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF .deps/libcob_la-common.Tpo -c common.c -fPIC -DPIC -o .libs/libcob_la-common.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF .deps/libcob_la-common.Tpo -c common.c -o libcob_la-common.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF ".deps/libcob_la-call.Tpo" -c -o libcob_la-call.lo `test -f 'call.c' || echo './'`call.c; \ then mv -f ".deps/libcob_la-call.Tpo" ".deps/libcob_la-call.Plo"; else rm -f ".deps/libcob_la-call.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF .deps/libcob_la-call.Tpo -c call.c -fPIC -DPIC -o .libs/libcob_la-call.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF .deps/libcob_la-call.Tpo -c call.c -o libcob_la-call.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF ".deps/libcob_la-strings.Tpo" -c -o libcob_la-strings.lo `test -f 'strings.c' || echo './'`strings.c; \ then mv -f ".deps/libcob_la-strings.Tpo" ".deps/libcob_la-strings.Plo"; else rm -f ".deps/libcob_la-strings.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF .deps/libcob_la-strings.Tpo -c strings.c -fPIC -DPIC -o .libs/libcob_la-strings.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF .deps/libcob_la-strings.Tpo -c strings.c -o libcob_la-strings.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-move.lo -MD -MP -MF ".deps/libcob_la-move.Tpo" -c -o libcob_la-move.lo `test -f 'move.c' || echo './'`move.c; \ then mv -f ".deps/libcob_la-move.Tpo" ".deps/libcob_la-move.Plo"; else rm -f ".deps/libcob_la-move.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-move.lo -MD -MP -MF .deps/libcob_la-move.Tpo -c move.c -fPIC -DPIC -o .libs/libcob_la-move.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-move.lo -MD -MP -MF .deps/libcob_la-move.Tpo -c move.c -o libcob_la-move.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF ".deps/libcob_la-numeric.Tpo" -c -o libcob_la-numeric.lo `test -f 'numeric.c' || echo './'`numeric.c; \ then mv -f ".deps/libcob_la-numeric.Tpo" ".deps/libcob_la-numeric.Plo"; else rm -f ".deps/libcob_la-numeric.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF .deps/libcob_la-numeric.Tpo -c numeric.c -fPIC -DPIC -o .libs/libcob_la-numeric.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF .deps/libcob_la-numeric.Tpo -c numeric.c -o libcob_la-numeric.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic.lo -MD -MP -MF ".deps/libcob_la-intrinsic.Tpo" -c -o libcob_la-intrinsic.lo `test -f 'intrinsic.c' || echo './'`intrinsic.c; \ then mv -f ".deps/libcob_la-intrinsic.Tpo" ".deps/libcob_la-intrinsic.Plo"; else rm -f ".deps/libcob_la-intrinsic.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic.lo -MD -MP -MF .deps/libcob_la-intrinsic.Tpo -c intrinsic.c -fPIC -DPIC -o .libs/libcob_la-intrinsic.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic.lo -MD -MP -MF .deps/libcob_la-intrinsic.Tpo -c intrinsic.c -o libcob_la-intrinsic.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF ".deps/libcob_la-fileio.Tpo" -c -o libcob_la-fileio.lo `test -f 'fileio.c' || echo './'`fileio.c; \ then mv -f ".deps/libcob_la-fileio.Tpo" ".deps/libcob_la-fileio.Plo"; else rm -f ".deps/libcob_la-fileio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF .deps/libcob_la-fileio.Tpo -c fileio.c -fPIC -DPIC -o .libs/libcob_la-fileio.o fileio.c:310: error: syntax error before "DB" fileio.c:310: warning: no semicolon at end of struct or union fileio.c:311: warning: type defaults to `int' in declaration of `key' fileio.c:311: warning: data definition has no type or storage class fileio.c:312: error: syntax error before "data" fileio.c:312: warning: type defaults to `int' in declaration of `data' fileio.c:312: warning: data definition has no type or storage class fileio.c:326: error: syntax error before '}' token fileio.c: In function `cob_sync': fileio.c:637: error: dereferencing pointer to incomplete type fileio.c:638: error: dereferencing pointer to incomplete type fileio.c:638: error: dereferencing pointer to incomplete type fileio.c:643: error: dereferencing pointer to incomplete type fileio.c:647: error: dereferencing pointer to incomplete type fileio.c:647: error: dereferencing pointer to incomplete type fileio.c: In function `indexed_open': fileio.c:1905: error: invalid application of `sizeof' to incomplete type `indexed_file' fileio.c:1954: error: dereferencing pointer to incomplete type fileio.c:1954: error: `DB' undeclared (first use in this function) fileio.c:1954: error: (Each undeclared identifier is reported only once fileio.c:1954: error: for each function it appears in.) fileio.c:1954: error: syntax error before ')' token fileio.c:1959: error: dereferencing pointer to incomplete type fileio.c:1960: error: dereferencing pointer to incomplete type fileio.c:1961: error: dereferencing pointer to incomplete type fileio.c:1970: error: `BTREEINFO' undeclared (first use in this function) fileio.c:1970: error: syntax error before "info" fileio.c:2003: error: `info' undeclared (first use in this function) fileio.c:2005: error: `R_DUP' undeclared (first use in this function) fileio.c:2016: error: dereferencing pointer to incomplete type fileio.c:2016: warning: implicit declaration of function `dbopen' fileio.c:2016: error: `DB_BTREE' undeclared (first use in this function) fileio.c:2017: error: dereferencing pointer to incomplete type fileio.c:2023: error: dereferencing pointer to incomplete type fileio.c:2023: error: dereferencing pointer to incomplete type fileio.c:2030: error: dereferencing pointer to incomplete type fileio.c:2031: error: dereferencing pointer to incomplete type fileio.c:2032: error: dereferencing pointer to incomplete type fileio.c:2044: error: dereferencing pointer to incomplete type fileio.c:2045: error: dereferencing pointer to incomplete type fileio.c:2048: error: dereferencing pointer to incomplete type fileio.c:2050: error: dereferencing pointer to incomplete type fileio.c:2051: error: dereferencing pointer to incomplete type fileio.c:2053: error: dereferencing pointer to incomplete type fileio.c:2053: error: `DBT' undeclared (first use in this function) fileio.c:2054: error: dereferencing pointer to incomplete type fileio.c:2070: error: dereferencing pointer to incomplete type fileio.c:2070: error: dereferencing pointer to incomplete type fileio.c:2070: error: dereferencing pointer to incomplete type fileio.c:2070: error: dereferencing pointer to incomplete type fileio.c:2070: error: dereferencing pointer to incomplete type fileio.c:2070: error: dereferencing pointer to incomplete type fileio.c:2070: error: `R_FIRST' undeclared (first use in this function) fileio.c:2073: error: dereferencing pointer to incomplete type fileio.c:2073: error: dereferencing pointer to incomplete type fileio.c:2073: error: dereferencing pointer to incomplete type fileio.c:2075: error: dereferencing pointer to incomplete type fileio.c: In function `indexed_close': fileio.c:2119: error: dereferencing pointer to incomplete type fileio.c:2120: error: dereferencing pointer to incomplete type fileio.c:2120: error: dereferencing pointer to incomplete type fileio.c:2122: error: dereferencing pointer to incomplete type fileio.c:2123: error: dereferencing pointer to incomplete type fileio.c:2126: error: dereferencing pointer to incomplete type fileio.c:2127: error: dereferencing pointer to incomplete type fileio.c:2129: error: dereferencing pointer to incomplete type fileio.c:2130: error: dereferencing pointer to incomplete type fileio.c:2131: error: dereferencing pointer to incomplete type fileio.c:2132: error: dereferencing pointer to incomplete type fileio.c:2133: error: dereferencing pointer to incomplete type fileio.c: In function `indexed_start_internal': fileio.c:2159: error: dereferencing pointer to incomplete type fileio.c:2159: error: dereferencing pointer to incomplete type fileio.c:2159: error: dereferencing pointer to incomplete type fileio.c:2160: error: dereferencing pointer to incomplete type fileio.c:2173: error: dereferencing pointer to incomplete type fileio.c:2173: error: dereferencing pointer to incomplete type fileio.c:2182: error: dereferencing pointer to incomplete type fileio.c:2182: error: dereferencing pointer to incomplete type fileio.c:2182: error: dereferencing pointer to incomplete type fileio.c:2182: error: dereferencing pointer to incomplete type fileio.c:2182: error: dereferencing pointer to incomplete type fileio.c:2182: error: dereferencing pointer to incomplete type fileio.c:2182: error: `R_CURSOR' undeclared (first use in this function) fileio.c:2187: error: dereferencing pointer to incomplete type fileio.c:2195: error: dereferencing pointer to incomplete type fileio.c:2195: error: dereferencing pointer to incomplete type fileio.c:2195: error: dereferencing pointer to incomplete type fileio.c:2195: error: dereferencing pointer to incomplete type fileio.c:2195: error: dereferencing pointer to incomplete type fileio.c:2195: error: dereferencing pointer to incomplete type fileio.c:2195: error: `R_LAST' undeclared (first use in this function) fileio.c:2201: error: dereferencing pointer to incomplete type fileio.c:2201: error: dereferencing pointer to incomplete type fileio.c:2201: error: dereferencing pointer to incomplete type fileio.c:2201: error: dereferencing pointer to incomplete type fileio.c:2201: error: dereferencing pointer to incomplete type fileio.c:2201: error: dereferencing pointer to incomplete type fileio.c:2201: error: `R_PREV' undeclared (first use in this function) fileio.c:2210: error: dereferencing pointer to incomplete type fileio.c:2210: error: dereferencing pointer to incomplete type fileio.c:2210: error: dereferencing pointer to incomplete type fileio.c:2210: error: dereferencing pointer to incomplete type fileio.c:2210: error: dereferencing pointer to incomplete type fileio.c:2210: error: dereferencing pointer to incomplete type fileio.c:2212: error: dereferencing pointer to incomplete type fileio.c:2216: error: dereferencing pointer to incomplete type fileio.c:2216: error: dereferencing pointer to incomplete type fileio.c:2216: error: dereferencing pointer to incomplete type fileio.c:2216: error: dereferencing pointer to incomplete type fileio.c:2216: error: dereferencing pointer to incomplete type fileio.c:2216: error: dereferencing pointer to incomplete type fileio.c:2218: error: dereferencing pointer to incomplete type fileio.c:2222: error: dereferencing pointer to incomplete type fileio.c:2223: error: dereferencing pointer to incomplete type fileio.c:2223: error: dereferencing pointer to incomplete type fileio.c:2223: error: dereferencing pointer to incomplete type fileio.c:2223: error: dereferencing pointer to incomplete type fileio.c:2223: error: dereferencing pointer to incomplete type fileio.c:2223: error: dereferencing pointer to incomplete type fileio.c:2223: error: `R_NEXT' undeclared (first use in this function) fileio.c:2230: error: dereferencing pointer to incomplete type fileio.c:2230: error: dereferencing pointer to incomplete type fileio.c:2230: error: dereferencing pointer to incomplete type fileio.c:2230: error: dereferencing pointer to incomplete type fileio.c:2230: error: dereferencing pointer to incomplete type fileio.c:2230: error: dereferencing pointer to incomplete type fileio.c:2236: error: dereferencing pointer to incomplete type fileio.c:2236: error: dereferencing pointer to incomplete type fileio.c:2236: error: dereferencing pointer to incomplete type fileio.c:2236: error: dereferencing pointer to incomplete type fileio.c:2236: error: dereferencing pointer to incomplete type fileio.c:2236: error: dereferencing pointer to incomplete type fileio.c:2242: error: dereferencing pointer to incomplete type fileio.c:2246: error: dereferencing pointer to incomplete type fileio.c:2246: error: dereferencing pointer to incomplete type fileio.c:2246: error: dereferencing pointer to incomplete type fileio.c:2246: error: dereferencing pointer to incomplete type fileio.c:2246: error: dereferencing pointer to incomplete type fileio.c:2246: error: dereferencing pointer to incomplete type fileio.c:2255: error: dereferencing pointer to incomplete type fileio.c:2257: error: dereferencing pointer to incomplete type fileio.c:2257: error: dereferencing pointer to incomplete type fileio.c:2257: error: dereferencing pointer to incomplete type fileio.c:2258: error: dereferencing pointer to incomplete type fileio.c:2259: error: dereferencing pointer to incomplete type fileio.c:2261: error: dereferencing pointer to incomplete type fileio.c:2261: error: dereferencing pointer to incomplete type fileio.c:2262: error: dereferencing pointer to incomplete type fileio.c:2263: error: dereferencing pointer to incomplete type fileio.c:2263: error: dereferencing pointer to incomplete type fileio.c:2263: error: dereferencing pointer to incomplete type fileio.c:2263: error: dereferencing pointer to incomplete type fileio.c:2296: error: dereferencing pointer to incomplete type fileio.c:2297: error: dereferencing pointer to incomplete type fileio.c:2297: error: dereferencing pointer to incomplete type fileio.c:2299: error: dereferencing pointer to incomplete type fileio.c:2299: error: dereferencing pointer to incomplete type fileio.c:2300: error: dereferencing pointer to incomplete type fileio.c:2300: error: dereferencing pointer to incomplete type fileio.c:2301: error: dereferencing pointer to incomplete type fileio.c:2301: error: dereferencing pointer to incomplete type fileio.c:2301: error: dereferencing pointer to incomplete type fileio.c:2302: error: dereferencing pointer to incomplete type fileio.c:2303: error: dereferencing pointer to incomplete type fileio.c:2303: error: dereferencing pointer to incomplete type fileio.c: In function `indexed_read': fileio.c:2540: error: dereferencing pointer to incomplete type fileio.c:2541: error: dereferencing pointer to incomplete type fileio.c:2541: error: dereferencing pointer to incomplete type fileio.c: In function `indexed_read_next': fileio.c:2800: error: `R_NEXT' undeclared (first use in this function) fileio.c:2812: error: `R_LAST' undeclared (first use in this function) fileio.c:2814: error: `R_PREV' undeclared (first use in this function) fileio.c:2817: error: `R_FIRST' undeclared (first use in this function) fileio.c:2829: error: dereferencing pointer to incomplete type fileio.c:2842: error: dereferencing pointer to incomplete type fileio.c:2842: error: dereferencing pointer to incomplete type fileio.c:2843: error: dereferencing pointer to incomplete type fileio.c:2843: error: dereferencing pointer to incomplete type fileio.c:2843: error: dereferencing pointer to incomplete type fileio.c:2847: error: dereferencing pointer to incomplete type fileio.c:2847: error: dereferencing pointer to incomplete type fileio.c:2847: error: dereferencing pointer to incomplete type fileio.c:2847: error: dereferencing pointer to incomplete type fileio.c:2847: error: dereferencing pointer to incomplete type fileio.c:2847: error: dereferencing pointer to incomplete type fileio.c:2849: error: dereferencing pointer to incomplete type fileio.c:2850: error: dereferencing pointer to incomplete type fileio.c:2851: error: dereferencing pointer to incomplete type fileio.c:2853: error: dereferencing pointer to incomplete type fileio.c:2853: error: dereferencing pointer to incomplete type fileio.c:2853: error: dereferencing pointer to incomplete type fileio.c:2853: error: dereferencing pointer to incomplete type fileio.c:2854: error: dereferencing pointer to incomplete type fileio.c:2854: error: dereferencing pointer to incomplete type fileio.c:2858: error: dereferencing pointer to incomplete type fileio.c:2858: error: dereferencing pointer to incomplete type fileio.c:2858: error: dereferencing pointer to incomplete type fileio.c:2858: error: dereferencing pointer to incomplete type fileio.c:2858: error: dereferencing pointer to incomplete type fileio.c:2858: error: dereferencing pointer to incomplete type fileio.c:2860: error: dereferencing pointer to incomplete type fileio.c:2863: error: dereferencing pointer to incomplete type fileio.c:2863: error: dereferencing pointer to incomplete type fileio.c:2863: error: dereferencing pointer to incomplete type fileio.c:2863: error: dereferencing pointer to incomplete type fileio.c:2864: error: dereferencing pointer to incomplete type fileio.c:2864: error: dereferencing pointer to incomplete type fileio.c:2865: error: dereferencing pointer to incomplete type fileio.c:2865: error: dereferencing pointer to incomplete type fileio.c:2865: error: dereferencing pointer to incomplete type fileio.c:2870: error: dereferencing pointer to incomplete type fileio.c:2870: error: dereferencing pointer to incomplete type fileio.c:2870: error: dereferencing pointer to incomplete type fileio.c:2873: error: dereferencing pointer to incomplete type fileio.c:2874: error: dereferencing pointer to incomplete type fileio.c:2874: error: dereferencing pointer to incomplete type fileio.c:2874: error: dereferencing pointer to incomplete type fileio.c:2875: error: dereferencing pointer to incomplete type fileio.c:2875: error: dereferencing pointer to incomplete type fileio.c:2875: error: dereferencing pointer to incomplete type fileio.c:2875: error: dereferencing pointer to incomplete type fileio.c:2912: error: dereferencing pointer to incomplete type fileio.c:2912: error: dereferencing pointer to incomplete type fileio.c:2913: error: dereferencing pointer to incomplete type fileio.c:2913: error: dereferencing pointer to incomplete type fileio.c:2913: error: dereferencing pointer to incomplete type fileio.c:2917: error: dereferencing pointer to incomplete type fileio.c:2917: error: dereferencing pointer to incomplete type fileio.c:2917: error: dereferencing pointer to incomplete type fileio.c:2917: error: dereferencing pointer to incomplete type fileio.c:2917: error: dereferencing pointer to incomplete type fileio.c:2917: error: dereferencing pointer to incomplete type fileio.c:2917: error: `R_CURSOR' undeclared (first use in this function) fileio.c:2936: error: dereferencing pointer to incomplete type fileio.c:2936: error: dereferencing pointer to incomplete type fileio.c:2936: error: dereferencing pointer to incomplete type fileio.c:2936: error: dereferencing pointer to incomplete type fileio.c:2937: error: dereferencing pointer to incomplete type fileio.c:2937: error: dereferencing pointer to incomplete type fileio.c:2938: error: dereferencing pointer to incomplete type fileio.c:2940: error: dereferencing pointer to incomplete type fileio.c:2940: error: dereferencing pointer to incomplete type fileio.c:2940: error: dereferencing pointer to incomplete type fileio.c:2940: error: dereferencing pointer to incomplete type fileio.c:2941: error: dereferencing pointer to incomplete type fileio.c:2941: error: dereferencing pointer to incomplete type fileio.c:2945: error: dereferencing pointer to incomplete type fileio.c:2945: error: dereferencing pointer to incomplete type fileio.c:2945: error: dereferencing pointer to incomplete type fileio.c:2945: error: dereferencing pointer to incomplete type fileio.c:2945: error: dereferencing pointer to incomplete type fileio.c:2945: error: dereferencing pointer to incomplete type fileio.c:2947: error: dereferencing pointer to incomplete type fileio.c:2965: error: dereferencing pointer to incomplete type fileio.c:2965: error: dereferencing pointer to incomplete type fileio.c:2965: error: dereferencing pointer to incomplete type fileio.c:2965: error: dereferencing pointer to incomplete type fileio.c:2966: error: dereferencing pointer to incomplete type fileio.c:2966: error: dereferencing pointer to incomplete type fileio.c:2992: error: dereferencing pointer to incomplete type fileio.c:2992: error: dereferencing pointer to incomplete type fileio.c:2992: error: dereferencing pointer to incomplete type fileio.c:2992: error: dereferencing pointer to incomplete type fileio.c:2992: error: dereferencing pointer to incomplete type fileio.c:2992: error: dereferencing pointer to incomplete type fileio.c:3007: error: dereferencing pointer to incomplete type fileio.c:3009: error: dereferencing pointer to incomplete type fileio.c:3009: error: dereferencing pointer to incomplete type fileio.c:3009: error: dereferencing pointer to incomplete type fileio.c:3010: error: dereferencing pointer to incomplete type fileio.c:3011: error: dereferencing pointer to incomplete type fileio.c:3013: error: dereferencing pointer to incomplete type fileio.c:3013: error: dereferencing pointer to incomplete type fileio.c:3014: error: dereferencing pointer to incomplete type fileio.c:3015: error: dereferencing pointer to incomplete type fileio.c:3015: error: dereferencing pointer to incomplete type fileio.c:3015: error: dereferencing pointer to incomplete type fileio.c:3015: error: dereferencing pointer to incomplete type fileio.c:3053: error: dereferencing pointer to incomplete type fileio.c:3054: error: dereferencing pointer to incomplete type fileio.c:3054: error: dereferencing pointer to incomplete type fileio.c:3054: error: dereferencing pointer to incomplete type fileio.c:3056: error: dereferencing pointer to incomplete type fileio.c:3056: error: dereferencing pointer to incomplete type fileio.c:3056: error: dereferencing pointer to incomplete type fileio.c:3057: error: dereferencing pointer to incomplete type fileio.c:3058: error: dereferencing pointer to incomplete type fileio.c:3058: error: dereferencing pointer to incomplete type fileio.c:3058: error: dereferencing pointer to incomplete type fileio.c:3059: error: dereferencing pointer to incomplete type fileio.c:3060: error: dereferencing pointer to incomplete type fileio.c:3060: error: dereferencing pointer to incomplete type fileio.c:3074: error: dereferencing pointer to incomplete type fileio.c:3075: error: dereferencing pointer to incomplete type fileio.c:3075: error: dereferencing pointer to incomplete type fileio.c: In function `get_dupno': fileio.c:3090: error: dereferencing pointer to incomplete type fileio.c:3090: error: dereferencing pointer to incomplete type fileio.c:3091: error: dereferencing pointer to incomplete type fileio.c:3091: error: dereferencing pointer to incomplete type fileio.c:3091: error: dereferencing pointer to incomplete type fileio.c:3096: error: dereferencing pointer to incomplete type fileio.c:3096: error: dereferencing pointer to incomplete type fileio.c:3096: error: dereferencing pointer to incomplete type fileio.c:3096: error: dereferencing pointer to incomplete type fileio.c:3096: error: `R_CURSOR' undeclared (first use in this function) fileio.c:3098: error: dereferencing pointer to incomplete type fileio.c:3098: error: dereferencing pointer to incomplete type fileio.c:3098: error: dereferencing pointer to incomplete type fileio.c:3099: error: dereferencing pointer to incomplete type fileio.c:3103: error: dereferencing pointer to incomplete type fileio.c:3103: error: dereferencing pointer to incomplete type fileio.c:3103: error: dereferencing pointer to incomplete type fileio.c:3103: error: dereferencing pointer to incomplete type fileio.c:3103: error: `R_NEXT' undeclared (first use in this function) fileio.c: In function `check_alt_keys': fileio.c:3122: error: dereferencing pointer to incomplete type fileio.c:3122: error: dereferencing pointer to incomplete type fileio.c:3123: error: dereferencing pointer to incomplete type fileio.c:3123: error: dereferencing pointer to incomplete type fileio.c:3123: error: dereferencing pointer to incomplete type fileio.c:3123: error: dereferencing pointer to incomplete type fileio.c:3126: error: dereferencing pointer to incomplete type fileio.c: In function `indexed_write_internal': fileio.c:3174: error: dereferencing pointer to incomplete type fileio.c:3174: error: dereferencing pointer to incomplete type fileio.c:3191: error: dereferencing pointer to incomplete type fileio.c:3192: error: dereferencing pointer to incomplete type fileio.c:3193: error: dereferencing pointer to incomplete type fileio.c:3193: error: dereferencing pointer to incomplete type fileio.c:3193: error: dereferencing pointer to incomplete type fileio.c:3193: error: dereferencing pointer to incomplete type fileio.c:3193: error: `R_NOOVERWRITE' undeclared (first use in this function) fileio.c:3199: error: dereferencing pointer to incomplete type fileio.c:3199: error: dereferencing pointer to incomplete type fileio.c:3201: error: dereferencing pointer to incomplete type fileio.c:3207: error: dereferencing pointer to incomplete type fileio.c:3209: error: dereferencing pointer to incomplete type fileio.c:3211: error: dereferencing pointer to incomplete type fileio.c:3211: error: dereferencing pointer to incomplete type fileio.c:3212: error: dereferencing pointer to incomplete type fileio.c:3221: error: dereferencing pointer to incomplete type fileio.c:3221: error: dereferencing pointer to incomplete type fileio.c:3222: error: dereferencing pointer to incomplete type fileio.c:3222: error: dereferencing pointer to incomplete type fileio.c:3222: error: dereferencing pointer to incomplete type fileio.c:3222: error: dereferencing pointer to incomplete type fileio.c: In function `indexed_write': fileio.c:3299: error: dereferencing pointer to incomplete type fileio.c:3299: error: dereferencing pointer to incomplete type fileio.c:3300: error: dereferencing pointer to incomplete type fileio.c:3301: error: dereferencing pointer to incomplete type fileio.c:3301: error: dereferencing pointer to incomplete type fileio.c:3303: error: dereferencing pointer to incomplete type fileio.c:3303: error: dereferencing pointer to incomplete type fileio.c:3303: error: dereferencing pointer to incomplete type fileio.c:3306: error: dereferencing pointer to incomplete type fileio.c:3306: error: dereferencing pointer to incomplete type fileio.c:3306: error: dereferencing pointer to incomplete type fileio.c: In function `indexed_delete_internal': fileio.c:3319: error: `DBT' undeclared (first use in this function) fileio.c:3319: error: syntax error before "prim_key" fileio.c:3366: error: dereferencing pointer to incomplete type fileio.c:3366: error: dereferencing pointer to incomplete type fileio.c:3367: error: dereferencing pointer to incomplete type fileio.c:3367: error: dereferencing pointer to incomplete type fileio.c:3367: error: dereferencing pointer to incomplete type fileio.c:3367: error: dereferencing pointer to incomplete type fileio.c:3372: error: `prim_key' undeclared (first use in this function) fileio.c:3372: error: dereferencing pointer to incomplete type fileio.c:3375: error: dereferencing pointer to incomplete type fileio.c:3377: error: dereferencing pointer to incomplete type fileio.c:3377: error: dereferencing pointer to incomplete type fileio.c:3378: error: dereferencing pointer to incomplete type fileio.c:3378: error: dereferencing pointer to incomplete type fileio.c:3381: error: dereferencing pointer to incomplete type fileio.c:3381: error: dereferencing pointer to incomplete type fileio.c:3381: error: dereferencing pointer to incomplete type fileio.c:3382: error: dereferencing pointer to incomplete type fileio.c:3387: error: dereferencing pointer to incomplete type fileio.c:3387: error: dereferencing pointer to incomplete type fileio.c:3387: error: dereferencing pointer to incomplete type fileio.c:3389: error: syntax error before "sec_key" fileio.c:3395: error: dereferencing pointer to incomplete type fileio.c:3395: error: dereferencing pointer to incomplete type fileio.c:3395: error: dereferencing pointer to incomplete type fileio.c:3395: error: dereferencing pointer to incomplete type fileio.c:3395: error: `R_CURSOR' undeclared (first use in this function) fileio.c:3397: error: `sec_key' undeclared (first use in this function) fileio.c:3397: error: dereferencing pointer to incomplete type fileio.c:3398: error: dereferencing pointer to incomplete type fileio.c:3400: error: dereferencing pointer to incomplete type fileio.c:3405: error: dereferencing pointer to incomplete type fileio.c:3405: error: dereferencing pointer to incomplete type fileio.c:3405: error: dereferencing pointer to incomplete type fileio.c:3411: error: dereferencing pointer to incomplete type fileio.c:3411: error: dereferencing pointer to incomplete type fileio.c:3411: error: dereferencing pointer to incomplete type fileio.c:3411: error: dereferencing pointer to incomplete type fileio.c:3411: error: `R_NEXT' undeclared (first use in this function) fileio.c:3428: error: dereferencing pointer to incomplete type fileio.c:3428: error: dereferencing pointer to incomplete type fileio.c: In function `indexed_rewrite': fileio.c:3593: error: dereferencing pointer to incomplete type fileio.c:3593: error: dereferencing pointer to incomplete type fileio.c: In function `cob_tmpfile': fileio.c:4994: warning: int format, pid_t arg (arg 4) *** Error code 1 make: Fatal error: Command failed for target `libcob_la-fileio.lo' Current working directory /dados/open-cobol-1.1/libcob *** Error code 1 The following command caused the error: failcom='exit 1'; \ for f in x $MAKEFLAGS; do \ case $f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo all-recursive | sed s/-recursive//`; \ list='lib libcob cobc bin config copy po texi tests'; for subdir in $list; do \ echo "Making $target in $subdir"; \ if test "$subdir" = "."; then \ dot_seen=yes; \ local_target="$target-am"; \ else \ local_target="$target"; \ fi; \ (cd $subdir && make $local_target) \ || eval $failcom; \ done; \ if test "$dot_seen" = "no"; then \ make "$target-am" || exit 1; \ fi; test -z "$fail" make: Fatal error: Command failed for target `all-recursive' Current working directory /dados/open-cobol-1.1 *** Error code 1 make: Fatal error: Command failed for target `all' [/code] any tips? ---------------------------------------------------------------- What version did you use (package date is the most interesting one)?[quote]$ cobc -version cobc (OpenCOBOL) 1.1.1 Copyright (C) 2001-2008 Keisuke Nishida / Roger While Built Oct 14 2008 15:52:54 Packaged Oct 13 2008 07:48:43 CEST[/quote] With an earlier version I had problems doing make without curses. Maybe building without BDB is fixed already, maybe Roger has to tweak it again. ---------------------------------------------------------------- I already try compiling without DB but occur another error : [code] ... gcc -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -o .libs/cobcrun cobcrun-cobcrun.o -L/dados/open-cobol-1.1/libcob /dados/open-cobol-1.1/libcob/.libs/libcob.so -L/usr/local/lib -L/usr/local/BerkeleyDB.4.2/lib -L/usr/local/ssl/lib -L/usr/openwin/lib -L/usr/lib -L/usr/local/mysql/lib/mysql -lm /usr/local/lib/libgmp.so -lncurses -R/usr/local/lib Undefined first referenced symbol in file initscr32 /dados/open-cobol-1.1/libcob/.libs/libcob.so nanosleep /dados/open-cobol-1.1/libcob/.libs/libcob.so w32addch /dados/open-cobol-1.1/libcob/.libs/libcob.so w32attron /dados/open-cobol-1.1/libcob/.libs/libcob.so w32attrset /dados/open-cobol-1.1/libcob/.libs/libcob.so getcurx /dados/open-cobol-1.1/libcob/.libs/libcob.so getcury /dados/open-cobol-1.1/libcob/.libs/libcob.so getmaxx /dados/open-cobol-1.1/libcob/.libs/libcob.so getmaxy /dados/open-cobol-1.1/libcob/.libs/libcob.so ld: fatal: Symbol referencing errors. No output written to .libs/cobcrun collect2: ld returned 1 exit status *** Error code 1 make: Fatal error: Command failed for target `cobcrun' Current working directory /dados/open-cobol-1.1/bin *** Error code 1 ... [/code] About the version of the package, I download it this last week, looking inside ChangeLog : [quote] 2008-09-29 Roger While * Makefile.am : Revise format of tarstamp.h 2008-08-20 Roger While * configure.ac : Option changes for AIX ... [/quote] ---------------------------------------------------------------- For the BDB problem, it's finding a default library but not the header file. Specify the path to the BDB include directory in the CPPFLAGS variable. See ./configure --help You may also want/need to set LDFLAGS. Roger ---------------------------------------------------------------- Thanks for this tips. I set this: [code] export CPPFLAGS="-I /usr/local/BerkeleyDB.4.2/include -I /opt/sfw/include/ncurses" export LDFLAGS="-L /opt/sfw/lib" [/code] The problem with BDB are resolved, but some errors still happing. Now appear occur with ncurses. I trying identify what's missing... Looking on ./configure execution: [quote] SunOS.000sv022 root:/dados/open-cobol-1.1# ./configure ... checking whether to use NLS... no checking ncurses.h usability... no checking ncurses.h presence... no checking for ncurses.h... no checking pdcurses.h usability... no ... SunOS.000sv022 root:/dados/open-cobol-1.1# ls -l /opt/sfw/include/ncurses/ total 532 -rw-r--r-- 1 root bin 59015 Oct 4 2006 curses.h -rw-r--r-- 1 root bin 6590 Oct 4 2006 cursesapp.h -rw-r--r-- 1 root bin 27646 Oct 4 2006 cursesf.h -rw-r--r-- 1 root bin 19518 Oct 4 2006 cursesm.h -rw-r--r-- 1 root bin 8446 Oct 4 2006 cursesp.h -rw-r--r-- 1 root bin 45086 Oct 4 2006 cursesw.h -rw-r--r-- 1 root bin 7312 Oct 4 2006 cursslk.h -rw-r--r-- 1 root bin 2891 Oct 4 2006 eti.h -rw-r--r-- 1 root bin 8840 Oct 4 2006 etip.h -rw-r--r-- 1 root bin 17206 Oct 4 2006 form.h -rw-r--r-- 1 root bin 11881 Oct 4 2006 menu.h lrwxrwxrwx 1 root root 8 Oct 9 14:02 ncurses.h -> curses.h -rw-r--r-- 1 root bin 1559 Oct 4 2006 ncurses_dll.h -rw-r--r-- 1 root bin 3721 Oct 4 2006 panel.h -rw-r--r-- 1 root bin 37864 Oct 4 2006 term.h -rw-r--r-- 1 root bin 3484 Oct 4 2006 termcap.h -rw-r--r-- 1 root bin 3013 Oct 4 2006 unctrl.h [/quote] And when a make are executed: [quote] ... gcc -DHAVE_CONFIG_H -I. -I. -I.. -I /usr/local/BerkeleyDB.4.2/include -I /opt/sfw/include/ncurses -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-termio.lo -MD -MP -MF .deps/libcob_la-termio.Tpo -c termio.c -o libcob_la-termio.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I /usr/local/BerkeleyDB.4.2/include -I /opt/sfw/include/ncurses -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-screenio.lo -MD -MP -MF ".deps/libcob_la-screenio.Tpo" -c -o libcob_la-screenio.lo `test -f 'screenio.c' || echo './'`screenio.c; \ then mv -f ".deps/libcob_la-screenio.Tpo" ".deps/libcob_la-screenio.Plo"; else rm -f ".deps/libcob_la-screenio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I /usr/local/BerkeleyDB.4.2/include -I /opt/sfw/include/ncurses -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-screenio.lo -MD -MP -MF .deps/libcob_la-screenio.Tpo -c screenio.c -fPIC -DPIC -o .libs/libcob_la-screenio.o screenio.c: In function `cob_screen_attr': screenio.c:125: warning: implicit declaration of function `attrset' screenio.c:125: error: `A_NORMAL' undeclared (first use in this function) screenio.c:125: error: (Each undeclared identifier is reported only once screenio.c:125: error: for each function it appears in.) screenio.c:127: error: `A_REVERSE' undeclared (first use in this function) screenio.c:130: error: `A_BOLD' undeclared (first use in this function) screenio.c:133: error: `A_BLINK' undeclared (first use in this function) screenio.c:136: error: `A_UNDERLINE' undeclared (first use in this function) screenio.c:139: warning: implicit declaration of function `attron' screenio.c:147: error: `COLOR_BLACK' undeclared (first use in this function) screenio.c:150: error: `COLOR_BLUE' undeclared (first use in this function) screenio.c:153: error: `COLOR_GREEN' undeclared (first use in this function) screenio.c:156: error: `COLOR_CYAN' undeclared (first use in this function) ... [/quote] There is any other tip? ---------------------------------------------------------------- Hmm, strange. Are you sure that -I /opt/sfw/include/ncurses is correct? Should it be just -I /opt/sfw/include ? Roger ---------------------------------------------------------------- Yes, all files are by default installed this way: [code] SunOS.000sv022 root:/opt/sfw# find /opt/sfw/include/ /opt/sfw/include/ /opt/sfw/include/magic.h /opt/sfw/include/ncurses /opt/sfw/include/ncurses/curses.h /opt/sfw/include/ncurses/cursesapp.h /opt/sfw/include/ncurses/cursesf.h /opt/sfw/include/ncurses/cursesm.h /opt/sfw/include/ncurses/cursesp.h /opt/sfw/include/ncurses/cursesw.h /opt/sfw/include/ncurses/cursslk.h /opt/sfw/include/ncurses/eti.h /opt/sfw/include/ncurses/etip.h /opt/sfw/include/ncurses/form.h /opt/sfw/include/ncurses/menu.h /opt/sfw/include/ncurses/ncurses.h /opt/sfw/include/ncurses/ncurses_dll.h /opt/sfw/include/ncurses/panel.h /opt/sfw/include/ncurses/term.h /opt/sfw/include/ncurses/termcap.h /opt/sfw/include/ncurses/unctrl.h /opt/sfw/include/readline /opt/sfw/include/readline/chardefs.h /opt/sfw/include/readline/history.h /opt/sfw/include/readline/keymaps.h /opt/sfw/include/readline/readline.h /opt/sfw/include/readline/rlconf.h /opt/sfw/include/readline/rlstdc.h /opt/sfw/include/readline/rltypedefs.h /opt/sfw/include/readline/tilde.h [/code] Only to make sure that is not the cause, I changed to -I /opt/sfw/include and re-execute the ./configure and make. The ./configure still not finding "ncurses.h" and the make appear other type of error: [code] if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I /usr/local/BerkeleyDB.4.2/include -I /opt/sfw/include -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-pplex.o -MD -MP -MF ".deps/cobc-pplex.Tpo" -c -o cobc-pplex.o `test -f 'pplex.c' || echo './'`pplex.c; \ then mv -f ".deps/cobc-pplex.Tpo" ".deps/cobc-pplex.Po"; else rm -f ".deps/cobc-pplex.Tpo"; exit 1; fi /bin/bash ../libtool --tag=CC --mode=link gcc -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -L /opt/sfw/lib -o cobc cobc-cobc.o cobc-config.o cobc-tree.o cobc-reserved.o cobc-error.o cobc-parser.o cobc-scanner.o cobc-field.o cobc-typeck.o cobc-codegen.o cobc-ppparse.o cobc-pplex.o ../lib/libsupport.a mkdir .libs gcc -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k /opt/sfw/lib -o cobc cobc-cobc.o cobc-config.o cobc-tree.o cobc-reserved.o cobc-error.o cobc-parser.o cobc-scanner.o cobc-field.o cobc-typeck.o cobc-codegen.o cobc-ppparse.o cobc-pplex.o -L/dados/open-cobol-1.1/cobc ../lib/libsupport.a ld: fatal: file /opt/sfw/lib: unknown file type ld: fatal: File processing errors. No output written to cobc collect2: ld returned 1 exit status *** Error code 1 [/code] About the above, there is the /opt/sfw/lib: [code] SunOS.000sv022 root:/opt/sfw# find /opt/sfw/lib/ /opt/sfw/lib/ /opt/sfw/lib/libmagic.a /opt/sfw/lib/libmagic.la /opt/sfw/lib/libmagic.so /opt/sfw/lib/libmagic.so.1 /opt/sfw/lib/libmagic.so.1.0 /opt/sfw/lib/locale /opt/sfw/lib/locale/da /opt/sfw/lib/locale/da/LC_MESSAGES /opt/sfw/lib/locale/da/LC_MESSAGES/findutils.mo /opt/sfw/lib/locale/de /opt/sfw/lib/locale/de/LC_MESSAGES /opt/sfw/lib/locale/de/LC_MESSAGES/findutils.mo /opt/sfw/lib/locale/es /opt/sfw/lib/locale/es/LC_MESSAGES /opt/sfw/lib/locale/es/LC_MESSAGES/findutils.mo /opt/sfw/lib/locale/et /opt/sfw/lib/locale/et/LC_MESSAGES /opt/sfw/lib/locale/et/LC_MESSAGES/findutils.mo /opt/sfw/lib/locale/fr /opt/sfw/lib/locale/fr/LC_MESSAGES /opt/sfw/lib/locale/fr/LC_MESSAGES/findutils.mo /opt/sfw/lib/locale/gl /opt/sfw/lib/locale/gl/LC_MESSAGES /opt/sfw/lib/locale/gl/LC_MESSAGES/findutils.mo /opt/sfw/lib/locale/id /opt/sfw/lib/locale/id/LC_MESSAGES /opt/sfw/lib/locale/id/LC_MESSAGES/findutils.mo /opt/sfw/lib/locale/it /opt/sfw/lib/locale/it/LC_MESSAGES /opt/sfw/lib/locale/it/LC_MESSAGES/findutils.mo /opt/sfw/lib/locale/ko /opt/sfw/lib/locale/ko/LC_MESSAGES /opt/sfw/lib/locale/ko/LC_MESSAGES/findutils.mo /opt/sfw/lib/locale/nl /opt/sfw/lib/locale/nl/LC_MESSAGES /opt/sfw/lib/locale/nl/LC_MESSAGES/findutils.mo /opt/sfw/lib/locale/pl /opt/sfw/lib/locale/pl/LC_MESSAGES /opt/sfw/lib/locale/pl/LC_MESSAGES/findutils.mo /opt/sfw/lib/locale/pt_BR /opt/sfw/lib/locale/pt_BR/LC_MESSAGES /opt/sfw/lib/locale/pt_BR/LC_MESSAGES/findutils.mo /opt/sfw/lib/locale/ru /opt/sfw/lib/locale/ru/LC_MESSAGES /opt/sfw/lib/locale/ru/LC_MESSAGES/findutils.mo /opt/sfw/lib/locale/sv /opt/sfw/lib/locale/sv/LC_MESSAGES /opt/sfw/lib/locale/sv/LC_MESSAGES/findutils.mo /opt/sfw/lib/locale/tr /opt/sfw/lib/locale/tr/LC_MESSAGES /opt/sfw/lib/locale/tr/LC_MESSAGES/findutils.mo /opt/sfw/lib/mpage /opt/sfw/lib/mpage/CP850.PC /opt/sfw/lib/mpage/ISO+STD+OTH /opt/sfw/lib/mpage/ISO-8859.1 /opt/sfw/lib/mpage/ISO-Latin.1 /opt/sfw/lib/mpage/ISO-Latin.2 /opt/sfw/lib/libform.a /opt/sfw/lib/libform.so /opt/sfw/lib/libform.so.5 /opt/sfw/lib/libform.so.5.5 /opt/sfw/lib/libform_g.a /opt/sfw/lib/libmenu.a /opt/sfw/lib/libmenu.so /opt/sfw/lib/libmenu.so.5 /opt/sfw/lib/libmenu.so.5.5 /opt/sfw/lib/libmenu_g.a /opt/sfw/lib/libncurses++.a /opt/sfw/lib/libncurses.a /opt/sfw/lib/libncurses.so /opt/sfw/lib/libncurses.so.5 /opt/sfw/lib/libncurses.so.5.5 /opt/sfw/lib/libncurses_g.a /opt/sfw/lib/libpanel.a /opt/sfw/lib/libpanel.so /opt/sfw/lib/libpanel.so.5 /opt/sfw/lib/libpanel.so.5.5 /opt/sfw/lib/libpanel_g.a /opt/sfw/lib/terminfo /opt/sfw/lib/libhistory.a /opt/sfw/lib/libhistory.so /opt/sfw/lib/libhistory.so.4 /opt/sfw/lib/libreadline.a /opt/sfw/lib/libreadline.so /opt/sfw/lib/libreadline.so.4 /opt/sfw/lib/X11 /opt/sfw/lib/X11/app-defaults /opt/sfw/lib/X11/app-defaults/UXTerm /opt/sfw/lib/X11/app-defaults/XTerm /opt/sfw/lib/X11/app-defaults/XTerm-color [/code] Help if I post the configure.log here? ---------------------------------------------------------------- Hmm, I think I might know what is going on. In CPPFLAGS and LDFLAGS, take out the space between the -I respectively the -L and the path names. Before redoing the configure, do a "make distclean". Roger ---------------------------------------------------------------- Hi Roger, Sorry the delay to post this reply... Well, I try has you said, but return the same error. I executed the make clean and cleandist, configure and make: [code] SunOS.000sv022 root:/dados/open-cobol-1.1# make clean ... SunOS.000sv022 root:/dados/open-cobol-1.1# make cleandist ... SunOS.000sv022 root:/dados/open-cobol-1.1# echo $LDFLAGS -L/opt/sfw/lib SunOS.000sv022 root:/dados/open-cobol-1.1# echo $CPPFLAGS -I/usr/local/BerkeleyDB.4.2/include -I/opt/sfw/include SunOS.000sv022 root:/dados/open-cobol-1.1# ./configure ... SunOS.000sv022 root:/dados/open-cobol-1.1# make Creating defaults.h... make all-recursive ... gcc -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -o .libs/cobcrun cobcrun-cobcrun.o -L/opt/sfw/lib -L/dados/open-cobol-1.1/libcob /dados/open-cobol-1.1/libcob/.libs/libcob.so -L/usr/local/lib -L/usr/local/BerkeleyDB.4.2/lib -L/usr/local/ssl/lib -L/usr/openwin/lib -L/usr/lib -L/usr/local/mysql/lib/mysql -lm /usr/local/lib/libgmp.so -lncurses -ldb -R/usr/local/lib Undefined first referenced symbol in file nanosleep /dados/open-cobol-1.1/libcob/.libs/libcob.so ld: fatal: Symbol referencing errors. No output written to .libs/cobcrun collect2: ld returned 1 exit status *** Error code 1 make: Fatal error: Command failed for target `cobcrun' Current working directory /dados/open-cobol-1.1/bin *** Error code 1 The following command caused the error: failcom='exit 1'; \ for f in x $MAKEFLAGS; do \ case $f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo all-recursive | sed s/-recursive//`; \ list='lib libcob cobc bin config copy po texi tests'; for subdir in $list; do \ echo "Making $target in $subdir"; \ if test "$subdir" = "."; then \ dot_seen=yes; \ local_target="$target-am"; \ else \ local_target="$target"; \ fi; \ (cd $subdir && make $local_target) \ || eval $failcom; \ done; \ if test "$dot_seen" = "no"; then \ make "$target-am" || exit 1; \ fi; test -z "$fail" make: Fatal error: Command failed for target `all-recursive' Current working directory /dados/open-cobol-1.1 *** Error code 1 make: Fatal error: Command failed for target `all' [/code] ---------------------------------------------------------------- Can you try current 1.1 tarball. It appears Solaris has nanosleep in either librt (newer versions) or libposix4 (older versions). We now check for that in the configure. Roger ---------------------------------------------------------------- Subject: OC FAQ updated http://opencobol.add1tocobol.com/ocfaq.html and ocfaqplain.html (no special css overrides). I'd like to post the http://opencobol.add1tocobol.com/ocfaq.rst file to Usenet soon ... say by Halloween. Any naysaying or "the file sucks" comments? Will it add to or scare away developers? Make us look bad to those "in the know" with proper FAQ netiquette? Cheers, Brian ---------------------------------------------------------------- Subject: Feature Request: check BASED vars when using -debug If you use a BASED var without ALLOCATE before it results in a seg fault (no problem here). When compiling with -debug it would be better to have a check so that the program exits with something like [quote]TESTPRG.CBL:34: libcob: The BASED var 'mybasedvar' was used and not ALLOCATEd before[/quote] ---------------------------------------------------------------- Try current 1.1 tarball. I think it should be OK. I have also included an OC test for this. I may have missed some corner case. Needs further testing. Roger ---------------------------------------------------------------- Subject: Gets/Puts/Posts/ and so on from the web? Can we get a teenie weenie code example that shows how we would grab the variables sent via a form? Cookies too? Kind Regards ---------------------------------------------------------------- This early code was posted before, but I'll try and explain the POST bit... [code] COBOL >>SOURCE FORMAT IS FIXED G ****************************************************************** I * Author: Brian Tiffin, Francois Hiniger * Date: 30-Aug-2008 * Purpose: Display the CGI environment space * Tectonics: cobc -x cgienv.cob * Move cgienv to the cgi-bin directory as cgienv.cgi * browse http://localhost/cgi-bin/cgienv.cgi or cgienvform.html ****************************************************************** identification division. program-id. cgienv. environment division. input-output section. file-control. select webinput assign to KEYBOARD. data division. file section. fd webinput. 01 postchunk pic x(1024). working-storage section. 78 name-count value 25. 01 newline pic x value x'0a'. 01 name-index pic 99 usage comp-5. 01 value-string pic x(256). 01 environment-names. 02 name-strings. 03 filler pic x(20) value 'DOCUMENT_ROOT'. 03 filler pic x(20) value 'GATEWAY_INTERFACE'. 03 filler pic x(20) value 'HTTP_ACCEPT'. 03 filler pic x(20) value 'HTTP_ACCEPT_CHARSET'. 03 filler pic x(20) value 'HTTP_ACCEPT_ENCODING'. 03 filler pic x(20) value 'HTTP_ACCEPT_LANGUAGE'. 03 filler pic x(20) value 'HTTP_CONNECTION'. 03 filler pic x(20) value 'HTTP_HOST'. 03 filler pic x(20) value 'HTTP_USER_AGENT'. 03 filler pic x(20) value 'LIB_PATH'. 03 filler pic x(20) value 'PATH'. 03 filler pic x(20) value 'QUERY_STRING'. 03 filler pic x(20) value 'REMOTE_ADDR'. 03 filler pic x(20) value 'REMOTE_PORT'. 03 filler pic x(20) value 'REQUEST_METHOD'. 03 filler pic x(20) value 'REQUEST_URI'. 03 filler pic x(20) value 'SCRIPT_FILENAME'. 03 filler pic x(20) value 'SCRIPT_NAME'. 03 filler pic x(20) value 'SERVER_ADDR'. 03 filler pic x(20) value 'SERVER_ADMIN'. 03 filler pic x(20) value 'SERVER_NAME'. 03 filler pic x(20) value 'SERVER_PORT'. 03 filler pic x(20) value 'SERVER_PROTOCOL'. 03 filler pic x(20) value 'SERVER_SIGNATURE'. 03 filler pic x(20) value 'SERVER_SOFTWARE'. 02 filler redefines name-strings. 03 name-string pic x(20) occurs name-count times. procedure division. * Always send out the Content-type before any other IO display "Content-type: text/html" newline end-display. display "" end-display. display "

CGI environment with OpenCOBOL

" end-display. display 'To cgienvform.html' "

" end-display. * Accept and display some of the known CGI environment values perform varying name-index from 1 by 1 until name-index > name-count accept value-string from environment name-string(name-index) end-accept display "" end-display if (name-string(name-index) = "REQUEST_METHOD") and (value-string = "POST") open input webinput read webinput at end move spaces to postchunk end-read close webinput display '" C end-display O end-if B end-perform. O display "
" name-string(name-index) ": " function trim (value-string trailing) "
' "First chunk of POST:" postchunk(1:72) "

" end-display. LUXURY goback. [/code] And a sample form to test out the POST method. The sample COBOL can be called directly from the Location bar, but it will come through as a GET. [code] OpenCOBOL sample CGI form

OpenCOBOL sample CGI form

Text:
Password:
Checkbox:
One
Two

[/code] So, for POST if the [i]REQUEST_METHOD[/i] enviroment variable is equal to "POST", then open standard input (SELECT ddname ASSIGN TO KEYBOARD) and READ in the data. Being COBOL, you'll need to loop to get all the data. I've not looked into any multipart forms yet. For [i]REQUEST_METHOD[/i] GET, then we'll need to workout a query string parser of some form. First a encode/decode of URL escape values using the value of the [i]QUERY_STRING[/i] env var. We should write one as an OpenCOBOL procedure, but for now, exposing curl_easy_escape (encode) and curl_easy_unescape (decode) will be a no-brainer, but adds a requirement for the external library. After the URL decode: Key chars are [b]?[/b] through to [b]&[/b] or end of string, this continues with [b]&[/b] through to [b]&[/b] or end of string for all the key value pairs in the QUERY_STRING. Within the substrings you'll have [i]name[/i][b]=[/b][i]value[/i] pairs. (Possible duplicates on the name). STRING and UNSTRING should chew through this like a hot knife through butter; with the complication of not knowing how many pieces are involved before hand. For Cookies, things get a little trickier but not much. In the CGI response, use [code] display "Set-Cookie: key=somevalue; expires=Fri, 31-Dec-2010 23:59:59 GMT; path=/; domain=.example.net newline "Content-type: text/html" newline end-display [/code] And from then on, requests from that browser should include Cookie: in the header, and this example source would have to be expanded to check the [i]HTTP_COOKIE[/i] env var. I'll work up another sample. And I could be completely out to lunch. This is an area I learn when I need to and then immediately forget as useless brain details. For instance; some sites may require support of HTTP PUT and DELETE. That will require investigation Cheers, Brian ---------------------------------------------------------------- I am having problems connecting to quotetracker that runs on my PC which runs on XP. I can connect to it via API either through socket using port 16240 or using CGI with port 16239. In both cases the IP address is 127.0.01 (Local PC). I am trying the CGI option and using the GET method with QUOTE_STRING but I am having problems running and getting any data. All environment variables are blank. If I run the command on a WEB page I can get the info. Can someone help me ? Here is the command I need to run : http://127.0.0.1:16239/Req?Getlastquote(DELL,msft) Thanks, ---------------------------------------------------------------- Hi Krigul; I just looked at http://www.quotetracker.com/help/qtserver.shtml Their internal webserver is not "CGI" in the common sense of the term. The server responds to a request with a text file that is not an http response packet. You'll need to code an access program to send the http request and then simply read until end of file. There will not be any CGI related environment setup for this, AFAIK at a glance. For your purpose, a modified [b]occurlrefesh[/b] or the ubiquitous [b]wget[/b] may be a much better way of handling this. If you want to try a COBOL solution, the occurlrefresh.cbl program could be a good start, but for trials at the command line I'd play with wget. http://oldsite.add1tocobol.com/tiki-list_file_gallery.php?galleryId=2 for the files of occurlrefresh. wget you can get from http://www.gnu.org/software/wget/ or use google for links to packaged binaries. Under Debian GNU/Linux (which I'll assume you are not running as qt is Windows), it'd simply be apt-get install wget. Cheers, Brian ---------------------------------------------------------------- Hi Brian, Thanks very much for the response, you are right QT responds in a text format which makes it easier to unstring. I was looking to wget and got lost in it. I tried curl, the program supplied with libcurl and it is working fine by directing the output to a file, however I am not able to call curl within my Cobol program, is there a way to just run/call curl within Cobol, otherwise I will modify occurlrefresh? Also I am using Kobol which is another flavour of Cobol, however I am having few issues with it, is it OK to use Open Cobol with win XP with no problem? if so I will download OpenCobol 1.1 and convert my programs. Thanks, Gregory ---------------------------------------------------------------- Hello Gregory; I'd like to just say, 'hey sure, OpenCOBOL will handle it', but I don't know. I've never used KOBOL and don't know. Will OpenCOBOL 1.1 run on Win/XP? yes; using a native MSVC compiler. But all my experience is either with Debian GNU/Linux or the Cygwin environment with gcc on the Windows side. [code] $ wget http://127.0.0.1/yourquery -O outputfilename [/code] will get you your request and save it to outputfilename. (Note; that is a CAPITAL oh, as small -o effects the log file, not the Output file). Use - for a filename for stdout (for piping etc). For using the occurl.c layer ... I'm not sure about KOBOL at all and have no clue how it would fit in with that environment. It requires a compiler system that will link to C object files. Cheers, Brian ---------------------------------------------------------------- Subject: Parameters for cobcrun? - IMPLEMENTED I'd like to know all parameters of cobcrun, so I did [code]cobcrun --help[/code] but it didn't work, [code]cobcrun --version[/code] is the same. Could we implement these parameters to cobcrun? ---------------------------------------------------------------- Should I post this on the wish-list? ---------------------------------------------------------------- Already in current 1.1 tarball :-) Roger ---------------------------------------------------------------- Subject: ADDRESS OF Hello, Excuse me if this a COBOL dolt question. I'm writing an OCDUMP callable. I'd like the syntax to be [code] CALL "OCDUMP" USING ADDRESS OF var FUNCTION LENGTH(var) END-CALL [/code] That doesn't work. It compiles, but the [i]ADDRESS OF[/i] clause seems to have zero effect. I've had to [code] 01 addr USAGE POINTER SET addr TO ADDRESS OF var CALL "OCDUMP" USING addr FUNCTION LENGTH(var) END-CALL [/code] It's not a huge deal, but it doesn't have the same finesse imho, being a two step sequence and not a concise one-liner. Interface in OCDUMP is currently using LINKAGE [code] 01 ptr USAGE POINTER 01 len USAGE BINARY-LONG PROCEDURE DIVISION USING ptr len [/code] Then it sets a BASED PIC X field to traverse the storage ... etcetera Cheers, Brian ---------------------------------------------------------------- Hmm, yes, that looks like a bug. Will check that. In the mean time how about this - [code] 01 len USAGE BINARY-LONG. MOVE FUNCTION LENGTH(var)TO len. CALL "OCDUMP" USING var len. [/code] Note the above is being defensive in case FUNCTION LENGTH ever returns something other than BINARY-LONG. And then - [code] 01 var PIC X ANY LENGTH. 01 len USAGE BINARY-LONG PROCEDURE DIVISION USING var len. [/code] Roger ---------------------------------------------------------------- Subject: OpenCOBOL reflective properties? Is there a way to query, from within an executable at run-time, if OC is running EBCDIC native or ASCII? 32 bit or 64? Etc.. Cheers, Brian ---------------------------------------------------------------- EBCDIC/ASCII fast and dirty. IF '0' < 'A' THEN SET ASCII flag ELSE SET EBCDIC flag END-IF. ASCII text digits are 0x30 - 0x39 EBCDIC are 0xF0 - 0xF9 Curt ---------------------------------------------------------------- 32/64 Bit: 01 testvar. 05 filler comp. move all '9' to testvar move 0 to counter inspect testvar tallying counter for all '9' ---------------------------------------------------------------- Nice tricks gentlemen. Thanks and cheers, Brian ---------------------------------------------------------------- Keep in mind, that the EBDIC trick only works if no alphabet is defined in your program. ---------------------------------------------------------------- For ASCII/EBCDIC - [code] IF " " = X"20" DISPLAY "I am ASCII" ELSE IF " " = X"40" DISPLAY "I am EBCDIC" ELSE DISPLAY "Oh my, what is this" END-IF END-IF [/code] For 32/64 bit - [code] 01 MYPTR USAGE POINTER. DISPLAY FUNCTION LENGTH (MYPTR). [/code] Roger ---------------------------------------------------------------- Thanks once again. Ok, so there are ways. But would I be out of line requesting a special register that could be referenced? Something along the lines of a runtime version of TARGET-COMPUTER? Along with bitwidth, character set, endian, assumed OS, ..., somewhat "fixed" enumerated values this special register would also be smart enough to know when certain SPECIAL-NAMES or ALPHABET are in use etc... ?? Cheers, Brian ---------------------------------------------------------------- Subject: Installing under SuSE Linux 11.0 I've never had problems, so this is not a definitive answer. [b]./configure --help[/b] includes this as part of the output. I hope it can help you with your build. [code] ... Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor CXXCPP C++ preprocessor [/code] I think you'll need to set LDFLAGS and CPPFLAGS before the configure. [i]think[/i] being a keyword here as I'm not really sure ... and I'd appreciate a note if you get it to work (or not). I'll add the details to the FAQ. Cheers, Brian ---------------------------------------------------------------- I am trying to install open cobol on Open SuSE Linux 11.0. In doing the ./configure I receive the message that GMP version 3 or later is not installed. It is installed, probably that the ./configure doesn't know where to find it. How can I get the configure script to find it? Thanks! ---------------------------------------------------------------- Subject: Programming "contest": Hex Dump debugging aid Hello everyone This sample comes with a challenge. Make the best Hex Dump callable for OpenCOBOL. For use during development and debugging. This code functions but isn't "professional" enough imho, so I'd like to challenge the forum to best it. Cheers, Brian A few notes; * I chose [b]1 relative[/b] for the offset display. Could be [b]0[/b]? Opinions here would be appreciated. * Bad variable names * Not an EBCDIC conformant char-table * [b]byte[/b] may not be necessary (the original plan was to pass a physical address...) [i]If a challenger can work it that way, I'd call it better than this cut.[/i] * The last two tests break Roger's defensive suggestion about using the LEN var to ensure proper argument size and type * I've included the testhead in the source, but a published subprogram would not, not this way at least. * A truncation warning is issued moving [b]counter[/b] to [b]offset[/b], but I wanted a shorter number. Plus offset is shown in decimal, should be hexed. [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 22-Oct-2008 *> Purpose: Test the OCDUMP routine *> Tectonics: cobc -x ocdump.cob *> *************************************************************** identification division. program-id. testdump. data division. local-storage section. 01 buffer pic x(64). 01 int usage binary-long value 123. 01 addr usage pointer. 01 len usage binary-long. *> ************************************************************** procedure division. move "abcdefghijklmnopqrstuvwxyz0123456789" to buffer move function length(buffer) to len display "Buffer Dump: " buffer(1:len) end-display call "OCDUMP" using buffer len end-call display "Alpha literal Dump" end-display move 17 to len call "OCDUMP" using "abcdefghijklmopqr" len end-call display "Integer Dump: " int end-display move function byte-length(int) to len call "OCDUMP" using int len end-call display "Numeric Literal Dump: " 0 end-display move function byte-length(0) to len call "OCDUMP" using 0 len end-call display "Hex Literal Dump" end-display call "OCDUMP" using x"f5f5f5f5" 4 end-call set addr to address of buffer display "Pointer Dump: " addr end-display call "OCDUMP" using addr function byte-length(addr) end-call goback. end program testdump. *> ************************************************************** *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20-Oct-2008 *> Purpose: Hex Dump display *> Tectonics: cobc -c ocdump.cob *> *************************************************************** identification division. program-id. OCDUMP. data division. local-storage section. 01 counter usage binary-long. 01 byline usage binary-long. 01 current usage binary-long. 01 offset pic 9999 usage computational-5. 01 byte pic x based. 01 datum pic 999 usage computational-5. 01 high pic 99 usage computational-5. 01 low pic 99 usage computational-5. 01 lins pic 9999 usage computational-5. 01 colu pic 99 usage computational-5. 01 char-table pic x(256) value '................................' & x'202122232425262728292a2b2c2d2e2f' & x'303132333435363738393a3b3c3d3e3f' & x'404142434445464748494a4b4c4d4e4f' & x'505152535455565758595a5b5c5d5e5f' & x'606162636465666768696a6b6c6d6e6f' & x'707172737475767778797a7b7c7d7e7f' & '................................' & '................................' & '................................' & '................................'. 01 dots pic x(16) value '................'. 01 show pic x(16). 01 hex. 02 high-hex pic x. 02 low-hex pic x. 01 hex-digit pic x(16) value '0123456789abcdef'. linkage section. 01 buffer pic x any length. 01 len usage binary-long. *> ************************************************************** procedure division using buffer len. perform varying counter from 1 by 16 until counter > len move counter to offset display offset space space with no advancing end-display move dots to show perform varying byline from 0 by 1 until byline > 15 add counter to byline giving current end-add if current > len display space space space with no advancing end-display else set address of byte to address of buffer(current:1) compute datum = function ord(byte) - 1 end-compute divide datum by 16 giving high remainder low end-divide move hex-digit(high + 1:1) to high-hex move hex-digit(low + 1:1) to low-hex move char-table(datum + 1:1) to show(byline + 1:1) display hex space with no advancing end-display end-if end-perform display space space show end-display end-perform display "" end-display goback. end program OCDUMP. [/code] Sample Output: [code] Buffer Dump: abcdefghijklmnopqrstuvwxyz0123456789 0001 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 abcdefghijklmnop 0017 71 72 73 74 75 76 77 78 79 7a 30 31 32 33 34 35 qrstuvwxyz012345 0033 36 37 38 39 20 20 20 20 20 20 20 20 20 20 20 20 6789 0049 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 Alpha literal Dump 0001 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6f 70 71 abcdefghijklmopq 0017 72 r............... Integer Dump: +0000000123 0001 7b 00 00 00 {............... Numeric Literal Dump: 0 0001 00 ................ Hex Literal Dump 0001 f5 f5 f5 f5 ................ Pointer Dump: 0xbf8b8db0 0001 b0 8d 8b bf ................ [/code] Game on! ---------------------------------------------------------------- Hi Find below a bid for the contest :-) I have considered what was meant by "best Hex Dump .." and who actually would use it - - I was also frightened a bit by the word "Professional" - but still I decided to give it a try. These are my considerations - Extra information needed - 32/64 bit, ASCII/EBCDIC, Endian - A ruler can help counting bytes - Starting address - where are we in storage The last two are for the one developing the stuff - while the first one is relevant if you ask others for help. For the module itself I decided to change: - calling module, literal-numbers seemed to be passed as char's in OC 1.0 which I run - changed to use variables And for OCDUMP - added extra fields to handle ascii, 32bit and endian - took away CHAR-table - I changed OCDUMP to use data directly instead. Thereby also solving the ASCII/EBCDIC. But probably Unicode will force rewriting. - added a SHOW-HEX-GROUP table to replace the many DISPLAYs. Table will collect the info as it is produced. Then we have only one display pr line. - introduced SECTIONs to structure the stuff - which was needed when adding new information. - STARTING-ADDRESS - collects and displays general information and ruler - CALC-HEX-VALUE to handle conversion to hex - sections TEST-ASCII, TEST-64BIT and TEST-ENDIAN to collect that information Then I scrubbed the main section of OCDUMP - took away the many display's as mentioned - they are slow - reworked address changing into "SET ADDRESS -- UP" instead of subscripting. Actually my OC 1.0 didn't like the "ANY LENGTH" that Brian had used. But basically I didn't like to subscript (potentially out of range) since this was really about adressing. As for OUT of RANGE: Noone helps us if we go outside our program boundaries - for instance through a bad calling. For Brians notes: - 0 relative is the right thing here. Changed to that - Variable names are fairly good - didn't change - [b]byte[/b] is good for this work. - as for passing the physical address - no not in COBOL. The interface you set up seems most "COBOL like" to me. Now for the code. I also included Brians Testdump - since I had to change it a bit. - grow quite long however [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 22-Oct-2008 *> Purpose: Test the OCDUMP routine *> Tectonics: cobc -x ocdump.cob *> *************************************************************** identification division. program-id. testdump. data division. local-storage section. 01 buffer pic x(64) value spaces. 01 int usage binary-long value 123. 01 addr usage pointer. 01 len usage binary-long. *> ************************************************************** procedure division. move "abcdefghijklmnopqrstuvwxyz0123456789" to buffer move function length(buffer) to len display "Buffer Dump: " buffer(1:len) end-display call "OCDUMP" using buffer len end-call display "Alpha literal Dump" end-display move 17 to len call "OCDUMP" using "abcdefghijklmopqr" len end-call display "Integer Dump: " int end-display move function byte-length(int) to len call "OCDUMP" using int len end-call display "Numeric Literal Dump: " 0 end-display move function byte-length(0) to len call "OCDUMP" using 0 len end-call display "Hex Literal Dump" end-display ´ move 4 to len call "OCDUMP" using x"f5f5f5f5" len end-call set addr to address of buffer display "Pointer Dump: " addr end-display move function byte-length(addr) to len call "OCDUMP" using addr len end-call goback. end program testdump. *> ************************************************************** *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Changed by Asger Kjelstrup *> Date: 26-Oct-2008 *> Purpose: Hex Dump display *> Tectonics: cobc -c ocdump.cob *> *************************************************************** identification division. program-id. OCDUMP. data division. local-storage section. 01 addr usage pointer. 01 addr2addr usage pointer. 01 counter usage binary-long. 01 byline pic 99 usage comp-5. 01 offset pic 9999 usage computational-5. 01 byte pic x based. 01 datum pic 999 usage computational-5. 01 high pic 99 usage computational-5. 01 low pic 99 usage computational-5. 01 is-ascii pic x(6). 01 is-32-bit pic x(6). 01 is-big-endian pic x. 01 endian-order pic x(10). 01 show-hex-group. 02 hex-line. 05 show-hexes pic x(48). 02 filler redefines hex-line. 05 filler occurs 16. 07 filler occurs 3. 10 show-hex pic x. 01 dots pic x(16) value '................'. 01 show pic x(16). 01 hex. 02 high-hex pic x. 02 low-hex pic x. 01 hex-digit pic x(16) value '0123456789abcdef'. linkage section. 01 buffer pic x. 01 len usage binary-long. *> ************************************************************** procedure division using buffer len. perform starting-address set address of byte to address of buffer perform varying counter from 0 by 16 until counter >= len move counter to offset move spaces to show-hexes move dots to show perform varying byline from 1 by 1 until byline > 16 if (counter + byline) > len move spaces to show-hexes(3*(byline - 1):3) move space to show(byline:1) else perform calc-hex-value if datum > 31 and datum <= 128 move byte to show(byline:1) end-if set address of byte up by 1 end-if end-perform display offset " " show-hexes show end-perform display "" goback. CALC-HEX-VALUE SECTION. compute datum = function ord(byte) - 1 divide datum by 16 giving high remainder low move hex-digit(high + 1:1) to show-hex(byline 1) move hex-digit(low + 1:1) to show-hex(byline 2) . STARTING-ADDRESS SECTION. perform TEST-ASCII perform TEST-64bit perform TEST-ENDIAN set addr to address of buffer set addr2addr to address of addr *> To show hex-address, reverse if Big-Little Endian if is-big-endian = "Y" set addr2addr up by function byte-length(addr) set addr2addr down by 1 end-if perform varying byline from 1 by 1 until byline > function byte-length(addr) set address of byte to addr2addr perform calc-hex-value if is-big-endian = "Y" set addr2addr down by 1 else set addr2addr up by 1 end-if end-perform *> Display characteristics and headline subtract 1 from byline display "" display "Dump of memory beginning at Hex-address: " show-hexes(1:3*byline) display "Program runs in " is-32-bit " architecture. " "Char-set is " is-ascii "." display "Byte order is " endian-order " endian." display "" display "Offs " "HEX-- -- -- 5- -- -- -- -- 10 -- -- -- -- 15 -- " "CHARS----1----5-" . TEST-ASCII SECTION. *> WDiscover if running Ascii or Ebcdic if " " = X"20" move "ASCII " to is-ascii else if " " = X"40" move "EBCDIC" to is-ascii else move "?" to is-ascii end-if end-if . TEST-64BIT SECTION. *> Check 32/64 bit.Longer pointers in 64-bit architecture if function length(addr) <= 4 move "32-bit" to is-32-bit else move "64-bit" to is-32-bit end-if . TEST-ENDIAN SECTION. *> Number-bytes are shuffled in Big-Little endian move 128 to byline set address of byte to address of byline if function ord(byte) > 0 move "Y" to is-big-endian move "Big-Little" to endian-order else move "N" to is-big-endian move "Little-Big" to endian-order end-if . end program OCDUMP. [/code] The testrun is like this: [code] Buffer Dump: abcdefghijklmnopqrstuvwxyz0123456789 Dump of memory beginning at Hex-address: 00 12 f6 68 Program runs in 32-bit architecture. Char-set is ASCII . Byte order is Big-Little endian. Offs HEX-- -- -- 5- -- -- -- -- 10 -- -- -- -- 15 -- CHARS----1----5- 0000 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 abcdefghijklmnop 0016 71 72 73 74 75 76 77 78 79 7a 30 31 32 33 34 35 qrstuvwxyz012345 0032 36 37 38 39 20 20 20 20 20 20 20 20 20 20 20 20 6789 0048 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 Alpha literal Dump Dump of memory beginning at Hex-address: 00 40 44 00 Program runs in 32-bit architecture. Char-set is ASCII . Byte order is Big-Little endian. Offs HEX-- -- -- 5- -- -- -- -- 10 -- -- -- -- 15 -- CHARS----1----5- 0000 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6f 70 71 abcdefghijklmopq 0016 72 r Integer Dump: +000000123 Dump of memory beginning at Hex-address: 00 12 f7 20 Program runs in 32-bit architecture. Char-set is ASCII . Byte order is Big-Little endian. Offs HEX-- -- -- 5- -- -- -- -- 10 -- -- -- -- 15 -- CHARS----1----5- 0000 7b 00 00 00 {... Numeric Literal Dump: 0 Dump of memory beginning at Hex-address: 00 40 44 24 Program runs in 32-bit architecture. Char-set is ASCII . Byte order is Big-Little endian. Offs HEX-- -- -- 5- -- -- -- -- 10 -- -- -- -- 15 -- CHARS----1----5- 0000 30 0 Hex Literal Dump Dump of memory beginning at Hex-address: 00 40 44 30 Program runs in 32-bit architecture. Char-set is ASCII . Byte order is Big-Little endian. Offs HEX-- -- -- 5- -- -- -- -- 10 -- -- -- -- 15 -- CHARS----1----5- 0000 f5 f5 f5 f5 .... Pointer Dump: 0001242728 Dump of memory beginning at Hex-address: 00 12 f6 ac Program runs in 32-bit architecture. Char-set is ASCII . Byte order is Big-Little endian. Offs HEX-- -- -- 5- -- -- -- -- 10 -- -- -- -- 15 -- CHARS----1----5- 0000 68 f6 12 00 h... [/code] That's about that, I think. Looking forward to any comments ---------------------------------------------------------------- Suggestions to the code of Ask: 1. Use evaluate, especially if you check for the same var, 2. Use 88er vars, especially if you check the same area [code] evaluate " " when X"20" set is-ascii to true when X"40" set is-ebdic to true when other set is-unknown to true end-evaluate[/code] 3. Use end-displays, especially if the display has more than one line 4. In my personal opinion, all sections should be ended with "exit." not with "." only It seems like this gets more like a community code than a contest. The code looks more and more nice. What I really like to see is a subprogram for converting data to hex, in way that OCDUMP calls it and displays the data. The program could be called every time, canceld only at the end. This makes it possible that all ASCII/EBDIC, byte length, ... are only tested once, although done by subprogram. What do you think about these points? human ---------------------------------------------------------------- Fine suggestions. Especially I like no 1 and 2. As for efficiency - normally I wouldn't care if situation doesn't occur often. That was what I had in mind, since we do hex-dumps. But if it's used for logging "strange" situations then you are right. But then we probably need even more information from within the calling program - variable names etc. That's quite another story. Asger ---------------------------------------------------------------- [code]set address of data-name up by arithmetic-expression[/code] seems to be not according to any standard, either you can use [code]set address of data-name to identifier[/code] or [code]set index-name up by arithmetic-expression[/code] but not a mix of them. I've changed this, added some missing terminators, added the dots in CHAR view and the use of any length again (necessary if check of the linkage section is done), changed the function byte-length() to expression LENGTH OF , made the extra information only view if special environment flag is set and implemented my suggestions (and style). Edit 04-Mar-2009: Use the buffer as the only using var, use C$PARAMSIZE instead to get the right length (if you want to pass a different length than the var size use "CALL 'OCDUMP' using buffer (01:62)"), allow to display up to 999999 bytes (and changed the types according to this), be sure that there are not more and make a "dot replacement" possible: [code] set environment "OC_DUMP_DOTS" to space[/code] Edit 05-Mar-2009: Added evaluation of printable signs for EBCDIC and use 88 level for that, use less vars, added a hyphen to the hex-dump after 8 bytes and use more of my coding preferences. Edit 27-Jul-2009: Added tectonics and changed prog-id according to FAQ-Sample. Made SOURCE-FORMAT working by removing the comment, added option to display length of dump and have two versions of extended infos. Edit 26-Jan-2010: Bugfixing extended-infos and take care for CALL with OMITTED. Edit 27-Jan-2010: Bugfixing output of dump length and some reformatting. Edit 19-Oct-2010: Put all dump-outputs to syserr. Removed unused paragraphs and minor beauty changes. [code] >>SOURCE FORMAT IS FIXED *----------------------------------------------------------------- * Authors: Brian Tiffin, Asger Kjelstrup, Simon Sobisch * Date: 19-Oct-2010 * Purpose: Hex Dump display * Tectonics: cobc -c CBL_OC_DUMP.cob * Usage: export OC_DUMP_EXT=1 for explanatory text on dumps * (memory address and dump length) * export OC_DUMP_EXT=Y for extended explanatory text * (architecture and endian-order) *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. CBL_OC_DUMP. * ENVIRONMENT DIVISION. CONFIGURATION SECTION. * DATA DIVISION. WORKING-STORAGE SECTION. 77 addr usage pointer. 77 addr2addr usage pointer. 77 counter pic 999999 usage comp-5. 77 byline pic 999 usage comp-5. 77 offset pic 999999. 01 some pic 999 usage comp-5. 88 some-is-printable-iso88591 values 32 thru 126, 160 thru 255. 88 some-is-printable-ebcdic values 64, 65, 74 thru 80, 90 thru 97, 106 thru 111, 121 thru 127, 129 thru 137, 143, 145 thru 153, 159, 161 thru 169, 176, 186 thru 188, 192 thru 201, 208 thru 217, 224, 226 thru 233, 240 thru 249. 77 high-var pic 99 usage comp-5. 77 low-var pic 99 usage comp-5. * 01 char-set pic x(06). 88 is-ascii value 'ASCII'. 88 is-ebdic value 'EBCDIC'. 88 is-unknown value '?'. 01 architecture pic x(06). 88 is-32-bit value '32-bit'. 88 is-64-bit value '64-bit'. 01 endian-order pic x(10). 88 is-big-endian-no value 'Little-Big'. 88 is-big-endian-yes value 'Big-Little'. * 77 hex-line pic x(48). 77 hex-line-pointer pic 9(02) value 1. * 77 show pic x(16). 77 dots pic x value '.'. 77 dump-dots pic x. * 77 hex-digit pic x(16) value '0123456789abcdef'. 01 extended-infos pic x. 88 show-extended-infos values '1', '2', 'Y', 'y'. 88 show-very-extended-infos values '2', 'Y', 'y'. * 77 len pic 999999 usage comp-5. 77 len-display pic 999999. * LINKAGE SECTION. 01 buffer pic x any length. 77 byte pic x. *----------------------------------------------------------------- PROCEDURE DIVISION USING buffer. * *MAIN SECTION. *00. perform starting-address * perform varying counter from 0 by 16 until counter >= len move counter to offset move spaces to hex-line, show move '-' to hex-line (24:01) move 1 to hex-line-pointer perform varying byline from 1 by 1 until byline > 16 if (counter + byline) > len if byline < 9 move space to hex-line (24:01) end-if inspect show (byline:) replacing all spaces by dots exit perform else move buffer (counter + byline : 1) to byte perform calc-hex-value if ((some-is-printable-iso88591 and is-ascii) or (some-is-printable-ebcdic and is-ebdic) ) move byte to show (byline:1) else move dots to show (byline:1) end-if end-if end-perform display offset ' ' hex-line ' ' show upon SYSERR end-display end-perform display ' ' upon SYSERR end-display * exit program. *----------------------------------------------------------------- CALC-HEX-VALUE SECTION. *00. subtract 1 from function ord(byte) giving some end-subtract divide some by 16 giving high-var remainder low-var end-divide string hex-digit (high-var + 1:1) hex-digit (low-var + 1:1) space delimited by size into hex-line with pointer hex-line-pointer end-string * exit section. *----------------------------------------------------------------- STARTING-ADDRESS SECTION. *00. * Get the length of the transmitted buffer CALL 'C$PARAMSIZE' USING 1 GIVING len END-CALL * If wanted, change the dots to something different than points accept dump-dots from environment 'OC_DUMP_DOTS' not on exception move dump-dots to dots end-accept * perform TEST-ASCII perform TEST-ENDIAN set addr to address of buffer set addr2addr to address of addr * if len > 0 * To show hex-address, reverse if Big-Little Endian if is-big-endian-yes set addr2addr up by LENGTH OF addr set addr2addr down by 1 end-if move 1 to hex-line-pointer perform varying byline from 1 by 1 until byline > LENGTH OF addr set address of byte to addr2addr perform calc-hex-value if is-big-endian-yes set addr2addr down by 1 else set addr2addr up by 1 end-if end-perform end-if * * Get and display characteristics and headline accept extended-infos from environment 'OC_DUMP_EXT' end-accept if show-extended-infos display ' ' upon SYSERR end-display if len > 0 display 'Dump of memory beginning at Hex-address: ' hex-line (1 : 3 * (byline - 1) ) upon SYSERR end-display end-if move len to len-display display 'Length of memory dump is: ' len-display upon SYSERR end-display if show-very-extended-infos perform TEST-64bit display 'Program runs in ' architecture ' architecture. ' 'Char-set is ' function trim (char-set) '.' upon SYSERR end-display display 'Byte order is ' endian-order ' endian.' upon SYSERR end-display end-if end-if * * Do we have anything to dump? if len > 0 * Ensure that the passed size is not too big if len > 999998 move 999998 to len, len-display display 'Warning, only the first ' len-display ' Bytes are shown!' upon SYSERR end-display end-if display ' ' upon SYSERR end-display display 'Offset ' 'HEX-- -- -- -5 -- -- -- -- 10 ' '-- -- -- -- 15 -- ' ' ' 'CHARS----1----5-' upon SYSERR end-display else display ' ' upon SYSERR end-display display 'Nothing to dump.' upon SYSERR end-display end-if * exit section. *----------------------------------------------------------------- TEST-ASCII SECTION. *Function: Discover if running Ascii or Ebcdic *00. evaluate space when x'20' set is-ascii to true when x'40' set is-ebdic to true when other set is-unknown to true end-evaluate * exit section. *----------------------------------------------------------------- TEST-64BIT SECTION. *Function: Discover if running 32/64 bit *00. * Longer pointers in 64-bit architecture if function length (addr) <= 4 set is-32-bit to true else set is-64-bit to true end-if * exit section. *----------------------------------------------------------------- TEST-ENDIAN SECTION. *00. * Number-bytes are shuffled in Big-Little endian move 128 to byline set address of byte to address of byline if function ord(byte) > 0 set is-big-endian-yes to true else set is-big-endian-no to true end-if * exit section. *----------------------------------------------------------------- end program CBL_OC_DUMP.[/code] Have fun! ---------------------------------------------------------------- Nice one human! I like it. But ... I had to comment out one of the 77 counter lines. The addition of the environment control over the explanatory info is a nice touch. Cheers, Brian ---------------------------------------------------------------- I've removed the counter duplicate. If this is something for the OC Manual is up to you, as always. human ---------------------------------------------------------------- human; I posted it up already. :) But I went and removed the binary-long duplicate as the comp-5 seemed to fit better, but I'll fix it to match what's here. I also updated the program-id to be in line with Roger's request for CBL_OC_ naming conventions as I think this one is getting close to something that could ship with the product (or at the least, seems worthy of the name) Cheers, Brian ---------------------------------------------------------------- OK, so I am "late to the game :lol: I have come up with a "different output approach". I don't know if this looks interesting (or not) to anyone. My problem is that I am still not "up to speed" on how to test a multi-program application. (I know that I need to learn about "make" - but haven't yet.) Therefore, I have only tested this in OC with WS (not Linkage Section) and with Fujitsu (where I know how to do multi-program applications - but where Omitted and ANY LENGTH don't work). Therefore, I don't even guarantee that this will work the way I expect. There are four parameters that you can pass to this program: - Stuff to be "dumped" - Length to be dumped (values 1 to 9999 - USAGE DISPLAY and not signed) - (optional) length of display output lines (values 1 to 132, USAGE display and not signed) - defaults to 79 - (Optional) a "default" character to use when the hex value of the "print character" is less than spaces. Currently this defaults to spaces, but I could change the default to "." or "-" depending on what others think. FYI, I also thought of having an option to write the output to a Line Sequntial file rather than DISPLAY. That is part of the reason that I did the "mulit-line output" that I used. This would be trivial to add, if there is interest. Please let me know if this works or not (and any comments you have) [code] Identification Division. Program-ID. WMKdump Initial. Environment Division. Data Division. Working-Storage Section. 01 Line1. 05 L1-Tab Occurs 1 to 132 times Depending on LLen. 10 L1 Pic X(01). 88 FixIt Value X"09" X"0A" X"0D". 01 Line2. 05 L2-Tabl Occurs 1 to 132 times Depending on LLen. 10 L2 Pic X(01). 01 Line3. 05 L3-Tabl Occurs 1 to 132 times Depending on LLen. 10 L3 Pic X(01). 10 L3-Num Redefines L3 Pic 9. 01 Line4. 05 L4-Tabl Occurs 1 to 132 times Depending on LLen. 10 L4 Pic X(01). 10 L4-Num Redefines L4 Pic 9. 01 LLen Pic 9(03) Value 80. 01 Def Pic X(01). 88 NoConv Value X"00". 01 Ruler-Line Pic X(132) Value "0---+----1----+----2----+----3----+----4 - "----+----5----+----6----+----7----+----8 - "----+----9----+---10----+---11----+---12 - "----+---13--". 01 Pic X(01) Value "Y". 88 Abort Value "N". 88 ContProc Value "Y". 01 Work-Fields. 05 Sub Pic S9(04) Comp-5. 05 Int Pic S9(04) Comp-5. 05 Int1 Pic S9(04) Comp-5. 05 Int2 Pic S9(04) Comp-5. 05 StillToDump Pic S9(04) Comp-5. 05 StartNext Pic S9(04) Comp-5. 05 NumEd Pic ZZZ9. Linkage Section. 01 DumpThis Pic X Any Length. * 05 DT * Occurs 1 to 9999 times * Depending on DumpLen * Pic X(01). 01 DumpLen Pic 9(04). 01 Passed-LL Pic 9(03). 01 Passed-Def Pic X(01). 01 TempWindow Pic X(132). Procedure Division Using DumpThis DumpLen Passed-LL Passed-Def . Mainline. Perform Init If ContProc Perform Until StillToDump = Zero If StillToDump >= LLen Continue Else Move StillToDump to LLen End-If Move TempWindow to Line1 Perform EachByte Varying Sub From +1 by +1 Until Sub > LLen Display Line1 Display Line2 Display Line3 Display Line4 Display " " Subtract LLen from StillToDump If StillToDump Not = Zero Compute StartNext = (StartNext + 1) + LLen Set Address of TempWindow to Address of DumpThis (StartNext:) Move StartNext to NumEd Display NumEd " Bytes from start of storage" End-If End-Perform End-If GoBack . Init. If DumpLen Omitted Display "Length of Storage to be dumped is" " a required parameter," Display " but was not passed" Set Abort to True Exit Paragraph End-If If DumpThis Omitted Display "Storage to be dumped is" " a required parameter," Display " but was not passed" Set Abort to True Exit Paragraph End-If If (DumpLen Not Numeric) or (DumpLen < 1) or (DumpLen > 9999) Display "Invalid Length to Dump:" DumpLen Set Abort to True Exit Paragraph Else Move DumpLen to StillToDump End-If If Passed-LL not Omitted If (Passed-LL <= 132) and (Passed-LL > 0) Move Passed-LL to LLen Else Display "Invalid Line Length requested:" Passed-LL Set Abort to True Exit Paragraph End-If Else Move 79 to LLen End-If If Passed-Def Omitted Move X" " to Def Else Move Passed-Def to Def End-If Move Ruler-Line to Line2 Set Address of TempWindow To Address of DumpThis * Display "Def:" Def * Display "LineLen:" LLen Display " Start of HexDump" Display " " . EachByte. Compute Int = (Function Ord (L1 (Sub))) - 1 If L1 (sub) >= Spaces Continue Else If NoConv If Not FixIt (Sub) Continue Else Move Spaces to L1 (sub) End-If Else Move Def to L1 (Sub) End-If End-If Divide Int by 16 Giving Int1 Remainder Int2 End-Divide * Display "Int:" Int " Int1:" Int1 " Int2:" Int2 Evaluate Int1 When 0 thru 9 Move Int1 to L3-Num (sub) When 10 Move "A" to L3 (sub) When 11 Move "B" to L3 (Sub) When 12 Move "C" to L3 (Sub) When 13 Move "D" to L3 (Sub) When 14 Move "E" to L3 (Sub) When 15 Move "F" to L3 (Sub) End-Evaluate Evaluate Int2 When 0 thru 9 Move Int2 to L4-Num (sub) When 10 Move "A" to L4 (sub) When 11 Move "B" to L4 (Sub) When 12 Move "C" to L4 (Sub) When 13 Move "D" to L4 (Sub) When 14 Move "E" to L4 (Sub) When 15 Move "F" to L4 (Sub) End-Evaluate . [/code] ---------------------------------------------------------------- Hello Bill, I had to remove the period on the 01 Dump-This before the PIC X any length. But that's not a biggy. Not really working, or I'm bungling the call params... [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20090220 *> Purpose: Demonstrate ASCII EBCDIC conversion and ALPHABET *> Tectonics: cobc -x toebcdic.cob CBL_OC_DUMP.o WMKdump.o *> *************************************************************** identification division. program-id. toebcdic. environment division. configuration section. special-names. alphabet alpha is native alphabet beta is ebcdic. data division. working-storage section. 01 var pic x(62) value is '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'. 01 len pic 9(4) value is 62. 01 line-len pic 9(3) value 40. *> *************************************************************** procedure division. call "CBL_OC_DUMP" using var function length(var) end-call call "WMKdump" using var len line-len "." inspect var converting alpha to beta call "CBL_OC_DUMP" using var function length(var) end-call call "WMKdump" using var len omitted omitted goback. end program toebcdic. [/code] Outputs [code] $ ./toebcdic Offs HEX-- -- -- 5- -- -- -- -- 10 -- -- -- -- 15 -- CHARS----1----5- 0000 30 31 32 33 34 35 36 37 38 39 41 42 43 44 45 46 0123456789ABCDEF 0016 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 GHIJKLMNOPQRSTUV 0032 57 58 59 5a 61 62 63 64 65 66 67 68 69 6a 6b 6c WXYZabcdefghijkl 0048 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a mnopqrstuvwxyz.. Def:. LineLen:040 Start of HexDump 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcd 0---+----1----+----2----+----3----+----4 3333333333444444444444444555555555556666 01234567891234567890BCDE 012345678901234 efghijklmnopqrstuvwxyz 0---+----1----+----2-- 6666666666677777777777 567890BCDE101234567890 Offs HEX-- -- -- 5- -- -- -- -- 10 -- -- -- -- 15 -- CHARS----1----5- 0000 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 c1 c2 c3 c4 c5 c6 ................ 0016 c7 c8 c9 d1 d2 d3 d4 d5 d6 d7 d8 d9 e2 e3 e4 e5 ................ 0032 e6 e7 e8 e9 81 82 83 84 85 86 87 88 89 91 92 93 ................ 0048 94 95 96 97 98 99 a2 a3 a4 a5 a6 a7 a8 a9 ................ Def: LineLen:079 Start of HexDump �����������������������������������遂������������������������ 0---+----1----+----2----+----3----+----4----+----5----+----6-- 6666666666CCCCCCCCCDDDDDDDDDEEEEEEEE88888888899999999900000000 01234567891234567891234567892345678912345678912345678923456789 [/code] Cheers ---------------------------------------------------------------- Brian, Sorry about the "period". I had to use the commented out lines for Fujitsu and missed the period when changing for OC. Do you know how OC is *supposed* to check for omitted parameters? IBM uses the "If address of param = Nulls" approach - which is what I tried to code. However, the '02 Standard introduced an IF param OMITTED test. If OC uses that approach, then that is what needs changing in my INIT paragraph. FYI, I have NOT done anything to "display' EBCDIC characters when running in an ASCII environment. I assume that people want the "dump" to show printable characters the way they are in the current environment. I know how to do the other, but don't know if it is worth it. Thanks for running the test for me. Can you tell me (short leason) what I do to create a "driver program" and compile/make the application to do my own testing? Feel free to point me to somewhere in the FAQ or online - or email me off-list.. P.S. Should I make the "passed-length" field BINARY-xxxx, so you can use the FUNCTION LENGTH (foo) to pass the length to my program? That's easy to change. I just thought that "unsigned USAGE DISPLAY" might be easiest for those trying to use the dump program. ---------------------------------------------------------------- OK, I have totally replaced the source code in my original note - hopefully fixing "all problems"!!! The information in the Users Guide on Static linking must be for V1.0, because it sure doesn't work for V1.1. (It doesn't know about -fmain, among other things). However, I found a way (probably not the best) and was able to create a driver program and test my routine. I think it now should work. Please let me know if it does and/or if you have any suggesitons/problems. I have still NOT changed the parameter telling the length of the passed data to dump. Let me know if this should be able to receive FUNCTION LENGTH passed data. ---------------------------------------------------------------- Haven't tried WMKdump v2 yet, but re: static link. Yeah, -fstatic-call is being ousted for OpenCOBOL 1.1. Newer tarballs have a new .text (info command) document with all the new, changed (with removals) command line options. But ... "static linkage" works with (that's a misnomer; object code inclusion might be better) [code] $ cobc -c staticobject.cob $ cobc -x mainprogram.cob staticobject.o otherobject.o ... [/code] The cobc command will do the right thing in most, if not all, cases. cob_resolve in tandem with cobc and the linker is quite the funky little, smart function. And yes the User Guide is becoming more and more critical. OpenCOBOL supports the building of huge and complex systems, and it's actually pretty easy and convenient, but we need more docs and more samples highlighting all the options. There is a wealth of information hidden in posts here on the forum and it all needs to be indexed, properly centralized and exposed. On OMITTED; Yes OpenCOBOL supports both [code] CALL prog USING OMITTED P2 (where P1 is the omitted arg) and ... IF P1 OMITTED or IF P1 NOT OMITTED [/code] Due to a need for callback handling, Roger did a wonderful job of various CALL and PROC DIV USING BY VALUE features. I promised a sample showing them off, and haven't yet done so. But for instance [code] PROCEDURE DIVISION USING BY VALUE SIZE 2 c-short [/code] is a supported entry spec that can handle a callback (or direct call) from C or COBOL with 16 bits on the stack. Size can be AUTO (does the right thing in 32/64 bit architectures), DEFAULT, 1, 2, 4, 8. Lots of flexibility and power. By the way; cobc command options are about to change again. ;) With new, more usable and feature rich listing options, including integration of Vincent Coen's uber cool CobXRef utility. Again; the docs here will get a good duff over when 1.1 nears release (or shortly thereafter), I'm sure. For now they are mainly 1.0 (with the odd addendum). Cheers, Brian ---------------------------------------------------------------- I have updated (replaced) the source code one more time. If you pass X"00" as the parameter for default printable character, then no conversion will take place. If there is any chance of having X"00" to X"1F", in the storage to dump, I don't recommend this as the DISPLAY can cause "bad" output. However, if is now available. I do "fix" X"09" X"0A" and X"0D" - but I don't know what other problems may occur. P.S. I also fixed a typo when the remainder of the DIVIDE was 15; I add "14" in 2 WHEN clauses and changed the first WHEN phrase from 0 thru 10 to (correctly) 0 thru 9. NOTE: If you do not want to have to pass "OMITTED" explicitly for trailing paramters, then compile the CALLing program with -fnull-param and you can leave off trailing omitted parameters. ---------------------------------------------------------------- If anyone wants them, here are the two test "driver" programs that I have used to test my dump program. [code] Identification Division. Program-ID. dumpdrv. Environment Division. Data Division. Working-Storage Section. 01 DumpThis. 05 DT Occurs 1 to 9999 times Depending on DumpLen Pic X(01). 01 DumpLen Pic 9(04). 01 Pass-LL Pic 9(03). 01 Pass-Def Pic X(01). Procedure Division. Mainline. Move 165 to DumpLen Move all "?" to DumpThis Move 40 to Pass-LL Move "-" to Pass-Def Call "WMKdump" Using DumpThis DumpLen Pass-LL Pass-Def On Exception Display "not Found" End-Call Display " --->" Display " Between Calls" Display " --->" Move 120 to DumpLen Move all X"12" to DumpThis Move Function Current-Date to DumpThis (5:25) Move "abcdefGHIJKLM" to DumpThis (45:20) * Move "~" to Pass-Def Call "WMKdump" Using DumpThis DumpLen Omitted * Pass-Def On Exception Display "not Found" End-Call Display " --->" Display " Between Calls" Display " --->" Move 50 to DumpLen Move X"00" to Pass-Def Move all X"00" to DumpThis Move "aBcDeFg?" to DumpThis (5:8) Move X"0102030405060708090a0b0c0d0e0f" to DumpThis (15:) Move X"1112131415161718191a1b1c1d1e1f" to DumpThis (30:) Call "WMKdump" Using DumpThis DumpLen Omitted Pass-Def On Exception Display "not Found" End-Call GoBack . [/code] and [code] Identification Division. Program-ID. dumpdrv2. Environment Division. Data Division. Working-Storage Section. 01 DumpThis Pic X(256). 01 DumpLen Pic 9(04). 01 Pass-LL Pic 9(03). 01 Pass-Def Pic X(01). 01 Sub Pic S9(04) Comp-5. Procedure Division. Mainline. Perform Varying Sub From +1 by +1 Until Sub > 256 Move Function Char (sub) to DumpThis (Sub:1) End-Perform Move 256 to DumpLen Move 64 to Pass-LL Move X"00" to Pass-Def Call "WMKdump" Using DumpThis DumpLen Pass-LL Pass-Def On Exception Display "not Found" End-Call Display " --->" Display " Between Calls" Display " --->" Move 256 to DumpLen Move 64 to Pass-LL MOve "~" to Pass-Def Call "WMKdump" Using DumpThis DumpLen Omitted Pass-Def On Exception Display "not Found" End-Call Display " --->" Display " Between Calls" Display " --->" Move 171 to DumpLen Call "WMKdump" Using DumpThis DumpLen On Exception Display "not Found" End-Call GoBack . [/code] ---------------------------------------------------------------- Changed my submitted one, there is no need to share the length, it is calculated by C$PARAMSIZE. The "dot-replacement" can be done by setting the environment var "OC_DUMP_DOTS" to something, for example space. ---------------------------------------------------------------- Nice changes human. The new version will make its way to the FAQ and other places soon. And I've opened a new thread regarding how best to bundle community tidbits. Cheers, Brian ---------------------------------------------------------------- Speaking of the "dots" processing, shouldn't the code: [code] if some > 31 and some <= 128 [/code] Be modified for different values if you ARE running in an EBCDIC environment? I think that I would suggest: [code] if some > 39 and some <= 255 [/code] but when you look at an EBCDIC chart, yo may think some other value is better. ---------------------------------------------------------------- Good point about the printable signs and EBCDIC. Would the [url=http://en.wikipedia.org/wiki/EBCDIC#Codepage_layout]Codepage layout shown at wikipedia[/url] be fine? I think I'll change these lines to 88 levels and change the non EBCDIC according to the to [url=http://en.wikipedia.org/wiki/ISO/IEC_8859-1#Codepage_layout]the values of ISO 8859-1[/url]. What do you think? ---------------------------------------------------------------- I won't say that the Wikipedia page is wrong (or even different), but the place that most IBM COBOL users would look is at: [url=http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3lr40/APPENDIX1.3.1 ]http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3lr40/APPENDIX1.3.1 [/url] I know that there are other EBCDIC environments, but I think that what is shown as "printable" on that page is probably printable for all EBCDIC users. ---------------------------------------------------------------- They indeed differ on some bytes. I added EBCDIC for all the signs that occur in both lists at least one time and changed a lot of other code. Is OCDUMP going to be professional soon? ---------------------------------------------------------------- Changed the DUMP-prog again: Added tectonics and changed prog-id according to FAQ-Sample. Made SOURCE-FORMAT working by removing the comment, added option to display length of dump and have two versions of extended infos. I think the changed version should replace the old one found at OC-FAQ, because a lot of stuff is missing there. human ---------------------------------------------------------------- Changed the DUMP-prog again: Bugfixing extended-infos and taken care for CALL with OMITTED. Again: I think the changed version should replace the old one found at the OC-FAQ, because a lot of stuff is missing there. human ---------------------------------------------------------------- Cool. And yes human, ocfaq needs the update. There are quite a few code samples in the hopper as well. Plus, it will be nice to consolidate the links to as many of the OpenCOBOL assets as is feasible. [i]aoirthoir has a dump of the forum. I never quite found the time to cherry pick through the choice questions and answers opencobol.org has accumulated.[/i] Cheers, Brian ---------------------------------------------------------------- Another day, another change (don't expect that to happen for ever :) Bugfixing output of dump length and some reformatting human ---------------------------------------------------------------- Just a short info about a newer version (edited the prog on page 1) Put all dump-outputs to syserr. Removed unused paragraphs and minor beauty changes. human ---------------------------------------------------------------- Subject: Find and Replace Roger, et al Would it be better to have a copybook Find and Replace different length strings performable section? OR should we attempt to write something that could be included in system.def as a stock OC callable library routine? Both? Cheers, Brian ---------------------------------------------------------------- It seems that a callable library routine is faster than writing it in Cobol. Copybooks would not need a new oc-runtime version. ---------------------------------------------------------------- Subject: Error in make (cygwin, dependency of libiconv) I found an older machine with OC 0.33. For updating I've got recent updates via cygwin, added libcurl, downloaded and untared recent prerelease. Then I did [code]./configure make clear ./configure make[/code] and got [quote] gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -march=i686 -mtune=pentium3 -finli ne-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-forma t-y2k -MT libcob_la-screenio.lo -MD -MP -MF .deps/libcob_la-screenio.Tpo -c scre enio.c -o libcob_la-screenio.o >/dev/null 2>&1 /bin/sh ../libtool --tag=CC --mode=link gcc -g -O2 -march=i686 -mtune=pentium3 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno -format-y2k -Wl,--export-all-symbols -Wl,--enable-auto-import -o libcob.la -rpa th /usr/local/lib -version-info 1:0:0 -no-undefined libcob_la-common.lo libcob_l a-call.lo libcob_la-strings.lo libcob_la-move.lo libcob_la-numeric.lo libcob_la- intrinsic.lo libcob_la-fileio.lo libcob_la-termio.lo libcob_la-screenio.lo -lm - lgmp -lintl -lncurses -ldb grep: /usr/lib/libiconv.la: No such file or directory /usr/bin/sed: can't read /usr/lib/libiconv.la: No such file or directory libtool: link: `/usr/lib/libiconv.la' is not a valid libtool archive make[2]: *** [libcob.la] Error 1 make[2]: Leaving directory `/tmp/install/open-cobol-1.1/libcob' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/tmp/install/open-cobol-1.1' make: *** [all] Error 2[/quote]Has anybody an idea how to fix that? ---------------------------------------------------------------- human; try something like [code] $ locate libiconv.la [/code] and find out where it is, then [code] $ # search for libiconv in DIR/include and DIR/lib $ ./configure --with-libiconv-prefix[=DIR] [/code] or [code] $ # don't search for libiconv in includedir and libdir $ ./configure --without-libiconv-prefix [/code] And I'll be honest, not having tried it, I don't know if this will do anything to help. Cheers, Brian ---------------------------------------------------------------- The only iconv in my cygwin environment is cygiconv-2.dll in cygwin\bin. I tried to do [code]./configure --without-libiconv-prefix[/code] as you suggested and the error stays the same. Some questions: 1. Is libiconv necessary for opencobol (maybe only in cygwin environment on win98)? 2a. If not make should work also without it. 2b. If yes, the README should say something about it and ./configure should check for libiconv. ---------------------------------------------------------------- I checked some other machines and cygwin setup. All had libiconv installed (because it was installed together with vim ). After installing it via cygwin setup make was fine. It seems like this dependency is a little bit newer, cause my old OC 0.33 had no problems about missing libiconv. Roger, please check for libiconv in ./configure, if it's really needed. If not, kick it out of make. Thank you! ---------------------------------------------------------------- Subject: Another "contest". Find and Replace Hello everyone Here is another sample. The objective is best this code. Goals: Provide a find and replace that does not care about substring lengths Yes, this sample is inefficient in most cases. I'm looking to provoke ([i]as human has pointed out on the hex dump thread[/i]) community involvement. Please please feel free to rip the coding style apart and perhaps lower yourself to calling me nasty names. Don't worry I'm secure enough in my nerdhood that I can probably take it. I'd rather take a smack down here than in front of a paying customer, so have at it. Is this the best I can do ... no. I'm trying to provoke others to pass on their wisdom, experience and programming finesse. [i]And perhaps this isn't the greatest example to use for find and replace, as I had to change the actual ampersand entities to a mock up using percent for the opencobol.org posting...[/i] The unaltered source code can be found by clicking to http://opencobol.add1tocobol.com/ocfr.cob [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 27-Oct-2008 *> Purpose: Find and replace unequal length sub strings *> in this case, for HTML entities *> Tectonics: cobc -x ocfr.cob *> *************************************************************** identification division. program-id. ENTITYIFY. data division. working-storage section. 01 source-string pic x(256). 01 dest pic x(256). 01 fore usage binary-long. 01 aft usage binary-long. 01 source-limit usage binary-long. 01 elements constant as 3. 01 element usage binary-long. 01 finder-table. 03 filler pic x(1) value "<". 03 filler pic x(1) value ">". 03 filler pic x(1) value "&". 01 filler redefines finder-table. 03 finder pic x(1) occurs elements times. 01 replacement-table. 03 filler pic x(5) value "%lt;". 03 filler pic x(5) value "%gt;". 03 filler pic x(5) value "%amp;". 01 filler redefines replacement-table. 03 replacement pic x(5) occurs elements times. 01 rlen usage binary-long. 01 flen usage binary-long. 01 substitute-flag pic x value low-value. 88 no-substitution value low-value. 88 substitution-occured value high-value. *> ************************************************************** procedure division. *> ************************************************************** *> * This is a very particular usage. The OC developer should *> * have access to a more generic *substitute this for that* *> * operation. Whether it be a copybook performable or a *> * separate callable program. *> ************************************************************** *> move "<" to finder(1) *> move "%lt;" to replacement(1) *> move ">" to finder(2) *> move "%gt;" to replacement(2) *> move "&" to finder(3) *> move "%amp;" to replacement(3) move "" & "this is a sample" & "" & "

A sample showing entity replacement" & "

of < > and & for safe browser source display

" & "" & "" to source-string move spaces to dest. display "|" function trim(source-string trailing) "|" end-display perform find-replace-all display "|" function trim(dest trailing) "|" end-display move "<& a string showing %amp; &>" to source-string move spaces to dest. display "|" function trim(source-string trailing) "|" end-display perform find-replace-all display "|" function trim(dest trailing) "|" end-display goback. *> ************************************************************** find-replace-all. compute aft = 1 end-compute compute fore = 1 end-compute compute source-limit = function length(function trim(source-string trailing)) end-compute perform until fore > source-limit set no-substitution to true move 1 to element perform until element > elements perform find-replace-current if no-substitution add 1 to element end-add end-if end-perform if no-substitution move source-string(fore:1) to dest(aft:1) add 1 to fore end-add add 1 to aft end-add end-if end-perform exit. *> ************************************************************** find-replace-current. compute rlen = function length(function trim(replacement(element) trailing)) end-compute compute flen = function length(function trim(finder(element) trailing)) end-compute if source-string(fore:flen) = finder(element) move replacement(element) to dest(aft:rlen) add rlen to aft end-add add flen to fore end-add set substitution-occured to true add 1 to elements giving element end-if exit. end program ENTITYIFY. [/code] And sample output. [i]Please note, I had to change the ampersands to percents for posting to the forum[/i] [code] |this is a sample

A sample showing entity replacement

of < > and & for safe browser source display

| |%lt;html%gt;%lt;head%gt;%lt;title%gt;this is a sample%lt;/title%gt;%lt;/head%gt;%lt;body%gt;%lt;p%gt; A sample showing entity replacement%lt;p%gt;of %lt; %gt; and %amp; for safe browser source display%lt;/p%gt;%lt;/body%gt;%lt;/html%gt;| |<& a string showing %amp; &>| |%lt;%amp; a string showing %amp; %amp;%gt;| [/code] ---------------------------------------------------------------- Took out the HTML for this one. Simplify the sample. Same call for anyone here to try and better this. Can be viewed at http://opencobol.add1tocobol.com/ocbcta.cob Cheers, Brian [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 27-Oct-2008 *> Purpose: Find and replace unequal length sub strings *> Tectonics: cobc -x ocbcta.cob *> *************************************************************** identification division. program-id. OCBCTA. data division. working-storage section. 01 source-string pic x(256). 01 dest pic x(256). 01 fore usage binary-long. 01 aft usage binary-long. 01 source-limit usage binary-long. 01 elements constant as 4. 01 element usage binary-long. 01 finder-table. 03 filler pic x(16) value "Bob". 03 filler pic x(16) value "Carol". 03 filler pic x(16) value "Ted". 03 filler pic x(16) value "Alice". 01 filler redefines finder-table. 03 finder pic x(16) occurs elements times. 01 replacement-table. 03 filler pic x(32) value "Carol". 03 filler pic x(32) value "Bob". 03 filler pic x(32) value "Alice". 03 filler pic x(32) value "Tony? Who's Tony?". 01 filler redefines replacement-table. 03 replacement pic x(32) occurs elements times. 01 rlen usage binary-long. 01 flen usage binary-long. 01 substitute-flag pic x value low-value. 88 no-substitution value low-value. 88 substitution-occured value high-value. *> ************************************************************** procedure division. *> ************************************************************** *> * This is a very particular usage. The OC developer should *> * have access to a more generic *substitute this for that* *> * operation. Whether it be a copybook performable or a *> * separate callable program. *> ************************************************************** move "Bob and Carol and Ted and Alice" to source-string move spaces to dest display "|" function trim(source-string trailing) "|" end-display perform find-replace-all display "|" function trim(dest trailing) "|" end-display goback. *> ************************************************************** find-replace-all. compute aft = 1 end-compute compute fore = 1 end-compute compute source-limit = function length(function trim(source-string trailing)) end-compute perform until fore > source-limit set no-substitution to true move 1 to element perform until element > elements perform find-replace-current if no-substitution add 1 to element end-add end-if end-perform if no-substitution move source-string(fore:1) to dest(aft:1) add 1 to fore end-add add 1 to aft end-add end-if end-perform exit. *> ************************************************************** find-replace-current. compute rlen = function length(function trim(replacement(element) trailing)) end-compute compute flen = function length(function trim(finder(element) trailing)) end-compute if source-string(fore:flen) = finder(element) move replacement(element) to dest(aft:rlen) add rlen to aft end-add add flen to fore end-add set substitution-occured to true add 1 to elements giving element end-if exit. end program OCBCTA. [/code] and the output [code] |Bob and Carol and Ted and Alice| |Carol and Bob and Alice and Tony? Who's Tony?| [/code] ---------------------------------------------------------------- I have a find and replace I've been using for years. I'll see if I can find time to post soon. The parm is in the form of ",find_string,rep_string," where the first character delimits the parm and then there needs to be pairs of find and replace strings. The find and replace strings needn't be the same length. I wrote it for the mainframe so I could use symbolic parameters in control decks. The ways I'd seen in use at the time(and still to this day) were cumbersome at best. I wrote it before I'd heard of sed or I might have tried to bring sed to the shop I was working in. ---------------------------------------------------------------- See http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=439&forum=1&post_id=2317#forumpost2317 for the [b]winner[/b] of this contest. ;) Cheers, Brian ---------------------------------------------------------------- Subject: Quick test of Lua interface; alpha-release with docs Hello everyone, Twiddling this evening. Tried a Lua interface. This is built against Lua 5.1 On Debian Lenny, it requires lua5.1, liblua5.1-0, liblua5.1-0-dev Cheers, Brian [b]oclua.c[/b] [code] /* OpenCOBOL Lua interface */ /* tectonics: cobc -c -I/usr/include/lua5.1 oclua.c */ #include #include /* Include the Lua API header files. */ #include #include #include static lua_State *oclua_state; int OCLUA(char *result, int len) { const char *retstr; /* Declare a Lua State, open the Lua State and load the libraries. */ /* lua_State *l; */ oclua_state = lua_open(); luaL_openlibs(oclua_state); printf("C prints starting...\n"); luaL_dofile(oclua_state, "oclua.lua"); /* display the stacked items returned from the script */ int i; for (i = lua_gettop(oclua_state); i--; i > 0) { retstr = lua_tostring(oclua_state, i+1); printf("in C, tostring index %d: %s\n", i+1, retstr); } /* pass top item to OpenCOBOL */ int retlen; retstr = lua_tolstring(oclua_state, -1, &retlen); memset(result, ' ', len); memcpy(result, retstr, (len > retlen) ? retlen : len); /* Clean up Lua State */ lua_close(oclua_state); return 0; } [/code] [b]oclua.lua[/b] [code] -- Start -- Script: oclua.lua print("Lua prints hello") hello = "Hello OpenCOBOL from Lua" return math.pi, hello -- End [/code] and finally [b]luacaller.cob[/b] [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 28-Oct-2008 *> Purpose: interface to Lua scripting *> Tectonics: cobc -c -I/usr/include/lua5.1/ oclua.c *> cobc -x -llua5.1 luacaller.cob oclua.o *> *************************************************************** identification division. program-id. luacaller. data division. working-storage section. 01 luascript pic x(10) value 'oclua.lua' & x"00". 01 luaresult pic x(32). *> ************************************************************** procedure division. call "OCLUA" using by reference luaresult by value function length(luaresult) end-call display "OpenCOBOL displays: |" luaresult "|" end-display goback. end program luacaller. [/code] with sample output [code] C prints starting... Lua prints hello in C, tostring index 2: Hello OpenCOBOL from Lua in C, tostring index 1: 3.1415926535898 OpenCOBOL displays: |Hello OpenCOBOL from Lua | [/code] ---------------------------------------------------------------- Update; Newest post has docs, and I won't bother reposting the sources ... the links here are to the latest. http://opencobol.add1tocobol.com/oclua.html ==== New, more complete Lua interface. The next cut will have an ocdoc usage guide. Click to http://opencobol.add1tocobol.com/oclua.html Sources at http://opencobol.add1tocobol.com/oclua.c http://opencobol.add1tocobol.com/luacaller.cob http://opencobol.add1tocobol.com/oclua.lua Cheers, Brian [b]oclua.c[/b] [code] /* OpenCOBOL Lua interface */ /* tectonics: cobc -c -I/usr/include/lua5.1 oclua.c */ #include #include #include /* Include the Lua API header files. */ #include #include #include /* Open the Lua engine and load all the default libraries */ lua_State *OCLUA_OPEN() { lua_State *oclua_state; oclua_state = lua_open(); luaL_openlibs(oclua_state); return oclua_state; } int OCLUA_DO(lua_State *L, int which, const char *string, unsigned char *cobol, int coblen) { int result; int stacked; const char *retstr; int retlen; memset(cobol, ' ', coblen); result = ((which == 0) ? luaL_dostring(L, string) : luaL_dofile(L, string)); if (result == 1) { /* error condition */ return -1; } else { stacked = lua_gettop(L); if (stacked > 0) { /* populate cobol field with top of stack */ retstr = lua_tolstring(L, stacked, &retlen); memcpy(cobol, retstr, (coblen > retlen) ? retlen : coblen); } /* return number of items on the stack */ return stacked; } } /* by filename */ int OCLUA_DOFILE(lua_State *L, const char *filename, unsigned char *cobol, int coblen) { return OCLUA_DO(L, 1, filename, cobol, coblen); } /* by string */ int OCLUA_DOSTRING(lua_State *L, const char *string, unsigned char *cobol, int coblen) { return OCLUA_DO(L, 0, string, cobol, coblen); } /* retrieve stack item as string */ int OCLUA_GET(lua_State *L, int element, unsigned char *cobol, int coblen) { const char *retstr; int retlen; /* populate cobol field with top of stack */ memset(cobol, ' ', coblen); retstr = lua_tolstring(L, element, &retlen); if (retstr == NULL) { return -1; } else { memcpy(cobol, retstr, (coblen > retlen) ? retlen : coblen); return retlen; } } /* depth of Lua stack */ int OCLUA_DEPTH(lua_State *L) { return lua_gettop(L); } /* pop elements off stack */ int OCLUA_POP(lua_State *L, int elements) { lua_pop(L, elements); return lua_gettop(L); } /* close the engine */ void OCLUA_CLOSE(lua_State *L) { lua_close(L); } [/code] [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 28-Oct-2008 *> Purpose: interface to Lua scripting *> Tectonics: cobc -c -I/usr/include/lua5.1/ oclua.c *> cobc -x -llua5.1 luacaller.cob oclua.o *> *************************************************************** identification division. program-id. luacaller. data division. working-storage section. 01 luastate usage pointer. 01 luascript pic x(10) value 'oclua.lua' & x"00". 01 luacommand pic x(64). 01 luaresult pic x(32). 01 lualength usage binary-long. 01 items pic 9 usage computational-5. 01 luastack. 03 luaitem pic x(32) occurs 5 times. 01 depth usage binary-long. *> ************************************************************** procedure division. call "OCLUA_OPEN" returning luastate end-call move 'return "OpenCOBOL " .. 1.0 + 0.1' & x"00" to luacommand call "OCLUA_DOSTRING" using by value luastate by reference luacommand by reference luaresult by value 32 returning depth end-call display "OpenCOBOL displays: " depth " |" luaresult "|" end-display call "OCLUA_DOFILE" using by value luastate by reference luascript by reference luaresult by value 32 returning depth end-call display "OpenCOBOL displays: " depth " |" luaresult "|" end-display call "OCLUA_DOFILE" using by value luastate by reference luascript by reference luaresult by value 32 returning depth end-call display "OpenCOBOL displays: " depth " |" luaresult "|" end-display call "OCLUA_DEPTH" using by value luastate returning depth end-call display "Lua depth: " depth end-display perform varying items from 1 by 1 until items > depth call "OCLUA_GET" using by value luastate by value items by reference luaresult by value 32 returning lualength end-call move luaresult to luaitem(items) end-perform perform varying items from 1 by 1 until items > depth display "Item " items ": " luaitem(items) end-display end-perform call "OCLUA_POP" using by value luastate by value depth returning depth end-call call "OCLUA_DEPTH" using by value luastate returning depth end-call display "Lua depth: " depth end-display call "OCLUA_CLOSE" using by value luastate end-call goback. end program luacaller. [/code] [b]oclua.lua[/b] [code] -- Start -- Script: oclua.lua print("Lua prints hello") hello = "Hello OpenCOBOL from Lua" return math.pi, hello -- End [/code] [b]sample output[/b] [code] OpenCOBOL displays: +0000000001 |OpenCOBOL 1.1 | Lua prints hello OpenCOBOL displays: +0000000003 |Hello OpenCOBOL from Lua | Lua prints hello OpenCOBOL displays: +0000000005 |Hello OpenCOBOL from Lua | Lua depth: +0000000005 Item 1: OpenCOBOL 1.1 Item 2: 3.1415926535898 Item 3: Hello OpenCOBOL from Lua Item 4: 3.1415926535898 Item 5: Hello OpenCOBOL from Lua Lua depth: +0000000000 [/code] ---------------------------------------------------------------- Subject: two small COBOL programs OC fails to compile Hi! Here are two small COBOL programs which Open COBOL 1.1 (latest tar ball from Roger's web site) fails to compile. I am not sure if this is bug in OC's parser or non-standard COBOL, but Micro Focus compiles them without warnings: [code] IDENTIFICATION DIVISION. PROGRAM-ID. TEST1. ENVIRONMENT DIVISION. CONFIGURATION SECTION. DATA DIVISION. WORKING-STORAGE SECTION. 01 X PIC 9(9). PROCEDURE DIVISION. MOVE 1 TO X IF X > 0 AND ( < 5 OR > 10) * IF X > 0 AND (X < 5 OR X > 10) DISPLAY "OK" ELSE DISPLAY "NOT OK" END-IF EXIT PROGRAM. [/code] test1.cbl:12: Error: Invalid expression [code] IDENTIFICATION DIVISION. PROGRAM-ID. TEST2. ENVIRONMENT DIVISION. CONFIGURATION SECTION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PIC 9(9). 01 X PIC 9(9). 01 Y PIC 9(9). 01 Z PIC 9(9). PROCEDURE DIVISION. MOVE 1 TO X MOVE 2 TO Y MOVE 3 TO Z COMPUTE A = FUNCTION MIN (X,(Y*Z)) * COMPUTE A = FUNCTION MIN (X, Y*Z ) DISPLAY "A=" A EXIT PROGRAM. [/code] test2.cbl:15: Error: 'X' cannot be subscripted The equivalent, commented out variants compile fine. ---------------------------------------------------------------- Hello Alex, I tried your small programs this way [b]test1.cob[/b] [code]IDENTIFICATION DIVISION. PROGRAM-ID. TEST1. ENVIRONMENT DIVISION. CONFIGURATION SECTION. DATA DIVISION. WORKING-STORAGE SECTION. 01 X PIC 9(9). PROCEDURE DIVISION. MOVE 1 TO X *> IF X > 0 AND ( < 5 OR > 10) IF X > 0 AND (X < 5 OR X > 10) DISPLAY "OK" ELSE DISPLAY "NOT OK" END-IF . EXIT PROGRAM.[/code] ./test1 OK [b]test2.cob[/b] [code]IDENTIFICATION DIVISION. PROGRAM-ID. TEST2. ENVIRONMENT DIVISION. CONFIGURATION SECTION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PIC 9(9). 01 B pic 9(9). 01 X PIC 9(9). 01 Y PIC 9(9). 01 Z PIC 9(9). PROCEDURE DIVISION. MOVE 1 TO X MOVE 2 TO Y MOVE 3 TO Z COMPUTE A = FUNCTION MIN (X, (Y*Z)) DISPLAY "A=" A COMPUTE B = FUNCTION MIN (X, Y*Z ) DISPLAY "B=" B . EXIT PROGRAM.[/code] ./test2 A=000000001 B=000000001 cobc -V cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2008 Keisuke Nishida / Roger While Built Oct 11 2008 20:16:19 Packaged Oct 11 2008 14:18:55 CEST Best regards Bear ---------------------------------------------------------------- Alex; Nice ones; For the first, [code] if (x > 0 and < 5) or > 10 [/code] syntax works. So does [code] if x > 0 and (x < 5 or > 10) [/code] Can't say why [code] if x > 0 and ( < 5 or > 10) [/code] doesn't compile, but I expect it has something to do with the wording of the standard documents and the NOT AND OR order of precedence and the paren expression not having a field to "reference" As a matter of fact; the standard includes if ... [quote] No parentheses are used within the sequence [/quote] when discussing abbreviated combined relation conditions Cheers, Brian ---------------------------------------------------------------- So, regarding test2.cbl: [code]FUNCTION MIN (X, (Y*Z))[/code] works, whereas [code]FUNCTION MIN (X,(Y*Z))[/code] (without space before the parenthesis) is interpreted as a subscripted expression. Is this intentionally or a bug in the parser? I assume the latter. ---------------------------------------------------------------- [quote] btiffin wrote: As a matter of fact; the standard includes if ... [quote] No parentheses are used within the sequence [/quote] when discussing abbreviated combined relation conditions [/quote] OK, meanwhile I found the Micro Focus documentation [u][url=http://supportline.microfocus.com/Documentation/books/sx50ws03/lhpdf60q.htm] "Abbreviated Combined Relation Conditions"[/url][/u] which quotes the example [code]x = a AND ( > b OR < z )[/code] as an OSVS extension. Since Roger's priority is to adhere to the standard, I assume he will not implement it. ---------------------------------------------------------------- Alex, please edit your posts and set all COBOL into code-Tags.[code][code]mycode[/code ][/code] (without the space between code and ]). I think you are right with your parser bug assuming (if yes, Roger solves these thinks fast) and also with [quote] alex wrote: [...] the example [code]x = a AND ( > b OR < z )[/code] [is] an OSVS extension. Since Roger's priority is to adhere to the standard, I assume he will not implement it. [/quote] I really like the standard and to be honest, wouldn't like if Roger implements stuff like this, because in my code base things like that would just be typing mistakes and something like this was meant [code]x = a AND (t > b OR < z )[/code] It's better if the compiler warns us about possible typing mistakes. ---------------------------------------------------------------- Re. FUNCTION MIN problem - Strictly speaking the comma is a seperator only when followed by a space. Parsing commas in expressions is somewhat complicated by the fact that numeric literals may or may not be involved depending on the presence of a DECIMAL POINT IS COMMA clause. eg. consider - FUNCTION MAX (3,4 1,2) FUNCTION MIN (3,4 2,1) with and without the DECIMAL POINT IS COMMA clause. However, OC's flexxer does greedy matching so we can cater for this. Fixed in current 1.1 tarball. Roger ---------------------------------------------------------------- Subject: cobc runs into infinite loop while compiling this program Open COBOL 1.1 fails to compile the following program due to the duplicate usage of A1 in SELECT and level 88. It runs into an infinite loop. [code] IDENTIFICATION DIVISION. PROGRAM-ID. LBXXXX. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT A1FD ASSIGN A1 ORGANIZATION LINE SEQUENTIAL. DATA DIVISION. FILE SECTION. FD A1FD. 01 A-RECORD PIC X(80). WORKING-STORAGE SECTION. 01 A-FIELD PIC 9. 88 A0 VALUE 0. 88 A1 VALUE 1. PROCEDURE DIVISION. A000-STEUER SECTION. EXIT PROGRAM. [/code] [code] > cobc --version cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2008 Keisuke Nishida / Roger While Built Oct 28 2008 13:30:51 Packaged Oct 26 2008 17:20:35 CET [/code] (this is on AIX, an older release on Linux segfaulted, Micro Focus compiles it without warnings) ---------------------------------------------------------------- Another nice one Alex. Fixed already. cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2008 Keisuke Nishida / Roger While Built Oct 30 2008 19:21:51 Packaged Oct 30 2008 16:52:34 CET I'd like to start a campaign to nominate Roger for the fastest "compiler bug report to fix" gun in the west ... east, north, south. Cheers, Brian ---------------------------------------------------------------- Actually my version of MF will not compile it - [code] * 258-** ** ASSIGN data-name A1 illegal cob32: error(s) in compilation: alx.cob [/code] Fixed in current 1.1 tarball - [code] cobc -x -std=mf alx.cob alx.cob:9: Error: ASSIGN data item 'A1' invalid [/code] Roger ---------------------------------------------------------------- Subject: add1tocobol Meeting Agenda for 2008-11-02 AND 2008-11-09 Hello Everyone, Now that the Software Freedom Day Cleveland 2008 Conference is over, I am back on track with Open Cobol and the Add 1 to Cobol project. I would like us to get together on our usual weekly schedule, not just for chatting, but to start implementing. So here are our topics for the next couple of weeks, please feel free to add your own. [b]Documentation:[/b] We need to really get going with the documentation. Brian (btiffin) has done a lot already. I would like us to get on board together. This is HIGH priority. Along those lines I am considering setting up a Wiki for us so that we can all contribute. Brian is suggesting TikiWiki. I am ok with it or MediaWiki. I prefer something SMALL, that JUST gets the job done, so that when we have a cobol wiki, transferring data is seamless. But we need a solution now, so by the 9th, the decision will be made and implemented. If you have a preferred wiki NOW is the time to tell me. If MediaWiki or TikiWiki are EASY to convert data from, then fine we will go with either one. [b]Chat:[/b] We are chatting in IRC right now. It is being suggested that having a chat facility where folks can join in and get the latest scroll, from when they were not in the room, would be preferred. Along with that an automatic recording of the room contents for perusal online would be nice as well. Suggestions? [b]Libraries[/b] A lot of folks are creating libraries as proofs of concept for Open Cobol. We've connections now for various SQL Databases, various languages (perl, lua, and such) and other things. I realize that a lot of folks have pet projects and we would all like to work on those. My gut tells me though, that we would get a lot more done working together as a team. So not only could our projects get done, but they could be more complete. We would have to work on them one at a time. Finish one, then as a team move to the next one. Finishing of course means testing and documenting as well. Those of us that cannot help with writing the libraries (me) could help in this regard. My desired goal and suggestion is that we ask, what do we need in order to be making OC our tool of choice? Obviously database connectivity, report writing, web output, search and replace, and so on. Let's decide by consensus the order of these, then do them one at a time. A part of the goal should be that the libraries also have cobol libraries. I mean this...the needed functionality to perform the: CALL "somelib" USING this that and the other is written. But then COPYBOOKS are also written which can be included (COPIED) into a particular app, so that then the COBOLER can just write: PERFORM BLA This way, it can nearly appear to be pure cobol, for the coboler. Having User Defined Functions will also make this much easier...which leads to our next topic [b]Help for Roger[/b] I suspect that a lot of the libraries being created will already take a bit of weight off of his shoulders. But he is still looking for help on the compiler. The person needs to know COBOL and C fluently. [b]Websites[/b] Now I am about ready to start setting folks up on the subversion, and hosting them on dreamhost. Additionally as mentioned we need a wiki. But we also need a plan for how apps can be added to add1tocobol.com. Of course this includes bug tracking and so on. Forums etc. Yes we could use sourceforge and perhaps will. However, our solution would allow us to own our own data. I will set up routines which will allow a person to get SQL dumps of their data, bug reports and so on. As well the code will be available. So those that eventually want to move to their own server will be able to take and run. Sourceforge doesnt really allow us to OWN our data. I look at its advantage being advertising. [b]applications[/b] Definitely time to start getting and distributing cobol based apps. [b]In other words[/b] It is time to really kickstart ourselves beyond the planning and experimenting stages and really to put something cohesive together that we can all use. The above are my opinions, please share yours. We will be meeting on Sunday 9:00am Eastern time...: Due to the fact that the time changes..and I am not sure when, I will be in there when my clock says 8:00am. Thus if the time is moving back..I am still there..or if it is moving forward. (These daylight savings time things always annoy me....but I will try to make sure that yall are covered) -- Joseph James Frantz (Aoirthoir) http://www.add1tocobol.com Regular add1tocobol meetings: Where: FREENODE IRC Channel: #add1tocobol Access from the web: http://www.add1tocobol.com/i_o_control.php Date: Sundays Time: 9:00am Eastern ::::::::NOTE IMPORTANT:::::::::: There has been some confusion as to the time. I believe this is because the United States uses Daylight Savings Time. On top of this the Government recently extended the dates that EDT (eastern daylight time) would run. So to be sure that you make it at 9am Eastern, I have this link: http://www.timeanddate.com/worldclock/city.html?n=179 That shows the time in New York City at the moment of viewing. It also explains the current UTC offset for the Eastern Zone in the United States. Simply compare the current time that site states, with your current time and you will know how far off we are from you. :::::::::::::::::::::::::::::::: We're there all of the time, even when we do not have a meeting. Stop on by for Open Cobol Support and chat. ---------------------------------------------------------------- [b]Self Contained OC/Add1 Programming Environment & Self Contained Program Distributions[/b] One of the things that will help uptake is a very simple install for OC and our libraries. Really it needs to be nearly instant. The same for the applications that we distribute written in OC. Along those lines I am exploring the idea of using a tiny GNU/Linux distribution like PuppyOS or Damn Small Linux, modified to have all the tools that we need, including libraries. Then an ISO can be distributed easily. The advantage to this is that we could also create Virtual Box vdi files, including guest additions. So the person would only have to install one "library" to get our working environment and apps up. That would be Vbox. With guest additions installed, our apps would run on the desktop just like any other program. Even if this doesn't interest anyone, it is significant enough for me that I will be working on it. ---------------------------------------------------------------- Note that USA switches time on Nov. 2 at 02:00. So the meeting time of Nov. 2 09:00 Eastern is UTC - 5. The UK and Europe have already switched. That means UK meet time is 14:00 and Europe is 15:00. Roger ---------------------------------------------------------------- Great session today; We covered off the agenda; Documentation; Discussed implications of moving from ReST to a wikitext form. Mention of emails sent to INCITS requesting information about getting permission to copy and paste from the COBOL Standard Technical Specification, COBOL-85 or better, COBOL-2002. Chat; IRC Freenode #add1tocobol will still be the main chat line for interested OpenCOBOL advocates. An IRCBOt will be put in place to copy the chatlogs to a searchable format on the web. Libraries; With the move to tikiwiki, a much better system of development collaboration should be available. We have been building up quite a toolkit of OpenCOBOL assistive technologies. Keeping with freedom of choice, we will probably provide dual layers for each of the extensions. A straight up CALL sequence, with helper COPYbook PERFORMable paragraphs when appropriate. Help for Roger; Yeah, we wish we could do more. And it turns out, a post was made to the open-cobol mailing list with an offer. We look forward to see if it bears fruit and we'll benefit from the good works of yet another talented individual. Websites; tikiwiki will be installed on a trial basis, but that is only to prove it can work for our team. Expectations are that yes it will and we will have access to the plethora of CMS/Groupware features that ship with tikiwiki. Wiki, Forum, Polls, Blog, Articles, Newsletters, Tasks, Fileshare, Image gallery, Workflow engine ... much more. Along with this, a plan to invoke a tkhtml widget from within the tctcl extension embedding Tcl/Tk in OpenCOBOL should allow for a rendering window controlled by an OpenCOBOL application. If it works, a Getting Started/New-To OpenCOBOL interactive teaching aid will be put on the work plate for development. Applications; This is still an open issue and with the install of tikiwiki, we'll be in a much better position to discuss the options, see where everyone's interests lie and how best to form teams. Miscellaneous; Roger did his normal "amaze the crowd" thing again, and started by putting forward the tidbit that OpenCOBOL allows a three line solution for native ASCII to EBCDIC conversion. SPECIAL-NAMES. ALPHABET alpha IS NATIVE. ALPHABET beta IS EBCDIC. INSPECT var CONVERTING alpha TO beta. Mention was also made of the Find and Replace challenge and to not overlook the INSPECT verb when dealing with certain substitute operations. Developers are encouraged to check the NIST test suite entry NC216A.CBL for examples of this powerful feature. Cheers, Brian ---------------------------------------------------------------- Subject: how to execute in a shell ? Hi, I don't manage to execute an open-cobol-executable in a shell : in a .profile ? Under Unix it is the command cobrun -F filename. But under Linux ??? Thanks for helping me. rudy hadoux. ---------------------------------------------------------------- Hello Rudy, OpenCOBOL can create object files, modules or executables [b]To create a linkable object file; creates filename.o[/b] [code] $ cobc -c filename.cob [/code] [b]To create a module (default); creates filename.so[/b] [code] $ cobc -m filename.cob $ cobcrun filename [/code] This is Roger's preferred method, [i](Roger is the lead developer for the OpenCOBOL compiler, with a well deserved reputation of having a deep understanding of the technology)[/i], but around here, we haven't completely bought into the benefits. Partly because, on the forums we discuss very small COBOL applications. [b]cobcrun[/b] expects the filename of the module, and will pick the program-id of the main for you. [i](This isn't quite true, but I'm glossing over many details.)[/i] [b]To create a shell executable[/b] [code] $ cobc -x filename.cob $ ./filename [/code] This is what you will see around here more often than not. We normally discuss binary executables. You just need to name the file to the shell to execute. [i]Just in case;[/i] the [b]./[/b] informs the shell to skip searching the PATH and find the program in the current directory. OpenCOBOL being what it is, allows for much greater flexibility than what I have shown here. [b]-b[/b] can be used to [i]build[/i] a package with the main and other sub programs in the same binary. -x and -m both accept a list of object files to include, etcetera. Feel free to ask more, I've glossed over many points and because of that, there are details and powerful options missing. Cheers, Brian ---------------------------------------------------------------- Thank you Brian. Tu parles français ? I don't want to execute by command but by a shell .profile. I think you answer to my question with 'cobcrun filename'. I am translating a Motorola unix VME cobol application into a personal computer linux application. Have a good day or night. rudy (Issy-les-Moulineaux). ---------------------------------------------------------------- When I do this : $ cobc -m filename.cob $ cobcrun filename I'v got the following message : 'libcob: Cannot find module 'YINITERM'' YINITERM is a c-function to execute a vt220-screen. What are the changes to do ? Thanks. rudy. ---------------------------------------------------------------- Yeah sorry Rudy, I guess I glossed over a few too many details. :-? [code] $ cobc filename.cob otherobject.o $ cobcrun filename [/code] [b]-m[/b] is the default action so you don't really need the switch, but I usually use it, just for clarity. And [b]cobc[/b] is pretty smart with combining all the required object files together. If YINITERM is in a library ([i]OpenCOBOL uses shared libraries, and uses them well[/i]) [code] $ cobc -m -llibrary filename.cob or perhaps $ cobc -m -L/usr/mylibpath/ -llibrary filename.cob maybeotherobj.o [/code] You can mix and match linking library functions with your own object files etcetera. Again, feel free to ask more. OpenCOBOL is fairly vast and we are still hard at it getting a New-To, User Guide, Reference Manual and other documents built up to a quality that the compiler deserves. Cheers, Brian ---------------------------------------------------------------- Specially for Rudy from Issy-les-Moulineaux : Bear is French, works with linux Debian/Ubuntu and has a valid mail address :-D Best Regards ---------------------------------------------------------------- Tu travailles en Ile de France ? A bientôt si tu veux. une adresse valide ? rudy. ---------------------------------------------------------------- ============Message for Rudy============= Bonjour Rudy, Clique sur mon nom et tu verras ... Best Regards ============ End Message ============ Sorry, this happens when people do not post their email address. ---------------------------------------------------------------- Subject: BASED in FILE SECTION doesn't work I've a file with a huge record length. It's only used at beginning and end of the program. That's why I've tried to use BASED, ALLOCATE and FREE ADDRESS OF for the record. The compiler says:[quote]Error: 'BASEDFILE-RECORD' BASED not allowed here[/quote]Can BASED be used for file-records? ---------------------------------------------------------------- No. It's restricted to working/local/linkage sections as per standard. Roger ---------------------------------------------------------------- Then there is no other possibility to save the memory of the file than a new subprogram handling the file and a memory affecting CANCEL statement for this program. I'll wait until You say I can try the quick and dirty environment setting. ---------------------------------------------------------------- Well, you could resort to the system call routines CBL_xxx where xxx is OPEN_FILE, WRITE_FILE, CLOSE_FILE. Refer to MF online doc for usage. Roger ---------------------------------------------------------------- Subject: Feature Request : GLOBAL support I'd like to get this feature on to the to do list. It's the only thing stopping Open COBOL being a viable compiler for my project (98,000,000 COBOL lines in 4,500 programs all with nested sub programs needing GLOBAL storage!). I've been starting to look into how EXTERNAL is implemented because in my head I think GLOBAL is similar but with more limited scope and (critically) without the need to define the storage in every sub program. If someone could tell me if I'm barking up the wrong tree or give a quick pointer at things/places to look into, that would be a great help. I see the parser has a flag_is_global in the field struct so that's a nice start :) (Is there a dedicated developer mailing list or forum) My thoughts on the matter are we could either... Move GLOBAL defined storage definitions outside of main() so that the nested sub program functions just use the exact same variables ... Probably not so good given how EXTERNAL is implemented (although, external needs to pass visibility back UP through a goback.. hmm) or Automatically define identical storage into any nested sub program for any GLOBAL item then be very similar to how EXTERNAL works but destroy (free) the storage on a goback. I don't know which approach would be more acceptable. Gravitating towards the second but I'd appreciate thoughts on the matter because if I do barrel ahead and add something myself, I don't want the effort to be wasted due to my using some unacceptable blundering technique! ---------------------------------------------------------------- Preliminary GLOBAL support has been added to current OC 1.1 tarball. Roger ---------------------------------------------------------------- Wow, that's great thank you. Testing now :-) ---------------------------------------------------------------- Subject: INITIALIZE Example with BASED var Here is a little example for everybody [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. 'INITTEST'. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. DATA DIVISION. * WORKING-STORAGE SECTION. * 77 mychar pic x. 77 mynumeric pic 9. 01 REC-TEST BASED. 03 REC-TEST-PART1 PIC X(10) value all '9'. 03 REC-TEST-PART2 PIC X(10) value all 'A'. 01 fillertest. 03 fillertest-1 PIC 9(10) value 2222222222. 03 filler PIC X value '|'. 03 fillertest-2 PIC X(10) value all 'A'. 03 filler PIC 9(03) value 111. 03 filler PIC X value '.'. *----------------------------------------------------------------- LINKAGE SECTION. *----------------------------------------------------------------- PROCEDURE DIVISION. *----------------------------------------------------------------- Main section. 00. * display 'fillertest ' 'on start:' end-display display fillertest end-display accept mychar * initialize fillertest display 'fillertest ' 'after initialize:' end-display display fillertest end-display accept mychar * initialize fillertest replacing numeric by 9 display 'fillertest ' 'after initialize replacing numeric by 9:' end-display display fillertest end-display accept mychar * initialize fillertest replacing alphanumeric by 'X' display 'fillertest ' 'after initialize replacing alphanumeric by "X":' end-display display fillertest end-display accept mychar * initialize fillertest replacing alphanumeric by all 'X' display 'fillertest ' 'after initialize replacing alphanumeric by all "X":' end-display display fillertest end-display accept mychar * initialize fillertest with filler display 'fillertest ' 'after initialize with filler:' end-display display fillertest end-display accept mychar * initialize fillertest all to value display 'fillertest ' 'after initialize all to value:' end-display display fillertest end-display accept mychar * ALLOCATE REC-TEST display 'REC-TEST after allocating:' end-display display REC-TEST end-display accept mychar * initialize REC-TEST all to value display 'REC-TEST after initalize all to value:' end-display display REC-TEST end-display accept mychar * stop run * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program INITTEST -------------------------------------[/code] ---------------------------------------------------------------- Subject: Sun Ultra5 Hello, I already included this message in the mailing list, but no answers. When I compile Open cobol on my test machine (Sun Ultra 5 running Ubuntu/Sparc), all is OK. When I try to 'make check', the test returns some error. I'm not a Cobl programmer (I set up this machine to learn it), then if you like I can opnen a ssh + ftp account on this system to test your Cobol compiler on Ubuntu/Sparc. Bye (and sorry dor my bad, bad english), Federico ---------------------------------------------------------------- What error was returned? ---------------------------------------------------------------- Fixed in current 1.1 tarball. Roger ---------------------------------------------------------------- All OK now. Thank you Roger. What is Open-cobol 1.2 present in tarball? A future relase? Federico ---------------------------------------------------------------- Not sure what you mean. I cannot see any reference to 1.2 in the 1.1 tarball. Roger ---------------------------------------------------------------- When I unzip the tarball on my Mac, I obtain 2 directory: open-cobol-1.1 and open-cobol-1.2 Federico ---------------------------------------------------------------- Subject: Online meeting November 9 reminder Reminder to join the meeting today. Start is 9:00 USA Eastern time which is 14:00 UK time and 15:00 European time. Everybody welcome. See what's being talked about. Simply enter into your browser - [code] http://www.add1tocobol.com/i_o_control_big.php [/code] Choose a reasonable nickname and you are in. Roger ---------------------------------------------------------------- Subject: Segmentation fault in OC on running I've tested a WRONG-CASE, this means something that should not compile at all. OC compiles this sample and when running ends in a segmentation fault. This sample is about a programmer (let's call him John :-), who uses copy and paste as many does. John wants to call the subprogram CALLPROG2, which was already in use in some other programs, from CALLPROG1. Therefore, he copied the whole necessary vars from SOMEPROG to CALLPROG1, together with the CALL itself. Problem: John copied the vars not to the WORKING-STORAGE but to LINKAGE-SECTION. We need 3 programs for our test, let's go! [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. LINKCALL. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. * WORKING-STORAGE SECTION. * 77 mychar pic x. 77 teststor1 pic x value '1'. 77 teststor2 pic x value '2'. *----------------------------------------------------------------- LINKAGE SECTION. *----------------------------------------------------------------- PROCEDURE DIVISION. declaratives. end declaratives. *----------------------------------------------------------------- main section. 00. display 'LINKCALL loaded, teststor1 = ' teststor1 ', teststor2 = ' teststor2 '.' end-display accept mychar * call 'CALLPROG1' using teststor1 teststor2 cancel 'CALLPROG1' display 'CALLPPROG1 canceld, teststor1 = ' teststor1 ', teststor2 = ' teststor2 '.' end-display accept mychar * stop run * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program LINKCALL--------------------------------------[/code] [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. CALLPROG1. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. * WORKING-STORAGE SECTION. * 77 mychar pic x. *----------------------------------------------------------------- LINKAGE SECTION. 77 teststor1 pic 9. 77 teststor2 pic 9. 77 wrongstor pic x value '3'. *----------------------------------------------------------------- PROCEDURE DIVISION using teststor1, teststor2. declaratives. end declaratives. *----------------------------------------------------------------- main section. 00. display 'CALLPROG1 loaded' accept mychar add 7 to teststor1, teststor2 * call 'CALLPROG2' using wrongstor cancel 'CALLPROG2' display 'CALLPPROG2 canceld, wrongstor = ' wrongstor '.' end-display accept mychar * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program CALLPROG1 ------------------------------------[/code] [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. CALLPROG2. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. * WORKING-STORAGE SECTION. * 77 mychar pic x. *----------------------------------------------------------------- LINKAGE SECTION. 77 wrongstor pic 9. *----------------------------------------------------------------- PROCEDURE DIVISION using wrongstor. declaratives. end declaratives. *----------------------------------------------------------------- main section. 00. display 'CALLPROG2 loaded, wrongstor = ' wrongstor '.' end-display subtract 2 from wrongstor accept mychar * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program CALLPROG2 ------------------------------------[/code] Now we start our test: [code]$ cobc CALLPROG1.CBL $ cobc CALLPROG2.CBL $ cobc -x LINKCALL.CBL /cobol/linkcall $ ./LINKCALL.exe LINKCALL loaded, teststor1 =1, teststor2 = 2. CALLPROG1 loaded 8790 [main] LINKCALL 5004 _cygtls::handle_exceptions: Error while dumping state (probably corrupted stack) Segmentation fault (core dumped)[/code] The segmentation fault is understandable: CALLPROG1 passes some reference to CALLPROG2 that does not exist, because LINKCALL doesn't pass wrongstor. We can even get the segmentation fault earlier, if we change the first lines of CALLPROG1 to [code] display 'CALLPROG1 loaded, wrongstor = ' wrongstor '.' end-display[/code] I think it would help a lot if OC-compiler checks: Is an item of the LINKAGE-STORAGE used, that isn't declared in USING clause of PROCEDURE DIVISION output something like: [quote]CALLPROG1.CBL: In paragraph '00': CALLPROG1.CBL:31: Error: 'wrongstor' is an item of LINKAGE-SECTION and was not passed in USING clause[/quote] ---------------------------------------------------------------- Well, a lot of legacy programs rely on LINKAGE items that are not referenced in the PROCEDURE ... USING. This is due to the fact that, prior to the 2002 standard, there was no BASED clause. So the only way to get an item with no initial storage was to define it in LINKAGE and then set up the address with a SET ADDRESS OF statement. Of course, as with all programming languages, there is plenty of rope to play with so you can easily hang yourself :-) Here we have a classic case of where defensive programming is an advantage ie. In CALLPROG1 and CALLPROG2 one should check the addressability - [code] IF wrongstor OMITTED DISPLAY/GOBACK whatever END-IF [/code] In fact, it does not hurt to do this for all items in LINKAGE. Roger ---------------------------------------------------------------- How good are the chances that you implement a warning parameter for this like that[code]-Wlink > Warn for linkage without using[/code] With -debug there should be a check about these vars (like it is already done with BASED vars). ---------------------------------------------------------------- Both done in current 1.1 tarball. NULL check is generated with "-debug". Also fixed the case that these vars are referenced in a "IF var [IS] [NOT] OMITTED" conditional. Obviously here we should not do the check (which we were doing previously). Warning param is "-Wlinkage". It is NOT set by "-Wall"; that would be too noisy for legacy progs. Roger ---------------------------------------------------------------- RR - Roger Rocks! Thank you! ---------------------------------------------------------------- Subject: null-terminated literals Recently I tried to code a "01 hugo pic x(05) value z'myprogname'" but I didn't succeed actually. I don't know if this is a compiler feature or compliant with standard 2002. Anyway, it's not too bad to have it. Can anyone of the guys tell me if I missed s.th. or if you are going to implement it? ---------------------------------------------------------------- I can't speak to future implementation, but we can use string catenation and hex literals for null bytes in OpenCOBOL. [code] 01 hugo pic x(05) value "mypr" & x"00". [/code] I don't have enough experience with other compilers to know if your example would have made hugo a value of "mypr" and a null or "mypro" with the null dropped off due to the picture size though. For non literals, we can also use [code] STRING var DELIMITED BY SIZE (or SPACE or ...) x'00' DELIMITED BY SIZE INTO null-term-var END-STRING [/code] Cheers, Brian ---------------------------------------------------------------- No, specifying Z as a null-terminator indication is not part of any standard (or proposed standard). It is unlikely that this will be implemented because, as Brian pointer out, there is a compatible alternative. Roger ---------------------------------------------------------------- Agree that Z can not be used for data defenitions. However, in IBM Enterprise COBOL for z/OS, it is possible to specify null-terminated literals using the Z. This would then be valid in IBM COBOL: [code]move Z'Anytext' to hugo move length of hugo to my-length[/code] which would leave 7 in my-length, since the length operator would count characters up to but not including the null. The Z'anytxt' should work as in VALUE declarations also. Regards Asger ---------------------------------------------------------------- You are right, maybe it's a question of taste, but "myprog" & x'00' reminds me somehow of a bitwise AND. ---------------------------------------------------------------- Subject: Default storage initialisation IBM COBOL has the Language Environment settings to say what values WORKING-STORAGE data items get if they don't have a VALUE clause on them. Micro Focus Server Express has the DEFAULTBYTE"00" (or whatever byte you like in " " ) directive to do the same job. Is there a switch or directive in Open COBOL to do the same thing? ---------------------------------------------------------------- It's automatic. Alphanumeric fields get set to spaces; binary fields to binary zero; packed fields (aka COMP-3) to zero (with right most nibble set according to sign); plain numeric fields (PIC 9) get set to numeric '0's and index/pointer fields get set to 0/NULL. Roger ---------------------------------------------------------------- Subject: What´s the Cond Code 2464 in Cobol ? I Compiled my program Cobol and it retuned the Cond Code 2464. Please...I need that sameone help me with this conditional code. Thanks :idea: ---------------------------------------------------------------- Subject: Feature Request: specify folder for -save-temps I want to store all gernerated c-files in a different place than my cobol-sources. So I vote for a new handling of -save-temps in a way that a folder can be specified (not must)[code] -save-temps Do not delete intermediate files -save-temps= Store intermediate files to given directory[/code]I know that it's possible to do move's but I prefer to have cobc doing the job. ---------------------------------------------------------------- Done in current 1.1 tarball. Help text adjusted (cobc --help). is checked - a) That it exists b) That it is a directory If (a) or (b) is not satisfied, a warning is produced and compilation continues as if "=" had not been specified. Roger ---------------------------------------------------------------- Subject: Regina Rexx layer for OpenCOBOL 1.1 Hello everyone; Here is a super simplistic layer for embedding Rexx. Requires regina-rexx, regina3, regina3-dev. First day, needs fencing. What follows is all code; sources that can be found at http://add1tocobol.com/tiki-list_file_gallery.php?galleryId=11 Cheers, [b]ocrexx.c[/b] [code] /* OpenCOBOL interface to Regina Rexx Interpreter */ /* Requires regina3 and regina3-dev */ /* cobc -I/usr/include/regina -c ocrexx.c */ #include #include #include int ocrexx(char *script, char *resfield, int reslen, short *result) { APIRET rexxapiret; RXSTRING retstr; short rexxret = 0; int ignore = 0; /* Initialize the engine, run the script */ rexxapiret = RexxStart(0, NULL, script, NULL, NULL, RXCOMMAND, NULL, &rexxret, &retstr); /* set result back to OpenCOBOL */ memset(resfield, ' ', reslen); memcpy(resfield, retstr.strptr, (retstr.strlength > reslen) ? reslen : retstr.strlength); *result = rexxret; /* Let Rexx do all the memory alllocation */ if (retstr.strptr != NULL) { ignore = RexxFreeMemory(retstr.strptr); } return (int)rexxapiret; } int ocrexxcmd(char *cmds, char *resfield, int reslen, short *result) { APIRET rexxapiret; RXSTRING retstr; RXSTRING arglist[1]; RXSTRING instore[2]; short rexxret = 0; int ignore = 0; /* I dunno, taken from 8.4 of the Regina3.4 pdf */ arglist[0].strptr = "//T"; arglist[0].strlength = 3; /* Move the command(s) to the instore array */ instore[0].strptr = cmds; instore[0].strlength = strlen(cmds); instore[1].strptr = NULL; instore[1].strlength = 0; /* Call Rexx, argcount 1 and &arglist to call syntax check */ rexxapiret = RexxStart(0, NULL, "FILLER", (PRXSTRING)&instore, "SYSTEM", RXFUNCTION, NULL, &rexxret, &retstr); /* set result back to OpenCOBOL */ memset(resfield, ' ', reslen); memcpy(resfield, retstr.strptr, (retstr.strlength > reslen) ? reslen : retstr.strlength); *result = rexxret; /* Let Rexx do all the memory alllocation */ if (instore[1].strptr != NULL) { ignore = RexxFreeMemory(instore[1].strptr); } if (retstr.strptr != NULL) { ignore = RexxFreeMemory(retstr.strptr); } return (int)rexxapiret; } [/code] [b]rexxcaller.cob[/b] [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *><* ***************** *><* Rexx in OpenCOBOL *><* ***************** *><* *><* :Author: Brian Tiffin *><* :Date: 13-Nov-2008 *><* :Purpose: Very High Level Regina Rexx engine *><* :Requires: regina-rexx, regina3, regina3-dev, OC 1.1 pre-rel *><* :Tectonics: *><* cobc -I/usr/include/regina -c ocrexx.c *><* cobc -x -lregina rexxcaller.cob ocrexx.o *><* ocdoc rexxcaller.cob rexxcaller.rst rexxcaller.html *> *************************************************************** identification division. program-id. rexxcaller. data division. *><* *><* ============= *><* Working Store *><* ============= *><* *><* :: *><* *><[ working-storage section. 01 apicode usage binary-long. 01 resultcode usage binary-short. 01 scriptname pic x(12) value 'verrexx.cmd' & x'00'. 01 cmds pic x(256). 01 rexxstring pic x(1024). *><] *> ************************************************************** procedure division. *><* *><* === *><* API *><* === *><* *><* ...... *><* ocrexx *><* ...... *><* Usage:: *><* compute apicode = function length(function trim(scriptname)) display "CALL Rexx with |" scriptname(1:apicode - 1) "|" end-display *><[ call "ocrexx" using by reference scriptname by reference rexxstring by value function length(rexxstring) by reference resultcode returning apicode end-call *><] display "|" apicode "|" resultcode with no advancing end-display display "|" function trim(rexxstring trailing) "|" end-display *><* *><* ......... *><* ocrexxcmd *><* ......... *><* Usage:: *><* *><[ move 'say "Hello World!"; ' & "'ls'; " & 'return "From Rexx";' & x'00' to cmds. compute apicode = function length(function trim(cmds)) display "CALL Rexx command with |" cmds(1:apicode - 1) "|" end-display call "ocrexxcmd" using by reference cmds by reference rexxstring by value function length(rexxstring) by reference resultcode returning apicode end-call display "|" apicode "|" resultcode with no advancing end-display display "|" function trim(rexxstring trailing) "|" end-display *><] *><* goback. end program rexxcaller. [/code] [b]verrexx.cmd[/b] [code] Parse Version ver; Say ver; return ver; [/code] [b]output[/b] [code] $ cobc -I/usr/include/regina/ -c ocrexx.c $ cobc -x -lregina rexxcaller.cob ocrexx.o $ ./rexxcaller CALL Rexx with |verrexx.cmd| REXX-Regina_3.3(MT) 5.00 25 Apr 2004 |+0000000000|+00000|REXX-Regina_3.3(MT) 5.00 25 Apr 2004| CALL Rexx command with |say "Hello World!"; 'ls'; return "From Rexx";| Hello World! daterexx.cmd errsrexx.cmd ocrexx.c rexcaller.html rexxcaller.cob tectonic datesrexx.cmd hellorexx.cmd ocrexx.o rexxcaller rexxcaller.rst verrexx.cmd |+0000000000|+00000|From Rexx| [/code] ---------------------------------------------------------------- Updated source code; http://oldsite.add1tocobol.com/tiki-list_file_gallery.php?galleryId=11 [b]tectonic[/b] [code] cobc -I/usr/include/regina/ -c ocrexx.c cobc -x -lregina rexxcaller.cob ocrexx.o ../ocdoc rexxcaller.cob rexxcaller.rst rexxcaller.html ../ocfaq.css ./rexxcaller [/code] [b]ocrexx.c[/b] [code] /* OpenCOBOL interface to Regina Rexx Interpreter */ /* Requires regina3 and regina3-dev */ /* cobc -I/usr/include/regina -c ocrexx.c */ #include #include #include int ocrexx(char *script, char *args, char *resfield, int reslen, short *result) { APIRET rexxapiret; RXSTRING retstr; RXSTRING arglist[1]; short rexxret = 0; int ignore = 0; /* Initialize the engine, run the script */ retstr.strptr = NULL; retstr.strlength = 0; arglist[0].strptr = args; arglist[0].strlength = strlen(args); rexxapiret = RexxStart(1, (PRXSTRING)&arglist, script, NULL, NULL, RXCOMMAND || RXRESTRICTED, NULL, &rexxret, &retstr); /* set result back to OpenCOBOL */ memset(resfield, ' ', reslen); if (rexxapiret == 0) { memcpy(resfield, retstr.strptr, (retstr.strlength > reslen) ? reslen : retstr.strlength); *result = rexxret; } /* Let Rexx do all the memory alllocation */ if (retstr.strptr != NULL) { ignore = RexxFreeMemory(retstr.strptr); } return (int)rexxapiret; } int ocrexxcmd(char *cmds, char *args, char *resfield, int reslen, short *result) { APIRET rexxapiret; RXSTRING retstr; RXSTRING arglist[1]; RXSTRING instore[2]; short rexxret = 0; int ignore = 0; /* For syntax check, no evaluate, taken from 8.4 of the Regina3.4 pdf */ arglist[0].strptr = "//T"; arglist[0].strlength = 3; arglist[0].strptr = args; arglist[0].strlength = strlen(args); /* Move the command(s) to the instore array */ instore[0].strptr = cmds; instore[0].strlength = strlen(cmds); instore[1].strptr = NULL; instore[1].strlength = 0; /* Call Rexx. Use argcount 1 and &arglist to call syntax check */ retstr.strptr = NULL; retstr.strlength = 0; rexxapiret = RexxStart(1, (PRXSTRING)&arglist, "FILLER", (PRXSTRING)&instore, "COMMAND" /* NULL */, RXCOMMAND, NULL, &rexxret, &retstr); /* set result back to OpenCOBOL */ memset(resfield, ' ', reslen); if (rexxapiret == 0) { memcpy(resfield, retstr.strptr, (retstr.strlength > reslen) ? reslen : retstr.strlength); *result = rexxret; } /* Let Rexx do all the memory alllocation */ if (instore[1].strptr != NULL) { ignore = RexxFreeMemory(instore[1].strptr); } if (retstr.strptr != NULL) { ignore = RexxFreeMemory(retstr.strptr); } return (int)rexxapiret; } [/code] [b]rexxcaller.cob[/b] [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *><* ***************** *><* Rexx in OpenCOBOL *><* ***************** *><* *><* :Author: Brian Tiffin *><* :Date: 13-Nov-2008 *><* :Purpose: Very High Level Regina Rexx engine *><* :Requires: regina-rexx, regina3, regina3-dev, OC 1.1 pre-rel *><* :Tectonics: *><* | cobc -I/usr/include/regina -c ocrexx.c *><* | cobc -x -lregina rexxcaller.cob ocrexx.o *><* | ocdoc rexxcaller.cob rexxcaller.rst rexxcaller.html *> *************************************************************** identification division. program-id. rexxcaller. data division. *><* *><* ============= *><* Working Store *><* ============= *><* *><* :: *><* *><[ working-storage section. 01 newline constant as x"0a". 01 apicode usage binary-long. 01 resultcode usage binary-short. 01 scriptname pic x(12) value 'verrexx.cmd' & x'00'. 01 argument pic x(256) value 'OC1.1 args' & x"00". 01 cmds pic x(1024). 01 rexxstring pic x(1048576). *><] *> ************************************************************** procedure division. *><* *><* === *><* API *><* === *><* *><* ------ *><* ocrexx *><* ------ *><* Pass a null-term scriptname, a null-term argument string *><* the return value field and length, the return code and *><* returning the Rexx api result code. *><* *><* Usage:: *><* compute apicode = function length(function trim(scriptname)) end-compute display "CALL Rexx with |" scriptname(1:apicode - 1) "|" end-display *><[ call "ocrexx" using by reference scriptname by reference argument by reference rexxstring by value function length(rexxstring) by reference resultcode returning apicode end-call display "|" apicode "|" resultcode with no advancing end-display display "|" function trim(rexxstring trailing) "|" end-display *><] *><* *><* --------- *><* ocrexxcmd *><* --------- *><* Usage:: *><* *><[ move "say 'Hello World!'; return 'From Rexx';" & x'00' to cmds. compute apicode = function length(function trim(cmds)) end-compute display newline "CALL Rexx command with |" cmds(1:apicode - 1) "|" end-display call "ocrexxcmd" using by reference cmds by reference argument by reference rexxstring by value function length(rexxstring) by reference resultcode returning apicode end-call display "|" apicode "|" resultcode with no advancing end-display display "|" function trim(rexxstring trailing) "|" end-display *><] *><* *><* or perhaps:: *><* *><[ move "parse arg argument; say '##' || argument || '##';" & x"0a" & "capture = '';" & x"0a" & "address system 'cat tectonic && cat verrexx.cmd && ls -l" & " && w3m rexxcaller.html'" & " with output fifo '';" & x"0a" & "DO i=1 WHILE queued() \= 0;" & x"0a" & " parse pull line;" & x"0a" & " capture = capture || line || '0a'x;" & x"0a" & "END;" & x'0a' & "return capture;" & x'00' to cmds compute apicode = function length(function trim(cmds)) end-compute display newline "CALL Rexx command with |" cmds(1:apicode - 1) "|" end-display call "ocrexxcmd" using by reference cmds by reference argument by reference rexxstring by value function length(rexxstring) by reference resultcode returning apicode end-call *><] display "|" apicode "|" resultcode with no advancing end-display display "|" function trim(rexxstring trailing) "|" end-display goback. end program rexxcaller. [/code] [b]output[/b] [code] CALL Rexx with |verrexx.cmd| REXX-Regina_3.3(MT) 5.00 25 Apr 2004 ocrexx.c ocrexx.o rexxcaller rexxcaller.cob rexxcaller.html rexxcaller.rst rexx.output tectonic verrexx.cmd |+0000000000|+00000|REXX-Regina_3.3(MT) 5.00 25 Apr 2004| CALL Rexx command with |say 'Hello World!'; return 'From Rexx';| Hello World! |+0000000000|+00000|From Rexx| CALL Rexx command with |parse arg argument; say '##' || argument || '##'; capture = ''; address system 'cat tectonic && cat verrexx.cmd && ls -l && w3m rexxcaller.html' with output fifo ''; DO i=1 WHILE queued() \= 0; parse pull line; capture = capture || line || '0a'x; END; return capture;| ##OC1.1 args## |+0000000000|+00000|cobc -I/usr/include/regina/ -c ocrexx.c cobc -x -lregina rexxcaller.cob ocrexx.o ../ocdoc rexxcaller.cob rexxcaller.rst rexxcaller.html ../ocfaq.css ./rexxcaller /* script for OpenCOBOL Regina Rexx */ Parse Version ver; Say ver; address system; 'ls'; return ver; total 60 -rw-r--r-- 1 brian brian 2469 2008-11-16 11:09 ocrexx.c -rw-r--r-- 1 brian brian 1624 2008-11-16 11:30 ocrexx.o -rwxr-xr-x 1 brian brian 15226 2008-11-16 11:30 rexxcaller -rw-r--r-- 1 brian brian 4477 2008-11-16 11:28 rexxcaller.cob -rw-r--r-- 1 brian brian 9312 2008-11-16 11:30 rexxcaller.html -rw-r--r-- 1 brian brian 3187 2008-11-16 11:30 rexxcaller.rst -rw-r--r-- 1 brian brian 659 2008-11-16 11:30 rexx.output -rwxr-xr-x 1 brian brian 162 2008-11-16 11:21 tectonic -rw-r--r-- 1 brian brian 101 2008-11-15 23:24 verrexx.cmd Rexx in OpenCOBOL Author: Brian Tiffin Date: 13-Nov-2008 Purpose: Very High Level Regina Rexx engine Requires: regina-rexx, regina3, regina3-dev, OC 1.1 pre-rel cobc -I/usr/include/regina -c ocrexx.c Tectonics: cobc -x -lregina rexxcaller.cob ocrexx.o ocdoc rexxcaller.cob rexxcaller.rst rexxcaller.html Working Store working-storage section. 01 newline constant as x"0a". 01 apicode usage binary-long. 01 resultcode usage binary-short. 01 scriptname pic x(12) value 'verrexx.cmd' & x'00'. 01 argument pic x(256) value 'OC1.1 args' & x"00". 01 cmds pic x(1024). 01 rexxstring pic x(1048576). API ocrexx Pass a null-term scriptname, a null-term argument string the return value field and length, the return code and returning the Rexx api result code. Usage: call "ocrexx" using by reference scriptname by reference argument by reference rexxstring by value function length(rexxstring) by reference resultcode returning apicode end-call display "|" apicode "|" resultcode with no advancing end-display display "|" function trim(rexxstring trailing) "|" end-display ocrexxcmd Usage: move "say 'Hello World!'; return 'From Rexx';" & x'00' to cmds. compute apicode = function length(function trim(cmds)) end-compute display newline "CALL Rexx command with |" cmds(1:apicode - 1) "|" end-display call "ocrexxcmd" using by reference cmds by reference argument by reference rexxstring by value function length(rexxstring) by reference resultcode returning apicode end-call display "|" apicode "|" resultcode with no advancing end-display display "|" function trim(rexxstring trailing) "|" end-display or perhaps: move "parse arg argument; say '##' || argument || '##';" & x"0a" & "capture = '';" & x"0a" & "address system 'cat tectonic && cat verrexx.cmd && ls -l" & " && w3m rexxcaller.html'" & " with output fifo '';" & x"0a" & "DO i=1 WHILE queued() \= 0;" & x"0a" & " parse pull line;" & x"0a" & " capture = capture || line || '0a'x;" & x"0a" & "END;" & x'0a' & "return capture;" & x'00' to cmds compute apicode = function length(function trim(cmds)) end-compute display newline "CALL Rexx command with |" cmds(1:apicode - 1) "|" end-display call "ocrexxcmd" using by reference cmds by reference argument by reference rexxstring by value function length(rexxstring) by reference resultcode returning apicode end-call | [/code] ---------------------------------------------------------------- Subject: printing method Hi unknown friends, I would like to know how to print "hello world" (why not ?) with a basical cobol program ? Thanks for giving me a list of code lines. rudy le français. Encore que je me sente plus universel que français... ---------------------------------------------------------------- Hello Rudy, Sorry for the delayed response. I assume you actually mean sending text to a printer, and not just a simple DISPLAY "Hello world" END-DISPLAY. Check this thread for some previous discussions we have had on this issue. I still don't have an active printer, so haven't done any testing in this area. http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=304&forum=1#forumpost1686 Cheers, Brian ---------------------------------------------------------------- Your reply suits me Brian. I thank you. rudy. ---------------------------------------------------------------- Hi guys, Porting our existing applications is going to be rather difficult (>2000 programs) without better/easier printer support. RM/Cobol uses a system similar to the AcuCobol method mentioned earlier: - A printfile is assigned to PRINT or PRINTER (instead of RANDOM or DISK). - The file is placed in the current working directory, using the external filename supplied in the SELECT (or in the variable named in the SELECT) statement. - If the name is listed in a configuration file, the configuration file specifies what shold be done. This way the file can be sent to a printer (e.g. using the lp command). I personally also use it to redirect the output to email (I use the Unix "mail $LOGNAME" command instead of lp). Information about the RM/Cobol implementation can be found in RM/Cobol user's guide http://www.liant.com/download/pdf/rmcug80.pdf on pages 10-24 through 10-28. Any idea if this could be implemented in OpenCobol? Thanks, Albert ---------------------------------------------------------------- Hello Albert, In fact, migration with OC needs some compatibility with RM or others. I like very much the configuration file "a la Acu". Different topics treated about "how to" . see http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=304&forum=1#forumpost1671 By the way can you tell us some more about "mail $LOGNAME" which seems to be very interesting option. Regards Bear ---------------------------------------------------------------- Ok then; What do we need to do to get a [code]CALL "CBL_OC_PRINT" USING[/code] developed to a point where it would be cross-platform enough to rate inclusion with OpenCOBOL? Do we start up a little community side project? I think we could provide a basic layer, nothing fancy, that could work across the various systems that our beloved OC runs on, providing a hook point or two that will allow for fancy printing when needed. Basically I envision cheating whenever possible and calling POSIX features when available or calls to some basic Windows functions. Anyone else? Cheers, Brian ---------------------------------------------------------------- Hi Bear, Printing from RM/Cobol using the lp print system on Unix (to a printer named prtoff): In RM/Cobol add the following to the config file: DEFINE-DEVICE device=PRTOFF path="lp -dprtoff -s" pipe=yes Use PRTOFF as the external filename SELECT ... ASSIGN TO PRINTER "PRTOFF" AcuCobol works is a similar way. Add the following to the config file: PRTOFF -P lp -dprtoff -s Now the email question. In Unix the variable $LOGNAME should contain the username used to log in to the system. If your unix system has email configured, you should be able to send yourself an email using the following command: ls / | mail -sls_output $LOGNAME the text after -s is the subject of the email I use the following to email reports directly to the user's inbox. I use MAILME as the external filename in the SELECT statement and add the following line to the RM/Cobol config file: DEFINE-DEVICE device=MAILME path="mail -soutput $LOGNAME" pipe=yes Note that this will only work if the mail command is executable (by the user) and the email system is properly configured. Some of my clients run their email using a separate email server so their users do not have access the email system of the server running the application. That is not a problem. It is simple to redirect the email from the application system to another system. No Cobol changes required. Just a matter of configuring the email software on the application system. Hope this helps! Regards, Albert ---------------------------------------------------------------- You could even go further and (with a small COBOL change) output this report to different places. Just use the name resolve of OC (see sample at [url=http://opencobol.add1tocobol.com/#what-are-the-opencobol-compile-time-configuration-files]oc configuration files[/url] about ASSIGN TO "DATAFILE"). All different targets (mail to person a/b, printer, ...) of the reports can be saved to a own config file and (depending on the wish of the user) be read and saved to DD_DATAFILE. [According to theory] human ---------------------------------------------------------------- There is another way to send a report anywhere you want. First you want to make sure that the output filename is unique (2 users could access the program at the same time and you do not want one to overwrite the other's file). You could achieve this by putting the PID (process ID) of the shell that starts the application in an environment variable. You could then write the report to a filename which contains this PID, e.g. /tmp/REP12345. The report could be sent anywhere using a SYSTEM call, e.g. call "SYSTEM" using "cat /tmp/REP12345 | mail -sreport foo@bar.com" or call "SYSTEM" using "lp -dlaslbx -oc -s /tmp/REP12345" While they work fine, I have a problem with these solutions: the application becomes specific to the operating system used. I would prefer to have Open Cobol use a config-like file (such as RM/Cobol and AcuCobol do) to send the report where it is wanted. That way my Cobol program stays nice and portable. Since RM and Acu have implemented this using pipes, I also do not have to worry about ensuring that filenames are unique. I assume that RM or Acu like functionality should not be too difficult to implement in OC. I have not checked the sourcecode, but assume that an OPEN OUTPUT or OPEN EXTEND of a LINE SEQUENTIAL file results in an fopen in C. If the SELECT has an ASSIGN TO PRINT (or PRINTER) the runtime should check if the external filename was included in the config file. If so, instead of opening a file, it should create a pipe. All writes are then sent to the pipe instead of a physical file. While I have some C experience, I have never used pipes in C programs. For that reason I am not sure if the background daughter process (lp, mail, etc.) should be spawned when the pipe is created (Cobol OPEN statement) or closed (Cobol CLOSE statement). Albert ---------------------------------------------------------------- I'm working towards answering the "Can you print from OpenCOBOL?" question and I kinda bumped into this... cupscob.cob [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian *> Date: 10-Aug-2009 *> Purpose: CUPS quick print *> Tectonics: cobc -lcups -x cupscob.cob *> *************************************************************** identification division. program-id. cupscob. data division. working-storage section. 01 result usage binary-long. 01 cupsError usage binary-long. 01 msgPointer usage pointer. 01 msgBuffer pic x(1024) based. 01 msgDisplay pic x(132). *> *************************************************************** procedure division. call "cupsPrintFile" using "cupsQueue" & x"00" "filename.prn" & x"00" "OpenCOBOL CUPS interface" & x"00" by value 0 by reference NULL returning result end-call if result equals zero call "cupsLastError" returning cupsError end-call display "Err: " cupsError end-display call "cupsLastErrorString" returning msgPointer end-call set address of msgBuffer to msgPointer string msgBuffer delimited by x"00" into msgDisplay end-string display function trim(msgDisplay) end-display else display "Job: " result end-display end-if goback. end program cupscob. [/code] Is it that easy? Am I naive and missing great huge complexity requirements? I'm asking as I don't have a printer hooked up here. I get [code] $ ./cupscob Err: +0000001030 No such file or directory [/code] when filename.prn doesn't exist and [code] $ ./cupscob Err: +0000001030 The printer or class was not found. [/code] when it does, so I take that as a good sign that it really may be that easy, if [i]that easy[/i] is appropriate for OpenCOBOL developers. [b]Edit;[/b] Yeah, can't be that easy. I'm not sure how the error number works. Can't find docs on ipp_status_t and just that both conditions above print the same number ... something is fishy. [b]Edit 2;[/b]Ok, a little side trip to cups/ipp.h and yes, the number should be 0x0406, clientside-not-found, 1030. But it's a big API and I'm sure the details of what wasn't found is squirreled away somewhere for the String form to be so specific. Anyway, now I'm rambling something quick and easy into something long and winded. Cheers, Brian ---------------------------------------------------------------- I've been using OpenCOBOL WRITEs to send HTML to a file. After the file is CLOSEd I use CALL "SYSTEM" to display the "printed" report for the user. The user is then free to use the web browser's "Print" command to print it if they wish. Of course, I don't have 2000+ programs to migrate to OC, and if you have to implement a mainframe-like batch process (or a Unix-like background) solution this probably wouldn't be too appropriate. ---------------------------------------------------------------- Subject: C-Noob wonders about C-files generated by OC Every COBOL program is a new function in the C-files generated by OC. The PERFORM statement is implemented by some stack like[quote] /* TESTPGM.COB:2966: PERFORM */ { /* PERFORM BEGINNING THRU BEGINNING */ frame_index++; frame_stack[frame_index].perform_through = 6; frame_stack[frame_index].return_address = &&l_473; goto l_6; l_473: frame_index--; }[/quote] Why are the sections not functions themselves, that are called by other functions? I tried -O2 (Optimization by C-Compiler) on some huge OC generated files and it needs some time and quite a lot of memory. I think the main reason for that can be found in the one HUGE function. I'm not sure if small functions will help but it seems to (according to to man pages):[quote] -O1 Optimize. Optimizing compilation takes somewhat more time, and [b]a lot more memory for a large function[/b].[/quote] ---------------------------------------------------------------- Well, there are many reasons but one is - Consider (note similarly applies to SECTIONs) [code] .... PERFORM P1 THRU P3. .... IF condition GO TO P2 END-IF .... *> Drop through into P1 P1. .... IF condition GO TO P3 END-IF .... P2. .... IF condition GO TO P3 END-IF .... P3. .... *> If not an exit from a PERFORM, drop through P4. .... [/code] Another reason is the scope of local variables. Regarding the optimization options, there is NO extra processing time/memory from the OC compiler side. The generated C code is the same regardless of optimization options or not. However, "-Os" and "-O2" DO optimize some operations on binary fields but these are buried in the standard OC include file "libcob.h" and are therefore not visible in the generated C code. All extra time/memory comes from the C compiler. You may find that "-Os" is a viable option. Roger ---------------------------------------------------------------- Hm, I see the difficulty of more than one function because they have to use each other. Have all variables to be local ones? The C compiler time (and in first line the compiler memory usage) is the reason that I though of the possibility to use more than one function. ---------------------------------------------------------------- Subject: Scientific notation Hi all, I hope this question hasn't been asked before. I sure did not find any reference to this. Thing is: I am in the process of moving away from MF to OC, and the main thing that is blocking me right now is the fact that in lots of sources the scientific notation was used. I made a temporary workaround by specifying a static PIC, like so: [code] 03 FM0024. * 04 FM0024-M PIC -.9999999999999999E-99. 04 FM0024-M PIC ----------9.99. 03 FI0024 VALUE ZERO USAGE COMP-2. [/code] While this is currently working, I do not know all the parameters the original programmer had in mind. Is there any plan to enable scientific notation PICs in OC? Thanks, Weo ---------------------------------------------------------------- Subject: Thanks to aoirthoir; New OpenCOBOL advocacy site There is a new [b]TikiWiki[/b] Site at http://add1tocobol.com This is all thanks to the good efforts of [i]aoirthoir[/i]. Along with OpenCOBOL, other open source and COBOL efforts will be championed on this TikiWiki. For those looking for the IRC chatline, it is now at http://add1tocobol.com/chat.php The site needs an appropriate skin, and things are still in flux, but is stabilizing and growing quickly. Cheer, Brian Note; The goal is to augment opencobol.org so primary discussion relating to our favourite open source product will always be here on opencobol.org. ---------------------------------------------------------------- Subject: Install on cygwin This might be libGMP. Re; 1. The README file states both the runtime and dev are required. Same for libGMP. There are docs for OC, but you kind of have to poke around a little to find some of the gems. ;) Cheers, Brian ---------------------------------------------------------------- Several notes: 1. I had to install db4.5-devel (not just db4.5), so it might be advisable to point that out explicitly in the installation requirements. 2. I first installed without libltdl, but that failed during the "make" step, with a long list of errors, beginning with: gcc -I/usr/local/include -I/usr/include -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -Wl,--export-all-symbols -Wl,--enable-auto-import -o cobcrun.exe cobcrun-cobcrun.o -L/usr/local/lib -L/usr/lib -L/cygdrive/c/OpenSource/open-cobol-1.1/libcob /cygdrive/c/OpenSource/open-cobol-1.1/libcob/.libs/libcob.a /usr/local/lib/libgmp.a /usr/lib/libdb-4.5.dll.a cygdrive/c/OpenSource/open-cobol-1.1/libcob/.libs/libcob.a /usr/local/lib/libgmp.a /usr/lib/libdb-4.5.dll.a /cygdrive/c/OpenSource/open-cobol-1.1/libcob/.libs/libcob.a(libcob_la-numeric.o):numeric.c:(.text+0x3ed7): undefined reference to `__imp____gmpz_init2' /cygdrive/c/OpenSource/open-cobol-1.1/libcob/.libs/libcob.a(libcob_la-numeric.o):numeric.c:(.text+0x3f17): undefined reference to `__imp____gmpz_ui_pow_ui' /cygdrive/c/OpenSource/open-cobol-1.1/libcob/.libs/libcob.a(libcob_la-numeric.o):numeric.c:(.text+0x3f33): undefined reference to `__imp____gmpz_mul' /cygdrive/c/OpenSource/open-cobol-1.1/libcob/.libs/libcob.a(libcob_la-numeric.o):numeric.c:(.text+0x3f54): undefined reference to `__imp____gmpz_ui_pow_ui' /cygdrive/c/OpenSource/open-cobol-1.1/libcob/.libs/libcob.a(libcob_la-numeric.o):numeric.c:(.text+0x3f70): undefined reference to `__imp____gmpz_tdiv_q' /cygdrive/c/OpenSource/open-cobol-1.1/libcob/.libs/libcob.a(libcob_la-numeric.o):numeric.c:(.text+0x3ffb): undefined reference to `__imp____gmpz_set' /cygdrive/c/OpenSource/open-cobol-1.1/libcob/.libs/libcob.a(libcob_la-numeric.o):numeric.c:(.text+0x402b): undefined reference to `__imp____gmpz_set_d' and ending with: /cygdrive/c/OpenSource/open-cobol-1.1/libcob/.libs/libcob.a(libcob_la-intrinsic.o):intrinsic.c:(.text+0x3622): undefined reference to `__imp____gmpz_set_ui' /cygdrive/c/OpenSource/open-cobol-1.1/libcob/.libs/libcob.a(libcob_la-intrinsic.o):intrinsic.c:(.text+0x37af): undefined reference to `__imp____gmpz_set_ui' /cygdrive/c/OpenSource/open-cobol-1.1/libcob/.libs/libcob.a(libcob_la-intrinsic.o):intrinsic.c:(.text+0x3859): undefined reference to `__imp____gmpz_set_ui' /cygdrive/c/OpenSource/open-cobol-1.1/libcob/.libs/libcob.a(libcob_la-intrinsic.o):intrinsic.c:(.text+0x38c4): undefined reference to `__imp____gmpz_set_ui' /cygdrive/c/OpenSource/open-cobol-1.1/libcob/.libs/libcob.a(libcob_la-intrinsic.o):intrinsic.c:(.text+0x3e47): more undefined references to `__imp____gmpz_set_ui' follow /cygdrive/c/OpenSource/open-cobol-1.1/libcob/.libs/libcob.a(libcob_la-intrinsic.o):intrinsic.c:(.text+0x4359): undefined reference to `__imp____gmpz_set' /cygdrive/c/OpenSource/open-cobol-1.1/libcob/.libs/libcob.a(libcob_la-intrinsic.o):intrinsic.c:(.text+0x437e): undefined reference to `__imp____gmpz_set_ui' collect2: ld returned 1 exit status The culprit seems to be the "__imp__" prefix, because the gmpz_* routines appear to be in libgmp.a 3. After installing the GNU Libtool (libltdl) the build completed successfully, so it might be a good idea not to tell cygwin users that it isn't needed... maybe? However, 4. Doing a "make check" resulted in all the tests (5 sets of 5-171 individual tests) are failing. Suggestions anybody? Thanks, Jonathan ---------------------------------------------------------------- Subject: Sample program to display date of easter Hello, Just horsing around. But please feel free to put my version to shame. Cheers, Brian [b]easter.cob[/b] [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 17-Nov-2008 *> Purpose: Display Easter Day for any given year, 1580 - 2050 *> Tectonics: cobc -x easter.cob *> ./easter [year] *> *************************************************************** identification division. program-id. easter. data division. working-storage section. 01 a picture 9(8). 01 b picture 9(8). 01 c picture 9(8). 01 d picture 9(8). 01 z picture 9(8). *> Why z? COBOL has pi for pi and e for e 01 f picture 9(8). 01 g picture 9(8). 01 h picture 9(8). 01 i picture 9(8). 01 j picture 9(8). 01 year picture 9(4). 01 mo picture 9(2). 01 da picture 9(2). 01 args picture x(80). *> *************************************************************** procedure division. accept args from command-line end-accept if args not equal spaces move args to year else display "Year: " with no advancing end-display accept year end-accept end-if compute a = function mod(year 19) end-compute divide year by 100 giving b remainder c end-divide divide b by 4 giving d remainder z end-divide compute f = (b + 8) / 25 end-compute compute g = (b - f + 1) / 3 end-compute compute h = (19 * a) + b - d - g + 15 end-compute compute h = function mod(h 30) end-compute divide c by 4 giving i remainder j end-divide compute c = (z + i) * 2 + 32 - h - j end-compute compute c = function mod(c 7) end-compute compute b = (a + (11 * h) + (22 * c)) / 451 end-compute compute a = h + c - (7 * b) + 114 end-compute compute da = function mod(a 31) + 1 end-compute divide a by 31 giving mo end-divide display "yyyy/mm/dd: " year "/" mo "/" da end-display goback. *> *************************************************************** *> Snagged from a REBOL script, easter-day.r by Didier Cadieu *> http://www.rebol.org/view-script.r?script=easter-day.r *> *> easter-day: func [ *> {Compute the easter date for the wanted year.} *> year [integer!] {Year for whitch you want the easter date} *> /local a b c d z f g h i k *> ] [ *> a: year // 19 *> b: to integer! year / 100 *> c: year // 100 *> d: to integer! b / 4 *> z: b // 4 *> f: to integer! b + 8 / 25 *> g: to integer! b - f + 1 / 3 *> h: 19 * a + b - d - g + 15 // 30 *> i: to integer! c / 4 *> k: c // 4 *> c: z + i * 2 + 32 - h - k // 7 *> b: to integer! a + (11 * h) + (22 * c) / 451 *> a: h + c - (7 * b) + 114 *> to date! reduce [ *> a // 31 + 1 *> to integer! a / 31 *> year *> ] *> ] end program easter. [/code] ---------------------------------------------------------------- Subject: internal compiler error Hi, I have an internal compiler error : "Unknown tree tag 10 Category 0 tree.c:397: Internal compiler error Aborting compile of SAI.cob at line 1100" How to remedy this kind of problem ? Thanks. rudy. ---------------------------------------------------------------- I have 4 warnings before. It may be linked. No previous data item of level 02. rudy. ---------------------------------------------------------------- Rudy; depending on how free you are to do so... A snippet of code will help a lot with this. I'm going to bet it is a syntax error of some form or other that is tripping this. And if we do figure it out, we can post the snippet for Roger's benefit, (and knowing Roger he'll have a solution racing through his brain before his fingers can hit the keys) :) If you aren't free to post snippets then it'll be harder but not impossible to track down the cause of and fix for the problem. Cheers, Brian ---------------------------------------------------------------- Subject: static linking Hello I am trying to use static linking as indicated on the user-manual Compile each file with the option -c, and link them at the end. The top-level program must be compiled with the option -fmain: $ cobc -c subr1.cob $ cobc -c subr2.cob $ cobc -c -fmain main.cob $ cobc -o prog main.o subr1.o subr2.o but when i do $ cobc -c -fmain main.cob it says cobc: unrecognized option `-fmain' everyone knows why??? ---------------------------------------------------------------- Hello duca2009; I'm still fairly new; -fmain seems way old. The User Manual on opencobol.org is from before OpenCOBOL 1.0. A problem that is being corrected. For now, drop the -c -fmain and try -x, something like [code] $ cobc -c subr1.cob $ cobc -c subr2.cob $ cobx -x -o prog main.cob subr1.o subr2.o [/code] should produce a [b]prog[/b] executable. There are other ways of pulling this off as well, using modules and cobcrun for instance, but see if the above sequence works out first. Although it is not filled with enough information yet, a new FAQ is in place at http://opencobol.add1tocobol.com Cheers, Brian ---------------------------------------------------------------- Subject: Command line arguments in OpenCOBOL Hello everyone; Before treading down possibly trodden paths, does anyone that hangs out here in open COBOL land have a [i]command line argument handling[/i] idiom, template or callable? Or advice or thoughts? Cheers and Thanks, Brian ---------------------------------------------------------------- What about: accept something from command-line Gerald ---------------------------------------------------------------- From taccess in the cobdbi extension. I've seen some nicer code on this archive but I kept it simple. [code] 1030-dbCmdArguments. accept dbType from argument-value. accept dbHost from argument-value. accept dbUser from argument-value. accept dbName from argument-value. accept dbEncode from argument-value. accept dbPass from argument-value. [/code] Running taccess with commands of the program [code] ./taccess $COB_DBI_TYPE $COB_DBI_HOST $COB_DBI_USER $COB_DBI_NAME $COB_DBI_ENCODE $COB_DBI_PASS [/code] ---------------------------------------------------------------- Thanks for those, but I was wondering if there was something along the lines of getopt or argparse. Take a look at the occurlrefresh.cbl for a way aoirthoir and I used 88 level values for testing arguments. While that idiom can make for a simple to code large list of options, it is not good for positional independence. Permutations make for a lot of lines. jrls ARGUMENT-VALUE could come in handy. [i]But, I'll leave open hope for a pre-written proc.[/i] ;) Cheers and thanks again, Brian ---------------------------------------------------------------- Brian this is better than my last try. [code] >>source format is free *>********************************************************************* *> Author: jrls (John Ellis) *> Date: Nov-2008 *> Purpose: command line processing *>********************************************************************* identification division. program-id. cmdline. data division. *> working-storage section. *>****************************************** 01 argv pic x(100) value spaces. 88 recv value "-r", "--recv". 88 email value "-e", "--email". 88 delivered value "-d", "--delivered". 01 cmdstatus pic x value spaces. 88 lastcmd value "l". 01 reptinfo. 05 rept-recv pic x(30) value spaces. 05 rept-howsent pic x(10) value spaces. *> procedure division. 0000-start. *> perform until lastcmd move low-values to argv accept argv from argument-value if argv > low-values perform 0100-process-arguments else move "l" to cmdstatus end-if end-perform display reptinfo. stop run. *> 0100-process-arguments. *> evaluate true when recv if rept-recv = spaces accept rept-recv from argument-value else display "duplicate " argv end-if when email move "email" to rept-howsent when delivered move "delivered" to rept-howsent when other display "invalid switch: " argv end-evaluate. [/code] I believe [i][b]accept from argument-value[/b][/i] works better than [i][b]accept from command-line[/b][/i] because of the way the first type handles quoted parms with spaces. See the run from bellow. [code] ./cmdline --recv "john ellis" -e -f invalid switch: -f john ellis email [/code] ---------------------------------------------------------------- I had expected OpenCobol to do as many other languages - delivering it as arguments. Then you could do [code] linkage section. 01 cmd-argument. 02 len pic 9(4) usage binary. 02 some-text pic x(256). procedure division using cmd-argument. display 'You wrote:' '>' some-text(1:len) display 'You cant do that kind of stuff :-)' [/code] Unexpectedly I had a compile error, saying [code] cmdinput.cob.25: Error: Executable program requested but PROCEDURE/ENTRY has USING clause [/code] Hm? In IBM Enterprise COBOL this is working OK. And Reference says nothing about this clause being in conflict with COBOL standard. Reading MF manuals make me believe that MF also allows this. I haven't been able to find the 2002 standard - so I couldn't check. In my mind it would be logical to allow the argument. Would this feature be added (if not in conflict with 2002 standard) ? Best Regards :-) ---------------------------------------------------------------- That's an awesome code idiom John. arg parsing is usually pretty specific to each app, but this is a great template to start from. Well done and thanks. Everyone else; this code has also been put into the add1tocobol TikiWiki at http://oldsite.add1tocobol.com/tiki-download_file.php?fileId=54 Cheers, Brian ---------------------------------------------------------------- Asger; OpenCOBOL doesn't receive argc argv in the "normal" sense of command line options. We have access to [code] ACCEPT args FROM COMMAND-LINE END-ACCEPT [/code] which gives the entire command line as a single string (less the argv[0] bit) and [code] ACCEPT one-arg FROM ARGUMENT-VALUE END-ACCEPT [/code] which gives the "next" argument. And (requires some looking into) ARGUMENT-NUMBER and ENVIRONMENT-VALUE are also available. Both for DISPLAY UPON and ACCEPT FROM. [code] ACCEPT val FROM ENVIRONMENT "PATH" END-ACCEPT DISPLAY "myval" UPON ENVIRONMENT "MYENV" END-DISPLAY [/code] Gee, I just looked quickly. Roger has given us all kinds of goodies with this. ENVIRONMENT-NAME, ENVIRONMENT-VALUE and the ENVIROMNENT "envvar" shortcut, along with ARGUMENT-NUMBER and ARGUMENT-VALUE. This will soon be an article in the FAQ, once figured out. OpenCOBOL is vast, wide and deep. [i]While looking I just noticed H"ABCDEF" hexadecimal numeric literal syntax.[/i] So many rich features. More motivation for the Utilization Guide. Cheers, Brian ---------------------------------------------------------------- Asger: Try using CHAINING (the var goes to WORKING-STORAGE instead of LINKAGE) [code] WORKING-STORAGE SECTION. 01 cmd-argument. 02 some-text pic x(256). procedure division Chaining cmd-argument. display 'You wrote:' '>"' function trim(some-text) '"' end-display display 'You cant do that kind of stuff :-)'[/code] ---------------------------------------------------------------- Human and Brian Thanks you for guiding. Chaining works fine for preformatted parameters - a good replace of the IBM-way (except I have to remove the length indicator). The parameter parsing is nice - since that would be cumbersome in plain COBOL. Regards Asger :-) ---------------------------------------------------------------- Subject: LINKING COBOL WITH ORACLE Hi I am having some problems linking cobol programs with c programs that have Oracle calls For example for compiling my programm I write the following command cobc -x -o rtsp rtsp.cob qeAllEndSql.o qeBeginTran.o qeCommit.o qeConnect.o qeDBErr.o qeDisconnect.o qeEndSql.o qeErr.o qeErrMsgBuf.o qeExec.o proc/pgm/dbflib.o proc/pgm/ftplib.o proc/pgm/uticl_c.o proc/pgm/qelib.o /oracle/product/db92/precomp/lib/cobsqlintf.o -I include -L /oracle/product/db92/precomp/lib/cobsqlintf.o -L /oracle/product/db92/lib/libclntsh.so -L /oracle/product/db92/lib/libsql9.a -L /oracle/product/db92/lib/libclntst9.a As result of the compilation I have the following error: proc/pgm/qelib.o(.text+0x18e): In function `CqeConnect': : undefined reference to `sqlcxt' proc/pgm/qelib.o(.text+0x22d): In function `CqeConnect': : undefined reference to `sqlcxt' proc/pgm/qelib.o(.text+0x2bf): In function `CqeDisconnect': : undefined reference to `sqlcxt' proc/pgm/qelib.o(.text+0x378): In function `CqeCommit': : undefined reference to `sqlcxt' proc/pgm/qelib.o(.text+0x424): In function `CqeRollback': : undefined reference to `sqlcxt' proc/pgm/qelib.o(.text+0x13c2): In function `set_bind_fetch': : undefined reference to `sqlnul' proc/pgm/qelib.o(.text+0x1524): In function `set_bind_fetch': : undefined reference to `sqlprc' .... Does anyone knows what these could be? Thanks ---------------------------------------------------------------- Hello duca2009 The cobc -L option adds a directory to search for libraries. -l (little ell) links in a library. So you would want to use something like [code] -L /oracle/product/db92/lib/ -lclntsh.so [/code] Note that in GNU/Linux land, -l assumes 'lib' prepends the name, so in this sample, libclntsh.so is linked with -lclntsh Cheers, Brian ---------------------------------------------------------------- You included everything except libcntsh.so Use -L $ORACLE_HOME/lib -lclntsh You do need the cobsqlintf stuff despite it being 'micro focus' only. ---------------------------------------------------------------- Subject: bug in screen io? I think there is a bug in the screen io. Normally a variable is filled with spaces for empty characters. But when I edit a field using screen-io, the variable ends with a '\0' character (like in C). This is probably due to the use of the ncurses library. The value returned by ncurses is not processed (all '\0' characters should be modified to spaces). I don't have time to fix the error in the code. Can someone do? ---------------------------------------------------------------- I don't know if Roger will have time to fix [i](fix is the wrong word; C can have nulls in it)[/i] all of the C => COBOL => C routines, but if you are really stuck in the short term... From the OCFAQ; http://opencobol.add1tocobol.com/#q-what-are-some-idioms-for-dealing-with-c-char-data-from-opencobol [code] * Change nulls to spaces INSPECT cobol-field REPLACING ALL X"00" WITH SPACE. [/code] Cheers, Brian ---------------------------------------------------------------- Yes, it works :-) (I only needed to type 'BY' in stead of 'WITH') Thanks! ---------------------------------------------------------------- Subject: An OpenCOBOL Utility Belt First a question for everyone. While developing, would you prefer a pick and choose subdirectory of separate object files or a single dynamic shared object (or two) with a miscellaneous collection of utility routines? By utility, I mean things like memory dump, various conversions, and other miscellany that can aid development, debug and deployment. Second part of the discussion will depend on the general feel received from the fist part. Cheers, Brian ---------------------------------------------------------------- I'd prefer different object files because: - if you put all stuff into one object file, everything is loaded into memory, if used or not (say you wanted the 4 KB utility of the 4 MB object file) - if there is a different file for each sub program (the utilities you've mentioned) you only need to deliver the object files of the utilities you'd used ---------------------------------------------------------------- I completely agree with human : use what you need ! Regards Bear ---------------------------------------------------------------- Subject: FR for more help in compiler error messages I've tried to compile a program like this [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. 'COMPTEST'. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. DATA DIVISION. * WORKING-STORAGE SECTION. * 78 something value '2'. * * ... insert a lot of vars here * 01 filler. 03 something pic x(03). 03 something2 pic 9(01). *----------------------------------------------------------------- LINKAGE SECTION. *----------------------------------------------------------------- PROCEDURE DIVISION. *----------------------------------------------------------------- Main section. 00. * stop run * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program COMPTEST -------------------------------------[/code] Error: [quote]$ cobc -x COMPTEST.CBL COMPTEST.CBL:17: Error: syntax error, unexpected "Literal", expecting EXTERNAL or GLOBAL[/quote] In this small sample, the error is quite obvious: something under filler cannot work, the compiler inserts the value "2" in this point because there is a level 78 entry called something before. If the level 78 something is hidden in a copy you could take a lot of time for searching this bug. Is it possible to have an error message like [quote]$ cobc -x COMPTEST.CBL COMPTEST.CBL:17: Error: syntax error, level 78 item can not be used here, leads to: unexpected "Literal", expecting EXTERNAL or GLOBAL[/quote] I think it's not easy but maybe anyone has an idea how the compiler can check for errors like this. ---------------------------------------------------------------- Tu n'as pas déclaré la variable something : 78 something pic 9 value 2. ---------------------------------------------------------------- You are not allowed to define a picture clause for level 78, because these are constants. [quote][url=http://supportline.microfocus.com/documentation/books/nx50/lhpdf402.htm#0005]MicroFocus Online Docs[/url] "[It] defines a constant-name, which is a symbolic name representing a constant value assigned to it when the source code is passed through your COBOL system. Your COBOL system replaces each reference to a constant-name by its value."[/quote] With level 78 vars you can do the following, which is not possible with any other level:[code]78 sampleconst value 12. 01 filler. 02 samplevar occurs sampleconst.[/code] ---------------------------------------------------------------- So, what is the line that gives a problem ? rudy. ---------------------------------------------------------------- The problem occurs if you use a 78-constant as a normal level var. If you define two vars on level 01 with the same name, OC Compiler says, that it's defined more than one time. If you use the same name you've defined as a level 78 constant somewhere, it is replaced by the value of the level 78 and therefore the following is done in the previous given sample[code] 01 filler. 03 '2' pic x(03). 03 something2 pic 9(01).[/code] This leads clearly to an error, but this error is really hard to find if that level 78 is defined in some copy. Therefore a better warning would be helpfull. ---------------------------------------------------------------- This particular problem is fixed in current 1.1 tarball. There are some other places where 78 usage is invalid that need to be looked at. Roger ---------------------------------------------------------------- The wonderful OC compiler says now [quote]$ cobc -x COMPTEST.CBL COMPTEST.CBL:17: Error: CONSTANT (78 level) may not be used here - 'something'[/quote] Some of the other places are maybe all places, where a value is moved to a constant [code]move 1 to something initialize something[/code]On these points the compiler always says [quote]Error: syntax error, unexpected "Literal", expecting ADDRESS or "Identifier"[/quote] Keep the good work, human ---------------------------------------------------------------- Subject: installation error ? Hi, I've installed open-cobol on a new linux-PC. And when I've launched : ./MENGEN (MENGEN = menu général) I've got the following error message : ./MENGEN: error while loading shared libraries: libsmf.so: cannot open shared object file: No such file or directory Somebody can help me ? rudy. ---------------------------------------------------------------- Hello Rudy, Some more information please. What do you mean by Linux-PC ? which distribution ? Have you checked environment var COB_LIBRARY_PATH ? etc Regards Bear ---------------------------------------------------------------- J'ai fait une installation toute simple avec ./configure. Où se trouve COB_LIBRARY_PATH ? Dans le Makefile ? Où est installée cette bibliothèque ? Merci. rudy. ---------------------------------------------------------------- Hi Rudy, What is MENGEN ? Do You have any source file to post ? I still do not know what distribution you're using ... Is MENGEN a cobol program ? does it have a call "lib..." ? Give us complete information, so we'll help you Regards Bear ---------------------------------------------------------------- Subject: Intercepting DISPLAY output Hello everyone, I have a doubt. Is it provided some interface to intercept output from DISPLAY command? I am calling my cobol code from C code. But I would like to use a callback to get a output from display insteaf of pipe concept. Thanks Gaeta ---------------------------------------------------------------- Subject: OpenCOBOL 1.1 evaluation pre-release passes the NIST tests Hello everyone, Here I go again, stealing Roger's thunder; but I get excited. And I might also be in trouble for announcing something that is still a work in progress. ;) THIS JUST IN The last tarball (28-Nov-2008) produces the following summary from running the NIST test pass: [code] ~/build/open-cobol-1.1/tests/cobol85$ cat summary.log Module programs executed error crash details ------ -------- -------- ----- ----- ------- NC 92 92 0 0 4363,0,6,11/4380 SM 15 13 0 0 289,2,3,1/295 IC 24 24 0 0 246,0,4,0/250 SQ 81 81 0 0 512,0,6,81/599 RL 32 32 0 0 1827,0,5,0/1832 IX 39 39 0 0 507,0,1,0/508 ST 39 39 0 0 278,0,0,0/278 IF 42 42 0 0 732,0,0,0/732 ------ -------- -------- ----- ----- ------- Total 364 362 0 0[/code] So this is looking like pretty good coverage of the NIST standards test suite. Sweet. Free and open COBOL. Cheers, Brian ---------------------------------------------------------------- What are the two not executed 'SM' tests? ---------------------------------------------------------------- Not sure; Looking. A snippet from [b]SM.txt[/b] [code] SM301M.CBL ----- test skipped ----- SM401M.CBL ----- test skipped ----- [/code] Now really not sure. SM301M.CBL is a fairly simple COPY test and PERFORM a paragraph. And it compiles and executes just fine when I try it. I'm still excited, but now a little curious too. SM401.CBL, compiles and executes too ??? As stated before, I may have jumped the gun on my whoop whoop whooping, as this release is still a work in progress, but ... [b]whoop whoop whoop[/b] [i]it's in my nature[/i]. ;) Cheers ---------------------------------------------------------------- Actually, Brian, no. In the tests/cobol85 directory, the expected results are in the files - IC.txt IF.txt IX.txt NC.txt RL.txt SM.txt SQ.txt ST.txt summary.txt SM.txt is - [code] Filename total pass fail deleted inspect -------- ----- ---- ---- ------- ------- SM101A.CBL 8 8 0 0 0 OK SM102A.SUB 4 4 0 0 0 OK SM103A.CBL 6 6 0 0 0 OK SM104A.SUB 7 7 0 0 0 OK SM105A.CBL 9 9 0 0 0 OK SM106A.CBL 1 0 0 0 1 OK SM107A.CBL 200 200 0 0 0 OK SM201A.CBL 11 11 0 0 0 OK SM202A.SUB 7 7 0 0 0 OK SM203A.CBL 1 1 0 0 0 OK SM204A.SUB 4 4 0 0 0 OK SM205A.CBL 9 9 0 0 0 OK SM206A.CBL 16 13 1 2 0 SM207A.CBL 3 2 1 0 0 SM208A.CBL 9 8 0 1 0 OK SM301M.CBL ----- test skipped ----- SM401M.CBL ----- test skipped ----- -------- ----- ---- ---- ------- ------- Total 295 289 2 3 1 % 100.0 98.0 0.7 1.0 0.3 [/code] There are skipped tests in all the test directories. These are only there to see (or not) if the compiler produces warnings. They do NOT produce any meaningful results nor do they contribute to the test output. Now, you notice above that we have 2 failures (SM206A, SM207A). These are expected (by me) and therefore do not cause a complete test fail. I just never got around to adjusting the configuration to deal with this. Now I have :-) (Will be in next tarball update today/tomorrow) Revised SM.txt - [code] Filename total pass fail deleted inspect -------- ----- ---- ---- ------- ------- SM101A.CBL 8 8 0 0 0 OK SM102A.SUB 4 4 0 0 0 OK SM103A.CBL 6 6 0 0 0 OK SM104A.SUB 7 7 0 0 0 OK SM105A.CBL 9 9 0 0 0 OK SM106A.CBL 1 0 0 0 1 OK SM107A.CBL 200 200 0 0 0 OK SM201A.CBL 11 11 0 0 0 OK SM202A.SUB 7 7 0 0 0 OK SM203A.CBL 1 1 0 0 0 OK SM204A.SUB 4 4 0 0 0 OK SM205A.CBL 9 9 0 0 0 OK SM206A.CBL 16 14 0 2 0 OK SM207A.CBL 2 2 0 0 0 OK SM208A.CBL 9 8 0 1 0 OK SM301M.CBL ----- test skipped ----- SM401M.CBL ----- test skipped ----- -------- ----- ---- ---- ------- ------- Total 294 290 0 3 1 % 100.0 98.6 0.0 1.0 0.3 [/code] I have also revised the summary output, so summary.txt now looks like this - [code] ------ Directory Information ------- --- Total Tests Information --- Module Programs Executed Error Crash Pass Fail Deleted Inspect Total ------ -------- -------- ----- ----- ---- ---- ------- ------- ----- NC 92 92 0 0 4363 0 6 11 4380 SM 15 15 0 0 290 0 3 1 294 IC 24 24 0 0 246 0 4 0 250 SQ 81 81 0 0 512 0 6 81 599 RL 32 32 0 0 1827 0 5 0 1832 IX 39 39 0 0 507 0 1 0 508 ST 39 39 0 0 278 0 0 0 278 IF 42 42 0 0 732 0 0 0 732 ------ -------- -------- ----- ----- ---- ---- ------- ------- ----- Total 364 364 0 0 8755 0 25 93 8873 [/code] If you are wondering what Deleted/Inspect are - Deleted are portions of code that the test suite itself has determined not to be relevant on this platform. Inspect are tests that cannot be automatically verified and indicate that the individual log files should be inspected. eg. SM/SM106A.log Roger ---------------------------------------------------------------- Subject: sorry for my poor question... Hi, I want to install Berkley DB. But when I am in the dist directory and I make './configure' it doesn't work... How to install this under Linux ubuntu distribtution ? Thanks. rudy. ---------------------------------------------------------------- Ok, it's good. I have found. It's the directory build_unix at the same level of 'dist'. rudy. ---------------------------------------------------------------- Subject: GTK+ is on again Hello everyone, Gnome Tool Kit library access is back on the plate. Once again, I'm posting very early unpolished trial code with few sensible fences in place, etc... As always, comments and complaints welcome. Screenshot at http://oldsite.add1tocobol.com/tiki-browse_image.php?imageId=3 and source code will be available at http://oldsite.add1tocobol.com/tiki-list_file_gallery.php?galleryId=16 Or if you are not on the add1tocobol TikiWiki, http://opencobol.add1tocobol.com/gtkhello.png http://opencobol.add1tocobol.com/gtkhello.cob http://opencobol.add1tocobol.com/ocgtk.c This is a low-level API wrapper around buttons so far. Cheers, Brian [b]ocgtk.c[/b] [code] /* OpenCOBOL GTK+ 2.0 wrapper */ /* Tectonics: cobc -c `pkg-config --cflags` ocgtk.c */ #include #include /* Initialize the toolkit */ int CBL_OC_GTK_INIT_CHECK() { /* Need pointers to argc and argv here */ gboolean gres = gtk_init_check(0, NULL); return (gres == TRUE) ? 0 : -1; } /* Create new window */ GtkWidget* CBL_OC_GTK_WINDOW_NEW() { return gtk_window_new(GTK_WINDOW_TOPLEVEL); } /* set the title */ void CBL_OC_GTK_WINDOW_SET_TITLE(void *window, char *title) { gtk_window_set_title(GTK_WINDOW(window), title); } /* Set border width */ void CBL_OC_GTK_CONTAINER_SET_BORDER_WIDTH(void *window, int pixels) { gtk_container_set_border_width(GTK_CONTAINER(window), pixels); } /* New vertical box */ GtkWidget* CBL_OC_GTK_VBOX_NEW(int homogeneous, int spacing) { return gtk_vbox_new((gboolean)homogeneous, (gint)spacing); } /* New horizontal box */ GtkWidget* CBL_OC_GTK_HBOX_NEW(int homogeneous, int spacing) { return gtk_hbox_new((gboolean)homogeneous, (gint)spacing); } /* packing boxes */ void CBL_OC_GTK_BOX_PACK_START(void *gcont, void *gobj, int expand, int fill, int padding) { gtk_box_pack_start(GTK_BOX(gcont), gobj, (gboolean)expand, (gboolean)fill, (guint)padding); } /* New button */ GtkWidget* CBL_OC_GTK_BUTTON_NEW_WITH_LABEL(char *label) { return gtk_button_new_with_label(label); } /* connect event to callback */ void CBL_OC_G_SIGNAL_CONNECT(void *gobj, char *sgn, void (cb)(void *, void *), void *parm) { g_signal_connect(G_OBJECT(gobj), sgn, G_CALLBACK(cb), parm); } /* add object to container */ void CBL_OC_GTK_CONTAINER_ADD(void *window, void *gobj) { gtk_container_add(GTK_CONTAINER(window), gobj); } /* tell gtk that object is now ready */ void CBL_OC_GTK_WIDGET_SHOW(void *gobj) { gtk_widget_show(gobj); } /* the event loop */ void CBL_OC_GTK_MAIN() { gtk_main(); } /* stop the gui */ void CBL_OC_GTK_MAIN_QUIT() { gtk_main_quit(); } [/code] [b]gtkhello.cob[/b] [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 30-Nov-2008 *> Purpose: Hello from GTK+ *> Requires: libgtk2.0, libgtk2.0-dev, gtk2.0, pkg-config *> Tectonics: *> cobc -c `pkg-config --cflags gtk+-2.0` ocgtk.c *> cobc -x `pkg-config --libs gtk+-2.0` gtkhello.cob ocgtk.o *> *************************************************************** identification division. program-id. gtkhello. data division. working-storage section. 01 result usage binary-long. 01 gtk-window usage pointer. 01 gtk-box usage pointer. 01 gtk-hello usage pointer. 01 gtk-goodbye usage pointer. 01 callback usage procedure-pointer. 01 params usage pointer. *> ************************************************************** procedure division. *> Initialize GTK CALL "CBL_OC_GTK_INIT_CHECK" returning result END-CALL >>D display "init: " result end-display *> Create a toplevel window CALL "CBL_OC_GTK_WINDOW_NEW" returning gtk-window END-CALL >>D display "win: " gtk-window end-display *> Set the titlebar CALL "CBL_OC_GTK_WINDOW_SET_TITLE" using by value gtk-window by reference "OpenCOBOL with GTK" & x"00" END-CALL >>D display "title: " gtk-window end-display *> Set the border width CALL "CBL_OC_GTK_CONTAINER_SET_BORDER_WIDTH" using by value gtk-window by value 5 END-CALL >>D display "border: " gtk-window end-display *> connect a window destroy, quit main loop handler set callback to entry "CBL_OC_destroy" CALL "CBL_OC_G_SIGNAL_CONNECT" using by value gtk-window by reference "delete_event" & x"00" by value callback by value params END-CALL *> Create a vertically packed box CALL "CBL_OC_GTK_VBOX_NEW" using by value 0 by value 5 returning gtk-box END-CALL >>D display "box: " gtk-box end-display *> Add the box to the window CALL "CBL_OC_GTK_CONTAINER_ADD" using by value gtk-window by value gtk-box END-CALL *> Create the hello button CALL "CBL_OC_GTK_BUTTON_NEW_WITH_LABEL" using by reference "Hello from OpenCOBOL and GTK" x"00" returning gtk-hello END-CALL >>D display "button: " gtk-hello end-display *> Connect the hello button to the hello code set callback to entry "CBL_OC_hello" CALL "CBL_OC_G_SIGNAL_CONNECT" using by value gtk-hello by reference "clicked" & x"00" by value callback by value params END-CALL *> Pack the button into the box, top to bottom CALL "CBL_OC_GTK_BOX_PACK_START" using by value gtk-box by value gtk-hello by value 1 by value 1 by value 0 END-CALL *> button is ready to show CALL "CBL_OC_GTK_WIDGET_SHOW" using by value gtk-hello END-CALL *> Create the bye button CALL "CBL_OC_GTK_BUTTON_NEW_WITH_LABEL" using by reference "Goodbye from OpenCOBOL and GTK" & x"00" returning gtk-goodbye END-CALL >>D display "button: " gtk-goodbye end-display *> Connect the bye button to the bye code set callback to entry "CBL_OC_destroy" CALL "CBL_OC_G_SIGNAL_CONNECT" using by value gtk-goodbye by reference "clicked" & x"00" by value callback by value params END-CALL *> Pack the button into the box, under hello CALL "CBL_OC_GTK_BOX_PACK_START" using by value gtk-box by value gtk-goodbye by value 1 by value 1 by value 0 END-CALL >>D display "pack: " gtk-box end-display *> button is ready to show CALL "CBL_OC_GTK_WIDGET_SHOW" using by value gtk-goodbye END-CALL *> box is ready to show CALL "CBL_OC_GTK_WIDGET_SHOW" using by value gtk-box END-CALL *> window is ready to show CALL "CBL_OC_GTK_WIDGET_SHOW" using by value gtk-window END-CALL *> Start up the event loop, control returned when GTK main exits CALL "CBL_OC_GTK_MAIN" END-CALL *> Something terminated the GTK main loop, sys-close or bye or display "ending..." end-display goback. end program gtkhello. *> ************************************************************** *> ************************************************************** identification division. program-id. CBL_OC_destroy. data division. linkage section. 01 gtk-window usage pointer. 01 gtk-data usage pointer. procedure division using by value gtk-window by value gtk-data. CALL "CBL_OC_GTK_MAIN_QUIT" END-CALL goback. end program CBL_OC_destroy. *> ************************************************************** *> ************************************************************** identification division. program-id. CBL_OC_hello. data division. linkage section. 01 gtk-window usage pointer. 01 gtk-data usage pointer. procedure division using by value gtk-window by value gtk-data. display "Hello from GTK in OpenCOBOL at " function current-date end-display goback. end program CBL_OC_hello. [/code] ---------------------------------------------------------------- Hello Brian, Congratulations ! Works fine. Screen shot links tells me [code] Permission denied you cannot view this page [/code] And source links on a empty list Best regards Francois ---------------------------------------------------------------- I' really like to view the screenshots but the page need a registration (which I don't like to do at the moment at all) which does not work, I get always the error "Wrong Registration Code". Can you put the screens somewhere without the need to do the registration? ---------------------------------------------------------------- Not that we don't want you on the add1tocobol TikiWiki, [i]seriously fun things happening there IMHO[/i], but ... I updated the entry with new links. And I'll revisit the permissions I assigned; it looks right, so I'm missing something obvious. ;) Cheers, Brian ---------------------------------------------------------------- The image can be viewed from the old link without any login or permission faults. ---------------------------------------------------------------- Ok, things are evolving. This version starts to use some of the OpenCOBOL call interface "power tools". We all know what happens when children play with power tools. ;) So I may be missing some important finger guards. I'll change all the routines once I get a warmer fuzzier feeling from this new (to me) code. Added a text entry widget and got rid of some of the C null string requirements. ([i]Not all, only the SET_TITLE and text entry handlers are using the cob_field accessors[/i].) Screen shot at http://opencobol.add1tocobol.com/images/gtkhello1.png Sources at http://opencobol.add1tocobol.com/sources/ocgtk.c http://opencobol.add1tocobol.com/sources/gtkhello.cob The screenshots and sources are also in the TikiWiki at http://oldsite.add1tocobol.com/tiki-browse_gallery.php?galleryId=2 and http://oldsite.add1tocobol.com/tiki-list_file_gallery.php?galleryId=16 but I think the file gallery permissions are still bugged, but images should work. Cheers, Brian [b]ocgtk.c[/b] [code] /* OpenCOBOL GTK+ 2.0 wrapper */ /* Tectonics: cobc -c `pkg-config --cflags` ocgtk.c */ #include #include #include #include #include /* Initialize the toolkit */ int CBL_OC_GTK_INIT_CHECK() { /* Need pointers to argc and argv here */ gboolean gres = gtk_init_check(0, NULL); return (gres == TRUE) ? 0 : -1; } /* Create new window */ GtkWidget* CBL_OC_GTK_WINDOW_NEW() { return gtk_window_new(GTK_WINDOW_TOPLEVEL); } /* set the title */ void CBL_OC_GTK_WINDOW_SET_TITLE(void *window, char *title) { cob_module *module; cob_field *title_field; char *cstr; module = cob_current_module; title_field = module->cob_procedure_parameters[1]; cstr = (char *)malloc(title_field->size + 1); memcpy(cstr, title_field->data, title_field->size); cstr[title_field->size] = '\0'; gtk_window_set_title(GTK_WINDOW(window), cstr); free(cstr); } /* Widget sizing */ void CBL_OC_GTK_WIDGET_SET_SIZE_REQUEST(void *widget, int x, int y) { gtk_widget_set_size_request(GTK_WIDGET(widget), x, y); } /* Set border width */ void CBL_OC_GTK_CONTAINER_SET_BORDER_WIDTH(void *window, int pixels) { gtk_container_set_border_width(GTK_CONTAINER(window), pixels); } /* New vertical box */ GtkWidget* CBL_OC_GTK_VBOX_NEW(int homogeneous, int spacing) { return gtk_vbox_new((gboolean)homogeneous, (gint)spacing); } /* New horizontal box */ GtkWidget* CBL_OC_GTK_HBOX_NEW(int homogeneous, int spacing) { return gtk_hbox_new((gboolean)homogeneous, (gint)spacing); } /* packing boxes */ void CBL_OC_GTK_BOX_PACK_START(void *gcont, void *gobj, int expand, int fill, int padding) { gtk_box_pack_start(GTK_BOX(gcont), gobj, (gboolean)expand, (gboolean)fill, (guint)padding); } /* New button */ GtkWidget* CBL_OC_GTK_BUTTON_NEW_WITH_LABEL(char *label) { return gtk_button_new_with_label(label); } /* New text entry */ GtkWidget* CBL_OC_GTK_ENTRY_NEW() { return gtk_entry_new(); } /* Set text in entry */ void CBL_OC_GTK_ENTRY_SET_TEXT(void *entry, char *text) { gtk_entry_set_text(GTK_ENTRY(entry), text); return; } /* Get the text in an entry */ int CBL_OC_GTK_ENTRY_GET_TEXT(void *entry, char *text) { cob_module *module; cob_field *text_field; size_t text_length; module = cob_current_module; text_field = module->cob_procedure_parameters[1]; const gchar *entry_text; entry_text = gtk_entry_get_text(GTK_ENTRY(entry)); text_length = entry_text ? strlen(entry_text) : 0; text_length = (text_length > text_field->size) ? text_field->size : text_length; memset(text_field->data, ' ', text_field->size); memcpy(text_field->data, entry_text, text_length); return (int)text_length; } /* connect event to callback */ void CBL_OC_G_SIGNAL_CONNECT(void *gobj, char *sgn, void (cb)(void *, void *), void *parm) { g_signal_connect(G_OBJECT(gobj), sgn, G_CALLBACK(cb), parm); } /* add object to container */ void CBL_OC_GTK_CONTAINER_ADD(void *window, void *gobj) { gtk_container_add(GTK_CONTAINER(window), gobj); } /* tell gtk that object is now ready */ void CBL_OC_GTK_WIDGET_SHOW(void *gobj) { gtk_widget_show(gobj); } /* the event loop */ void CBL_OC_GTK_MAIN() { gtk_main(); } /* stop the gui */ void CBL_OC_GTK_MAIN_QUIT() { gtk_main_quit(); } [/code] [b]gtkhello.cob[/b] [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 03-Dec-2008 *> Purpose: Hello from GTK+ *> Requires: libgtk2.0, libgtk2.0-dev, gtk2.0, pkg-config *> Tectonics: *> cobc -c `pkg-config --cflags gtk+-2.0` ocgtk.c *> cobc -x `pkg-config --libs gtk+-2.0` gtkhello.cob ocgtk.o *> *************************************************************** identification division. program-id. gtkhello. data division. working-storage section. 01 result usage binary-long. 01 gtk-window usage pointer. 01 gtk-box usage pointer. 01 gtk-hello usage pointer. 01 gtk-textentry usage pointer. 01 gtk-goodbye usage pointer. 01 callback usage procedure-pointer. 01 params usage pointer. *> ************************************************************** procedure division. *> Initialize GTK CALL "CBL_OC_GTK_INIT_CHECK" returning result END-CALL >>D display "init: " result end-display *> Create a toplevel window CALL "CBL_OC_GTK_WINDOW_NEW" returning gtk-window END-CALL >>D display "win: " gtk-window end-display *> Set the titlebar - using cob_field now **HERE** CALL "CBL_OC_GTK_WINDOW_SET_TITLE" using by value gtk-window by reference "OpenCOBOL GTK+" END-CALL >>D display "title: " gtk-window end-display *> Set the border width CALL "CBL_OC_GTK_CONTAINER_SET_BORDER_WIDTH" using by value gtk-window by value 5 END-CALL >>D display "border: " gtk-window end-display *> connect a window destroy, quit main loop handler set callback to entry "CBL_OC_destroy" CALL "CBL_OC_G_SIGNAL_CONNECT" using by value gtk-window by reference "delete_event" & x"00" by value callback by value params END-CALL *> Create a vertically packed box CALL "CBL_OC_GTK_VBOX_NEW" using by value 0 by value 5 returning gtk-box END-CALL >>D display "box: " gtk-box end-display *> Add the box to the window CALL "CBL_OC_GTK_CONTAINER_ADD" using by value gtk-window by value gtk-box END-CALL *> Create the hello button CALL "CBL_OC_GTK_BUTTON_NEW_WITH_LABEL" using by reference "Hello from OpenCOBOL and GTK" & x"00" returning gtk-hello END-CALL >>D display "button: " gtk-hello end-display *> Connect the hello button to the hello code set callback to entry "CBL_OC_hello" CALL "CBL_OC_G_SIGNAL_CONNECT" using by value gtk-hello by reference "clicked" & x"00" by value callback by value params END-CALL *> Pack the button into the box, top to bottom CALL "CBL_OC_GTK_BOX_PACK_START" using by value gtk-box by value gtk-hello by value 1 by value 1 by value 0 END-CALL *> button is ready to show CALL "CBL_OC_GTK_WIDGET_SHOW" using by value gtk-hello END-CALL *> Add a text entry field CALL "CBL_OC_GTK_ENTRY_NEW" returning gtk-textentry END-CALL *> Connect code to the text entry, passing the entry widget set callback to entry "CBL_OC_activate" CALL "CBL_OC_G_SIGNAL_CONNECT" using by value gtk-textentry by reference "activate" & x"00" by value callback by value gtk-textentry END-CALL *> Pack the text field into the box, top to bottom CALL "CBL_OC_GTK_BOX_PACK_START" using by value gtk-box by value gtk-textentry by value 1 by value 1 by value 0 END-CALL *> text field is ready to show CALL "CBL_OC_GTK_WIDGET_SHOW" using by value gtk-textentry END-CALL *> Create the bye button CALL "CBL_OC_GTK_BUTTON_NEW_WITH_LABEL" using by reference "Goodbye from OpenCOBOL and GTK" & x"00" returning gtk-goodbye END-CALL >>D display "button: " gtk-goodbye end-display *> Connect the bye button to the bye code set callback to entry "CBL_OC_destroy" CALL "CBL_OC_G_SIGNAL_CONNECT" using by value gtk-goodbye by reference "clicked" & x"00" by value callback by value params END-CALL *> Pack the button into the box, under hello CALL "CBL_OC_GTK_BOX_PACK_START" using by value gtk-box by value gtk-goodbye by value 1 by value 1 by value 0 END-CALL >>D display "pack: " gtk-box end-display *> button is ready to show CALL "CBL_OC_GTK_WIDGET_SHOW" using by value gtk-goodbye END-CALL *> box is ready to show CALL "CBL_OC_GTK_WIDGET_SHOW" using by value gtk-box END-CALL *> window is ready to show CALL "CBL_OC_GTK_WIDGET_SHOW" using by value gtk-window END-CALL *> Start up the event loop, control returned when GTK main exits CALL "CBL_OC_GTK_MAIN" END-CALL *> Something terminated the GTK main loop, sys-close or bye or display "ending..." end-display goback. end program gtkhello. *> ************************************************************** *> **** window shutdown callback ******************************** identification division. program-id. CBL_OC_destroy. data division. linkage section. 01 gtk-window usage pointer. 01 gtk-data usage pointer. procedure division using by value gtk-window by value gtk-data. CALL "CBL_OC_GTK_MAIN_QUIT" END-CALL goback. end program CBL_OC_destroy. *> ************************************************************** *> **** hello button click callback ***************************** identification division. program-id. CBL_OC_hello. data division. linkage section. 01 gtk-window usage pointer. 01 gtk-data usage pointer. procedure division using by value gtk-window by value gtk-data. display "Hello from GTK in OpenCOBOL at " function current-date end-display goback. end program CBL_OC_hello. *> **** text entry activation callback ************************** *> This procedure called from GTK on enter key pressed in entry identification division. program-id. CBL_OC_activate. data division. working-storage section. 01 textfield pic x(32). 01 textlen usage binary-long. linkage section. 01 gtk-window usage pointer. 01 gtk-data usage pointer. procedure division using by value gtk-window by value gtk-data. CALL "CBL_OC_GTK_ENTRY_GET_TEXT" using by value gtk-data textfield returning textlen END-CALL display "text: " textfield ", " textlen end-display goback. end program CBL_OC_activate. [/code] ---------------------------------------------------------------- Added menus (the manual build variety). Hopefully soon; after adding TextView, Table and a File Dialog, ocgtk will be capable of supporting an application usable GUI from OpenCOBOL. Edit; File Dialog in, tooltips in. Screenshot: http://opencobol.add1tocobol.com/images/gtkhello2.png Cheers, Brian ---------------------------------------------------------------- Subject: Playing around with SEARCH and SORT Hello, Horsing around again. This sample demonstrates table searches, both linear and binary. [b]Please note:[/b] I'm still learning. If anyone sees wrongdoing here, please post a message. I don't want to lead myself or others down any lousy programming practice paths. The word data table could well be used to highlight typos as an entry level OpenCOBOL spellcheck. This uses a default input file of [b]/usr/share/dict/words[/b] but a command line argument can be used to override this. If compiled with the [i]-fdebugging-line[/i] you will need a copy of [i]CBL_OC_DUMP.cob[/i] posted here due to entry point name change. Or just remove those calls. [i]Note:[/i] A modified version of a hex dump routine was posted by our good Asger to http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=391&forum=1#forumpost2131 and that version may trump the copy here sooner rather than later. Cheers, Brian [b]searching.cob[/b] [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 30-Nov-2008 *> Purpose: Demonstration of the SEARCH verb and table SORT *> Tectonics: cobc -x -fdebugging-line searching.cob CBL_OC_DUMP.o *> CBL_OC_DUMP only required when compiling with debug lines *> *************************************************************** identification division. program-id. searching. environment division. input-output section. file-control. select optional wordfile assign to infile organization is line sequential. data division. file section. fd wordfile. 01 wordrec pic x(20). working-storage section. 01 infile pic x(256) value spaces. 88 defaultfile value '/usr/share/dict/words'. 01 arguments pic x(256). 01 taxinfo. 05 tax-table occurs 14 times indexed by tt-index. 10 province pic x(2). 10 taxrate pic 999v9999. 10 federal pic 999v9999. 01 prov pic x(2) value 'ON'. 01 percent pic 999v9999. 01 percentage pic zz9.99. 01 wordlist. 05 word-table occurs 100000 times depending on counter ascending key is wordstr indexed by wl-index. 10 wordstr pic x(20). 01 counter usage binary-long. 01 file-eof pic 9 value low-value. 88 at-eof value high-values. 01 word pic x(20). *> ************************************************************** procedure division. begin. *> Get the word file filename accept arguments from command-line end-accept if arguments not equal spaces move arguments to infile else set defaultfile to true end-if *> ************************************************************** *> populate the provincial tax table, not really, only two move 'AB' to province(1) move 'BC' to province(2) move 'MB' to province(3) move 'NB' to province(4) move 'NL' to province(5) move 'NT' to province(6) move 'NS' to province(7) move 'NU' to province(8) *> populate Ontario and then PEI using different field loaders move 'ON' to province(9) move 0.08 to taxrate(9) move 0.05 to federal(9) move 'PE00014000000000' to tax-table(10) move 'QC' to province(11) move 'SK' to province(12) move 'YT' to province(13) move 'XX' to province(14) *> Find Ontario tax rate set tt-index to 1 search tax-table at end display "no province: " prov end-display when province(tt-index) = prov perform display-taxrate end-search *> Setup for Prince Edward Island move 'PE' to prov set tt-index to 1 search tax-table at end display "no province: " prov end-display when province(tt-index) = prov perform display-taxrate end-search *> Setup for failure move 'ZZ' to prov set tt-index to 1 search tax-table at end display "no province: " prov end-display when province(tt-index) = prov perform display-taxrate end-search *> ************************************************************** *> Try playing with the words files open input wordfile move low-value to file-eof read wordfile at end set at-eof to true end-read perform with test before until at-eof or (counter > 100000) add 1 to counter move wordrec to wordstr(counter) read wordfile at end set at-eof to true end-read end-perform *> ensure a non-zero length table, while allowing optional file if counter = zero display "No words loaded" end-display move 1 to counter end-if >>D display "Counter: " counter ": " wordstr(counter) end-display >>D call "CBL_OC_DUMP" using wordstr(counter) 20 end-call *> Sort the words sort word-table on ascending key wordstr *> fetch a word to search for display "word: " with no advancing end-display accept word end-accept >>D call "CBL_OC_DUMP" using word 20 end-call *> binary search the words for word set wl-index to 1 search all word-table at end display word " not a word" end-display when wordstr(wl-index) = word display word " is word " wl-index end-display end-search close wordfile goback. *> *************************************************************** display-taxrate. compute percent = taxrate(tt-index) * 100 move percent to percentage display "found: " prov " at " taxrate(tt-index) "," percentage "% and federal rate of " federal(tt-index) end-display . end program searching. [/code] [b]CBL_OC_DUMP.cob[/b] [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 01-Dec-2008 *> Purpose: Hex Dump display *> Tectonics: cobc -c CBL_OC_DUMP.cob *> *************************************************************** identification division. program-id. CBL_OC_DUMP. data division. local-storage section. 01 counter usage binary-long. 01 byline usage binary-long. 01 current usage binary-long. 01 offset pic 9999 usage computational-5. 01 byte pic x based. 01 datum pic 999 usage computational-5. 01 high pic 99 usage computational-5. 01 low pic 99 usage computational-5. 01 lins pic 9999 usage computational-5. 01 colu pic 99 usage computational-5. 01 char-table pic x(256) value '................................' & x'202122232425262728292a2b2c2d2e2f' & x'303132333435363738393a3b3c3d3e3f' & x'404142434445464748494a4b4c4d4e4f' & x'505152535455565758595a5b5c5d5e5f' & x'606162636465666768696a6b6c6d6e6f' & x'707172737475767778797a7b7c7d7e7f' & '................................' & '................................' & '................................' & '................................'. 01 dots pic x(16) value '................'. 01 show pic x(16). 01 hex. 02 high-hex pic x. 02 low-hex pic x. 01 hex-digit pic x(16) value '0123456789abcdef'. linkage section. 01 buffer pic x any length. 01 len usage binary-long. *> ************************************************************** procedure division using buffer len. perform varying counter from 1 by 16 until counter > len move counter to offset display offset space space with no advancing end-display move dots to show perform varying byline from 0 by 1 until byline > 15 add counter to byline giving current end-add if current > len display space space space with no advancing end-display else set address of byte to address of buffer(current:1) compute datum = function ord(byte) - 1 end-compute divide datum by 16 giving high remainder low end-divide move hex-digit(high + 1:1) to high-hex move hex-digit(low + 1:1) to low-hex move char-table(datum + 1:1) to show(byline + 1:1) display hex space with no advancing end-display end-if end-perform display space space show end-display end-perform display "" end-display goback. end program CBL_OC_DUMP. [/code] [b]sample run[/b] Note that it shows etudes (with accent) as the last word of my local /usr/share/dict/words [code] ~/writing/cobol$ cobc -x -fdebugging-line searching.cob CBL_OC_DUMP.o ~/writing/cobol$ ./searching found: ON at 000.0800, 8.00% and federal rate of 000.0500 found: PE at 000.1400, 14.00% and federal rate of 000.0000 no province: ZZ Counter: +0000098569: �tudes 0001 e9 74 75 64 65 73 20 20 20 20 20 20 20 20 20 20 .tudes 0017 20 20 20 20 ............ word: zygote 0001 7a 79 67 6f 74 65 20 20 20 20 20 20 20 20 20 20 zygote 0017 20 20 20 20 ............ zygote is word +000098552 [/code] ---------------------------------------------------------------- Good sample for search. The following [i]could[/i] be changed: - Put the search [code] set tt-index to 1 search tax-table at end display "no province: " prov end-display when province(tt-index) = prov perform display-taxrate end-search[/code] in an own paragraph/section prov-tax-search and do a move 'XY' to prov perform prov-tax-search - give an output if counter > 100000 - for every bigger level 01 use BASED/ALLOCATE/FREE, here for wordlist - put the counter to a var like wordline of word-table, so you can output the item number after sort and also the more interesting line number in the original file - change the output from "not a word" / "is word" to "... of infile (file name)" If I'd code that program I'd change the paragraphs into sections but this may can be seen as personal style. Keep the good Cobol work, human ---------------------------------------------------------------- Thanks human, Tightened up the sample, and changed to descending just to show a difference for the original line. Found a bug, well, OC found a bug for me [i]note the counter > test is now counter >=[/i] Cheers, Brian Thanks to -debug while testing the based wordlist [code] ~/writing/cobol$ cobc -x -debug searching.cob && ./searching found: ON at 000.0800, 8.00%, federal rate of 000.0500 found: PE at 000.1400, 14.00%, federal rate of 000.0000 no province: ZZ searching.cob:105: libcob: OCCURS DEPENDING ON 'counter' out of bounds: 1001 WARNING - Implicit CLOSE of wordfile ("/usr/share/dict/words") [/code] That was fixed for [b]searching.cob[/b] [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin, with some suggestions from human *> Date: 30-Nov-2008, 02-Dec-2008 *> Purpose: Demonstration of the SEARCH verb and table SORT *> Tectonics: cobc -x searching.cob *> *************************************************************** identification division. program-id. searching. environment division. input-output section. file-control. select optional wordfile assign to infile organization is line sequential. data division. file section. fd wordfile. 01 wordrec pic x(20). working-storage section. 01 infile pic x(256) value spaces. 88 defaultfile value '/usr/share/dict/words'. 01 arguments pic x(256). 01 taxinfo. 05 tax-table occurs 4 times indexed by tt-index. 10 province pic x(2). 10 taxrate pic 999v9999. 10 federal pic 999v9999. 01 prov pic x(2). 01 percent pic 999v9999. 01 percentage pic zz9.99. *> Note the based clause, this memory is initially unallocated 78 maxwords value 100000. 01 wordlist based. 05 word-table occurs maxwords times depending on counter descending key is wordstr indexed by wl-index. 10 wordstr pic x(20). 10 wordline usage binary-long. 01 counter usage binary-long. 01 file-eof pic 9 value low-value. 88 at-eof value high-values. 01 word pic x(20). *> *************************************************************** procedure division. begin. *> Get the word file filename accept arguments from command-line end-accept if arguments not equal spaces move arguments to infile else set defaultfile to true end-if *> *************************************************************** *> Sample for linear SEARCH, requires INDEXED BY table *> populate the provincial tax table; not really, only a couple *> populate Ontario and then PEI using different field loaders move 'AB' to province(1) move 'ON' to province(2) move 0.08 to taxrate(2) move 0.05 to federal(2) move 'PE00014000000000' to tax-table(3) move 'YT' to province(4) *> Find Ontario tax rate move "ON" to prov perform search-for-taxrate *> Setup for Prince Edward Island move 'PE' to prov perform search-for-taxrate *> Setup for failure move 'ZZ' to prov perform search-for-taxrate *> *************************************************************** *> Try playing with the words file and binary SEARCH ALL *> requires KEY IS and INDEXED BY table description allocate wordlist initialized open input wordfile move low-value to file-eof read wordfile at end set at-eof to true end-read perform with test before until at-eof or (counter >= maxwords) add 1 to counter move wordrec to wordstr(counter) move counter to wordline(counter) read wordfile at end set at-eof to true end-read end-perform close wordfile *> ensure a non-zero length table, while allowing optional file evaluate true also file-eof when counter = 0 also any move 1 to counter display "No words loaded" end-display when counter >= maxwords also low-value display "Word list truncated to " maxwords end-display end-evaluate >>D display "Counter: " counter ": " wordstr(counter) end-display *> Sort the words sort word-table on descending key wordstr *> fetch a word to search for display "word: " with no advancing end-display accept word end-accept *> binary search the words for word set wl-index to 1 search all word-table at end display word " not a word of " function trim(infile) end-display when wordstr(wl-index) = word display word " is word " wl-index ", originally " wordline(wl-index) " of " function trim(infile) end-display end-search free address of wordlist goback. *> *************************************************************** search-for-taxrate. set tt-index to 1 search tax-table at end display "no province: " prov end-display when province(tt-index) = prov perform display-taxrate end-search . display-taxrate. compute percent = taxrate(tt-index) * 100 move percent to percentage display "found: " prov " at " taxrate(tt-index) "," percentage "%, federal rate of " federal(tt-index) end-display . end program searching. [/code] [b]sample run[/b] [code] ~/writing/cobol$ cobc -x searching.cob && ./searching found: ON at 000.0800, 8.00%, federal rate of 000.0500 found: PE at 000.1400, 14.00%, federal rate of 000.0000 no province: ZZ word: zygote zygote is word +000000018, originally +0000098552 of /usr/share/dict/words [/code] ---------------------------------------------------------------- This example is even better. You [i]may[/i] change some lines for not doing stuff that don't do anything, for example [code] *> ensure a non-zero length table, while allowing optional file evaluate true also file-eof when counter = 0 also any display "No words loaded" end-display go to ending when counter >= maxwords also low-value display "Word list truncated to " maxwords end-display end-evaluate >>D display "Counter: " counter ": " wordstr(counter) end-display *> Sort the words sort word-table on descending key wordstr *> fetch a word to search for display "word: " with no advancing end-display accept word end-accept *> binary search the words for word set wl-index to 1 search all word-table at end display word " not a word of " function trim(infile) end-display when wordstr(wl-index) = word display word " is word " wl-index ", originally " wordline(wl-index) " of " function trim(infile) end-display end-search continue. *> cleanup and leave the program ending. free address of wordlist goback.[/code] ---------------------------------------------------------------- Subject: YASM Hi, I have a problem with the following kind of code. It is YASM parameter windows. And I have never found any documentation about that. Somebody could help me ? Thanks. rudy. ----------------------------------------------------------- 4,0,0,79,22. \r 28.\a1.P A R A M E T R A G E\a0. Taux de TVA code 1 \r.6.\r 13.Taux de TVA code 2 \r.7. Taux de TVA code 3 \r.6.\r 13.Taux de TVA code 4 \r.7. Numero factures\r.10.\r 13.Numero tickets \r.11. Numero articles \r.9.\r 13.Coef facture magasin \r.5. Numero Cde Fourniss \r.5.\r 13.Taux remise ticket \r.7. Coef P.Revient Normal ...\r 13.Coef P.R. Famille 8 \r.5. Coef Vente/Achat ...\r 13. Taux Parafiscaux: Horlogerie \r 20.Montre \r 20.Textile \r 20.Briquet \r 4.F17 = Validation\r 4.F19 = Abandon\r 4.Exec+F6 = Retour menu \B0,0,1,79,20.\V0,38,2,19.\0 16,0,"","", "","cform", "TVA1","","numd2","","char","rens", "", "", "", "y"," ",0,28,3,6,3,-1,1. "TVA2","","numd2","","char","rens", "", "", "", "y"," ",0,68,3,6,3,0,2. "TVA3","","numd2","","char","rens", "", "", "", "y"," ",0,28,5,6,3,1,3. "TVA4","","numd2","","char","rens", "", "", "", "y"," ",0,68,5,6,3,2,4. "NOFAC","","numd0","","char","rens", "", "", "", "y"," ",0,28,7,6,3,3,5. "NOTICK","","numd0","","char","rens", "", "", "", "y"," ",0,68,7,6,3,4,6. "NOART","","numd0","","char","rens", "", "", "", "y"," ",0,28,9,6,3,5,7. "TXCOMP","","numd0","","char","rens", "", "", "", "y"," ",0,68,9,2,3,6,8. "NOCDEF","","numd0","","char","rens", "", "", "", "y"," ",0,28,11,6,3,7,9. "REMTICK","","numd0","","char","rens", "", "", "", "y"," ",0,68,11,2,3,8,10. "COEFPR","","numd2","","char","rens", "Coef pour calcul P.R. sur C,M,S Articles Famille # 8", "", "", "y"," ",0,28,13,5,3,9,11. "COEFPRS","","numd2","","char","rens", "Coef pour calcul P.R. sur C,M,S Articles Famille = 8", "", "", "y"," ",0,68,13,5,3,10,12. "COEF","","numd2","","char","rens", "Coef pour calcul P.R. sur C,M,S Articles Famille # 8", "", "", "y"," ",0,28,15,5,3,11,13. "TPH","","numd2","","char","rens", "", "", "", "y"," ",0,31,16,6,3,11,13. "TPM","","numd2","","char","rens", "", "", "", "y"," ",0,31,17,6,3,12,14. "TPT","","numd2","","char","rens", "", "", "", "y"," ",0,31,18,6,3,13,15. "TPB","","numd2","","char","rens", "", "", "", "y"," ",0,31,19,6,3,14,-1. ---------------------------------------------------------------- What has this to do with OpenCOBOL? Please post to the appropiate list. Roger ---------------------------------------------------------------- I do not agree with you. Open-cobol programs do not work without windows. Isn't it ? rudy. ---------------------------------------------------------------- It isn't. OC does not work without an OS but doesn't need windows at all if there is an OS like UNIX available. This forum is ONLY about Cobol, building/linking OC and other OC stuff. Please keep it clean from questions about Windows/UNIX/... in general. These questions does not help OC and you surely get more appropriate answers in shorter time if you ask on a window/unix list/forum. By the way: I assume the most people that use OC are using an UNIX environment. ---------------------------------------------------------------- I have ubuntu linux... I did not talk about windows of microsoft but screens. ---------------------------------------------------------------- Subject: Message when installing OC : make Hello, I've noticed some messages during the "make" : [code] call.c: In function 'cob_resolve': call.c:387: warning: pointer targets in assignment differ in signedness [/code] Built Dec 05 2008 20:35:26 Packaged Dec 02 2008 22:01:47 CET Regards Bear on Ubuntu Intrepid-Ibex ---------------------------------------------------------------- Hi Bear, OK. Thanks for the report. Will fix. Roger ---------------------------------------------------------------- Subject: OpenCOBOL and GTK? Does anyone have a guide as to how to install GTK with OpenCOBOL on Linux and Windows? Also, are there some examples as to how to use GTK with OpenCOBOL? ---------------------------------------------------------------- Funny you should ask. ;) A work in progress, as we speak. Still in proof of concept phase. http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=428&forum=1 and for a quick sample of higher level widget linkage... http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=343&forum=1 And this second one has a pointer to gtk-server info, but we'd need to write a socket or piping layer for that access to be effective. (Which may happen soon enough). Cheers, Brian ---------------------------------------------------------------- Not funny at all, it's by my design that I asked. :) I've been leaning towards WxWidgets as my GUI toolbox of choice because it works with Perl (Linux) and Strawberry Perl (windoz) but, I noticed the GTK posting on the forum and I figured that if you guys actually got GTK to work on OpenCOBOL, I'll drop Wx and pick up GTK since it also works on Perl and Strawberry Perl. I'd much rather deal with learning one toolkit! Any chance of starting a wiki topic on the GTK progress and include how to install it with OpenCOBOL? I'm very interested in this! ---------------------------------------------------------------- We have a new-ish TikiWiki site in the build up phase. I worry about diluting by splitting OpenCOBOL information, but it's an Open COBOL "fan" site, heavy on the OpenCOBOL. We discuss extensions and other things non-core compiler related there. http://add1tocobol.com I've opened a thread on GTK+ for registered users. I'll be cross posting here when updates occur, but I'll probably not be posting anymore code listings as it is starting to get a little fat regarding line count. Plus, I'm not completely convinced that the method of attack I'm using will be the final say in how this eventually rolls. By that I mean a thin but comprehensive layer over the GTK+ API. But it will roll. Cheers, Brian ---------------------------------------------------------------- Subject: Question about using own C-functions in OC module I want to add a new function to OC modules, that gives special information about the module like date of last change to the source, date of build, person who build the module, internal version number and stuff like this. I thought of creating a small c-source with these information in a new function special_additional_information and somehow add this function to the module generated by OC. The problem is that the COBOL part should behave like before (for example if called from another COBOL program) and a C-Program should read the linked information "out of COBOL" (maybe without using the main function but the new special_additional_information function). Does anybody has an idea how to thinks like this? Greetings, human ---------------------------------------------------------------- Subject: libcob Hello to all people of good will... For the others I have nothing to say... I don't know why but I have two applications in two different directories but that works with exactly same environment. One works and the other gives me the following message : MENGEN.cob:49: libcob: File does not exist (STATUS = 35) File : '' I don't understand... Really... Thanks for your help. rudy. ---------------------------------------------------------------- Rudy; Take a look at line 49 in MENGEN.cob. I'm guessing it is an OPEN verb [i](or perhaps SORT or a few others)[/i]. In the directory where this fails, the file that is mentioned cannot be found. In the directory where is works, the file is there (or can be found using the PATH related environment settings in play). From open-cobol-1.1/libcob/fileio.h [code] #define COB_STATUS_35_NOT_EXISTS 35 [/code] So, while a little cryptic, error 35 is File Not Found Hope that helps. Cheers, Brian P.S. Please don't take some of the "shorter" answers from some of us as not showing goodwill. This forum is very technical in nature and we strive to stay in focus. It is important that we show due diligence to ensure that the opencobol.org forum posts are kept on topic. Sometimes when misunderstandings arise, what seems on topic to one may seem off topic, [i]and a potential waste of valuable time[/i], to another. Hang out here long enough and you'll be a master OpenCOBOL developer able to answer most of your own questions and those of others travelling up the learning curve. ;) ---------------------------------------------------------------- I have found my mistake, sorry. Happy new year (to all). rudy. ---------------------------------------------------------------- Subject: OC and window management ... Hello OC players, I am trying to find out a way to manage character based windows from OC. Programs below give some results but there is still work to do. OCWINS calls WINONE and WINTWO : this part seems to work well. Then OCWINS calls DELWIN in order to delete WINTWO and WINONE. By "delete" I mean "Erase the screen" created by WINONE and/or WINTWO. This part does not work ... Help welcome ! OCWINS.CBL [code] >>SOURCE FORMAT FREE *> ****************************************************************************** *> * Author : Francois Hiniger *> * Date : 13-Dec-2008 *> * Purpose : OC calls C for window management *> * Tectonics : cobc -x OCWINS.CBL *> * : cc -shared -o ../Library/$1.so -lncurses $1.c where $1=WINONE *> * : cc -shared -o ../Library/$1.so -lncurses $1.c where $1=WINTWO *> * : cc -shared -o ../Library/$1.so -lncurses $1.c where $1=DELWIN *> * Note : "../Library/" can be replaced by "./" ; this is dependent to *> * : my organization. *> * Run : ./OCWINS *> ****************************************************************************** identification division. program-id. OCWINS. *> *> Playing with character-type windows *> data division. working-storage section. 77 w-PopUp1 usage pointer. 77 w-PopUp2 usage pointer. 77 w-PopUp3 usage pointer. 77 w-Line pic S9(8) usage comp-5. 77 w-Position pic S9(8) usage comp-5. 77 w-Height pic S9(8) usage comp-5. 77 w-Size pic S9(8) usage comp-5. 77 w-TopTitle pic X(040). 77 w-BottomTitle pic X(040). procedure division. initiale section. debut. display "THIS STANDARD WINDOW, stdscr, COMES FROM COBOL OCWINS" line 01 column 01 with erase eos end-display. call "C$SLEEP" using 1 end-call *> callling window-1 : the first window move 05 to w-Line move 10 to w-Position move 05 to w-Height move 30 to w-Size call "WINONE" using w-PopUp1 w-Line w-Position w-Height w-Size on exception display "Sorry WINONE failed !" line 22 column 10 end-display not on exception continue end-call display "WINONE has been called" line 23 column 10 end-display call "C$SLEEP" using 1 end-call *> callling window-2 : the 2nd window move 07 to w-Line move 50 to w-Position move 05 to w-Height move 30 to w-Size call "WINTWO" using w-PopUp2 w-Line w-Position w-Height w-Size on exception display "Sorry WINTWO failed !" line 22 column 50 end-display not on exception continue end-call display "WINTWO has been called" line 23 column 50 end-display call "C$SLEEP" using 1 end-call call "DELWIN" using w-PopUp2 on exception display "ErrCall DELWIN" with beep end-display not on exception display "WINTWO must be erased ..." line 24 column 10 end-display end-call call "C$SLEEP" using 1 end-call call "DELWIN" using w-PopUp1 on exception display "ErrCall DELWIN" with beep end-display not on exception display "WINONE must be erased ..." line 24 column 50 end-display end-call display "BYE, It's Over ..." line 12 column 31 with bell foreground-color 1 background-color 6 end-display call "C$SLEEP" using 2 end-call . terminale section. fin. exit program. [/code] WINONE.c [code] #include /* This is window one, called WINONE which is the clearest way to name it */ void WINONE (WINDOW *ptr_win, int *ptr_Lw, int *ptr_Cw, int *ptr_Hw, int *ptr_Sw) { int Lw = *ptr_Lw; int Cw = *ptr_Cw; int Hw = *ptr_Hw; int Sw = *ptr_Sw; // Don't forget : screen location in Cobol begins at line 1 column 1, C begins at (0,0) Lw = Lw -1; Cw = Cw -1; WINDOW *win; /* pointer for new window */ win = newwin(Hw,Sw,Lw,Cw); ptr_win = win ; if( win == NULL) { addstr("Unable to allocate memory for new window."); endwin(); } wborder(win,0,0,0,0, 0,0,0,0); waddstr(win,"This is window ONE ... \n"); wrefresh(win); } [/code] WINTWO.c [code] #include /* This is window two, called WINTWO which is the clearest way to name it */ void WINTWO (WINDOW *ptr_win, int *ptr_Lw, int *ptr_Cw, int *ptr_Hw, int *ptr_Sw) { int Lw = *ptr_Lw; int Cw = *ptr_Cw; int Hw = *ptr_Hw; int Sw = *ptr_Sw; // Don't forget : screen location in Cobol begins at line 1 column 1, C begins at (0,0) Lw = Lw -1; Cw = Cw -1; WINDOW *win; /* pointer for new window */ win = newwin(Hw,Sw,Lw,Cw); ptr_win = win ; if( win == NULL) { addstr("Unable to allocate memory for new window."); endwin(); } wborder(win,0,0,0,0, 0,0,0,0); waddstr(win,"This is window TWO... \n"); wrefresh(win); endwin(); } [/code] DELWIN.c [code] #include /* Can You find a better name for this program ? */ void DELWIN (WINDOW *win) { if( win == NULL) { addstr("Unable to de-allocate memory for window in DELWIN."); getchar(); endwin(); } delwin(win); touchwin(stdscr); refresh(); } [/code] Regards Bear ---------------------------------------------------------------- Nice demo Bear! And [i]this is just as a heads up[/i]; tectonics can be simplified to [code] cobc -x OCWINS.CBL cobc WINONE.c cobc WINTWO.c cobc DELWIN.c [/code] when building into ./ (or, for your needs) [code] cobc -o ../Library/WINONE.so WINONE.c [/code] Roger has built the compiler to handle C files, it produces Dynamic Shared Objects by default, and relying on the fact that [i]ncurses[/i] is already a findable library for OpenCOBOL apps. Regarding the window erasing; I'm not up on ncurses, but I took some hints from http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/windows.html Those hints lead to this [i](and sorry for the changes to POINTER ... I'm just more comfortable with this style of RETURNING and CALL USING BY VALUE with handles)[/i] Those changes could well be wrong minded and stubborn. ;) The actual "fix" was in DELWIN.c OCWINS.CBL [code] >>SOURCE FORMAT FREE *> ****************************************************************************** *> * Author : Francois Hiniger (hacked by Brian - don't blame Bear) *> * Date : 13-Dec-2008 *> * Purpose : OC calls C for window management *> * Tectonics : cobc -x OCWINS.CBL *> * : cc -shared -o ../Library/$1.so -lncurses $1.c where $1=WINONE *> * : cc -shared -o ../Library/$1.so -lncurses $1.c where $1=WINTWO *> * : cc -shared -o ../Library/$1.so -lncurses $1.c where $1=DELWIN *> * Note : "../Library/" can be replaced by "./" ; this is dependent to *> * : my organization. *> * Run : ./OCWINS *> ****************************************************************************** identification division. program-id. OCWINS. *> *> Playing with character-type windows *> data division. working-storage section. 77 w-PopUp1 usage pointer. 77 w-PopUp2 usage pointer. 77 w-PopUp3 usage pointer. 77 w-Line pic S9(8) usage comp-5. 77 w-Position pic S9(8) usage comp-5. 77 w-Height pic S9(8) usage comp-5. 77 w-Size pic S9(8) usage comp-5. 77 w-TopTitle pic X(040). 77 w-BottomTitle pic X(040). procedure division. initiale section. debut. display "THIS STANDARD WINDOW, stdscr, COMES FROM COBOL OCWINS" line 01 column 01 with erase eos end-display. call "C$SLEEP" using 1 end-call *> callling window-1 : the first window move 05 to w-Line move 10 to w-Position move 05 to w-Height move 30 to w-Size call "WINONE" using w-Line w-Position w-Height w-Size returning w-PopUp1 on exception display "Sorry WINONE failed !" line 22 column 10 end-display not on exception continue end-call display "WINONE has been called" line 23 column 10 end-display call "C$SLEEP" using 1 end-call *> callling window-2 : the 2nd window move 07 to w-Line move 50 to w-Position move 05 to w-Height move 30 to w-Size call "WINTWO" using w-Line w-Position w-Height w-Size returning w-PopUp2 on exception display "Sorry WINTWO failed !" line 22 column 50 end-display not on exception continue end-call display "WINTWO has been called" line 23 column 50 end-display call "C$SLEEP" using 1 end-call call "DELWIN" using by value w-PopUp2 on exception display "ErrCall DELWIN" with beep end-display not on exception display "WINTWO must be erased ..." line 24 column 10 end-display end-call call "C$SLEEP" using 1 end-call call "DELWIN" using by value w-PopUp1 on exception display "ErrCall DELWIN" with beep end-display not on exception display "WINONE must be erased ..." line 24 column 50 end-display end-call display "BYE, It's Over ..." line 12 column 31 with bell foreground-color 1 background-color 6 end-display call "C$SLEEP" using 2 end-call . terminale section. fin. exit program. [/code] WINONE.c [code] #include /* This is window one, called WINONE which is the clearest way to name it */ WINDOW * WINONE (int *ptr_Lw, int *ptr_Cw, int *ptr_Hw, int *ptr_Sw) { int Lw = *ptr_Lw; int Cw = *ptr_Cw; int Hw = *ptr_Hw; int Sw = *ptr_Sw; // Don't forget : screen location in Cobol begins at line 1 column 1, C begins at (0,0) Lw = Lw -1; Cw = Cw -1; WINDOW *win; /* pointer for new window */ win = newwin(Hw,Sw,Lw,Cw); /* ptr_win = win ; */ if( win == NULL) { addstr("Unable to allocate memory for new window."); endwin(); } wborder(win,0,0,0,0, 0,0,0,0); waddstr(win,"This is window ONE ... \n"); wrefresh(win); return win; } [/code] WINTWO.c [code] #include /* This is window two, called WINTWO which is the clearest way to name it */ WINDOW * WINTWO (int *ptr_Lw, int *ptr_Cw, int *ptr_Hw, int *ptr_Sw) { int Lw = *ptr_Lw; int Cw = *ptr_Cw; int Hw = *ptr_Hw; int Sw = *ptr_Sw; // Don't forget : screen location in Cobol begins at line 1 column 1, C begins at (0,0) Lw = Lw -1; Cw = Cw -1; WINDOW *win; /* pointer for new window */ win = newwin(Hw,Sw,Lw,Cw); /* ptr_win = win ; */ if( win == NULL) { addstr("Unable to allocate memory for new window."); endwin(); } wborder(win,0,0,0,0, 0,0,0,0); waddstr(win,"This is window TWO... \n"); wrefresh(win); return win; /* endwin(); */ } [/code] and then DELWIN.c [code] #include /* Can You find a better name for this program ? */ void DELWIN (WINDOW *win) { if( win == NULL) { addstr("Unable to de-allocate memory for window in DELWIN."); getchar(); endwin(); } wborder(win, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); wrefresh(win); delwin(win); /* touchwin(stdscr); refresh(); */ } [/code] Which are the changes from the hints on the tldp HOWTO. Cheers, Brian ---------------------------------------------------------------- Hello Brian, Thank you for examples of [i]simplified tectonics[/i]. I'll remember for next posts. I'm still trying to make this example work, because lots of ideas are behind this post... Regards Bear ---------------------------------------------------------------- Oops, I edited my post with some new code for you; We were typing at the same time. It's nice to be able to edit posts, but ... Cheers, Brian ---------------------------------------------------------------- Brian, It works now ! You can do everything you want with this examples, post it at add1tocobol ... etc I'm going to add some other features to this ... I have a basement of development here ... Thank you Bear ---------------------------------------------------------------- No problem Bear and thanks to you. Yeah, make sure you check out http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/index.html It seems like a pretty extensive HOWTO and could save you some head scratching, or even better, lead to some added functionality for your toolkit. ;) With a warning; Don't go too too far in replicating Warren's cobcurses package. His system works pretty good and includes a boatload of features. Cheers, Brian ---------------------------------------------------------------- Yes Brian, I understand. My wishes are not to replace Warren's work, but I need a tool that allows me to go on with my development. I'm not working on mainframe so I do not use screen designers. I need a tool to be driven by the program itself... Well, I modified some lines in program below specially to show better execution. OCWINS.CBL [code] >>SOURCE FORMAT FREE *> ****************************************************************************** *> * Author : Francois Hiniger (hacked by Brian - don't blame Bear) *> * Date : 13-Dec-2008 *> * Purpose : OC calls C for window management *> * Tectonics : cobc -x OCWINS.CBL *> * : cobc WINONE.c *> * : cobc WINTWO.c *> * : cobc DELWIN.c *> * Run : ./OCWINS *> ****************************************************************************** identification division. program-id. OCWINS. *> *> Playing with character-type windows *> data division. working-storage section. 77 L pic 99. 77 w-80 pic X(080). 77 w-PopUp1 usage pointer. 77 w-PopUp2 usage pointer. 77 w-PopUp3 usage pointer. 77 w-Line pic S9(8) usage comp-5. 77 w-Position pic S9(8) usage comp-5. 77 w-Height pic S9(8) usage comp-5. 77 w-Size pic S9(8) usage comp-5. 77 w-TopTitle pic X(040). 77 w-BottomTitle pic X(040). procedure division. initiale section. debut. display "THIS STANDARD WINDOW, stdscr, COMES FROM COBOL OCWINS" line 01 column 01 with blank screen *> I think this must clear the whole screen, foreground-color 1 background-color 7 end-display. move all "." to w-80 perform varying L from 2 by 1 until L > 24 display w-80 line L column 1 end-display end-perform call "C$SLEEP" using 1 end-call *> callling window-1 : the first window move 05 to w-Line move 10 to w-Position move 05 to w-Height move 30 to w-Size call "WINONE" using w-Line w-Position w-Height w-Size returning w-PopUp1 on exception display "Sorry WINONE failed !" line 22 column 10 end-display not on exception continue end-call display "WINONE has been called" line 23 column 10 end-display call "C$SLEEP" using 1 end-call *> callling window-2 : the 2nd window move 07 to w-Line move 50 to w-Position move 05 to w-Height move 30 to w-Size call "WINTWO" using w-Line w-Position w-Height w-Size returning w-PopUp2 on exception display "Sorry WINTWO failed !" line 22 column 50 end-display not on exception continue end-call display "WINTWO has been called" line 23 column 50 end-display call "C$SLEEP" using 1 end-call *> This must make window-2 disappear call "DELWIN" using by value w-PopUp2 on exception display "ErrCall DELWIN" with beep end-display not on exception display "WINTWO must be erased ..." line 24 column 10 end-display end-call call "C$SLEEP" using 1 end-call *> This must make window-1 disappear call "DELWIN" using by value w-PopUp1 on exception display "ErrCall DELWIN" with beep end-display not on exception display "WINONE must be erased ..." line 24 column 50 end-display end-call call "C$SLEEP" using 1 end-call display "BYE, It's Over ..." line 12 column 31 with bell foreground-color 1 background-color 6 end-display call "C$SLEEP" using 2 end-call . terminale section. fin. exit program. [/code] WINONE.c [code] #include /* This is window one, called WINONE which is the clearest way to name it */ WINDOW * WINONE (int *ptr_Lw, int *ptr_Cw, int *ptr_Hw, int *ptr_Sw) { int Lw = *ptr_Lw; int Cw = *ptr_Cw; int Hw = *ptr_Hw; int Sw = *ptr_Sw; // Don't forget : screen location in Cobol begins at line 1 column 1, C begins at (0,0) Lw = Lw -1; Cw = Cw -1; WINDOW *win; /* pointer for new window */ win = newwin(Hw,Sw,Lw,Cw); if( win == NULL) { addstr("Unable to allocate memory for new window."); endwin(); } wborder(win,0,0,0,0, 0,0,0,0); wmove(win,2,7); waddstr(win,"This is window 1"); wrefresh(win); return win; } [/code] WINTWO.c [code] #include /* This is window two, called WINTWO which is the clearest way to name it */ WINDOW * WINTWO (int *ptr_Lw, int *ptr_Cw, int *ptr_Hw, int *ptr_Sw) { int Lw = *ptr_Lw; int Cw = *ptr_Cw; int Hw = *ptr_Hw; int Sw = *ptr_Sw; // Don't forget : screen location in Cobol begins at line 1 column 1, C begins at (0,0) Lw = Lw -1; Cw = Cw -1; WINDOW *win; /* pointer for new window */ win = newwin(Hw,Sw,Lw,Cw); if( win == NULL) { addstr("Unable to allocate memory for new window."); endwin(); } wborder(win,0,0,0,0, 0,0,0,0); wmove(win,2,7); waddstr(win,"This is window 2"); wrefresh(win); return win; } [/code] ... and finally DELWIN.c [code] #include /* Can You find a better name for this program ? */ void DELWIN (WINDOW *win) { if( win == NULL) { addstr("Unable to de-allocate memory for window in DELWIN."); getchar(); endwin(); } /*wborder(win, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); */ wmove(win,1,1); wclear(win); wrefresh(win); delwin(win); touchwin(stdscr); // If you don't do this, then stdscr is not initialized ... } [/code] DELWIN still does not work correctly. Regards Bear ---------------------------------------------------------------- Do you have any screenshots of your work? ---------------------------------------------------------------- Not yet, I still need help to make all this stuff work. Regards Bear ---------------------------------------------------------------- Ladies and Gentlemen, OC programmers and Ncurses experts, I have a dream ... (this reminds me somebody) ... Well, in more serious way I simplified a bit my last post to get it more readable. OCWIN2(.CBL) calls NEWWIN(.c) twice and then calls DELWIN(.c) to delete the previous screens and stops. I Added some colors - well I get some blinking Christmas tree, but its not exactly what I expected ... Yes you got it : I still need help ... source of OCWIN2.CBL [code] >>SOURCE FORMAT FREE *> ****************************************************************************** *> * Author : Francois Hiniger & Brian Tiffin & so on ... *> * Date : 13-Dec-2008 / 17-Dec-2008 *> * Purpose : OC calls C for window management *> * Tectonics : cobc -x OCWINS.CBL *> * : cobc NEWWIN.c *> * : cobc DELWIN.c *> * Run : ./OCWIN2 *> ****************************************************************************** identification division. program-id. OCWIN2. *> *> Playing with character-type windows *> data division. working-storage section. 77 L pic 999. 77 LMax pic 999. 77 YMax pic 999. 77 XMax pic 999. 77 w-envvar pic X(20). 77 w-256 pic X(256). 77 w-PopUp1 usage pointer. 77 w-PopUp2 usage pointer. 77 w-PopUp0 usage pointer. 77 w-Line pic S9(8) usage comp-5. 77 w-Position pic S9(8) usage comp-5. 77 w-Height pic S9(8) usage comp-5. 77 w-Size pic S9(8) usage comp-5. 77 w-TopTitle pic X(040). 77 w-BottomTitle pic X(040). procedure division. initiale section. debut. display "THIS STANDARD WINDOW, stdscr, COMES FROM COBOL OCWINS. So wait and see ..." line 01 column 01 with blank screen *> I think this must clear the whole screen, foreground-color 1 background-color 7 end-display. call "C$SLEEP" using 1 end-call move 24 to YMax move 80 to XMax move all "." to w-256 perform varying L from 2 by 1 until L > YMax display w-256 (1:XMax) line L column 1 with foreground-color 3 background-color 7 end-display end-perform call "C$SLEEP" using 1 end-call *> callling window-1 : the first window is called and a return-value is stored in w-PopUp1 move 05 to w-Line move 10 to w-Position move 05 to w-Height move 30 to w-Size call "NEWWIN" using w-Line w-Position w-Height w-Size returning w-PopUp1 on exception display "Sorry NEWWIN failed (1) !" line 22 column 10 end-display not on exception continue end-call display "NEWWIN has been called (1)" line 23 column 10 end-display call "C$SLEEP" using 3 end-call *> callling window-2 : the 2nd window is called and a return-value is stored in w-PopUp2 move 07 to w-Line move 50 to w-Position move 05 to w-Height move 30 to w-Size call "NEWWIN" using w-Line w-Position w-Height w-Size returning w-PopUp2 on exception display "Sorry NEWWIN failed (2) !" line 22 column 50 end-display not on exception continue end-call display "NEWWIN has been called (2)" line 23 column 50 end-display call "C$SLEEP" using 1 end-call *> This is supposed to make window-2 disappear call "DELWIN" using by value w-PopUp2 on exception display "ErrCall DELWIN" with beep end-display not on exception display "Window 2 must be erased WITHOUT window 1..." line 24 column 10 end-display end-call call "C$SLEEP" using 1 end-call *> This is supposed to make window-1 disappear call "DELWIN" using by value w-PopUp1 on exception display "ErrCall DELWIN" with beep end-display not on exception display "window 2 must be erased now ..." line 24 column 50 end-display end-call call "C$SLEEP" using 1 end-call *> This is supposed to tell you "BYE, ..." or something like that ... display "BYE, It's Over !!!" line 12 column 31 with bell foreground-color 0 background-color 6 highlight end-display call "C$SLEEP" using 3 end-call . *> This is like me : I'm going to sleep for a while terminale section. fin. exit program. [/code] source of NEWWIN.c [code] #include /* This is window two, called WINTWO which is the clearest way to name it */ WINDOW * NEWWIN (int *ptr_Lw, int *ptr_Cw, int *ptr_Hw, int *ptr_Sw) { int Lw = *ptr_Lw; int Cw = *ptr_Cw; int Hw = *ptr_Hw; int Sw = *ptr_Sw; // Don't forget : screen location in Cobol begins at line 1 column 1, C begins at (0,0) Lw = Lw -1; Cw = Cw -1; WINDOW *win; /* pointer for new window */ win = newwin(Hw,Sw,Lw,Cw); if( win == NULL) { addstr("Unable to allocate memory for new window."); endwin(); } // This Color Gedings start_color (); init_pair (1,COLOR_WHITE, COLOR_CYAN); init_pair (2,COLOR_MAGENTA, COLOR_YELLOW); // This is supposed to clear the inside box with magenta on yellow wattrset (win, COLOR_PAIR(2)); wclear(win); wrefresh(win); mvwaddstr(win,2,7,"This is window "); wrefresh(win); // This is supposed to draw box white lines on cyan ... wattrset (win, COLOR_PAIR(1)); box(win,0,0); wrefresh(win); return win; } [/code] source of DELWIN.c [code] #include /* Can You find a better name for this program ? */ void DELWIN (WINDOW *win) { if( win == NULL) { addstr("Unable to de-allocate memory for window in DELWIN."); getchar(); endwin(); } wclear(win); delwin(win); // clearok(stdscr,TRUE); touchwin(stdscr); refresh(); } [/code] Bestregards Bear ---------------------------------------------------------------- Hello World ! As you can see I'm not giving up ! In the following lines you'll find a piece of my madness. I changed a bit my job. OCPOPS.CBL is the main OC program that manages pop up windows. NEWPOP.c creates a "pop-up window" when called by OCPOPS. WRTPOP.c is supposed to write something into the window opened by NEWPOP. DELPOP.c deletes the pop up windows. In order to increase readability I added some "perform" here and there. For instance, perform NEWPOP performs a section called NEWPOP in which we can find a call "NEWPOP" using ... Uncomment the "perform WRTPOP" to see what happens. :-D OCPOPS.CBL [code] >>SOURCE FORMAT FREE *> ****************************************************************************** *> * Author : Francois Hiniger (hacked by Brian Tiffin, and so on) ... *> * Date : 13-Dec-2008 *> * Purpose : OC calls C for popup window management -proof of concept *> * Tectonics : cobc -x OCPOPS.CBL *> * : cobc NEWPOP.c *> * : cobc WRTPOP.c *> * : cobc DELPOP.c *> * Run : ./OCPOPS *> ****************************************************************************** identification division. program-id. OCPOPS. *> *> Playing with character-type POPUP windows *> data division. working-storage section. 77 w-YMax pic 999. 77 w-XMax pic 999. 77 L pic 99. 77 w-80 pic X(080). 01 w-PopUp usage pointer. 77 w-Line pic S9(8) usage comp-5. 77 w-Position pic S9(8) usage comp-5. 77 w-Height pic S9(8) usage comp-5. 77 w-Size pic S9(8) usage comp-5. 77 w-Fcolor pic S9(8) usage comp-5. 77 w-Bcolor pic S9(8) usage comp-5. 77 w-Message pic X(050). 77 w-TopTitle pic X(040). 77 w-BottomTitle pic X(040). procedure division. initiale section. debut. *> Gently begins the actual program ... display "This comes from OCPOPS (stdscr) ..." line 01 column 01 with blank screen foreground-color 1 background-color 7 end-display. call "C$SLEEP" using 1 end-call *> Filling the standard screen (stdscr) with some "X" move all "X" to w-80 perform varying L from 2 by 1 until L > 24 display w-80 line L column 1 with foreground-color 1 background-color 7 end-display end-perform call "C$SLEEP" using 1 end-call *> Opening a boxed PopUp window with Top & Bottom Title move 05 to w-Line move 10 to w-Position move 15 to w-Height move 50 to w-Size move "TopTitle" & low-value to w-TopTiTle move "BottomTitle" & low-value to w-BottomTiTle perform NEWPOP *> Writing something inside the current opened window move 03 to w-line move 02 to w-position move "This Text comes from OCPOPS via WRTPOP" & low-value to w-message *> perform WRTPOP *> UNCOMMENT THIS perform TO SEE WHY IT DOES NOT WORK :-) *> This must make popup disappear perform DELPOP *> This is something that often works ... ;-) display "BYE, It's Going To Be Over ..." line 14 column 31 with bell foreground-color 1 background-color 6 end-display call "C$SLEEP" using 2 end-call . go to FIN. *> *********************************************************************************** *> All these modules can be stored in a copybook like "NEWPOP.MDL", "WRTPOP.MDL", ... *> *********************************************************************************** NEWPOP SECTION. D-NEWPOP. call "NEWPOP" using w-Line w-Position w-Height w-Size w-TopTitle w-BottomTitle giving w-PopUp on exception display "Sorry NEWPOP failed !" line 22 column 10 end-display not on exception continue end-call display "PopUp window has been called" line 23 column 10 end-display call "C$SLEEP" using 1 end-call . F-NEWPOP. exit. WRTPOP SECTION. D-WRTPOP. call "WRTPOP" using w-popup w-line w-position w-message on exception display "ErrCall WRTPOP" with beep end-display not on exception display "Some words on window" line 23 column 10 end-display end-call call "C$SLEEP" using 1 end-call . F-WRTPOP. exit. DELPOP SECTION. D-DELPOP. call "DELPOP" using by value w-PopUp on exception display "ErrCall DELPOP" with beep end-display not on exception display "1st window disapeared ..." line 24 column 10 with beep end-display end-call call "C$SLEEP" using 1 end-call . F-DELPOP. exit. terminale section. fin. ultime. exit program. [/code] NEWPOP.c [code] /*********************************************************************************** Author : Francois Hiniger Purpose : creates a boxed popup window with TopTitle and BottomTitle if any. : returns a popup handler that may be used by the caller OCPOPS. ************************************************************************************/ #include WINDOW * NEWPOP (int *ptr_Lw, int *ptr_Cw, int *ptr_Hw, int *ptr_Sw, char *TopTitle, char *BotTitle) { int Lw = *ptr_Lw; int Cw = *ptr_Cw; int Hw = *ptr_Hw; int Sw = *ptr_Sw; int k, kmax; // Screen location in Cobol begins at line 1 column 1, C begins at (0,0) Lw = Lw -1; Cw = Cw -1; WINDOW *curwin; // Pointer to current New window curwin = newwin(Hw,Sw,Lw,Cw); if( curwin == NULL) { addstr("Unable to allocate memory for new window."); endwin(); } // This Color Gedings (initializes color pairs) init_pair (1,COLOR_BLUE, COLOR_WHITE); // the same used by the caller ??? init_pair (2,COLOR_WHITE, COLOR_YELLOW); // This clears the inside box with white text on yellow [OK] // wbkgd(curwin,COLOR_PAIR(2)); // This draws box white lines on cyan ... [OK] wbkgd(curwin, COLOR_PAIR(2)); wborder(curwin,0,0,0,0, 0,0,0,0 ); wrefresh(curwin); // Let's display the TopTitle wmove (curwin,0,3); for (k=0;k<40;k++) { if (TopTitle[k] == '\0') { k=40; break; } { waddch(curwin,TopTitle[k]); } } wrefresh(curwin); // ...and now the Bottom Title wmove (curwin, Hw - 1, 3); for (k=0;k<40;k++) { if (BotTitle[k] == '\0') { k=40; break; } { waddch(curwin,BotTitle[k]); } } wrefresh(curwin); wnoutrefresh(stdscr); doupdate(); return curwin; } [/code] WRTPOP.c [code] /***************************************************************************************** Author : Francois Hiniger Date : Dec 2008 Purpose : "Writes" a message from *Ms on window curwin at line Lw-1, column Cw-1 ******************************************************************************************/ #include void WRTPOP (WINDOW *curwin, int *ptr_Lw, int *ptr_Cw, char *Ms) { int Lw = *ptr_Lw; int Cw = *ptr_Cw; int k; if(curwin == NULL) { addstr("Unable to write on window in WRTPOP"); getchar(); endwin(); } wmove (curwin, Lw - 1, Cw - 1); for (k=0;30;k++) { if (Ms[k] == '\0') { k=31; break; } { waddch(curwin,Ms[k]); } } wrefresh(curwin); } [/code] DELPOP.c [code] /*************************************************************************** Author : Francois Hiniger Purpose : removes a popup window from memory and from screen ****************************************************************************/ #include void DELPOP (WINDOW *curwin) { if( curwin == NULL) { addstr("Unable to de-allocate memory for window in DELPOP."); getchar(); endwin(); } // wclear(curwin); // touchwin(curwin); // wrefresh(curwin); delwin(curwin); touchwin(stdscr); refresh(); } [/code] Critics heavily recommended... Best regards Bear ---------------------------------------------------------------- Hello Bear, it's good that you try to move your prove-of-concept to a usable piece of code more and more. I like the way your code is written (especially the end-... and the use of sections), here are just some additional thoughts to it: 1. What do you think of putting the three c-files into one module? 2. "go to FIN" should be replaced by "perform terminale" 3. For easier usage I'd appreciate moving the x'00' to the ...pop sections via inspect[code]NEWPOP SECTION. D-NEWPOP. inspect w-TopTitle replacing trailing spaces by x'00' inspect w-BottomTitle replacing trailing spaces by x'00' ... WRTPOP SECTION. D-WRTPOP. inspect w-message replacing trailing spaces by x'00' ...[/code] 4. For easier reading I'd appreciate some optical delimiters between the sections/divisions like a comment line with - (or * if you prefer these) 5. For easier reading I'd appreciate naming l as line-counter 6. For easier reading/usage I'd appreciate putting the necessary vars used in ...pop sections into a copybook (for example POPMDLW.CPY), even in this example 7. Instead of different copybooks I suggest to move the ...pop sections into one copybook POPMLD.CPY (don't forget to begin the copy with >>SOURCE FORMAT directive) 8. For easier reading/usage I'd appreciate putting the ...pop sections into a copybook, even in this example human ---------------------------------------------------------------- Hello Human, I generally agree with most of your remarks. Another post will be made after getting some results. Has anyone found out why WRTPOP sends [code] Attempt to reference unallocated memory (Signal SIGSEGV) [/code] ? I think I must use the PANEL library to get better results but this message does not explain me what to do. Maybe I'm getting blind ... I wish you a happy new year and long life to OC Regards Bear ---------------------------------------------------------------- The problem is how you are calling WRTPOP - call "WRTPOP" using w-popup ..... Remember that the default for CALL params is BY REFERENCE. So you are passing the ADDRESS of the window pointer. ie. a "WINDOW **". So, either change the call to - call "WRTPOP" using by value w-popup by reference .... or change WRTPOP to use a pointer to pointer. Roger ---------------------------------------------------------------- Roger, 2009 begins with happyness !!! I was right when I said I'm getting blind... I changed the way of calling WRTPOP and suddenly light came ! so this is the latest OCPOPS.CBL including multiple calls of WRTPOP module. [code] >>SOURCE FORMAT FREE *> ****************************************************************************** *> * Author : Francois Hiniger (hacked by Brian Tiffin, and so on) ... *> * Date : 13-Dec-2008 *> * Purpose : OC calls C for popup window management -proof of concept *> * Tectonics : cobc -x OCPOPS.CBL *> * : cobc NEWPOP.c *> * : cobc WRTPOP.c *> * : cobc DELPOP.c *> * Run : ./OCPOPS *> ****************************************************************************** identification division. program-id. OCPOPS. *> *> Playing with character-type POPUP windows *> data division. working-storage section. 77 w-YMax pic 999. 77 w-XMax pic 999. 77 L pic 99. 77 w-80 pic X(080). 01 w-PopUp usage pointer. 77 w-Line pic S9(8) usage comp-5. 77 w-Position pic S9(8) usage comp-5. 77 w-Height pic S9(8) usage comp-5. 77 w-Size pic S9(8) usage comp-5. 77 w-Fcolor pic S9(8) usage comp-5. 77 w-Bcolor pic S9(8) usage comp-5. 77 w-Message pic X(050). 77 w-TopTitle pic X(040). 77 w-BottomTitle pic X(040). procedure division. initiale section. debut. *> Gently begins the actual program ... display "This comes from OCPOPS (stdscr) ..." line 01 column 01 with blank screen foreground-color 1 background-color 7 end-display. call "C$SLEEP" using 1 end-call *> Filling the standard screen (stdscr) with some "X" move all "X" to w-80 perform varying L from 2 by 1 until L > 24 display w-80 line L column 1 with foreground-color 1 background-color 7 end-display end-perform call "C$SLEEP" using 1 end-call *> Opening a boxed PopUp window with Top & Bottom Title move 05 to w-Line move 10 to w-Position move 15 to w-Height move 50 to w-Size move "Marvelous TopTitle" & low-value to w-TopTiTle move "Incredible BottomTitle" & low-value to w-BottomTiTle perform NEWPOP *> Writing something inside the current opened window, "Merci Roger !" move 03 to w-line move 02 to w-position move "This Text comes from OCPOPS via WRTPOP" & low-value to w-message perform WRTPOP move 05 to w-line move 03 to w-position move "THANK YOU ROGER !" & low-value to w-message perform WRTPOP move 06 to w-line move 03 to w-position move "ONCE AGAIN : I APPRECIATE !" & low-value to w-message perform WRTPOP *> This must make popup disappear perform DELPOP *> This is something that often works ... ;-) display "BYE, It's Going To Be Over ..." line 14 column 31 with bell foreground-color 1 background-color 6 end-display call "C$SLEEP" using 2 end-call . *> The only one in my programs : dozen of years ago, progs were filled with "GO TO" .. go to FIN. *> *********************************************************************************** *> All these modules can be stored in a copybook like "NEWPOP.MDL", "WRTPOP.MDL", ... *> *********************************************************************************** NEWPOP SECTION. D-NEWPOP. call "NEWPOP" using w-Line w-Position w-Height w-Size w-TopTitle w-BottomTitle giving w-PopUp on exception display "Sorry NEWPOP failed !" line 22 column 10 end-display not on exception continue end-call display "PopUp window has been called" line 23 column 10 end-display call "C$SLEEP" using 1 end-call . F-NEWPOP. exit. WRTPOP SECTION. D-WRTPOP. call "WRTPOP" using by value w-popup by reference w-line w-position w-message on exception display "ErrCall WRTPOP" with beep end-display not on exception display "Some words on window ... " line 23 column 10 end-display end-call call "C$SLEEP" using 2 end-call . F-WRTPOP. exit. DELPOP SECTION. D-DELPOP. call "DELPOP" using by value w-PopUp on exception display "ErrCall DELPOP" with beep end-display not on exception display "1st window disapeared ..." line 24 column 10 with beep end-display end-call call "C$SLEEP" using 1 end-call . F-DELPOP. exit. terminale section. fin. ultime. exit program. [/code] Of course all these codes are freely usable by Brian and others for Faqs and etc .... Thank you again Roger. Best Regards Blind Bear :-D PS The ideas that are behind this coding are much more important that the code itself ... Thinking Bear :-D ---------------------------------------------------------------- Bear; Congrats. I'll be bringing this toolkit up at Sunday's IRC meetup. Freenode IRC #add1tocobol, Sundays 09:00 EST (GMT -5:00) And yes, I'd like to add it to the growing pile of samples, so that should happen soon; both as FAQ/Manual and as an extension entry on http://add1tocobol.com human; I'll also be bringing up your suggestions on good source code sectioning style (and I'll try and let it sink in to the examples I code up for posting), as well as the proper splitting of the FAQ (which I'm still pondering on path of least resistance). Cheers, Brian ---------------------------------------------------------------- Thanks Brian, You could see in this example that I'm not a big programmer in C. In fact Cobol was my world and I did what I had to do for my job. I met OpenCobol in 2006, so I learned very much tips and tricks, from you, from Roger, etc ... My problem is now how to pass informations from OC to a C program, and specially how to get info back via a structure. Example MYPROG calls a C prog in witch we find a "getmaxyx (curwin, maxy, maxx);" ... I think this must be easy for experimented C coders ... I would like to have a kind of "pattern" to play with. Regards Bear ---------------------------------------------------------------- This looks really good yall. It's exciting. Hopefully yall can be there on Sunday for the meeting. I'll be up and adam for it. ---------------------------------------------------------------- Hello OC hackers, I made some changes around my OC/ncurses project. I fixed a XIOPOP.CPY in order to be more explicit. I built a TSTPOP to test XIOPOP module. C programs are the same. source of TSTPOP.CBL [code] >>SOURCE FORMAT FREE *> ****************************************************************************** *> * Author : Francois Hiniger *> * Date : 02 Jan 2009 *> * Purpose : Testing module -proof of concept for the spririt of XIOPOP *> * Tectonics : cobc -x TSTPOP.CBL *> * : cobc XIOPOP.CBL *> * : cobc NEWPOP.c *> * : cobc WRTPOP.c *> * : cobc DELPOP.c *> * Run : ./TSTPOP *> ****************************************************************************** identification division. program-id. TSTPOP. data division. working-storage section. copy "XIOPOP.XDF". 77 x-IoPop-YMax pic 999. 77 x-IoPop-XMax pic 999. 77 L pic 99. 77 w-80 pic X(080). 77 w-PopUp1 usage pointer. 77 w-PopUp2 usage pointer. 77 w-PopUp3 usage pointer. procedure division. initiale section. debut. *> Gently begins the actual program ... display "This comes from TSTPOP (stdscr) ..." line 01 column 01 with blank screen foreground-color 1 background-color 7 end-display. call "C$SLEEP" using 1 end-call *> Filling the standard screen (stdscr) with some "X" (useful for further demo) move all "X" to w-80 perform varying L from 2 by 1 until L > 24 display w-80 line L column 1 with foreground-color 1 background-color 7 end-display end-perform call "C$SLEEP" using 1 end-call *> Opening a boxed PopUp window with Top & Bottom Title initialize x-IoPop move "OPEN" to x-IoPop-Command move 05 to x-IoPop-Line move 10 to x-IoPop-Position move 15 to x-IoPop-Height move 50 to x-IoPop-Size move "Marvelous TopTitle" to x-IoPop-TopTiTle move "Incredible BottomTitle" to x-IoPop-BottomTiTle perform XIOPOP move x-IoPop-1stWin to w-popup1 *> this is VERY important call "INFPOP" using by value w-popup1 by reference x-IoPop-YMax x-IoPop-XMax on exception display "HEY ?" end-display not on exception continue end-call *> Writing something inside the current opened window, (w-popup1) initialize x-IoPop move "WRITE" to x-IoPop-command move w-popup1 to x-IoPop-1stwin move 03 to x-IoPop-line move 02 to x-IoPop-position move "This Text comes from TSTPOP via XIOPOP" to x-IoPop-message perform XIOPOP move 04 to x-IoPop-Line move 04 to x-IoPop-Position move "Thank you Brian for your help in emergency " to x-IoPop-message perform XIOPOP move 05 to x-IoPop-line move 04 to x-IoPop-position move "THANK YOU ROGER !" to x-IoPop-message perform XIOPOP move 06 to x-IoPop-line move 03 to x-IoPop-position move "ONCE AGAIN : I APPRECIATE !" to x-IoPop-message perform XIOPOP *> Printing results of INFPOP .......... move 09 to x-IoPop-line move 03 to x-IoPop-position move spaces to x-IoPop-Message string "Pop size Y=" x-IoPop-YMax " X=" x-IoPop-XMax delimited by size into x-IoPop-message end-string perform XIOPOP *> This must make popup disappear initialize x-IoPop move w-popup1 to x-IoPop-1stwin move "DELETE" to x-IoPop-Command perform XIOPOP *> This is something that often works ... ;-) display "BYE, It's Going To Be Over ..." line 14 column 31 with bell foreground-color 1 background-color 6 end-display call "C$SLEEP" using 2 end-call . *> The only "GOTO" survives here : dozen of years ago, progs were filled with this .. go to FIN. copy "XIOPOP.MDL". terminale section. fin. ultime. exit program. [/code] XIOPOP.XDF [code] >>SOURCE FORMAT FREE *>****************************************************************************************** *> *> *> +--------------------------------------- standard screen (stdscr) ----- ... *> | *> | +-- TopTitle --------------------------- ] *> | |<-------------SubTitle----------------- ] *> | |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ] *> | |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ] window *> | |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx > managed *> | |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ] by XIOPOP *> | . ] *> | |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ] *> | +------- Bottom Title ------------------ ] *> . *> . *>****************************************************************************************** *> XIOPOP exchange definition area for PopUp boxed windows 01 x-IoPop. 02 x-IoPop-Command pic X(010). *> "OPEN", "CLOSE", ..., 02 x-IoPop-Handlers. 03 x-IoPop-1stWin usage pointer. *> The main window (boxed) 03 x-IoPop-2ndWin usage pointer. *> Subtitle subwindow 03 x-IoPop-3rdWin usage pointer. *> Working Subwindow 02 x-IoPop-Line pic 9(03). *> line in Cobol notation (y+1) 02 x-IoPop-Position pic 9(03). *> column in Cobol notation (x+1) 02 x-IoPop-Height pic 9(03). *> total height of the final window 02 x-IoPop-Size pic 9(03). *> total size of the final window 02 x-IoPop-TopTitle pic X(132). *> Top title (if any) 02 x-IoPop-TopPlace pic X(001). *> "L"=Left;"C"=Centered;"R"=Right; 02 x-IoPop-BottomTitle pic X(132). *> Bottom Title, if any 02 x-IoPop-BottomPlace pic X(001). *> "L"=Left;"C"=Centered;"R"=Right; 02 x-IoPop-SubTitle pic X(132). *> begins at Line + 1 02 x-IoPop-Message pic X(132). *> Message to send INSIDE a window 02 x-IoPop-Colors. *> Multiple Colors settings 03 x-IoPop-WinColor. *> Window colors (1) 04 x-IoPop-WinFg pic 9(05). 04 x-IoPop-WinBg pic 9(05). 03 x-IoPop-BorColor. *> Border color (default WinColor) 04 x-IoPop-BorFg pic 9(05). 04 x-IoPop-BorBg pic 9(05). 03 x-IoPop-TopColor. *> Top Title color (Default WinColor) 04 x-IoPop-TopFg pic 9(05). 04 x-IoPop-TopBg pic 9(05). 03 x-IoPop-BotColor. *> Bottom Title color 04 x-IoPop-BotFg pic 9(05). 04 x-IoPop-BotBg pic 9(05). 03 x-IoPop-CurColor. *> Current Line color 04 x-IoPop-CurFg pic 9(05). 04 x-IoPop-CurBg pic 9(05). 03 x-IoPop-SelColor. *> Selected line(s) color 04 x-IoPop-SelFg pic 9(05). 04 x-IoPop-SelBg pic 9(05). 03 x-IoPop-Overlapped. *> current line is a selected line 04 x-IoPop-OvlFg pic 9(05). 04 x-IoPop-OvlBg pic 9(05). *>------------------------------------------------------------------------------------------- *> (1) Too much colors brings programmer to build application very near to christmas tree ! [/code] source of XIOPOP.CBL [code] >>SOURCE FORMAT FREE *> ****************************************************************************** *> * Author : Francois Hiniger (hacked by Brian Tiffin, and so on) see OCPOPS *> * Date : 02-Jan-2008 *> * Purpose : Parser for window management -proof of concept *> * Tectonics : cobc XIOPOP.CBL *> * : cobc NEWPOP.c *> * : cobc WRTPOP.c *> * : cobc DELPOP.c *> * Run : ./TSTPOP *> ****************************************************************************** identification division. program-id. XIOPOP. data division. working-storage section. 77 w-Popup usage is pointer. 77 w-Line pic S9(08) usage comp-5. *> line in Cobol notation (y+1) 77 w-Position pic S9(08) usage comp-5. *> column in Cobol notation (x+1) 77 w-Height pic S9(08) usage comp-5. *> total height of the final window 77 w-Size pic S9(08) usage comp-5. *> total size of the final window 77 w-Message pic X(132). *> because I still believe that 77 w-TopTitle pic X(132). *> might be different than 80x24 77 w-BottomTitle pic X(132). *> ... linkage section. copy "XIOPOP.XDF". procedure division using x-IoPop. initiale section. debut. evaluate x-IoPop-Command when "OPEN" move x-IoPop-Line to w-Line move x-IoPop-Position to w-Position move x-IoPop-Height to w-Height move x-IoPop-Size to w-Size move x-IoPop-TopTitle to w-TopTiTle inspect w-TopTitle replacing trailing spaces by x'00' *> Human, have you seen that ? move x-IoPop-BottomTitle to w-BottomTiTle inspect w-BottomTitle replacing trailing spaces by x'00' *> Human, have you seen that ? perform NEWPOP move w-PopUp to x-IoPop-1stwin when "WRITE" move x-IoPop-1stwin to w-popup move x-IoPop-Line to w-line move x-IoPop-Position to w-position move x-IoPop-Message to w-message inspect w-message replacing trailing spaces by x'00' *> Human, have you seen that ? perform WRTPOP when "DELETE" move x-IoPop-1stwin to w-popup perform DELPOP when other continue end-evaluate go to FIN. *> I like to remember that I coded long time with this "imperative statement" copy "NEWPOP.MDL". copy "WRTPOP.MDL". copy "DELPOP.MDL". terminale section. fin. ultime. exit program. [/code] Here comes somes modules ".MDL" DELPOP.MDL [code] DELPOP SECTION. D-DELPOP. call "DELPOP" using by value w-PopUp on exception display "ErrCall DELPOP" with beep end-display not on exception display "1st window disapeared ..." line 24 column 10 with beep end-display end-call call "C$SLEEP" using 1 end-call . F-DELPOP. exit. [/code] NEWPOP.MDL [code] NEWPOP SECTION. D-NEWPOP. call "NEWPOP" using w-Line w-Position w-Height w-Size w-TopTitle w-BottomTitle giving w-PopUp on exception display "Sorry NEWPOP failed !" line 22 column 10 end-display not on exception continue end-call display "PopUp window has been called" line 23 column 10 end-display call "C$SLEEP" using 1 end-call . F-NEWPOP. exit. [/code] WRTPOP.MDL [code] WRTPOP SECTION. D-WRTPOP. call "WRTPOP" using by value w-popup by reference w-line w-position w-message on exception display "ErrCall WRTPOP" with beep end-display not on exception display "Some words on window ... " line 23 column 10 end-display end-call call "C$SLEEP" using 2 end-call . F-WRTPOP. exit. [/code] XIOPOP.MDL [code] *> *> Calling the parser XIOPOP *> XIOPOP SECTION. D-XIOPOP. call "XIOPOP" using x-IoPop on exception display "ErrCall XIOPOP" with beep end-display not on exception continue end-call call "C$SLEEP" using 1 end-call . F-XIOPOP. exit. [/code] I hope you'll have some interest to push this foreward. I will help me to build an accounting software from scratch as soon as I can make my XIOxyz library work !!! Best regards Bear ---------------------------------------------------------------- Hi Bear. I've seen the "inspect trailing" before, but it would be nicer for coding if the inspect would be in the NEWPOP/WRTPOP sections/copies. Again the question: Why do you do "go to fin" instead of "perform terminale"? If you have XIOPOP as wrapper, the NEWPOP/WRTPOP/DELPOP can be included directly into this program. If you don't want to include the sections there, I suggest putting them all together in one copy. ---------------------------------------------------------------- Hello Human, Generally speaking, I agree with your remarks. When the project will be finished I'll bring modifications to make it as clear as possible, so we can have discussion(s) at that time. For the "GO TO" It's just a very personal way to remember that we are at the end of procedure. This is why I have a lot of "COPY" following this statement before I reach the "real" end of program with an EXIT PROGRAM. For the moment I'm looking for a partner in order to finalize this job. C hackers welcome. Best Regards Bear :-) ---------------------------------------------------------------- Hello OC hackers, Another set of Cobol + C for playing with ncurses. TSTMAX.CBL [code] >>source format free *>************************************************************************************ *> Author : Francois (Bear) Hiniger *> Date : 13-Jan-2009 *> Purpose : One way to get the size of the current window (proof of concept) *> Tectonics : cobc -x TSTMAX.CBL *> : cobc GETMAX.c *> Run : ./TSTMAX change the size of your window and run ./TSTMAX again *>************************************************************************************ identification division. program-id. TSTMAX. data division. working-storage section. 77 w-curwin usage pointer. 77 w-maxxy pic s9(08) usage comp-5. 77 w-maxxx pic s9(08) usage comp-5. 77 getchar pic X. 77 wlines pic 9(03). 77 wcols pic 9(03). 77 wmessage pic X(60). 77 EndLine pic 9(3). 77 MidLine pic 9(3). 77 MidColumn pic 9(3). procedure division. initiale section. debut. *> Doing this initializes the standard screen display "Screen Size Test" line 01 column 01 with blank screen end-display set w-curwin to NULL *> So GETMAX will apply 'stdscr' for the current window call "GETMAX" using by value w-curwin by reference w-maxxy w-maxxx on exception display "GETMAX Failed" line 10 column 30 with beep end-display not on exception move w-maxxy to wlines move w-maxxx to wcols move spaces to wmessage string "This Screen is " wlines " lines height and " wcols " columns wide" delimited by size into wmessage end-string compute MidLine = wlines / 2 end-compute display wmessage line MidLine column 20 end-display end-call . termine section. fin. move wlines to EndLine compute MidColumn = wcols / 2 end-compute accept getchar line EndLine column MidColumn with prompt end-accept . ultime. exit program. [/code] GETMAX.c [code] /****************************************************** * Author : Francois (Bear) Hiniger * * Purpose : Cobol interface for C getmaxyx() macro.* * Tectonics : cobc GETMAX.c (see TSTMAX.CBL) * ******************************************************/ #include void GETMAX (WINDOW *win, int *ptr_maxy, int *ptr_maxx) { int maxy, maxx; if (win == NULL) { getmaxyx(stdscr, maxy, maxx); } else { getmaxyx(win, maxy, maxx); } *ptr_maxy = maxy; *ptr_maxx = maxx; } [/code] and finally the latest TSTPOP.CBL in which you can see 2 calls of GETMAX, one for the standard window, the second for the "popup" window ... [code] >>SOURCE FORMAT FREE *> ****************************************************************************** *> * Author : Francois (Bear) Hiniger *> * Date : 02 Jan 2009 *> * Purpose : Testing module -proof of concept for the spririt of XIOPOP *> * Tectonics : cobc -x TSTPOP.CBL *> * : cobc XIOPOP.CBL *> * : cobc NEWPOP.c *> * : cobc WRTPOP.c *> * : cobc DELPOP.c *> * Run : ./TSTPOP *> ****************************************************************************** identification division. program-id. TSTPOP. data division. working-storage section. copy "XIOPOP.XDF". 77 w-Scr-YMax pic 999. 77 w-Scr-XMax pic 999. 77 w-Pop-YMax pic 999. 77 w-Pop-XMax pic 999. 77 w-maxxy pic s9(08) usage comp-5. 77 w-maxxx pic s9(08) usage comp-5. 77 L pic 99. 77 w-80 pic X(080). 77 w-PopUp1 usage pointer. 77 w-PopUp2 usage pointer. 77 w-PopUp3 usage pointer. procedure division. initiale section. debut. *> Gently begins the actual program ...and initializes stdscr, the standard screen display "This comes from TSTPOP (stdscr) ..." line 01 column 01 with blank screen foreground-color 1 background-color 7 end-display *> Gets some information via getmaxyx() ... set w-PopUp1 to NULL call "GETMAX" using by value w-PopUp1 by reference w-maxxy w-maxxx on exception display "GETMAX Failed" line 10 column 30 with beep end-display not on exception move w-maxxy to w-Scr-YMax move w-maxxx to w-Scr-XMax end-call . call "C$SLEEP" using 1 end-call *> Filling the standard screen (stdscr) with some "X" (useful for further demo) move all "X" to w-80 perform varying L from 2 by 1 until L > 24 display w-80 line L column 1 with foreground-color 1 background-color 7 end-display end-perform call "C$SLEEP" using 1 end-call *> Opening a boxed PopUp window with Top & Bottom Title initialize x-IoPop move "OPEN" to x-IoPop-Command move 05 to x-IoPop-Line move 10 to x-IoPop-Position move 15 to x-IoPop-Height move 50 to x-IoPop-Size move "Marvelous TopTitle" to x-IoPop-TopTiTle move "Incredible BottomTitle" to x-IoPop-BottomTiTle perform XIOPOP move x-IoPop-1stWin to w-popup1 *> this is VERY important call "GETMAX" using by value w-PopUp1 by reference w-maxxy w-maxxx on exception display "GETMAX Failed" line 10 column 30 with beep end-display not on exception move w-maxxy to w-Pop-YMax move w-maxxx to w-Pop-XMax end-call *> Writing something inside the current opened window, (w-popup1) initialize x-IoPop move "WRITE" to x-IoPop-command move w-popup1 to x-IoPop-1stwin move 03 to x-IoPop-line move 02 to x-IoPop-position move "This Text comes from TSTPOP via XIOPOP" to x-IoPop-message perform XIOPOP move 04 to x-IoPop-Line move 04 to x-IoPop-Position move "Thank you Brian for your help in emergency " to x-IoPop-message perform XIOPOP move 05 to x-IoPop-line move 04 to x-IoPop-position move "THANK YOU ROGER !" to x-IoPop-message perform XIOPOP move 06 to x-IoPop-line move 03 to x-IoPop-position move "ONCE AGAIN : I APPRECIATE !" to x-IoPop-message perform XIOPOP *> Printing results of GETMAX .......... move 09 to x-IoPop-line move 03 to x-IoPop-position move spaces to x-IoPop-Message string "Screen size Y=" w-Scr-YMax " X=" w-Scr-XMax delimited by size into x-IoPop-message end-string perform XIOPOP move 10 to x-IoPop-line move 03 to x-IoPop-position move spaces to x-IoPop-Message string "Pop size Y=" w-Pop-YMax " X=" w-Pop-XMax delimited by size into x-IoPop-message end-string perform XIOPOP *> This must make popup disappear initialize x-IoPop move w-popup1 to x-IoPop-1stwin move "DELETE" to x-IoPop-Command perform XIOPOP *> This is something that often works ... ;-) display "BYE, It's Going To Be Over ..." line 14 column 31 with bell foreground-color 1 background-color 6 end-display call "C$SLEEP" using 2 end-call . *> The only "GOTO" survives here : dozen of years ago, progs were filled with this .. go to FIN. copy "XIOPOP.MDL". terminale section. fin. ultime. exit program. [/code] I hope you'll enjoy. Regards Bear ---------------------------------------------------------------- Bear; This is all working out nice. Just so you (and all other interested parties) know. 15-Jan-2009 pre-release Support for ACCEPT field AT llcc WITH SCROLL UP BY 02 LINES and SCROLL DOWN (default 1 line for both) 01 termlines USAGE BINARY-LONG 01 termcols USAGE BINARY-LONG Support for ACCEPT termnums FROM LINES ACCEPT termcols FROM COLUMNS Quick Example [b]scrolltest.cob[/b] [code] PROGRAM-ID. scrolltest. DATA DIVISION. WORKING-STORAGE SECTION. 01 ACCPTFLD PIC X(60). 01 TERMLINES USAGE BINARY-LONG. PROCEDURE DIVISION. ACCEPT TERMLINES FROM LINES PERFORM FOREVER IF FUNCTION UPPER-CASE (FUNCTION TRIM (ACCPTFLD)) = "END" EXIT PERFORM END-IF DISPLAY "This is line 1" AT 0201 END-DISPLAY ACCEPT ACCPTFLD AT LINE TERMLINES COLUMN 1 WITH SCROLL UP ON EXCEPTION EXIT PERFORM END-ACCEPT END-PERFORM GOBACK. [/code] Cheers, Brian ---------------------------------------------------------------- Hello OC hackers ! This post is getting more famous each day :-D I'm still working on, and as usual I think I have a (small) problem with pointers IMHO. TSTPOP.CBL [code] >>SOURCE FORMAT FREE *> ****************************************************************************** *> * Author : Francois Bear Hiniger / with most help *> * Date : 02 Jan 2009 *> * Purpose : Testing module -proof of concept for the spririt of XIOPOP *> * Tectonics : cobc -x TSTPOP.CBL *> * : cobc XIOPOP.CBL *> * : cobc NEWPOP.c *> * : cobc WRTPOP.c *> * : cobc DELPOP.c *> * Run : ./TSTPOP *> ****************************************************************************** identification division. program-id. TSTPOP. data division. working-storage section. copy "XIOPOP.XDF". 77 w-Scr-YMax pic 999. 77 w-Scr-XMax pic 999. 77 w-Pop-YMax pic 999. 77 w-Pop-XMax pic 999. 77 w-maxxy pic s9(08) usage comp-5. 77 w-maxxx pic s9(08) usage comp-5. 77 L pic 99. 77 w-80 pic X(080). 77 w-PopUp1 usage pointer. 77 w-PopUp2 usage pointer. 77 w-PopUp3 usage pointer. procedure division. initiale section. debut. *> Gently begins the actual program ... and initializes stdscr, the standard screen display "This comes from TSTPOP (stdscr) ..." line 01 column 01 with blank screen foreground-color 1 background-color 7 end-display *> Gets some information via getmaxyx() ... set w-PopUp1 to NULL call "GETMAX" using by value w-PopUp1 by reference w-maxxy w-maxxx on exception display "GETMAX Failed" line 10 column 30 with beep end-display not on exception move w-maxxy to w-Scr-YMax move w-maxxx to w-Scr-XMax end-call . call "C$SLEEP" using 1 end-call *> Filling the standard screen (stdscr) with some "X" (useful for further demo) move all "X" to w-80 perform varying L from 2 by 1 until L > 24 display w-80 line L column 1 with foreground-color 1 background-color 7 end-display end-perform call "C$SLEEP" using 1 end-call *> Opening a boxed PopUp window with Top & Bottom Title, + subtitle initialize x-IoPop move "OPEN" to x-IoPop-Command move 05 to x-IoPop-Line move 10 to x-IoPop-Position move 15 to x-IoPop-Height move 42 to x-IoPop-Size move "Marvelous TopTitle" to x-IoPop-TopTiTle move "L" to x-IoPop-TopPlace move "Incredible BottomTitle" to x-IoPop-BottomTiTle move "R" to x-IoPop-BottomPlace move "What do you think about this Subtitle !?" to x-IoPop-SubTitle move "This is a Subtitle or a Header [depends]" to x-IoPop-SubTitle perform XIOPOP move x-IoPop-1stWin to w-popup1 move x-IoPop-2ndWin to w-popup2 move x-IoPop-3rdWin to w-popup3 call "GETMAX" using by value w-PopUp1 by reference w-maxxy w-maxxx on exception display "GETMAX Failed" line 10 column 30 with beep end-display not on exception move w-maxxy to w-Pop-YMax move w-maxxx to w-Pop-XMax end-call *> Writing something inside the current opened window, (w-popup?) initialize x-IoPop move "WRITE" to x-IoPop-command move w-popup1 to x-IoPop-1stwin move 04 to x-IoPop-line move 02 to x-IoPop-position move "This Text comes from TSTPOP via XIOPOP" to x-IoPop-message perform XIOPOP move 05 to x-IoPop-Line move 04 to x-IoPop-Position move "Thank you Brian for your help in emergency " to x-IoPop-message perform XIOPOP move 06 to x-IoPop-line move 04 to x-IoPop-position move "Thank you Roger !" to x-IoPop-message perform XIOPOP move 07 to x-IoPop-line move 07 to x-IoPop-position move "I Really appreciate !" to x-IoPop-message perform XIOPOP *> Printing results of GETMAX .......... move 08 to x-IoPop-line move 03 to x-IoPop-position move spaces to x-IoPop-Message string "Screen size Y=" w-Scr-YMax " X=" w-Scr-XMax delimited by size into x-IoPop-message end-string perform XIOPOP move 09 to x-IoPop-line move 03 to x-IoPop-position move spaces to x-IoPop-Message string "Pop size Y=" w-Pop-YMax " X=" w-Pop-XMax delimited by size into x-IoPop-message end-string perform XIOPOP *> This must make popup disappear initialize x-IoPop move w-popup1 to x-IoPop-1stwin move "DELETE" to x-IoPop-Command perform XIOPOP *> This is something that often works ... ;-) display "BYE, It's Going To Be Over ..." line 14 column 31 with bell foreground-color 1 background-color 6 end-display call "C$SLEEP" using 2 end-call . go to FIN. XIOPOP SECTION. D-XIOPOP. call "XIOPOP" using x-IoPop on exception display "ErrCall XIOPOP" with beep end-display not on exception continue end-call *> call "C$SLEEP" using 1 *> end-call . F-XIOPOP. exit. terminale section. fin. ultime. exit program. [/code] XIOPOP.CBL [code] >>SOURCE FORMAT FREE *> ************************************************************************************ *> * Author : Francois Bear Hiniger (hacked by Brian Tiffin, and so on) see OCPOPS *> * Date : 02-Jan-2008 *> * Purpose : Parser for window management -proof of concept *> * Tectonics : cobc -x TSTPOP.CBL *> * : cobc XIOPOP.CBL *> * : cobc NEWPOP.c *> * : cobc WRTPOP.c *> * : cobc DELPOP.c *> * Run : ./TSTPOP *> ************************************************************************************ identification division. program-id. XIOPOP. data division. working-storage section. 77 w-Popup1 usage is pointer. 77 w-Popup2 usage is pointer. 77 w-Popup3 usage is pointer. 77 w-Line pic S9(08) usage comp-5. *> line in Cobol notation (y+1) 77 w-Position pic S9(08) usage comp-5. *> column in Cobol notation (x+1) 77 w-Height pic S9(08) usage comp-5. *> total height of the final window 77 w-Size pic S9(08) usage comp-5. *> total size of the final window 77 w-Message pic X(132). *> because I still believe that 77 w-TopTitle pic X(132). *> might be different than 80x24 77 w-BottomTitle pic X(132). *> ... same remarks ... 77 w-SubTitle pic X(132). 77 w-TopPlace pic X(001). *> "L", "C", "R" or SPACE 77 w-BotPlace pic X(001). *> "L", "C", "R" or SPACE linkage section. copy "XIOPOP.XDF". procedure division using x-IoPop. initiale section. debut. evaluate x-IoPop-Command when "OPEN" move x-IoPop-Line to w-Line move x-IoPop-Position to w-Position move x-IoPop-Height to w-Height move x-IoPop-Size to w-Size move x-IoPop-TopTitle to w-TopTiTle inspect w-TopTitle replacing trailing spaces by x'00' move x-IoPop-TopPlace to w-TopPlace move x-IoPop-BottomTitle to w-BottomTitle inspect w-BottomTitle replacing trailing spaces by x'00' move x-IoPop-BottomPlace to w-BotPlace move x-IoPop-SubTitle to w-SubTitle inspect w-SubTitle replacing trailing spaces by x'00' perform NEWPOP move w-PopUp1 to x-IoPop-1stwin *> The 'main' window wrapper move w-PopUp2 to x-IoPop-2ndwin *> The 'subtitle' window move w-PopUp3 to x-IoPop-3rdwin *> The 'current' window when "WRITE" move x-IoPop-1stwin to w-popup1 move x-IoPop-2ndwin to w-popup2 move x-IoPop-3rdwin to w-popup3 move x-IoPop-Line to w-line move x-IoPop-Position to w-position move x-IoPop-Message to w-message inspect w-message replacing trailing spaces by x'00' perform WRTPOP when "DELETE" move x-IoPop-1stwin to w-popup1 move x-IoPop-2ndwin to w-popup2 move x-IoPop-3rdwin to w-popup3 perform DELPOP when other continue end-evaluate go to FIN. NEWPOP SECTION. D-NEWPOP. set w-PopUp1 to NULL set w-PopUp2 to NULL set w-PopUp3 to NULL call "NEWPOP" using by reference w-Line w-Position w-Height w-Size w-TopTitle w-TopPlace w-BottomTitle w-BotPlace w-SubTitle w-PopUp2 w-PopUp3 returning w-PopUp1 on exception display "Sorry NEWPOP failed !" line 23 position 10 end-display not on exception if w-Popup2 = w-PopUp3 display "Sorry ! Pointers problems in NEWPOP" line 23 position 10 end-display else continue end-if end-call display "NEWPOP module has been called" line 22 column 10 end-display call "C$SLEEP" using 1 end-call . F-NEWPOP. exit. WRTPOP SECTION. D-WRTPOP. display "WRTPOP Calling" line 25 position 10 end-display call "WRTPOP" using by value w-popup1 by reference w-Line w-Position w-message on exception display "ErrCall WRTPOP" with beep end-display not on exception display "Some words on window ... " line 23 column 10 end-display end-call call "C$SLEEP" using 1 end-call . F-WRTPOP. exit. DELPOP SECTION. D-DELPOP. call "DELPOP" using by value w-PopUp1 on exception display "ErrCall DELPOP" with beep end-display not on exception display "1st window disapeared ..." line 24 column 10 with beep end-display end-call call "C$SLEEP" using 1 end-call . F-DELPOP. exit. terminale section. fin. ultime. exit program. [/code] XIOPOP.XDF [code] >>SOURCE FORMAT FREE *>****************************************************************************************** *> *> *> +--------------------------------------- standard screen (stdscr) ----- ... *> | *> | - +-- TopTitle --------------------------- + ] *> | ^ |<-------------SubTitle----------------- | ] *> | | |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | ] *> | | |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | ] window *> | Height |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | > managed *> | | |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | ] by XIOPOP *> | . . . ] *> | v |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | ] *> | - +------- Bottom Title ------------------ + ] *> . *> . |<---------------- Size ---------------->| *>****************************************************************************************** *> XIOPOP exchange definition area for PopUp boxed windows 01 x-IoPop. 02 x-IoPop-Command pic X(010). *> "OPEN", "CLOSE", ..., 02 x-IoPop-Handlers. 03 x-IoPop-1stWin usage pointer. *> The main window (boxed) 03 x-IoPop-2ndWin usage pointer. *> Subtitle subwindow 03 x-IoPop-3rdWin usage pointer. *> Working Subwindow 02 x-IoPop-Line pic 9(03). *> line in Cobol notation (y+1) 02 x-IoPop-Position pic 9(03). *> column in Cobol notation (x+1) 02 x-IoPop-Height pic 9(03). *> total height of the final window including borders 02 x-IoPop-Size pic 9(03). *> total size of the final window including borders 02 x-IoPop-TopTitle pic X(132). *> Top title (if any) 02 x-IoPop-TopPlace pic X(001). *> "L"=Left;"C"=Centered;"R"=Right; 02 x-IoPop-BottomTitle pic X(132). *> Bottom Title, if any 02 x-IoPop-BottomPlace pic X(001). *> "L"=Left;"C"=Centered;"R"=Right; 02 x-IoPop-SubTitle pic X(132). *> begins at Line + 1 02 x-IoPop-Message pic X(132). *> Message to send INSIDE a window 02 x-IoPop-Colors. *> Multiple Colors settings 03 x-IoPop-WinColor. *> Window colors (1) 04 x-IoPop-WinFg pic 9(05). 04 x-IoPop-WinBg pic 9(05). 03 x-IoPop-BorColor. *> Border color (default WinColor) 04 x-IoPop-BorFg pic 9(05). 04 x-IoPop-BorBg pic 9(05). 03 x-IoPop-TopColor. *> Top Title color (Default WinColor) 04 x-IoPop-TopFg pic 9(05). 04 x-IoPop-TopBg pic 9(05). 03 x-IoPop-BotColor. *> Bottom Title color 04 x-IoPop-BotFg pic 9(05). 04 x-IoPop-BotBg pic 9(05). 03 x-IoPop-CurColor. *> Current Line color 04 x-IoPop-CurFg pic 9(05). 04 x-IoPop-CurBg pic 9(05). 03 x-IoPop-SelColor. *> Selected line(s) color 04 x-IoPop-SelFg pic 9(05). 04 x-IoPop-SelBg pic 9(05). 03 x-IoPop-Overlapped. *> current line is a selected line 04 x-IoPop-OvlFg pic 9(05). 04 x-IoPop-OvlBg pic 9(05). *>------------------------------------------------------------------------------------------- *> (1) Too much colors brings programmer to build application very near to christmas tree ! [/code] NEWPOP.c [code] /************************************************************************************************ * Version : 14-Jan-2009 * * Author : Francois (Bear) Hiniger - Brian Tiffin * * Purpose : creates a boxed popup window with TopTitle and BottomTitle if any. * * : returns a set of 3 popup handler to the caller XIOPOP. * *------------------------------------------------------------------------------------ * * In fact we have THREE windows, the main window which is boxed, Top and/or bottom titled, * * then comes a first sub-window specially for the subtitle, then a second sub-window, * * which is the "current working window". * ************************************************************************************************/ #include #include WINDOW * NEWPOP (int *Line, int *Position, int *Height, int *Size, char *TopTitle, char *TopPlace, char *BotTitle, char *BotPlace, char *SubTitle, WINDOW *ptr_titlewin, WINDOW *ptr_curwin) { int Lw = *Line; int Cw = *Position; int Hw = *Height; int Sw = *Size; int k, kmax, p ; int TopLen = strlen (TopTitle); int BotLen = strlen (BotTitle); int SubLen = strlen (SubTitle); int TopLine = 0; int BotLine = Hw - 1; int SubLine = Hw + 1; // Screen location in Cobol begins at line 1 column 1, ncurses begins at (0,0) Lw = Lw -1; Cw = Cw -1; // This Color Gedings (initializes color pairs) init_pair (1,COLOR_BLUE, COLOR_WHITE); // the same used by the caller ??? init_pair (2,COLOR_WHITE, COLOR_YELLOW); // The wrapper Color init_pair (3,COLOR_MAGENTA, COLOR_WHITE); // Subtitle Color init_pair (4,COLOR_CYAN, COLOR_BLACK); // "Current window" Color // Creating the main window (the wrapper ?) WINDOW *mainwin; mainwin == NULL; mainwin = newwin(Hw,Sw,Lw,Cw); if( mainwin == NULL) { addstr("Unable to allocate memory for new window."); endwin(); } // This draws box for the main window wbkgd(mainwin, COLOR_PAIR(2)); wborder(mainwin,0,0,0,0, 0,0,0,0 ); wrefresh(mainwin); // Compute the start position of TopTitle defined by "p" if (TopPlace[0] == 'L') { p=2; } else if (TopPlace[0] == 'R') { p = Sw -(TopLen + 2); } else { p = (Sw -(TopLen + 2)) / 2; } // Let's display the TopTitle wmove (mainwin,TopLine,p); for (k=0;k #include void WRTPOP (WINDOW *curwin, int *Line, int *Position, char *Message) { int Lw = *Line; int Cw = *Position; int k; int MLen = strlen(Message); mvaddstr(1,50,"WRTPOP.c in action"); if(curwin == NULL) { mvaddstr(1,17,"Unable to write on window in WRTPOP"); getchar(); endwin(); } wmove (curwin, Lw - 1, Cw - 1); for (k=0;MLen;k++) { waddch(curwin,Message[k]); } wrefresh(curwin); } [/code] Other progs have not changed . But unfortunately the result is that program sleeps because of pointers problem. Yes I can, specially if I get some more help. Thank you Bear ---------------------------------------------------------------- In WRTPOP.c, look carefully at - [code] for (k=0;MLen;k++) { [/code] :-) Roger ---------------------------------------------------------------- As I Said before, Yes I Can write Stupid Code ! I'm still laughing ... :-D [code] for (k=0;k= 4.2 human ---------------------------------------------------------------- Roger, what do you think of this? Maybe you also want to change make test, there is a little spelling mistake: [b]Ambigous[/b] reference with qualification, ASCII and EBCDIC should be in capital letters. ---------------------------------------------------------------- To part 2 : Fixed in current tarball. To part 1 : No. That cpucheck thingy was only put in to get around deficiencies in early gcc 3 versions. (Only x86 32-bit). It's probably time to take it out. You always have the possibility to override default settings by eg. specififying CPPFLAGS to the configure. Roger ---------------------------------------------------------------- To part 1: I've forget the CPPFLAGS (I'm not very familiar with C, just use it to build different stuff). But using machine optimized code should increase compiler and runtime speed, therefore I like the cpucheck. -O2 is used in the make files, too and this is fine. I think to use cpucheck if there is an old gcc version and to have -march=native if gcc >= 4.2 is used would be nice, wouldn't it? human ---------------------------------------------------------------- Subject: Patch for README: redirect output of make [quote] README: [code]If you think you have a problem or just want to record the make output, just redirect the output thus : make 1>mymake.log 2>&1 make install 1>myinstall.log 2>&1[/code][/quote] I think it would better to leave the output on the screen and redirect a pipe to files:[code] make 2>&1 | tee -a mymake.log make install 2>&1 | tee -a myinstall.log[/code] So maybe the lines above are a worthy small patch to README file. human ---------------------------------------------------------------- Subject: Problems with FUNCTIONs and DECIMAL-POINT IS COMMA If you use "," as delimiter in FUNCTIONs, there is a compiler error when DECIMAL-POINT IS COMMA was defined. [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. 'FUNCTEST'. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. *----------------------------------------------------------------- PROCEDURE DIVISION. *----------------------------------------------------------------- Main section. 00. DISPLAY FUNCTION SUBSTITUTE("AAAABBBCCDD", "AA", "BB", "BB", "CC", "CC", "DD"; "D", "EE") END-DISPLAY * stop run * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program FUNCTEST -------------------------------------[/code] [quote]FUNCTEST.CBL: In paragraph '00': FUNCTEST.CBL:13: Error: syntax error, unexpected $undefined[/quote] So either the line with "DECIMAL-POINT IS COMMA." has to be commented out or all "," in FUNCTIONs have to be removed like this [code] ... DISPLAY FUNCTION SUBSTITUTE("AAAABBBCCDD" "AA" "BB" "BB" "CC" "CC" "DD" "D" "EE") END-DISPLAY ...[/code] Is this a bug? If not, we should never use a "," as an optical delimiter in COPYs, because one never know which special names are used in the programs where the copy-file is included. Are there other optical delimiters available? human with [quote]$ cobc -version cobc (OpenCOBOL) 1.1.2 Copyright (C) 2001-2008 Keisuke Nishida / Roger While Built Dec 22 2008 12:15:34 Packaged Dec 21 2008 19:28:09 CET[/quote] ---------------------------------------------------------------- First version works here. [code] BBBBCCBDDEEEE [/code] Roger fixed this with the newest tarball. ;) [code] cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2008 Keisuke Nishida / Roger While Built Dec 22 2008 12:43:01 Packaged Dec 22 2008 18:30:03 CET [/code] Cheers, Brian P.S. DPC special names does lead to some weird argument handling conditions. [code] DISPLAY FUNCTION MIN(1,2 3,4) END-DISPLAY [/code] Under default conditions that is 4 parameters. Under DPC it is 2. So ... I'd almost like to suggest that we get used to space as the function argument delimiter and skip using commas; but I like commas. :) ---------------------------------------------------------------- Hm. Maybe there are other usable optical delimiters we can use? It seems like this stuff is important for the code guidelines for the documentation team. ---------------------------------------------------------------- In COBOL if you use DECIMAL-POINT IS COMMA then this should be noted only in NUMBERS so MIN(1,2,3,4) should be then 2 parameters 1,2 and 3,4. The comma between should be noted as delimiter. This is as MIN(1.2,3.4) without DECIMAL-POINT IS COMMA directive. So, the comma is still a delimiter regarding functions, statements etc. ---------------------------------------------------------------- Well, actually other compilers will not accept the MIN(1,2,3,4) construct with DPC. The current 1.1 tarball will accept this but will parse this as 1.2 0.3 and 0.4. Referring to current 1.1 tarball (there was a bug in earlier versions), a good way to resolve this issue is to use the semi-colon (;) as a delimiter. There is then no ambiguity. eg. MIN(1,2;3,4) Note also that we collapse multiple occurrences of a delimiter down to the minimum to parse (as other compilers do) - eg. MIN (1,2,,,,,,,,,,,,,,,5) will collapse down to 1.2 and 0.5. Roger ---------------------------------------------------------------- Subject: Happy Birthday 1.0 OpenCOBOL 1.0 In honour of OpenCOBOL's first birthday. And in honour of cheating for effect; this image is generated by an html string passed to a gtkhtml widget. Sadly I can't show the full code listing yet, it's not ready for subprime time. Click to: http://oldsite.add1tocobol.com/tiki-browse_image.php?imageId=7 Here is a snippet though ... [code] int CBL_OC_GTKHTML (char *html_string) { GtkWidget *app; GtkWidget *html; GtkWidget *scrolled_window; char *fakeargv[2] = {"happybday", ""}; /* prepare our environment, we need gnome and gconf */ gnome_init ("Example_1", "1.0", 1, fakeargv); gconf_init (1, fakeargv); /* create GtkHTML widget */ html = gtk_html_new (); gtk_signal_connect (GTK_OBJECT (html), "url_requested", GTK_SIGNAL_FUNC (url_requested), NULL); gtk_signal_connect (GTK_OBJECT (html), "object_requested", GTK_SIGNAL_FUNC (object_requested), NULL); gtk_html_load_from_string (GTK_HTML (html), html_string, -1); /* create GNOME app and put GtkHTML in scrolled window in it */ app = gnome_app_new ("Example_1", "Happy Birthday OpenCOBOL"); scrolled_window = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add (GTK_CONTAINER (scrolled_window), html); gnome_app_set_contents (GNOME_APP (app), scrolled_window); gtk_window_set_default_size (GTK_WINDOW (app), 320, 100); gtk_widget_show_all (app); /* run the main loop */ gtk_main (); return 0; } [/code] [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 27-Dec-2008 *> Purpose: Happy Birthday OpenCOBOL *> Tectonics: cobc -x ocgtkhtml.cob hellogtk.o *> *************************************************************** identification division. program-id. ocgtkhtml. data division. working-storage section. 01 result usage binary-long. 01 html-string pic x(512) value "Happy Birthday 1.0 " & "OpenCOBOL 1.0!!
" & "
" & "opencobol " & "

Closebutton" & "
" & x"00". *> *************************************************************** procedure division. call "CBL_OC_GTKHTML" using by reference html-string returning result end-call goback. end program ocgtkhtml. [/code] Cheers, Brian ---------------------------------------------------------------- Subject: References to Standards As a new participant in this forum (but not really new to OpenCOBOL), I just thought that I would make a slight clarification to re-occurring information in this forum. There are several references to "COBOL 85" and these are often distinguished from "Intrinsic Functions". The official (but really obscure) term that should be used is "Amended Third Standard COBOL". The "clearer" (and IMHO better) term that should be used is something like - "'85 Standard COBOL with its amendments" By 1991 (actually 1993 for ISO rather than ANSI) there was no such thing as "just '85 Standard COBOL". The only recognized Standard was the "base" document (X3.23-1985) ALONG with its two amendments - Intrinsic Functions Module Amendment - Corrections Amendment An interesting related fact is that the "Intrinsic Functions Module" was OPTIONAL in the ANSI and ISO COBOL Standards but was REQUIRED (at the HIGH level) for FIPS COBOL. As the "certification tests" were aimed at getting US government contracts, most vendors (who were still doing certification) actually treated Intrinsic Functions required not optional for "High-level" certification. (They were NOT included in the FIPS intermediate certification process). Bottom-Line: Although some intrinsic functions were added in the '02 Standard (and more are included in the draft revision), it is not proper (in my opinion) to distinguish between supporting the '85 Standard and supporting intrinsic functions. P.S. The corrections amendment did make some technical changes but all of these were included in the '02 Standard. Therefore, hopefully, what it did won't impact OpenCOBOL much. If you want to see if the compiler conforms to the corrections amendment, you should try various combinations of "NOT" with ">=" and "greater than or equal to". Even I can't remember the excruciating set of rules that ended up applying to these syntactic structures. P.S. As discussed privately with Roger, it does NOT seem to me that one can claim to support the Intrinsic Function Module amendment UNLESS one can support the "ALL" subscript. Many "real world" programs that use functions like "ORD-MAX" and "SUM" much less "PRESNET VALUE" are onlu usefu because of the "ALL" subscript. I don't deny that this is difficult to implement, but (to me) this should be a priority. ---------------------------------------------------------------- Yes, the ins and outs of definitions are somewhat obtuse. Note that the COBOL test suite at - http://www.itl.nist.gov/div897/ctg/cobol_form.htm is called "The COBOL85 test suite". It does, however, qualify what it is based upon - Quote ... COBOL standard (ANSI X3.23-1985, ISO 1989-1985, ANSI X3.23a-1989 and ANSI X3.23b-1993.) End quote Roger ---------------------------------------------------------------- Welcome to opencobol.org Bill. I, for one, look forward to your presence here. Please feel free to offer up your wisdom regarding correctness, as you may find that some of us are still somewhat uninitiated when it comes to the details and true history of COBOL. Cheers, Brian ---------------------------------------------------------------- Where do we stand on the info about what text from the standard we can include in our documentation? ---------------------------------------------------------------- Lost in space ---------------------------------------------------------------- Subject: Recursion with factorial Hello, I was horsing around again. Not that this is [i]smart[/i] COBOL or anyhing, but here is a recursive factorial example. [b]recurse.cob[/b] [code] *> *************************************************************** *> Author: Brian Tiffin *> Date: 29-Dec-2008 *> Purpose: Horsing around with recursion *> Tectonics: cobc -x recurse.cob *> *************************************************************** identification division. program-id. recurse. data division. working-storage section. 78 n value 7. 01 result usage binary-long. *> *************************************************************** procedure division. call "factorial" using by value n returning result end-call display n "! = " result end-display goback. end program recurse. *> *************************************************************** *> *************************************************************** *> *************************************************************** identification division. program-id. factorial is recursive. data division. working-storage section. 01 result usage is binary-long. linkage section. 01 num usage is binary-long. *> *************************************************************** procedure division using by value num. display "num: " num end-display if num equal zero move 1 to return-code display "ret: " return-code goback end-if subtract 1 from num end-subtract call "factorial" using by value num returning result compute return-code = (num + 1) * result end-compute display "ret: " return-code end-display goback. end program factorial. [/code] [b]Outputs:[/b] [code] num: +0000000007 num: +0000000006 num: +0000000005 num: +0000000004 num: +0000000003 num: +0000000002 num: +0000000001 num: +0000000000 ret: +000000001 ret: +000000001 ret: +000000002 ret: +000000006 ret: +000000024 ret: +000000120 ret: +000000720 ret: +000005040 7! = +0000005040 [/code] One thing I noted while playing, [code] program-id. factorial is recursive. program-id. factorial is initial. program-id. factorial. [/code] all have the same effect. Bug? or am I missing something? Cheers, Brian ---------------------------------------------------------------- A recursive called program should always have the "is recursive" clause. Used vars in a program with "is recursive" clause should be in local-storage section. If not they should use the same values (maybe you can try this by displaying the var result after each call). Where do you move some value to "result"? Are the results the same if compiled with recent prerelease and [code]cobc -x -debug recurse.cob[/code] even with the three different program-ids? human ---------------------------------------------------------------- Hello human; Thanks for the comments. result is set by RETURNING, in both the main kicker and the recursive calls, and relies on the implicit special register RETURN-CODE. I could have used a different variable name than result in the main, and did try it using [i]fact[/i] to avoid confusion, but then it's a factorial experiment so confusion reigns. ;) -debug compiler switch had no effect on displayed results with all three program-id attributes. Defining [i]result[/i] in the factorial IS RECURSIVE called program in LOCAL-STORAGE causes a double free or corruption memory fault in both -debug and normal compiles at the point of num = zero goback. [code] *** glibc detected *** ./recurse: double free or corruption (fasttop): 0x0aeb8a78 *** [/code] I didn't really plan on reporting bugs or making this a headache for Roger; but I may have opened up a can, which I'd be more than willing to close for now while work progresses in other areas. ;) Cheers, Brian ---------------------------------------------------------------- Brian, the LOCAL-STORAGE bug is fixed in current tarball. Couple of notes about the PROGRAM-ID clauses: Note that RECURSIVE implies INITIAL. Therefore a prog with either RECURSIVE or INITIAL attributes gets W/S initialized on every entry. OC does not, at the moment, prevent recusive entry into a prog that does not have the RECURSIVE attribute. Roger ---------------------------------------------------------------- LOCAL-STORAGE usage with recursion working just fine now. Sorry, this wasn't supposed to be a make work project, it was more for "Hey, this is pretty cool", and well, [i]this is pretty cool![/i] ;) Thanks one more time Roger. And a note to everyone reading; this particular example of factorial with recursion is quite limited. It relies on RETURN-CODE which has a limit of 12!, as 13! will overflow. OpenCOBOL is capable of much higher values using a simple procedural loop to calculate factorials. This was just an example of the recursive capabilities of the system, and even then it comes with [i]coder beware[/i] issues. As Roger stated, IS RECURSIVE implies IS INITIAL, so care with GLOBAL and things like USAGE POINTER will require due care and appropriate amounts of testing when writing recursive algorithms. Cheers, Brian ---------------------------------------------------------------- [quote] simrw wrote: OC does not, at the moment, prevent recursive entry into a prog that does not have the RECURSIVE attribute.[/quote] I found something about this in ACU-Docs, they do only allow recursive calls if a special environment entry "RECURSION" is set to one. Could this be useful for OC for all programs without RECURSIVE attribute, too? Take PROG A --> PROG B -- PROG A What happens to PROG A without RECURSIVE attribute if it is called from PROG B? Are there two copies of the procedure division in memory? What happens if PROG B does a CANCEL for PROG A? human ---------------------------------------------------------------- Subject: RM/Cobol ACCEPT/DISPLAY extensions First of all I would like to say it is great to see a serious effort to develop a good open source Cool compiler! Thanks guys, great work! I have been writing Cobol for over 25 years and have worked on Unix systems for most of that time. The last years I have mainly been using RM/Cobol and AcuCobol. I understand using non-standard extensions can become serious issues, so when I started writing applications for my own company I made sure I stuck to the 1974 standard as closely as was possible. (The 85 standard was not yet implemented on the systems I was using.) That turned out to be a good decision, because porting to other compilers has never been an issue. The only concession I had to make at that time was to make use of the RM/Cobol ACCEPT/DISPLAY extensions. These extensions have been part of RM/Cobol for the last 20 years or so and have become defacto standards (they also work in AcuCobol and others). The reason, by the way, was simple. The 1974 standard did not have cursor positioning! Scrolling terminal I/O was all you could get. I now find that I have a problem porting existing applications to OpenCobol. A major problem is the lack of support for the DISPLAY/ACCEPT extensions. The RM/Cobol language manual can be found at http://www.liant.com/download/pdf/rmlr_e01.pdf The ACCEPT and DISPLAY extensions I require are mentioned on pages 247-261 and 293-300. The use of SCREEN sections is not an options (>2000 existing programs). Is it possible to build these extensions into OpenCobol? Thanks, Albert ---------------------------------------------------------------- Hello Albert, I'm very glad to see your interest for display / accept. I was looking for all these extensions myself, and Roger did a great work during this 1.1 pre-release. I think we must go forwards and include some "extensions". RM/Cobol is a recognized standard. I use Acu in my job, so I know what you mean. This is the reason why I'm trying write some code in C with ncurses, just to bring OC at the same level as my official compiler. I cannot imagine another compiler than OpenCobol for my very near future development. So if you are new in this forum, welcome. He have lot of works to do. Regards Bear :-D ---------------------------------------------------------------- Actually, It would be useful to know exactly whcih syntax variants of the ACCEPT/DISPLAY are causing problems. One thing that we will NEVER be able to do is to cover all variations of all compilers. They conflict within the syntax. Roger ---------------------------------------------------------------- Dear Roger, I understand your dilemma. I will look into our sourcecode and let you know how we use the ACCEPT and DISPLAY statements. I am a bit worried though. Developers each use their own subset of the language (or dialect). Even if all [b]my[/b] needs were met, someone else would probably still have problems. Could a compiler option solve this problem? I know that AcuCobol has a number of compile options to "emulate" RM/Cobol and other "dialects" (i.e. to overcome this type of thing). Thanks. Regards, Albert ---------------------------------------------------------------- Subject: OT?: REBOL parsing COBOL and producing VID screens Hello, This may be a little off topic for now, but I hope that may change. An online acquaintance and REBOL developer, posted this image. I just got permission to repost the URL. http://www.fys.ku.dk/~niclasen/screendumps/wedoscreens.png John has written a little piece of REBOL code that parses through COBOL SCREEN SECTION and produces REBOL VID (Visual Interface Dialect) code to display the screens as a GUI. Pretty cool. I'll be talking with Geomol (his common nick) about how we might benefit from his efforts for use with OpenCOBOL and how it may influence porting efforts. Geomol is student at the University of Copenhagen, one smart cookie and a highly prolific developer. [i]By the way; REBOL has nothing in common with COBOL other than coincidental similarity of name.[/i] REBOL is a acronym for the Relative Expression Based Object Language. It just happens to be my favourite scripting environment and now it has a tangential linkage to my favourite compiler system. ;) When the 3rd edition of REBOL is released (soon) this linkage may become much stronger as I'll be doing my best to embed REBOL as the scripting language of choice for OpenCOBOL. Cheers, Brian ---------------------------------------------------------------- If this is exactly the way the screen should look like in original Cobol program, I suppose this is an implementor specific screen section (because of the check boxes). For what implementor was the screen section written originally? Is there a way to interact between REBOL VID and OC jet? ---------------------------------------------------------------- I'm a little shy on details. Geomol just posted this yesterday and all I've asked so far was permission to repost the URL. I'm pretty sure he did this as a work for hire, parsing AccuCOBOL, so I may not get to examine or divulge any sources. I'll be asking him some more soon. I'm patiently waiting for access to the REBOL 3 alpha release of the shared core library. As soon as that occurs I'll be burning midnight oil in glee getting it fitted in with OpenCOBOL. I'm one of the lucky few on the alpha release team, so I'll likely get access piping hot off the presses to start early testing. The code outputs shown in the screenshot are REBOL/View 2 VID, and that doesn't come as a core library with hosting layer, so it's a waiting game from my perspective. More news soon (soon being relative, R3 has been in development for 2 1/2 years now and Rebol Technologies won't release things until ready. A model I like and support). Cheers, Brian ---------------------------------------------------------------- It would be cool if he could stop into the add1 chats Brian. The more we can interface with others, touching our scope, the better. Good job on the screens, this would give us one more option of GUI. ---------------------------------------------------------------- Subject: Embedded SQL support Where can I find more information about the embedded SQL development for OpenCOBOL? There don't appear to be any links to open projects in the OpenCOBOL FAQ or on the OpenCOBOL site (that I can see). I am quite interested in this part of the project and would like to try to get in on it, if possible. Thanks, Rich Smrcina ---------------------------------------------------------------- Welcome to the forum. Maybe you can try tu use the [url=http://www.opencobol.org/modules/newbb/search.php]search function[/url], with Keywords "embed SQL" and "Search for ALL of the terms" enabled. ---------------------------------------------------------------- Search doesn't allow terms less than three characters, and yes I did try it. I found embedded SQL support on add1tocobol.com. ---------------------------------------------------------------- I was going to suggest add1tocobol.com A lot of third party development is happening there, and Roger's been supporting us as well. So far we've got SQLite and MySQL via libdb. I think others are working on even more. But there's a lot happening there, not just related to SQL. We meet once a week on Sunday's at 9am Eastern USA time. I slacked off the past couple of weeks due to the holidays and sheer exhaustion, but we will be back on track this next sunday (the 11th). http://www.add1tocobol.com/chat.php ---------------------------------------------------------------- Excellent. I'll try to join the chat this week. Thanks. ---------------------------------------------------------------- Subject: Call to a C++ DLL in Windows For those of you who have experience with OpenCOBOL version 1.0 in a Windows environment, has anyone been able to successfully call an entry point in a C++ DLL? I have been able to successfully link in the import library (LIB) file and have preloaded the DLL itself. However, when I do the call I get back an error: "libcob: Cannot find module 'GetDiskInfo' ". Any help would be appreciated as I'm strongly considering replacing MicroFocus 4.0 COBOL with OpenCOBOL but need to do dynamic calls. Thanks... ---------------------------------------------------------------- Hello flking; Well, you need to make sure the OC runtime knows where to find the GetDiskInfo entry point. -L during the cobc, the [code]$ COB_PRE_LOAD=somemodule:someothermodule[/code] sequence, and LD_LIBRARY_PATH and one other that escapes me as I type. BUT; C++ entry points are "mangled" names. You may need to write a thin wrapper [code] extern "C" { someC++func or method or class constructor or ... }[/code] and then link OpenCOBOL to the object file produced from that layer to get the cob_resolve entry point correct. Read a few of the posts here and you'll see we are heavy into dynamic CALL code for all kinds of extensions. ;) And take a look at http://opencobol.add1tocobol.com/#what-stock-call-library-does-opencobol-offer to see if any of the STOCK library features can help as well. Cheers, Brian ---------------------------------------------------------------- Brian, Thanks for the information. We have now gotten a little further. It does look like we will have to write some kind of wrapper to support any calls we do to our DLLs and to the Windows API because of calling conventions. Like Windows are DLLS use the PASCAL calling convention rather than standard C. For anyone else reading this thread, a couple of things to note: 1) COB_PRE_LOAD=somemodule;someothermodule (I think I read somewhere that Windows requires a semicolon between modules). 2) Don't include ".DLL" in COB_PRE_LOAD. 3) If you want to link in an import library (LIB file) and you're using MS C++ 2008 Express use "-link" rather than "-l". It looks like you can LIBS by just placing them as the last thing on the command line after the ".COB" file as well but I'm not sure that's the way you should do it. Frank ---------------------------------------------------------------- Frank; Thanks for the corrections. I'm building up a FAQ (well, information file more like at this point) for OpenCOBOL and it's posted at http://opencobol.add1tocobol.com I'll admit, I'm kinda bad at offering advice in some areas as everything just works for me on my Debian GNU/Linux system. When I do (rarely) boot into Windows, I always work in the Cygwin system and again, when I do trial builds, things just work. I'll have to bite the bullet someday and test a build sequence under native Windows so I can try and see if I can't learn some things that could help others and then add some entries to the ocfaq.rst file. I'd be happy to hear more of what you get figured out, and then I'll ask permission to repost it to the FAQ. ;) Cheers, Brian ---------------------------------------------------------------- Subject: Documentation and quoting from the Standard(s) In response to a note in another thread (and from other places). I am not a lawyer and am NOT trying to give legal advice. The following is my understanding of "truth" but may or may not meet anyone else's view of reality. 1) Any or all text from Amended 3rd Standard COBOL (aka the '85 Standard and its two published and approved amendments) may be included in any text (public or otherwise) as long as one quotes the ENTIRE "acknowledgement" text from the '85 Standard. 2) "minor" quotes from the '85 Standard and amendments may be used *if* the term "COBOL" (not to be confused with "Cobol") is used. 3) Text may be used from the INCITS (US or ANSI) version of the published '02 Standard. HOWEVER, you really should contact INCITS for verification of this. Reference the cover page of the document that states (in part), "However, ITI/INCITS claims no copyright in the underlying technical specifications of the COBOL standard and, to the extent that consent is required, INCITS freely consents to use of the underlying technical specification by any person without charge. No person reproducing, improving, or using the standard shall claim that any modifications or improvements have been adopted as part of any "official†COBOL standards and/or the standard setting processes of ANSI/ITI/INCITS" ---------------------------------------------------------------- Hello again Bill; Muchly appreciated post. I had an email conversation with INCITS, and then missed a phone call as they wanted to talk voice to clarify what I meant in my request to start cut'n'pasting from a textual copy of a standards docs as I work up an OpenCOBOL reference manual, with details on where and how OC meets or does not comply with what is written in the spec. (This occurred right at the time of the thread on the comp.lang.cobol group when you suggested it to me). Being me, I quit pestering, but plan on doing so every so often until I can get a link up to explain what I'd like to see and either get formal approval or find out what is possible. I'd still like a pointer to where a flat ASCII (for lack of a better term) non marked up file that includes the specification that can be copied in whole or in part as mentioned in the preamble of the snippets of the '85 Standard I have seen, or to the underlying technical spec that the 2002 Standard preamble mentions. Assuming that form of copy in whole or in part is what is implied by that expression in the '85 documents, and the "claims no copyright" phrase of the 2002 docs. Anyway, I'll reissue my request to INCITS shortly and I'll see if I can't gain access to an original "textual" copy of '85 or '2002 that I can copy bits of (with attributions of course). And once again, glad to see you here Bill and having someone closer to "in the know" can only be a good thing, as this issue still seems a little circular from my perspective. There doesn't really seem to be clear and open doors to this clear and open standard. To be honest; I'd really like to build up a set of web pages that can be linked to the GeSHi syntax highlighter to allow source code posted on add1tocobol.com (or anyone using GeSHi, but that would require the GeSHi team accepting my changes to the cobol.php language configuration file) to not only have reserved word highlighting, but include hyperlinks. It would be nice if a click on a reserved word could lead to some technically and typographically correct entry. I will build up some of these for trial, but a copy'n'paste right from the Standard (any) would be preferred. Not to avoid work so much (although that would be nice and greatly accelerate the process), but to garner a much higher guarantee of correctness. Said pages would also eventually have usage examples, tutorials and further explanations gathered from as many experts as would assist. Cheers, Brian ---------------------------------------------------------------- Brian, I know for a fact that there is no "flat file" version of any edition of the COBOL Standard. The '74 Standard was done on a typewriter (with a pen and ruler creating the "boxes" to show levels of features. The '85 Standard was done in TROFF. There were INCREDIBLE "fights" to get the "source" of that version when work began on the '02 Standard. The Intrinsic Function and Correction Amendments were done in Word. The '02 Standard (and the current work on the revision) are done in Framemaker. *** It is my understanding (assumption) that what is "allowed" is to cut and paste the TEXT from an electronic copy of a Standard (or photo-copy of a hardcopy) and to place that text into "your own" formatting document. The '85 Standard is still available in a PDF. Unfortunately, it is a scanned version of the published document and when you (or I) try and "cut and paste" from it, I end up with "graphic" copies and not text. (You probably could put it thru an OCR scanner but that may be more trouble than it is worth.) When you purchase the INCITS (not ISO) version of the '02 Standard, you are forced to "sign" an end-user license agreement. This is why I think that it is PROBABLY best if you do try and get something from INCITS to affirm your right to use that text. As I think I said in comp.lang.cobol, the COBOL Standard is different (because of history) from most INCITS (or ANSI or ISO) Standards. Therefore, do make certain when you are communicating with INCITS, that you make certain that they understand you are talking SPECIFICALLY about the COBOL Standard and quote that text from the cover page. ---------------------------------------------------------------- Thanks again Bill. Good information regarding my quest for "flat". That removes an unknown. I knew it would be good to have someone in the know around. ;) Re; INCITS and approvals; Yes, I'll follow official procedures and channels for this one, with no assumptions on my part. Cheers, Brian ---------------------------------------------------------------- Subject: libcob I'm a newbe, and I finally got all the pieces to make oc install. I tried the simple hello.cob in Getting Started, and it compiled with no errors displayed. When I invoke it, I get this error "./hello: error while loading shared libraries: libcob.so.l: cannot open shared object file: No such file or directory". I did everything in the installation instructions, and I see the libcob folder, but there is no such file in it. I see a Makefile in this folder but there is nothing in the documentation I have seen that says anything special needs to be done to create libcob object files. The "configure" script appears to create the libcob Makefile, and the trail peters out at that point. Have I missed a step or what? If not, to what is the error referring. Thanks! ---------------------------------------------------------------- In the build directory, after [code] $ ./configure $ make [/code] did you try [code] $ make check [/code]? I'll ask this before requesting that you post the outputs from the ./configure and make. It might be as simple as [code] # make install [/code] where (on my Debian box) make install needs root access to copy things into the (default) /usr/local/... tree. But ensure that make check works first. When you reply, OS and OS version and any other details you can give may help as well. Cheers, Brian ---------------------------------------------------------------- If you need to redirect the output for posting it somewhere I suggest to leave the output on the screen and redirect a pipe to files:[code] make 2>&1 | tee -a mymake.log make install 2>&1 | tee -a myinstall.log[/code] ---------------------------------------------------------------- Thanks. I did run ./configure, make, make check and make install. At the end, they all seemed to be successful, and I ran them as root to avoid permission problems. I am running this on Ubuntu 8.04 on an Intel box. ---------------------------------------------------------------- Ok, so now (I could be missing something obvious; I'm like that) Using find or locate, can you see a libcob.so anywhere? Normally [b]# make install[/b] places things in the /usr/local/... tree. On my system [code] /usr/local/lib/libcob.a /usr/local/lib/libcob.la /usr/local/lib/libcob.so /usr/local/lib/libcob.so.1 /usr/local/lib/libcob.so.1.0.0 [/code] If those files are there, then there is something fishy with the "normal" library loader environment variables or there is a permissions issue or a symlink issue or ... ? The libcob.so.1 does seem fishy. So it might be worthwhile looking into an [b]ldconfig[/b] pass to resync the ld.so and ld-linux.so shared library cache. I rarely use this so I'll let you look at the man pages to ensure that that is appropriate for your systems before blindly giving the advice. I [b]think[/b] it's harmless to run ldconfig, but don't have enough experience to say that it is harmless in all cases. I once (only once) got burned by bash and it's internal path cache. After installing a Debian package for 1.0 and running cobc tests, then rebuilding 1.1 I had to [code] $ hash -r [/code] to reset the internal bash lookup path. Look at http://www.opencobol.org/modules/bwiki/index.php?InstallGuide for the details I posted on the wiki here. Cheers, Brian ---------------------------------------------------------------- dseverns; From the thread at http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=454&forum=1&post_id=2400#forumpost2400 I'm now pretty sure that it is the shared library loader cache and [b]ldconfig[/b] that will fix this. MrScott rebooted and the problem went away. Once again, depending on the system, reboots may not be an appropriate action if there are production applications running. So, after verifying that ldconfig won't throw any monkeywrenches, I suggest that course of action; refresh the ld.so cache with ldconfig. Cheers, Brian ---------------------------------------------------------------- Subject: Forum question Is there a forum option to allow members to view threads in 'flat' format? When I'm signed on and click on a thread to view, in order to see all of the messages in a thread on the screen I need to click on the 'Flat' link. If I'm not signed on, the 'flat' view appears to be the default. Is there a way to make 'flat' the default when I'm signed on? Thanks, Rich ---------------------------------------------------------------- From the home page after login; on the right; Edit Account Change the Comment Display Mode dropdown. Cheers, Brian ---------------------------------------------------------------- Excellent! Thanks. Rich ---------------------------------------------------------------- Subject: Valid syntax rejected: SELECT statement with duplicate primary key Hi Here's a valid MicroFocus syntax that is rejected by OpenCobol 1.1: SELECT F40360I1 ASSIGN TO DYNAMIC NL--ACT-NAME28 ORGANIZATION IS INDEXED ACCESS MODE SEQUENTIAL RECORD KEY IS F40360I1-KEY1 WITH DUPLICATES PS: We know it is not recommended but it is legal in many COBOL. For now we did minor modifications to parser.y, codegen.c and tree.h to support it. Can you add this in 1.1 wishlist ? :-) ---------------------------------------------------------------- There aren't many, but this is one Micro Focus extension that I really HOPE that OpenCOBOL does NOT provide support for. I know that at one time MF did support this, but I canNOT find it supported in the current NetExpress 5.1 (or even the 4.0) LRM's. They allow WITH DUPLICATES for ALTERNATE RECORD KEY but not for RECORD KEY. Before OpenCOBOL adds support for it, can you give me a reference to a currently supported MF compiler that still documents support for this? I know that (over a decade ago) when I worked for MF, this was a "controversial" syntax item. Although the compiler (at that time) allowed it, the run-time results for real users were RARELY what they actually wanted/expected (unless the syntax allowed it, but no records actually HAD duplicate primary keys) ---------------------------------------------------------------- Hi Here's the Micro-Focus doc. about Indexed file: http://www.microfocus.com/000/20050801-004_tcm21-5954.pdf. Search for this line: "You can define any key in an indexed file to allow for duplicate values. However, we do not recommend that you allow duplicates on primary keys." Unfortunately we have many COBOL programs using this kind of 'non-recommended' SELECT syntax. There is also AcuCobol who support it. Refer to ACUCOBOL-GT reference manual. Thanks, Hope you can help us. ---------------------------------------------------------------- When I click on your URL, I get a "page not found" message. I look at MF documentation starting at page http://supportline.microfocus.com/productdoc.asp Can you tell me how to find your quote starting from that page? I can tell you when you go to the LRM under any of the current products listed there, you will see NO "with DUPLICATES" phrase for the RECORD KEY clause (only the ALTERNATE RECORD KEY). What supoprted syntax are you using to create/use duplicate primary keys? It is possible that currently MF does support duplicate primary keys via a separate file-handler rather than thru ntive COBOL syntax. It is also possible tht the compiler (and run-timer) ALLOW duplicate primary keys, but the documentation doesn't include it, because this is not (currently) supported language. WHATEVER the documentation says, I still think this is a BAD extension and that applications should be "forced to correct" their syntax before migrating to OpenCOBOL. ---------------------------------------------------------------- Hi Sorry for the link. Try: http://www.microfocus.com/000/20050801-004_tcm21-5954.pdf Look at second paragraph. But my point is that we already have Cobols, from partners, clients and in house shops, that are defining primary key with duplicates. We are in the business of migrating legacy COBOL (HP3000, etc) to more recents platforms and COBOL on HP3000, Micro-Focus and AcuCobol do not have this restriction. The type of indexed file (MF3, MF8, CISAM, DISAM...) may restrict you at run-time but they all accept it at parsing time. PS: You are right it is not something we recommend but in the migration business you must consider what your clients are using. OpenCobol is super but this parsing restriction is a little bit annoying. Our Migration website: http://www.speedware.com/solutions/HPe3000_migration/migration_tools/AMXW/ ---------------------------------------------------------------- Did you notice the following text in the document that you refered to: " To enable duplicate values to be specified for alternate keys, use WITH DUPLICATES in the ALTERNATE RECORD KEY clause in the SELECT clause" Even it doesn't show support for DUPLICATES in teh "RECORD KEY" clause. I may not "win" this argument, but when I have dealt with migrations (and I have dealt with MANY - most from IBM mainframes to other platforms), I have always tried to convince the customer/user to migrate ONLY to "supported" syntax/features. I suppose, teh advantage of an "open source" product like OpenCOBOL is that if the "supplied" compiler doesn't do what you want, you can create a "local modification" that never gets into the main steam. I would certanly be interested in what other think about this. Should this (currently unsupported in teh LRM by MF) extension be added? If so, what are the semantics that you expect: A) you can ONLY get t all the records via "read next" (not by RANDOM READ with a record key? B) What is (or is not) the predictability of how the records are stored (FIFO, FILO, unpredictable) C) What (if anything) happens when you "reorg" the file/ *** It was questions like this that made MF turn this into something "unsupported in their language documentation". I just can't remonnend AGAINST it becoming part of the "main stream" of OpenCOBOL support strongly enough. Support should certainly NOT be turned on, just by asking for "general" Micro Focus support. If it is added, then it should require a separate compiler and/or run-time switch (that includes a strong warning aginst it - everytime you try to use it). ---------------------------------------------------------------- [quote] wmklein wrote: [...] I just can't remonnend AGAINST it becoming part of the "main stream" of OpenCOBOL support strongly enough. Support should certainly NOT be turned on, just by asking for "general" Micro Focus support. If it is added, then it should require a separate compiler and/or run-time switch (that includes a strong warning aginst it - everytime you try to use it).[/quote] I agree with wmklein. If you enable this "feature", OC has to use the primary key internal as secondary key and use an unique thing like a timestamp for the primary key (only internal). ---------------------------------------------------------------- Subject: libcob.so.1 I am trying out Open COBOL, version 1.0, for the first time. On trying out the simple hello world program after the compile I get the following error message: ./hello: error while loading shared libraries: libcob.so.1: cannot open shared object file: No such file or directory This is on OpenSuSE 11.0 and I have ensured the dependencies were met. No problem seen during the configure, make and make install. Any ideas? ---------------------------------------------------------------- Hello MrScott See http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=451&forum=1&post_id=2395#forumpost2395 But this is curious; two identical problems in a 48 hour span ... hmm. For continuity; we'll try and move this conversation to the above thread, if that's ok? They could be separate issues, but it doesn't seem so. Cheers, Brian ---------------------------------------------------------------- No problem. Rebooted OS (odd for Linux, but oh well...) and tried the Hello World sample program and encountered no problems. On to more testing! ---------------------------------------------------------------- Subject: Priorities from the cheap seats revisited Hello everyone, Things seem to be progressing nicely in OpenCOBOL. We've added a few extension possibilities, the documentation slowly grows from a FAQ into a Manual of Miscellaneous Musings. Work on GTK+ bindings for adding gui potential (and many others; GTK+ is a big subsystem) to OC 1.1 continues. This include a gtkhtml widget for in application browser capabilities. And now I'd like to poll the good members of the forum on priorities for the volunteer teams again. Shore up what's been tested and posted making them more release ready? Add CBL_OC_PRINT functions for cross-platform printing? [color=080]Add REPORT SECTION giving OpenCOBOL access to Standard defined Report Writer?[/color] Assisting Bear get his ncurses console windowing toolkit up and published? [color=080]Add Guile scripting and include this as part of the OpenCOBOL build sequence as part of ./configure?[/color] More samples and examples? [color=080]A sockets layer for networking?[/color] Open up linkage for accessing Java and a JVM? Focus on documentation? Online OpenCOBOL Course Material? These are only a few of the options I'd like to see OpenCOBOL developers discuss and request. Feel free to offer up any wants or needs. Note: the coloured entries are my own current hot plate items. Also note that very few of these items are short term goals; they will be long term efforts. Cheers ---------------------------------------------------------------- A sockets layer would be a very nice addition. I don't know how it's done in other COBOL platforms/dialects, but on z/OS and z/VSE (the System z platform) there is an external program (called EZASOKET) that is called that handles the socket interfacing. A non-standard implementation on z/VSE goes as far as to implement EXEC TCP language extentions and uses a pre-processor to translate them into appropriate calls to lower level OS routines (sort of like how the CICS pre-processor works). I would also be in favor of focusing on documentation, including samples. ---------------------------------------------------------------- I am a "language" person, so I'll mention some of the COBOL Language (syntax) features that I think should be considered and categorized by both users and "developers": 1) ALL subscript for intrinsic functions. This RALLY adds functionality to things like SUM, ORD-MAX, etc 2) I am not positive that it isn't there already, but there was a mention in a recent note about calling convention issues. If it isn't there already, the CALL-CONVENTION feature (MF extension and in '02 Standard) might be useful. 3) (Probably low-priority for most) "Internationalization" enhancements from the '02 Standard. This includes USAGE NATIONAL (including for Numeric and Numeric-edited items as is already implemented by IBM on the mainframe), "locale" based processing (which should work well with generated C code), multiple currency sign clauses and separation of currency sign from currency symbol (This has some problems in the '02 Standard but both MF and IBM have implemented it) 4) I would probably put report-writer into a low-priority UNLESS you add some extensions (See SPC on web) that support proportional fonts 5) A big issue would be adding XML support. Unfortunately, there are 2 or 3 conflicting approaches. IBM has done this thru EXEC XML with a bunch of special registers. MF has XD and OPEN, READ, WRITE, CLOSE processing. There is an ISO TR (Technical Report) that is SIMILAR but not quite the same as MF's implementation. 6) I think that some initial investigation should be done into OO support. Again, the existing implementations, IBM, MF and Fujitsu don't match each other or the Standard exactly. This is a "non-issue" for those coming from IBM mainframes (where it is supported but not used). However, more workstation (especially Windows) OO COBOL are being developed. 7) Table SORT is nice to have. MF and the '02 Standard have this; I don't know who else does. *** The non-language issues that I think may need enhancing (or at least more on how to use existing tools) are - Language Sensitive editing - source code level interactive debugging All "IDE" topics may be worth looking at (including "profiling", data/file tools, *** I am certain I could come up with an endless list of other things to consider, but this list might get discussion going. ---------------------------------------------------------------- Is the SORT option available in OC? ---------------------------------------------------------------- Table SORT exists for quite a long time, it works fast and well. I really like to see socket implementation. I remember there was C$SOCKET since ACU 6. This would add the possibility to communicate with a lot of program languages and build own OC socket servers. About C$SOCKET and JAVA you could have a look at http://supportline.microfocus.com/000/Interoperability%20Guide.pdf (point 2.2.3 has a small example) and at http://supportline.microfocus.com/000/ACUCOBOL-GT_Appendices_v8_tcm21-18401.pdf with a full description of C$SOCKET. There is an example about using C$SOCKET for sending SMS, but it is in german http://www.acucorp.com/de/events/newsletters/2003_3.pdf (page 6 to 8). The other really nice thing would be threading (there seems to be a lot of different thread implementations, PERFORM/CALL THREAD from ACU seems to be the easiest for developers, MF has CALL CBL_..._THREAD). With threading and socket communication it would be possible to write nice OC Servers. ---------------------------------------------------------------- MrScott; Samples of file and table sorts at http://opencobol.add1tocobol.com/#sort Another sample with hooks to demonstrate INPUT and OUTPUT PROCEDURE IS (requires commenting out USING and GIVING clauses and removing comments on the other two lines). The sections don't really do anything useful though. Mixed case sort with ALPHABET and then upper lower case mappings. Just a sample. Located at http://svn.wp0.org/ocdocs/brian/sorting.cob :) Cheers, Brian ---------------------------------------------------------------- Bill; always nice to see your wisdom tossed into the discussion. I can't speak to many items on that list; but 3) Roger has implemented at least some LOCALE and we have PIC N. Not sure how deep or wide this coverage is. 4) Report Writer is coming... I find it an interesting challenge, it will assist in CGI enabling and other plans and it's on my plate. ;) 5) a subset of XML should come soon with the GTK+ bindings in terms of a GMarkupParseContext. If this doesn't cut mustard for needs then I plan on digging into libXML2 or other framework depending on analysis not yet complete. Alas this will be a CALL interface, not a builtin. Anyone with a current and dire need can use the Lua layer and Lua-xmlrpc or a SpiderMonkey ECMAScript bundle, or cob_perl or the soon to be unveiled Guile interface; to name but a few of the potential solutions offered in OC1.1 today (or soon). As an aside the GTK+ bindings will also offer a path to GIOChannel, which should provide a usable client/server layer. Although direct Berkeley sockets (with the obligatory Windows workarounds) may be an easier path. 6) we discuss Object COBOL support on and off but that does require the step of exposing some of the currently hidden no-go territory for prototyping As Far As I Understand, and User FUNCTION will come first as part of that fairly major change. 7) As stated on the other replies; SORT is already quite capable in OC. *** And we have quite a few entries in our OpenCOBOL IDE thread, and being a fan of vi, I find our cobol.vim and vi by nature, more than capable of language specific edits for OpenCOBOL. Same for KATE, Emacs and Notepad+ (but I'm not a user of those editors - so I'm not sure about the productivity). In terms of debugging; gdb hooks are enabled, but it does require a manual mapping of COBOL source lines to the generated C. I actually find that pretty straight forward but more features would definitely be welcomed. Our utility belt is growing and sooner than later I expect we will have quite an extensive set of support tools. Again more would be welcomed. [i]Anyone reading this; as Bill pointed out, these are all points worthy of more discussion and expression of opinion.[/i] Cheers, Brian ---------------------------------------------------------------- [quote] In terms of debugging; gdb hooks are enabled, but it does require a manual mapping of COBOL source lines to the generated C. I actually find that pretty straight forward but more features would definitely be welcomed. [/quote] I think full gdb (and ddd) support should be of top priority. Being able to run code in the debugger is not only for debugging, it's also a great productivity boost in development. After coding Java or C++ I usually run the code first in the debugger, have a look at the variables and see if the code really does what it should. Also, for selling OpenCobol to management, it would help a lot if there were an IDE with integrated debugger for it .. With java you can start the runtime with debugging options and attach with Eclipse or other tools from your development PC to a running Unix server and debug your code. I think this is one of the best features of Java. If only one had that for OpenCobol, too. Juergen ---------------------------------------------------------------- Update; A project aimed at providing Network Sockets has been opened on the add1tocobol.com website, and we've discussed it quite extensively on the #add1tocobol IRC channel. It may come in two flavours; classic sockets with HTON, GETHOSTBYNAME etc, and a much higher level CBL_OC_OPEN_SERVER, CBL_OC_OPEN_LINK, CBL_OC_LINK_READ (with implied wait), with clear or encrypted data, CBL_OC_LINK_STATUS etc. If the second form comes to fruition, robust yet easy on the developer client/server applications could well be in OpenCOBOL's future. The former flavour will likely come in a few versions; POSIX and some Windows capable external library layer and based on historical socket programming calls and may well be a single CALL interface with a plethora of sub-functions. The option of GTK+ GIOChannel is still in the works, but the GTK+ bindings are in early stages and will end up being a long term and large undertaking. Cheers, Brian ---------------------------------------------------------------- Hi btiffin. Sockets are really nice. If the sockets are implemented, it would be nice to have C$SOCKET, too (as just another way to call these functions). For good client/server applications it's necessary to have threads as well. These aren't implemented yet, are they? human ---------------------------------------------------------------- Roger would know better of where this comes from; but POSIX threads are listed as a load dependency in a hello world executable. [code] $ ldd hello linux-gate.so.1 libcob.so.1 libm.so.6 libgmp.so.3 libncurses.so.5 libdb-4.5.so libc.so.6 /lib/ld-linux.so.2 libdl.so.2 libpthread.so.0 [/code] So I think, with proper care and a little luck, we may have access to the POSIX thread library functions. This may be wishful thinking, as the Windows side of the equation always seems to include very large monkeywrenches. There is nothing in the compiler that promises thread safety, but the library is linked in for some reason, but I couldn't say where in the chain this dependency is raised. It doesn't show up explicitly in a $ cobc -x -v. Here's hopin' Cheers, Brian ---------------------------------------------------------------- Subject: New Rexx option Open Object Rexx(tm) Hello everyone; It only took ten minutes to trial; so there is a new Rexx option for OpenCOBOL. ooRexx is from IBM. So now we have Regina Rexx and ooRexx as options for OpenCOBOL. http://www.oorexx.org/ Very well documented. [color=080]Note: ooRexx is licensed under the Common Public License. Hopefully my re-posting the sample COBOL is not a breach of copyright, and if it is, I'll appreciate being informed and I'll edit this entry and just leave a link. Also note that Open Object Rexx is trademarked.[/color] Note; unlike the Regina Rexx extension; this required has no C helper layer. The sample links to the ooRexx libraries directly from the CALL. I installed the Debian package from http://www.oorexx.org/download.html and then a simple [code] # dpkg --install ooRexx-3.2.0-1.debian40.i386.deb [/code] [b]WARNING: This overwrote my /usr/bin/rexx with a link to /opt/ooRexx/bin/rexx so I lost the Regina Rexx rexx command line binary but still have the regina alias, so... not too worried. I'll check for other /usr/lib conflicts but initial tests all worked with regina. [/b] [b]tectonics (showing the link options for reference)[/b] [code] $ oorexx-config --libs -L/opt/ooRexx/lib/ooRexx -lrexx -lrexxapi $ cobc -x `oorexx-config --libs` oorexxcall.cob [/code] Will build the an executable out of the sample source code from http://www.oorexx.org/docs/rexxpg/x2658.htm The sample only required commenting out the PROCESS PGMNAME directive and adding a period to the end of the PROGRAM-ID line. [b]oorexxcall.cob[/b] from http://www.oorexx.org/docs/rexxpg/x2658.htm with small changes [code] *PROCESS PGMNAME(MIXED) * You need to specify Rexx.LIB when you link this program, * for example on the COB2 command. * Note that the name RexxStart, used later, is case-sensitive, * and requires the PGMNAME(MIXED) compiler option. ************************************************************* IDENTIFICATION DIVISION. ************************************************************* PROGRAM-ID. 'CALLRexx'. AUTHOR. IBM VISUALAGE FOR COBOL. ************************************************************* *NAME: CALLRexx *** * *** *FUNCTION: CALL A Rexx PROCEDURE NAME XXXXXXXX, *** * PASSING ARGUMENT AND GETTING RETURNED DATA. *** * *** *EXTERNAL SUBROUTINES: NONE *** *COPY MEMBERS: NONE *** * *** ************************************************************* ************************************************************* ENVIRONMENT DIVISION. ************************************************************* CONFIGURATION SECTION. ************************************************************* DATA DIVISION. ************************************************************* WORKING-STORAGE SECTION. ************************************************************* * INTERNAL VARIABLES * ************************************************************* 01 WS-WORK-FIELDS. 05 WS-RESULT-AREA PIC X(255) VALUE SPACES. 05 WS-ARGUMENT-AREA PIC X(255) VALUE SPACES. 05 WS-PARM1 PIC X(50) VALUE '55'. 05 WS-PARM2 PIC X(8) VALUE '66'. 01 WS-RexxSTART-PARAMETERS. 05 WS-Rexx-ARGUMENT-COUNT PIC S9(9) VALUE +1 COMP-5. 05 WS-Rexx-ARGUMENT-LIST. 10 WS-ARG-LENGTH PIC 9(9) COMP-5. 10 WS-ARG-POINTER POINTER. 05 WS-Rexx-PROGRAM-NAME PIC X(255) VALUE LOW-VALUES. 05 WS-Rexx-ENV-NAME PIC X(20) VALUE LOW-VALUES. 05 WS-Rexx-RETURN-CODE PIC S9(9) VALUE 0 COMP-5. 05 WS-Rexx-RESULT. 10 WS-RESULT-LENGTH PIC 9(9) COMP-5. 10 WS-RESULT-POINTER POINTER. 05 WS-Rexx-INTERPRETER-RC PIC S9(9) COMP-5. LINKAGE SECTION. PROCEDURE DIVISION. SET WS-ARG-POINTER TO ADDRESS OF WS-ARGUMENT-AREA. MOVE LENGTH OF WS-ARGUMENT-AREA TO WS-ARG-LENGTH. STRING WS-PARM1 DELIMITED BY SPACE ' ' DELIMITED BY SIZE WS-PARM2 DELIMITED BY SPACE INTO WS-ARGUMENT-AREA END-STRING. STRING 'MYCMD' DELIMITED BY SIZE X'00' DELIMITED BY SIZE INTO WS-Rexx-PROGRAM-NAME END-STRING. STRING 'CGISRV' DELIMITED BY SIZE X'00' DELIMITED BY SIZE INTO WS-Rexx-ENV-NAME END-STRING. SET WS-RESULT-POINTER TO ADDRESS OF WS-RESULT-AREA. MOVE LENGTH OF WS-RESULT-AREA TO WS-RESULT-LENGTH. * Note that the name RexxStart is case sensitive CALL 'RexxStart' USING BY VALUE WS-Rexx-ARGUMENT-COUNT BY REFERENCE WS-Rexx-ARGUMENT-LIST BY REFERENCE WS-Rexx-PROGRAM-NAME BY VALUE 0 BY REFERENCE WS-Rexx-ENV-NAME BY VALUE 0 BY VALUE 0 BY REFERENCE WS-Rexx-RETURN-CODE BY REFERENCE WS-Rexx-RESULT RETURNING WS-Rexx-INTERPRETER-RC. DISPLAY WS-Rexx-RETURN-CODE ' ' WS-Rexx-INTERPRETER-RC. DISPLAY WS-RESULT-LENGTH. DISPLAY WS-RESULT-AREA. GOBACK. [/code] and using [b]MYCMD.CMD[/b] of [code] /* script for OpenCOBOL ooRexx */ Trace All; Parse Version ver; Say ver; address "bash"; 'ls'; return ver; [/code] ./oorexxcall produces [b]output[/b] [code] 3 *-* Parse Version ver; 4 *-* Say ver; REXX-ooRexx_3.2.0(MT) 6.02 30 Oct 2007 5 *-* address "bash"; 6 *-* 'ls -l'; >>> "ls -l" total 18316 -rw-r--r-- 1 brian brian 115 2009-01-11 17:17 MYCMD.CMD -rw-r--r-- 1 brian brian 300 2009-01-11 14:24 MYINPUT.CMD -rw-r--r-- 1 brian brian 5727920 2009-01-11 13:24 oodialog.pdf -rw-r--r-- 1 brian brian 744768 2009-01-11 13:32 ooRexx-3.2.0-1.debian40.i386.deb -rw-r--r-- 1 brian brian 29480 2009-01-11 13:21 ooRexx-3.2.0.tar.gz -rwxr-xr-x 1 brian brian 10925 2009-01-11 14:17 oorexxcall -rw-r--r-- 1 brian brian 4703 2009-01-11 13:19 oorexxcall.cob -rw-r--r-- 1 brian brian 2030830 2009-01-11 13:22 rexxpg.pdf -rw-r--r-- 1 brian brian 9373731 2009-01-11 13:25 rexxref.pdf -rw-r--r-- 1 brian brian 440346 2009-01-11 13:21 rxftp.pdf -rw-r--r-- 1 brian brian 318034 2009-01-11 13:21 rxmath.pdf -rwxr-xr-x 1 brian brian 46 2009-01-11 14:17 tectonic 7 *-* return ver; +000000000 +000000000 000000038 REXX-ooRexx_3.2.0(MT) 6.02 30 Oct 2007 [/code] Cheers ---------------------------------------------------------------- Subject: Very exciting IRC meetup on Freenode #add1tocobol Hello everyone; Today was a very exciting day. The weekly Sunday 9am EST meetup on #add1tocobol included [color=080]- a look at a C layer to transform OpenCOBOL ISAM calls to pgSQL (very cool technology)[/color] - discussions of creating an OpenCOBOL EXEC SQL pre-processor [color=080]- hints that OpenCOBOL will have a very capable CobXRef cross referencer built into the compiler sequence (there are still issues where this will fit in the chain so it remains a separate utility)[/color] - hints that [b]upto 1.5 million[/b] lines of COBOL could soon be open sourced, awaiting a few enhancements to SCREEN SECTION handling. And these may be doable. - discussions of the in progress changes to the compiler support for REPORT SECTION - other miscellaneous sundries including a hint for a link to IBM's freely available DB2 Express C edition http://www-01.ibm.com/software/data/db2/express/ A very exciting meeting. It had the sense of OpenCOBOL making a quantum leap in energy level. By the way; [b]NON FUNCTIONAL; only parses - doesn't DO anything ... far more effort required[/b] but I'm impatient when I get excited. ;) Here is a sample of source code my local copy of cobc is parsing... [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: *> Purpose: test parse of Report Writer *> Tectonics: cobc -x reports.cob *> *************************************************************** identification division. program-id. reportsection. environment division. configuration section. input-output section. *> file-control. *> select *> assign to *> organization is *> . data division. *> file section. *> fd . *> 01 . working-storage section. 01 field1 pic x. 01 field2 pic x. 01 cont1 pic xxx value "xyz". local-storage section. linkage section. report section. rd testreport is global code is "abc" control is field1 . 01 thing type detail. 05 sub-line pic x(999). rd secondreport is global code is cont1 control is final field2 page limit is 66 lines 72 columns heading is 4 first detail is 8 last control heading is 52 last detail is 55 footing is 62 . 01 thing type detail present when field1 = "p". 05 other-thing pic x(5) group indicate blank when zero source is field2. 05 sub-thing pic x(10) line 5 7 9 8 plus 5 next page 12 column number is 10 sum of field1 sum of field2. rd thirdreport page 23 cols heading 5 last de is 7 . 01 thing. screen section. *> *************************************************************** procedure division. display "have report section" end-display goback. end program reportsection. [/code] [b]Again; ONLY PARSING; no Report Writer code is emitted [/b] (notice the duplicate [i]thing[/i] definitions for instance), but this source does produce a valid binary that dutifully displays [i]have report section[/i] when executed. All in all, a good day. Cheers, Brian ---------------------------------------------------------------- Subject: Flagging - What, if anything, do users want? With the ANSI '85 Standard, a "conforming compiler" must - (at the users request) be able to flag the use of OBSOLETE syntax - Be able to flag extensions to the Standard With the '85 *NIST* Standard, a conforming compiler must be able to (in addition) be able to flag - syntax from a "higher" level of a module (i.e. what is in Nucleus level 2) With the '02 Standard a conforming compiler must be able to flag - Obsolete items and extenss (as before - archaic syntax - arithmetic statements that might yield non-Standard results *** So my quesiton is which OpenCOBOL users actually care about which types of flagging - if any? If you are using OpenCOBOL in order to develop on one platform (with OpenCOBOL) but then port to another O/S *and* compiler, then having "extension flagging" is important. It may also be important to be able to flag WHICH Standard you are conforming to (i.e extensions to the '85 Standard that are included in the '02 Standard - such as GOBACK and USAGE POINTER) Do users actually care about OBSOLETE and ARCHAIC flagging? If they do, do they care about what was OBSOLETE in teh '85 Standard or in the '02 Standard or both? ---------------------------------------------------------------- Subject: Articles on Eclipse In a separate thread, there was discussion of using Eclipse as an IDE. I don't know how many OpenCOBOL people know it (although I do know that you all probably know it better than I do ) However, there was just a post in the IBM-MAIN list that pointed to some articles that may be useful to those who want to know more about it. Any way, if interested, please see: http://www.ibm.com/developerworks/views/opensource/libraryview.jsp?search_by=mastering+eclipse+v3.4 ---------------------------------------------------------------- Now, if only there were some articles explaining how to use Eclipse to edit Cobol sources (with full syntax assistance) and how to use Eclipse to remote-debug a running OpenCobol process ... ;-) ---------------------------------------------------------------- I have NOT tried it and don't know what it does or does not do, but are you aware of the "open source COBOL IDE" project under eclipse? The latest release was just last Deceimber, so it looks like it is active. Try: [url=http://www.eclipse.org/cobol/downloads.php]http://www.eclipse.org/cobol/downloads.php[/url] And see what it gets you (or how "open" it really is). ---------------------------------------------------------------- Subject: Native COBOL Language for XML As a follow-up on a discussion of COBOL and XML in another thread, I thought I would provide references to 3 different sources for approaches to providing native language (as opposed to CALL or API support) for XML in COBOL. There is an ISO TR (Technical Report) that deals just with this. At one time there was a thought that this would be included in the next COBOL revision. At this time, it is more of a "try and give us feedback" document. See: http://webstore.iec.ch/preview/info_isoiec24716%7Bed1.0%7Den.pdf When reading it for the first time, I suggest going to the "Concepts" section to get an overview. The ISO approach was based on the existing (and implemented) Micro Focus approach. To read about the MF apporoach, - Go to http://supportline.microfocus.com/productdoc.asp - Select "Net Express 5.1 WS 1" - in the Bookshelf, go to "XML and COBOL" - and under that there are two entries for: XML Input/Output and XML Tutorials For the IBM approach (which is quite different) start at: http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/IGY3PG40/5.0 and read the following pages. If you prefer a PDF to an online book, you can download that book from: http://publibfp.boulder.ibm.com/epubs/pdf/igy3pg40.pdf and start at the chapter "Using XML and COBOL together " ---------------------------------------------------------------- Bill, I take it this isn't a standard yet? How does Enterprise COBOL for z/OS handle XML? Rich ---------------------------------------------------------------- Yes, there is a "Standard" as I said above. There is a TR or ISO Technical Report. Follow my first link and you will see the approved TR. If you mean has it been inlcuded in the 2002 Standard, then the answer is no. As far as Enterprise COBOL goes, follow my third set of instructions and you will see how they do it. ---------------------------------------------------------------- Bill; the http://webstore.iec.ch/preview/info_isoiec24716{ed1.0}en.pdf link leads to a PDF that is cutoff at Page 1 (after the 5 preamble pages) Using kpdf here. Cheers, Brian ---------------------------------------------------------------- Sorry about that. I am still looking if there is a place to get the final (publsihed) version of the TR for freee. (I have found some places that it can be purchased). HOWEVER, to see the final content of the document, there is a MS Word version available at: [url=http://www.cobolstandard.info/j4/files/07-0005.doc]http://www.cobolstandard.info/j4/files/07-0005.doc[/url] ---------------------------------------------------------------- Subject: Install OpenCobol Hello I'm using UBUNTU 8.04. I've downloaded OpenCobol by Synaptic. I've created a launcher but the launcher didn't work. How can I execute OpenCobol? Thanks for your answer. Peter ---------------------------------------------------------------- Peter; OpenCOBOL is a command line tool. See http://opencobol.add1tocobol.com/#how-does-the-opencobol-compiler-work for some details. Cheers, Brian ---------------------------------------------------------------- Subject: Companys Using OpenCOBOL We are currently evaluating our COBOL options and I have been tasked with evaluating OpenCOBOL. We have found a lot of good information on the OpenCOBOL site and have done some preliminary testing with good results. What we have not been able to find though is any references to companys, particularly any that may be considered to be high profile who use OpenCOBOL in a very visible application. If anyone knows of any companys in that position, or if you work for a company that uses OpenCOBOL, we would be interested in hearing of your experiences. Thanks for your help ---------------------------------------------------------------- Roland; Due to the usually closed nature of the COBOL development business this is harder than it should be. I know of a city in Japan using OpenCOBOL for some core management functions, but until I get approval to say more that's about as far as I'd feel comfortable hinting. I don't want this thread to sit unanswered, but as the opening statement suggests, you may be hard pressed to find developers willing or able to give details on work activities in such a public forum. I'll ask the developer I know for permission again, as it'll be good for advocacy and I believe the OpenCOBOL system is more than capable of taking on large scale corporate production tasks. Other hints are included in the FAQ at http://opencobol.add1tocobol.com/#can-opencobol-by-used-for-production-applications Cheers, Brian EDIT: Got some permissions; The application was a port from mainframe COBOL for the Nagasaki Prefecture. Population 1.44 million and 30,000 civil employees. A combination of OpenCOBOL (with embedded Perl) and MySQL was used to port (at least) the payroll system from the mainframe environment for the Prefecture. The OpenCOBOL interface to Perl was also developed for this system. For information of the Prefecture; http://www.pref.nagasaki.jp/en/. Details of the codebase are of course in the hands of the customer, but approval to open the sources could come by April. [i]Things being what there are, that could be wishful thinking, as competitive advantage is probably a guarded secret even in municipal systems[/i]. This system was built (at least in part if not all) by Hiroki Minematsu of Lancardcom Ltd. A link to some details at http://www.lancard.com/archives/000522.html Hiroki had to meet or beat some existing payroll generation benchmarks and succeeded with the system being in production for sometime now. By the way; we get the benefit of the cob_perl code, a link is posted in the Extensions File gallery on http://add1tocobol.com ---------------------------------------------------------------- Thanks very much for your efforts Brian. Every little bit helps! ---------------------------------------------------------------- Hi Roland, I have developed a small/medium application for an Italian government local agency using openCOBOL V. 1.1. The application is composed by 208 COBOL source files; the average length of source files is 225 lines. The data handled by the application are spawned in about 75 files. User interface is textual (the most proficient UI for these kind of applications IMHO) and a library in C has been developed on purpose for handle it. Some other C modules have been developed for handle several low-level tasks. So far I had no problem at all. I hope this can help you. Antonio ---------------------------------------------------------------- Excellent! Thank you very much for you response Antonio. ---------------------------------------------------------------- Subject: Sample Open COBOL programs Hello, Can you please provide me sample Open Cobol programs for report generation. Open Cobol does not support reserve words related to report Generation like Report SECTION, RD and so on . . . Please provide me some sample programs. Also, i could not use FILLER in my report. Please help me Thanks in Advance..... :) ---------------------------------------------------------------- danysavla0; You are asking this just a few weeks/(hopefully not months) too early. Work on Report Writer is just beginning. The parser in a very soon to be unleashed development copy of OpenCOBOL accepts most of the REPORT SECTION and RD syntax [b]but there is NO functional code emitted[/b] just yet. Parser mechanisms will be put in for INITIATE, GENERATE, TERMINATE and the USE BEFORE PRINTING Declarative quite shortly. Tonight maybe? I don't want to get hopes up too high in terms of the when OpenCOBOL Report Writer will be ready for prime time. I'm new to adding functionality to the OpenCOBOL compiler; there are things to learn and then develop and then solidify. Roger, the lead author will NOT let a compiler out of the door unless it meets or surpasses a level of quality that we fans have grown to expect and enjoy. I hope to surpass those standards, but being untested, I can only try at this point and shouldn't promise. Having said that, see http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=457&forum=1 for a sample of the code I use to test my changes to the compiler. And please heed the warnings; this is just the parser. Functional code still needs writing, testing and verification. So for now; old school hand rolled page break programming may be the way to go. OpenCOBOL fully supports the READ and WRITE verbs, the LINAGE clause, and the CALL "SYSTEM" feature can be used to send data to printers using commands appropriate for the operating system. Cheers, Brian ---------------------------------------------------------------- Subject: Enhanced ACCEPT from LINES , COLUMNS Hello OpenCobolers, As Brian told US we have now the possibility to accept #row & #lines from terminal. see http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=435&forum=1&post_id=2428#forumpost2428 ACCEPT ... from LINES ACCEPT ... from COLUMNS. I found out that Roger made "COLUMN" and "POSITION" synonyms. Pay attention that "COL" is admitted, NOT "POS". Here is a little example I Updated from my last post. TSTMAX.CBL including new features of ACCEPT ... [code] >>SOURCE FORMAT FREE *>********************************************************************************** *> Author : Francois (Bear) Hiniger *> Date : 13-Jan-2009 *> Purpose : One way to get the size of the current window (proof of concept) *> Tectonics : cobc -x TSTMAX.CBL *> : cobc GETMAX.c *> Run : ./TSTMAX change the size of your window and ./TSTMAX again identification division. program-id. TSTMAX. data division. working-storage section. 77 w-curwin usage pointer. 77 w-maxxy pic s9(08) usage comp-5. 77 w-maxxx pic s9(08) usage comp-5. 77 w-LINES pic 9(3). 77 w-COLS pic 9(3). 77 getchar pic X. 77 wlines pic 9(03). 77 wcols pic 9(03). 77 wmessage pic X(60). 77 EndLine pic 999. 77 MidLine pic 999. 77 MidColumn pic 999. procedure division. initiale section. debut. *> Doing this initializes the standard screen display "Screen Size Test : OpenCobol New Accept Features" line 01 col 01 with blank screen end-display accept w-LINES from LINES move w-LINES to wlines accept w-COLS from COLUMNS move w-COLS to wcols move spaces to wmessage string "OpenCobol said : This Screen is " wlines " lines height and " wcols " columns wide" delimited by size into wmessage end-string display wmessage line 03 position 20 end-display set w-curwin to NULL *> So GETMAX will apply 'stdscr' for the current window call "GETMAX" using by value w-curwin by reference w-maxxy w-maxxx on exception display "GETMAX Failed" line 10 column 30 with beep end-display not on exception move w-maxxy to wlines move w-maxxx to wcols move spaces to wmessage string "GETMAX said : This Screen is " wlines " lines height and " wcols " columns wide" delimited by size into wmessage end-string compute MidLine = wlines / 2 end-compute display wmessage line MidLine position 20 end-display end-call . termine section. fin. move wlines to EndLine compute MidColumn = wcols / 2 end-compute accept getchar line EndLine column MidColumn with prompt end-accept . ultime. exit program. [/code] GETMAX.c [code] /**************************************************** Author : Francois (Bear) Hiniger Purpose : Cobol interface for C getmaxyx() macro. Tectonics : cobc GETMAX.c (see TSTMAX.CBL) ****************************************************/ #include void GETMAX (WINDOW *win, int *ptr_maxy, int *ptr_maxx) { int maxy, maxx; if (win == NULL) { getmaxyx(stdscr, maxy, maxx); } else { getmaxyx(win, maxy, maxx); } *ptr_maxy = maxy; *ptr_maxx = maxx; } [/code] AcuCobolers will enjoy thanks to Roger Regards Bear ---------------------------------------------------------------- Subject: Help installing on Mac OS X 10.4.x I am trying to install openCOBOL for the first time and am having a problem ar "./configure". I already downloaded and successfully installed GNU MP 4.2.4 (the latest), but when I try to install openCOBOL, I get this error. What else do I need to do? Thanks for any help in advance! (Last few lines from the ./configure output) checking gmp.h usability... yes checking gmp.h presence... yes checking for gmp.h... yes checking for __gmp_randinit in -lgmp... no configure: error: GMP 3 or later is required ---------------------------------------------------------------- See - http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=316&forum=1#forumpost1717 Although that is for 10.5, the hints given by Sarah towards the bottom of the page should also be OK for 10.4. Roger ---------------------------------------------------------------- Thanks, Roger! (I went through the forum, but somehow I managed to not find that topic...) So I followed Sarah's steps and it all installed fine. No errors - that is until I got to the "make check" step like you mention in that thread. I get so many error in all categories. These are the numbers it returned as failed: 4 out of 74 Syntax tests 152 out of 161 Run tests All Data representation tests It says to send the log to the list, but before doing so, I wanted to know if there's something I did wrong in the process. I don't even know where to start looking. (I'm very new to this...) Does anyone have a solution/pointer? I'll go through the forum in the meantime. Thanks! ---------------------------------------------------------------- Have you had any luck? I'm having the same problems with make check. ---------------------------------------------------------------- Subject: Variable length sequential file Dear all, First, I would like to thanks all the contributors and the developpers for this compiler. It's very useful in our business (we've a important past with COBOL / Mainframe). Currently, we work on a program to process a variable length file. The goal is relatively simple : read a variable length sequential file and display the record one-per-one. The length of the record is in another file. I'm not a big programmer in COBOL but my coworker doesn't have any idea to find an issue to our problem. Here is the COBOL code : [code] IDENTIFICATION DIVISION. PROGRAM-ID. ReadMasterSeq. AUTHOR. ols * Read the sequential file MASTER.SEQ.DAT and ouput on the SYSTEM.OUT * This file contents the length of the record in the Direct Master file. * Use the LENREC.DAT file to know the size of the records to read. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT LenReqFile ASSIGN TO "LENREC.DAT" ORGANIZATION IS LINE SEQUENTIAL. SELECT MasterSeqFile ASSIGN TO "MASTER.SEQ.DAT" ORGANIZATION IS SEQUENTIAL ACCESS MODE IS SEQUENTIAL. DATA DIVISION. FILE SECTION. FD LenReqFile. 01 LenReqRecord. 05 LenReqValue PIC 9999. FD MasterSeqFile DATA RECORD IS MasterSeqRecord RECORDING MODE IS V RECORD IS VARYING IN SIZE FROM 1 TO 1250 DEPENDING ON RecordSize. 01 MasterSeqRecord. 05 FILLER PIC X(1250). WORKING-STORAGE SECTION. 01 RecordSize PIC 9999. PROCEDURE DIVISION. Begin. PERFORM OpenInputFiles PERFORM ReadOneRecord PERFORM UNTIL LenReqRecord = HIGH-VALUES DISPLAY LenReqValue,MasterSeqRecord PERFORM ReadOneRecord END-PERFORM CLOSE LenReqFile STOP RUN. OpenInputFiles. OPEN INPUT LenReqFile OPEN INPUT MasterSeqFile EXIT. ReadOneRecord. READ LenReqFile AT END MOVE HIGH-VALUES TO LenReqRecord END-READ IF LenReqRecord NOT = HIGH-VALUES MOVE LenReqRecord TO RecordSize READ MasterSeqFile END-IF EXIT. [/code] During the first read of the MasterSeqFile (under the procedure ReadOneRecord), I've a segmentation fault and I don't find why after many investigations. Is it due to a missing features in Open Cobol ? A bug ? A bad COBOL usage ? I hope that somebody have an idea. Thanks in advance, Olivier. ---------------------------------------------------------------- Hello Olivier, welcome to the forum. I did not looked at the code but here are some first hints. First: Please edit your post and put the COBOL into CODE-Tags. You can reach them via the <> Symbol. Second: If you get a segmentation fault try to compile the programs with -debug, it may lead to a nice error message what's wrong. Please submit always the info from cobc -version if you have problems like this. ---------------------------------------------------------------- Hello human, Thanks for your hints. It's easier to read the code now. Concerning the version of cobc, I'm currently use the 1.0.0 (provided in the Ubuntu packaging). My segmentation fault is due to a memcpy() from a memory address 0xBF to my MasterSeqFile. The segmentation fault appears during the call at the C function cob_read(h_MASTERSEQFILE, 0, 0, 1). The GDB trace follow : [code] (gdb) backtrace #0 0xb7c4167c in mempcpy () from /lib/tls/i686/cmov/libc.so.6 #1 0xb7c336ab in ?? () from /lib/tls/i686/cmov/libc.so.6 #2 0xb7c35b58 in _IO_sgetn () from /lib/tls/i686/cmov/libc.so.6 #3 0xb7c29000 in fread () from /lib/tls/i686/cmov/libc.so.6 #4 0xb7efd195 in ?? () from /usr/lib/libcob.so.1 #5 0xb7efb4a4 in cob_read () from /usr/lib/libcob.so.1 #6 0x08048f9b in ReadMasterSeq_ (entry=) at ReadMasterSeq.cbl:64 #7 0x08049687 in main (argc=Cannot access memory at address 0xbf) at /tmp/cob6897_0.c:23 [/code] Any idea ? ---------------------------------------------------------------- Please compile the COBOL source with -debug and see if the segfault still exists. ---------------------------------------------------------------- The segfault still appears with the -debug option. ---------------------------------------------------------------- I don't know if it is the problem causing the segmentation fault, but you have a basic misunderstanding of the [code]Record Varying in size from N to N Depending on WS-Item[/code] feature of COBOL. When you open for INPUT a file with that phrase and then do a READ, the WS-Item is not used to determine how large a record to read, instead it is updated with the size of the record that WAS read. (WS-ITEM is used on a WRITE statement to determin how large a record to write.) Therefore, any informaiton that you have from your length file is IGNORED when reading your masterfile. It just reads the file as line sequential. This raises the question of whether your master file is really record sequential (the defaulat) or if it is actually LINE SEQUENTIAL. Try adding "LINE" before SEQUENTIAL in that Select/Assign clause and I'll bet that your segmentation fault will go away. ---------------------------------------------------------------- Even with wrong code, segfaults should not apear if compiled with -debug. Can you check if this occurs in recent OC (compiler and runtime), too? ---------------------------------------------------------------- Subject: Is there a way to concatenate vars? We had some discussions about this in chat, but no solution. Does anybody know of a way to concatenate things when a "STRING ... INTO ..." [b]is not possible[/b]? I thought of something like FUNCTION CONCAT("sometext <" somevar "> sometext " someothervar) but I do not know of a function like that. The aim is to feed FUNCTION TRIM (unknown TRAILING) with that. Any suggestions? Is a new FUNCTION like CONCAT() the only possibility and I have to beg roger for that? human ---------------------------------------------------------------- Why can't you use "STRING"? That *is* the way to concatenate values (or portions of values) in COBOL. ---------------------------------------------------------------- Because it is in a copy and feed by copy replacing like FUNCTION TRIM (==this-is-changed== TRAILING). It's not nice coding but I try to solve this point without redesigning all the programs using that copy book. Has anybody an solution for this problem? What do you think of an (not standard) FUNCTION CONCAT(argument-1 [... argument-n)? ---------------------------------------------------------------- I still don't understand what you are trying to do. Are you trying to concatenate the values within two variables? Are you trying to concatenate the TRIMMED values of two variables? Can you show me (in a little detail - not too much) what you want as "source" information and what you want from output? What part is in a COPY member? ---------------------------------------------------------------- You can find a kind of a sample here. Let's see this more as an academic problem to solve than a should-be-coded-like-this. Maybe someone has a solution to this, maybe the only solution is to code different or to have a new OC-FUNCTION that concatenate vars. part of CPYFL.CPY: [code]DISPLAY 'Here is my start thing <' FUNCTION TRIM (this-is-changed TRAILING) '> here is some end string' END-DISPLAY[/code] part of PGM1.COB (works): [code]77 myvar1 pic x(5000) value 'A wonderful string'. ... COPY CPYFL REPLACING ==this-is-changed== by ==myvar1==.[/code] part of PGM2.COB (this is an newer version of PGM1.COB and works not): [code]77 myvar1 pic x(5000) value 'A wonderful string'. 78 myconst value ' A wonderful string with spaces before and after '. 01 myvar2. 05 myvar2-int pic 9(10) value 513584. 05 myvar2-str pic x(2000) value ' Another wonderful string with some spaces before'. ... COPY CPYFL REPLACING ==this-is-changed== by ==' some spaces wanted before: ' myvar1 ',' FUNCTION TRIM (myconst) ': ' myvar2 ==.[/code] ---------------------------------------------------------------- Maybe I am being dense or there is a language issue here, but I still am not certain I understand what the problem is. First you have code of [code]DISPLAY 'Here is my start thing <' FUNCTION TRIM (==this-is-changed== TRAILING) '> here is some end string' End-Display[/code] Now personally, I think that the use of == is going to cause you problems eventually and would be better if replaced by some other separator. I would use ":" so that the code would be: [code]DISPLAY 'Here is my start thing <' FUNCTION TRIM (:this-is-changed: TRAILING) '> here is some end string' End-Display[/code] Now, as I understand it, you want to have as an argument to the TRIM function the values from concatenating [code] ' some spaces wanted before: ' *> a literal myvar1 *> the content of this variable ',' *> another literal FUNCTION TRIM (myconst) *> the returned value from a function ': ' *> another literal myvar2 *> the contents of another variable [/code] The logical way (to me) would be string the values together into a termporary data item and use that in the COPY replacing statement, but if, for some reason, you didn't want to do that, then you could do it with the following code: [code]copy CPYFL replacing ==Display== by ==String ' some spaces wanted before: ' delimited by size myvar1 delimited by size ',' *> delimited by size FUNCTION TRIM (myconst) delimited by size ': ' delimited by size myvar2 delimited by size into temp-field Display== ==:this-is-changed:== by ==Temp-Field [/code] As I say, I would personally do the STRING before the COPY statement, but it can be done by COPY/REPLACING as above. It does require the use of a "temp-field". Is your problem that you don't want to have an explicit temporary field for the concatenated values? If that is the issue, then as a personal opinion, avoiding a temporary field does NOT justify creating a non-standard intrinsic function, but other can certainly disagree with this. ---------------------------------------------------------------- I am replying to myself because I didn't want to "Mix" this reply with the previous one. I just watned to state the the premise of the last request is really odd (to me). I wouldn't use the COPY for the previous case because the whole THING should be replaced by a single STRING statement. All you are doing with that COPY statement is trying to "feed it into" a TRIM function (with TRAILING specified). When what you really should do is just STRING and delimit the final variable by all SPACES. I assume that there are other cases where you want to "feed" a concatenation (results of a STRING) into another function (not TRIM) where it would make sense, but even in those cases, the "COBOL way" to do this is to use STRING and put it in a temporary field and then use that as the argument to the other function. ---------------------------------------------------------------- You've got the point: there should be no definition of a temporary var. This thread is just a question if there are ways to do this without a string. Therefore your answer about copy replacing ==DISPLAY== by ==STRING ... END-STRING DISPLAY== was interesting but no solution for the underlying (academic) problem: Is it possible or not? Answer until now: It would be only possible with a questionable non-standard function. And you were right, in [code]==this-is-changed==[/code] == are wrong in the copy, I've edited the post. ---------------------------------------------------------------- OK, traditional COBOL does require a temporary data item (and the use of STRING). Besides being non-Standard, a "CONCAT" function would require (IMHO) all the variations of DELIMITED BY that STRING has for each argument. In the current COBOL Standard ('02), the solution would be to create a user-defined function or an inline (object orientation) invocation. Neither of these would require a temporary data item (in the COPY stuff - but would in the function or method). Creating user-defined functions would be better than creating (temporary - to be replaced when user-defined functions are available - intrinis functions. Can you help me understand the objection to a temporary data item? "Traditionally" there have been many times when traditional data items are used for "multi-statement" operations. ---------------------------------------------------------------- Hmm. I can see the argument for a FUNCTION CONCATENATE. It certainly aids in producing concise/compact code. Let me ponder it. Roger ---------------------------------------------------------------- Just so it is clear, the reason that I do NOT like new (non-Standard) intrinsic functions is that they impact (some what unexpectedly) existing user code. If the repository paragrpah includes [code] Function All Intrinsics[/code] and the source code includes a "concatenate" paragraph, you will suddenly cause the program to fail to compile - even if the new function is never used. Adding ANY new (non-Standard) intrinsic function - especially one iwth a "sounds like a verb or identifier name" name is likely to break existing code that uses the repository paragraph to allow code not to use the FUNCTION keyword. ---------------------------------------------------------------- The whole thing was about "use no string because of the necessary var". No matter, your responses included been good thoughts, thank you. I think if Roger builds a non standard function it will have the prefix OC_ or COB_, so I see no break of existing code. If not, you would've been right there, too. ---------------------------------------------------------------- There isn't a prefix for STORED-CHAR-LENGTH which isn't Standard (but does, I think, exist in another dialect). I would certainly support using a "COB_" prefix for non-Standard intrinsic functions. Use of "OC_" runs into a silly rule about two characters before a hyphen or underscore and probably should NOT be used. ---------------------------------------------------------------- You're right, COB_ is better in every way. Own extensions like CBL_OC_NANOSLEEP use both. ---------------------------------------------------------------- Typically, CBL_, COB_, etc. are used to denote system routines that may be CALL'd. Using that for functions confuses the whole matter. Anyway, current tarball has FUNCTION CONCATENATE and also SUBSTITUTE-CASE. The latter is the same as SUBSTITUTE except that case is ignored when comparing the match string. I'll live with the fallout (if any) from OC extensions. Roger ---------------------------------------------------------------- Thanks, especially for SUBSTITUTE-CASE. Is it likely that these functions will be available in all later versions? ---------------------------------------------------------------- Subject: (False) Error-Message with "Ascending Key" usage? Hi, I've been trying to compile a Cobol-File (from BS2000). [code] IDENTIFICATION DIVISION. *======================== PROGRAM-ID. TESTCOB. ENVIRONMENT DIVISION. *===================== * CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. * DATA DIVISION. *============== * WORKING-STORAGE SECTION. *======================== * 01 TEST-TAB1. 02 TEST-TAB1-ELEM OCCURS 30 ASCENDING KEY IS TAB1-ASC-KEY INDEXED BY TAB1-IND. 03 TAB1-ASC-KEY PIC 9(01). 03 FILLER PIC X(01). * - ERROR MESSAGE....()ERROR: SYNTAX ERROR, UNEXPECTED ASCENDING, * EXPECTING EXTERNAL OR GLOBAL * - ALSO THE COBC STOPS AFTER ASCENDENING - NO FURTHER ERROR * OUTPUT 01 TEST-TAB2. 02 TEST-TAB2-ELEM OCCURS 30 INDEXED BY TAB2-IND ASCENDING KEY IS TAB2-ASC-KEY. 03 TAB2-ASC-KEY PIC 9(01). 03 FILLER PIC X(01). * LINKAGE SECTION. * PROCEDURE DIVISION. *========================================== * MAIN SECTION. * * * EXIT PROGRAM. STOP RUN. [/code] This is a short example of my Problem - when I compile this file at BS2000 there is no Error, but with Open Cobol (V1.1.0 Build from 15.01.2009) I get an Error with the second Ascending Key. The Error Message is: C:/COB/SPE5A7~1.COB:47: Error: syntax error, unexpected ASCENDING, expecting EXTERNAL or GLOBAL Also the Compiler stops here, and doesn't execute further Code Checking. In my Opinion both Versions of the table with indexed by and ascending are correct or? At least, the BS2000 Compiler does not have any warnings on both constructions. ---------------------------------------------------------------- The Standard (current and past) requires the ASCENDING/DESCENDING KEY prhase to appear BEFORE the INDEXED BY phrase. Check and see if BS2000 has a (documented) extension allowing the phrases to be in the other order. (You mighw ant to compile the program with "standard conformance checking" turned on. I think that BS2000 has that feature.) NOTE: The OpenCOBOL message seems wrong to me - as EXTERNAL and GLOBAL would be wrong at that place in the syntax as well. ---------------------------------------------------------------- wmklein, you're right about the wrong error message. This is one of the points to work on for OC, but it was very improved during the last years. ---------------------------------------------------------------- You are also right about the correct order of the indexed by and ascending/descending clause. So there is still - correct error message - further code checking after the occ. of this error would be nice :-D ---------------------------------------------------------------- Same error message on a forgotten point (at end of line) [code] IDENTIFICATION DIVISION. *======================== PROGRAM-ID. TESTCOB. ENVIRONMENT DIVISION. *===================== * CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. * DATA DIVISION. *============== * WORKING-STORAGE SECTION. *======================== * * Forgotten Point leads to * C:/COB/SPE5A7~1.COB:20: Error: syntax error, unexpected "Literal", expecting EXTERNAL or GLOBAL 01 TEST-A 02 TEST-A1 PIC 9(03) VALUE ZERO. * LINKAGE SECTION. * PROCEDURE DIVISION. *========================================== * MAIN SECTION. * MOVE 999 TO TEST-A. * EXIT PROGRAM. STOP RUN. * [/code] ---------------------------------------------------------------- Which is perfectly fine. 01 TEST-A GLOBAL. or 01 TEST-A EXTERNAL. would be valid. Roger ---------------------------------------------------------------- Subject: Length Checking within Open Cobol Hi, as you have read in my last post :-), I'm trying to use Open Cobol V1.1 for some BS2000 COBOL Sourc-Codes. Here is another Question about the length Checking within the Compiler. Here is a short example of what I mean: [code] IDENTIFICATION DIVISION. *======================== PROGRAM-ID. TESTCOB. ENVIRONMENT DIVISION. *===================== * CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. * DATA DIVISION. *============== * WORKING-STORAGE SECTION. *======================== * 01 TEST-A. 02 TEST-A1 PIC X(01). 02 TEST-A2T OCCURS 3. 03 TEST-A3T PIC X(05). * 01 TEST-B. 02 TEST-B1 PIC X(01). 02 TEST-B2T OCCURS 3. 03 TEST-B3T PIC X(04). * 01 TEST-C. 02 TEST-C1 PIC X(10). * 01 TEST-D. 02 TEST-D1 PIC X(09). * LINKAGE SECTION. * PROCEDURE DIVISION. *========================================== * MAIN SECTION. * * NOT SIZE-CHECKED MOVE TEST-A TO TEST-B. MOVE TEST-C TO TEST-D. * * ALSO NOT SIZE-CHECKED MOVE TEST-C1 TO TEST-D1. * * BUT THIS IS SIZE-CHECKED? MOVE "1234567890" TO TEST-D1. * * AND THIS ONE IS ALSO CHECKED... MOVE TEST-B (1:LENGTH OF TEST-A) TO TEST-A. * * AND ANOTHER ONE THAT IS CHECKED... MOVE TEST-D1 (1:LENGTH OF TEST-C1) TO TEST-C1. * EXIT PROGRAM. STOP RUN. [/code] The first three Statements are not Checked but why?? There is no Warning with Open Cobol V1.1.0 (std=bs2000). In the last three Statements, there are Warnings... well nice Implementation of the Length Function maybe :-D Here are the warnings/error messages (the Lines maybe not correct) C:/COB/SPE5A7~1.COB: In section 'MAIN': C:/COB/SPE5A7~1.COB:66: Warning: Value size exceeds data size C:/COB/SPE5A7~1.COB:31: Warning: 'TEST-D1' defined here as PIC X(09) C:/COB/SPE5A7~1.COB:69: Error: Length of 'TEST-B' out of bounds: 16 C:/COB/SPE5A7~1.COB:72: Error: Length of 'TEST-D1' out of bounds: 10 And at least, I've made the cross Check on my old BS2000 Compiler with the same Source Code. But for better understanding here the Source Code with the translates Error Messages from the BS2000 Compiler [code] ** START OF TOM-SAVLST *** IDENTIFICATION DIVISION. *======================== PROGRAM-ID. TESTCOB. ENVIRONMENT DIVISION. *===================== * CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. * DATA DIVISION. *============== * WORKING-STORAGE SECTION. *======================== * 01 TEST-A. 02 TEST-A1 PIC X(01). 02 TEST-A2T OCCURS 3. 03 TEST-A3T PIC X(05). * 01 TEST-B. 02 TEST-B1 PIC X(01). 02 TEST-B2T OCCURS 3. 03 TEST-B3T PIC X(04). * 01 TEST-C. 02 TEST-C1 PIC X(10). * 01 TEST-D. 02 TEST-D1 PIC X(09). * LINKAGE SECTION. * PROCEDURE DIVISION. *========================================== * * NO PARAGRAPH AFTER CHAPTER * NACH EINEM KAPITELNAMEN FEHLT DER PARAGRAPHENNAME............................ MAIN SECTION. * * DESTINATION IS LARGER THAN SOURCE FIELD * IN DER ANWEISUNG 'MOVE' IST DAS SENDEFELD GROESSER ALS DAS EMPFANGSFELD...... MOVE TEST-A TO TEST-B. * * DESTINATION IS LARGER THAN SOURCE FIELD * IN DER ANWEISUNG 'MOVE' IST DAS SENDEFELD GROESSER ALS DAS EMPFANGSFELD...... MOVE TEST-C TO TEST-D. * * DESTINATION IS LARGER THAN SOURCE FIELD * IN DER ANWEISUNG 'MOVE' IST DAS SENDEFELD GROESSER ALS DAS EMPFANGSFELD...... MOVE TEST-C1 TO TEST-D1. * * DESTINATION IS LARGER THAN SOURCE FIELD * IN DER ANWEISUNG 'MOVE' IST DAS SENDEFELD GROESSER ALS DAS EMPFANGSFELD...... MOVE "1234567890" TO TEST-D1. * * THIS ARENT CHECKED - NICE FROM OpenCOBOL to do so :-) MOVE TEST-B (1:LENGTH OF TEST-A) TO TEST-A. MOVE TEST-D1 (1:LENGTH OF TEST-C1) TO TEST-C1. * * EXIT PROGRAM. STOP RUN. [/code] As you can see, the BS2000 compiler Checks the length of the first three statements as well - and gives a warning (lowest error wight = 0!) and checks the forth statement as well but cannot check the Length Function ... so as a short conclusion for me, when I run both compilers, I will see all Error-Messages :-D ---------------------------------------------------------------- I am confused as to WHY you think that there should be warning messages at all for moving group items to group items or alphanumeric to alphanuemric items. The rules for truncation are part of the COBOL Standard and this is perfectly valid (and useful) feature of COBOL. I think that many COBOL programmers would be bothered if they got a warning message (and certainly not an error message) every time they moved a larger group item to a smaller one or a larger alphanumeric item to a smaller alphanumeric item. Do you also want a warning message if you move a smaller item to a larger one - where padding occurs? The case of reference modification is different. In that case you aren't getting a message saying tha tyou are moving a larger item to a smaller item, you are getting a message saying that you are trying to define a length in reference modividation that is larger than the field that you are reference modifying. That is illegal. The numeric literal case is one that is superflouus, but doesn't hurt. In that case, it is unlikely that one would move a hard coded literal to a field that can't handle it, but it is still legal. ---------------------------------------------------------------- Enable all the warnings seen in [url=http://opencobol.add1tocobol.com/#what-compiler-options-are-supported]compiler options[/url], maybe it results in more expected error messages. ---------------------------------------------------------------- I've already compiled the Source with -Wall :-D (no warning or message) Well, even if you could not understand why it could be usefull, the creators of the BS2000 Compiler thought so, that it maybe usefull to know if a truncation is done. And I think so too - maybe it would be a nice idea to create another/new error flag, for this warning or "informational" message. So everybody could turn the warning on or off. I know that some older MF compilers (I think the 92 Compiler) have done in some Cases no correct truncation - so you could find the "rest" of the longer Source-Var in the next defined var (only in rare cases)... So all in all, there might me cases where a warning is absolutly stupid, but I can think of some cases where a warning might help (thinking of larger tabels/groups out of copy books and so on..) what argmunent speaks against a new warning flag maybe -WAutoTruncWarn :-P :-P ---------------------------------------------------------------- You did not look closely enough at the compile options. Look at cobc --help With the correct warning options I get this - [code] tescob.cob: In section 'MAIN': tescob.cob:41: Warning: Sending field larger than receiving field tescob.cob:17: Warning: 'TEST-A' defined here as a group of length 16 tescob.cob:22: Warning: 'TEST-B' defined here as a group of length 13 tescob.cob:42: Warning: Sending field larger than receiving field tescob.cob:27: Warning: 'TEST-C' defined here as a group of length 10 tescob.cob:30: Warning: 'TEST-D' defined here as a group of length 9 tescob.cob:45: Warning: Sending field larger than receiving field tescob.cob:28: Warning: 'TEST-C1' defined here as PIC X(10) tescob.cob:31: Warning: 'TEST-D1' defined here as PIC X(09) tescob.cob:48: Warning: Value size exceeds data size tescob.cob:31: Warning: 'TEST-D1' defined here as PIC X(09) tescob.cob:51: Error: Length of 'TEST-B' out of bounds: 16 tescob.cob:54: Error: Length of 'TEST-D1' out of bounds: 10 [/code] Roger ---------------------------------------------------------------- As you could've seen in the link I've posted:[quote] -Wcall-params Warn non 01/77 items for CALL params [b](NOT set with -Wall)[/b] -Wcolumn-overflow Warn text after column 72 [b](FIXED format, NOT set with -Wall)[/b] -Wterminator Warn lack of scope terminator [b](END-XXX, NOT set with -Wall)[/b] -Wtruncate Warn possible field truncation [b](NOT set with -Wall)[/b] [/quote] ---------------------------------------------------------------- *Duck and hide* :-? I've only read the first lines until -Wall turns on all... ok my fault and many thx :-D ---------------------------------------------------------------- Also note with current 1.1 tarball - (part of cobc --help) [code] -W Enable ALL warnings -Wall Enable all warnings except as noted below [/code] Roger ---------------------------------------------------------------- Thx :lol: :-D ---------------------------------------------------------------- Subject: Solved: Compiler messages:implicit defined vars are shown to be after COBOL file,return-code missing If you have no return-code defined and use it, it is implicit defined as pic s9(9). Sample code [code]77 trc pic 99. ... call 'BIGPROG2' returning trc move return-code to trc[/code] Three weird things about that: 1. even with -Wimplicit-define there is no warning about not defined return-code (used in line 4) 2. if compiled with -Wtruncate, the compiler complains about truncation with return-code in line 3, although there is no var "return-code" used (it complains also about line 4, this is right). [quote]TESTPGM.CBL:34 (this is line 3! from the sample): Warning: Some digits may be truncated TESTPGM.CBL:35: Warning: 'RETURN-CODE' defined here as PIC S9(9) TESTPGM.CBL:15 (this is line 1 from the sample): Warning: 'trc' defined here as PIC 99[/quote] Is this right? 3. There is no line 35 in TESTPGM.CBL. I think it would be better if the compiler would say [code]TESTPGM.CBL: Warning: 'RETURN-CODE' implicit defined as PIC S9(9)[/code] human ---------------------------------------------------------------- If it matters (probably not relevant to this thread), the RETURN-CODE special register was (as far as I know) originally an IBM extension. (I know that Micro Focus supports it and I think that it was a part of X/Open). Any way, the way that IBM defines it is: [code]RETURN-CODE GLOBAL PICTURE S9(4) USAGE BINARY VALUE ZERO.[/code] See: [url=http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3lr40/1.3.8.6 ]http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3lr40/1.3.8.6 [/url] I would suggest that, if it isn't already, that this is what the implicit definition of RETURN-CODE should be. (Both the BINARY and the GLOBAL are important for some types of coding) In IBM mainframe-speak, I don't know of any systems that use a "full word" - pic S9(9) - Return-Code. It is almost always half-word. For those used to IBM programming, the "return-code" is what ends up in R15 and actually impacts the "return-code" that works with JCL. Having a full word value would be VERY strange. ---------------------------------------------------------------- [url=http://manuals.fujitsu-siemens.com/open.php?ID=2064]COBOL V1.4 Siemens[/url] defines it as RETURN-CODE 8-ziffriges Datenfeld mit Vorzeichen mit COMPUTATIONAL Angabe und SYNCHRONIZED-Angabe (entspricht PIC S9(8) COMP-5 SYNC) if it matters :-) ---------------------------------------------------------------- Fixed in current 1.1 tarball. Message now reads (for internal regsiters) - [code] Warning: Internal register 'RETURN-CODE' defined as BINARY-LONG [/code] Roger ---------------------------------------------------------------- When the dialect is IBM or MVS is it BINARY-LONG (which doesn't even exist for IBM) or is it as specified by IBM? In MF it is determiend by the RTNCODE-SIZE compiler option. (it can be 2, 4, or 8 - indicating the size in bytes) My guess is that OpenCOBOL needs a similar "directive". ---------------------------------------------------------------- Nope. This is always a 4 byte native signed integer. Roger ---------------------------------------------------------------- So, you just don't care about portability with IBM COBOL; probably the MOST COMMONLY used COBOL today? (See the URL with their definition posted above.) P.S. It also looks as if you aren't giving it the GLOBAL attribute which will be anotehr migration issue. ---------------------------------------------------------------- Current OC 1.1 handles the "GLOBAL" nature of RETURN-CODE perfectly fine in nested programs. However, it is not run-unit "global" but is "propogated up" in non-nested programs as the following (non-nested) example shows - In prog 1 - [code] move 2 to return-code. display "Return-code before call " return-code. call "prog2". display "Return-code after call " return-code. stop run. [/code] In prog 2 - [code] display "Return-code in prog2 " return-code. move 3 to return-code. exit program. [/code] Result - [/code] Return-code before call +000000002 Return-code in prog2 +000000000 Return-code after call +000000003 [/code] I do not see what you have against - [code] Warning: Internal register 'RETURN-CODE' defined as BINARY-LONG [/code] You want it to be - [code] Warning: Internal register 'RETURN-CODE' defined as PIC S9(9) COMP-5 [/code] ? or maybe - [code] Warning: Internal register 'RETURN-CODE' defined as PIC S9(well it's more than 9 digits but not the full 10) COMP-5 [/code] ? or maybe - [code] Warning: Internal register 'RETURN-CODE' has possible inclusive values of -2147483648 to 2147483647 [/code] ? :-) Now to it's interpretation. RETURN-CODE is passed as the exit status to the "outside world" when an executable (run-unit) terminates. This is so (AFAIK) with all compilers that support RETURN-CODE. This executable may be a COBOL program that has been compiled down to an executable with eg. "cobc -x" (equivalent to Micro Focus "cob -x") or it can be "driver" program supplied with the compiler eg. "cobcrun" in OC, "cobrun" in Micro Focus. In OC, for the above cases, there is an explicit (in the case of "cobcrun") or implicit (in the case of code genned from "cobc -x") C "main" function defined. The C standard mandates that the "main" function return a (native) signed integer. This is irregardless whether PC, mainframe, big-endian, little-endian, 32-bit, 64-bit, etc. Therefore it is logical to make RETURN-CODE a native signed integer and BINARY-LONG [SIGNED] is exactly that. Anything else does not make sense. I have never had any problem with portability/compatibility here. Roger ---------------------------------------------------------------- I don't have a problem with the DEFAULT messsage being "binary-long". However, if one is compiling with MVS or IBM (at least) that makes no sense to the programmer. Those shouldn't be considered VALID usages when compiled with those dialects. Furthemore, when an IBM (mainframe) program moves any value greater than 4096 to a Return-Code special register, they expect it to be truncated. A few, not many, programs rely on this truncation. This is why I think that the (Micro Focus-like) directive should be available to change the maximum size of the teturn-code value. If you want to keep it as Binary-Long but use a BINARY-SHORT intermediate item, that would certainly work. My personal prefered warning message would be something like [code]Warning: Special register 'RETURN-CODE' defined, See documentation for attributes[/code] ---------------------------------------------------------------- 4096 ?? Since when does a PIC S9(4) COMP truncate to 4096 (or any other binary field for that matter)? Very sad state of affairs if people rely on truncation behaviour as that is inherently non-portable. Roger ---------------------------------------------------------------- You, of course, are correct that the maximum for a S9)04) item 9s "9999" and not "4096". I don't, however understand why you think that programmers should NOT rely on truncation behavior. When run in ANSI/ISO conforming mode, ALL compilers must support truncation (even of USAGE VINARY) items to the number of (base-10) digits in the Picture clause. Of course, with BINARY-LONG (or -SHOR)) or the extenison of COMP-5, that is NOT true. but with BINARY, truncation is (and always has been) totablly portable IF the program is conpiled in "conformance" mode. Many (most?) vendors have non-Standard ways of running where BINARY items ignore the PICTURE clause for turncation, but what do extensions and non-conforming mode have to do with portability? ---------------------------------------------------------------- And what has that got to do with the price of eggs at the market? You made the statement that the IBM RETURN-CODE definiton is PIC S9(4) COMP and that values will be "truncated" to 4096. Researching the web shows that indeed there is some nefarious limit to the value that can be moved to RETURN-CODE on IBM and it also appears that negative values can not be used. What has that got to do with truncation behaviour/ANSI/ISO conformance? And are you saying that there are programs that rely on this "limit"? If so they are in for a rude awakening. Anyway, this thread is leading nowhere. OC is working as designed and poses no portability problems. Roger ---------------------------------------------------------------- What is your objection to having a directive or flag or something else to allow return-code (by SELECTION) t be limited to a half-word? This is a portability issue and it would be better if IBM users who rely on trunctation did NOT have to have a "rude awakening" - but instead could select IBM mainframe compatible behavior. If I understood your objection to such a directive (similar to that already available for Micro Focus), then maybe I would be happy to "drop it". No one (at least not me) is telling you that it is WRONG to use BINARY-LONG as the "default". But I don't understand why it must be the ONLY option - when there are reasons to provide alternatives. ---------------------------------------------------------------- Subject: Solved question about compiler option -ext. [quote]-ext Add default file extension [/quote] What extensions are used (and in which order) if cobc is called with/without "-ext COPY" for the code [code]COPY SAMPLE.[/code] There is no entry in the [url=http://opencobol.add1tocobol.com/ocfaq.html]FAQ[/url] yet, but it would be an important information. ---------------------------------------------------------------- In the following order - CPY, CBL, COB, cpy, cbl, cob and finally with no extension. User specified extensions (in the order as per command line) are inspected PRIOR to the above defaults. ie. They have take precedence. Roger ---------------------------------------------------------------- Thank you for this information. I think Brian will add this info to the FAQ. ---------------------------------------------------------------- Hi Brian. Would you add this information to OC FAQ, please? human ---------------------------------------------------------------- Added. :) Thanks for the reminder human. It's 3.10 for now, but that will probably change. Cheers, Brian ---------------------------------------------------------------- Subject: on non-Standard Intrinsic Functions (possible solution) So I [u][b]REALLY [/b][/u] hate adding new non-Standard intrinsic functions. However, if you are going to add them (and apparently add BUNCHES of them), can you please also add an [code]EXCEPT[/code] phrase to the [code]Function All Intrinsics[/code] clause of the Repository paragraph? If you do that, a programmer interested in portability of COBOL source code could create a COPY member with an except clause to avoid all the new non-Standard intrinsic functions. I would also think you MIGHT want to think about turning them off and on by a (single) directive. In that way, when you DO provide support for user-defined functions, they can be "moved" from intrinsic to user-defined and make your source code portable - and Standard. ---------------------------------------------------------------- Sounds reasonable, let's see what Roger thinks about that. ---------------------------------------------------------------- In current OC 1.1 we already have an external facility for doing this. In the "config" directory there are "xxx.conf" configuration files. One of the entries that may be specified in these files is "not-reserved". This allows specifying a "reserved word" (including FUNCTION names) as losing their "reserved" status and being available as a user word. You can create your own config files and you have the possibility to specify this on the compile command line. Roger ---------------------------------------------------------------- Are there supplied config files for IBM, MF, and all the other dialects? If so will these functions be turned off in them? (For those familiar with Micro Focus, they have two separate facilities, the "dialect" directives just change what reserved words are in effect while the "WB.xxx" files set ALL the directives to emulate the dialect environment, e.g. ASCII vs EBCDIC or big-/little-endian. Of course, all of these solutions are "all or nothing" solutions, while the repository paragraph is a per program solution. So far, only changing the compile command-line seems to do this adn that would be a maintenance problem. People NEVER remember which options to use when "called in at 3am" to fix a problem. This is why I strongly prefer source code solutions. The other thing to remember, of course, is that function names are NOT "reserved words". They are "reserved in context". Hopefully, the config file doesn't treat them as reserved. When the FUNCTION INTIINSICS ALL is specified, then they are treated as if they were reserved, but in all other cases, they MAY be used as user-defined words. Hopefully, the current compiler works that way. ---------------------------------------------------------------- Subject: Questions for ACU-Compatibility There is no -std=ACU yet. Is it useful to implement it? For example one difference (really stupid but it's ACU, not OC :) is, that with ACU the following does not compile[code]accept datevar from date end-accept accept timevar from time end-accept[/code] This results in two times [quote]Unmatched END-ACCEPT[/quote] Maybe it would be good if we have -std=ACU and not complaining about missing END-ACCEPT even with -Wterminator set. What other incompatibilities (from ACU) do you know? Do you think it would be good to have -std=ACU? the questioning human ---------------------------------------------------------------- Subject: Documentation on what compiler options are available As a follow-up to the warning and other threads. It seems to me that the FAQ, under [code]3.4 What compiler optionss are available[/code] includes several compiler options that are NOT included under the "User Manual" under the same topic and both of these don't inlcude everything that is actually in the compiler. First, am I correct about this? Second, am I correct that the only way(s) to know what is actually available is either look at the source code or run with -help? Is the teext of what you get from help something that could be placed in a file that was accessible from the webpage? That way everytime there is an "updated tarball" there could be an updated online reference? ---------------------------------------------------------------- Bill, The documentation on the wiki portion of opencobol.org corresponds (or should) to OpenCOBOL 1.0. Most of the forum posts and the FAQ/Manual of Musings tries to keep up with the 1.1 pre-release. As 1.1 approaches a freeze point there will be a push to update the opencobol.org "official" documentation as well as including the Texinfo file and manpages that ship with the system install. As a volunteer doc writer, the last few weeks have been pretty exciting. A gentleman whose expertise and experience I've grown to highly respect has commenced writing up language reference materials. The add1tocobol team has been discussing the requirements for a Usage and Installation Guide with all the various ins and outs of the supported platforms and build options. The documentation behind OpenCOBOL could soon catch up with the quality of the codebase. Cheers, Brian ---------------------------------------------------------------- Subject: Help me to understand - new intrinsic functions vs User Defined functions Can someone help me understand what the problem is in implementing the user-defined functions facility? Without knowing the develoment efforts required, I can't understand why there are resources to create new non-Standard functions while there doesn't seem to be resources to create user-defined functions (that, to me, would be a "simple" extension from subprograms with the rETURNING phrase). If the compiler had user-defined functions, then all the non-Standard intrinsic functions could be included in a "function library" and available in a Standard way. An [u][b]initial[/b][/u] implementation of user-defined functions could work where arguments have a fixed number and matched between use and definition. Function Prototypes and variable number (much less variable size) arguments could be later - if the ANY LENGTH (01-level in Linage Section) isn't implemented yet. When J4 and WG4 were developing user-defined functions, I tried to get them to consider allowing ANY program with a RETURNING phrase to be used as a user-defined function (with PROGRAM-ID not even FUNCITON-ID. Would an extension like that allow you to make user-defined functions for things like CONCATENATE? How difficult would it be to implement? ---------------------------------------------------------------- Your argumentation sounds reasonable. I've no idea what has to be done to implement user defined functions (I think it's mainly parsing and maybe outsourcing into a different c-function) but a first implementation would be help a lot. ---------------------------------------------------------------- Subject: Update to occurlrefresh.cbl Hello; To help keep up with Roger's pace; I've updated occurlrefresh and added a [b]-b[/b] ([i]for build[/i]) command line argument to extract the tarball, configure and make the system. Existing open-cobol-1.1 directories are archived. See the new sources at http://svn.wp0.org/ocdocs/brian/occurlrefresh.cbl and http://svn.wp0.org/ocdocs/brian/Makefile.occurlrefresh Using the Makefile with [code] $ make -f Makefile.occurlrefresh [/code] will rebuild occurlrefresh with a check for the dependencies of http://svn.wp0.org/ocdocs/brian/occurlsym.cpy and http://svn.wp0.org/ocdocs/brian/occurl.c As usual, this app requires libcurl and libcurl-dev packages. Cheers, Brian ---------------------------------------------------------------- It's very important to be able to set additional configure flags, for example the patchlevel or different isam use. Is this currently possible with the source mentioned? ---------------------------------------------------------------- human; Not with this cut, no. I might take one more kick at this app to include John's far more powerful command line argument handling idiom than the code that is used in this utility. I just coded this change to save a few keystrokes on my normal fetch and build sequence. Customizing for a particular setup wouldn't be hard. Just change the call "SYSTEM" line (which, by the way, uses the new CONCATENATE intrinsic; very handy, and a good suggestion human, thanks for that). Anyone that doesn't like to recompile as often as that may require, could change the call "SYSTEM" to execute an external script and localize the changes there. And a testament to Roger; this build sequence doesn't have any real error handling mechanics. The pre-release tarball always just works here so there is never a chance to learn what to do when things go sideways, having never gone sideways. ;) Cheers ---------------------------------------------------------------- Subject: MinGW, OC 1.1, cobc.c:477: error: `SIGHUP' undeclared (first use in this function) G'day everyone I'm trying to build OC 1.1 on MinGW. The following is the output from configure and from make. Toward the bottom of the make run are a number of errors that I, in my newbie-ishness, don't understand, namely: cobc.c: In function `cobc_sig_handler': cobc.c:477: error: `SIGHUP' undeclared (first use in this function) cobc.c:477: error: (Each undeclared identifier is reported only once cobc.c:477: error: for each function it appears in.) cobc.c:487: error: `SIGQUIT' undeclared (first use in this function) cobc.c: In function `main': cobc.c:1672: error: `SIGHUP' undeclared (first use in this function) cobc.c:1675: error: `SIGQUIT' undeclared (first use in this function) What am I not doing right? Kind regards, Bruce. Bruce@BABEL-ISH ~/open-cobol-1.1 $ ./configure --prefix=/mingw checking for a BSD-compatible install... /bin/install -c checking whether build environment is sane... yes checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether to enable maintainer-specific portions of Makefiles... no checking for gcc... gcc checking for C compiler default output file name... a.exe checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... .exe checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking how to run the C preprocessor... gcc -E checking for egrep... grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking whether ln -s works... yes checking for a BSD-compatible install... /bin/install -c checking build system type... i686-pc-mingw32 checking host system type... i686-pc-mingw32 checking for a sed that does not truncate output... /bin/sed checking for ld used by gcc... c:/MinGW/mingw32/bin/ld.exe checking if the linker (c:/MinGW/mingw32/bin/ld.exe) is GNU ld... yes checking for c:/MinGW/mingw32/bin/ld.exe option to reload object files... -r checking for BSD-compatible nm... /mingw/bin/nm checking how to recognize dependent libraries... file_magic file format pei*-i386(.*architecture: i386)? checking for dlltool... dlltool checking for as... as checking for objdump... objdump checking dlfcn.h usability... no checking dlfcn.h presence... no checking for dlfcn.h... no checking the maximum length of command line arguments... 8192 checking command to parse /mingw/bin/nm output from gcc object... ok checking for objdir... .libs checking for ar... ar checking for ranlib... ranlib checking for strip... strip checking if gcc supports -fno-rtti -fno-exceptions... no checking for gcc option to produce PIC... -DDLL_EXPORT checking if gcc PIC flag -DDLL_EXPORT works... yes checking if gcc static flag -static works... yes checking if gcc supports -c -o file.o... yes checking whether the gcc linker (c:/MinGW/mingw32/bin/ld.exe) supports shared libraries... yes checking whether -lc should be explicitly linked in... yes checking dynamic linker characteristics... Win32 ld.exe checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes configure: creating libtool checking whether make sets $(MAKE)... (cached) yes checking for ANSI C header files... (cached) yes checking for stdint.h... (cached) yes checking for sys/types.h... (cached) yes checking signal.h usability... yes checking signal.h presence... yes checking for signal.h... yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking malloc.h usability... yes checking malloc.h presence... yes checking for malloc.h... yes checking locale.h usability... yes checking locale.h presence... yes checking for locale.h... yes checking stddef.h usability... yes checking stddef.h presence... yes checking for stddef.h... yes checking wchar.h usability... yes checking wchar.h presence... yes checking for wchar.h... yes checking for dlfcn.h... (cached) no checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking for an ANSI C-conforming const... yes checking whether byte ordering is bigendian... no checking for size_t... yes checking whether struct tm is in sys/time.h or time.h... time.h checking for working alloca.h... no checking for alloca... yes checking for vprintf... yes checking for _doprnt... no checking for memmove... yes checking for memset... yes checking for setlocale... yes checking for fcntl... no checking for strerror... yes checking for strcasecmp... yes checking for strchr... yes checking for strrchr... yes checking for strdup... yes checking for strstr... yes checking for strtol... yes checking for gettimeofday... yes checking for ld used by GCC... c:/MinGW/mingw32/bin/ld.exe checking if the linker (c:/MinGW/mingw32/bin/ld.exe) is GNU ld... yes checking for shared library run path origin... done checking for iconv... no, consider installing GNU libiconv checking for nl_langinfo and CODESET... no checking for getopt_long_only... no checking gmp.h usability... yes checking gmp.h presence... yes checking for gmp.h... yes checking for __gmp_randinit in -lgmp... yes checking for nanosleep in -lrt... no checking for nanosleep in -lposix4... no checking whether NLS is requested... yes checking for msgfmt... no checking for gmsgfmt... : checking for xgettext... no checking for msgmerge... no checking whether NLS is requested... yes checking for GNU gettext in libc... no checking for iconv... (cached) no, consider installing GNU libiconv checking for GNU gettext in libintl... no checking whether to use NLS... no checking for initscr in -lncurses... no checking for initscr in -lpdcurses... yes checking pdcurses.h usability... yes checking pdcurses.h presence... yes checking for pdcurses.h... yes checking for BDB db.h version >= 4.1 ... yes (4.7) checking for BDB 4.1 compatibility in db ... yes configure: creating ./config.status config.status: creating cob-config config.status: creating Makefile config.status: creating lib/Makefile config.status: creating libcob/Makefile config.status: creating cobc/Makefile config.status: creating bin/Makefile config.status: creating po/Makefile.in config.status: creating texi/Makefile config.status: creating config/Makefile config.status: creating copy/Makefile config.status: creating tests/atlocal config.status: creating tests/Makefile config.status: creating tests/cobol85/Makefile config.status: creating config.h config.status: config.h is unchanged config.status: executing tests/atconfig commands config.status: executing depfiles commands config.status: executing default-1 commands config.status: creating po/POTFILES config.status: creating po/Makefile OpenCOBOL Configuration: CC gcc COB_CC gcc CFLAGS -O2 -march=i686 -mtune=pentium3 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k COB_CFLAGS -I/mingw/include COB_EXTRA_FLAGS -march=i686 -mtune=pentium3 LDFLAGS COB_LDFLAGS COB_LIBS -L${exec_prefix}/lib -lcob -lm -lgmp -lpdcurses -ldb COB_CONFIG_DIR ${prefix}/share/open-cobol/config COB_COPY_DIR ${prefix}/share/open-cobol/copy COB_LIBRARY_PATH ${exec_prefix}/lib/open-cobol COB_MODULE_EXT dll COB_SHARED_OPT -shared COB_PIC_FLAGS -DDLL_EXPORT -DPIC COB_EXPORT_DYN -Wl,--export-all-symbols -Wl,--enable-auto-import COB_STRIP_CMD strip --strip-unneeded Dynamic loading System Use gettext for international messages: no Use Berkeley DB for file I/O: yes Use enhanced Berkeley DB (>= 4.1) yes Use fcntl for file locking: no Use ncurses/pdcurses/curses for screen I/O: pdcurses Bruce@BABEL-ISH ~/open-cobol-1.1 $ make Creating defaults.h... make all-recursive make[1]: Entering directory `/home/Bruce/open-cobol-1.1' Making all in lib make[2]: Entering directory `/home/Bruce/open-cobol-1.1/lib' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/home/Bruce/open-cobol-1.1/lib' Making all in libcob make[2]: Entering directory `/home/Bruce/open-cobol-1.1/libcob' if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium3 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF ".deps/libcob_la-common.Tpo" -c -o libcob_la-common.lo `test -f 'common.c' || echo './'`common.c; \ then mv -f ".deps/libcob_la-common.Tpo" ".deps/libcob_la-common.Plo"; else rm -f ".deps/libcob_la-common.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium3 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF .deps/libcob_la-common.Tpo -c common.c -DDLL_EXPORT -DPIC -o .libs/libcob_la-common.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium3 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF .deps/libcob_la-common.Tpo -c common.c -o libcob_la-common.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium3 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF ".deps/libcob_la-call.Tpo" -c -o libcob_la-call.lo `test -f 'call.c' || echo './'`call.c; \ then mv -f ".deps/libcob_la-call.Tpo" ".deps/libcob_la-call.Plo"; else rm -f ".deps/libcob_la-call.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium3 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF .deps/libcob_la-call.Tpo -c call.c -DDLL_EXPORT -DPIC -o .libs/libcob_la-call.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium3 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF .deps/libcob_la-call.Tpo -c call.c -o libcob_la-call.o >/dev/null 2>&1 /bin/sh ../libtool --tag=CC --mode=link gcc -O2 -march=i686 -mtune=pentium3 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -Wl,--export-all-symbols -Wl,--enable-auto-import -o libcob.la -rpath /mingw/lib -version-info 1:0:0 -no-undefined libcob_la-common.lo libcob_la-call.lo libcob_la-strings.lo libcob_la-move.lo libcob_la-numeric.lo libcob_la-intrinsic.lo libcob_la-fileio.lo libcob_la-termio.lo libcob_la-screenio.lo -lm -lgmp -lpdcurses -ldb rm -fr .libs/libcob.a .libs/libcob.dll.a .libs/libcob.la .libs/libcob.lai gcc -shared .libs/libcob_la-common.o .libs/libcob_la-call.o .libs/libcob_la-strings.o .libs/libcob_la-move.o .libs/libcob_la-numeric.o .libs/libcob_la-intrinsic.o .libs/libcob_la-fileio.o .libs/libcob_la-termio.o .libs/libcob_la-screenio.o /mingw/lib/libgmp.dll.a -lpdcurses -ldb -march=i686 -mtune=pentium3 -Wl,--export-all-symbols -Wl,--enable-auto-import -o .libs/libcob-1.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libcob.dll.a Creating library file: .libs/libcob.dll.a ar cru .libs/libcob.a libcob_la-common.o libcob_la-call.o libcob_la-strings.o libcob_la-move.o libcob_la-numeric.o libcob_la-intrinsic.o libcob_la-fileio.o libcob_la-termio.o libcob_la-screenio.o ranlib .libs/libcob.a creating libcob.la (cd .libs && rm -f libcob.la && ln -s ../libcob.la libcob.la) make[2]: Leaving directory `/home/Bruce/open-cobol-1.1/libcob' Making all in cobc make[2]: Entering directory `/home/Bruce/open-cobol-1.1/cobc' make all-am make[3]: Entering directory `/home/Bruce/open-cobol-1.1/cobc' if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium3 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-cobc.o -MD -MP -MF ".deps/cobc-cobc.Tpo" -c -o cobc-cobc.o `test -f 'cobc.c' || echo './'`cobc.c; \ then mv -f ".deps/cobc-cobc.Tpo" ".deps/cobc-cobc.Po"; else rm -f ".deps/cobc-cobc.Tpo"; exit 1; fi cobc.c: In function `cobc_sig_handler': cobc.c:477: error: `SIGHUP' undeclared (first use in this function) cobc.c:477: error: (Each undeclared identifier is reported only once cobc.c:477: error: for each function it appears in.) cobc.c:487: error: `SIGQUIT' undeclared (first use in this function) cobc.c: In function `main': cobc.c:1672: error: `SIGHUP' undeclared (first use in this function) cobc.c:1675: error: `SIGQUIT' undeclared (first use in this function) make[3]: *** [cobc-cobc.o] Error 1 make[3]: Leaving directory `/home/Bruce/open-cobol-1.1/cobc' make[2]: *** [all] Error 2 make[2]: Leaving directory `/home/Bruce/open-cobol-1.1/cobc' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/Bruce/open-cobol-1.1' make: *** [all] Error 2 ---------------------------------------------------------------- That should be fixed in the current 1.1 tarball. Roger ---------------------------------------------------------------- Subject: Executables First off I would like to say that the people who developed OpenCOBOL are awesome. I just started learning it in school and we are using NetExpress at school but I am using it here at home both in Windows XP and Ubuntu. My only question is this though. When I try to run an .exe file on XP outside of the OpenCOBOL folder that I have all the files stored in, it asks me for all the OpenCOBOL .dll files (libcob. libgmp). Why is this? ---------------------------------------------------------------- Hello and welcome to the forum. To your question: It's because the runtime is linked to the exe-files (don't forget: OC generates C-Code). It should be possible to include them into the .exe-file but this will blow the size of your program. Best solution: Ship the dll's along with your program. Keep them in the same folder where your exe-files are or put them into Windows\system32 (if you put them there you shouldn't forget to renew them if you use a newer OC version). How do you generate the exe-files on windows (Cygwin/Mingw/VC)? What OC-Version do you use (cobc --version)? human ---------------------------------------------------------------- As far as I know (and I don't as I didn't try it) Windows uses PATH when it looks for DLLs. LoadLibrary will look in the current dir, the system dirs and then PATH. Under Cygwin; LD_LIBRARY_PATH works as it should. There is also COB_LIBRARY_PATH for OpenCOBOL and to preload COB_PRE_LOAD. Cheers, Brian ---------------------------------------------------------------- I use the OpenCOBOL made by that Kiska person that was ported to windows. So it uses the cl.exe C compiler. Tell me how you would link the runtime files into the exe file. I dont care about size. ---------------------------------------------------------------- How do I add the DLL directly to the executables? ---------------------------------------------------------------- Umm; it's not really recommended but; run [b]depends[/b] and then zip any .DLL files or other dependencies that aren't part of Windows. One of the problems in breach of licence so do show care. or you could look to a third party tool along the lines of AppPackager or other bundle builder, but again I wouldn't recommend it. or Find an installer maker something like http://www.advancedinstaller.com/ [b]Warning:[/b] I don't run these so I have zero experience. Don't take the links I gave verbatim; but google up on Windows bundle maker, Windows Installer maker, look into the ZIP options. There is a high risk of breaching a licence here. No worries for libcob.dll as it's LGPL but any other dependencies will have to be carefully examined before risking redistribution. Did I mention the risk of bundling a file that you're not allowed to enough times? ;) Another option is to figure out and document instructions for your customer to do their own installs. Cheers, Brian ---------------------------------------------------------------- Subject: What packages are needed with Cygwin? This may be answered some place, but I haven't found it yet. When one does the initial install of Cygwin, as is documented, it doesn't install many "packages". (For example, it doens't see to install any gcc compiler). Is there a list somewhere of what "packages" should be added if one wants to install and use OpenCOBOL? Again, sorry if this is answered somewhere, but it wasn't in any of the logical places that I could think of. ---------------------------------------------------------------- Try the logical "README" under Requirements. Please install a c-Compiler, too, it's missing there. Then download the latest tar and start the installation procedure. OC will tell you what's missing and abort the installation. human ---------------------------------------------------------------- I am not close to being able to download OpenCOBOL and try it. I am still trying to download and install the OTHER things that the README tells me to download. When I went for gmplib (the first thing), that told me that I needed the c compiler, then M4, then Make. With those, I was able to get gmplib and libtools. Soon I'll try Betkley database and see what it needs. I'm keeping track so HOPEFULLY, I can create a "usefuL' file for Windows people (who don't know Unix/Linux) to install. ---------------------------------------------------------------- That's maybe a good idea. ---------------------------------------------------------------- Subject: Solved (sort of) - Reading from command line as a file (Oracle, Pro*Cobol, SCT Banner) I am trying to find out if OpenCobol can be used as the Cobol compiler for an Oracle Pro*Cobol application that is part of a big application suite called "Banner". Banner uses about two dozen Pro*Cobol apps in its collection, and presently I am running it on IBM RS6000/AIX with a Microfocus Cobol compiler. I'm trying to port this whole system over to a Linux box, and have set up an AMD 64-bit test server running Oracle Enterprise Linux (RHEL-variant) with Oracle 11g, all 64-bit. I've finally conjured up a makefile that will build the cobol apps, compile and link everything up successfully as 64-bit apps, but when invoking these newly compiled programs, they do load and begin to start up, but I cannot get them to read in any of the command line parameters that are passed in at run time. All of these programs share a common module that is supposed to read the command line parms and parse them up by opening up a file called "CMDFILE". When all these Cobol progs are built on the AIX box using MF Cobol and Oracle 9.2 Pro*Cobol, this file called "CMDFILE" never seems to exist as an actual file in the operating system, but seems to be some nebulous thing that just magically comes into existance at runtime and is known only within the running program itself. When the program is compiled and run upon the Linux/OpenCobol/Pro*Cobol box, it is looking now for a file literally named "CMDFILE" in the local directory of the file system. On the AIX box, the program just seems to magically get the command line parameter string stuffed into a phantom file that the program is simply able to open up and read from and use. Typically the command line parms are nothing more than the oracle username and password that the program needs to use to connect to the database, like this: $my_progname netman/mypassword and the program connects and runs. On the Linux box, they all fail to log into the database because the user/passwd string is blank. Is this mysterious CMDFILE thing some kind of Microfocus reserved keyword and built-in function kind of deal? Has anyone here encountered this before, or have been able to get OpenCobol to work with Oracle Pro*Cobol and the Banner software on Linux? I'm not very experienced with Cobol programming, but have some minimal clue in getting Cobol progs to work, but I've looked thru all the Banner source code modules high and low, and cannot for the life of me figure out how the contents of the unix command line parms are getting dumped into a file that the program is able to reference as CMDFILE and make use of. If anyone here can offer any help, I'd be very grateful. The only two Cobol compilers that the Banner vendor officially supports on Linux are MF and Fujitsu.... and MF is horribly showstopper overpriced, and Fujitsu does not offer a 64-bit Linux compiler, only a 32-bit. If OpenCobol can be made to work with Banner, it would be a great benefit to Banner users worldwide and another victory for Open Source! ---------------------------------------------------------------- netman; Sorry, don't know much about CMDFILE and it turns out to be a fairly lousy google search word as everyone seems to have a cmdfile, being a filename for all kinds of batch jobs, job control, Rexx, DDNAMEs etc... But; for access to command line arguments and environment variables with OpenCOBOL, we had a discussion a while back at http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=419&forum=1#forumpost2242 and it includes some great pointers for getting at arguments and an awesome code idiom for parsing through optional and position independent arguments by our good John. Cheers, Brian ---------------------------------------------------------------- Please post the exact SELECT statement that refers to CMDFILE. Roger ---------------------------------------------------------------- The original unmodified code snippet from the INPUT-OUTPUT section on down to the end of the module is as follows: I did have to modify it a bit to get it to compile and run for testing with OpenCobol. Unmodified, it compiles with a "Warning: RECORD clause ignored for LINE SEQUENTIAL" and when ran, it errors out with a "libcob: File does not exist (STATUS = 35) File : '' " error. If I remove the ORGANIZATION IS LINE SEQUENTIAL clause, it compiles error free but runs with the same file does not exist error, so I then further modified the code to assign CMDFILE as external and made a file called CMDFILE in my local directory and filled it with my command line args. The program opens the file, as expected, and seems to parse it up correctly, but the Oracle connect fails with invalid user/pass even if I display out the contents of what it's passing to Oracle for login and they look OK. ----------------------------------------- INPUT-OUTPUT SECTION. FILE-CONTROL. * * THIS SELECT IS FOR THE FILE THAT IS CREATED BY OPERATING * SYSTEM SPECIFIC COMMAND OR EXEC PROCEDURES TO PASS * COMMAND LINE PARAMETERS TO A COBOL PROGRAM. * **************************************************************** ** UNIX FILE SELECTS **************************************************************** SELECT COMMAND-FILE ASSIGN TO CMDFILE ORGANIZATION IS LINE SEQUENTIAL. * DATA DIVISION. FILE SECTION. * * THIS FD DESCRIBES THE FILE THAT IS CREATED BY OPERATING * SYSTEM SPECIFIC COMMAND OR EXEC PROCEDURES TO PASS * COMMAND LINE PARAMETERS TO A COBOL PROGRAM. * FD COMMAND-FILE RECORD CONTAINS 255 CHARACTERS. 01 COMMAND-REC PICTURE X(255). * WORKING-STORAGE SECTION. EXEC SQL INCLUDE SQLCACOM END-EXEC. EXEC SQL INCLUDE SDECLARE END-EXEC. EXEC SQL INCLUDE EDECLARE END-EXEC. LINKAGE SECTION. 01 CMD-AREA. 05 CMD-LENGTH PIC S9(4) COMP. 05 CMD-LINE. 10 CMD-LINE-CHAR PIC X(01) OCCURS 255 TIMES. PROCEDURE DIVISION USING CMD-AREA. A000-START-PROG-SECT SECTION. A000-START-PROG. OPEN INPUT COMMAND-FILE. MOVE LOW-VALUES TO CMD-AREA. READ COMMAND-FILE INTO CMD-LINE AT END MOVE LOW-VALUES TO CMD-AREA. MOVE 256 TO CMD-LENGTH. A500-FIND-LAST-CHAR. SUBTRACT 1 FROM CMD-LENGTH. IF CMD-LENGTH < 1 GO TO A590-END. IF CMD-LINE-CHAR (CMD-LENGTH) = SPACE OR LOW-VALUE GO TO A500-FIND-LAST-CHAR. A590-END. CLOSE COMMAND-FILE. EXIT PROGRAM. ----------------------------------------------------- I cannot find anywhere in this module's source code, or in its includes where "CMDFILE" is getting referenced anywhere else. That's why I'm suspecting it must be a pseudo-file containing the command line parms and that is being provided by some kind of weird special extension of the 1996-vintage Microfocus compiler for AIX. Since it looks like all that I really need to do to get a successful Oracle login is get the command line contents into the "CMD-AREA" linkage variable, I may just try to re-write this code to use the methods of: ACCEPT STUFF FROM COMMAND-LINE or ACCEPT STUFF FROM ARGUMENT-VALUE to get the command line arguments into the linkage variable. A cobol program I've been using for testing, which uses this module is successfully connecting to Oracle whenever I manually hard-code the Oracle username and password while bypassing all the command-line reading stuff, so if I can get past this issue, I'll be ready for the next hurdle... which is GLOBAL storage. Many of the other Banner cobol progs make extensive use of Global, and I understand that OpenCobol 1.1 now has the first release of Global support built into it. ---------------------------------------------------------------- I finally discovered what was going on. I just found out I wasn't supposed to be running these Banner cobol executables directly from the command line. They're supposed to be run from within a unix shell wrapper instead, which builds all the command line stuff into a temporary file and then assigns a pseudo randomly generated filename into an environment variable named CMDFILE. Older versions of MF Cobol for AIX automatically look for and use the contents of a unix environment variable indirectly if it finds an env var name the same exact string as the filename in the cobol file select/assign statement if it cannot find a file named exactly with the same string. All I need to do now is fix all my assign statements to use something like "$CMDFILE" so it will get the filename to open from the contents of the env var, and then run my cobol progs from an appropriate unix shell wrapper. Boy, do I feel dumb now... but then I'm a C and Pascal programmer, and not a Cobol programmer... and only marginally familiar with this Banner software suite (the Cobol programmer who used to maintain it for us left for another job) and I only once had a Cobol programming class in college some 25 years ago and haven't touched it much since then. ---------------------------------------------------------------- Subject: Handy command for keeping up with what's going on Hello, If you are running a GNU/Linux box or similar [code]$ head `find . -name ChangeLog -print`[/code] from the open-cobol-1.1 build directory will give you a good clue on recent changes Roger has implemented in the 1.1 pre-release. [code]$ grep -A4 2009 `find . -name ChangeLog` | awk '{if (/ 31) { 420 cb_error (_("User defined name must be less than 32 characters")); 421 } [/code] to [code] 417 /* Check word length */ 418 wordlen = strlen (yytext); 419 if (wordlen > 31) { 420 cb_error (_("User defined name must be less than 32 characters: '%s'"), yytext); 421 } [/code] Given [code] 01 someprog-linkage. 05 filler pic 9 value 0. 88 someprog-begin-veryspecialthing-1 value 1. 88 someprog-begin-veryspecialthing-2 value 2. 88 someprog-begin-veryspecialthing-3 value 3. 88 someprog-dowork-and-add value 4. 88 someprog-output value 5. 88 someprog-output-record-and-entry value 6. [/code] [code] $ cobc -x dpc.cob dpc.cob:19: Error: User defined name must be less than 32 characters: 'someprog-begin-veryspecialthing-1' dpc.cob:20: Error: User defined name must be less than 32 characters: 'someprog-begin-veryspecialthing-2' dpc.cob:21: Error: User defined name must be less than 32 characters: 'someprog-begin-veryspecialthing-3' dpc.cob:24: Error: User defined name must be less than 32 characters: 'someprog-output-record-and-entry' [/code] so it's doable, but I wonder if it is really worthwhile? This will make it a multiline error if \n is used or (as it's a long identifier) exceed 80 column error output. The compiler already shows the file and line number. [code] $ cobc -x dpc.cob 2>errs.lis or $ cobc -x dpc.cob 2>&1 | tee errs.lis dpc.cob:19: Error: User defined name must be less than 32 characters dpc.cob:20: Error: User defined name must be less than 32 characters dpc.cob:21: Error: User defined name must be less than 32 characters dpc.cob:24: Error: User defined name must be less than 32 characters $ vim -q errs.lis [/code] Vim will dutifully start up right on the errorenous line 19. And then [b]:cn[/b] to travel to next error. Any editor that supports quickfix mode should have these features. [code] $ vim +19 dpc.cob [/code] will get you to the first line quickly as well. So ... it'll be up to whether Roger finds this worthwhile ... and he'll have my support either way. Cheers, Brian ---------------------------------------------------------------- Just two more "points of interest" when Roger decides what should be done about this (if anything): 1) When std=85 is on, the message should occur for COBOL words that are 31 characters (as well as for those 32 and larger). (See substantive change listed above). 2) As I recall, when I was working for Micro Focus, one of the OTHER compilers (possibly AcuCOBOL or RM) actually "allowed" greater than 30 character user-defined words BUT truncated them to 30 characters - with a warning message. (This meant that user-defined words that "looked different" but were the same for the first 30 characters, would be treated as identical. Personally, I don't like that as an "extension" - but this is a warning that it might come up for some code migration projects. ---------------------------------------------------------------- Micro Focus produces the following regardless of the dialect selected - [code] ** COBOL word contains more than 31 characters. Word truncated. [/code] Roger ---------------------------------------------------------------- This seems like MF would try to compile the file anyway (with the word truncated=warning, not an error). At the second occurs of a word containing more than 31 chars and only differ in the last I think there would be a compile error. [code] 01 someprog-linkage. 05 filler pic 9 value 0. 88 someprog-begin-veryspecialthing-1 value 1. 88 someprog-dowork-and-add value 4. 88 someprog-output value 5. 88 someprog-output-record-and-entry value 6.[/code] should be fine [code] 01 someprog-linkage. 05 filler pic 9 value 0. 88 someprog-begin-veryspecialthing-1 value 1. 88 someprog-begin-veryspecialthing-2 value 2.[/code] should lead to "someprog-begin-veryspecialthing-" was defined already. btiffins patch seems fine (producing a multiline-error with \n). What do you think of taking it into OC source? What do you think of truncating the word and put out a warning (as MF seems to do it)? human ---------------------------------------------------------------- Subject: Problems with cobc -Wlinkage $ cobc -Wlinkage -fsyntax-only TESTPGM.CBL [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. 'TESTPGM'. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. DATA DIVISION. * WORKING-STORAGE SECTION. * *----------------------------------------------------------------- LINKAGE SECTION. 01 mynumber pic 9(02). 01 filler redefines mynumber. 05 mynumber-x pic x(02). *----------------------------------------------------------------- PROCEDURE DIVISION using mynumber. *----------------------------------------------------------------- main section. 00. stop run * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program TESTPGM --------------------------------------[/code] Leads to [quote]TESTPGM.CBL:22: Warning: LINKAGE item 'WORK$1' is not a PROCEDURE USING parameter[/quote] Because of the 01 filler (WORK$1) is only a redefine from mynumber, this shouldn't occur, should it? human ---------------------------------------------------------------- Correct. Fixed. Roger ---------------------------------------------------------------- Subject: GCC path Ok so I know how to compile the source code in Cygwin just fine and it works well in there. But I now want to be able to use the cobc compiler I made in cygwin to be able to use in windows command prompt. Everything works ok except when it trys to compile through GCC, it keeps looking for the cygwin direct cygdrive/c/documents and settings.... and so on. How do I tell GCC to look in C:\Documents and Settings instead of cygdrive/c/documents and settings. Is there something I need to specify when I run ./configure in cygwin to point GCC to the right directory? ---------------------------------------------------------------- Will not work. Cygwin is NOT native Windows. Refer to the FAQ at the Cygwin site. Roger ---------------------------------------------------------------- Maybe you should/could use mingw - the created exe files should run without cygwin.dll's etc. But I don't know if your problem is solved by using mingw :-? ---------------------------------------------------------------- Alright well i figured out my own problem and if anyone wants the step by step solution how I figured it out I will post instructions. I basically compiled the OC source code in MSYS with the ./configure --prefix=C:/Mingw. It now works perfectly natively in Windows without any problems. ---------------------------------------------------------------- Yes please on the details. If they are suitable for general consumption I'll make an entry in the FAQ/Manual. Good stuff. Cheers, Brian ---------------------------------------------------------------- Subject: Makefile sample for OpenCOBOL 1.1 COBOL sources Hello, Another post with the intention of starting a discussion. Here is a sample Makefile for Programming in the Small OpenCOBOL projects. The top bits are generic rules for [code] $ make hello [/code] given hello.cob will compile an executable hello (any .cob filename will work; [b]$ make myprog[/b]) $ make hello $ make hello.so - create a DSO suitable for cobcrun $ make hello.o - create an object file $ make hello.c - leave the C code $ make hello.s - leave the assembly code the bottom bits are highly personal $ make hello.q - run a compile pass; on failure call up vim in [i]quickfix mode[/i] which defaults to using errors.err $ make hello.i - run and save temp files to tmps; tmps is left hanging around $ make hello.lst - run an object compile, save the temps and then run Vincent's ever cool CobXref utility. $ make occurlrefresh - encapsulate the tectonics for the routine to fetch and build current 1.1 pre-release tarball. The .q is a hack extension to trigger the quickfix mode; for example, no .q file is produced. occurlrefresh only checks the dependency of the occurl.c sources and will ignore a fresher .o if it was created outside the make sequence. A real Makefile for occurlrefresh would link the dependency of the .c to the .o, etc... [b]Makefile[/b] [code] # OpenCOBOL rules COBCWARN = -W # create an executable %: %.cob cobc $(COBCWARN) -x $^ -o $@ # create a dynamic module %.so: %.cob cobc $(COBCWARN) -m $^ -o $@ # create a linkable object %.o: %.cob cobc $(COBCWARN) -c $^ -o $@ # generate C code %.c: %.cob cobc $(COBCWARN) -C $^ # generate assembly %.s: %.cob cobc $(COBCWARN) -S $^ # generate intermediate suitable for cobxref %.i: %.cob [ -d tmps ] || mkdir tmps cobc $(COBCWARN) --save-temps=tmps -c $^ # hack extension; create an executable; capture errors, call vim in quickfix %.q: %.cob cobc $(COBCWARN) -x $^ 2>errors.err || vi -q # run cobxref and get a cross reference listing (leaves tmps dir around) %.lst: %.cob [ -d tmps ] || mkdir tmps cobc $(COBCWARN) --save-temps=tmps -c $^ -o tmps/$*.o && ./cobxref tmps/$*.i # tectonics for occurlrefresh occurlrefresh: occurl.c occurlsym.cpy occurlrefresh.cbl cobc -c -Wall occurl.c cobc -x -lcurl occurlrefresh.cbl occurl.o [/code] Comments and criticisms welcome. This is by no means an optimized Makefile, nor will it likely work on non GNU/Linux boxen. It's objective is to get people talking. Change the COBCWARN to fit your own warning preferences for instance. Cheers, Brian ---------------------------------------------------------------- Subject: OpenCOBOL for windows! Ok so I have finally figured out how to make OC run natively in windows with MinGW already installed. Here are the steps. [u][b]First[/b][/u] Please install MinGW with full installation type with default directory selected (C:\MinGW). After MinGW has been installed, please install MSYS in order to have a bash shell environment for creating the executable. [u][b]Second[/b][/u] Please go to this website to download the already compiled versions of GMP, DB 4.5, gettext, libiconv, and PDcurses. The link is http://opencobol.no-ip.org/download.html under MinGW binary. Now the OpenCOBOL binary on the website has been configured for Cygwin so do not download that. [u][b]Third[/b][/u] After you have downloaded the necessary libraries from the website, please extract the contents from each folder in the zip file to there respective folders under the C:\MinGW directory. So everything that is in the [b]bin[/b] folder in a zip file will go inside the bin folder under the C:\MinGW directory. Do this for each folder, [b]lib[/b],[b]include[/b], etc... [b]Fourth[/b] Now please download the source code for OpenCOBOL 1.0 from this website and extract it to your desktop or wherever you save your files. Now open up MSYS. Change your directory to where you have extracted the OpenCOBOL source folder (cd C:\... wherever you saved it). Now run the configure command with the prefix option ./configure --prefix=C:/MinGW At this point the program will produce all the correct Makefiles and cob-configs to be run under windows. Now the only error I have gotten after running configure was that it told me I didn't have fnctl for "file locking". To be honest I have no idea what that is but if someone could tell me I would appreciate it. As far as I know i have ran COBOL source code that reads and write files and it works fine. After configure is finished then just do the Make Make install commands and you are done. I did get one error telling me after the make command saying it couldn't create cobcrun.exe but I have never used it so I didn't see that being a big problem for me. Just double check to make sure that the cobc.exe binary is under your C:\MinGW\bin directory and if it is you are all good. From there I would just add the C:\MinGW\bin directory to your Path variable in windows so you can compile straight from command prompt in any directory. Well that concludes this tutorial. If anyone has any comments or questions e-mail me at player51@comcast.net Thank You. ---------------------------------------------------------------- Sorry forgot two things after trying to follow my install guide myself. You will have to make a folder called open-cobol under the C:\MinGW\share directory and place the config folder from your original source code directory. Also for some reason beyond me the libcob.h folder doesnt get copied into the include folder under MinGW directory, so you also have to make a copy of that from your source code directory and copy it into the C:\MinGW\include folder. Sorry about that. Again please e-mail for any other problems. player51@comcast.net ---------------------------------------------------------------- Followed your install keep getting error when I try to run configure checking for gmp.h... no configure: error: gmp.h is required gmp.h is in the \MinGW\include folder also in your second post you say:- "Also for some reason beyond me the libcob.h folder doesnt get copied into the include folder under MinGW directory, so you also have to make a copy of that from your source code directory and copy it into the C:\MinGW\include folder" I take it you are talking about the libcob.h file in the in the root folder of open-cobol-1.0 and this refers to the following so do we copy libcob.h file and the libcob folder into the \MinGW\include folder Dave ---------------------------------------------------------------- Yes you do copy that into the include folder. As for the gmp.h problem I dont know why you are getting that error. ---------------------------------------------------------------- Thanks for the reply. I still haven't sorted the gmp.h issue, may download again and try that. Dave ---------------------------------------------------------------- Subject: ocdoc sample (and ocfaq now) in colour Hello, I've been experimenting with a Pygments lexer for adding colour highlighting to ReStructuredText OpenCOBOL source code listings. Sample at http://opencobol.add1tocobol.com/ocdoc.html sourced by ./ocdoc against it's own sources http://opencobol.add1tocobol.com/ocdoc.cob and it now includes a CobXref listing to get used to that nifty utility. Note the syntax lexer still has bugs; Python word boundaries include hyphen so things like [b]source-record[/b] look like two keywords and not a user defined entity. That'll be fixed once I get a suitable regex replacement for \b figured out for start-of-word and end-of-word. Cheers, Brian ---------------------------------------------------------------- Looks nice. What you haven't mentioned yet is that that OC Manual has the same highlighting (this is quite cool). Is there any possibility to add this to a forum syntax highlighting? human ---------------------------------------------------------------- Updated the Subject header. ;) So, so everyone knows; the FAQ link on the left sidebar of the opencobol.org page now leads to a new (work in progress) colour syntax source codes faq file. Regrading the forums here, we don't really have a lot of control over opencobol.org and what gets plugged into the Xoops. We do have colour highlighting plugged into http://add1tocobol.com though. We updated a COBOL highlighter used by GeSHi for that one. The sample for ocdoc and the faq uses Pygments; a Python based highlighter, and I wrote the OpenCOBOL syntax lexer (which is why it's broken) ;) and then hooked that into our ReStructuredText handler. I'll get my head round more the regex required for OpenCOBOL over the next few days; so the highlighting will get better, or at least, suck less. Cheers, Brian ---------------------------------------------------------------- Subject: Problem(s) installing OC (1.1 pre-release) OK, I am trying to install OpenCOBOL 1.1. I have (with some effort) installed (in my Windows XP environment) - Cygwin - Libtool - gmplib - Berkley Database\ I think (but won't swear to it) that NOT running the "make clean" option, I have installed all the "development" libraries that I was supposed to. (At least, I couldn't find any documented options that I missed). So my questions (for my FAILED install) 1) Am I correct that the "latest" tarball is the one pointed to from the "download" or "openCOBOL 1..1 prerelease" "tabs" at the side of www.pencobol.org If not, where can/should I get the "latest" version? (I thought that Roger had sent out a note, but I couldn't easily find such) 2) the ./configure command is getting up to and thru verifigying that I have the proper ncurses stuff. However, it is complaining about: libdb is required I think that I hve correctly installed the Berkley database stuff. At least ./configure;make; and maake install - all worked OK. However, the version of Berkley that I downloaded was db-4.7.25 As I read the OC /configure, it looks like it may not be looking for numbbers that high (but I may be mistaken). I know there are porblems with "lower" levels, but is OC set up to run with 4.7.35? If not, what should I do? If it helps, under /cygwin/usr/local/BerkeleyDB.4.7\lib I have the following files: libdb-4.7.a libdb-4.7.dll.a libdb-4.7.l libdb.a - ---------------------------------------------------------------- Direct quote from the README - [code] Requirements ============ *** NOTE For all the following packages (required or optional), BOTH runtime AND development components are necessary. *** *** NOTE All the following packages are normally part of a Linux distribution. Cygwin also has these as installable packages ALWAYS install the distro packages when available !! *** [/code] I do not think I can get any more concise than that. Roger ---------------------------------------------------------------- Roger, What the README is NOT clear on (for Cygwin), is that you will have trouble if you do NOT use the Cygwin versions but instead try and use the later versions available from the sites that you talk about in the README for Unix/Linux users. to me [code]ALWAYS install the distro packages [/code] was NOT a statement about getting them from the Cygwin install. I don't know what a ""distro package" is and I assumed that it was something that there would be a "later and greater" version at the Libtool, gmp, and ncursses site. ---------------------------------------------------------------- NO. If you decide to install other than packaged versions then you MUST read the appropiate doc for that software. eg. BDB does NOT install (per default) into the usual default directories (refer to BDB doc). This is NOT a OC problem. The README is quite clear. Roger ---------------------------------------------------------------- Roger, You know what a "DISTRO package" is. Someone (like me) who is Windows users (using Cygwin), doesn't have the FOGGEST idea what that term means. The README is NOT clear to a Windows only person. If it said, something like "Always install these packages only via the Cygwin setup program" that would be clear to a Windows person. The "target audience" for Cygwin installs is NOT someone used to Unix/Linux or gcc terminology. ---------------------------------------------------------------- Sorry but I am not going into the semantics of what particular terminology is/means. The README is on a par with all other GNU stuff. If you have a problem with the term "package", then I suggest you mail the appropiate lists. Roger ---------------------------------------------------------------- Subject: unreachable/never called section Never called/performed section: [code] IDENTIFICATION DIVISION. *======================== PROGRAM-ID. TESTCOB . * STD AUTHOR. TEST. * ENVIRONMENT DIVISION. *===================== * CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. * DATA DIVISION. *============== * WORKING-STORAGE SECTION. *======================== * 01 TEST-A. 02 TEST-A1 PIC 9(03) VALUE ZERO. * LINKAGE SECTION. * PROCEDURE DIVISION. *========================================== * MAIN SECTION. * MAIN-1001. * MOVE 999 TO TEST-A1. * GO TO MAIN-1002. * MOVE 742 TO TEST-A1. * MAIN-1002. * STOP RUN. * SUB SECTION. * MOVE 123 TO TEST-A1. * EXIT SECTION. * [/code] cobc returns [code] C:/COB/SPE5A7~1.COB: In paragraph 'MAIN-1001': C:/COB/SPE5A7~1.COB:36: Warning: Unreachable statement [/code] But there is now warning about the section "SUB" (which is never called/performed). I think this is not an error, nut a nice to have feature :-D PS cobc buld from 01.02.2009 with param -W ---------------------------------------------------------------- At least at the moment we can not do code analysis :-) The "unreachable" is targeted only for imperative statement sequences. Roger ---------------------------------------------------------------- Subject: Simplest Screen Section problem If you do a Display / Acept loop of a scrren-name that only include literal (no FROM/TO/USING) it doesn't seem to "pause" on the Accept [code] Identification Division. Program-ID. test1. Environment Division. Data Division. Working-Storage Section. Screen Section. 01 ScrName Background-color 1 foreground-color 7. 05 aLine Column 2 Line 3 Pic X(12) Value "Hello World!". Procedure Division. Mainline. Perform 2 times Display ScrName Accept ScrName End-Perform GoBack. End Program test1. [/code] I was running with "TERM Cygwin" (under Cygwin) if this matters. Adding any USING item under ScrName causes the "pause" to occur. ---------------------------------------------------------------- There is nothing to ACCEPT therefore it's a noop. Roger ---------------------------------------------------------------- I'll try it with Micro Focus and/or Fujitsu, but I would EXPECT (according to the rules of the '02 Standard at least) that it would still wait until the operator [code]pressed a terminator key or a user-defined or context-dependent function key[/code] ---------------------------------------------------------------- Doesn't even compile with recent version of Micro Focus. Roger ---------------------------------------------------------------- Just to confirm that when compiled with Fujitsu (after removing the non-X/Open "PICTURE CLAUSE", did NOT do a "pause". Part of my confusion, I think, relates to the fact that when I run Accept/Display for Fujitsu, the "console" or "window" where it is done is separate from where I enter the command to run it. I have just started under Cygwin and don't know if there is (or will be) a better way to test Accept/Display/Screen Section programs. ---------------------------------------------------------------- Note that we do set an exception in this case. If the prog does not itself define a CRT STATUS, then OC will implicitly define a field for you - COB-CRT-STATUS. Various statuses and defines for colors are in a supplied copy element. Just add into the prog - [code] COPY screenio. [/code] Current contents of this file - [code] *> Colors 78 COB-COLOR-BLACK VALUE 0. 78 COB-COLOR-BLUE VALUE 1. 78 COB-COLOR-GREEN VALUE 2. 78 COB-COLOR-CYAN VALUE 3. 78 COB-COLOR-RED VALUE 4. 78 COB-COLOR-MAGENTA VALUE 5. 78 COB-COLOR-YELLOW VALUE 6. 78 COB-COLOR-WHITE VALUE 7. *> *> Values that may be returned in CRT STATUS (or COB-CRT-STATUS) *> Normal return - Value 0000 78 COB-SCR-OK VALUE 0. *> Function keys - Values 1xxx 78 COB-SCR-F1 VALUE 1001. 78 COB-SCR-F2 VALUE 1002. 78 COB-SCR-F3 VALUE 1003. 78 COB-SCR-F4 VALUE 1004. 78 COB-SCR-F5 VALUE 1005. 78 COB-SCR-F6 VALUE 1006. 78 COB-SCR-F7 VALUE 1007. 78 COB-SCR-F8 VALUE 1008. 78 COB-SCR-F9 VALUE 1009. 78 COB-SCR-F10 VALUE 1010. 78 COB-SCR-F11 VALUE 1011. 78 COB-SCR-F12 VALUE 1012. 78 COB-SCR-F13 VALUE 1013. 78 COB-SCR-F14 VALUE 1014. 78 COB-SCR-F15 VALUE 1015. 78 COB-SCR-F16 VALUE 1016. 78 COB-SCR-F17 VALUE 1017. 78 COB-SCR-F18 VALUE 1018. 78 COB-SCR-F19 VALUE 1019. 78 COB-SCR-F20 VALUE 1020. 78 COB-SCR-F21 VALUE 1021. 78 COB-SCR-F22 VALUE 1022. 78 COB-SCR-F23 VALUE 1023. 78 COB-SCR-F24 VALUE 1024. 78 COB-SCR-F25 VALUE 1025. 78 COB-SCR-F26 VALUE 1026. 78 COB-SCR-F27 VALUE 1027. 78 COB-SCR-F28 VALUE 1028. 78 COB-SCR-F29 VALUE 1029. 78 COB-SCR-F30 VALUE 1030. 78 COB-SCR-F31 VALUE 1031. 78 COB-SCR-F32 VALUE 1032. 78 COB-SCR-F33 VALUE 1033. 78 COB-SCR-F34 VALUE 1034. 78 COB-SCR-F35 VALUE 1035. 78 COB-SCR-F36 VALUE 1036. 78 COB-SCR-F37 VALUE 1037. 78 COB-SCR-F38 VALUE 1038. 78 COB-SCR-F39 VALUE 1039. 78 COB-SCR-F40 VALUE 1040. 78 COB-SCR-F41 VALUE 1041. 78 COB-SCR-F42 VALUE 1042. 78 COB-SCR-F43 VALUE 1043. 78 COB-SCR-F44 VALUE 1044. 78 COB-SCR-F45 VALUE 1045. 78 COB-SCR-F46 VALUE 1046. 78 COB-SCR-F47 VALUE 1047. 78 COB-SCR-F48 VALUE 1048. 78 COB-SCR-F49 VALUE 1049. 78 COB-SCR-F50 VALUE 1050. 78 COB-SCR-F51 VALUE 1051. 78 COB-SCR-F52 VALUE 1052. 78 COB-SCR-F53 VALUE 1053. 78 COB-SCR-F54 VALUE 1054. 78 COB-SCR-F55 VALUE 1055. 78 COB-SCR-F56 VALUE 1056. 78 COB-SCR-F57 VALUE 1057. 78 COB-SCR-F58 VALUE 1058. 78 COB-SCR-F59 VALUE 1059. 78 COB-SCR-F60 VALUE 1060. 78 COB-SCR-F61 VALUE 1061. 78 COB-SCR-F62 VALUE 1062. 78 COB-SCR-F63 VALUE 1063. 78 COB-SCR-F64 VALUE 1064. *> Exception keys - Values 2xxx 78 COB-SCR-PAGE_UP VALUE 2001. 78 COB-SCR-PAGE_DOWN VALUE 2002. 78 COB-SCR-KEY-UP VALUE 2003. 78 COB-SCR-KEY-DOWN VALUE 2004. 78 COB-SCR-ESC VALUE 2005. 78 COB-SCR-PRINT VALUE 2006. *> Input validation - Values 8xxx 78 COB-SCR-NO-FIELD VALUE 8000. *> Other errors - Values 9xxx 78 COB-SCR-FATAL VALUE 9000. [/code] In the test case, you will get a COB-SCR-NO-FIELD value. Roger ---------------------------------------------------------------- Subject: Compile Problem Hi, I have just installed OpenCOBOL. I am using Windows Vista and VC 2008 Express edition. I downloaded one prebuilt OpenCOBOL for windows. Now I was trying to compile Hello.COB. It could not find MSPDB80.dll at first. But later I copied that file to windows/system32 and then it didn't give that error. But this time it started giving a new error. Now It cannot find stdio.h. How do I fix this problem? Please help. Thanks ---------------------------------------------------------------- You have to change your path variable in windows. Its under Computer/ Properties/ Advanced Systems settings. You must add the directories in Microsoft Visual Studio 9/bin, Microsoft Visual Studio 9/include,Microsoft Visual Studio 9/lib, to your path variable values separated by semicolons; ---------------------------------------------------------------- Subject: Arithmetic overflow From the recursion routine sample that calculated [i]factorials[/i] using the RETURN-CODE, I thought it might be nice to show the real [i]FUNCTION FACTORIAL[/i] and one way to detect the overflow condition. [b]overflowing.cob[/b] [code] *> ** *> *************************************************************** *> Author: Brian Tiffin *> Date: 04-Feb-2009 *> Purpose: Factorial and overflow *> Tectonics: cobc -x overflowing.cob *> *************************************************************** identification division. program-id. overflowing. data division. working-storage section. 01 fact usage binary-long. 01 answer usage binary-double. *> *************************************************************** procedure division. 00-main. perform varying fact from 1 by 1 until fact > 21 add function factorial(fact) to zero giving answer on size error display "overflow at: " fact " is " answer " without test " function factorial(fact) end-display not on size error display fact ": " answer end-display end-add end-perform . 00-leave. goback. end program overflowing. *> *************************************************************** [/code] [b]output[/b] [code] +0000000001: +00000000000000000001 +0000000002: +00000000000000000002 +0000000003: +00000000000000000006 +0000000004: +00000000000000000024 +0000000005: +00000000000000000120 +0000000006: +00000000000000000720 +0000000007: +00000000000000005040 +0000000008: +00000000000000040320 +0000000009: +00000000000000362880 +0000000010: +00000000000003628800 +0000000011: +00000000000039916800 +0000000012: +00000000000479001600 +0000000013: +00000000006227020800 +0000000014: +00000000087178291200 +0000000015: +00000001307674368000 +0000000016: +00000020922789888000 +0000000017: +00000355687428096000 +0000000018: +00006402373705728000 +0000000019: +00121645100408832000 overflow at: +0000000020 is +00121645100408832000 without test 432902008176640000 overflow at: +0000000021 is +00121645100408832000 without test 197454024290336768 [/code] Cheers, Brian ---------------------------------------------------------------- Subject: Unexpected (incorrect?) FS=21 on WRITE of DYNAMIC relative file The following code compiles and runs "cleanly" on Fujitsu, but gets a FS=21 with OC. I don't think you should ever get a FS=21 for a relative file that is defined as ACCESS DYNAIMIC. [code] Identification Division. Program-Id. rfile1. Environment Division. Input-Output Section. File-Control. Select RelFile Assign RelName Access Dynamic Organization Relative Status Rel-FS Relative Key RelKey . Data Division. File Section. FD RelFile Record Varying in Size From 1 to 999 Depending on RelLen. 01 RelRec. 05 RR-Elem occurs 1 to 999 times Depending on RelLen Pic X(01). Working-Storage Section. 01 RF-Stuff. 05 RelName Pic X(08) Value "relftest". 05 Rel-FS Pic X(02). 88 RFS-OK Value "00". 88 RFS-DupKey Value "22". 05 RelKey Pic 9(03). 05 RelLen Pic 9(03). 01 TempStuff. 05 NumFld Pic 9(09)V9(09). Procedure Division. Mainline. Perform Create-File If RFS-OK Perform Read-File GoBack . Create-File. Open Output RelFile If RFS-OK Perform 10 times Compute RelKey NumFld = (Function Random) * 1000 Compute RelLen = Function Mod (RelKey 22) + 23 Move all "-" to RelRec Move Function Current-Date to RelRec (1:22) Write RelRec Invalid Key If not RFS-DupKey Display "Invalid Key, FS:" Rel-FS Exit Perform Else Display "Duplicate RelKey" End-If End-Write If (not RFS-OK) and (not RFS-DupKey) Display "Bad FS on WRITE:" Rel-FS End-If End-Perform Close RelFile Else Display "Bad FS on OPEN:" Rel-FS End-IF . Read-File. Open I-O RelFile Read RelFile Next If RFS-Ok Perform 10 Times Display RelRec Read RelFile Next At End Exit Perform End-Read End-Perform End-If Close RelFile . [/code] ---------------------------------------------------------------- I suspect what is happening is that you are getting 0 back from the RANDOM function (valid). I can not find a specific rule that states what the status should be when the relative key is less than 1 on a WRITE statement. OC produces 21. Micro Focus produces 23. Arguably neither is correct. It seems that none of the 2x, 3x, 4x statuses cover this. And I am sure you didn't really mean the following - [code] Perform Create-File If RFS-OK Perform Read-File GoBack . [/code] :-) ie. If Create-File is not OK, you fall through into it again :-) Roger ---------------------------------------------------------------- Interesting. When I "manually" testes with a relative key with Fujitsu, I get a "24", so this certainly is NOT well defined. I'll change the code to fix that - but probably need to do an official "interpretation request" to figure out what should happen. (I also added the missing End-If) Thanks ---------------------------------------------------------------- Yes, indeed. A clarification would be welcome. Incidentally, the 0 return from RANDOM is interesting. Does not usually happen. However, after some research it seems that the FIRST call to the underlying (standard) system rand() function is ALWAYS producing 0 under Cygwin. And ONLY under Cygwin. ie. It's doing it's own seeding. This is arguably wrong and there are a couple of threads mentioning this that I found by googling. Roger ---------------------------------------------------------------- Hm, should OC handle this and do allways two times rand() if used under cygwin? ---------------------------------------------------------------- I wouldn't mind a change and not getting zero. On the other hand, zero is perfectly valid, and, in this case, it showed me an error in my coding. A "good" unit test should always test for zero and all 9's (after the decimal point) which I hadn't done (yet ). However, it is nice to know that this (Cygwin and zero) is a "known issue". ---------------------------------------------------------------- Subject: Incorrect nested sub program behaviour (also posted to the mailing list, not sure if I should report there or on here) There is a problem with nested sub programs, they go wrong when named the same and it's causing major problems. Here are two small example programs: [code] identification division. program-id. prog1. data division. working-storage section. 01 myitems global. 03 myitem1 pic x(10). 03 myitem2 pic 9. procedure division. a-main1 section. move 'hello' to myitem1 move 8 to myitem2 display 'a-main1 prog1' display 'a-main1 myitem1 ' myitem1 display 'a-main1 myitem2 ' myitem2 call 'nestedprog' call 'prog2' call 'nestedprog' display 'bye' goback. identification division. program-id. nestedprog. procedure division. b-main1 section. display 'nestedprog in prog1' display 'nestedprog in prog1 myitem1 ' myitem1 display 'nestedprog in prog1 myitem2 ' myitem2 goback. end program nestedprog. end program prog1. [/code] and the other one [code] identification division. program-id. prog2. data division. working-storage section. 01 myitems global. 03 myitem1 pic x(10). 03 myitem2 pic 9. procedure division. a-main1 section. move 'goodbye' to myitem1 move 4 to myitem2 display 'a-main1 prog2' display 'a-main1 myitem1 ' myitem1 display 'a-main1 myitem2 ' myitem2 call 'nestedprog' display 'goback to prog1' goback. identification division. program-id. nestedprog. procedure division. b-main1 section. display 'nestedprog in prog2' display 'nestedprog in prog2 myitem1 ' myitem1 display 'nestedprog in prog2 myitem2 ' myitem2 goback. end program nestedprog. end program prog2. [/code] You can see that both programs contain a nested sub program named 'nestedprog' The problem is, when prog2 tries to call it's copy of 'nestedprog' open cobol runs the 'nestedprog' from prog1 instead. Worse, it uses the storage from prog1. Resulting in the following output: [quote] $ cobc prog1.cbl $ cobc prog2.cbl $ cobcrun prog1 a-main1 prog1 a-main1 myitem1 hello a-main1 myitem2 8 nestedprog in prog1 nestedprog in prog1 myitem1 hello nestedprog in prog1 myitem2 8 a-main1 prog2 a-main1 myitem1 goodbye a-main1 myitem2 4 nestedprog in prog1 nestedprog in prog1 myitem1 hello nestedprog in prog1 myitem2 8 goback to prog1 nestedprog in prog1 nestedprog in prog1 myitem1 hello nestedprog in prog1 myitem2 8 bye [/quote] So when you see "a-main1 prog2" we have moved goodbye and 4 to our storage, but when we call 'nestedprog' it goes off to prog1 and uses 'hello' and 8 again. This is not correct. Micro Focus Server Express runs the programs like this: [quote] $ cobrun ./prog1 a-main1 prog1 a-main1 myitem1 hello a-main1 myitem2 8 nestedprog in prog1 nestedprog in prog1 myitem1 hello nestedprog in prog1 myitem2 8 a-main1 prog2 a-main1 myitem1 goodbye a-main1 myitem2 4 nestedprog in prog2 nestedprog in prog2 myitem1 goodbye nestedprog in prog2 myitem2 4 goback to prog1 nestedprog in prog1 nestedprog in prog1 myitem1 hello nestedprog in prog1 myitem2 8 bye[/quote] ---------------------------------------------------------------- What results do you get if you do : cobc -x prog1.cbl cobc -c prog2.cbl ./prog1 ./prog2 ? ---------------------------------------------------------------- Assuming you mean -x on both: $ cobc -x prog1.cbl $ cobc -x prog2.cbl $ ./prog1 a-main1 prog1 a-main1 myitem1 hello a-main1 myitem2 8 nestedprog in prog1 nestedprog in prog1 myitem1 hello nestedprog in prog1 myitem2 8 libcob: Cannot find module 'prog2' $ ./prog2 a-main1 prog2 a-main1 myitem1 goodbye a-main1 myitem2 4 nestedprog in prog2 nestedprog in prog2 myitem1 goodbye nestedprog in prog2 myitem2 4 goback to prog1 A program can't CALL another module if it's compiled with -x so it's not really testing the same thing at all. prog2s nested subprogram runs correctly though, if it's not called from prog1. ---------------------------------------------------------------- Known problem. On my TODO list. There is not a "quick" solution for this. Roger ---------------------------------------------------------------- Okay thanks. I've been attempting to work around this by writing a processor in AWK that goes through each of our .cbl files and clobbers the first four characters of each nested sub program's program-id with the program-id of the main program (which will always be four characters). So in main program GYCA.cbl we see program-id. GYCA. Now in each of its nested subs I replace (for example) program-id. SYAZSERV-ADJUST-ADDR. with program-id. GYCASERV-ADJUST-ADDR. The next program, GYCB you'll see program-id. GYCBSERV-ADJUST-ADDR. for the same nested program. I change all the program-id, end-program and CALL lines. It's clunky and it takes a looooong time to run this awk on ~80,000,000 lines of code. It has allowed further testing to take place though, which is good. Correct nested sub program behaviour is really our biggest issue right now since even after my awk program I still seem to be having other issues which I haven't yet nailed down to a simple case. Your efforts in the world of Open COBOL are much appreicated. ---------------------------------------------------------------- Subject: Passing parameters from Cobol to C Hello OpenCoboler's As you've seen in former posts, I'm working with OC and Ncurses. So generally speaking I waist some time with pointers and others. Are the experimented hackers in OC AND C motivated enough to give me a canvas for passing values from a Cobol caller to a C program that can modify values when returning ? That will help me a lot to progress in my project and will freeze my (I should say "our") methodology. As an (old ;-)) Coboler, I never had the opportunity to use other languages. I really think that the answers of this post will interest the audience. Best regards Bear ---------------------------------------------------------------- Sorry Bear, missed this post. Check out http://opencobol.add1tocobol.com/#can-opencobol-interface-with-lua for some samples. And the FAQ will be updated soon with a whole section on this. I've been slow getting the promised PROCEDURE DIVISION USING BY VALUE docs up to speed and they ARE coming. http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=298&forum=1&post_id=2803#forumpost2803 has a sample on how to handle arrays of pointers to structs in the glib error message handler. The http://svn.wp0.org/ocdocs/brian/ocshell.c program has a procedure for passing functional pointers as well to get entry point call backs from C to COBOL procedures. Cheers, Brian ---------------------------------------------------------------- Thank you Brian, I hang up for a few week, having an eye on this forum, specially on "OC window management". I think that this post is a success, because it talks about how to get data into OC files ! I always asked myself how people using OC get their information into their system ... I'm in holidays for a week in the Vercors mounts, near Grenoble in France. In a couple of weeks I'll have special learning in XHTML, CSS and Javascript. Things are going better for me since my interest is growing each day for OC ! ... I'm always training with C. I hope that one of these days we can produce a stable solution for windowing thru a putty or other. Imagine OC running in a little company on a linux server with 20 - 25 window$ stations, and 7 printers. Thank you again, Regards François "Bear" Hiniger ---------------------------------------------------------------- Subject: General - Forum vs List So far, the only "problems" that I have found with OC have turned out to be user errors. I have seen this asked but I don't know if there really is a general answer. When someone has a "problem" with, should they post here, to the list, or both? ---------------------------------------------------------------- I think it depends on the audience you want. Some people like me only read the forum posts, not the mail list. So it is up to you where you want to have your questions answered. If you have solutions or important facts about OC, please post them here :-) ---------------------------------------------------------------- Subject: How to ignore case in END PROGRAM statement? I have found the compiler directives that handle "case folding" for COPY members, but I am getting an error message when there is (only) case differences between the PROGRAM-ID paragraph name (not in quotes) and the END PROGRAM statement. According to the Standard ('85 and '02), these are just "COBOL words" so case should not be significant. Testing under Fujitsu, shows that (by default) they ignore this. Is there a directive already to ignore differences for this? Minimal sample follows: [code] Identification Division. Program-ID. PgmCase. Data Division. Procedure Division. Mainline. Display "Hello World" GoBack. End Program PGMCASe. [/code] For Micro Focus users, there are 3 separate directives that deal with "case". They are: - Case - FOLD-CALL-NAME - FOLD-COPY-NAME When "dialect(ans85)" is specified, then - FOLDCALLNAME"UPPER" - FOLDCOPYNAME"UPPER" are turned on. (I don't see any change to CASE) ---------------------------------------------------------------- Do no replies mean there isn't any way to to this? ---------------------------------------------------------------- This is a work in progress as far as I know. There are efforts underway to allow PROGRAM-ID. prog. PROGRAM-ID. PROG. PROGRAM-ID. ProG. END PROGRAM ProG. END PROGRAM PROG. CALL "PROG" CALL "ProG" END PROGRAM prog. etc... so this handler is in a state of flux. Umm, if I was to guess, I would say that when it settles, the PROGRAM-ID and END PROGRAM will have to match. This is an exception (and a tad of a hairy one from what I seen) to the normal case insensitivity rules. More soon I'm sure. Cheers, Brian ---------------------------------------------------------------- OK, When things "settle down", there really needs to be an option for complete case INsensitivity - both for Program-ID and End Program and for CALL. That is why MF has fold"UPPER" for the ANSI defaults, This is required for ANSI conformance. ---------------------------------------------------------------- The following - [code] IDENTIFICATION DIVISION. PROGRAM-ID. PROG. PROCEDURE DIVISION. DISPLAY "First" END-DISPLAY. CALL "prog" END-CALL. STOP RUN. PROGRAM-ID. prog. PROCEDURE DIVISION. DISPLAY "Second" END-DISPLAY. EXIT PROGRAM. END PROGRAM prog. END PROGRAM PROG. [/code] compiled with Micro Focus (maximum warning level) and with/without ANS85, with/without CASE. with/without FOLD-CALL-NAME=UPPER (any combination of the three or none) - a) Produces no compile message whatsoever b) Executes as coded OC has never stated (and does not document) that it is "conformant" to anything. Roger ---------------------------------------------------------------- Try compiling that Micro Focus program with either of the following: [code] Dialect(ANS85) [/code] or [code]FLAGSTD(H) FLAGAS(S)[/code] The whole reason that the [code]AS "literal"[/code] was added to the Program-ID paragraph is so that you CAN have case sensitive program-names. As far as "claiming" conformance, why do you run the NIST tests if the goal isn't to be conforming? As a general rule, if you are trying to "test" whatMicro Focus thinks is "conforming" (to the '85 Standard), then you should compile with DIALECT(ANS85) - or at a minimum with FLAGSTD(H) and FLAGAS(S). ---------------------------------------------------------------- Which has the peculiar effect of producing - [code] END PROGRAM PROG. * 613-S**************** ** ** Invalid program name [/code] Somewhat cryptic. The majority of the NIST tests are not 85 specific. They test core COBOL functionality and, as such, are a useful (free) source for regression testing. Roger ---------------------------------------------------------------- Was the message with DIALECT(ANS85) or just the FLAGSTD directive set? As I say, for full "conformance checking", try the DIALECT directive. (If using an older verison of Micro Focus, you might find instead that the [code]DIR(WBANS85)[/code] is used instead. I'll try and bring up my MF compiler and see what I get. ---------------------------------------------------------------- However, This does not work in MF: [code] $set sourceformat"free" IDENTIFICATION DIVISION. PROGRAM-ID. MAIN. PROCEDURE DIVISION. DISPLAY "First" END-DISPLAY. CALL "prog" END-CALL. CALL "PROG" END-CALL. STOP RUN. PROGRAM-ID. prog. PROCEDURE DIVISION. DISPLAY "Second" END-DISPLAY. EXIT PROGRAM. END PROGRAM prog. PROGRAM-ID. PROG. PROCEDURE DIVISION. DISPLAY "Third" END-DISPLAY. EXIT PROGRAM. END PROGRAM PROG. END PROGRAM MAIN. [/code] For me it produces: First Second Second Leigh. ---------------------------------------------------------------- ... and OC (cobc -x -free -std-mf) gives: innertest.cob:22: Error: END PROGRAM 'PROG' is different to PROGRAM-ID 'prog' Leigh. ---------------------------------------------------------------- leigh9203; What version? Here with: [code] $ cobc -V cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Feb 23 2009 14:14:22 Packaged Feb 06 2009 10:30:55 CET [/code] I get [code] $ cobc -x -free -std=mf progs.cob $ ./progs First Second Third [/code] [i]After removing the $set line that is.[/i] This whole mixcased PROGRAM-ID is still in play, but it is more stable with the most recent. It is a fairly tricky special case of normal COBOL case insensitive name reference, but there shouldn't be too too many edge cases left over. Cheers, Brian ---------------------------------------------------------------- Ahh, yes. That version was the opencobol-1.1-win32-bin.zip from www dot kiska dot net. That version reports: [code] > cobc -V cobc (OpenCOBOL) 1.1.20080610 Copyright (C) 2001-2008 Keisuke Nishida / Roger While Built Dec 11 2008 11:19:55 Packaged Dec 08 2008 20:40:20 CET [/code] A different build that I did myself under Cygwin works as you report. That version is: [code] $ cobc -V cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Mar 06 2009 20:35:15 Packaged Feb 06 2009 10:30:55 CET [/code] Obviously, as you say, things are fluid in that area right now. Regards, Leigh. ---------------------------------------------------------------- Subject: Specifying directives within source code Several (many?) COBOL compilers have a way of specifying compiler directives within the COBOL source code (before the first Identification Division header). See for example: [url=http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3lr40/8.1.2]http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3lr40/8.1.2[/url] Does OC have such a feature? For production/maintenance type code, this is helpful for making certain that a program is always compiled with the correct/same options. For testing, it is "nice" to be able to change options within source code to know which options (default and otherwise) that you have tested. ---------------------------------------------------------------- The only directives I know about can be found at [url=http://opencobol.add1tocobol.com/ocfaq.html]OC FAQ[/url]: Source Format and Debug (for free format) ---------------------------------------------------------------- I am not asking about just the new "direcives" defined in the '02 Standard, but any compiler option. Like the Micro Focus $SET statement ---------------------------------------------------------------- Subject: Question about Roger's ToDo-List and CVS Is there a possibility to view Rogers ToDo-list? (All points he wants to change later?) ---------------------------------------------------------------- Is there a way to access Roger's CVS? (only anonymous read transactions, of course) ---------------------------------------------------------------- human; I don't know what your freetime is like, but Roger frequents the irc.freenode.net #add1tocobol channel most Sundays. 9am EST or soon after, till whenever (usually 2pm or later but the weekly meet ups are pretty freeform so there are no real guarantees of any one person showing up or when). You know how it goes. It is a time to speak of many things; ships and shoes and sealing wax, cabbages and kings; [i]although sometimes the talk gets to a technical level that you can end up feeling like an oyster about to be eaten[/i], but not often. ;-) It's an all-level chat time. Cheers, Brian ---------------------------------------------------------------- Subject: Strange compile Problem (Col 8 or 9 + Author) Hi, I have a really strange compile problem (maybe error?). [code] PROGRAM-ID. UKVABC. AUTHOR. ICHDU. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. DATA DIVISION. WORKING-STORAGE SECTION. LINKAGE SECTION. PROCEDURE DIVISION. DISPLAY "ENTER UKVABC" DISPLAY "LEAVE UKVABC" EXIT PROGRAM. STOP RUN. [/code] produces during compile [code] $ cobc -x -W ./UKVABC.COB ./UKVABC.COB:2: Warning: AUTHOR is obsolete in OpenCOBOL ./UKVABC.COB:13: Warning: DISPLAY statement not terminated by END-DISPLAY ./UKVABC.COB:15: Warning: DISPLAY statement not terminated by END-DISPLAY [/code] Starting the exe will show you the expected text... but [code] PROGRAM-ID. UKVABC. AUTHOR. ICHDU. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. DATA DIVISION. WORKING-STORAGE SECTION. LINKAGE SECTION. PROCEDURE DIVISION. DISPLAY "ENTER UKVABC" DISPLAY "LEAVE UKVABC" EXIT PROGRAM. STOP RUN. [/code] shows during compile [code] $ cobc -x -W ./UKVABC.COB ./UKVABC.COB:2: Warning: AUTHOR is obsolete in OpenCOBOL [/code] and when you start the exe... no output is shown. The difference between both codes is, that the program-id/env sec. is on col 8 or 9??? But should this lead to no error during compile because nothing seems to be compiled with everything on col. 9 (and using an author). If you leave the author,.. everything is fine again ... [code] PROGRAM-ID. UKVABC. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. DATA DIVISION. WORKING-STORAGE SECTION. LINKAGE SECTION. PROCEDURE DIVISION. DISPLAY "ENTER UKVABC" DISPLAY "LEAVE UKVABC" EXIT PROGRAM. STOP RUN. [/code] during compile [code] $ cobc -x -W ./UKVABC.COB ./UKVABC.COB:12: Warning: DISPLAY statement not terminated by END-DISPLAY ./UKVABC.COB:14: Warning: DISPLAY statement not terminated by END-DISPLAY [/code] ---------------------------------------------------------------- If you need this to work before Roger puts in the real fix (as this is NOT a real fix)... Save this as [b]pplex.l.patch[/b] in the [b]cobc/[/b] subdir of your tarball build directory. [code] --- cobc/pplex.l~ 2009-02-06 01:16:44.000000000 -0500 +++ cobc/pplex.l 2009-02-06 01:18:47.000000000 -0500 @@ -567,13 +567,7 @@ } /* skip comments that follow after AUTHORS, etc. */ - if (within_comment) { - if (buff[7] == ' ') { - newline_count++; - goto start; - } - within_comment = 0; - } + within_comment = 0; /* check the text that is longer than cb_text_column */ if (n > cb_text_column + 1) { [/code] and then [code] $ patch pplex.l pplex.l.patch [/code] [b]BE WARNED[/b], I'm expecting to take some heat from Roger for this. Far better to wait for a real fix. My patch doesn't account for the proper handling of the [i]within_comment[/i] flag and I'm probably missing something. Well, I know I missing something. Why am I posting this in such a public forum? Because more of us have to become involved and dig in a little. :-) Really. OpenCOBOL rocks. It's a solid COBOL contender, but it can be made better and I'd like to see it solidify its future. And that will require more developers getting their hands dirty. The more we try, the better we'll get and the more understanding we'll be able to share with each other. Will Roger fix this in a more robust fashion. Yes. Should he be the only one able to? I'd like to think that more of us could offer assistance. This post is my feeble attempt to advance that flag. Even if it's not a good patch; it's an attempt, and I hope, incentive to keep the technical discussion going. Once there is a team this type of talk can be placed into a more closed technical forum, but we have to start building up that team. Oh, did I mention that this isn't really a [i]good[/i] patch, but that it is simply [i]a[/i] patch? ;-) Or that willy-nilly patches are not a good thing without professional level management and quality control in place? Or that I'm more interested in seeing developers try and see if they can cut the OpenCOBOL compiler writing apprentice mustard? As the saying goes: [quote]A computer without COBOL and Fortran is like a piece of chocolate cake without ketchup or mustard. -- John Kruegar[/quote] Cheers, Brian ---------------------------------------------------------------- I'm not sure about the quality of this patch but I'm real sure of the right intention. Keep on the work btiffin and try to get more people involved. To the topic: Try to compile with cobc -free until there was a patch by roger, it should work. ---------------------------------------------------------------- Fixed in current 1.1 tarball. Nice try Brian but not quite right :-) Human, compiling free format happens to work in this instance. However this would not work if the comment following AUTHOR was continued (in Area B) on the following line(s). eg. [code] AUTHOR. Start of comment. Continuation of comment. [/code] Roger ---------------------------------------------------------------- Thank you! In this case I've found why the called program does nothing, but maybe if you compile a lot of sources, it won't be so easy to find out (and to fix it). Thx. ---------------------------------------------------------------- Subject: Experiment; ROBODoc and OpenCOBOL source codes Hello world, I've started an experiment and hacked a little on one of the OpenCOBOL source files. I've added ROBODoc comments including a few inline [i]dot[/i] graphviz commands to the cobc.c source code. First pass of a few functions posted to http://opencobol.add1tocobol.com/docs/cobc.html and in particular, I'd like comments on http://opencobol.add1tocobol.com/docs/cobc.html#robo8 (A five year old helped picked the shapes and colours of the graph nodes and I'm sure they'll look more [i]professional[/i] once things start to settle) Complain now please. There is nothing cast in stone, I've still got a few things to figure out and I'd prefer we as a group decide on a style before the effort gets too far down the road and potentially loses a consistent overall look and feel. Cheers, Brian ---------------------------------------------------------------- Bumpin' my own post. http://opencobol.add1tocobol.com/docs/cobc.html I'd like to motivate someone to design a beefier logo/banner. Along the same lines of 3D drops, but perhaps with a more ice-blue solid steel look and rugged rivets a plenty. Nothing much really; [i]scalable, a transparent background, iconic in monochrome, with fireworks and sound effects.[/i] ;) Cheers, Brian ---------------------------------------------------------------- Subject: SOLVED - Standard question: can a var and section/paragraph have the same name? cobc -fsyntax-only TESTPGM.CBL (Packaged Feb 02 2009 20:13:56 CET) with [code]77 mytest pic 9. ... main section. 00. perform mytest. ex. exit. ... mytest section. ...[/code] leads to [quote]TESTPGM.CBL: In paragraph 'ex': TESTPGM.CBL:8: Error: Redefinition of 'mytest' TESTPGM.CBL:1: Error: 'mytest' previously defined here TESTPGM.CBL: In paragraph 'ex': TESTPGM.CBL:5: Error: 'mytest (main:TRUE)' not procedure name[/quote] I do not know what the standards say about this. Does anybody know or is even able to quote the passage? human ---------------------------------------------------------------- human, No you can't have a var with the same name. 8.3.1.1.1 of the Draft 20xx (which I won't quote directly here as I'm clueless on copyright with Drafts and All Rights Reserved works in progress) Basically; a user-defined word may only be used as ONE type of user-defined word. An exception of note is that section and paragraph names can be the same as level [i]numbers[/i]. Cheers, Brian ---------------------------------------------------------------- Thank you for finding the right reference. ---------------------------------------------------------------- Subject: cobc switch: MF .NET 4.0/5.0 compatible? Hi, is there any chance for a cobc-switch (-std=mfnet4) to increase the comp. mode for MF.NET 4.0/5.0? Here are a few thinks I have noticed not to be comp. with OC: - typedef (is not implemented in OC yet or?) - $SET ... (Error: Invalid indicator '$' at column 7 -> mf-compiler switches are not implemented, at least they should be ignored or (with -std=mf) - Program-ID. "Memory management" External. (External as reserved word?) - In the Standard copy-books of MF.NET there are some compile-time statements... [code] $if P64 set 01 cblt-os-offset cblt-x4-comp5 typedef. ... $else 01 cblt-os-offset cblt-x8-comp5 typedef ... $end [/code] Even if these statements (except typedef?) are not defined in a Cobol-Standard is there a chance to impl. it in OC? - typedef would be nice - at least to ignore the $SET Directive with -mf=std would be nice - external,.. well is it in a standard? - $if,... well I don't know if this should really be impl. in OC.. ---------------------------------------------------------------- What MF implemented as "$IF" statements is part of what the '02 Standard introduced as "conditional compilation", e.g [code] >>IF >>EVALUATE >>DEFINE [/code] Also, I agree with you that having a "$SET" funciton is useful, see my note about setting compiler directives/options within source code. IBM uses - CBL cards Fujitsu uses - @OPTIONS Micro Focus - $SET The '02 Standard introduced [code] >>IMP [/code] which can also be used. ---------------------------------------------------------------- Ok, normaly I'm not using Cobol2002 :-). In my opinion the first stept should be to ignore these "$SET,@OPTIONS etc..". If they are ignored, there should be no problem/Error in compiling the same source with oc and MF/IBM/FS etc... ---------------------------------------------------------------- I agree - I have a script to strip out mf $ directives from the top of over 7000 cobol source files before testing them with Open COBOL. It'd be nice to have them ignored with std=mf , and nicer to have them mapped/actioned. Especially the $SET DEFAULTBYTE(xx) for which I have to patch OpenCOBOL myself to implement :) ---------------------------------------------------------------- grc - Why do you have to patch OC? OC, per default, initializes fields without a value clause according to their picture/usage. I will consider ignoring (with a warning) $SET (and only that). I will put in the EXTERNAL clause on PROGRAM-ID. For the posted code snippet, we already have an equivalent (extension) in OC - [code] 01 cblt-os-offset USAGE BINARY-C-LONG. [/code] As with other 2002 BINARY-xxx constructs, you may append SIGNED or UNSIGNED to the clause with SIGNED being the default. This defines a native binary integer field of 4 or 8 bytes length depending on whether OC was generated 32-bit or 64-bit. This actually was implemented to satisfy the vagaries of some external C libraries (eg. libcurl) that take a C "long" parameter which is either 4 or 8 bytes dpending on the environment. Roger ---------------------------------------------------------------- We use $SET DEFAULTBYTE(00) in MF and the equivalent LE switch on MVS so that all our PIC X and group level items get x'00' initialisation on them. It's crummy I know - but some of these areas are redefined by POINTER types. The COBOL program then blithley issues if POINTER-VARIABLE is NULL then allocate some memory and point the pointer at it else do stuff with POINTER-VARIABLE end-if What we're seeing with Open COBOL is that our pointers are having x'2020202020' in them, which is not a valid pointer. I therefore change this in codegen.c : [code] static int initialize_uniform_char (struct cb_field *f) { int c; if (f->children) { c = initialize_uniform_char (f->children); for (f = f->children->sister; f; f = f->sister) { if (!f->redefines) { if (c != initialize_uniform_char (f)) { return -1; } } } return c; } else { switch (cb_tree_type (CB_TREE (f))) { case COB_TYPE_NUMERIC_BINARY: return 0; case COB_TYPE_NUMERIC_DISPLAY: return '0'; case COB_TYPE_ALPHANUMERIC: //gc return ' '; return 0; default: return -1; } } } [/code] ---------------------------------------------------------------- Crummy isn't the word ! Shoot the programmer ! Anyway, there is an alternative without patching. Make a copy of one of the xxx.conf files from the "config" directory. If you are using eg "-std=mf", then make a copy of mf.conf. If not using any "-std=" then make a copy of "default.conf". Rename it according to your taste. eg. grc.conf Edit it, and change (if default.conf) or add - [code] auto-initialize: no [/code] Then compile with extra parameter -conf=grc.conf (Or with full path to grc.conf if necessary). That prevents any initialization meaning that allocated areas will be defaulted to low-value. Roger ---------------------------------------------------------------- Subject: OpenCOBOL 5-7-5 haiku [code] program-id. one. procedure division. add 1 to return-code. [/code] Compiles a "functional" program that returns 1 to the OS. Can't say it's the greatest poem ever, but hey ... maybe someone can invent a use for a haiku that causes a purposeful pipeline failure status. :-) Cheers ---------------------------------------------------------------- Subject: What about the other '85 Standard optional modules? In the features section of this site at [url=http://www.opencobol.org/modules/bwiki/index.php?Features]http://www.opencobol.org/modules/bwiki/index.php?Features[/url] it lists the "Communications Section" under [code]Features won't be implemented[/code] but it doesn't say anything about the other optional modules from the '85 Standard. I know that some work is going on for Report Writer (which is required in the '02 Standard), but I don't know what the status is for the [b]DEBUGGING MODULE[/b] or the [b]SEGMENTATION Module[/b] My guess is that they belong under "won't be implemented" but they may belong under "not yet implemented" (or maybe one or the other is implemented). I "like" some of the features of the Debugging Module (especially the DEBUG-ITEM) but as they were OBSOLETE in teh '85 Standard, I can see NOT adding them. However, I do think they belong somewhere on the features page. Can anyone tell me what there statu is? ---------------------------------------------------------------- [i]A fan's take on the state of the onion[/i] On DEBUGGING; While not officially advertised as DEBUGGING MODULE... Debug lines are supported, both D (col 7 FIXED) and >>D and can be turned on with -fdebugging-line While there is no READY TRACE, -ftrace (SECTION/PARAGRAPH entry tracers) and -ftraceall (SECTION/PARAGRAPH/STATEMENT tracers) is supported. And while I'll have to admit to not really getting into OpenCOBOL Programming in the Large as of yet, my trial sessions of debugging with gdb and matching the OpenCOBOL source with the generated C code has been a simple and straight forward process. On COMMUNICATION SECTION; While not official; I put together a POSIX message queue layer, works pretty good on GNU/Linux (though it uncovered bugs on the Cygwin 1.7 implementation of MQ_ api). That code probably won't ever be folded into the distribution of OpenCOBOL as I have no immediate plans to implement a Windows version (though maybe someday, after I get my head around Report Writer and feel worthy of extending the compiler more). First, REPORT SECTION to see if my compiler writing is weak or (hoping) if it cuts mustard. So while these aren't to "the Standard", OpenCOBOL can be hooked or crooked into just about any role to implement the functionality in the spirit of the standards; in my humble opinion. SEGMENTATION I'd give a skip as a complication not really required with gigabyte RAM home computers and multigig business machines being the current norm. Perhaps supporting the syntax (while effectively ignoring it) and just letting the link loader do its thing?? The current module build system seems pretty robust already. [i]Just thoughts from an advocate[/i] Cheers, Brian ---------------------------------------------------------------- I am "bumping" a few of my old posts to this forum. These are items that either received no replies or that didn't receive "definititive" answers when I first asked them. Maybe someone can/will answer them now. If anyone thinks there is a better way/place for me to ask these, please let me know via the forum or off-line. NOTE: "Debugging lijnes" are part of the Nucleus, not part of the Debugging Module and were NOT "obsolete" in the '85 Standard but are in the '02 Standard. Segmentation Module impacts when certain segments are "refreshed" and when they aren't. Report Writer is REQUIRED in the '02 Stndard, but optional in the '85 Standard. The "bottom-line" is that nothing indicates which may and which won't ever be implemented (except for Communcations Moule). Bill Klein wmklein ix.netcom.com ---------------------------------------------------------------- Subject: Parse a Cobol Copybook Hi: Is it possible to use OpenCobol to parse a Cobol Copybook that contains nothing more than fields for an FD section? Basically I have some copybooks that start with 01 level group item fields and describe the layout for records in a dataset. I would like to have an output that shows me each field, its parent field, offset, length, etc. Is this possible? Thank you for your help. ---------------------------------------------------------------- Check out [url=http://primacomputing.co.nz/cobdata/]http://primacomputing.co.nz/cobdata/[/url] I think that is what you are looking for. However, if you have used any of hte OpenCOBOL only USAGEs, then it probably won't work for you. Source code in both COBOL and C is available, so you might be able to "expand it" - if it doesn't meet your current needs ---------------------------------------------------------------- Subject: Another open source cobol Came across this web site today http://www.cobol-it.com . An open source cobol compiler. Looks interesting. ---------------------------------------------------------------- It's not really another open source COBOL. It's a repackaging of OpenCOBOL forked quite some time ago now. And from what I've seen (I'll admit; little) it's made a few changes but doesn't have the latest features of OpenCOBOL 1.1 development. Sadly, I'm not sure they are giving anything back. But maybe I'm just out of that loop, but AFAIK, it wasn't an overly friendly fork. If you look close at the ChangeLog you'll see. Cheers, Brian ---------------------------------------------------------------- You can see this also in the [url=http://www.choyou.fr/host/cobol-it/software/COBOL-IT%20Compiler%20Suite/Manual/Getting_Started_with_COBOL-IT_Compiler_Suite.pdf]COBOL-IT Manual[/url]. [quote]Introduction: This document describes how to install and how to use the COBOL-IT Open Source COBOL compiler named COBOL-IT Compiler Suite. COBOL-IT is based on OpenCOBOL, originally developed by Keisuke Nishida and maintained since 2007 by Roger While. COBOL-IT fork its own compiler branch since 2008 to develop a full featured product and offer a professional support to the COBOL user industry. This file contains part of the initial OpenCOBOL manual. Copyright (C) 2002-2007 Keisuke Nishida Copyright (C) 2007 Roger While Copyright (C) 2008 COBOL-IT[/quote] And cobc -V states this, too [quote]C:\COBOL\CobolIT\bin>cobc -V cobc (COBOL-IT) 1.2.9.0 Build date Jan 26 2009 16:05:31 Based on Keisuke Nishida / Roger While Open-COBOL Open-COBOL Copyright (C) 2001-2008 Keisuke Nishida / Roger While Copyright (C) 2008 CobolIT[/quote] The interesting thing about this stuff is the GPL and the "free available source code" together with the "staff has submitted hundreds of COBOL-IT updates in the past year alone". I think it would be really useful if a C developer would get the code from them, diff it to current OC code and could submit useful differences here for Roger to take them into OC Code (if there are some). They provide binaries linked with VBISAM and want to provide an "Developer Studio [...] based on the Eclipse environment" with debugger support, "soon". This should be usable with current OC, too or should be at least easily tweakable to OC. Maybe this COBOL-IT could lead to a faster OC development, at least I hope so. human ---------------------------------------------------------------- It would lead to the fastest development if they joined with us. Unfortunately they are changing the code too much, and not keeping up with the latest OC. ---------------------------------------------------------------- human; [i]fan of OpenCOBOL rant follows:[/i] This was a snag of Roger and Keisuke's good works imho. The compiler itself still has bugs that Roger has fixed over the last 14? months. The VBISAM (by Trevor Van Bremen) integration layer is a large part Roger's work and we can already use that with ./configure --with-vbisam, but it's busted. It'll require quite a few days of testing and tweaking before that 2.1 tarball (and that's the one I noticed is in use by COBOL-IT currently) is release ready. The current rendition runs pretty high risk of data loss so it's not a release candidate for OpenCOBOL yet. I've been experimenting a little to see if we can't get a source level gdb (and ergo visual ddd) debug system in place with the real OpenCOBOL. Advertising [i]"Full ANSI 85 Compatibility"[/i] might be a little misleading. The system is nowhere close to conformant in any "legal" sense as far as I know. (I looked for the implementation notes REQUIRED for conformance and came up empty). Roger doesn't claim [i]conformance[/i] with OpenCOBOL and I've updated the FAQ to reiterate that stance. Hiding the COBOL-IT 1.2.9 source code behind a "send us an email" seems fishy given the state of today's open source initiatives and doesn't quite match the spirit of the GPL 2, section 3a wording. I admire the attempt at commercializing OpenCOBOL, as it warrants such, but I'd prefer a co-operative effort instead of a non-communicative fork with no open give back, that I've seen yet. They stopped communicating with Roger after he critiqued the first cut as "not quite up to OpenCOBOL professional standards". But, I always like to hold up hope when it comes to shared works. Perhaps time will change my current impressions. And I'd prefer to not widen any split, but work politely to close any gaps and resynch the efforts. OpenCOBOL does deserve to have commercial efforts behind it, but those efforts should be [b]open[/b]. Cheers, Brian ---------------------------------------------------------------- btiffin, you've exactly said the same points as I've thought of. At least some resynching with the code would be nice. As I said before, I think you could use some of their manual in the OC FAQ (especially the c stuff) because these are just basics about libcob, cobc, ... The thing I miss the most in OC (and I think you all know I like and apprechiate Roger's work) is "real" COBOL debugging, the second one is VBISAM in the hope of a free and more stable ISAM Implementation than BDB. There were locking problems the last time I've got into the VBISAM discussion (maybe they are solved yet)? A physical CANCEL would be nice (Roger said he MAY will built a special environment flag) especially for updating the modules at runtime (after some programming and without the need to restart the whole application, as it is now). What do you think of these points? ---------------------------------------------------------------- Re manual; The Getting Started With ? Most of the C information is already in the texi subdir and the [code]$ info open-cobol[/code] command sequence, which is also here in opencobol.org under the User Manual [i]link on the right[/i]. [i]Aside; I've updated the texi info file with 1.1 information, but it's incomplete. The next tarball will have all the recent changes (mainly current cobc options) and I'm adding more technical information[/i]. On a positive, the COBOL-IT people have added information in Deet; something I might look into. Leading to re: Debug Adding the #line nnn "file.cob" to the generated C is not hard, I've been experimenting; but [b]gdb[/b] gets confused. It "works" and displays OpenCOBOL source code when using [code](gdb) list[/code] but then as it steps through it gets out of whack and starts to show the wrong source line (relative to what gcc is fed with #line directives). I've been pestering the gdb IRC channel with no response as to tips and tricks just yet. Maybe reading through Deet and the Tcl/Tk code will have some hints. I'll be honest, this won't (shouldn't) be that hard to synch, but it's not my development style so I give it little time or attention. I prefer debug lines in source code and edit/compile/test when I'm having problems with OC programs. But we'll get there (a source line debugger that is). :-) Re VBISAM; I'd wager we have a fully functional integrated VBISAM (and DISAM and CISAM) sooner than later. It'll just take someone sitting down and working out some of the inner wrinkles. This is not "mundane" programming but guru level stuff so I think you may know which "someone" I'm referring to. :lol: We can integrate with VBISAM now and help test, but our good Roger knows of at least three cases that can lead to data loss. This is separate from any locking issues, but, the features available for testing with VBISAM are pretty cool. So we configure VBISAM at our own risk, use the much more reliable Berkeley libdb for now and let the COBOL-IT users assume any of the known production risks I guess. (For what I understand, libdb is "stable" but suffers from licensing issues for commercialization and a grief stricken version mismatching. Alternate ISAM will arrive; doubtful as part the 1.1 production release, but I don't think it will be much past 1.2 of OpenCOBOL. [b]To everyone[/b]: IBM has posted [b]DB2 Express-C[/b] edition for free download, so someone may want to take a kick at interfacing OpenCOBOL with DB2?? http://www.ibm.com/software/data/db2/express/ Re; CANCEL. Agree (and we've heard some guru level treatise on the subject on the add1tocobol IRC channel from Roger on this - hairy stuff); but I'll be honest again, Programming in the Large is not yet part of my OpenCOBOL daily routine so I have little (no) technical opinion as I have no experience. I do relish getting into a system of the size where those would be a concern. ;-) I hope reports from grc's 80,000,000 line efforts may shed light on some of those trials and tribulations. [i]Edit:[/i] I just read Bill's "in the know" information on CANCEL. From that perspective, Roger's current code cuts mustard. Perhaps, if we treat him nice, he'll work out the subprogram call graph chaining required to allow for (safe and robust) physical cancel though. Cheers, Brian ---------------------------------------------------------------- Thank you for your information about CANCEL/VBISAM. As it seems with VBISAM, BDB has also different more or less known points where data loss is possible AND there is the commercial licensing thing. Therefore I really look forward to VBISAM, where improvement/bugfixing seems to be possible. To DB2: I do not know any more which efforts where done with the different external DBs. I think they are all with an SQL-Preprocessor not with COBOL statements like "open input". It would be a good idea to make an overview about the different DB efforts and the status of them. To OC FAQ: It's good that there are many things in the texi files but I'd like to view the information online, not only after downloading OC. This can be a later difference of OC FAQ (containing nothing of the texi files, but pointing at them) and the OC Manual containing all the useful information we can bring up. Please keep up the good work, especially in the documentation and debug area. human ---------------------------------------------------------------- COBOL-IT can use Visual C 2008 Express as compiler. Is there a distribution of OpenCOBOL that uses the same compiler? ---------------------------------------------------------------- If you have all the needed prerequisites (you should be able to take most of them from COBOL-IT), a recent tarball and the [url=http://www.kiska.net/opencobol/1.1/]VC project files[/url] it should be no problem. ---------------------------------------------------------------- We've seen many open source tries for a COBOL compiler, but OC is the most reliable of all. I obviously, like more features and the use of IDE eclipse, but I do not leave OpenCOBOL for a clone. I don't see the need of another open source cobol. ---------------------------------------------------------------- Dear all, Given the more or less accurate information being spread out on the net about us, we would like to clarify COBOL-IT's position regarding a number of matters. A bit more than one year ago, after that MF acquired Acucorp, we all faced the same evidence, namely, that the market needed another professional source for COBOL Compiler, provided by a company that treats their customer well and provide them with decent service and support. A company focused on delivering solutions and services to professional organizations for which security, reliability, confidentiality are vital. We then decided to promote a separate compiler suite, and we soon opted for OpenCOBOL as the base of our offering because of its intrinsic virtues: quality, simplicity, and portability. At that time, we visited Roger While to see whether a form of closer cooperation was possible. However, it turned out that our commercial goals were too different from his, and decided to branch out. Please appreciate that despite such differences of appreciation, we are in very good term with Roger, who has always been kept up to date with our intentions and plans. We then incorporated COBOL-IT in September 2008. Our goal is to provide the market with a reliable and full-featured COBOL compiler that comes with professional support. Please do not misrepresent what we say. We are not saying that the OpenCOBOL compiler as maintained by Roger is not stable or not reliable. Our point is that this compiler misses a number of serious features required by the large corporations we're talking to, and that in order to address this market efficiently, support based on an open forum and goodwill just is not enough. Our model is not based on letting the burden of configuring and compiling the compiler to the end user, who often does not have the skills to do so. That's why we provide precompiled, ready to use binaries, even though our source code is available. We separate the public from the customer version of the compiler. The public version is freely available on our web site, while the customer version, with a number of extended features, is reserved to our customers only. We strictly respect the terms and the spirit of the GPL license since the source of the public version are sent on simple email request and our customers always receive the sources code together with the compiled binary. COBOL-IT has improved on the original OpenCOBOL compiler in a number of areas: - It is certified - or in the process of being certified with third party tools, including Pro*COBOL from Oracle, Tuxedo, Syncsort, DB2, XFrame, UniKix, MySql, etc. - We offer a SQL precompiler to target MySQL, PostgreSQL and ODBC. - Windows API calls (STDCALL) are now supported - Mircosoft's Visual C compilers are supported as backend - A number of features have been introduced to improve the source level compatibility with MF - We have thoroughly debugged and now support our version of VBISAM - We developed an Eclipse-based plug-in, to be released in the coming weeks - We provide a COBOL source-level debugger - We provide a profiler - We implemented a number of optimizations to make the generated code closer in terms of performance to the other players in the market - We provide an external Sort module tool We hope this explains how, while COBOL-IT is based on OpenCOBOL, we believe that referring to it as 'Open COBOL with a new name' or a ‘Clone of OpenCOBOL’ or as a 'non friendly fork' is not accurate. While it is rooted in OpenCOBOL, COBOL-IT is a separate product with separate aims and separate ambitions, to be used by separate sets of people. Our version diverges from the original OpenCOBOL source a little bit more every day, even if we keep an attentive eye on Roger's excellent work, and we understand he does the same with ours. I hope that these explanations will help the OpenCOBOL community to understand where we stand. The COBOL-IT Staff ---------------------------------------------------------------- Cobol-IT, Thanks for responding to this thread. Due to the nature of the GPL, you're perfectly within the limits to expand on the code, and even rebrand it. So you'll find no argument there from me or the Add 1 to Cobol team. We agree that an Open Source Cobol Compiler needs professional support beyond help on forums or email lists. So we're glad you are offering that. As the market for proprietary Cobol compilers becomes more restricted, having more options in the FOSS community benefits us all. While the goals that you have diverge from the goals Roger and our other teams have, it is my firm belief that working together can benefit us all. Most especially I would like to encourage code parity between your compiler and OC. If your other offerings are FOSS, therein also, parity would benefit you and the community as well. The more libraries that we all create, that follow Roger's pattern of coding, the better able we will be to incorporate those directly into the compiler. Several of the libraries that you mentioned (particularly the DB libraries) are already being worked on by members of the Add 1 to Cobol team. Combining efforts in some of these would reduce work, enabling more to be done in less time. So it is my hope that we might get together and discuss these. We meet Sunday's at 9am eastern on Freenode IRC in #add1tocobol. We're also there on and off throughout the week. So feel free to contact us at any time, maybe we can cross pollinate. Kind Regards ---------------------------------------------------------------- Subject: Getting "internal compiler error" - MIGHT relate to GLOBAL I am getting the following error message when I compile a rpogram: [code] filetst.COB:24: Error: 'RelLen' undefined tree.c:1456: Invalid type cast from 'Internal error node' Tag 1 0 Tag 2 9 Aborting compile of filetst.COB at line 26 [/code] The source program is "medium long", so rather than post it in this note, I have put it on the web at: [url=http://home.comcast.net/~wmklein/DOX/filetst.CBL]http://home.comcast.net/~wmklein/DOX/filetst.CBL[/url] I can post the full code, if anyone has trouble getting to that source code. (I changed the name to ".CBL" when I posted becuase of also posting a '.COB" version as described below). The program itself, still had some logic errors. I don't think that has anything to do with the problem with the compiler. However, if anyone wants to see the "final" version of the test program, see: [url=http://home.comcast.net/~wmklein/DOX/filetst.COB]http://home.comcast.net/~wmklein/DOX/filetst.COB[/url] NOTE: Before actually trying OC (under Cygwin) I have run DOS2UNIX, so if the "posted versions" have Windows line terminators, you may need to run that against the source that I posted. ---------------------------------------------------------------- I have been able to create a "small" program that demonstrates the problem. Try the following code: [code] Identification Division. Program-Id. rglob. Environment Division. Input-Output Section. File-Control. Select RelFile Assign RelName Access Dynamic Organization Relative Status Rel-FS Relative Key RelKey . Data Division. File Section. FD RelFile Global Record Varying in Size From 1 to 999 Depending on RelLen. 01 RelRec. 05 RR-Elem occurs 1 to 999 times Depending on RelLen Pic X(01). Working-Storage Section. 01 RF-Stuff Global. 05 RelName Pic X(08) Value "relftest". 05 Rel-FS Pic X(02). 05 RelKey Pic 9(03). 05 RelLen Pic 9(03). Procedure Division. Mainline. Display "Mainline" GoBack. [/code] ---------------------------------------------------------------- I am "bumping" a few of my old posts to this forum. These are items that either received no replies or that didn't receive "definititive" answers when I first asked them. Maybe someone can/will answer them now. If anyone thinks there is a better way/place for me to ask these, please let me know via the forum or off-line. Bill Klein wmklein ix.netcom.com ---------------------------------------------------------------- You get the same error whether you have global or not. I think that the compiler is looking for the numeric occurs item within the record. If I change the definition of RelRec in your example to: 01 RelRec. 05 ElemCnt Pic 9(03). 05 RR-Elem occurs 1 to 996 times Depending on ElemCnt Pic X(01). then it seems to work. Maybe one of the experts can tell us why. Cheers ---------------------------------------------------------------- change the FD to [code] FD RelFile Global Record Varying in Size From 1 to 999 Depending on RelLen. 01 RelRec pic x(999). [/code] move what you had to working storage [code] 01 WSRelRec Global. 05 RR-Elem occurs 1 to 999 times Depending on RelLen Pic X(01). [/code] change the write to write from. [code] Write RelRec from WSRelRec Invalid Key If not RFS-DupKey Display "Invalid Key, FS:" Rel-FS Exit Paragraph Else Display "Duplicate RelKey" End-If Not Invalid Key Move RelKey to aRelKey (RelInd) End-Write [/code] ---------------------------------------------------------------- Subject: CANCEL statement (follow-up on other thread) Another thread talks about a 'real CANCEL statement" - but doesn't explain what it means. It then asks what others think of this. (The same thread talks about "conformance" - and I'll start another thread on that). Just as a matter of "information", the Standard (past, current, revision, etc) all make it clear that the CANCEL statement does NOT require the freeing of any storage. All the CANCEL statement is "guaranteed" to do is to place the subprogram in "initial state" the next time it is called. For Micro Focus, check out: [code] default_cancel_mode Specifies whether logical or physical cancels are used [/code] For IBM mainframe users, it is also interesting to see how the DYNAM/NODYNAM compiler options impact what happens with a CANCEL statement. See: [url=http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3pg40/2.4.19 ]http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3pg40/2.4.19 [/url] ---------------------------------------------------------------- Thanks for the information Bill. Always gems. Cheers, Brian ---------------------------------------------------------------- Thank you for your information, but the question was about a physical cancel for being able to update the module at run time. [quote] human wrote: A physical CANCEL would be nice (Roger said he MAY will built a special environment flag) especially for updating the modules at runtime (after some programming and without the need to restart the whole application, as it is now).[/quote] To free the memory would also be a very nice thing, at least for production with OC, but it's not my main personal interest. ---------------------------------------------------------------- Actually, that was why I mentioned the Micro Focus [code]default_cancel_mode[/code] feature. I think that it is a good model (and would work for compatibility for those users) for what you are talking about. I don't know if you are familiar with the MF documenttion to check it out, but if you are, do you think it is the type of thing you are looking for? ---------------------------------------------------------------- You're right. If OC implements something like this it would be good to go the same way MF does: If nothing is set, CANCEL is only done logically, but it's possible to set CANCEL to be done physically. Because of migrating issues, OC should use the same statement (if possible). The according part of the MF docs can be found [url=http://supportline.microfocus.com/documentation/books/sx22sp1/cyconf.htm#s005]here[/url] (scroll down to default_cancel_mode) ---------------------------------------------------------------- Subject: Are there stated "goals" or "direction" for OpenCOBOL This is a follow-up on several recent threads. I'll admit that I was [u][b]NOT[/b][/u] surprised that there is no claim that the current (pre-release 1.1) OpenCOBOL is, already, ANS'85 conforming. However, I was [u][b]surprised[/b][/u] that it apeears that it is not a current "direection" (or goal) to move toward ANS85 conformance. Similarly, in response to requests for Micro Focus [code] $SET *> in sourse code default-byte directives [/code] It seems that this level of compatibility with MF isn't a current goal. So my real quesiton is, exactly what are the "goals" or "directions" for OpenCOBOL? I fully understand that there are priority issues and resource issues that may make some items "desirable" but not in the near future (as resources are being allocated elsewhwere). However, there is a difference between what is currently available, what can be expected in the near future, and what is the ultimate goal or direction for the project. Looking at the "features" seciton of the OpenCOBOL website doesn't help much. It doesn't seem to be current (e.g. shows Screen Seciton not implemented yet) nor very complete in that it doesn't help tell what ANS85 or MF features are implemented and which are not. ---------------------------------------------------------------- Doh! I updated the SCREEN SECTION part of the wiki under the Task (ToDo) page. I'll update Features as well. Part of my volunteering here is to try and alleviate some of the mundane documentation responsibilities from the core development team. [i]Then I find I have too much fun exploring the capabilities of OpenCOBOL 1.1[/i] and it's posts like this that motivate some nose to the grindstone doc efforts. ;-) But ... opencobol.org is a little bit bipolar. We discuss the 1.1 pre-release almost exclusively, but the website docs still represent the 1.0 release codebase. I do expect a wholesale update will occur when 1.1 approaches release (or shortly thereafter). Cheers, Brian ---------------------------------------------------------------- I am "bumping" a few of my old posts to this forum. These are items that either received no replies or that didn't receive "definititive" answers when I first asked them. Maybe someone can/will answer them now. If anyone thinks there is a better way/place for me to ask these, please let me know via the forum or off-line. I still don't know what the "ultimate" (or even short-term) goal of OC is. Where does "standard-conforming" fit in? For either the '85 Standard or the '02 Standard? Where does IBM compatibility or MicroFocus compatibility fit in? Bill Klein wmklein ix.netcom.com ---------------------------------------------------------------- Bill, and especially everyone else reading this, please take this as [b]fan-boy talk and NOT official project stance[/b]. I think the end goal is to make a practical, usable COBOL system. Cover the best and skip the rest. Kinda like how we have to treat the standards documentation. The underlying technology is open, but the text is under copyright. I'll opine that OpenCOBOL will build to the open underlying technology and try and avoid the closed commercial nature of the written details. Once again ... [b]fan-boy ... not to be taken as official project stance[/b] I'd like to see OpenCOBOL try and get "stamped" someday, but I'm not sure we have the volunteer time and money resources to jump through those hoops at this point in time. Simply complying with the documentation requirements for sections 3.1.1 through 3.1.16 of the Draft 20xx will take many hundreds of hours. (The kind of meticulous, [i]read boring[/i], hours of effort that people might want paycheck and orders from the boss incentives for). Unlike the exciting, itch scratching, efforts that coding up a good compiler inspire. :) Cheers, Brian ---------------------------------------------------------------- Subject: OpenCOBOL OpenOffice John Ellis is posting some details on working with OpenOffice.org documents from OpenCOBOL applications. John does good works, so it'll be worth keeping an eye on. It's a work in progress, and when I posted this things were just starting out. http://oldsite.add1tocobol.com/tiki-index.php?page=OpenCobolOpenOffice Cheers, Brian ---------------------------------------------------------------- Bumping thread. In case you haven't seen. John has updated his Open Document handlers and his article. It's very nicely done and offers a lot of potential to OpenCOBOL development. http://oldsite.add1tocobol.com/tiki-index.php?page=OcOOForm Cheers ---------------------------------------------------------------- Subject: Comments requested - Getting Started for Windows users (dox) After my trials and tribulations (as a non-Unix/Linux type person) trying to get OpenCOBOL installed and working under Cygwin under Windows, I have created a document: [code] [size=large][color=CC0000][b]Getting Started with OpenCOBOL for Dummies (like me)[/b][/color][/size] [/code] and placed it on the web, I am soliciting comments (correction - technical or editorial and/or suggestions or whatever). Once (if) it gets stabilized, hopefully, it will be useful in this website. To view the current (first) draft: In PDF, go to http://home.comcast.net/~wmklein/DOX/OC_GettingStarted_Windows.PDF In HTML, go to http://home.comcast.net/~wmklein/DOX/OC_GettingStarted_Windows.HTM The HTML was created from MS Word, so I know that this sometimes causes problems for non-IE users. Let me know if you can't access either of these (and I can send them to you off-line). Thanks in advance for any/all input, Bill Klein wmklein ix.netcom.com ---------------------------------------------------------------- Nice. Yep, well done and great coverage Bill. Cheers, Brian ---------------------------------------------------------------- Subject: LENGTH OF special register Dear friends, maybe this is of interest for you. 01 subnum binary-long unsigned. 01 arr. 03 arr-entry occurs ..... Some compiler do not allow 'arr-entry(length of subnum)'. I do not understand why. Is this also a restriction for open cobol? Actually I got a compiler message complaining about 'compute subnum = subnum + length of subnum' and 'display arr-entry(subnum + length of subnum)' From my point of view 'subnum + length of subnum' is an arithmetic expression that is allowed and that results in a positive unsigned binary suitable for a subscript. I'm looking forward to hear from you. Regards starlake ---------------------------------------------------------------- Two possible problems with your source code (for "other compilers") 1) "length of" special register is an extension and is not part of any ANSI/ISO Standard. The LENGTH intrinsic function, on the other hand, is ANSI/ISO conforming. (I kknow that Micro Focus and IBM both support "length of" special register, but I don't know which other compilers do). 2) Use of an arithmetic expresion as a subscript was NEW in the '02 Standard. I don't know which compilers support this already. I know that neither IBM nor Fujitsu do (yet). There is one other possible issue. You don't have a "separator space" before the opening left parenthesis starting the subscript. Again, I think there are number of compilers that support this, but it isn't Standard and I don't think that all compilers do allow it. ---------------------------------------------------------------- This works here; [code] *> *************************************************************** identification division. program-id. datasize. environment division. configuration section. repository. * function all intrinsic. data division. working-storage section. 01 subnum binary-long unsigned. 01 arr. 03 arr-entry pic x occurs 20 times. *> *************************************************************** procedure division. move "abcdefghijklmnopqrst" to arr move 18 to subnum display arr-entry(subnum + length of subnum) end-display display arr-entry(subnum + function length(subnum)) end-display display arr-entry(function byte-length(subnum)) end-display goback. end program datasize. [/code] Compiles fine. Because I set subnum to 18, the debug compile option is required to catch the run time subscript error. [code] $ cobc -debug datasize.cob $ ./datasize datasize.cob:19: libcob: Subscript of 'arr-entry' out of bounds: 22 [/code] Note; with the REPOSITORY FUNCTION ALL INTRINSIC uncommented and due to OpenCOBOL supporting both FUNCTION LENGTH and the LENGTH OF clause... [code] $ cobc datasize.cob datasize.cob:19: Error: FUNCTION LENGTH has wrong number of arguments datasize.cob:19: Error: syntax error, unexpected OF [/code] but I do believe that sequence is being worked on and may well change. Without the move 18 (and without the all intrinsic), it all works as expected. [code] $ ./datasize d d d [/code] [code] $ cobc -version cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Feb 06 2009 19:56:37 Packaged Feb 06 2009 10:30:55 CET [/code] Cheers, Brian Re: other compilers; There are other compilers? ;) ---------------------------------------------------------------- Subject: OpenCOBOL and Source Level Debugging I'd like to start up another discussion. In an attempt to get source level debugging with gdb I hacked up codegen.c to emit [code] #line nnn "program.cob" [/code] line directives in the generated C code. BUT; this has problems as synching the gdb with COBOL source lines and the C source lines that are actually stepped causes some grief. For example: [code] $ gdb hello GNU gdb 6.8-debian Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i486-linux-gnu"... (gdb) start Breakpoint 1 at 0x00000000: file hello.c, line 31. Starting program: /home/cobol/hello [Thread debugging using libthread_db enabled] [New Thread 0x00000000 (LWP 22573)] [Switching to Thread 0x00000000 (LWP 22573)] main (argc=1, argv=0x00000000) at hello.c:31 31 cob_init (argc, argv); (gdb) step 32 cob_stop_run (hello ()); (gdb) hello () at hello.c:40 40 { (gdb) hello_ (entry=0) at hello.c:56 56 /* CANCEL callback handling */ (gdb) 65 /* Initialize frame stack */ (gdb) 66 frame_ptr = &frame_stack[0]; (gdb) 67 frame_ptr->perform_through = 0; (gdb) 70 /* Push module stack */ (gdb) 71 module.next = cob_current_module; (gdb) 74 /* Initialize program */ (gdb) 76 { (gdb) 79 } (gdb) 80 cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); (gdb) 81 (*(int *) (b_1)) = 0; (gdb) 82 memset (b_5, 32, 132); (gdb) 85 (gdb) 11 001100 DISPLAY "Hello World!" END-DISPLAY. (gdb) 13 001300 IF COMMAND-ARGS NOT EQUAL SPACES (gdb) Hello World! 12 001200 ACCEPT COMMAND-ARGS FROM COMMAND-LINE END-ACCEPT. (gdb) list 7 000700 DATA DIVISION. 8 000800 WORKING-STORAGE SECTION. 9 000900 01 COMMAND-ARGS PIC X(132). 10 001000 PROCEDURE DIVISION. 11 001100 DISPLAY "Hello World!" END-DISPLAY. 12 001200 ACCEPT COMMAND-ARGS FROM COMMAND-LINE END-ACCEPT. 13 001300 IF COMMAND-ARGS NOT EQUAL SPACES 14 001400 DISPLAY 15 001500 "[" FUNCTION TRIM(COMMAND-ARGS TRAILING) "]" 16 001600 END-DISPLAY (gdb) [/code] Note how the stepper goes from line 11, to display line 13 (which wasn't really evaluated, just displayed) before synching back to 12. This is due to the C code taking more than 1 line for each executable COBOL statement. I don't really see a way around this (and the guru has tried this as well), aside from discipline on the part of the person doing the debugging. [i]For the keen eyed, I've replaced all addresses with 0's in the above listing.[/i] The change to codegen.c was a simple three liner for this form of confused single stepping, but it's not very practical for mass consumption. So the point of discussion would be; any ideas? Is there an idiom for pumping out line directives that cover a range, for instance? Is there a gdb option to get the stepper to skip through the C steps to auto-synch with "external" source files? Etc... Cheers, Brian ---------------------------------------------------------------- Maybe you can just use the lines of cob_set_location as [url=http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=200&forum=1]suggested by Roger earlier[/url]. He wrote there something of better not using the #line directive, too. human ---------------------------------------------------------------- There have been a few chats of a fairly deep technical nature on some of the options for OC debugging support recently. Anyone that knows DWARF might be interested in the #add1tocobol Freenode IRC chatline on Sundays for the next while if/when the discussions occur. Cheers, Brian ---------------------------------------------------------------- I never heard of [url=http://en.wikipedia.org/wiki/DWARF]DWARF (on en.wikipedia.org)[/url] but it sounds good. I think the whole debugging thing is really an important point for OC, as being one of the things missing compared to COBOL compilers and even the OC clone COBOL-IT. I'll read the summarize or chat log of the meeting. human ---------------------------------------------------------------- Yeah, on logs ... I don't think we keep logs. We keep the channel open, but still keep a little (and it really is little, as anyone can come in) sense of privacy in the room. I guess, it is just that we don't officially publish any logs [i]so there is no historical record of our bitching and stupid mistakes[/i]. ;) Is you send a message to erstazi (just mention that string in a message and he'll see it) in the chat room, he may open up his private stash of logged entries. The AddBOTtoCOBOL supy bot keeps a log, but it's not published anywhere. (This doesn't stop anyone from keeping their own personal copy for logs and posting them, but that hasn't happened yet, AFAIK. We only have a [i]sense[/i] of privacy, not a guarantee.) But yeah, it's our good Jim who is coming up with the ideas and I'm hoping to come to some technical grips with the concepts this coming Sunday. The efforts may spill over to posts here, on add1tocobol.com, or the mailing list, but may mostly be on the #add1tocobol freenode IRC channel for the first kicks at things. Cheers, Brian ---------------------------------------------------------------- There were logs for the first meetings, but I understand the sense of privacy thing. I would really be glad if there is somebody summarizing the meetings (maybe from his private log) and post the most important things mentioned / talked about there at the forum afterwards. human ---------------------------------------------------------------- Well, maybe we could put up an announcement and finally go public with the logs. As long as everyone knows about the change, we can keep our secret sam chats in personal channels. It's already a little hit or miss, as the supy bot keeps a public summary with a random post (and other weird stats) from whomever visits I'll talk to erstazi and aoirthoir about it soon. Cheers, Brian ---------------------------------------------------------------- Subject: Cobol / Linux / X-Windows The following note was posted this weekend in comp.lang.cobol. There have been a few replies (such as TK/TCL) But the question for this forum(and the list) is Does anyone have any experience or suggestions for this OpenCOBOL user? (Especially any EXPERIENCE that they could share) > Oh how do I get myself into nasty little messes like this? > A friend of mine was laid off from his job (damn bank!) > and is now getting in pretty desparate straights. So he took > a consulting job - on spec no less - and has been handed a mess. > > His project is to port some old PrimeOS (!!) Cobol code to Linux. > So I gave him an x86 box with Linux and OpenCOBOL installed on it. > And he was off. Till the buggers he contracted with sprung a surprise on > him - they are demanding that he produce a Linux GUI. > > (damn bank! damn bank#2!) > > Does anyone have any experience with hooking OpenCOBOL into > XWindows? And if so, would you be willing to share a few tips > with me on how to go about doing it?? > > Ill help him do this someway or another, by hooking in C wrapper > routines if I have to, but I sure would like to avoid taking all the time > to do that if there is a faster way. I am a bit in overload myself right > now... :( > > PrimeOS! In 2009. To XWindows! > Unbelievable...*(*&@&#! > Thanks > -Paul ---------------------------------------------------------------- Brian Tiffin demonstrates code about using GTK+ here: http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=428&forum=1 ---------------------------------------------------------------- I replied to comp.lang.cobol. The original poster seemed happy. Yay for OC. ;) Cheers, Brian ---------------------------------------------------------------- Subject: Embedding Guile Hello everyone; Below is a sample of coding a libguile extension language into OpenCOBOL. It's a rather poor example in terms of domain coverage, [i]using Scheme for money math[/i], but I hope you see the potential. ;) Requires [b]guile-1.8[/b], [b]guile-1.8-dev[/b] The tectonics for this one only require [i]-lguile[/i], but other features of the Guile Scheme interpreter may also require additional libraries; [i]-lltdl -lgmp -lcrypt -lm[/i] which under normal OpenCOBOL builds, only libltdl and libcrypt would need to be added to compiler commands. Due to some cool technical changes Roger made a while back, they is a lot less need for wrapper code when dealing with these engines. OpenCOBOL is a lot more flexible when using CALL and PROCEDURE DIVISION USING so intermediate C code will now only be required for rare oddball datatypes. [b]callguile.cob[/b] [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20090215 *> Purpose: Demonstrate libguile Scheme interactions *> Tectonics: cobc -x -lguile callguile.cob *> *************************************************************** identification division. program-id. callguile. data division. working-storage section. 01 tax-scm usage pointer. 01 shipping-scm usage pointer. 01 scm-string usage pointer. 01 radix-scm usage pointer. 01 subtotal pic 999v99 value 80.00. 01 subtotal-display pic z(8)9.99. 01 weight pic 99v99 value 10.00. 01 weight-display pic Z9.99. 01 breadth pic 99v99 value 20.00. 01 breadth-display pic Z9.99. 01 answer pic x(80). 01 len usage binary-long. 01 tax pic 9(9)v9(2). 01 tax-display pic z(8)9.9(2). 01 shipping pic 9(9)v9(2). 01 shipping-display pic z(8)9.9(2). 01 invoice-total pic 9(9)v9(2). 01 invoice-display pic $(8)9.9(2). *> *************************************************************** procedure division. display "OC: initialize libguile" end-display call "scm_init_guile" end-call display "OC: load scheme code" end-display call "scm_c_primitive_load" using "script.scm" & x"00" end-call display "OC:" end-display display "OC: evaluate one of the defined functions" end-display call "scm_c_eval_string" using "(do-hello)" & x"00" end-call display "OC:" end-display display "OC: perform tax calculation" end-display move subtotal to subtotal-display move weight to weight-display move breadth to breadth-display call "scm_c_eval_string" using function concatenate( "(compute-tax "; subtotal-display; ")"; x"00" ) returning tax-scm end-call display "OC: perform shipping calculation" end-display display "OC: " function concatenate( "(compute-shipping "; weight-display; " "; breadth-display; ")" ) end-display call "scm_c_eval_string" using function concatenate( "(compute-shipping "; weight-display; " "; breadth-display; ")"; x"00" ) returning shipping-scm end-call display "OC: have guile build a scheme integer 10" end-display call "scm_from_int32" using by value size is 4 10 returning radix-scm end-call display "OC: have guile convert number, base 10" end-display call "scm_number_to_string" using by value tax-scm by value radix-scm returning scm-string end-call display "OC: get numeric string to COBOL" end-display call "scm_to_locale_stringbuf" using by value scm-string by reference answer by value 80 returning len end-call display "OC: tax as string: " answer end-display move answer to tax call "scm_number_to_string" using by value shipping-scm by value radix-scm returning scm-string end-call call "scm_to_locale_stringbuf" using by value scm-string by reference answer by value 80 returning len end-call display "OC: shipping as string: " answer end-display move answer to shipping compute invoice-total = subtotal + tax + shipping end-compute move subtotal to subtotal-display move tax to tax-display move shipping to shipping-display move invoice-total to invoice-display display "OC:" end-display display "OC: subtotal " subtotal-display end-display display "OC: tax " tax-display end-display display "OC: shipping " shipping-display end-display display "OC: total: " invoice-display end-display goback. end program callguile. [/code] [b]script.scm[/b] [code] (define (do-hello) (begin (display "Welcome to Guile") (newline))) (define (compute-tax subtotal) (* subtotal 0.0875)) (define (compute-shipping weight length) ;; For small, light packages, charge the minimum (if (and (< weight 20) (< length 5)) 0.95 ;; Otherwise for long packages, charge a lot (if (> length 100) (+ 0.95 (* weight 0.1)) ;; Otherwise, charge the usual (+ 0.95 (* weight 0.05))))) (display "Loaded script.scm")(newline) [/code] [b]Sample run[/b] [code] OC: initialize libguile OC: load scheme code Loaded script.scm OC: OC: evaluate one of the defined functions Welcome to Guile OC: OC: perform tax calculation OC: perform shipping calculation OC: (compute-shipping 10.00 20.00) OC: have guile build a scheme integer 10 OC: have guile convert number, base 10 OC: get numeric string to COBOL OC: tax as string: 7.0 OC: shipping as string: 1.45 OC: OC: subtotal 80.00 OC: tax 7.00 OC: shipping 1.45 OC: total: $88.45 [/code] ---------------------------------------------------------------- Subject: OC Installation on OS X 10.4.11 New to COBOL and not a Unix geek so bear with me, I'm having problems with installing OpenCobol 1.0 on a PPC OS X 10.4.11 system. Everything seems to build correctly using gmp 4.2.4, libtool 2.2, bdb 4.7.25 and ncurses 5.7 libraries, but when I do a make check OC fails miserably, like almost all but a handful of the tests. I followed the directions that Sarah posted back in August '08 and have tried to build OC four times, bit just can't get it to pass the make check. I think I saw a post that someone else had a similar problem. Any words of wisdom on where to look for trouble? I'd like to get this up and running to try out for a client wishing to port their COBOL code from a legacy machine. :-( ---------------------------------------------------------------- Tried compiling the sample Hello World program and it ran, but could there still be problems with the compiler? ---------------------------------------------------------------- Never mind! I restarted the Mac and re-ran the make check and all the tests passed except the big-endian (probably due to machine being PowerPC?). Maybe something wasn't loaded after doing initial installation and required a restart? Hopefully, now I'm off to the races! :-D ---------------------------------------------------------------- That sounds like a link library cache problem. It's a bit of a burn. [code] $ hash -r [/code] (assuming bash) gets rid of any cached program path search, for instance cobc moving from /usr/bin to /usr/local/bin and [code] $ ldconfig [/code] rebuilds the system dynamic link library cache. Those are both hard to figure out gotchas during development and rebuilds; (but necessary evils with shared unixy multi process operating systems). Cheers, Brian ---------------------------------------------------------------- Subject: Problem with running a generated .so file Hi all, I have this issue with opecobol. I am using a ubuntu box (amd64, which is probably the source of it all). I have tried both the prepackaged version and tu build it from the source (version 1.0, 1.1 won't compile). cobc works fine, and a .so file is generated. When I try to run it I get: [code]undefined symbol: _31[/code] Can anyone help? I haven't found a thing in google nor here. ---------------------------------------------------------------- Did you've tried to run it with [code]cobcrun myso[/code]? Did you have all the necessary stuff (see README) installed before trying to install OC? What problems occurred during the building process of OC? ---------------------------------------------------------------- Make sure that the file name bla.cob (or bla.cbl) is the SAME as your Program-ID. If not it won't run. ---------------------------------------------------------------- Subject: "ANY LENGTH" not on level 77? [quote]Error: 'buffer' ANY LENGTH must be 01 level[/quote] Why shouldn't a level 77 var have "ANY LENGTH"? ---------------------------------------------------------------- I don't know if this answers "why", but according to the '02 Standard, "ANY LANGTH clause", Syntax rule 1: [code]The ANY LENGTH clause may be specified only in an elementary level 1 entry in the linkage section of a function, of a contained program, or of a method that is not a property method. NOTE The ANY LENGTH clause cannot be specified in an outermost program. This is because an outermost program can be called with or without a program-prototype format CALL statement. For calls without a program-prototype, this International Standard does not require an implementation to determine whether an argument corresponds to a formal parameter described with ANY LENGTH. [/code] In the draft of the revision, the use of ANY LENGTH is greatly expanded (and is currently a MESS). The "goal" is to support it outside the Linkage Section and (eventually) may support truly variable length fields with either a prefix or a delimiter. Back to the original question. I [u][b]think[/b][/u] that there is a general feeling of (slightly) and UNOFFIICALLY deprecating the use of 77-levels. It seems to me that several "new clauses" work for 01-levels but not for 77-levels. However, I can't really give you much reasoning behind this; it is just a feeling that I have. ---------------------------------------------------------------- Subject: XEmacs vs Emacs - with OpenCOBOL (Posted in the Forum and sent to the list) As part of my effort (one step forward, two steps back) toward getting OpenCOBOL up and running under Windows XP (using Cygwin) in a "user-friendly - to me -way", I have been trying to find a reasonable COBOL-sensitive editor. When I installed VIM it comes up in a pretty-ugly "text mode" while when I installed Emacs, I can't even get it to come up. (I think these have to do with my failures to get rxvt working and what "terminal" type and stuff Cygwin gives me by default.) On the other hand, XEmacs seems to give me a "reasonable" editor. Therefore, I have been working to get "cobol-mode" to work. When I started this, I didn't know that there is a "serious difference of opinion" between the Emacs and XEmacs environments. (If not open war, then at least silent hostilities between their developers). So now that I am part way thru getting XEmacs to work in a COBOL-sensitive way, my question is: Do existing OpenCOBOL users use: - Emacs? (at least some of the time, but never XEmacs) - XEmacs? (at least some of the time, but not Emacs) - (mostly other editors) - both? - some other answer (not included above)? If no-one uses XEmacs, then my guess is that my current project isn't really that useful. (For my personal use, I can happily use my Windows COBOL editor and just "dos2unix" the output). If, on the other hand, there is some interest in (and/or use of) XEmacs, I will continue my current work. Comments? Input? ---------------------------------------------------------------- Read through the [url=http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=315&forum=1&viewmode=flat&order=ASC]topic about cobol IDE[/url]. There you find different editors and some syntax files. I think there was an improved syntax for emacs, but I'm not sure. You maybe want to try [url=http://www.vim.org/download.php#pc]gVim for Windows[/url], too. Good luck! ---------------------------------------------------------------- I'm using UltraEdit (Windows) for editing and compiling (via Tools) OC SourceCode. If wanted, I can post the part of the Wordfile.txt for Cobol (but its optimized for the use of BS2000 Cobol). Nonetheless, UE will show you all Sections and copy statements in a seperate function list plus a few macros for checking/transform cobol source from ebcdic/html do dos and backwards. ---------------------------------------------------------------- Please keep all the discussions and suggestions for COBOL editors in the previous mentioned and linked topic. Thank you! ---------------------------------------------------------------- Please DO answer my question in this thread. If you are using XEmacs or Emacs, let me know which (and maybe why) ---------------------------------------------------------------- Subject: OC Syntax in ACCEPT statement Like I said previously, I'm learning Cobol on the fly here. I'm trying to compile a couple of standalone programs that were written in Data General Cobol as tests and, surprise, surprise, I'm running into a lot of syntax issues. Does OC support this type of syntax in an Accept statement?: 010600 ACCEPT DATA-IN ON ESCAPE GO TO P090. The compiler gives me this error: dave1500.sr:111: Error: syntax error, unexpected ON. It looks like the DATA-IN field is being tested for an ESCAPE character to exit the program, at least that's how it works on the DG. Tried removing the ON word, got unexpected ESCAPE error. Ideas? ---------------------------------------------------------------- I think that you want to add a CRT STATUS phrase in your Speicial-Names paragraph and check it after the ACCEPT (rather than the ON ESCAPE phrase). I couldn't quickly find what value it would have if ESACPE was pressed, but either a test should show you or someone else may post a better reply. The other issue MAY be whether DATA-IN is in Working-Storage or is a SCREEN SECTION item. I am not positve that the CRT STATUS does or does not get updated when you do an "ANSI ACCEPT" (into a WS item). ---------------------------------------------------------------- The DATA-IN is in the WORKING-STORAGE SECTION. There is no Special Names paragraph. I wish I new what the idiosyncrasies were between Open Cobol and the DG Cobol this stuff was originally written in. Since the code is so old and after digging through an old DG manual, I found the DG Cobol (AOS/VS) conforms to the ANSI '74 standard and nothing later. I need to climb the learning curve fast to determine if this is going to be a viable solution and how much monkeying around is going to be necessary to move about 300 programs! Appreciate the suggestions. ---------------------------------------------------------------- I just wanted to clarify/correct my earlier post. Adding a CRT STATUS clause (into a new Special-Names paragrph) would not help in this case. The CRT STATUS field is only updated for an Accept/Display of a screen item. I know of no way (without semi-significant recoding) to detect the use of an "escape key" during an ACCEPT into a Working-Storage item (i.e. ACCEPT - implicitly FROM CONSOLE). ---------------------------------------------------------------- Actually, the CRT STATUS clause did make it some of it work, still can't ESCAPE out of the program. Thanks! ---------------------------------------------------------------- This needs to be documented: export COB_SCREEN_EXCEPTIONS=Y export COB_SCREEN_ESC=Y (only tested when EXCEPTIONS=Y) Search the forum for those keywords for discussion on usage and warnings ... ncurses has an escape key timer of some sort, if I remember correctly, that has to do with the escape code being part of the extended keyboard sequences. Cheers, Brian ---------------------------------------------------------------- Hi, I was a DG COBOL programmer a long time ago, and my company has done a lot of DG COBOL migrations, to MF and ACU. From the fact that the statement you give has a sequence number, the '010600' I suspect that this might be ICOBOL rather then AOS COBOL. Anyway they both did roughly the same thing. The statement you give, ACCEPT DATA-IN ON ESCAPE GO TO P090 would place data from the keyboard into DATA-IN. If the user terminated the entry with new-line then the next statement is executed. If the user terminated the ACCEPT by pressing escape or a function key then the GO TO P090 is executed. To find out which function key was pressed you have to do: ACCEPT data-item FROM ESCAPE KEY I can tell you the values put in data-item for each function key if you need it. None of this was in any COBOL standard. Leigh. ---------------------------------------------------------------- Should the ON ESCAPE be implemented to OC or should IF COB-CRT-STATUS NOT = 0 be used? (This is the same, isn't it?) ---------------------------------------------------------------- I'm not in on the overall plan, but ACCEPT .. FROM ESCAPE KEY is in the current parser, but displays a PENDING warning and emits no code. And info for everyone: There are few ways to get at the escape key. An ACCEPT screen or ACCEPT AT will honour the COB_SCREEN_EXCEPTIONS=Y and COB_SCREEN_ESC=Y runtime environment variables. The accept will terminate and CRT STATUS is set after ncurses detects an escape key (27) and times out or other PF key. The downside is the ncurses init-scr required for initialization does that whole "erase the console and make a new virtual terminal" thingy, which is distracting (and removes the potential of easy to access DISPLAY statements) unless you have a full blown screen section app. [i]I'm going to try and discuss a move away from ncurses to S-Lang for OC screen and extended keyboard support. Not only is it a very capable system, with features such as key code fetch without the screen clear, we'd end up with a pretty cool scripting engine in the core as a bonus. The S-Lang script engine has features that could move OpenCOBOL into the Fortrany numeric array processing space. I'm a huge fan of wholes greater than sums of parts. Synergy rocks.[/i] Downside: Work (and time perhaps best spent on other things), and a shared library only a slim 8 times the size of the current libcob. ;) This may be a non-starter wishful think. Back to reality ... for the status codes: From libcob/screenio.c 1000 + Fkey (1 to 64) 2001 is page up 2002 is page down 2003 is cursor up 2004 is cursor down 2005 is escape (but will require a short wait for detection and may or may not work depending on terminal capabilities) 2006 is printscr This info is also in screenio.cpy that ships with the system. /usr/local/share/open-cobol/ on my Debian system. Cheers, Brian ---------------------------------------------------------------- Subject: OpenCobol ported on AmigaOS4 :) Hello guys, i've successfully ported OpenCobol to AmigaOS4 platform! :) i've compiled the hello world example and it works correctly.. :D now i would try something more complicated.. where i can find some other examples? Andrea ---------------------------------------------------------------- Hello Andrea! Did you've tried the "make check" on install, does it work fine? Could you shortly explain if there was something special in this port to AmigaOS4? More nice examples can be found at the OC FAQ (link to the left), just search for "program-id" and compile the givien samples (some programs have extra dependencies, but you will find a lot of programs that should compile fine). ---------------------------------------------------------------- Some at http://svn.wp0.org/ocdocs/brian Or for some code that is a LOT more professional and a good work out for any compiler... http://www.simotime.com/indexcbl.htm Many thanks to SimoTime Enterprises. Their samples (all rights reserved - but ok for personal use) can teach many COBOL coders good and proper form. Umm, not that any of it has rubbed off yet. ;) Cheers, Brian ---------------------------------------------------------------- i've cross-compiled it, so make chech will not work. i've made no great change, i've only compiled some dependencies like gmp or ncurses (well.. i've use an SDL wrapper...sinc we haven't a native implementation yet). On the code i ve made no great changes except for some os parts. for example we don't use ENV variable so much and so i've forced temporary dir to /t (T: on amigaos) and some other small stuff. I would avoid the use of libintl but i think it was impossible. isn't it? Andrea ---------------------------------------------------------------- thank you! i'll try them! ---------------------------------------------------------------- Subject: ASCII to EBCDIC in OpenCOBOL An example using one of the tidbits in the FAQ. Uses the CBL_OC_DUMP found here in the forum and in the FAQ, thanks to our good human. Note the magic; Two ALPHABETS and an INSPECT CONVERTING. [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20090220 *> Purpose: Demonstrate ASCII EBCDIC conversion and ALPHABET *> Tectonics: cobc -x toebcdic.cob CBL_OC_DUMP.o *> *************************************************************** identification division. program-id. toebcdic. environment division. configuration section. special-names. alphabet alpha is native alphabet beta is ebcdic. data division. working-storage section. 01 var pic x(62) value is '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'. *> *************************************************************** procedure division. call "CBL_OC_DUMP" using var function length(var) end-call inspect var converting alpha to beta call "CBL_OC_DUMP" using var function length(var) end-call goback. end program toebcdic. [/code] Outputs: [code]Offs HEX-- -- -- 5- -- -- -- -- 10 -- -- -- -- 15 -- CHARS----1----5- 0000 30 31 32 33 34 35 36 37 38 39 41 42 43 44 45 46 0123456789ABCDEF 0016 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 GHIJKLMNOPQRSTUV 0032 57 58 59 5a 61 62 63 64 65 66 67 68 69 6a 6b 6c WXYZabcdefghijkl 0048 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a mnopqrstuvwxyz.. Offs HEX-- -- -- 5- -- -- -- -- 10 -- -- -- -- 15 -- CHARS----1----5- 0000 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 c1 c2 c3 c4 c5 c6 ................ 0016 c7 c8 c9 d1 d2 d3 d4 d5 d6 d7 d8 d9 e2 e3 e4 e5 ................ 0032 e6 e7 e8 e9 81 82 83 84 85 86 87 88 89 91 92 93 ................ 0048 94 95 96 97 98 99 a2 a3 a4 a5 a6 a7 a8 a9 ................ [/code] ---------------------------------------------------------------- This thread is a good place to put a plug in for the NATIONAL-OF and DISPLAY-OF intrinsic functions (from the '02 Standard). IBM has an extension for the 2nd paramter to these functions. See: [url=http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3lr40/7.1.15 ]http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3lr40/7.1.15 [/url] and [url=http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3lr40/7.1.31 ]http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3lr40/7.1.31 [/url] and with that extension, see the way that they do such conversions at: [url=http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3pg40/1.6.6.4]http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3pg40/1.6.6.4[/url] I am not saying that this way is easier or better than the INSPECT CONVERTING technique, but it does show one use of those intrinsic functions. NOTE: The IBM 2nd paramer actually conflicts with the 2nd parameter that was actually added to the Standard - for a default character when the functions can't find a "match". ---------------------------------------------------------------- Subject: Some sample indexed file operations Hello, There are probably a thousand and one better more established ways of going about this ... but here is a few samples of ORGANIZATION IS INDEXED [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *><* ================ *><* indexing example *><* ================ *><* :Author: Brian Tiffin *><* :Date: 17-Feb-2009 *><* :Purpose: Fun with Indexed IO routines *><* :Tectonics: cobc -x indexing.cob *> *************************************************************** identification division. program-id. indexing. environment division. configuration section. input-output section. file-control. select optional indexing assign to "indexing" organization is indexed access mode is dynamic record key is keyfield of indexing-record alternate record key is splitkey of indexing-record *> source first-part of indexing-record *> last-part of indexing-record with duplicates . data division. file section. fd indexing. 01 indexing-record. 03 keyfield pic x(8). 03 splitkey. 05 first-part pic 99. 05 middle-part pic x. 05 last-part pic 99. 03 data-part pic x(54). working-storage section. 01 display-record. 03 filler pic x(4) value spaces. 03 keyfield pic x(8). 03 filler pic xx value spaces. 03 splitkey. 05 first-part pic z9. 05 filler pic x value space. 05 middle-part pic x. 05 filler pic xx value all "+". 05 last-part pic z9. 03 filler pic x(4) value all "-". 03 data-part pic x(54). *> control break 01 oldkey pic 99x99. *> In a real app this should well be two separate flags 01 control-flag pic x. 88 no-more-duplicates value high-value when set to false is low-value. 88 no-more-records value high-value when set to false is low-value. *> *************************************************************** procedure division. *> Open optional index file for read write open i-o indexing *> populate a sample database move "1234567800a01some 12345678 data here" to indexing-record perform write-indexing-record move "8765432100a01some 87654321 data here" to indexing-record perform write-indexing-record move "1234876500a01some 12348765 data here" to indexing-record perform write-indexing-record move "8765123400a01some 87651234 data here" to indexing-record perform write-indexing-record move "1234567900b02some 12345679 data here" to indexing-record perform write-indexing-record move "9765432100b02some 97654321 data here" to indexing-record perform write-indexing-record move "1234976500b02some 12349765 data here" to indexing-record perform write-indexing-record move "9765123400b02some 97651234 data here" to indexing-record perform write-indexing-record move "1234568900c13some 12345689 data here" to indexing-record perform write-indexing-record move "9865432100c13some 98654321 data here" to indexing-record perform write-indexing-record move "1234986500c13some 12349865 data here" to indexing-record perform write-indexing-record move "9865123400c13some 98651234 data here" to indexing-record perform write-indexing-record *> close it ... not necessary, but for the example close indexing *> clear the record space for this example move spaces to indexing-record *> open the data file again open i-o indexing *> read all the duplicate 00b02 keys move 00 to first-part of indexing-record move "b" to middle-part of indexing-record move 02 to last-part of indexing-record *> using read key and then next key / last key compare set no-more-duplicates to false perform read-indexing-record perform read-next-record until no-more-duplicates *> read by key of reference ... the cool stuff move 00 to first-part of indexing-record move "a" to middle-part of indexing-record move 02 to last-part of indexing-record *> using start and read next set no-more-records to false perform start-at-key perform read-next-by-key until no-more-records *> read by primary key of reference move "87654321" to keyfield of indexing-record *> set no-more-records to false perform start-prime-key perform read-previous-by-key until no-more-records *> and with that we are done with indexing sample close indexing goback. *> *************************************************************** *><* Write paragraph write-indexing-record. write indexing-record invalid key display "rewrite key: " keyfield of indexing-record end-display rewrite indexing-record invalid key display "really bad key: " keyfield of indexing-record end-display end-rewrite end-write . *><* read by alternate key paragraph read-indexing-record. display "Reading: " splitkey of indexing-record end-display read indexing key is splitkey of indexing-record invalid key display "bad read key: " splitkey of indexing-record end-display set no-more-duplicates to true end-read . *><* read next sequential paragraph read-next-record. move corresponding indexing-record to display-record display display-record end-display move splitkey of indexing-record to oldkey read indexing next record at end set no-more-duplicates to true not at end if oldkey not equal splitkey of indexing-record set no-more-duplicates to true end-if end-read . *><* start primary key of reference paragraph start-prime-key. display "Prime < " keyfield of indexing-record end-display start indexing key is less than keyfield of indexing-record invalid key display "bad start: " keyfield of indexing-record end-display set no-more-records to true not invalid key read indexing previous record at end set no-more-records to true end-read end-start . *><* read previous by key or reference paragraph read-previous-by-key. move corresponding indexing-record to display-record display display-record end-display read indexing previous record at end set no-more-records to true end-read . *><* start alternate key of reference paragraph start-at-key. display "Seeking >= " splitkey of indexing-record end-display start indexing key is greater than or equal to splitkey of indexing-record invalid key display "bad start: " splitkey of indexing-record end-display set no-more-records to true not invalid key read indexing next record at end set no-more-records to true end-read end-start . *><* read next by key or reference paragraph read-next-by-key. move corresponding indexing-record to display-record display display-record end-display read indexing next record at end set no-more-records to true end-read . end program indexing. *><* *><* Last Update: 20090220 [/code] Outputs: (on a second or later run) [code] rewrite key: 12345678 rewrite key: 87654321 rewrite key: 12348765 rewrite key: 87651234 rewrite key: 12345679 rewrite key: 97654321 rewrite key: 12349765 rewrite key: 97651234 rewrite key: 12345689 rewrite key: 98654321 rewrite key: 12349865 rewrite key: 98651234 Reading: 00b02 12345679 0 b++ 2----some 12345679 data here 97654321 0 b++ 2----some 97654321 data here 12349765 0 b++ 2----some 12349765 data here 97651234 0 b++ 2----some 97651234 data here Seeking >= 00a02 12345679 0 b++ 2----some 12345679 data here 97654321 0 b++ 2----some 97654321 data here 12349765 0 b++ 2----some 12349765 data here 97651234 0 b++ 2----some 97651234 data here 12345689 0 c++13----some 12345689 data here 98654321 0 c++13----some 98654321 data here 12349865 0 c++13----some 12349865 data here 98651234 0 c++13----some 98651234 data here Prime < 87654321 87651234 0 a++ 1----some 87651234 data here 12349865 0 c++13----some 12349865 data here 12349765 0 b++ 2----some 12349765 data here 12348765 0 a++ 1----some 12348765 data here 12345689 0 c++13----some 12345689 data here 12345679 0 b++ 2----some 12345679 data here 12345678 0 a++ 1----some 12345678 data here [/code] ---------------------------------------------------------------- For another sample program (that doesn't do anything useful) that uses both Indexed and Relative files, check out: [url=http://home.comcast.net/~wmklein/OC/filetstx.cbl]http://home.comcast.net/~wmklein/OC/filetstx.cbl[/url] It also uses some functions and the SEARCH statement. NOTE: It also will use the "ALL" subscript, once that gets implemented, but now it is commented out. NOTE2: I also have a version with LLOBAL and nested programs, but that is waiting for a "fix" for these features in OPenCOBOL. ---------------------------------------------------------------- Subject: Vala programming language and OpenCOBOL GUI Super excited kids; Just got a hint from compsci.ca about the Vala programming language. http://live.gnome.org/Vala This is one of my "don't stop and think" posts. Too excited. Designed soley to provide C ABI access to Gnome. What this basically means is that there is no worries about C++ linkage name mangling in a C++ mode of coding. So the object files produced are directly callable by OpenCOBOL. Once I'm not so excited, I'll clean up the edges and get crackin' on a real sample. For now screenshot at http://oldsite.add1tocobol.com/tiki-browse_image.php?imageId=11 [i]Just so ya know:[/i] I got the hint about Vala just before 1:00pm. Had it built, checked, installed, (including plopping their vim syntax highlighter into my system), running and the OpenCOBOL linkage figured, a thank you post to the gent that gave me the heads up, the image up to Add1ToCOBOL for the screenshot, this post ... and it is now just after 2:00pm. [b]Vala could really help out getting full on gui to OpenCOBOL.[/b] So GTK+ is now as simple as: [b]builder.vala[/b] [code] /* GtkTreeView and GtkBuilder in Vala sample code */ /* $ valac --pkg gtk+-2.0 -o builderexample BuilderExample.vala $ ./builderexample */ using Gtk; public class BuilderSample { private const string UI_FILE = "main_window.ui"; public void run () { try { var builder = new Builder (); builder.add_from_file (UI_FILE); var window = builder.get_object ("window") as Window; setup_treeview (builder.get_object ("treeview1") as TreeView); window.show_all (); window.destroy += Gtk.main_quit; Gtk.main (); } catch (Error e) { var msg = new MessageDialog (null, DialogFlags.MODAL, MessageType.ERROR, ButtonsType.CANCEL, "Failed to load UI\n%s", e.message); msg.run (); } } private void setup_treeview (TreeView view) { /* * Use ListStore to hold accountname, accounttype, balance and * color attribute. For more info on how TreeView works take a * look at the GTK+ API. */ var listmodel = new ListStore (4, typeof (string), typeof (string), typeof (string), typeof (string)); view.set_model (listmodel); view.insert_column_with_attributes (-1, "Account Name", new CellRendererText (), "text", 0, null); view.insert_column_with_attributes (-1, "Type", new CellRendererText (), "text", 1, null); var cell = new CellRendererText (); cell.set ("foreground_set", true, null); view.insert_column_with_attributes (-1, "Balance", cell, "text", 2, "foreground", 3, null); TreeIter iter; listmodel.append (out iter); listmodel.set (iter, 0, "My Visacard", 1, "card", 2, "102,10", 3, "red", -1); listmodel.append (out iter); listmodel.set (iter, 0, "My Mastercard", 1, "card", 2, "10,20", 3, "red", -1); } public static int vala_main (string[] args) { Gtk.init (ref args); var sample = new BuilderSample (); sample.run (); return 0; } } int caller() { string[] args = {"one", "two"}; Gtk.init(ref args); var sample = new BuilderSample(); sample.run(); return 0; } [/code] [b]valacall.cob[/b] [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20090221 *> Purpose: GTK+ through Vala *> Tectonics: valac --pkg gtk+-2.0 -c -o builder builder.vala *> cobc -x `pkg-config --libs gtk+-2.0` valacall.cob gtk1.o *> *************************************************************** identification division. program-id. valacall. data division. working-storage section. 01 result usage binary-long. *> *************************************************************** procedure division. *call "gtk_sample_mycall" using omitted returning result end-call call "caller" returning result end-call goback. end program valacall. [/code] and a GtkBuilder XML ui file [code] GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Main Window 100 200 True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK True [/code] [b]tectonics[/b] [code] $ valac --pkg gtk+-2.0 -c -o builder builder.vala $ cobc -x `pkg-config --libs gtk+-2.0` valacall.cob builder.o [/code] And ./valacall pops up a TreeView shown at http://oldsite.add1tocobol.com/tiki-browse_image.php?imageId=11 Cheers, Brian MORE SOON ---------------------------------------------------------------- Ok then. This is one rapid development environment. Three minutes ... webkit browser sample embedded in OpenCOBOL ... and it passes the tests at http://acid3.acidtests.org and displays http://opencobol.org quite nicely. Woohoo! Screenshot: http://oldsite.add1tocobol.com/tiki-browse_image.php?imageId=12 Next minute ... a sample ncurses layer (wanted to try that one for Bear) ;) Two more ... a sample Unit Test system. A few more after that, a PDF viewer. Some more scant minutes ... Cairo 2D vector graphics. Screenshot at http://oldsite.add1tocobol.com/tiki-browse_image.php?imageId=13 Along with the Vala code, a wrapper is as simple as [code] /* Expose for OpenCOBOL */ int caller() { string[] args = {"cairo", "two"}; return CairoSample.valamain(args); } [/code] and [code] call "caller" returning result end-call [/code] And note: and this is why I'm so excited. Vala produces a C ABI, and very predictable linker names. Given [code] 01 args. 03 arg1 usage pointer. 03 arg2 usage pointer. [/code] and Vala prototypes of [code] public class CairoSample : Gtk.Window { ... public static int valamain (string[] args) { [/code] the call from OpenCOBOL can also be [code] call "cairo_sample_valamain" using by reference args returning result end-call [/code] And the small exposing function may not even be needed. (More experiments and tech reading before this is a guarantee or a reliable assumption in all cases). Passing real parameters will be as easy it is with the current C code we have been doing, but these Vala sources are at a much higher conceptual level, so ... The potential for this environment is vast, wide and way fun. There are Gnome library routines to convert UFT-8 text to PNG, Networking, Instant Messaging, Encryption, soundstreams, videofeeds, ..., oh so much potential and dirt easy to wrap now. Cheers, Brian ---------------------------------------------------------------- Posting reply with valabrowser called from ocweb.cob [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20090224 *> Purpose: Full on WebKit browser through Vala *> Tectonics: *> valac --pkg webkit-1.0 -c -o valabrowser valabrowser.vala *> cobc -x `pkg-config --libs webkit-1.0` ocweb.cob valabrowser.o *> *************************************************************** identification division. program-id. ocweb. data division. working-storage section. 01 result usage binary-long. *> *************************************************************** procedure division. call "valaweb" using "http://opencobol.org" & x"00" returning result end-call goback. end program ocweb. [/code] 121 lines of Vala, but basically [code] /* expose for OpenCOBOL */ int valaweb(string url) { string [] args = {"valabrowser"}; Gtk.init (ref args); var browser = new ValaBrowser (); browser.start_at (url); Gtk.main (); return 0; } [/code] Once I convince Roger to let me at cob_argc, cob_argv the mocked up string args[] will go away and we can let GTK do all it's magic option parsing as well. For a screen shot of what I'm typing right now ... well not, quite as I need the URL first ... http://oldsite.add1tocobol.com/tiki-browse_image.php?imageId=14 and just for fun a screen shot of this browser viewing the above screenshot: http://oldsite.add1tocobol.com/tiki-browse_image.php?imageId=15 :) Cheers, Brian ---------------------------------------------------------------- Hi btiffin, is it already possible to pass more things to the valabrowser like username+password for sites that are secured via .htaccess? Is there a way to get more results than the return code (for example by do a perform until 0 = 1, call 'C$SLEEP', calling valabrowser with asking for site/content/if it's open anymore/... end-perform)? ---------------------------------------------------------------- Oh absolutely ([i]he answered, all keen and not bothering to check details[/i]) ;) We'll be able to do all the things we can do with C, but in a fraction of the time. And anything that the Gnome team has done (GObject and Glib, which is where GTK is rooted) already has bindings. The beauty of Vala is that it uses the C application binary interface, on purpose. C-sharp level coding without the hassle of mangled names and specialized stack frames. And the side benefit for OpenCOBOL is pre-existing runtime bindings. Very simplistic headers is all that are normally required, and Vala does all the glue code when it generates C. Vala is very similar to OpenCOBOL is some aspects. Same autoconf/libtool configure/make build packaging. Generates C source and then calls another compiler. Etc, etc. But again, the magic from our perspective is the plethora of very high level linked libraries we can now access in very few lines of Vala. And with Roger's recent enhancements to PROC DIV USING BY we'll be able to pull off all kinds of intermixing. Cheers, Brian ---------------------------------------------------------------- Subject: Error in compiling "write myrec from spaces" [code] ... FILE-CONTROL. SELECT myfil ASSIGN TO "Testfile" ACCESS IS SEQUENTIAL STATUS IS myfil-STATUS ORGANIZATION IS LINE SEQUENTIAL. DATA DIVISION. FILE SECTION. FD myfil. 01 myrec PIC X(2000). ... write myrec from spaces end-write ...[/code] leads to [quote]Error: syntax error, unexpected SPACE, expecting "Literal" or "Identifier"[/quote] I've compiled this program using OC 1.0 without any warning. What's the problem about this line? human ---------------------------------------------------------------- Good find human. This has to do, afaik, with changes made to support PROGRAM-ID CaseSensitiveName. And it uncovers another issue. Draft 20xx specs that WRITE FROM should handle FUNCTION (with category limitations) and the current parser.y doesn't account for that, along with missing the figurative constants you have discovered. Long live pre-releases and extended soak-time. I have a trial patch, but it'll be not quite right, and in compiler speak that is the same as [b]wrong[/b], so I'm not posting it this time. ;) Cheers, Brian ---------------------------------------------------------------- Brian, could you please submit (and if possible explain) your trial patch? What is wrong about it? Maybe we can fix this as a community? I'd like to have that bug source fixed for Roger being able to just take this into the next tarball. human ---------------------------------------------------------------- Bumping up this one for a patch in OpenCOBOL-CE. @brian: here you go :-) human ---------------------------------------------------------------- Will do human. I got parser.y and friends to all write from figuratives, but changes to the parse tree need very special care and attention. Changes are relatively easy ... but. A change to the scan rules can have weird effects on completely unrelated usage of the reserved words (complex backtracking yadayada, stuff I don't feel comfortable pretending that I can internally visualize all at once). Last time I tried to run a VCG (a visual representation of the compiler graph) it ran out of resources (OpenCOBOL is likely one of the most complex scanner.l and parser.y pairs in existence). Before I fling code on the world, I'd like to get a vcgview or similar tool working to verify deltas after the changes. [i]found a script that looks like it reads gcc -fdump-tree-vcg and outputs Graphviz .dot files, need to test and maybe tweak[/i] Cheers, Brian ---------------------------------------------------------------- An addition as I've read this in the 20xx draft today: WRITE FROM SPACES/SPACE should insert ONE space into the record (depends on additional clauses and FD, of course - in line sequential files you will have either a simple additional line break or many spaces (if COB_LS_FIXED is used)). @Brian: just add it to the parser and place some test progs into the suite, we'll find errors later on, if they're in. And if you find good tools for visualizing, please use them when we have changes to parser/lexer stuff. human ---------------------------------------------------------------- Just to be clear(er) Write Rec-Name from Spaces doesn't "exactly" insert one (space) character. Rather it is more accurate to say that it MOVEs "one space chacter" (eg " ") to the 01-record name and then writes that record. This means that ALL normal rules for "padding" and writing apply, i.e. it is EXACTLY equivalent to Move " " to Rec-Name Write Rec-Name (and if Rec-Name is a NATIONAL item, the space is a national space) This may be what Human, meant, but I did want to make cerain that it was "clear". ---------------------------------------------------------------- Subject: Is there a way to output the name of an 88 or 01 level? If you have a huge list of 88 levels of a numeric var and want to do an output of the var-name you have to code a large table or evaluate to do so. Definition: [code]01 mytestvar pic 9(04). 88 mytestvar-value1 value 0001. 88 mytestvar-value2 value 0002. ... 88 mytestvar-value999 value 0999.[/code] Var name via table (unnecessary use of memory): [code]01 filler. 05 mytestvarnames-strings. 10 filler pic x(20) value "mytestvar-value1". 10 filler pic x(20) value "mytestvar-value2". ... 10 filler pic x(20) value "mytestvar-value999". 05 mytestvarnames redefines mytestvarnames-strings pic x(20) occurs 999. ... display mytestvarnames (mytestvar) end-display[/code] Var name via evaluate (unnecessary use of code and runtime): [code]evaluate mytestvar when mytestvar-value1 display "mytestvar-value1" end-display when mytestvar-value2 display "mytestvar-value2" end-display ... when mytestvar-value999 display "mytestvar-value999" end-display end-evaluate[/code] Is there an easier/better way? Maybe a cool FUNCTION like [code]display FUNCTION VARNAME("mytestvar") "has the value of " mytestvar ", this means:" FUNCTION CONSTNAME("mytestvar") "." end-display[/code] resulting in [code]mytestvar has the value of 0002, this means mytestvar-value2.[/code] I'm not sure if there is a real COBOL solution. OC knows how the names are, so it should be possible to print them in some way, shouldn't it? human ---------------------------------------------------------------- human; This could be quite tricky. There can be more than one (related or unrelated) 88 per field value, and there can be more than one value per conditional. Re; the EVALUATE, it might even be better to use [code] EVALUATE TRUE WHEN mytestvar-value1 ... WHEN mytestvar-value2 [/code] to keep with the DRY principle, although this is a pretty clear example of one of those times that you really can't not repeat yourself, as far as I know. Cheers, Brian ---------------------------------------------------------------- I may be missing something obvious here, but wouldn't the code: [code] Display "mytestvar:" mytestvar [/code] give you the information you "need". If you know what the current value is of the data item associated with the condition-name, doesn't that tell you what condition name (or names) are "in play"? If that value is valid for multiple condition-names, then the order of your procedure division statement would tell you which one was used this time. ---------------------------------------------------------------- @wmklein: The simple display would tell the value but sometimes the according name would be useful and I've seen no other way than the evaluate. @btiffin: I've changed the evaluate to the coding you've suggested (this was the original thought of). Good point with the multiple definition like [code]01 mytestvar pic 9(04). 88 mytestvar-value1 value 0001. 88 mytestvar-value2 value 0002. 88 mytestvar-value1t2 values 0001, 0002. ...[/code] How could one handle this in a FUNCTION? The point is to not repeat oneself in an evaluate. ---------------------------------------------------------------- One could handle this via a simple [code]FUNCTION CONSTNAME([i]name of a constant[/i] [, [i]delimiter for name list[/i]])[/code] If there is no delimiter passed to the function only the first entry would be given back, if there is a delimiter, all the names are given back, delimited by [i]delimiter for name list[/i]. This should work at least in concept, shouldn't it? human ---------------------------------------------------------------- This is still tricky. Internally a cob_field doesn't know it's own name. And the compiler referencing symbol table(s) have a bunch of scoping issues to deal with. The conditionals are compiled as field references and C code tests. For instance: [code] 01 var pic x. 88 isab values "a" "b". 88 isc value "c". *> *************************************************************** procedure division. move "c" to var. if isab display "a or b" end-display end-if if isc display "c" end-display end-if [/code] cobc -C cond.cob generates [code] ... /* cond.cob:20: MOVE */ { *(b_5) = 99; } /* cond.cob:21: IF */ { if ((((int)(int)(*(b_5) - 97) == 0) || ((int)(int)(*(b_5) - 98) == 0))) { /* cond.cob:22: DISPLAY */ { cob_display (0, 1, 1, &c_1); } } } /* cond.cob:24: IF */ { if (((int)(int)(*(b_5) - 99) == 0)) { /* cond.cob:25: DISPLAY */ { cob_display (0, 1, 1, &c_2); } } } ... [/code] So even if one of us (external to the compiler) wanted to write up an intrinsic, it would be hairy, as there no information passed to the run time. Of interest; note how smart the compiler is when looking at the C code for [code] 01 var pic xxx. 88 isaorb values "a" "b". *> uses cob_cmp 88 isabc value "abc". *> uses faster memcmp [/code] Quite cool. Cheers, Brian ---------------------------------------------------------------- OK, then this idea seems to be not worth of the necessary work. ---------------------------------------------------------------- Subject: Blacktie transaction manager JBoss released a first milestone of the Blacktie transaction manager under LGPL license (https://www.jboss.org/community/docs/DOC-13231). Blacktie is for C/C++ services, so one should be able to run OpenCOBOL based services under a transaction manager. I think these are very exciting opportunities for transaction processing with OpenCOBOL. Greetings, Juergen ---------------------------------------------------------------- Subject: OUTDD - DISPLAY to stderr Hi, IBM's Enterprise Cobol has a compiler directive to force DISPLAYs to go to another device than stdout. (http://publib.boulder.ibm.com/infocenter/ratdevz/v7r5/index.jsp?topic=/com.ibm.ent.cbl.zos.doc/topics/PGandLR/ui/up0052.htm) Could that be implemented as compiler option for OpenCobol, too? The idea is if you link several programs into one executable, you still can have different outputs for the programs. Thanks, Juergen ---------------------------------------------------------------- It is worth mentioning that MIcro Focus has an "OUTDD" compiler directive for compatibility with IBM and they ALSO have an INDD directive that works in a similar manner for ACCEPT statements. ---------------------------------------------------------------- I've found [url=http://www.infotraxsys.com/dev/acudocs/comprun/gt400487.htm]this point in the ACUCOBOL-Manual[/url], they have "DISPLAY UPON SYSERR" for stderr (this can be redirected to a file via -e errorfile), "DISPLAY UPON SYSOUT" for stdout (this can be redirected to a file via -o outputfile). ---------------------------------------------------------------- Subject: Comprehensive Install Windows/Cygwin document Hello everyone, Bill Klein has recently finished a 1.0 version of a very comprehensive instruction manual for getting OpenCOBOL installed and running on Windows under Cygwin. It's linked in the FAQ, or directly from http://opencobol.add1tocobol.com/oc_gettingstarted_windows.html and http://opencobol.add1tocobol.com/OC_GettingStarted_Windows.pdf It's a good read and we'd like to thank Bill for the effort and the share. Cheers, Brian ---------------------------------------------------------------- Brian, yeah it is amazing, he did a great job with it. ---------------------------------------------------------------- Nice one. If it's possible it would be good to add the MinGW installation and running process later. ---------------------------------------------------------------- Subject: Doesn't "EXIT PROGRAM" work correct? [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. 'TESTPGM'. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. cygwin. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. * WORKING-STORAGE SECTION. *----------------------------------------------------------------- LINKAGE SECTION. *----------------------------------------------------------------- PROCEDURE DIVISION. declaratives. end declaratives. *----------------------------------------------------------------- main section. 00. display 'TESTPGM loaded, calling TESTPGM1 and TESTPGM2' D x'0D0A' 'This is a debug line' end-display go to ex * display 'Not reacheable code' end-display * stop run * continue. ex. exit program. *----------------------------------------------------------------- unused section. 00. display 'Unused stuff' end-display * continue. ex. exit. *----------------------------------------------------------------- *--- End of program TESTPGM --------------------------------------[/code] With [code]$ cobc -debug -O2 -Wall -Wterminator -x TESTPGM.CBL $ ./TESTPGM.exe[/code] results in [quote]TESTPGM loaded, calling TESTPGM1 and TESTPGM2 Unused stuff[/quote] There is only an "EXIT PROGRAM" instead of "STOP RUN" because of the "GO TO ex". Should this "EXIT PROGRAM" be ignored as it is now? human ---------------------------------------------------------------- By definition, an "EXIT PROGRAM" in a MAIN program is equivalent to a "CONTINUE". An "EXIT PROGRAM" only has "impact" if executed within a CALLed subroutine. Use GOBACK, if you want something that "exits" whether in a MAIN or SUB-program. ---------------------------------------------------------------- Thank you, I wasn't sure about that. ---------------------------------------------------------------- Subject: Question about obsolete COBOL items in OpenCobol I just wanted to ask how obsolete items are handled. Are they not implemented because the recent standards mark them as obsolete? Are they just not programmed in OC because one think of these items not being worth the work? Do we want to encourage COBOL programmers to use better ways? Simple example: SOURCE-COMPUTER. myveryslowpc WITH DEBUGGING MODE. Results in "DEBUGGING MODE is obsolete in OpenCobol". For everybody not knowing what this line do: Just the same like compiling a program with -fdebugging-line. Therefore the feature itself is already implemented in OC (and I'm not sure why DEBUGGING MODE is not supported). If it should not be supported I think it would be nice to give the COBOL programmer a hint like "DEBUGGING MODE is obsolete in OpenCobol, compile with -fdebugging-line instead." What do you think? human ---------------------------------------------------------------- LOts of answers to a "simple" quesiton. 1) I assume that whether or not you get a message for WITH DEBUGGING MODE is dependent upon whether or not -Wobsolete is truned on or not (-Wall does turn it on). 2) The message that you quote does NOT mean that the feature is not supported - or at least similar messages with other compilers don't indicate this. Did you determine if you debugging lines were or were not compiled? 3) In Standard "speak" and OBSOLETE feature SHOULD be suported in that level of the compiler (Unless it is optional) but will be "removed" from the next Standard. For example, - The "Debugging Module (but NOT debugging lines) was obsolete (and optional) in the '85 Standard but was removed in teh '02 Standard - Debugging Lines (required) and Communications Section (optional) are OBSOLETE in the '02 Standard but removed from the draft revision. 4) For OpenCOBOL, this is a "little" confusing. If the compiler is (eventually) going to provide FULL support for the '85 Standard, then all the OBSOLTE features in that Standard that were REQUIRED should be supported. This includes - Alter - author, date-written, etc paragraphs - etc BUT there is no need to support the OPTIONAL features such as - segmentation - debugging module * * * My personal recommendation would be to: A) make certain that all REQUIRED but OPTIONAL fearures in teh '02 Standard are supported B) as a "medium-low" priority support the REQUIRED but OPITONAL features of the '85 Standard (some can be just as "documentatiary" support) C) NOT worry about any of the OCPTIONAL and OBSOLETE ('85 or '02 Standard) features. ---------------------------------------------------------------- And for a little more complexity added to the mix. A configuration file can be used to control the handling of warnings and errors for certain features. From default.conf [code] # Dialect features # Value: 'ok', 'archaic', 'obsolete', 'skip', 'ignore', 'unconformable' author-paragraph: obsolete memory-size-clause: obsolete multiple-file-tape-clause: obsolete label-records-clause: obsolete value-of-clause: obsolete data-records-clause: obsolete top-level-occurs-clause: skip synchronized-clause: ok goto-statement-without-name: obsolete stop-literal-statement: obsolete debugging-line: obsolete padding-character-clause: obsolete next-sentence-phrase: archaic eject-statement: skip entry-statement: obsolete move-noninteger-to-alphanumeric: error odo-without-to: ok [/code] But for full understanding, looking through the build cobc/ subdir is the best way of cyphering what's what. While not the whole picture (but pretty close), parser.y is a great read. And being open, we have that freedom. Cheers, Brian ---------------------------------------------------------------- The debugging lines are not compiled, no matter if -Wall is used or not (this leads just to the Warning message). For general, I think a little different version of wmklein's recommendation is mine (because of migrating issues of older COBOL code): A) make certain that all REQUIRED but OPTIONAL features in the '02 Standard are supported B) as a "medium-low" priority support the REQUIRED but OPTIONAL features of the '85 Standard (some can be just as "documentary" support) C) as a "very-low" priority support the OPTIONAL and OBSOLETE ('85 or '02 Standard) features. D) if there is anybody willing to implement an OPTIONAL feature and wants to submit a patch: take it. E) if there is a better way of doing an OPTIONAL/OBSOLETE thing give a hint to the developer (like in this sample -fdebugging-line) It would be interesting to read Roger's policy about this topic. ---------------------------------------------------------------- FYI, The "better way" to do debuggint lines (from an ANSI/ISO point of view) is to use "conditional compilation". This give "multi-path" compilation options and was why debugging lines were put into the OBSOLETE category in the '02 Standard (and removed in the revision). UNFORTUNATELY, they aren't implemented yet in OpenCOBOL. Therefore, it looks as if the "only" solution (at the moment) is to use the non-Standard compiler directive to turn on debugging lines and as resources exist request that - WITH DEBUGGING MODE gets implmented and - Conditional compilation gets implemented ---------------------------------------------------------------- Back to the original question; adding a more hintful message regarding WITH DEBUGGING MODE is pretty trivial and maybe it should be done. In parser.y it's just a [code] with_debugging_mode: _with DEBUGGING MODE { cb_verify (cb_debugging_line, "DEBUGGING MODE"); } ; [/code] to [code] with_debugging_mode: _with DEBUGGING MODE { cb_warning (_("Hint message here")); cb_verify (cb_debugging_line, "DEBUGGING MODE"); } [/code] or [code] with_debugging_mode: _with DEBUGGING MODE { cb_verify (cb_debugging_line, "DEBUGGING MODE, use -fdebugging-line compiler switch"); } [/code] The cb_verify is the part that checks the .conf setting and acts appropriately, but adding the hint is pretty easy, either way. And someday, these could/should all be part of a LOCALE strings msg file. But that is a slightly different (large) kettle of fish. Cheers, Brian ---------------------------------------------------------------- Subject: Where's EXEC85.COB? I was going out tonight and thought it would be a good time to run the NIST tests. I tried to follow the instructions in the README in the /tests/COBO85 directory. HOWEVER, When I tried to run "make test", it couldn't find EXEC85.COB. When I looked in the opencobol-1.1 "zipped" file and in the download newcob.val file, I can't find it. I know there are MANY copies on the web that I could find, but didn't know if these are what is expected. I do have an EXEC85.CONF but not a .COB Any suggestions? DId I unzip something incorrectly or not download something that I should have? ---------------------------------------------------------------- From the tests/cobol85/README [code] 1. EITHER - a) Download the test archive from - http://www.sim-basis.de/newcob.val.gz Uncompress it - gunzip newcob.val.gz (alternatively gzip -d newcob.val.gz) OR b) Download the test archive `newcob.val.Z' from http://www.itl.nist.gov/div897/ctg/cobol_form.htm Uncompress it: uncompress newcob.val.Z 2. Move the file newcob.val to the tests/cobol85 directory [/code] So, best to [code] $ cd tests/cobol85 $ wget http://www.sim-basis.de/newcob.val.gz (or if you have occurlrefresh compiled) $ ./occurlrefresh http://www.sim-basis.de/newcob.val.gz newcob.val.gz $ gunzip newcob.val.gz $ make tests [/code] As an aside; one advantage to [i]occurlrefresh[/i] is that it will only download a file if the source is newer than the local destination. [i]wget[/i] on the other hand (while a much more capable application) will download a new version by default. You'll end up with newcob.val.gz, newcob.val.gz.1 ... .2, .3 so unless you look, gunzip newcob.val.gz will be the oldest copy, not the newest and multiple copies can start accumulating. Cheers, Brian ---------------------------------------------------------------- Brian, Did you try those instructions? That is exaclty what I did - but when I got to the "make test", it died immeditely - and as far as I can tell it was because there was no EXEC85.COB. I definitely had a new copy of http://www.sim-basis.de/newcob.val.gz as I had never tried to run this before. ---------------------------------------------------------------- This all worked for me first try. (Ok I once had an issue where the report summaries weren't copied during a clean ./configure && make, but only after make install, but that has been fixed and I did test it after a make distclean a few times) You have this is the open-cobol-1.1 build tree? Did a ./configure, make sequence first? EXEC85.cob is created during the make test process, one of the first things it does. AFAIK, its part of the bootstrap routines to allow the tests to run in a pre-installed "open-cobol" NIST test mode. The source code is cleaned as part of the automake. Look in Makefile.am if you are the curious type. Then (and this is where I might be doing it differently), I usually make check, make install and then some time later end up running [b]tests/cobol/[/b] [i]make test[/i] when I'm exploring a feature or checking FAQs. And I've only run it once or twice from Cygwin, but yeah it worked there too, (I've used newcob.val.gz to test occurlrefresh command parser on the Cygwin side), but I'll admit it's been awhile. Cheers, ---------------------------------------------------------------- I did [code] ./configure make makce check *> everything worked make install [/code] and have been able to use cobc without any problem. Before I posted this, I looked in opencobol-1.1.tar and don't see it there. As I say, I don't think that my installation created the file. I did a (windows) search and it it isn't on my machine at all. As I say, I have an EXEC85.conf but no .COB ---------------------------------------------------------------- Yeah, you would have had to use grep to find it. ;) EXEC85.cob is created as part of the automake sequence of the [i]make test[/i]. It's generated by perl, compiled and then the source code is removed. It's in [b]Makefile.am[/b] in the tests/cobol85 subdir. Cheers, Brian ---------------------------------------------------------------- (some private emails sent, but I am still NOT having any success) I have completely re-installed Cygwin and Open-cobol-1.1. I have verified that both SED and Perl were installed by the Cygwin install (even though the README never told me that I needed them) I have followed the exact directions in the README in the /tests/cobol85 directory and when I enter make test I am still getting [code] . ../atconfig; . ../atlocal; export PATH; cobc -std=cobol85 -x EXEC85.cob Building module NC... bin/sh: ./EXEC85: No such file or directory make: *** [NC] error 127 [/code] Any other suggestions or hints? ---------------------------------------------------------------- I'm typing this from Windows for a change. I'm running the pre-release 1.7 of Cygwin (I installed it to trial a bug report on the POSIX message queue calls) [code] $ cd build $ ../cobol/occurlrefresh -b didn't dl any new tar, but I typed y to do a clean build and -b copies off ./open-cobol-1.1 then extracts the tar creating open-cobol-1.1, cd's to there, executes ./configure and then make so I'm left with an uninstalled test build but a previously installed older copy in /usr/local from a previous $ make install $ cd open-cobol-1.1/tests/cobol85 $ wget http://www.sim-basis.de/newcob.val.gz $ gunzip newcob.val.gz $ make test [/code] works fine and I get a clean summary.log (which, without thinking I just nuked with $ make clean; I dislike my greps bumping into all the NIST testing files so I routinely get rid of the extracts) I don't know what to say at this point. If $ make check worked, then the setup for cobc pre-installed has to be working. What happens if you do $ make install (from top of build dir), then $ make test (from tests/cobol85 after the newcob.val extract)? Note: I run Cygwin with a "developer" headspace. I snag a lot of the Devel, Perl, Python, Libs, Mingw, Editors, Shells, System, Text, Utils packages and pay no mind until something breaks, which is pretty much never, so I learn nothing. ;) Re; documenting need for sed and perl. Those are rarely documented as dependencies for development. They are "required bare minimums" along with a plethora of assumed POSIX tools. Cheers, ? Brian ---------------------------------------------------------------- I found the answer. I am not entirely happy about this, but at least I know what is happening and how to get around it. Norton360 (my virus protection software) has decided that there is SOMETHING in the code generated in EXEC85.exe that is a THREAT and it IMMEDIATELY deletes that file as soon as it is created. It is not the name of the file, as when I changed the name of EXEC85.cob to something else and compiled it, NORTON 360 immediately deletes that .exe as well. OK, now I know that (for me) to run the NIST tests, I need to turn off my virus protection. If anyone has any ideas why this might be, I would really be interested. (Especially if this may happen with other ".exe" files that I create while virus protection is turned on. Now, all I need is some time (a while for all the tests) when I can disconnect from the internet (to avoid virus problems) and run the full NIST tests (with virus protection turned off). (some later information) I have found what Norton 360 doesn't like about EXEC85.exe. My Norton log has the following: [code] Suspicious MH690.A Sumission details file: c:\open-cobol-1.1\tests\cobol85\EXEC85.exe Detection Digest 02 00 EA AF 06 01 00 00 00 FF 60 00 00 CE 8B CB ... 96 6F 43 3C 18 00 00 00 00 63 6A 10 49 ... [/code] ---------------------------------------------------------------- Odd, latest AVG is happy with it. That is, under Linux ---------------------------------------------------------------- Subject: Vala and GtkTextView With the simplicity of interfacing to the plethora of Gnome based libraries through Vala and the simplicity of interfacing Vala objects to OpenCOBOL, I'm starting to think it may not be that difficult to support cross platform [b]DISPLAY WINDOW[/b] and [b]ACCEPT WINDOW[/b] with some calls to [i]GtkTextView[/i] and [i]GtkTextBuffer[/i]. [i]Anyone feel up to some technical discussions on how this could best into the OpenCOBOL environment?[/i] From what I can cypher, we can implement AT ll cc functionality with some smart use of the GtkTextIter, GtkTextMark classes and a limited set of the methods. Or ... we could try and build full dialog systems with entry, buttons, labels, but I'd prefer to aim for simple text get/put within a multiline edit widget at first. Cheers, Brian ---------------------------------------------------------------- Subject: "consider installing libiconv" message While running ./config for the Nth time, I noticed a couple of messages "suggesting" that I install libiconv. I looked online for what it offers and certainly can't think of any reason NOT to install it (except for size). Is there a reason that the ./config suggests this but that the README doesn't? Any specific PROS or CONs that I should know about? ---------------------------------------------------------------- I think, (but haven't looked all that closely) that ./configure will suggest iconv as there are some po files that can be used with cobc. Keisuke added some Japanese message catalog entries. I don't think there are many CONs, other than being a real head scratcher to figure out; but luckily we don't have to very often. I could be completely wrong about the reasons. Completely. ;) Cheers, Brian ---------------------------------------------------------------- Subject: GNAT Programming Studio for OpenCOBOL Hello, It seems people jones for an IDE. Personally, GNU/Linux is my "IDE" of choice. But OpenCOBOL is an open system and towards that end, efforts should be be made to accommodate the styles, preferences, needs and wants of as many developers as feasible. So, after some research I've started work on adding a Language Support file to GPS, the GNAT Programming Studio and see if it suits. https://libre.adacore.com/gps/main.html From Debian, apt-get install gnat-gps I've tried Eclipse and it was just not up to speed on my development system. Your mileage may vary. There is an Eclipse COBOL plugin working group, but I didn't get that far. Other options, if GPS doesn't pan out (and from initial inspection it will, at least for my likings. Adding Language Support and External Tools are very well and cleanly documented) could be: Geany (SciTE and Scintilla are good systems) Anjunta KDevelop Benefits of gnat-gps so far include: GPL multi platform, multi language snappy performance very full featured including call graphs and GPS Shell a solid Ada development company behind it ([b]AdaCore[/b]) choice of a very capable internal editor, vi or emacs; out of the box all sorts of other assistive aids and perhaps, for the odd OpenCOBOL developer, a chance to pick up some Ada skills. [i]Not required, but the gnat-gps system will make picking up the skills a consequence of guilt by association.[/i] ;-) Ada is one of the few standards that include documented interface specs for COBOL (but in reality, for OpenCOBOL the also defined C interface makes more sense). GPS uses Python as a scripting extension arm so OpenCOBOL developers may end up picking up a few Python skills as well. None of this can hurt. The OpenCOBOL FAQ/Manual of Musings already has a section on use of gnatbind to link OpenCOBOL and GNAT. If I can't find one, I'll add a Language Support file for Vala as well. Vala is quickly becoming a key stepping stone to advancing OpenCOBOL capabilities in my humble opinion. I'll post a few tidbits as things progress, but I'll admit that this is an area that does not hold a overly large level of personal interest and I haven't yet been faced with a Programming in the Large challenge, so I'll be asking for volunteers to try things out; OpenCOBOL deserves it. More soon. Cheers, Brian ---------------------------------------------------------------- Hi, as you wrote there are several options for an OpenCobol IDE. I recommend jEdit (jedit.org), it's not an IDE, but a nice text editor with Cobol syntax highlighting. There are also plugins to manage your projects. If necessary, you can even edit your source with vi. It works. So, I think the editor or IDE is not the most pressing problem. There are always ways to get your programs into the computer. But a quite more pressing problem is the lack of a debugger. Right now there is no working one (with source code debugging, display and inspection of variables and so on). So, I'd rather vote for a full gdb integration than for an IDE. Thanks, Juergen ---------------------------------------------------------------- We have a team of folks that are working on a lot of these. All of them are very skilled. Btiffin being one of them. But the numbers working are still few. I personally agree that I would like to see a debugger, and at least one fella has some work on one. But it is a lot of work with two few people. Those that want a say in what is happening on the Tool and Library end of Open Cobol need to join the Add 1 to Cobol project, because that is where a lot of these decisions are being made and work is being done. So by joining you'll get a greater emphasis on your choice, and if you have the skills and knowledge to contribute your requests, you find those that are more able to assist or lend advice. Myself I am not up with the rest of yall on a lot of these other languages, so I just try to facilitate. For now anyhow. http://www.add1tocobol.com/chat.php The more often you are there, the more likely your ideas are to be implemented. Brian, thanks for this info with Gnat, I will give it a try and see how it goes. Danke again. Kind Regards ---------------------------------------------------------------- If there is a good syntax highlighting I would try to install and use GNAT on a windows machine. I really would like to have a multi level syntax (one for OpenCobol, one for preparser 1, another for preparser 2, ...). Would it be possible to use the build and debugger directly from GNAT menu (for OC of course)? ---------------------------------------------------------------- To me, (and I think this is similar to other posts) a "good" IDE for OpenCOBOL would: 1) Have COBOL sensitive syntax highlinting 2) Would be integrated with the compiler so that one can specify compiler options/directives. This should allow for cutomizable "defaults" and per program specificaiton. 3) would be intergrated with compiler messages so that one can go "directly" from compiler messages to the line whre the message points to or better would show the messages at the line in quesiton. 4) Would have "project" build capability (with linkage or build options "stored" per project as well as customizable defaults 5) Would be integrated with a source code debugger (allowing "stepping" thru the program and display and modification of variable value during exectuion. (This should include both "normal" and hex views of data and storage) 6) "integration" with (at least) a C-debugger so that a single IDE would be used to debug mixed COBOL/C applicaitons. 7) point-and-click movement between main source code and COPY members. *** Nice but not as "required" features would be A) point-click-and-move features during editing for finding references and defiinition of user-defiend words (variables and procedure-names) B) Correct-as-you-type syntax checking C) non-debugging "execution" facility for testing of applications D) "file" building and manipulation facilities (to create source data files: including indexed and relative files - possibly SQL). It is also nice to have ASCII/EBCIC conversion utilities. Some also include "view with a COBOL record layout" each record "intellegently". E) Option to debug at "C source" level (similar to existing commercial COBOL debuggers that support debugging at Assembler level) F) ability to "debug" a subprogram without coding/using a CALLing program. (dummy "passed" linkage section and not requiring a "main" program) G) point-and-click access to language reference material for each syntactic structure. (Possibly with built-in skeletons to inser into code) **** Obviously, this is a LOT - but it is what "commericial" COBOL users are used to. I wouldn't "need" all of this in version 1, but I would hope it would be the "goal". ---------------------------------------------------------------- Here is a quick customization of gnat-gps. [i]By quick I mean sorely incomplete and not all that useful yet.[/i] Debian: [code] $ sudo apt-get install gnat-gps gnat-gps-doc [/code] Run the tool [b]gnat-gps[/b] once; let it do its thing and create a [b]~/.gps[/b] local config subtree. Exit the tool. Plop this in [b]~/.gps/plug-ins/cobol.xml[/b]. [code] OpenCOBOL .cob .cbl .cpy ^(identification|id|environment|data|procedure|division| program-id|author| configuration|source-computer|object-computer| special-names|repository| input-output|file-control|io-control| file|working-storage|local-storage|linkage| communication|report|screen| declaratives|section| add|subtract|multiply|divide|compute| end-add|end-subtract|end-multiply|end-divide|end-compute| accept|display|read|write|rewrite|sort| end-accept|end-display|end-read|end-write|end-rewrite| move|evaluate|end-evaluate|if|end-if|when| (un)?string|end-(un)?string|call|end-call| filler|low-value[s]?|high-value[s]?|space[s]?|zero[es]?[s]?)\b \*>|[ ]{6}\* " ' True True False procedure ^[0-9a-z]+\. 1 subprogram_xpm OpenCOBOL -x cobc -x %f cobcrun %p OpenCOBOL cobc cobcrun [/code] To access the online docs, I put [b]xdg-open[/b] in the Edit->Preferences->External Command->HTML Browser field to get konqueror to open up tabs when clicking on the User Guide from the Welcome screen. (The Tutorial was misnamed and I had to [code] $ sudo ln -s /usr/share/doc/gnat-gps-doc/tutorial.html /usr/share/doc/gnat-gps-doc/gps-tutorial.html [/code] to get the Welcome Tutorial button to work properly. This is a sad customization so far. It doesn't really do much. I'd just like Opinions from people on whether it is worth continuing. GNAT Programming Studio is very gnatmake, gprmake and gcc centric. We can play in that field, but for now all I've added is an OpenCOBOL menu that will compile -x the currently selected .cob source. Build->Run will handle the execution of the Main file for the Project. That pretty much limits project builds to single files, but you can go ahead and add sources when you run the Project Wizard and they will show up in the selectors, [b]but this is not a valid OpenCOBOL build tool as of yet[/b]. I simply want Opinions. If no one wants to use it, I'll not bother tweaking gprmake , gnatmake, the highlighter and tools setup to properly handle cobc. If someone does think they could use it, then we'll play and see if we can't get the call graph tool and other niceties running along with proper project builds. Cheers, Brian ---------------------------------------------------------------- Another few minutes spent; In GPS, F9 invokes the menu item for Build->Make->Custom... which pops up a "Enter the command to execute:" command window. So, with a [i]normal[/i] Makefile such as [code] # Makefile for occurlrefresh occurlrefresh: occurlrefresh.cob occurl.o occurlsym.cpy cobc -x -g -debug -lcurl occurlrefresh.cob occurl.o occurl.o: occurl.c [/code] Simply type [i]make[/i] into the popup to build occurlrefresh. As long as occurlrefresh is defined as the Main File for the GPS project, Build->Run will have occurlfresh listed in a submenu. More mucking about and Run switches can be configured into the project properties. Cheers, Brian ---------------------------------------------------------------- Update; Ok, so I'm starting to like this. Added Vala language support, have menus and buttons for make, and run; which built and kicked this webkit browser instance. [i]Which, being used to Konqueror set for "Show animations once", the little moving smiley icon at the bottom of this input widget ... is distracting ;)[/i] I'll be posting a more complete opencobol.xml GPS plugin shortly; after a few more trials and tribulations. This will (well, should, not done yet) a complete GUI layer to the various cobc and valac switches (this is all built into GPS already, just need to describe the layout - they already have gcc and gnat controls). I've added a lot more keywords to the OpenCOBOL GPS editor highlighter, etc. OpenCOBOL (for those that buy into this - which is still an unknown from my point of view), in my humble opinion, could soon take a quantum leap into the land of GUIed development and development of GUIs. OpenCOBOL, Vala and GPS seem to make a good team. I'm using the tool, as I experiment, to build an ocsampler app, with a GUI frontend to the various samples that get posted, and if I get a few wrinkles figured, it'll have this webkit browser in a window for viewing documentation files. The more I uncover, the more I like GPS. We can: Define Aliases, for templated code snippets Access two form of Shell scripts (internal GPS and Python) and this is on top of all the external commands and tools that can be defined. GPS Shell commands provide access to a plethora of the IDE's internals, such as [b]MDI.save_all 0[/b] which saves current edits (and the boolean 0, can be a 1 to specify a confirmation popup). All kinds of information can be used in the scripts, and this can make for some very powerful and personalized assistive features. Define Themes for even more personal flair Add docgen types; so ocdoc can be built right in (along with ReST, ROBODoc, etc). The customization potential is pretty vast...I'll stop listing them now. Cheers, Brian P.S. Curious. Has anyone else tried GNAT Programming Studio? I'll admit that I didn't think I'd really like it, but I'm sitting here pleasantly surprised. And AdaCore produces good, reliable, "Roger level" code. ;) P.P.S. And if people don't mind cc-by, I'll be using the famfamfam very nice button sized silk icons; http://www.famfamfam.com/lab/icons/silk/ Preview of the whole set at http://www.famfamfam.com/lab/icons/silk/previews/index_abc.png ---------------------------------------------------------------- As it pertains to GPS and Bill's List of Needs; 1) Yep; working - I'll need to add more keywords and fix the regex \b word-boundary, but that's already done for the Pygments lexer for the FAQ 2) Yep; building an options screen today 3) Maybe and Yes. Internal editor, not sure - still learning all it's features but guessing yes; when configured for Emacs or Vim, absolutely. 4) Absolutely. Either through Makefile or GNAT Project files or mix of both. [b]Vala[/b] will also be supported. (I've already written the highlighter and builder hooks). 5) Not as of yet. A few options are being pursued. 6) For this we can already use gdb/ddd out of the box. 7) Yes. This will increase in power as we refine the "Categories" allowed in GPS. a) Yes and maybe. Need to work out Categories and proper integration with tags and xref tools in a form expected. b) yes and even Aliases for full on code template snippets. c) GPS comes with a fairly sophisticated Unit Test harness, as does the standard OpenCOBOL autoconf/libtool tarball and the GNOME Test Unit is only 20ish lines of Vala away from fully functional. d) Not in, but we can build a suite and attach these to buttons/menus and scripts quite easily. e) In already with gdb f) Doable, but will require work on our end g) Interface is in already and we can add docs out the yang, including docgen hooks. And we will. And the snippets can be defined as part of GPS Alias handlers. So GPS will be very close to fulfilling this laundry list. And when we get the source level debugging hooks figured out (either through gdb or Xdebug DGBp protocols or ... something as yet undiscovered) we'll be close to golden. Cheers, Brian ---------------------------------------------------------------- Continuing; Here is a work-in-progress screen shot of the GPS cobc switches dialog and the current opencobol.xml customization file I'm playing around with. Note: [i]I'll stop repeating this soon, but I want everyone to be clear:[/i] [b]this is a work in progress[/b] and doesn't get a lot of my time. But I do believe in its potential, so I will be adding more and more as the days progress. [i]There is still a lot of left over Ada controls in this file that I'm using as template; so don't worry ... those entries will disappear from any final extensions.[/i] As the emerald faced guy said ... "Ignore the man behind the curtain". And ... I'm all for someone else picking up the ball and running with it ... I won't mind at all. Someone that likes designing dialog frames ... anyone? ;-) Screenshots: OpenCOBOL project http://oldsite.add1tocobol.com/tiki-browse_image.php?imageId=17 cobc command line switch dialog (pre-alpha...INCOMPLETE) http://oldsite.add1tocobol.com/tiki-browse_image.php?imageId=18 [i]If you have tried an earlier copy, [b]remove ~/.gps/plug-ins/cobol.xml[/b] before downloading and saving this. I've changed the name to opencobol.xml and it can't co-exist in the plug-in with cobol.xml[/i] Don't cut'n'paste the xml below ... download it from http://svn.wp0.org/ocdocs/brian/opencobol.xml and save to ~/.gps/plug-ins/opencobol.xml The forum is converting some carefully crafted less-than and greater-than which causes problems with the XML. Sorry. You'll need to run GPS at least once to get a proper ~/.gps sub-directory tree. So do that before saving if necessary. [b]~/.gps/plug-ins/opencobol.xml[/b] [code] OpenCOBOL .cob .cbl .cpy ^(identification|id|environment|data|procedure|division| program-id|author| configuration|source-computer|object-computer| special-names|repository| input-output|file-control|io-control| file|working-storage|local-storage|linkage| communication|report|screen| section|declaratives| end| perform|end-perform|until|times|varying| add|subtract|multiply|divide|compute| end-add|end-subtract|end-multiply|end-divide|end-compute| accept|display|read|write|rewrite|sort| end-accept|end-display|end-read|end-write|end-rewrite| move|evaluate|end-evaluate|if|end-if|when| (un)?string|end-(un)?string|call|end-call| filler|low-value[s]?|high-value[s]?|space[s]?|zero[es]?[s]?)\b \*>|[ ]{6}\* " ' True True False procedure ^[0-9a-z]+\. 1 subprogram_xpm Vala .vala ^(bool|char|constpointer|double|float|size_t|ssize_t|string|unichar|void| int|int8|int16|int32|int64|long|short| uint|uint8|uint16|uint32|uint64|ulong|ushort| class|delegate|enum|errordomain|interface|namespace|struct| break|continue|do|for|foreach|return|while| else|if|switch| case|default| abstract|const|dynamic|ensures|extern|inline|internal|override| private|protected|public|requires|signal|static|virtual|volatile|weak| false|null|true| try|catch|finally|throw| as|base|construct|delete|get|in|is|lock|new|out|params|ref| sizeof|set|this|throws|typeof|using|value|var|yield|yields)\b // /* */ " ' True True True procedure ^[0-9a-z]+\. 1 subprogram_xpm OpenCOBOL -x Code generation Run-time checks Messages <title line="2" column="2" >Debugging Syntax make cobc -x %f cobcrun %p valac --pkg gtk+-2.0 %f OpenCOBOL make cobc cobcrun valac [/code] ---------------------------------------------------------------- A few more minutes in; Adding the first alias to opencobol.xml (again, with gt and lt entities mangled by the forum, so don't cut'n'paste, but take from http://svn.wp0.org/ocdocs/brian/opencobol.xml if you want to try it out.) [i]Don't forget to update the [b]Your Name Here[/b] on the Author line[/i]. And the %_ is where the cursor will be placed after the alias substitution, so that'll be another personal preference to set. part of [b]~/.gps/plug-ins/opencobol.xml[/b] [code] prog *>OC<* *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Your Name Here *> Date: %D *> Purpose: %_ *> Tectonics: make *> *************************************************************** identification division. program-id %(pid). environment division. configuration section. repository. special-names. input-output section. data division. file section. working-storage section. local-storage section. linkage section. screen section. procedure division. declaratives. end declaratives. 00-main. . 00-finish. goback. *> *************************************************************** end program %(pid). [/code] Starting with a blank file and typing [b]program[/b] followed by Ctrl-O will fill in a program template. http://oldsite.add1tocobol.com/tiki-browse_image.php?imageId=19 becomes http://oldsite.add1tocobol.com/tiki-browse_image.php?imageId=20 after a small popup to fill in the name the program (the %(pid) alias parameter). I guess part of the reasons for this post is to duke out a solid skeleton for OpenCOBOL sources. No one has complained too loud about what I've been using, so I'm sticking with variations of it for now. To get highlighting for the screenshot, I saved an empty [b]trial.cob[/b] before typing the [i]program[/i] alias, otherwise GPS won't know you are working on COBOL source until you tell it by setting a .cob/.cbl extension. Cheers, Brian ---------------------------------------------------------------- Going to try and add [b]cgdb[/b] support to gps. cgdb is a pretty slick curses wrapper on gdb. Split screen Source display along with the gdb console without the resource requirements of ddd. And [i]vi[/i] style key usage. Very nice. And just so everyone knows. With the source code shown, and comments inserted in the generated C code, debugging OpenCOBOL isn't all that bad. A secondary window with access to program.c.h might help when mapping generated field names with COBOL names, but ... still not too bad, and cgdb makes it one step [i]gooder[/i]. ;) Cheers, Brian ---------------------------------------------------------------- We get hungry for some screen shots :-) ---------------------------------------------------------------- It's kinda boring, but ... ;) http://oldsite.add1tocobol.com/tiki-browse_image.php?imageId=21 Added to the OpenCOBOL menu with [code] konsole --vt_sz 132x24 -e cgdb ./%p MDI.input_dialog "Enter command arguments" "Args" konsole --vt_sz 132x24 -e cgdb --args ./%p %1 [/code] and [code] cgdb cgdb... [/code] Note the "cgdb...", use any name you like, but this one uses GPS's scripting power to popup a dialog and request arguments. They get passed to the next line of the action as %1. [i](And passed to the next next line as %2, as the result of each line shifts another result for access to later lines. Two lines later the script would see the Args as %3 for instance. Very cool.)[/i] gives a lot more control, as it could have [i]list=GSP.MDI.input_dialog("Legend", "field1", "field2")[/i] and then later action lines could access list[0], list[1], react properly to Cancel, etc. I went and added, gdb, gdbtui with args, ddd to the actions and menu in my setup for GPS. This is very personal, and you'll want to run your favourite terminal. I use konsole (and I shrunk it down from 132 column for the screen shot). But here's the rub. I don't like IDE's. I like GPS as it turns out, but I don't like IDE's in principal. I'm not the guy to build the best of the best whiz bang OpenCOBOL development IDE customizations. I don't care enough. I prefer vi, make, and the CLI. Plus ... the more I putz around with GPS, the more I get attracted to GNAT development, and Python scripting. It's dragging me away from C and Vala and OpenCOBOL. ;) [i]Ada is pretty sweet by the way. AWS looks very cool.[/i] I have noticed that GPS 4.4 has COBOL source navigator in the SVN source code but I haven't delved too deep into what it offers, but it looks very, very tantalizing. So maybe it's better to build little tools and wait for the big guns at AdaCore to provide the whiz bang over the next few months. Maybe?...? [i]it may well be a GNAT/Pro feature[/i] Cheers, Brian ---------------------------------------------------------------- Thank you for your explanations so far. I think the source navigator / syntax scheme will also be available in GPL edition. The syntax scheme is likely to miss some reserved things from OC (at least the non standard functions, but other stuff, too), therefore it would be good to know how to improve them. They surely won't build an OpenCOBOL Toolchain, therefore it would be good to coming up with this until GPS 4.4 is released (earlier would mean we could use the things you've done so far). The problem with the debugger as shown on the screen shot: You debug C-Code, not COBOL. I'm not clear how COBOL-IT solved this issue but there is COBOL debugging available. Is it likely OC will have something like that, too? human ---------------------------------------------------------------- Is there anything new belonging to GNAT and OC? ---------------------------------------------------------------- Yep; Finished the cobc compiler switches screen. http://oldsite.add1tocobol.com/tiki-browse_image.php?imageId=23 But, alas and alack, when I write the xml to call the compiler with the options, gnat-gps falls down. [code] Project %p Project.get_tool_switches_as_string %1 Cobc cobc %1 %f [/code] It's either a bug or I'm not doing something correctly. Between AdaCore and myself, I'd vote that I'm the one up to the mischief. ;) This IDE will be fitting for OpenCOBOL development someday [i]or later[/i], but I'll whinge and whine again that it's not of much personal interest, so it will probably take the involvement of someone keen on graphically assistive project tools to carry this ball over the goal line. Cheers, Brian ---------------------------------------------------------------- The screenshot is nice, although I'm not sure why "Syntax checking only" is a checkbox, not part of the option fields above it. Did you posted the problem at some AdaCore forum/mailing list yet? human ---------------------------------------------------------------- On syntax check, yep that could move. On mailing list ... not yet, but it's on the todo list. I'l have to sign up and pull down the entire GNAT Community Edition for a local build of latest and greatest soon. The AdaCore team seems to enhancing GPS on a fairly regular basis. Cheers, Brian ---------------------------------------------------------------- Sounds nice, I'll have a look at the forum for news and maybe bug you from time to time if there are no recent news :-) human ---------------------------------------------------------------- Just dropped a note on comp.lang.ada, see if there is any interest from that side of the fence. Signed up on libre.adacore.com too. Snag the latest and greatest when I get the confirmation email. Next will be the gnat-gps mailing list, but I'll let that wait a bit. Too many other fun things to do with OpenCOBOL proper still. Cheers, Brian ---------------------------------------------------------------- Subject: gcc vs gcc4 When running setup of Cygwin, you can select gcc or gcc4 (with corresponding g++ and core libiraries). Cygwin has sent out an announcement indicating that "gcc" (v3) is at "end-of-life". However, when I select installing ONLY the gcc4 files for Gygwin, the ./configure step of OpenCOBOL thinks that I don't have a "valid" gcc compiler. Does OpenCOBOL work with gcc4? If so, is there a way to get ./configure to understand that is what I have installed and use it? If not, are there any plans to "upgrade" OpenCOBOL to work with gcc4? (install and then use it)? ---------------------------------------------------------------- Not that I've tried it, but give [code] ./configure --with-cc=gcc4 [/code] (Or whatever the path is) It's weird, I've been on gcc 4.3 for quite some time here in Debian Lenny land, and it's just "gcc" in terms of the command line. Cheers, Brian ---------------------------------------------------------------- Bad news, good news, bad news, good news, etc ... Well, it turns out that Cygwin setup does NOT create a gcc4 executable, but rather a gcc-4 executable. the "--with-cc" doesn't seem able to handle that. HOWEVEVER, when I "coppied" the gcc-4 to gcc (in the /bin direcotry), then ./configure worked like a charm. Even better, once I switched from using gcc3 to gcc4, now the NIST tests can be run without Norton thinking that EXEC85.exe has a virus. (This is why I was trying to switch from v3 to v4 - as I hoped the generated code would be "clean" according to Norton). ---------------------------------------------------------------- Yeah, as we talked about privately. For anyone else listening; under POSIX it is usually better to [code] $ ln -s existingfile newname [/code] and create soft links than to physically [b]cp[/b] files around when you need to trick an alias like this. And yay Bill. :) Cheers, Brian ---------------------------------------------------------------- btiffin is right and to make it clear: links work fine with cygwin, too. ---------------------------------------------------------------- Dave Korn (from Cygwin) gave me the exact .?configure command that seems to work to both use gcc V4 to build OPenCOBOL and as the compiler used by OpenCOBOL. My next update to the "getting started" (w/ Cygwin) document will include the command line: [code] ./configure --with-cc=gcc-4 CC=gcc-4 --with-gnu-ld [/code] with this, I don't think I need to do any "alias" stuff on my own and the NIST tests seem to work (without turning off virus protection). Cygwin does plan on making gcc V4 the "default" soon, but this will work until then. ---------------------------------------------------------------- Thank you for sharing this information. ---------------------------------------------------------------- Subject: PSPad anyone? Does anyone else here use PSPad to edit COBOL source code? I do and I definitely think its the best out there. It also has a setting to set a compiler to compile your source code. If anyone has any questions about how to setup PSPad for OC or if anyone is currently using it let me know your experiences and your opinions. ---------------------------------------------------------------- :-) THANK YOU!!! I really like it very much: Comments only starting in line 7, graphical view of different areas, Code Explorer, ... You can link compiler, log files etc. into PSPad, this is very fine, too. The standard COBOL syntax is fixed format. I try to update this file and submit it with a free format one to the developer soon. ---------------------------------------------------------------- This editor is written for Windows, but according to their FAQ should be usable on linux with wine, too. [quote]Q: How to run PSPad on linux from wine after clicking on file or right click Open with... A: Make script in /usr/bin/PSPad and insert inside: [code]#!/bin/bash PATH_="Z:"${1//\//\\\\} wine "/home/path/to/PSPad editor/PSPad.exe" $PATH &[/code] then you can (eg in Gnome) run Open with -> other -> select form /usr/bin/ directory created PSPad file PS: Remember adding permissions - being able to run script.[/quote] ---------------------------------------------------------------- Subject: PROCEDURE DIVISION USING BY VALUE Hello, Just so everyone knows. There were enhancements made to the 1.1 pre-release some time ago. Tests are proving ok, but the more the merrier. [code] PROCEDURE DIVISION USING BY VALUE [UNSIGNED] SIZE IS 2 var [/code] Where SIZE IS can be 1,2,4,8, AUTO (determined by PIC/USAGE), DEFAULT (4). These map to C type casts as 1 = (char), 2 = (short), 4 = (int), 8 = (long long) [i]under "normal" C compiler circumstances[/i]. This allows direct unreferenced values to be passed to OpenCOBOL called programs. [code] CALL "nested" USING BY VALUE UNSIGNED SIZE IS 2 16535 END-CALL [/code] or (and one of the main reasons this was implemented) [code] static int (*ocsql_callback)(void*, int, char*, int); [/code] so that callback routines (that can't easily be wrapped when context is hidden) can now be passed ENTRY and PROCEDURE POINTER for OpenCOBOL called programs. Note: As usual, these qualifiers are "sticky" when multiple arguments are involved in a call. [code] PROCEDURE DIVISION USING BY VALUE var1 var2. [/code] var2 is also expected on the call stack BY VALUE. (I rarely rely on that feature and usually qualify each parameter). This makes for a lot of permutations with the call frames now and a few rules. OPTIONAL is only allowed with BY REFERENCE, BY VALUE is not allowed for CHAINED program, and SIZE IS is only valid for BY VALUE. If you get a chance; try it out. BY VALUE and SIZE IS could use a good workout to ensure a smooth 1.1. We should be able to extend OpenCOBOL in weird and wonderful ways now. Cheers, Brian ---------------------------------------------------------------- Subject: OpenCOBOL community library Hello everyone. With a very nice little Hex Dump utility, and a few other callables starting to appear, I'd like to ask the forum on how they best see this being published for the good of all. Do we create a single shared object file? Leave them as separate pieces? Regardless of that decision, I think we should plan a sourcecode tarball with all the community sponsored code and perhaps a utility or two for managing and browsing the archive. The IDE thread alone has a wondrous array of information we should share in a reasonable package that lets programmers pick and choose their development toolkits from. Or no? Cheers, Brian ---------------------------------------------------------------- Personally I am all for this kind of thing being in the Add1 Repo. Even little snippets of code can go in there. ---------------------------------------------------------------- Yep; but instead of (or along side of, actually) all the singletons, we could have a managed package to simplify the downloads and build controls for people. Maybe? Cheers, Brian ---------------------------------------------------------------- I agree. Which controls would be built? Software components? ---------------------------------------------------------------- What about doing a "community source downloader website" all in COBOL? We could make a simple download site (COBOL via CGI) where people can select the sources they want (HTML-Fronted with check boxes) and get a zipped version of their selected sources. COBOL would - look for the subfolders in a special dir - for every subfolder (each source has it's own folder) there would be a checkbox and another for "download all sources" - COBOL could look for a special human readable text file parsing the "Description:", "Version:", "Author(s):" and use this information for generating the web site - if the Download-Button is used, the checked folders get gziped via CALL "SYSTEM" and are send to the browser As an extra service we could place a simple text file to the root that only contains the folder names. With this one we could use the points mentioned above to implement a "community source downloader/updater" that reads this file, checks his own folders against the text files on the server and automatically updates them. This would be cool stuff and should be not so hard to code, wouldn't it? human ---------------------------------------------------------------- I like that thinking human; exactly what I had in mind. Well, that and an associated command line tool, something like [i]occan[/i], The OpenCOBOL Central Archive Network. [i]occan list[/i], [i]occan verify package[/i], [i]occan fetch package[/i], [i]occan submit package[/i] ... etc. I'm working on a GUI frontend to list, compile and run some of the samples; so once a first cut is complete we could discuss look and feel perhaps Cheers, Brian ---------------------------------------------------------------- Yes, I like to beta test it. For committing to the "The OpenCOBOL Central Archive Network" there should be special rights needed, so do you want a command line / gui login? A simple command line menu (occan menu) should be possible with display and accept or if you like that more OCs first support of screen section. ---------------------------------------------------------------- Alright I am dumb... NOW I understand what yall mean by community library. You are talking about something similar to PERL's CPAN? or PHP's PEAR? Just call me dumb....if that's what yall meant I am all for it. ---------------------------------------------------------------- Ok, I'd like to move the actionable activities to http://add1tocobol.com. We have more control over the resources there. But the discussion should also continue here. Some questions: autoconf Makefile generated tarballs ala OC1.1 pre-release? A big fat all-in SQLite database that we can fling about? Some samples just plain old text files, some packaged? A new occan specialized package delivery system? The SVN repository as it already exists? With or without checksums? With or without pre-compiled binaries? For starters... Cheers, Brian ---------------------------------------------------------------- Executable binary verification This will require a fair amount of discussion. Security holes are hard to find when you don't think like a cracker. So ... is this even close? What this does is scan an executable (hard coded in this case as "verify" ... but we'll work out a way to get at argv[0]) and scan it byte for byte, accumulating a SHA-256 checksum digest. Of course a real procedure would use a larger buffer ... this is proof of concept. It then compares to a saved digest file (again, hardcoded for demonstration "verify.sha") and if the digest isn't readable or the 64 character hex strings don't match, spews a mismatch. For the demo, it then saves the digest ... so the next run will (should) display an "OK". After a recompile, there should be a mismatch again (internal stamp change will and should cause this delta) Second run after a recompile, should be "OK". If this is worthy of continuation, there will be a separate write utility (that then chmods the digest as readonly) and then a callable matcher routine. And a next step might be linkage to a ring-of-trust with digital keys as a second layer of verifying the digest to trusted sources? Request for comments, opinions, expertise ... Cheers, Brian [b]verify.cob[/b] [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20090308 *> Purpose: Security verification of current executable *> Tectonics: cobc -x verify.cob -lglib-2.0 *> cobc -x -fdebugging-line verify.cob -lglib-2.0 CBL_OC_DUMP.o *> *************************************************************** identification division. program-id. CBL_OC_SECURECHECK. environment division. configuration section. repository. function all intrinsic. input-output section. file-control. select optional digest assign to current-digest organization is line sequential . select executable assign to current-executable organization is sequential . data division. file section. fd executable. 01 executable-record pic x(1). fd digest. 01 digest-record pic x(64). working-storage section. 01 G_CHECKSUM_MD5 constant as 0. 01 G_CHECKSUM_SHA1 constant as 1. 01 G_CHECKSUM_SHA256 constant as 2. 01 GChecksum usage pointer. 01 checksum-ptr usage pointer. 01 checksum-buffer pic x(256) based. 01 checksum-string pic x(64). 01 current-digest pic x(10) value "verify.sha". 01 current-executable pic x(6) value "verify". 01 flag-executable pic x value low-value. 88 end-of-executable value high-value when false low-value. 01 disgest-flag pic x value low-value. 88 no-digest value high-value when false low-value. *> *************************************************************** procedure division. 00-main. *> get a checksum structure call "g_checksum_new" using by value G_CHECKSUM_SHA256 returning GChecksum end-call if GChecksum equal NULL display "Could not create the checksum" end-display stop run returning 1 end-if *> Compute the checksum a byte at a time open input executable read executable at end set end-of-executable to true end-read perform update-checksum until end-of-executable close executable *> retrieve the digest. closes off the GChecksum call "g_checksum_get_string" using by value GChecksum returning checksum-ptr end-call *> transfer the string to a usable buffer set address of checksum-buffer to checksum-ptr string checksum-buffer delimited by x"00" into checksum-string end-string *> free the checksum structure, includes the digest buffer call "g_checksum_free" using by value GChecksum end-call display "OK: " trim(checksum-string) end-display >>D call "CBL_OC_DUMP" using trim(checksum-string) end-call *> Read in expected checksum open input digest read digest at end set no-digest to true end-read close digest if no-digest or (digest-record not equal trim(checksum-string)) display "CBL_OC_SECURECHECK mismatch:" end-display display "Is: " trim(checksum-string) end-display display "Ck: " digest-record end-display end-if *> write the digest for demo open output digest move checksum-string to digest-record write digest-record end-write close digest . 00-finish. goback. *> *************************************************************** *> *************************************************************** update-checksum. call "g_checksum_update" using by value GChecksum by reference executable-record by value length(executable-record) end-call read executable at end set end-of-executable to true end-read . end program CBL_OC_SECURECHECK. [/code] [b]first run[/b] [code] OK: 651450683e8ada60c2d5c58e658fabf05d26b8e5ae758112cbb9c37e9b0d8a80 CBL_OC_SECURECHECK mismatch: Is: 651450683e8ada60c2d5c58e658fabf05d26b8e5ae758112cbb9c37e9b0d8a80 Ck: [/code] [b]second[/b] [code] OK: 651450683e8ada60c2d5c58e658fabf05d26b8e5ae758112cbb9c37e9b0d8a80 [/code] [b]after a recompile[/b] [code] OK: ddcc10e2d0b0894e4d2fac50c833ffc4bcb1266e9a0e3bddbf3ddd63d714f0ae CBL_OC_SECURECHECK mismatch: Is: ddcc10e2d0b0894e4d2fac50c833ffc4bcb1266e9a0e3bddbf3ddd63d714f0ae Ck: 651450683e8ada60c2d5c58e658fabf05d26b8e5ae758112cbb9c37e9b0d8a80 [/code] [b]subsequent runs[/b] [code] OK: ddcc10e2d0b0894e4d2fac50c833ffc4bcb1266e9a0e3bddbf3ddd63d714f0ae [/code] ---------------------------------------------------------------- Shouldn't MD5 be faster and easier? ---------------------------------------------------------------- :) glib supports that, yes. Change [code] call "g_checksum_new" using by value G_CHECKSUM_SHA256 returning GChecksum end-call [/code] to [code] call "g_checksum_new" using by value G_CHECKSUM_MD5 returning GChecksum end-call [/code] Set the digest-record and checksum-string to pic(32), change the digest name to .md5, [i]and I reordered the OK display to only show if there is a verified match.[/i] Outputs: [code] brian@homenode:~/writing/cobol$ ./verify CBL_OC_SECURECHECK mismatch: Is: 63efee848e8759f4ab9bf251e8f69945 Ck: brian@homenode:~/writing/cobol$ ./verify OK: 63efee848e8759f4ab9bf251e8f69945 [/code] If this continues, we'll need a digest creator for source code, as well as this possibility of inline runtime verification with the creator as a separate utility as part of our packaging/posting sequence. Cheers, Brian ---------------------------------------------------------------- Btiffin, Definitely we need to have the actionables on add1. Human brought up an important point, this should all be in OpenCobol itself via cgi web interface. Now with the work that you and John and Marc and Jim and human and others have done, if we could get everyone together starting on our regular meetings again (at least say every two weeks, but with refreshers every week for those that want) we could push a lot of this stuff forward. I am all convinced now to do the generator entirely in OpenCobol. The only question that really remains is whether to have an RDBMS for the generator or not. But my point is that a lot of the CobolForge, and the OCcan stuff you are talking about, there's no reason we could not, with the team of folks we have, program all of that entirely in OC, especially if we have a generator. ---------------------------------------------------------------- Subject: Bug (?) constant as length of pointer [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. 'TESTPGM'. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. * WORKING-STORAGE SECTION. 77 addr usage pointer. 01 pointer-length constant as length of addr. *----------------------------------------------------------------- LINKAGE SECTION. *----------------------------------------------------------------- PROCEDURE DIVISION. declaratives. end declaratives. *----------------------------------------------------------------- main section. 00. display 'Pointers are ' pointer-length ' long.' end-display * stop run * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program TESTPGM --------------------------------------[/code] result in [quote]$ cobc -x -debug -O2 -Wterminator TESTPGM.CBL TESTPGM.CBL:14: Error: 'addr' cannot have PICTURE clause[/quote] Shouldn't this work? If not: What other ways exists instead of [code]function length(addr)[/code]? human ---------------------------------------------------------------- Definitely a bug. It should work. It has to do with constants not really being "fields", and some interactions between relatively complex code occurring in the compiler to work with 01 constant and 78 level items along with handling of POINTER. Workaround, for now, is to do the LENGTH in the PROCEDURE DIVISION. But this will get fixed. Cheers, Brian ---------------------------------------------------------------- Subject: OpenCOBOL for Mono/.NET Has anyone thought about the idea of adapting the OpenCOBOL project to compile to Mono or .NET? There are a number of .NET COBOL products out there (NetCOBOL and NetExpress) but it would be quite nice for a lightweight open-source COBOL compiler to be on the market. Since it sounds like OpenCOBOL takes the COBOL to C, I would assume that it would be relatively simple to then take that C and compile it under both Mono and Microsoft .NET. If anyone has tried or would like to assist in trying to make this happen, let me know. I think it would get quite a bit of visibility for the project. Thanks! Robert Lair robertlair@gmail.com http://blog.robertlair.com ---------------------------------------------------------------- It was another thread on the subject with name: Another open source cobol There we discussed COBOL-IT (http://www.cobol-it.com) ---------------------------------------------------------------- Robert talked about using .NET commands in OpenCobol. COBOL-IT (which has the OC-Kernel from 2008) has no .NET compatibility. The idea sounds nice, maybe there is somebody out there able to help. ---------------------------------------------------------------- This idea has been bandied about before. An advantage of course is that we get windows compatibility immediately when it's done. But beyond my scope and I think C# is different enough from C to make it a major undertaking. ---------------------------------------------------------------- My thinking was not to take it to C#, but rather use the C++ compiler for .NET instead. I need to check to see if C will work fine with the compiler, but I would imagine it would be. But I don't see any reason to have to take the COBOL to C#. ---------------------------------------------------------------- Yep, any C compiler that can output CIL *should* be able to take the -C output (same for assemblers and -S output?) from cobc and generate something the CLR can handle. gcc4cil might be worth looking into; I think it got approved as an official gcc branch. Anyone that cares; when I read up on this, FSF and GNU are quite concerned that the "standard" ECMA-335 and ISO/IEC 23271:2006 for CIL includes runtime features that are patented by MS. They view it as a "better mousetrap" and warn against using either Mono or .NET in [i]free[/i] software. [b]Not that this should stop any OpenCOBOL developers from trying[/b]; [i]just reiterating what I read[/i]. Cheers, Brian ---------------------------------------------------------------- OpenCOBOL can be adapted to have many back-ends (CLI GCC assembler). The simplest approach would be to translate the OC syntax tree. However, it is said that a back-end is about 70-80% of the total work. There is a open source COBOL compiler for NET, written in C#, called Wildcat [1]. Looking at the screen-shot, appears to be developed on a Mac using Mono. 1) Wildcat COBOL Compiler for .NET http://www.sorn.net/projects/wildcat-cobol-compiler/ ---------------------------------------------------------------- Yeah, Sandy Dunlop, the author of Wildcat COBOL was hanging out on the #add1tocobol IRC channel for a while. At the time our conversations didn't really jive with .NET speak, but perhaps if this thread leads to an action item or two, we can drop him a line. A very nice gentleman and I'd wager more than willing to offer tidbits of wisdom. Cheers, Brian ---------------------------------------------------------------- Btiffin, Not to mention Wildcat seems to be more proof of concept as it does not fully implement Cobol. I hope we can get him (and the rest of yall) into #add1tocobol on freenode.net. Or http:/www.add1tocobol.com/chat.php ---------------------------------------------------------------- I do not see exactly the benefits of this, neither do I see an advantage of OpenCOBOL running on the Java virtual machine. - OpenCOBOL runs on Unix and Windows, so why have it running on .NET and Mono? - it will run slower on a VM - there is no way for Intra-VM communication between C# and Cobol, you'd probably have to go via C. But this should also work with C# and Cobol outside of the VM. I don't know, but there should be some analogon of Java's JNI. ---------------------------------------------------------------- Despite the run-time penalty, in my neighborhood, COBOL applications are being migrated to JAVA and NET in mass. Most positions prefer COBOL experience, but it is not considered a requirement. Getting OC to interface with the NET CLI would be no small task. As suggested on 'comp.lang.cobol', perhaps the easiest way to use OC with NET is to add some C code wrapper to the COBOL code, and create a COM binary object. ---------------------------------------------------------------- Another option to call Cobol from .net is using Corba via http://iiop-net.sourceforge.net/ A stand-alone Cobol server could be wrapped with some C++ gluecode and the Tao Orb (http://www.cs.wustl.edu/~schmidt/TAO.html) (the C++ wrapping is necessary because there is no open source IDL2Cobol compiler). Or, run the Cobol server under BlackTie (http://www.jboss.org/blacktie/) and again call it via http://iiop-net.sourceforge.net/ ---------------------------------------------------------------- [quote] essex wrote: Despite the run-time penalty, in my neighborhood, COBOL applications are being migrated to JAVA and NET in mass. [/quote] I think a lot of that is really simply because, what choice do they have? Many people that are running Cobol apps now and wish to move from the mainframe, or need to move to smaller hardware are simply unaware of the possibilities. OpenCobol being a major one. So they end up going with the only options they are aware exist. This is one of the reasons Cobol has fallen into apparent disuse. Ever price some of the compilers that are not based on .Net or Java? But now folks are having options. .Net is always a possibility for OC. But personally I will be pointing out to my clients that OC straight is one of the best options they have. ---------------------------------------------------------------- Wildcat does not seem to be available on this link anymore: http://www.sorn.net/projects/wildcat-cobol-compiler/ is there an alternative? Regards Canalside ---------------------------------------------------------------- Hi all, about this topic... I would like to know: has someone tried opencobol with .net or mono ?. If so it could be interesting have more feedback about this, examples or link to obtain more informations. Your's faithfully Federico ---------------------------------------------------------------- Most of the web links for wildcat-cobol have been removed. Even on SF. You can still find some of the sources on launchpad [1]. Just click on 'View the branch content'. 1) https://code.launchpad.net/~sandy-dunlop/wildcatcobol/i18n ---------------------------------------------------------------- maybe the wildcat-cobol is a fake :-( it's really a wildcat ! Federico ---------------------------------------------------------------- If you read the 'README.text' file in the sources, it has a Copyright notice and link to the old 'sorn.net' location. They look the same, but I don't have the sources (0.15) from 'sorn.net' to compare. I think the Csharp assembly code was removed from the Launchpad site. In any case the project was in the very stages of development and did not use any OC code. ---------------------------------------------------------------- Subject: UK Government Getting Real About Open Source England make take a serious kick at open source infrastructure. http://www.opensource.org/node/396 and the linked announcement http://www.cio.gov.uk/transformational_government/open_source/index.asp Cheers, Brian ---------------------------------------------------------------- Subject: gretl - Gnu Regression, Econometrics and Time-series Library Would there be an interest in building [b]gretl[/b] linkage to and from [b]OpenCOBOL[/b]? http://gretl.sourceforge.net/ Benefits include: - a [i]cross platform linkable library[/i] along with its CLI and GUI - active development - econometric analysis for the biz side of OpenCOBOL applications. - Very nice access to gnuplot and tight integration with R (which would save binding layers to those two as gretl could be an intermediate and it'll be a three-for-one) - a plethora of canned models - one of the input formats is OpenDocument Worksheets, [i]which fits well with John's up and coming OpenCOBOL linkage to ODF[/i]. Downsides include: - unsure (wasted time if no one needs it?) If anyone is using OpenCOBOL for business, this could be a very capable and worthy extension. [i]slightly off topic, but noteworthy[/i] Plus, if interest is there I'll build gretl support into GPS. GPS is forming up to be quite the little tool for OpenCOBOL development and I now have plans for building in support for Guile, Lua, SQLite along with Vala, (C is already very well supported internally), and anything else that OpenCOBOL can be wrapped around. GPS is becoming a point of focus for building extension tools around OpenCOBOL. Which has been a primary goal of mine since I started with OC. I've even discovered it can be used quite comfortably as a front (writing) and back (viewing, click indexing) end for the documentation efforts. Cheers, Brian ---------------------------------------------------------------- Subject: popen and fun with zenity Hello, Sample code for opening pipes with OpenCOBOL under GNU/Linux and using those to call [b]zenity[/b]. This pops up [b]yet another calendar[/b] :) If you compile with debugging lines, it requires a version of CBL_OC_DUMP. human's is quite nice, but I renamed my copy as CBL_OC_DUMP in prep for Roger potentially publishing it as a stock callable with OpenCOBOL. [b]pop.cob[/b] [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20090307 *> Purpose: Demonstrate GNU/Linux pipe calls and zenity *> Tectonics: cobc -x pop.cob *> cobc -x -fdebugging-line pop.cob CBL_OC_DUMP.o *> *************************************************************** identification division. program-id. pop. data division. working-storage section. 01 fileptr usage pointer. 01 requested constant as 80. 01 buffer pic x(requested). 01 flag pic x. 88 eof value high-value false is low-value. 01 items usage binary-long. 01 result usage binary-long. *> *************************************************************** procedure division. call "popen" using "zenity --calendar --date-format='%Y%m%d'" & x"00" "r" & x"00" returning fileptr end-call if fileptr equal NULL display "problem popen" end-display stop run returning 1 end-if set eof to false perform a-fread if items not equal zero display buffer(1 : items) with no advancing end-display >>D call "CBL_OC_DUMP" using buffer(1: items) end-call end-if perform until eof perform a-fread if items not equal zero display buffer(1 : items) with no advancing end-display >>D call "CBL_OC_DUMP" using buffer(1: items) end-call end-if end-perform call "pclose" using by value fileptr returning result end-call if result not equal zero display "pclose status not zero" end-display stop run returning result end-if goback. *> *************************************************************** *> *************************************************************** a-fread. call "fread" using by reference buffer by value 1 by value requested by value fileptr returning items end-call if items not equal requested set eof to true call "ferror" using by value fileptr returning result end-call if result not equal zero display "problem fread" end-display stop run returning result end-if end-if . end program pop. [/code] Another one without GUI. Note: the [b]requested[/b] constant can be pretty much any value, 1 to huge. [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20090307 *> Purpose: Demonstrate GNU/Linux pipe calls with grep *> Tectonics: cobc -x pop.cob *> cobc -x -fdebugging-line pop.cob CBL_OC_DUMP.o *> *************************************************************** identification division. program-id. pop. data division. working-storage section. 01 fileptr usage pointer. 01 requested constant as 80. 01 buffer pic x(requested). 01 flag pic x. 88 eof value high-value false is low-value. 01 items usage binary-long. 01 result usage binary-long. 01 newline constant as x"0a". 01 zterm constant as x"00". *> *************************************************************** procedure division. call "popen" using *> "zenity --calendar --date-format='%Y%m%d'" & zterm "grep -ni display pop.cob" & zterm "r" & zterm returning fileptr end-call if fileptr equal NULL display "problem popen" end-display stop run returning 1 end-if set eof to false perform a-fread if items not equal zero display buffer(1 : items) with no advancing end-display >>D call "CBL_OC_DUMP" using buffer(1: items) end-call end-if perform until eof perform a-fread if items not equal zero display buffer(1 : items) with no advancing end-display >>D call "CBL_OC_DUMP" using buffer(1: items) end-call end-if end-perform call "pclose" using by value fileptr returning result end-call if result not equal zero display "pclose status not zero" end-display stop run returning result end-if goback. *> *************************************************************** *> *************************************************************** a-fread. call "fread" using by reference buffer by value 1 by value requested by value fileptr returning items end-call if items not equal requested set eof to true call "ferror" using by value fileptr returning result end-call if result not equal zero display "problem fread" end-display stop run returning result end-if end-if . end program pop. [/code] Displays [code] 30: "grep -ni display pop.cob" & zterm 35: display "problem popen" end-display 42: display buffer(1 : items) with no advancing end-display 48: display buffer(1 : items) with no advancing end-display 55: display "pclose status not zero" end-display 77: display "problem fread" end-display [/code] ---------------------------------------------------------------- Subject: Process Management on Unix Dear friends, yesterday I tested the sort command and everything was fine - well done. Then I said to me, try it again with a larger input file, and so I did. After a while I came back and Poor PC was still working, doing lots of IO in the background. Soon I realized that I could not start commands from the shell anymore. The shell did not fork because all the main storage was consumed. So could not do a ps to get the process-ID of the sort in order to send a kill -9. Ok then, good old Unix is striking back, I said to me when I pushed the interrupt button. Trying to reboot, Poor PC didn't come up again, unable to load the kernel anymore. That is where I ended up with Poor PC crashed due to process management on Unix, that still needs improvement. Do you agree with that? Regards starlake ---------------------------------------------------------------- Subject: Question: How should numeric vars on level 78 be defined? [code]78 numtest value 0123. 78 strtest value 'ABCD'. call 'TESTPRG' using by content numtest strtest end-call[/code] Shows that the corresponding item in LINKAGE SECTION has to be a PIC 9(04) comp-5 (strtest has to be PIC X(04) or PIC X ANY LENGTH). Because of level 78 beeing no real standard, I'd like to ask how numeric 78er should be defined and how they are defined from other vendors. I found out that ACU uses PIC 9(04). What about MF and others? Is there some documentation about the implicit defined type for numeric 78er in OpenCobol? ---------------------------------------------------------------- Hi, According to MF documents literals used with 'by content' must be an alphanumeric or national. So what you are doing is strictly illegal in MF. Having said that, it does compile and run! It seems that MF passes 'by content numtest' as a 'S9(9) COMP'. The MF way to do what your code is doing is to use 'by value'. Using 'by value' you get to choose how big the data that is passed is. Example: [code] call 'TESTPRG' using by value numtest size 2 by content strtest [/code] Interestingly, if you use 'by value' the data is passed as COMP-5, not COMP. Leigh. ---------------------------------------------------------------- Because of the question not answered yet, I just ask it again: How should numeric vars on level 78 be defined? Is there some documentation about this already? human ---------------------------------------------------------------- This changed in the funky cool PROCEDURE DIVISION USING BY VALUE ... handler that Roger was nice enough to hash out for us, and from what I can cypher... [code] union { unsigned char data[8]; long long datall; int dataint; } content_1; content_1.dataint = 100; [/code] Is the C code generated and parameter passed with [code] 78 const1 value 100. ... CALL "subprog" USING BY CONTENT const1 END-CALL [/code] subprogram [code] LINKAGE SECTION. 01 anumber usage binary-long. PROCEDURE DIVISION USING anumber. [/code] Displays as [code] linkage: +0000000100 [/code] When defined in linkage as [code] 01 anumber PIC X(12). [/code] the generated C code is the same. An int is populated in the union and it prints as binary 100 (junk). for [code] 78 const1 value 123456789012345678. [/code] it ends up generating [code] content_1.datall = 123456789012345678LL; [/code] Note the union is an 8 byte thingy me bob (I think) in support of 64bit architectures for when references (addresses) are a full 8 bytes. So ... I'd have to guess, that Roger is doing a little bit of COBOL dynamic typing when it comes to constants. Meaning that I don't think you can pre-guess what a 78 numeric will be in the linkage with certainty, but a binary-long seems a good general case for small numbers, and binary-double for larger numbers. [i]Note, I'm probably speaking out of turn. Details are in the compiler code, I just didn't look hard enough and took a stab anyway.[/i] Cheers, Brian ---------------------------------------------------------------- [quote] btiffin wrote: [i]Note, I'm probably speaking out of turn. Details are in the compiler code, I just didn't look hard enough and took a stab anyway.[/i][/quote] I'm not able to understand the code of our great OC. Therefore I would appreciate to hear Roger's view about the necessary definition. Maybe someone knows how this is done by other compilers. human ---------------------------------------------------------------- As far as what other compilers do, there are a few things to consider: 1) 78-levels are NOT ANSI/ISO conforming so many (most?) compilers don't support them at all. 2) As far as I know, Micro Focus originated this extension and I don't think they DOCUMENT support for passing them via a CALL statement (although, I think Brian reported that this does work. 3) The '02 Standard does allow for CONSTANT (not 78-levels) and allows for passing them via a CALL statement, but ONLY when there is a CALL prototype, and this does "type forcing" for you (as it does for arithmetic expression. ---------------------------------------------------------------- Subject: Feature Request: Implicit define RETURN-UNSIGNED (redefine of RETURN-CODE) I don't know if/how other vendors handle this. By reading the ACU-Docs, I found out that ACU does an implicit (re-)define for an unsigned RETURN-CODE. [code]77 RETURN-UNSIGNED REDEFINES RETURN-CODE UNSIGNED-LONG, EXTERNAL.[/code] Could this be implemented in OC, too? Because of migrating issues it could be useful. human ---------------------------------------------------------------- Subject: OpenCOBOL wikipedia page Well, I went and added http://en.wikipedia.org/wiki/OpenCOBOL and not too many seconds later, it was tagged for lacking Notability. So, do I/we try and appease the tag or just let it slip and perhaps let the page be removed? Cheers, Brian ---------------------------------------------------------------- Good work. Please add some sources (OC FAQ, text files available on sourceforge, ...) and try to keep the page. Maybe there should be a link from the COBOL wiki entry to the OpenCOBOL entry (there are only links to opencobol.org and OC FAQ yet)? ---------------------------------------------------------------- I like the article, please try to keep it. If you browse http://en.wikipedia.org/wiki/Category:Free_compilers_and_interpreters there are lots of entries that are more prone to lack notability (Stalin anyone?) [quote] btiffin wrote: Well, I went and added http://en.wikipedia.org/wiki/OpenCOBOL and not too many seconds later, it was tagged for lacking Notability. So, do I/we try and appease the tag or just let it slip and perhaps let the page be removed? Cheers, Brian[/quote] ---------------------------------------------------------------- I added a comment in the discussion tab. More of us should do so. Also we should start adding more information to the wikipedia page.[quote] weberjn wrote: I like the article, please try to keep it. If you browse http://en.wikipedia.org/wiki/Category:Free_compilers_and_interpreters there are lots of entries that are more prone to lack notability (Stalin anyone?) ---------------------------------------------------------------- Subject: open-cobol popularity contest A not overly scientific, but IMHO still interesting graph: http://qa.debian.org/popcon-graph.php?packages=open-cobol&show_installed=on&show_vote=on&show_old=on&want_legend=on&want_ticks=on&from_date=2006-02-01&to_date=&hlght_date=&date_fmt=%25Y-%25m or for a shorter url http://qa.debian.org/popcon-graph.php and type in [b]open-cobol[/b] then Go! Cheers, Brian ---------------------------------------------------------------- Subject: What is the "end target" for END PROGRAM case handling? I know that there is a separate thread on "case matching" for PROGRAM-ID and END PROGRAM hancling, and I know that this is still "in flux" as to what how this is being handled, but I was wondering what the ULTIMATE goal is for how OpenCOBOL will handle this: A) [b]ALWAYS[/b] be case senstiive (abc NOT = AbC) B) Default to case sensitive but have an option for case insensitive c) default to ANSI/ISO conforming (not case sensitive) but have an option for case sensitive D) use the same compiler option for Program-name matching as is used for CALL handling E) Other? I am also interested as to how (if at all) this will be handled for user-defined functions. As INTRINSIC functions are always case INsesitive, will user-defined functions be the same or will they be handled as CALL statement is handled or as Program-ID/END Program is handled or other? ---------------------------------------------------------------- I am "bumping" a few of my old posts to this forum. These are items that either received no replies or that didn't receive "definititive" answers when I first asked them. Maybe someone can/will answer them now. If anyone thinks there is a better way/place for me to ask these, please let me know via the forum or off-line. Bill Klein wmklein ix.netcom.com ---------------------------------------------------------------- Subject: Unclear and missing I-O status According to libcob/fileio.h there are different file status, that I do not understand. [u]Status that seem to be missing:[/u] 24 Write beyond the maximum file size 45 Record identification failure 53 Maximum locks for this file reached. 54 Maximum locks for the runtime reached. [u]Status that seems to be not included in any standard:[/u] [i]For what is this necessary, shouldn't it be 9x?[/i] #define COB_STATUS_07_SUCCESS_NO_UNIT 07 [u]Implementor defined:[/u] [i]For what is this necessary?[/i] #define COB_STATUS_91_NOT_AVAILABLE 91 Greetings, human ---------------------------------------------------------------- I don't know how much it iwll help, but for file status "07", the paper that you should read is at: [url=http://www.cobolstandard.info/j4/files/07-0141.doc]http://www.cobolstandard.info/j4/files/07-0141.doc[/url] When I first read it, I wasn't really clear on it and now that I just reread it, I am still not clear exactly what it is saying, BUT it is supposed to answer the question about when an "07" should be issued. *** File status 45 can only happen when you support the FORMAT clause (not yet supported in OC, I think - and will be OPTIONAL in next Standard) ---------------------------------------------------------------- Subject: Flame post removed I said something bad about others, second thoughts prevailed and I'm removing the post. Cheers, Brian ---------------------------------------------------------------- Could you at least say something bad about me? ---------------------------------------------------------------- Subject: OpenCOBOL 1.1 libcob.so.1 problem I downloaded OpenCOBOL 1.1 on March 18, 2009 ./configure seemed to work fine make produced the following dialogue with errors at the bottom: checking for dlopen... no checking for dlopen in -ldl... yes checking whether a program can dlopen itself... yes checking whether a statically linked program can dlopen itself... no checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes configure: creating libtool checking whether make sets $(MAKE)... (cached) yes checking for ANSI C header files... (cached) yes checking for stdint.h... (cached) yes checking for sys/types.h... (cached) yes checking signal.h usability... yes checking signal.h presence... yes checking for signal.h... yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking malloc.h usability... yes checking malloc.h presence... yes checking for malloc.h... yes checking locale.h usability... yes checking locale.h presence... yes checking for locale.h... yes checking stddef.h usability... yes checking stddef.h presence... yes checking for stddef.h... yes checking wchar.h usability... yes checking wchar.h presence... yes checking for wchar.h... yes checking for dlfcn.h... (cached) yes checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking for an ANSI C-conforming const... yes checking whether byte ordering is bigendian... yes checking for size_t... yes checking whether struct tm is in sys/time.h or time.h... time.h checking for inline... inline checking for working alloca.h... yes checking for alloca... yes checking for vprintf... yes checking for _doprnt... no checking for memmove... yes checking for memset... yes checking for setlocale... yes checking for fcntl... yes checking for strerror... yes checking for strcasecmp... yes checking for strchr... yes checking for strrchr... yes checking for strdup... yes checking for strstr... yes checking for strtol... yes checking for gettimeofday... yes checking for ld used by GCC... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for shared library run path origin... done checking for iconv... yes checking for iconv declaration... extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); checking for nl_langinfo and CODESET... yes checking for getopt_long_only... yes checking kpathsea/getopt.h usability... no checking kpathsea/getopt.h presence... no checking for kpathsea/getopt.h... no checking getopt.h usability... yes checking getopt.h presence... yes checking for getopt.h... yes checking gmp.h usability... yes checking gmp.h presence... yes checking for gmp.h... yes checking for __gmp_randinit in -lgmp... yes checking whether NLS is requested... yes checking for msgfmt... no checking for gmsgfmt... : checking for xgettext... no checking for msgmerge... no checking whether NLS is requested... yes checking for GNU gettext in libc... yes checking whether to use NLS... yes checking where the gettext function comes from... libc checking for initscr in -lncurses... no checking for initscr in -lpdcurses... no checking for initscr in -lcurses... no checking for BDB db.h version >= 4.1 ... yes (4.4) checking for BDB 4.1 compatibility in db ... yes checking for dlopen in -lc... no checking for dlopen in -ldl... (cached) yes configure: creating ./config.status config.status: creating cob-config config.status: creating Makefile config.status: creating lib/Makefile config.status: creating libcob/Makefile config.status: creating cobc/Makefile config.status: creating bin/Makefile config.status: creating po/Makefile.in config.status: creating texi/Makefile config.status: creating config/Makefile config.status: creating copy/Makefile config.status: creating tests/atlocal config.status: creating tests/Makefile config.status: creating tests/cobol85/Makefile config.status: creating config.h config.status: executing tests/atconfig commands config.status: executing depfiles commands config.status: executing default-1 commands config.status: creating po/POTFILES config.status: creating po/Makefile OpenCOBOL Configuration: CC gcc COB_CC gcc CFLAGS -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k COB_CFLAGS -I/usr/local/include COB_EXTRA_FLAGS LDFLAGS COB_LDFLAGS COB_LIBS -L${exec_prefix}/lib -lcob -lm -lgmp -ldb -ldl COB_CONFIG_DIR ${prefix}/share/open-cobol/config COB_COPY_DIR ${prefix}/share/open-cobol/copy COB_LIBRARY_PATH ${exec_prefix}/lib/open-cobol COB_MODULE_EXT so COB_SHARED_OPT -shared COB_PIC_FLAGS -fPIC -DPIC COB_EXPORT_DYN -Wl,--export-dynamic COB_STRIP_CMD strip --strip-unneeded Dynamic loading System Use gettext for international messages: yes Use Berkeley DB for file I/O: yes Use enhanced Berkeley DB (>= 4.1) yes Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: no sys0t-debian:/testing-set-1/jim_currey/opencobol/open-cobol-1.1# make Creating defaults.h... make all-recursive make[1]: Entering directory `/testing-set-1/jim_currey/opencobol/open-cobol-1.1' Making all in lib make[2]: Entering directory `/testing-set-1/jim_currey/opencobol/open-cobol-1.1/lib' if gcc -DHAVE_CONFIG_H -I. -I. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT dummymac.o -MD -MP -MF ".deps/dummymac.Tpo" -c -o dummymac.o dummymac.c; \ then mv -f ".deps/dummymac.Tpo" ".deps/dummymac.Po"; else rm -f ".deps/dummymac.Tpo"; exit 1; fi rm -f libsupport.a ar cru libsupport.a dummymac.o ranlib libsupport.a make[2]: Leaving directory `/testing-set-1/jim_currey/opencobol/open-cobol-1.1/lib' Making all in libcob make[2]: Entering directory `/testing-set-1/jim_currey/opencobol/open-cobol-1.1/libcob' if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF ".deps/libcob_la-common.Tpo" -c -o libcob_la-common.lo `test -f 'common.c' || echo './'`common.c; \ then mv -f ".deps/libcob_la-common.Tpo" ".deps/libcob_la-common.Plo"; else rm -f ".deps/libcob_la-common.Tpo"; exit 1; fi mkdir .libs gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF .deps/libcob_la-common.Tpo -c common.c -fPIC -DPIC -o .libs/libcob_la-common.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF .deps/libcob_la-common.Tpo -c common.c -o libcob_la-common.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF ".deps/libcob_la-call.Tpo" -c -o libcob_la-call.lo `test -f 'call.c' || echo './'`call.c; \ then mv -f ".deps/libcob_la-call.Tpo" ".deps/libcob_la-call.Plo"; else rm -f ".deps/libcob_la-call.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF .deps/libcob_la-call.Tpo -c call.c -fPIC -DPIC -o .libs/libcob_la-call.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF .deps/libcob_la-call.Tpo -c call.c -o libcob_la-call.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF ".deps/libcob_la-strings.Tpo" -c -o libcob_la-strings.lo `test -f 'strings.c' || echo './'`strings.c; \ then mv -f ".deps/libcob_la-strings.Tpo" ".deps/libcob_la-strings.Plo"; else rm -f ".deps/libcob_la-strings.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF .deps/libcob_la-strings.Tpo -c strings.c -fPIC -DPIC -o .libs/libcob_la-strings.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF .deps/libcob_la-strings.Tpo -c strings.c -o libcob_la-strings.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-move.lo -MD -MP -MF ".deps/libcob_la-move.Tpo" -c -o libcob_la-move.lo `test -f 'move.c' || echo './'`move.c; \ then mv -f ".deps/libcob_la-move.Tpo" ".deps/libcob_la-move.Plo"; else rm -f ".deps/libcob_la-move.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-move.lo -MD -MP -MF .deps/libcob_la-move.Tpo -c move.c -fPIC -DPIC -o .libs/libcob_la-move.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-move.lo -MD -MP -MF .deps/libcob_la-move.Tpo -c move.c -o libcob_la-move.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF ".deps/libcob_la-numeric.Tpo" -c -o libcob_la-numeric.lo `test -f 'numeric.c' || echo './'`numeric.c; \ then mv -f ".deps/libcob_la-numeric.Tpo" ".deps/libcob_la-numeric.Plo"; else rm -f ".deps/libcob_la-numeric.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF .deps/libcob_la-numeric.Tpo -c numeric.c -fPIC -DPIC -o .libs/libcob_la-numeric.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF .deps/libcob_la-numeric.Tpo -c numeric.c -o libcob_la-numeric.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic.lo -MD -MP -MF ".deps/libcob_la-intrinsic.Tpo" -c -o libcob_la-intrinsic.lo `test -f 'intrinsic.c' || echo './'`intrinsic.c; \ then mv -f ".deps/libcob_la-intrinsic.Tpo" ".deps/libcob_la-intrinsic.Plo"; else rm -f ".deps/libcob_la-intrinsic.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic.lo -MD -MP -MF .deps/libcob_la-intrinsic.Tpo -c intrinsic.c -fPIC -DPIC -o .libs/libcob_la-intrinsic.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic.lo -MD -MP -MF .deps/libcob_la-intrinsic.Tpo -c intrinsic.c -o libcob_la-intrinsic.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF ".deps/libcob_la-fileio.Tpo" -c -o libcob_la-fileio.lo `test -f 'fileio.c' || echo './'`fileio.c; \ then mv -f ".deps/libcob_la-fileio.Tpo" ".deps/libcob_la-fileio.Plo"; else rm -f ".deps/libcob_la-fileio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF .deps/libcob_la-fileio.Tpo -c fileio.c -fPIC -DPIC -o .libs/libcob_la-fileio.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF .deps/libcob_la-fileio.Tpo -c fileio.c -o libcob_la-fileio.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-termio.lo -MD -MP -MF ".deps/libcob_la-termio.Tpo" -c -o libcob_la-termio.lo `test -f 'termio.c' || echo './'`termio.c; \ then mv -f ".deps/libcob_la-termio.Tpo" ".deps/libcob_la-termio.Plo"; else rm -f ".deps/libcob_la-termio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-termio.lo -MD -MP -MF .deps/libcob_la-termio.Tpo -c termio.c -fPIC -DPIC -o .libs/libcob_la-termio.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-termio.lo -MD -MP -MF .deps/libcob_la-termio.Tpo -c termio.c -o libcob_la-termio.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-screenio.lo -MD -MP -MF ".deps/libcob_la-screenio.Tpo" -c -o libcob_la-screenio.lo `test -f 'screenio.c' || echo './'`screenio.c; \ then mv -f ".deps/libcob_la-screenio.Tpo" ".deps/libcob_la-screenio.Plo"; else rm -f ".deps/libcob_la-screenio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-screenio.lo -MD -MP -MF .deps/libcob_la-screenio.Tpo -c screenio.c -fPIC -DPIC -o .libs/libcob_la-screenio.o screenio.c:1079: error: conflicting types for 'cob_field_display' screenio.h:88: error: previous declaration of 'cob_field_display' was here screenio.c:1085: error: conflicting types for 'cob_field_accept' screenio.h:91: error: previous declaration of 'cob_field_accept' was here make[2]: *** [libcob_la-screenio.lo] Error 1 make[2]: Leaving directory `/testing-set-1/jim_currey/opencobol/open-cobol-1.1/libcob' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/testing-set-1/jim_currey/opencobol/open-cobol-1.1' make: *** [all] Error 2 sys0t-debian:/testing-set-1/jim_currey/opencobol/open-cobol-1.1# --------------------------------------------------------- I edited screenio.c to try to get a clean compile as follows: OLD SOURCE was void cob_field_display (cob_field *f, cob_field *line, cob_field *column, cob_field *fgc, cob_field *bgc, const int attr) { } void cob_field_accept (cob_field *f, cob_field *line, cob_field *column, cob_field *fgc, cob_field *bgc, const int attr) { } NEW SOURCE IS: void cob_field_display (cob_field *f, cob_field *line, cob_field *column, cob_field *fgc, cob_field *bgc, cob_field *scroll, const int attr) { } void cob_field_accept (cob_field *f, cob_field *line, cob_field *column, cob_field *fgc, cob_field *bgc, cob_field *scroll, const int attr) { } --------------------------------------------------------- I then ran make again with no errors (that I could see), followed by make install. I then tried to compile and execute Hello World as follows: sys0t-debian:/testing-set-1/jim_currey/lm# rm hello sys0t-debian:/testing-set-1/jim_currey/lm# ldconfig sys0t-debian:/testing-set-1/jim_currey/lm# cobc -x hello.cbl sys0t-debian:/testing-set-1/jim_currey/lm# ./hello ./hello: error while loading shared libraries: libcob.so.1: cannot open shared object file: No such file or directory sys0t-debian:/testing-set-1/jim_currey/lm# ---------------------------------------------------------- Looking at the various directories I found: sys0t-debian:/# sys0t-debian:/# find -name libcob.so.1 ./testing-set-1/jim_currey/opencobol/open-cobol-1.1/libcob/.libs/libcob.so.1 ./usr/local/lib/libcob.so.1 sys0t-debian:/# cat /etc/ld.so.conf include /opencobol/open-cobol-1.1/libcbl/.libs include /etc/ld.so.conf.d/*.conf include /usr/local/lib sys0t-debian:/# ls -l /usr/local/lib total 512 -rw-r--r-- 1 root staff 274796 2009-03-21 06:57 libcob.a -rwxr-xr-x 1 root staff 818 2009-03-21 06:57 libcob.la lrwxrwxrwx 1 root staff 15 2009-03-21 06:57 libcob.so -> libcob.so.1.0.0 lrwxrwxrwx 1 root staff 15 2009-03-21 06:57 libcob.so.1 -> libcob.so.1.0.0 -rwxr-xr-x 1 root staff 225632 2009-03-21 06:57 libcob.so.1.0.0 drwxrwsr-x 3 root staff 4096 2009-03-16 13:53 python2.4 sys0t-debian:/# --------------------------------------------------------- I am new to this and apologize if I have wasted anyone's time. Would someone be kind enough to point me in the right direction? jimc ---------------------------------------------------------------- You pulled the tarball from? http://www.sim-basis.de/open-cobol-1.1.tar.gz My copy is dated 2009-02-06 and I'm pretty sure it's the latest pre-release. I'm asking because the error lines in screenio.c and screenio.h do NOT match what I have in this copy. [code] void cob_field_display .. [/code] for instance is at line 86 in screenio.h and 825 in screenio.c on this copy. So, that seems mysterious. And this seems strange: [code] sys0t-debian:/# cat /etc/ld.so.conf include /opencobol/open-cobol-1.1/libcbl/.libs include /etc/ld.so.conf.d/*.conf include /usr/local/lib [/code] My Debian copy simply has the second line, and .d/libc.conf includes the /usr/local/lib I've never seen an opencobol directory off the root, and even if, it won't be libcbl, it'd would be libcob during the temporary build state for make check and before make install. From your post, you seem to have a good clue about what you are doing, so this advice seems a little ... umm, simplistic: Perhaps a fresh download, untar to a fresh build dir? And perhaps a closer look at /etc/ld.so.conf? Cheers, Brian ---------------------------------------------------------------- Thank you for your quick and thought provoking reply! I pulled the tarball from the link on the left side of the opencobol.org site. (OpenCOBOL 1.1 pre-release link). I will start over and let you know. Thanks again. jimc ---------------------------------------------------------------- Sorry for the second post. The include opencobol line in /etc/ld.so.conf was placed in the file manually by me in a futile attempt to get by. jimc ---------------------------------------------------------------- latest> downloaded from site again (shows from www.sim-basis.de) re-ran ./configure re-ran make had same problem as before, make terminated btw, I am doing everything from root jimc ---------------------------------------------------------------- Hmm; I just tried a fresh dl and build ... worked fine. Mind you, the only thing a build requires root access for is [b]make install[/b]. All other steps can and probably should be from a user account. I'm stumped. I'm not even sure how to check all the versions of build software required. Anyone else? One thing might be ... on my Debian box; way back when, I did an [b]apt-get install open-cobol[/b] That installed 1.0. (with a /usr prefix by Debian packaging rules. The pre-release uses a dafault prefix of /usr/local) It may well have fulfilled dependencies that I didn't even notice at the time. I've never had a problem building from Roger's pre-releases. If you have aptitude, check the entry for open-cobol; see if any red missing dependencies show up. Aptitude is pretty good that way, ensuring that all required versions are up to snuff. Cheers, Brian ---------------------------------------------------------------- Sorry for the pause, I got myself into a bit of trouble. By way of explanation, I am running a 4-way SMP, HPPA machine (N4000). Lenny will not boot (known problem), so we are on Etch. While Open-COBOL is available on Lenny (@ debian.org), it does not appear to be available on Etch (including backports). I took a chance (some of you know what is coming) and got apt-get to bring me the Lenny version of Open-COBOL. I ended up with a system that was Etch at the Kernel but Lenny in almost everything else. df stopped working (known problem). I started over and clobbered the system. I downloaded and installed Etch. I then downloaded OpenCOBOL 1.0 from opencobol.org. ./configure worked fine. make worked fine. make check worked fine. make install worked fine. ldconfig seemed to work fine. I put /usr/local/lib into /etc/ld.so.conf. ldconfig worked fine again. cobc -x hello.cbl worked fine. ./hello gave me the same error as before. I moved hello into the /libcob/.libs directory and tried to execute from there. I got the same error. I sincerely appreciate the assistance that is being provided and am willing to do my part as best I can. Thank you in advance. jimc ---------------------------------------------------------------- What do you get from ldd? [code] ldd ./hello linux-gate.so.1 => (0xa7e5a000) libcob.so.1 => /usr/local/lib/libcob.so.1 (0xa7e11000) libm.so.6 => /lib/i686/cmov/libm.so.6 (0xa7deb000) libgmp.so.3 => /usr/lib/libgmp.so.3 (0xa7da7000) libncurses.so.5 => /lib/libncurses.so.5 (0xa7d75000) libdb-4.5.so => /usr/lib/libdb-4.5.so (0xa7c55000) libc.so.6 => /lib/i686/cmov/libc.so.6 (0xa7afa000) /lib/ld-linux.so.2 (0xa7e5b000) libdl.so.2 => /lib/i686/cmov/libdl.so.2 (0xa7af6000) libpthread.so.0 => /lib/i686/cmov/libpthread.so.0 (0xa7adc000) [/code] Cheers, Brian ---------------------------------------------------------------- sys0t-debian:/testing-set-1/jim_currey/lm# ldd ./hello libcob.so.1 => not found libm.so.6 => /lib/libm.so.6 (0x401a8000) libgmp.so.3 => /usr/lib/libgmp.so.3 (0x4011e000) libdb-4.4.so => /usr/lib/libdb-4.4.so (0x4035e000) libdl.so.2 => /lib/libdl.so.2 (0x40602000) libc.so.6 => /lib/libc.so.6 (0x40a08000) /lib/ld.so.1 (0x4027b000) sys0t-debian:/testing-set-1/jim_currey/lm# ---------------------------------------------------------------- Umm, anybody? ;) This seems strange, but now I'd have to guess that the ldconfig didn't seem to take. How about ldconfig -p do any libcob entries show up? Or try ./configure --prefix=/usr and things will get installed to /usr/lib and /usr/bin instead of the default /usr/local/... but I don't like that answer as much as figuring out why /usr/local isn't taking. Cheers ---------------------------------------------------------------- ldconfig -p did not seem to make a difference (at least at run-time). I have the outputs if you are interested. ./configure --prefix=/usr followed by make and make install worked like a champ! I am truly appreciative. Not knowing what the conventions are on this forum, I take the risk of offering to send you a bottle of your favorite. You have provided a valuable service both to me and to the community. Thank you. jimc :-D ---------------------------------------------------------------- Great news. ldconfig -p was just to get a print of the current cache, so you could maybe see if there was anything wonky. There is something a little fishy if /usr/local isn't used as a default LD_LIBRARY_PATH though. And no conventions. Open goodness is the aim; but if it ever did get that far my favourite is cheap, brown, thick, day old ... coffee. ;-) Cheers, Brian ---------------------------------------------------------------- Subject: ALTERNATE KEYS (Microfocus x OpenCobol) How can i declare "ALTERNATE RECORD KEYS" like that? ALTERNATE KEY IS CHVSLOG3 = CDCIDTRN OF REG-SBDLOG CDTRN OF REG-SBDLOG WITH DUPLICATES In Microfocus Cobol that code compiles without errors, but OpenCobol compiler doesn't accept this syntax. slsbdlog:11: Error: 'CHVSLOG3' undefined In a single key i remove this implicit declaration and it works fine, but in this case it doesn't works. Can someone help me with this case? Thanks! ---------------------------------------------------------------- Split Keys are not supported, yet (if I'm not wrong). Despite my personal opinion, that this should be not too hard to implement, there is the following solution: [code]ALTERNATE KEY IS CHVSLOG3 WITH DUPLICATES[/code] with FD [code] FD xyz. 01 REG-SBDLOG 05 CHVSLOG3. 10 CDCIDTRN pic xyz. 10 CDTRN pic xyz.[/code] If these items does not come after each other in the file record you have to define an extra var for the key and have to move the entries every time you want to use this key / change the according items. ---------------------------------------------------------------- Excuse me, but I was not very clear in my question and I will redo it. This time putting the whole code: How can i declare "ALTERNATE RECORD KEYS" like that? SELECT ARQ-SBDLOG ASSIGN "SBDLOG" ORGANIZATION INDEXED ACCESS DYNAMIC LOCK MODE IS AUTOMATIC RECORD KEY IS CHVSLOG1 = NRNSU OF REG-SBDLOG ALTERNATE KEY IS CHVSLOG2 = NRCNT OF REG-SBDLOG WITH DUPLICATES ALTERNATE KEY IS CHVSLOG3 = CDCIDTRN OF REG-SBDLOG CDTRN OF REG-SBDLOG WITH DUPLICATES ALTERNATE KEY IS CHVSLOG4 = CDCIDTRN OF REG-SBDLOG NRMTIOPD OF REG-SBDLOG IDETCORI OF REG-SBDLOG WITH DUPLICATES ALTERNATE KEY IS CHVSLOG5 = STTRN OF REG-SBDLOG WITH DUPLICATES FILE STATUS WSS-STATUS . In Microfocus Cobol that code compiles without errors, but COBOL-IT compiler doesn't accept this syntax. slsbdlog:Error: 'CHVSLOG1' undefined slsbdlog:Error: 'CHVSLOG2' undefined slsbdlog:Error: 'CHVSLOG3' undefined slsbdlog:Error: 'CHVSLOG4' undefined slsbdlog:Error: 'CHVSLOG5' undefined In a single key i remove this implicit declaration and it works fine, but in this case it doesn't works. Is there a way to do this, using the same implicit declaration of Mirofocus Cobol, ie without having to declare variables (CHVSLOG1, CHVSLOG2, CHVSLOG3, CHVSLOG4, CHVSLOG5)? Thanks! ---------------------------------------------------------------- I think you were clear but you didn't understand the response. In your code you have [code]ALTERNATE KEY IS CHVSLOG4 =[/code] What that "=" sign in the Select/Assign ALTERNATE KEY prhase means to Micro Focus is that you are defining a "split key". This is NOT a Standard part of COBOL (for the '85 Standard") and is defined slighly differently in the '02 Standard. The rsponse you received indiates that this syntax is NOT supported (yet) in OpenCOBOL. If the two "subfields) are deinfed next to each other in the original FD, then the suggestion was made that you could "group" them under a new field and use that as the alternate key. If the two fields are NOT next to each otehr in the FD, then there is (currently) no way to do this in OpenCOBOL. If anyone knows (for certain) what the development status is for providing support for split keys (using either the MF or the '02 Standard syntax), this would tell you when/if you will be able to use this code in OpenCOBOL. Is this clear? ---------------------------------------------------------------- Split keys. The SOURCE IS syntax of 20xx draft (unsure of other specs ... I only ever read the draft), is supported by OC, but only to the extent of the compiler generating warning messages that split keys are not supported, followed by "undefined" errors when that key is used in the procedure divion or elsewhere. [code] ALTERNATE KEY IS newkey SOURCE IS part1 part2 [/code] is pseudo-allowable syntax, but again, doesn't create a reference for the split key, therefore not being usable. [code] indexing.cob:27: Warning: 'SPLIT KEYS' not implemented indexing.cob:24: Error: 'newkey' undefined [/code] Cheers, Brian ---------------------------------------------------------------- Subject: Cobol BATCH IDE Framework Ten years ago I've made a framework to do [color=BLUE][url=http://sites.google.com/site/batchide/]Cobol BATCH programming[/url] [/color]much easier in order to make a huge data conversion/migration. (the definition of a program had an average of 25 lines and the equivalent expanded cobol source had more than 1000 lines of code) info in the site http://sites.google.com/site/batchide/ ---------------------------------------------------------------- This seems to be a complex but maybe valuable piece of software. Does the BATCH IDE output 100% OC compatible source? I found no sample generated programs at the web site and no download possibility of BATCH IDE. Are the programs compiled automatically and did you've tried this stuff with OC? ---------------------------------------------------------------- It was done to two target cobol compilers: Microfocus in the unix server and the PC, and Cobol of the mainframe Cyber (Control Data). It is easy to adapt to OC. The front end is MS Access with two or three OCX components and the application is not 'packaged' for easy installation. To be adapted someone has to know Acess (there is no configuration screen) and the paths and invocation of compiler and sort commands are inside code. It is one of the best applications I've done and took more than one year of work. It is a pitty if it dies in my computer. Years after done the actual data migration job I saw the application ADVANTAGE of CA Associates and mine solution his better. What the future? May be gather a team to make the next version. Make a user manual? Move the frontend out of Access is a lot of work but is desirable. Better performance is obtainable by several ways not seen elsewhere using cobol. In this momment if I have to do heavy batch programming again I will use my framework. It was written by someone (me) that spent all working life doing Cobol programs (among others: Access, PL/SQL, C, Pascal,Prolog,BrookGPU,...) Tomorrow I will actualize the site with examples of a defined program, a generated program, a bash job, and PC job. ---------------------------------------------------------------- This sounds good. We could use OC for file access and logic and use the evolving C-Frontends. Do you have a OC version to try if the output is OC compatible ("compile" with cobc -fsyntax-only -Wall -Wcolumn-overflow -Wterminator yourprog.cob)? ---------------------------------------------------------------- I've updated the site [url=http://sites.google.com/site/batchide/]Cobool BATCH IDE[/url] and included more screens and datafiles as examples. The generated source code is self contained and therefore can be compiled without dependencies on other files (there is no COPYs). I'do not have installed OC for now. You can try, please, and email-me the result . The beginning of the file are directives to MF compiler. I use ACCEPT FROM COMMAND-LINE to read the command line parameters. I do not know to on OC. the $set SEQUENTIAL"LINE" is because the I use ORGANIZATION SEQUENTIAL meaning ORGANIZATION LINE SEQUENTIAL. Also the Locking can be different I use SELECT ... ORGANIZATION ... LOCK MANUAL FILE STATUS IS .. .. and statements like this ... READ CDF610 WITH LOCK . ... ... UNLOCK CDF610 . I think that these are the only important differences. ---------------------------------------------------------------- Subject: suggested documentation Being new to OpenCOBOL (thanks to Mr. Tiffin for getting us up and running), I hope to save some head bashing by starting in the right direction. Can someone point me to a manual or documentation set that does a good job of defining the features and syntax that OpenCOBOL supports now? Our shop is heavily Cobol oriented on multiple architectures. We are familiar with how to tackle conversion issues. What we are looking for is guidance that will help us write new code that will comply with the spirit of the OpenCOBOL dialect. Clearly we could go down the MF, RM, MVS or other dialect path. We would prefer to stay true to the base implementation. Thank you in advance. jimc ---------------------------------------------------------------- After checking out the User Manual wiki pages (Left side menu and sorely incomplete compared to the coverage of the actual compiler system), try the FAQ. It's not really a FAQ. More a manual of musings and tidbits. The OpenCOBOL Developer Guide is in progress. Our good Bill Klein has created a getting started with Cygwin document as well. It's linked to from the FAQ. The FAQ has lots of links in it. Cheers, Brian ---------------------------------------------------------------- Subject: Compiler listing drops comment lines With OpenCOBOL 1.0 a cobc -t pfname source.cbl results is a blank line in pfname for each comment line I have looked in the FAQ, the Wiki, and the User Manual, the Install Guide and on the WEB for guidance. I hope that someone will be kind enough to direct me. jimc ---------------------------------------------------------------- I just wanted to add that the same "problem" (ussue?) occurs with OC 1.1 as is reported for 1.0a ---------------------------------------------------------------- The next 1.1 pre-release will change everthing with regards to listing files. -t is being dropped, -P ??? added and it will allow a call to the ever nifty CobXRef utility. So we get more consistent, better, code listings and the bonus of a cross reference. Code is written afaik. We await the release after some testing and time found to roll it up. Cheers, Brian ---------------------------------------------------------------- Wow, I really like to see the results. ---------------------------------------------------------------- Subject: binary files, comp-3 I've just downloaded and started playing with OC 1.0 in windows xp with cygwin 1.5.25 and I'm having a problem reading binary files. I'm trying to convert a pair of files with comp-3 fields into equivelent files with those fields in display format so that I can easily upload them to an IBM mainframe. 0ne of the files in question is the product.dat file in the cics for cobol programmers examples at http://www.murach.com/dloads/mccp/mccp_programs.exe. My program looks like ID DIVISION. PROGRAM-ID. CPYDATA. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT PRODUCT ASSIGN 'I:\KICKS\doc\Murach\CICS\Programs\Data files\PRODUCT.dat' organization is line sequential. SELECT NEW-PRODUCT ASSIGN 'I:\KICKS\doc\Murach\CICS\Programs\Data files\NPRODUCT.dat' organization is line sequential. DATA DIVISION. FILE SECTION. FD PRODUCT. 01 PRODUCT-MASTER-RECORD. 05 PRM-PRODUCT-CODE PIC X(10). 05 PRM-PRODUCT-DESCRIPTION PIC X(20). 05 PRM-UNIT-PRICE PIC S9(07)V99 COMP-3. 05 PRM-QUANTITY-ON-HAND PIC S9(07) COMP-3. FD NEW-PRODUCT. 01 NEW-PRODUCT-MASTER-RECORD. 05 PRM-PRODUCT-CODE PIC X(10). 05 PRM-PRODUCT-DESCRIPTION PIC X(20). 05 PRM-UNIT-PRICE PIC S9(07)V99 . 05 PRM-QUANTITY-ON-HAND PIC S9(07) . PROCEDURE DIVISION. OPEN INPUT PRODUCT. OPEN OUTPUT NEW-PRODUCT. COPY-PRODUCT. READ PRODUCT RECORD AT END GO TO DONE-PAR. MOVE CORR PRODUCT-MASTER-RECORD TO NEW-PRODUCT-MASTER-RECORD. WRITE NEW-PRODUCT-MASTER-RECORD. GO TO COPY-PRODUCT. DONE-PAR. CLOSE PRODUCT, NEW-PRODUCT. STOP RUN. the output looks like AB-100 FRAMIS-A 0000000001000000 3000-001 ETHERNET CARD 0000000000226000 3000-002 ETHERNET CARD PLUS 00000000003=?>60 3000-003 ETHERNET CARD 16 00000000002=?000 3100-001 5600 BAUD MODEM 0000000000900000 3100-002 5600 MNP-5 MODEM 0000000001097>60 3200-001 4 PORT PASSIVE HUB 0000000002020202 garbage record with nulls in it 3200-002 8-PORT ACTIVE HUB 0000000028=>6000 so I have (at least) two issues: (1) comp-3 is not unpacking right, which I think is 'cause the original file has bad data, and (2) some of the binary data in the comp-3 fields is causing open cobol's read to function incorrectly (I think). If I change 'line sequential' to just 'sequential' the results are even worse (but I can't paste the results here 'cause my editor refuses to copy lines containing nulls). So what am I doing wrong?? ---------------------------------------------------------------- It seems like an inherently bad idea to define a file containing binary data as line sequential. However, looking at the data file I see that the records do vary in length and do have a CR/LF line terminator. I think that your problem is that, after the 1st 3 fields, the records seem to have varying layouts too. Leigh. ---------------------------------------------------------------- Hello, Yeah, I don't have access to the data files, but OC's LINE SEQUENTIAL handler will read a line a byte at a time looking for 10's (LF). 13's are skipped over. It'll be completely data dependent on what's in the COMP-3 fields. And Cygwin throws its own smurfing of Windows data into the mix. Cygwin has a global install setting controlling whether or not the files are treated as POSIX "binary" mode byte streams vs the Windows line oriented mode with Ctrl-Z etc etc. Do the Murach files have any big/little endian issues? It could be chaos. ;) Cheers, Brian ---------------------------------------------------------------- Hello, Using comp-3 prohibits line sequential files. You must use binary sequential organization. Better use OC 1.1 Regards Bear ---------------------------------------------------------------- HI, Try these modifications to see what's going on. DIVISION. PROGRAM-ID. CPYDATA. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT PRODUCT ASSIGN 'I:\KICKS\doc\Murach\CICS\Programs\Data files\PRODUCT.dat' organization is indexed RECORD KEY IS PRM-PRODUCT-CODE ACCESS MODE IS SEQUENTIAL FILE STATUS IS IN-FILE-STATUS . SELECT NEW-PRODUCT ASSIGN 'I:\KICKS\doc\Murach\CICS\Programs\Data files\NPRODUCT.txt' organization is line sequential. DATA DIVISION. FILE SECTION. FD PRODUCT. 01 PRODUCT-MASTER-RECORD. 05 PRM-PRODUCT-CODE PIC X(10). 05 PRM-PRODUCT-DESCRIPTION PIC X(20). 05 PRM-UNIT-PRICE PIC S9(07)V99 COMP-3. 05 PRM-QUANTITY-ON-HAND PIC S9(07) COMP-3. FD NEW-PRODUCT. 01 NEW-PRODUCT-MASTER-RECORD. 05 PRM-PRODUCT-CODE PIC X(10). 05 PRM-PRODUCT-DESCRIPTION PIC X(20). 05 PRM-UNIT-PRICE PIC S9(07)V99 . 05 PRM-QUANTITY-ON-HAND PIC S9(07) . WORKING-STORAGE SECTION. 01 IN-FILE-STATUS. 05 WS-FILE-STATUS-1 PIC X(2). 88 STAT-F-I-OK VALUE "00". 88 STAT-F-I-DUPLICATE-KEYs VALUE "21". 88 STAT-F-I-KEY-ALREADY-EXIST VALUE "22". 88 STAT-F-I-KEY-NOT-FOUND VALUE "23". ETC PROCEDURE DIVISION. OPEN INPUT PRODUCT. OPEN OUTPUT NEW-PRODUCT. COPY-PRODUCT. READ PRODUCT RECORD AT END GO TO DONE-PAR. MOVE CORR PRODUCT-MASTER-RECORD TO NEW-PRODUCT-MASTER-RECORD. DISPLAY 'FILE STATUS IS' IN-FILE-STATUS WRITE NEW-PRODUCT-MASTER-RECORD. GO TO COPY-PRODUCT. DONE-PAR. CLOSE PRODUCT, NEW-PRODUCT. STOP RUN. You should see the file status errors. I coded only 4 of them.... Other ones are documented in your best Cobol user guide. =============== See next linessssss for explanationsssss of your problem! Two different and distincts situations can explain your problem. 1) end of line data file format 2) comp-3 data structure combined wit an indexed file format For 1) 1) the "WHY" Apple, microsoft and Unix/Linux use a different eol (end or line) marker! MacIntosh CR Linux LF Windows CR/LF (!!) SO. A flat file transfered from one to other OS must be converted before a reading without error. USe an utility like DOS2UNIX.exe or UNIX2DOS.exe to reformat the flat file on your local OS. 1) the "HOW" These utilities insert or drop the eol marker to reflect the OS! The file will be more readable. IN COBOL, the line sequential and sequential parameter of SELECT command have a direct impact on the eol flat file structure. With ORGANIZATION IS SEQUENTIAL, the compiler generate a unique physical record, appending all logical records without eol marker between them. NOTEPAD will show you the file as a very long (and only one) record. With ORGANIZATION IS LINE SEQUENTIAL, the compiler generate an eol marker at every unique physical record. SO, the logical record and the physical record are identical. This form is more easily readable by a flat file editor like notepad. For 2) 2) the " why" comp-3 data structure and the .dat file format are two distinct situations why it is unreadable for you. TRY the modifications at the top. If the file has been written with a cobol program as .dat file, you are in trouble, except if you known the right data structure. (have you ever try to read an ?.xls ,?.mdb or ?.DOC file with notepad .....) SO. a file saved with a .dat must be converted to a flat file before to read it. the comp-3 option is a compression of numeric data, as proposed by IBM engineers to save CPU process and disk space a long time ago. Yo want to read it easily? DON'T use the comp-3 option for the PICTURE of th OUTPUT file. The compiler is your friend; it will made the uncompression to display the numeric value as you expected. Lucky! ---------------------------------------------------------------- Subject: Feature Request: Add Packaged/Copyright information of cobc -version to ./configure -V cobc -version results in [quote]cobc (OpenCOBOL) 1.1.5 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Mar 11 2009 09:00:03 Packaged Feb 06 2009 10:30:55 CET[/quote] ./configure -V results in [quote]OpenCOBOL configure 1.1 generated by GNU Autoconf[...][/quote] Could you please add the additional information to ./configure, too? A sample could be [quote]OpenCOBOL configure 1.1 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Packaged Feb 06 2009 10:30:55 CET generated by GNU Autoconf [...][/quote] Thank you in advance human ---------------------------------------------------------------- That's a little tricky. The copyright inside the configure script is [code] # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. [/code] So it might not be right to claim a copyright in the -V unless it could be made explicit that the notice is for the copyrights over OpenCOBOL 1.x and not the configure script generated by the autoconf. Cheers, Brian ---------------------------------------------------------------- Currently, there are both copyright messages (OC and autoconf). Only the additional information is missing. ---------------------------------------------------------------- Subject: FILE DELETE STATUS=48 I'm having a little bit of a problem here. I want to delete records from a text file that i am writing into. Here is my code. Untitled
        IDENTIFICATION DIVISION.
        PROGRAM-ID. InsertRecords.
        AUTHOR. Bryan Anderson.
       * This program updates the Students.Dat file with insertions
       * taken from the Transins.Dat file to create a new file
       * - Students.New - which contains the inserted records.
        
        ENVIRONMENT DIVISION.
        INPUT-OUTPUT SECTION.
        FILE-CONTROL.
              SELECT StudentRecords ASSIGN "MasterStudentFile.txt"
                     ORGANIZATION IS LINE SEQUENTIAL
                     ACCESS MODE IS SEQUENTIAL.
        
              SELECT TransRecords ASSIGN "StudentTransactionFile.txt"
                     ORGANIZATION IS LINE SEQUENTIAL
                     ACCESS MODE IS SEQUENTIAL.
        
              SELECT OPTIONAL NewStudentRecords ASSIGN
                    "newmasterstufile.txt"
                     ORGANIZATION IS LINE SEQUENTIAL
                     ACCESS MODE IS SEQUENTIAL.
        
        
        DATA DIVISION.
        FILE SECTION.
        FD StudentRecords.
        01 StudentRecord.
           88 EndOfStudentFile     VALUE HIGH-VALUES.
           02 StudentID            PIC X(6).
           02 FILLER               PIC X(40).
        
        FD TransRecords.
        01 TransRecord.
           88 EndOfTransFile       VALUE HIGH-VALUES.
           02 TransStudentID       PIC X(6).
           02 FILLER               PIC X(40).
        
        FD NewStudentRecords.
        01 NewStudentRecord        PIC X(46).
        
        
        
        
        PROCEDURE DIVISION.
        BEGIN.
            OPEN INPUT StudentRecords
            OPEN INPUT TransRecords
            OPEN I-O NewStudentRecords
        
            READ StudentRecords
               AT END SET EndOfStudentFile TO TRUE
            END-READ
        
            READ TransRecords
               AT END SET EndOfTransFile TO TRUE
            END-READ
        
            PERFORM UNTIL (EndOfStudentFile) AND (EndOfTransFile)
               EVALUATE TRUE
                 WHEN (StudentID < TransStudentID)
                      WRITE NewStudentRecord FROM StudentRecord
                      READ StudentRecords
                         AT END SET EndOfStudentFile TO TRUE
                      END-READ
        
                 WHEN (StudentID > TransStudentID)
                      WRITE NewStudentRecord FROM TransRecord
                      READ TransRecords
                          AT END SET EndOfTransFile TO TRUE
                      END-READ
        
                 WHEN (StudentID = TransStudentID)
                 DELETE NewStudentRecords
                      DISPLAY "Error - " TransStudentId
                      " already exists in file"
       *               DELETE NewStudentRecords
                      READ TransRecords
                          AT END SET EndOfTransFile TO TRUE
                      END-READ
               END-EVALUATE
            END-PERFORM
            
            CLOSE StudentRecords
            CLOSE TransRecords
            CLOSE NewStudentRecords
            STOP RUN.


This is the error i get libcob: WRITE not allowed (STATUS = 48) File : 'newmasterstufile.txt' ---------------------------------------------------------------- Umm my bad... when i previewed it, it did not look like that here it is IDENTIFICATION DIVISION. PROGRAM-ID. InsertRecords. AUTHOR. Bryan Anderson. * This program updates the Students.Dat file with insertions * taken from the Transins.Dat file to create a new file * - Students.New - which contains the inserted records. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT StudentRecords ASSIGN "MasterStudentFile.txt" ORGANIZATION IS LINE SEQUENTIAL ACCESS MODE IS SEQUENTIAL. SELECT TransRecords ASSIGN "StudentTransactionFile.txt" ORGANIZATION IS LINE SEQUENTIAL ACCESS MODE IS SEQUENTIAL. SELECT OPTIONAL NewStudentRecords ASSIGN "newmasterstufile.txt" ORGANIZATION IS LINE SEQUENTIAL ACCESS MODE IS SEQUENTIAL. DATA DIVISION. FILE SECTION. FD StudentRecords. 01 StudentRecord. 88 EndOfStudentFile VALUE HIGH-VALUES. 02 StudentID PIC X(6). 02 FILLER PIC X(40). FD TransRecords. 01 TransRecord. 88 EndOfTransFile VALUE HIGH-VALUES. 02 TransStudentID PIC X(6). 02 FILLER PIC X(40). FD NewStudentRecords. 01 NewStudentRecord PIC X(46). PROCEDURE DIVISION. BEGIN. OPEN INPUT StudentRecords OPEN INPUT TransRecords OPEN I-O NewStudentRecords READ StudentRecords AT END SET EndOfStudentFile TO TRUE END-READ READ TransRecords AT END SET EndOfTransFile TO TRUE END-READ PERFORM UNTIL (EndOfStudentFile) AND (EndOfTransFile) EVALUATE TRUE WHEN (StudentID < TransStudentID) WRITE NewStudentRecord FROM StudentRecord READ StudentRecords AT END SET EndOfStudentFile TO TRUE END-READ WHEN (StudentID > TransStudentID) WRITE NewStudentRecord FROM TransRecord READ TransRecords AT END SET EndOfTransFile TO TRUE END-READ WHEN (StudentID = TransStudentID) DELETE NewStudentRecords DISPLAY "Error - " TransStudentId " already exists in file" * DELETE NewStudentRecords READ TransRecords AT END SET EndOfTransFile TO TRUE END-READ END-EVALUATE END-PERFORM CLOSE StudentRecords CLOSE TransRecords CLOSE NewStudentRecords STOP RUN. ---------------------------------------------------------------- From the Standard, [quote]For a file that is in the sequential access mode, the last input-output statement executed for file-name-1 prior to the execution of the DELETE statement shall have been a successfully executed READ statement.[/quote] I don't see you doing a READ before trying to delete the record. ---------------------------------------------------------------- Subject: Coding DB table using ISAM reads and writes Does OpenCOBOL support DB table access using ISAM reads and writes similar to the AcuCobol GL (MicroFocus) runtime? ---------------------------------------------------------------- Depends on what you mean, but I think the short answer is "no, not directly". Yes it supports ISAM and ships with full support of INDEXED and RELATIVE file organizations. There is also full support of the START verb and the conditional READ NEXT and READ PREVIOUS that that triggers. Indirectly we have support of SQL databases. SQLite comes with two wrapper forms so far ... API based and clone of the sqlite3> command line processor, MySQL, (and Firebird and PostgreSQL and others through libDBI). I haven't looked closely, but I'm sure that as soon as someone sits down and writes a wrapper, we'll have OpenCOBOL linkage to DB2-Express edition that IBM has posted for hobbyist free-as-in-free-beer-free use. Someone will have to do that work though. Cheers, Brian ---------------------------------------------------------------- Subject: How to pass input files to cobol program on linux I am trying to migrate a cobol program from VMS to LINUX and would like to know how can I pass the file location to IPFILE and OPFILE parameter below: INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT CKDIG11FILE ASSIGN TO IPFILE. SELECT ZIPCODE14FILE ASSIGN TO OPFILE. IN VMS, I used to assign the IPFILE, OPFILE variables to file location. But IN Linux, I tried doing IPFILE="/home/input.dat" before running the prog but I still get: libcob: File does not exist (STATUS = 35) File : '' The only way it would work in Linux is when I insert the file path within the code: INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT CKDIG11FILE ASSIGN TO "/home/input.dat". SELECT ZIPCODE14FILE ASSIGN TO "/home/output.dat". Is there a way to assign the input and output file location outside the code, just like how I do it on VMS. ---------------------------------------------------------------- I'm looking for similar information; in my case, I have a program that uses the statements Special-Names. Argument-Value is Command-Line. File-Control. Select In-File assign to File-In organization is Line Sequential file status is In-Stat. and Accept File-In from Command-Line Open Input In-File ... to get a variable input filename for File-In. What would be the syntax in the Linux environment? Will environment information eventually appear in the User Manual? Thanks, Leslie ---------------------------------------------------------------- I found some information regarding this at http://opencobol.add1tocobol.com/ that might be helpful. In the install tree for openCOBOL is a config directory containing various .conf files. (The following files are in this directory in my installation: bs2000.conf cobol2002.conf cobol85.conf default.conf ibm.conf mf.conf mvs.conf one of these is selected for use according to the dialect value specified at compile-time with the -std switch.) There is a switch called "filename-mapping" which controls how the value of the assign clause is interpreted by the compiler: if filename-mapping is no, the value is treated as the actual name of the file; if it is yes, the value is treated as a reference to an environment variable (several variations are possible). In my installation the default.conf file contains filename-mapping: yes meaning that environment variables are referred to. Perhaps in your installation file-mapping is set to no? ---------------------------------------------------------------- Thanks for your help! The problem is now resolved. By default filename-mapping is set to yes in default.conf For some reason, the environment variable must be set using export otherwise it won't work. So here is what I did, in the cobol program: ASSIGN TO "IPFILE" outside the program export IPFILE = "/home/input.dat" and then ran it (and it works great!) :-D :-D ---------------------------------------------------------------- Good! I was afraid that it might be more complicated than that. I suspect that the export is necessary because the program does not run directly in the shell session that invoked it, but in a subshell (just a guess; the developers could confirm that.) There's a lot of other good stuff in that FAQ at the Add1toCobol site. Perhaps there should be a link to it in the Documentation item in the navigator bar? Leslie ---------------------------------------------------------------- I believe the add1tocobol faq will be put into the opencobol faq once oc 1.1 final release is finished. ---------------------------------------------------------------- The FAQ left-hand menu item here (under [b]Documentation[/b]) links to the same url. And yes, it still needs a lot of work. OC deserves the best. Cheers, Brian ---------------------------------------------------------------- Strictly speaking, the program does not run in a subshell, but does run as a separate process, therefore the variable needs to be an environment variable. In Bourne shells, the export command turns a shell variable into an environment variable. In C shells environment variables are created using the setenv command. ---------------------------------------------------------------- I added a little information on this to the FAQ under the ASSIGN reserved word entry at http://opencobol.add1tocobol.com/#assign but I'll be adding an entire section on how the ENVIRONMENT DIVISION is best handled. Although [i]relatively[/i] simple, there are quite a few details to document. Cheers, Brian ---------------------------------------------------------------- Subject: How do i install in Windows XP Hi, could someone give me a simple step by step on how to install the Compiler onto the Windows XP OS? Also simple steps how to edit my first program and compile it. I've worked COBOL/400 (IBM) but don't know much about Linux. I've read the instructions provided but it's not clear to me how to input those $ commands, sorry for the ignorance thanks :-? ---------------------------------------------------------------- Did you seethe faq section that syas, [code] Build from sources under Cygwin or MinGW. Follow the instructions from the site listed above, or read the OC_GettingStarted_Windows document by William Klein available online at http://opencobol.add1tocobol.com/oc_gettingstarted_windows.html http://opencobol.add1tocobol.com/OC_GettingStarted_Windows.pdf [/code] ---------------------------------------------------------------- If you are still having trouble I found the instructions posted by banders51 2009/2/1 under OpenCOBOL for Windows very good indeed. There does not seem to be many native WINDOWS people about so I would be interested to know how far you have managed to get. ---------------------------------------------------------------- Subject: Syntax Error at Filler definition I want to compile an existing module with Open Cobol In the line with the code: 05 FILLER VALUE +6,300E-02. The compiler returns with the error message: ... Error: syntax error, unexpected WORD, expecting EXTERNAL or GLOBAL. IF I change the code to 05 FILLER VALUE +0,063. everthing is ok! The Original is compiled with Acucobol, without errors. I've tested it with all dialects-configurations available in cobc (cobol2002, cobol85, ibm, mvs, bs2000, mf). We can't change the program code because it's from an external provider. What can I do to compile this module without syntax errors? ---------------------------------------------------------------- What type of elementary item are you expecting thisto create? Floatin-poing? Numeric? Floating-point edited? Other? Without a PICTURE and/or USAGE, I doubt that you will get this to compile cleanly. (Adding something like "COMP-1" or "Float-Long" MIGHT get a clean compile, but does require a syntax change. ---------------------------------------------------------------- It's a table definition with more than 10 elements. All elements are defined as COMP-2 and all elements has Values with FILLER VALUE definitions like my description here: 01 TABLE01 USAGE COMP-2. 05 FILLER VALUE +6,300E-02. 05 ... The Contruct 01 TABLE01 USAGE COMP-2. 05 FILLER VALUE +0,063. 05 ... works. I must change more than 50 lines in a Program of another provider ---------------------------------------------------------------- I'm not sure if there are plans for supporting E scientific notation in OpenCOBOL in the near future. ghasse; if this becomes a major hassle, we can maybe work out a perl, awk, or sed preprocessor script to scan COBOL sources and replace any E notations with fixed point? Cheers, Brian ---------------------------------------------------------------- Whether or not OpenCOBOL suport scientific notation (or more accurately syntax as defined in the '02 Standard for numeric-edited floating-point and floating-point literals). There is something VERY strange in the sample code. If you place a USAGE at the higher leverl (where you have COMP-2) that still does NOT impact subordinate levels. I think you need to check that this is really "good code" for AcuCOBOL. They may have an extension for what you have, but what you have shown in this forum seems dubious to me. ---------------------------------------------------------------- Thank you wmklein, therefore I am not the only one wondering. Is it allowed to put USAGE in a higher level at all? What should this declaration do (according to any standard / according to the implementors)? ---------------------------------------------------------------- By draft 20xx standard 13.16.59.2 paraphrase of subsection 2 If a USAGE clause is specified for a group item, a subordinate elementary or group item may also specify, but they MUST match. So, I think that syntax is allowed. Cheers, Brian ---------------------------------------------------------------- Brian, In the "sample" source code there is a COMP-2 specification at the group level and [u][b]NO[/b][/u] USAGE specified at the subordinate level, so the usages do NOT match. Something like: [code] 01 Many-Nums Binary. 05 N1 Pic S9(03) Binary. 05 N2 Pic 999999 Binary. [/code] is allowed, but not [code] 01 Many-Nums Binary. 05 N1 Value 123. 05 N2 Value +987866. [/code] It is that latter type of source code that is being talked about in this thread (even with COMP-2 - which is an extension itself. In other words, you can put the USAGE at a group level, but only when it is totally REDUNDANT. ---------------------------------------------------------------- That's not how I read the entry... [i]I really really wish I felt comfortable with the copyrights on this document ... but here I go, copying[/i] [b]from 20xx Draft; ISO/IEC 1989:20xx WD 1.10 (E)[/b] Usage Clause, 13.16.59.2 Syntax rules [code] 2) If the USAGE clause is written in the data description entry for a group item, it may also be written in the data description entry for any subordinate elementary item or group item, but the same usage shall be specified in both entries. [/code] So I take that as saying; if you put in on a group, the subordinates must match, but you can skip the USAGE clause on the subordinates if you want. USAGE cascades down. But ... given what little I know of the history, there could well be a counter clause somewhere else that overrides my understanding on this entry. Cheers, Brian ---------------------------------------------------------------- After further "study" (and checking with some others), I now agree that Brian is correct in what the Standard is saying. For a "conforming" example, [code] 01 aGroup Binary-Short. 05. *> elementary item 05 N1. 05. *> group item 10 Value 12. [/code] would be conforming and would be equivalent to: [code] 01 aGroup. 05 Filler Binary-Short. 05 N1 Binary-Short. 05 Filler. 10 Filler Binary-Short Value 12. [/code] It may look "odd" but the Standard does allow this. ---------------------------------------------------------------- OK, all fine then because ghasse states [code]01 TABLE01 USAGE COMP-2. 05 FILLER VALUE +0,063. 05 FILLER VALUE +0,053. 05 ...[/code] works. Good to know that this is possible and how it should be coded. Therefore, the only request is to enable [code]01 TABLE01 USAGE COMP-2. 05 FILLER VALUE +0,063[b]E-02[/b]. 05 FILLER VALUE +0,053[b]E-02[/b]. 05 ...[/code] ---------------------------------------------------------------- Subject: After upgrade to 1.1 get "undefined symbol: cob_display" with DISPLAY command I just upgraded my open-cobol to 1.1 on my SuSE Linux machine, to try out the screen functionality. I have now also completely removed both the open-cobol-1.0 and open-cobol-1.1 from my /usr/share, and cobc and cobcrun from /usr/local/bin, then reinstalled open-cobol-1.1.tar.gz into /usr/local/. I see no errors from the runs of configure, make, make check or make install, but the following problem persists: A program that worked fine with 1.0 fails when compiled with 1.1, with error "undefined symbol: cob_display" at execution time. The file has one DISPLAY command which displays only an alphanumeric literal. When I comment that statement out the program works correctly. Is there some sort of environment variable or library reference that's pointing to the old version, that I need to change or remove? Leslie ---------------------------------------------------------------- The quickest thing to try is [code]# ldconfig to ensure the shared library cache is resynched, and/or $ rehash to ensure the shell isn't finding an older binary in the search path. [/code] There was an internal linkage name change a few pre-releases back (having to do with dashes and underscores), but it seems you are recompiling, so that shouldn't be the problem. Iff, you untared over an older copy, the best thing to do is [code] $ make distclean $ ./configure [/code] before the other makes. This , cleans up some of the libtool/autoconf cache files between builds. Safer is a clean build tree, each and every time, but I've had success with [b]make distclean[/b] and a build dir that I use over and over again. If none of that works, try [code] $ nm -D /usr/local/lib/libcob.so [/code] and look to see that cob_display is in the list. If it is (it should be), it'll give you a clue that things should work and then we can try to ferret out a solution. Another handy tool is [code] $ ldd [/code] which displays the linker dependencies of a program. It'll spew some kind of "not found" if the runtime shared lib path isn't quite right. Cheers, Brian ---------------------------------------------------------------- Subject: Error Codes Is there a list of all the error codes with descriptions that I can have as a PDF file or something? ---------------------------------------------------------------- Unfortunately no, not yet [i]as far as I know[/i]. In the short term, if you need to get a "what's what" view of things. (build-dir)/libcob/exceptions.def has all the known (but not all used by the system yet) exceptions. In (build-dir)/cobc/ doing a $ grep cb_error * | less will give you a whack of one-liner compile-time error messages, (but completely out of context in this case) cb_warn might be a good grep too, to cover all the bases. In (build-dir)/libcob/ doing grep on '_error' will show some, sadly I don't think all, of the run-time errors that can be triggered. There are no doubt other places to look, so perhaps this task shouldn't be taken on lightly unless [i]incomplete overview, but better than nothing[/i] is acceptable. The error list (along with many other docs), is on the plate, and I'm slowing building up ROBODoc entries for the source code, and this list will make a great index when that effort eventually gets posted. Cheers, Brian ---------------------------------------------------------------- I think banders51 ask for file status error codes. It would be really usefull if there would be an extension that gives a text message to the last occured file error. This would solve the most questions related to the meaning of different file status values. It could be used like [code]77 ERROR-MESSAGE PIC X(128). ... declaratives. ... CALL "CBL_OC_IOERROR" USING ERROR-MESSAGE END-CALL DISPLAY "FILE ERROR '" FILE-STATUS "' OCCURED FOR FILE '" FILE-NAME "':' x'0D0A' ERROR-MESSAGE END-DISPLAY ... end declaratives.[/code] Could this be done? ---------------------------------------------------------------- Subject: USE OF THE SELECT STATEMENT IS THERE A WAY ON OPEN-COBOL TO SELECT A DEVICE ATTACHED TO A USB PORT. EG: SELECT FILE-NAME ASSIGN "LPT1" ASSIGN THE OUTPUT TO THE PARALLEL PORT LPT1. I WOULD LIKE TO USE THE USB PORTS TO OUTPUT TO LINE PRINTERS AND RS232 DEVICES. DON ---------------------------------------------------------------- Subject: Unable to get hello.cob to run (newbie, obviously) Hello all, I've installed OpenCOBOL 1.0 on a PIII pc running Xubuntu 8.04. I installed it using [code]sudo apt-get install open-cobol[/code] No problem there. Then I tried running hello.cob [code] IDENTIFICATION DIVISION. PROGRAM-ID. hello. PROCEDURE DIVISION. DISPLAY "Hello World!". STOP RUN. [/code] Then [code] cobc -x hello.cob[/code] returns the following [code]hello.cob:4: Warning: File not terminated by a newline /usr/bin/ld: cannot find -lncurses collect2: ld returned 1 exit status [/code] My morning of searching has proved fruitless. Any hints or suggestions are appreciated. Regards, Tom ---------------------------------------------------------------- Hello Tom, Hmm, the warning is something you can fix by just editing the file and ensuring there is a terminating newline. (But I'm curious as to why it reported line 4 and not 5; I'll be honest, I only ran OpenCOBOL 1.0 for a few minutes before snagging a 1.1 pre-release tarball and building from sources, so don't have a lot of experience with the release version.) The next part; ncurses should be listed as a dependency in the APT package. apt-get should have verified that it was installed. At least here on my Debian Lenny (I'll sneak a peek at Ubuntu 8.04 packaging tomorrow during the lunch break), but to fix it; Run aptitude, take a look at libncurses5 and libncurses5-dev, make sure those are installed and if not, add those packages. If they are, it may be the ever plaguing [b]ldconfig[/b] shared library cache problem with new installs and builds. We'll try and help out, but it may take a few kicks at the can as things are tried. Cheers, Brian ---------------------------------------------------------------- Btiffin, In Ubuntu when I search Synaptic it says Open-cobol 1.0-1ubuntu2. I am curious which version of OC this means then? Also who packaged it up. Very cool. ---------------------------------------------------------------- Hi, Did you ever solve this problem? On my Debian Squeeze system, it turns out that the link line as specified (i.e. generated by OC): $ cobc -x -v hello.c cc -pipe -c -O2 -Wall -O2 -Wno-unused -fsigned-char -Wno-pointer-sign -o /tmp/cob18871_0.o hello.c cc -pipe -Wl,--export-dynamic -o hello /tmp/cob18871_0.o -L/usr/lib -lcob -lm -lgmp -lncurses -ldb $ ./hello Hello World! requires a symlink entry in /usr/lib: As root: cd /usr/lib ln -s ../../lib/libncurses.so.5 libncurses.so I don't know if this is an OC issue or a Debian packaging issue. ---------------------------------------------------------------- Aoirthoir; Not sure, but I'll look during a lunch break soon. We're running a few versions of ubuntu. Bart Martens is still the Debian Maintainer, and the MOTU team probably doesn't have to do much to repackage. ubuntu h has 0.33 listed with ubuntu i at 1.0-1 ubuntu j at 1.0-1ubuntu2 ubuntu k at 1.0-3 For the FAQ I'll try and figure what packaged on dates these use, but I wouldn't doubt that the Karmic build is fairly recent. 1.0-2 was built into Debian in April, and 1.0-3 in May, (but that doesn't really say anything about the source, just the activity). jchimene; hmm, that should not be a necessary manual intervention if the ncurses package was installed properly, but on these systems, **it happens. ;) Cheers, Brian ---------------------------------------------------------------- Ok, After thinking about this a bit more, I realized that cobc might be dependant on libncurses5-dev. Sure enough: I removed the link created in my previous post then installed libncurses5-dev. Succcess. I'll contact the Debian maintainer and get his opinion. Huh - sitting in my apt updates queue is OC. From the release notes: * debian/control: Added libncurses5-dev to Depends. Closes: #528206. ---------------------------------------------------------------- Only one more note. Regarding de apt-get installin' on Debian Lenny, I tried and it doesn't work. You need the C compiler and other required packages that are not installed with aptitude. The .deb package need more work. ---------------------------------------------------------------- Hmm, yeah, perhaps we can convince Bart to list [b]build-essential[/b] as a dependency. I'm going to assume most coders that touch any programming on GNU/Linux start with build-essential so it may slip through the dependency cracks with some Debian maintainers. It's a little weird as cobc proper has a dependency list, the intermediate C that is generated has a dependency list and then the binary apps have dependencies. I'll try and get a FAQ entry filled out that goes through the three lists. AND/OR, start updating the Install Guide wiki page here on the opencobol.org site. I don't think mentioning some of the things required by OC 1.1 would hurt anyone using the release 1.0 version. Hmmm. Cheers, Brian ---------------------------------------------------------------- Subject: COBOL might get some good press as it turns 50 http://www.guardian.co.uk/technology/2009/apr/09/cobol-internet-programming Cheers, Brian ---------------------------------------------------------------- Yes it does, and it encourages me more to learn this language. COBOL was one of the languages I wanted to learn when I started programming for this very reason -- extensive backend use for systems across a wide range of environments. (Unfortunately, it was dropped from the curriculum the semester I began.) I'm looking forward to learning enough (and more) to make myself useful in maintaining those "250bn lines of Cobol code". ---------------------------------------------------------------- Speaking of which Brian we need to start helping out Frank with Cobol Magazine: http://www.cobolmagazine.com/ ---------------------------------------------------------------- Subject: Text from Standards and "copyright" issues As a follow-up to several other posts, I just wanted to point anyone concerned with copyright issues and using "small excerpts" from the current or past COBOL standards to: [url=http://www.copyright.gov/fls/fl102.html]http://www.copyright.gov/fls/fl102.html[/url] I am NOT a lawyer and not trying to give legal advice. Furthermore, I don't know how such issues are dealt with in other coutnries, but TO ME, this seems clear that using small (properly attributed) excerpts from a/the Standard for "educational" (or similar) uses - is "fair use". This does NOT answer questions about creating an entirely new "manual" based on text from a Standard, but it does (again to me) answer any concerns about using small excerpts to answer quesitons in this forum. ---------------------------------------------------------------- Sounds fair. ;) Thanks again Bill. I'm only wary, as putting oneself at risk is one thing, putting the project itself at risk is a different thing entirely. But yeah, fair use for clarification seems like a fair use. Cheers, Brian ---------------------------------------------------------------- But we have to be VERY careful with the fair use issue. The reason being that any court can make any claim it wants about what is and what is not fair use. Sometimes they do not even follow the legislation. A good example, fair use does not restrict the media that you can convert to. Yet all of the time lawyers and judges are "questioning" whether conversion to this or that medium is "permissible," despite their knowing darn well and good that it IS. ---------------------------------------------------------------- Coming from a long line of lawyers, I fully understand that ANYTHING is possible - when it comes to "frivolous" law suits. However, is there any evidence that either ANSI or ISO (or INCITS or IEC, or whatever) has [u][i][b]EVER[/b][/i][/u] brought a law suit against anyone's use of their text? they are the ONLY ones who have any "standing" when it comes to such law suites. I really can understand this as an issue with creating a "valid" LRM, but it really is incredibly unlikely (verging on 0%) for use within this forum (or the list). What is the status of asking ANSI or ISO for permision to use the text (not the formatting) from the current (or past Standards)? Obviously (once again) [u][b]ALL[/b][/u] text (in part of whole) from the '85 Standard may be used (for the LRM or in this forum). The acknowledgement makse that 100% clear (and I can point you to any number of vendors' LRMs that do this.) This also applies to the "original" Intrinsic Functions (but not those added in the '02 Standard) ---------------------------------------------------------------- Bill, you are correct. The text saying we can use it, is different than a fair use issue. I just wanted folks to be aware that what the federal law says fair use is, aint always what federal law "says" fair use is, when you get called on the carpet for it. Also you are right about the ansi standards. I don't think they've harassed anyone about these things and am not concerned that they would harass us either. Now copying from the IBM manual under the guise of fair use, while I personally agree that fair use is expansive, is another thing, because the courts aren't being so legal in the States anymore. ---------------------------------------------------------------- For IBM LRM issues, things are even simpler in this forum (not for an LRM). All I do is say something like, For a discussion of how IBM on the Mainframe handles Binary Trucation, check out: [url=http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3pg40/2.4.55 ]http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3pg40/2.4.55 [/url] and [url=http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3lr40/5.3.17.1 ]http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3lr40/5.3.17.1 [/url] Referencing the Micro Focus documentation is a little harder. I have yet to figure out how to do a URL to a specific topic in their online documentation. I can, however, tell readers how to "get to" the relevant text. ---------------------------------------------------------------- Subject: Is it possible to get the section/paragraph name | call stack from COBOL Think of a section that does logging. It would be really good to know from which section/paragraph the logging section was called. Is it possible to do this with standard Cobol (without the need of typing the names / do an evaluate everytime)? I think not. But what do you think of some new nifty FUNCTION doing the trick? I thought of two possibilities, either a call stack [code]first_sect section. 00. ... perform logging ... sec_sect section. 00. ... perform logging ... logging section. 00. write somerec from 'Log: Timestamp, called from "' [b]FUNCTION OC_CBL_CALLSTACK (1, Section )[/b] ':' [b]FUNCTION OC_CBL_CALLSTACK (1, Paragraph)[/b] '"' end-write[/code] with [b]FUNCTION OC_CBL_CALLSTACK ([i]How many entries upwards (0 means current entry)[/i], [i]Section OR Paragraph[/i])[/b] or maybe something to get the current position (which seems to be easy to code because this doesn't change on run time and could be handled like a level 78 var/constant) [code]first_sect section. 00. ... move spaces to log-position string [b]FUNCTION OC_CBL_COBPOSITION (Section )[/b] ':' [b]FUNCTION OC_CBL_COBPOSITION (Paragraph)[/b] delimited by size into log-position end-string perform logging ... sec_sect section. 00. ... move spaces to log-position string [b]FUNCTION OC_CBL_COBPOSITION (Section )[/b] ':' [b]FUNCTION OC_CBL_COBPOSITION (Paragraph)[/b] delimited by size into log-position end-string perform logging ... logging section. 00. write somerec from 'Log: Timestamp, called from "' log-position '"' end-write[/code] with [b]FUNCTION OC_CBL_COBPOSITION ([i]Section OR Paragraph[/i])[/b] What do you think about this? human ---------------------------------------------------------------- Check out the (existing - I think) EXCEPTION-LOCATION intrinsic function ---------------------------------------------------------------- human; If you don't mind a little C code, yes this will be a breeze. [code] $ cobc -fsource-location prog.cob [/code] generates [code] /* hello.cob:11: DISPLAY */ cob_set_location ("hello", "hello.cob", 11, "MAIN SECTION", "MAIN PARAGRAPH", "DISPLAY"); { cob_display (0, 0, 1, &c_1); } [/code] and in libcob/common.c [code] void cob_set_location (const char *progid, const char *sfile, const unsigned int sline, const char *csect, const char *cpara, const char *cstatement) { cob_current_program_id = progid; cob_source_file = sfile; cob_source_line = sline; cob_current_section = csect; cob_current_paragraph = cpara; if (cstatement) { cob_source_statement = cstatement; } if (cob_line_trace) { fprintf (stderr, "PROGRAM-ID: %s \tLine: %d \tStatement: %s\n", (char *)progid, sline, cstatement ? (char *)cstatement : "Unknown"); fflush (stderr); } } [/code] And then the wall. Always a wall. ;) The necessary vars are defined static, so local to the library. We'll have to convince Roger to expose the key fields: [code] static const char *cob_current_program_id = NULL; static const char *cob_current_section = NULL; static const char *cob_current_paragraph = NULL; static const char *cob_source_file = NULL; static const char *cob_source_statement = NULL; static unsigned int cob_source_line = 0; static size_t cob_line_trace = 0; [/code] I doubt there are name conflicts, but there may be issues in letting us clown coders possibly step on the values. So, not a breeze. It might require a grovel. But, yeah, this won't be hard. All the tracer data is already in place in the code generator. Cheers, Brian ---------------------------------------------------------------- @wmklein: Yes, the [url=http://opencobol.add1tocobol.com/ocfaq.html#exception-location]EXCEPTION LOCATION function[/url] exists and there is even a sample (for real errors) in the FAQ posted by Roger. If I understood it right, I must not perform the logging section but use the RAISE statement instead to raise a non fatal exception (there is no sample in the FAQ yet, what a pity) and define a special declarative that could just perform the logging section. Then I should be able to use EXCEPTION LOCATION to get a nice message where the logging comes from. I think this should work but I'm not sure if this is well coding if you want to log just some infos (like "The program was started, the user input is ..."). Do you have a sample (which maybe could go to the FAQ, too)? Do you think this should be used for non-error messages? @btiffin: This is the kind of thing what I thought of at the beginning but I think it would be only useable if there would be some (non-standard) function implemented. It would be really nice if Roger would implement something like that. For the FAQ: There is written "This option is also turned on with -g debugging info compiles." but it also suffices to compile with -debug (to enable run time checking, what I'm doing the most time) according to the info of cobc -help. It would be good to change this in the FAQ. human ---------------------------------------------------------------- Updated the FAQ to clarify the implied -fsource-location with -g and/or -debug. Cheers, Brian ---------------------------------------------------------------- Subject: GMP3 error on AIX I am trying to compile opencobol 1.0 or 1.1 on AIX 5.3 and I recieve the following error. checking for __gmp_randinit in -lgmp... no configure: error: GMP 3 or later is required I found several forum posts that were a couple years old about this, but couldnt make sense of what I needed to do. The only version of GMP I can find for download is gmp-4.3.0., it installed fine but the older posts suggest I need a different version. If someone could point me in the right direction that would be greatly appreciated. ---------------------------------------------------------------- Which compiler are you using: xlc or gcc? At least with xlc (which I am using), you either have to force GMP in 32 bit mode [code].../gmp$ ABI=32 ./configure[/code] (because ABI=aix64 is the default) or OpenCOBOL in 64 bit mode [code].../opencobol$ CFLAGS=-q64 ./configure[/code] (because -q32 is the default). I always use ABI=32, so I have no guarantees that 64 bit mode fully works, but at least the __gmp_randinit error does not appear. For me GMP 4.3.0 does not compile at all. You can find some older GMP versions at [url=ftp://ftp.gmplib.org/pub/]ftp://ftp.gmplib.org/pub/[/url] Even older versions are available under [url=http://ftp.gnu.org/gnu/gmp/]http://ftp.gnu.org/gnu/gmp/[/url] Try e.g. GMP 4.2.4 Regards, Alex ---------------------------------------------------------------- Subject: How to communicate with MySQL from Opencobol using MySQL C API -- WARNING LONG POST I cannot take credit for this find, [url=http://www.geocities.jp/sanpontze/xindex.html]sanpontze[/url] is the source of this information. Here's the Google translated link: [url=http://translate.google.com/translate?hl=en&sl=ja&u=http://www.geocities.jp/sanpontze/mysql.html&ei=_7roSc-OKZOotAOJ5ODrAQ&sa=X&oi=translate]translated[/url] Software Used: MySQL 5.0.32 libmysqlclient15-dev Opencobol 1.1.0 gcc 4.1.2 Debian Linux 4.0 (etch) 2.6.18-6-parisc-smp I will skip the installation of the above software as there is a plethora of info on this available on the web. Brief Overview: Create a C wrapper program that will take calls from Opencobol and pass them to the C API. This will be compiled and assembled into an object file so that we can link to it when we compile our Opencobol program. Steps: 1) Create the C wrapper program (cobmysqlapi.c). [code] /* cob-mysql Version 3.0 25/Jul/2008 */ /* Copyright (C) sanpontze. All Rights Reserved */ #include #include #include #include #include #define min(a,b) ((a) < (b) ? (a) : (b)) static int (*func)(char *errno, const char *errmsg); MYSQL sql, *mysql=&sql; static int errout; void err_exit(int rc) { char errno[10]; if( !rc ) return; switch(errout){ case 1: fprintf(stderr,"%d\n", mysql_errno(mysql)); fprintf(stderr,"%s\n", mysql_error(mysql)); return; case 2: break; case 3: sprintf(errno,"%d", mysql_errno(mysql)); func(errno, mysql_error(mysql)); } return; } void move_to_cob(char *cob_dat, const char *dat) { int len = strlen(cob_dat); // data length in cob memset(cob_dat, ' ', len); // clear with spaces memcpy(cob_dat, dat, min(len, strlen(dat))); // data copy return; } void MySQL_affected_rows(int *no) { *no = mysql_affected_rows(mysql); return; } int MySQL_change_user(const char *user, const char *passwd, const char *db) { int rc; rc = mysql_change_user(mysql, user, passwd, db); err_exit(rc); return rc; } void MySQL_close(void) { mysql_close(mysql); return; } void MySQL_errno(char *errno) { char buf[10]; sprintf(buf,"%d", mysql_errno(mysql)); move_to_cob(errno, buf); return; } void MySQL_error(char *errmsg) { move_to_cob(errmsg, mysql_error(mysql)); return; } void MySQL_fetch_field(MYSQL_RES **result, int *pos, char *field) { MYSQL_FIELD *fields; fields = mysql_fetch_fields(*result); move_to_cob(field, fields[ *pos - 1 ].name); return; } void MySQL_fetch_fields(MYSQL_RES **result, ...) { int rc, j, colms; va_list args; MYSQL_FIELD *fields; va_start(args, result); colms = min(cob_call_params, mysql_num_fields(*result)); fields = mysql_fetch_fields(*result); for(j=0; j 1){ fname = va_arg(args, char *); } else { fname = ""; } va_end(args); if( !strcmp(fname, "stderr") ){ errout = 1; // stderr } else if( !strcmp(fname,"" ) ){ errout = 2; // default } else { cob_init(0, NULL); func = cob_resolve(fname); if(func == NULL){ fprintf(stderr, "%s\n", cob_resolve_error()); return 1; } errout = 3; // user function } err_exit(rc); return rc; } int MySQL_list_tables( MYSQL_RES **res) { int rc; *res = mysql_list_tables(mysql, NULL); rc = *res != NULL ? 0 : 1; err_exit(rc); return rc; } void MySQL_num_fields(MYSQL_RES **result, int *cols) { *cols = mysql_num_fields(*result); return; } void MySQL_num_rows(MYSQL_RES **result, int *rows) { *rows = mysql_num_rows(*result); return; } int MySQL_query(char *query) { int rc; rc = mysql_query(mysql, query); err_exit(rc); return rc; } int MySQL_real_connect(char *host, char *user, char *passwd, char *db, unsigned int port, char *unix_socket) { int rc; MYSQL *tmp; tmp = mysql_real_connect(&sql, host, user, passwd, db, port, unix_socket, 0); rc = tmp != NULL ? 0 : 1; err_exit(rc); return rc; } int MySQL_selectdb(char *dbname) { int rc; rc = mysql_select_db(mysql, dbname); err_exit(rc); return rc; } int MySQL_set_character_set(char *charset) { int rc; rc = mysql_set_character_set(mysql, charset); err_exit(rc); return rc; } int MySQL_store_result(MYSQL_RES **result) { int rc; *result = mysql_store_result(mysql); rc = result != NULL ? 0 : 1; err_exit(rc); return rc; } int MySQL_use_result(MYSQL_RES **result) { int rc; *result = mysql_use_result(mysql); rc = result != NULL ? 0 : 1; err_exit(rc); return rc; } [/code] 2) Compile this to object (Use the mysql_config program to list out your library and header file locations as these can vary from system to system) [code] gcc -I/usr/include/mysql -c cobmysqlapi.c [/code] This will produce cobmysqlapi.o. 4) Create a test database and table. In mysql, execute: [code] CREATE DATABSE testdb; CREATE TABLE `testdb`.`example_table` ( `field1` char(20) NOT NULL, `field2` char(16) NOT NULL, `field3` char(32) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO example_table VALUES ('value1','value2','value3'); [/code] 5) Create an Opencobol program to demonstrate communication (test.cbl). [code] identification division. program-id. test1. data division. working-storage section. 01 cid usage pointer. 01 result usage pointer. 01 a pic x(20). 01 b pic x(16). 01 c pic x(32). 01 errno pic x(04). 01 err-msg pic x(80). 01 eod pic x. procedure division. call "MySQL_init" using cid if return-code not = 0 then perform db-error end-if call "MySQL_real_connect" using "localhost" "USERNAME GOES HERE" "****" "testdb" 3306 "SOCKET GOES HERE" if return-code not = 0 then perform db-error end-if call "MySQL_selectdb" using "testdb" if return-code not = 0 then perform db-error end-if call "MySQL_query" using "select * from example_table" if return-code not = 0 then perform db-error end-if call "MySQL_use_result" using result if result = NULL then perform db-error end-if call "MySQL_fetch_fields" using result a b c if result = NULL then perform db-error end-if display a b c perform until eod not = eod call "MySQL_fetch_row" using result a b c if return-code = -1 then exit perform end-if display a b c end-perform call "MySQL_close" stop run. * error db-error. call "MySQL_errno" using errno display errno ":" call "MySQL_error" using err-msg display err-msg stop run. [/code] You will notice that our mysql_init call passes the port and socket of the mysql server. We added this to the cobmysqlapi.c file because we run multiple instances of mysql. You may want to modify cobmysqlapi.c to suite your needs. For the meantime, check your my.cnf file for the location of your socket file (usually /var/run/mysqld/mysqld.sock). 6) Compile this and link with our cobmysqlapi.o [code] cobc -x test.cbl cobmysqlapi.o -L/usr/lib/mysql -lmysqlclient [/code] Note the "-L" parameter, use mysql_config to see where your library is installed. 7) Run the program. You should see: [code] field1 field2 field3 value1 value2 value3 [/code] We are currently testing how the different datatypes in MySQL map to COBOL datatypes but have noticed, so far, that calling mysql_fetch_row with x(...) variables yields the best results. For numerics, we are accepting into x(...) variables and then moving them to s9(...). We will post more info as we discover it. ---------------------------------------------------------------- Very cool to see. Not to put in reasons to stop forward motion, as OpenCOBOL developers should have this interface. John Ellis did an awesome job with libDBI. His efforts are documented at http://oldsite.add1tocobol.com/tiki-read_article.php?articleId=1 Other database link efforts can be see starting at http://oldsite.add1tocobol.com/tiki-view_forum_thread.php?topics_offset=1&topics_sort_mode=lastPost_desc&forumId=1&comments_parentId=2 Under the SQLite entry. And awaiting in the wings, and afaik, not yet published, so maybe I'm playing the vapour-taunt game now, there is some code that converts OpenCOBOL READ/WRITE ISAM calls to SQL [b]at runtime[/b]. What I saw of it so far was mondo sweet technology. Volunteer efforts being what they are, this come soon, later, never ... so I don't want to put brakes on ANY efforts toward offering the OpenCOBOL developer community new angles and interfaces. Also, as a leg up on any future works, maybe you'd like to check out Vala. http://live.gnome.org/Vala There is a mysql.vapi wrapper. I've found Vala saves orders of magnitudes of code and time when building interfaces for OpenCOBOL. And we really should have a libcob.vapi by now. Just need to sit down for an afternoon and do it. Vala cool. Cheers, Brian ---------------------------------------------------------------- Hmmm... I was not aware of these other methods. I'll give them a look. Thanks for the info, Brian. ---------------------------------------------------------------- Just an update to my previous post. This version of the MySQL_fetch_row function allows for mapping to all available COBOL datatypes from MySQL (in other words, you can accept numerics from MySQL directly into computational fields). It also doesn't bomb out if a row has a field with a value of NULL (recently noticed this bug while doing some OUTER JOINs). [code] static const cob_field_attr MYSQL_FIELD_ATTRIBUTES = {33, 0, 0, 0, NULL}; int MySQL_fetch_row(MYSQL_RES **result, ...) { MYSQL_ROW res; int rc, j, maxcols; res = mysql_fetch_row(*result); if(res != NULL) { maxcols = min(cob_call_params, mysql_num_fields(*result)); for(j=0; jcob_procedure_parameters[j+1]; if(res[j] == NULL) { memset(cf_from_cobol->data, (char)NULL, strlen(cf_from_cobol->data)); } else { cob_field cf_from_mysql = { strlen( res[j] ), (unsigned char *) res[j], &MYSQL_FIELD_ATTRIBUTES }; cob_move( &cf_from_mysql, cf_from_cobol ); } } rc = 0; } else { mysql_free_result(*result); rc = -1; } return rc; } [/code] ---------------------------------------------------------------- Marc thanks for this. Brian you are right that we are "spoilt" for choice. I would like to get the crew together though and settle on some choices, to help us move forward, so that we don't stagnate. I would like to see the advantage to John's compared to Marc's methods. I know that libdbi is a library for accessing lots of different database libraries. However I am curious as to the following: 1. Does libdbi, vala or other interfaces "miss out" on some features of a specific DBMS, that using the native libraries of that system would provide. For instance Stored Procedures, Multiple Return sets and so on. I use MySQL as an example because that is the DBMS I know. 2. Do these libraries have other requirements? For instance if I understand properly, vala requires gnome? So then running it on dreamhost might be difficult. 3. Would these other libraries have advantages over the native libraries for a specific dbms? 4. What are the "must have" dbmses? I list: MySQL SQLite PostgreSQL Firebird Are there other FOSS DBMSes? How interested are we "at the moment" of getting non FOSS ones going? Personally I say let's stick with those four. So what I prefer, and I am willing to dig into the C now that I've started to look at your code, and Marc's and John's and others and see c isn't ALL that difficult as I thought, and start experimenting. In any case I think we can all agree that having a FOSS DBMS connection (or multiple connections namely those four above, or others besides) is paramount to moving forward. I think if I had that, I would just start to use Open Cobol almost exclusively for all of my work. Comments? ---------------------------------------------------------------- [url=http://erstazi.c-wd.net/cobol_sql_example.tar.gz]Here[/url] is my expansion of what marcr and jcurrey (and originally sanpontze) did. This allows for stored procedures, multi-statements, and multi-results. Also I added mysql_real_query which is faster than mysql_query and it allows binary, which mysql_query does not. Also, I changed all the functions from MySQL_foo to CBL_OC_MYSQL_FOO per Roger's request for standardization. Thanks marcr, jcurrey and sanpontze! ---------------------------------------------------------------- aoirthoir; 1) probably 2) vala doesn't require gnome persay, just glib and gtk+ for the gui bits. Most servers will have libglib 3) yes and no, see below 4) see below My 2 pennies on the SQL engines. My preference in order and why SQLite3 - public domain, easy(ish), and a good testing ground for others ... we already have 2 versions of interface. One an API sample, another a string interface to the sqlite3> shell. A third soon to see light will be a higher level create a COBOL schema descriptor table and then CALL "load-this-table" USING this-query this-schema END-CALL style interface. This third level of interface is something I'd like the team to look into. It'll be great practice at adding higher level features to the other API wrappers. PostgreSQL - very open, very robust, if I was a gambler I'd bet on it to be the tortoise of the race. We might be able to leverage ecpg to embed EXEC SQL in C files and then link them directly. And being a selfish git, I've got to learn the ins and outs or psql for a contract so might as well volunteer other people's time to the cause. ;) MySQL - popular, works with TikiWiki, good to know. Firebird - here nor there at this point, but their pre-processor source code might be a mondo cool thing to look into. There are others . We might even want to take a boo at IBM's DB2 Express-C freebeer freebie. But rubber hit road, SQLite and MySQL will probably be first out of the gate for something we could polish and publish, seeing as they are beta testable already. Cheers, Brian ---------------------------------------------------------------- Another fine choice: use DB2 Express-C (non open source but free) and embedded SQL. It also contains the IBM embedded SQL processor which also works with OpenCobol. So you get a nice Cobol source like [code] EXEC SQL BEGIN DECLARE SECTION END-EXEC. 01 NAME PIC X(40). EXEC SQL END DECLARE SECTION END-EXEC. DISPLAY 'EXEC SQL' EXEC SQL SELECT NAME INTO :NAME FROM MYTABLE END-EXEC DISPLAY 'got ' NAME. [/code] And, if you're bored you might write an embedded SQL preprocessor for postgresql ... Cheers, Juergen ---------------------------------------------------------------- I have no the mentioned /usr/share/mysql.h here (Linux Centos 5.3); think that it must be part of another development package but yum was unable to find it :( can you pls point me to url where it can be downloaded? TIA ---------------------------------------------------------------- I believe this file is installed when you install the libmysqlclient15-dev package. On a debian machine you should be able to [code]apt-get install libmysqlclient15-dev [/code]. HTH ---------------------------------------------------------------- human just reminded me that we have not posted the latest version -- so here it is this version runs on PARISC -- I believe we have to change one or two variables to run on Windows and maybe on IA64 -- let me know if this is needed [code] /* cob-mysql Version 3.0 25/Jul/2008 */ /* Copyright (C) sanpontze. All Rights Reserved */ /********************************************************************** * Version 003--Changed to correctly map to COBOL data types. * 05/07/2009--Marc Rodriguez * Version 004--Changed to correctly place NULLs into numeric types. * 1225978--Sandy Doss * 07/01/2009--Marc Rodriguez * Version 005--Added new MySQL call to fetch entire row selected * using "select *". Also fixed potential bug in * MySQL_fetch_row that compares number of passed * parameters (inclusive of WS-MYSQL-RESULT) against * number of fields returning from MySQL select. * 1331073--Jim Currey * 12/16/2009--Pete McThompson **********************************************************************/ #include #include #include #include #include #include //121609 #include //121609 #define min(a,b) ((a) < (b) ? (a) : (b)) //function pointer prototype should not include paramater names //121609 //static int (*func)(char *errno, const char *errmsg); //121609 static int (*func)(char *, const char *); //121609 MYSQL sql, *mysql=&sql; static int errout; static const cob_field_attr MYSQL_FIELD_ATTRIBUTES = {33, 0, 0, 0, NULL}; void err_exit(int rc) { char errno[10]; if( !rc ) return; switch(errout){ case 1: fprintf(stderr,"%d\n", mysql_errno(mysql)); fprintf(stderr,"%s\n", mysql_error(mysql)); return; case 2: break; case 3: sprintf(errno,"%d", mysql_errno(mysql)); func(errno, mysql_error(mysql)); } return; } void move_to_cob(char *cob_dat, const char *dat) { int len = strlen(cob_dat); // data length in cob if(dat == NULL) { memset(cob_dat, 0, len); // clear with NULL } else { memset(cob_dat, ' ', len); // clear with spaces memcpy(cob_dat, dat, min(len, strlen(dat))); // data copy } return; } void MySQL_affected_rows(int *no) { *no = mysql_affected_rows(mysql); return; } int MySQL_change_user(const char *user, const char *passwd, const char *db) { int rc; rc = mysql_change_user(mysql, user, passwd, db); err_exit(rc); return rc; } void MySQL_close(void) { mysql_close(mysql); return; } void MySQL_errno(char *errno) { char buf[10]; sprintf(buf,"%d", mysql_errno(mysql)); move_to_cob(errno, buf); return; } void MySQL_error(char *errmsg) { move_to_cob(errmsg, mysql_error(mysql)); return; } void MySQL_fetch_field(MYSQL_RES **result, int *pos, char *field) { MYSQL_FIELD *fields; fields = mysql_fetch_fields(*result); move_to_cob(field, fields[ *pos - 1 ].name); return; } void MySQL_fetch_fields(MYSQL_RES **result, ...) { int rc, j, colms; va_list args; MYSQL_FIELD *fields; va_start(args, result); colms = min(cob_call_params, mysql_num_fields(*result)); fields = mysql_fetch_fields(*result); for(j=0; jcob_procedure_parameters[j+1]; //050709 if(res[j] == NULL) //050709 { //050709 //memset(cf_from_cobol->data, (char)NULL, strlen(cf_from_cobol->data)); //070109 memset(cf_from_cobol->data, 0, cf_from_cobol->size); //070109 } //050709 else //050709 { //050709 cob_field cf_from_mysql = { strlen( res[j] ), //050709 (unsigned char *) res[j], //050709 &MYSQL_FIELD_ATTRIBUTES //050709 }; //050709 cob_move( &cf_from_mysql, cf_from_cobol ); //050709 } //050709 } //050709 rc = 0; //050709 } //050709 else //050709 { //050709 mysql_free_result(*result); //050709 rc = -1; //050709 } //050709 return rc; //050709 } //050709 int MySQL_fetch_record(MYSQL_RES **result, ...) //121609 { //121609 MYSQL_ROW res; //121609 int rc, j, maxcols; //121609 char strError[255]; //121609 res = mysql_fetch_row(*result); //121609 //121609 //121609 if(res != NULL) //121609 { //121609 // cob_call_params contains the number of parameters passed. we subtract 1 to //121609 // account for the WS-MYSQL-RESULT. //121609 if(cob_call_params - 1 != mysql_num_fields(*result)) //121609 { //121609 mysql_free_result(*result); //121609 openlog(NULL, LOG_PERROR | LOG_PID | LOG_NDELAY, LOG_DAEMON); //121609 sprintf(strError, "MySQL_fetch_record: fields mismatch. Given %i, expected %i", //121609 cob_call_params - 1, mysql_num_fields(*result)); //121609 syslog(1, strError); //121609 closelog(); //121609 exit(0); //121609 } //121609 maxcols = mysql_num_fields(*result); //121609 for(j=0; jcob_procedure_parameters[j+1]; //121609 if(res[j] == NULL) //121609 { //121609 memset(cf_from_cobol->data, 0, cf_from_cobol->size); //121609 } //121609 else //121609 { //121609 cob_field cf_from_mysql = { strlen( res[j] ), //121609 (unsigned char *) res[j], //121609 &MYSQL_FIELD_ATTRIBUTES //121609 }; //121609 cob_move( &cf_from_mysql, cf_from_cobol ); //121609 } //121609 } //121609 rc = 0; //121609 } //121609 else //121609 { //121609 mysql_free_result(*result); //121609 rc = -1; //121609 } //121609 return rc; //121609 } //121609 void MySQL_field_count(int *count) { *count = mysql_field_count(mysql); return; } void MySQL_free_result(MYSQL_RES **result) { mysql_free_result(*result); return; } void MySQL_get_character_set_info(char *csname) { MY_CHARSET_INFO cs; mysql_get_character_set_info(mysql, &cs); move_to_cob(csname, cs.name); return; } int MySQL_init(MYSQL **cid, ...) { int rc,n; char *fname; va_list args; *cid = mysql; rc = mysql_init(&sql) != NULL ? 0 : 1; va_start(args, cid); if(cob_call_params > 1){ fname = va_arg(args, char *); } else { fname = ""; } va_end(args); if( !strcmp(fname, "stderr") ){ errout = 1; // stderr } else if( !strcmp(fname,"" ) ){ errout = 2; // default } else { cob_init(0, NULL); func = cob_resolve(fname); if(func == NULL){ fprintf(stderr, "%s\n", cob_resolve_error()); return 1; } errout = 3; // user function } err_exit(rc); return rc; } int MySQL_list_tables( MYSQL_RES **res) { int rc; *res = mysql_list_tables(mysql, NULL); rc = *res != NULL ? 0 : 1; err_exit(rc); return rc; } void MySQL_num_fields(MYSQL_RES **result, int *cols) { *cols = mysql_num_fields(*result); return; } void MySQL_num_rows(MYSQL_RES **result, int *rows) { *rows = mysql_num_rows(*result); return; } int MySQL_query(char *query) { int rc; rc = mysql_query(mysql, query); err_exit(rc); return rc; } int MySQL_real_connect(char *host, char *user, char *passwd, char *db, unsigned int port, char *unix_socket) { int rc; MYSQL *tmp; tmp = mysql_real_connect(&sql, host, user, passwd, db, port, unix_socket, 0); rc = tmp != NULL ? 0 : 1; err_exit(rc); return rc; } int MySQL_selectdb(char *dbname) { int rc; rc = mysql_select_db(mysql, dbname); err_exit(rc); return rc; } int MySQL_set_character_set(char *charset) { int rc; rc = mysql_set_character_set(mysql, charset); err_exit(rc); return rc; } int MySQL_store_result(MYSQL_RES **result) { int rc; *result = mysql_store_result(mysql); rc = result != NULL ? 0 : 1; err_exit(rc); return rc; } int MySQL_use_result(MYSQL_RES **result) { int rc; *result = mysql_use_result(mysql); rc = result != NULL ? 0 : 1; err_exit(rc); return rc; } [/code] ---------------------------------------------------------------- I have some problems in installation and I want to solve it.. ---------------------------------------------------------------- define your SO/distribution, report your last actions, cut/paste error messages and put it in another post (open a new, specifc trhead) ---------------------------------------------------------------- Subject: What kind of jobs can be done with the cobol language? hi,everybody! I'm new to cobol. I just want to know how powerful this language is. :-) ---------------------------------------------------------------- My personal take; Lots of power. COBOL is very much a heavy weight data processor. Not overly fancy, but it gets data from A to B and it gets it there accurately and intact. This could well be a myth that just spreads, but ... the Gartner Group did an estimate of 300,000,000,000 lines of production source code in the world. 200,000,000,000 lines of that is COBOL. 2/3rds of the world's data processing is COBOL data processing. Other estimates peg that a full 95% of ALL financial transactions touch COBOL. Why does it not get the press that 2/3rds of all source should garner? In my humble opinion it is directly related to the domains where COBOL is in use. Top secret and very closed systems. Banking, insurance, government and military. The good men and women that have written the billions of lines of COBOL over the last 50 years are not at liberty to discuss their work. No internet postings about "Hey, I wrote this really funky cool transaction merge program and it can handle 50,000 records every microsecond. And then I found that XYZ company didn't report the correct amount of tax". That's not allowed in these domains. Along with that, these same good men and women don't have the internet "script kiddie" personalities. Their work is their work, and their life is not necessarily for exposure on the internet or on bulletin boards. One other key reason is the closed nature of the open standard of COBOL. The "underlying technology" of the specification is open to the world and [i]COMMON[/i], but the actual [i]text[/i] of the standards are for fee. So, very few hobbyists have the Standards Documents. OpenCOBOL aims to change some of this. By its nature of using C intermediates, we can link to all kinds of "fun" object files. Vala (and therefore the entire GNOME library set - including embedded browsers, PDF viewers, networking), Lua, PHP, Perl, Guile, Javascript, GNAT, SQL database engines, etcetera etcetera already have linkage demos. So we can plan to build a core-critical workhorse COBOL engine with spokes off into all the "internet cool" graphics, networking and other human usability areas. By its nature of being open and free, we should be in a position to break through the "secret sam" mentality of past COBOL efforts and get this very sound technology into the hands of hobbyists, and then onwards and upwards to more professional installations. But ... we still lack a lot of documentation. Sooo many pages need to be written, and work progresses to that end. In short; COBOL is, COBOL does, OpenCOBOL adds a little fun. Cheers, Brian ---------------------------------------------------------------- Thank you,Brian! I'm going to work on IBM's Mainframe and write COBOL for z/OS. This forum helps me a lot. :-) ---------------------------------------------------------------- Subject: OpenCOBOL viability For those concerned about the viability of OpenCOBOL in a production environment, I offer our situation as an example. We started loading OpenCOBOL to a Debian (Etch) Parisc box in mid March. With some valuable help from this forum we were up and running in a few days. We then explored the CGI capabilities and moved our home-brewed CGI handler (written in HP3000 Cobol) over. We ended up changing only a few lines. As Marcr's post indicates, we found a MySql wrapper and made some minor changes to it. Starting the second week in April we were in full development of new systems for commercial use. Please accept our congratulations to the community and our gratitude for the help from the forum. jimc ---------------------------------------------------------------- Jim. As an advocate. WooHoo! As the keeper of the FAQ, I'd like permission to reprint this in http://opencobol.add1tocobol.com/#can-opencobol-be-used-for-production-applications Cheers, Brian ---------------------------------------------------------------- Permission gladly granted. ---------------------------------------------------------------- :) In and posted. Thanks Jim. Cheers, Brian ---------------------------------------------------------------- What's your mysql wrapper? Also any chance yall would be willing to FOSS the cgi handler and share it with the community? (If you are legally able to do so, I realize some contracts forbid it...) ---------------------------------------------------------------- MySQL wrapper is discussed in Re: How to communicate with MySQL from Opencobol using MySQL C API -- WARNING LONG POST Sorry, I don't know how to muscle my way through this blog software. Again, sorry FOSS is a term that I am not familiar with. May have something to do with me being youth challenged :lol: I suspect that you would like to look at it. The URL that we used to promote it is dead, but I will have someone get something back up within the next day. If people still have interest in it after looking at it, then we should be able to post it for your use. jimc ---------------------------------------------------------------- Aoirthoir, cgignite.curreyadkins.com will take you to the information that you asked about We did not bring up the whole site. If you select CGIgnite demo on the first screen, and user guide on the second screen you should be able to get the idea. Note that sample programs are lower on the page. The demo used a charting app and was part of a complete site, neither of which have we tried to bring back up. This stuff was written in the late 90's. Viewer discretion is advised. If you would like a copy of the code, just ask. jimc ---------------------------------------------------------------- By the way Jim; FOSS is Free and Open Source Software. You might also see FLOSS, where they throw in a mostly-redundant Libre, but it's for effect to clarify the freedom meaning of Free. [i]raving[/i] Freedom is great, and zero-dollar-down freedom is just sweet. :) [i]/raving[/i] Now to go check your site. Cheers, Brian ---------------------------------------------------------------- Jim thanks. And thanks to Marc too. I read the post about the MySQL library and would like to see about getting yall to introduced to our Add1 team. Foss as Brian pointed out is Free and Open Source. What that means is that the software is distributed with rights that allow developers to modify and distribute the source code. That is the model that OpenCobol is distributed under. I quote from the Free Software Foundation: * The freedom to run the program, for any purpose (freedom 0). * The freedom to study how the program works, and adapt it to your needs (freedom 1). Access to the source code is a precondition for this. * The freedom to redistribute copies so you can help your neighbor (freedom 2). * The freedom to improve the program, and release your improvements (and modified versions in general) to the public, so that the whole community benefits (freedom 3). Access to the source code is a precondition for this. You can read more here: http://www.gnu.org/philosophy/free-sw.html So basically what I was asking is if you would at all be interested in releasing your software as a library that could be freely distributed with OpenCobol, giving persons the rights listed there. Preferably under the GNU GPL Version 2 or later. The more of us that we have working on those libraries, the greater chance we can all correct issues (except for me as I do not know C yet...but am going to start experimenting with Marc's and John's libraries to learn more.) ---------------------------------------------------------------- The MySQL stuff from Marc is now openly published and should be available to anyone. If we need to do something more, please let me know. Our CGI environment can be made available also. As a 1960's assembly language type I learned that macros (someone else's code) required study and compromise but might eliminate some work. Our product was called CGIgnite. It was quite capable and comprehensive. Many hundreds of web pages (each a program) use it even today. It does require adapting an approach but in return provides a capability. So in other words, CGIgnite takes a little bit of learning. For those interested, my earlier post on this thread will show you how to get started. We will be pleased to make the code available as FOSS if there is any interest. Just tell us how to proceed. jimc ---------------------------------------------------------------- Thanks Jim! Let's get yall if we can into our chat room soon. Maybe on the 31st. If the time is too early for you, you can always come a couple hours later. A lot of times our meetings end up running all day as various persons pop in for a while, then leave and then I continue the conversation with others. I have a couple more things to wrap up with a project that I am running now which will save me a lot of time at my office. When I get that done I am going to start digging through code that you, marc, brian, john and others have done and start dipping my feet into C. It still makes me nervous though. Kind Regards ---------------------------------------------------------------- Subject: Delete File Am I right in concluding that DELETE FILE has not been implemented in OC 1.1? This is not a problem since a call to "CBL_DELETE_FILE" works nicely, but I avoid making calls unless necessary. jimc ---------------------------------------------------------------- [i]Dammit, Jim! I'm a COBOL not a Shell.[/i] Sorry Jim A) McCoy never actually said Dammit B) Just sorry for the lame joke :) Yes, you are correct. No DELETE FILE verb clause, but I'm going to suggest it ... especially to suss out magic files created by any ISAM handlers. Better the compiler know about index.dat.0 (or whatever) than us poor app level developers. One thing that has been discussed (meaning it may never see light of day) is ASSIGN TO TEMPORARY (or similar syntax) and having the compiler create temp names and mark the files as delete on close. That'd be a handy extension. Cheers, Brian ---------------------------------------------------------------- Subject: ISAM and START verb Hi, I just added some source code to the FAQ for ISAM indexing. I'd appreciate any negative feedback if anyone feels it isn't "quite right". http://opencobol.add1tocobol.com/#does-opencobol-support-isam That and the START verb was described. These kinds of things should be as right as we can make them. http://opencobol.add1tocobol.com/#start Cheers, Brian ---------------------------------------------------------------- Just some thoughts to your good work. [u]ISAM sample:[/u] 1. 1st close should be done (maybe change the comment) and put afterwards a open input (the sample has open i-o) because you're only reading the file. 2. You don't use file status (but often invalid clause) and declaratives. In my opinion, there should at least be some check after open i-o. Maybe it's good to clone the sample (after open i-o check was implemented) and have a version only using the file status (there are often questions about this) and one with mostly using "invalid key". 3. As always I'd prefer sections instead of paragraphs. Do we have some coding guideline for the documentation? [u]START verb:[/u] 1. I think it's important to define what SEQUENTIAL access modes are (if you want to use this description): 'Can also be used to seek to the FIRST or LAST record of a file for SEQUENTIAL access modes [b](="ACCESS MODE IS SEQUENTIAL" or "ACCESS MODE IS DYNAMIC")[/b].' 2. I think it's important to mention what '[not] invalid key' is used for. 3. I think it's important to give the possible file state values if you don't want to use "invalid key" and the others like 'file not opened (for sequential access)', too. 4. I've never seen "KEY IS <>", has someone a good example for the use of it? 5. Just wondering about the colors, shouldn't "LESS THAN" and "EQUAL TO" have the same colors? [u]in general:[/u] 1. Maybe you want to add the "See Does OpenCOBOL support ISAM? for some example source code." to all ISAM statements you have in it (READ/REWRITE/WRITE/OPEN/CLOSE). 2. Maybe you want to add DELETE to the ISAM sample. 3. The "RESERVE integer [AREA/AREAS]" clause (belongs to the SELECT statement) seems to be used in OC (at least it's in the reserved list), has someone a good example for it? human ---------------------------------------------------------------- Thanks human; All very good inputs. I'll make an attempt to update the sample, the docs (and my hack up of the Pygments syntax colour lexer) soon. Cheers, Brian ---------------------------------------------------------------- I don't know if people are looking for file I/O examples, but you may want to look at the "verification" program that I created for my "Getting Started" document. See: [url=http://home.comcast.net/~wmklein//OC/filetstx.cbl ]http://home.comcast.net/~wmklein//OC/filetstx.cbl [/url] It has examples of using both relative and indexed files ---------------------------------------------------------------- Subject: Side trip into ROBODoc Hello everyone, Started on another side trek. ROBODoc. An autodocumentation utility. I like this tool. This is the first of what should be a few posts as things are fine tuned. Below is the first cut of a configuration file I've been experimenting with. If you play around with this, the [b]options[/b] section is probably the first part you will want to personalize. To see what this can produce ([i]totally mocked up, the included DOT graphics are meaningless[/i]), check out http://opencobol.add1tocobol.com/robocob/robotest.html Generated from http://opencobol.add1tocobol.com/robocob/mqrobo.cob with [code] $ ~/lang/robodoc/robodoc-4.99.38/Source/robodoc \ --src mqrobo.cob --doc robotest --singlefile \ --rc robocob.rc [/code] I've used a locally built copy, as I made a change in the HTML colourizer to account for the COBOL dash in names. [i]That will be one of the later posts[/i] Unfortunately the [i]singlefile[/i] form of ROBODoc doesn't really highlight its indexing powers. That really kicks in with singledoc and multidoc builds. [i]A later post[/i]. Here is the ROBODoc configuration. [b]robocob.rc[/b] [code] # robodoc.rc for OpenCOBOL # items: NAME AUTHOR DATE PURPOSE TECTONICS SYNOPSIS INPUTS OUTPUTS SIDE EFFECTS HISTORY BUGS EXAMPLE SOURCE ignore items: HISTORY BUGS item order: PURPOSE SYNOPSIS INPUTS OUTPUTS source items: SYNOPSIS preformatted items: INPUTS OUTPUTS format items: PURPOSE SIDE EFFECTS options: # --src ./ # --doc ./doc --html --syntaxcolors # --singledoc # --multidoc --index --tabsize 8 headertypes: J "Projects" robo_projects 2 F "Files" robo_files 1 e "Makefile Entries" robo_mk_entries x "System Tests" robo_syst_tests q Queries robo_queries ignore files: README CVS *.bak *~ "a test_*" accept files: *.cob *.COB *.cbl *.CBL *.cpy *.CPY header markers: *>**** remark markers: *> end markers: *>**** header separate characters: , header ignore characters: [ remark begin markers: *>+ remark end markers: *>- source line comments: *> keywords: accept access active-class add address advancing after aligned all allocate alphabet alphabetic alphabetic-lower alphabetic-upper alphanumeric alphanumeric-edited also alter alternate and any anycase are area areas argument-number argument-value arithmetic as ascending assign at attribute auto auto-skip automatic autoterminate b-and b-not b-or b-xor background-color based beep before bell binary binary-c-long binary-char binary-double binary-long binary-short bit blank blink block boolean bottom by byte-length call cancel cd center cf ch chain chaining character characters class class-id classification close code code-set col collating cols column columns comma command-line commit common communication comp comp-1 comp-2 comp-3 comp-4 comp-5 comp-x computational computational-1 computational-2 computational-3 computational-4 computational-5 computational-x compute condition configuration constant contains content continue control controls converting copy corr corresponding count crt currency cursor cycle data data-pointer date day day-of-week de debugging decimal-point declaratives default delete delimited delimiter depending descending destination detail disable disk display divide division down duplicates dynamic ebcdic ec egi else emi enable end end-accept end-add end-call end-compute end-delete end-display end-divide end-evaluate end-if end-multiply end-of-page end-perform end-read end-receive end-return end-rewrite end-search end-start end-string end-subtract end-unstring end-write entry entry-convention environment environment-name environment-value eo eol eop eos equal equals erase error escape esi evaluate exception exception-object exclusive exit expands extend external factory false fd file file-control file-id filler final first float-extended float-long float-short footing for foreground-color forever format free from full function function-id generate get giving global go goback greater group group-usage heading high-value high-values highlight i-o i-o-control id identification if ignoring implements in index indexed indicate inherits initial initialize initialized initiate input input-output inspect interface interface-id into intrinsic invalid invoke is just justified key label last lc_all lc_collate lc_ctype lc_messages lc_monetary lc_numeric lc_time leading left length less limit limits linage linage-counter line line-counter lines linkage local-storage locale lock low-value low-values lowlight manual memory merge message method method-id minus mode move multiple multiply national national-edited native negative nested next no none normal not null nulls number numbers numeric numeric-edited object object-computer object-reference occurs of off omitted on only open optional options or order organization other output overflow overline override packed-decimal padding page page-counter paragraph perform pf ph pic picture plus pointer position positive present previous printer printing procedure procedure-pointer procedures proceed program program-id program-pointer prompt property prototype purge queue quote quotes raise raising random rd read receive record recording records recursive redefines reel reference relation relative release remainder removal renames replace replacing report reporting reports repository required reserve reset resume retry return returning reverse-video rewind rewrite rf rh right rollback rounded run same screen sd search seconds section secure segment select self send sentence separate sequence sequential set sharing sign signed signed-int signed-long signed-short size sort sort-merge source source-computer sources space spaces special-names standard standard-1 standard-2 start statement status step stop string strong sub-queue-1 sub-queue-2 sub-queue-3 subtract sum super suppress symbol symbolic sync synchronized system-default table tallying tape terminal terminate test text than then through thru time times to top trailing true type typedef ucs-4 underline unit universal unlock unsigned unsigned-int unsigned-long unsigned-short unstring until up update upon usage use user-default using utf-16 utf-8 val-status valid validate validate-status value values varying when with working-storage write yyyyddd yyyymmdd zero zeroes zeros [/code] Cheers, Brian ---------------------------------------------------------------- Brian, Thank you for this complete configuration of Robodoc. I also use Robodoc which is a very useful program to document code. But my ow config was not so complete as yours. Regards Alain ---------------------------------------------------------------- Agree. ROBODoc is becoming one of my favourite tools. I'm finding all kinds of uses for it. Just so you (and everyone) knows. Building the list of reserved words for tools like ROBODoc (and GeSHi and Pygments and Vim and GNAT GPS and ...) is a simple [code] $ cobc --list-reserved [/code] and a little bit of [b]awk[/b] code to reformat. There is also --list-intrinsics and --list-mnemonics for getting at all the goodies supported in OpenCOBOL. Cheers, Brian ---------------------------------------------------------------- Will robodoc be replacing ocdoc? ---------------------------------------------------------------- Subject: Feature Request (FIX submitted): Add section name to Warnings/Errors For all errors either the paragraph name or the section name (depending on the last occurrence) is printed. Samples: [quote] SOMEPROG.cbl: In paragraph '00': SOMEPROG.cbl:746: Warning: CALL statement not terminated by END-CALL SOMEPROG.cbl: In section 'somesec': SOMEPROG.cbl:912: Warning: CALL statement not terminated by END-CALL[/quote] Is it possible to output both (if there is a section at all)? The paragraph '00' in the sample can exist in every section of the same program. I thought of something like [quote] SOMEPROG.cbl: In section 'somesec': SOMEPROG.cbl: In paragraph '00': SOMEPROG.cbl:746: Warning: CALL statement not terminated by END-CALL SOMEPROG.cbl:775: Warning: CALL statement not terminated by END-CALL SOMEPROG.cbl: In paragraph 'data': SOMEPROG.cbl:851: Warning: CALL statement not terminated by END-CALL SOMEPROG.cbl: In section 'somesec2': SOMEPROG.cbl: In paragraph '00': SOMEPROG.cbl:1645: Warning: CALL statement not terminated by END-CALL[/quote] What do you think, is this request valid? Thank you in advance, human ---------------------------------------------------------------- Digging into the source slowly the patch is quite easy and belongs to "error.c". The part [code]/* print the paragraph or section name */[/code] in print_error must be changed either to [code] /* print the section and/or paragraph name */ if (current_section != last_section || current_paragraph != last_paragraph) { if (current_section && strcmp ((const char *)(current_section->name), "MAIN SECTION")) { fprintf (stderr, _("%s: In section '%s':\n"), file, current_section->name); } if (current_paragraph && strcmp ((const char *)(current_paragraph->name), "MAIN PARAGRAPH")) { fprintf (stderr, _("%s: In paragraph '%s':\n"), file, current_paragraph->name); } last_section = current_section; last_paragraph = current_paragraph; }[/code] resulting in [quote]SOMEPROG.cbl: In section 'somesec': SOMEPROG.cbl: In paragraph '00': SOMEPROG.cbl:746: Warning: CALL statement not terminated by END-CALL SOMEPROG.cbl:775: Warning: CALL statement not terminated by END-CALL[/quote] or, which I like more because of it's beautiful output, to [code] /* print the section and/or paragraph name */ if (current_section != last_section || current_paragraph != last_paragraph) { if (current_section && strcmp ((const char *)(current_section->name), "MAIN SECTION")) { fprintf (stderr, _("%s: In section '%s'"), file, current_section->name); if (current_paragraph && strcmp ((const char *)(current_paragraph->name), "MAIN PARAGRAPH")) { fprintf (stderr, _(", paragraph '%s':\n"), current_paragraph->name); } else { fprintf (stderr, _(":\n")); } } else if (current_paragraph && strcmp ((const char *)(current_paragraph->name), "MAIN PARAGRAPH")) { fprintf (stderr, _("%s: In paragraph '%s':\n"), file, current_paragraph->name); } last_section = current_section; last_paragraph = current_paragraph; }[/code] resulting in [quote]SOMEPROG.cbl: In section 'somesec', paragraph '00': SOMEPROG.cbl:746: Warning: CALL statement not terminated by END-CALL SOMEPROG.cbl:775: Warning: CALL statement not terminated by END-CALL[/quote] human ---------------------------------------------------------------- Subject: (solved)new installation of 1.1 Hi, From more years I use with satisfaction open-cobol 1.1. Now installing the last O-C 1.1 version on new PC I received some errors: danilo@danilo-ntbk:~$ cobc -V cobc (OpenCOBOL) 1.0.0 Copyright (C) 2001-2007 Keisuke Nishida Copyright (C) 2007 Roger While danilo@danilo-ntbk:~$ cd open-cobol-1.1 danilo@danilo-ntbk:~/open-cobol-1.1$ ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking whether to enable maintainer-specific portions of Makefiles... no checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking how to run the C preprocessor... gcc -E checking for egrep... grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking whether ln -s works... yes checking for a BSD-compatible install... /usr/bin/install -c checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking for a sed that does not truncate output... /bin/sed checking for ld used by gcc... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for /usr/bin/ld option to reload object files... -r checking for BSD-compatible nm... /usr/bin/nm -B checking how to recognize dependent libraries... pass_all checking dlfcn.h usability... yes checking dlfcn.h presence... yes checking for dlfcn.h... yes checking the maximum length of command line arguments... 1572864 checking command to parse /usr/bin/nm -B output from gcc object... ok checking for objdir... .libs checking for ar... ar checking for ranlib... ranlib checking for strip... strip checking if gcc supports -fno-rtti -fno-exceptions... no checking for gcc option to produce PIC... -fPIC checking if gcc PIC flag -fPIC works... yes checking if gcc static flag -static works... yes checking if gcc supports -c -o file.o... yes checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking for shl_load... no checking for shl_load in -ldld... no checking for dlopen... no checking for dlopen in -ldl... yes checking whether a program can dlopen itself... yes checking whether a statically linked program can dlopen itself... no checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes configure: creating libtool checking whether make sets $(MAKE)... (cached) yes checking for ANSI C header files... (cached) yes checking for stdint.h... (cached) yes checking for sys/types.h... (cached) yes checking signal.h usability... yes checking signal.h presence... yes checking for signal.h... yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking malloc.h usability... yes checking malloc.h presence... yes checking for malloc.h... yes checking locale.h usability... yes checking locale.h presence... yes checking for locale.h... yes checking stddef.h usability... yes checking stddef.h presence... yes checking for stddef.h... yes checking wchar.h usability... yes checking wchar.h presence... yes checking for wchar.h... yes checking for dlfcn.h... (cached) yes checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking for an ANSI C-conforming const... yes checking whether byte ordering is bigendian... no checking for size_t... yes checking whether struct tm is in sys/time.h or time.h... time.h checking for inline... inline checking for working alloca.h... yes checking for alloca... yes checking for vprintf... yes checking for _doprnt... no checking for memmove... yes checking for memset... yes checking for setlocale... yes checking for fcntl... yes checking for strerror... yes checking for strcasecmp... yes checking for strchr... yes checking for strrchr... yes checking for strdup... yes checking for strstr... yes checking for strtol... yes checking for gettimeofday... yes checking for ld used by GCC... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for shared library run path origin... done checking for iconv... yes checking for iconv declaration... extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); checking for nl_langinfo and CODESET... yes checking for getopt_long_only... yes checking kpathsea/getopt.h usability... no checking kpathsea/getopt.h presence... no checking for kpathsea/getopt.h... no checking getopt.h usability... yes checking getopt.h presence... yes checking for getopt.h... yes checking gmp.h usability... yes checking gmp.h presence... yes checking for gmp.h... yes checking for __gmp_randinit in -lgmp... yes checking whether NLS is requested... yes checking for msgfmt... /usr/bin/msgfmt checking for gmsgfmt... /usr/bin/msgfmt checking for xgettext... /usr/bin/xgettext checking for msgmerge... /usr/bin/msgmerge checking whether NLS is requested... yes checking for GNU gettext in libc... yes checking whether to use NLS... yes checking where the gettext function comes from... libc checking for initscr in -lncurses... no checking for initscr in -lpdcurses... no checking for initscr in -lcurses... no checking for BDB db.h version >= 4.1 ... yes (4.5) checking for BDB 4.1 compatibility in db ... yes checking for dlopen in -lc... no checking for dlopen in -ldl... (cached) yes configure: creating ./config.status config.status: creating cob-config config.status: creating Makefile config.status: creating lib/Makefile config.status: creating libcob/Makefile config.status: creating cobc/Makefile config.status: creating bin/Makefile config.status: creating po/Makefile.in config.status: creating texi/Makefile config.status: creating config/Makefile config.status: creating copy/Makefile config.status: creating tests/atlocal config.status: creating tests/Makefile config.status: creating tests/cobol85/Makefile config.status: creating config.h config.status: executing tests/atconfig commands config.status: executing depfiles commands config.status: executing default-1 commands config.status: creating po/POTFILES config.status: creating po/Makefile OpenCOBOL Configuration: CC gcc COB_CC gcc CFLAGS -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k COB_CFLAGS -I/usr/local/include COB_EXTRA_FLAGS -march=i686 -mtune=pentium4 LDFLAGS COB_LDFLAGS COB_LIBS -L${exec_prefix}/lib -lcob -lm -lgmp -ldb -ldl COB_CONFIG_DIR ${prefix}/share/open-cobol/config COB_COPY_DIR ${prefix}/share/open-cobol/copy COB_LIBRARY_PATH ${exec_prefix}/lib/open-cobol COB_MODULE_EXT so COB_SHARED_OPT -shared COB_PIC_FLAGS -fPIC -DPIC COB_EXPORT_DYN -Wl,--export-dynamic COB_STRIP_CMD strip --strip-unneeded Dynamic loading System Use gettext for international messages: yes Use Berkeley DB for file I/O: yes Use enhanced Berkeley DB (>= 4.1) yes Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: no danilo@danilo-ntbk:~/open-cobol-1.1$ make Creating defaults.h... make all-recursive make[1]: Entering directory `/home/danilo/open-cobol-1.1' Making all in lib make[2]: Entering directory `/home/danilo/open-cobol-1.1/lib' if gcc -DHAVE_CONFIG_H -I. -I. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT dummymac.o -MD -MP -MF ".deps/dummymac.Tpo" -c -o dummymac.o dummymac.c; \ then mv -f ".deps/dummymac.Tpo" ".deps/dummymac.Po"; else rm -f ".deps/dummymac.Tpo"; exit 1; fi rm -f libsupport.a ar cru libsupport.a dummymac.o ranlib libsupport.a make[2]: Leaving directory `/home/danilo/open-cobol-1.1/lib' Making all in libcob make[2]: Entering directory `/home/danilo/open-cobol-1.1/libcob' if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF ".deps/libcob_la-common.Tpo" -c -o libcob_la-common.lo `test -f 'common.c' || echo './'`common.c; \ then mv -f ".deps/libcob_la-common.Tpo" ".deps/libcob_la-common.Plo"; else rm -f ".deps/libcob_la-common.Tpo"; exit 1; fi mkdir .libs gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF .deps/libcob_la-common.Tpo -c common.c -fPIC -DPIC -o .libs/libcob_la-common.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF .deps/libcob_la-common.Tpo -c common.c -o libcob_la-common.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF ".deps/libcob_la-call.Tpo" -c -o libcob_la-call.lo `test -f 'call.c' || echo './'`call.c; \ then mv -f ".deps/libcob_la-call.Tpo" ".deps/libcob_la-call.Plo"; else rm -f ".deps/libcob_la-call.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF .deps/libcob_la-call.Tpo -c call.c -fPIC -DPIC -o .libs/libcob_la-call.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF .deps/libcob_la-call.Tpo -c call.c -o libcob_la-call.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF ".deps/libcob_la-strings.Tpo" -c -o libcob_la-strings.lo `test -f 'strings.c' || echo './'`strings.c; \ then mv -f ".deps/libcob_la-strings.Tpo" ".deps/libcob_la-strings.Plo"; else rm -f ".deps/libcob_la-strings.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF .deps/libcob_la-strings.Tpo -c strings.c -fPIC -DPIC -o .libs/libcob_la-strings.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF .deps/libcob_la-strings.Tpo -c strings.c -o libcob_la-strings.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-move.lo -MD -MP -MF ".deps/libcob_la-move.Tpo" -c -o libcob_la-move.lo `test -f 'move.c' || echo './'`move.c; \ then mv -f ".deps/libcob_la-move.Tpo" ".deps/libcob_la-move.Plo"; else rm -f ".deps/libcob_la-move.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-move.lo -MD -MP -MF .deps/libcob_la-move.Tpo -c move.c -fPIC -DPIC -o .libs/libcob_la-move.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-move.lo -MD -MP -MF .deps/libcob_la-move.Tpo -c move.c -o libcob_la-move.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF ".deps/libcob_la-numeric.Tpo" -c -o libcob_la-numeric.lo `test -f 'numeric.c' || echo './'`numeric.c; \ then mv -f ".deps/libcob_la-numeric.Tpo" ".deps/libcob_la-numeric.Plo"; else rm -f ".deps/libcob_la-numeric.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF .deps/libcob_la-numeric.Tpo -c numeric.c -fPIC -DPIC -o .libs/libcob_la-numeric.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF .deps/libcob_la-numeric.Tpo -c numeric.c -o libcob_la-numeric.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic.lo -MD -MP -MF ".deps/libcob_la-intrinsic.Tpo" -c -o libcob_la-intrinsic.lo `test -f 'intrinsic.c' || echo './'`intrinsic.c; \ then mv -f ".deps/libcob_la-intrinsic.Tpo" ".deps/libcob_la-intrinsic.Plo"; else rm -f ".deps/libcob_la-intrinsic.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic.lo -MD -MP -MF .deps/libcob_la-intrinsic.Tpo -c intrinsic.c -fPIC -DPIC -o .libs/libcob_la-intrinsic.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic.lo -MD -MP -MF .deps/libcob_la-intrinsic.Tpo -c intrinsic.c -o libcob_la-intrinsic.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF ".deps/libcob_la-fileio.Tpo" -c -o libcob_la-fileio.lo `test -f 'fileio.c' || echo './'`fileio.c; \ then mv -f ".deps/libcob_la-fileio.Tpo" ".deps/libcob_la-fileio.Plo"; else rm -f ".deps/libcob_la-fileio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF .deps/libcob_la-fileio.Tpo -c fileio.c -fPIC -DPIC -o .libs/libcob_la-fileio.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF .deps/libcob_la-fileio.Tpo -c fileio.c -o libcob_la-fileio.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-termio.lo -MD -MP -MF ".deps/libcob_la-termio.Tpo" -c -o libcob_la-termio.lo `test -f 'termio.c' || echo './'`termio.c; \ then mv -f ".deps/libcob_la-termio.Tpo" ".deps/libcob_la-termio.Plo"; else rm -f ".deps/libcob_la-termio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-termio.lo -MD -MP -MF .deps/libcob_la-termio.Tpo -c termio.c -fPIC -DPIC -o .libs/libcob_la-termio.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-termio.lo -MD -MP -MF .deps/libcob_la-termio.Tpo -c termio.c -o libcob_la-termio.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-screenio.lo -MD -MP -MF ".deps/libcob_la-screenio.Tpo" -c -o libcob_la-screenio.lo `test -f 'screenio.c' || echo './'`screenio.c; \ then mv -f ".deps/libcob_la-screenio.Tpo" ".deps/libcob_la-screenio.Plo"; else rm -f ".deps/libcob_la-screenio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-screenio.lo -MD -MP -MF .deps/libcob_la-screenio.Tpo -c screenio.c -fPIC -DPIC -o .libs/libcob_la-screenio.o screenio.c:1077: error: conflicting types for 'cob_field_display' screenio.h:86: error: previous declaration of 'cob_field_display' was here screenio.c:1083: error: conflicting types for 'cob_field_accept' screenio.h:89: error: previous declaration of 'cob_field_accept' was here make[2]: *** [libcob_la-screenio.lo] Error 1 make[2]: Leaving directory `/home/danilo/open-cobol-1.1/libcob' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/danilo/open-cobol-1.1' make: *** [all] Error 2 danilo@danilo-ntbk:~/open-cobol-1.1$ sudo make install make install-recursive make[1]: Entering directory `/home/danilo/open-cobol-1.1' Making install in lib make[2]: Entering directory `/home/danilo/open-cobol-1.1/lib' make[3]: Entering directory `/home/danilo/open-cobol-1.1/lib' make[3]: Nothing to be done for `install-exec-am'. make[3]: Nothing to be done for `install-data-am'. make[3]: Leaving directory `/home/danilo/open-cobol-1.1/lib' make[2]: Leaving directory `/home/danilo/open-cobol-1.1/lib' Making install in libcob make[2]: Entering directory `/home/danilo/open-cobol-1.1/libcob' if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-screenio.lo -MD -MP -MF ".deps/libcob_la-screenio.Tpo" -c -o libcob_la-screenio.lo `test -f 'screenio.c' || echo './'`screenio.c; \ then mv -f ".deps/libcob_la-screenio.Tpo" ".deps/libcob_la-screenio.Plo"; else rm -f ".deps/libcob_la-screenio.Tpo"; exit 1; fi 22 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-screenio.lo -MD -MP -MF .deps/libcob_la-screenio.Tpo -c screenio.c -fPIC -DPIC -o .libs/libcob_la-screenio.o screenio.c:1077: error: conflicting types for 'cob_field_display' screenio.h:86: error: previous declaration of 'cob_field_display' was here screenio.c:1083: error: conflicting types for 'cob_field_accept' screenio.h:89: error: previous declaration of 'cob_field_accept' was here make[2]: *** [libcob_la-screenio.lo] Error 1 make[2]: Leaving directory `/home/danilo/open-cobol-1.1/libcob' make[1]: *** [install-recursive] Error 1 make[1]: Leaving directory `/home/danilo/open-cobol-1.1' make: *** [install] Error 2 danilo@danilo-ntbk:~/open-cobol-1.1$ danilo@danilo-ntbk:~/open-cobol-1.1$ cobc -V cobc (OpenCOBOL) 1.0.0 Copyright (C) 2001-2007 Keisuke Nishida Copyright (C) 2007 Roger While danilo@danilo-ntbk:~/open-cobol-1.1$ then I installed a previouse O-C 1.1 version (the same I normally use), but, when compile my cobol sources, I receve this error: crtvid.cbl:13: Error: syntax error, unexpected ORGANIZATION, expecting WORD or LITERAL or DISPLAY this is part of my cobol source with the error: SELECT ambiente ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-STAT-ambiente. where I do some mistake? How can I resolve? thanks danilo ---------------------------------------------------------------- Hello danilo, I can't say for sure for your particular case ... but the automake/libtools used for packaging the OC pre-releases is somewhat sensitive to "build over old sources". By that I mean, if you have [code] /home/danilo/build/open-cobol-1.1$ ./configure [/code] that should work great (the first time) If you then [code] /home/danilo/build$ tar xvf open-cobol-1.1.tar.gz [/code] and extract the tar ball over top of the old sources, there is a possibility of cached libtool and automake files getting in the way. Either extract to a clean build directory everytime, or what I do is (from the same build dir each time) [code] $ tar xvf ... $ cd open-cobol-1.1 $ make distclean $ ./configure $ make $ make check $ sudo make install [/code] The [b]make distclean[/b] properly purges the cached automake/libtool files that can possibly get in the way of a clean compiler build. This caching issue can cause all kinds of subtle very hard to figure out problems. And you'll know when you might have to do the "build over" cleanup as $ make distclean will work. On a clean install directory there won't be any makefile until after an initial ./configure. :) [i]By the way, your code snippet worked fine here[/i]. Hope that helps Cheers, Brian ---------------------------------------------------------------- thanks Brian for Your quickly answer. unfortunately this doesn't solve my problem. The result is the same: using the new download of OC1.1, the install procedure end with errors; using an old download , the install end fine. But the bigger problem for me, is the error during the compilation regarding the word "ORGANIZATION". danilo ---------------------------------------------------------------- Yeah, it is a problem. This works on my Debian box [code] identification division. program-id. filer. environment division. input-output section. file-control. SELECT ambiente ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-STAT-ambiente. data division. file section. fd ambiente. 01 rec pic x(132). working-storage section. 01 WS-STAT-ambiente pic 9999. procedure division. goback. end program filer. [/code] Can you post some of the surrounding code you have? [b]Oh, and by the way[/b]: There are two things that can get you after a build. Cached libtool files and the shared library cache. Always good to do a [b]$ sudo ldconfig[/b] after a new compiler compile. On the broken build. I think it has something to do with finding ncurses.h. Do you have the ncurses-dev and libncurses5-dev packages installed (or similar? lib64ncurses5-dev for a 64bit machine for instance)? Cheers, Brian ---------------------------------------------------------------- there is the one of my more simple cobol source and the result of compilation. This source, how more other, has been compiled without problems more time with cobc 1.1 since 2008 jan. IDENTIFICATION DIVISION. PROGRAM-ID. crtcab. ************************************************************************* * * * sostituisce CAB e CASE con IF * * non sostituisce DO *HIVAL con DOUEQ * * sostituisce DO n-times con Z-ADD e DOUEQ * * * ************************************************************************* AUTHOR. rosso. DATE-WRITTEN. nov 1999. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. w95. OBJECT-COMPUTER. w95. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT ambiente ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-STAT-ambiente. SELECT listarpg ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-STAT-listarpg. SELECT listafmt ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-STAT-listafmt. SELECT srcrpg ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-STAT-srcrpg. SELECT srcrpgo ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-STAT-srcrpgo. SELECT mdsrcj ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-STAT-mdsrcj. SELECT xcall ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-STAT-xcall. DATA DIVISION. FILE SECTION. FD listarpg LABEL RECORD IS STANDARD VALUE OF FILE-ID IS "listarpg.txt" DATA RECORD IS listarpg-REC. 01 listarpg-REC. 10 WHFILE. 15 primicar. 17 filler pic x. 17 whfuno pic x. 15 restocar. 17 filler pic x(4). 17 whfSET pic x. 17 filler pic x(3). 15 filler pic x(40). FD listafmt LABEL RECORD IS STANDARD VALUE OF FILE-ID IS "listafmt.txt" DATA RECORD IS listafmt-REC. 01 listafmt-REC. 10 nomevideo pic x(10). 10 nomepgm pic x(10). 10 SFL pic x(10). 10 filler pic x(70). FD srcrpgo LABEL RECORD IS STANDARD VALUE OF FILE-ID IS nome-srcrpgo DATA RECORD IS srcrpgo-REC. 01 srcrpgo-REC. 05 filler pic x(100). FD srcrpg LABEL RECORD IS STANDARD VALUE OF FILE-ID IS nome-srcrpg DATA RECORD IS srcrpg-REC. 01 srcrpg-REC. 05 filler pic x(100). FD mdsrcj LABEL RECORD IS STANDARD VALUE OF FILE-ID IS nome-mdsrcj DATA RECORD IS mdsrcj-REC. 01 mdsrcj-REC. 05 filler pic x(100). FD ambiente LABEL RECORD IS STANDARD VALUE OF FILE-ID IS "ambiente.txt" DATA RECORD IS ambiente-REC. 01 ambiente-REC. 05 creads. 12 filler pic x(4). 12 nomeamb pic x(100). FD xcall LABEL RECORD IS STANDARD VALUE OF FILE-ID IS "xcall.txt" DATA RECORD IS mdsrcj-REC. 01 xcall-REC. 05 nompgm pic x(10). 05 nomecall pic x(10). 05 filler pic x(60). *----------------------------------------------------------------- * DEFINIZIONE AREA DI WORK *----------------------------------------------------------------- WORKING-STORAGE SECTION. 01 xxa pic x. 01 env pic x. 01 homeD pic x(100). 01 homeL pic x(100). 01 nomeambiente pic x(100). 01 nomedacv pic x(100). 01 nomejcv pic x(100). 01 xdebug pic x(100). 01 nvoc pic 9(3) value 0. 01 sav-wrkrpg-rec. 05 filler pic x(100). 01 xinp pic x. 01 swcas pic x value space. 01 numif pic S999 value 0. 01 savwrkrpg-REC. 05 filler pic x(100). 01 path-srcrpg pic x(50) value space. 01 nome-srcrpg pic x(50) value space. 01 P3-srcrpg PIC X(10) VALUE ' '. 01 path-srcrpgo pic x(50) value space. 01 nome-srcrpgo pic x(50) value space. 01 P3-srcrpgo PIC X(10) VALUE ' '. 01 nome-mdsrcj. 05 P3-amb PIC X(10) VALUE space. 01 WS-STAT-ambiente. 05 st1-ambiente pic X value ' '. 05 st2-ambiente pic 9 comp value 0. 01 WS-STAT-xcall. 05 st1-xcall pic X value ' '. 05 st2-xcall pic 9 comp value 0. 01 WS-STAT-mdsrcj. 05 st1 pic X value ' '. 05 st2 pic 9 comp value 0. 01 WS-STAT-listarpg. 05 st1 pic X value ' '. 05 st2 pic 9 comp value 0. 01 WS-STAT-listafmt. 05 st1 pic X value ' '. 05 st2 pic 9 comp value 0. 01 WS-STAT-srcrpg. 05 st1 pic X value ' '. 05 st2 pic 9 comp value 0. 01 WS-STAT-srcrpgo. 05 st1o pic X value ' '. 05 st2o pic 9 comp value 0. 01 swfine pic x value space. 01 savrisult pic x(6) value space. 01 savcodopec2 pic xx value space. 01 wrkmdsrcj-REC. 10 filler pic x(6) value 'md '. 10 newmds pic x(50) value ' '. 01 wrkmdsrcL-REC. 10 filler pic x(6) value 'mkdir '. 10 newmdsL pic x(50) value ' '. 01 wrkrpg-REC. 05 numrig pic x(5). 05 tipospec pic x. 05 specifica. 10 aster pic x. 10 filler pic x(65). 05 spec-F redefines specifica. 10 nomefile. 15 nomef6 pic x(6). 15 nomef2 pic x(2). 10 CUOI pic x. 10 FPS pic x. 10 EoF pic x. 10 AD pic x. 10 EF pic x. 10 lblk pic x(4). 10 lrek pic x(4). 10 LR pic x. 10 lkey pic xx. 10 IK pic x. 26 10 fo pic x. 10 OwF pic xx. 10 Kfs pic x(4). 10 exK pic x. 10 device pic x(7). 10 simbdev pic x(6). 10 contl pic x. 10 extlab pic x(6). 10 extent pic x(6). 10 AU pic x. 10 filler pic x(4). 66 10 fileuser pic xx. 05 spec-C redefines specifica. 10 MOLA pic xx. 10 indccond. 15 nc1 pic x. 15 indc pic xx. 15 nc2 pic x. 15 indc2 pic xx. 15 nc3 pic x. 15 indc3 pic xx. 10 fattore1. 15 fatt1 pic x(6). 15 filler pic x(4). 10 codope. 15 codope1 pic xx. 15 codope2 pic xx. 15 filler pic x. 10 codopec redefines codope. 15 codopec1 pic xxx. 15 codopec2 pic xx. 10 fattore2. 15 fatt2 pic x(6). 15 filler pic x(4). 10 result pic x(6). 10 fldl pic x(3). 10 ndec pic x. 10 halfadg pic x. 10 indr1 pic xx. 10 indr2 pic xx. 10 indr3 pic xx. 66 10 filler pic x(12). 05 comm pic x(8). 01 numdo pic 999 value 0. 01 MOLAs pic xx value space. 01 PARAMETRI-DI-WORK. 10 swfinerpg pic x(01) value zero. 10 scxend. 15 el-scxend occurs 200 times. 20 el-scxend-inv pic x(6). 10 scxend2. 15 el-scxend2 occurs 200 times. 20 el-scxend2-tipo. 25 el-scxend2-tipo1 pic x. 25 el-scxend2-tipo2 pic x. 25 el-scxend2-tipo3 pic x. 20 el-scxend2-ind pic x. 20 el-scxend2-spec pic x(4). 10 indxend pic S999 value 0. 10 tipo-scxend2 pic xxx. 10 replac. 15 el-replac pic x occurs 200 times. 10 replac-red redefines replac pic x(200). PROCEDURE DIVISION. *----------------------------------------------------------------- * MAIN LINE *----------------------------------------------------------------- MAIN-LINE. PERFORM INIZIO THRU FINE. perform eladsp thru ex-eladsp until swfine = '1'. END-PGM. PERFORM INIZIO-CLOSE THRU FINE-CLOSE. display "fine crtcab" if xdebug = "DEBUG " then accept xxa end-if. stop run. eladsp. read listarpg at end move '1' to swfine if listafmt-REC <> space then write listafmt-rec end-if go to ex-eladsp END-READ if primicar = "**" or " " then go to ex-eladsp end-if if listafmt-REC <> space then write listafmt-rec end-if move space to listafmt-rec perform open-rpg thru ex-open-rpg if WS-STAT-srcrpg = '00' then perform prep-md thru ex-prep-md move "0" to swfinerpg PERFORM INIZIO-ELAB THRU FINE-ELAB until swfinerpg = '1' end-if. ex-eladsp. exit. *----------------------------------------------------------------- * APERTURA ARCHIVI *----------------------------------------------------------------- INIZIO. move space to listafmt-rec open input ambiente move "BASE" to nomeambiente if WS-STAT-ambiente = "00" then read ambiente move nomeamb to env read ambiente move nomeamb to homeD read ambiente move nomeamb to homeL read ambiente move nomeamb to nomeambiente read ambiente move nomeamb to nomejcv read ambiente move nomeamb to nomedacv read ambiente move nomeamb to xdebug end-if close ambiente OPEN input listarpg. OPEN output listafmt xcall CLOSE listafmt OPEN extend listafmt if env = "W" then move "mdsrcj.bat" to nome-mdsrcj String homeD, nomedacv, nomeambiente, '\src\' delimited by space into path-srcrpg String homeD, nomedacv, nomeambiente, '\src\rpgo\' delimited by space into path-srcrpgo end-if if env = "L" then move "mdsrcj.sh" to nome-mdsrcj String homeL, nomedacv, nomeambiente, '\src\' delimited by space into path-srcrpg String homeL, nomedacv, nomeambiente, '\src\rpgo\' delimited by space into path-srcrpgo inspect path-srcrpg replacing all "\" by "/" inspect path-srcrpgo replacing all "\" by "/" end-if OPEN output mdsrcj Close mdsrcj. FINE. EXIT. *----------------------------------------------------------------- * CHIUSURA ARCHIVI *----------------------------------------------------------------- INIZIO-CLOSE. CLOSE srcrpg srcrpgo mdsrcj listarpg xcall listafmt. FINE-CLOSE. EXIT. *----------------------------------------------------------------- * ELABORAZIONE ARCHIVIO PER CREAZIONE COPY *----------------------------------------------------------------- INIZIO-ELAB. if WS-STAT-srcrpg = '00' then READ srcrpg NEXT into wrkrpg-rec AT END move "1" to swfinerpg move all'9' to wrkrpg-rec go to FINE-ELAB end-read else move all'9' to wrkrpg-rec go to FINE-ELAB end-if if aster = '*' or (tipospec not = "C" and tipospec not = "F") then write srcrpgo-rec from wrkrpg-rec move space to swcas move 0 to numif else if tipospec = "C" then perform fa-c thru ex-fa-c else if tipospec = "F" then perform fa-f thru ex-fa-f end-if write srcrpgo-rec from wrkrpg-rec move space to swcas move 0 to numif end-if end-if. FINE-ELAB. EXIT. fa-C. if codope = "CALL " then move space to xcall-REC move nomepgm to nompgm move fattore2 to nomecall write xcall-REC end-if if codope= "ENDCS" then move space to codope move "END " to codope end-if if (codope1 = "DO" or codope1 = "IF" or codopec1 = "CAS") then perform caricaxend thru ex-caricaxend end-if if (codopec1 not = "CAB" and codope1 not = "DO" and codopec1 not = "CAS"and codopec1 not = "END" and codope1 not = "IF") then if codope = 'COMP' then perform fa-comp thru ex-facomp else write srcrpgo-rec from wrkrpg-rec move space to swcas move 0 to numif end-if else if codope1 = "DO" or codopec1 = "CAB" or codopec1 = "CAS" or codopec1 = "END" and codope not = "ENDSR" then move mola to molas perform specC thru ex-specC else write srcrpgo-rec from wrkrpg-rec move space to swcas move 0 to numif end-if end-if. ex-fa-c. EXIT. fa-f. if tipospec = "F" and device = "WORKSTN" then move nomefile to replac move replac to nomevideo move WHFILE to replac perform pulisci thru ex-pulisci move replac to nomepgm ************** write listafmt-rec end-if. inspect srcrpg-REC tallying nvoc for ALL "KSFILE" if nvoc > 0 then move "SFL" to SFL move 0 to nvoc end-if. ex-fa-f. EXIT. specC. if codope1 = "DO" then add 1 to numdo end-if if (codope = "DO " and fattore2 = "*HIVAL ") then perform doH thru ex-doH else if codope = "DO " and fattore2 not = space then move "*" to aster write srcrpgo-rec from wrkrpg-rec move " " to aster move molas to mola perform doN thru ex-doN else if codopec1 = "CAB" then move "*" to aster write srcrpgo-rec from wrkrpg-rec move " " to aster move molas to mola perform cab thru ex-cab else if codopec1 = "CAS" then move "*" to aster write srcrpgo-rec from wrkrpg-rec move " " to aster move molas to mola perform cas thru ex-cas else if codopec1 = "END" then perform faend thru ex-faend else write srcrpgo-rec from wrkrpg-rec end-if end-if end-if end-if end-if. ex-specC. EXIT. doH. write srcrpgo-rec from wrkrpg-rec. ex-doH. EXIT. doN. move result to el-scxend-inv (numdo) move wrkrpg-rec to savwrkrpg-rec move "Z-ADD" to codope if fattore1 not = space then move fattore1 to fattore2 else move '1' to fattore2 end-if move space to fattore1 write srcrpgo-rec from wrkrpg-rec move savwrkrpg-rec to wrkrpg-rec move "DOULE" to codope move result to fattore1 move space to result move space to ndec move space to fldl write srcrpgo-rec from wrkrpg-rec move savwrkrpg-rec to wrkrpg-rec. ex-doN. EXIT. cab. if codopec2 = space then move "GOTO" to codope move result to fatt2 move space to result write srcrpgo-rec from wrkrpg-rec else move result to savrisult move codopec2 to savcodopec2 move space to result move space to codope move "IF" to codope1 move savcodopec2 to codope2 write srcrpgo-rec from wrkrpg-rec move space to wrkrpg-rec move "C" to tipospec move "GOTO" to codope move savrisult to fatt2 write srcrpgo-rec from wrkrpg-rec move space to wrkrpg-rec move "C" to tipospec move "END" to codope write srcrpgo-rec from wrkrpg-rec end-if. ex-cab. EXIT. cas. if swcas = "1" then move wrkrpg-rec to savwrkrpg-rec move space to wrkrpg-rec move "C" to tipospec move "ELSE" to codope write srcrpgo-rec from wrkrpg-rec move savwrkrpg-rec to wrkrpg-rec end-if move "1" to swcas if codopec2 = space then move "EXSR" to codope move result to fatt2 move space to result write srcrpgo-rec from wrkrpg-rec else add 1 to numif move result to savrisult move codopec2 to savcodopec2 move space to result move space to codope move "IF" to codope1 move savcodopec2 to codope2 write srcrpgo-rec from wrkrpg-rec move space to wrkrpg-rec move "C" to tipospec move "EXSR" to codope move savrisult to fatt2 write srcrpgo-rec from wrkrpg-rec end-if. ex-cas. EXIT. faend. move wrkrpg-rec to sav-wrkrpg-rec if swcas = "1" then perform finecas thru ex-finecas else move el-scxend2-tipo (indxend) to tipo-scxend2 move space to el-scxend2 (indxend) compute indxend = indxend - 1 if tipo-scxend2 = "N" if fattore2 = space then move "1" to fattore2 end-if move "ADD " to codope move el-scxend-inv (numdo) to result write srcrpgo-rec from wrkrpg-rec move space to el-scxend-inv (numdo) subtract 1 from numdo else if tipo-scxend2 = "D" move space to spec-C move "END " to codope write srcrpgo-rec from wrkrpg-rec end-if end-if. write srcrpgo-rec from sav-wrkrpg-rec. ex-faend. EXIT. finecas. move space to swcas compute numif= numif - 1 if numif > 0 then perform varying numif from numif by -1 until numif = 0 move space to wrkrpg-rec move "C" to tipospec move "END" to codope write srcrpgo-rec from wrkrpg-rec end-perform end-if move space to swcas. ex-finecas. EXIT. fa-comp. move wrkrpg-rec to savwrkrpg-rec move mola to molas move '*' to aster write srcrpgo-rec from wrkrpg-rec *************************** move space to codope indr1 indr2 indr3 fattore1 fattore2 move molas to mola move "DO " to codope write srcrpgo-rec from wrkrpg-rec *************************** move savwrkrpg-rec to wrkrpg-rec move space to codope indccond mola fattore1 fattore2 move "SETOF" to codope write srcrpgo-rec from wrkrpg-rec *************************** move savwrkrpg-rec to wrkrpg-rec if indr1 not = space move space to codope indccond mola indr1 indr2 indr3 move 'IFGT ' to codope write srcrpgo-rec from wrkrpg-rec *************************** move savwrkrpg-rec to wrkrpg-rec move space to codope indccond mola fattore1 fattore2 indr2 indr3 move "SETON" to codope write srcrpgo-rec from wrkrpg-rec **************************** move space to wrkrpg-rec move "C" to tipospec move "END" to codope write srcrpgo-rec from wrkrpg-rec end-if ********************************************* move savwrkrpg-rec to wrkrpg-rec if indr2 not = space move space to codope indccond mola indr1 indr2 indr3 move 'IFLT ' to codope write srcrpgo-rec from wrkrpg-rec *************************** move savwrkrpg-rec to wrkrpg-rec move space to codope indccond mola fattore1 fattore2 indr1 indr3 move "SETON" to codope write srcrpgo-rec from wrkrpg-rec **************************** move space to wrkrpg-rec move "C" to tipospec move "END" to codope write srcrpgo-rec from wrkrpg-rec end-if ************************************* move savwrkrpg-rec to wrkrpg-rec if indr3 not = space move space to codope indccond mola indr1 indr2 indr3 move 'IFEQ ' to codope write srcrpgo-rec from wrkrpg-rec *************************** move savwrkrpg-rec to wrkrpg-rec move space to codope indccond mola fattore1 fattore2 indr1 indr2 move "SETON" to codope write srcrpgo-rec from wrkrpg-rec **************************** move space to wrkrpg-rec move "C" to tipospec move "END" to codope write srcrpgo-rec from wrkrpg-rec end-if ******************************************** move space to wrkrpg-rec move "C" to tipospec move "END " to codope write srcrpgo-rec from wrkrpg-rec. ex-facomp. EXIT. open-rpg. CLOSE srcrpg srcrpgo mdsrcj move "00" to WS-STAT-srcrpg move "00" to WS-STAT-srcrpgo move "00" to WS-STAT-mdsrcj move space to nome-srcrpg move space to nome-srcrpgo String path-srcrpg, WHFILE delimited by space into nome-srcrpg String path-srcrpgo, WHFILE delimited by space into nome-srcrpgo move space to P3-srcrpg move space to P3-srcrpgo move WHFILE to P3-srcrpg move WHFILE to P3-srcrpgo OPEN output srcrpgo. OPEN input srcrpg. OPEN extend mdsrcj. ex-open-rpg. exit. caricaxend. add 1 to indxend if codope = "DO " and fattore2 not = space then if fattore2 not = "*HIVAL " then move "N" to el-scxend2-tipo (indxend) else move "H" to el-scxend2-tipo (indxend) end-if else move codopec1 to el-scxend2-tipo (indxend) if codope1 = "DO" and fattore2 not = space move codopec1 to el-scxend2-tipo (indxend) end-if if indccond not = space then move "I" to el-scxend2-ind (indxend) end-if. ex-caricaxend. EXIT. prep-md. move WHFILE to replac perform pulisci thru ex-pulisci if env = "W" then move space to newmdsL String homeL, nomejcv delimited by space into newmdsL write mdsrcj-REC from wrkmdsrcL-REC move space to newmdsL String homeL, nomejcv, nomeambiente delimited by space into newmdsL write mdsrcj-REC from wrkmdsrcL-REC move space to newmdsL String homeL, nomejcv, nomeambiente, '\jsrc\' delimited by space into newmdsL write mdsrcj-REC from wrkmdsrcL-REC move space to newmds String homeD, nomejcv, nomeambiente, '\jsrc\', replac delimited by space into newmds write mdsrcj-REC from wrkmdsrcj-REC end-if if env = "L" then move space to newmdsL String homeL, nomejcv delimited by space into newmdsL inspect newmdsL replacing all "\" by "/" write mdsrcj-REC from wrkmdsrcL-REC move space to newmdsL String homeL, nomejcv, nomeambiente delimited by space into newmdsL inspect newmdsL replacing all "\" by "/" write mdsrcj-REC from wrkmdsrcL-REC move space to newmdsL String homeL, nomejcv, nomeambiente, '\jsrc\' delimited by space into newmdsL inspect newmdsL replacing all "\" by "/" write mdsrcj-REC from wrkmdsrcL-REC move space to newmdsL String homeL, nomejcv, nomeambiente, '\jsrc\', replac delimited by space into newmdsL inspect newmdsL replacing all "\" by "/" write mdsrcj-REC from wrkmdsrcL-REC end-if. ex-prep-md. exit. pulisci. inspect replac replacing all "$" by "S" inspect replac replacing all "#" by "L" inspect replac replacing all "œ" by "L". ex-pulisci. EXIT. danilo@danilo-ntbk:~/Xcvastoj/cvastoj_src$ cobc -x crtcab.cbl crtcab.cbl:24: Error: syntax error, unexpected ORGANIZATION, expecting WORD or LITERAL or DISPLAY danilo@danilo-ntbk:~/Xcvastoj/cvastoj_src$ Now I work with Ubuntu 8.10. but at some previous time I worked fine with OC1.1 on ubuntu 7.10 & 8.04. thanks danilo ---------------------------------------------------------------- Aside from a few weird things in the working storage (like line 454, with the 26 before the level 10 - which I just shuffled into the sequence field), this compiled fine here. So let's keep working this problem. I'd like it if we could work on getting the newest pre-release compiled. Did you check for [b]ncurses.h[/b] by any chance? I think that could help get round the build error. [i]for future reference[/i], it's nice for formatted code on forum posts to use [b]code[/b] tags. For example: [code] [code] identification division ... [/code] [/code] The square bracket code and square bracket slash code may not show up properly as the first one I'm trying to embed might terminate the sample. But I hope you get what I mean. Cheers, Brian ---------------------------------------------------------------- Hi, Brian Now all works well.thanks. I repeated again completly the installation procedure, starting from the download. On my PC there are not "ncurses-dev",but only "libncurses5-dev"(via Synaptic and apt-get install). And also ther is not "ncurses.h". Please, I don't understood what do you want tell with this sentence: "Aside from a few weird things in the working storage (like line 454, with the 26 before the level 10 - which I just shuffled into the sequence field), this compiled fine here. So let's keep working this problem." In my source there is not "the 26 before the level 10"; the only 26 the I find is at col 1 (Sequence number). Probaly,the past lost the spaces. this is the original source: [code] IDENTIFICATION DIVISION. PROGRAM-ID. crtcab. ************************************************************************* * * * sostituisce CAB e CASE con IF * * non sostituisce DO *HIVAL con DOUEQ * * sostituisce DO n-times con Z-ADD e DOUEQ * * * ************************************************************************* AUTHOR. rosso. DATE-WRITTEN. nov 1999. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. w95. OBJECT-COMPUTER. w95. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT ambiente ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-STAT-ambiente. SELECT listarpg ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-STAT-listarpg. SELECT listafmt ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-STAT-listafmt. SELECT srcrpg ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-STAT-srcrpg. SELECT srcrpgo ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-STAT-srcrpgo. SELECT mdsrcj ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-STAT-mdsrcj. SELECT xcall ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-STAT-xcall. DATA DIVISION. FILE SECTION. FD listarpg LABEL RECORD IS STANDARD VALUE OF FILE-ID IS "listarpg.txt" DATA RECORD IS listarpg-REC. 01 listarpg-REC. 10 WHFILE. 15 primicar. 17 filler pic x. 17 whfuno pic x. 15 restocar. 17 filler pic x(4). 17 whfSET pic x. 17 filler pic x(3). 15 filler pic x(40). FD listafmt LABEL RECORD IS STANDARD VALUE OF FILE-ID IS "listafmt.txt" DATA RECORD IS listafmt-REC. 01 listafmt-REC. 10 nomevideo pic x(10). 10 nomepgm pic x(10). 10 SFL pic x(10). 10 filler pic x(70). FD srcrpgo LABEL RECORD IS STANDARD VALUE OF FILE-ID IS nome-srcrpgo DATA RECORD IS srcrpgo-REC. 01 srcrpgo-REC. 05 filler pic x(100). FD srcrpg LABEL RECORD IS STANDARD VALUE OF FILE-ID IS nome-srcrpg DATA RECORD IS srcrpg-REC. 01 srcrpg-REC. 05 filler pic x(100). FD mdsrcj LABEL RECORD IS STANDARD VALUE OF FILE-ID IS nome-mdsrcj DATA RECORD IS mdsrcj-REC. 01 mdsrcj-REC. 05 filler pic x(100). FD ambiente LABEL RECORD IS STANDARD VALUE OF FILE-ID IS "ambiente.txt" DATA RECORD IS ambiente-REC. 01 ambiente-REC. 05 creads. 12 filler pic x(4). 12 nomeamb pic x(100). FD xcall LABEL RECORD IS STANDARD VALUE OF FILE-ID IS "xcall.txt" DATA RECORD IS mdsrcj-REC. 01 xcall-REC. 05 nompgm pic x(10). 05 nomecall pic x(10). 05 filler pic x(60). *----------------------------------------------------------------- * DEFINIZIONE AREA DI WORK *----------------------------------------------------------------- WORKING-STORAGE SECTION. 01 xxa pic x. 01 env pic x. 01 homeD pic x(100). 01 homeL pic x(100). 01 nomeambiente pic x(100). 01 nomedacv pic x(100). 01 nomejcv pic x(100). 01 xdebug pic x(100). 01 nvoc pic 9(3) value 0. 01 sav-wrkrpg-rec. 05 filler pic x(100). 01 xinp pic x. 01 swcas pic x value space. 01 numif pic S999 value 0. 01 savwrkrpg-REC. 05 filler pic x(100). 01 path-srcrpg pic x(50) value space. 01 nome-srcrpg pic x(50) value space. 01 P3-srcrpg PIC X(10) VALUE ' '. 01 path-srcrpgo pic x(50) value space. 01 nome-srcrpgo pic x(50) value space. 01 P3-srcrpgo PIC X(10) VALUE ' '. 01 nome-mdsrcj. 05 P3-amb PIC X(10) VALUE space. 01 WS-STAT-ambiente. 05 st1-ambiente pic X value ' '. 05 st2-ambiente pic 9 comp value 0. 01 WS-STAT-xcall. 05 st1-xcall pic X value ' '. 05 st2-xcall pic 9 comp value 0. 01 WS-STAT-mdsrcj. 05 st1 pic X value ' '. 05 st2 pic 9 comp value 0. 01 WS-STAT-listarpg. 05 st1 pic X value ' '. 05 st2 pic 9 comp value 0. 01 WS-STAT-listafmt. 05 st1 pic X value ' '. 05 st2 pic 9 comp value 0. 01 WS-STAT-srcrpg. 05 st1 pic X value ' '. 05 st2 pic 9 comp value 0. 01 WS-STAT-srcrpgo. 05 st1o pic X value ' '. 05 st2o pic 9 comp value 0. 01 swfine pic x value space. 01 savrisult pic x(6) value space. 01 savcodopec2 pic xx value space. 01 wrkmdsrcj-REC. 10 filler pic x(6) value 'md '. 10 newmds pic x(50) value ' '. 01 wrkmdsrcL-REC. 10 filler pic x(6) value 'mkdir '. 10 newmdsL pic x(50) value ' '. 01 wrkrpg-REC. 05 numrig pic x(5). 05 tipospec pic x. 05 specifica. 10 aster pic x. 10 filler pic x(65). 05 spec-F redefines specifica. 10 nomefile. 15 nomef6 pic x(6). 15 nomef2 pic x(2). 10 CUOI pic x. 10 FPS pic x. 10 EoF pic x. 10 AD pic x. 10 EF pic x. 10 lblk pic x(4). 10 lrek pic x(4). 10 LR pic x. 10 lkey pic xx. 10 IK pic x. 26 10 fo pic x. 10 OwF pic xx. 10 Kfs pic x(4). 10 exK pic x. 10 device pic x(7). 10 simbdev pic x(6). 10 contl pic x. 10 extlab pic x(6). 10 extent pic x(6). 10 AU pic x. 10 filler pic x(4). 66 10 fileuser pic xx. 05 spec-C redefines specifica. 10 MOLA pic xx. 10 indccond. 15 nc1 pic x. 15 indc pic xx. 15 nc2 pic x. 15 indc2 pic xx. 15 nc3 pic x. 15 indc3 pic xx. 10 fattore1. 15 fatt1 pic x(6). 15 filler pic x(4). 10 codope. 15 codope1 pic xx. 15 codope2 pic xx. 15 filler pic x. 10 codopec redefines codope. 15 codopec1 pic xxx. 15 codopec2 pic xx. 10 fattore2. 15 fatt2 pic x(6). 15 filler pic x(4). 10 result pic x(6). 10 fldl pic x(3). 10 ndec pic x. 10 halfadg pic x. 10 indr1 pic xx. 10 indr2 pic xx. 10 indr3 pic xx. 66 10 filler pic x(12). 05 comm pic x(8). 01 numdo pic 999 value 0. 01 MOLAs pic xx value space. 01 PARAMETRI-DI-WORK. 10 swfinerpg pic x(01) value zero. 10 scxend. 15 el-scxend occurs 200 times. 20 el-scxend-inv pic x(6). 10 scxend2. 15 el-scxend2 occurs 200 times. 20 el-scxend2-tipo. 25 el-scxend2-tipo1 pic x. 25 el-scxend2-tipo2 pic x. 25 el-scxend2-tipo3 pic x. 20 el-scxend2-ind pic x. 20 el-scxend2-spec pic x(4). 10 indxend pic S999 value 0. 10 tipo-scxend2 pic xxx. 10 replac. 15 el-replac pic x occurs 200 times. 10 replac-red redefines replac pic x(200). PROCEDURE DIVISION. *----------------------------------------------------------------- * MAIN LINE *----------------------------------------------------------------- MAIN-LINE. PERFORM INIZIO THRU FINE. perform eladsp thru ex-eladsp until swfine = '1'. END-PGM. PERFORM INIZIO-CLOSE THRU FINE-CLOSE. display "fine crtcab" if xdebug = "DEBUG " then accept xxa end-if. stop run. eladsp. read listarpg at end move '1' to swfine if listafmt-REC <> space then write listafmt-rec end-if go to ex-eladsp END-READ if primicar = "**" or " " then go to ex-eladsp end-if if listafmt-REC <> space then write listafmt-rec end-if move space to listafmt-rec perform open-rpg thru ex-open-rpg if WS-STAT-srcrpg = '00' then perform prep-md thru ex-prep-md move "0" to swfinerpg PERFORM INIZIO-ELAB THRU FINE-ELAB until swfinerpg = '1' end-if. ex-eladsp. exit. *----------------------------------------------------------------- * APERTURA ARCHIVI *----------------------------------------------------------------- INIZIO. move space to listafmt-rec open input ambiente move "BASE" to nomeambiente if WS-STAT-ambiente = "00" then read ambiente move nomeamb to env read ambiente move nomeamb to homeD read ambiente move nomeamb to homeL read ambiente move nomeamb to nomeambiente read ambiente move nomeamb to nomejcv read ambiente move nomeamb to nomedacv read ambiente move nomeamb to xdebug end-if close ambiente OPEN input listarpg. OPEN output listafmt xcall CLOSE listafmt OPEN extend listafmt if env = "W" then move "mdsrcj.bat" to nome-mdsrcj String homeD, nomedacv, nomeambiente, '\src\' delimited by space into path-srcrpg String homeD, nomedacv, nomeambiente, '\src\rpgo\' delimited by space into path-srcrpgo end-if if env = "L" then move "mdsrcj.sh" to nome-mdsrcj String homeL, nomedacv, nomeambiente, '\src\' delimited by space into path-srcrpg String homeL, nomedacv, nomeambiente, '\src\rpgo\' delimited by space into path-srcrpgo inspect path-srcrpg replacing all "\" by "/" inspect path-srcrpgo replacing all "\" by "/" end-if OPEN output mdsrcj Close mdsrcj. FINE. EXIT. *----------------------------------------------------------------- * CHIUSURA ARCHIVI *----------------------------------------------------------------- INIZIO-CLOSE. CLOSE srcrpg srcrpgo mdsrcj listarpg xcall listafmt. FINE-CLOSE. EXIT. *----------------------------------------------------------------- * ELABORAZIONE ARCHIVIO PER CREAZIONE COPY *----------------------------------------------------------------- INIZIO-ELAB. if WS-STAT-srcrpg = '00' then READ srcrpg NEXT into wrkrpg-rec AT END move "1" to swfinerpg move all'9' to wrkrpg-rec go to FINE-ELAB end-read else move all'9' to wrkrpg-rec go to FINE-ELAB end-if if aster = '*' or (tipospec not = "C" and tipospec not = "F") then write srcrpgo-rec from wrkrpg-rec move space to swcas move 0 to numif else if tipospec = "C" then perform fa-c thru ex-fa-c else if tipospec = "F" then perform fa-f thru ex-fa-f end-if write srcrpgo-rec from wrkrpg-rec move space to swcas move 0 to numif end-if end-if. FINE-ELAB. EXIT. fa-C. if codope = "CALL " then move space to xcall-REC move nomepgm to nompgm move fattore2 to nomecall write xcall-REC end-if if codope= "ENDCS" then move space to codope move "END " to codope end-if if (codope1 = "DO" or codope1 = "IF" or codopec1 = "CAS") then perform caricaxend thru ex-caricaxend end-if if (codopec1 not = "CAB" and codope1 not = "DO" and codopec1 not = "CAS"and codopec1 not = "END" and codope1 not = "IF") then if codope = 'COMP' then perform fa-comp thru ex-facomp else write srcrpgo-rec from wrkrpg-rec move space to swcas move 0 to numif end-if else if codope1 = "DO" or codopec1 = "CAB" or codopec1 = "CAS" or codopec1 = "END" and codope not = "ENDSR" then move mola to molas perform specC thru ex-specC else write srcrpgo-rec from wrkrpg-rec move space to swcas move 0 to numif end-if end-if. ex-fa-c. EXIT. fa-f. if tipospec = "F" and device = "WORKSTN" then move nomefile to replac move replac to nomevideo move WHFILE to replac perform pulisci thru ex-pulisci move replac to nomepgm ************** write listafmt-rec end-if. inspect srcrpg-REC tallying nvoc for ALL "KSFILE" if nvoc > 0 then move "SFL" to SFL move 0 to nvoc end-if. ex-fa-f. EXIT. specC. if codope1 = "DO" then add 1 to numdo end-if if (codope = "DO " and fattore2 = "*HIVAL ") then perform doH thru ex-doH else if codope = "DO " and fattore2 not = space then move "*" to aster write srcrpgo-rec from wrkrpg-rec move " " to aster move molas to mola perform doN thru ex-doN else if codopec1 = "CAB" then move "*" to aster write srcrpgo-rec from wrkrpg-rec move " " to aster move molas to mola perform cab thru ex-cab else if codopec1 = "CAS" then move "*" to aster write srcrpgo-rec from wrkrpg-rec move " " to aster move molas to mola perform cas thru ex-cas else if codopec1 = "END" then perform faend thru ex-faend else write srcrpgo-rec from wrkrpg-rec end-if end-if end-if end-if end-if. ex-specC. EXIT. doH. write srcrpgo-rec from wrkrpg-rec. ex-doH. EXIT. doN. move result to el-scxend-inv (numdo) move wrkrpg-rec to savwrkrpg-rec move "Z-ADD" to codope if fattore1 not = space then move fattore1 to fattore2 else move '1' to fattore2 end-if move space to fattore1 write srcrpgo-rec from wrkrpg-rec move savwrkrpg-rec to wrkrpg-rec move "DOULE" to codope move result to fattore1 move space to result move space to ndec move space to fldl write srcrpgo-rec from wrkrpg-rec move savwrkrpg-rec to wrkrpg-rec. ex-doN. EXIT. cab. if codopec2 = space then move "GOTO" to codope move result to fatt2 move space to result write srcrpgo-rec from wrkrpg-rec else move result to savrisult move codopec2 to savcodopec2 move space to result move space to codope move "IF" to codope1 move savcodopec2 to codope2 write srcrpgo-rec from wrkrpg-rec move space to wrkrpg-rec move "C" to tipospec move "GOTO" to codope move savrisult to fatt2 write srcrpgo-rec from wrkrpg-rec move space to wrkrpg-rec move "C" to tipospec move "END" to codope write srcrpgo-rec from wrkrpg-rec end-if. ex-cab. EXIT. cas. if swcas = "1" then move wrkrpg-rec to savwrkrpg-rec move space to wrkrpg-rec move "C" to tipospec move "ELSE" to codope write srcrpgo-rec from wrkrpg-rec move savwrkrpg-rec to wrkrpg-rec end-if move "1" to swcas if codopec2 = space then move "EXSR" to codope move result to fatt2 move space to result write srcrpgo-rec from wrkrpg-rec else add 1 to numif move result to savrisult move codopec2 to savcodopec2 move space to result move space to codope move "IF" to codope1 move savcodopec2 to codope2 write srcrpgo-rec from wrkrpg-rec move space to wrkrpg-rec move "C" to tipospec move "EXSR" to codope move savrisult to fatt2 write srcrpgo-rec from wrkrpg-rec end-if. ex-cas. EXIT. faend. move wrkrpg-rec to sav-wrkrpg-rec if swcas = "1" then perform finecas thru ex-finecas else move el-scxend2-tipo (indxend) to tipo-scxend2 move space to el-scxend2 (indxend) compute indxend = indxend - 1 if tipo-scxend2 = "N" if fattore2 = space then move "1" to fattore2 end-if move "ADD " to codope move el-scxend-inv (numdo) to result write srcrpgo-rec from wrkrpg-rec move space to el-scxend-inv (numdo) subtract 1 from numdo else if tipo-scxend2 = "D" move space to spec-C move "END " to codope write srcrpgo-rec from wrkrpg-rec end-if end-if. write srcrpgo-rec from sav-wrkrpg-rec. ex-faend. EXIT. finecas. move space to swcas compute numif= numif - 1 if numif > 0 then perform varying numif from numif by -1 until numif = 0 move space to wrkrpg-rec move "C" to tipospec move "END" to codope write srcrpgo-rec from wrkrpg-rec end-perform end-if move space to swcas. ex-finecas. EXIT. fa-comp. move wrkrpg-rec to savwrkrpg-rec move mola to molas move '*' to aster write srcrpgo-rec from wrkrpg-rec *************************** move space to codope indr1 indr2 indr3 fattore1 fattore2 move molas to mola move "DO " to codope write srcrpgo-rec from wrkrpg-rec *************************** move savwrkrpg-rec to wrkrpg-rec move space to codope indccond mola fattore1 fattore2 move "SETOF" to codope write srcrpgo-rec from wrkrpg-rec *************************** move savwrkrpg-rec to wrkrpg-rec if indr1 not = space move space to codope indccond mola indr1 indr2 indr3 move 'IFGT ' to codope write srcrpgo-rec from wrkrpg-rec *************************** move savwrkrpg-rec to wrkrpg-rec move space to codope indccond mola fattore1 fattore2 indr2 indr3 move "SETON" to codope write srcrpgo-rec from wrkrpg-rec **************************** move space to wrkrpg-rec move "C" to tipospec move "END" to codope write srcrpgo-rec from wrkrpg-rec end-if ********************************************* move savwrkrpg-rec to wrkrpg-rec if indr2 not = space move space to codope indccond mola indr1 indr2 indr3 move 'IFLT ' to codope write srcrpgo-rec from wrkrpg-rec *************************** move savwrkrpg-rec to wrkrpg-rec move space to codope indccond mola fattore1 fattore2 indr1 indr3 move "SETON" to codope write srcrpgo-rec from wrkrpg-rec **************************** move space to wrkrpg-rec move "C" to tipospec move "END" to codope write srcrpgo-rec from wrkrpg-rec end-if ************************************* move savwrkrpg-rec to wrkrpg-rec if indr3 not = space move space to codope indccond mola indr1 indr2 indr3 move 'IFEQ ' to codope write srcrpgo-rec from wrkrpg-rec *************************** move savwrkrpg-rec to wrkrpg-rec move space to codope indccond mola fattore1 fattore2 indr1 indr2 move "SETON" to codope write srcrpgo-rec from wrkrpg-rec **************************** move space to wrkrpg-rec move "C" to tipospec move "END" to codope write srcrpgo-rec from wrkrpg-rec end-if ******************************************** move space to wrkrpg-rec move "C" to tipospec move "END " to codope write srcrpgo-rec from wrkrpg-rec. ex-facomp. EXIT. open-rpg. CLOSE srcrpg srcrpgo mdsrcj move "00" to WS-STAT-srcrpg move "00" to WS-STAT-srcrpgo move "00" to WS-STAT-mdsrcj move space to nome-srcrpg move space to nome-srcrpgo String path-srcrpg, WHFILE delimited by space into nome-srcrpg String path-srcrpgo, WHFILE delimited by space into nome-srcrpgo move space to P3-srcrpg move space to P3-srcrpgo move WHFILE to P3-srcrpg move WHFILE to P3-srcrpgo OPEN output srcrpgo. OPEN input srcrpg. OPEN extend mdsrcj. ex-open-rpg. exit. caricaxend. add 1 to indxend if codope = "DO " and fattore2 not = space then if fattore2 not = "*HIVAL " then move "N" to el-scxend2-tipo (indxend) else move "H" to el-scxend2-tipo (indxend) end-if else move codopec1 to el-scxend2-tipo (indxend) if codope1 = "DO" and fattore2 not = space move codopec1 to el-scxend2-tipo (indxend) end-if if indccond not = space then move "I" to el-scxend2-ind (indxend) end-if. ex-caricaxend. EXIT. prep-md. move WHFILE to replac perform pulisci thru ex-pulisci if env = "W" then move space to newmdsL String homeL, nomejcv delimited by space into newmdsL write mdsrcj-REC from wrkmdsrcL-REC move space to newmdsL String homeL, nomejcv, nomeambiente delimited by space into newmdsL write mdsrcj-REC from wrkmdsrcL-REC move space to newmdsL String homeL, nomejcv, nomeambiente, '\jsrc\' delimited by space into newmdsL write mdsrcj-REC from wrkmdsrcL-REC move space to newmds String homeD, nomejcv, nomeambiente, '\jsrc\', replac delimited by space into newmds write mdsrcj-REC from wrkmdsrcj-REC end-if if env = "L" then move space to newmdsL String homeL, nomejcv delimited by space into newmdsL inspect newmdsL replacing all "\" by "/" write mdsrcj-REC from wrkmdsrcL-REC move space to newmdsL String homeL, nomejcv, nomeambiente delimited by space into newmdsL inspect newmdsL replacing all "\" by "/" write mdsrcj-REC from wrkmdsrcL-REC move space to newmdsL String homeL, nomejcv, nomeambiente, '\jsrc\' delimited by space into newmdsL inspect newmdsL replacing all "\" by "/" write mdsrcj-REC from wrkmdsrcL-REC move space to newmdsL String homeL, nomejcv, nomeambiente, '\jsrc\', replac delimited by space into newmdsL inspect newmdsL replacing all "\" by "/" write mdsrcj-REC from wrkmdsrcL-REC end-if. ex-prep-md. exit. pulisci. inspect replac replacing all "$" by "S" inspect replac replacing all "#" by "L" inspect replac replacing all "Å“" by "L". ex-pulisci. EXIT. [/code] Danilo ---------------------------------------------------------------- Good to hear on the (Solved). Nice. So a clean build dir allowed things to run smooth, or did you have to re-tweak your installed packages along with a fresh untar? Regarding the 26, yeah, it was just the forum post lost the leading spaces due to lack of [b]code[/b] tags. That was all I meant by that. I assumed there were sequence numbers, and it compiled fine here. Cheers Danilo, Brian ---------------------------------------------------------------- Subject: Getting "Invalid type cast from 'Internal error node'" for not defined files. I found this one at cobol-it's and this is the same for OpenCOBOL. [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. 'TESTPGMA'. *AUTHOR. FIMATOR AB. FIM WÄSTBERG / human. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT STOPP-FIL ASSIGN TO "MY.DAT" ORGANIZATION IS LINE SEQUENTIAL. DATA DIVISION. FILE SECTION. FD STOPP-FIL. 01 STOPP-FIL-POST. 10 FILLER PIC X. * WORKING-STORAGE SECTION. *----------------------------------------------------------------- LINKAGE SECTION. *----------------------------------------------------------------- PROCEDURE DIVISION. declaratives. USE AFTER ERROR PROCEDURE ON TAB-FIL STOPP-FIL. end declaratives. *----------------------------------------------------------------- main section. 00. stop run * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program TESTPGMA -------------------------------------[/code] leads to [quote]$ cobc -Wall -debug TESTPGMA.CBL TESTPGMA.CBL:26: Error: 'TAB-FIL' undefined TESTPGMA.CBL:26: Error: 'TAB-FIL' is not a file name parser.y:6428: Invalid type cast from 'Internal error node' Tag 1 0 Tag 2 11 Aborting compile of TESTPGMA.CBL at line 26[/quote] ---------------------------------------------------------------- Yes, it is a compiler problem and yes it is the same between OC and COBOL-IT. That compiler is still pretty much just a snag clone of OpenCOBOL, by and large, especially the [b]parser.y[/b]. I apologize in advance for diluting this thread human. It's a trigger effect, sorry. [i]One thing I noticed, their 1.2.10 release has a bunch of my early alpha work-in-progress efforts in the sources. Even though I want to give it away to the world as a friendly gesture, it still stings seeing a company out to make money using work that was supposed to be open and free for the little guy. And this is unannounced nowhere near ready for prime time changes released out by Roger so I could work somewhat in tandem with the actual OpenCOBOL pre-releases.[/i] I think I now have a small inkling of how Roger may feel about this whole sneaky-fork thing. So when Roger fixes this bug in OpenCOBOL, I'll imagine -IT will be fixed a day or two later. What would be nice is if they fixed it, being the "COBOL experts and compiler development specialists", and passed the fix back to us volunteer stiffs. When they read this, perhaps it'll prompt them to do such, but without the prompting, I'd doubt it. [i]And just so ya know, if anyone noticed ... I deleted the text of a rant post I made about this a while back and simply changed it to something about not wanting to say bad things about things[/i] Even though it stings a little, it is not my intent to sow foul feelings between OC and -IT. The outcome of open flames sounds bad, tastes bad, and just won't really help anything. All it would accomplish is tarnishing the reputations of both parties and perhaps FOSS in general. I'm nervous about posting this little rant even ... I might let second thought win again, and delete most of it later tonight. So, as Jerry Garcia sang in the song "He's Gone": [code]like I told you, what I said. Steal your face right off of your head ... cat on a tin roof, dogs in a pile. Nothing left to do but smile, smile, smile[/code] :-) Cheers, Brian ---------------------------------------------------------------- Because of the root from COBOL IT beeing in OpenCobol, I have a look at their forum and website from time to time. If somebody founds a compiler problem and reports to them, we should know about it and try it too. I hope the COBOL IT stuff gives a bit back in fixing things like that. Let's see. ---------------------------------------------------------------- Subject: terminating the accept statement Does anyone know how to get a single character from the keyboard (with no other terminating keys) in OC 1.1? 01 READ-AREA PIC X. ACCEPT READ-AREA. Some environments will terminate the ACCEPT after a single key is depressed. May have to go to C for this one. jimc ---------------------------------------------------------------- Yeah, maybe a small C func is the way to go. You can't even trick CBL_READ_FILE with a file-handle of 0, as the internal [b]lseek[/b] will fail and return-code comes back as -1. $ stty raw just causes weird and wonderful grief (at least here). A READ from KEYBOARD with various options on the SELECT doesn't cut it either ... it always ends up being buffered and needing a terminator. There may be some magic combination, but ACCEPT calls a protected form of [b]fgets[/b], so you'll be very limited in getting round the stdin low level buffered io mechanics. If you want a hand, we can work on something all nicey nice for a CBL_OC_GETKEY [i]but seeing previous posts, I can only guess you already know what needs to be done[/i]. ;) Cheers, Brian ---------------------------------------------------------------- If somebody codes things like that, why don't take it into the OC-Source. CBL_OC_GETKEY sounds nice. By the way: How do I just wait for a keyboard termination (waiting for a person to read a message)? ACCEPT OMITTED does not work. human ---------------------------------------------------------------- Thanks to Jose Rosado the following seems to be doing the trick: [code] 01 WS-HOLD. 05 WS-FILLER PIC X. 05 WS-READ-AREA PIC X. 01 WS-NUM-VALUE REDEFINES WS-HOLD PIC S9(4) COMP. PROCEDURE DIVISION. MOVE X"00" TO WS-FILLER. 0100-LOOP. CALL "acceptchar" USING WS-READ-AREA. DISPLAY "NUM-VALUE=\", WS-NUM-VALUE. IF WS-READ-AREA IS EQUAL TO "|" STOP RUN. GO TO 0100-LOOP. *****************************the c routine is below***************************** #include // for getchar() #include // for system() /******************************************************************************* * acceptchar() * * Gets the next character input from stdin and places it in passed variable. * * * * Parameters * * char * cpReturn - A pointer to the variable to place the next inputted key.* * Regardless of definition of the passed variable, the key value is placed * * in the left most position. * * * * Returns * * int - 0 for success, else failure. * *******************************************************************************/ int acceptchar( char * cpReturn ) { char cInput; system( "stty raw" ); // Set stdin to unbuffered mode // Get next character from standard input cInput = getchar(); system( "stty -raw" ); // Set stdin back to buffered mode // Assign inputted character to return variable cpReturn[ 0 ] = cInput; return 0; } // main() [/code] jimc ---------------------------------------------------------------- Jim, Here's one that'll be a littler nicer on performance. ;-) [b]CBL_OC_GETKEY.c[/b] [code] /********************************************************************** ****f* CBL_OC/CBL_OC_GETKEY * FUNCTION * get a key without terminator * INPUTS * PIC X * PIC S9(8) * OUTPUT * The keycode and/or error status and errno * SOURCE */ #include #include #include #include #define STDIN_HANDLE (0) int CBL_OC_GETKEY(char *thekey, int *errvalue) { struct termio term, saveterm; int cc = 0; char ch = ' '; /* Get current tty setting */ cc = ioctl(STDIN_HANDLE, TCGETA, &term); /* on error, set the ever friendly global errno */ if (cc < 0) { *errvalue = errno; return cc; } /* Save current terminal settings */ saveterm = term; /* Turn off echo, canonical input and break key handling */ term.c_lflag &= ~(ICANON | ECHO | ISIG); /* Set for 1 character input */ term.c_cc[VMIN] = 1; term.c_cc[VTIME] = 0; /* set the new tty values */ cc = ioctl(STDIN_HANDLE, TCSETA, &term); /* ignore return values, as we want to get to the terminal reset */ (void) fflush(stdout); (void) read(STDIN_HANDLE, (void *)thekey, sizeof(char)); /* reset the original tty values */ cc = ioctl(STDIN_HANDLE, TCSETA, &saveterm); /* set or clear errno and return the status */ *errvalue = (cc == 0) ? 0 : errno; return cc; } /******/ [/code] [b]getkey.cob[/b] [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20090428 *> Purpose: Demonstrate CBL_OC_GETKEY *> Tectonics: cobc -c CBL_OC_GETKEY.c *> cobc -x getkey.cob CBL_OC_GETKEY.o *> *************************************************************** identification division. program-id. getkey. data division. working-storage section. 01 thekey pic x. 01 result usage binary-long. 01 errno usage binary-long. *> *************************************************************** procedure division. display "fetch keys until 'q'" end-display move x"00" to thekey move 0 to errno perform until (thekey equal 'q') or (errno not equal 0) call "CBL_OC_GETKEY" using thekey errno returning result end-call display "ORD = " function ord(thekey) end-display if result = -1 display "errno = " errno end-display end-if end-perform goback. end program getkey. [/code] and if you want, you can run the C code through ROBODoc ;) [code] $ robodoc --src CBL_OC_GETKEY.c --doc getkey --singlefile --html \ --cmode --documenttitle 'CBL_OC_GETKEY' [/code] Cheers, Brian ---------------------------------------------------------------- Are things like that likely to get into the OpenCobol runtime? Has anybody an idea how to wait ONLY for a terminator without a var behind (if possible with an ACCEPT statement)? ---------------------------------------------------------------- Brian, Thank you. By the way, can you help this Texan understand more about "Well Met"? My dictionary leaves your meaning unclear. jimc ---------------------------------------------------------------- Awww, do I have to? ;) Well met is an old english expression. Hail good fellow, well met. But truth be told, I picked it up when I played and Dungeon Mastered a Forgotten Realms campaign ... Dungeons and Dragons. Ed Greenwood was fond of the expression in his writing. [i]But Dungeon and Dragons lost out to Warhammer. I play nuttin' but Warhammer now.[/i] [b]D&D is for nerdy geeks that like Star Trek[/b] :-) winky winky. Cheers, Brian P.S. I'm going to update CBL_OC_GETKEY. There is no real need for the errno param. It can be returned, either as the RETURNING or implicitly in RETURN-CODE, so I'll simplify that code once the little one is tucked in later this evening. ---------------------------------------------------------------- New version. Anyone that knows about termio, and ioctl; this routine doesn't seem to respond to Ctrl-@, NULL is not returning. Anyone up for reading through all the termio flags? ;) Jim, if you need to react to 0 valued input, this is not yet quite right. And just so everyone knows. COBOL is one-based. FUNCTION ORD returns 2 for Ctrl-A, not 1 as might be expected (for ASCII, that is). Cheers, Brian [b]CBL_OC_GETKEY.c[/b] [code] /******************************************************** ****f* CBL_OC/CBL_OC_GETKEY * FUNCTION * get a key without terminator * INPUTS * PIC X, passed by reference * OUTPUT * The keycode and 0 or error status (errno) and no key * SOURCE */ #include #include #include #include #define STDIN_HANDLE (0) int CBL_OC_GETKEY(char *thekey) { struct termio term, saveterm; int cc = 0; char ch = ' '; /* Get current tty setting */ cc = ioctl(STDIN_HANDLE, TCGETA, &term); /* on error, set the ever friendly global errno */ if (cc < 0) { return (int)errno; } /* Save current terminal settings */ saveterm = term; /* Turn off echo, canonical input and break key handling */ term.c_lflag &= ~(ICANON | ECHO | ISIG); /* Set for 1 character input */ term.c_cc[VMIN] = 1; term.c_cc[VTIME] = 0; /* set the new tty values */ cc = ioctl(STDIN_HANDLE, TCSETA, &term); /* ignore return values, as we want to get to the terminal reset */ (void) fflush(stdout); (void) read(STDIN_HANDLE, (void *)thekey, sizeof(char)); /* reset the original tty values */ cc = ioctl(STDIN_HANDLE, TCSETA, &saveterm); /* set or clear errno and return the status */ return (cc == 0) ? (int)0 : (int)errno; } /******/ [/code] [b]getkey.cob[/b] [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20090428 *> Purpose: Demonstrate CBL_OC_GETKEY *> Tectonics: cobc -c CBL_OC_GETKEY.c *> cobc -x getkey.cob CBL_OC_GETKEY.o *> *************************************************************** identification division. program-id. getkey. data division. working-storage section. 01 thekey pic x value x'00'. 01 result usage binary-long value 0. *> *************************************************************** procedure division. display "fetch keys until 'q'" end-display perform until (thekey equal 'q') or (result not equal 0) call "CBL_OC_GETKEY" using thekey returning result end-call if result equal 0 display "ORD = " function ord(thekey) end-display else display "errno = " result end-display end-if end-perform goback. end program getkey. [/code] Cheers, Brian ---------------------------------------------------------------- human; On it getting into the tarball someday. That's why I named it CBL_OC_GETKEY :) CBL_OC_ being the prefix we've chosen for those routines that may be worthy of addition to the stock callables. But on the choice of name, GETKEY is pretty generic, perhaps if or when the time comes it'll be CBL_OC_GETCHNOTERM or some such. On the next bit: Not sure what is meant by the ONLY terminator? If you mean just newline, then a similar piece of code to this one could be used that just spun until it got a return, but that could get pretty hard on the CPU unless some work with the read timers was implemented. Otherwise, the concept of terminator might be application specific. Cursor motion, function keys etc. In that case you'd need a table of keycodes, and some are multi-byte sequences, with weird waits for ESC getting in the way sometimes. But if you feel a need for such, we can muck about I think. It could be a neat exercise, digging into the newer termios specification, versus the older ioctl spec used in this example. Or...perhaps ncurses supports such an operation? I took a quick peek at the filter() function, but it didn't match initial expectations. :( Cheers, Brian ---------------------------------------------------------------- Thank you for your information. Meanwhile I had a look at some docs from ACU, at least there[code]ACCEPT OMITTED[/code] works fine. Why not implementing it into OC instead of building a huge OC_CBL_...? ---------------------------------------------------------------- I'd actually ditto that sentiment. ACCEPT OMITTED would not be a hard thing to implement [i]in the parser at least[/i]. But as Roger once pointed out, it puts OpenCOBOL on a slippery slope that could lead to a long game of chase the tail. Although this seems like a reasonable change and a pretty common idiom. OTOH 01 WAITER PIC X. ACCEPT WAITER END-ACCEPT doesn't seem overly burdensome. Tricky. [i]An aside[/i] While putzing around with alternatives, I tried ACCEPT RETURN-CODE END-ACCEPT. :) It seems to trigger a screen section with no echo. Cool ... in that weird, what the... kinda way. Cheers, Brian ---------------------------------------------------------------- Subject: centos 5.3 install/compile error as far as I can see (forum posts) there are no solution for install error and/or compile error when in CentOS. It either asks for the gbm/dbd/lib(something)..4.7 or lots of dependencies. :( is there a very simple way to install Open-Cobol without so much torture? note: I followed the install instructions in wiki http://www.opencobol.org/modules/bwiki/index.php?InstallGuide but CentOS doesnot have those libs/dependencies ready, so I installed the fedora 10 *rpm ones. No solution, it didnot compile/install :( resume: desired clean, reasonable, easy to follow, complete instructions to install Open-Cobol in CentOS 5.3 TIA ---------------------------------------------------------------- Instead of leaving this unanswered... Sadly, no experience with CentOS. But ... come someday in the not too distant future, this old P4 dev box will be upgraded. Then the fun fun fun of Virtual Box will be worthwhile and manageable. It'll mean being able (I assume CentOS is a friendly VBox guest OS) to play around with various setups and how they all vary in getting OpenCOBOL built and packaged and rebuilt. But ... I hope someone else will step up with a better answer, as mine involves far flung timelines and wishy-washy commitments. Cheers, Brian ---------------------------------------------------------------- I haven't visited for a while. Centos does have the required packages although they may not have been installed by default. First remove the Fedora rpms using rpm -e You may have to use --nodeps if the removal complains about dependencies. Then check what packages you need: # rpm -q gmp gmp-devel db4 db4-devel ncurses ncurses-devel libtool gcc [ the *-devel rpms hold header files and other resources needed for compiling against a package whereas the non -devel rpms just contain what is needed to run programs that use a package ] Assuming the Centos box has access to the internet run yum to install the missing packages and any dependencies they have eg: # yum install gmp-devel libtool db4 db4-devel Following this you should be able to successfully compile. I have just done so: greg@tui:/home/greg/src/open-cobol-1.1 p/5] cat /etc/redhat-release CentOS release 5.3 (Final) greg@tui:/home/greg/src/open-cobol-1.1 p/5] cobc -V cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built May 13 2009 10:02:03 Packaged Feb 06 2009 10:30:55 CET One last addition if you install to the default location /usr/local (if only you use the machine then add --prefix=/usr to the ./configure command to install in the system directories and this step is not needed): If you get errors like: ./hello: error while loading shared libraries: libcob.so.1: cannot open shared object file: No such file or directory then you need to add /usr/local/lib to the shared library config (as root): # cd /etc/ld.so.conf.d # echo /usr/local/lib >open-cobol.conf # ldconfig Cheers ---------------------------------------------------------------- Subject: Happy chest puffing. Well, the other night I did a print preview of the OC FAQ. Just hit the 200 page mark. http://opencobol.add1tocobol.com/ It's a motivational number. Now I want to accelerate it towards the 300 page mark. ;) Excuse the interruption. It's a personal thing, but I had to share my giddy. Cheers, Brian ---------------------------------------------------------------- Yay! Keep on doing the docs, good work. BTW: There are no recent changes to the CHANGELOG, but to the Version date. Seems a little bit weird. ---------------------------------------------------------------- Your service has been invaluable to us. Later this morning I plan to introduce a programming team to our new OC environment and switch a project from PHP to OC. Live long and prosper. jimc ---------------------------------------------------------------- Thanks Jim. And ... we should have a opencobol_php.so sooner rather than later. I might be letting the cat out of the bag early, but word is we'll have cob_perl.so real soon, and the the php.so as soon as a few more features are added. From what I understand, this is all going to work with apache and the apache php mod. But ... it's not my work, so I might be stealing thunder plus announcing things too early. So please take this with a grain of, just in case. Cheers, Brian ---------------------------------------------------------------- Yeah thanks human. And I neglected this in my chest puffing... Thanks to human, Vincent, Bill, John and a plethora of others that I've snagged snippets and code from for the FAQ. Thanks to Roger and Keisuke for the compiler. Thanks to aoithoir for hosting space. Cheers, Brian P.S. on the changelog. I try and keep up to date with that but do get to the odd quick update and post it without thinking. April 19 was the last revision, and I'm pretty sure I made entries both to the revision and the log. Keep up the keen eye human, it helps. :) ---------------------------------------------------------------- Brian, Definitely time to start getting others in and digging around. I start training people on the 2nd of June. I have been debating whether I should do a couple of things...first whether I should teach them Cobol first or MySQL. Second whether I should NOW start to move my projects from Php to Cobol. Especially the generator, since it is in the beginning phases. Well Jim's statements kind of solidify. Erstazi might have some comments about what php can do that OpenCobol cannot. But then as far as I am concerned we can call those bits directly to php or from Cobol to php when needed. Along those lines I REALLY want to find out more about what Jim's team is doing. If we can get OpenCobol CGI, MySQL, Cookies and several other things going, I see no reason why not to just start outputting everything in OpenCobol now. I would also like to get the Add1toCMS going finally, but that will be output from the generator. Comments? ---------------------------------------------------------------- Subject: Sample of profiling OpenCOBOL applications Hello everyone. A little blurb on profiling OpenCOBOL and using gprof. As easy as a flag. The Tectonics entry in the spin.cob sources should show how this all works. GCC has a -pg option. This sets up the object file for inline profiling. Note that you want both the compile and link phases to include the option to get proper statistical collection. The -v cobc option displays what goes on with the background compile pass (so you can see that the -pg is being exported through COB_CFLAGS properly). When running ./spin a [b]gmon.out[/b] file will be created in the working directory. And as this sample is just a dumb loop, the hardcoded 99 million on the limiter should be tweaked for your machine if you try this. You don't really, really need the renice to -20, but when profiling it can help keep the other processes from interfering with the numbers. [i]Aside: Something that surprised me. A 99 million pass over binary-long took longer then pic s9(8). Hmm; might need to look at the C code and Assebmly to see if it's the call or the compare in the PERFORM. Still lots to learn about details.[/i] ;) Umm, [b]don't forget to $ export -n[/b] on the two environment variables before shipping anything out of the lab. Giving customers debug versions and getting a call that the app created some strange gmon.out could be embarrassing. Cheer, Brian [b]spin.cob[/b] [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20090502 *> Purpose: Experiments with profiling and gprof *> Tectonics: export COB_CFLAGS='-pg' COB_LDFLAGS='-pg' *> cobc -v -g -x spin.cob *> sudo renice -20 -u brian *> ./spin *> sudo renice 0 -u brian *> gprof -b -p spin *> *************************************************************** identification division. program-id. spin. data division. working-storage section. 01 limiter constant as 99000000. 01 accumulator pic s9(8). 01 bin-accumulator usage binary-long. 01 comp-accumulator pic s9(8) usage computational-5. 01 float-accumulator usage float-long. *> *************************************************************** procedure division. move 0 to accumulator perform until accumulator greater than or equal to limiter call "accumulate" using accumulator end-call end-perform move 0 to bin-accumulator perform until bin-accumulator greater than or equal to limiter call "bin_accumulate" using bin-accumulator end-call end-perform move 0 to comp-accumulator perform until comp-accumulator greater than or equal to limiter call "comp_accumulate" using comp-accumulator end-call end-perform move 0 to float-accumulator perform until float-accumulator greater than or equal to limiter call "float_accumulate" using float-accumulator end-call end-perform goback. end program spin. *> *************************************************************** *> *************************************************************** identification division. program-id. accumulate. data division. linkage section. 01 local-value pic s9(8). *> *************************************************************** procedure division using local-value. add 1 to local-value. goback. end program accumulate. *> *************************************************************** *> *************************************************************** identification division. program-id. bin_accumulate. data division. linkage section. 01 local-value usage binary-long. *> *************************************************************** procedure division using local-value. add 1 to local-value. goback. end program bin_accumulate. *> *************************************************************** *> *************************************************************** identification division. program-id. comp_accumulate. data division. linkage section. 01 local-value pic s9(8) usage computational-5. *> *************************************************************** procedure division using local-value. add 1 to local-value. goback. end program comp_accumulate. *> *************************************************************** *> *************************************************************** identification division. program-id. float_accumulate. data division. linkage section. 01 local-value usage float-long. *> *************************************************************** procedure division using local-value. add 1 to local-value. goback. end program float_accumulate. *> *************************************************************** [/code] [b]sample output from $ gprof -b -p[/b] [code] Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls s/call s/call name 34.11 6.43 6.43 1 6.43 18.85 spin_ 16.87 9.61 3.18 99000000 0.00 0.00 bin_accumulate_ 15.65 12.56 2.95 99000000 0.00 0.00 comp_accumulate_ 13.02 15.02 2.46 99000000 0.00 0.00 float_accumulate_ 10.72 17.04 2.02 99000000 0.00 0.00 accumulate_ 2.71 17.55 0.51 99000000 0.00 0.00 bin_accumulate 2.44 18.00 0.46 99000000 0.00 0.00 accumulate 2.39 18.45 0.45 99000000 0.00 0.00 comp_accumulate 2.10 18.85 0.40 99000000 0.00 0.00 float_accumulate 0.00 18.85 0.00 1 0.00 18.85 spin [/code] ---------------------------------------------------------------- Thank you for this information. You showed how to profile the call of different programs. Is it possible to profile the time stayed in different sections/paragraphs with OC/gprof, too? This information would be even more useful. ---------------------------------------------------------------- Well, kinda, but no, not really. gprof has a -l option. It'll display the internal profiles by line. That would require matching C output lines with the COBOL sources. (Which, while a manual operation, is not that hard at all, as -fsource-location displays the COBOL source lines in the generated C file) I'd post a sample of the spin gmon.out with -l, but I'm pretty sure it wouldn't match anyone else's. (I'm still digging about trying to get a version of gen'ed C code to work with the GDB source line debugger, so the C code my particular compiler is generating is riddled with #line preprocessor directives and they influence the profiler by line output). Cheers, Brian ---------------------------------------------------------------- I just have seen that Cobol-*T has an option for profiling (section/paragraphs/trace points) in the generated module itself. I'll try to find the necessary code changes and merge them into OC somewhere in the next N months ("Error: N not defined :-)") human ---------------------------------------------------------------- Subject: Missing/wrong line numbers in -Wconstant [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. 'TESTPGMB'. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. WORKING-STORAGE SECTION. 78 teststring1 value '123'. 77 teststring2 pic x(03) value '123'. * * * * * * * * * * 77 testtarget pic x(02). *----------------------------------------------------------------- LINKAGE SECTION. *----------------------------------------------------------------- PROCEDURE DIVISION. declaratives. end declaratives. *----------------------------------------------------------------- main section. 00. * * * * * * * move teststring1 to testtarget move teststring2 to testtarget * stop run * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program TESTPGMB -------------------------------------[/code][quote]$ cobc -fsyntax-only -Wconstant TESTPGMB.COB TESTPGMB.COB: In paragraph '00': TESTPGMB.COB:12: Warning: Value size exceeds data size TESTPGMB.COB:24: Warning: 'testtarget' defined here as PIC X(02)[/quote] The line number where the warning occurred (line 41) is wrong, the line where we defined the constant (line 12) is missing. See -Wtruncate instead, here it is shown. [quote]$ cobc -fsyntax-only -Wtruncate TESTPGMB.COB TESTPGMB.COB: In paragraph '00': TESTPGMB.COB:42: Warning: Sending field larger than receiving field TESTPGMB.COB:13: Warning: 'teststring2' defined here as PIC X(03) TESTPGMB.COB:24: Warning: 'testtarget' defined here as PIC X(02)[/quote] Can the warning line number / line where the constant was defined be added to -Wconstant, too? I've used the pre release from Feb 06 2009 10:30:55 CET. human ---------------------------------------------------------------- Subject: Another side trip down embedder lane; S-Lang Hello everyone, Ok, every have one of those Doh! moments? I've been ignoring references to S-Lang as I mistakenly assumed it was S Language, the predecessor/sister to R, the statistical package. Not so. S-Lang has a plethora of features that will come in handy for OpenCOBOL. Not only is it yet another easily embedded scripting language, it competes nicely with ncurses as well. There will be more on this side trip ... S-Lang comes with a hyper nifty script variable name insertion, so we'll be able to point to OpenCOBOL variables and pass names for S-Lang script processing. Very cool. For now, here is yet another no terminator keyboard routine, with a few twists. The output shown is generated from hitting A, PgUp, C, D, E, F1, Ctrl-G and EscEsc. It calls "normal" getkey and keymap getkey. Keymap getkey reduces the multiple chars of the Function and special keys to single number, or a normal code for anything 256 or under. Where it breaks is Ctrl-C handling. The installed EXIT_PROC doesn't get a chance to run as the runtime SIGNAL handler calls [b]exit[/b] and doesn't seem to run through the [b]exit_hdlrs[/b] structure of cob_tidy. So if you SLang_getkey and hit Ctrl-C, you'll need to [code] $ stty sane [/code] to get keyboard echo back. Note: that is only for this version with the [b]SLang_set_abort_handler[/b] commented out. I haven't quite figured out how to pass the signal on, so left it out. You need libslang for this one. When you install the libslang2 package, snag slsh too, it's got all kinds-a-goodies in it that I hope to be exposing to OpenCOBOL soon. [b]callslang.cob[/b] [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20090503 *> Purpose: Experimental S-Lang interface *> Tectonics: cobc -x callslang.cob -lslang *> *************************************************************** identification division. program-id. callslang. data division. working-storage section. 01 thekey usage binary-long unsigned. 01 thekm usage binary-long. 01 result usage binary-long. *> exit handler address and priority (prio is IGNORED with OC1.1) 01 install-flag pic 9 comp-x value 0. 01 install-params. 02 exit-addr usage is procedure-pointer. 02 handler-prio pic 999 comp-x. *> *************************************************************** procedure division. *> Initialize low and high level S-Lang terminal routines call "SLtt_get_terminfo" end-call call "SLkp_init" returning result end-call if result equal -1 display "problem intializing S-Lang tty" end-display stop run giving 1 end-if call "SLang_init_tty" using by value -1 *> abort char by value -1 *> flow ctrl by value 0 *> output processing returning result end-call if result equal -1 display "problem intializing S-Lang tty" end-display stop run giving 1 end-if *> install an exit handler to put terminal back set exit-addr to entry "tty-reset" call "CBL_EXIT_PROC" using install-flag install-params returning result end-call if result not equal zero display "error installing exit procedure" end-display end-if *> Not sure? Have SLang handle ^C or let OpenCOBOL take over? *> call "SLang_set_abort_signal" using by value 0 end-call *> The demo. Fetch a key, then fetch a keycode. 4 times. *> SLang terminals display newline as newline. Need explicit *> CR to get a carriage return. Hence the x"0d". *> Plus, output is buffered until line terminators. perform 4 times call "SLang_getkey" returning thekey end-call display thekey space with no advancing end-display call "SLkp_getkey" returning thekm end-call display thekm x"0d" end-display end-perform *> Exit handler will take care of resetting terminal *> call "SLang_reset_tty" end-call goback. *> *************************************************************** *> Exit procedure to ensure terminal properly reset *> *************************************************************** entry "tty-reset". call "SLang_reset_tty" end-call goback. end program callslang. [/code] [b]Output sample[/b] [code] 0000000097 +0000000261 0000000099 +0000000100 0000000101 +0000000513 0000000007 +0000065535 [/code] Cheers, Brian ---------------------------------------------------------------- Ok, S-Lang is pretty cool. [b]callslang.cob[/b] [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20090505 *> Purpose: Experimental S-Lang interface *> Tectonics: cobc -x callslang.cob -lslang *> *************************************************************** identification division. program-id. callslang. data division. working-storage section. 01 result usage binary-long. 01 cobol-integer usage binary-long value 42. 01 cobol-float usage float-long value 0.0. 01 sl-int-type constant as 20. 01 sl-double-type constant as 27. 01 read-write constant as 0. *> *************************************************************** procedure division. *> Initialize S-Lang call "SLang_init_all" returning result if result equal -1 display "Sorry, problem initializing SLang" end-display end-if *> Register "slint" variable call "SLadd_intrinsic_variable" using by reference "slint" & x"00" by reference cobol-integer by value sl-int-type by value read-write returning result end-call if result equal -1 display "Could not register cobol-integer" end-display end-if *> Register "sldbl" variable call "SLadd_intrinsic_variable" using by reference "sldbl" & x"00" by reference cobol-float by value sl-double-type by value read-write returning result end-call if result equal -1 display "Could not register cobol-float" end-display end-if call "SLang_load_string" using "sldbl = sum([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);" & x"00" returning result end-call if result equal -1 display "Could not interpret sum intrinsic" end-display end-if display "S-Lang set cobol-float to " cobol-float end-display display "Next lines of output are S-Lang printf" end-display call "SLang_load_string" using '() = printf("slint (cobol-integer) = %d\n", slint);' & x"00" returning result end-call if result equal -1 display "Could not interpret printf" end-display end-if add 1 to cobol-integer call "SLang_load_string" using '() = printf("slint after COBOL add = %d\n", slint);' & x"00" returning result end-call if result equal -1 display "error with printf after COBOL add" end-display end-if *> Let's get out of here and do the Dilbert Nerd Dance...Woohoo! goback. end program callslang. [/code] Which outputs [code] S-Lang set cobol-float to 45.000000000000000000 Next lines of output are S-Lang printf slint (cobol-integer) = 42 slint after COBOL add = 43 [/code] Cheers P.S. This is neat, but ... having a variable loose linked between two programming languages like this ... hmmm ... bankers and rocket scientists may frown on such things. Not so, us codesurfin' weirdos. ;-) This sample is simply yelling Hello World to a new tool. No assumptions about nodding Hi Real World. ---------------------------------------------------------------- Subject: LINAGE clause Hi Valid LINAGE clause (MF, AcuCobol...) is rejected: LINAGE IS 60 LINES, LINES AT TOP 3, LINES AT BOTTOM 3 fix.cbl:31: Error: parse error, unexpected LINES, expecting EXTERNAL or GLOBAL It seems that the keyword LINES is not supported (parser.y). Is there some plan to support it in the near future ? MicroFocus (The linage clause): http://supportline.microfocus.com/Documentation/books/sx50/lhpdf40e.htm#s001 Thank you ---------------------------------------------------------------- jean-marc, The syntax in the 20xx Draft is (supposed to be) supported, you've uncovered a parser bug it seems. See http://opencobol.add1tocobol.com/#linage for a sample. I compiled it just now to make sure the current pre-release still functions properly. [code] FD mini-report linage is 16 lines with footing at 15 lines at top 2 lines at bottom 2. [/code] Early experiments are that n LINES LINES AT triggers the problem. The double occurrence of LINES LINES (with or without the whitespace comma). So [code] LINAGE IS 16 LINES TOP 2 BOTTOM 2 [/code] will work, just not the IS LINES followed by LINES AT. It does parse properly when the FOOTING phrase is inserted in between. I'll try a few things in the parser, see if I can't offer a patch for Roger to test out. So, if you have access to change the sources, dropping the optional "LINES AT" from the TOP phrase or the optional LINES from the LINAGE IS clause will let the code compile cleanly in the short term. Cheers, Brian ---------------------------------------------------------------- Thanks Brian I can wait for a couple of weeks if there is a chance to get a fix. Can we expect a fix? When would it be available ? Thank you ---------------------------------------------------------------- Umm, don't want to leave this post hangin', but jean-marc, to be honest ... no clue when the next tarball is going to be released. We are at the behest and the behooves of a an all volunteer project. There [i]has[/i] been a dry spell on the public front lately, while development happens in the background. When things come, oft times they are in a flurry ... with these periods of [i]seeming[/i] inactivity. I can almost certainly say there [i]will[/i] be a fix, would not want to say when. But again, in the meantime, unless you have no control over the source code, the [i]functionality[/i] is working. A simple drop of either of the optional LINES keywords between IS n [LINES LINES] AT TOP will make the parser happy. Cheers, Brian ---------------------------------------------------------------- Subject: Migrating ISAM to MySQL I've read that there is an effort migrating data from ISAM to MySQL. This is very interesting and I want to contribute. Changing ISAM could be the first step of unifying COBOL with other language and lose nothing is the process. Please answer. Regards, Konenas ---------------------------------------------------------------- konenas; There are lots of options in this area. SQLite3 at http://oldsite.add1tocobol.com/tiki-list_file_gallery.php?galleryId=12 libDBI at http://oldsite.add1tocobol.com/tiki-read_article.php?articleId=1 marcr's recent MySQL posts (these look very promising) But there are also yet unpublished works ... in the works. I've been pondering what it would take to have EXEC SQL built into the compiler proper, but I'll admit that it is not an easy think. I'm not sure what to advise as where the greatest bang for the buck would be, (but I might lean toward the recent posts by marcr and Jim) And there is always the scripting angles using S-Lang or Lua or Guile or ... or compiled with the Vala linkage. Hmmm. Spoilt for choice. Cheers, Brian ---------------------------------------------------------------- Dear Brian, I want to migrate >1000 cobol sources and my thought was, if I had a solution to migrate them all at once, I would. Unfortunately libdbi, EXECSQL and sqlite3 need a lot of changes in my code. Also, using scripting would be for me, "another language". This led me to this solution and I'm willing to help for it. I've tested OC for some time now and excluding split alternate keys, nothing else holds me back. Regards, Konnos ---------------------------------------------------------------- Converting ISAM to RDBMS is an important step towards getting COBOL to a place where it can interact with objects and components written in other languages (including other COBOLs) There is a complete technical strategy for this, posted on the COBOL 21 site. Check out their "Migration" portal and click through to the PRIMA Toolset. http://primacomputing.co.nz/cobol21 I have used this toolset to convert ISAM used by COBOL to MySQL, postgreSQL, and SQL Server and found the tools to be excellent. If you contact PRIMA and tell them you are using Open COBOL they will definitely assist; (they are very supportive of Open COBOL) with tools and experience and may even do some of it for you. They do not charge for advice and help. There is more to this than you might think... COBOL OCCURS, REDEFINES, and Group fields have to be catered for and the end point RDB should be normalized. Their tools do this automatically, but you can do it manually if you want. Until Open COBOL supports COM and OO COBOL you will be unable to complete the whole process as shown on their site, but you can certainly get your ISAM files moved to MySQL without problem. ---------------------------------------------------------------- I've found in primacomputing very interesting features. But maybe I wasn't understood. My problem is that, having a lot of code to change, I want to change my data file access to MySQL from ISAM. This could be step #1 of migration process. Secondly I would change all access code to LIBDBI and use SQL features. Regards, Konnos ---------------------------------------------------------------- As mentioned there are several projects being created to manage this. One interesting project would take care of the SQL in the back end, entirely without the programmers interaction. So he could choose MySQL or ISAM or whatever, and it would take care of converting as necessary. In cases of reads/writes this would be fine. (For more powerful options, I want to have full access to my sql of course...). We have been a bit lax in our Add1 project lately because so many of us have so much work going on. But I finally got some generators that create code for me. Thus my job will get more easy. In any case I am going to try to get the add1 meetings going again on a regular basis. If you joined us in the chat there, it would help push some of these options forward. I'd like to see an oco team working on these sorts of tools and libraries so we all have what we need to get our work done. Regards ---------------------------------------------------------------- Converting code from isam access to SQL access sounds like a good tool. I wouldn't mind working on a project to create the tool myself. You should visit the add1tocobl chat channel on freenode to discuss this further. Besides the code conversion does this tool need to generate the SQL tables in mysql? Should this tool work with other DBM tools? Take care ---------------------------------------------------------------- John, Wouldn't a key first part if this be to have a complete working mysql library for open cobol? That would have to include CALLS wrapped in copybooks and procedures. Then one could simply supply the sql statement. I know a lot of folks want more of an automatic thing (that is the EXEC) but honestly doing a SELECT `col1`, `col2`, `col3` ... FROM `table` WHERE bla Is not really the difficult or time consuming part. The main part is making sure that those selects get into the proper COBOL data structures and that INSERTS, REPLACES, and UPDATES or even the mysql CALL statement (for stored procedures) are taken from the correct COBOL data structures. Nevertheless as I see it for RDBMS access we need several things: 1. A series of libraries to CONTACT the RDBMS, which places values into or takes values from Cobol data structures. 2. Management of GROUP data structures (a TEXT column perhaps?) 3. A back end ISAM "replacement". This would use the library without the Coboler's knowledge (except for someplace setting some needed values, host, username,password etc...) So that READS become SELECTS and WRITES become INSERTS or UPDATES (or REPLACES). If this were done, then the original poster would not have to change their code at all? There was someone that came into our add1tocobol chat a while ago suggesting they might do something like that. 4. The EXEC, which is similar to 3. But I am curious, rather than doing a lot of the code conversion as a separate process (or sql to cobol) wouldn't the generator that we are in the process of creating now handle that? Couldn't we design it to? ---------------------------------------------------------------- [quote] aoirthoir wrote: 3. A back end ISAM "replacement". This would use the library without the Coboler's knowledge (except for someplace setting some needed values, host, username,password etc...) So that READS become SELECTS and WRITES become INSERTS or UPDATES (or REPLACES). If this were done, then the original poster would not have to change their code at all? [/quote] If the "needed values" could be set to the environment, then no code change would be needed. I think the hardest part of this is the locking. Although this sounds nice, I prefer a good working VBISAM :-) human ---------------------------------------------------------------- Agreed on all counts. The looking into the environment could simply be a part of the library itself, not the code of the coboler. Just a thought. And yeah I really want to have vbisam so we have a complete, cobol only solution. ---------------------------------------------------------------- Just in cawse anyone does NOT already know about it, for Alchemy (previously Fujtsu) COBOL users, the ability to keep COBOL source code "as is" but use SQL as the back end is already available as a "commerial" product. Check out [url=http://www.netcobol.com/migrations/VSAM-to-SQL-Server.htm]http://www.netcobol.com/migrations/VSAM-to-SQL-Server.htm[/url] (If you don't know it, "VSAM" is an IBM data access method used for impelemting what standard COBOL would call ISAM. Well actually, VSAM KSDS is "ISAM" while VSAM RRDS are "relative files") ---------------------------------------------------------------- I think having both choices would be good. I always prefer to do my own sql. But if we offered a simple back end, where reads become selects and writes become inserts and updates, then it's really got to keep any advanced features out. Thoughts? ---------------------------------------------------------------- I have always hoped that VBISAM were mature also. I like the idea of a back-end replacement that eliminates the need for code changes. And yes, the big COBOL compiler vendors have products in this space. They are also very "proud" of the tools. I have never been clear if VBISAM would allow a straight copy of dat and idx files from MF. AddTo1 has an interesting post about the -vbisam compile switch. In fact, I actually would have been interested in migrating to bdb but the lack of alternate key support would have made a >1000 program solution painful to migrate. At first glance, I thought this was a limitation of bdb. I found this link that makes me think otherwise( [url=http://pybsddb.sourceforge.net/ref/am/second.html]Berkeley DB Reference Guide[/url] ) but, I don't know enough about OC plumbing to understand where a change like this might be feasible. I also assume that Roger probably considered it. Now I'm rambling.... ---------------------------------------------------------------- [quote] streez wrote: I have never been clear if VBISAM would allow a straight copy of dat and idx files from MF.[/quote] You will NEVER be able to read these files if you do not have a MF compiler and runtime. But there is no problem in converting these fils to OC if you follow these steps: 1. Read all MF files you need with MF and write a sequential / line sequential text file with the contents (packed fields should be unpacked) 2. Read all the text files with OC and write the content to BDB or VBISAM (depending on the ./configure you've done during install of OC) ---------------------------------------------------------------- Subject: problem compil cobol I compile a program ,a mmessage error : opt/oracle/outils>cobc -x soldacot.cob1 soldacot.cob1:1: Error: syntax error, unexpected DEFAULT, expecting PROGRAM_ID /opt/oracle/outils> ---------------------------------------------------------------- Then you surely have a syntax error. Because of not posting the error lines we can just guess: Maybe the DEFAULT is a vendor specific implementation. Try to do what the compiler says: Start the program with [code]PROGRAM-ID. myprog.[/code] and put a comment before the DEFAULT. If you want further help you should post the lines around the position where the error occured (please use the CODE tag for posting code, it's the icon <> in the posting editor). ---------------------------------------------------------------- Subject: RUN TIME ENVIRONMENT for NATIVE WINDOWS In a true native Windows XP, Vista environment that has not been used for opencobol development what would be the minimum required for the .exe code generated by cobc -x to run? Has anyone done this and got it working? ---------------------------------------------------------------- It depends on the way the cobc was generated. If it was done in cygwin environment you need the cygwin dll's and the opencobol ones. If the cobc was build on a native windows environment using Microsoft C++, you do not need cygwin dlls but the according MS C++ runtime library. If you've used Berkeley DB for ISAM access, you have to use these dlls to (I think they have windows setup files available). You may want to check the necessary dlls copying the generated exe using the [url=http://www.dependencywalker.com/]Dependency Walker[/url]. It works best to copy the exe to the wanted system and use the dependency walker there, enabling you to see all necessary dlls for running the exe-file. In step two, you should gather all runtime environments giving you the necessary files. ---------------------------------------------------------------- Hello. OC + WinXP with cygwin installed on PC1>>> OK To share programs and data of the PC1 from a PC2 I have copied all the dll cygwin and OC in the directory C:\Windows\system32 on PC2 I also changed the path accordingly>>> not work !!! Message: "Error opening terminal: cygwin" Why ??? I supose it's not an OC problem ... I need help Thank ---------------------------------------------------------------- Hello. Have you managed to install and operate OC on Windows natively without cygwin or MinGW / MSYS? Hope to read you. ---------------------------------------------------------------- Subject: Bug in FUNCTION LENGTH Another one found at cobol-it's: [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. 'TESTX'. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. * WORKING-STORAGE SECTION. 01 a pic x(10). 01 x. 05 b pic 9 occurs 1. *----------------------------------------------------------------- LINKAGE SECTION. *----------------------------------------------------------------- PROCEDURE DIVISION. declaratives. end declaratives. *----------------------------------------------------------------- main section. 00. move "123" to a. move 2 to b(1). display "a= " a end-display display "b(1)= " b(1) end-display display "length(a(1:b(1)))= " function length(a(1:b(1))) end-display * stop run * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program TESTX ---------------------------------------- [/code] results (with OC Packaged Nov 12 2008 20:35:55 CET) in [quote]a= 123 b(1)= 2 length(a(1:b(1)))= -1[/quote] Shouldn't the FUNCTION LENGTH result in 2? Temporary workaround: [code] display "length(a(1:b(1)))= " function length( function concatenate (a(1:b(1)))) end-display[/code] ---------------------------------------------------------------- Add a function trim within your length. [code] display "length(a(1:b(1)))= " function length( function trim( a(1:b(1)) ) ) end-display [/code] take care ---------------------------------------------------------------- jris, I hope you are saying that using the FUNCTION TRIM is a "temporary work around" and NOT that it shouldd be required. There is NO WAY that having the LENGTH intrinsic funciton return a NEGATIVE value can be something other htan a BUG. Furthermore, using the FUNCITON TRIN "internally" for input to FUNCTION LENGTH should (in many cases) actually yield a DIFFERENT result than that expected if it weren't there. ---------------------------------------------------------------- Like you it seems like the original statement should work because the following works fine too and no function trim. [code] display "length(a(1:2))=" function length (a(1:2)) end display [/code] Your said "FUNCTION TRIM 'internally' for input to FUNCTION LENGTH should(in many cases) actually yield a DIFFERENT result than expected' doesn't ring true to me. Could you show examples where it should not work. Thanks ---------------------------------------------------------------- Consider the code: [code] function length( function trim( a(1:b(1)) ) [/code] versus the code [code] function length( a(1:b(1) [/code] If the "value of" (data pointed to by) a(1:b (1) is " xyz " (space, folloed by xyz followed by space) Then if you TRIN that, you will get a length of 3 while if you don't trim it, you get a length of 5. Is this clear as to why I think using the TRIM where it was proposed would be a BAD idea (if the goal is to get the length WITH any leading/trailing spces) ---------------------------------------------------------------- The right workaround was added in the first post: function concatenate ---------------------------------------------------------------- Subject: Is there any chance of a "bug report" page? Is there any chance that we could have (that Roger would be willing/interested in having) a "bug report" page for OpenCOBOL? This would have 3 parts: 1) Bug reports that have been submitted but not yet evaluated 2) Bug reports that have been evaluated and are accepted as "bugs in the compiler/run-time". - but have not yet been fixed 3) Bug reports that have been fixed (and in what version). * * * * * * I don't want to place significant burden on anyone, but I know that I have reported problems that I don't know if - Roger (or anyone) has accepted them as bugs - or if they are considered "working as designed" - Whether there are already fixes available, but I just don't have the right version of the 1.1 prerelease. * * * * I would think that having (keeping current) such a list could help, not just me but also - help in creating "release" documentation when a new versions is put out - help with responding to some forum posts - with a "this is a known but not yet fixed problem". * * * * * * If Roger (or anyone else) has a "to do list" with this type of information, I would be happy to volunteer for turning this into an external document. ---------------------------------------------------------------- I totally agree wmklein. As I've mentioned before, there are a bug and a FR-tracker at sourceforge (as there are new forums and I think also a mantis tracker available at "Hosted Apps"). All request of wmklein mentioned above can be be covered by most bug and feature trackers. I would really like to use them but it has to be clear that these are the wanted places for reporting them. The only one that can agree to this is Roger. I made a list of the bugs of 1.1 prerelease, I will post them either in this forum or in a bug tracker but I'd really like to know how Roger's thought about using bug trackers (and which one) are. human ---------------------------------------------------------------- Subject: Problem installing openCobol in solaris 10 hello. Once I installed the prerequisites, run configure and works well. But when I run make it show me the following error. Undefined first referenced symbol in file initscr32 /opt/software/COBOL/open-cobol-1.0/libcob/.libs/libcob.so w32attron /opt/software/COBOL/open-cobol-1.0/libcob/.libs/libcob.so w32attrset /opt/software/COBOL/open-cobol-1.0/libcob/.libs/libcob.so ld: fatal: Symbol referencing errors. No output written to .libs/cobcrun collect2: ld returned 1 exit status *** Error code 1 make: Fatal error: Command failed for target `cobcrun' Current working directory /opt/software/COBOL/open-cobol-1.0/bin *** Error code 1 The following command caused the error: failcom='exit 1'; \ for f in x $MAKEFLAGS; do \ case $f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo all-recursive | sed s/-recursive//`; \ list='lib libcob cobc bin po texi config tests'; for subdir in $list; do \ echo "Making $target in $subdir"; \ if test "$subdir" = "."; then \ dot_seen=yes; \ local_target="$target-am"; \ else \ local_target="$target"; \ fi; \ (cd $subdir && make $local_target) \ || eval $failcom; \ done; \ if test "$dot_seen" = "no"; then \ make "$target-am" || exit 1; \ fi; test -z "$fail" make: Fatal error: Command failed for target `all-recursive' Current working directory /opt/software/COBOL/open-cobol-1.0 *** Error code 1 make: Fatal error: Command failed for target `all' =========== I put all snapshot from the installation root@peral # ./configure checking for a BSD-compatible install... /usr/local/bin/install -c checking whether build environment is sane... yes checking for gawk... no checking for mawk... no checking for nawk... nawk checking whether make sets $(MAKE)... yes checking whether to enable maintainer-specific portions of Makefiles... no checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking how to run the C preprocessor... gcc -E checking for egrep... egrep checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking whether ln -s works... yes checking for a BSD-compatible install... /usr/local/bin/install -c checking build system type... sparc-sun-solaris2.10 checking host system type... sparc-sun-solaris2.10 checking for a sed that does not truncate output... /usr/bin/sed checking for ld used by gcc... /usr/ccs/bin/ld checking if the linker (/usr/ccs/bin/ld) is GNU ld... no checking for /usr/ccs/bin/ld option to reload object files... -r checking for BSD-compatible nm... /usr/ccs/bin/nm -p checking how to recognize dependent libraries... pass_all checking dlfcn.h usability... yes checking dlfcn.h presence... yes checking for dlfcn.h... yes checking the maximum length of command line arguments... 786240 checking command to parse /usr/ccs/bin/nm -p output from gcc object... ok checking for objdir... .libs checking for ar... ar checking for ranlib... ranlib checking for strip... strip checking if gcc supports -fno-rtti -fno-exceptions... no checking for gcc option to produce PIC... -fPIC checking if gcc PIC flag -fPIC works... yes checking if gcc static flag -static works... no checking if gcc supports -c -o file.o... yes checking whether the gcc linker (/usr/ccs/bin/ld) supports shared libraries... yes checking whether -lc should be explicitly linked in... yes checking dynamic linker characteristics... solaris2.10 ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... no checking for shl_load... no checking for shl_load in -ldld... no checking for dlopen... yes checking whether a program can dlopen itself... yes checking whether a statically linked program can dlopen itself... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes configure: creating libtool checking whether make sets $(MAKE)... (cached) yes checking for ANSI C header files... (cached) yes checking for stdint.h... (cached) yes checking for sys/types.h... (cached) yes checking signal.h usability... yes checking signal.h presence... yes checking for signal.h... yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking malloc.h usability... yes checking malloc.h presence... yes checking for malloc.h... yes checking locale.h usability... yes checking locale.h presence... yes checking for locale.h... yes checking stddef.h usability... yes checking stddef.h presence... yes checking for stddef.h... yes checking wchar.h usability... yes checking wchar.h presence... yes checking for wchar.h... yes checking for dlfcn.h... (cached) yes checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking for an ANSI C-conforming const... yes checking whether byte ordering is bigendian... yes checking for size_t... yes checking whether struct tm is in sys/time.h or time.h... time.h checking for inline... inline checking for working alloca.h... yes checking for alloca... yes checking for vprintf... yes checking for _doprnt... yes checking for memmove... yes checking for memset... yes checking for regcomp... yes checking for setlocale... yes checking for fcntl... yes checking for strerror... yes checking for strcasecmp... yes checking for strchr... yes checking for strrchr... yes checking for strdup... yes checking for strstr... yes checking for strtol... yes checking for gettimeofday... yes checking for ld used by GCC... /usr/ccs/bin/ld checking if the linker (/usr/ccs/bin/ld) is GNU ld... no checking for shared library run path origin... done checking for iconv... yes checking how to link with libiconv... /usr/local/lib/libiconv.so -L/usr/local/lib -L/usr/openwin/lib -R/usr/local/lib checking for iconv declaration... extern size_t iconv (iconv_t cd, const char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); checking for nl_langinfo and CODESET... yes checking for getopt_long_only... yes checking kpathsea/getopt.h usability... no checking kpathsea/getopt.h presence... no checking for kpathsea/getopt.h... no checking getopt.h usability... yes checking getopt.h presence... yes checking for getopt.h... yes checking gmp.h usability... yes checking gmp.h presence... yes checking for gmp.h... yes checking for __gmp_randinit in -lgmp... yes checking whether NLS is requested... yes checking for msgfmt... no checking for gmsgfmt... /usr/lib/gmsgfmt checking for xgettext... no checking for msgmerge... no found gmsgfmt program is not GNU msgfmt; ignore it checking whether NLS is requested... yes checking for GNU gettext in libc... no checking for iconv... (cached) yes checking how to link with libiconv... /usr/local/lib/libiconv.so -L/usr/local/lib -L/usr/openwin/lib -R/usr/local/lib checking for GNU gettext in libintl... yes checking whether to use NLS... yes checking where the gettext function comes from... external libintl checking how to link with libintl... /usr/local/lib/libintl.so -L/usr/local/lib -L/usr/openwin/lib -L/usr/X11R6/lib /usr/local/lib/libiconv.so -lsec -lc -R/usr/local/lib -R/usr/local/ssl/lib -R/usr/openwin/lib -R/usr/lib -R/usr/local/BerkeleyDB.4.2/lib -R/usr/X11R6/lib checking ncurses.h usability... no checking ncurses.h presence... no checking for ncurses.h... no checking pdcurses.h usability... no checking pdcurses.h presence... no checking for pdcurses.h... no checking ncurses/ncurses.h usability... no checking ncurses/ncurses.h presence... no checking for ncurses/ncurses.h... no checking curses.h usability... yes checking curses.h presence... yes checking for curses.h... yes checking for initscr in -lncurses... yes checking for BDB db.h version >= 4.1 ... yes (4.7) checking for BDB 4.1 compatibility in db ... yes checking for dlopen in -lc... yes configure: creating ./config.status config.status: creating cob-config config.status: creating Makefile config.status: creating lib/Makefile config.status: creating libcob/Makefile config.status: creating cobc/Makefile config.status: creating bin/Makefile config.status: creating po/Makefile.in config.status: creating texi/Makefile config.status: creating config/Makefile config.status: creating tests/atlocal config.status: creating tests/Makefile config.status: creating tests/cobol85/Makefile config.status: creating config.h config.status: executing tests/atconfig commands config.status: executing depfiles commands config.status: executing default-1 commands config.status: creating po/POTFILES config.status: creating po/Makefile OpenCOBOL Configuration: CC gcc COB_CC gcc CFLAGS -O2 -finline-functions -fomit-frame-pointer -fsigned-ch COB_CFLAGS -I/usr/local/include -I/usr/local/include -O2 COB_EXTRA_FLAGS LDFLAGS COB_LDFLAGS COBC_LIBS -L/usr/local/lib -lintl -L/usr/openwin/lib -L/usr/X11R6/ -R/usr/openwin/lib -R/usr/lib -R/usr/local/BerkeleyDB.4.2/lib -R/usr/X11R6/lib COB_LIBS -L${exec_prefix}/lib -lcob -lm -lgmp -L/usr/local/lib -li /usr/local/lib -R/usr/local/ssl/lib -R/usr/openwin/lib -R/usr/lib -R/usr/local/B COB_CONFIG_DIR ${prefix}/share/open-cobol/config COB_LIBRARY_PATH .:${exec_prefix}/lib/open-cobol COB_MODULE_EXT so COB_SHARED_OPT -shared COB_PIC_FLAGS -fPIC -DPIC COB_EXPORT_DYN Dynamic loading System Use gettext for international messages: yes Use Berkeley DB for file I/O: yes Use enhanced Berkeley DB (>= 4.1) yes Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: yes root@peral # /usr/sfw/bin root@peral # make Creating defaults.h... make all-recursive Making all in lib if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT dummymac.o -MD -MP -MF ".deps/dummymac.Tpo" -c -o dummymac.o dummymac.c; \ then mv -f ".deps/dummymac.Tpo" ".deps/dummymac.Po"; else rm -f ".deps/dummymac.Tpo"; exit 1; fi rm -f libsupport.a ar cru libsupport.a dummymac.o ranlib libsupport.a Making all in libcob if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF ".deps/libcob_la-common.Tpo" -c -o libcob_la-common.lo `test -f 'common.c' || echo './'`common.c; \ then mv -f ".deps/libcob_la-common.Tpo" ".deps/libcob_la-common.Plo"; else rm -f ".deps/libcob_la-common.Tpo"; exit 1; fi mkdir .libs gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF .deps/libcob_la-common.Tpo -c common.c -fPIC -DPIC -o .libs/libcob_la-common.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF .deps/libcob_la-common.Tpo -c common.c -o libcob_la-common.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF ".deps/libcob_la-call.Tpo" -c -o libcob_la-call.lo `test -f 'call.c' || echo './'`call.c; \ then mv -f ".deps/libcob_la-call.Tpo" ".deps/libcob_la-call.Plo"; else rm -f ".deps/libcob_la-call.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF .deps/libcob_la-call.Tpo -c call.c -fPIC -DPIC -o .libs/libcob_la-call.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF .deps/libcob_la-call.Tpo -c call.c -o libcob_la-call.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF ".deps/libcob_la-strings.Tpo" -c -o libcob_la-strings.lo `test -f 'strings.c' || echo './'`strings.c; \ then mv -f ".deps/libcob_la-strings.Tpo" ".deps/libcob_la-strings.Plo"; else rm -f ".deps/libcob_la-strings.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF .deps/libcob_la-strings.Tpo -c strings.c -fPIC -DPIC -o .libs/libcob_la-strings.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF .deps/libcob_la-strings.Tpo -c strings.c -o libcob_la-strings.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-move.lo -MD -MP -MF ".deps/libcob_la-move.Tpo" -c -o libcob_la-move.lo `test -f 'move.c' || echo './'`move.c; \ then mv -f ".deps/libcob_la-move.Tpo" ".deps/libcob_la-move.Plo"; else rm -f ".deps/libcob_la-move.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-move.lo -MD -MP -MF .deps/libcob_la-move.Tpo -c move.c -fPIC -DPIC -o .libs/libcob_la-move.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-move.lo -MD -MP -MF .deps/libcob_la-move.Tpo -c move.c -o libcob_la-move.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF ".deps/libcob_la-numeric.Tpo" -c -o libcob_la-numeric.lo `test -f 'numeric.c' || echo './'`numeric.c; \ then mv -f ".deps/libcob_la-numeric.Tpo" ".deps/libcob_la-numeric.Plo"; else rm -f ".deps/libcob_la-numeric.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF .deps/libcob_la-numeric.Tpo -c numeric.c -fPIC -DPIC -o .libs/libcob_la-numeric.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF .deps/libcob_la-numeric.Tpo -c numeric.c -o libcob_la-numeric.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic.lo -MD -MP -MF ".deps/libcob_la-intrinsic.Tpo" -c -o libcob_la-intrinsic.lo `test -f 'intrinsic.c' || echo './'`intrinsic.c; \ then mv -f ".deps/libcob_la-intrinsic.Tpo" ".deps/libcob_la-intrinsic.Plo"; else rm -f ".deps/libcob_la-intrinsic.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic.lo -MD -MP -MF .deps/libcob_la-intrinsic.Tpo -c intrinsic.c -fPIC -DPIC -o .libs/libcob_la-intrinsic.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic.lo -MD -MP -MF .deps/libcob_la-intrinsic.Tpo -c intrinsic.c -o libcob_la-intrinsic.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF ".deps/libcob_la-fileio.Tpo" -c -o libcob_la-fileio.lo `test -f 'fileio.c' || echo './'`fileio.c; \ then mv -f ".deps/libcob_la-fileio.Tpo" ".deps/libcob_la-fileio.Plo"; else rm -f ".deps/libcob_la-fileio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF .deps/libcob_la-fileio.Tpo -c fileio.c -fPIC -DPIC -o .libs/libcob_la-fileio.o fileio.c: In function `cob_tmpfile': fileio.c:4910: warning: int format, pid_t arg (arg 4) gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF .deps/libcob_la-fileio.Tpo -c fileio.c -o libcob_la-fileio.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-termio.lo -MD -MP -MF ".deps/libcob_la-termio.Tpo" -c -o libcob_la-termio.lo `test -f 'termio.c' || echo './'`termio.c; \ then mv -f ".deps/libcob_la-termio.Tpo" ".deps/libcob_la-termio.Plo"; else rm -f ".deps/libcob_la-termio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-termio.lo -MD -MP -MF .deps/libcob_la-termio.Tpo -c termio.c -fPIC -DPIC -o .libs/libcob_la-termio.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-termio.lo -MD -MP -MF .deps/libcob_la-termio.Tpo -c termio.c -o libcob_la-termio.o >/dev/null 2>&1 if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-screenio.lo -MD -MP -MF ".deps/libcob_la-screenio.Tpo" -c -o libcob_la-screenio.lo `test -f 'screenio.c' || echo './'`screenio.c; \ then mv -f ".deps/libcob_la-screenio.Tpo" ".deps/libcob_la-screenio.Plo"; else rm -f ".deps/libcob_la-screenio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-screenio.lo -MD -MP -MF .deps/libcob_la-screenio.Tpo -c screenio.c -fPIC -DPIC -o .libs/libcob_la-screenio.o screenio.c: In function `cob_screen_puts': screenio.c:267: warning: passing arg 2 of `waddnstr' discards qualifiers from pointer target type gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-screenio.lo -MD -MP -MF .deps/libcob_la-screenio.Tpo -c screenio.c -o libcob_la-screenio.o >/dev/null 2>&1 /bin/bash ../libtool --tag=CC --mode=link gcc -DSUPER_OPTIMIZE -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -o libcob.la -rpath /usr/local/lib -version-info 1:0:0 -no-undefined libcob_la-common.lo libcob_la-call.lo libcob_la-strings.lo libcob_la-move.lo libcob_la-numeric.lo libcob_la-intrinsic.lo libcob_la-fileio.lo libcob_la-termio.lo libcob_la-screenio.lo -lm -lgmp -L/usr/local/lib -lintl -L/usr/openwin/lib -L/usr/X11R6/lib -L/usr/local/lib -liconv -lsec -lc -R/usr/local/lib -R/usr/local/ssl/lib -R/usr/openwin/lib -R/usr/lib -R/usr/local/BerkeleyDB.4.2/lib -R/usr/X11R6/lib -lncurses -ldb gcc -shared -Wl,-h -Wl,libcob.so.1 -o .libs/libcob.so.1.0.0 .libs/libcob_la-common.o .libs/libcob_la-call.o .libs/libcob_la-strings.o .libs/libcob_la-move.o .libs/libcob_la-numeric.o .libs/libcob_la-intrinsic.o .libs/libcob_la-fileio.o .libs/libcob_la-termio.o .libs/libcob_la-screenio.o -R/usr/local/lib -R/usr/local/lib -R/usr/local/ssl/lib -R/usr/openwin/lib -R/usr/lib -R/usr/local/BerkeleyDB.4.2/lib -R/usr/X11R6/lib -R/usr/local/mysql/lib/mysql -lm /usr/local/lib/libgmp.so -L/usr/local/lib -L/usr/local/BerkeleyDB.4.2/lib -L/usr/local/ssl/lib -L/usr/openwin/lib -L/usr/lib -L/usr/local/mysql/lib/mysql /usr/local/lib/libintl.so -L/usr/X11R6/lib /usr/local/lib/libiconv.so -lsec -lc -lncurses -ldb -lc (cd .libs && rm -f libcob.so.1 && ln -s libcob.so.1.0.0 libcob.so.1) (cd .libs && rm -f libcob.so && ln -s libcob.so.1.0.0 libcob.so) ar cru .libs/libcob.a libcob_la-common.o libcob_la-call.o libcob_la-strings.o libcob_la-move.o libcob_la-numeric.o libcob_la-intrinsic.o libcob_la-fileio.o libcob_la-termio.o libcob_la-screenio.o ranlib .libs/libcob.a creating libcob.la (cd .libs && rm -f libcob.la && ln -s ../libcob.la libcob.la) Making all in cobc make all-am if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-cobc.o -MD -MP -MF ".deps/cobc-cobc.Tpo" -c -o cobc-cobc.o `test -f 'cobc.c' || echo './'`cobc.c; \ then mv -f ".deps/cobc-cobc.Tpo" ".deps/cobc-cobc.Po"; else rm -f ".deps/cobc-cobc.Tpo"; exit 1; fi cobc.c:175: warning: initialization discards qualifiers from pointer target type cobc.c:176: warning: initialization discards qualifiers from pointer target type cobc.c:180: warning: initialization discards qualifiers from pointer target type cobc.c:181: warning: initialization discards qualifiers from pointer target type cobc.c:182: warning: initialization discards qualifiers from pointer target type cobc.c:183: warning: initialization discards qualifiers from pointer target type cobc.c:184: warning: initialization discards qualifiers from pointer target type cobc.c:185: warning: initialization discards qualifiers from pointer target type cobc.c:186: warning: initialization discards qualifiers from pointer target type cobc.c:187: warning: initialization discards qualifiers from pointer target type cobc.c:188: warning: initialization discards qualifiers from pointer target type cobc.c:189: warning: initialization discards qualifiers from pointer target type cobc.c:190: warning: initialization discards qualifiers from pointer target type cobc.c:191: warning: initialization discards qualifiers from pointer target type cobc.c:192: warning: initialization discards qualifiers from pointer target type cobc.c:193: warning: initialization discards qualifiers from pointer target type cobc.c:194: warning: initialization discards qualifiers from pointer target type In file included from cobc.c:199: flag.def:25: warning: initialization discards qualifiers from pointer target type flag.def:25: warning: initialization discards qualifiers from pointer target type flag.def:28: warning: initialization discards qualifiers from pointer target type flag.def:28: warning: initialization discards qualifiers from pointer target type flag.def:31: warning: initialization discards qualifiers from pointer target type flag.def:31: warning: initialization discards qualifiers from pointer target type flag.def:34: warning: initialization discards qualifiers from pointer target type flag.def:34: warning: initialization discards qualifiers from pointer target type flag.def:37: warning: initialization discards qualifiers from pointer target type flag.def:37: warning: initialization discards qualifiers from pointer target type flag.def:40: warning: initialization discards qualifiers from pointer target type flag.def:40: warning: initialization discards qualifiers from pointer target type flag.def:43: warning: initialization discards qualifiers from pointer target type flag.def:43: warning: initialization discards qualifiers from pointer target type flag.def:46: warning: initialization discards qualifiers from pointer target type flag.def:46: warning: initialization discards qualifiers from pointer target type flag.def:49: warning: initialization discards qualifiers from pointer target type flag.def:49: warning: initialization discards qualifiers from pointer target type flag.def:52: warning: initialization discards qualifiers from pointer target type flag.def:52: warning: initialization discards qualifiers from pointer target type flag.def:55: warning: initialization discards qualifiers from pointer target type flag.def:55: warning: initialization discards qualifiers from pointer target type flag.def:58: warning: initialization discards qualifiers from pointer target type flag.def:58: warning: initialization discards qualifiers from pointer target type cobc.c:200: warning: initialization discards qualifiers from pointer target type In file included from cobc.c:205: warning.def:25: warning: initialization discards qualifiers from pointer target type warning.def:25: warning: initialization discards qualifiers from pointer target type warning.def:28: warning: initialization discards qualifiers from pointer target type warning.def:28: warning: initialization discards qualifiers from pointer target type warning.def:31: warning: initialization discards qualifiers from pointer target type warning.def:31: warning: initialization discards qualifiers from pointer target type warning.def:34: warning: initialization discards qualifiers from pointer target type warning.def:34: warning: initialization discards qualifiers from pointer target type warning.def:37: warning: initialization discards qualifiers from pointer target type warning.def:37: warning: initialization discards qualifiers from pointer target type warning.def:40: warning: initialization discards qualifiers from pointer target type warning.def:40: warning: initialization discards qualifiers from pointer target type warning.def:43: warning: initialization discards qualifiers from pointer target type warning.def:43: warning: initialization discards qualifiers from pointer target type warning.def:46: warning: initialization discards qualifiers from pointer target type warning.def:46: warning: initialization discards qualifiers from pointer target type warning.def:49: warning: initialization discards qualifiers from pointer target type warning.def:49: warning: initialization discards qualifiers from pointer target type warning.def:52: warning: initialization discards qualifiers from pointer target type warning.def:52: warning: initialization discards qualifiers from pointer target type cobc.c: In function `temp_name': cobc.c:725: warning: int format, pid_t arg (arg 4) if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-config.o -MD -MP -MF ".deps/cobc-config.Tpo" -c -o cobc-config.o `test -f 'config.c' || echo './'`config.c; \ then mv -f ".deps/cobc-config.Tpo" ".deps/cobc-config.Po"; else rm -f ".deps/cobc-config.Tpo"; exit 1; fi if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-tree.o -MD -MP -MF ".deps/cobc-tree.Tpo" -c -o cobc-tree.o `test -f 'tree.c' || echo './'`tree.c; \ then mv -f ".deps/cobc-tree.Tpo" ".deps/cobc-tree.Po"; else rm -f ".deps/cobc-tree.Tpo"; exit 1; fi if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-reserved.o -MD -MP -MF ".deps/cobc-reserved.Tpo" -c -o cobc-reserved.o `test -f 'reserved.c' || echo './'`reserved.c; \ then mv -f ".deps/cobc-reserved.Tpo" ".deps/cobc-reserved.Po"; else rm -f ".deps/cobc-reserved.Tpo"; exit 1; fi if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-error.o -MD -MP -MF ".deps/cobc-error.Tpo" -c -o cobc-error.o `test -f 'error.c' || echo './'`error.c; \ then mv -f ".deps/cobc-error.Tpo" ".deps/cobc-error.Po"; else rm -f ".deps/cobc-error.Tpo"; exit 1; fi if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-parser.o -MD -MP -MF ".deps/cobc-parser.Tpo" -c -o cobc-parser.o `test -f 'parser.c' || echo './'`parser.c; \ then mv -f ".deps/cobc-parser.Tpo" ".deps/cobc-parser.Po"; else rm -f ".deps/cobc-parser.Tpo"; exit 1; fi if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-scanner.o -MD -MP -MF ".deps/cobc-scanner.Tpo" -c -o cobc-scanner.o `test -f 'scanner.c' || echo './'`scanner.c; \ then mv -f ".deps/cobc-scanner.Tpo" ".deps/cobc-scanner.Po"; else rm -f ".deps/cobc-scanner.Tpo"; exit 1; fi if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-field.o -MD -MP -MF ".deps/cobc-field.Tpo" -c -o cobc-field.o `test -f 'field.c' || echo './'`field.c; \ then mv -f ".deps/cobc-field.Tpo" ".deps/cobc-field.Po"; else rm -f ".deps/cobc-field.Tpo"; exit 1; fi if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-typeck.o -MD -MP -MF ".deps/cobc-typeck.Tpo" -c -o cobc-typeck.o `test -f 'typeck.c' || echo './'`typeck.c; \ then mv -f ".deps/cobc-typeck.Tpo" ".deps/cobc-typeck.Po"; else rm -f ".deps/cobc-typeck.Tpo"; exit 1; fi if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-codegen.o -MD -MP -MF ".deps/cobc-codegen.Tpo" -c -o cobc-codegen.o `test -f 'codegen.c' || echo './'`codegen.c; \ then mv -f ".deps/cobc-codegen.Tpo" ".deps/cobc-codegen.Po"; else rm -f ".deps/cobc-codegen.Tpo"; exit 1; fi if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-ppparse.o -MD -MP -MF ".deps/cobc-ppparse.Tpo" -c -o cobc-ppparse.o `test -f 'ppparse.c' || echo './'`ppparse.c; \ then mv -f ".deps/cobc-ppparse.Tpo" ".deps/cobc-ppparse.Po"; else rm -f ".deps/cobc-ppparse.Tpo"; exit 1; fi if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-pplex.o -MD -MP -MF ".deps/cobc-pplex.Tpo" -c -o cobc-pplex.o `test -f 'pplex.c' || echo './'`pplex.c; \ then mv -f ".deps/cobc-pplex.Tpo" ".deps/cobc-pplex.Po"; else rm -f ".deps/cobc-pplex.Tpo"; exit 1; fi /bin/bash ../libtool --tag=CC --mode=link gcc -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -o cobc cobc-cobc.o cobc-config.o cobc-tree.o cobc-reserved.o cobc-error.o cobc-parser.o cobc-scanner.o cobc-field.o cobc-typeck.o cobc-codegen.o cobc-ppparse.o cobc-pplex.o -L/usr/local/lib -lintl -L/usr/openwin/lib -L/usr/X11R6/lib -L/usr/local/lib -liconv -lsec -lc -R/usr/local/lib -R/usr/local/ssl/lib -R/usr/openwin/lib -R/usr/lib -R/usr/local/BerkeleyDB.4.2/lib -R/usr/X11R6/lib ../lib/libsupport.a mkdir .libs gcc -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -o cobc cobc-cobc.o cobc-config.o cobc-tree.o cobc-reserved.o cobc-error.o cobc-parser.o cobc-scanner.o cobc-field.o cobc-typeck.o cobc-codegen.o cobc-ppparse.o cobc-pplex.o -L/usr/local/lib /usr/local/lib/libintl.so -L/usr/local/ssl/lib -L/usr/openwin/lib -L/usr/lib -L/usr/local/BerkeleyDB.4.2/lib -L/usr/X11R6/lib /usr/local/lib/libiconv.so -lsec -lc ../lib/libsupport.a -R/usr/local/lib -R/usr/local/lib -R/usr/local/ssl/lib -R/usr/openwin/lib -R/usr/lib -R/usr/local/BerkeleyDB.4.2/lib -R/usr/X11R6/lib Making all in bin if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobcrun-cobcrun.o -MD -MP -MF ".deps/cobcrun-cobcrun.Tpo" -c -o cobcrun-cobcrun.o `test -f 'cobcrun.c' || echo './'`cobcrun.c; \ then mv -f ".deps/cobcrun-cobcrun.Tpo" ".deps/cobcrun-cobcrun.Po"; else rm -f ".deps/cobcrun-cobcrun.Tpo"; exit 1; fi /bin/bash ../libtool --tag=CC --mode=link gcc -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -o cobcrun cobcrun-cobcrun.o -L../libcob -lcob -lm -lgmp -L/usr/local/lib -lintl -L/usr/openwin/lib -L/usr/X11R6/lib -L/usr/local/lib -liconv -lsec -lc -R/usr/local/lib -R/usr/local/ssl/lib -R/usr/openwin/lib -R/usr/lib -R/usr/local/BerkeleyDB.4.2/lib -R/usr/X11R6/lib -lncurses -ldb mkdir .libs gcc -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -o .libs/cobcrun cobcrun-cobcrun.o -L/opt/software/COBOL/open-cobol-1.0/libcob /opt/software/COBOL/open-cobol-1.0/libcob/.libs/libcob.so -L/usr/local/lib -L/usr/local/BerkeleyDB.4.2/lib -L/usr/local/ssl/lib -L/usr/openwin/lib -L/usr/lib -L/usr/local/mysql/lib/mysql -L/usr/X11R6/lib -lm /usr/local/lib/libgmp.so /usr/local/lib/libintl.so /usr/local/lib/libiconv.so -lsec -lc -lncurses -ldb -R/usr/local/lib -R/usr/local/ssl/lib -R/usr/openwin/lib -R/usr/lib -R/usr/local/BerkeleyDB.4.2/lib -R/usr/X11R6/lib Undefined first referenced symbol in file initscr32 /opt/software/COBOL/open-cobol-1.0/libcob/.libs/libcob.so w32attron /opt/software/COBOL/open-cobol-1.0/libcob/.libs/libcob.so w32attrset /opt/software/COBOL/open-cobol-1.0/libcob/.libs/libcob.so ld: fatal: Symbol referencing errors. No output written to .libs/cobcrun collect2: ld returned 1 exit status *** Error code 1 make: Fatal error: Command failed for target `cobcrun' Current working directory /opt/software/COBOL/open-cobol-1.0/bin *** Error code 1 The following command caused the error: failcom='exit 1'; \ for f in x $MAKEFLAGS; do \ case $f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo all-recursive | sed s/-recursive//`; \ list='lib libcob cobc bin po texi config tests'; for subdir in $list; do \ echo "Making $target in $subdir"; \ if test "$subdir" = "."; then \ dot_seen=yes; \ local_target="$target-am"; \ else \ local_target="$target"; \ fi; \ (cd $subdir && make $local_target) \ || eval $failcom; \ done; \ if test "$dot_seen" = "no"; then \ make "$target-am" || exit 1; \ fi; test -z "$fail" make: Fatal error: Command failed for target `all-recursive' Current working directory /opt/software/COBOL/open-cobol-1.0 *** Error code 1 make: Fatal error: Command failed for target `all' Please, I need help. Thanks ---------------------------------------------------------------- Subject: error messages I am the other mmessage error : opt/oracle/outils>cobc -x soldacot.cob1 soldacot.cob1:54: Error: syntax error, unexpected LITERAL, expecting EXTERNAL or GLOBAL thank you ---------------------------------------------------------------- What does the source code around line 54 look like? (Show us several lines before and several lines after) ---------------------------------------------------------------- Subject: ever expanding faq It seemed to me that activity on the forum was rather quiet. Now I know what the elves have been up to. Take a look at the FUNCTION definitions on the FAQ. They seem to be growing daily. Thank you for your hard work! jimc ---------------------------------------------------------------- Thanks Jim, Recent efforts are on a reorg. I got tired of trying to find the reserved word section in the Table of Contents so I've started moving more items to a higher level. Still quite a bit of shuffling to do. Then...I may take a kick at adding an .. index:: directive to ReStructuredText so we can get a real index. Not an easy task (or at least not an easy task if done in a general way, but I don't really care about all the general cases, just something we can use for this and similar documents). Then...back to trying to get a semblance of a Usage Guide out of all the great information everyone has posted and discussed and thrashed out. Then...(or probably before the Usage and a working index) more reference material. OC deserves good docs, but man'o'man, that means a lot of docs before "good" happens. ;) Cheers, Brian ---------------------------------------------------------------- Holy cow! I never realized it had gotten so big! Thanks Brian. ---------------------------------------------------------------- Subject: Add 1 To Cobol Meetings Starting again in June (May 31 actually) I am going to be starting the Sunday meetings again in the add 1 to cobol chat room. We have a lot of things to discuss to try to get a bit more organized and more info will follow soon. These meetings will be held at 9am Ohio, USA time. Comments? ---------------------------------------------------------------- Great! If there are no marital obligations and if I can figure out what time 9AM in Ohio is and if I can figure out how to join a chat room for the first time in my life then I will be there :-) ---------------------------------------------------------------- Hello and welcome, jcurrey! No marital obligations. we are not fanatics, just users (: Also, 9AM EST is 8AM in Texas. The IRC channel can be accessed from [url=http://add1tocobol.com/chat.php]here[/url] ([url=http://add1tocobol.com/chat.php]http://add1tocobol.com/chat.php[/url]). You can join whenever you prefer. Someone should be sitting in there. If no one responds right away, they might be away from the keyboard so please have patience. We hope to see you there! ---------------------------------------------------------------- Great. Y'all probably don't want to hear this about Texas, but we are soooooo big that we are in multiple time zones. Our office runs on Mountain time, so I conclude that it will be 7AM to me. Is there any preparation that you can recommend? ---------------------------------------------------------------- Ah sorry. Was for some odd reason thinking you were in Eastern Texas. As for preparation, wear a helmet. No, I am just joking. Your mind should be sufficient. ---------------------------------------------------------------- Jim, As for preparation, be ready for me to barrage you with questions and harangue you to foss everything you ever do from now on. Well ok maybe not EVERYTHING, just the things I want you to foss. Ok, not even those, just the things YOU want to foss:) But I won't complain if you share anything you know and join our team creating libraries. The point of this meeting is to hopefully find out what everyone needs from me (clients? money? begging? goodies?) to get some solid things completed. As Brian Tiffin says, we are spoilt for choice with OpenCobol because it will do so many things. What I am hoping is, that we can narrow some of that choice down, so we can all start to use OC for our projects. For instance I am interested in a MySQL, Drizzle, Firebird, SQLite, PostgreSQL and complete ISAM formats. But, that's the spoilt for choice part. So I would like to see if we could all work together getting a complete MySQL connection, using the MySQL libraries, creating MySQL/OpenCobol Copybooks and such. That way I dont have to do CALL "SOMETHING" using XODcrazy C variable thingie. But instead I can say PERFORM MySQL_Config using USERNAME, PASSWORD, HOST, DATABASE. Then PERFORM MYSQL_SQLfunctin using 'SELECT somethign from that thing over there". Hopefully that makes sense. Of course I do not get much say in this because I am not a C coder. But if I can encourage people by finding clients for them, that might move us along. We might get paid (maybe?) for creating the very tools we need. That's the plan anyhow. As far as the meeting time hopefully this will help: -- Joseph James Frantz (Aoirthoir) http://www.add1tocobol.com Regular add1tocobol meetings: Where: FREENODE IRC Channel: #add1tocobol Access from the web: http://www.add1tocobol.com/chat.php Date: Sundays Time: 9:00am Eastern ::::::::NOTE IMPORTANT:::::::::: There has been some confusion as to the time. I believe this is because the United States uses Daylight Savings Time. On top of this the Government recently extended the dates that EDT (eastern daylight time) would run. So to be sure that you make it at 9am Eastern, I have this link: http://www.timeanddate.com/worldclock/city.html?n=179 That shows the time in New York City at the moment of viewing. It also explains the current UTC offset for the Eastern Zone in the United States. Simply compare the current time that site states, with your current time and you will know how far off we are from you. :::::::::::::::::::::::::::::::: We're there all of the time, even when we do not have a meeting. Stop on by for Open Cobol Support and chat. Kind Regards ---------------------------------------------------------------- Subject: Feature Request: PERFORM UNTIL EXIT (as synonym for PERFORM FOREVER) There is an EXIT PERFORM or a GO TO or even an EXIT PROGRAM somewhere in the code. Are there better possibilities for doing [code]perform until 0 = 1 ... end-perform[/code] maybe something like [code]perform forever ... end-perform[/code] Is there somebody with knowledge about this? As wmklein pointed out in the posting after this, MF has an extention for this [url=http://supportline.microfocus.com/documentation/books/sx22sp1/lrpdfb.htm]PERFORM EXIT (Format 3)[/url]. If there is nothing like this supported by standards I hereby would like to submit this as a feature request. Currently OC says [quote]Error: syntax error, unexpected EXIT[/quote] Thank you, human ---------------------------------------------------------------- Micro Focus has a documented extension for inline performs that allows "UNTIL to be "UNTIL EXIT", e.g. [code] Pefrom Until Exit Add 1 to Knt If Knt > 27 Exit Perform End-If End-Perform [/code] You might want to TRY this with OC. If this MF extension ins't already implemented, then I suggest you "submit it" as an enhancement request. Obviously, an incorrectly (imporopoer logic) code sequence like this runs the risk of an infinitie loop - but it does meet your needs. ---------------------------------------------------------------- THX, I've changed the topic and the first post (PERFORM UNTIL EXIT does not work with recent prerelease). ---------------------------------------------------------------- Latest OpenCOBOL fully supports: [i]forever, exit perform, exit perform cycle[/i] [code] identification division. program-id. foreverloop. data division. working-storage section. 01 cobol pic 9 value 1. 01 c pic 9 value 2. 01 fortran pic 9 value 3. procedure division. perform forever add 1 to cobol display "cobol at " cobol end-display if cobol greater than fortran exit perform end-if if cobol greater than c exit perform cycle end-if display "cobol still creeping up on c" end-display end-perform display "cobol surpassed c and fortran" end-display goback. end program foreverloop. [/code] Outputting [code] cobol at 2 cobol still creeping up on c cobol at 3 cobol at 4 cobol surpassed c and fortran [/code] Note that when I first wrote this, going too fast, I had the EXIT PERFORM CYCLE test before the fortran test. Then thought things were broken when cobol just kept growing (well, maxing out and looping at 9, being a single digit and all). ;) Cheers, Brian ---------------------------------------------------------------- So this was there all the time? ---------------------------------------------------------------- I'd say [b]FOREVER[/b] but I'd be lying. ;) It's fairly recent. EXIT PERFORM and EXIT PERFORM CYCLE have been in for longer, as they can be used with any of the inline PERFORM loops. Cheers, Brian ---------------------------------------------------------------- Thank you for this information. I use EXIT PERFROM and EXIT PERFORM CYCLE often, good to know that there is a PERFORM FOREVER. Not that I want to use it but if we have PERFORM FOREVER, what do you think of adding PERFORM UNTIL EXIT (for migrating issues)? human ---------------------------------------------------------------- I tried adding PERFORM UNTIL EXIT, emitting code identical to PERFORM FOREVER. The change added a few lines to the parser source and 2 shift-reduce exceptions. It passed [i]make check[/i] and the sample still surpassed c and fortran. So, yes it seems possible, but I don't have a brain big enough to know if this will break code that doesn't get exercised with $ make check. make check is fairly exhaustive, but there are an infinite number of possible COBOL programs so it takes a well thought out overall view of the system before changes like this can be thrown to the wild. My concern is the UNTIL and the EXIT. These are both keywords used for lots of other purposes and this change may or may not have adverse effects on the parser's backtracking and error reporting. [i]And it has the slippery slope problem of chasing other compilers with syntax that isn't STD. Those extensions need to be vetted while showing some level of restraint.[/i] Cheers, Brian ---------------------------------------------------------------- Did you pass the necessary changes to Roger for further investigation already? ---------------------------------------------------------------- Not yet, but will discuss the change at first opportunity. I'll be honest, I have a feeling the consensus may be that we have PERFORM FOREVER and UNTIL EXIT is just another (already non-std) extension that does the same thing. We'll see. Cheers, Brian ---------------------------------------------------------------- Brian, I really, REALLY, wish that someone would post some replies to my thread [quote]Are there stated "goals" or "direction" for OpenCOBOL[/quote] TO me it would make MUCH better sense to "kill off" the "FOREVER" feature and instead to suport the "UNTIL EXIT" syntax that is used by another compiler [u][i][b]AND[/b][/i][/u] which would (therefore) provide migration assistance. I just don't understand the "rejection" of existing (relatively common) syntax - at the same time that providing '85 Standar or '02 Standard features are being rejected (I think) - while other non-Standard intrinsic functions are being put in. I wouldn't "rant" about this, if only I knew what the goals of the OC project WERE. - Is it to provide a "migration" COBOL for existing applications? (Particularly for Micro Focus and IBM mainframe COBOLs - but for at least for some specified compilers) - Is it to provide an '85 Standar compiler? an '02 STandard compiler? - Or is it to "randomly" add features that "strick the fancy" of the primary developer? I have absolutely NOTHING against "prioritizing" additions and corrections - but without understanding the reasoning behind what at least GETS ON THE LIST, this really does bug me. As usual, I want to stress my admiration for what Roger has done and continues to do. However, I do think that it ouwld be "nice" if we at least all knew what the objectives are and how they are used to evaluate "enhancement requests". ---------------------------------------------------------------- Not to downplay the importance of the community knowing what the future holds, with OpenCOBOL I'm not sure we can know. At least not yet. The level of success of OC is now at a point where there really could be a committee and not just a single lead developer that we overwhelm with requests and wishes, but that will require some vetting of talent if we want OpenCOBOL to remain as the high quality product we now enjoy. On the current state of things; there are many many person hours of efforts that COULD be done, both on the core compiler and what I'd like to see as the OCCAN third-party archive. On the decisions made on what is and what isn't valid OC syntax; I think (think being key, I'm gabby but I don't officially speak for the lead developer, nor would I feel comfortable in those shoes) the overall goal is to create a usable COBOL compiler that is not beholding to any other particular dialect. While aiming for standard syntax, deviations will be at the [i]carefully considered[/i] inclinations of a volunteer. [i]To be honest, PERFORM UNTIL EXIT may well be included in a soon to see pre-release[/i]. Bill, Roger is pretty good at listening to our requests but in his defense, OC core really is a one-man job today and that comes with a whole bag of pros and cons. It's a pro when he can devote time, as that time is highly effective, but it's a con when other aspects of real life reduce his available free time. The next time I get a chance I'll see if I can bounce a few things off Roger and try to create a new edition of the Roadmap, alleviating that time commitment for his programming and leave the documentation time to an underling. Cheers, Brian [Update:] I broke it. ;) [code] PERFORM UNTIL end-of-file ... [/code] caused the compiler to kakk with an unexpected identifier, EXIT expected with the PERFORM UNTIL EXIT change. So, not as easy as the first trials made it look. The change I made won't be going anywhere anytime soon. ---------------------------------------------------------------- If anybody wants to look for the definition of PERFORM UNTIL EXIT extension from MF, [url=http://supportline.microfocus.com/documentation/books/nx51ws01/lhpdfb01.htm#u002]here are the docs[/url]. Just to let you know, PERFORM FOREVER and PERFORM UNTIL EXIT both work with out-of-line performs and PERFORM THROUGH, too: [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. 'PERFTST'. * DATA DIVISION. WORKING-STORAGE SECTION. 77 counter pic 9(02). 77 omitted-var pic x. *----------------------------------------------------------------- PROCEDURE DIVISION. *----------------------------------------------------------------- main section. 00. display 'Inner PERFORM with VARYING COUNTER UNTIL' end-display perform varying counter from 1 by 1 until counter > 9 perform disp-counter end-perform display ' ' end-display * display 'Outer PERFORM with VARYING COUNTER UNTIL' end-display perform disp-counter varying counter from 1 by 1 until counter > 9 continue display ' ' end-display accept omitted-var end-accept * display 'Outer PERFORM THROUGH with VARYING COUNTER UNTIL' end-display perform disp-counter-a through disp-counter-b varying counter from 1 by 1 until counter > 9 continue display ' ' end-display * display 'Inner PERFORM FOREVER (OC-Ext) with EXIT PERFORM' end-display move 1 to counter perform forever perform disp-counter if counter > 8 exit perform else add 1 to counter end-add end-if end-perform display ' ' end-display accept omitted-var end-accept * * (The MF-Extension PERFORM UNTIL EXIT is not supported by OC 1.1 yet) * display 'Inner PERFORM UNTIL EXIT (MF-Ext) with EXIT PERFORM' * end-display * move 1 to counter * perform until exit * perform disp-counter * if counter > 8 * exit perform * else * add 1 to counter * end-add * end-if * end-perform * display ' ' end-display * display 'Outer PERFORM THROUGH FOREVER (OC-Ext) ' 'with STOP RUN' end-display move 1 to counter perform disp-counter-a through disp-counter-b2 forever display ' ' end-display * display 'Outer PERFORM FOREVER (OC-Ext) with STOP RUN' end-display move 1 to counter perform disp-counter-b2 forever display ' ' end-display accept omitted-var end-accept * * display 'Outer PERFORM UNTIL EXIT (MF-Ext) with STOP RUN' * end-display * move 1 to counter * perform disp-counter-b2 forever * display ' ' end-display * * display 'Outer PERFORM THROUGH UNTIL EXIT (MF-Ext) ' * 'with STOP RUN' * end-display * move 1 to counter * perform disp-counter-a through disp-counter-b2 until exit * display ' ' end-display * accept omitted-var end-accept * display 'Never should come here.' end-display stop run * continue. ex. exit program. *----------------------------------------------------------------- disp-counter section. 00. display 'The counter is ' counter end-display * continue. ex. exit. *----------------------------------------------------------------- disp-counter-a section. 00. display 'The counter is ' with no advancing end-display * continue. ex. exit. *----------------------------------------------------------------- disp-counter-b section. 00. display counter end-display * continue. ex. exit. *----------------------------------------------------------------- disp-counter-b2 section. 00. if counter > 8 stop run else add 1 to counter end-add end-if * continue. ex. exit. *----------------------------------------------------------------- disp-counter2 section. 00. perform disp-counter if counter > 8 stop run else add 1 to counter end-add end-if * continue. ex. exit. *----------------------------------------------------------------- *--- End of program PERFTST --------------------------------------[/code] btiffin, could you please post the patch for parser.y to support PERFORM UNTIL EXIT for the others (and Roger) being able to have a look at it? human ---------------------------------------------------------------- Subject: a littlle program I make a test to compil this program but it's the errors messages: kobol.cob:1: Error: 'CONTROL' reserved word, but not supported yet kobol.cob:1: Error: syntax error, unexpected WORD, expecting PROGRAM_ID /opt/oracle/outils>vi kobol.cob CONTROL DIVISION. DEFAULT SECTION. DISPLAY IS TERMINAL. IDENTIFICATION DIVISION. PROGRAM-ID. KOBOL. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. GCOS. OBJECT-COMPUTER. GCOS. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT PRINT ASSIGN TOPRINT-SYSOUT. DATA DIVISION. FILE SECTION. FD PRINT LINAGE 46, TOP 1, BOTTOM 1. 01 PRT. 02 FILLER PIC X(3). 02 ETEX PIC X(9). 02 FILLER PIC X(88). WORKING-STORAGE SECTION. 77 AX PIC 99. 01 WENCAW PIC 9(7)V99. 01 FILLER REDEFINES WENCAW. 02 WENCAX PIC 9(9). PROCEDURE DIVISION. CHB-PARA-00000. OPEN OUTPUT PRINT. PERFORM P1-PRINT THRU P1-PRINT-FIN. FIN. CLOSE PRINT. STOP RUN. P1-PRINT. MOVE " " TO PRT. MOVE "BLABLABLA" TO ETEX. WRITE PRT BEFORE PAGE. P1-PRINT-FIN. EXIT. thank ---------------------------------------------------------------- Cobol program begins with identification division. Un programme cobol commence par [code]identification division.[/code] Regards ---------------------------------------------------------------- Subject: MOVE VAR (1:2) TO VAR (2:2) [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. 'TESTPGM2'. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. * WORKING-STORAGE SECTION. 77 subtest pic x(03) value 'ABC'. 77 stuff pic x. * *----------------------------------------------------------------- LINKAGE SECTION. *----------------------------------------------------------------- PROCEDURE DIVISION. *----------------------------------------------------------------- main section. 00. display subtest end-display move subtest (1:2) to subtest (2:2) display subtest end-display accept stuff end-accept stop run * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program TESTPGM2 -------------------------------------[/code] leads to [quote]ABC AAA[/quote] Is this a correct behaviour? Can anybody quote a standard about this? Thank you, human ---------------------------------------------------------------- The results that you are getting are entirely "Standard conforming" - but then again, so are ANY results. What the Standard says about this is, [quote] In the case of reference modification, the unique data item produced by reference modification is not considered to be the same data description entry as any other data description entry. Therefore, if an overlapping situation exists, the results of the operation are undefined. [/quote] The behavior you are reporting is totally compatible with what ALWAYS happens on IBM mainframes. It is INCOMPATABLE with the rsults that are common among PC/Linux/Unix compilers. For more on this "topic" check out the Micro Focus compiler option BYTE-MODE-MOVE ---------------------------------------------------------------- Acu gives the same result In fact this kind of move is dramatically dangerous ... Regards Bear ---------------------------------------------------------------- Because this seems to be OK, please add another warning (set with -Wall)like: [code] -Wsourceisdest Warn move with possible source- = dest-item (NOT set with -Wall)[/code] human ---------------------------------------------------------------- It is relatively rare that you can detect this type of thing at compile-time. You can in your specific example, but change any of the 4 "values" in the two reference modification specifications to a variable - and you can't. Use arithmetic expressions and it is even harder to figure out. If you are interested in the topic of "Operlapping Operands", PL22.4 (formerly J4) is working on this RIGHT NOW. Check out the document at: [url=http://www.cobolstandard.info/j4/files/09-0092.doc]http://www.cobolstandard.info/j4/files/09-0092.doc[/url] This paper will be discussed in just a few weeks. If you have any comments on it, I suggest that you send them (asking for the to be discussed) to the PL22.4 chair. ---------------------------------------------------------------- Wow, you really are a good source for COBOL information. Thank you for the doc. Although it is not possible to output the warning correct in all cases, it would be good to have a warning (NOT set with -Wall) on both [code]move var (1:2) to var (2:2) var (anothervar:2) to var (anothervar2:2)[/code] The same would apply to [code]... 01 var pic x. 01 redefvar redefines var pic 9. ... move var to redefvar[/code] Maybe it's possible to output something like that, this would be really useful. BTW: I found an old ACU version that outputs 'AAB' (as a result to the sample mentioned in the first post). ---------------------------------------------------------------- I don't know much about the standard writing process, but for what it is worth IMHO the logical result is AAB. Also, personally I do not see the need for a warning if somehow the standards could define a result. ---------------------------------------------------------------- There is [u][i][b]ZERO[/b][/i][/u] chance that the Standard would ever be changed to give the DEFINED results that you find "logical". This would break hundreds of thousands (millioons?) of existing IBM Mainframe COBOL programs. The concept of "forward overlapping moves" as a way to INITIALIZE a field to whatever is in the first byte is a "well known" and documented technicaue on IBM mainframe (originated with how Assembler works). If OpenCOBOL introduced a compiler option like the Mircor Focus Byte-Mode-Move directive which CONTROLS (and let the programmer select) which method is used, then I wouldn't see a need for a warning message - as the program would do what the applicaiton programmer wanted it to do. ---------------------------------------------------------------- Whoa! I am not arguing. I understand the issue of backward compatability. However if the standard says that a result is undefined, it seems to me that the door is opened to allow the compiler to cause whatever result the author picks. Olive branch. jimc ---------------------------------------------------------------- The undefined result is exactly the reason why I would like to see a warning message (IF explicit wanted by turning on -W or -Wsomesourcedestthing). This could make switching to OC easier and I personally don't want to code this way for new programs (MOVE ALL var(1:) TO var (2:2) seems nicer). Hopefully Roger or somebody else has the possibility to implement this warning. human ---------------------------------------------------------------- Subject: Accept/Display - Device-name vs Mnemonic name This is a follow-up to a separate thread (or two). I am not even positive that this in an "answer" to the intended quesiton. IBM, Micro Rocus and (I think) OC allow for the syntax [code] Accept whatever from Device-Name Display whatever upon device-name [/code] while the current ('85 and '02) Standards require that you do NOT (directly) use a device name for Accept/Display, but instead you use a mnemonic-name that is [u][b]ASSOCIATED[/b][/u] with a device-name in the Special-Names paragraph. I am not certain, but I think the '74 Standard alctually allowed this (or wasn't clear on it). For "standard conformance" (if you care), the program should always use the mnemonic form (associate in the Special-names paragraph). However, for "common usage", don't bother with any special names stuff and just use one of the (specified by the implementor, e.g. CONSOL, SYSOUT, whatever) names in the ACCEPT/DISPLAY statement. ---------------------------------------------------------------- Are there "specified by the implementor, e.g. CONSOL, SYSOUT, whatever names" in OC? ---------------------------------------------------------------- The ggod news is Enter the command [code] cobc --list-mnemonics [/code] The bad news, is that this list doesn't tell you which are for Accept/Display and which are for other places that mnemoics/device-names can be used (e.g. After Advancing). Someone else may be able to tell you how to figure out which are Accept/Display names and which aren't - other than trying them or reading the compiler source code. NOTE: That directive is actually a misnomer. Those are the device or other "things that you may ASSOCIATE with mnemonics, they aren't te mnemonic itself. MENOMICS are "user-defined words" that you associate with device-names via the Special-Names paragraph. ---------------------------------------------------------------- Just for reference; [code] {"SYSIN", CB_DEVICE_NAME, CB_DEVICE_SYSIN, NULL}, {"SYSIPT", CB_DEVICE_NAME, CB_DEVICE_SYSIN, NULL}, {"SYSOUT", CB_DEVICE_NAME, CB_DEVICE_SYSOUT, NULL}, {"SYSLIST", CB_DEVICE_NAME, CB_DEVICE_SYSOUT, NULL}, {"SYSLST", CB_DEVICE_NAME, CB_DEVICE_SYSOUT, NULL}, {"PRINTER", CB_DEVICE_NAME, CB_DEVICE_SYSOUT, NULL}, {"SYSERR", CB_DEVICE_NAME, CB_DEVICE_SYSERR, NULL}, {"CONSOLE", CB_DEVICE_NAME, CB_DEVICE_CONSOLE, NULL}, [/code] is part of [b]cobc/reserved.c[/b], and at present, there isn't much special processing of these device mnemonics. (In particular, CONSOLE is usually in a switch fall through along with sysout for DISPLAY UPON and a fall through equivalent with sysin for ACCEPT FROM. ASSIGN TO KEYBOARD and READ may offer a little more flexibility or at least ease of grok) This could well be an area where the peanut gallery could provide some "drivers" for special devices and get into the whole [i]codec[/i] arena. Cheers, Brian ---------------------------------------------------------------- Subject: What is ./configure --enable-param-check? This seems to be not the default option. Why should it be not used? human ---------------------------------------------------------------- It turns on parameter count checking for the stock library calls e.g. CBL_CREATE_DIR and C$SLEEP. Why not? Umm, there is a small performance hit if it is turned on, and well, OpenCOBOLers are testerone riddled code freaks that care not for airbags? *kidding* Not sure about its designed purpose. I just tried a compile and gcc trips anyway when compiling genned code that doesn't have appropriate numbers of arguments. So, more ... not sure, other than this one may seem a little cryptic perhaps? And other times, OC trips at a different place in the compile, so the safety measures seem to be the default operation. [code] $ cobc -x -v check.cob preprocessing check.cob into /tmp/cob5775_0.cob translating /tmp/cob5775_0.cob into /tmp/cob5775_0.c gcc -pipe -c -I/usr/local/include -Wno-unused -fsigned-char -Wno-pointer-sign -o /tmp/cob5775_0.o /tmp/cob5775_0.c /tmp/cob5775_0.c: In function ‘check_’: /tmp/cob5775_0.c:143: error: too many arguments to function ‘cob_acuw_sleep’ $ cobc -C check.cob check.cob:17: Error: Wrong number of CALL parameters for 'CBL_CREATE_FILE' [/code] So, from the quick glance I've given it so far, it may be a compiler developer safety net during development of the stock library? Cheers, Brian ---------------------------------------------------------------- Ah, this only belongs to the internal stock library? If yes, it would be good to write this in ./configure --help like[code] --enable-param-check (OpenCOBOL) enable CALL parameter checking for internal stock library[/code] And this is no runtime check but a check on compile time (for everybody wanting a CLEAR message instead of a C-compiler error), right? If yes, I see no reason for this (wonderful) function to be enabled or disabled by configure option, I think it should be enabled by default. Do you agree? human ---------------------------------------------------------------- Subject: make check FAILED because ldconfig has to be done first Before doing "make check" ldconfig seems necessary but it's placed afterwards in README. Please change the README and put the two ** NOTE ** before the ./configure. Thank you, human ---------------------------------------------------------------- Subject: FR: Trace on run time (use of cob_set_location) [quote] simrw wrote [url=http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=200&forum=1]here[/url]: [...] the generated C code reflects this, so you can see it with gdb; eg. /* roger.cob:19: SET */ cob_set_location ("roger", "roger.cob", 19, "MAIN SECTION", "MAIN PARAGRAPH", "SET"); [...] Also with current OC 1.1, if you specify "-g" and/or "-debug", the "cob_set_location" calls will be generated. There will be no print to stderr unless you specify "-ftraceall". Roger[/quote] Is it possible to use these cob_set_location calls to enable tracing at run time? Modules compiled with -ftrace or -ftraceall will always output the tracing to stderr. It would be nice to be able to set these flags at run time (I'd prefer via environment) to be able to trace if you need to, without regenerating the whole code. If cob_set_location would check the environment and output the trace to stderr if wanted, this problem could be solved easily. What do you think about this? Maybe someone other than Roger is able to code this change and post it here for discussion? human ---------------------------------------------------------------- No code yet, but I'll take part in a discussion. The code itself won't be that bad. The emitters in codegen.c are localized to a single if block. Currently using [b]fputs[/b], emitted using a pretty nifty output_line function these intermediate source lines could be: a) wrapped in an extra runtime if 2) moved to a function that does the test z) some other option? The hit will be either a static variable added to the runtime, set after testing an env var on init, a new function in the libcob runtime, or something completely different. The change won't cost much in terms of new code for the compiler, but it'll require an env var, with docs on how to turn off the trace by setting it (or something completely different). Cheers, Brian ---------------------------------------------------------------- If I understood right, you think there should be no additional compiler switch but an env var to suppress the trace output, right? Maybe we could remove the code that is generated by -ftrace and -ftraceall, doing the trace always via cob_set_location. We could have a module internal switch for "level of trace". If one of the -ftrace compiler switches are used, there could be a local initialize for the "level of trace" to 2 (-ftrace) or 3 (-ftraceall). If not, the local var would be initialized to zero. Level 1 of trace could be "program id only". After this initializing, the module could check the env var enabling to change the level of trace up or down. human ---------------------------------------------------------------- Subject: Is it possible to get COBOL comments into generated C-files? Especially for debugging purposes, it would be good to be able to put the COBOL comments to the c files as C comment. I thought of something like [code][b] /* /home/myuser/cobol/TEST.cob:1390: Here we move some special thing to another point: */[/b] /* /home/myuser/cobol/TEST.cob:1391: MOVE */ cob_set_location ("FPBAB", "/home/myuser/cobol/TEST.cob", 1391, "DIF-STUF", "00", "MOVE"); { memset (b_671 + 5, 32, 11); }[/code] (the bold stuff was my thought, the other lines are generated with -debug already) This FR seems to be a little bigger change, mostly in pplex.l. human ---------------------------------------------------------------- I'll second this enhancement request: The use would be for an external preprocessor/precompiler to be able to leave the original source code lines in but commented out so that they can be seen in the debugger (thus making the debugging of the C code in gdb much easier). ---------------------------------------------------------------- Hi Human, I am fully for that so you have both my hands raised as a vote :-) The question is who will do that 1. Need to change preprocessor to preserve the comments in preprocessed code 2. Changes in parser to keep those as some "comments" nodes in the tree 3. Changes in generator to generate comments from those nodes (well, it's really nothing, you know) But still not a small job :-( If you touched this topic, than I can bring another one: What about to keep COBOL variables names (replacing "-" by "_") in the C code ? It is possible of course, especially switching from C to C++, and that will make code better and readable, and better optimized by compiler, etc... But I think it's not a nearest future :-( ---------------------------------------------------------------- Thank you for drawing a short plan for this FR. Some time I maybe get through this whole stuff and can solve it. We already have the COBOL variable names (at least when compiled with -debug), therefore it should be able to use them in generated source, too. But why would that make code better and better optimized, why would it be necessary to switch to C++? What are Rogers thoughts about switching to C++? human ---------------------------------------------------------------- Subject: Happy 50 http://www.theregister.co.uk/2009/05/28/cobol_fifty/ If you take the date as May 28th, 1959 then we missed COBOL turning 50. I'm still waiting till September 18th, the day the name COBOL was announced. But anyway ... someone go and raise a glass, and I'll suck back an extra mug of coffee. Cheers, Brian ---------------------------------------------------------------- Subject: Which file status should occur for OPEN OUTPUT if the folder does not exist? If OPEN OUTPUT is used and the folder for the file does not exists OC leads to FILE STATUS value '30' (for both ISAM and SEQUENTIAL files). Is there another error value than '30 - PERMANENT ERROR' that covers this error? Other vendors use '35' but this seem to be no file status value for OUTPUT. human ---------------------------------------------------------------- Subject: Read STDIN in COBOL I am teaching myself COBOL, but having a hard time finding info online. I am trying to read STDIN line-by-line and print it out to STDOUT. If I use ACCEPT I have no way to detect EOF. I am trying the following, but I'm getting libcob: File does not exist (STATUS = 35) File : '' 0 IDENTIFICATION DIVISION. 0 PROGRAM-ID. APP. 0 ENVIRONMENT DIVISION. 0 INPUT-OUTPUT SECTION. 0 FILE-CONTROL. 0 SELECT SYSIN ASSIGN TO DA-S-SYSIN ORGANIZATION LINE SEQUENTIAL. 0 DATA DIVISION. 0 FILE SECTION. 0 FD SYSIN. 0 01 ln PIC X(255). 0 88 EOF VALUE HIGH-VALUES. 0 WORKING-STORAGE SECTION. 0 PROCEDURE DIVISION. 0 OPEN INPUT SYSIN 0 READ SYSIN 0 AT END SET EOF TO TRUE 0 END-READ 0 PERFORM UNTIL EOF 0 DISPLAY ln 0 READ SYSIN 0 AT END SET EOF TO TRUE 0 END-READ 0 END-PERFORM 0 CLOSE SYSIN 0 STOP RUN. ---------------------------------------------------------------- There is some arcana when it comes to the environment division and OpenCOBOL. The SELECT and ASSIGN clauses have some controlling rules (with hints) that can be found in /usr/share/open-cobol/config/default.conf (or /usr/local/share/open-cobol/config/default.conf - depending on the prefix during build/install) [code] # If yes, file names are resolved at run time using environment variables. # For example, given ASSIGN TO "DATAFILE", the actual file name will be # 1. the value of environment variable `DD_DATAFILE' or # 2. the value of environment variable `dd_DATAFILE' or # 3. the value of environment variable `DATAFILE' or # 4. the literal "DATAFILE" # If no, the value of the assign clause is the file name. # # Value: `yes', `no' filename-mapping: yes [/code] But ... I like simple ... Try taking some hints from this filter template (stdin by assigning to KEYBOARD and stdout by assigning to DISPLAY). [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *><* =========== *><* filter *><* =========== *><* :Author: Brian Tiffin *><* :Date: 20090207 *><* :Purpose: Standard IO filters *><* :Tectonics: cobc -x filter.cob *> *************************************************************** identification division. program-id. filter. environment division. configuration section. input-output section. file-control. select standard-input assign to keyboard. select standard-output assign to display. data division. file section. fd standard-input. 01 stdin-record pic x(32768). fd standard-output. 01 stdout-record pic x(32768). working-storage section. 01 file-status pic x value space. 88 end-of-file value high-value when set to false is low-value. *> *************************************************************** procedure division. main section. 00-main. perform 01-open perform 01-read perform until end-of-file perform 01-transform perform 01-write perform 01-read end-perform . 00-leave. perform 01-close . goback. *> end main support section. 01-open. open input standard-input open output standard-output . 01-read. read standard-input at end set end-of-file to true end-read . *> All changes here 01-transform. move stdin-record to stdout-record . *> 01-write. write stdout-record end-write . 01-close. close standard-input close standard-output . end program filter. *><* *><* Last Update: dd-Mmm-yyyy [/code] Cheers, Brian ---------------------------------------------------------------- Thanks! Changing DA-S-SYSIN to KEYBOARD solved it! Do you know how to make READ ignore the final newline? or do I have to cut it off myself somehow? ---------------------------------------------------------------- KEYBOARD defaults to LINE SEQUENTIAL. It should strip off newlines automagically. newline in this case being x"0A", C's view of "newline". On a DOS based PC you may need to do some mucking about with the 13's (CR) that may get in the way. Gee ... I better not speak too loudly, need to run some tests ... Yep, here on my Debian box the 10's are stripped off each record. If you are not seeing that, then you can use a few techniques: COBOL sports a very nifty STRING verb [code] STRING stdin-record DELIMITED BY x"0A" INTO output-buffer END-STRING [/code] which will move all the characters up to the first newline of the stdin-record to the output buffer. Or ... [code] MOVE FUNCTON SUBSTITUTE(stdin-record; x"0A"; SPACE) TO stdin-record [/code] will use the new OpenCOBOL intrinsic function extension to substitute newlines for spaces. Or ... [code] COMPUTE trunc = LENGTH OF FUNCTION TRIM(stdin-record) - 1 END-COMPUTE MOVE stdin-record(1 : trunc) TO output-buffer [/code] using reference modification to crop off the last character of the string. [i]Note, I didn't test any of the above snippets ... beware typos and brain farts.[/i] But, I don't think you should see the newlines in your stdin-record buffers actually. [i]Aside[/i] We had a little coding contest here a while back. Take a look at http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=391&forum=1#forumpost2697 and the entry that human posted 2009/02/18 or in the FAQ at http://opencobol.add1tocobol.com/#what-is-cbl-oc-dump. Asger wrote a gem, and then human polished it a bit. It's a beauty for getting at the nitty gritty of the technical details of buffers. I use it all the time now. Snag the text out of the FAQ (I prefer the version where you pass the length) [code] $ cobc -c CBL_OC_DUMP.cob [/code] put [code] CALL "CBL_OC_DUMP" USING buffer len END-CALL [/code] in the code you are testing, then build your app with [code] $ cobc -x program.cob CBL_OC_DUMP.o [/code] [i]Aside 2[/i] I just updated the FAQ to include the filter.cob sample under http://opencobol.add1tocobol.com/#can-opencobol-be-used-to-write-command-line-stdin-stdout-filters Cheers, Brian ---------------------------------------------------------------- Oh, you're right. I just thought the newline was there because DISPLAY prints all the characters in the string, including all the blanks at the end, so I'm getting 255 chars of output when all I really want is the data from the input. This'll work for my purposes though. Thanks for your help! ---------------------------------------------------------------- Yeah, DISPLAY FUNCTION TRIM(str TRAILING) END-DISPLAY will get rid of all the trailing spaces for you if you are just printing out the data. Cheers, Brian ---------------------------------------------------------------- Subject: Some COBOL usage statistics http://www.jsayles.com/ibm/cobol/COBOL2009.htm Cheers, Brian ---------------------------------------------------------------- Good reading. Thanks :-) ---------------------------------------------------------------- Subject: OpenCOBOL treatment of * (comment) Hi, Why has the treatment of comment character, *, in pos 1 changed from ver 1.0 to current 1.1? The follwoing example code: *> ** >>SOURCE FORMAT IS FREE *> ********************************************************************* *> Author: *> Date: *> Purpose: *> Tectonics: cobc -free *> ********************************************************************* identification division. program-id.testing. environment division. configuration section. data division. working-storage section. 01 misc. 10 falt1 pic x(10). 10 num1 pic 9(9). 10 num2 pic 9(9). procedure division. starting section. start-par. move 10 to num1. move 20 to num2. compute num1 = num1 * num2. display num1 at 0701. accept falt1. stop run. gives: 000000200 in version 1.1 and 000000010 in version 1.0 also a * in pos 1 on an empty line or line with a statement generates an error compiling with version 1.1 but not version 1.0. I've read about it here on the forum but I still don't understand what the problem with the old behaviour is. Coming from Acucobol a line with an asterisk in pos 1 in free format source code has always been treated as a comment. Looking forward to an answer that really explains why I should have to change to *> in my 1500000+ lines system. regards, Hans ---------------------------------------------------------------- When you are doing free format, do not really put * in position 1. In fact, as RogerWhile says often, your programs should be able to compile in FREE format or FIXED format. To do that, DONT put code in positions 1 through 7. Comments should always start in position 7 and always have *>. There are some other rules you should follow that the others can explain (or correct if I have something awry). But it really is bad practice to have your programs so that they only compile in one or the other format. When you try to compile several together (or include .cpy files) that are following different formats, you're kicking yourself in the head over it. But if you make sure your programs/cpy files and such will compile in either, then you can mix and match no problem... The advntages of free aren't really that advantageous anyhow. ---------------------------------------------------------------- Thanks for the reply. What does the standard say? I've been programming in COBOL in 20+ years and have never seen the *> format. Maybe I have been lucky. There are compilers out there which can compile no matter how you mix free and fixed format. And why has the behaviour of OpenCOBOL changed from version 1.0 to version 1.1? regards, Hans ---------------------------------------------------------------- Even the ones that will compile both, will give mixed reactions. Especially if you mix free and fixed in your COPY statements. One file having FIXED and another having FREE can cause issues. Now regarding "why has it changed from 1.0 to 1.1", 1.1 is not released. 1.1 is experimental. While it is an excellent compiler, it is still in beta with changes coming often. Sometimes every day. So there are going to be quirks. ---------------------------------------------------------------- [quote] HansJ wrote: What does the standard say?[/quote] [quote] 2008 Draft - http://www.cobolstandard.info/wg4/open/WD1-10-pdf.zip - wrote on pages 22/23: [code]Fixed indicators may be specified in the indicator area of fixed-form reference format [...][column 7]. The following are fixed indicators: Character Indicator name Indicates * comment indicator a comment line / comment indicator a comment line with page ejection - (hyphen) continuation indicator a continuation line space source indicator any line that is not a comment line or a continuation line [...] Floating indicators may be used in fixed-form or free-form reference format. The following COBOL character-strings are floating indicators: Character-string Indicator name Indicates *> comment indicator 1) a comment line when specified as the first character-string in the program-text area; 2) an inline comment when specified following one or more character-strings in the program-text area, subject to the additional rules in 6.1.2.1, Syntax Rules.[...][/code][/quote] human ---------------------------------------------------------------- The ability to use a "*" rather than "*>" in column 1 of free form reference format is a COMMON extension to the Standard. Micro Focus has this; see the MFCOMMENT directive. Any "conforming to the '02 Standard" compiler will accept "*>" in columns 1-2 of the free form reference format as a comment line. Any comforming compiler ('85 or '02") will accept "*>" in columns 7-8 (with blanks in columns 1-6) as a comment line whether in fixed form or free form reference format. I agree with the recommendation to code all source code (original and COPY code) so that it will compile with either fixed for free format refence format. The only problem (and I don't know if this is still a problem) with doing this in OC, is the continuation of alphanumeric (or national) literals. In the '02 Standard, you may code something like [code] "ABC"- "XYZ" [/code] where the '85 Standard requied (for fixed format - the only format in that STandard) [code] "ABC - "XYZ" [/code] where the C of the first line was in column 71 (or just before the R-margin) and the "-" was in column 7. If OC has implmented the new form of literal continuation, then there is no reason why you should ever code source code that won't compile identically in fixed and free format. NOTE: I think that OC has ">>D" for debugging lines, but I know that OC isn't conforming for debugging lines any way so this is less an issue. NOTE2: For an '02 Standard conforming implementation, it is possible to have free from reference format in COPY code that is used by fixed form reference format main source. You do this by coding the SOURCE-FROMAT directive at the top of the COPY member. By default, the source format will "return" to the original format at the end of the COUY source code. ---------------------------------------------------------------- Many thanks for all replies. Very informative. I admit my ignorance. regards, HansJ ---------------------------------------------------------------- Subject: Unable to configure and make binaries Sorry, I've read the posts related to the message about checking for gmp.h... yes checking for __gmp_randinit in -lgmp... no configure: error: GMP 3 or later is required But .. swlist reports my installed version of gmp is 4.3.1 which I have installed, uninstalled, and reinstalled several times. I'm working on an older HPUX 11.0 system. If anyone knows how I can get past this error, or where I can download binaries, newer than 1.0.20071227, I would appreciate it. Version 1.0.20071227 doesn't allow the -fmfcomment directive! Thanks in advance, Karey In another thread essex suggested: export LDFLAGS="-L ... -L..." export CPPFLAGS="-I... -I..." ./configure --prefix=... That definitely helped, then I found: ./configure CC='gcc -fPIC' which has now let me compile GMP. NOW when I try to compile OC 1.1 I get: screenio.c: In function `cob_screen_attr': screenio.c:154: error: `COLOR_BLACK' undeclared (first use in this function) screenio.c:154: error: (Each undeclared identifier is reported only once screenio.c:154: error: for each function it appears in.) screenio.c:157: error: `COLOR_BLUE' undeclared (first use in this function) screenio.c:160: error: `COLOR_GREEN' undeclared (first use in this function) screenio.c:163: error: `COLOR_CYAN' undeclared (first use in this function) screenio.c:166: error: `COLOR_RED' undeclared (first use in this function) screenio.c:169: error: `COLOR_MAGENTA' undeclared (first use in this function) screenio.c:172: error: `COLOR_YELLOW' undeclared (first use in this function) screenio.c:175: error: `COLOR_WHITE' undeclared (first use in this function) screenio.c:211: error: `COLOR_PAIRS' undeclared (first use in this function) screenio.c:212: warning: implicit declaration of function `pair_content' screenio.c:217: warning: implicit declaration of function `init_pair' screenio.c:223: warning: implicit declaration of function `color_set' screenio.c:223: warning: implicit declaration of function `COLOR_PAIR' screenio.c:227: warning: implicit declaration of function `bkgdset' screenio.c: In function `cob_screen_init': screenio.c:282: warning: implicit declaration of function `has_colors' screenio.c:283: warning: implicit declaration of function `start_color' screenio.c:285: error: `COLOR_PAIRS' undeclared (first use in this function) screenio.c:290: warning: implicit declaration of function `getmaxyx' screenio.c: In function `cob_screen_puts': screenio.c:400: warning: implicit declaration of function `addnstr' screenio.c: In function `cob_screen_get_all': screenio.c:494: error: `KEY_BTAB' undeclared (first use in this function) screenio.c:560: error: `KEY_END' undeclared (first use in this function) screenio.c:596: warning: implicit declaration of function `ungetch' screenio.c: In function `cob_field_display': screenio.c:842: warning: implicit declaration of function `scrl' screenio.c: In function `cob_field_accept': screenio.c:982: error: `KEY_END' undeclared (first use in this function) *** Error exit code 1 ---------------------------------------------------------------- Subject: Reading DIRECT ACCESS files Hi, I am trying to read an old direct access file. Each record has a length of 128 bytes with no embedded key, just a sequence of as many records as fit into the filespace and containing mainly binary bigendian integers. When I try to read the first byte of the first record I seem to land on the fifth byte. Running an example program to create a direct access file seems to support my suspicion. The first 4 bytes are probably a "hidden" system field containing the length of the record. How do I have to set the FILE DESCRIPTION to be able to accress a file containing binary data fields only? I am running it on Kubuntu 9.04. Ray ---------------------------------------------------------------- Hello Ray, Each binary must be described. See the following "simple program" : it may help you to explain your problem. cobc -free -x rayfile.cob Source of rayfile.cob [code] *> Simple program for Ray and his Old Direct Access File identification division. program-id. rayfile. environment division. input-output section. file-control. select yourfile assign to disk, wyourfile-id organization is relative access mode is dynamic relative key is wyourfile-key file status is wyourfile-status . data division. file section. fd yourfile. 01 yourfile-item. 02 yourfile-data pic X(128). *> You must define your fields here working-storage section. 77 wyourfile-id pic X(060). 77 wyourfile-key pic 9(8). 77 wyourfile-status pic XX. procedure division. begin-here. move "YOURFILE" to wyourfile-id *> move the name of your "Old Direct Access File" here open input yourfile. *> *> close yourfile . stops-here. exit program. [/code] Where is your file coming from ? Regards Bear ---------------------------------------------------------------- Hi, first the relevant parts of the program: FILE-CONTROL. SELECT IndivFile ASSIGN TO "indiv.dat" ORGANIZATION IS RELATIVE ACCESS MODE IS DYNAMIC RELATIVE KEY IS RINKey FILE STATUS IS Indivstatus. .... FD IndivFile. 01 IndivRecord. 88 EndOfFile VALUE HIGH-VALUES. 02 SN binary-short. 02 GN1 PIC 9(4) comp. 02 GN2 PIC 9(4) comp. 02 GN3 PIC 9(4) comp. 02 IndivRest PIC X(120). .... WORKING-STORAGE SECTION. 01 IndivStatus PIC X(2). 88 RecordFound VALUE "00". 01 RINKey PIC 9(5). 01 PrnIndivRecord. 02 PrnRINKey PIC BB9(5). 02 FILLER PIC X VALUE ":". 02 PrnSurNameNr PIC BB9(5). 02 PrnGivenNameNr1 PIC BB9(5). 02 PrnGivenNameNr2 PIC BB9(5). 02 PrnGivenNameNr3 PIC BB9(5). ..... Now the first Hex-Edit line of the data file: 00000000 02 00 03 00 04 00 00 00 00 00 4D 03 00 05 00 98 07 00 00 00 00 00 00 00 ..........M............. It starts with the short integer number 2, then a 3 followed by a 4 in the fifth and sixth byte. When I read and display the content of this first record I get: 00001: 00004 00000 00000 19715 with the 19715 being the numerical interpretation of the character "M" and a 03 as high byte - four bytes to far into the record. So it looks to me as if the program treats the first four bytes of the record as a system field not to be made available to the programmer. To confirm this I run one of the example programs at: http://www.csis.ul.ie/cobol/examples/default.htm#Direct and I found that the first 4 bytes in each record of the RELSUPP.DAT contain the record length of hex 48. So what do I do if my file does not contain these hidden fields? Ray ---------------------------------------------------------------- Well, the 4 Bytes are the "Header" of each Record. As far as I can remember it contains the length and the status of the Record. I was searching for more detailed information, but could not find them now :-(. If you need moren information about the header - let me now. But back to your Problem, the file you write is not a "plain" text file containing only 0x0D0A (on windows systems) as a line separator. In your file each Record has a Header containing the length of the following record - so it is easy to manage a file with different record sizes but you must take care of the header in any other program (except opencobol/cobol progs) where you want to "read" this file. Maybe you shoul use "plain" text files instead? PS Now I found the information/page :-D [url=http://docs.hp.com/cgi-bin/doc3k/BB243390046.15153/53]http://docs.hp.com/cgi-bin/doc3k/BB243390046.15153/53[/url] As you can read there, there are different Record-Types - not all containen "Data" -> but in your case in a "new" file there should be only Data-Records. But depending on the length of the record, padding may occurs. Be aware of that :-) ---------------------------------------------------------------- Well, well, no matter how I declare the file in the FILE DESCRIPTION the program just declares the first 4 bytes of each record as a hidden field having to be of no interest to me. It is an old existing file with fixed length record - 128 bytes each - without any secretive file headers or record header, just simply 128 bytes of binary data. In other languages - like Perl - I can say "Read exactly 128 bytes starting from zero", "Read the next 128 bytes" etc. Here my latest try (with the same miserable result): FILE-CONTROL. SELECT IndivFile ASSIGN TO "indiv.dat" ORGANIZATION IS RELATIVE ACCESS MODE IS RANDOM RELATIVE KEY IS RINKey FILE STATUS IS Indivstatus. DATA DIVISION. FILE SECTION. FD IndivFile RECORDING MODE IS F RECORD CONTAINS 128 CHARACTERS. 01 IndivRecord. 88 EndOfFile VALUE HIGH-VALUES. 02 SN BINARY-SHORT. 02 GN1 BINARY-SHORT. 02 GN2 BINARY-SHORT. 02 GN3 BINARY-SHORT. 02 IndivRest PIC X(120). I just cannot access the first 4 bytes of each record. ---------------------------------------------------------------- I think the problem is the use of the term "direct acdcss"file. What I think you have is a "record sequential" fixed length file. This should be defined with [code] SELECT IndivFile ASSIGN TO "indiv.dat" ORGANIZATION IS Record Sequential ACCESS MODE IS Sequential FILE STATUS IS Indivstatus. [/code] Then [code] FD IndivFile RECORD CONTAINS 128 CHARACTERS. 01 IndivRecord. 88 EndOfFile VALUE HIGH-VALUES. 02 SN BINARY-SHORT. 02 GN1 BINARY-SHORT. 02 GN2 BINARY-SHORT. 02 GN3 BINARY-SHORT. 02 IndivRest PIC X(120). [/code] You won't be able to read that file in "random" access, but you will read all 128 bytes. If you want to create a "relative" file from that, then read that file and write a relative file (that will have the "hidden" fields that you don't want to use). ---------------------------------------------------------------- Hi, as there are no "holes" in the file and all the records are of equal length I could read it sequentially. Unfortunately I need to access it randomly. In my eyes any system that insists on prefixing fixed length records with this constant record length has a serious design flaw. I just cannot imagine that the original designers of COBOL made such a boob. It wastes space, it makes the file incompatible to other systems and languages it is a source for errors (what takes precedence? the prefix or the now incomplete FD), it curtails any flexibility (with minimal changes to the access logic I could define the records as being 64 or 256 bytes long). But I am quite willing to listen to any reasoning for the prefix. Ray ---------------------------------------------------------------- As wmklein pointed out: just read this file sequential and write the contents (without prefix) to a new ISAM file. Then use the new file for random access. human ---------------------------------------------------------------- Hi, having to convert a DA file to an ISAM file sounds more like a strong reason for not using this compiler. Ray ---------------------------------------------------------------- Sounds like you just don't understand that COBOL defines the "lgocial processing" of files and NOT how they are defined or accessed physically. You do NOT need to convert your sequential file to ISAAM, but you do need to convert it to a RELATIVE file. The COBOL language allows for the dynamic access aND creation fo records in a RELATIVE file. Therefore, it is highly unlikley that you will find ANY COBOL compiler that supports random acess of a relative file that has no PHYSICAL data to indicate records (missing and filled in). Feel free to try and find one if you think that is easier than doing a single (one-time) conversion of a sequential file (which is what you hve) to a relative file (which is what you want to use). NOTE: In some enviornments (such as IBM mainframes) the difference between sequential and relative files is MUCH greater than just a "header" field. ---------------------------------------------------------------- Hi, wmklein wrote: >NOTE: In some enviornments (such as IBM mainframes) the difference between sequential and relative files is MUCH greater than just a "header" field. IBM was and is still very apt at keeping system information - about file, block, record - seperate from user data (being a system developer on their machines since 1969 I should know). For fixed length records IBM never demanded that every record in random access mode be prefixed with this constant record length. It is not that I cannot convert all these files but I see this as a unreasonable demand and a flaw in the design of the compiler. Fortunately I did not throw away the Perl and QBasic scripts which have no touble processing these files. Til we meet again Ray ---------------------------------------------------------------- Subject: SCREEN SECTION Issues (RESOLVED) First, let me congratulate EVERYONE who's worked on the OpenCOBOL project - WHAT A TOOL! I do have a question about SCREEN SECTION support. First, the background. The first version of OC I tried was the OC 1.1 native Windows build available in binary form from http://kiska.net/opencobol - everything seemed to work except the SCREEN SECTION - all screen-related DISPLAY and ACCEPT statements whether or not they access a SCREEN SECTION item do nothing (in effect, they act like a CONTINUE statement). I then built a MinGW version of OC 1.1 (downloaded 2009/06/16 from the 1.1 link on the opencobol.org site) and found that - with the same test programs - IT WORKED! Just one problem - no colors or other visual attributes. I saw a similar problem in the forum but it was supposedly fixed a while back. So my question is this - what is the current "state of affairs" regarding the SCREEN SECTION? Is there any way to get it working in Sergey's Windows version? Is there something I can do to get colors/attributes working with my MinGW version? Thanks (in advance) for any advice that can be provided. ---------------------------------------------------------------- Can you please give a short description about the necessary steps to build OC with MinGW from scratch (no MinGW installed first)? There is a how-to about cygwin (where the colours seem to work), but a MinGW one is missing. Thank you in advance, human ---------------------------------------------------------------- I followed the steps documented at http://cobcurses.wiki.sourceforge.net/MinGW+Open-Cobol+Install making the following adjustments: 1 - I received many permission failures late in the process when attempting "make install" steps for the Berkeley DB package. I'm running Vista, so I ran the MSYS "rxvt" terminal tool via "Run As Administrator" and those issues went away. 2 - The "./configure" for OpenCobol failed to find a viable "curses" package, even though I installed "PDCurses" according to the directions at the website (those instructions were - I believe - originally created for OpenCobol 0.33). After digging through the "./configure" script it appeared that it wanted to find a "pdcurses.h" header file in the /mingw/include directory. The instructions had me create a "curses.h" folder. I renamed the header file from "curses.h" to "pdcurses.h" and re-ran "./configure". This time, it found PDCurses. The SCREEN SECTION and related DISPLAY and ACCEPT functions appear to work (pretty well) except for visual highlighting options. ---------------------------------------------------------------- With cygwin ncurses is used, not PDcurses. PDcruses seems to be a MinGW-Port of ncurses but maybe the needed stuff for colouring is not found in PDcurses or needs some other using within OC code. Which version of PDcurses did you've used? Do you tried both 3.3, which is mentioned at the given site, and the last release 3.4? human ---------------------------------------------------------------- I used the 3.4 version. I haven't tried 3.3 (yet, anyway). ---------------------------------------------------------------- No difference between 3.3 and 3.4. Some new info . . . The HIGHLIGHT attribute is working. It just appears that colors don't. It's like the good-old days of using a monochrome Lear Siegler, Hazeltine or VT100 terminal! Could there be some sort of runtime setting that turns "color display mode" on or off? While I'm at it, let me ask another question. Is there any way to affect the tab order in a SCREEN SECTION 01 group? I've defined my elementary items in line/column sequence and in desired tab order sequence and it seems to make no difference. ---------------------------------------------------------------- The root cause of the "NO COLOR" issue has been identified, and I've come up with a "fix" (band-aid?) that addresses it. See the "OpenCOBOL 1.1, MinGW, PDCurses & Color" thread. I'd STILL be interested in hearing any suggestions for changing the "tab order" of fields on a screen though. ---------------------------------------------------------------- PDCurses [1] is a UN*X SYSV curses clone, and will compile and run UN*X like systems as well as Win32 (not sure about Cygwin). The Win32 port was written as a separate project, and posted on a long forgotten web site. Later, it was integrated into the PDCurses sources. On a side note ... UN*X curses is an attempt to have a standard API (front end) to the many terminals, and pseudo-terminals, that once populated the UN*X landscape. The PDCurses Win32 port, is a front end to the Win32 Console API. So, most likely, there will be some incompatibilities between the two systems. Perhaps a better solution, for the OC run-time, would have been to call the Win32 Console API directly. Since OC does not currently support a native Win32 port, further investigation and Win32 fixes will be required for both MinGW and VC. 1) PDCurses - Public Domain Curses http://pdcurses.sourceforge.net/ ---------------------------------------------------------------- Subject: Problem with -ftrace and DISPLAY WITH NO ADVANCING Combining both leads to some weird displays: The following compiled with -ftraceall [code]DISPLAY 'STARTING TEST' WITH NO ADVANCING END-DISPLAY IF a = b DISPLAY ' GOING ON' END-DISPLAY END-IF IF ...[/code] leads to [quote]PROGRAM-ID: DISPTEST Line: 320 Statement: DISPLAY STARTING TESTPROGRAM-ID: DISPTEST Line: 327 Statement: IF PROGRAM-ID: DISPTEST Line: 345 Statement: DISPLAY GOING ONPROGRAM-ID: DISPTEST Line: 350 Statement: IF[/quote] Maybe -ftrace/-ftraceall should insert a line break and position to the current column if necessary. What do you think? human ---------------------------------------------------------------- I thought about this again. The easiest solution would be to trace everything into a file (optional), therefore check something like COB_TRACEFILE and if there is a valid file name put everything here (instead of stderr) human ---------------------------------------------------------------- TIP FOR NEWBIES: I've gotten into the habit of putting a "2> filename" onto the end of all program executions when I'm in development mode. That way any trace output as well as any runtime errors get separated from "real" output. SCREEN SECTION stuff still works correctly too. ---------------------------------------------------------------- Yes, you're right. But the problem stays the same if you do [code]DISPLAY UPON SYSERR[/code] human ---------------------------------------------------------------- Subject: Installing opencobol in an OpenSUSE Image in VMWare Hi, I am new to opencobol and linux. I have an OpenSUSE Linux image on my VMWare Player. So far I have already installed DB2, the libstdc++33, gcc-c++ (C++ compiler), and gmp-devel. Now I am trying to install OpenCobol but I run into several issues. make #This command causes many many error messages such as: 'struct indexed_file' has no member named 'db' II am not sure why I am getting this message. Can anyone provide any assistance? ---------------------------------------------------------------- You did ./configure before make? Did it said "all fine"? All errors should occur there, not at "make". It should tell you that some dependencies are not installed, see the file README. human ---------------------------------------------------------------- Subject: Reading COMP-3 from z/os Trying to read in a monster sized file created on z/os. Using its copybook with opencobol 1.1 on SUN10 (sparc).... the COMP-3 fields are not being groked by opencobol... Had a MF buddy create me a file thats pic 9(15) COMP-3 with the value: 000001234567890 od in hex shows it as this: 0000 0183 a4b7 690f but it is non-sensical to opencobol... wrote an OC program to write pic 9(15) comp-3. writing the same value and it looks ok in hex: 0000 0123 4567 890f So did my NDM mess datafile up, or do I have ebcdic or endian issues? thx for your help. JurgyMan ---------------------------------------------------------------- Hi, when I convert 01 23 45 67 89 0F from ASCII to EBCDIC the result is 01 83 A4 B7 69 0f so your guess with EBCDIC<->ASCII was right :-). Maybe you have converted it "to often" or not -> but I think you should not convert your file. It is not "good" to convert Files with packed Field between ASCII/EBCDIC - if possible try to read it "unconverted" in OC you can set for example the "BS2000" flag to read/write files in the ebcdic format. Have a look at the doc for more flags/options to set EBCDIC/ASCII file format. The "normal" converter does not know anything about "comp" fields - so a comp field with "45" is a big "E" (ASCII) for the converter -> a big "E" is C5 in EBCDIC. I hope this short example explains why it is not good to convert files containing binary/comp filed between ASCII/EBCDIC. [code] ASCII (comp-3) -> EBCDIC 45 (= "E") C5 (= "E") EBCDIC (comp-3) -> ASCII 45 (= "á") A4 (= "á") [/code] Gandalf PS Another "solution": Do not use packed fields in files that are transfered between systems with different encodings :-) PPS Do not forget that a lot of FTP Tools will convert the files automaticly when you select "Text" files - use the binary option to transfer them without changing it ---------------------------------------------------------------- Thanks so much for the detailed, thoughtful response. What threw me is the file has readable TEXT within it... Is EBCDIC printable chars [A-z] the same as ASCII? So yes the COMP3 data is packed and still ebcdic... When you say check to doc, do you mean the FAQ? Because thats the only substantive doc I find on opencobol... There BS2000 is only mentioned as a flag: -std=BS2000 to allow that dialect... doesnt appear to enforce EBCDIC. I'm trying to use the example code in faq RE: EBCDIC SPECIAL-NAMES. ALPHABET ALPHA IS NATIVE. ALPHABET BETA IS EBCDIC. PROCEDURE DIVISION. INSPECT variable CONVERTING ALPHA TO BETA But get these errors compiling: Error: syntax error, unexpected ALPHABET, expecting "end of file" Error: syntax error, unexpected "SPECIAL-NAMES", expecting "end of file" any assistance greatly appreciated. Its been about 16 years since I coded COBOL... Where can I find definitive OpenCobol doc/reference, and for COBOL in general reference doc? JM ---------------------------------------------------------------- No, the Characters A-Z,a-z have a different hex value. So when you convert a file between ASCII/EBCDIC the "printable" Characters are converted quiet corret (the "text" is readable in the other character set). But your problem is that a packed field could by representing a A-Z,a-z Character -> so it is converted (and there could also a problem with diffrent EBCDIC encodings - but i've never had any problem with this). I'm sorry to say so, but by mentioning the "EBCDIC Flag" I got mixed up/confused with MF-Cobol.NET and the OpenCobol compiler. I will have a closer look at the documentation of the OC Compiler if there is a chance to use EBCDIC Files. But if there is a chance - your Files should be not "readable" on your OC-System. What I mean is, there should be not readable "Text" when you open it with a standard editor with no ebcdic/ascii support. But I have also a question: Z/OS = EBCDIC??? Never heard about that? EDIT: As far as i understand the oc doc - there is a support of EBCDIC fields/characters. But the FileHandler might not be able to read the file if it is a ebdcid-isam file on a ascii system (without or qith convertig it to ascci). Please correct me if i am not right. It might even occur that the filehandler is not able to read an ebcdic LineSequential File on an ASCII System when it is not converted, because of the different indicators of the LineEnd/NextLine. As Far as i remember now MF-Cobol filehandler was able to do so, but with quiet a lot of limitations -> so i wrote my own ebcdic file-reader/writer with the CBL_READ/CBL_WRITE funtions. But i am not able/allowed to post this source code here :-(. ---------------------------------------------------------------- OK after figuring out howto force NDM to transfer file asis (ebcdic), I am having success looking at my comp-3 values! And I can use the: inspect ALPHANUMVAR converting beta to alpha trick to handle the ebcdic text fields. EXCEPT, I'm seeing inconsistent results decoding the packed decimal field.... like if its got trailing zeros, they disappear (decimal place introduced somewhere??) So i think i'll have to insist on no COMP-3 from SOR. Thanks for your help JM ---------------------------------------------------------------- If you have a "say" in how the filres are created on the mainframe, then the best thing to ask fo is that ALL numeric fields be defined as Usage Display Sign is Leadeing Separate If you then dcwnload those files (with EBCDIC -> ASCII conversion) bot the numeric and non-numeric fields will be readable. If your file inlcudes any COMP-??? fields (Binary, Packed-Decimal, or floating-point) then you will have conversion problems. Other COBOL products (such as IBM's and Micro Focus') have tools to "convert" files intellegently (i.e. change text fields but not packed/binary fields) but no such "generic" tool exists - that OC could use. NOTE WELL: Floaging Point (COMP-1 and COMP-2) fields are unusual on z/OS - but if you have any of thsee, then you will have a mor significant migration problem - as the IBM format is totally incompatible with any "norml" PC or Linux/Unix format. ---------------------------------------------------------------- 1) If you need to check a mainframe Cobol file, you could look at http://record-editor.sourceforge.net/; There are some basic notes on using with Mainframe-Cobol here http://record-editor.sourceforge.net/MainframeNotes.html 2) I could write a basic Smart Mainframe Cobol to Ascii Cobol conversion Utility (and leave Comp / comp-3 Cobol fields untouched) fairly easily (in Java - a couple of days work). I already have the all the access / conversion code. It will just be a matter of linking it together. The utility will be about 400kb The limitations on the utility I envision are: * No Comp-1 / Comp-2 Support * No Occurs Depending on * Single Record only * Result of Redefines will be unpredictable If any one is interested in the Conversion Utility, let me know / respond here ---------------------------------------------------------------- Subject: Screen generator - RM/Panels Hello, Exists any text screen generator for OpenCOBOL, something like RM/Panels? Thanks ---------------------------------------------------------------- Subject: C Program Calling Cobol Program Hello everybody. I need a C program that passes for a OpenCobol program a parameter (string or int). The C program should receive back a string of Cobol program. Someone would have a C program example? Tks Adriano Capobianco ---------------------------------------------------------------- Subject: C Program Calling Cobol Program Hello everybody. I need a C program that passes for a OpenCobol program a parameter (string or int). The C program should receive back a string of Cobol program. Someone would have a C program example? Tks Adriano Capobianco ---------------------------------------------------------------- There are quite a few samples of mixing C and OpenCOBOL in the FAQ on the leftside panel of the forum. The Lua example http://opencobol.add1tocobol.com/#can-opencobol-interface-with-lua might be useful. Cheers, Brian ---------------------------------------------------------------- Subject: COPY (cygwin/winxp) problem i don't speak linux. i don't speak c-whatever. and apparently i don't speak open-cobol. my first oc pgm contains 3 copy statements; one in working-storage, one in the screen section, and the third one in the procedure division. they are as follows: copy 'TOSws', 'TOSsc', and 'TOSpd'. 'cobc' says the first two do not exist, yet it finds the third one. 'copy' begins in cc13. it would be fine if 'cobc' had a listing option that yielded readable results. the -t option... leaves much to be desired. tia bob ---------------------------------------------------------------- i compiled again with -t and even though the compiler did not say that it could not find the third copy it did not in fact find the third copy. non of the 3 are being found. that should simplify things. 1) is it the single quotes? 2) i don't have a clue as to how oc/cygwin/winxp coordinate searches for files 3) btw... the copy files are in the same directory as the main program 4) i installed cygwin and oc using the guide supplied by bill klein at http://primacomputing.co.nz/cobol21/ShowMe.aspx?ptitle=Bill%20Klein%27s%20Open%20COBOL%20installation%20Guide&pcontent=documents/wmk.htm tia again. bob ---------------------------------------------------------------- i compiled again with -t and even though the compiler did not say that it could not find the third copy it did not in fact find the third copy. non of the 3 are being found. that should simplify things. 1) is it the single quotes? 2) i don't have a clue as to how oc/cygwin/winxp coordinate searches for files 3) btw... the copy files are in the same directory as the main program 4) i installed cygwin and oc using the guide supplied by bill klein at http://primacomputing.co.nz/cobol21/ShowMe.aspx?ptitle=Bill%20Klein%27s%20Open%20COBOL%20installation%20Guide&pcontent=documents/wmk.htm tia again. bob ---------------------------------------------------------------- COPY files are searched for: 1) in the directory containing the program being compiled 2) in the directory specified on the "-I" option to cobc 3) in the directory specified as the value of the COB_COPY_DIR environment variable Actually, I'm not sure of the EXACT sequence in which it searches those directories, but that's where it searches. One additional point ... the COB_COPY_DIR environment variable is actually specific to the 1.1 version of the compiler. The other two options still apply to 1.0, however. I don't have any experience with OpenCOBOL versions prior to 1.0 so I couldn't say how they worked. ---------------------------------------------------------------- Does the case (upper vs lower) of the copybook name used in the program match the case of the ".cpy" file? ---------------------------------------------------------------- [quote] CutlerGL wrote: COPY files are searched for: 1) in the directory containing the program being compiled 2) in the directory specified on the "-I" option to cobc 3) in the directory specified as the value of the COB_COPY_DIR environment variable Actually, I'm not sure of the EXACT sequence in which it searches those directories, but that's where it searches. One additional point ... the COB_COPY_DIR environment variable is actually specific to the 1.1 version of the compiler. The other two options still apply to 1.0, however. I don't have any experience with OpenCOBOL versions prior to 1.0 so I couldn't say how they worked.[/quote] thanks for your quick response. the copy books are in the same directory as the source file. from the listing file... # COBCPY : is not set i've been looking for the environmental variable 'cobcpy' to no avail. where can i find 'COB_COPY_DIR'? thanks again. bob ---------------------------------------------------------------- [quote] CutlerGL wrote: Does the case (upper vs lower) of the copybook name used in the program match the case of the ".cpy" file?[/quote] damn! and linux is case-sensitive. i'm learning. i gotta try it now. thanks. bob ---------------------------------------------------------------- SET COB_COPY_DIR=/usr/local/mycob (or whatever path is right) export COB_COPY_DIR ---------------------------------------------------------------- [quote] CutlerGL wrote: SET COB_COPY_DIR=/usr/local/mycob (or whatever path is right) export COB_COPY_DIR[/quote] therein lies a problem. the path begins 'd:\...' and i know linux doesn't speak windows paths... my environment is win/95 running cygwin. in a file that is full of aliases i have this line: alias d:='cd /cygdrive/d'. i'm not sure what cygdrive is or how to use it. my guess is that 'SET' is temp, and 'export' makes it permanent. thanks for your reply. bob ---------------------------------------------------------------- Your assumption about SET/EXPORT is correct (Windows does both in one command, UNIX/CYGWIN separate the two functions). I believe you may be able to mount the Windows folder you need (d:\...) to Cygwin as a UNIX filesystem by adding it to the mount table. Check out http://www.cygwin.com/cygwin-ug-net/using.html#mount-table ---------------------------------------------------------------- In standard cygwin environment all windows drives are mounted to /cygdrive/[i]drivename[/i]. Therefore you can use /cygdrive/d/[i]yourfolder[/i]. Just take sure all backslashes in yourfolder are slashes and all spaces in foldernames are escaped with backslashes, for example: [code]/cygdrive/d/myfolder\ with\ spaces/mysubfolder[/code] you can easily find the right folder by using TAB-Key for file/folder name completion. Try [code]cd /cygdrive/d/[/code] and press TAB instead of RETURN. human ---------------------------------------------------------------- i can see that using open-cobol will not be possible without learning linux; and that is more than i can obligate myself to at present. oc and cygwin are off the computer as of early this morning. you guys respond quickly and with good info. i appreciate that. thanks. bob qm has a windows version as well as a linux version. wouldn't having a windows version be a marketing plus for oc? just a thought. ---------------------------------------------------------------- As mentioned in the [url=http://opencobol.add1tocobol.com/ocfaq.html#are-there-pre-built-opencobol-packages]FAQ[/url] there is somebody who compiled OC and has pre build binaries for OC: http://www.kiska.net/opencobol/ The pre-releases are not always the same version as "latest tarball", but you can use them. BTW: They need Visual-C++ as C-Compiler [the express version works, too]. human. ---------------------------------------------------------------- Subject: display screen size the following code will not compile: display screen size 132 on exception continue end-display the compiler error reads 'Error: syntax error, unexpected SCREEN' help! tia bob ---------------------------------------------------------------- What are you trying to do with that statement? ---------------------------------------------------------------- [quote] CutlerGL wrote: What are you trying to do with that statement? [/quote] according to the cobol85 programmers guide this statement is the 'format 9 (screen size)' display statement that is used to 'set the default number of screen columns' (PERCobol Language Referance Manual pg 443). i want to set the default number of screen columns to 132. bob ---------------------------------------------------------------- [quote] CutlerGL wrote: What are you trying to do with that statement? [/quote] i have just now discovered the gems contained within the faq. looks like 'size' has not been implemented. i'm really glad i found those gems. bob ---------------------------------------------------------------- According to the 2008 draft ( http://www.cobolstandard.info/wg4/open/WD1-10-pdf.zip ) there are only two formats for DISPLAY and there is no SIZE clause. human ---------------------------------------------------------------- [quote] human wrote: According to the 2008 draft ( http://www.cobolstandard.info/wg4/open/WD1-10-pdf.zip ) there are only two formats for DISPLAY and there is no SIZE clause. human[/quote] and yet, in your faq, there it is. i am unable to make the required commitment to oc/linux that is required; so i'm off in other directions. thanks for you help. bob ---------------------------------------------------------------- [quote] bob wrote: and yet, in your faq, there it is.[/quote] Can you please be more detailed: Where can I find DISPLAY SCREEN SIZE in the FAQ? For the linux thing, have a look at the other. human ---------------------------------------------------------------- I just watned to confirm that the "DISPLAY SCREEN SIZE" syntax is NOT a part of any Standard that I know of (including ANSI, ISO, or X/Open) from 1985 thru the draft of the next ISO Standard. I would suggest checking the "COBOL85" programming guide (referenced in the original note) to see if this is a PerCOBOL extension. ---------------------------------------------------------------- Subject: OC-FAQ: Concerning FUNCTIONs Why are some titled "FUNCTION XYZ" (for example FUNCTION BYTE-LENGTH) and others only "XYZ" (for example TRIM)? Could this be identical for all FUNCTIONs, please (I suggest without the FUNCTION-prefix)? Missing FUNCTION (already implemented according to cobc --list-intrinsics): LOCALE-TIME-FROM-SECONDS It is not "TEST-DAY-YYYYMMDD" but "TEST-DAY-YYYYDDD". Description for TEST-DATE-YYYYMMDD: Tests if a date with the form YYYYMMDD is valid, returns 0 if yes. Description for YYYYDDD: Tests if a date with the form YYYYDDD is valid, returns 0 if yes. human ---------------------------------------------------------------- Thanks ... updated. I'm still using FUNCTION for a few of the content entries as these calls conflict with reserved words of the same name; will need to test a few things to see how these react with FUNCTION ALL INTRINSIC in the REPOSITORY. Thanks again. Cheers, Brian ---------------------------------------------------------------- If you want to add FUNCTION as a prefix, please do with all entries. It's easier to find the entries if they are in the same format. human ---------------------------------------------------------------- Done. Thanks again. Cheers, Brian ---------------------------------------------------------------- Subject: OpenCOBOL 1.1, MinGW, PDCurses & Color (Fix Submitted) Has anyone (else) built OpenCOBOL 1.1 in a MinGW environment using PDCurses and actually gotten color attributes (ACCEPT/DISPLAY, SCREEN SECTION) to work? If so, what version of PDCurses did you use? Did you have to do anything "special" to make it work? ---------------------------------------------------------------- Although the answers to your question would be very interesting, maybe you want to try the "Beta Binaries" from [url=http://www.kiska.net/opencobol/1.1/]kiska.net[/url] (they are build with VisualStudio and need Visual-C++ [the express version works, too] for compiling COBOL to C). human. ---------------------------------------------------------------- The kiska.net binaries were the first thing I tried. It appears that these versions were built with no curses support whatsoever. Programs compiled using the kiska.net binaries treat all extended ACCEPT/DISPLAY statements as no-ops (assembler term - they do nothing). I'm restarting my MinGW build from scratch. I've completed the PDCurses build and all the demos work as advertised - color included. NEXT - try the OpenCOBOL build again. :idea: ---------------------------------------------------------------- No good. Same thing. Next, I built a 1.1 version under Cygwin. Perfect! This doesn't solve my problem though. I need the OpenCOBOL compiler/runtime environment to be (1) Portable and (2) able to run from a flashdrive. I'm going to play with the Cygwin version, but I don't think that'll do the job. ---------------------------------------------------------------- [quote] CutlerGL wrote: The kiska.net binaries were the first thing I tried. It appears that these versions were built with no curses support whatsoever. Programs compiled using the kiska.net binaries treat all extended ACCEPT/DISPLAY statements as no-ops (assembler term - they do nothing).[/quote] Yes, I recognized it yesterday, too. Same thing with VC build from kiska.net project files. I try to add an option for using PDCurses there, as I try with VBISAM (I will make a new topic for that when I'm finished). [quote] CutlerGL wrote: I'm restarting my MinGW build from scratch. I've completed the PDCurses build and all the demos work as advertised - color included.[/quote] Do I understood it right: PDCurses demos, including color, worked; but OC 1.1 prerelease with this PDCurses build shows no colors, but all other extended DISPLAY/ACCEPT work. Right? If yes, there seems to be a problem with the PDCurses support. Maybe any of the guys diving into the OC source can help with submitting a patch? [quote] CutlerGL wrote: I need the OpenCOBOL compiler/runtime environment to be (1) Portable and (2) able to run from a flashdrive. I'm going to play with the Cygwin version, but I don't think that'll do the job.[/quote] It works, but you need all the generated dll's to be copied to the same folder, too. It should be at least the dlls from cygwin, oc (libcob), ncurses and libdb (if you had BDB in your ./configure). This would be the same for a VC build (but instead of cygwin/ncurses you would have PDCurses+VC Runtime). human BTW: You seem to not give up after short time, this is VERY good! Keep it that way. ---------------------------------------------------------------- I'm now comparing the OC code generated from my MinGW build against the OC code generated from my Cygwin build. I'm ASSUMING they'll look very similar if not identical. The next step will be to compare the OC runtime source of the two versions. I'm confident this will get to the bottom of the problem. NO COMPUTER BEATS ME (for long, anyway). :hammer: RESULTS (Thus far): OC-generated source code is IDENTICAL between the two versions (I expected this actually). Now for the OC runtime. This I DO expect to be different. Sigh. I guess I'll gave to really dig into the linkage differences between ncurses (Cygwin) and PDCurses (MinGW). ---------------------------------------------------------------- cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Jul 11 2009 10:51:01 Packaged Feb 06 2009 10:30:55 CET ---------- It took a while, but I finally found out WHY OpenCOBOL 1.1 builds using MinGW and PDCurses couldn't use color. The following is the (fixed) code of the cob_screen_init() function in OpenCOBOL's "screenio.c" module. The comments describe the problem and the fix. [code] static void COB_NOINLINE cob_screen_init (void) { char *s; /******************************************************************************* ** BUGFIX - No color when using PDCurses - loop counter needed by upcoming ** ** 'for' loop. ** *******************************************************************************/ #ifdef HAVE_LIBPDCURSES short i; #endif /******************************************************************************* ** END BUGFIX ** *******************************************************************************/ if (!cob_screen_initialized) { s = getenv ("COB_SCREEN_EXCEPTIONS"); if (s) { if (*s == 'Y' || *s == 'y') { cob_extended_status = 1; s = getenv ("COB_SCREEN_ESC"); if (s) { if (*s == 'Y' || *s == 'y') { cob_use_esc = 1; } } } } fflush (stdout); fflush (stderr); if (!initscr ()) { cob_runtime_error ("Failed to initialize curses"); cob_stop_run (1); } cbreak (); keypad (stdscr, 1); nl (); noecho (); if (has_colors ()) { start_color (); pair_content ((short)0, &fore_color, &back_color); if (COLOR_PAIRS) { cob_has_color = 1; } /******************************************************************************* ** BUGFIX - No color when using PDCurses - PDCurses inits all color pairs to ** ** whatever fg/bg the screen had when pgm started running, whereas ** ** OpenCOBOL expects them to have been initialized to 0,0. With ** ** PDCurses, cob_screen_attr() can't find an 'empty' color pair to ** ** use, so it just gives up and goes monochrome! Note that this fix ** ** leaves the first color pair unchanged (so the default colors are ** ** available right up-front. This isn't the most elegant solution, ** ** but it does work! ** *******************************************************************************/ #ifdef HAVE_LIBPDCURSES for (i = 1; i < (size_t)COLOR_PAIRS; i++) { init_pair ((short)i, (short)0, (short)0); } #endif /******************************************************************************* ** END BUGFIX ** *******************************************************************************/ } attrset (A_NORMAL); getmaxyx (stdscr, cob_max_y, cob_max_x); cob_screen_initialized = 1; } } [/code] :-D :-D :-D ---------------------------------------------------------------- Thank you for submitting this patch. Let's see what Roger says to it when he show up again. human ---------------------------------------------------------------- It's better to not ask for the name of the curses header (pdcurses has curses.h and compiling OC works fine without renaming it) but for the library that needs the fix. Therefore better ask for [code]#ifdef HAVE_LIBPDCURSES[/code] I did this change to the fix and it worked fine! human BTW: If possible please edit your previous post and add [ code][ /code] (without spaces) around your fix, maybe you want to change it to HAVE_LIBPDCURSES in the same run ---------------------------------------------------------------- Thanks for the "#ifdef HAVE_LIBPDCURSES" tip. ---------------------------------------------------------------- Subject: Bug: Compiler shows the wrong place if section not found [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. 'TESTPGM3'. *----------------------------------------------------------------- PROCEDURE DIVISION. *----------------------------------------------------------------- main section. 00. perform not-there * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program TESTPGM3 ------------------------------------- [/code] and [code]cobc -Wall -debug TESTPGM3.CBL[/code] leads to [quote]TESTPGM3.CBL: In paragraph 'ex': TESTPGM3.CBL:9: Error: 'not-there' undefined[/quote] Line number is fine, but shouldn't the message be [quote]TESTPGM3.CBL: In paragraph '00': TESTPGM3.CBL:9: Error: 'not-there' undefined[/quote] BTW: Is it possible to display the SECTION name, too? human ---------------------------------------------------------------- Subject: Questions about compiling with VC 2005/2008: manifest, exp, lib OC calls mt.exe for including the manifest. Therefore the manifest could be deleted after building. The files %s.exp and %s.lib could be deleted, too, couldn't they? It would be good if cobc.exe would delete these files after including the manifest. If compiled with -save-temps, these could stay. What do you think? human ---------------------------------------------------------------- [quote] human wrote: It would be good if cobc.exe would delete these files after including the manifest. If compiled with -save-temps, these could stay. What do you think? human[/quote] That make sense. ---------------------------------------------------------------- Can you provide a patch for these files to be deleted if -save-temps is not used and these files to be moved to dir if -save-temps= is used? human ---------------------------------------------------------------- [quote] ska wrote: Patch to cobc.c with your patches applied [code] *** cobc.c.human 2009-07-28 11:39:20.000000000 -0400 --- cobc.c 2009-07-28 14:05:39.000000000 -0400 *************** *** 1465,1472 **** --- 1465,1478 ---- sprintf (buff, "mt /nologo /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); } ret = process (buff); + sprintf (buff, "%s.dll.manifest", name); + cobc_check_action (buff); } #endif + sprintf (buff, "%s.exp", name); + cobc_check_action (buff); + sprintf (buff, "%s.lib", name); + cobc_check_action (buff); #else /* _MSC_VER */ sprintf (buff, "%s %s %s %s %s %s %s %s -o %s %s %s", cob_cc, gccpipe, cob_cflags, cob_define_flags, COB_SHARED_OPT, *************** *** 1520,1527 **** --- 1526,1539 ---- } ret = process (buff); + sprintf (buff, "%s.dll.manifest", name); + cobc_check_action (buff); } #endif + sprintf (buff, "%s.exp", name); + cobc_check_action (buff); + sprintf (buff, "%s.lib", name); + cobc_check_action (buff); #else /* _MSC_VER */ sprintf (buff, "%s %s %s %s %s %s -o %s %s %s", cob_cc, gccpipe, COB_SHARED_OPT, cob_ldflags, COB_PIC_FLAGS, *************** *** 1604,1611 **** --- 1616,1629 ---- sprintf (buff, "mt /nologo /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); } ret = process (buff); + sprintf (buff, "%s.dll.manifest", name); + cobc_check_action (buff); } #endif + sprintf (buff, "%s.exp", name); + cobc_check_action (buff); + sprintf (buff, "%s.lib", name); + cobc_check_action (buff); #else /* _MSC_VER */ sprintf (buffptr, "%s %s %s %s %s %s -o %s %s %s", cob_cc, gccpipe, COB_SHARED_OPT, cob_ldflags, COB_PIC_FLAGS, *************** *** 1676,1681 **** --- 1694,1701 ---- sprintf (buff, "mt /nologo /manifest \"%s.exe.manifest\" /outputresource:\"%s.exe\";#2", name, name); } ret = process (buff); + sprintf (buff, "%s.exe.manifest", name); + cobc_check_action (buff); } #endif #else /* _MSC_VER */ [/code][/quote] I've added the .obj files, too. Here is a patch for the file from Sergey [code]1476,1477d1475 < sprintf (buff, "%s.obj", name); < cobc_check_action (buff); 1537,1538d1534 < sprintf (buff, "%s.obj", name); < cobc_check_action (buff); 1630,1633d1624 < for (f = l; f; f = f->next) { < sprintf (buff, "%s.obj", f->object); < cobc_check_action (buff); < }[/code]. human ---------------------------------------------------------------- Not that fast ! [code] 1537,1538d1534 < sprintf (buff, "%s.obj", name); < cobc_check_action (buff); [/code] 1. cobc -m a.obj Do you want to remove a.obj ? 2. Connected to 1 - there is a bug in all versions of OC which didn't come to my attention Patch before your patch: [code] *** cobc.my 2009-07-28 14:05:39.000000000 -0400 --- cobc.c 2009-07-29 11:25:02.000000000 -0400 *************** *** 1506,1513 **** --- 1506,1515 ---- #endif } else { file_basename (fn->source, name); + #ifndef _MSC_VER strcat (name, "."); strcat (name, COB_MODULE_EXT); + #endif } #ifdef _MSC_VER sprintf (buff, gflag_set ? [/code] ---------------------------------------------------------------- There are different functions for different compilings. But you are right, it's important to look where the .obj should be removed and where not. Does anybody know this or is debugging that one? human ---------------------------------------------------------------- Subject: Compiler Directives >>SOURCE FORMAT IS only without "*"? I'm a little bit confused. I took an old sample (and did small changes)[code]OCOBOL*>>SOURCE FORMAT IS FREE identification division. program-id. ROGERS. *> *> Specially Built For Accept Statement Playing ;-D *> environment division. configuration section. source-computer. Debian-Etch. object-computer. Debian-Etch. data division. working-storage section. 01 w pic X(001). 01 funkey pic 9(04). procedure division. debut. display "TESTING Function Keys" *> I'm not shure that this text is really line 03 column 33 with *> displayed at the right line/col position foreground-color 1 background-color 7 blank screen end-display . perform until w = "Q" or "q" display "Enter something : " line 10 col 32 with erase eos foreground-color 1 background-color 7 end-display accept w line 10 column 50 with foreground-color 2 background-color 7 prompt reverse-video auto on exception perform except-key not on exception perform normal-key end-accept end-perform go to fin. . except-key. move COB-CRT-STATUS to funkey *> Special word display "Exception Key = " line 12 column 30 end-display display funkey line 12 col 46 with foreground-color 7 background-color 4 highlight end-display call "C$SLEEP" using "1" end-call . normal-key. move COB-CRT-STATUS to funkey display "Normal Key = " line 12 column 30 end-display display funkey line 12 col 43 with foreground-color 7 background-color 2 highlight end-display call "C$SLEEP" using "1" end-call . fin. display "GAME OVER !" line 24 column 38 with foreground-color 7 background-color 4 highlight bell BLANK LINE end-display call "C$SLEEP" using "1" end-call . ultime. exit program.[/code] I compiled with the latest tarball in cygwin environment. [quote]$ cobc -W -Debug ROGERS.cob ROGERS.cob:1: Error: Invalid indicator 'f' at column 7[/quote] Shouldn't "SOURCE FORMAT IS FREE" tell the compiler to use free format even if * is placed in column 7? Shouldn't it be "line 3" instead of "line 1" (the compiler complains about the f in identification division)? If this is the right behaviour, the samples in OC-FAQ should be updated. If I remove the * in column 7 the compiling works. human ---------------------------------------------------------------- In the FAQ, I cheat again. The ReStructuredText syntax highlighter is indentation sensitive. I normally comment out *>>SOURCE FORMAT IS FIXED but try not to with the FREE samples. It is just a hack trick to ensure there is no de-indent early in the code block; sadly the comment only works for FIXED, being the default, so I'll try and change the rst hack. Cheers, Brian ---------------------------------------------------------------- To reply to the original question. If the first source-foirmat line has [code]*>>SOIURCE-FOMRAT is FREE [/code] where the "*" is in column 7, then this should be treated as a comment line (as the default is fixed format - and ANY line with an "*" in column 7 is a comment line) If the "*" were in column 6, then I think (but am not positive) that this would be a valid SOURCE FORMAT directive line (as columns 1-6 are ignored in fixed format) ---------------------------------------------------------------- Thank you both for the answer. I'm using [code] >> SOURCE FORMAT IS FREE/FIXED[/code] without comment indicator from now on. Works fine. ---------------------------------------------------------------- Subject: SOLVED: Problems with OC compiled via VC 2008 I compiled OC with VC 2008 using kiska.net project files (converted from 2005 to VC 2008) and a slightly changed config.h (the one from kiska.net give the same results). Compiling OC worked fine, but compiling COBOL with the resulted cobc results in C-Errors. Therefore I compiled the "smallest hello world sample" with both versions (cobc -Debug -free -save-temps HELLO.cob) and compared the c-files. Maybe anyone of you can tell me why these are different and what I can do to make it work. First the error output: [quote]HELLO.c HELLO.c(43) : error C2079: 'module' uses undefined struct 'cob_module' HELLO.c(43) : warning C4047: 'Initialize': Count of Dereference at 'int' and 'void *' different HELLO.c(43) : error C2078: To many Initializes HELLO.c(61) : error C2224: The left part of '.next' has to be a Struct/Union HELLO.c(62) : warning C4133: '=': Incompatible Types - from 'int *' to 'cob_module *' HELLO.c(71) : error C2224: The left part of '.next' has to be a Struct/Union[/quote] Differences in hello.c.h cygwin: [code]/* Frame stack declaration */ struct cob_frame { int perform_through; void *return_address; };[/code] vc2008: [code]/* Frame stack declaration */ struct cob_frame { int perform_through; int return_address; };[/code] Differences in hello.c cygwin: [code]/* Function prototypes */ int HELLO (void); static int HELLO_ (const int);[/code] There is no /* Frame stack jump table */ entry vc2008: [code]/* Function prototypes */ __declspec(dllexport) int HELLO (void); static int HELLO_ (const int); /* Frame stack jump table */ P_switch: cob_fatal_error (COB_FERROR_CODEGEN);[/code] Thank you in advance, human ---------------------------------------------------------------- [quote]HELLO.c HELLO.c(43) : error C2079: 'module' uses undefined struct 'cob_module' [/quote] I'm wondering how that could possibly be, when a struct cob_module is defined in common.h, and common.h is included from libcob.h ??? Try to set environment manually from command line, like mine: G:\skatests\cobol>h:\VisualNet8\VC\bin\vcvars32.bat G:\skatests\cobol>"H:\VisualNet8\Common7\Tools\vsvars32.bat" Setting environment for using Microsoft Visual Studio 2008 x86 tools. G:\skatests\cobol>SET WD=g:\open-cobol\build_windows G:\skatests\cobol>SET PATH=%WD%\win32\debug;%PATH% G:\skatests\cobol>SET COB_CFLAGS=-I %WD%\.. -I %WD%\win32 -I %WD% G:\skatests\cobol>SET COB_CONFIG_DIR=%WD%\..\config G:\skatests\cobol>SET COB_LIBS=%WD%\win32\debug\libcob.lib %WD%\win32\gmp.lib G:\skatests\cobol>cobc -x test.cbl ... [quote] /* Frame stack declaration */ [/quote] GNU has a "computed goto", the rest of compilers do not. So the call stack implementation is different. ---------------------------------------------------------------- You have pointed me in the right direction... If you compile OC yourself, it is better to change paths in defaults.h to the right ones (don't forget to use \\ instead of \ there). If you do not compile it yourself, it is better to write a short batch file that includes the stuff mentioned by Sergey. Compiling/running works now. human ---------------------------------------------------------------- Subject: libcob: Cannot find module 'xxoggi.int' Hi people, I am trying to compile a program (named ACI.cbl) calling a subprogram, named xxoggi.int with this cobol code: CALL "xxoggi.int" USING LA-DATA Is there anybody who has an example of the compilation and the linking? I tryed the following instructions for compiling: cobc -x aci.cbl cobc -x xxoggi.cbl mv xxoggi xxoggi.int Trying to execute with: ./aci ...I received this error message: libcob: Cannot find module 'xxoggi.int' Can anyone help me? Thanks a lot... ---------------------------------------------------------------- xxoggi seems to be no main prog (because of USING). Therefore it should be compiled without -x: [code]cobc xxoggi.cbl[/code] or [code]cobc -m xxoggi.cbl[/code] Only main progs should be compiled with -x. If possible, remove the .int in call (and if you ask me, add the end-call): [code]CALL "xxoggi" USING LA-DATA END-CALL[/code] If not, try to change the PROG-ID in xxoggi to xxoggi.int and compile it with [code]cobc -o xxoggi.int.so xxoggi.cbl[/code] (for not needing to do the mv command) human BTW: I recommend to compile with -Wall -Wterminator find possible mistakes. ---------------------------------------------------------------- Subject: ./configure error when I try to ./configure or ./configure --with-cc=gcc-4 CC=gcc-4 --with-gnu-ld it said... configure:1593: checking for a BSD-compatible install configure:1648: result: /usr/bin/install -c configure:1659: checking whether build environment is sane configure:1702: result: yes configure:1767: checking for gawk configure:1783: found /usr/bin/gawk configure:1793: result: gawk configure:1803: checking whether make sets $(MAKE) configure:1827: result: no configure:1991: checking whether to enable maintainer-specific portions of Makefiles configure:2000: result: no configure:2136: checking for gcc configure:2165: result: no configure:2136: checking for xlc configure:2165: result: no configure:2136: checking for cc configure:2165: result: no configure:2177: error: no acceptable C compiler found in $PATH Anything I can do for fix this? please advise. :-? Thank a lot ---------------------------------------------------------------- Are you sure you have a C-compiler installed? Try to do so The install procedure of C-Compiler depends on the unix you are using - cygwin? suse? redhat? some info needed. ---------------------------------------------------------------- Subject: Bug in FUNCTION TRIM [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. TRTEST. DATA DIVISION. * WORKING-STORAGE SECTION. 77 mychar pic x. * 01 aGroup. 05 Num1 Pic 9. 05 Group2. 10 Elem occurs 0 to 9 times depending on Num1 Pic X. *----------------------------------------------------------------- PROCEDURE DIVISION. *----------------------------------------------------------------- main section. 00. DISPLAY '"' FUNCTION TRIM(' ' TRAILING) '"' END-DISPLAY DISPLAY '"' FUNCTION TRIM(' ' LEADING ) '"' END-DISPLAY DISPLAY '"' FUNCTION TRIM(' ' ) '"' END-DISPLAY Move 1 to Num1 Display Num1 ': "' Group2 '"' END-DISPLAY Move 0 to Num1 Display Num1 ': "' Group2 '"' END-DISPLAY accept mychar end-accept * continue. ex. stop run. *----------------------------------------------------------------- *--- End of program TRTEST ---------------------------------------[/code] leads to [quote]" " " " " " 1: " " 0: ""[/quote] This seems wrong, according to the 2008 draft:[quote]If argument-1 contains all spaces or argument-1 is of length zero, the returned value is of length zero.[/quote] human ---------------------------------------------------------------- human; This may be wrong information, but it's what I believe to be true... COBOL has historically been leery of zero lengthed items. FUNCTION TRIM will always return something, this is OC design intent. Although OpenCOBOL might allow zero length fields someday, it opens up some weirdly deep thingys. Envision the PICTURE clause for a zero length item ... ??? So once this goes in, it will have to be a ubiquitous change and will effect the entire OC system. Cheers, Brian ---------------------------------------------------------------- ... maybe, but this is a BUG, isn't it? ---------------------------------------------------------------- COBOL has supported zero-length group items for quite a while. Concisder: [code] 01 aGroup. 05 Num1 Pic 9. 05 Group2. 10 Elem occurs 0 to 9 times depending on Num1 Pic X. ... Move 0 to Num1 Display '"' Group2 '"'. [/code] There is also a "work item" for the introduction of a zero-length literal - which currently does NOT exist in Standard COBOL. This does appear to be a "bug" in TRIN. ---------------------------------------------------------------- For every wondering if the zero-length in group items work in OC, they do. I changed my sample in the first post to test/show that. human ---------------------------------------------------------------- Subject: *BUG* With INITIALIZE Of EXTERNAL ? Perhaps there's something I don't know about the rules, but an attempt to INITIALIZE an item flagged as EXTERNAL failed (no error message, it just didn't do anything). No problem doing an INITIALIZE on a group subordinate to the EXTERNAL item though, so the work-around is pretty simple. Is this a "feature" or a BUG? OpenCOBOL 1.1 built under MinGW. ---------------------------------------------------------------- If you submit a bug, please do always the following: - give the "Packaged on" info - submit a test program - submit the result and if necessary, the intended result I do this for you this time [quote]$ cobc -version cobc (OpenCOBOL) 1.1.2 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Jul 02 2009 09:38:00 Packaged Feb 06 2009 10:30:55 CET[/quote] [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. INITTST. DATA DIVISION. * WORKING-STORAGE SECTION. 77 mychars pic x(20) value 'VVV'. 77 mychars2 pic x(20) value 'VVV' external. *----------------------------------------------------------------- PROCEDURE DIVISION. *----------------------------------------------------------------- display 'At program start (with value clauses):' x'0D0A' 'normal var: "' mychars '"' x'0D0A' 'external var: "' mychars2 '"' x'0D0A0D0A' end-display * move all 'A' to mychars, mychars2 display 'After MOVE:' x'0D0A' 'normal var: "' mychars '"' x'0D0A' 'external var: "' mychars2 '"' x'0D0A0D0A' end-display initialize mychars, mychars2 display 'After INITIALIZE:' x'0D0A' 'normal var: "' mychars '"' x'0D0A' 'external var: "' mychars2 '"' x'0D0A0D0A' end-display initialize mychars, mychars2 all to value display 'After INITIALIZE ALL TO VALUE' ' (Should this work with EXTERNALs?):' x'0D0A' 'normal var: "' mychars '"' x'0D0A' 'external var: "' mychars2 '"' end-display accept mychars end-accept * goback. *----------------------------------------------------------------- *--- End of program INITTST -------------------------------------- [/code] leads to [code]$ cobcrun.exe INITTST At program start (with value clauses): normal var: "VVV " external var: " " After MOVE: normal var: "AAAAAAAAAAAAAAAAAAAA" external var: "AAAAAAAAAAAAAAAAAAAA" After INITIALIZE: normal var: " " external var: "AAAAAAAAAAAAAAAAAAAA" After INITIALIZE ALL TO VALUE (Should this work with EXTERNALs?): normal var: "VVV " external var: "AAAAAAAAAAAAAAAAAAAA"[/code] This seems like a very hard bug to me. human ---------------------------------------------------------------- Well, "Declarations having the EXTERNAL clause cannot have VALUE clauses. The exception is the 88 level items. The 88 level items can have VALUE clauses associated with them. Using EXTERNAL on a group item makes the group item and all those items subordinate to it externally visible." but... "When the statement is written without the REPLACING phrase, data items of the categories alphabetic, alphanumeric, and alphanumeric-edited are set to spaces. Data items of the categories numeric and numeric-edited are set to zeros. In this case, the operation is as if each affected data item is the receiving area in an elementary MOVE statement with the indicated source literal (that is, spaces or zeros)." I Think, that the external Field should be filled with spaces because ist is an alphabetic field. Even if there is no value clause allowed. Maybe cobc sets a "standard" value internaly and does not do so for external fields because they aren't allowed to have this caluse??? ---------------------------------------------------------------- You talk about "INITIALIZE var ALL TO VALUE" (I added this to the sample above). I'm not sure if this should work on EXTERNAL items or not. ---------------------------------------------------------------- The restrcition on VALUE clauses with EXTERNAL items was true in the '85 Standard, but NOT in the '02 Standard. See the substantive change that states, [quote] 145) VALUE clause ignored in external data items and in linkage and file sections. The data-item and table formats of the VALUE clause may be specified in data descriptions in the linkage section and in the file section and for items described with the EXTERNAL clause. These VALUE clauses are ignored except during the execution of an explicit or implicit INITIALIZE statement. [/quote] It is also true that in the '85 Standard INITIQALIZE should "correctly? initialize (external or NOT external) items vased on their category, i.e. in this case to spaces - when no ohter phrase is specified. ---------------------------------------------------------------- Just to end this topic: Tested with upcoming version (OC 2.0), everything works correct there, [code]$ cobcrun INITTST At program start (with value clauses): normal var: "VVV " external var: " " After MOVE: normal var: "AAAAAAAAAAAAAAAAAAAA" external var: "AAAAAAAAAAAAAAAAAAAA" After INITIALIZE: normal var: " " external var: " " After INITIALIZE ALL TO VALUE (Should this work with EXTERNALs?): normal var: "VVV " external var: "VVV "[/code] human ---------------------------------------------------------------- Subject: SCREEN SECTION Accept : Use of "Ins" and "Del" keys When I press the INS or DEL keys during an ACCEPT of a SCREEN SECTION item an actual data character is generated (different characters for "real" INS/DEL and numeric keypad INS/DEL. Is there any magic option or environment variable that will transform those into functional editing keys or is this just a limitation of the SCREENIO module? ---------------------------------------------------------------- Well, I would expect them to be different characters - at least they are different keys on you keybord :-D .But I know what you mean - but I think an "or" or an level 88 should and could help you there. For me this is not a bug - I think both views of the characters that should be returned are "understandable" :-). In my opinion, it is "better" if different characters for different keys are returned and the programmer have to take some extra care about that. Beacause when you need to distinguish between the characters it would be impossible to do so when both keys are represented by the same character :-( . And there are a lot of chances where you use the numeric keypad and normaly don't want to use the ins/del key's - without activating/deactiving num (maybe give the user are warning that num is in the wrong state?) ---------------------------------------------------------------- I believe that the original poster wants INS and DEL to be edit keys. Like HOME is. Basically, allow more sophisticated field edits. I would certainly appreciate it (and this I can hack into the system myself). Just like ESC is either ignored or returned, but with some results (toggle insert/overwrite, del deletes characters right, backspace can delete characters left. but I would only implement delete character behaviour if the mode is "insert"). That sort of thing Also, I would want some cursor control options (size, blink). Some terminal programs don't work well with the setup used by OpenCOBOL 1.1. I NEED this functionality, and will hack it in myself (my other requests are just "nice to have"). ---------------------------------------------------------------- Subject: FR to -Wunreachable (FIX submitted): ignore CONTINUE and tell what statement is unreachable [code]go to 10. continue. 10.[/code] with -Wunreachable leads to "Warning: Unreachable statement". Because of CONTINUE beeing no real statement I'd like CONTINUE to be ignored. Is this a valid feature request? It would be nice to show the statement, that is unreachable, too. human ---------------------------------------------------------------- Is it not a "real" statement? Well, at last it is a kind of a place holder for a statment... but in this "place" any code would be unreachable. For me it is OK that the continue statment gives the "unreachable" warning in your example. [code] IF x > 0 THEN CONTINUE ELSE X * -1 END-IF [/code] OK, it is a realy short example, but what I want to show - here the code is not unreachable if it ever become unreachable you may have a serious error/mistake in your code. In this case i want to know if it is unreachable. ---------------------------------------------------------------- -Wunreachable only work for GO TO and EXIT at the moment, see the examples [code] go to b [b]continue[/b]. b. continue[/code] or [code]exit. [b]continue[/b][/code] What you like to have is something like [code]if 1 = 0 [b]continue[/b] end-if[/code] This would be cool, yes. But back to the FR. If CONTINUE is the only statement that is unreachable I wouldn't mind, because CONTINUE is only a place holder and is never executed. The request to be able to have a warning for both would need another option. Maybe we could have [code]-Wunreachable Warn of unreachable statements (NOT set with -Wall) -WunreachableAll Warn of unreachable statements including CONTINUE (NOT set with -Wall)[/code] human ---------------------------------------------------------------- Fix for ignore CONTINUE totally in -Wunreachable and to show the name of the unreachable statement (changed in BEGIN_STATEMENT of parser.y) [code] if ((((char *)name) != "CONTINUE") && cb_warn_unreachable && check_unreached) { cb_warning (_("Unreachable statement '%s'"), ((char *)name)); }[/code] resulting in the COBOL source[code] go to ex CONTINUE move '!' to myvar continue. ex.[/code] leading to [quote]MYPROG.COB:94: Warning: Unreachable statement 'MOVE'[/quote] instead of the old [quote]MYPROG.COB:93: Warning: Unreachable statement MYPROG.COB:94: Warning: Unreachable statement MYPROG.COB:95: Warning: Unreachable statement[/quote] human BTW: ((char *)name) is always uppercase, therefore we don't have to check the lowercase one ---------------------------------------------------------------- Subject: copy (partial word replacement) Does oc do copy partial word replacement? My test for this is not working: COPY screenio * works: replacing COB-COLOR-RED by COB-COLOUR-RED * does not work: replacing ==COB-COLOR== BY ==COB-COLOUR== . Version: cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Packaged Feb 06 2009 10:30:55 CET ---------------------------------------------------------------- Try using the "LEADING" phrase of REPLACING (this was introduced in the '02 Standard). Alternatively, check out the technique in example 3 at: http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3lr40/8.1.4.3 ---------------------------------------------------------------- Thanks oc does not seem to understand: copy xxx replacing leading yyy by zzz. it throws a syntax error even with the -std=cobol2002 compiler directive. ---------------------------------------------------------------- Did you tried the example mentioned by wmklein: [code] 01 :TAG:. 02 :TAG:-WEEK PIC S99. 02 :TAG:-GROSS-PAY PIC S9(5)V99. 02 :TAG:-HOURS PIC S999 OCCURS 1 TO 52 TIMES DEPENDING ON :TAG:-WEEK OF :TAG:. [/code] and [code] COPY PAYLIB REPLACING ==:TAG:== BY ==Payroll==.[/code] ---------------------------------------------------------------- I am trying to change the spelling of color to colour in the screenio.cpy file that comes with oc 1.1 (curing a lot of syntax errors in the programs), unfortunately it does not come with tags so I have had to make an amended copy of the file and use that, I will just have to remember to correct it in each new version of oc. Hmm, I've just discovered another one - oc does not recognise 'initialise' (only 'initialize'), COBOL standards are supposed to be British/American spelling neutral. Thanks for your help. ---------------------------------------------------------------- Where are "a lot of syntax errors in the programs" with original screenio.cpy, can you give some examples please? I never heard of the "British/American spelling neutral" thing. I do not know any compiler where initialise work. Do you know some? If this is a request to be spelling neutral then open another thread for this, please (maybe you can quote the standard and tell us what standard you are quoting). human ---------------------------------------------------------------- Micro Focus (whose headquarters are in the UK) does support British spelling such as "COLOUR" and "INITIALISE". These are, however, CLEARLY marked as extensions to the Standard. If you compile with MF and use FLAG(ANS85) (or '02), you will receive clear compile-time messages indicating that these are EXTENSIONS. Micro Focus does have another extenion whereby you can use a compiler directive [quote] Defines a user-defined reserved word to be synonymous with an existing reserved word. [/quote] This would help OC for cases like this. See the MF directive: ADDSYN ---------------------------------------------------------------- The question about "where does the syntax errors occurs" is not answered but a Feature Request for defining "a user-defined reserved word to be synonymous with an existing reserved word" (I would prefer to use a configuration file instead of a compiler directive) sounds good. human ---------------------------------------------------------------- The syntax errors occur because we naturally use British English spelling when writing & coding, e.g. colour not color. It makes it hard to code if you have to keep going back to change words to, what is to us, an unnatural spelling. Conversely if we accidentally use an 'incorrect' spelling in a business document it reflects badly on us with our customers, and maintaining two different spellings for the same words depending on the context is, at best, difficult. As said above mf allows this, but I agree this should be another thread. ---------------------------------------------------------------- Subject: Screen section colour bug report Bug report for screen section colour: * works 01 screen-sample foreground-color COB-COLOR-GREEN. 03 line 2 column 4 from from-field1 pic x(20). * works: 03 line 4 column 8 foreground-color 5 to to-field1 pic x(20). * does not work (syntax error): 03 line 5 column 8 foreground-color COB-COLOR-RED to to-field2 pic x(20). Version: cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Packaged Feb 06 2009 10:30:55 CET ---------------------------------------------------------------- Subject: Maybe BUG in CALL USING BY VALUE This sample worked in an earlier version (it was a 1.1 prerelease) and does not work with latest prerelease "Packaged Feb 06 2009 10:30:55 CET". [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. CBVTEST. DATA DIVISION. * WORKING-STORAGE SECTION. 77 mychar pic x. *----------------------------------------------------------------- PROCEDURE DIVISION. *----------------------------------------------------------------- main section. 00. accept mychar end-accept call 'CBVTEST2' USING BY VALUE mychar end-call accept mychar end-accept display mychar end-display * continue. ex. stop run. *----------------------------------------------------------------- *--- End of program CBVTEST --------------------------------------[/code][code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. CBVTEST2. DATA DIVISION. * LINKAGE SECTION. 77 mychar pic x. *----------------------------------------------------------------- PROCEDURE DIVISION USING BY VALUE mychar. *----------------------------------------------------------------- main section. 00. display mychar end-display accept mychar end-accept * continue. ex. stop run. *----------------------------------------------------------------- *--- End of program CBVTEST2 -------------------------------------[/code] results (with latest prerelease) in [quote]$ cobcrun.exe CBVTEST CBVTEST2.CBL:13: Attempt to reference unallocated memory (Signal SIGSEGV) Abnormal termination - File contents may be incorrect[/quote] Is the current behaviour right (and the earlier one was wrong) or vice versa and we have a bug? human BTW: What the code should have done is to accept a var, pass it to a sub program, display it there and even if changed in the sub program, the var should be the same on returning back. BTW2: Using BY CONTENT (CALL USING BY CONTENT in CBVTEST and PROCEDURE DIVISION USING BY REFERENCE in CBVTEST2) works. ---------------------------------------------------------------- I don't know about this. Are there restrictions in OC on what "size" and usages can be passed BY VALUE? Some compilers DO have such resrictions, e.g. can only be a half-word or full-word binary. ---------------------------------------------------------------- For sure it's a bug. And as I can see, it was not working properly in OC 1.0 Your sample will work, but consider mychar pic x(4) and even OC 1.0 passing only the first character OC 1.1 is wrong on both generations - for PROCEDURE DIVISION USING it generates BY REFERENCE, and in CALL USING it tries to get the number out of this PIC X(4) :-)) It is not a big deal to fix PROCEDURE generation, but fix for CALL might need more attention. ---------------------------------------------------------------- OC can (of course) have an extension, but the syntax rule for an identifier passed by VALUE in the '02 Standard states, [quote] 19) If identifier-4 or its corresponding formal parameter is specified with a BY VALUE phrase, identifier-4 shall be of class numeric, object, or pointer. [/quote] It seems to me that the "bug' in OC is that it is not giving a compile-time error for trying to pass an alphanumeric identifier BY VALUE. Of course, if OC does have an extension for other data types, then the run-time behavior should match the syntax (as defined in the OC EXTENSION to the Standard) ---------------------------------------------------------------- Subject: Crash with message "libcob: No error" If you have a file like this [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. CALLTEST. DATA DIVISION. * WORKING-STORAGE SECTION. *----------------------------------------------------------------- PROCEDURE DIVISION. *----------------------------------------------------------------- main section. 00. display 'In program' end-display * continue. ex. stop run. *----------------------------------------------------------------- *--- End of program CALLTEST -------------------------------------[/code] and you name it CALLTST.COB (yes, not CALLTEST.COB as you could think because of the PROGRAM-ID) and use [code]$ cobc -W -debug CALLTST.COB $ cobcrun.exe CALLTST[/code] The result is (with latest prerelease "Packaged Feb 06 2009 10:30:55 CET"): [quote]$ cobcrun.exe CALLTST libcob: No error[/quote] The DISPLAY statement does not work, therefore it seems we have a crash. Maybe it is possible to output a warning like "CALLTEST.COB FILE NAME NOT ACCORDING TO PROGRAM-ID", both on compile time and on run time "libcob: FILE NAME NOT ACCORDING TO PROGRAM-ID". human BTW: If this happens with a sub program (PROGRAM-ID = CALLTEST2 and file name on compile time CALLTST2.COB), you get CALLTEST.COBL:18: libcob: No error ---------------------------------------------------------------- Subject: Enhancement request: precompiler/preprocessor This is an enhancement request for a way to add in a source code precompiler/preprocessor between oc steps. For example by allowing the separate compile steps 'preprocess, translate, compile, assemble & link' to be run individually while specifying the input/output files (or stdin/stdout) it would be much easier to add in an embedded sql precompiler step, or a standards conformance checking step (for example if the use of 'goto' is disapproved of at your organisation). At the moment the compiler option -E allows the preprocess step to be run on its own, however the next step in the chain cannot be run separately - compiler option -C also runs the preprocessor. ---------------------------------------------------------------- I support this idea. A solution for OpenCOBOL might be inspired by the Integrated Preprocessor Interface of Micro Focus, see [url=http://supportline.microfocus.com/Documentation/books/sx50ws03/prprep.htm]http://supportline.microfocus.com/Documentation/books/sx50ws03/prprep.htm[/url] It allows to stack several preprocessors (e.g. cobsql and cp), and most important it keeps track of mapping line numbers in the original source file and final preprocessed output. This is a prerequisite for a debugger to know which line to display (which is unfortunately currently not possible with OC, but one should not abandon hope for the future). ---------------------------------------------------------------- Actually you can already do it. You need to know 2 bits of information. 1) You can use the "-o xxx" option with "-E". 2) An input file with a suffix of ".i" is assumed by the compiler to be precompiled (and therefore the precompile stage is skipped). So the 2 steps - cobc -x -E -o prog.i prog.cob cobc -x prog.i are exactly equivalent to cobc -x prog.cob The output from the first step can of course be any name you like, just that for the second step it needs to have a ".i" suffix. Note that in the second step, you may use options such as "C", "S", etc. Roger ---------------------------------------------------------------- Welcome back Roger... ... and thank you for the information. human ---------------------------------------------------------------- Actually, having another look at this, the "-E" option is an exception as regards it's operation (Compared with -C -S -c, etc). Probably a throwback from way-back-when for "gcc like" behaviour. It's of no particular use to throw the output per default onto stdout. So let's change this similar to the other options. "-E" will precompile and produce an output with a ".i" extension. Roger ---------------------------------------------------------------- Hi Roger Is it (will it be) possible to pipe (through stdin/stdout) from the output of the precompile step, to another precompiler, and then pipe the output of that into the compiler? ---------------------------------------------------------------- Subject: Bug: SOURCE FORMAT IS must be in first lines? [code] >>SOURCE FORMAT IS FIXED PROGRAM-ID. INVIND.[/code] leads to [quote]$cobc INVIND.COB INVIND.CBL:1: Error: Invalid indicator ' ' at column 7[/quote] human ---------------------------------------------------------------- As the message points to column 7, is the first ">" of ">>SOURCE FORMAT" in column 7 or in column 8? I think it needs to be in column 8 (unless you were compiling with source format free truned on somewhere else) ---------------------------------------------------------------- Yes, it must be in column 8 as it is. Putting it in column 7 results in [quote]INVIND.CBL:1: Error: Invalid indicator '>' at column 7[/quote] If you remove only one blank line in the sample above, the code works. This is the buggy thing. human ---------------------------------------------------------------- Subject: Bug/FR in BDB-interface: DB_ENV->failchk should be used for returning file status 30 Sometimes it is not possible to access a bdb-file. If you try to, the oc-process hangs. To move on, the process has to be killed. According to [url=http://forums.oracle.com/forums/thread.jspa?messageID=3608796]Oracle BDB-forums[/url], this could be handled if OC would call [url=http://www.oracle.com/technology/documentation/berkeley-db/db/api_c/env_failchk.html]DB_ENV->failchk[/url] before using it's handle, see also [url=http://www.oracle.com/technology/documentation/berkeley-db/db/ref/transapp/fail.html]Handling failure in Transactional Data Store applications[/url]. This function checks the db-handle and returns [url=http://www.oracle.com/technology/documentation/berkeley-db/db/ref/program/errorret.html#DB_RUNRECOVERY]DB_RUNRECOVERY[/url] if bdb/bin/db_recovery has to be perform. If OC gets this error, it could return file status 30. Therefore I'd like OC to do this in general or be able to tell OC on ./configure or OC-environment if DB_ENV->failchk should be used. The necessary dependencies in the code are explained by "user651890" in the mentioned forum post. human BTW: This is one of the DB_ENV things that cannot be specified in the [url=http://www.oracle.com/technology/documentation/berkeley-db/db/ref/env/db_config.html]DB_CONFIG file[/url], therefore the only way to do this is source code of OC ---------------------------------------------------------------- Subject: OpenCOBOL 1.1 - must be released :-) Hi All, Is it a good time to claim that 1.1 pre from now is a release ? I don't see any changes from February, so I'm assuming it's okay and stable (and all ANSI tests confirming that) Any objections ? Regards, Sergey ---------------------------------------------------------------- Yes, there are some important bugs open and the parser does not work as good as in 1.0. We will have to wait for Roger to show up and fix these. It would be good if there would be submitted patches for the problems for Roger only having to have a look at them. After that 1.1 could be released. Roger wrote earlier that he wanted to do this as soon as possible. human ---------------------------------------------------------------- It is 5 years nince we had a stable release an it is still 1.0 ---------------------------------------------------------------- I'm going to post a new thread on the forge, perhaps work with Simon and Sergey to write up a release note. Advertise to the world that 1.1 Feb 2009 is a release cut, [i]and is currently the default tarball on the forge[/i], as well as advertising the forward motions happening in the Community Edition SVN tree. Cheers, Brian ---------------------------------------------------------------- Hi Brian, I think we need to switch to the "forge" and let everyone know that this forum is in "read-only" mode, meanwile to look if it is possible to move all the messages to the forge. The answer is in [url=https://sourceforge.net/p/open-cobol/discussion/109661/]https://sourceforge.net/p/open-cobol/discussion/109661/[/url] ---------------------------------------------------------------- As part of the move, the response to part of this is on SourceForge. And yes we should switch Sergey. I just stumbled on https://sourceforge.net/apps/trac/sourceforge/wiki/Project%20web and https://sourceforge.net/apps/trac/sourceforge/wiki/Developer%20web so yes we should switch. We can rebuild this place on the forge, over time, and let new people into the game, now. [i]stumbled on[/i] is the wrong expression, [i]realized a sense of potential[/i] would be more accurate. Cheers, Brian ---------------------------------------------------------------- Subject: Is it possible to get the number of records of an ISAM file? Is there a simple CALL to get the number of records in an ISAM file that works both in vbisam and bdb? Something like CALL 'OC_CBL_COUNTROWS' using FULL-FILENAME, NUMBER-OF-RECORDS END-CALL? human ---------------------------------------------------------------- As far as I know there is no counter within an ISAM file. So at least the file has to be read once for this information... but maybe there is such a field in a new (unknown to me till now) header ? (ISAM Files can contain different record type, which should be counted? all? system,...) ---------------------------------------------------------------- There are often C-Routines for getting the total record number of a file which is MUCH faster than reading all the records just for counting (I think there was a possibility to do so in BDB, too). COBOL programs should not be filled with different C-Calls, it would be much better to use something like CALL 'OC_CBL_COUNTROWS' to get the number of records. libcob could use the corresponding C-Routines for the different ISAMs (and maybe give a RETURN-CODE of -1 if there is no implementation for the current used ISAM). human ---------------------------------------------------------------- Ok, that would be nice :-) but a least until there is no field in the header one (cobol, c, c++ etc. ) have to read the file :-(. I Think the best way to do so is using the file handler OC is already using! ---------------------------------------------------------------- I think I've found a way to get the number of records in BDB and VBISAM. For BDB we could access [url=http://www.oracle.com/technology/documentation/berkeley-db/db/api_reference/C/dbstat.html]DB->stat[/url] on the data file and use bt_ndata (number of data entries). For VBISAM there is gtdatasize /* # Rows in data file */ in libvbisam/ischeck.c (maybe in others, too). No Idea for D-ISAM/C-ISAM. These numbers should be accessed and given to the COBOL module, if OC_CBL_COUNTROWS is called. human ---------------------------------------------------------------- Subject: Bug/FR in BDB-interface: DB->set_flags DB_CHKSUM should be used before DB->open According to [url=http://www.oracle.com/technology/documentation/berkeley-db/db/ref/transapp/reclimit.html]the BDB docs[/url] there are multiple possible reasons for BDB getting inconsistent and this would be not discovered by BDB system. To solve this issue one should use DB->set_flags [url=http://www.oracle.com/technology/documentation/berkeley-db/db/api_c/db_set_flags.html#DB_CHKSUM]DB_CHKSUM[/url] before doing DB->open (although it raises CPU of course). Therefore I'd like OC to do this in general or be able to tell OC on ./configure if DB_CHKSUM should be used. human BTW: Are the "multiple possible reasons" mentioned in the linked BDB docs a possible reason for VBISAM to get inconsistent, too? ---------------------------------------------------------------- Subject: Feature request: Reserved word alternative This is a: Feature Request for defining "a user-defined reserved word to be synonymous with an existing reserved word". Reason: To enable oc to be more international. How: The suggestion is a 2 column config file mapping a user defined word to an existing reserved word. e.g. for gb BACKGROUND-COLOUR BACKGROUND_COLOR FOREGROUND-COLOUR FOREGROUND_COLOR INITIALISE INITIALIZE INITIALISED INITIALIZED ORGANISATION ORGANIZATION PROGRAMME PROGRAM PROGRAMME-ID PROGRAM-ID PROGRAMME-POINTER PROGRAM-POINTER SYNCHRONISED SYNCHRONIZED Most of these could probably be done by reading the config file into reserved.c however PROGRAM-ID seems to be hard coded elsewhere. ---------------------------------------------------------------- Subject: Migration MF x OC !!! Hello, Had previously posted that was bad for the "SPLIT KEYS" in the migration of my code of MF to OC. Which is currently "SPLIT KEYS" are implemented in OC, or if there is any solution for this problem? Help me :-( Thank you. Bruno. ---------------------------------------------------------------- These are not implemented yet, but it is always possible to define an higher level as key. Have look at the [url=http://opencobol.add1tocobol.com/#does-opencobol-support-isam]ISAM sample in the OC FAQ[/url]. If you use fields in different keys, the only possibility by now is to define them (and fill them) for every key. Please change you misleading topic [use Edit on the first post] to something like "Is it possible to use SPLIT KEYS?" human ---------------------------------------------------------------- Human, Why do you consider the title of this thread as misleading? It seems clear to me that this issue is a MIGRATiON from Micro Focus to OC issue. It would be possible to define "split keys" the way that the '02 Standard does and OC would STILL have a migration problem from MF, as MF has (slightly) different syntax from the Standard. I read this thread as a request to provide MF compatible split key functionality - in order to ease migration from MF (data and programs) and NOT just a request to provide split key suport (which could be done incompatibly with MF) ---------------------------------------------------------------- I would appreciate if at least "SPLIT KEYS" would be in the topic title. I did not know that there are different ways to define SPLIT KEYS (at the moment they do not work at all). Could you give a nice example for defining them for MF and the same sample for the 2002? human ---------------------------------------------------------------- Subject: FR (FIX attempts submitted): Make use of FILE NAME mapping possible if ASSIGN has ".", "-", "@" If ASSIGN TO "FILEDAT" is used, file name mapping can be used by setting DD_FILEDAT into environment. What can be set to environment if the value of ASSIGN-CLAUSE contains not valid characters? According to [url=http://supportline.microfocus.com/documentation/books/sx22sp1/fhname.htm#u007]MF-Docs[/url], it can be done by using a underscore instead, therefore FILE.DAT can be mapped by using DD_FILE_DAT, FILE-DAT can be mapped by using DD_FILE_DAT, too. This does not seem to work in OC. Can anybody tell me what to do [without changing the ASSIGN CLAUSE] or post a fix for fileio.c (must be something around line 3851 "DD_TMPFILE")? human ---------------------------------------------------------------- This fix work for FILE NAME mapping (it is possible to set DD_FILE_DAT for the ASSIGNs "FILE-DAT" or "FILE.DAT" or even "FILE@DAT"), but ... [code] if (cob_current_module->flag_filename_mapping) { src = file_open_name; dst = file_open_buff; /* expand environment variables */ /* ex. "$TMPDIR/foo" -> "/tmp/foo" */ while (*src) { if (*src == '$') { for (i = 1; ; i++) { if (!isalnum (src[i]) && src[i] != '_' && *src != '-') { break; } } memcpy (file_open_env, src + 1, i - 1); file_open_env[i - 1] = 0; if ((p = getenv (file_open_env)) != NULL) { strcpy (dst, p); dst += strlen (p); } src += i; } else { if (!isalnum (*src) && *src != '_') { *src = '_'; } *dst++ = *src++; } } *dst = 0; strncpy (file_open_name, file_open_buff, COB_SMALL_MAX); /* resolve by environment variables */ /* ex. "TMPFILE" -> DD_TMPFILE, dd_TMPFILE, or TMPFILE */ for (i = 0; i < NUM_PREFIX; i++) { snprintf (file_open_buff, COB_SMALL_MAX, "%s%s", prefix[i], file_open_name); if ((p = getenv (file_open_buff)) != NULL) { strncpy (file_open_name, p, COB_SMALL_MAX); break; } } if (i == NUM_PREFIX && cob_file_path) { snprintf (file_open_buff, COB_SMALL_MAX, "%s/%s", cob_file_path, file_open_name); strncpy (file_open_name, file_open_buff, COB_SMALL_MAX); } }[/code] ...The occurrences of .-@ etc. are ALWAYS replaced in the file name. Therefore the ASSIGNs "FILE-DAT" and "FILE.DAT" and "FILE@DAT" lead always to a file named "FILE_DAT". Not so good... The next attempt was to change the buffer after [code]strncpy (file_open_name, file_open_buff, COB_SMALL_MAX);[/code] with the code [code] if (cob_current_module->flag_filename_mapping) { /* expand environment variables */ /* ex. "$TMPDIR/foo" -> "/tmp/foo" */ src = file_open_name; dst = file_open_buff; while (*src) { if (*src == '$') { for (i = 1; ; i++) { if (!isalnum (src[i]) && src[i] != '_' && *src != '-') { break; } } memcpy (file_open_env, src + 1, i - 1); file_open_env[i - 1] = 0; if ((p = getenv (file_open_env)) != NULL) { strcpy (dst, p); dst += strlen (p); } src += i; } else { *dst++ = *src++; } } *dst = 0; strncpy (file_open_name, file_open_buff, COB_SMALL_MAX); /* resolve by environment variables */ /* ex. "TMPFILE" -> DD_TMPFILE, dd_TMPFILE, or TMPFILE */ /* Make sure we use only have valid chars for environment */ src = file_open_buff; while (*src) { if (!isalnum (*src)) { *src = '_'; } *src++; } *src = 0; for (i = 0; i < NUM_PREFIX; i++) { snprintf (file_open_buff, COB_SMALL_MAX, "%s%s", prefix[i], file_open_name); if ((p = getenv (file_open_buff)) != NULL) { strncpy (file_open_name, p, COB_SMALL_MAX); break; } } if (i == NUM_PREFIX && cob_file_path) { snprintf (file_open_buff, COB_SMALL_MAX, "%s/%s", cob_file_path, file_open_name); strncpy (file_open_name, file_open_buff, COB_SMALL_MAX); } }[/code] But then FILE NAME mapping does not work any more... Please have a look at this if you know what is done in fileio.c human ---------------------------------------------------------------- Subject: LEVEL 78 BUG (RESOLVED BY UPGRADING) I've had some problems with level 78. Specifically, I tried to use the level 78 in screenio.cpy, to allow symbolic colours in screen section definitions. So, I put the COPY at the top of the WORKING-STORAGE section, and my program immediately failed. Isolating further, I determined that 01 constant could go anywhere, but 78 pretty much had to be at the end. Find compiler version and test-case below. ============= [user@ariel xyzzy]$ cobc -V cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Jan 18 2009 03:43:53 Packaged Jan 15 2009 11:03:17 CET [user@ariel etc]$ uname -a Linux ariel 2.6.23.9lw #105 SMP PREEMPT Fri Jun 27 18:56:59 EDT 2008 i686 i686 i386 GNU/Linux [user@ariel etc]$ ============= BUG78.COB IDENTIFICATION DIVISION. PROGRAM-ID. BUG78. DATA DIVISION. WORKING-STORAGE SECTION. * BUG - IF THE LEVEL 78 IS HERE, THE PROGRAM FAILS. MY-VAR2 * IS DISPLAYED AS BLANKS. IF IT IS AT THE END, IT * WORKS. 78 MY-C2 VALUE 55. 01 MY-CONS CONSTANT 10. 77 MY-VAR2 PICTURE X(20) VALUE "ABCD". PROCEDURE DIVISION. DISPLAY "HELLO WORLD!". DISPLAY MY-VAR2. DISPLAY "GOODBYE WORLD!". STOP RUN. ============= [user@ariel xyzzy]$ cobc -x BUG78.COB [user@ariel xyzzy]$ cobc -x -W BUG78.COB BUG78.COB:12: Warning: DISPLAY statement not terminated by END-DISPLAY BUG78.COB:13: Warning: DISPLAY statement not terminated by END-DISPLAY BUG78.COB:14: Warning: DISPLAY statement not terminated by END-DISPLAY [user@ariel xyzzy]$ ./BUG78 HELLO WORLD! GOODBYE WORLD! [user@ariel xyzzy]$ ---------------------------------------------------------------- Interesting. I know this probably won't make you feel any better, but the program you provided works fine on my OpenCOBOL. cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Jun 16 2009 20:12:12 Packaged Feb 06 2009 10:30:55 CET Windows MinGW build. ---------------------------------------------------------------- Why shouldn't he feel better, you have "Packaged Feb 06 2009 10:30:55 CET", he has "Packaged Jan 15 2009 11:03:17 CET". Therefore his OC version is older and the bug seems to be fixed. @fredw: Please install latest pre release and try again. If it works fine, please add "SOLVED in latest pre release" or something like that to the topic title. human ---------------------------------------------------------------- human Thanks! The Feb 6 pre-release did the trick! Back to coding... FredW ---------------------------------------------------------------- I missed that package date difference. That's what I get for not using my reading glasses. Sigh. It's tough getting old. :-) ---------------------------------------------------------------- Subject: OC 1.1 IBM compatibility - degradation Hi, As it comes to the reality, OC 1.1 does not allow 77 FILLER PIC X VALUE 'A'. even in -std=ibm OC 1.0 did allow that Microfocus does not give a warning, Native Mainframe Cobol allows that. I think we can use relax-level-hierarchy for that, so the fix will be the following: [code] *** parser.y.orig 2009-02-04 11:56:18.000000000 -0500 --- parser.y 2009-07-15 11:03:27.000000000 -0400 *************** *** 2332,2341 **** data_description_clause_sequence { if (!qualifier && (current_field->level == 88 || ! current_field->level == 77 || current_field->level == 66 || ! current_field->flag_item_78)) { cb_error (_("Item requires a data name")); } if (current_field->level == 88) { cb_validate_88_item (current_field); } --- 2332,2347 ---- data_description_clause_sequence { if (!qualifier && (current_field->level == 88 || ! current_field->level == 66 || current_field->flag_item_78)) { cb_error (_("Item requires a data name")); } + if (!qualifier && current_field->level == 77) { + if (cb_relax_level_hierarchy) { + cb_warning (_("Item requires a data name")); + } else { + cb_error (_("Item requires a data name")); + } + } if (current_field->level == 88) { cb_validate_88_item (current_field); } [/code] ---------------------------------------------------------------- I think that this is just a BUG in OC. I believe the Standard ('85 and '02) REQUIRES that you support (explicit or implict) FILLER with 77-levels. Consider: [code] 77 Filler Pic X Value "A". 88 Test1 Value "A". 01 Pic 9 Value 1. 88 Test2 Value 3 False 7. 01 Pic N. 88 Test3 Value Spaces. ... Set Test1 to True Set Test2 to False If Test3 {erform Whatever [/code] ---------------------------------------------------------------- [quote] wmklein wrote: I think that this is just a BUG in OC. I believe the Standard ('85 and '02) REQUIRES that you support (explicit or implict) FILLER with 77-levels. [/quote] Than the fix would be even easier: [code] *** parser.y.orig 2009-02-04 11:56:18.000000000 -0500 --- parser.y 2009-07-15 14:51:35.000000000 -0400 *************** *** 2332,2339 **** data_description_clause_sequence { if (!qualifier && (current_field->level == 88 || ! current_field->level == 77 || current_field->level == 66 || ! current_field->flag_item_78)) { cb_error (_("Item requires a data name")); } if (current_field->level == 88) { --- 2332,2338 ---- data_description_clause_sequence { if (!qualifier && (current_field->level == 88 || ! current_field->level == 66 || current_field->flag_item_78)) { cb_error (_("Item requires a data name")); } if (current_field->level == 88) { [/code] ---------------------------------------------------------------- Thank you for posting this fix! human ---------------------------------------------------------------- Subject: OPEN-COBOL 1.1 FEATURE REQUEST: LIKE 77 MY-VAR PIC X(20). 77 MY-VAR2 LIKE MY-VAR. I believe its COBOL/400, maybe other versions. I request this with the following rationale: 78 FMT "PIC X(20)". doesn't work, because expansion would be a literal, and 78 FMT PIC X(20). can't work, because PICTURE isn't expected. In general, it is nice to abstract types as much as possible for new development; we could use an external pre-processor for this, but it is much more convenient to have language support. Using "LIKE" to derive types (and it also allows tables to be derived: 01 MY-VAR3 LIKE MY-VAR(10). ...along those lines) and aggregates, allows type basing from copybook items as well. Just a terrific device -- so can we have it please? (or, I can try the patch on my own -- but I am horribly new at open-cobol). Or, has this been hashed out, and is a still-born idea? ---------------------------------------------------------------- I do not understand what you want to to. Do you want to have the picture string in a var? Then 78 FMT VALUE "PIC X(20)" would work. Please explain what you want to achieve, maybe you can post a link to some docs explaining what LIKE should do. Maybe you can post some COBOL code that definitely works with some vendor. human ---------------------------------------------------------------- human Um... 78 fmt value "pic x(20)". doesn't work. Try it 77 myvar fmt. will give unexpected literal. So, here is some code: 01 something. 02 more-stuff. 03 varx pic x(41). * we choose something obscure! * more stuff here... * And, now we need something to hold a "varx" type variable --- 01 vary like varx. See http://publib.boulder.ibm.com/infocenter/iadthelp/v7r0/topic/com.ibm.etools.iseries.langref.doc/evfeb4ls37.htm and look for "LIKE Clause" (this is doc for COBOL/400 product). ---------------------------------------------------------------- Ah, you want to define a lot of fields in the same way. I use the following way: [code]78 obscure-lenght value 41. 01 something. 02 more-stuff. 03 varx pic x(obscure-lenght). * we choose something obscure! * more stuff here... * And, now we need something to hold a "varx" type variable 01 vary pic x(obscure-lenght).[/code] This work for a lot of cases but does not if you have something like [code]77 myspecialvar s999.999.999v99[/code] I see the reasoning behind that. If there is a hack it could MAYBE find its way into OC if Roger sees this, too. Thank you for providing the link. But I do not understand how/why to use LIKE and change the length by doing this. Do you have some good samples for LIKE clause? human ---------------------------------------------------------------- LIKE is a feature of COBOL/400. It rpovides the identical (I think) functionality as the [b]SAME AS[/b] feature in the '02 Standard. See that Standard for the semantics and syntax. The TYPE and TYPEDEF feature also provide similar (but not quite the same) functionality. If they aren't already, please include SAME, TYPE (optional STRONG), and TYPEDEF in the "features request" list. ---------------------------------------------------------------- Subject: OPEN-COBOL 1.1 FEATURE REQUEST: SYMBOLIC CHARACTERS Hi I would like to suggest the support of SYMBOLIC CHARACTERS in the SPECIAL-NAMES paragraph. SPECIAL-NAMES. ... SYMBOLIC CHARACTERS KEYBOARD-BELL IS 7 CARRIAGE-RETURN IS 14 Tkx ---------------------------------------------------------------- The FAQ states, [quote] OpenCOBOL supports a fair complete set of the SPECIAL-NAMES in common use. [/quote] I haven't tried it, so can you show what syntax doesn't work and what compiler message you get? SYMBOLIC CHARACTERS have been part of the Standard for at least since the '85 Standard. ---------------------------------------------------------------- Subject: Is there a way to distribute OpenCobol applications without including the OpenCobol libraries? Hi, Is there a way to distribute applications compiled with OpenCobol to people who don't have OpenCobol? I installed OpenCobol on Windows XP and am using Visual Studio 2008 as the C++ compiler. So I understand that end-users need to install Visual C++ 2008, but when I try to run an executable, it says that it can't find libcob.dll. I got the installer from this page: http://www.kiska.net/opencobol/. I also tried outputting just the C++ code and changing the include lines to use quotes instead of angle-brackets and placing the C++ source code in the folder with the header files, but it then complains about there not being a main method. So, I added an "int main(){}" to the file, and then it starts to complain about unresolved symbols while it links the files ("error LNK2019: unresolved external symbol _cob_stop_run referenced in function _TEST_," etc.). Forgive me as I am new to both C++ and COBOL. Thanks for any help. ---------------------------------------------------------------- Hi! What is the problem about distributing the libcob.dll along with your programs (just put it in the same folder)? human ---------------------------------------------------------------- Hi. That's not too bad. I didn't know you could put the .dll in the same folder. Thanks. ---------------------------------------------------------------- Subject: PROCEDURE DIVISION, using-phrase: OPTIONAL - withdrawn question Edit: ... Works fine if you use current OC [had a problem with an earlier version] human ---------------------------------------------------------------- Subject: Question: How to get the name of the main program? If you have PROGA, calling PROGB, that calls PROGC, that calls PROGD and you neither want to define an external nor want to pass the program name in LINKAGE nor want to change the command line that calls PROGA: 1. Is there a way to know in PROGD what program it was called by (in this sample PROGC)? 2. Is there a way to know in PROGD what main program was used (in this sample PROGA)? human BTW: ACCEPT FROM COMMAND-LINE only gives the parameters that where passed to the main program, not the name of the main program itself. ---------------------------------------------------------------- On Linux the name of the last command executed is sometimes held in an environmental variable called "_" (underscore). So if you compile the main program with cobc -x you should be able to retrieve it (i.e. if you don't use cobcrun) e.g. (adapted from the gcienv program in add1tocobol FAQ): (sorry about the indenting, don't know how to post formatted source code) [code] identification division. program-id. testenv2. *test getting environmental variable that holds the command *executed environment division. data division. working-storage section. 01 value-string pic x(256). procedure division. accept value-string from environment "_" end-accept display function trim (value-string trailing) end-display goback. [/code] ---------------------------------------------------------------- Thank you for your answer but I'm looking for a system independent way with cobcrun. I thought about somehow getting the call stack from OC. BTW: You can press the <>-Button in editing/posting to format something as CODE or write "[ code]initialize something[/ code]" (without spaces before code). Maybe you want to try to edit your previous post? ---------------------------------------------------------------- Thanks for the tip on the code formatting. The name of the main program may be held in a C variable called cob_argv[0] - see libcob/common.c cob_accept_command_line for how oc gets the rest of the command line How you get at this from a cobol program I don't know, can any C programmers help? ---------------------------------------------------------------- The "portable" way that SHOULD work for getting the main porgram name is by getting the "0" argument of the command line. This was true for X/Open and still is true for Micro Focus. See the documentation for the ACCEPT statement that says, [quote] If the current command-line argument number is 0, it is intended that the program-name of the main program of the run unit will be returned. [/quote] As the MF documentation says, this does depend on exactly HOW you "invke" your program. It maay be "argument 1" if you use a "utility" (such as COBRUN) before the main program name in your comand-line invocation. I do NOT know if OC currently (or in the future) implements this X/Open syntax. ---------------------------------------------------------------- This seems to work for getting the name of the main program, but exactly what you get back seems to depend on whether you use cobcrun or run it as a static executable. I have not tested it from a called program, and this does not answer the other question about getting the name of the program that called this one: [code] identification division. program-id. testcommandline. *test getting commandline arguments - including the program name environment division. data division. working-storage section. 01 ws-argument-number pic 99. 01 ws-loop-counter pic 999. 01 ws-command-line-arguments. 03 ws-program-name pic x(256). 03 ws-argument-value pic x(256) occurs 99. procedure division. *Get the name of the main program *(this is the same program name whether running under cobcrun or *as a static executable, but you get the path in the second case) move 00 to ws-argument-number display ws-argument-number upon argument-number end-display accept ws-program-name from argument-value end-accept *Get the command-line arguments * Get the number of arguments on the command line accept ws-argument-number from argument-number end-accept * Loop round putting them into a table move 1 to ws-loop-counter perform until (ws-loop-counter > ws-argument-number) accept ws-argument-value(ws-loop-counter) from argument-value end-accept add 1 to ws-loop-counter end-perform *For debugging - display what we got display ws-program-name end-display display ws-argument-number end-display move 1 to ws-loop-counter perform until (ws-loop-counter > ws-argument-number) display ws-argument-value(ws-loop-counter) end-display add 1 to ws-loop-counter end-perform goback. [/code] ---------------------------------------------------------------- Ah, I did not know about this very interesting extension. I've done some little tweaking for testing and adding this nice sample of code to the FAQ [code] identification division. program-id. testcommandline. *test getting commandline arguments - including the program name environment division. data division. working-storage section. 01 ws-argument-number pic 99. 01 ws-loop-counter pic 999. 01 ws-command-line-arguments. 03 ws-program-name pic x(256). 03 ws-argument-value pic x(256) occurs 99. procedure division. *Get the name of the main program *(this is the same program name whether running under cobcrun or *as a static executable, but you get the path in the second case) move 00 to ws-argument-number display ws-argument-number upon argument-number end-display accept ws-program-name from argument-value end-accept *Get the command-line arguments * Get the number of arguments on the command line accept ws-argument-number from argument-number end-accept * Loop round putting them into a table perform varying ws-loop-counter from 1 by 1 until (ws-loop-counter > ws-argument-number) accept ws-argument-value(ws-loop-counter) from argument-value end-accept end-perform *For debugging - display what we got display ' ' end-display display 'Program name: "' FUNCTION TRIM(ws-program-name) '"' end-display display 'Number of arguments: ' ws-argument-number end-display perform varying ws-loop-counter from 1 by 1 until (ws-loop-counter > ws-argument-number) display 'Argument number ' ws-loop-counter ': "' FUNCTION TRIM(ws-argument-value(ws-loop-counter)) '"' end-display end-perform goback.[/code] leads to [quote]cobcrun testcommandline "this is an entry" entry2 3 Program name: "testcommandline" Number of arguments: 03 Argument number 001: "this is an entry" Argument number 002: "entry2" Argument number 003: "3"[/quote] and with it cobc -x testcmdcall[code] identification division. program-id. testcmdcall. environment division. data division. working-storage section. procedure division. call 'testcommandline' end-call goback.[/code] it works, too, [quote]testcmdcall "this is an entry" entry2 3 Program name: "testcmdcall" Number of arguments: 03 Argument number 001: "this is an entry" Argument number 002: "entry2" Argument number 003: "3"[/quote] but as canalside pointed out would give the path if called with it (applies to .exe too), [quote]..\tests\testcmdcall.exe "this is an entry" entry2 3 Program name: "..\tests\testcmdcall.exe" Number of arguments: 03 Argument number 001: "this is an entry" Argument number 002: "entry2" Argument number 003: "3"[/quote] Therefore this is quite usable for getting the main program for now (taking the last part before \/, removing .exe if necessary). If there is no way to get the call stack, this would be a nice (and maybe easy to code) extension for OC. human ---------------------------------------------------------------- Subject: cobcrun errors (RESOLVED - USE CHAINING, NOT USING) I am converting some JCL, and the code uses LINKAGE to pass PARAMs. This doesn't work when using cobc -x, so I use cobc without, generating a .so module (dll in Windows?). All is good, and the parameters can be passed in using cobcrun MYPROG PARAMETER except... it appears the parameters are passed as: MYPROG x"0" PARAMETER1 x"0" PARAMETER2... which doesn't do me a whole lot of good. It also doesn't really track IBM COBOL usage very well, nor, I believe, MF. Now, cobcrun is simple enough -- the defect appears to be cob_init(argc - 1, &argv[1]); It should probably be (at least) cob_init(argc - 2, &argv[2]); which would eliminate the "MYPROG" name from being hammered into the LINKAGE. But, multiple parameter words would still be munged. cobcrun also doesn't return the program code correctly (if at all). I am poking into the run-time implementation to see if I can sort this out. Any thoughts? ---------------------------------------------------------------- Subject: Questions to VBISAM - Compression, Environment Settings, ... 1. According to docs/vbisamdocs.txt there are different methods available to have INDEX compression. Is there a way to activate them in VBISAM/OC? 2. Is there a way to compress the data file .dat via VBISAM/OC? 3. There are several environment vars to tweak VBISAM (according to vbisamdocs.txt), for example VB_TREE_LEVEL or VB_FILE_TREE_KEY or MAXSUBS. The only one I found in the source is MAXSUBS. Do the others exist (any more)? 4. Is there a doc for vbrecover available? It always complains about "Error opening log: 120". Can vbrecover be used for OC at all? 5. Is there a doc for vbcheck available? There are lines like Part 1: 3488,20,CHARTYPE And I like to know what that means. 6. If one deletes some records, there are x'00' at this point in the .dat and I think some special markers in .idx. Is there a way to rebuild the files (to throw these out of the files and do a resort, if this helps for performance)? human ---------------------------------------------------------------- Subject: PRINTER + Debian = unknown beast! Hello, I tried to create a simple Open cobol program that print on a printer a simple line... The code: [code] IDENTIFICATION DIVISION. PROGRAM-ID. jtest. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT PRINT-FILE ASSIGN TO "| lp -dprinter" FILE STATUS IS STATUS-ISM. DATA DIVISION. FILE SECTION. FD PRINT-FILE. 01 TEXT-TO-PRINT PIC X(120). working-storage section. 77 STATUS-ISM pic XX value "-1". 77 RISPOSTA pic X(01). procedure division. DISPLAY "Printing..." LINE 05 COLUMN 05 WITH NO ADVANCING. INIZIO. OPEN OUTPUT PRINT-FILE. DISPLAY "Opening PRINT-FILE: " LINE 06 COLUMN 05 WITH NO ADVANCING. DISPLAY STATUS-ISM WITH NO ADVANCING. MOVE "Printing test!" TO TEXT-TO-PRINT. WRITE TEXT-TO-PRINT AFTER ADVANCING 1 LINE CLOSE PRINT-FILE. DISPLAY "Printed! (maybe...)" LINE 08 COLUMN 05 WITH NO ADVANCING. ACCEPT RISPOSTA. exit program. [/code] The problem is that don't print!... It giver no errors, status code of the printer is 00 (ok) but I don't know what I missed!... I use OC 1.1 on Debian. The name of the printer in Debian printer list is "printer" and is a net printer. Thanks in advance for your time. Riky ---------------------------------------------------------------- The status code is 00, because the underlying system says it is all fine. You do the same as doing the following on console [code]nonexistentstuff | lp -dprinter[/code] which does nothing and resulting in return code 0. Maybe it would be good to use the SEARCH function of this board and have a look at topics about printing like [url=http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=304&forum=1]this one[/url]. BTW: You can press the <>-Button in editing/posting to format something as CODE or write "[ code]initialize something[/ code]" (without spaces before code). Maybe you want to try to edit your previous post? ---------------------------------------------------------------- Thanks, I've seen all the posts before mine, but they didn't help me! I can't understand what I have to do to configure Linux for printing from OpenCobol. By console using LPR works fine, but I can't understand if I have to use the printer like a file and write in it: in /dev directory there's no lp0, lp1 because it's a net printer connected via printer graphical settings dialog in Debian. Have I to crate a simbolik link in the Linux environment in /dev directory? Sorry for my ignorance! Riky ---------------------------------------------------------------- Subject: License for Berkeley DB All good Cobol implementations provide a good ISAM access method, with good tools to rebuild/reorg the ISAM files. I see the Berkeley DB is used to provide the standard ISAM access. I have two issues which I have not been able to resolve: 1) It appears the Berkeley DB will require a license if we are to provide a product outside our internal environment; 2) I didn't see any tools with the Berkeley DB to rebuild indexed files. I assume they exist, there has to be some way to remove deleted records, and reorg the index. I also didn't see much information on record locking either between users or between threads. Is there a good writeup somewhere regarding record locking. Also, from the Berkeley DB website, is appears that a commit is required in order to release the existing locks. Is this true? I am excited about this project, and hope to be able to help in the development. We have many development tools designed for the Cobol environment which we may be able to contribute. However, they are all written in Cobol, not C. Thank you to all who are and have been working to make Open Cobol a reality. FredY ---------------------------------------------------------------- Berkeley DB changed it's license beginning with version 2. And it's been a source of contention since the beginning of the OC project. Have you tried compiling OC using VBISAM [1]. It is a open source C-IS*M clone distributed under the GPL license. Supports process/user level record locking using the C flock/fctl. Works well on UN*X type systems, but not so well on Win32. 1) VBISAM - version 2 http://www.sim-basis.de/vbisam-2.0.tar.gz ---------------------------------------------------------------- I have experienced some bugs and problems with BDB, therefore I try to move to VBISAM. If I understood Roger While some months ago, VBISAM has a good change to be merged into OC later, although this seems to be only possible if the Win32 problems (I haven't tried this yet) are solved. Record and file locking worked fine for me with BDB and OC 1.1.2 (with MANUAL locking). @FredY: COBOL-Tools in COBOL are very fine, I like to see these, as soon as possible. @essex: What problems occur on Win32 with VBISAM? human ---------------------------------------------------------------- [quote] essex wrote: Have you tried compiling OC using VBISAM [1]. Works well on UN*X type systems, but not so well on Win32. [/quote] How it could possibly work with so many major bugs ? :-) ---------------------------------------------------------------- I haven't worked on VBISAM since version 1.x. On Win32, there was a fundamental flaw with version 1.x. The lock function behave differently on Win32, than the UN*X lock function (flock, advisory locks). Many bugs fixes are included with version 2. But, I don't know what the status is, or what issues are still remaining. BTW, there is also a cobol-it [1] version of VBISAM, on the SF site. This version will not compile with OC as the function names have been changed. 1) cobol-it http://sourceforge.net/projects/cobol-it/ ---------------------------------------------------------------- The SourceForge page form COBOL-IT is not maintained any more. The more recent version of VBISAM changed by COBOL-IT can be downloaded if you go to their website, choose download and Compiler Suite and then take the selection sources. If there is somebody understanding this C stuff it could be a good idea to have a look if there are some things (not the function names) that should be merged into the VBISAM version from Roger While (to become OCISAM later). human ---------------------------------------------------------------- You can rebuild BDB files using the utilities db_dump and db_load, which should be part of your BDB distribution. See http://www.oracle.com/technology/documentation/berkeley-db/db/utility/index.html OC uses "Berkeley DB Concurrent Data Store", for a documentation see http://www.oracle.com/technology/documentation/berkeley-db/db/ref/cam/intro.html As the name says, this interface handles concurrent file access, provided that all threads define the same BDB environment using the DB_HOME variable. Hans-Martin ---------------------------------------------------------------- Subject: Cobol Data File Editor (RecordEditor) I have just started updating the RecordEditor (a PC Data file editor similar to File Aid) to Support Open Cobol. I am currently still testing these changes so I would appreciate any Open Cobol Data files (+ Copybooks + some idea of contents). Also any Testing / Comments would be appreciated. The RecordEitor will Display Cobol Files (Text / Binary) in a table. Package includes 2 versions of the Editor * Standard (Full Editor) which stores layouts in a DB. There is an option to import Cobol Copybooks * Cobol Editor which can work off Copybooks. The Cobol Editor is slightly more limited than the main. The package also includes * File compare utility which generates a formated Compare * Copy utility (Still under development) Which will do - Copy from one layout to another - Copy a file from one Cobol Dialect to another (i.e. Mainframe Cobol to / from Open Cobol). Initial Test Version is available Here: https://sourceforge.net/projects/record-editor/files/ There are some Notes on using the editor with Cobol Here: http://record-editor.sourceforge.net/Cobol.html Bruce ---------------------------------------------------------------- Do you talk about viewing and editing only sequential / line sequential files or ISAM files, too? human BTW: the last link is written wrong, it ends in 404 - not found. ---------------------------------------------------------------- At the moment I only support sequential / line sequential. ISAM is some thing I could look at in the future if there is enough demand The second link should be: http://record-editor.sourceforge.net/Cobol.html ---------------------------------------------------------------- ISAM would be very interesting, because the other files can be more easy edited without a special editor if they do not contain fields with USAGE COMP (although the screens look fine). There are java libraries for BDB (therefore this should be easy), VBISAM is only available in C. Where should bugs and feature requests should be posted? In this topic? BTW: Maybe it's a good idea to edit the broken link in the first post, too. ---------------------------------------------------------------- I don't know what you mean about RECORD sequential files not having USAGE COMP (COMP-5, POINTE, whatever) fields. It is true that most "well-formed" LINE sequental files arae limited to "displayable" fields, but even there if you have any USAGE NATIONAL data intermixed with USAGE DISPLAY, having a "record layout senstive" editor is a great help. Although they have a PC version, it is mostly IBM mainframe shops that are familiar with "File-Aid". You may want to check out: [url=http://www.compuware.com/resources/mainframe/fileaid_mvs.pdf]http://www.compuware.com/resources/mainframe/fileaid_mvs.pdf[/url] Micro Focus' "data file editor" provides similar functionality. You can see information about it in Chapter 4 of the Utilities Guide for Net Express 4.1 ---------------------------------------------------------------- I started the RecordEditor while working for a large retailer (Unix Package / PLSQL / C) we used to receive a variety of Fixed Width Text files from various suppliers. When ever a new supplier started sending files, they nearly always had errors in them. Figuring out what the errors where / fixing the Errors was often very difficult with a Text Editor. The RecordEditor was a huge help. Text Editors a fine for simple Files. The RecordEditor / FileAid / FileMaster are great if 1) You have complicated files with hundred's of fields. On the mainframe I have seen files with 20+ Record Layouts with most records having hundreds of fields 2) You are receiving files from external sources. Also the the Compare in the RecordEditor could be usefull for Cobol Programers. It can 1) Compare 2 files and display the difference using the Cobol Record Layout 2) Compare Selected fields from one file with Selected fields from a file in a different format. This can be useful for comparing a programs input file with the Output file. Also from my experience most mainframe Cobol tend to be binary (with File-Aid Binary files are just as easy to edit as Text files). I would think the RecordEditor would be useful for people with a Mainframe Cobol Background. The best place for logging errors is at sourceforge I have updated the link in the first post (I did not know you could update past posts). ---------------------------------------------------------------- If I was misunderstood: The RecordEditor seems nice, especially for the reasons you've mentioned. If the "File Structure" "Delimiter separated file" with a changeable delimiter isn't available yet, please add it (Keyword CSV and others). human ---------------------------------------------------------------- Do you want to 1) use multiple Delimiter in the same file 2) just change delimiter. If its is the first option, please supply more details If it is the second, You have 2 choices; * The Generic CSV layout lets you specify Delimiter (+ other options) at Run Time * You can define a new Layout in the Layout Editor. On the extra tab there is a Delimiter option (see below). If there are other delimiters you want, let me know. Note: the easiest way to define a new Delimited layout is to edit an existing Delimited Layout and use the save as option. http://record-editor.cvs.sourceforge.net/viewvc/record-editor/record-editor/Docs/Diagram/LayoutEdit_Delim.GIF?view=markup If you use CSV files, the Copy function (currently only accessible via File >>> File Menu) will let you copy a CSV file to a Cobol File. I plan to add * A specific option to copy 'RecordEditor' Defined files to a Delimited file * Batch run option * Copy menu as a stand alone program Note: The Cobol Copy function would of solved the Mainframe file translation issue discussed here http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=618&forum=1 ---------------------------------------------------------------- OK, this sounds good. I did a test installation and there were some things I've mentioned: 1. The file RecordEdit\HSQL\lib\RecordEdit.Ico is missing. 2. Should there be an entry in start menu "Basic Editor" or not (there isn't one)? 3. I think it would be VERY good (this is my main Feature Request) if, instead of HSQL, SQLite could be used (no need to start any server). There are JAVA drivers available for SQLite. 4. For the delimiters (I meant scenario 2, in RecordEditor there are currently , ; : | / \): Maybe it is a good idea to be able to choose the delimiter either by pull-down-menu or by other input. The most complicated (not often used) thing is if you have a file with some hex-delimiter, for example x'FF' or x'FE'. Normally you have to pass this file to a hex editor, change these signs to a more often used sign (and hope it does not occur anywhere in the data), work with the file and then convert the new delimiter to the old one. human ---------------------------------------------------------------- Thanks for reporting the errors 1) I will look in to it 2) I removed it from the menu a while back - will update the documentation 3) It is possible to Run HSQL in server mode (i.e. do not need to start the Server). The disadvantage is only one copy of the RecordEditor / LayoutEditor can run at a time. See Below 4) The hex could be difficult without a complete rewite - at present because I am parsing a Java String (16 bit char) Java String (i.e. --------------------------------------------------------- If you wish to use the DB in imbeded mode, There is a properties file that needs to be updated (back the file up first): XP - C:\Documents and Settings\\RecordEditor_HSQL\Params.Properties Vista - C:\Users\\RecordEditor_HSQL\Params.Properties Linux - You do not need to update the parmeter file (use the Database Combo) new Properties Contents - #---------------------------------------------------- #RecordEditor #Fri Jul 24 19:15:07 EST 2009 DefaultFileDirectory=/SampleFiles/* CopyBookReader=RecordEditor XML Copybook DateFormat=dd.MMM.yyyy VelocityTemplateDirectory=/SampleVelocityTemplates/File/* Source.1=jdbc\:hsqldb\:file\:/Database/recordedit;readonly\=no; DefaultCobolDirectory=/CopyBook/Cobol/* ExpandVars.1=Y VelocityCopybookDirectory=/SampleVelocityTemplates/Copybook/* DefaultDB=Record Edit - file SignificantCharInFiles.3=22 SignificantCharInFiles.2=12 SignificantCharInFiles.1=6 CopyBookWriter=RecordEditor XML LooksClassIndex=1 CopybookDirectory=/CopyBook/Xml/ User.1=sa Driver.1=org.hsqldb.jdbcDriver User.0=sa #--------------------------------------------------------- Once the property file has been updated; The Database Combo will control wether you use the Server or Embedded DB Access. Exit the Editor and restart; it should now start in imbedded mode. You can control wether it defaults to Server or Imbeded mode via Edit >>>> Edit Startup options; Then Properties // Defaults Then click on Default DB :-) ---------------------------------------------------------------- RecordEditor 0.67 Test 2 is out (See https://sourceforge.net/projects/record-editor/files/) Chages from Test 1 include * A lot fixes for the copy function. You should be able to Copy Cobol to / from Delimited Files Copy XML to Cobol / Delimited fiiles * There are 2 new copy options - Copy to delimited - Copy to Velocity, basically throughs the File at a Velocity Template. Could be useful for reformatting a Cobol File as free format text. Note: You need to download the Velocity files and install them in the lib directory * The HSQL version should now - Use the HSQL Server if running - Open the DB in embedded mode if not This works well in Linux but there can be a noticable delay when opening the DB in embeded mode on Window * Added SQLite to the Generic Version (which I have included this time). You will need to download the SQLite JDBC driver from here http://www.zentus.com/sqlitejdbc/ Note: As well as SQLite the Generic version support running with HSQL, H2 and Apache Derby DB's in embeded mode * Added a quick and dirty Cobol Copybook analysis function (on the file menu) which will display a copybooks fields, there starting position and length etc. Note: I basically convert the copybook to Xml and View the XML using the RecordEditor which is why there are a few funny XML type fields in the display Bruce ---------------------------------------------------------------- Hello, does anyone know if there were any recent updates to this product? Is there support for variable length records? ---------------------------------------------------------------- According to the linked project page there is an production version 0.69.1 (date 10-10-05) and a test version 0.80.2 (date 12-03-13). Downloads and changelogs are available there. I suggest that you have a look at them and answer your question (and other stuff you recognize) here. If you find bugs report them at the project site. human ---------------------------------------------------------------- Ok, thanks. :-) Here's the thing, based upon reading the existing documention, the RecordEditor is a great product. As of which, I have the following options: 1. If a file is created in OC with ORGANIZATION IS LINE SEQUENTIAL, RecordEditor will be able to view/edit that file. RecordEditor, recognizes cr/lf and also an EOR marker. 2. If a file is created in OC with ORGANIZATION IS RECORD BINARY SEQUENTIAL, with fixed length records, this works fine with RecordEditor. 3. However, as for files created in OC with Variable Length Binary Records, as my understanding each record is prefixed a (4 byte – big endian) binary integer, which indicates the length of the data with follows. Based upon the documentation I saw, I’m not sure how to handle this with the RecordEditor? :-? Though, on a side note, I’ve used a product called “SPF/PC” for years. It has a feature, to recognize variable length records, which are prefixed with record length indicators of (2 byte – little endian) binary integers. Though, I'm not sure if I could read this type of format in OC? ---------------------------------------------------------------- 1) The RecordEditor should be able to handle Variable Length Records; But there is a trick to it - You must define the File Structure as Open Cobol VB Download this png: http://record-editor.svn.sourceforge.net/viewvc/record-editor/Temp/LayouteditorOC.png?view=log to see where to define the record format 2) Mainframe VB file structure is different Open Cobol VB format so SPF/PC probably be able to handle it, From Memory On the mainframe, the VB Length includes the 4 byte RDW In OC VB the Length does not include the 4 byte RDW ---------------------------------- I have just had an extended holiday and am now catchinbg up with outstanding User requests / bug reports. So If anyone has any feature / change request; let me know Bruce ---------------------------------------------------------------- Hi Bruce, a change request would be to change the GUI a way one don't has to know "tricks" like the one you just mentioned. Another one to use [code]start /b javaw[/code] in the win batches to not pop up an unused cmd.exe. A feature request is to read(/write?) OC's ISAM implementation with BDB files and ACU-COBOL Vision Files (documentation to the first can be found from libcob/fileio.c and I may am able to get some docs to the second one, if needed). human ---------------------------------------------------------------- 1) File Format: when editting files with a lot of records, it would be possible to work out the format. The issue comes for empty files or those with one or two records. What ever method used would need to work for Cobol Files + users who using the package with standard windows/unix files. I will see if I can think of a solution. 2) start /b javaw - Will do 3) Basically willing when I have the time (which isn't now). This will be a big change What is the current state ISAM in open-cobol; the last time I checked, there was a choice of ISAM formats. 4) ACU-COBOL Vision Files willing to look at it and will probably do it if I can. But I will need a) Documentation both file format and b) Sample files (as many as possible) + copybooks c) Some one with access to Accu Cobol to test the changes note: I wrote some Cobol programs (open-cobol) to write sample files http://sourceforge.net/projects/record-editor/files/Prod/Version_0.69.1/CobolTestFilePrograms.zip/download If some one can run them and give me the results, it would be some thing to go on. Bruce ---------------------------------------------------------------- Hi Bruce, please upload a file http://sourceforge.net/projects/record-editor/files/Prod/Version_0.70/CobolTestFilePrograms.zip/download with creation of ISAM files. That way you can get exactly the files you want (and already have the copybooks). I'd try to run the tests with OC's free ISAM implementations (BDB and VBISAM [CISAM and DISAM are other choices but require paid libraries]), along with ACU-COBOL (different file versions) and upload them via SF feature tracker. human ---------------------------------------------------------------- Not worth doing for ISAM, I will probably either 1) call the C programs from java, 2) Convert c to Java byte code either way there will a lot of investigation. Saves working out the format and how to inser / delete records. ---------------------------------------------------------------- Hm, in any case I guess it would be good to have test files, wouldn't it? Hint for file types supported by OC: they need external libraries (BDB needs libdb.dll/so, VBISAM libvbisam.dll/so, DISAM libdisam.dll/so, CISAM libcisam.dll/so). I'm not sure if you can find free-to-use versions of these, especially for DISAM/CISAM. If done that way, it could be a good idea to read the absolute path to these libraries from environment and to disable the support if the environment entries aren't set/libraries cannot be loaded. Not sure how to access ACU ISAM (Vision) files, without rewriting the functions. human ---------------------------------------------------------------- I have created to Forum entries on the RecordEditor project for Enhancements + user interface changes for this year. https://sourceforge.net/projects/record-editor/forums/forum/467594 ---------------------------------------------------------------- Subject: What USAGE COMP should be used for counters to speed up COBOL? This topic is only about OC, because the storage of the different COMPUTATIONAL types are not standardized (correct me if I'm wrong). Because we talk about counters, we do not need to store any sign. Given the codes [code]inspect myspecialtext tallying myvar for all x'FE' perform something myvar times add 2 to myvar end-add compute myvar = (myvar/4 - 1)* 2 end-compute move mytable(myvar) to mytable(myvar + 1)[/code] For myvar, one could use a PIC 9(02) USAGE DISPLAY, but because of the ASCII storage, this has no good performance and needs more storage. I think the best would be either COMP-4 or COMP-5. Both seem to store the items as binary and seem to use only as much bytes as necessary according to the PICTURE string. Do you know if this answer is right and what the differences between COMP-4 and COMP-5 are? human ---------------------------------------------------------------- On a Intel machine I would guess (and it is only a guess) that comp-5 might be better then Comp-4 as it is a Little Endian Integer (the same as Intel uses). On a Machines with big-endian (i.e. IBM Power series) the reverse may be true ---------------------------------------------------------------- [quote] Bruce wrote: On a Intel machine I would guess (and it is only a guess) that comp-5 might be better then Comp-4 as it is a Little Endian Integer (the same as Intel uses). On a Machines with big-endian (i.e. IBM Power series) the reverse may be true[/quote] comp-5 will always be not worse than comp-4. comp-5 is a "native" int (not specifically little-endian) and on big-endian if using "-fnotrunc" it will be the same as comp-4. If truncation is enforced, comp-5 will be better as it is not a subject for truncation. ---------------------------------------------------------------- I think the USAGE BINARY-xxxx words help out here. As far as I know; not BINARY in particular, but BINARY-SHORT, BINARY-LONG etc are, by spec, going to use native operations on any platform OC will compile to. If you need to interface with C long types, the OC extension of BINARY-C-LONG tells the code emitter to use C long types ... whatever size the native C compiler will compile to, so if the C object and the OpenCOBOL are compiled on the same machine ... all will be good. Now as to the "as far as I know" part. I did some gprof profiling experiments on my little Pentium 4 Debian box. A tight loop of FLOAT-LONG seemed to come up with the best score more times than not. But I gotta be missin' something, as this seems a little counter intuitive? [code] *>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20090502 *> Purpose: Experiments with profiling and gprof *> Tectonics: export COB_CFLAGS='-pg' COB_LDFLAGS='-pg' *> cobc spin.cob *> sudo renice -20 -u brian *> ./spin *> sudo renice 0 -u brian *> gprof -b -p spin *> *************************************************************** identification division. program-id. spin. data division. working-storage section. 01 limiter constant as 10000000. 01 bin-limiter usage binary-long value limiter. 01 accumulator pic s9(8). 01 bin-accumulator usage binary-long. 01 comp-accumulator pic s9(8) usage computational-5. 01 float-accumulator usage float-long. *> *************************************************************** procedure division. move 0 to accumulator perform until accumulator greater than or equal to limiter call "accumulate" using accumulator end-call end-perform move 0 to bin-accumulator perform until bin-accumulator greater than or equal to bin-limiter call "bin_accumulate" using bin-accumulator end-call end-perform move 0 to comp-accumulator perform until comp-accumulator greater than or equal to limiter call "comp_accumulate" using comp-accumulator end-call end-perform move 0 to float-accumulator perform until float-accumulator greater than or equal to limiter call "float_accumulate" using float-accumulator end-call end-perform goback. end program spin. *> *************************************************************** *> *************************************************************** identification division. program-id. accumulate. data division. linkage section. 01 local-value pic s9(8). procedure division using local-value. add 1 to local-value. goback. end program accumulate. *> *************************************************************** *> *************************************************************** identification division. program-id. bin_accumulate. data division. linkage section. 01 local-value usage binary-long. procedure division using local-value. add 1 to local-value. goback. end program bin_accumulate. *> *************************************************************** *> *************************************************************** identification division. program-id. comp_accumulate. data division. linkage section. 01 local-value pic s9(8) usage computational-5. procedure division using local-value. add 1 to local-value. goback. end program comp_accumulate. *> *************************************************************** *> *************************************************************** identification division. program-id. float_accumulate. data division. linkage section. 01 local-value usage float-long. procedure division using local-value. add 1 to local-value. goback. end program float_accumulate. *> *************************************************************** [/code] with [code] $ export COB_CFLAGS='-pg' COB_LDFLAGS='-pg' $ cobc spin $ ./spin $ gprof -b -p spin Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls s/call s/call name 40.65 0.50 0.50 1 0.50 1.23 spin_ 11.38 0.64 0.14 10000000 0.00 0.00 comp_accumulate_ 10.57 0.77 0.13 10000000 0.00 0.00 accumulate_ 10.57 0.90 0.13 10000000 0.00 0.00 bin_accumulate_ 9.76 1.02 0.12 10000000 0.00 0.00 float_accumulate_ 7.32 1.11 0.09 10000000 0.00 0.00 accumulate 4.07 1.16 0.05 10000000 0.00 0.00 float_accumulate 3.25 1.20 0.04 10000000 0.00 0.00 bin_accumulate 2.44 1.23 0.03 10000000 0.00 0.00 comp_accumulate 0.00 1.23 0.00 1 0.00 1.23 spin [/code] Cheers, Brian ---------------------------------------------------------------- The original question was only about USAGE COMP and ska's answer was the one I thought of (but wasn't sure about). Roger said some time before that one should [quote]Define [... the fields] as PIC S9(8) COMP-5 (alternatively as USAGE BINARY-LONG SIGNED)[/quote] but there was no explanation why. Brian, would you be so good as to - raise limiter by adding a zero - add one section for binary and another for binary-short - add sections for every binary SIGNED - add one section with pic 9(8) comp-5 - add one section with pic 9(2) comp-5 (calling everything more often using "limiter2 value 90" in every sub-program), coded like [code] [...] program-id. spin. data division. working-storage section. 01 limiter constant as 10000000. [...] procedure division. perform limiter times call "accumulate" end-call end-perform [...] program-id. accumulate. data division. working-storage section. 01 limiter2 constant as 90. 01 accumulator pic s9(8). procedure division using local-value. perform varying accumulator from 0 by 1 until accumulator > limiter2 continue end-perform goback. [...][/code] Maybe it would be good to use ACCEPT FROM TIME (with hundreds) before and after PERFORM limiter TIMES and compute the used time via COBOL instead of using gnu profiler? And then, for extended comparison compile and run the code 4 times, one with [code]$ cobc spin[/code] another one with [code]$ cobc -O2 spin[/code] another one with [code]$ export COB_CFLAGS='-march=native' $ cobc spin[/code] and the last one with [code]$ export COB_CFLAGS='-march=native' $ cobc -O2 spin[/code] Thank you in advance, human ---------------------------------------------------------------- Subject: Information on Open Cobol We are thinking of migrating from Microfocus Cobol on HP-UX to Open Cobol on a Linux platform. The extent of our usage of cobol is limited to top level (driver type) programs and sub-programs ie. we DON'T use it to create screens or perform interactive de-bugging etc. We are new to Open Cobol and would welcome any information with regards to : • Has anybody done this? • Migrating to Open Cobol - success stories • Number of installed bases (especially in South Africa) • If at all possible - sample company names (especially in South Africa) • Adoption rate of the technology • Any pitfalls • Stability • Performance • Integration with newer technologies (java, c++, c#) • XML parsing • Support availability • Any other concerns which we should be aware of Any advice or information will be appreciated :-) ---------------------------------------------------------------- You should be aware that OC enither - claims Micro Focus compatibility nor - accepts ALL enhancement requests for Micro Focus extensions On the other hand, OC does have many MF extessions. You might want to try compilering your existing programs with MF with the FLAG(ANS85) directive turned on and see how extensive your use of MF extensions are. You might also compile them with FLAG(ENTCOBOL) and this will show you how many extensions that are NOT part of IBNM COBOL you also use. In general (but NOT universally) extensions that are common to Micro Focus and IBM are implemented within OC. However, if your programs rely on many MF extensions that are not also IBM extensions, there is a reasonable chance that they are not in OC and not planned for availability soon. ---------------------------------------------------------------- If you do not need any screen interaction, you are on a good way. Stability and Performance in general is fine, but if you need ISAM (you do, aren't you?) this gets a little bit complicated, depending on how you use it and how the SELECTs are defined (SPLIT KEYs are not implemented yet and have to be recoded) - this is the most important point you have to have a look at. There is no XML parsing available yet, therefore you need to do that either in COBOL or another language and pass the results to OC. Integration with other technologies work well, you should have a look at the FAQ (link is on the left). human ---------------------------------------------------------------- Subject: How do I allocate memory with variable length data? I'm looking to see if it's possible to run my application in Open Cobol. Is there an Open Cobol equivalent to the CEEGTST on the mainframe or the CBL_ALLOC_MEM in MicroFocus? ---------------------------------------------------------------- If you look at the FAQ section (reserved words), it appears that OC has already implemented ALLOCATE (and FREE) syntax as defined in the '02 Standard. It does use "BASED" format of data descriptions, but that shouldn't be too serious a conversion problem. ---------------------------------------------------------------- ALLOCATE and FREE work very fine. If you want to use big vars throughout the whole program, LOCAL-STORAGE SECTION is a fine thing, too. human ---------------------------------------------------------------- Thanks William & Human. A couple of questions on that though. I already looked at the doc here, but I'm not really understanding what "Based" means. The example doesn't really show whats accomplished by using the Based option. Also, I don't see how to pass the length of the area to the Allocate statement. What I'm allocating is a variable length area, thus the need to allocate it. So, I get storage of varying lengths, determined at run-time. The example in the Open Cobol lib for Allocate shows a fixed length item, and it doesn't show any parms that can be passed to the Allocate. If I'm missing answers in some doc somewhere, just point me to it. The IBM doc doesn't cover the Based option. Thanks, Vivian ---------------------------------------------------------------- @vsaegesser: please change the subject of this thread (=>first post) to something like "How do allocate memory with variable length (e.g. 'get main')", because many persons will not know what "get main" means. If you declare a var as BASED, there is no memory reserved for that var. If you do an ALLOCATE, the memory for this var is allocated. Normally you do this with fixed length. An option could be to define the maximum length via OCCURS and set the actual length by DEPENDING ON, [code] 77 mylengthvar pic 9(08). 01 myallocvar BASED . 05 filler occurs 99999999 depending on mylengthvar pic x. ... ALLOCATE myallocvar INITIALIZED move 5 to mylengthvar move all '5' to myallocvar call 'OC_CBL_DUMP' using myallocvar end-call move 8 to mylengthvar move all '8' to myallocvar call 'OC_CBL_DUMP' using myallocvar end-call FREE ADDRESS OF myallocvar[/code] This results in, [quote]Offset HEX-- -- -- 5- -- -- -- -- 10 -- -- -- -- 15 -- CHARS----1----5- 000000 35 35 35 35 35 55555........... Offset HEX-- -- -- 5- -- -- -- -- 10 -- -- -- -- 15 -- CHARS----1----5- 000000 38 38 38 38 38 38 38 38- 88888888........ [/quote] OC reserves the maximum defined bytes (this is something you have to know before) but uses only the needed ones. Some other vendors don't pass the right length to sub programs, there you have to use [code]call 'OC_CBL_DUMP' using myallocvar (1:lengthvar) end-call[/code] If you do not want to have to much unnecessary memory in use you could do [code] 77 mylengthvar pic 9(08). ... 01 myallocvar-4 BASED . 05 filler occurs 9999 depending on mylengthvar pic x. 01 myallocvar-5 BASED . 05 filler occurs 99999 depending on mylengthvar pic x. ... evaluate mylengthvar when 1 thru 9999 ALLOCATE myallocvar-4 INITIALIZED call 'OC_CBL_DUMP' using myallocvar-4 end-call FREE ADDRESS OF myallocvar-4 when 10000 thru 99999 ALLOCATE myallocvar-5 INITIALIZED call 'OC_CBL_DUMP' using myallocvar-5 end-call FREE ADDRESS OF myallocvar-5 end-evaluate ...[/code] This stuff works fine! human ---------------------------------------------------------------- Subject: FR: Add the possibilty for delayload of vbisam.dll, lbdbnn.dll, ... If one tries to compile with MSVC9 and add the /DELAYLOAD:vbisam.dll, the linker complains about [quote]LINK : fatal error LNK1194: cannot delay-load "vbisam.dll" due to import of data symbol "__imp__isreclen"; link without /DELAYLOAD:vbisam.dll[/quote] If you do not do anything with ISAM files (for example compiling HELLO.cob), it is very annoying that one needs the dll. What can be done for loading these dlls only if needed? human ---------------------------------------------------------------- Subject: Problems with self compiled VBISAM (MSVC) "libcob: Unknown file error (STATUS = 39)" For starting on WIN I grabbed the kiska project files, updated them to VC9, used most recent OC tarball, did a little bit of editing to config.h and defaults.h and tried to compile and run some samples. For ISAM I used the [url=http://opencobol.add1tocobol.com/ocfaq.html#does-opencobol-support-isam]ISAM sample found at the OC FAQ[/url] which worked fine. Then I downloaded [url=http://www.sim-basis.de/vbisam-2.0.tar.gz]http://www.sim-basis.de/vbisam-2.0.tar.gz[/url], made a new VC9 project for vbisam, vbcheck, vbrecover and compiled these. After some struggling and self defining a vbisam.def, this worked fine. If I take a vbisam file (both .dat and .idx) and do [code]vbcheck MYFILE[/code] this works fine, therefore vbisam alone seems to work well, [quote]Processing: MYFILE Table node size: 4096 bytes Index 1: ISNODUPS Part 1: 209,12,CHARTYPE Index 2: ISDUPS Part 1: 4,90,CHARTYPE Index 3: ISDUPS Part 1: 221,1,CHARTYPE Index 4: ISDUPS Part 1: 751,25,CHARTYPE Index 5: ISDUPS Part 1: 94,115,CHARTYPE Index 6: ISDUPS Part 1: 3448,20,CHARTYPE Index 7: ISDUPS Part 1: 3468,20,CHARTYPE Index 8: ISDUPS Part 1: 3488,20,CHARTYPE[/quote] Afterwards I compiled OC, using the new vbisam (removed #define WITH_DB and adding #define WITH_VBISAM 1 in config.h, linked vbisam). This worked fine, too. Now I recompiled indexing.cob, removed the indexing BDB files and tried to run again with cobcrun. This time I got an error, [quote]indexing.cob:74: libcob: Unknown file error (STATUS = 39) File : 'indexing'[/quote](line 74 is "open i-o indexing", no difference if you change it to "open output" and remove the "select optional") This sample works fine with VBISAM/OC on a unix machine. Has anybody a clue or a guess how to fix that? human ---------------------------------------------------------------- Hi, So far I didn't succeed in using VBISAM on Win, but I didn't have a lot of time. Maybe I will pay more attention to it in a future. First of all, you should correct one bug. *** ishelper.c.orig 2009-07-22 13:33:39.000000000 -0400 --- ishelper.c 2008-08-28 10:03:52.000000000 -0400 *************** *** 69,78 **** return -1; } if (psvbptr->iindexhandle >= 0) { ! fsync (svbfile[psvbptr->iindexhandle].ihandle); } if (psvbptr->idatahandle >= 0) { ! fsync (svbfile[psvbptr->idatahandle].ihandle); } return 0; } --- 69,78 ---- return -1; } if (psvbptr->iindexhandle >= 0) { ! fsync (psvbptr->iindexhandle); } if (psvbptr->idatahandle >= 0) { ! fsync (psvbptr->idatahandle); } return 0; } At second, I did use this correction in vblocking - ivbenter has a mismatch with ivbexit. This correction is wrong anyway, but at least we need to do something with that: *** vblocking.c.orig 2009-07-22 13:21:50.000000000 -0400 --- vblocking.c 2008-08-28 12:37:18.000000000 -0400 *************** *** 209,220 **** return -1; } psvbptr->iindexchanged = 0; - /* if (psvbptr->iopenmode & ISEXCLLOCK) { psvbptr->iisdictlocked |= 0x01; return 0; } - */ if (psvbptr->iisdictlocked & 0x03) { iserrno = EBADARG; return -1; --- 209,218 ---- And than of course you will figure out that on Win locking functions do not allow double-locking, and on Unix they do. That's the major problem with VBISAM on Win. Actually we have to remember all locks (and I think VBISAM is really doing that), and check if we already have a lock to prevent double-lock attempt... Other option is to ignore ERROR_LOCK_VIOLATION, but that's wrong. ---------------------------------------------------------------- I have no clue what this stuff should do. Could you please explain a little bit of your change? Could you please use the code tag for easier reading, either by click the <>-Button in post/edit or using the [ code][ /code] (without the spaces)? Thank you for both, human ---------------------------------------------------------------- [quote] human wrote: I have no clue what this stuff should do. Could you please explain a little bit of your change? [/quote] The first part is just a bug. In the second part, in vblocking.c, because in ivbexit Roger commented out [code] /* RXW if (psvbptr->iopenmode & ISEXCLLOCK) { return 0; } */ [/code] ivbexit unlocks (and I think that is wrong - ecxlusive lock should remain till the full close) And if we are not commenting out the corresponding part in ivbenter, there will be no lock at all, and finally at some point unlock is failing. Anyway it's just a temporary workaround, and I'm considering VBISAM still nonworking on Win. [quote] Could you please use the code tag for easier reading, [/quote] My mistake - I was using "<" instead of "[" :-) ---------------------------------------------------------------- I try both tomorrow. At least the open output should work on Win... human ---------------------------------------------------------------- I did some changes again, and now it looks a little bit better. Posting the patches to the original Roger's version: [code] *** ishelper.c.orig 2008-08-28 10:03:52.000000000 -0400 --- ishelper.c 2009-07-22 13:33:39.000000000 -0400 *************** *** 69,78 **** return -1; } if (psvbptr->iindexhandle >= 0) { ! fsync (psvbptr->iindexhandle); } if (psvbptr->idatahandle >= 0) { ! fsync (psvbptr->idatahandle); } return 0; } --- 69,78 ---- return -1; } if (psvbptr->iindexhandle >= 0) { ! fsync (svbfile[psvbptr->iindexhandle].ihandle); } if (psvbptr->idatahandle >= 0) { ! fsync (svbfile[psvbptr->idatahandle].ihandle); } return 0; } [/code] ... missed one point on this one, so I'm editing this [code] *** vblocking.c.orig 2008-08-28 12:37:18.000000000 -0400 --- vblocking.c 2009-07-28 16:08:02.000000000 -0400 *************** *** 28,33 **** --- 28,64 ---- /* Local functions */ static int + ilockexist (const int ihandle, const off_t trownumber) + { + struct DICTINFO *psvbptr; + struct VBLOCK *psnewlock = NULL, *pslock; + int iindexhandle; + + psvbptr = psvbfile[ihandle]; + iindexhandle = psvbptr->iindexhandle; + pslock = svbfile[iindexhandle].pslockhead; + /* Head of list */ + if (pslock == NULL || trownumber < pslock->trownumber) { + return 0; + } + /* Tail of list */ + if (trownumber > svbfile[iindexhandle].pslocktail->trownumber) { + return 0; + } + /* Position pslock to insertion point (Keep in mind, we insert AFTER) */ + while (pslock->psnext && trownumber >= pslock->psnext->trownumber) { + pslock = pslock->psnext; + } + /* Already locked? */ + if (pslock->trownumber == trownumber) { + if (pslock->ihandle == ihandle) { + return 1; + } + } + return 0; + } + + static int ilockinsert (const int ihandle, const off_t trownumber) { struct DICTINFO *psvbptr; *************** *** 65,71 **** return 0; } /* Position pslock to insertion point (Keep in mind, we insert AFTER) */ ! while (pslock->psnext && trownumber > pslock->psnext->trownumber) { pslock = pslock->psnext; } /* Already locked? */ --- 96,102 ---- return 0; } /* Position pslock to insertion point (Keep in mind, we insert AFTER) */ ! while (pslock->psnext && trownumber >= pslock->psnext->trownumber) { pslock = pslock->psnext; } /* Already locked? */ *************** *** 303,313 **** } ttransnumber = inl_ldquad (psvbptr->sdictnode.ctransnumber); psvbptr->ttranslast = ttransnumber; ! /* RXW if (psvbptr->iopenmode & ISEXCLLOCK) { return 0; } ! */ if (psvbptr->iisdictlocked & 0x02) { if (!(psvbptr->iisdictlocked & 0x04)) { psvbptr->ttranslast = ttransnumber + 1; --- 334,344 ---- } ttransnumber = inl_ldquad (psvbptr->sdictnode.ctransnumber); psvbptr->ttranslast = ttransnumber; ! //* RXW if (psvbptr->iopenmode & ISEXCLLOCK) { return 0; } ! //*/ if (psvbptr->iisdictlocked & 0x02) { if (!(psvbptr->iisdictlocked & 0x04)) { psvbptr->ttranslast = ttransnumber + 1; *************** *** 465,471 **** } else if (imode == VBUNLOCK) { iresult = ilockdelete (ihandle, trownumber); } ! if (!iresult) { toffset = VB_OFFLEN_40; iresult = ivblock (psvbptr->iindexhandle, toffset + trownumber, tlength, imode); --- 496,502 ---- } else if (imode == VBUNLOCK) { iresult = ilockdelete (ihandle, trownumber); } ! if (!iresult && (imode == VBUNLOCK || !ilockexist (ihandle, trownumber))) { toffset = VB_OFFLEN_40; iresult = ivblock (psvbptr->iindexhandle, toffset + trownumber, tlength, imode); [/code] ---------------------------------------------------------------- Thank you, the first test [url=http://opencobol.add1tocobol.com/ocfaq.html#does-opencobol-support-isam]indexing.cob (ISAM sample found at the OC FAQ)[/url] works now. The next tries are different versions of START and later on the locking. human ---------------------------------------------------------------- Subject: BDB Interface When changing a record in a BDB dataset through a programm, a second in parallel running programm will not see the changed data, I assume not before the old data have been overwritten in its buffers and have to be read again. What interface conventions to BDB have been set by OC and how can I change these parameters? ---------------------------------------------------------------- The programs have to use the same BDB environment. For this, set the environment variable DB_HOME to a directory which should contain the BDB environment (i.e. files with names like __db.001). This directory will also be used to store the isam files, unless it contains a file DB_CONFIG with an entry "set_data_dir path_to_isam_files" Hans-Martin ---------------------------------------------------------------- Subject: Escape key not working Can anyone help me to get the escape key working on accept please? Build: cobc (OpenCOBOL) 1.1.0 Packaged Feb 06 2009 10:30:55 CET Platform: Slackware 12.2 i386 Terminals, I have tried: normal terminal or under xfce: xterm, rxvt & konsole Shell: bash In both .bash_profile and .bashrc and I have: export COB_SCREEN_EXCEPTIONS=Y export COB_SCREEN_ESCAPE=Y echo "$COB_SCREEN_ESCAPE" echo "$COB_SCREEN_EXCEPTIONS" both show 'Y' (and I can read these environmental variables from within the program, and they are there if I call SYSTEM using xterm from the program and then do the echo's) The environmental variables have enabled Page up & Page down, but none of the other keys that should terminate an accept statement (F1-F12 & Enter were working without them). Any ideas? (curiously F1-F4 don't work under rxvt - but that is a different problem) ---------------------------------------------------------------- Did you really mean "COB_SCREEN_ESCAPE"? It's supposed to be "COB_SCREEN_ESC". ---------------------------------------------------------------- Ah - thanks, working now. The FAQ needs to be corrected, section 5.21 says: "COB_SCREEN_ESCAPE=Y" ---------------------------------------------------------------- Oops. Fixed in rc38. Cheers, Brian ---------------------------------------------------------------- Subject: New draft of next COBOL revision From the PL22.4 distribution list, "Committee draft 1.1 has also been posted as the current base document. However, there were a number of editorial changes that were missed when assembling this document, so another document will be published within the next few weeks." See: http://www.cobolstandard.info/j4/index.htm Item: 20xx – Base Document for 20xx standard July 2009 (Nelson) ---------------------------------------------------------------- Thank you for this important information and the link to the newer version. If you see the new document, please make a new post about this at this topic. Do you know what the exact difference between "Working Draft International Standard" and "Committee Draft International Standard" is? I just had a quick look for differences to the last WD: - 8 pages more - 286 differences The most differences seem to be because of the new headlines (the text did exist before) for "General" (for example in point 14.) and because of missing entries to the PDF document structure. Maybe anybody knows changes that are real relevant for programmers/vendors, if there are some. human ---------------------------------------------------------------- I think (but won't swear to it) that the chagnes are documented in: 09-0124 – Combined Change Proposal #11 (Nelson) and 09-0125 – Project Editor Change Proposal #12 which can also be reached from http://www.cobolstandard.info/j4/index.htm How useful (or readable) you will find these dcouments is questionable, but they should be where tyou arart to look for what changes have been invorporated in this draft. ---------------------------------------------------------------- Subject: FIX common.h for MSC: cobc XYZ results in compiler warning C4715, better use _declspec(noreturn) As mentioned before I try to use self compiled OC and VBISAM with VC9, using MSC in compiling with cobc. For EVERY COBOL file the compiler complained about 'prog-id_' : not all control paths return a value (C4715). After some digging I created my first small patch for OC: common.h, line 286[code]#ifdef __GNUC__ extern void cobexit (int) __attribute__ ((noreturn)); extern void cob_stop_run (const int) __attribute__ ((noreturn)); extern void cob_fatal_error (const unsigned int) __attribute__ ((noreturn)); extern void cob_runtime_error (const char *, ...) __attribute__ ((format (printf, 1, 0))); extern void *cob_malloc (const size_t) __attribute__ ((malloc)); #else [b]// using _declspec(noreturn) for MSVC, removing compiler warning C4175 because cob_fatal_error never returns (human) #ifdef _MSC_VER extern void __declspec(noreturn) cobexit (int); extern void __declspec(noreturn) cob_stop_run (const int); extern void __declspec(noreturn) cob_fatal_error (const unsigned int); #else[/b] extern void cobexit (int); extern void cob_stop_run (const int); extern void cob_fatal_error (const unsigned int); [b]#endif[/b] extern void cob_runtime_error (const char *, ...); extern void *cob_malloc (const size_t); #endif[/code] Is this a worthy patch? human ---------------------------------------------------------------- Subject: Does anybody like to have recent VC9 project files, OC WIN Binaries? I updated the kiska project files to VC9 and made new ones for VBISAM. At the current state, I could provide - VC9 project files for VBISAM - VC9 project files for OC using with VBISAM - VC9 project files for OC using with BDB44 I could also provide recent builds for these. Important: VBISAM does not work for me with OC on WIN. Can add1tocobol could host these? Whom should I ask for? human ---------------------------------------------------------------- Building DLLs on Win32 can be cumbersome as it uses PE-COFF. You have to create a DEF file, and export library (VC: libvbisam.lib) before you can create a DLL. That is where the 'declspec(dllexport/dllimport)' are used. Maybe, Sergey can add OC (1.1.20090206) binaries using VBISAM to his web site [1]. 1) OpenCobol Binaries built using VC http://kiska.net/opencobol/1.1/ :-D ---------------------------------------------------------------- Yes, I know because I was going to this process last week. For easier compiling I added flex/bison as "parsertools" (necessary for compiling cobc). When we talk about this here: are extra entries for 64bit systems in the project files usefull (Sergey had them)? human ---------------------------------------------------------------- [quote] essex wrote: Maybe, Sergey can add OC (1.1.20090206) binaries using VBISAM to his web site [1]. [/quote] Sure, I have a lot of space. No problem with that. ---------------------------------------------------------------- Should I mail the whole stuff to you? If yes, please send a PM with the mail address. human ---------------------------------------------------------------- Subject: VAX VMS to OpenCOBOL Dear All We are considering the migration of an application currently hosted on VAX VMS to Linux. I have two questions to ask. 1. Last stable build on openCOBOL seems to be from 2007-2008. Is there active development happening? 2. Can someone please share insights/best practices that I should be aware of? Thank you in advance. Warm Regards :-D ---------------------------------------------------------------- Ahh, OpenVMS/Vax ... 1) Yes and kinda. Roger is our lead and well, only, core compiler author, so with time commitments and other factors, some of us a little down the skill ladder are wondering how that effort can be spread over a few more developers. Recent visits to the forum, there are some up and coming, capable, C technical discussions occurring. A very good sign. More recent 1.1 builds, while pre-release, are quite a bit more functional than the 1.0 binaries. Well worth getting a build-essentials environment set up on any GNU/Linux box for. 2) Insights ... hmmm ... how about personal emotional anecdotes? I'd relish a chance to take a kick at porting from OpenVMS COBOL to GNU/Linux and OpenCOBOL, but I'd probably end up taking far too many years ... being too emotionally attached to DCL and EVE and RMS and .... High probability of procrastinating on the problem and working on "supporting tools" and the like, just to get a chance to sit at a VT220 everyday. :) A little insight perhaps ... it's a personal view but, don't expect the quality of engineering in GNU/Linux compared to Vax. I've found it almost feels like coming to terms with the simple, amazed realization of [i]how duct tape and glue actually [b]can[/b] fly airplanes[/i] ... but would you really want to fly them across the ocean? ;) Cheers, Brian ---------------------------------------------------------------- Subject: FIX cobc.h for supporting spaces in pathnames (MSVC) It's necessary to add \" around all %s when using the options /Fa, /Fe and /Fo. Here is the content of the patchfile for cobc.c: [code]1393,1394c1393,1394 < "%s /c %s %s /Od /MDd /Zi /FR /c /Fa\"%s\" /Fo\"%s\" %s" : < "%s /c %s %s /MD /c /Fa\"%s\" /Fo\"%s\" %s", --- > "%s /c %s %s /Od /MDd /Zi /FR /c /Fa%s /Fo%s %s" : > "%s /c %s %s /MD /c /Fa%s /Fo%s %s", 1411,1412c1411,1412 < "%s /c %s %s /Od /MDd /Zi /FR /Fo\"%s\" %s" : < "%s /c %s %s /MD /Fo\"%s\" %s", --- > "%s /c %s %s /Od /MDd /Zi /FR /Fo%s %s" : > "%s /c %s %s /MD /Fo%s %s", 1454,1455c1454,1455 < "%s %s %s /Od /MDd /LDd /Zi /FR /Fe\"%s\" /Fo\"%s\" %s %s %s" : < "%s %s %s /MD /LD /Fe\"%s\" /Fo\"%s\" %s %s %s", --- > "%s %s %s /Od /MDd /LDd /Zi /FR /Fe%s /Fo%s %s %s %s" : > "%s %s %s /MD /LD /Fe%s /Fo%s %s %s %s", 1462c1462 < sprintf (buff, "mt /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); --- > sprintf (buff, "mt /manifest %s.dll.manifest /outputresource:%s.dll;#2", name, name); 1504,1505c1504,1505 < "%s /Od /MDd /LDd /Zi /FR /Fe\"%s\" %s %s %s" : < "%s /MD /LD /Fe\"%s\" %s %s %s", --- > "%s /Od /MDd /LDd /Zi /FR /Fe%s %s %s %s" : > "%s /MD /LD /Fe%s %s %s %s", 1511c1511 < sprintf (buff, "mt /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); --- > sprintf (buff, "mt /manifest %s.dll.manifest /outputresource:%s.dll;#2", name, name); 1584,1585c1584,1585 < "%s /Od /MDd /LDd /Zi /FR /Fe\"%s\" %s %s %s" : < "%s /MD /LD /Fe\"%s\" %s %s %s", --- > "%s /Od /MDd /LDd /Zi /FR /Fe%s %s %s %s" : > "%s /MD /LD /Fe%s %s %s %s", 1591c1591 < sprintf (buff, "mt /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); --- > sprintf (buff, "mt /manifest %s.dll.manifest /outputresource:%s.dll;#2", name, name); 1652,1653c1652,1653 < "%s /Od /MDd /Zi /FR /Fe\"%s\" %s %s %s" : < "%s /MD /Fe\"%s\" %s %s %s", --- > "%s /Od /MDd /Zi /FR /Fe%s %s %s %s" : > "%s /MD /Fe%s %s %s %s", 1659c1659 < sprintf (buff, "mt /manifest \"%s.exe.manifest\" /outputresource:\"%s.exe\";#2", name, name); --- > sprintf (buff, "mt /manifest %s.exe.manifest /outputresource:%s.exe;#2", name, name);[/code] I have no MinGW/GCC version here, maybe it would be necessary to submit a patch for this one, too. human ---------------------------------------------------------------- Good point ! Thanks. ---------------------------------------------------------------- The .obj files were missed. Here is a patch (line numbers may be wrong) [code]1454,1455c1454,1455 < "%s %s %s /Od /MDd /LDd /Zi /FR /Fe\"%s\" /Fo\"%s\" %s \"%s\" %s" : < "%s %s %s /MD /LD /Fe\"%s\" /Fo\"%s\" %s \"%s\" %s", --- > "%s %s %s /Od /MDd /LDd /Zi /FR /Fe\"%s\" /Fo\"%s\" %s %s %s" : > "%s %s %s /MD /LD /Fe\"%s\" /Fo\"%s\" %s %s %s", 1516,1517c1514,1515 < "%s /Od /MDd /LDd /Zi /FR /Fe\"%s\" %s \"%s\" %s" : < "%s /MD /LD /Fe\"%s\" %s \"%s\" %s", --- > "%s /Od /MDd /LDd /Zi /FR /Fe\"%s\" %s %s %s" : > "%s /MD /LD /Fe\"%s\" %s %s %s", 1576d1571 < strcat (objsptr, "\""); 1578c1573 < strcat (objsptr, "\" "); --- > strcat (objsptr, " "); 1671d1661 < strcat (objsptr, "\""); 1673c1663 < strcat (objsptr, "\" "); --- > strcat (objsptr, " "); [/code]. human ---------------------------------------------------------------- [quote] human wrote: [code] 1576d1571 < strcat (objsptr, "\""); 1578c1573 < strcat (objsptr, "\" "); --- > strcat (objsptr, " "); 1671d1661 < strcat (objsptr, "\""); 1673c1663 < strcat (objsptr, "\" "); --- > strcat (objsptr, " "); [/code] [/quote] Not sure about all Unixes, but maybe. Isn't it safer to do [code] #ifdef _MSC_VER strcat (objsptr, "\""); #endif etc... [/code] ---------------------------------------------------------------- GCC should have no problems with quotes. May the leader (Roger) decide this. human ---------------------------------------------------------------- Subject: OC switch "-o" with VC: fatal error LNK1149: "output filename matches input filename" Compiling with the VC binaries (both from kiska.net and the self compiled ones) works fine. If you use -o switch from OC you cannot use filename.dll [code]cobc -o filename.dll filename.cob[/code] results in, [quote]Link: fatal error LNK1149: "output filename matches input filename"[/quote] instead, one has to do [code]cobc -o filename filename.cob[/code] This works fine and filename.dll is created (filename.exe if you use the -x switch). When using cygwin, both (-o with and without .dll/.exe) works fine. Therefore I think the best would be to remove .dll / .exe from -o command switch in cobc.c, this should do no harm for any C-compiler and would help for MSVC. human ---------------------------------------------------------------- Yes, it's a bug. "-o" should not go to /Fo option if we are not compiling into object module. i.e. if it's "-c" it should go to /Fo and if there is no "-c" it should go only to /Fe and /Fo should not be used. Will check ---------------------------------------------------------------- OK, I wait for this topic until your checks are done. human ---------------------------------------------------------------- This one is still open, I just wanted to bump it up again. human ---------------------------------------------------------------- Subject: Bug (?) when using cobc -v: OC writes log info to error stream If you use [code]cobc -v -save-temps BLANKS.cob 1> verbose.log 2> verbose.err[/code] the following is written into the error stream (verbose.err), although no error occurred, [quote]preprocessing BLANKS.cob into BLANKS.i translating BLANKS.i into BLANKS.c gcc -pipe -Wno-unused -fsigned-char -Wno-pointer-sign -I/dev/opencobol/include -shared -fPIC -DPIC -Wl,--export-dynamic -o BLANKS.so BLANKS.c -lcob -lm -lvbisam -lgmp -lncurses -L/dev/opencobol/lib -L/dev/vbisam/lib[/quote] If compiled with MSVC, MS adds some extra text, [quote]Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. preprocessing BLANKS.cob into BLANKS.i translating BLANKS.i into BLANKS.c cl -I win32-bin\libcob -I "win32-bin" /MD /LD /FeBLANKS /FoBLANKS BLANKS.c "win32-bin\libcob.lib" "win32-bin\gmp.lib" mt /manifest BLANKS.dll.manifest /outputresource:BLANKS.dll;#2[/quote] Shouldn't these infos be found only in stdout (verbose.log)? human ---------------------------------------------------------------- The cobc.c code that reacts to -v, usually looks something like: [code] if (verbose_output) { fprintf (stderr, "preprocessing %s into %s\n", fn->source, fn->preprocess); } [/code] so I'm pretty sure it's design intent to go to standard error, [i]and there might be GNUey best practise guidelines about this somewhere?[/i]. Cheers, Brian ---------------------------------------------------------------- Subject: FIX cobc.h for not writing MS info to stdout, when -v is not used (MSVC) The fix can be seen in the next post, this was the problem: If you use [code]cobc -save-temps BLANKS.cob 1> normal.log 2> normal.err[/code] the following is written into stdout (normal.log), although no verbose mode (compiler switch -v) was used, [quote]Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. /dll /implib:BLANKS.lib /out:BLANKS.dll BLANKS.obj "win32-bin\libcob.lib" "win32-bin\gmp.lib" Creating library "BLANKS.lib" and object "BLANKS.exp" Microsoft (R) Manifest Tool version 5.2.3790.2076 Copyright (c) Microsoft Corporation 2005. All rights reserved.[/quote] Shouldn't these infos be found only in stdout (normal.log) if the -v switch is used? human ---------------------------------------------------------------- The solution is to add /nologo to both calls of mt.exe and cl.exe (cob_cc with #ifdef _MSC_VER) [b]but only when -v is not used[/b]. The following patch does exactly this, the patch about [url=http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=672&forum=1]supporting spaces in pathnames (MSVC)[/url] must be applied before. The patch is tested and works fine! [code]1462,1466c1462 < if (verbose_output) { < sprintf (buff, "mt /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); < } else { < sprintf (buff, "mt /nologo /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); < } --- > sprintf (buff, "mt /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); 1515,1521c1511 < < if (verbose_output) { < sprintf (buff, "mt /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); < } else { < sprintf (buff, "mt /nologo /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); < } < --- > sprintf (buff, "mt /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); 1601,1605c1591 < if (verbose_output) { < sprintf (buff, "mt /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); < } else { < sprintf (buff, "mt /nologo /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); < } --- > sprintf (buff, "mt /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); 1673,1677c1659 < if (verbose_output) { < sprintf (buff, "mt /manifest \"%s.exe.manifest\" /outputresource:\"%s.exe\";#2", name, name); < } else { < sprintf (buff, "mt /nologo /manifest \"%s.exe.manifest\" /outputresource:\"%s.exe\";#2", name, name); < } --- > sprintf (buff, "mt /manifest \"%s.exe.manifest\" /outputresource:\"%s.exe\";#2", name, name); 1836,1840d1817 < #ifdef _MSC_VER < if (!verbose_output) { < strcat (cob_cflags, " /nologo"); < } < #endif[/code] Maybe it would be good to add cob_mtflags (containing nothing or " /nologo"), because there would be only one place (the last one of the patch) where the verbose_output for MSC is handled. The only lines from MS that are not removed yet (because I have no idea how to do so) are (in stdout), [quote]BLANKS.c Creating library "BLANKS.lib" and object "BLANKS.exp" [/quote] They come from cl.exe, maybe someone knows how to suppress them. human ---------------------------------------------------------------- Good point too. ---------------------------------------------------------------- Can you have a look if it's possible for you to submit a patch for [url=http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=627&forum=1]saving .exp and .lib only if save-temps is used[/url], please? Have you seen the [url=http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=669&post_id=3329&order=0&viewmode=flat&pid=0&forum=1#forumpost3329]FIX common.h for MSC: cobc XYZ results in compiler warning C4715, better use _declspec(noreturn)[/url] already? human ---------------------------------------------------------------- [quote] human wrote: Can you have a look if it's possible for you to submit a patch for saving .exp and .lib only if save-temps is used, please? [/quote] Patch to cobc.c with your patches applied [code] *** cobc.c.human 2009-07-28 11:39:20.000000000 -0400 --- cobc.c 2009-07-28 14:05:39.000000000 -0400 *************** *** 1465,1472 **** --- 1465,1478 ---- sprintf (buff, "mt /nologo /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); } ret = process (buff); + sprintf (buff, "%s.dll.manifest", name); + cobc_check_action (buff); } #endif + sprintf (buff, "%s.exp", name); + cobc_check_action (buff); + sprintf (buff, "%s.lib", name); + cobc_check_action (buff); #else /* _MSC_VER */ sprintf (buff, "%s %s %s %s %s %s %s %s -o %s %s %s", cob_cc, gccpipe, cob_cflags, cob_define_flags, COB_SHARED_OPT, *************** *** 1520,1527 **** --- 1526,1539 ---- } ret = process (buff); + sprintf (buff, "%s.dll.manifest", name); + cobc_check_action (buff); } #endif + sprintf (buff, "%s.exp", name); + cobc_check_action (buff); + sprintf (buff, "%s.lib", name); + cobc_check_action (buff); #else /* _MSC_VER */ sprintf (buff, "%s %s %s %s %s %s -o %s %s %s", cob_cc, gccpipe, COB_SHARED_OPT, cob_ldflags, COB_PIC_FLAGS, *************** *** 1604,1611 **** --- 1616,1629 ---- sprintf (buff, "mt /nologo /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); } ret = process (buff); + sprintf (buff, "%s.dll.manifest", name); + cobc_check_action (buff); } #endif + sprintf (buff, "%s.exp", name); + cobc_check_action (buff); + sprintf (buff, "%s.lib", name); + cobc_check_action (buff); #else /* _MSC_VER */ sprintf (buffptr, "%s %s %s %s %s %s -o %s %s %s", cob_cc, gccpipe, COB_SHARED_OPT, cob_ldflags, COB_PIC_FLAGS, *************** *** 1676,1681 **** --- 1694,1701 ---- sprintf (buff, "mt /nologo /manifest \"%s.exe.manifest\" /outputresource:\"%s.exe\";#2", name, name); } ret = process (buff); + sprintf (buff, "%s.exe.manifest", name); + cobc_check_action (buff); } #endif #else /* _MSC_VER */ [/code] [quote] Have you seen the FIX common.h for MSC: cobc XYZ results in compiler warning C4715, better use _declspec(noreturn) already? [/quote] I saw it, but that's just a warning, and you have a bunch of them in OC ---------------------------------------------------------------- Thank you for the fix for -save-temps, I will test it tomorrow. My submitted fix for C4715 is for the RESULTS cobc produces, not for compiling cobc itself. I'm not sure about all the warnings of OC the compiler complains about, but I really like to have the compiler not complaining at all (VBISAM is quite better, 22 occurrences of C4244: conversion from 'type1' to 'type2', possible loss of data). If you have a fix for resolving compiler errors, I would be glad to have them. human ---------------------------------------------------------------- Subject: removed topic ... another mistake again, topic can be removed... human ---------------------------------------------------------------- Subject: Question for generating OC: Should "#define WITH_LFS64 1" be only set for 64bit cpu? In both VBISAM and OpenCOBOL we have an entry in config.h [code]/* Compile with large file system I/O */ #define WITH_LFS64 1[/code] Should this be set only when compiling for 64bit machines/OSes? human ---------------------------------------------------------------- [quote] Should this be set only when compiling for 64bit machines/OSes? [/quote] No, it just mean you will not have 2G(4G) limitation on file size. ---------------------------------------------------------------- OK, then it will be defined in the project files I send to you (just waiting for clarification of some posts before doing so). human ---------------------------------------------------------------- Subject: FIX for not needing a .def for compiling with MSVC (vbisam and opencobol) The problem is that there are different points where DLL_EXPIMP is missing. These patches help to be able to use both vbisam and opencobol without creating a def file. For better seperation DLL_EXPIMP was renamed to COB_DLL_EXPIMP or VB_DLL_EXPIMP. [code]--- vbisam.h.orig Wed Aug 27 15:21:38 2008 +++ vbisam.h Wed Jul 29 13:02:42 2009 @@ -34,12 +34,12 @@ #ifdef _MSC_VER #ifdef VBISAM_LIB -#define DLL_EXPIMP __declspec(dllexport) +#define VB_DLL_EXPIMP __declspec(dllexport) #else -#define DLL_EXPIMP __declspec(dllimport) +#define VB_DLL_EXPIMP __declspec(dllimport) #endif #else -#define DLL_EXPIMP +#define VB_DLL_EXPIMP #endif #define CHARTYPE 0 @@ -171,10 +171,10 @@ #define EINTERUPT 157 /* Interrupted isam call */ #define EBADFORMAT 171 /* Locking or NODESIZE change */ -DLL_EXPIMP extern int iserrno; /* Isam error return code */ -DLL_EXPIMP extern int iserrio; /* NOT used with VBISAM */ -DLL_EXPIMP extern int isreclen; /* Used for varlen tables */ -DLL_EXPIMP extern int isrecnum; /* Current row number */ +VB_DLL_EXPIMP extern int iserrno; /* Isam error return code */ +VB_DLL_EXPIMP extern int iserrio; /* NOT used with VBISAM */ +VB_DLL_EXPIMP extern int isreclen; /* Used for varlen tables */ +VB_DLL_EXPIMP extern int isrecnum; /* Current row number */ struct audhead { @@ -192,47 +192,47 @@ #define VAUDHEADSIZE 16 /* Prototypes for file manipulation functions */ -extern int isaddindex (const int ihandle, struct keydesc *pskeydesc); -extern int isaudit (const int ihandle, char *pcfilename, int imode); -extern int isbegin (void); -extern int isbuild (const char *pcfilename, const int imaxrowlength, +VB_DLL_EXPIMP extern int isaddindex (const int ihandle, struct keydesc *pskeydesc); +VB_DLL_EXPIMP extern int isaudit (const int ihandle, char *pcfilename, int imode); +VB_DLL_EXPIMP extern int isbegin (void); +VB_DLL_EXPIMP extern int isbuild (const char *pcfilename, const int imaxrowlength, struct keydesc *pskey, int imode); -extern int ischeck (const char *pcfile); -extern int iscleanup (void); -extern int isclose (const int ihandle); -extern int iscluster (const int ihandle, struct keydesc *pskeydesc); -extern int iscommit (void); -extern int isdelcurr (const int ihandle); -extern int isdelete (const int ihandle, char *pcrow); -extern int isdelindex (const int ihandle, struct keydesc *pskeydesc); -extern int isdelrec (const int ihandle, vbisam_off_t trownumber); -extern int iserase (char *pcfilename); -extern int isflush (const int ihandle); -extern int isfullclose (const int ihandle); -extern int isindexinfo (const int ihandle, void *pskeydesc, const int ikeynumber); -extern int islock (const int ihandle); -extern int islogclose (void); -extern int islogopen (const char *pcfilename); -extern int isopen (const char *pcfilename, int imode); -extern int isread (const int ihandle, char *pcrow, int imode); -extern int isrecover (void); -extern int isrelcurr (const int ihandle); -extern int isrelease (const int ihandle); -extern int isrelrec (const int ihandle, const vbisam_off_t trownumber); -extern int isrename (char *pcoldname, char *pcnewname); -extern int isrewcurr (const int ihandle, char *pcrow); -extern int isrewrec (const int ihandle, const vbisam_off_t trownumber, +VB_DLL_EXPIMP extern int ischeck (const char *pcfile); +VB_DLL_EXPIMP extern int iscleanup (void); +VB_DLL_EXPIMP extern int isclose (const int ihandle); +VB_DLL_EXPIMP extern int iscluster (const int ihandle, struct keydesc *pskeydesc); +VB_DLL_EXPIMP extern int iscommit (void); +VB_DLL_EXPIMP extern int isdelcurr (const int ihandle); +VB_DLL_EXPIMP extern int isdelete (const int ihandle, char *pcrow); +VB_DLL_EXPIMP extern int isdelindex (const int ihandle, struct keydesc *pskeydesc); +VB_DLL_EXPIMP extern int isdelrec (const int ihandle, vbisam_off_t trownumber); +VB_DLL_EXPIMP extern int iserase (char *pcfilename); +VB_DLL_EXPIMP extern int isflush (const int ihandle); +VB_DLL_EXPIMP extern int isfullclose (const int ihandle); +VB_DLL_EXPIMP extern int isindexinfo (const int ihandle, void *pskeydesc, const int ikeynumber); +VB_DLL_EXPIMP extern int islock (const int ihandle); +VB_DLL_EXPIMP extern int islogclose (void); +VB_DLL_EXPIMP extern int islogopen (const char *pcfilename); +VB_DLL_EXPIMP extern int isopen (const char *pcfilename, int imode); +VB_DLL_EXPIMP extern int isread (const int ihandle, char *pcrow, int imode); +VB_DLL_EXPIMP extern int isrecover (void); +VB_DLL_EXPIMP extern int isrelcurr (const int ihandle); +VB_DLL_EXPIMP extern int isrelease (const int ihandle); +VB_DLL_EXPIMP extern int isrelrec (const int ihandle, const vbisam_off_t trownumber); +VB_DLL_EXPIMP extern int isrename (char *pcoldname, char *pcnewname); +VB_DLL_EXPIMP extern int isrewcurr (const int ihandle, char *pcrow); +VB_DLL_EXPIMP extern int isrewrec (const int ihandle, const vbisam_off_t trownumber, char *pcrow); -extern int isrewrite (const int ihandle, char *pcrow); -extern int isrollback (void); -extern int issetcollate (const int ihandle, const unsigned char *collating_sequence); -extern int issetunique (const int ihandle, const vbisam_off_t tuniqueid); -extern int isstart (const int ihandle, struct keydesc *pskeydesc, +VB_DLL_EXPIMP extern int isrewrite (const int ihandle, char *pcrow); +VB_DLL_EXPIMP extern int isrollback (void); +VB_DLL_EXPIMP extern int issetcollate (const int ihandle, const unsigned char *collating_sequence); +VB_DLL_EXPIMP extern int issetunique (const int ihandle, const vbisam_off_t tuniqueid); +VB_DLL_EXPIMP extern int isstart (const int ihandle, struct keydesc *pskeydesc, int ilength, char *pcrow, int imode); -extern int isuniqueid (const int ihandle, vbisam_off_t *ptuniqueid); -extern int isunlock (const int ihandle); -extern int iswrcurr (const int ihandle, char *pcrow); -extern int iswrite (const int ihandle, char *pcrow); +VB_DLL_EXPIMP extern int isuniqueid (const int ihandle, vbisam_off_t *ptuniqueid); +VB_DLL_EXPIMP extern int isunlock (const int ihandle); +VB_DLL_EXPIMP extern int iswrcurr (const int ihandle, char *pcrow); +VB_DLL_EXPIMP extern int iswrite (const int ihandle, char *pcrow); extern char *isdi_name (const int ihandle); extern int isdi_datlen (const int ihandle); [/code] [code]--- call.h.orig Sun Jan 18 12:24:14 2009 +++ call.h Wed Jul 29 14:55:36 2009 @@ -31,27 +31,27 @@ void *cbj_ptr_rest[2]; }; -extern void cob_set_cancel (const char *, void *, void *); -extern void *cob_resolve (const char *); -extern void *cob_resolve_1 (const char *); -extern const char *cob_resolve_error (void); +COB_DLL_EXPIMP extern void cob_set_cancel (const char *, void *, void *); +COB_DLL_EXPIMP extern void *cob_resolve (const char *); +COB_DLL_EXPIMP extern void *cob_resolve_1 (const char *); +COB_DLL_EXPIMP extern const char *cob_resolve_error (void); -extern void *cob_call_resolve (const cob_field *); -extern void *cob_call_resolve_1 (const cob_field *); -extern void cob_field_cancel (const cob_field *); -extern void cobcancel (const char *); -extern int cobcall (const char *, const int, void **); -extern int cobfunc (const char *, const int, void **); -extern void *cobsavenv (struct cobjmp_buf *); -extern void *cobsavenv2 (struct cobjmp_buf *, const int); -extern void coblongjmp (struct cobjmp_buf *); +COB_DLL_EXPIMP extern void *cob_call_resolve (const cob_field *); +COB_DLL_EXPIMP extern void *cob_call_resolve_1 (const cob_field *); +COB_DLL_EXPIMP extern void cob_field_cancel (const cob_field *); +COB_DLL_EXPIMP extern void cobcancel (const char *); +COB_DLL_EXPIMP extern int cobcall (const char *, const int, void **); +COB_DLL_EXPIMP extern int cobfunc (const char *, const int, void **); +COB_DLL_EXPIMP extern void *cobsavenv (struct cobjmp_buf *); +COB_DLL_EXPIMP extern void *cobsavenv2 (struct cobjmp_buf *, const int); +COB_DLL_EXPIMP extern void coblongjmp (struct cobjmp_buf *); #define cobsetjmp(x) setjmp (cobsavenv (x)) #ifdef __GNUC__ -extern void cob_call_error (void) __attribute__ ((noreturn)); +COB_DLL_EXPIMP extern void cob_call_error (void) __attribute__ ((noreturn)); #else -extern void cob_call_error (void); +COB_DLL_EXPIMP extern void cob_call_error (void); #endif #endif /* COB_CALL_H */ [/code] [code]--- codegen.h.orig Sun Jan 18 12:26:12 2009 +++ codegen.h Wed Jul 29 14:55:42 2009 @@ -20,154 +20,156 @@ #ifndef COB_CODEGEN_H #define COB_CODEGEN_H +#include + #ifdef COB_LOCAL_INLINE #define COB_STATIC static #else #define COB_STATIC -extern int cob_get_numdisp (const unsigned char *, const size_t); -extern int cob_cmp_packed_int (const cob_field *, const int); -extern int cob_get_packed_int (const cob_field *); -extern int cob_add_packed_int (cob_field *, const int); - -extern int cob_cmp_u8_binary (const unsigned char *, const int); -extern int cob_cmp_s8_binary (const unsigned char *, const int); -extern int cob_cmp_u16_binary (const unsigned char *, const int); -extern int cob_cmp_s16_binary (const unsigned char *, const int); -extern int cob_cmp_u24_binary (const unsigned char *, const int); -extern int cob_cmp_s24_binary (const unsigned char *, const int); -extern int cob_cmp_u32_binary (const unsigned char *, const int); -extern int cob_cmp_s32_binary (const unsigned char *, const int); -extern int cob_cmp_u40_binary (const unsigned char *, const int); -extern int cob_cmp_s40_binary (const unsigned char *, const int); -extern int cob_cmp_u48_binary (const unsigned char *, const int); -extern int cob_cmp_s48_binary (const unsigned char *, const int); -extern int cob_cmp_u56_binary (const unsigned char *, const int); -extern int cob_cmp_s56_binary (const unsigned char *, const int); -extern int cob_cmp_u64_binary (const unsigned char *, const int); -extern int cob_cmp_s64_binary (const unsigned char *, const int); - -extern int cob_cmp_align_u16_binary (const unsigned char *, const int); -extern int cob_cmp_align_s16_binary (const unsigned char *, const int); -extern int cob_cmp_align_u32_binary (const unsigned char *, const int); -extern int cob_cmp_align_s32_binary (const unsigned char *, const int); -extern int cob_cmp_align_u64_binary (const unsigned char *, const int); -extern int cob_cmp_align_s64_binary (const unsigned char *, const int); - -extern void cob_add_u8_binary (unsigned char *, const int); -extern void cob_add_s8_binary (unsigned char *, const int); -extern void cob_add_u16_binary (unsigned char *, const int); -extern void cob_add_s16_binary (unsigned char *, const int); -extern void cob_add_u24_binary (unsigned char *, const int); -extern void cob_add_s24_binary (unsigned char *, const int); -extern void cob_add_u32_binary (unsigned char *, const int); -extern void cob_add_s32_binary (unsigned char *, const int); -extern void cob_add_u40_binary (unsigned char *, const int); -extern void cob_add_s40_binary (unsigned char *, const int); -extern void cob_add_u48_binary (unsigned char *, const int); -extern void cob_add_s48_binary (unsigned char *, const int); -extern void cob_add_u56_binary (unsigned char *, const int); -extern void cob_add_s56_binary (unsigned char *, const int); -extern void cob_add_u64_binary (unsigned char *, const int); -extern void cob_add_s64_binary (unsigned char *, const int); - -extern void cob_add_align_u16_binary (unsigned char *, const int); -extern void cob_add_align_s16_binary (unsigned char *, const int); -extern void cob_add_align_u32_binary (unsigned char *, const int); -extern void cob_add_align_s32_binary (unsigned char *, const int); -extern void cob_add_align_u64_binary (unsigned char *, const int); -extern void cob_add_align_s64_binary (unsigned char *, const int); - -extern void cob_sub_u8_binary (unsigned char *, const int); -extern void cob_sub_s8_binary (unsigned char *, const int); -extern void cob_sub_u16_binary (unsigned char *, const int); -extern void cob_sub_s16_binary (unsigned char *, const int); -extern void cob_sub_u24_binary (unsigned char *, const int); -extern void cob_sub_s24_binary (unsigned char *, const int); -extern void cob_sub_u32_binary (unsigned char *, const int); -extern void cob_sub_s32_binary (unsigned char *, const int); -extern void cob_sub_u40_binary (unsigned char *, const int); -extern void cob_sub_s40_binary (unsigned char *, const int); -extern void cob_sub_u48_binary (unsigned char *, const int); -extern void cob_sub_s48_binary (unsigned char *, const int); -extern void cob_sub_u56_binary (unsigned char *, const int); -extern void cob_sub_s56_binary (unsigned char *, const int); -extern void cob_sub_u64_binary (unsigned char *, const int); -extern void cob_sub_s64_binary (unsigned char *, const int); - -extern void cob_sub_align_u16_binary (unsigned char *, const int); -extern void cob_sub_align_s16_binary (unsigned char *, const int); -extern void cob_sub_align_u32_binary (unsigned char *, const int); -extern void cob_sub_align_s32_binary (unsigned char *, const int); -extern void cob_sub_align_u64_binary (unsigned char *, const int); -extern void cob_sub_align_s64_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_get_numdisp (const unsigned char *, const size_t); +COB_DLL_EXPIMP extern int cob_cmp_packed_int (const cob_field *, const int); +COB_DLL_EXPIMP extern int cob_get_packed_int (const cob_field *); +COB_DLL_EXPIMP extern int cob_add_packed_int (cob_field *, const int); + +COB_DLL_EXPIMP extern int cob_cmp_u8_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmp_s8_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmp_u16_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmp_s16_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmp_u24_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmp_s24_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmp_u32_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmp_s32_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmp_u40_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmp_s40_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmp_u48_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmp_s48_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmp_u56_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmp_s56_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmp_u64_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmp_s64_binary (const unsigned char *, const int); + +COB_DLL_EXPIMP extern int cob_cmp_align_u16_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmp_align_s16_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmp_align_u32_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmp_align_s32_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmp_align_u64_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmp_align_s64_binary (const unsigned char *, const int); + +COB_DLL_EXPIMP extern void cob_add_u8_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_add_s8_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_add_u16_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_add_s16_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_add_u24_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_add_s24_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_add_u32_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_add_s32_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_add_u40_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_add_s40_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_add_u48_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_add_s48_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_add_u56_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_add_s56_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_add_u64_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_add_s64_binary (unsigned char *, const int); + +COB_DLL_EXPIMP extern void cob_add_align_u16_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_add_align_s16_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_add_align_u32_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_add_align_s32_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_add_align_u64_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_add_align_s64_binary (unsigned char *, const int); + +COB_DLL_EXPIMP extern void cob_sub_u8_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_sub_s8_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_sub_u16_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_sub_s16_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_sub_u24_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_sub_s24_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_sub_u32_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_sub_s32_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_sub_u40_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_sub_s40_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_sub_u48_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_sub_s48_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_sub_u56_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_sub_s56_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_sub_u64_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_sub_s64_binary (unsigned char *, const int); + +COB_DLL_EXPIMP extern void cob_sub_align_u16_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_sub_align_s16_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_sub_align_u32_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_sub_align_s32_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_sub_align_u64_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_sub_align_s64_binary (unsigned char *, const int); #ifndef WORDS_BIGENDIAN -extern int cob_cmpswp_u16_binary (const unsigned char *, const int); -extern int cob_cmpswp_s16_binary (const unsigned char *, const int); -extern int cob_cmpswp_u24_binary (const unsigned char *, const int); -extern int cob_cmpswp_s24_binary (const unsigned char *, const int); -extern int cob_cmpswp_u32_binary (const unsigned char *, const int); -extern int cob_cmpswp_s32_binary (const unsigned char *, const int); -extern int cob_cmpswp_u40_binary (const unsigned char *, const int); -extern int cob_cmpswp_s40_binary (const unsigned char *, const int); -extern int cob_cmpswp_u48_binary (const unsigned char *, const int); -extern int cob_cmpswp_s48_binary (const unsigned char *, const int); -extern int cob_cmpswp_u56_binary (const unsigned char *, const int); -extern int cob_cmpswp_s56_binary (const unsigned char *, const int); -extern int cob_cmpswp_u64_binary (const unsigned char *, const int); -extern int cob_cmpswp_s64_binary (const unsigned char *, const int); - -extern int cob_cmpswp_align_u16_binary (const unsigned char *, const int); -extern int cob_cmpswp_align_s16_binary (const unsigned char *, const int); -extern int cob_cmpswp_align_u32_binary (const unsigned char *, const int); -extern int cob_cmpswp_align_s32_binary (const unsigned char *, const int); -extern int cob_cmpswp_align_u64_binary (const unsigned char *, const int); -extern int cob_cmpswp_align_s64_binary (const unsigned char *, const int); - -extern void cob_addswp_u16_binary (unsigned char *, const int); -extern void cob_addswp_s16_binary (unsigned char *, const int); -extern void cob_addswp_u24_binary (unsigned char *, const int); -extern void cob_addswp_s24_binary (unsigned char *, const int); -extern void cob_addswp_u32_binary (unsigned char *, const int); -extern void cob_addswp_s32_binary (unsigned char *, const int); -extern void cob_addswp_u40_binary (unsigned char *, const int); -extern void cob_addswp_s40_binary (unsigned char *, const int); -extern void cob_addswp_u48_binary (unsigned char *, const int); -extern void cob_addswp_s48_binary (unsigned char *, const int); -extern void cob_addswp_u56_binary (unsigned char *, const int); -extern void cob_addswp_s56_binary (unsigned char *, const int); -extern void cob_addswp_u64_binary (unsigned char *, const int); -extern void cob_addswp_s64_binary (unsigned char *, const int); - -extern void cob_subswp_u16_binary (unsigned char *, const int); -extern void cob_subswp_s16_binary (unsigned char *, const int); -extern void cob_subswp_u24_binary (unsigned char *, const int); -extern void cob_subswp_s24_binary (unsigned char *, const int); -extern void cob_subswp_u32_binary (unsigned char *, const int); -extern void cob_subswp_s32_binary (unsigned char *, const int); -extern void cob_subswp_u40_binary (unsigned char *, const int); -extern void cob_subswp_s40_binary (unsigned char *, const int); -extern void cob_subswp_u48_binary (unsigned char *, const int); -extern void cob_subswp_s48_binary (unsigned char *, const int); -extern void cob_subswp_u56_binary (unsigned char *, const int); -extern void cob_subswp_s56_binary (unsigned char *, const int); -extern void cob_subswp_u64_binary (unsigned char *, const int); -extern void cob_subswp_s64_binary (unsigned char *, const int); - -extern void cob_setswp_u16_binary (unsigned char *, const int); -extern void cob_setswp_s16_binary (unsigned char *, const int); -extern void cob_setswp_u24_binary (unsigned char *, const int); -extern void cob_setswp_s24_binary (unsigned char *, const int); -extern void cob_setswp_u32_binary (unsigned char *, const int); -extern void cob_setswp_s32_binary (unsigned char *, const int); -extern void cob_setswp_u40_binary (unsigned char *, const int); -extern void cob_setswp_s40_binary (unsigned char *, const int); -extern void cob_setswp_u48_binary (unsigned char *, const int); -extern void cob_setswp_s48_binary (unsigned char *, const int); -extern void cob_setswp_u56_binary (unsigned char *, const int); -extern void cob_setswp_s56_binary (unsigned char *, const int); -extern void cob_setswp_u64_binary (unsigned char *, const int); -extern void cob_setswp_s64_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmpswp_u16_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmpswp_s16_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmpswp_u24_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmpswp_s24_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmpswp_u32_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmpswp_s32_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmpswp_u40_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmpswp_s40_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmpswp_u48_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmpswp_s48_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmpswp_u56_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmpswp_s56_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmpswp_u64_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmpswp_s64_binary (const unsigned char *, const int); + +COB_DLL_EXPIMP extern int cob_cmpswp_align_u16_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmpswp_align_s16_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmpswp_align_u32_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmpswp_align_s32_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmpswp_align_u64_binary (const unsigned char *, const int); +COB_DLL_EXPIMP extern int cob_cmpswp_align_s64_binary (const unsigned char *, const int); + +COB_DLL_EXPIMP extern void cob_addswp_u16_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_addswp_s16_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_addswp_u24_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_addswp_s24_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_addswp_u32_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_addswp_s32_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_addswp_u40_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_addswp_s40_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_addswp_u48_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_addswp_s48_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_addswp_u56_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_addswp_s56_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_addswp_u64_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_addswp_s64_binary (unsigned char *, const int); + +COB_DLL_EXPIMP extern void cob_subswp_u16_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_subswp_s16_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_subswp_u24_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_subswp_s24_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_subswp_u32_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_subswp_s32_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_subswp_u40_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_subswp_s40_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_subswp_u48_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_subswp_s48_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_subswp_u56_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_subswp_s56_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_subswp_u64_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_subswp_s64_binary (unsigned char *, const int); + +COB_DLL_EXPIMP extern void cob_setswp_u16_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_setswp_s16_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_setswp_u24_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_setswp_s24_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_setswp_u32_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_setswp_s32_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_setswp_u40_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_setswp_s40_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_setswp_u48_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_setswp_s48_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_setswp_u56_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_setswp_s56_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_setswp_u64_binary (unsigned char *, const int); +COB_DLL_EXPIMP extern void cob_setswp_s64_binary (unsigned char *, const int); #endif #endif [/code] [code]--- common.h.orig Sun Jan 18 13:31:30 2009 +++ common.h Wed Jul 29 14:55:48 2009 @@ -36,14 +36,14 @@ #define __i386__ #ifdef LIBCOB_EXPORTS -#define DLL_EXPIMP __declspec(dllexport) +#define COB_DLL_EXPIMP __declspec(dllexport) #else /* LIBCOB_EXPORTS */ -#define DLL_EXPIMP __declspec(dllimport) +#define COB_DLL_EXPIMP __declspec(dllimport) #endif /* LIBCOB_EXPORTS */ #else /* _MSC_VER */ -#define DLL_EXPIMP +#define COB_DLL_EXPIMP #ifdef __370__ #define inline __inline @@ -243,21 +243,21 @@ * Global variables */ -DLL_EXPIMP extern int cob_initialized; -DLL_EXPIMP extern int cob_exception_code; +COB_DLL_EXPIMP extern int cob_initialized; +COB_DLL_EXPIMP extern int cob_exception_code; -DLL_EXPIMP extern struct cob_module *cob_current_module; +COB_DLL_EXPIMP extern struct cob_module *cob_current_module; -DLL_EXPIMP extern int cob_call_params; -DLL_EXPIMP extern int cob_save_call_params; -DLL_EXPIMP extern int cob_initial_external; - -DLL_EXPIMP extern cob_field cob_zero; /* ZERO */ -DLL_EXPIMP extern cob_field cob_space; /* SPACE */ -DLL_EXPIMP extern cob_field cob_high; /* HIGH-VALUE */ -DLL_EXPIMP extern cob_field cob_low; /* LOW-VALUE */ -DLL_EXPIMP extern cob_field cob_quote; /* QUOTE */ -DLL_EXPIMP extern cob_field cob_one; /* Numeric ONE */ +COB_DLL_EXPIMP extern int cob_call_params; +COB_DLL_EXPIMP extern int cob_save_call_params; +COB_DLL_EXPIMP extern int cob_initial_external; + +COB_DLL_EXPIMP extern cob_field cob_zero; /* ZERO */ +COB_DLL_EXPIMP extern cob_field cob_space; /* SPACE */ +COB_DLL_EXPIMP extern cob_field cob_high; /* HIGH-VALUE */ +COB_DLL_EXPIMP extern cob_field cob_low; /* LOW-VALUE */ +COB_DLL_EXPIMP extern cob_field cob_quote; /* QUOTE */ +COB_DLL_EXPIMP extern cob_field cob_one; /* Numeric ONE */ /* convert a digit (e.g., '0') into an integer (e.g., 0) */ #define cob_d2i(x) ((x) - '0') @@ -272,127 +272,134 @@ /* General functions */ -extern void cob_init (int, char **); -extern void cob_module_enter (struct cob_module *); -extern void cob_module_leave (struct cob_module *); +COB_DLL_EXPIMP extern void cob_init (int, char **); +COB_DLL_EXPIMP extern void cob_module_enter (struct cob_module *); +COB_DLL_EXPIMP extern void cob_module_leave (struct cob_module *); #ifdef __GNUC__ -extern void cobexit (int) __attribute__ ((noreturn)); -extern void cob_stop_run (const int) __attribute__ ((noreturn)); -extern void cob_fatal_error (const unsigned int) __attribute__ ((noreturn)); -extern void cob_runtime_error (const char *, ...) +COB_DLL_EXPIMP extern void cobexit (int) __attribute__ ((noreturn)); +COB_DLL_EXPIMP extern void cob_stop_run (const int) __attribute__ ((noreturn)); +COB_DLL_EXPIMP extern void cob_fatal_error (const unsigned int) __attribute__ ((noreturn)); +COB_DLL_EXPIMP extern void cob_runtime_error (const char *, ...) __attribute__ ((format (printf, 1, 0))); -extern void *cob_malloc (const size_t) __attribute__ ((malloc)); +COB_DLL_EXPIMP extern void *cob_malloc (const size_t) __attribute__ ((malloc)); #else -extern void cobexit (int); -extern void cob_stop_run (const int); -extern void cob_fatal_error (const unsigned int); -extern void cob_runtime_error (const char *, ...); -extern void *cob_malloc (const size_t); +// using _declspec(noreturn) for MSVC, removing compiler warning C4175 because cob_fatal_error never returns (human) +#ifdef _MSC_VER +COB_DLL_EXPIMP extern void __declspec(noreturn) cobexit (int); +COB_DLL_EXPIMP extern void __declspec(noreturn) cob_stop_run (const int); +COB_DLL_EXPIMP extern void __declspec(noreturn) cob_fatal_error (const unsigned int); +#else +COB_DLL_EXPIMP extern void cobexit (int); +COB_DLL_EXPIMP extern void cob_stop_run (const int); +COB_DLL_EXPIMP extern void cob_fatal_error (const unsigned int); +#endif +COB_DLL_EXPIMP extern void cob_runtime_error (const char *, ...); +COB_DLL_EXPIMP extern void *cob_malloc (const size_t); #endif -extern const char *cob_get_exception_name (const int); +COB_DLL_EXPIMP extern const char *cob_get_exception_name (const int); -extern void cob_set_exception (const int); -extern void cob_check_version (const char *, const char *, const int); -extern void cob_accept_date (cob_field *); -extern void cob_accept_date_yyyymmdd (cob_field *); -extern void cob_accept_day (cob_field *); -extern void cob_accept_day_yyyyddd (cob_field *); -extern void cob_accept_day_of_week (cob_field *); -extern void cob_accept_time (cob_field *); -extern void cob_display_command_line (cob_field *); -extern void cob_accept_command_line (cob_field *); -extern void cob_set_environment (cob_field *, cob_field *); -extern void cob_display_environment (cob_field *); -extern void cob_get_environment (cob_field *, cob_field *); -extern void cob_accept_environment (cob_field *); -extern void cob_display_env_value (cob_field *); -extern void cob_display_arg_number (cob_field *); -extern void cob_accept_arg_number (cob_field *); -extern void cob_accept_arg_value (cob_field *); -extern void cob_chain_setup (void *, const size_t, const size_t); -extern void cob_allocate (unsigned char **, cob_field *, +COB_DLL_EXPIMP extern void cob_set_exception (const int); +COB_DLL_EXPIMP extern void cob_check_version (const char *, const char *, const int); +COB_DLL_EXPIMP extern void cob_accept_date (cob_field *); +COB_DLL_EXPIMP extern void cob_accept_date_yyyymmdd (cob_field *); +COB_DLL_EXPIMP extern void cob_accept_day (cob_field *); +COB_DLL_EXPIMP extern void cob_accept_day_yyyyddd (cob_field *); +COB_DLL_EXPIMP extern void cob_accept_day_of_week (cob_field *); +COB_DLL_EXPIMP extern void cob_accept_time (cob_field *); +COB_DLL_EXPIMP extern void cob_display_command_line (cob_field *); +COB_DLL_EXPIMP extern void cob_accept_command_line (cob_field *); +COB_DLL_EXPIMP extern void cob_set_environment (cob_field *, cob_field *); +COB_DLL_EXPIMP extern void cob_display_environment (cob_field *); +COB_DLL_EXPIMP extern void cob_get_environment (cob_field *, cob_field *); +COB_DLL_EXPIMP extern void cob_accept_environment (cob_field *); +COB_DLL_EXPIMP extern void cob_display_env_value (cob_field *); +COB_DLL_EXPIMP extern void cob_display_arg_number (cob_field *); +COB_DLL_EXPIMP extern void cob_accept_arg_number (cob_field *); +COB_DLL_EXPIMP extern void cob_accept_arg_value (cob_field *); +COB_DLL_EXPIMP extern void cob_chain_setup (void *, const size_t, const size_t); +COB_DLL_EXPIMP extern void cob_allocate (unsigned char **, cob_field *, cob_field *); -extern void cob_free_alloc (unsigned char **, unsigned char *); -extern int cobinit (void); -extern int cobtidy (void); -extern void *cobcommandline (int, int *, char ***, +COB_DLL_EXPIMP extern void cob_free_alloc (unsigned char **, unsigned char *); +COB_DLL_EXPIMP extern int cobinit (void); +COB_DLL_EXPIMP extern int cobtidy (void); +COB_DLL_EXPIMP extern void *cobcommandline (int, int *, char ***, char ***, char **); -extern char *cobgetenv (const char *); -extern int cobputenv (char *); +COB_DLL_EXPIMP extern char *cobgetenv (const char *); +COB_DLL_EXPIMP extern int cobputenv (char *); /* System routines */ -extern int CBL_ERROR_PROC (unsigned char *, unsigned char *); -extern int CBL_EXIT_PROC (unsigned char *, unsigned char *); -extern int SYSTEM (const unsigned char *); -extern int CBL_AND (unsigned char *, unsigned char *, const int); -extern int CBL_OR (unsigned char *, unsigned char *, const int); -extern int CBL_NOR (unsigned char *, unsigned char *, const int); -extern int CBL_XOR (unsigned char *, unsigned char *, const int); -extern int CBL_IMP (unsigned char *, unsigned char *, const int); -extern int CBL_NIMP (unsigned char *, unsigned char *, const int); -extern int CBL_EQ (unsigned char *, unsigned char *, const int); -extern int CBL_NOT (unsigned char *, const int); -extern int CBL_XF4 (unsigned char *, unsigned char *); -extern int CBL_XF5 (unsigned char *, unsigned char *); -extern int CBL_X91 (unsigned char *, const unsigned char *, +COB_DLL_EXPIMP extern int CBL_ERROR_PROC (unsigned char *, unsigned char *); +COB_DLL_EXPIMP extern int CBL_EXIT_PROC (unsigned char *, unsigned char *); +COB_DLL_EXPIMP extern int SYSTEM (const unsigned char *); +COB_DLL_EXPIMP extern int CBL_AND (unsigned char *, unsigned char *, const int); +COB_DLL_EXPIMP extern int CBL_OR (unsigned char *, unsigned char *, const int); +COB_DLL_EXPIMP extern int CBL_NOR (unsigned char *, unsigned char *, const int); +COB_DLL_EXPIMP extern int CBL_XOR (unsigned char *, unsigned char *, const int); +COB_DLL_EXPIMP extern int CBL_IMP (unsigned char *, unsigned char *, const int); +COB_DLL_EXPIMP extern int CBL_NIMP (unsigned char *, unsigned char *, const int); +COB_DLL_EXPIMP extern int CBL_EQ (unsigned char *, unsigned char *, const int); +COB_DLL_EXPIMP extern int CBL_NOT (unsigned char *, const int); +COB_DLL_EXPIMP extern int CBL_XF4 (unsigned char *, unsigned char *); +COB_DLL_EXPIMP extern int CBL_XF5 (unsigned char *, unsigned char *); +COB_DLL_EXPIMP extern int CBL_X91 (unsigned char *, const unsigned char *, unsigned char *); -extern int CBL_TOUPPER (unsigned char *, const int); -extern int CBL_TOLOWER (unsigned char *, const int); -extern int CBL_OC_NANOSLEEP (unsigned char *); -extern int cob_return_args (unsigned char *); -extern int cob_parameter_size (unsigned char *); -extern int cob_acuw_sleep (unsigned char *); -extern int cob_acuw_justify (unsigned char *, ...); +COB_DLL_EXPIMP extern int CBL_TOUPPER (unsigned char *, const int); +COB_DLL_EXPIMP extern int CBL_TOLOWER (unsigned char *, const int); +COB_DLL_EXPIMP extern int CBL_OC_NANOSLEEP (unsigned char *); +COB_DLL_EXPIMP extern int cob_return_args (unsigned char *); +COB_DLL_EXPIMP extern int cob_parameter_size (unsigned char *); +COB_DLL_EXPIMP extern int cob_acuw_sleep (unsigned char *); +COB_DLL_EXPIMP extern int cob_acuw_justify (unsigned char *, ...); /* Utilities */ -extern unsigned char *cob_external_addr (const char *, const int); -extern unsigned char *cob_get_pointer (const unsigned char *); -extern void *cob_get_prog_pointer (const unsigned char *); -extern void cob_set_location (const char *, const char *, +COB_DLL_EXPIMP extern unsigned char *cob_external_addr (const char *, const int); +COB_DLL_EXPIMP extern unsigned char *cob_get_pointer (const unsigned char *); +COB_DLL_EXPIMP extern void *cob_get_prog_pointer (const unsigned char *); +COB_DLL_EXPIMP extern void cob_set_location (const char *, const char *, const unsigned int, const char *, const char *, const char *); -extern void cob_ready_trace (void); -extern void cob_reset_trace (void); +COB_DLL_EXPIMP extern void cob_ready_trace (void); +COB_DLL_EXPIMP extern void cob_reset_trace (void); /* Switch */ -extern int cob_get_switch (const int); -extern void cob_set_switch (const int, const int); +COB_DLL_EXPIMP extern int cob_get_switch (const int); +COB_DLL_EXPIMP extern void cob_set_switch (const int, const int); /* Comparison */ -extern int cob_cmp (cob_field *, cob_field *); +COB_DLL_EXPIMP extern int cob_cmp (cob_field *, cob_field *); /* Class check */ -extern int cob_is_omitted (const cob_field *); -extern int cob_is_numeric (cob_field *); -extern int cob_is_alpha (const cob_field *); -extern int cob_is_upper (const cob_field *); -extern int cob_is_lower (const cob_field *); +COB_DLL_EXPIMP extern int cob_is_omitted (const cob_field *); +COB_DLL_EXPIMP extern int cob_is_numeric (cob_field *); +COB_DLL_EXPIMP extern int cob_is_alpha (const cob_field *); +COB_DLL_EXPIMP extern int cob_is_upper (const cob_field *); +COB_DLL_EXPIMP extern int cob_is_lower (const cob_field *); /* Table sort */ -extern void cob_table_sort_init (const int, const unsigned char *); -extern void cob_table_sort_init_key (const int, cob_field *, size_t); -extern void cob_table_sort (cob_field *, const int); +COB_DLL_EXPIMP extern void cob_table_sort_init (const int, const unsigned char *); +COB_DLL_EXPIMP extern void cob_table_sort_init_key (const int, cob_field *, size_t); +COB_DLL_EXPIMP extern void cob_table_sort (cob_field *, const int); /* Run-time error checking */ -extern void cob_check_numeric (cob_field *, const char *); -extern void cob_check_based (const unsigned char *, +COB_DLL_EXPIMP extern void cob_check_numeric (cob_field *, const char *); +COB_DLL_EXPIMP extern void cob_check_based (const unsigned char *, const char *); -extern void cob_check_odo (const int, const int, +COB_DLL_EXPIMP extern void cob_check_odo (const int, const int, const int, const char *); -extern void cob_check_subscript (const int, const int, +COB_DLL_EXPIMP extern void cob_check_subscript (const int, const int, const int, const char *); -extern void cob_check_ref_mod (const int, const int, +COB_DLL_EXPIMP extern void cob_check_ref_mod (const int, const int, const int, const char *); /* Comparison functions */ -extern int cob_numeric_cmp (cob_field *, cob_field *); +COB_DLL_EXPIMP extern int cob_numeric_cmp (cob_field *, cob_field *); #endif /* COB_COMMON_H */ [/code] [code]--- fileio.h.orig Sun Jan 18 14:29:56 2009 +++ fileio.h Wed Jul 29 14:55:52 2009 @@ -224,61 +224,61 @@ int (*fdelete) (cob_file *); }; -DLL_EXPIMP extern cob_file *cob_error_file; +COB_DLL_EXPIMP extern cob_file *cob_error_file; -extern void cob_default_error_handle (void); +COB_DLL_EXPIMP extern void cob_default_error_handle (void); -extern void cob_open (cob_file *, const int, const int, cob_field *); -extern void cob_close (cob_file *, const int, cob_field *); -extern void cob_read (cob_file *, cob_field *, cob_field *, int); -extern void cob_write (cob_file *, cob_field *, const int, cob_field *); -extern void cob_rewrite (cob_file *, cob_field *, const int, cob_field *); -extern void cob_delete (cob_file *, cob_field *); -extern void cob_start (cob_file *, const int, cob_field *, cob_field *); +COB_DLL_EXPIMP extern void cob_open (cob_file *, const int, const int, cob_field *); +COB_DLL_EXPIMP extern void cob_close (cob_file *, const int, cob_field *); +COB_DLL_EXPIMP extern void cob_read (cob_file *, cob_field *, cob_field *, int); +COB_DLL_EXPIMP extern void cob_write (cob_file *, cob_field *, const int, cob_field *); +COB_DLL_EXPIMP extern void cob_rewrite (cob_file *, cob_field *, const int, cob_field *); +COB_DLL_EXPIMP extern void cob_delete (cob_file *, cob_field *); +COB_DLL_EXPIMP extern void cob_start (cob_file *, const int, cob_field *, cob_field *); -extern void cob_unlock_file (cob_file *, cob_field *); -extern void cob_commit (void); -extern void cob_rollback (void); +COB_DLL_EXPIMP extern void cob_unlock_file (cob_file *, cob_field *); +COB_DLL_EXPIMP extern void cob_commit (void); +COB_DLL_EXPIMP extern void cob_rollback (void); /* System routines */ -extern int CBL_OPEN_FILE (unsigned char *, unsigned char *, +COB_DLL_EXPIMP extern int CBL_OPEN_FILE (unsigned char *, unsigned char *, unsigned char *, unsigned char *, unsigned char *); -extern int CBL_CREATE_FILE (unsigned char *, unsigned char *, +COB_DLL_EXPIMP extern int CBL_CREATE_FILE (unsigned char *, unsigned char *, unsigned char *, unsigned char *, unsigned char *); -extern int CBL_READ_FILE (unsigned char *, unsigned char *, +COB_DLL_EXPIMP extern int CBL_READ_FILE (unsigned char *, unsigned char *, unsigned char *, unsigned char *, unsigned char *); -extern int CBL_WRITE_FILE (unsigned char *, unsigned char *, +COB_DLL_EXPIMP extern int CBL_WRITE_FILE (unsigned char *, unsigned char *, unsigned char *, unsigned char *, unsigned char *); -extern int CBL_CLOSE_FILE (unsigned char *); -extern int CBL_FLUSH_FILE (unsigned char *); -extern int CBL_DELETE_FILE (unsigned char *); -extern int CBL_COPY_FILE (unsigned char *, unsigned char *); -extern int CBL_CHECK_FILE_EXIST (unsigned char *, unsigned char *); -extern int CBL_RENAME_FILE (unsigned char *, unsigned char *); -extern int CBL_GET_CURRENT_DIR (const int, const int, unsigned char *); -extern int CBL_CHANGE_DIR (unsigned char *); -extern int CBL_CREATE_DIR (unsigned char *); -extern int CBL_DELETE_DIR (unsigned char *); -extern int cob_acuw_chdir (unsigned char *, unsigned char *); -extern int cob_acuw_mkdir (unsigned char *); -extern int cob_acuw_copyfile (unsigned char *, unsigned char *, unsigned char *); -extern int cob_acuw_file_info (unsigned char *, unsigned char *); -extern int cob_acuw_file_delete (unsigned char *, unsigned char *); +COB_DLL_EXPIMP extern int CBL_CLOSE_FILE (unsigned char *); +COB_DLL_EXPIMP extern int CBL_FLUSH_FILE (unsigned char *); +COB_DLL_EXPIMP extern int CBL_DELETE_FILE (unsigned char *); +COB_DLL_EXPIMP extern int CBL_COPY_FILE (unsigned char *, unsigned char *); +COB_DLL_EXPIMP extern int CBL_CHECK_FILE_EXIST (unsigned char *, unsigned char *); +COB_DLL_EXPIMP extern int CBL_RENAME_FILE (unsigned char *, unsigned char *); +COB_DLL_EXPIMP extern int CBL_GET_CURRENT_DIR (const int, const int, unsigned char *); +COB_DLL_EXPIMP extern int CBL_CHANGE_DIR (unsigned char *); +COB_DLL_EXPIMP extern int CBL_CREATE_DIR (unsigned char *); +COB_DLL_EXPIMP extern int CBL_DELETE_DIR (unsigned char *); +COB_DLL_EXPIMP extern int cob_acuw_chdir (unsigned char *, unsigned char *); +COB_DLL_EXPIMP extern int cob_acuw_mkdir (unsigned char *); +COB_DLL_EXPIMP extern int cob_acuw_copyfile (unsigned char *, unsigned char *, unsigned char *); +COB_DLL_EXPIMP extern int cob_acuw_file_info (unsigned char *, unsigned char *); +COB_DLL_EXPIMP extern int cob_acuw_file_delete (unsigned char *, unsigned char *); /* SORT */ -extern void cob_file_sort_init (cob_file *, const int, +COB_DLL_EXPIMP extern void cob_file_sort_init (cob_file *, const int, const unsigned char *, void *, cob_field *); -extern void cob_file_sort_init_key (cob_file *, const int, +COB_DLL_EXPIMP extern void cob_file_sort_init_key (cob_file *, const int, cob_field *, size_t); -extern void cob_file_sort_close (cob_file *); -extern void cob_file_sort_using (cob_file *, cob_file *); -extern void cob_file_sort_giving (cob_file *, const size_t, ...); -extern void cob_file_release (cob_file *); -extern void cob_file_return (cob_file *); +COB_DLL_EXPIMP extern void cob_file_sort_close (cob_file *); +COB_DLL_EXPIMP extern void cob_file_sort_using (cob_file *, cob_file *); +COB_DLL_EXPIMP extern void cob_file_sort_giving (cob_file *, const size_t, ...); +COB_DLL_EXPIMP extern void cob_file_release (cob_file *); +COB_DLL_EXPIMP extern void cob_file_return (cob_file *); #endif /* COB_FILEIO_H */ [/code] [code]--- intrinsic.h.orig Thu Jan 22 22:02:06 2009 +++ intrinsic.h Wed Jul 29 15:05:46 2009 @@ -22,81 +22,81 @@ #include -extern cob_field *cob_intr_binop (cob_field *, int, cob_field *); -extern cob_field *cob_intr_current_date (const int, const int); -extern cob_field *cob_intr_when_compiled (const int, const int, cob_field *); -extern cob_field *cob_intr_exception_file (void); -extern cob_field *cob_intr_exception_location (void); -extern cob_field *cob_intr_exception_status (void); -extern cob_field *cob_intr_exception_statement (void); -extern cob_field *cob_intr_char (cob_field *); -extern cob_field *cob_intr_ord (cob_field *); -extern cob_field *cob_intr_stored_char_length (cob_field *); -extern cob_field *cob_intr_combined_datetime (cob_field *, cob_field *); -extern cob_field *cob_intr_date_of_integer (cob_field *); -extern cob_field *cob_intr_day_of_integer (cob_field *); -extern cob_field *cob_intr_integer_of_date (cob_field *); -extern cob_field *cob_intr_integer_of_day (cob_field *); -extern cob_field *cob_intr_test_date_yyyymmdd (cob_field *); -extern cob_field *cob_intr_test_day_yyyyddd (cob_field *); -extern cob_field *cob_intr_factorial (cob_field *); -extern cob_field *cob_intr_exp (cob_field *); -extern cob_field *cob_intr_exp10 (cob_field *); -extern cob_field *cob_intr_abs (cob_field *); -extern cob_field *cob_intr_acos (cob_field *); -extern cob_field *cob_intr_asin (cob_field *); -extern cob_field *cob_intr_atan (cob_field *); -extern cob_field *cob_intr_cos (cob_field *); -extern cob_field *cob_intr_log (cob_field *); -extern cob_field *cob_intr_log10 (cob_field *); -extern cob_field *cob_intr_sin (cob_field *); -extern cob_field *cob_intr_sqrt (cob_field *); -extern cob_field *cob_intr_tan (cob_field *); -extern cob_field *cob_intr_upper_case (const int, const int, cob_field *); -extern cob_field *cob_intr_lower_case (const int, const int, cob_field *); -extern cob_field *cob_intr_reverse (const int, const int, cob_field *); -extern cob_field *cob_intr_concatenate (const int, const int, +COB_DLL_EXPIMP extern cob_field *cob_intr_binop (cob_field *, int, cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_current_date (const int, const int); +COB_DLL_EXPIMP extern cob_field *cob_intr_when_compiled (const int, const int, cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_exception_file (void); +COB_DLL_EXPIMP extern cob_field *cob_intr_exception_location (void); +COB_DLL_EXPIMP extern cob_field *cob_intr_exception_status (void); +COB_DLL_EXPIMP extern cob_field *cob_intr_exception_statement (void); +COB_DLL_EXPIMP extern cob_field *cob_intr_char (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_ord (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_stored_char_length (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_combined_datetime (cob_field *, cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_date_of_integer (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_day_of_integer (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_integer_of_date (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_integer_of_day (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_test_date_yyyymmdd (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_test_day_yyyyddd (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_factorial (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_exp (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_exp10 (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_abs (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_acos (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_asin (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_atan (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_cos (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_log (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_log10 (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_sin (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_sqrt (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_tan (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_upper_case (const int, const int, cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_lower_case (const int, const int, cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_reverse (const int, const int, cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_concatenate (const int, const int, const int, ...); -extern cob_field *cob_intr_substitute (const int, const int, +COB_DLL_EXPIMP extern cob_field *cob_intr_substitute (const int, const int, const int, ...); -extern cob_field *cob_intr_substitute_case (const int, const int, +COB_DLL_EXPIMP extern cob_field *cob_intr_substitute_case (const int, const int, const int, ...); -extern cob_field *cob_intr_trim (const int, const int, +COB_DLL_EXPIMP extern cob_field *cob_intr_trim (const int, const int, cob_field *, const int); -extern cob_field *cob_intr_length (cob_field *); -extern cob_field *cob_intr_integer (cob_field *); -extern cob_field *cob_intr_integer_part (cob_field *); -extern cob_field *cob_intr_fraction_part (cob_field *); -extern cob_field *cob_intr_sign (cob_field *); -extern cob_field *cob_intr_numval (cob_field *); -extern cob_field *cob_intr_numval_c (cob_field *, cob_field *); -extern cob_field *cob_intr_annuity (cob_field *, cob_field *); -extern cob_field *cob_intr_mod (cob_field *, cob_field *); -extern cob_field *cob_intr_rem (cob_field *, cob_field *); -extern cob_field *cob_intr_sum (const int, ...); -extern cob_field *cob_intr_ord_min (const int, ...); -extern cob_field *cob_intr_ord_max (const int, ...); -extern cob_field *cob_intr_min (const int, ...); -extern cob_field *cob_intr_max (const int, ...); -extern cob_field *cob_intr_midrange (const int, ...); -extern cob_field *cob_intr_median (const int, ...); -extern cob_field *cob_intr_mean (const int, ...); -extern cob_field *cob_intr_range (const int, ...); -extern cob_field *cob_intr_random (const int, ...); -extern cob_field *cob_intr_variance (const int, ...); -extern cob_field *cob_intr_standard_deviation (const int, ...); -extern cob_field *cob_intr_present_value (const int, ...); -extern cob_field *cob_intr_year_to_yyyy (const int, ...); -extern cob_field *cob_intr_date_to_yyyymmdd (const int, ...); -extern cob_field *cob_intr_day_to_yyyyddd (const int, ...); -extern cob_field *cob_intr_locale_date (const int, const int, +COB_DLL_EXPIMP extern cob_field *cob_intr_length (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_integer (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_integer_part (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_fraction_part (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_sign (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_numval (cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_numval_c (cob_field *, cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_annuity (cob_field *, cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_mod (cob_field *, cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_rem (cob_field *, cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_sum (const int, ...); +COB_DLL_EXPIMP extern cob_field *cob_intr_ord_min (const int, ...); +COB_DLL_EXPIMP extern cob_field *cob_intr_ord_max (const int, ...); +COB_DLL_EXPIMP extern cob_field *cob_intr_min (const int, ...); +COB_DLL_EXPIMP extern cob_field *cob_intr_max (const int, ...); +COB_DLL_EXPIMP extern cob_field *cob_intr_midrange (const int, ...); +COB_DLL_EXPIMP extern cob_field *cob_intr_median (const int, ...); +COB_DLL_EXPIMP extern cob_field *cob_intr_mean (const int, ...); +COB_DLL_EXPIMP extern cob_field *cob_intr_range (const int, ...); +COB_DLL_EXPIMP extern cob_field *cob_intr_random (const int, ...); +COB_DLL_EXPIMP extern cob_field *cob_intr_variance (const int, ...); +COB_DLL_EXPIMP extern cob_field *cob_intr_standard_deviation (const int, ...); +COB_DLL_EXPIMP extern cob_field *cob_intr_present_value (const int, ...); +COB_DLL_EXPIMP extern cob_field *cob_intr_year_to_yyyy (const int, ...); +COB_DLL_EXPIMP extern cob_field *cob_intr_date_to_yyyymmdd (const int, ...); +COB_DLL_EXPIMP extern cob_field *cob_intr_day_to_yyyyddd (const int, ...); +COB_DLL_EXPIMP extern cob_field *cob_intr_locale_date (const int, const int, cob_field *, cob_field *); -extern cob_field *cob_intr_locale_time (const int, const int, +COB_DLL_EXPIMP extern cob_field *cob_intr_locale_time (const int, const int, cob_field *, cob_field *); -extern cob_field *cob_intr_seconds_past_midnight (void); -extern cob_field *cob_intr_lcl_time_from_secs (const int, const int, +COB_DLL_EXPIMP extern cob_field *cob_intr_seconds_past_midnight (void); +COB_DLL_EXPIMP extern cob_field *cob_intr_lcl_time_from_secs (const int, const int, cob_field *, cob_field *); -extern cob_field *cob_intr_seconds_from_formatted_time (cob_field *, cob_field *); +COB_DLL_EXPIMP extern cob_field *cob_intr_seconds_from_formatted_time (cob_field *, cob_field *); #endif /* COB_INTRINSIC_H */ [/code] [code]--- move.h.orig Sun Jan 18 12:36:08 2009 +++ move.h Wed Jul 29 14:56:00 2009 @@ -23,8 +23,8 @@ #include -extern void cob_move (cob_field *, cob_field *); -extern void cob_set_int (cob_field *, int); -extern int cob_get_int (cob_field *); +COB_DLL_EXPIMP extern void cob_move (cob_field *, cob_field *); +COB_DLL_EXPIMP extern void cob_set_int (cob_field *, int); +COB_DLL_EXPIMP extern int cob_get_int (cob_field *); #endif /* COB_MOVE_H */ [/code] [code]--- numeric.h.orig Sun Jan 18 12:43:54 2009 +++ numeric.h Wed Jul 29 14:55:56 2009 @@ -38,37 +38,37 @@ int scale; } cob_decimal; -extern void cob_decimal_init (cob_decimal *); -extern void cob_decimal_set_field (cob_decimal *, cob_field *); -extern int cob_decimal_get_field (cob_decimal *, cob_field *, const int); -extern void cob_decimal_add (cob_decimal *, cob_decimal *); -extern void cob_decimal_sub (cob_decimal *, cob_decimal *); -extern void cob_decimal_mul (cob_decimal *, cob_decimal *); -extern void cob_decimal_div (cob_decimal *, cob_decimal *); -extern void cob_decimal_pow (cob_decimal *, cob_decimal *); -extern int cob_decimal_cmp (cob_decimal *, cob_decimal *); +COB_DLL_EXPIMP extern void cob_decimal_init (cob_decimal *); +COB_DLL_EXPIMP extern void cob_decimal_set_field (cob_decimal *, cob_field *); +COB_DLL_EXPIMP extern int cob_decimal_get_field (cob_decimal *, cob_field *, const int); +COB_DLL_EXPIMP extern void cob_decimal_add (cob_decimal *, cob_decimal *); +COB_DLL_EXPIMP extern void cob_decimal_sub (cob_decimal *, cob_decimal *); +COB_DLL_EXPIMP extern void cob_decimal_mul (cob_decimal *, cob_decimal *); +COB_DLL_EXPIMP extern void cob_decimal_div (cob_decimal *, cob_decimal *); +COB_DLL_EXPIMP extern void cob_decimal_pow (cob_decimal *, cob_decimal *); +COB_DLL_EXPIMP extern int cob_decimal_cmp (cob_decimal *, cob_decimal *); -extern int cob_add (cob_field *, cob_field *, const int); -extern int cob_sub (cob_field *, cob_field *, const int); -extern int cob_add_int (cob_field *, const int); -extern int cob_sub_int (cob_field *, const int); -extern int cob_div_quotient (cob_field *, cob_field *, +COB_DLL_EXPIMP extern int cob_add (cob_field *, cob_field *, const int); +COB_DLL_EXPIMP extern int cob_sub (cob_field *, cob_field *, const int); +COB_DLL_EXPIMP extern int cob_add_int (cob_field *, const int); +COB_DLL_EXPIMP extern int cob_sub_int (cob_field *, const int); +COB_DLL_EXPIMP extern int cob_div_quotient (cob_field *, cob_field *, cob_field *, const int); -extern int cob_div_remainder (cob_field *, const int); +COB_DLL_EXPIMP extern int cob_div_remainder (cob_field *, const int); -extern int cob_cmp_int (cob_field *, const int); -extern int cob_cmp_uint (cob_field *, const unsigned int); -extern int cob_cmp_packed (cob_field *, int); -extern int cob_cmp_numdisp (const unsigned char *, +COB_DLL_EXPIMP extern int cob_cmp_int (cob_field *, const int); +COB_DLL_EXPIMP extern int cob_cmp_uint (cob_field *, const unsigned int); +COB_DLL_EXPIMP extern int cob_cmp_packed (cob_field *, int); +COB_DLL_EXPIMP extern int cob_cmp_numdisp (const unsigned char *, const size_t, const int); -extern int cob_cmp_sign_numdisp (const unsigned char *, +COB_DLL_EXPIMP extern int cob_cmp_sign_numdisp (const unsigned char *, const size_t, const int); -extern int cob_cmp_long_numdisp (const unsigned char *, +COB_DLL_EXPIMP extern int cob_cmp_long_numdisp (const unsigned char *, const size_t, const int); -extern void cob_set_packed_zero (cob_field *); -extern void cob_set_packed_int (cob_field *, const int); +COB_DLL_EXPIMP extern void cob_set_packed_zero (cob_field *); +COB_DLL_EXPIMP extern void cob_set_packed_int (cob_field *, const int); -extern int cob_cmp_long_sign_numdisp (const unsigned char *, +COB_DLL_EXPIMP extern int cob_cmp_long_sign_numdisp (const unsigned char *, const size_t, const int); #endif /* COB_NUMERIC_H */ [/code] [code]--- screenio.h.orig Tue Jan 20 20:59:14 2009 +++ screenio.h Wed Jul 29 14:56:30 2009 @@ -78,15 +78,15 @@ int attr; /* for COB_SCREEN_TYPE_ATTRIBUTE */ }; -DLL_EXPIMP extern int cob_screen_mode; +COB_DLL_EXPIMP extern int cob_screen_mode; -extern void cob_screen_line_col (cob_field *, const int); -extern void cob_screen_display (cob_screen *, cob_field *, cob_field *); -extern void cob_screen_accept (cob_screen *, cob_field *, cob_field *); -extern void cob_field_display (cob_field *, cob_field *, cob_field *, +COB_DLL_EXPIMP extern void cob_screen_line_col (cob_field *, const int); +COB_DLL_EXPIMP extern void cob_screen_display (cob_screen *, cob_field *, cob_field *); +COB_DLL_EXPIMP extern void cob_screen_accept (cob_screen *, cob_field *, cob_field *); +COB_DLL_EXPIMP extern void cob_field_display (cob_field *, cob_field *, cob_field *, cob_field *, cob_field *, cob_field *, const int); -extern void cob_field_accept (cob_field *, cob_field *, cob_field *, +COB_DLL_EXPIMP extern void cob_field_accept (cob_field *, cob_field *, cob_field *, cob_field *, cob_field *, cob_field *, const int); [/code] [code]--- strings.h.orig Sun Jan 18 12:22:00 2009 +++ strings.h Wed Jul 29 14:56:34 2009 @@ -23,27 +23,27 @@ #include -extern void cob_inspect_init (cob_field *, const int); -extern void cob_inspect_start (void); -extern void cob_inspect_before (const cob_field *); -extern void cob_inspect_after (const cob_field *); -extern void cob_inspect_characters (cob_field *); -extern void cob_inspect_all (cob_field *, cob_field *); -extern void cob_inspect_leading (cob_field *, cob_field *); -extern void cob_inspect_first (cob_field *, cob_field *); -extern void cob_inspect_trailing (cob_field *, cob_field *); -extern void cob_inspect_converting (cob_field *, cob_field *); -extern void cob_inspect_finish (void); +COB_DLL_EXPIMP extern void cob_inspect_init (cob_field *, const int); +COB_DLL_EXPIMP extern void cob_inspect_start (void); +COB_DLL_EXPIMP extern void cob_inspect_before (const cob_field *); +COB_DLL_EXPIMP extern void cob_inspect_after (const cob_field *); +COB_DLL_EXPIMP extern void cob_inspect_characters (cob_field *); +COB_DLL_EXPIMP extern void cob_inspect_all (cob_field *, cob_field *); +COB_DLL_EXPIMP extern void cob_inspect_leading (cob_field *, cob_field *); +COB_DLL_EXPIMP extern void cob_inspect_first (cob_field *, cob_field *); +COB_DLL_EXPIMP extern void cob_inspect_trailing (cob_field *, cob_field *); +COB_DLL_EXPIMP extern void cob_inspect_converting (cob_field *, cob_field *); +COB_DLL_EXPIMP extern void cob_inspect_finish (void); -extern void cob_string_init (cob_field *, cob_field *); -extern void cob_string_delimited (cob_field *); -extern void cob_string_append (cob_field *); -extern void cob_string_finish (void); +COB_DLL_EXPIMP extern void cob_string_init (cob_field *, cob_field *); +COB_DLL_EXPIMP extern void cob_string_delimited (cob_field *); +COB_DLL_EXPIMP extern void cob_string_append (cob_field *); +COB_DLL_EXPIMP extern void cob_string_finish (void); -extern void cob_unstring_init (cob_field *, cob_field *, const size_t); -extern void cob_unstring_delimited (cob_field *, const int); -extern void cob_unstring_into (cob_field *, cob_field *, cob_field *); -extern void cob_unstring_tallying (cob_field *); -extern void cob_unstring_finish (void); +COB_DLL_EXPIMP extern void cob_unstring_init (cob_field *, cob_field *, const size_t); +COB_DLL_EXPIMP extern void cob_unstring_delimited (cob_field *, const int); +COB_DLL_EXPIMP extern void cob_unstring_into (cob_field *, cob_field *, cob_field *); +COB_DLL_EXPIMP extern void cob_unstring_tallying (cob_field *); +COB_DLL_EXPIMP extern void cob_unstring_finish (void); #endif /* COB_STRINGS_H */ [/code] [code]--- termio.h.orig Sun Jan 18 14:33:18 2009 +++ termio.h Wed Jul 29 14:56:36 2009 @@ -23,7 +23,7 @@ #include -extern void cob_display (const int, const int, const int, ...); -extern void cob_accept (cob_field *); +COB_DLL_EXPIMP exter ---------------------------------------------------------------- Subject: Combined cobc.c patch for MSVC Here is a combined patch for most of human and my patches from the original distribution cobc.c 1. allow spaces in filenames (I never use that :-)) 2. cleanup .exp, .lib, .manifest 3. strip filename extension for "-o" option (MSVC has a problem with that) 4. cobc -m x.obj -- bug fix Forgot what else... [code] *** cobc.c.orig 2009-02-01 04:16:48.000000000 -0500 --- cobc.c 2009-07-29 11:57:02.000000000 -0400 *************** *** 917,922 **** --- 917,933 ---- } static void + file_stripext (char *buff) + { + char * endp = buff + strlen(buff) - 1; + while(endp > buff) { + if(*endp == '/' || *endp == '\\') break; + if(*endp == '.') *endp = 0; + --endp; + } + } + + static void file_basename (const char *filename, char *buff) { const char *startp; *************** *** 1382,1387 **** --- 1393,1401 ---- if (output_name) { strcpy (name, output_name); + #ifdef _MSC_VER + file_stripext(name); + #endif } else { file_basename (fn->source, name); #ifndef _MSC_VER *************** *** 1390,1397 **** } #ifdef _MSC_VER sprintf (buff, gflag_set ? ! "%s /c %s %s /Od /MDd /Zi /FR /c /Fa%s /Fo%s %s" : ! "%s /c %s %s /MD /c /Fa%s /Fo%s %s", cob_cc, cob_cflags, cob_define_flags, name, name, fn->translate); #else --- 1404,1411 ---- } #ifdef _MSC_VER sprintf (buff, gflag_set ? ! "%s /c %s %s /Od /MDd /Zi /FR /c /Fa\"%s\" /Fo\"%s\" %s" : ! "%s /c %s %s /MD /c /Fa\"%s\" /Fo\"%s\" %s", cob_cc, cob_cflags, cob_define_flags, name, name, fn->translate); #else *************** *** 1408,1415 **** #ifdef _MSC_VER sprintf (buff, gflag_set ? ! "%s /c %s %s /Od /MDd /Zi /FR /Fo%s %s" : ! "%s /c %s %s /MD /Fo%s %s", cob_cc, cob_cflags, cob_define_flags, fn->object, fn->translate); #else --- 1422,1429 ---- #ifdef _MSC_VER sprintf (buff, gflag_set ? ! "%s /c %s %s /Od /MDd /Zi /FR /Fo\"%s\" %s" : ! "%s /c %s %s /MD /Fo\"%s\" %s", cob_cc, cob_cflags, cob_define_flags, fn->object, fn->translate); #else *************** *** 1436,1442 **** if (output_name) { strcpy (name, output_name); ! #ifndef _MSC_VER if (strchr (output_name, '.') == NULL) { strcat (name, "."); strcat (name, COB_MODULE_EXT); --- 1450,1458 ---- if (output_name) { strcpy (name, output_name); ! #ifdef _MSC_VER ! file_stripext(name); ! #else if (strchr (output_name, '.') == NULL) { strcat (name, "."); strcat (name, COB_MODULE_EXT); *************** *** 1451,1468 **** } #ifdef _MSC_VER sprintf (buff, gflag_set ? ! "%s %s %s /Od /MDd /LDd /Zi /FR /Fe%s /Fo%s %s %s %s" : ! "%s %s %s /MD /LD /Fe%s /Fo%s %s %s %s", cob_cc, cob_cflags, cob_define_flags, name, name, cob_ldflags, fn->translate, cob_libs); ret = process (buff); #if _MSC_VER >= 1400 /* Embedding manifest */ if (ret == 0) { ! sprintf (buff, "mt /manifest %s.dll.manifest /outputresource:%s.dll;#2", name, name); ret = process (buff); } #endif #else /* _MSC_VER */ sprintf (buff, "%s %s %s %s %s %s %s %s -o %s %s %s", cob_cc, gccpipe, cob_cflags, cob_define_flags, COB_SHARED_OPT, --- 1467,1494 ---- } #ifdef _MSC_VER sprintf (buff, gflag_set ? ! "%s %s %s /Od /MDd /LDd /Zi /FR /Fe\"%s\" /Fo\"%s\" %s \"%s\" %s" : ! "%s %s %s /MD /LD /Fe\"%s\" /Fo\"%s\" %s \"%s\" %s", cob_cc, cob_cflags, cob_define_flags, name, name, cob_ldflags, fn->translate, cob_libs); ret = process (buff); #if _MSC_VER >= 1400 /* Embedding manifest */ if (ret == 0) { ! if (verbose_output) { ! sprintf (buff, "mt /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); ! } else { ! sprintf (buff, "mt /nologo /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); ! } ret = process (buff); + sprintf (buff, "%s.dll.manifest", name); + cobc_check_action (buff); } #endif + sprintf (buff, "%s.exp", name); + cobc_check_action (buff); + sprintf (buff, "%s.lib", name); + cobc_check_action (buff); #else /* _MSC_VER */ sprintf (buff, "%s %s %s %s %s %s %s %s -o %s %s %s", cob_cc, gccpipe, cob_cflags, cob_define_flags, COB_SHARED_OPT, *************** *** 1488,1494 **** if (output_name) { strcpy (name, output_name); ! #ifndef _MSC_VER if (strchr (output_name, '.') == NULL) { strcat (name, "."); strcat (name, COB_MODULE_EXT); --- 1514,1522 ---- if (output_name) { strcpy (name, output_name); ! #ifdef _MSC_VER ! file_stripext(name); ! #else if (strchr (output_name, '.') == NULL) { strcat (name, "."); strcat (name, COB_MODULE_EXT); *************** *** 1496,1517 **** #endif } else { file_basename (fn->source, name); strcat (name, "."); strcat (name, COB_MODULE_EXT); } #ifdef _MSC_VER sprintf (buff, gflag_set ? ! "%s /Od /MDd /LDd /Zi /FR /Fe%s %s %s %s" : ! "%s /MD /LD /Fe%s %s %s %s", cob_cc, name, cob_ldflags, fn->object, cob_libs); ret = process (buff); #if _MSC_VER >= 1400 /* Embedding manifest */ if (ret == 0) { ! sprintf (buff, "mt /manifest %s.dll.manifest /outputresource:%s.dll;#2", name, name); ret = process (buff); } #endif #else /* _MSC_VER */ sprintf (buff, "%s %s %s %s %s %s -o %s %s %s", cob_cc, gccpipe, COB_SHARED_OPT, cob_ldflags, COB_PIC_FLAGS, --- 1524,1559 ---- #endif } else { file_basename (fn->source, name); + #ifndef _MSC_VER strcat (name, "."); strcat (name, COB_MODULE_EXT); + #endif } #ifdef _MSC_VER sprintf (buff, gflag_set ? ! "%s /Od /MDd /LDd /Zi /FR /Fe\"%s\" %s \"%s\" %s" : ! "%s /MD /LD /Fe\"%s\" %s \"%s\" %s", cob_cc, name, cob_ldflags, fn->object, cob_libs); ret = process (buff); #if _MSC_VER >= 1400 /* Embedding manifest */ if (ret == 0) { ! ! if (verbose_output) { ! sprintf (buff, "mt /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); ! } else { ! sprintf (buff, "mt /nologo /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); ! } ! ret = process (buff); + sprintf (buff, "%s.dll.manifest", name); + cobc_check_action (buff); } #endif + sprintf (buff, "%s.exp", name); + cobc_check_action (buff); + sprintf (buff, "%s.lib", name); + cobc_check_action (buff); #else /* _MSC_VER */ sprintf (buff, "%s %s %s %s %s %s -o %s %s %s", cob_cc, gccpipe, COB_SHARED_OPT, cob_ldflags, COB_PIC_FLAGS, *************** *** 1549,1561 **** objsptr = objs; } for (f = l; f; f = f->next) { strcat (objsptr, f->object); strcat (objsptr, " "); } if (output_name) { strcpy (name, output_name); ! #ifndef _MSC_VER if (strchr (output_name, '.') == NULL) { strcat (name, "."); strcat (name, COB_MODULE_EXT); --- 1591,1611 ---- objsptr = objs; } for (f = l; f; f = f->next) { + #ifdef _MSC_VER + strcat (objsptr, "\""); + #endif strcat (objsptr, f->object); + #ifdef _MSC_VER + strcat (objsptr, "\""); + #endif strcat (objsptr, " "); } if (output_name) { strcpy (name, output_name); ! #ifdef _MSC_VER ! file_stripext(name); ! #else if (strchr (output_name, '.') == NULL) { strcat (name, "."); strcat (name, COB_MODULE_EXT); *************** *** 1581,1597 **** #ifdef _MSC_VER sprintf (buff, gflag_set ? ! "%s /Od /MDd /LDd /Zi /FR /Fe%s %s %s %s" : ! "%s /MD /LD /Fe%s %s %s %s", cob_cc, name, cob_ldflags, objsptr, cob_libs); ret = process (buff); #if _MSC_VER >= 1400 /* Embedding manifest */ if (ret == 0) { ! sprintf (buff, "mt /manifest %s.dll.manifest /outputresource:%s.dll;#2", name, name); ret = process (buff); } #endif #else /* _MSC_VER */ sprintf (buffptr, "%s %s %s %s %s %s -o %s %s %s", cob_cc, gccpipe, COB_SHARED_OPT, cob_ldflags, COB_PIC_FLAGS, --- 1631,1657 ---- #ifdef _MSC_VER sprintf (buff, gflag_set ? ! "%s /Od /MDd /LDd /Zi /FR /Fe\"%s\" %s %s %s" : ! "%s /MD /LD /Fe\"%s\" %s %s %s", cob_cc, name, cob_ldflags, objsptr, cob_libs); ret = process (buff); #if _MSC_VER >= 1400 /* Embedding manifest */ if (ret == 0) { ! if (verbose_output) { ! sprintf (buff, "mt /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); ! } else { ! sprintf (buff, "mt /nologo /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); ! } ret = process (buff); + sprintf (buff, "%s.dll.manifest", name); + cobc_check_action (buff); } #endif + sprintf (buff, "%s.exp", name); + cobc_check_action (buff); + sprintf (buff, "%s.lib", name); + cobc_check_action (buff); #else /* _MSC_VER */ sprintf (buffptr, "%s %s %s %s %s %s -o %s %s %s", cob_cc, gccpipe, COB_SHARED_OPT, cob_ldflags, COB_PIC_FLAGS, *************** *** 1629,1640 **** --- 1689,1709 ---- objsptr = objs; } for (f = l; f; f = f->next) { + #ifdef _MSC_VER + strcat (objsptr, "\""); + #endif strcat (objsptr, f->object); + #ifdef _MSC_VER + strcat (objsptr, "\""); + #endif strcat (objsptr, " "); } if (output_name) { strcpy (name, output_name); + #ifdef _MSC_VER + file_stripext(name); + #endif } else { file_basename (l->source, name); } *************** *** 1649,1663 **** } #ifdef _MSC_VER sprintf (buff, gflag_set ? ! "%s /Od /MDd /Zi /FR /Fe%s %s %s %s" : ! "%s /MD /Fe%s %s %s %s", cob_cc, name, cob_ldflags, objsptr, cob_libs); ret = process (buff); #if _MSC_VER >= 1400 /* Embedding manifest */ if (ret == 0) { ! sprintf (buff, "mt /manifest %s.exe.manifest /outputresource:%s.exe;#2", name, name); ret = process (buff); } #endif #else /* _MSC_VER */ --- 1718,1738 ---- } #ifdef _MSC_VER sprintf (buff, gflag_set ? ! "%s /Od /MDd /Zi /FR /Fe\"%s\" %s %s %s" : ! "%s /MD /Fe\"%s\" %s %s %s", cob_cc, name, cob_ldflags, objsptr, cob_libs); ret = process (buff); #if _MSC_VER >= 1400 /* Embedding manifest */ if (ret == 0) { ! if (verbose_output) { ! sprintf (buff, "mt /manifest \"%s.exe.manifest\" /outputresource:\"%s.exe\";#2", name, name); ! } else { ! sprintf (buff, "mt /nologo /manifest \"%s.exe.manifest\" /outputresource:\"%s.exe\";#2", name, name); ! } ret = process (buff); + sprintf (buff, "%s.exe.manifest", name); + cobc_check_action (buff); } #endif #else /* _MSC_VER */ *************** *** 1815,1820 **** --- 1890,1900 ---- /* Defaults are set here */ if (!cb_flag_syntax_only) { + #ifdef _MSC_VER + if (!verbose_output) { + strcat (cob_cflags, " /nologo"); + } + #endif if (!wants_nonfinal) { if (cb_flag_main) { cb_compile_level = CB_LEVEL_EXECUTABLE; [/code] ---------------------------------------------------------------- I will gather the Bugs and FR open for 1.1 (one topic for Bugs, one for FR). Maybe we can find solutions to some of them, too, for Roger having not too much to do when showing up until he can release 1.1. human ---------------------------------------------------------------- And if (as a FR) someone wants to have compiler options "-Wc," and "-Wl," (as in GCC), here is a patch for that (after applying combined) [code] *** cobc.c.my1 2009-07-29 15:02:17.000000000 -0400 --- cobc.c 2009-07-29 15:14:20.000000000 -0400 *************** *** 252,258 **** static cob_sighandler_t qutsig = NULL; #endif ! static const char short_options[] = "hVvECScbmxOgwo:t:I:L:l:D:"; static const struct option long_options[] = { {"help", no_argument, NULL, 'h'}, --- 252,258 ---- static cob_sighandler_t qutsig = NULL; #endif ! static const char short_options[] = "hVvECScbmxOgwo:t:I:L:l:D:W:"; static const struct option long_options[] = { {"help", no_argument, NULL, 'h'}, *************** *** 282,288 **** {"fno-"name, no_argument, &var, 0}, #include "flag.def" #undef CB_FLAG ! {"Wall", no_argument, NULL, 'W'}, {"W", no_argument, NULL, 'Z'}, #undef CB_WARNDEF #define CB_WARNDEF(var,name,wall,doc) \ --- 282,288 ---- {"fno-"name, no_argument, &var, 0}, #include "flag.def" #undef CB_FLAG ! {"Wall", no_argument, NULL, 'A'}, {"W", no_argument, NULL, 'Z'}, #undef CB_WARNDEF #define CB_WARNDEF(var,name,wall,doc) \ *************** *** 294,303 **** }; static const char *cob_cc; /* gcc */ ! static char cob_cflags[COB_SMALL_BUFF]; /* -I... */ static char cob_libs[COB_MEDIUM_BUFF]; /* -L... -lcob */ static char cob_define_flags[COB_SMALL_BUFF]; /* -D... */ ! static const char *cob_ldflags; static const char *cob_copy_dir; /* cobc functions */ --- 294,303 ---- }; static const char *cob_cc; /* gcc */ ! static char cob_cflags[COB_SMALL_BUFF]; /* -I..., -Wc,... */ static char cob_libs[COB_MEDIUM_BUFF]; /* -L... -lcob */ static char cob_define_flags[COB_SMALL_BUFF]; /* -D... */ ! static char cob_ldflags[COB_SMALL_BUFF]; /* -Wl,... */ static const char *cob_copy_dir; /* cobc functions */ *************** *** 553,558 **** --- 553,560 ---- puts (_(" -L Add to library search path")); puts (_(" -l Link the library ")); puts (_(" -D Pass to the C compiler")); + puts (_(" -Wc, Pass on to the C compiler")); + puts (_(" -Wl, Pass on to the linker")); puts (_(" -conf= User defined dialect configuration - See -std=")); puts (_(" --list-reserved Display reserved words")); puts (_(" --list-intrinsics Display intrinsic functions")); *************** *** 814,819 **** --- 816,835 ---- cb_extension_list = cb_text_list_add (cb_extension_list, ext); break; + case 'W': + if(*optarg != 'c' && *optarg != 'C' && *optarg != 'l' && *optarg != 'L' && optarg[1] != ',') { + fprintf (stderr, _("Invalid option -W%s\n"), optarg); + exit (1); + } + if(*optarg == 'c' || *optarg == 'C') { + strcat (cob_cflags, " "); + strcat (cob_cflags, optarg+2); + } else { + strcat (cob_ldflags, " "); + strcat (cob_ldflags, optarg+2); + } + break; + case 'w': #undef CB_WARNDEF #define CB_WARNDEF(var,name,wall,doc) var = 0; *************** *** 821,827 **** #undef CB_WARNDEF break; ! case 'W': #undef CB_WARNDEF #define CB_WARNDEF(var,name,wall,doc) if (wall) var = 1; #include "warning.def" --- 837,843 ---- #undef CB_WARNDEF break; ! case 'A': #undef CB_WARNDEF #define CB_WARNDEF(var,name,wall,doc) if (wall) var = 1; #include "warning.def" *************** *** 1833,1842 **** } cobc_init_var (cob_cflags, "COB_CFLAGS", COB_CFLAGS); cobc_init_var (cob_libs, "COB_LIBS", COB_LIBS); ! cob_ldflags = getenv ("COB_LDFLAGS"); ! if (cob_ldflags == NULL) { ! cob_ldflags = COB_LDFLAGS; ! } cob_config_dir = getenv ("COB_CONFIG_DIR"); if (cob_config_dir == NULL) { cob_config_dir = COB_CONFIG_DIR; --- 1849,1855 ---- } cobc_init_var (cob_cflags, "COB_CFLAGS", COB_CFLAGS); cobc_init_var (cob_libs, "COB_LIBS", COB_LIBS); ! cobc_init_var (cob_ldflags, "COB_LDFLAGS", COB_LDFLAGS); cob_config_dir = getenv ("COB_CONFIG_DIR"); if (cob_config_dir == NULL) { cob_config_dir = COB_CONFIG_DIR; [/code] ---------------------------------------------------------------- If a patch is already available I like this to be implemented (I will take this to the FR list). human ---------------------------------------------------------------- The patch seems to be incorrect. After applying it, the test suite (syntax checks) do not work any more. [quote]..\..\cobc\cobc.c:854: Internal compiler error[/quote] BTW: Maybe it is a good idea to run the cobol85 tests after all changes, too. What is necessary to do so (on win)? human ---------------------------------------------------------------- Subject: NUMVAL/NUMVAL-C Can't Parse CR/DB (Fix Submitted) The intrinsic functions NUMVAL and NUMVAL-C (implemented in the libcob/intrinsic.c module by the "cob_intr_numval" and "cob_intr_numval_c" functions, respectively) in OpenCOBOL 1.1 both have the same problem - they stop one byte short of being able to recognize CR or DB symbols in the strings they're parsing. Each has a segment of code like this: [code] for (i = 0; i < srcfield->size; ++i) { if (i < (srcfield->size - 2)) { if (strcasecmp ((char *)&srcfield->data[i], "CR") == 0 || strcasecmp ((char *)&srcfield->data[i], "DB") == 0) { sign = 1; break; } } [/code] That needs a very simple change: [code] for (i = 0; i < srcfield->size; ++i) { /******************************************************************************* ** BUGFIX - "CR" and "DB" symbols aren't being recognized (testing for those ** ** symbols stops one character too short) .. replace statement: ** ** ---------------------------------- ** ** if (i < (srcfield->size - 2)) { ** ** ---------------------------------- ** *******************************************************************************/ if (i < (srcfield->size - 1)) { /******************************************************************************* ** END BUGFIX ** *******************************************************************************/ if (strcasecmp ((char *)&srcfield->data[i], "CR") == 0 || strcasecmp ((char *)&srcfield->data[i], "DB") == 0) { sign = 1; break; } } [/code] cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Jul 29 2009 11:23:33 Packaged Feb 06 2009 10:30:55 CET ---------------------------------------------------------------- Yes, it's a bug staying from 0.33 :-) Thanks for pointing out. ---------------------------------------------------------------- Subject: Patch for MSVC: No need to specify additional libs anymore, just use the libs of config.h This patch remove the need to update both config.h and the project files. The libraries that are included in this patch are: -curses -ncurses -pdcurses -gmp -disam -ifisam -vbisam They are linked by [code]#pragma comment( lib, "libname" )[/code] I wasn't sure if this could crash GCC, therefore the patch uses [code]#ifdef _MSC_VER[/code] I wondered that C-ISAM library has no entry in config.h. Isn't any library necessary for C-ISAM? Because of me don't wanting to change the entries in config.h, there is no patch for linking C-ISAM or the right bdb library. [code]--- fileio.c.orig Sat Jan 24 15:31:30 2009 +++ fileio.c Thu Jul 30 15:57:56 2009 @@ -99,13 +99,9 @@ #ifdef WITH_CISAM #include -#endif - -#ifdef WITH_DISAM +#elif WITH_DISAM #include -#endif - -#ifdef WITH_VBISAM +#elif WITH_VBISAM #include #endif @@ -146,6 +142,17 @@ #define INITIAL_FLAGS O_BINARY #else #define INITIAL_FLAGS 0 +#endif + +/* Link Libraries for MSC according to config.h */ +#ifdef _MSC_VER +#ifdef HAVE_LIBDISAM + #pragma comment( lib, "disam" ) +#elif defined(HAVE_LIBIFISAM) + #pragma comment( lib, "ifisam" ) +#elif defined(HAVE_LIBVBISAM) + #pragma comment( lib, "vbisam" ) +#endif #endif /* SORT definitions */ [/code] [code]--- numeric.c.orig Sat Jan 24 15:31:30 2009 +++ numeric.c Thu Jul 30 15:57:46 2009 @@ -35,6 +35,13 @@ #define COB_LIB_INCLUDE #include "codegen.h" +/* Link Libraries for MSC according to config.h */ +#ifdef _MSC_VER +#ifdef HAVE_LIBGMP + #pragma comment( lib, "gmp" ) +#endif +#endif + #define DECIMAL_NAN -128 #define DECIMAL_CHECK(d1,d2) \ if (unlikely(d1->scale == DECIMAL_NAN || d2->scale == DECIMAL_NAN)) { \ [/code] [code]--- screenio.c.orig Sat Jan 31 18:33:50 2009 +++ screenio.c Thu Jul 30 15:57:48 2009 @@ -45,6 +45,17 @@ #include "coblocal.h" #include "screenio.h" +/* Link Libraries for MSC according to config.h */ +#ifdef _MSC_VER +#ifdef HAVE_LIBNCURSES + #pragma comment( lib, "ncurses" ) +#elif defined(HAVE_LIBPDCURSES) + #pragma comment( lib, "pdcurses" ) +#elif defined(HAVE_LIBCURSES) + #pragma comment( lib, "curses" ) +#endif +#endif + /* Global variables */ int cob_screen_initialized = 0; [/code] The fix was tested and works fine! The alternative would be to have a new mscmake.c (only for compiling with msc) where those #pragma are gathered. human ---------------------------------------------------------------- Subject: syntax error, unexpected VALUE, expecting EXTERNAL or GLOBAL I am using OpenCobol1.0 on and HP-UX system. I am getting the following error message: DCIOABRT.CBL:74: Error: syntax error, unexpected VALUE, expecting EXTERNAL or GLOBAL The code looks like this: (line 74 is 006700) [code] 006300 FILE SECTION. 006400*------------ 006500 006600 FD DCERR 006700 VALUE OF ID IS WK-FILE-ID. 006800 006900 01 DCERR-REC PIC X(80). 007000 007100 WORKING-STORAGE SECTION. 007200*----------------------- 007300 007400 01 WK-FILE-ID PIC X(40) VALUE SPACES. [/code] The syntax looks fine to me, but obviously there is a problem! Any ideas what the problem coud be? ---------------------------------------------------------------- Hi! 1st: Welcome to OC 2nd: There is no VALUE OF ID IS clause in FD. What should it do? (comment it out, don't forget to add the point and the syntax work) 3rd: Please use the CODE-Tags (Button <> in post/edit or write [ CODE] [ /CODE] without spaces). human ---------------------------------------------------------------- VALUE OF was an "old" STANDARD phrase in the FD. It was OBSOLETE in the '85 Standard and removed in the '02 Standard. To be "standard conforming" (somethng that Roger says that OC is NOT), this would need to be supported - if you claimed conformance to the '85 Standard. See, for example, [url=http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/IGY3LR40/5.2.7 ]http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/IGY3LR40/5.2.7 [/url] ---------------------------------------------------------------- Looking at an old I*M COBOL manual (STD85) the actual syntax is: VALUE OF system-name-1 [ IS ] { data-name | literal } The OC parser uses 'FILE-ID' as the 'system-name-1'. I haven't looked at any COBOL standard reference to confirm, but assuming that 'system-name-1' is implementation defined, then 'FILE-ID' is valid. By replacing 'ID' with 'FILE-ID', the sample code does compile with out any errors. I used OC 1.1-20090206 [1] for the test. 1) OC 1.1-20090206 http://www.sim-basis.de/open-cobol-1.1.tar.gz 2) OC Binaries 1.1 for Win32/64 HPUX http://www.kiska.net/opencobol/1.1/ ---------------------------------------------------------------- I think what essex wanted to say: Try to change ID to FILE-ID and see if it works. If not, try to compile the latest OC 1.1 prerelease or use the older 1.1 binaries from kiska.net. Please tell us if the VALUE OF clause work as it is supposed? human ---------------------------------------------------------------- Actually, there are two formats for the 'VALUE OF' clause supported by OC. Format-1: (85: obsolete, 2002: unconformable) VALUE OF identifier-1 [ IS ] { identifier-2 | literal-2 } Format-2: (extension) VALUE OF FILE-ID [ IS ] { identifier-1 | literal-1 } One format (Format-1) is, or was, part of the COBOL standard. The other (Format-2) is a COBOL extension used to relate the internal COBOL file name to the actual file name-path. In any case the current OC version (OC 1.1-20090206) will parse the syntax properly, even when a specific standard is selected. ---------------------------------------------------------------- Does Format-2 work in OC or only parses right? Could you provide a sample for Format-2 and, if it is different, for Format-1, too? human ---------------------------------------------------------------- Thanks for the responses. I tried to change ID to FILE-ID, and I get the same error. I am stuck using Version 1.0 binaries which I found that I can install on my HP-UX 11.00 system, so re-compiling or even using OC 1.1 is not an option. --Karey ---------------------------------------------------------------- Did you tried the newer HP-UX snapshot: http://www.kiska.net/opencobol/1.1/opencobol-1.1-hpux-ia64-bin.tar.gz What about recompiling OC for HP-UX on your machine? human ---------------------------------------------------------------- My system is not an IA64, it is running HP-UX 11.0 on a PA-RISC 2 architecture, and Open Cobol will NOT compile on it. Stupid error about GMP not being high enough version even though 4.3 is installed. I wish I could run OC 1.1. ---------------------------------------------------------------- Format-1 is treated as a comment by the OC parser. It will give a warning with the '--std=cobol85' option, and an error with the 'cobol2002' option. Format-2 will compile and work properly. It is functionally equivalent to the following form of the 'SELECT' clause. SELECT ... { identifier-1 | literal-1 } Looking at OC 1.0, Format-2 is not included in the parser. Assuming you are trying to relate the internal COBOL file name to the external or actual file name-path, the only other option is to comment the 'VALUE OF' clause and use 'SELECT' clause. Then the sample code would be as follows. FILE-CONTROL. SELECT DCERR ASSIGN TO WK-FILE-ID ... FILE SECTION. ... FD DCERR . * VALUE OF ID IS WK-FILE-ID ... WORKING-STORAGE SECTION. 01 WK-FILE-ID PIC X(40) VALUE SPACES. ... MOVE ... TO WK-FILE-ID Or you could define the actual file name at run time as follows. FILE-CONTROL. SELECT DCERR ASSIGN TO 'WKFILEID' ... FILE SECTION. ... FD DCERR . * VALUE OF ID IS WK-FILE-ID ... WORKING-STORAGE SECTION. *01 WK-FILE-ID PIC X(40) VALUE SPACES. export DD_WKFILEID=/path/filename ./program-name Anyway hope this helps. ---------------------------------------------------------------- My system is not an IA64, it is running HP-UX 11.0 on a PA-RISC 2 architecture, and Open Cobol will NOT compile on it. Stupid error about GMP not being high enough version even though 4.3 is installed. I wish I could run OC 1.1. ---------------------------------------------------------------- Getting GMP to configure properly is a common problem. A search of the OC forums and mailing lists may save you some time and effort in isolating the problem. Perhaps there may be multiple copies of GMP on your system. This can be fixed by setting the paths in the environment variables. example: export LDFLAGS="-L ... -L..." export CPPFLAGS="-I... -I..." ./configure --prefix=... ---------------------------------------------------------------- @essex: Thank you for making clear that only Format-2 work properly. If you use VALUE OF, you don't use ASSIGN TO in the SELECT clause? This is the pointing I wondered about, can you please submit a sample for VALUE OF? @kdsadler: kiska.net wrotes [quote]you will need GMP 4.2.1 and Berkeley DB 4.4.20 which you can download from [url=http://hpux.connect.org.uk/]Porting And Archive Centre for HP-UX[/url][/quote] If you have problems with building on HP-UX 11.0 on a PA-RISC 2 it could be a good idea to open a new thread for that problem. human ---------------------------------------------------------------- Example using .VALUE OF FILE-ID'. FILE-CONTROL. SELECT DCERR ASSIGN TO DISK ... FILE SECTION. FD DCERR VALUE OF FILE-ID IS 'WKFILEID'. *> VALUE OF FILE-ID IS WK-FILE-ID. 01 DCERR-REC PIC X(80). ... WORKING-STORAGE SECTION. 01 WK-FILE-ID PIC X(40) VALUE SPACES. export DD_WKFILEID=/path/filename ./DCIOABRT There is a search sequence defined in the OC RTL. But I don't think it is documented. ---------------------------------------------------------------- Thanks for the suggestion. It also took ./configure CC='gcc -fPIC' to finally compile GMP. I have another thread open for compiling OC 1.1 so I'll leave off that topic in this thread. ---------------------------------------------------------------- Subject: Problem compiling on OS X Leopard box Hello... Trying to ./configure prior to compiling, on an OS X 10.5.7 Leopard box. I have the developer tools installed. . . . checking getopt.h usability... yes checking getopt.h presence... yes checking for getopt.h... yes checking gmp.h usability... no checking gmp.h presence... no checking for gmp.h... no configure: error: gmp.h is required dnormandin@d75-154-103-161 ~/downloads/open-cobol-1.0 dnormandin@d75-154-103-161 ~/downloads/open-cobol-1.0 01:41 pm >> sudo find /opt -name "gmp.h" Password: /opt/local/include/gmp.h /opt/local/var/macports/software/gmp/4.2.2_1/opt/local/include/gmp.h /opt/local/var/macports/software/gmp/4.2.4_3/opt/local/include/gmp.h I don't program in C, so I don't know the tricks-of-the-trade. Is there a way to have the compile process find gmp.h where it does live on this box? TIA... -- duke ---------------------------------------------------------------- Hi, welcome here. If you do ./configure --help you can see [quote] LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory [...] Use these variables to override the choices made by 'configure' or to help it to find libraries and programs with nonstandard names/locations.[/quote]Therefore use [code]export CPPFLAGS=$CPPFLAGS -I/opt/local/var/macports/software/gmp/4.2.4_3/opt/local/include[/code] for helping configure. It would be nice if you would tell us what things you had to do for compiling OC on your leopard. human BTW: Please use the quote / code tags (The two buttons next to MANAGER in post/edit) ---------------------------------------------------------------- [quote]human wrote: Hi, welcome here. [/quote] Thank you for the welcome! [snip] [quote]Therefore use [code]export CPPFLAGS=$CPPFLAGS -I/opt/local/var/macports/software/gmp/4.2.4_3/opt/local/include[/code] for helping configure.[/quote] That's looks like the solution I need. Thank you for the clue! [quote]It would be nice if you would tell us what things you had to do for compiling OC on your leopard.[/quote] If I get get OC to compile cleanly on my OS X box, I will post a summary of the steps that I had to take in order to have joy! Thanks again.. ---------------------------------------------------------------- Hey human! how have you being -- I mean been? ;) I adjusted $CPPFLAGS as you recommended! The configuration process took a small step forward, then choked again. Is there a way to attach the config.log file to messages in this forum? The relevant part of the file is quite long, and I'd hate to clutter up the message. Or can I send it to you privately? Ideas please! Thanks. ---------------------------------------------------------------- It's OK, post it here (in quote tags), for others beeing to able to help you, too. human ---------------------------------------------------------------- Here is my latest config.log file: [quote]This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by OpenCOBOL configure 1.0, which was generated by GNU Autoconf 2.59. Invocation command line was $ ./configure ## --------- ## ## Platform. ## ## --------- ## hostname = d75-154-109-44.abhsia.telus.net uname -m = i386 uname -r = 9.7.0 uname -s = Darwin uname -v = Darwin Kernel Version 9.7.0: Tue Mar 31 22:52:17 PDT 2009; root:xnu-1228.12.14~1/RELEASE_I386 /usr/bin/uname -p = i386 /bin/uname -X = unknown /bin/arch = unknown /usr/bin/arch -k = unknown /usr/convex/getsysinfo = unknown hostinfo = Mach kernel version: Darwin Kernel Version 9.7.0: Tue Mar 31 22:52:17 PDT 2009; root:xnu-1228.12.14~1/RELEASE_I386 Kernel configured for up to 2 processors. 2 processors are physically available. 2 processors are logically available. Processor type: i486 (Intel 80486) Processors active: 0 1 Primary memory available: 2.00 gigabytes Default processor set: 72 tasks, 234 threads, 2 processors Load average: 0.61, Mach factor: 1.38 /bin/machine = unknown /usr/bin/oslevel = unknown /bin/universe = unknown PATH: . PATH: /Users/dnormandin PATH: /sw/bin PATH: /sw/sbin PATH: /usr/local/bin PATH: /Users/dnormandin/bin PATH: /usr/bin PATH: /usr/sbin PATH: /bin PATH: /sbin PATH: /usr/X11R6/bin PATH: /opt/local/bin PATH: /opt/local/sbin ## ----------- ## ## Core tests. ## ## ----------- ## configure:1594: checking for a BSD-compatible install configure:1649: result: /usr/bin/install -c configure:1660: checking whether build environment is sane configure:1703: result: yes configure:1768: checking for gawk configure:1784: found /opt/local/bin/gawk configure:1794: result: gawk configure:1804: checking whether make sets $(MAKE) configure:1824: result: yes configure:1992: checking whether to enable maintainer-specific portions of Makefiles configure:2001: result: no configure:2137: checking for gcc configure:2153: found /usr/bin/gcc configure:2163: result: gcc configure:2407: checking for C compiler version configure:2410: gcc --version &5 i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490) Copyright (C) 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. configure:2413: $? = 0 configure:2415: gcc -v &5 Using built-in specs. Target: i686-apple-darwin9 Configured with: /var/tmp/gcc/gcc-5490~1/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=i686-apple-darwin9 --with-arch=apple --with-tune=generic --host=i686-apple-darwin9 --target=i686-apple-darwin9 Thread model: posix gcc version 4.0.1 (Apple Inc. build 5490) configure:2418: $? = 0 configure:2420: gcc -V &5 gcc-4.0: argument to `-V' is missing configure:2423: $? = 1 configure:2446: checking for C compiler default output file name configure:2449: gcc $CPPFLAGS -I/opt/local/include/ conftest.c >&5 i686-apple-darwin9-gcc-4.0.1: $CPPFLAGS: No such file or directory configure:2452: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "OpenCOBOL" | #define PACKAGE_TARNAME "open-cobol" | #define PACKAGE_VERSION "1.0" | #define PACKAGE_STRING "OpenCOBOL 1.0" | #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" | #define PACKAGE "open-cobol" | #define VERSION "1.0" | #define COB_DEBUG 1 | #define __USE_STRING_INLINES 1 | /* end confdefs.h. */ | | int | main () | { | | ; | return 0; | } configure:2491: error: C compiler cannot create executables See `config.log' for more details. ## ---------------- ## ## Cache variables. ## ## ---------------- ## ac_cv_env_CC_set= ac_cv_env_CC_value= ac_cv_env_CFLAGS_set= ac_cv_env_CFLAGS_value= ac_cv_env_CPPFLAGS_set=set ac_cv_env_CPPFLAGS_value='$CPPFLAGS -I/opt/local/include/' ac_cv_env_CPP_set= ac_cv_env_CPP_value= ac_cv_env_CXXCPP_set= ac_cv_env_CXXCPP_value= ac_cv_env_LDFLAGS_set= ac_cv_env_LDFLAGS_value= ac_cv_env_build_alias_set= ac_cv_env_build_alias_value= ac_cv_env_host_alias_set= ac_cv_env_host_alias_value= ac_cv_env_target_alias_set= ac_cv_env_target_alias_value= ac_cv_path_INTLTOOL_PERL=/usr/bin/perl ac_cv_path_install='/usr/bin/install -c' ac_cv_prog_AWK=gawk ac_cv_prog_ac_ct_CC=gcc ac_cv_prog_make_make_set=yes ## ----------------- ## ## Output variables. ## ## ----------------- ## ACLOCAL='${SHELL} /Users/dnormandin/downloads/open-cobol-1.0/missing --run aclocal-1.9' ALLOCA='' AMDEPBACKSLASH='' AMDEP_FALSE='' AMDEP_TRUE='' AMTAR='${SHELL} /Users/dnormandin/downloads/open-cobol-1.0/missing --run tar' AR='' AS='' AUTOCONF='${SHELL} /Users/dnormandin/downloads/open-cobol-1.0/missing --run autoconf' AUTOHEADER='${SHELL} /Users/dnormandin/downloads/open-cobol-1.0/missing --run autoheader' AUTOMAKE='${SHELL} /Users/dnormandin/downloads/open-cobol-1.0/missing --run automake-1.9' AWK='gawk' CC='gcc' CCDEPMODE='' CFLAGS='' COBC_LIBS='' COB_BIGENDIAN='' COB_CC='' COB_CFLAGS='' COB_CONFIG_DIR='' COB_EXPORT_DYN='' COB_HAS_INLINE='' COB_LDFLAGS='' COB_LIBRARY_PATH='' COB_LIBS='' COB_MODULE_EXT='' COB_PIC_FLAGS='' COB_SHARED_OPT='' CPP='' CPPFLAGS='$CPPFLAGS -I/opt/local/include/' CXXCPP='' CYGPATH_W='echo' DEFS='' DEPDIR='' DLLTOOL='' ECHO='/bin/echo' ECHO_C='ECHO_N='' ECHO_T='' EGREP='' EXEEXT='' GMSGFMT='' INSTALL_DATA='${INSTALL} -m 644' INSTALL_PROGRAM='${INSTALL}' INSTALL_SCRIPT='${INSTALL}' INSTALL_STRIP_PROGRAM='${SHELL} $(install_sh) -c -s' INTLLIBS='' LDFLAGS='' LIBCOB_CFLAGS='' LIBCOB_LIBS='-lm' LIBICONV='' LIBINTL='' LIBOBJS='' LIBS='' LIBTOOL='' LN_S='' LTLIBICONV='' LTLIBINTL='' LTLIBOBJS='' MAINT='#' MAINTAINER_MODE_FALSE='' MAINTAINER_MODE_TRUE='#' MAKEINFO='${SHELL} /Users/dnormandin/downloads/open-cobol-1.0/missing --run makeinfo' MKINSTALLDIRS='' MSGFMT='' MSGMERGE='' OBJDUMP='' OBJEXT='' PACKAGE='open-cobol' PACKAGE_BUGREPORT='open-cobol-list@lists.sourceforge.net' PACKAGE_NAME='OpenCOBOL' PACKAGE_STRING='OpenCOBOL 1.0' PACKAGE_TARNAME='open-cobol' PACKAGE_VERSION='1.0' PATH_SEPARATOR=':' POSUB='' RANLIB='' SED='' SET_MAKE='' SHELL='/bin/sh' STRIP='' USE_NLS='' VERSION='1.0' XGETTEXT='' ac_ct_AR='' ac_ct_AS='' ac_ct_CC='gcc' ac_ct_DLLTOOL='' ac_ct_OBJDUMP='' ac_ct_RANLIB='' ac_ct_STRIP='' am__fastdepCC_FALSE='' am__fastdepCC_TRUE='' am__include='' am__leading_dot='.' am__quote='' am__tar='${AMTAR} chof - "$$tardir"' am__untar='${AMTAR} xf -' bindir='${exec_prefix}/bin' build='' build_alias='' build_cpu='' build_os='' build_vendor='' datadir='${prefix}/share' exec_prefix='NONE' host='' host_alias='' host_cpu='' host_os='' host_vendor='' includedir='${prefix}/include' infodir='${prefix}/info' install_sh='/Users/dnormandin/downloads/open-cobol-1.0/install-sh' libdir='${exec_prefix}/lib' libexecdir='${exec_prefix}/libexec' localstatedir='${prefix}/var' mandir='${prefix}/man' mkdir_p='$(mkinstalldirs)' oldincludedir='/usr/include' prefix='NONE' program_transform_name='s,x,x,' sbindir='${exec_prefix}/sbin' sharedstatedir='${prefix}/com' sysconfdir='${prefix}/etc' target_alias='' ## ----------- ## ## confdefs.h. ## ## ----------- ## #define COB_DEBUG 1 #define PACKAGE "open-cobol" #define PACKAGE_BUGREPORT "open-cobol-list@lists.sourceforge.net" #define PACKAGE_NAME "OpenCOBOL" #define PACKAGE_STRING "OpenCOBOL 1.0" #define PACKAGE_TARNAME "open-cobol" #define PACKAGE_VERSION "1.0" #define VERSION "1.0" #define __USE_STRING_INLINES 1 configure: exit 77[/quote] I _think_ that it is falling apart while running: conftest.c Why? Should I be root in order to "configure & make"? ---------------------------------------------------------------- [quote] duke wrote: Should I be root in order to "configure & make"?[/quote] Yes, it is always a good idea to work as root if you want to install something. conftests seems to be only used for testing if gcc could make executables (what is necessary if you want to compile OC). This seem not to work because of a weird environment, [quote] configure:2446: checking for C compiler default output file name configure:2449: gcc $CPPFLAGS -I/opt/local/include/ conftest.c >&5 i686-apple-darwin9-gcc-4.0.1: $CPPFLAGS: No such file or directory[/quote] It seems that environment vars are not resolved. No idea what one could do about this. What is printed if you do [code]echo $CPPFLAGS[/code] human ---------------------------------------------------------------- [snip] [quote] What is printed if you do [code]echo $CPPFLAGS[/code] human[/quote] Nothing! Before I run "configure", I execute the command that you suggested in a previous message: export CPPFLAGS=$CPPFLAGS -I/opt/local/include Otherwise this Env. Var. is empty on my system. Is it not set from within the install script? Anyway, I ran "sudo ./configure", and here is the latest result: checking for strdup... yes checking for strstr... yes checking for strtol... yes checking for gettimeofday... yes checking for ld used by GCC... /usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld checking if the linker (/usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld) is GNU ld... no checking for shared library run path origin... done checking for iconv... yes checking how to link with libiconv... -liconv checking for iconv declaration... extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); checking for nl_langinfo and CODESET... yes checking for getopt_long_only... yes checking kpathsea/getopt.h usability... no checking kpathsea/getopt.h presence... no checking for kpathsea/getopt.h... no checking getopt.h usability... yes checking getopt.h presence... yes checking for getopt.h... yes checking gmp.h usability... no checking gmp.h presence... no checking for gmp.h... no configure: error: gmp.h is required dnormandin@d75-154-80-153 ~/downloads/open-cobol-1.0 09:18 am >> dnormandin@d75-154-80-153 ~/downloads/open-cobol-1.0 09:22 am >> echo $CPPFLAGS $CPPFLAGS -I/opt/local/include I suspect that $CPPFLAGS is missing a few directories. ---------------------------------------------------------------- If nothing is printed, this is fine, because $CPPFLAGS is often not set by system. It just looked like there is no resolve of env vars at all (if it would be that way $CPPFLAGS had been printed). The configure script sets $CPPFLAGS but on unix all env vars are local (not reaching upper scripts), therefore this is fine, too. Try to find gmp.h (maybe other stuff, too) and set the flags right. If you cannot find something that is needed (all points where configure is aborting), download and build it with configure / make / make install, too. I'm really interested in your "how to install OC on Leopard X" guide. human ---------------------------------------------------------------- [quote] Try to find gmp.h (maybe other stuff, too) and set the flags right.[/quote] I have it!! dnormandin@d75-154-80-153 ~/downloads/open-cobol-1.0 10:50 am >> ls /opt/local/include/gmp* /opt/local/include/gmp.h /opt/local/include/gmpxx.h I have used your suggestion: export $CPPFLAGS='/opt/local/include' The "configure" script IS NOT picking this up. Why? [quote] If you cannot find something that is needed (all points where configure is aborting), download and build it with configure / make / make install, too.[/quote] I'm sure that I have _all_ the dependencies. The problem appears to be that the script is not picking up the directories. [quote]I'm really interested in your "how to install OC on Leopard X" guide.[/quote] I don't have one yet! As soon as I can OC to compile cleanly, I will write about my experiences and pains ;)) BTW, human... Are you one of the developers of OC? ---------------------------------------------------------------- the left side of export should not contain a $, the right one (at least for CPPFLAGS or LDFLAGS) should contain the old var with $ for not overriding already set vars. LDFLAGS are used for linking (the next step if everything compiles fine). The command should be [code]export CPPFLAGS=$CPPFLAGS -I/opt/local/var/macports/software/gmp/4.2.4_3/opt/local/include -I/opt/local/include[/code] I'm just a heavy user of OC. The only "real" developer is Roger While, some others like me try to help him by doing support via forum, documentation and some little fixes. human ---------------------------------------------------------------- [quote] human wrote: the left side of export should not contain a $, [/quote] You are correct! You have noticed a cut-n-paste error on my part... The command I use is: [code]export CPPFLAGS='$CPPFLAGS -I/opt/local/include'[/code] [quote] I'm just a heavy user of OC. The only "real" developer is Roger While, some others like me try to help him by doing support via forum, documentation and some little fixes. [/quote] I appreciate your valiant efforts in helping me solve this issue. I think that I may have found a message at the sourceforge mailing list that may be of some use. As a side bar, I believe that it would serve OpenCOBOL much better, if this forum or the mailing list would become the de facto support venue. It would reduce the frustration factor by at least 50% IMHO. ---------------------------------------------------------------- Don't forget to include all necessary folders in CPPFLAGS. As shown in the post before, you can do this with one command, or use export CPPFLAGS=$CPPFLAGS someflags more than once to do this step by step. (I suggest you do echo $CPPFLAGS before ./configure and check if everything seems fine). [quote] duke wrote: As a side bar, I believe that it would serve OpenCOBOL much better, if this forum or the mailing list would become the de facto support venue. It would reduce the frustration factor by at least 50% IMHO.[/quote] This forum and the mailing list (which I personally do not use, but there are other users that do not read here regularly, but helping there) ARE the places one should look for support [regarding OpenCOBOL]. Where did you tried to get it from? human ---------------------------------------------------------------- Subject: ACCEPT ... FROM DAY-OF-WEEK Doesn't Work In Windows (Fix Submitted) The ACCEPT … FROM DAY-OF-WEEK statement is non-functional on Windows versions of OpenCOBOL. To fix this, find the “cob_accept_day_of_week" function in the common.c module (found in the libcob folder): [code] void cob_accept_day_of_week (cob_field *f) { time_t t; char s[4]; t = time (NULL); #if defined(_MSC_VER) sprintf(s, "%d", localtime(&t)->tm_wday + 1); #else strftime (s, 2, "%u", localtime (&t)); #endif cob_memcpy (f, (ucharptr)s, 1); } [/code] And make the changes shown here: [code] void cob_accept_day_of_week (cob_field *f) { /******************************************************************************* ** BUGFIX - ACCEPT ... FROM DAY-OF-WEEK non-functional on Windows system ** *******************************************************************************/ #ifdef _WIN32 SYSTEMTIME syst; char s[4]; GetLocalTime (&syst); sprintf(s, "%d", syst.wDayOfWeek + 1); #else /******************************************************************************* ** END BUGFIX ** *******************************************************************************/ time_t t; char s[4]; t = time (NULL); #if defined(_MSC_VER) sprintf(s, "%d", localtime(&t)->tm_wday + 1); #else strftime (s, 2, "%u", localtime (&t)); #endif /******************************************************************************* ** BUGFIX - ACCEPT ... FROM DAY-OF-WEEK non-functional on Windows system ** *******************************************************************************/ #endif /******************************************************************************* ** END BUGFIX ** *******************************************************************************/ cob_memcpy (f, (ucharptr)s, 1); } [/code] cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Jul 29 2009 11:23:33 Packaged Feb 06 2009 10:30:55 CET ---------------------------------------------------------------- Now I was wondering how OC passed the cobol85 tests, especially NC214M !!! Here is the answer - 0 of 0 tests passed !!! Bugs in NIST test suite !??? No - it's just tells to do VISUAL comparison, which of course nobody (and me 2 :-( ) did [code] OFFICIAL COBOL COMPILER VALIDATION SYSTEM CCVS85 4.2 COPY - NOT FOR DISTRIBUTION TEST RESULT OF NC214M IN HIGH LEVEL VALIDATION FOR ON-SITE VALIDATION, NATIONAL INSTITUTE OF STD & TECH. FOR OFFICIAL USE ONLY COBOL 85 VERSION 4.2, Apr 1993 SSVG COPYRIGHT 1985 FEATURE PASS PARAGRAPH-NAME REMARKS TESTED FAIL *********************************************************************************************************************** ACCEPT DATE ACC-TEST-F2-1 CHECK VISUALLY *** INFORMATION *** 000090801.000000000 DATE YYMMDD FORMAT VI-72 6.5.4 GR7 ACCEPT DAY ACC-TEST-F2-2 CHECK VISUALLY *** INFORMATION *** 000009213.000000000 DAY YYDDD FORMAT VI-72 6.5.4 GR8 ACCEPT TIME ACC-TEST-F2-3 CHECK VISUALLY *** INFORMATION *** 011034181.000000000 HHMMSSFF FORMAT VI-72 6.5.4 GR9 ACCEPT DAY-OF-WEEK ACC-TEST-F2-4 CHECK VISUALLY *** INFORMATION *** 000000007.000000000 SINGLE DIGIT INTEGERVI-72 6.5.4 GR10 *********************************************************************************************************************** END OF TEST- NC214M 000 OF 000 TESTS WERE EXECUTED SUCCESSFULLY NO TEST(S) FAILED NO TEST(S) DELETED NO TEST(S) REQUIRE INSPECTION FOR OFFICIAL USE ONLY ON-SITE VALIDATION, NATIONAL INSTITUTE OF STD & TECH. COPYRIGHT 1985 [/code] ---------------------------------------------------------------- Looks like your patch is incorrect, i.e. it is doing exactly the same as original program :-) Here is the patch: [code] *** common.c.orig 2009-01-26 10:50:50.000000000 -0500 --- common.c 2009-08-01 11:55:13.000000000 -0400 *************** *** 1363,1369 **** t = time (NULL); #if defined(_MSC_VER) ! sprintf(s, "%d", localtime(&t)->tm_wday + 1); #else strftime (s, 2, "%u", localtime (&t)); #endif --- 1363,1371 ---- t = time (NULL); #if defined(_MSC_VER) ! s[0] = (char)(localtime(&t)->tm_wday); ! if(s[0] == 0) s[0] = 7; ! s[0] += '0'; #else strftime (s, 2, "%u", localtime (&t)); #endif [/code] ---------------------------------------------------------------- I'm confused (a common problem according to my wife :-D ) The code you're showing doesn't look like my original submission. Is there a reply (or two) missing here in this post? ---------------------------------------------------------------- [quote] CutlerGL wrote: I'm confused (a common problem according to my wife :-D ) The code you're showing doesn't look like my original submission. Is there a reply (or two) missing here in this post?[/quote] I mean your code is doing the same as original. The patch I've provided is not to your code, but to the original common.c from distribution ---------------------------------------------------------------- The thing I'm not comfortable with is the naming of problems "in windows" and the patches using "#if defined _MSC_VER" instead of "#ifdef _WIN32". I suppose this stuff work with MinGW compiled builds!?! human ---------------------------------------------------------------- I used the term "in Windows" because that's all I have access to and I didn't want to generalize the problem to all platforms - the code looked like it would have been fine on a UNIX build. I'm working on a full-featured User's Guide for OpenCOBOL 1.1 and - as I test the features I am writing about and discover problems - I (try to) fix them and then submit the fix. So far I've been able to fix whatever problems I've found. Specifically, I AM using a MinGW build. Should I perhaps have been more specific? Perhaps "non-functional on a Windows MinGW build" or something like that? I am NOT using a native Windows build because I need to have my OpenCOBOL environment capable of working from a flashdrive so I can "take it with me". I never used "#if defined _MSC_VER" in my patch (please see my original post, which shows both the BEFORE and the AFTER version of the code). I have to (reluctantly) state that I'm still confused about what "sky" is trying to say. ---------------------------------------------------------------- It is very good that you try to fix occurring problems and submit the patches. It is always good to have a test program to be able to prove that the fix work (by trying before and after applying the patch). Could you post a test prog for this fix, please? [quote]I am NOT using a native Windows build because I need to have my OpenCOBOL environment capable of working from a flashdrive so I can "take it with me".[/quote] MinGW builds are native windows builds (correct me if I'm wrong). Both MinGW builds and MSC builds are possible for "taking around on flash drives and using on WIN" (the right dll's have to be copied to the flash drive and the env vars must be set right, but portable versions including C-Compiler are easier to make with GCC MinGW build). "non-functional on a Windows MinGW build" would be very useful for the original post because we have GCC in general, on special systems (mostly WIN32 and HPUX) and MSC. Ska posted a fix for MSC, you did for GCC on WIN32. It seems like it does not work on WIN (neither with MinGW nor with MSC builds), maybe it does not work in general (I will test this as soon as the test prog is submitted)? The combined patch of you and ska should look like this (untested): [code]void cob_accept_day_of_week (cob_field *f) { char s[4]; #if defined(_MSC_VER) time_t t; t = time (NULL); s[0] = (char)(localtime(&t)->tm_wday); if(s[0] == 0) s[0] = 7; s[0] += '0'; #elif defined(_WIN32) SYSTEMTIME t; GetLocalTime (&t); sprintf(s, "%d", t.wDayOfWeek + 1); #else time_t t; t = time (NULL); strftime (s, 2, "%u", localtime (&t)); #endif cob_memcpy (f, (ucharptr)s, 1); } [/code] human ---------------------------------------------------------------- Well, I was not aware of MinGW (or whatever - why you need it if you have a native...) But the idea of my patch is that it will work anyway If you want to put it to all win - just put #if defined(_MSC_VER) || defined(_WIN32) ... Actually it will work for all unixes too. It's just an issue with %u strftime format which does not exist on windows. You can remove those #if and the unix version of the code. That's it. ---------------------------------------------------------------- Sorry 'human' - I keep forgetting those test programs, don't I? Here you go... [code] IDENTIFICATION DIVISION. PROGRAM-ID. bugtest. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 Today PIC 9. PROCEDURE DIVISION. 100-Main. ACCEPT Today FROM DAY-OF-WEEK. DISPLAY 'Today=' Today. DISPLAY 'Expect 1=Sunday, 2=Monday, ... , 7=Saturday'. STOP RUN. [/code] ---------------------------------------------------------------- Thank you. The fix of ska (using his version and removing all other stuff and defines) does work for you, doesn't it? human ---------------------------------------------------------------- Yes - it works fine on a MinGW build. Thanks for the simplification! ---------------------------------------------------------------- [quote] CutlerGL wrote: [code] DISPLAY 'Expect 1=Sunday, 2=Monday, ... , 7=Saturday'.[/code][/quote] Wrong. According Cobol - 1=Monday, ... 7=Sunday ---------------------------------------------------------------- So that would make the fix be the following: [code] void cob_accept_day_of_week (cob_field *f) { char s[4]; #if defined(_MSC_VER) time_t t; t = time (NULL); s[0] = (char)(localtime(&t)->tm_wday); if(s[0] == 0) s[0] = 7; s[0] += '0'; #elif defined(_WIN32) SYSTEMTIME t; GetLocalTime(&t); s[0] = (char)t.wDayOfWeek; if(s[0] == 0) s[0] = 7; s[0] += '0'; #else time_t t; t = time (NULL); strftime (s, 2, "%u", localtime (&t)); #endif cob_memcpy (f, (ucharptr)s, 1); } [/code] and the test program as follows: [code] IDENTIFICATION DIVISION. PROGRAM-ID. bugtest. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 Today PIC 9. PROCEDURE DIVISION. 100-Main. ACCEPT Today FROM DAY-OF-WEEK. DISPLAY 'Today=' Today. DISPLAY 'Expect 1=Monday, 2=Tuesday, ... , 7=Sunday'. STOP RUN. [/code] I've tested this version of the fix on a MinGW build of OpenCOBOL 1.1 and today (Wednesday) it returns a value of 3. By the way - I originally coded the new version with: s[0] = (char)(GetLocalTime(&t)->wDayOfWeek); but gcc burped out this error during "make": common.c: In function `cob_accept_day_of_week': common.c:1374: error: void value not ignored as it ought to be That's why I put the GetLocalTime call into its own separate statement. I'm not enough of a C guru to understand why it failed the way I originally wrote it (definition of SYSTEMTIME versus time_t????), but this way definitely works. Perhaps one of you more expert C programmers can explain it to me (sorry for my ignorance). ---------------------------------------------------------------- Please try if the patch from Sergey works (without any define) on your MinGW (it does at least for both MSVC and Cygwin builds) [code]void cob_accept_day_of_week (cob_field *f) { time_t t; char s[4]; t = time (NULL); s[0] = (char)(localtime(&t)->tm_wday); if(s[0] == 0) s[0] = 7; s[0] += '0'; cob_memcpy (f, (ucharptr)s, 1); }[/code] human ---------------------------------------------------------------- Sergey's version works perfectly with a MinGW build. ---------------------------------------------------------------- Therefore we have a perfect fix, without adding additional defines, but instead removing them. This is nice. Thank you for affirming that the fix work on MinGW, too. human ---------------------------------------------------------------- Subject: Open COBOL Doc I am examining Open COBOL with a view to using on a workstation in my practice of migrating mainframe COBOL systems to servers. Ia there any doc available which I can read to determine what COBOL syntax is supported? Is therre anything I can download and print, for study,say, in the mornings in the library? :-) ---------------------------------------------------------------- I suppose to take the stuff found to the left. 1st Features, then User Manual and last one for the library the FAQ. human ---------------------------------------------------------------- I am developing a document (OpenCOBOL Syntax and Users Guide) which I hope to have ready in the next several weeks. I think that'll help. If you'd like an early copy to review, send me an email at cutlergl@gmail.com and I'll send you a copy. ---------------------------------------------------------------- The stuff at the left is not printable as a document; it is a web-page structure not at all suitable for extended study. I certainly don't take my desktop with me in the morning while I ruminate in the "library". No offense to you or to COBOL (which has fed, clothed, and housed me for nearly fifty years) but analysis of the syntax acceptable to a COBOL compiler does take extended reflective study. If I can't print it then I can't study it. ---------------------------------------------------------------- There is limited documentation available for OC, but the FAQ would be a good place to start. And you should be able to save, print, cut and paste any documentation, in what ever format available. In any case I don't think the COBOL syntax will be a big issue. Certainly not the biggest issue. Browsing the OC forums and mailing lists may save you some time and effort. Here is a very brief list of some the issues you will need to consider. - OC converts COBOL to C, thus you require a C compiler to create a binary. - The OC run-time requires several support libraries. GMP, Curses (Ncurses or PDcurses), indexed file IO (BDB or VBISAM or C-IS*M or D-IS*M) - Syntax related issues (in the current version). REPORT generation is not implemented. COMMUNICATION SECTION is not implemented. - SQL or CICS preprocessors are not included. - OC currently is best suited for UN*X like systems. For a native Win32/64 implementation using MSVC see link[1]. Anyway hope this helps. :-) 1) OC Binaries 1.1 for Win32/64 HPUX http://www.kiska.net/opencobol/1.1/ ---------------------------------------------------------------- Thanks for your reply; My needs cannot be met by an FAQ section. I know the COBOL syntax, I just need to know what parts of it are not implemented in OC, and for that I need to see the doc. Mr. Cutler has kindly sent me the kind of doc I am looking for, up to but not including the Procedure Division. I look forward to reviewing this material and maybe suggesting modifications. The plethora of ancillary software is just a symptom of one of the three big curses (no pun intended) of open-source software that hinder wider adoption of really good packages. As far as the rest, my focus is on migrating and testing COBOL programs on a WinXP box. All the rest of the issues simply take a back seat. At present I use isCOBOL, which does the job well, albeit at a price greater than OC. ---------------------------------------------------------------- Unless you plan to place labels on tape, or some thing else unusual, I don't think the grammar will be a problem. I forgot to mention, there is an introduction[1] on how to set up OC on Win32 using Cygwin. BTW, as a 'mainframer' I think you will find these links [2,3] interesting. It is written in Java but it does have a COBOL compiler. 1) Getting Started with OpenCOBOL for Dummies http://home.comcast.net/~wmklein/DOX/OC_GettingStarted_Windows.HTM 2) z390 Portable Mainframe Assembler and Emulator http://z390.sourceforge.net/ 3) zCOBOL Portable Mainframe COBOL Compiler http://www.zcobol.org/ ---------------------------------------------------------------- This is going to be a total [b]Rah Rah Biss Boom Bah![/b] posting. Very exciting. Gary Cutler has sent me a copy of his User Guide. This is [b]sweet stuff[/b]. I'd like to encourage everyone to encourage Gary. Beautiful document. The index alone is a sight for sore eyes. The details are bang on, and the look is chrome glow polish. Yaaaayyy! No, really, the wait is almost over. OpenCOBOL and open COBOL are on the verge of some high quality docs. Cheers, Brian ---------------------------------------------------------------- Gary, in the words of the Irish, f'ck'n great! (That's with an E by the way..) The docs look great. I transferred the pdf to my kindle and it mostly works. A word doc might do better. But it would be cool if we could convert to Restructured Text as well. Also if there is any way you would be willing to throw this in our SVN for Add 1, I will give you access. Kind Regards ---------------------------------------------------------------- The document is actually done using Word (Office 2007) with Powerpoint used for the syntax diagrams. I used Microsoft's free "Save As PDF" add-in to generate the PDF, under the assumption that a stand-alone document would be more universally usable if it was in PDF form. It would be just as easy to use "Save As HTML" to generate a web-based version too for those that want that on the www.opencobol.org website. The latest DRAFT version is available at http://www.mediafire.com/file/2gzmommmzmy/OpenCOBOL%20Manual.pdf if anyone would like to check out a copy. At present I guesstimate I'm still a week or so from a published 1st edition (I suspect this may never be truly "complete"). Once that's available, we can play with it to make it available on add1tocobol. ---------------------------------------------------------------- GutlerGL is it possible for us to get the original sources so that I can convert to Restructured Text? ---------------------------------------------------------------- Try http://www.mediafire.com/file/tqjn1d4nnmd/OpenCOBOL Manual.docx and http://www.mediafire.com/file/eigmmolmted/Syntax Diagrams.pptx Remember that's still a draft copy of a work in progress and not the "final" version. ---------------------------------------------------------------- CutlierGL, Thanks! Also I would like to give you access to the Add1 svn repo, then you could keep histories of your work and others could access it as well. Just email me at aoirthoir@add1tocobol.com if you are interested. Regards ---------------------------------------------------------------- Subject: Compiling to 32bit executable using 64bit compiler Hi, I am working on a zLinux box with 64bit OpenCOBOL installed. I would like to use that compiler to compile COBOL to a 31bit executable. gcc has an option named -m31 that allows me to do that. Does cobc have a similar option? Will simply adding -m31 to the final compile of the generated C code do the trick? Or is the C code different based on whether it is intended to be compiled for 31 or 64 bit. If adding the -m31 will work, is there an option to cobc that ultimately passes the option to gcc? Point of clarification for those not familiar with zLinux: zLinux runs on 31bit or 64bit hw, hence the -m31 rather than -m32. -- Michael ---------------------------------------------------------------- It should be possible to use [code]export CFLAGS=$CFLAGS -m31[/code] before using cobc. I'm not aware of any differences of the generated code, whether cobc is used on 32 or 64 bit. human ---------------------------------------------------------------- [quote]human wrote: I'm not aware of any differences of the generated code, whether cobc is used on 32 or 64 bit.[/quote] Don't do that !!! It will not work properly and even if you succeed to link the produced code, you will be looking for sideffects for a long time. You have to build another 31-bit version of cobc and libcob (as well as to have 31-bit gmp and bdb or vbisam) ! ---------------------------------------------------------------- The generated code is therefore the same, but logically work only right with 31bit libcob, gmp, etc. Good that Sergey pointed this out. human ---------------------------------------------------------------- [quote]human wrote: The generated code is therefore the same, but logically work only right with 31bit libcob, gmp, etc.[/quote] It is not the same ! in 64-bit it is assuming that POINTER is 64 bit. Compiling code generated for 64-bit in 32/31 might give you a shift in data and some other problems. ---------------------------------------------------------------- Subject: Bug: Filenames with spaces are not found if routines CBL_FILE / C$FILE are used [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. FILENTST. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. DATA DIVISION. * WORKING-STORAGE SECTION. 77 TEST-FILE-NAME pic X(256). * 01 C-FILE-INFO. 02 C-FILE-SIZE PIC X(8) COMP-X. 02 C-FILE-DATE PIC 9(8) COMP-X. 02 C-FILE-TIME PIC 9(8) COMP-X. 01 Cbl-File-Details. 03 Cbl-File-Size pic x(8) comp-x value zero. 03 Cbl-File-Date. 05 Cbl-File-Day pic x comp-x value zero. 05 Cbl-File-Mth pic x comp-x value zero. 05 Cbl-File-Year pic x comp-x value zero. 03 Cbl-File-time. 05 Cbl-File-Hour pic x comp-x value zero. 05 Cbl-File-Min pic x comp-x value zero. 05 Cbl-File-Sec pic x comp-x value zero. 05 Cbl-File-Hund pic x comp-x value zero. *----------------------------------------------------------------- PROCEDURE DIVISION. *----------------------------------------------------------------- main section. 00. call 'SYSTEM' using 'echo . > "ISTHERE.TXT"' end-call call 'SYSTEM' using 'echo . > "ISTHERE TOO.TXT"' end-call move 'ISTNOTHERE.TXT' to TEST-FILE-NAME perform get-fileinfo-cbl perform get-fileinfo-c move 'ISTHERE.TXT' to TEST-FILE-NAME perform get-fileinfo-cbl perform get-fileinfo-c move 'ISTHERE TOO.TXT' to TEST-FILE-NAME perform get-fileinfo-cbl perform get-fileinfo-c call 'SYSTEM' using 'rm "ISTHERE.TXT"' end-call call 'SYSTEM' using 'rm "ISTHERE TOO.TXT"' end-call * accept ommitted-var * end-accept * continue. ex. stop run. *----------------------------------------------------------------- get-fileinfo-cbl section. 00. CALL 'CBL_CHECK_FILE_EXIST' USING TEST-FILE-NAME Cbl-File-Details END-CALL display 'CBL: FILE "' FUNCTION TRIM(TEST-FILE-NAME) with no advancing end-display if return-code not = 0 display '" NOT FOUND!' end-display display 'CBL: Return code is ' return-code end-display else display '":' end-display display 'CBL: SIZE: ' Cbl-File-Size end-display display 'CBL: DATE: ' Cbl-File-Day Cbl-File-Mth Cbl-File-Year end-display display 'CBL: TIME: ' Cbl-File-Hour Cbl-File-Min Cbl-File-Sec Cbl-File-Hund end-display end-if * continue. ex. exit. *----------------------------------------------------------------- get-fileinfo-c section. 00. CALL 'C$FILEINFO' USING TEST-FILE-NAME C-FILE-INFO END-CALL display 'C$: FILE "' FUNCTION TRIM(TEST-FILE-NAME) with no advancing end-display if return-code not = 0 display '" NOT FOUND!' end-display display 'C$: Return code is ' return-code end-display else display '":' end-display display 'C$: SIZE: ' C-FILE-SIZE end-display display 'C$: DATE: ' C-FILE-DATE end-display display 'C$: TIME: ' C-FILE-TIME end-display end-if * continue. ex. exit. *----------------------------------------------------------------- *--- End of program FILENTST -------------------------------------[/code] results in [code]$ cobc -W -debug FNAMETST.CBL $ cobcrun.exe FNAMETST CBL: FILE "ISTNOTHERE.TXT" NOT FOUND! CBL: Return code is +000000035 C$: FILE "ISTNOTHERE.TXT" NOT FOUND! C$: Return code is +000000035 CBL: FILE "ISTHERE.TXT": CBL: SIZE: 000000000000000002 CBL: DATE: 030807 CBL: TIME: 17103856 C$: FILE "ISTHERE.TXT": C$: SIZE: 000000000000000002 C$: DATE: 20090803 C$: TIME: 10385600 CBL: FILE "ISTHERE TOO.TXT" NOT FOUND! CBL: Return code is +000000035 C$: FILE "ISTHERE TOO.TXT" NOT FOUND! C$: Return code is +000000035[/code] For both kind of routines we have the following in fileio.c, [code] fn = cob_str_from_fld (cob_current_module->cob_procedure_parameters[0]); if (stat (fn, &st) < 0) { free (fn); return 35; }[/code] Therefore I think cob_current_module->cob_procedure_parameters do not take care of the spaces in the file name. human ---------------------------------------------------------------- Subject: FIX: include tarstamp.h in common.c (before : FIX: adding define to tarstamp.h) [code]#ifndef COB_TARSTAMP_H #define COB_TARSTAMP_H static char octardate[] = "Feb 06 2009 10:30:55 CET"; #endif /* COB_TARSTAMP_H */[/code] Is it possible to change tarstamp.h in this way? It's at least useful if you want to include it in different locations. human ---------------------------------------------------------------- Fix changed and first post edited: If you want to include it in different locations it should be just included in common.c (which seems to be used everywhere). human ---------------------------------------------------------------- Subject: Bug: START FIRST / START LAST resulting in "syntax error, unexpected FIRST/LAST" I think the following should be possible since COBOL-2002, but OC seems to have it not implemented yet [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. STARTTST. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT TEST-FILE ASSIGN to 'TEST.DAT' ORGANIZATION IS INDEXED ACCESS IS DYNAMIC LOCK MODE IS MANUAL RECORD KEY IS TEST-KEY01 ALTERNATE RECORD KEY IS TEST-KEY02 WITH DUPLICATES ALTERNATE RECORD KEY IS TEST-KEY03 WITH DUPLICATES FILE STATUS IS TEST-STATUS. I-O-CONTROL. DATA DIVISION. FILE SECTION. FD TEST-FILE. 01 TEST-REC. 03 TEST-KEY01. 05 TEST-NUM PIC 9(03). 03 TEST-KEY02. 05 TEST-TYP PIC X(20). 05 TEST-NAME PIC X(20). 03 TEST-KEY03. 05 TEST-INDEX PIC 9(03). * WORKING-STORAGE SECTION. 77 TEST-STATUS pic x(02). 77 OMITTED-INPUT pic x(01). *----------------------------------------------------------------- PROCEDURE DIVISION. declaratives. test-dc section. use after standard error procedure on TEST-FILE. display 'Error! The value of FILE STATUS for ' 'the file "TEST.DAT" is "' TEST-STATUS '"!' end-display accept OMITTED-INPUT end-accept continue. * ex. exit. end declaratives. *----------------------------------------------------------------- *----------------------------------------------------------------- main section. 00. open output TEST-FILE * write TEST-REC from '001Group1 Item1 100' end-write write TEST-REC from '002Group1 Item2 010' end-write write TEST-REC from '003Group2 Item3 001' end-write * close TEST-FILE open input TEST-FILE * start TEST-FILE last invalid key display 'Error: No last record found!' end-display not invalid key read TEST-FILE at end display 'Error: The last record ' 'could not be read!' end-display not at end display 'Last Record:' end-display display TEST-REC end-display display ' ' end-display end-read end-start * start TEST-FILE first invalid key display 'Error: No first record found!' end-display not invalid key read TEST-FILE at end display 'Error: The first record ' 'could not be read!' end-display not at end display 'First Record:' end-display display TEST-REC end-display display ' ' end-display end-read end-start * close TEST-FILE * accept OMITTED-INPUT end-accept * continue. ex. stop run. *----------------------------------------------------------------- *--- End of program STARTTST -------------------------------------[/code] results in [quote]$ cobc -Debug -W STARTST.COB STARTST.COB: In paragraph '00': STARTST.COB:69: Warning: START statement not terminated by END-START STARTST.COB:69: Error: syntax error, unexpected LAST[/quote] It's OK if OC hasn't this implemented this yet, but then this should result in the error "not implemented yet". If it's possible it would be nice to have START FIRST/LAST in OC 1.1 final. human ---------------------------------------------------------------- Subject: Error: syntax error, Unexpected ERROR [code] start TEST-FILE invalid key display 'No ' 'record found end-display end-start[/code] leading to [quote]$ cobc STARTTST.COB STARTST.COB: In paragraph '00': STARTST.COB:127: Error: syntax error, unexpected ERROR[/quote] (line 127 is the first display of the sample) The problem: the string was not closed [and is not recognized as this problem if the DISPLAY is inside INVALID KEY], it has to be [code] display 'No ' 'record found[color=990000][b][size=xx-large]'[/size][/b][/color] end-display[/code] Maybe this sample helps to remove one occurrence of "Error: syntax error, Unexpected ERROR". human ---------------------------------------------------------------- Subject: FR - new command line option for cobc/cobcrun: Output the important configuration (even of libcob) Imagine you have build you OpenCOBOL a long time ago. Later on you want to know what configuration options where used. The points I thought of were [code]System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-experimental (OpenCOBOL) enable experimental code (Developers only!) --enable-param-check (OpenCOBOL) enable CALL parameter checking --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --disable-rpath do not hardcode runtime library paths --disable-nls do not use Native Language Support Optional Packages: --with-cc= (OpenCOBOL) specify the C compiler used by cobc --with-seqra-extfh (OpenCOBOL) Use external SEQ/RAN file handler --with-cisam (OpenCOBOL) Use CISAM for ISAM I/O --with-disam (OpenCOBOL) Use DISAM for ISAM I/O --with-vbisam (OpenCOBOL) Use VBISAM for ISAM I/O --with-index-extfh (OpenCOBOL) Use external ISAM file handler --with-db1 (OpenCOBOL) use Berkeley DB 1.85 (libdb-1.85) --with-db (OpenCOBOL) use Berkeley DB 3.0 or later (libdb)(default) --with-lfs64 (OpenCOBOL) use large file system for file I/O (default) --with-dl (OpenCOBOL) use system dynamic loader (default) --with-patch-level (OpenCOBOL) define a patch level (default 0) --with-varse (OpenCOBOL) define variable sequential format (default 0)[/code] It would be good to have a command line option like --build-info or --info where these information are shown, additionally to the information we currently have in --version. I tested some versions of vim, they all output the features and the compiler line [although CFLAGS, LDFLAGS and CPPFLAGS seems to be missing in this info], [quote]VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Oct 9 2008 15:23:22) Compiled by corinna@cathi Huge version without GUI. Features included (+) or not (-): +arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent -clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +cryptv +cscope +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path +float +folding -footer +fork() +gettext -hangul_input +iconv +insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap +menu +mksession +modify_fname +mouse -mouseshape +mouse_dec -mouse_gpm -mouse_jsbterm +mouse_netterm -mouse_sysmouse +mouse_xterm +multi_byte +multi_lang -mzscheme -netbeans_intg -osfiletype +path_extra -perl +postscript +printer +profile -python +quickfix +reltime +rightleft -ruby +scrollbind +signs +smartindent -sniff +statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" user exrc file: "$HOME/.exrc" fall-back for $VIM: "/usr/share/vim" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 Linking: gcc -L/usr/local/lib -o vim.exe -lm -lncurses -liconv -lintl[/quote] I think the most complicated thing in this request is about many of the (OpenCOBOL) stuff can only be found in libcob, therefore cobc/cobcrun have to call the library to get these infos. human ---------------------------------------------------------------- Something like this - ? [code] > cobcrun --info cobcrun (OpenCOBOL) 1.1.0 Copyright (C) 2004-2009 Roger While Built Aug 15 2009 12:41:03 Packaged Aug 13 2009 21:39:45 CEST Build information CC : gcc CPPFLAGS : CFLAGS : -g -O2 -Wno-pointer-sign -pipe -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k LD : /usr/x86_64-suse-linux/bin/ld -m elf_x86_64 LDFLAGS : OpenCOBOL information COB_CC : gcc COB_CFLAGS : -I/usr/local/include -Wno-pointer-sign -pipe COB_LDFLAGS : COB_LIBS : -L/usr/local/lib -lcob -lm -lifisam -lifisamx -lgmp -lncurses COB_CONFIG_DIR : /usr/local/share/open-cobol/config COB_COPY_DIR : /usr/local/share/open-cobol/copy COB_LIBRARY_PATH : /usr/local/lib/open-cobol COB_MODULE_EXT : so COB_EXEEXT : "CBL_" param check : Disabled Variable format : 0 Sequential handler : Internal ISAM handler : BDB [/code] Roger ---------------------------------------------------------------- +1 for --info As usual Roger ... above and beyond. Cheers, Brian ---------------------------------------------------------------- Thumbs up for --info, better than I could thought of! Maybe include the following info: [code] --with-lfs64 (OpenCOBOL) use large file system for file I/O (default) --enable-experimental (OpenCOBOL) enable experimental code (Developers only!)[/code] human BTW: It's really cool that you're back! I hope you find the time to have a look at the patches we made and the bugs that were found. Would it help if I get the old "For getting 1.1 to final - last known bugs"-topic up and add all the topics that are not in yet? I recently made a link list for me, therefore it should not take too long. ---------------------------------------------------------------- Human, I have almost caught up with all your bugs/suggestions/enhancements. Most (with maybe 1 or 2 execptions) will be in the the forthcoming tarball. Also applies to posts from others. I will post when it is uploaded and then you can fire up all your outstanding tests. I would suggest that after I post that you put your test results (positive/negative) on to that thread. That will make it easier to track rather than hunting down a whole bunch of posts. Roger ---------------------------------------------------------------- Fine. Will there be a new VB-ISAM 2.0 tarball available (old link or new one)? human ---------------------------------------------------------------- Can you please add the (31/)32/64 bit mode in which OC is running? human ---------------------------------------------------------------- Subject: Bug (ppinput of pplex.c): Wrong line numbers are used [code] PROGRAM-ID. COL73TST. PROCEDURE DIVISION. display 'Test'. A[/code] leads to [quote]$ cobc -fsyntax-only -W COL73TST.cob COL73TST.cob:2: Warning: Source text after column 72 COL73TST.cob:3: Warning: DISPLAY statement not terminated by END-DISPLAY[/quote] It seems like the wrong line number is used in ppinput of pplex.c, where the warning first warning occurs (it is taken from "cb_source_line"). The second warning occurring elsewhere is fine. I do not dare to change cb_source_line. Does anybody [u]know[/u] where this fix has to be done? human ---------------------------------------------------------------- Subject: Bug (VBISAM-only): START at file end + READ PREVIOUS don't work | wrong record READ+REWRITE+READ NEX The following should work and works fine with BDB but not with VBISAM [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. STARTTST. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT TEST-FILE ASSIGN to 'TESTDAT' ORGANIZATION IS INDEXED ACCESS IS DYNAMIC LOCK MODE IS MANUAL RECORD KEY IS TEST-KEY01 ALTERNATE RECORD KEY IS TEST-KEY02 ALTERNATE RECORD KEY IS TEST-KEY03 WITH DUPLICATES FILE STATUS IS TEST-STATUS. I-O-CONTROL. DATA DIVISION. FILE SECTION. FD TEST-FILE. 01 TEST-REC. 03 TEST-KEY01. 05 TEST-NUM PIC 9(03). 03 TEST-KEY02. 05 TEST-TYP PIC X(20). 05 TEST-NAME PIC X(20). 03 TEST-KEY03. 05 TEST-INDEX PIC 9(03). * WORKING-STORAGE SECTION. 77 TEST-STATUS pic x(02). 77 OMITTED-INPUT pic x(01). *----------------------------------------------------------------- PROCEDURE DIVISION. declaratives. test-dc section. use after standard error procedure on TEST-FILE. display 'Error! The value of FILE STATUS for ' 'the file "TESTDAT" is "' TEST-STATUS '"!' end-display accept OMITTED-INPUT end-accept continue. * ex. exit. end declaratives. *----------------------------------------------------------------- *----------------------------------------------------------------- main section. 00. open output TEST-FILE if TEST-STATUS not = '00' go to ex end-if * write TEST-REC from '001Group1 Item1 100' end-write write TEST-REC from '002Group1 Item2 010' end-write write TEST-REC from '003Group2 Item1 020' end-write * close TEST-FILE open input TEST-FILE * display ' ' end-display display 'Do a START + READ NEXT for getting a record.' end-display display ' ' end-display * move 002 to TEST-NUM start TEST-FILE invalid key display 'No record found for start with "' TEST-NUM '"' end-display not invalid key read TEST-FILE next at end display 'Error: The record for "' TEST-NUM '"' 'could not be read!' end-display not at end display 'Searched record "START/READ NEXT":' end-display display TEST-REC end-display display ' ' end-display end-read end-start * display ' ' end-display display 'Do a READ + REWRITE + READ NEXT ' 'for getting two records.' end-display display ' ' end-display * close TEST-FILE open i-o TEST-FILE * move 002 to TEST-NUM read TEST-FILE key is TEST-KEY01 invalid key display 'No record found for start with "' TEST-NUM '"' end-display not invalid key [b] display 'Rewrite the found record from "READ":' end-display display TEST-REC end-display rewrite TEST-REC invalid key display 'The found record could not be rewritten!' end-display not invalid key display 'The found record was rewritten, ' 'reading the next one.' end-display read TEST-FILE next at end display 'Error: The next record ' 'could not be read!' end-display not at end if TEST-NUM = 002 display 'Searched record "READ NEXT" ' 'was the same as before, this ' 'shouldn''t happen!' end-display else display 'Searched record "READ NEXT":' end-display display TEST-REC end-display end-if end-read end-rewrite[/b] end-read * accept OMITTED-INPUT end-accept * close TEST-FILE open input TEST-FILE * display ' ' end-display display 'Do different START + READ PREVIOUS for getting ' 'the last record.' end-display display ' ' end-display * * START FIRST/LAST not working in OC 1.1 yet * start TEST-FILE last * invalid key * display 'Error: No last record found!' * end-display * not invalid key * read TEST-FILE * at end * display 'Error: The last record ' * 'could not be read!' * end-display * not at end * display 'Last Record:' end-display * display TEST-REC end-display * display ' ' end-display * end-read * end-start * [b] move 999 to TEST-NUM start TEST-FILE KEY NOT > TEST-NUM invalid key display 'Last record with "START KEY NOT >" ' 'not found!' end-display not invalid key read TEST-FILE previous at end display 'Error: The last record ' 'could not be read!' end-display not at end display 'Searched record "START KEY NOT >":' end-display display TEST-REC end-display display ' ' end-display end-read end-start * move 999 to TEST-NUM start TEST-FILE KEY NOT >= TEST-NUM invalid key display 'Last record with "START KEY NOT >=" ' 'not found!' end-display not invalid key read TEST-FILE previous at end display 'Error: The last record ' 'could not be read!' end-display not at end display 'Searched record "START KEY NOT >=":' end-display display TEST-REC end-display display ' ' end-display end-read end-start * move 999 to TEST-NUM start TEST-FILE KEY < TEST-NUM invalid key display 'Last record with "START KEY <" ' 'not found!' end-display not invalid key read TEST-FILE previous at end display 'Error: The last record ' 'could not be read!' end-display not at end display 'Searched record "START KEY <":' end-display display TEST-REC end-display display ' ' end-display end-read end-start * move 999 to TEST-NUM start TEST-FILE KEY <= TEST-NUM invalid key display 'Last record with "START KEY <=" ' 'not found!' end-display not invalid key read TEST-FILE previous at end display 'Error: The last record ' 'could not be read!' end-display not at end display 'Searched record "START KEY <=":' end-display display TEST-REC end-display display ' ' end-display end-read end-start[/b] * accept OMITTED-INPUT end-accept * display ' ' end-display display 'Do different START + READ NEXT for getting ' 'the first record.' end-display display ' ' end-display * * START FIRST/LAST not working in OC 1.1 yet * start TEST-FILE last * invalid key * display 'Error: No last record found!' * end-display * not invalid key * read TEST-FILE * at end * display 'Error: The last record ' * 'could not be read!' * end-display * not at end * display 'Last Record:' end-display * display TEST-REC end-display * display ' ' end-display * end-read * end-start * move 000 to TEST-NUM start TEST-FILE KEY NOT < TEST-NUM invalid key display 'First record with "START KEY NOT <" ' 'not found!' end-display not invalid key read TEST-FILE next at end display 'Error: The first record ' 'could not be read!' end-display not at end display 'Searched record "START KEY NOT <":' end-display display TEST-REC end-display display ' ' end-display end-read end-start * move 000 to TEST-NUM start TEST-FILE KEY NOT <= TEST-NUM invalid key display 'First record with "START KEY NOT <=" ' 'not found!' end-display not invalid key read TEST-FILE next at end display 'Error: The first record ' 'could not be read!' end-display not at end display 'Searched record "START KEY NOT <=":' end-display display TEST-REC end-display display ' ' end-display end-read end-start * move 000 to TEST-NUM start TEST-FILE KEY > TEST-NUM invalid key display 'First record with "START KEY >" ' 'not found!' end-display not invalid key read TEST-FILE next at end display 'Error: The first record ' 'could not be read!' end-display not at end display 'Searched record "START KEY >":' end-display display TEST-REC end-display display ' ' end-display end-read end-start * move 000 to TEST-NUM start TEST-FILE KEY >= TEST-NUM invalid key display 'First record with "START KEY >=" ' 'not found!' end-display not invalid key read TEST-FILE next at end display 'Error: The first record ' 'could not be read!' end-display not at end display 'Searched record "START KEY >=":' end-display display TEST-REC end-display display ' ' end-display end-read end-start * close TEST-FILE * accept OMITTED-INPUT end-accept * continue. ex. stop run. *----------------------------------------------------------------- *--- End of program STARTTST -------------------------------------[/code] Result with BDB, [quote] Do a START + READ for getting a record. Searched Record (START): 002Group1 Item2 010 Rewrite the found record from "READ": 002Group1 Item2 010 The found record was rewritten, reading the next one. [b]Searched record "READ NEXT": 003Group2 Item1 020[/b] Do different START + READ PREVIOUS for getting the last record. [b]Searched Record (START KEY NOT >): 003Group2 Item1 020 Searched Record (START KEY NOT >=): 003Group2 Item1 020 Searched Record (START KEY <): 003Group2 Item1 020 Searched Record (START KEY <=): 003Group2 Item1 020 [/b] Do different START + READ NEXT for getting the first record. Searched Record (START KEY NOT <): 001Group1 Item1 100 Searched Record (START KEY >): 001Group1 Item1 100 Searched Record (START KEY >=): 001Group1 Item1 100 [/quote] Result with VBISAM, [quote] Do a START + READ for getting a record. Searched Record (START): 002Group1 Item2 010 Do a READ + REWRITE + READ NEXT for getting two records. Rewrite the found record from "READ": 002Group1 Item2 010 The found record was rewritten, reading the next one. [b]Searched record "READ NEXT" was the same as before, this shouldn't happen![/b] Do different START + READ PREVIOUS for getting the last record. [b]Last record with "START KEY NOT >" not found! Last record with "START KEY NOT >=" not found! Last record with "START KEY <" not found! Last record with "START KEY <=" not found![/b] Do different START + READ NEXT for getting the first record. Searched Record (START KEY NOT <): 001Group1 Item1 100 Searched Record (START KEY NOT <=): 001Group1 Item1 100 Searched Record (START KEY >): 001Group1 Item1 100 Searched Record (START KEY >=): 001Group1 Item1 100 [/quote] Although the different START after file end work the following READ PREVIOUS do not work with VBISAM in current OC tarball. Because it is working with Cobol-*T 1.2.10c, I think it either worked with an old OC/VBISAM version or this has been fixed by them (and we could merge the fix to OC). The READ + REWRITE + READ NEXT does not work as expected (same problem with Cobol-*T) but works with the same OC version and configured for BDB. human ---------------------------------------------------------------- I found another VBISAM-only bug that seems to be related to this one (therefore I post it here, too). If you have a READ + REWRITE, READ NEXT for getting the next record does not work (READ + REWRITE, READ PREVIOUS seem to work). This is often done for massive updates and therefore a big problem. I've adjusted the sample in the first post, it represents both problems now. human ---------------------------------------------------------------- Hi Human, For me it looks like OC bug and not vbisam at this point. Of course vbisam is missing "start browse" with reverse direction (< or <= conditions), but BDB does not have this too. In the case of BDB, OC is handling this correctly - i.e. starting with "key" (of course it is ">=" condition), if record is not found, getting LAST. If found and condition is "<" or "key" does not match, getting PREV. I don't see any part of this logic in C/D/VB-ISAM implementation of indexed_start in fileio.c Regarding REWRITE+READNEXT - it is in the logic of indexed_rewrite to keep "current" file position (what if you do more than 1 rewrite) - but it also (for unknown for me reasons :-) doing several "start"s on this key which triggers the flag of "start", so following READNEXT thinking that it is just after "start", so it must bring CURRENT record and not NEXT It seems to me that the whole logic of ISAM implementation in OC need a good review. It is also doing a lot of extra unnecessary stuff... Of course I can fix those issues, but that would be VBISAM-specific, and what about CISAM/DISAM (and what is that anyway) ? Do we want to split VBISAM implementation into separate set of functions ? That might help not only to fix bugs, but to improve performance. If you have or can point me to ISAM functions documentation, that might speedup the fix. ---------------------------------------------------------------- [quote] simrw wrote (end of 2006): [...] MF uses a modified version of IBM (formally INFORMIX) C-ISAM. Many years ago they bought the rights to the source. I have been trying to get IBM to OpenSource C-ISAM as it can't be any great revenue for them. So far without success. It might help if you, and all others who read this, also put pressure on IBM to release C-ISAM to the OpenSource community. Having said this, I have been looking at alternatives. One that MAY eventually be a possibility is VBISAM over at SourceForge. The VB has NOTHING, repeat NOTHING to do with Visual Basic :-) It comes from the originator - Trevor Van Bremen. Problem is that Trevor disappears for months at a time. I have, however, taken the code, completely revised it and put it under control of autotools [...] Download at http://www.sim-basis.de/vbisam-2.0.tar.gz [...] If you want to apply pressure on IBM to opensource C-ISAM, the product manager is Andrea Reid - E-Mail areid@us.ibm.com [...] C-ISAM we can forget if IBM will not opensource. VBISAM needs a bunch of mods (also applies to C-ISAM) eg. a) Support for lock on write when manually locking. b) Support for own comparison routine c) Support for Win locking (it currently does not work even under Cygwin)[/quote] I think many of the points he said are working already (as some simple locking tests work fine, both with cygwin and MSVC builds). Whether the "bunch of mods" belong to fileio.c/.h or directly to the ISAM source itself is not clear to me. D-ISAM is a commercial ISAM with commercial support and commercial licence fees (I never had a deeper look into that). I guess you're right with the "good review" the ISAM implementation needs. I'd prefer to use #defines in the functions we have already to fix bugs and boost up performance. If it's somehow possible for you to have a deeper look into the ISAM part in general for kind of rewriting it, it would be better to have some consultation and agreements with Roger before. Concerning documentation, you may want to have a look at all files in vbisam/docs (there are also files with "open" points). Because of VBISAM being a replacement for IBMs C-ISAM, it may help to have a look at [url=http://www.elink.ibmlink.ibm.com/publications/servlet/pbi.wss?CTY=US&FNC=SRX&PBL=G251-0448-00#]their documentation[/url], especially Chapter 8 - Call Formats and Descriptions, too. human ---------------------------------------------------------------- The OC file IO code is very compact and convoluted, thus making it difficult to read and maintain. So perhaps, it would be better to separate the file IO code into several files, with a common interface. No small task, by any means. One file for BDB, and one for VB/D/C-CIS*M as they share a similar interface. No idea about EXTFH. Since indexed file selection is a configure compile time option, the configure option could select which file to include in the OC RT. As to how difficult, if indeed possible, would it be to achieve this selection using the auto-config tools. I have no idea. As for ISAM documentation, I would suggest the C-IS*M programmers manual. It is a free download, and includes C sample code. Just search for cisam _dot_ pdf. ---------------------------------------------------------------- The link to the C-ISAM programmers manual is linked in my previous post, therefore no need to serach for it... human ---------------------------------------------------------------- I did not notice the embedded link. Maybe links should be underlined. :-D In any case, if you look at the latest C-IS*M documentation, you will notice that it does not support '<' or '<=' conditions. So you have to do it the hard way, as Sergey mentioned. ---------------------------------------------------------------- Wouldn't it be more useful if VBISAM support it (if it doesn't support it yet) and for D-ISAM/C-ISAM we implement "the hard way"? human ---------------------------------------------------------------- Well VB/C-IS*M, and probably D-IS*M, use a B-tree structure to store the indexes. If it was feasible to implement this feature, then it would be included in VB/C/D-IS*M. Note that the COBOL-85 standard does not include the < and <= conditions for the START verb. In any case, the hard way is generally not expensive, unless you have large numbers of duplicate keys. ---------------------------------------------------------------- Of course both the '02 Standard and the revision both DO support read backwards and <. ---------------------------------------------------------------- Subject: libcob: Cannot find module 'SQLADR' I am using a precompiled OC-1.0 package on an HP-UX 11.0 server. I am attempting to compile programs written with embedded SQL statements after they have been pre-compiled with Oracle's procobol. I have linked the Oracle library. My problem is that I keep getting the message: libcob: Cannot find module 'SQLADR'. Anyone have any experience doing such a thing? Thanks, --Karey ---------------------------------------------------------------- Karey; we have a little experience here on oc.o, but if you could post more of the tectonics (build instructions) help might go farther, faster [i]or crash into a wall[/i]. In particular, I'd be curious as to what the -L and -l (little l) options look like. SQLADR may not be in SHLIB_PATH (if I remember the HPUX. It might be LD_LIBRARY_PATH or LIB_PATH or ..., but it's best to leave these env vars alone anyway) And maybe http://opencobol.add1tocobol.com/#what-is-cob-pre-load Here's rooting for you. It'll be cool if 1.0 (or 1.1pre-release for that matter) can compile and run the output from Oracle's preprocessor. Cheers, Brian ---------------------------------------------------------------- [quote] kdsadler wrote: libcob: Cannot find module 'SQLADR'. [/quote] Hi, I'm assuming you doing something like that: cobc -x TEST.cbl ${ORACLE_HOME}/precomp/lib/cobsqlintf.o -L${ORACLE_HOME}/lib -lclntsh You have 2 choices - ether use cobc -x -fstatic-call ... or include ${ORACLE_HOME}/bin in COB_LIBRARY_PATH and use COB_PRE_LOAD=libclntsh.so ---------------------------------------------------------------- Pro* COBOL precompiler inserts the call to SQLADR in upper case. You just require to change the the case of SQLADR to all lower case and link the library libsql avaliabe at $ORACLE_HOME/lib. libsql contains the function "sqladr" in small case. To confirm pls check with command "nm -A libsql8.a |grep -i sqladr" This will surely work....... ---------------------------------------------------------------- Hi. And what about in windows with oracle express 10g? What is the lib? Maybe oci.lib? ---------------------------------------------------------------- According to http://www.uni-muenster.de/ZIVdoc/oracle/oracle.805/server.805/a58232.pdf (7-42 Compiling and Linking) oci.lib/liboci are only needed for OCI calls, you allways need to link sql.lib/libsql if you want to use the Pro*COBOL Precompiler. Don't forget to check if you need to change the CALL commands to lower-case CALL 'sqladr'. human ---------------------------------------------------------------- LOL, I also have the same problem with you sir... please anybody experience like this scenario? help us okay? i find it hard to compile things embedded from SQL msgs... tnx ---------------------------------------------------------------- Thanks for the reply! To link with oracle 10g express the dll ir orasql10, no libs needed after the precomp process ---------------------------------------------------------------- Subject: Unable to make OC 1.1 Attempting to compile OC1.1 on an HP-UX 11.0 system. I think I have finally got all the prerequisets taken care of. ./configure goes OK, then I attempt to make I get: screenio.c: In function `cob_screen_attr': screenio.c:154: error: `COLOR_BLACK' undeclared (first use in this function) screenio.c:154: error: (Each undeclared identifier is reported only once screenio.c:154: error: for each function it appears in.) screenio.c:157: error: `COLOR_BLUE' undeclared (first use in this function) screenio.c:160: error: `COLOR_GREEN' undeclared (first use in this function) screenio.c:163: error: `COLOR_CYAN' undeclared (first use in this function) screenio.c:166: error: `COLOR_RED' undeclared (first use in this function) screenio.c:169: error: `COLOR_MAGENTA' undeclared (first use in this function) screenio.c:172: error: `COLOR_YELLOW' undeclared (first use in this function) screenio.c:175: error: `COLOR_WHITE' undeclared (first use in this function) screenio.c:211: error: `COLOR_PAIRS' undeclared (first use in this function) screenio.c:212: warning: implicit declaration of function `pair_content' screenio.c:217: warning: implicit declaration of function `init_pair' screenio.c:223: warning: implicit declaration of function `color_set' screenio.c:223: warning: implicit declaration of function `COLOR_PAIR' screenio.c:227: warning: implicit declaration of function `bkgdset' screenio.c: In function `cob_screen_init': screenio.c:282: warning: implicit declaration of function `has_colors' screenio.c:283: warning: implicit declaration of function `start_color' screenio.c:285: error: `COLOR_PAIRS' undeclared (first use in this function) screenio.c:290: warning: implicit declaration of function `getmaxyx' screenio.c: In function `cob_screen_puts': screenio.c:400: warning: implicit declaration of function `addnstr' screenio.c: In function `cob_screen_get_all': screenio.c:494: error: `KEY_BTAB' undeclared (first use in this function) screenio.c:560: error: `KEY_END' undeclared (first use in this function) screenio.c:596: warning: implicit declaration of function `ungetch' screenio.c: In function `cob_field_display': screenio.c:842: warning: implicit declaration of function `scrl' screenio.c: In function `cob_field_accept': screenio.c:982: error: `KEY_END' undeclared (first use in this function) *** Error exit code 1 ---------------------------------------------------------------- This a problem with the curses (ncurses) header. No idea as to the reasone why. ---------------------------------------------------------------- Please post the content of the generated config.h. What version of cursed do you have? human ---------------------------------------------------------------- Subject: OC codegen bug for perform-osvs Hi, As it came to reality one funny but dangerous bug in generation with perform-osvs enabled has been discovered [d](in all OC versions)[/d] in OC 1.1. The chances to hit it are very small, but... Here is a patch: [code] *** codegen.c.orig 2009-01-28 13:18:22.000000000 -0500 --- codegen.c 2009-08-07 16:56:54.000000000 -0400 *************** *** 2744,2761 **** output_line (" return 0;"); output_line ("}"); } ! output_newline (); ! output_line ("if (frame_ptr->perform_through == %d)", l->id); #ifndef __GNUC__ ! output_line (" goto P_switch;"); #elif COB_USE_SETJMP ! output_line (" longjmp (frame_ptr->return_address, 1);"); #else ! output_line (" goto *frame_ptr->return_address;"); #endif ! if (cb_perform_osvs) { output_line ! ("for (temp_index = frame_ptr - 1; temp_index->perform_through; temp_index--) {"); output_line (" if (temp_index->perform_through == %d) {", l->id); output_line (" frame_ptr = temp_index;"); #ifndef __GNUC__ --- 2744,2762 ---- output_line (" return 0;"); output_line ("}"); } ! if (!cb_perform_osvs) { ! output_newline (); ! output_line ("if (frame_ptr->perform_through == %d)", l->id); #ifndef __GNUC__ ! output_line (" goto P_switch;"); #elif COB_USE_SETJMP ! output_line (" longjmp (frame_ptr->return_address, 1);"); #else ! output_line (" goto *frame_ptr->return_address;"); #endif ! } else { output_line ! ("for (temp_index = frame_ptr; temp_index->perform_through; temp_index--) {"); output_line (" if (temp_index->perform_through == %d) {", l->id); output_line (" frame_ptr = temp_index;"); #ifndef __GNUC__ [/code] ---------------------------------------------------------------- Where does this problem occur? human ---------------------------------------------------------------- 1. I was wrong about OC versions. This BUG appeared only in 1.1 Previous versions don't have this bug. 2. It is very hard to reproduce (and I don't want to post 3+ MB code), but basically if you have the following in your code, you are in danger: [code] PROCEDURE DIVISION. DISPLAY 'BEFORE 01-PARA'. 01-PARA. DISPLAY '01-PARA'. 01-PARA-EXIT. DISPLAY '01-PARA-EXIT'. PERFORM 02-PARA. GOBACK. 02-PARA. PERFORM 01-PARA. [/code] There are chances of SIGSEGV or that the program will return after first display of '01-PARA' ---------------------------------------------------------------- Subject: OpenCobol and Add 1 to Cobol Chat moving from Freenode Our chat channel on Freenode (#add1tocobol) has for some time used a web based interface for those that do not want to get yet another chat client. (Though I recommend Pidgin as it is the one Chat Client to rule them all...) The locations of our web based interface to freenode were (are) at: http://www.add1tocobol.com/chat.php http://www.add1tocobol.com/chat.html These web based interfaces to IRC were graciously provided by http://www.mibbit.com and unfortunately Freenode has blocked all access to mibbit. The most is explaining it is here: http://blog.freenode.net/2009/06/new-freenode-webchat-and-why-to-use-it/ . While we understand that any chat network has the right to determine who can and cannot access their network, this interruption has caused us at the Add 1 to Cobol team a bit of stress, as a great many persons had been accessing our channel through mibbit. Rather than trying to dissuade freenode from this course we've decided to test the waters and explore other options. We're looking for feedback from the OpenCobol and the Add 1 to Cobol communities for the best path to move forward. Any suggestions anyone has would be appreciated. Some considerations we want to keep in mind are: 1. The chat system we choose should have a web based interface for those that do not want to install an IM client. 2. IRC is preferred for its openness. 3. Those that would be in charge of this (me) have zero experience installing an IRCd and would prefer to just pay a turnkey service provider. 4. Minimal number of servers is preferred to eliminate netsplits. 5. The single contrary to an IRC server would be an option for voice chat, via a client and a web based interface. We're looking to moving these things forward as soon as possible because we are planning to restart regular OpenCobol and Add 1 to Cobol meetings in September. So any suggestions are sought as rapidly as folks are able to give them. I apologize for not dealing with this earlier, until tonight I did not realize that Freenode had permanently removed Mibbit.com, and had though it was only a temporary issue. So I thank all of you for your understanding. Kind Regards -- Joseph James Frantz (Aoirthoir) http://www.add1tocobol.com Regular add1tocobol meetings: Where: FREENODE IRC Channel: #add1tocobol Access from the web: http://www.add1tocobol.com/chat.php Date: Sundays Time: 9:00am Eastern ::::::::NOTE IMPORTANT:::::::::: There has been some confusion as to the time. I believe this is because the United States uses Daylight Savings Time. On top of this the Government recently extended the dates that EDT (eastern daylight time) would run. So to be sure that you make it at 9am Eastern, I have this link: http://www.timeanddate.com/worldclock/city.html?n=179 That shows the time in New York City at the moment of viewing. It also explains the current UTC offset for the Eastern Zone in the United States. Simply compare the current time that site states, with your current time and you will know how far off we are from you. :::::::::::::::::::::::::::::::: We're there all of the time, even when we do not have a meeting. Stop on by for Open Cobol Support and chat. ---------------------------------------------------------------- Subject: Newbie with some questions Aloha! I'm a long time COBOL user. I learned it first in college back in the 70's, and have been using it as the basis of a large medical practice management system since 1980. Our shop uses HPs version of COBOL, and of course it uses some extensions and methods that are different than other dialects and platforms. I would like to express a huge thanks and well done! to the developers and others who have created what looks like an amazing product. We hope to use OC to migrate our application to Linux. We have already installed Ubuntu Linux Server 9.04 and OC 1.1, and run a Hello World program. So far so good. I have researched the FAQ and the forum a lot already, but there are some things I would like to ask here to save time and trouble. One question has to do with compiling and linking programs and subprograms. On the HP, we compile all of our shared subprograms and put them into a single file called an "XL" (a descendant of "SL", for segmented library). At run time, we indicate the location of that one file. Is there a means in OC to combine all of the compiled subprograms in this way? On the HP, when a subprogram is called, the name included between the quotes in the CALL statement is the name contained in the PROGRAM-ID statement of the subprogram, not the name of the program file itself. When I evaluated AcuCOBOL several years ago, I found that it wanted the name of the program file to be included between the quotes in the CALL statement. What does OC expect? In HP COBOL, it is possible to add the clause "initial" following the PROGRAM-ID name, and this will cause the Working Storage variables to be set to their explicit initial values whenever the subprogram is called, rather than retain their values from call to call. Does OC support this? (Our subprograms use "exit program" to indicate when to return to the calling program). We have never used "CANCEL" or anything like that. Finally, does OC support ENTRY points within a subprogram? (I believe this is an HP COBOL extension). I would appreciate any guidance from forum members, and TIA. ---------------------------------------------------------------- dakine; cobc by default uses the [b]-m[/b] switch, producing a shareable object file. Around here, we usually use [b]-x [/b] for executables, but that really is a "programming in the small" switch. Great for us here discussing concepts and samples. But, [b]-b[/b] and a list of source, objects and other shareable objects will build an all-in shareable. Execute from these shareables with [code] $ cobcrun filename [/code] Where filename is the built module that includes one 'main' entry address. CALL names are by and large 'link loader names', and OC 1.1 is by and large a dynamic loader system. As long as the .o, or .so is (file)named during cobc, the symbols inside should resolve as expected. INITIAL should work, and if not, it's bug reportable. Yep on ENTRY. I've used them for C callbacks, and they work the beauty. Cheers, Brian ---------------------------------------------------------------- Could you please supply a sample of using entry points and, if possible, quote the standard about this? human ---------------------------------------------------------------- "ENTRY" points are extensions (as far as I know WHEREVER they are included). I first used them in IBM (mainframe) COBOL. See: [url=http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/IGY3LR40/6.2.12 ]http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/IGY3LR40/6.2.12 [/url] They are (relatively closely) related to "linkage editors" or "binders" in that they (usually) require an "alias" by which the "main" program can be called. In MIcro Focus, they provide an external facility to "emulate" what a linkage editor or binder can do. Check ou the Micro Focus, Mainframe Express documentation at: [url=http://supportline.microfocus.com/documentation/books/mx31/mx31indx.htm]http://supportline.microfocus.com/documentation/books/mx31/mx31indx.htm[/url] and look for the topic, "Entry Point Mapping for COBOL and Assembler Programs" ---------------------------------------------------------------- Hi human, I was trying to send you some sample code, but when I Preview the reply, everything is left justified. It looks fine after pasting to the text box. If you can tell me how to make sure the indents are retained, I can send you an example. ---------------------------------------------------------------- Thanks very much, Brian. Very good to hear that we will not have to make too many changes when migrating. ---------------------------------------------------------------- @dakine: try to post the code here with using the code tags, write [ code] cobol code with intend[ /code] (without the space after "[") or simply use the button <> next to MANAGER in post/edit. human ---------------------------------------------------------------- Thanks, human! Here is a sample of some code that uses ENTRY points. If you have any questions, let me know. [code] IDENTIFICATION DIVISION. ****************************************************************** PROGRAM-ID. TIME-ROUTINES initial. ****************************************************************** * Date Init Remarks * -------- ---- ------------------------------------------------- * 5/22/99 WTS Written. ****************************************************************** ENVIRONMENT DIVISION. CONFIGURATION SECTION. copy specname. DATA DIVISION. WORKING-STORAGE SECTION. *----------------------------------------------------------------- 01 x-time-ndx pic s9(09) comp. 01 ws-time-ndx pic s9(09) comp. 01 ws-end-ndx pic s9(09) comp. 01 ws-slots pic s9(09) comp. 01 I pic s9(09) comp. 01 rem pic s9(09) comp. 01 work-time. 03 wt-hh pic s9(09) comp. 03 wt-mm pic s9(09) comp. *----------------------------------------------------------------- 01 x-time. 03 x-hh pic 9(02). 03 x-mm pic 9(02). 01 ws-start-time pic x(04). 01 ws-end-time pic x(04). 01 time-buf. 03 tb-hh pic 9(02). 03 tb-hhx redefines tb-hh pic x(02). 03 filler pic x(01) value ":". 03 tb-mm pic 9(02). 03 tb-mmx redefines tb-mm pic x(02). 03 tb-ap pic x(02). 88 AM values "AM", "am". 88 PM values "PM", "pm". *----------------------------------------------------------------- LINKAGE SECTION. 01 mil-time. 03 hh pic 9(02). 03 mm pic 9(02). 01 civ-time pic x(08). 01 time-ndx pic s9(09) comp. 01 start-time pic x(04). 01 end-time pic x(04). 01 duration pic s9(09) comp. *----------------------------------------------------------------- PROCEDURE DIVISION. main-pgh. *----------------------------------------------------------------- ENTRY "CIV-TIME" using mil-time civ-time. * ct-main. move spaces to civ-time. if ((hh >= 0 and hh <= 23) and (mm >= 0 and mm <= 59)) and mil-time <> spaces and mil-time NUMERIC if hh < 12 move "am" to tb-ap if hh = zero move 12 to tb-hh move mm to tb-mm else move hh to tb-hh move mm to tb-mm end-if else move "pm" to tb-ap if hh = 12 move hh to tb-hh move mm to tb-mm else subtract 12 from hh giving tb-hh move mm to tb-mm end-if end-if move time-buf to civ-time inspect civ-time replacing leading zeroes by spaces. if mil-time = "9999" move "99:99" to civ-time. exit program. *----------------------------------------------------------------- ENTRY "MIL-TIME" using civ-time mil-time. * mt-main. move spaces to mil-time. move civ-time to time-buf. inspect tb-hhx replacing leading spaces by zeroes. if (tb-hhx is NUMERIC and tb-mmx is NUMERIC) if AM if tb-hh <> 12 move tb-hh to hh move tb-mm to mm else move zero to hh move tb-mm to mm end-if else if tb-hh <> 12 add 12 to tb-hh giving hh move tb-mm to mm else move tb-hh to hh move tb-mm to mm end-if end-if end-if. exit program. *----------------------------------------------------------------- ENTRY "TIME-NDX" using mil-time time-ndx. * tn-main. move mil-time to x-time. perform time-ndx-pgh. move x-time-ndx to time-ndx. exit program. *----------------------------------------------------------------- ENTRY "NDX-TIME" using time-ndx mil-time. * nt-main. move time-ndx to x-time-ndx. perform ndx-time-pgh. move x-time to mil-time. exit program. *----------------------------------------------------------------- ENTRY "ADD-DURATION" using start-time end-time duration. * ad-main. move start-time to x-time. perform time-ndx-pgh. compute ws-slots = duration / 5. compute ws-end-ndx = x-time-ndx + ws-slots. move ws-end-ndx to x-time-ndx. perform ndx-time-pgh. move x-time to end-time. exit program. ****************************************************************** * time-ndx-pgh. move zero to x-time-ndx. if x-time NUMERIC compute x-time-ndx = ((x-hh * 12) + 1) + (x-mm / 5). * ndx-time-pgh. move spaces to x-time. if (x-time-ndx > 0 and x-time-ndx < 289) compute I = x-time-ndx - 1 divide I by 12 giving x-hh remainder rem compute x-mm = 5 * rem. [/code] ---------------------------------------------------------------- human; here's another sample. [code] >>SOURCE FORMAT IS FIXED ***************************************************************** * OpenCOBOL demonstration * Author: Brian Tiffin * Date: 26-Jun-2008 * History: * 03-Jul-2008 * Updated to compile warning free according to standards * Purpose: * CBL_ERROR_PROC and CBL_EXIT_PROC call example * CBL_ERROR_PROC installs or removes run-time error procedures * CBL_EXIT_PROC installs or removes exit handlers * Also demonstrates the difference between Run time errors * and raised exceptions. Divide by zero is raises an * exception, it does not cause a run time error. * NB: * Please be advised that this example uses the functional but * now obsolete ENTRY verb. Compiling with -Wall will display * a warning. No warning will occur using -std=MF * Tectonics: cobc -x errorproc.cob identification division. program-id. error_exit_proc. data division. working-storage section. * entry point handlers are procedure addresses 01 install-address usage is procedure-pointer. 01 install-flag pic 9 comp-x value 0. 01 status-code pic s9(9) comp-5. * exit handler address and priority (prio is IGNORED with OC1.1) 01 install-params. 02 exit-addr usage is procedure-pointer. 02 handler-prio pic 999 comp-x. * indexing variable for back scannning error message strings 01 ind pic s9(9) comp-5. * work variable to demonstrate raising exception, not RTE 01 val pic 9. * mocked up error procedure reentrancy control, global level 01 once pic 9 value 0. 88 been-here value 1. * mocked up non-reentrant value 01 global-value pic 99 value 99. * LOCAL-STORAGE SECTION comes into play for ERROR_PROCs that * may themselves cause run-time errors, handling reentry. local-storage section. 01 reenter-value pic 99 value 11. * Linkage section for the error message argument passed to proc * By definition, error messages are 325 alphanumeric linkage section. 01 err-msg pic x(325). * example of OpenCOBOL error and exit procedures procedure division. * Demonstrate problem installing procedure * get address of WRONG handler. NOTE: Invalid address set exit-addr to entry "nogo-proc". * flag: 0 to install, 1 to remove call "CBL_EXIT_PROC" using install-flag install-params returning status-code end-call. * status-code 0 on success, in this case expect error. if status-code not = 0 display "Intentional problem installing EXIT PROC" ", Status: " status-code end-display end-if. * Demonstrate install of an exit handler * get address of exit handler set exit-addr to entry "exit-proc". * flag: 0 to install, 1 to remove call "CBL_EXIT_PROC" using install-flag install-params returning status-code end-call. * status-code 0 on success. if status-code not = 0 display "Problem installing EXIT PROC" ", Status: " status-code end-display stop run end-if. * Demonstrate installation of an error procedure * get the procedure entry address set install-address to entry "err-proc". * install error procedure. install-flag 0 installs, 1 removes call "CBL_ERROR_PROC" using install-flag install-address returning status-code end-call. * status-code is 0 on success. if status-code not = 0 display "Error installing ERROR PROC" end-display stop run end-if. * example of error that raises exception, not a run-time error divide 10 by 0 giving val end-divide. * val will be a junk value, use at own risk divide 10 by 0 giving val on size error display "DIVIDE BY ZERO Exception" end-display end-divide. * intentional run-time error call "erroneous" end-call. *> ** Intentional error ** * won't get here. RTS error handler will stop run display "procedure division, following run-time error" end-display. display "global-value: " global-value ", reenter-value: " reenter-value end-display. exit program. ***************************************************************** ***************************************************************** * Programmer controlled Exit Procedure: entry "exit-proc". display "**Custom EXIT HANDLER (will pause 3 and 0.5 seconds)**" end-display. * sleep for 3 seconds call "C$SLEEP" using "3" end-call. * demonstrate nanosleep; argument in billionth's of seconds * Note: also demonstrates OpenCOBOL's compile time * string catenation using ampersand; * 500 million being one half second call "CBL_OC_NANOSLEEP" using "500" & "000000" end-call. exit program. ***************************************************************** * Programmer controlled Error Procedure: entry "err-proc" using err-msg. display "**ENTER error procedure**" end-display. * These lines are to demonstrate local and working storage display "global-value: " global-value ", reenter-value: " reenter-value end-display. * As reenter-value is local-storage * the 77 will NOT display on rentry, while the global 66 will move 66 to global-value. move 77 to reenter-value. * Process err-msg. * Determine Length of error message, looking for null terminator perform varying ind from 1 by 1 until (err-msg(ind:1) = x"00") or (ind = length of err-msg) continue end-perform. display err-msg(1:ind) end-display. * demonstrate trapping an error caused in error-proc if not been-here then set been-here to true display "Cause error while inside error-proc" end-display call "very-erroneous" end-call *> Intentional error end-if. * In OpenCOBOL 1.1, the return-code is local and does * not influence further error handlers *move 1 to return-code. move 0 to return-code. display "**error procedure EXIT**" end-display. exit program. [/code] Outputs: [code] $ ./errorproc Intentional problem installing EXIT PROC, Status: -000000001 DIVIDE BY ZERO Exception **ENTER error procedure** global-value: 99, reenter-value: 11 Cannot find module 'erroneous' Cause error while inside error-proc **ENTER error procedure** global-value: 66, reenter-value: 11 Cannot find module 'very-erroneous' **error procedure EXIT** libcob: Cannot find module 'very-erroneous' **Custom EXIT HANDLER (will pause 3 and 0.5 seconds)** [/code] Cheers, Brian ---------------------------------------------------------------- @dakine: OK, I see what you are doing. I just used a "01 prog-mode pic 99 comp-5" with different 88 like "88 NDX-TIME value 9" for that. How do you call this program with an entry point? human ---------------------------------------------------------------- Hi human, From any program, you can call any of the ENTRY points by its name and include the variables specified under that entry point. In my use, the program name in the PROGRAM-ID field is not used. If you wanted to convert a "mil-time" (which is just a 24 hour clock time with hhmm, where hh is the hour and mm is the minute) to a "civ-time" (which is a time in the format "hh:mm" and either an "am" or "pm" suffix depending on the hour), you would call "CIV-TIME" using mil-time civ-time, and populate the "mil-time" variable with a "hhmm", and the corresponding "civ-time" would be returned. So sending "0859" would return "8:59am". The LINKAGE SECTION contains all of the possible variables that any of the ENTRY points might use, but any of the ENTRY points does not have to use all of them. I like ENTRY points because you can combine programs that perform similar functions into one overall program. All of the ENTRY points can share the WORKING-STORAGE variables. The TIME-NDX routine converts a 24-hour clock time to an offset from midnight based on how many 5-minute intervals there are. The NDX-TIME converts the offset back to the 24-hour clock time. I hope this helps. ---------------------------------------------------------------- I think what you are asking is how to get the OC runtime to recognize the entry points. What you need to do is to tell the OC runtime to "preload" the module which then makes the entry points visible. Simple - set and export the environment variable "COB_PRE_LOAD". So, let's assume your posted source program is called "time1.cob". Compile it - cobc -m -Wall time1.cob (As "-m" is the default, you need not specify it). Now before we fire up the application that calls these entries in "time1", set the variable - export COB_PRE_LOAD=time1 Multiple modules may be specified by delimiting the names with a colon (on native windows a semi-colon) - export COB_PRE_LOAD=time1:time2 You can also create a "library" of routines by using the "-b" compile option. eg. cobc -b -Wall -o myoclib time1.cob time2.cob .... Then set/export - export COB_PRE_LOAD=myoclib Note that, when specifying output compile options, you should NOT specify the suffix. OC knows what suffix to use depending on target system (eg. .so, .dll, .dylib, etc.) This also applies when creating executables with "-x"; OC knows if it needs to append or not append a suffix. Roger ---------------------------------------------------------------- Roger, Does OC support both the "sticky-linkage" and "no-sticky-linkage" behaviors that Micro Focus has by compiler directive? With Sticky-Linkage "turned on", then addressibility is kept to Linkag Section items after the first CALL using them. While with no-sticky-linkage, ONLY those parameters aactually used in the CALL get addressibility. This is particulary important with ENTEY statements - where the same program uses different parameters (number of patameters) for different ENTRY points. IBM mainframes ALWAYS use "sticky-linkage" behavior; while MF allows the user to decide (at compile-time). I don't know what HP does. NOTE: Personally, NOT passing all the parameters for all entry points is a "bad" programming practice (IMHO) - but it is fairly common (at least for IBM programs usent ENTRY statements). ---------------------------------------------------------------- Yes, but only over the config files. It is not currently a compile option. It's turned on for -std=ibm and -std=mvs. Roger ---------------------------------------------------------------- Subject: OC initialization bug in IBM mode (all versions) Hi, Here is the bug. Compile cobc -x -std=ibm badinit.cbl [d]I don't have a patch so far...[/d] Patch submitted. [code] IDENTIFICATION DIVISION. PROGRAM-ID. BADINIT. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 L1 OCCURS 1000 TIMES. 05 L2 PIC S9(9) COMP-5 VALUE 5. PROCEDURE DIVISION. DISPLAY 'VALUE(3) = ' L2(3). [/code] ---------------------------------------------------------------- Here is the patch for OC 1.1 Should not be worse than it was :-) [code] *** codegen.c.orig 2009-01-28 13:18:22.000000000 -0500 --- codegen.c 2009-08-14 13:01:53.000000000 -0400 *************** *** 1533,1539 **** } if (p->val && f->values) { ! return INITIALIZE_ONE; } if (p->flag_statement && !f->children) { --- 1533,1543 ---- } if (p->val && f->values) { ! if(topfield && f->flag_occurs) { ! return INITIALIZE_COMPOUND; ! } else { ! return INITIALIZE_ONE; ! } } if (p->flag_statement && !f->children) { *************** *** 1909,1917 **** int last_char; int i; size_t size; ff = cb_field (x); ! for (f = ff->children; f; f = f->sister) { type = initialize_type (p, f, 0); c = cb_build_field_reference (f, x); --- 1913,1928 ---- int last_char; int i; size_t size; + static int recurs_level = 0; ff = cb_field (x); ! if (!recurs_level && ff->parent == NULL && ff->flag_occurs) { ! f = ff; ! } else { ! f = ff->children; ! } ! ++recurs_level; ! while(f) { type = initialize_type (p, f, 0); c = cb_build_field_reference (f, x); *************** *** 1973,1979 **** --- 1984,1993 ---- output_indent (" }"); } } + if(f == ff) break; + f = f->sister; } + --recurs_level; } static void [/code] ---------------------------------------------------------------- Hee, that's what you get for using non-standard extensions :-) And what we get for supporting them :-( Looks like this does not cater for - INITIALIZE L1 (1). It's initializing the whole array. Note this construct is weird in that you cannot reference the complete array as an entity. ie. You cannot do INITIALIZE L1. Only when doing the first initialization do you need to treat that thing as a complete entity. Roger ---------------------------------------------------------------- Roger, What "non-Standard" extension (for IBM mode?) do you support? Other than COMP-5, I don't see anything non-Standard in the sample COBOL code (and I don't read C code to understand what that is doing)? When it comes to both "initialization" (of WS when a program is tarted) and the INITIALIZE verb, I think that IBM is pretty Standard. ---------------------------------------------------------------- OCCURS at the 01 level. That is not allowed in 85/2002. Roger ---------------------------------------------------------------- OCCURS at 01-level is also[b]NOT[/b] valid for any IBM compiler and shouldn't be allowed in 'IBM mode". It was an *old* extension allowed in Micro Focus, but I don't believe that they support it anymore, either. (I think it gets by their compiler, but causes "unpredictable" restuls at run-time). See: [url=http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/IGY3LR40/5.3.11 ]http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/IGY3LR40/5.3.11 [/url] which says (inpart), [quote] The OCCURS clause cannot be specified in a data description entry that: - Has a level number of 01, 66, 77, or 88. ... [/quote] IBM (and Micro Focus - with ODOSLIDE) have extensions that allow: - ODO under another ODO (ntested ODO) - Data following an ODO ---------------------------------------------------------------- Micro Focus do support OCCURS at 01 level. (And allows it per default with no warning). From current (SE) doc - The OCCURS clause should not be specified in a data description entry at the 01 level or as a 77 level-number. (MF) This restriction is removed. Rather interesting that the word "should" is used. I think "can" or "must" should (sic) have been specified there. For this feature what we will do is adjust the config files (config/xxx.conf) as follows - For the default (no -std= option), -std=mf and -std=bs2000 we will allow this. All others will disallow (-std=cobol85, cobol2002, ibm, mvs). Roger ---------------------------------------------------------------- Hi Roger, [quote]simrw wrote: INITIALIZE L1 (1). It's initializing the whole array.[/quote] No, I don't see that: [code] IDENTIFICATION DIVISION. PROGRAM-ID. BADINIT. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 S2 OCCURS 1000 TIMES PIC S9(9) COMP-5 VALUE 7. PROCEDURE DIVISION. DISPLAY 'S2(3) = ' S2(3). MOVE 1 TO S2(1) S2(2) S2(3). DISPLAY 'S2(3) = ' S2(3). INITIALIZE S2(2). DISPLAY 'S2(3) = ' S2(3). DISPLAY 'S2(2) = ' S2(2). [/code] And the result is the same as in Microfocus: [code] G:\open-cobol\build_windows\test>test S2(3) = +0000000007 S2(3) = +0000000001 S2(3) = +0000000001 S2(2) = +0000000000 [/code] And the produced INITIALIZE looks [code] /* test.cbl:12: INITIALIZE */ { memset (b_5 + 4 * 1, 0, 4); } [/code] ---------------------------------------------------------------- Sergey, try it on your original COBOL code. Do an INITITIALIZE L1 (1). I have a more pervasive fix for this in the works. Will be in upcoming tarball. Roger ---------------------------------------------------------------- Hi Roger, [quote] simrw wrote: Sergey, try it on your original COBOL code. Do an INITITIALIZE L1 (1). [/quote] I did. I don't see any issues in original code too: [code] IDENTIFICATION DIVISION. PROGRAM-ID. BADINIT. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 L1 OCCURS 1000 TIMES. 05 L2 PIC S9(9) COMP-5 VALUE 5. PROCEDURE DIVISION. DISPLAY 'VALUE(3) = ' L2(3). INITIALIZE L1(1). DISPLAY 'VALUE(1) = ' L2(1). DISPLAY 'VALUE(3) = ' L2(3). GOBACK. [/code] [code]G:\open-cobol\build_windows\test>test VALUE(3) = +0000000005 VALUE(1) = +0000000000 VALUE(3) = +0000000005 [/code] [quote]I have a more pervasive fix for this in the works. Will be in upcoming tarball. Roger[/quote] Ether way. It's not a critical bug anyway. ---------------------------------------------------------------- Sergey, sorry, was using a slightly different test prog. Try this - [code] IDENTIFICATION DIVISION. PROGRAM-ID. BADINIT. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 L1 OCCURS 1000 TIMES. 05 L2 PIC S9(9) COMP-5 VALUE 5. 05 L3 PIC S9(9) VALUE 5. PROCEDURE DIVISION. DISPLAY 'VALUE(3) = ' L2(3). INITIALIZE L1(1). DISPLAY 'VALUE(1) = ' L2(1). DISPLAY 'VALUE(3) = ' L2(3). INITIALIZE L1(1) DEFAULT. DISPLAY 'VALUE(1) = ' L2(1). DISPLAY 'VALUE(3) = ' L2(3). INITIALIZE L1(1) ALL VALUE. DISPLAY 'VALUE(1) = ' L2(1). DISPLAY 'VALUE(3) = ' L2(3). GOBACK. [/code] Roger ---------------------------------------------------------------- Hi Roger, [quote]simrw wrote: Sergey, sorry, was using a slightly different test prog. Try this - Roger[/quote] WOW. But fortunately that's not a big change :-) the change itself is [code] < if (!recurs_level && ff->parent == NULL && ff->flag_occurs) { > if (!recurs_level && !p->flag_statement && ff->parent == NULL && ff->flag_occurs) { [/code] Full patch for codegen (from original) [code] *** codegen.c.orig 2009-01-28 13:18:22.000000000 -0500 --- codegen.c 2009-08-19 19:34:26.000000000 -0400 *************** *** 1533,1539 **** } if (p->val && f->values) { ! return INITIALIZE_ONE; } if (p->flag_statement && !f->children) { --- 1533,1543 ---- } if (p->val && f->values) { ! if(topfield && f->flag_occurs) { ! return INITIALIZE_COMPOUND; ! } else { ! return INITIALIZE_ONE; ! } } if (p->flag_statement && !f->children) { *************** *** 1909,1917 **** int last_char; int i; size_t size; ff = cb_field (x); ! for (f = ff->children; f; f = f->sister) { type = initialize_type (p, f, 0); c = cb_build_field_reference (f, x); --- 1913,1928 ---- int last_char; int i; size_t size; + static int recurs_level = 0; ff = cb_field (x); ! if (!recurs_level && !p->flag_statement && ff->parent == NULL && ff->flag_occurs) { ! f = ff; ! } else { ! f = ff->children; ! } ! ++recurs_level; ! while(f) { type = initialize_type (p, f, 0); c = cb_build_field_reference (f, x); *************** *** 1973,1979 **** --- 1984,1993 ---- output_indent (" }"); } } + if(f == ff) break; + f = f->sister; } + --recurs_level; } static void *************** *** 2744,2761 **** output_line (" return 0;"); output_line ("}"); } ! output_newline (); ! output_line ("if (frame_ptr->perform_through == %d)", l->id); #ifndef __GNUC__ ! output_line (" goto P_switch;"); #elif COB_USE_SETJMP ! output_line (" longjmp (frame_ptr->return_address, 1);"); #else ! output_line (" goto *frame_ptr->return_address;"); #endif ! if (cb_perform_osvs) { output_line ! ("for (temp_index = frame_ptr - 1; temp_index->perform_through; temp_index--) {"); output_line (" if (temp_index->perform_through == %d) {", l->id); output_line (" frame_ptr = temp_index;"); #ifndef __GNUC__ --- 2758,2776 ---- output_line (" return 0;"); output_line ("}"); } ! if (!cb_perform_osvs) { ! output_newline (); ! output_line ("if (frame_ptr->perform_through == %d)", l->id); #ifndef __GNUC__ ! output_line (" goto P_switch;"); #elif COB_USE_SETJMP ! output_line (" longjmp (frame_ptr->return_address, 1);"); #else ! output_line (" goto *frame_ptr->return_address;"); #endif ! } else { output_line ! ("for (temp_index = frame_ptr; temp_index->perform_through; temp_index--) {"); output_line (" if (temp_index->perform_through == %d) {", l->id); output_line (" frame_ptr = temp_index;"); #ifndef __GNUC__ [/code] ---------------------------------------------------------------- Almost :-) [code] .... 01 L9 OCCURS 1000 PIC X VALUE QUOTE. .... INITIALIZE L9 (1) ALL TO VALUE. [/code] Roger ---------------------------------------------------------------- [quote]simrw wrote: Almost :-) Roger [/quote] Yea, you right :-) in initialize_type [code] < if(topfield && f->flag_occurs) { > if(topfield && f->flag_occurs && !p->flag_statement) { [/code] Full patch: [code] *** codegen.c.orig 2009-01-28 13:18:22.000000000 -0500 --- codegen.c 2009-08-20 08:32:32.000000000 -0400 *************** *** 1533,1539 **** } if (p->val && f->values) { ! return INITIALIZE_ONE; } if (p->flag_statement && !f->children) { --- 1533,1543 ---- } if (p->val && f->values) { ! if(topfield && f->flag_occurs && !p->flag_statement) { ! return INITIALIZE_COMPOUND; ! } else { ! return INITIALIZE_ONE; ! } } if (p->flag_statement && !f->children) { *************** *** 1909,1917 **** int last_char; int i; size_t size; ff = cb_field (x); ! for (f = ff->children; f; f = f->sister) { type = initialize_type (p, f, 0); c = cb_build_field_reference (f, x); --- 1913,1928 ---- int last_char; int i; size_t size; + static int recurs_level = 0; ff = cb_field (x); ! if (!recurs_level && !p->flag_statement && ff->parent == NULL && ff->flag_occurs) { ! f = ff; ! } else { ! f = ff->children; ! } ! ++recurs_level; ! while(f) { type = initialize_type (p, f, 0); c = cb_build_field_reference (f, x); *************** *** 1973,1979 **** --- 1984,1993 ---- output_indent (" }"); } } + if(f == ff) break; + f = f->sister; } + --recurs_level; } static void *************** *** 2744,2761 **** output_line (" return 0;"); output_line ("}"); } ! output_newline (); ! output_line ("if (frame_ptr->perform_through == %d)", l->id); #ifndef __GNUC__ ! output_line (" goto P_switch;"); #elif COB_USE_SETJMP ! output_line (" longjmp (frame_ptr->return_address, 1);"); #else ! output_line (" goto *frame_ptr->return_address;"); #endif ! if (cb_perform_osvs) { output_line ! ("for (temp_index = frame_ptr - 1; temp_index->perform_through; temp_index--) {"); output_line (" if (temp_index->perform_through == %d) {", l->id); output_line (" frame_ptr = temp_index;"); #ifndef __GNUC__ --- 2758,2776 ---- output_line (" return 0;"); output_line ("}"); } ! if (!cb_perform_osvs) { ! output_newline (); ! output_line ("if (frame_ptr->perform_through == %d)", l->id); #ifndef __GNUC__ ! output_line (" goto P_switch;"); #elif COB_USE_SETJMP ! output_line (" longjmp (frame_ptr->return_address, 1);"); #else ! output_line (" goto *frame_ptr->return_address;"); #endif ! } else { output_line ! ("for (temp_index = frame_ptr; temp_index->perform_through; temp_index--) {"); output_line (" if (temp_index->perform_through == %d) {", l->id); output_line (" frame_ptr = temp_index;"); #ifndef __GNUC__ [/code] ---------------------------------------------------------------- Will there be extended tests in "make test" (maybe they are in yet) for the things we've seen here? human ---------------------------------------------------------------- Subject: LOCAL-STORAGE - are there any cobc flags ? I see that allocation of LOCAL-STORAGE changed from STACK to HEAP in OC 1.1 Is there a way to push generation to allocate on STACK ??? ---------------------------------------------------------------- Subject: Problem getting c code compiled I am using a pre-compiled OC 1.0 package on an HP-UX 11.0 system. The system has HP's native c compiler and also gcc version 3.4.6. I can't seem to get the c compiler options to work correctly. Here is the command I enter: cobc -v -std=mf -save-temps -L${ORACLE_HOME}/precomp/lib/cobsqlintf.o -L/oracle/734/lib/ -lclntsh -o $DC_LIB/GITVAR.o $DC_SRC/GITVAR.CBL And here is the error I get: preprocessing /discus/pddev1/src/GITVAR.CBL into GITVAR.i translating GITVAR.i into GITVAR.c cc -I /usr/local/include -AC99 -D_HPUX_SOURCE +e +Oinline -w +Olit=all -b -L/usr/local/lib +Z -DPIC -Wl,-E -o /discus/pddev1/lib/GITVA R.o GITVAR.c -L/usr/local/lib -lcob -lm -lgmp -lintl -liconv -lc -lcurses -ldb -L/oracle/734/precomp/lib/cobsqlintf.o -L/oracle/734/lib/ -lclntsh cc: error 1412: Option A usage: -A level where level may be a or c. /usr/ccs/bin/ld: (Warning) At least one PA 2.0 object file (GITVAR.o) was detected. The linked output may not run on a PA 1.x system. When I force OC to use gcc with this: export COB_CC=/usr/local/pa20_32/bin/gcc I get this error: preprocessing /discus/pddev1/src/GITVAR.CBL into GITVAR.i translating GITVAR.i into GITVAR.c /usr/local/pa20_32/bin/gcc -I /usr/local/include -AC99 -D_HPUX_SOURCE +e +Oinline -w +Olit=all -b -L/usr/local/lib +Z -DPIC -Wl,-E -o /discus/pddev1/lib/GITVAR.o GITVAR.c -L/usr/local/lib -lcob -lm -lgmp -lintl -liconv -lc -lcurses -ldb -L/oracle/734/precomp/lib/cobsqli ntf.o -L/oracle/734/lib/ -lclntsh gcc: `-b' must come at the start of the command line Any ideas on how I can get this to work? Thanks, Karey ---------------------------------------------------------------- You can use export COB_CFLAGS=... to adjust your C compiler options ---------------------------------------------------------------- Thanks Sergey, How does setting COB_CFLAGS affect the generated options from OC? Does it replace them or add to them? --Karey ---------------------------------------------------------------- Karey; One of the snippets of sources; cobc/cobc.c [code] p = getenv ("COB_CFLAGS"); if (p) { cobc_add_str (cob_cflags, COB_SMALL_MAX, p, NULL, NULL); } else { cobc_add_str (cob_cflags, COB_SMALL_MAX, COB_CFLAGS, NULL, NULL); } [/code] and [code] #define COB_CFLAGS "-I/usr/local/include -fwrapv -pipe" [/code] So, (umm, I guess I have to add .. I think, but I'd bet money) it replaces the defaults that configure divines, but then adds to the other command line options. Cheers, Brian ---------------------------------------------------------------- Wouldn't it make sense to add the COB_CFLAGS to p (at the end), for not have to set the include path and other stuff every time? human ---------------------------------------------------------------- Subject: Archived posting - Frank Polschei Embedded SQL The OC wiki Todo page (http://www.opencobol.org/modules/bwiki/index.php?Tasks) mentions an old post about Embedded SQL: "Frank Polscheit posted his implementation of SQL preprocessor. (2004-02-17: SQL pre-processor for OPEN-COBOL)" Unfortunately the forum does not seem to go back that far. I have found a copy of the mail (http://sourceforge.net/mailarchive/message.php?msg_name=000701c3f51b%249cdc6f00%240a00a8c0%40ALPHA) but it does not include the attachments of the preprocessor itself that I assume must have been on the original mail. Does anyone have a copy or later version of the preprocessor files please? ---------------------------------------------------------------- Found them, at the bottom of: http://sourceforge.net/mailarchive/forum.php?forum_name=open-cobol-list&max_rows=25&style=nested&viewmonth=200402&viewday=17 ---------------------------------------------------------------- Subject: New Chat, finally working and explained. Howdy Yall. Sorry about the issues we have had recently with the chat from the web. Freenode blocked all access to the mibbit client. So we had to look elsewhere. I've set up an entirely new chat on the Mibbit servers. To chat with us now you can access via any IRC client (mirc, pidgin, iirc, and lots of others) at: Server: irc.mibbit.com Channel: #add1.to (yes the period is required.) From the web you can chat with us at: http://widget2.mibbit.com/?settings=420c8cc09d2c60c997224743c456c5f0&channel=%23add1.to ---------------------------------------------------------------- Subject: PERFORM procedure END-PERFORM - END-PERFORM rejected Shouldn't even the trivial case of "PERFORM procedure" allow the use of END-PERFORM? This program, when compiled: [code] IDENTIFICATION DIVISION. PROGRAM-ID. performtest. PROCEDURE DIVISION. 000-Main. PERFORM 100-Sub END-PERFORM. STOP RUN. 100-Sub. DISPLAY '100-Sub' END-DISPLAY. [/code] generates this message: C:/OpenCobol/testbed.cbl: In paragraph '000-Main': C:/OpenCobol/testbed.cbl:7: Error: syntax error, unexpected "END-PERFORM" cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Aug 05 2009 20:32:54 Packaged Feb 06 2009 10:30:55 CET MinGW/gcc/PDCurses/BDB ---------------------------------------------------------------- By the Standard (or at least the Draft 20xx I read) section 14.9.27.1 PERFORM procedure. PERFORM inline imperative statements END-PERFORM END-PERFORM not being optional or allowed for procedure performs. Cheers, Brian ---------------------------------------------------------------- As btiffin said before, this is a big NONO. (inline and outline performs exists for long time, surely for the 2002 standard and I think in 85, too). human ---------------------------------------------------------------- That's what I thought (I don't have a copy of the standards). Someone needs to tell Unisys - their COBOL85 compiler allows it. :-) ---------------------------------------------------------------- Gary; Bill Klein has been nice enough to keep us up to speed with the Draft releases. Last note I noticed: http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=668&forum=1 Get'em while they are hot...just don't copy it to anyone. Seems to be the wonderful catch-22 of "you can read the draft and use the underlying technical information relatively freely, but the document is copyrighted material". If we want the ISO folks to keep working hard for us, it'll be best (and only fair) that we play nice. Then ... your usage manual might rock the COBOL boat a little, loosen up some of those strings, change the world for the better, get hippies running the world bank and ... [i]oops, sorry[/i] ;) Cheers, Brian ---------------------------------------------------------------- Subject: Add 1 to Cobol mailing list As many of you know, we've had a [terrible] mailing list for Add 1 to Cobol for many months now. It was managed by hand, which made it very difficult for folks to join, leave and so on. Thankfully I've now set up a listserv for the Add 1 to Cobol mailing list. All of those that receive these emails from the add1tocobol@add1tocobol.com mailing list, will need to head over to the new listserv and sign up. Additionally many folks on the OpenCobol forums and listserv may have an interest in the Add 1 to Cobol list. Why? To reiterate our purpose, Add 1 to Cobol is a Cobol Advocacy group, with OpenCobol as our compiler of choice. (The last bit of that is becoming more and more true, considering all of the wonderful work Roger is doing on the compiler, and folks like Seth and Jim and Mark and Brian are doing with addons, and the great docs that are soon to be released the FAQ from Brian and the OpenCobol Manual by Gary. A hearty thanks to every one of yall for the work you do.) So how do we advocate Cobol? Through use mostly. We have a Subversion repository for folks to contribute Free Software to, typically with the GNU GPL License. Vincent has added a lot of his Accounting, we've added some Mysql Libraries, some PHP for interim solutions (for instance Cheap A$$ CMS, which will soon be converted to Cobol) and many other things. The reason thus for the additional mailing list is for discussions of addons, programs written in Cobol and other things OpenCobol related, but not germane to the discussions about the compiler itself. This way our conversations can keep from cluttering the OpenCobol list. So if you would like to contribute, or learn more, participate in discussions of this nature, would like to learn about our Subversion Repostory, and gain access to commits, or just would like to follow our conversations in general, please head to the listserv and sign up at: http://lists.add1.to/listinfo.cgi/opencobol-add1.to Also don't forget about our chats on irc.mibbit.com in #add1.to where we talk about all things OpenCobol related. We're open most of the time, with a steady growing group of regulars again (now that the web front end issues are fixed, Thanks Mibbit!). This Sunday we will be having a special meeting to discuss how we can form teams to help Roger more directly. These discussions will take place over the next four weeks. So be sure to stop by. If you cannot make it on Sundays (details in my signature), then stop in any time throughout the week and let us know what you are thinking. If we don't respond right away, please stick around, and we'll eventually notice you have arrived and strike up a conversation. Many Kind Regards, ---------------------------------------------------------------- Subject: Sunday Aug 23rd Special Add 1 to Cobol meeting Hello all! We will be holding a series of 4 Sunday meetings to put together a team to help Roger by offering our services to him. We will discuss the details starting this next Sunday Aug 23rd at 9am Eastern. Please be sure to check the world clocks online to make sure you are coming in at 9am Eastern. We can be found on IRC at the server irc.mibbit.com and the channel #add1.to. If you are unable to make it Sunday at that time (even if you are able to make it) please stop by during the week. We've a growing list of partners joining us in chat throughout the day now. The more we all get together, the better able we will be to grow this thing. Kind Regards ---------------------------------------------------------------- Do we have a log about the meeting? human ---------------------------------------------------------------- I don't have a log. Basically we ended up discussing the need for a list. Of course database structures are at the top of he list. ---------------------------------------------------------------- Subject: PROCEDURE DIVISION USING I'm moving some cobol from MF to only OpenCCOBOL but, I have a problem with "PROCEDURE DIVISION USING PARM", this because the definition of "PARM" include a 05 level that handle the PARM lenght, this is the definition: [code] 01 PARM. 05 LPARM PIC S9(4) COMP. 05 PARM-PRINT-LOAD PIC X. 88 B-PARM VALUE 'S' 'L' 'A' 'D' 'E' 'I' '1' 'R'. 05 PKEY PIC X(50). [/code] I've seen that I can use USING instead of CHAINING, but CHAINING moves the argument to LPARM not to PARM-PRINT-LOAD. IS there any way to fix this? Thanks in advance, Ricardo ---------------------------------------------------------------- I know in IBM COBOL and I *think* in Micro Focus COBOL, the variation of passign length-then-data for a Linkage Section item, is [u][b]ONLY[/b][/u] valid for passign data to the MAIN program in a run-unit. In IBM COBOL, this is done via a PARM= veature in JCL. Micro Focus provides a similar feature. (Check out the topic "parameter passer" in older MF products.) In "Standard" COBOL having a "linkage section" in a MAIN program is either undefined or invalid. ---------------------------------------------------------------- I'm not sure what you are doing. Please submit the source for the call of the program and the old / new context of your definition. human ---------------------------------------------------------------- COBOL: [code] LINKAGE SECTION. 01 PARM. 05 LPARM PIC S9(4) COMP. 05 PARM-PRINT-LOAD PIC X. 88 B-PARM VALUE 'S' 'L' 'A' 'D' 'E' 'I' '1' 'R'. 05 PKEY PIC X(50). PROCEDURE DIVISION USING PARM. ... [/code] Why I need the parm lenght: [code] ... LISTAR-VSAM-KEY-GFEOP. ADD 1 TO DESPR1 GIVING WDESPL. SUBTRACT 1 FROM LPARM GIVING WLONG. PERFORM UNTIL WLONG = 0 OR PKEY (WLONG:1) NOT = ' ' SUBTRACT 1 FROM WLONG END-PERFORM. ... [/code] ---------------------------------------------------------------- It appears you want to receive an argument of unknown length in your subprogram and then determine how long that argument is with any trailing SPACES removed. Is that correct? If that IS correct, perhaps this will help: [code] IDENTIFICATION DIVISION. PROGRAM-ID. anylength. PROCEDURE DIVISION. 000-Main. CALL 'sub' USING "Arg1". CALL 'sub' USING "A r g 2 ". CALL 'sub' USING " Arg3". STOP RUN. END PROGRAM anylength. IDENTIFICATION DIVISION. PROGRAM-ID. sub. ENVIRONMENT DIVISION. DATA DIVISION. LINKAGE SECTION. 01 Arg PIC X(1) ANY LENGTH. PROCEDURE DIVISION USING Arg. 000-Main. DISPLAY "Parm: '" Arg "'". DISPLAY "Len Minus Traiing Spaces: " FUNCTION LENGTH(FUNCTION TRIM(Arg,Trailing)). GOBACK. END PROGRAM sub. [/code] When executed, the following output will be produced: [code] Parm: 'Arg1' Len Minus Traiing Spaces: 0000000004 Parm: 'A r g 2 ' Len Minus Traiing Spaces: 0000000007 Parm: ' Arg3' Len Minus Traiing Spaces: 0000000012 [/code] ---------------------------------------------------------------- One more time (in case my lst note didn't sink in - as the notes after it imply), At least with IBM and Micro Focus, the technique where you get an 05-level with the length followed by the "actual data" is used in a [u][i][b]COBOL MAIN program[/b][/i][/u] and [u][b]NOT[/b][/u] in a called subprogram. This is a way of getting data from JCL "parms". (This is why Micro Focus calls this facility "parm passer".). This is SIMILAR to using the "command-line" feature in X/Open conforming programs, but is mutually exclusive from it. Any techniques where the a "caller" is used or where the programmer has to specifically supply the length is INCOMPATIBLE with this IBM and MF "main program" technique. OBVIOSUSLY, if the OP is actually asking for something to be used by a "called subprogram" there there are ways to ge around this, but I still think they are asking for the "usual" IBM/MF technique for getting "passed params" into the MAIN COBOL program. ---------------------------------------------------------------- wmklein : Thanks for your answer, I want to tell you that [i]this is the main program[/i], so, do I missing something?, may be an option in cobc? ---------------------------------------------------------------- Maybe you missed that there is no LINKAGE SECTION for main programs? human ---------------------------------------------------------------- Humana, The point is that there SHOULD be (for compatibility sake) a feature for Linkage Section in MAIN programs - when running in IBM or MF mode (possibly others - but not ANSI/ISO conforming). This is a documented and supported feature of both IBM COBOL (for decades) and Micro Focus (when providing mainframe compatibility). NOTE to ricgomez, If you are actually "porting away from" MF or IBM, then you may want to look at the "command-line" feature (defined by X/Open and available in OC). This allows you to ge each parameter from the command-line that invokes your main program. You would need to "rec-doed" your logic, but I *assume* this is the information you are are trying to get. If not, how do you think this "field" in your linkage section actually gets filled in? ---------------------------------------------------------------- OK. Then you could move LPARM to the working storage and use C$PARAMSIZE for setting LPARM. To support this for IBM/MF would be cool anyway. human ---------------------------------------------------------------- Some care is needed when using this facility. The initiators program snippet is wrong on two counts. (1) When no parameter is supplied, LPARM is 0 and the prog will go into an infinite loop (or at least as until any possible wraparound occurs). (2) If you supply parameter(s), then LPARM is the length of these as they are; It does NOT take into account the actual length of the receiving area. That means that (for the snippet), if you specify parameter(s) with length > 51, the prog will be accessing outside of allocated storage. Roger ---------------------------------------------------------------- Subject: Questions to cobxref / OC-FAQ I just had a look at cobxref, this seems to be a fine tool. 1. Can we have a sample output of a more complex program (with both sections and paragraphs)? 2. Why does the output has to be truncated to 72 columns in OC FAQ? 3. Are the following things concerned? - More than 1 program in 1 source file - PERFORM MYSEC1 THRU MYSEC5 - GO TO (from one section to another) - GO TO (from one paragraph to another) 4. Is there still "Active Development" as stated in Feb-09 at the OC FAQ? 5. Why isn't the SVN on SourceForge used (having better statistics than the add1repo)? human ---------------------------------------------------------------- 4. Vincent has been converting many of his Cobol programs to GNU GPL and verifying their ability to compile in OC. These are in the Add 1 repository. Perhaps this is impacting any development on Cobxref? Perhaps it's not had feature requests? 5. The Add 1 repository is all things OpenCobol related, including extensions to the compiler, tools and Cobol programs. So it provides a nice central source for us, a single place for all things we're interested in. As to the statistics, what kind are you looking for? ---------------------------------------------------------------- Looking for all the nice things you can done easily on sf: - stats for read/write to svn (bytes/files) - web access for online reading/downloading files in every version They use [url=http://viewvc.tigris.org/]ViewVC[/url] at sf, maybe you want to install this at add1, too. human ---------------------------------------------------------------- Human, I will check it out. On the other hand Launchpad has been Freed finally. So that might be something to consider? Or various free forms of sourceforge? Thoughts? ---------------------------------------------------------------- Re; [i]1. Can we have a sample output of a more complex program (with both sections and paragraphs)?[/i] I believe that can be set up. I'll run CobXref over CobXref perhaps. Or try and talk to Warren and run it over CobCurses? [i]2. Why does the output has to be truncated to 72 columns in OC FAQ?[/i] I dislike horizontal scroll on web pages. One wide pre section and the entire document goes too wide for my liking. Sorry. Probably won't change. I'm not there yet, but the FAQ .rst source will be on a 79 char line length before it gets published. Cheers, Brian ---------------------------------------------------------------- re; [i]Or various free forms of sourceforge? Thoughts?[/i] COBOLForge! COBOLForge! :) Cheers, Brian p.s. [i]for those that don't know, I've been advocating for a server setup with FusionForge customized for a COBOLForge. Does not come time (or perhaps server side expense) free though.[/i] ---------------------------------------------------------------- Cheers on the 79 char limit on OCFAQ. I likewise hate scrolling wide sites. What about Launchpad Brian? If we were to do CobolForge, I'd really prefer it to be written in cobol. ---------------------------------------------------------------- Subject: Accessing SQL using the cobdbi method We are attempting to use the cobdbi method in the hopes of eventually accessing a MS SQL database. We have followed the instructions given by the FAQ link about SQL databases in OC, but have run into a wall getting the taccess sample to run. When we attempt to compile the taccess sample code as documented in the sample, we get the error below: bill@p3:/usr/local/cobdbi/src/utils$ sudo cobc -x -free -Wall -ldbi -lcobdbi -I ../copybk taccess.cob /usr/bin/ld: cannot find -lcobdbi So we added the library path to the the compile command and get unresolved references: bill@p3:/usr/local/cobdbi/src/utils$ sudo cobc -x -free -Wall -ldbi -lcobdbi -I ../copybk -L ../lib taccess.cob ../lib/libcobdbi.so: undefined reference to `dbi_result_free' ../lib/libcobdbi.so: undefined reference to `dbi_result_get_float' ../lib/libcobdbi.so: undefined reference to `dbi_result_get_field_name' ../lib/libcobdbi.so: undefined reference to `dbi_result_get_field_length_idx' ../lib/libcobdbi.so: undefined reference to `dbi_conn_close' ../lib/libcobdbi.so: undefined reference to `dbi_initialize' ../lib/libcobdbi.so: undefined reference to `dbi_conn_connect' ../lib/libcobdbi.so: undefined reference to `dbi_result_get_short' ../lib/libcobdbi.so: undefined reference to `dbi_result_get_uint' ../lib/libcobdbi.so: undefined reference to `dbi_result_get_uchar' ../lib/libcobdbi.so: undefined reference to `dbi_result_get_string' ../lib/libcobdbi.so: undefined reference to `dbi_result_get_datetime' ../lib/libcobdbi.so: undefined reference to `dbi_result_next_row' ../lib/libcobdbi.so: undefined reference to `dbi_result_get_longlong' ../lib/libcobdbi.so: undefined reference to `dbi_result_get_double' ../lib/libcobdbi.so: undefined reference to `dbi_conn_set_option' ../lib/libcobdbi.so: undefined reference to `dbi_conn_new' ../lib/libcobdbi.so: undefined reference to `dbi_result_get_int' ../lib/libcobdbi.so: undefined reference to `dbi_result_get_ulonglong' ../lib/libcobdbi.so: undefined reference to `dbi_result_get_field_length' ../lib/libcobdbi.so: undefined reference to `dbi_result_get_char' ../lib/libcobdbi.so: undefined reference to `dbi_result_get_ushort' ../lib/libcobdbi.so: undefined reference to `dbi_conn_queryf' collect2: ld returned 1 exit status What are we missing? ---------------------------------------------------------------- This is actually a generic linker FAQ. Let's reduce it it to a simple example using gcc. gcc -o myprog myprog.c -ldbi -lcobdbi -L ../lib That will not work. You need to specify the library location before the libraries themselves - gcc -o myprog myprog.c -L ../lib -ldbi -lcobdbi Now this is NOT necessary in OC. The OC compile rearranges things such that any "-L" come before the "-l". So, still does not work. You need to specify the libraries IN THE ORDER in which entry points are resolved. gcc -o myprog myprog.c -L ../lib -lcobdbi -ldbi ie. "cobdbi" depends on "dbi" and therefore must be specified in this order. One final point - When specifying directories (the "-L") I would recommend using full path names. Otherwise, on some systems, you may get problems at runtime. Roger ---------------------------------------------------------------- Subject: Question: How to detect eof on accept Question: How do you detect the end of file (Ctrl+D) on an accept statement? This is for piping from sysin ---------------------------------------------------------------- See - http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=610&forum=1#forumpost3114 Roger ---------------------------------------------------------------- Roger, I read the referenced thread and it SEEMS to confirm what I thought, i.e. There is [u][i][b]NO[/b][/i][/u] way to detect EOF if you are using ACCEPT. You must use a "file" (defined in Select/Asssign) and use OPEN,, READ, CLOSE syntax. That is what I thought was true (for most? all?) COBOL's, but can you confirm that this is what is true with OC? ---------------------------------------------------------------- It is TRUE that the ACCEPT verb cannot detect an end-of-file condition. SELECT a file and ASSIGN it to KEYBOARD and you'll be in business. ---------------------------------------------------------------- Why shouldn't UNSTRING work? ---------------------------------------------------------------- Won't the input field be all spaces on an EOF? It is on Windows using a MinGW build of OpenCOBOL. ---------------------------------------------------------------- YOu certaainly MAY get "all spaces" if you do an ACCEPT *after* EOF, but you will also get "all spaces" if there is a bunch of (enough) spaces in the middle of the ACCEPT input. As far as "unstring" goes, it assumes that you will get an EOF indicator in the middle of the ACCEPTed input. At least with some systems (I don't know about OC), this won't happen. You will get the data UP TO the eof indicator and the rest will be space filled. ---------------------------------------------------------------- Subject: Anyone interested earning a few extra dollars? You're missing a lot of information in this post. Are you asking for someone to write your assignment for you? Seriously? Or are you just asking for some help on the application you are already writing? If the first I hate to break it to you, but most of the Cobolers are going to be making too much money to make it worth our while to help a student cheat at his work. The rest of us have too much integrity to do so. ---------------------------------------------------------------- Hi, I'm a student that has an excercise due Monday, been working on it but just stumped and am running out of time! Anyone interested in compiling a simple excercise for a few extra dollars? If so please pm me. Thanks ---------------------------------------------------------------- Subject: FR to warning of wrong typed FUNCTION Because of misspelling upper-case, I recognized two very small issues. OC always writes "Error: FUNCTION xyz not implemented", if there is an unknown FUNCTION. Sample: [code]function UPpercase(w)[/code] leads to [quote]Error: FUNCTION UPpercase not implemented[/quote] FR1: Always upper-case the function name in the output [quote]Error: FUNCTION [b]UPPERCASE[/b] not implemented[/quote] FR2: Because of (most/all?) FUNCTION from 2009 draft are implemented, it could be better to use something like [quote]Error: FUNCTION UPPERCASE [b]unknown[/b][/quote] at least for all FUNCTIONs that are non standard. human ---------------------------------------------------------------- Subject: FR: Implement 'ACCEPT .. FROM ESCAPE KEY' Because of OC supporting escape keys now, it would be nice to have 'ACCEPT .. FROM ESCAPE KEY' working. Modified sample prog (showing the support for escape keys in general and the missing FROM ESCAPE KEY), [code] >>SOURCE FORMAT IS FREE identification division. program-id. ROGERS. *> *> Specially Built For Accept Statement Playing ;-D *> environment division. configuration section. data division. working-storage section. 01 w pic X(001). 01 funkey pic 9(04). procedure division. debut. display "TESTING Function Keys" *> I'm sure that this text is displayed line 03 column 33 with *> at the right line/col position foreground-color 1 background-color 7 blank screen end-display . *> use ACCEPT .. ON EXCEPTION first perform with test after until function upper-case(w) = "Q" display "Enter something : " line 10 col 32 with erase eos *> WITH ERASE EOS is nice, bacause foreground-color 1 *> we do not have to blank the screen background-color 7 *> ourself with DISPLAY SPACES end-display display "(quit with entering 'Q')" line 10 col 52 with foreground-color 1 background-color 7 end-display accept w line 10 column 50 with foreground-color 2 background-color 7 prompt reverse-video auto on exception perform except-key not on exception perform normal-key end-accept end-perform call "C$SLEEP" using "1" end-call *> use ACCEPT .. ON ESCAPE now (should be the same as ON EXCEPTION) perform with test after until function upper-case(w) = "Q" display "Enter something : " line 10 col 32 with erase eos foreground-color 1 background-color 7 end-display display "(quit with entering 'Q')" line 10 col 52 with foreground-color 1 background-color 7 end-display accept w line 10 column 50 with foreground-color 2 background-color 7 prompt reverse-video auto on exception perform except-key not on exception perform normal-key end-accept end-perform call "C$SLEEP" using "1" end-call *> now try ACCEPT .. FROM ESCAPE KEY display "Use some escape key: " line 10 col 32 with erase eos foreground-color 1 background-color 7 end-display accept funkey from escape key end-accept display funkey line 12 col 46 with foreground-color 7 background-color 4 highlight end-display call "C$SLEEP" using "1" end-call go to fin. . except-key. move COB-CRT-STATUS to funkey *> Special word display "Exception Key = " line 12 column 36 end-display display funkey line 12 col 50 with foreground-color 7 background-color 4 highlight end-display call "C$SLEEP" using "2" end-call . normal-key. move COB-CRT-STATUS to funkey display "Normal Key = " line 12 column 36 end-display display funkey line 12 col 50 with foreground-color 7 background-color 2 highlight end-display display "Key value = " line 13 column 36 end-display display w line 13 col 50 with foreground-color 7 background-color 2 highlight end-display call "C$SLEEP" using "2" end-call . fin. display "GAME OVER!" line 24 column 36 with foreground-color 7 background-color 4 highlight bell BLANK LINE end-display call "C$SLEEP" using "4" end-call . ultime. exit program.[/code] human ---------------------------------------------------------------- Subject: IBM announces new release of Enterprise COBOL For those interested in IBM compatibility, IBM just announced their latest release of Enterprise COBOL. See: [url=http://www-01.ibm.com/common/ssi/rep_ca/4/897/ENUS209-244/ENUS209-244.PDF]http://www-01.ibm.com/common/ssi/rep_ca/4/897/ENUS209-244/ENUS209-244.PDF[/url] Among other things, they (finally) will allow underscores in user-defined words!!! ---------------------------------------------------------------- [quote] wmklein wrote: For those interested in IBM compatibility, IBM just announced their latest release of Enterprise COBOL.[/quote] What I still don't see is 64-bit support :-) ---------------------------------------------------------------- Subject: FR: add origin of error when cobc_terminate is called If hard errors occur in cobc, cobc_terminate is called which outputs the error. Sometimes the error alone does not help, therefore it would be nice to output the origin of the error, too. human ---------------------------------------------------------------- Subject: FR (FIX submitted): Output exit codes of extrnal compilers when using cobc -v I found a useful patch from Cobol-*T. It outputs exit codes when cobc is in verbose mode. Patch for taking this into OC, [code]--- cobc/cobc.origin.c Sun Feb 01 11:16:48 2009 +++ cobc/cobc.c Thu Aug 27 10:42:26 2009 @@ -1096,14 +1108,19 @@ char *p; char *buffptr; size_t clen; - int ret; + int ret; char buff[COB_MEDIUM_BUFF]; if (strchr (cmd, '$') == NULL) { if (verbose_output) { - fprintf (stderr, "%s\n", (char *)cmd); + fprintf (stderr, "calling: %s\n", (char *)cmd); } - return system (cmd); + fflush(stderr); + ret = system (cmd); + if (verbose_output) { + fprintf (stderr, "Exit code from call: %d\n",ret); + } + return ret; } clen = strlen (cmd) + 32; if (clen > COB_MEDIUM_BUFF) { @@ -1123,9 +1140,13 @@ *p = 0; if (verbose_output) { - fprintf (stderr, "%s\n", buffptr); + fprintf (stderr, "calling: %s\n", buffptr); } + fflush(stderr); ret = system (buffptr); + if (verbose_output) { + fprintf (stderr, "Exit code from call: %d\n",ret); + } if (buffptr != buff) { free (buffptr); } [/code] human ---------------------------------------------------------------- Subject: BUG (FIX submitted) cobc.h: no support of -L and -l for MSVC, libraries with spaces in general I just recognized that it wasn't possible to pass -l or -L to MSVC. In cobc.h, we need the following fix to pass libs to MSVC (dont use -l, use quotes to escape the filepath [should be fine for gcc, too]), [code] case 'l': #ifdef _MSC_VER strcat (cob_libs, " \""); #else strcat (cob_libs, " -l\""); #endif strcat (cob_libs, optarg); strcat (cob_libs, "\""); break;[/code] The harder thing is the use of -L. For every entry we need to add /LIBPATH:"entry" (no prob) and all /LIBPATHs have to stand at the end of cl call with /link before. Therefore we need to split -l to cob_libs and -L to a new var cob_lib_paths. For cobc.h (the bolded parts are necessary for the fix), [code]--- cobc/cobc.origin.c Sun Feb 01 11:16:48 2009 +++ cobc/cobc.c Thu Aug 27 10:42:26 2009 @@ -295,7 +295,8 @@ static const char *cob_cc; /* gcc */ static char cob_cflags[COB_SMALL_BUFF]; /* -I... */ [b]-static char cob_libs[COB_MEDIUM_BUFF]; /* -L... -lcob */ +static char cob_libs[COB_MEDIUM_BUFF]; /* -l... */ +static char cob_lib_paths[COB_MEDIUM_BUFF]; /* -L... */[/b] static char cob_define_flags[COB_SMALL_BUFF]; /* -D... */ static const char *cob_ldflags; static const char *cob_copy_dir; @@ -800,13 +801,23 @@ break; case 'L': [b]- strcat (cob_libs, " -L"); - strcat (cob_libs, optarg); +#ifdef _MSC_VER + strcat (cob_lib_paths, " /LIBPATH:\""); +#else + strcat (cob_lib_paths, " -L\""); +#endif + strcat (cob_lib_paths, optarg); + strcat (cob_lib_paths, "\""); break; case 'l': - strcat (cob_libs, " -l"); +#ifdef _MSC_VER + strcat (cob_libs, " \""); +#else + strcat (cob_libs, " -l\""); +#endif strcat (cob_libs, optarg); + strcat (cob_libs, "\""); break;[/b] case 'e': @@ -1070,15 +1081,16 @@ } else if (output_name && cb_compile_level == CB_LEVEL_ASSEMBLE) { fn->object = strdup (output_name); } else if (save_temps || cb_compile_level == CB_LEVEL_ASSEMBLE) { - fn->object = cobc_malloc (strlen (basename) + 5); #ifdef _MSC_VER + fn->object = cobc_malloc (strlen (basename) + 7); sprintf (fn->object, "%s.obj", basename); #else + fn->object = cobc_malloc (strlen (basename) + 5); sprintf (fn->object, "%s.o", basename); #endif } else { #ifdef _MSC_VER - fn->object = cobc_malloc (strlen (basename) + 5); + fn->object = cobc_malloc (strlen (basename) + 7); sprintf (fn->object, "%s.obj", basename); #else fn->object = cobc_temp_name (".o"); @@ -1096,14 +1108,19 @@ char *p; char *buffptr; size_t clen; - int ret; + int ret; char buff[COB_MEDIUM_BUFF]; if (strchr (cmd, '$') == NULL) { if (verbose_output) { - fprintf (stderr, "%s\n", (char *)cmd); + fprintf (stderr, "calling: %s\n", (char *)cmd); } - return system (cmd); + fflush(stderr); + ret = system (cmd); + if (verbose_output) { + fprintf (stderr, "Exit code from call: %d\n",ret); + } + return ret; } clen = strlen (cmd) + 32; if (clen > COB_MEDIUM_BUFF) { @@ -1123,9 +1140,13 @@ *p = 0; if (verbose_output) { - fprintf (stderr, "%s\n", buffptr); + fprintf (stderr, "calling: %s\n", buffptr); } + fflush(stderr); ret = system (buffptr); + if (verbose_output) { + fprintf (stderr, "Exit code from call: %d\n",ret); + } if (buffptr != buff) { free (buffptr); } @@ -1123,9 +1140,13 @@ } #ifdef _MSC_VER sprintf (buff, gflag_set ? - "%s /c %s %s /Od /MDd /Zi /FR /c /Fa%s /Fo%s %s" : - "%s /c %s %s /MD /c /Fa%s /Fo%s %s", + "%s /c %s %s /Od /MDd /Zi /FR /c /Fa\"%s\" /Fo\"%s\" \"%s\"" : + "%s /c %s %s /MD /c /Fa\"%s\" /Fo\"%s\" \"%s\"", cob_cc, cob_cflags, cob_define_flags, name, name, fn->translate); #else @@ -1390,8 +1411,8 @@ } #ifdef _MSC_VER sprintf (buff, gflag_set ? - "%s /c %s %s /Od /MDd /Zi /FR /c /Fa%s /Fo%s %s" : - "%s /c %s %s /MD /c /Fa%s /Fo%s %s", + "%s /c %s %s /Od /MDd /Zi /FR /c /Fa\"%s\" /Fo\"%s\" \"%s\"" : + "%s /c %s %s /MD /c /Fa\"%s\" /Fo\"%s\" \"%s\"", cob_cc, cob_cflags, cob_define_flags, name, name, fn->translate); #else @@ -1408,8 +1429,8 @@ #ifdef _MSC_VER sprintf (buff, gflag_set ? - "%s /c %s %s /Od /MDd /Zi /FR /Fo%s %s" : - "%s /c %s %s /MD /Fo%s %s", + "%s /c %s %s /Od /MDd /Zi /FR /Fo\"%s\" \"%s\"" : + "%s /c %s %s /MD /Fo\"%s\" \"%s\"", cob_cc, cob_cflags, cob_define_flags, fn->object, fn->translate); #else @@ -1451,23 +1472,35 @@ } #ifdef _MSC_VER [b] sprintf (buff, gflag_set ? - "%s %s %s /Od /MDd /LDd /Zi /FR /Fe%s /Fo%s %s %s %s" : - "%s %s %s /MD /LD /Fe%s /Fo%s %s %s %s", + "%s %s %s /Od /MDd /LDd /Zi /FR /Fe\"%s\" /Fo\"%s\" %s \"%s\" %s /link %s" : + "%s %s %s /MD /LD /Fe\"%s\" /Fo\"%s\" %s \"%s\" %s /link %s", cob_cc, cob_cflags, cob_define_flags, name, name, - cob_ldflags, fn->translate, cob_libs); + cob_ldflags, fn->translate, cob_libs, cob_lib_paths);[/b] ret = process (buff); #if _MSC_VER >= 1400 /* Embedding manifest */ if (ret == 0) { - sprintf (buff, "mt /manifest %s.dll.manifest /outputresource:%s.dll;#2", name, name); + if (verbose_output) { + sprintf (buff, "mt /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); + } else { + sprintf (buff, "mt /nologo /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); + } ret = process (buff); + sprintf (buff, "%s.dll.manifest", name); + cobc_check_action (buff); } #endif + sprintf (buff, "%s.exp", name); + cobc_check_action (buff); + sprintf (buff, "%s.lib", name); + cobc_check_action (buff); + sprintf (buff, "%s.obj", name); + cobc_check_action (buff); #else /* _MSC_VER */ [b]- sprintf (buff, "%s %s %s %s %s %s %s %s -o %s %s %s", + sprintf (buff, "%s %s %s %s %s %s %s %s -o "%s" "%s" %s %s", cob_cc, gccpipe, cob_cflags, cob_define_flags, COB_SHARED_OPT, cob_ldflags, COB_PIC_FLAGS, COB_EXPORT_DYN, name, - fn->translate, cob_libs); + fn->translate, cob_libs, cob_lib_paths);[/b] ret = process (buff); #ifdef COB_STRIP_CMD if (strip_output && ret == 0) { @@ -1501,21 +1534,33 @@ } #ifdef _MSC_VER [b] sprintf (buff, gflag_set ? - "%s /Od /MDd /LDd /Zi /FR /Fe%s %s %s %s" : - "%s /MD /LD /Fe%s %s %s %s", - cob_cc, name, cob_ldflags, fn->object, cob_libs); + "%s /Od /MDd /LDd /Zi /FR /Fe\"%s\" %s \"%s\" %s /link %s" : + "%s /MD /LD /Fe\"%s\" %s \"%s\" %s %s /link %s", + cob_cc, name, cob_ldflags, fn->object, cob_libs, cob_lib_paths);[/b] ret = process (buff); #if _MSC_VER >= 1400 /* Embedding manifest */ if (ret == 0) { - sprintf (buff, "mt /manifest %s.dll.manifest /outputresource:%s.dll;#2", name, name); + if (verbose_output) { + sprintf (buff, "mt /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); + } else { + sprintf (buff, "mt /nologo /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); + } ret = process (buff); + sprintf (buff, "%s.dll.manifest", name); + cobc_check_action (buff); } #endif + sprintf (buff, "%s.exp", name); + cobc_check_action (buff); + sprintf (buff, "%s.lib", name); + cobc_check_action (buff); + sprintf (buff, "%s.obj", name); + cobc_check_action (buff); #else /* _MSC_VER */ [b]- sprintf (buff, "%s %s %s %s %s %s -o %s %s %s", + sprintf (buff, "%s %s %s %s %s %s -o "%s" "%s" %s %s", cob_cc, gccpipe, COB_SHARED_OPT, cob_ldflags, COB_PIC_FLAGS, - COB_EXPORT_DYN, name, fn->object, cob_libs); + COB_EXPORT_DYN, name, fn->object, cob_libs, cob_lib_paths);[/b] ret = process (buff); #ifdef COB_STRIP_CMD if (strip_output && ret == 0) { @@ -1549,8 +1596,9 @@ objsptr = objs; } for (f = l; f; f = f->next) { + strcat (objsptr, "\""); strcat (objsptr, f->object); - strcat (objsptr, " "); + strcat (objsptr, "\" "); } if (output_name) { @@ -1581,21 +1629,35 @@ #ifdef _MSC_VER [b] sprintf (buff, gflag_set ? - "%s /Od /MDd /LDd /Zi /FR /Fe%s %s %s %s" : - "%s /MD /LD /Fe%s %s %s %s", - cob_cc, name, cob_ldflags, objsptr, cob_libs); + "%s /Od /MDd /LDd /Zi /FR /Fe\"%s\" %s %s %s /link %s" : + "%s /MD /LD /Fe\"%s\" %s %s %s /link %s", + cob_cc, name, cob_ldflags, objsptr, cob_libs, cob_lib_paths);[/b] ret = process (buff); #if _MSC_VER >= 1400 /* Embedding manifest */ if (ret == 0) { - sprintf (buff, "mt /manifest %s.dll.manifest /outputresource:%s.dll;#2", name, name); + if (verbose_output) { + sprintf (buff, "mt /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); + } else { + sprintf (buff, "mt /nologo /manifest \"%s.dll.manifest\" /outputresource:\"%s.dll\";#2", name, name); + } ret = process (buff); + sprintf (buff, "%s.dll.manifest", name); + cobc_check_action (buff); } #endif + sprintf (buff, "%s.exp", name); + cobc_check_action (buff); + sprintf (buff, "%s.lib", name); + cobc_check_action (buff); + for (f = l; f; f = f->next) { + sprintf (buff, "%s.obj", f->object); + cobc_check_action (buff); + } #else /* _MSC_VER */ [b]- sprintf (buffptr, "%s %s %s %s %s %s -o %s %s %s", + sprintf (buffptr, "%s %s %s %s %s %s -o "%s" %s %s %s", cob_cc, gccpipe, COB_SHARED_OPT, cob_ldflags, COB_PIC_FLAGS, - COB_EXPORT_DYN, name, objsptr, cob_libs); + COB_EXPORT_DYN, name, objsptr, cob_libs, cob_lib_paths);[/b] ret = process (buffptr); #ifdef COB_STRIP_CMD if (strip_output && ret == 0) { @@ -1629,8 +1691,9 @@ objsptr = objs; } for (f = l; f; f = f->next) { + strcat (objsptr, "\""); strcat (objsptr, f->object); - strcat (objsptr, " "); + strcat (objsptr, "\" "); } if (output_name) { @@ -1649,21 +1712,28 @@ } #ifdef _MSC_VER [b] sprintf (buff, gflag_set ? - "%s /Od /MDd /Zi /FR /Fe%s %s %s %s" : - "%s /MD /Fe%s %s %s %s", - cob_cc, name, cob_ldflags, objsptr, cob_libs); + "%s /Od /MDd /Zi /FR /Fe\"%s\" %s %s %s /link %s" : + "%s /MD /Fe\"%s\" %s %s %s /link %s", + cob_cc, name, cob_ldflags, objsptr, cob_libs, cob_lib_paths);[/b] ret = process (buff); #if _MSC_VER >= 1400 /* Embedding manifest */ if (ret == 0) { - sprintf (buff, "mt /manifest %s.exe.manifest /outputresource:%s.exe;#2", name, name); + if (verbose_output) { + sprintf (buff, "mt /manifest \"%s.exe.manifest\" /outputresource:\"%s.exe\";#2", name, name); + } else { + sprintf (buff, "mt /nologo /manifest \"%s.exe.manifest\" /outputresource:\"%s.exe\";#2", name, name); + } ret = process (buff); + sprintf (buff, "%s.exe.manifest", name); + cobc_check_action (buff); } #endif + #else /* _MSC_VER */ [b]- sprintf (buffptr, "%s %s %s %s -o %s %s %s", + sprintf (buffptr, "%s %s %s %s -o "%s" %s %s %s", cob_cc, gccpipe, cob_ldflags, COB_EXPORT_DYN, name, - objsptr, cob_libs); + objsptr, cob_libs, cob_lib_paths);[/b] ret = process (buffptr); #ifdef __hpux @@ -1748,9 +1818,11 @@ sprintf (buff, "TMPDIR=%s", p); p = strdup (buff); putenv (p); +#ifndef _WIN32 } else { cob_tmpdir = "/tmp"; putenv ((char *)"TMPDIR=/tmp"); +#endif } cob_cc = getenv ("COB_CC"); if (cob_cc == NULL) { @@ -1757,7 +1829,16 @@ cob_cc = COB_CC; } cobc_init_var (cob_cflags, "COB_CFLAGS", COB_CFLAGS); + cobc_init_var (cob_libs, "COB_LIBS", COB_LIBS); + // make sure the old COB_LDADD still works by adding it to cob_libs + p = getenv ("COB_LDADD"); + if (p) { + strcat (cob_libs, " "); + strcat (cob_libs, p); + } + [b]+ cobc_init_var (cob_lib_paths, "COB_LIB_PATHS", COB_LIB_PATHS);[/b] cob_ldflags = getenv ("COB_LDFLAGS"); if (cob_ldflags == NULL) { cob_ldflags = COB_LDFLAGS; @@ -1771,12 +1852,6 @@ cob_copy_dir = COB_COPY_DIR; } memset (cob_define_flags, 0, sizeof (cob_define_flags)); - - p = getenv ("COB_LDADD"); - if (p) { - strcat (cob_libs, " "); - strcat (cob_libs, p); - } p = getenv ("COB_EBCDIC"); if (p && (*p == 'F' || *p == 'f')) { alt_ebcdic = 1; @@ -1815,6 +1890,11 @@ /* Defaults are set here */ if (!cb_flag_syntax_only) { + #ifdef _MSC_VER + if (!verbose_output) { + strcat (cob_cflags, " /nologo"); + } + #endif if (!wants_nonfinal) { if (cb_flag_main) { cb_compile_level = CB_LEVEL_EXECUTABLE; [/code] For defaults.h (on WIN systems, UNIX should be done by ./configure), [code]#define COB_LIBS "\"libcob.lib\" \"gmp.lib\"" #define COB_LIB_PATHS "/LIBPATH:\"C:\\open-cobol-1.1\\build_windows\\win32\\Release\" /LIBPATH:\"C:\\open-cobol-1.1\\build_windows\\win32\""[/code] This fix was tested on MSVC, unix + gcc has to be done, too. I surely missed to adjust bufflen and others to the new lengths. human ---------------------------------------------------------------- Sounds like a plan. My development branch cobc.c is somewhat changed, so I will review and merge as appropiate along with other posted stuff. Incidentally, we should also cater for spaces in the file name :-) I will also cater for this. eg. cobc -x "silly name.cob" producing an executable silly name (on Posix) and silly name.exe (On Win) Of course, save_temps, -C and all the rest should also work appropiately. ie. silly name.c silly name.c.h etc. Roger ---------------------------------------------------------------- Subject: FR for cobc: output "Error: XYZ header missing" instead of "expecting end of file" A missing INPUT-OUTPUT SECTION is errored fine, [quote]Error: NPUT-OUTPUT SECTION header missing[/quote] On many others, [quote]Error: syntax error, unexpected XYZ, expecting end of file[/quote] DATA DIVISION, [quote]Error: syntax error, unexpected WORKING-STORAGE, expecting end of file[/quote] instead of [quote]Error: DATA DIVISION header missing[/quote] ENVIRONMENT DIVISION, [quote]Error: syntax error, unexpected CONFIGURATION, expecting end of file[/quote] instead of [quote]Error: ENVIRONMENT DIVISION header missing[/quote] CONFIGURATION SECTION, [quote]Error: syntax error, unexpected SPECIAL-NAMES, expecting end of file[/quote] instead of [quote]Error: CONFIGURATION SECTION header missing[/quote] INPUT-OUTPUT SECTION, [quote]Error: syntax error, unexpected SELECT, expecting end of file[/quote] instead of [quote]Error: INPUT-OUTPUT SECTION header missing[/quote] Can you please fix these messages? Thx! human ---------------------------------------------------------------- Something like this ? - [code] PROGRAM-ID. nohdr. SOURCE-COMPUTER. LINUX WITH DEBUGGING MODE. SPECIAL-NAMES . SYMBOLIC NL IS 101 NL2 102 NUMERIC SIGN TRAILING SEPARATE DECIMAL-POINT IS COMMA . SELECT PRINT-FILE ASSIGN "EXTRXW" ORGANIZATION LINE SEQUENTIAL . DATA DIVISION. FD PRINT-FILE EXTERNAL. 01 PRINT-REC PIC X(64). DISPLAY "Silly Syntax" END-DISPLAY GOBACK . [/code] [code] cobc -x -std=mf nohdr.cob nohdr.cob:2: Warning: ENVIRONMENT DIVISION header missing - assumed nohdr.cob:2: Warning: CONFIGURATION SECTION header missing - assumed nohdr.cob:10: Warning: INPUT-OUTPUT SECTION header missing - assumed nohdr.cob:10: Warning: FILE-CONTROL header missing - assumed nohdr.cob:14: Warning: FILE SECTION header missing - assumed nohdr.cob:21: Warning: PROCEDURE DIVISION header missing - assumed [/code] [code] cobc -x nohdr.cob nohdr.cob:2: Error: ENVIRONMENT DIVISION header missing nohdr.cob:2: Error: CONFIGURATION SECTION header missing nohdr.cob:10: Error: INPUT-OUTPUT SECTION header missing nohdr.cob:10: Error: FILE-CONTROL header missing nohdr.cob:14: Error: FILE SECTION header missing nohdr.cob:21: Error: PROCEDURE DIVISION header missing [/code] Note you can only go so far with missing headers because of uniqueness constraints. So, in order to skip the PROCEDURE div, you MUST have a statement. You CANNOT have a section/paragraph. That's not parsable. As long as at least one statement is present, then, thereafter you may use sections/paragraphs. This is in line with what Micro Focus allows. Roger ---------------------------------------------------------------- Yes, something like this. It isn't implemented in latest tarball but seems to come in next one, right? human ---------------------------------------------------------------- Sure, will be in next tarball. Still trying to catch up with all your posts :-) As a side effect of the parser reorg, we can, for a simple program (not nested/contained, multi-source, etc.) do without the PROGRAM-ID as well. In this case we take the base name of the input source file. So - Hello World.cob (No misprint, there is a space in there) [code] DISPLAY "Hello World". [/code] [code] # cobc -x -std=mf -free "Hello World.cob" Hello World.cob:1: Warning: PROCEDURE DIVISION header missing - assumed # ./Hello\ World Hello World [/code] And it's callable as a module - mymain.cob - [code] CALL "Hello World". [/code] [code] # cobc -x -std=mf -free mymain.cob mymain.cob:1: Warning: PROCEDURE DIVISION header missing - assumed # cobc -m -std=mf -free "Hello World.cob" Hello World.cob:1: Warning: PROCEDURE DIVISION header missing - assumed # ./mymain Hello World [/code] Roger ---------------------------------------------------------------- Subject: Bug (part-FIX submitted by Roger): Missing runtime error when accessing var(0:1) [code] IDENTIFICATION DIVISION. PROGRAM-ID. TESTOOB. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 77 indexstring pic x(10). 77 omitted-var pic x. 77 indexzaehler pic 9(02). PROCEDURE DIVISION. 100-Main. move 'bbbbbbbbbb' to indexstring display indexstring end-display move 0 to indexzaehler move 'a' to indexstring(indexzaehler:1) display indexstring end-display move 20 to indexzaehler move 'a' to indexstring(indexzaehler:1) display indexstring end-display accept OMITTED-var end-accept stop run.[/code] [code]cobc -debug -W -Wtruncate -Wlinkage -Wunreachable -Wterminator TESTDOW.cob[/code] There occurs NO error, just a display of bbbbbbbbbb 3 times (both the 2nd [index 0=too small] and 3rd [index 20=too big] should produce a runtime error). This is a quite heavy bug, isn't it? human ---------------------------------------------------------------- Yep, yep it is. And from what I can tell, it's skipping the cob_check_ref_mod() debug C code emit on write, but not on a fetch. [code] display indexstring(indexzaehler:) end-display [/code] with -debug gives: [code] bbbbbbbbbb refmod2.cob:15: libcob: Offset of 'indexstring' out of bounds: 0 [/code] Cheers, Brian ---------------------------------------------------------------- Quick fix for this particular problem is in cobc/typeck.c. Pop in this block of code in the function cb_build_move after the if (CB_EXCEPTION_ENABLE (COB_EC_BOUND_SUBSCRIPT)) { block and before the /* Output optimal code */ comment - [code] if (CB_EXCEPTION_ENABLE (COB_EC_BOUND_REF_MOD)) { if (CB_REFERENCE_P (src) && CB_REFERENCE (src)->check) { return cb_build_move_call (src, dst); } if (CB_REFERENCE_P (dst) && CB_REFERENCE (dst)->check) { return cb_build_move_call (src, dst); } } [/code] Roger ---------------------------------------------------------------- I'm longing for the next pre release (actually I installed a cron job for checking the tarball). How long do you think we have to wait (to get good tarball is always better than a fast one)? human ---------------------------------------------------------------- The submitted patch works only for the first part [code] move 0 to indexzaehler move 'a' to indexstring(indexzaehler:1)[/code][quote]libcob: Offset of 'indexstring' out of bounds: 0[/quote] but not for the second part[code] move 20 to indexzaehler move 'a' to indexstring(indexzaehler:1)[/code] human ---------------------------------------------------------------- Subject: error while compiling in ubuntu 9.04 /usr/bin/ld: cannot find -lncurses ---------------------------------------------------------------- I can only guess: You tried to compile OC, right? I guess you did ./configure and there was no error? Some more information needed (don't forget to tell us the version of OC you're trying to compile. human ---------------------------------------------------------------- I've just compiled OC successfully on Ubuntu 9.04. I have both libncurses5 and libncurses5-dev installed. ---------------------------------------------------------------- sudo apt-get install ncurses-dev I had to install the -dev of several libraries for OC to compile on my 9.04. Give that a try and if something else prevents compile try sudo apt-get install library-in-question-dev Cheers ---------------------------------------------------------------- Subject: BUG: UNSTRING with multiple variable length fields Bug found in opencobol-1.0, opencobol-1.1 and cobol-it. UNSTRING using multiple delimiters of variable length gives incorrect results due to a bug between libcob/strings.c and the cobc precompiler. When using fixed length records each fields has a permanent cob_field structure which gets passed to cob_unstring_delimiter to add to the list of delimiters. Variable length records are substituted with a temporary cob_field record for cob_unstring_delimiter by the cobc precompiler. Using two variable length delimiters in unstring results in two cob_unstring_delimiter calls using the same temporary structure, overwritten with the field data for the last delimiter. This cobol program illustrates the point, and below is a little patch for libcob/strings.c that overcomes the problem with a little deep copy. Don't know whether this is the correct solution. [code] IDENTIFICATION DIVISION. PROGRAM-ID. unstr. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 BLOB PIC X(20) VALUE 'ABCDEFGHI'. 01 FIRST-MATCH PIC X(10). 01 SECOND-MATCH PIC X(10). 01 FIRST-DELIM PIC X(3) VALUE 'ABC'. 01 SECOND-DELIM PIC X(3) VALUE 'GHI'. 01 FIRST-DELIM-HOLD PIC X(3). 01 SECOND-DELIM-HOLD PIC X(3). 01 V-FIRST-DELIM-LEN PIC 99. 01 V-SECOND-DELIM-LEN PIC 99. 01 V-FIRST-DELIM. 03 V-FIRST-DELIM-CH PIC X OCCURS 1 TO 30 DEPENDING ON V-FIRST-DELIM-LEN. 01 V-SECOND-DELIM. 03 V-SECOND-DELIM-CH PIC X OCCURS 1 TO 30 DEPENDING ON V-SECOND-DELIM-LEN. PROCEDURE DIVISION. MOVE LENGTH OF FIRST-DELIM TO V-FIRST-DELIM-LEN. STRING FIRST-DELIM DELIMITED BY SIZE INTO V-FIRST-DELIM. MOVE LENGTH OF SECOND-DELIM TO V-SECOND-DELIM-LEN. STRING SECOND-DELIM DELIMITED BY SIZE INTO V-SECOND-DELIM. DISPLAY "Looking for text in '" BLOB "' between '" FIRST-DELIM "' and '" SECOND-DELIM "'.". DISPLAY SPACES. DISPLAY "Fixed length fields:" DISPLAY "---------------------------------------------------". DISPLAY " FIRST-DELIM: |" FIRST-DELIM "|". DISPLAY " SECOND-DELIM: |" SECOND-DELIM "|". DISPLAY " Length of FIRST-DELIM: " LENGTH OF FIRST-DELIM. DISPLAY "Length of SECOND-DELIM: " LENGTH OF SECOND-DELIM. UNSTRING BLOB DELIMITED BY FIRST-DELIM OR SECOND-DELIM INTO FIRST-MATCH DELIMITER IN FIRST-DELIM-HOLD, SECOND-MATCH DELIMITER IN SECOND-DELIM-HOLD END-UNSTRING. DISPLAY " MATCHED: |" FIRST-MATCH "|, |" SECOND-MATCH "|". DISPLAY " DELIM HOLDS: |" FIRST-DELIM-HOLD "|, |" SECOND-DELIM-HOLD "|". DISPLAY SPACES. DISPLAY "Variable length fields:" DISPLAY "---------------------------------------------------". DISPLAY " V-FIRST-DELIM: |" V-FIRST-DELIM "|". DISPLAY " V-SECOND-DELIM: |" V-SECOND-DELIM "|". DISPLAY " Length of V-FIRST-DELIM: " LENGTH OF V-FIRST-DELIM. DISPLAY "Length of V-SECOND-DELIM: " LENGTH OF V-SECOND-DELIM. UNSTRING BLOB DELIMITED BY V-FIRST-DELIM OR V-SECOND-DELIM INTO FIRST-MATCH DELIMITER IN FIRST-DELIM-HOLD, SECOND-MATCH DELIMITER IN SECOND-DELIM-HOLD END-UNSTRING. DISPLAY " MATCHED: |" FIRST-MATCH "|, |" SECOND-MATCH "|". DISPLAY " DELIM HOLDS: |" FIRST-DELIM-HOLD "|, |" SECOND-DELIM-HOLD "|". DISPLAY SPACES. STOP RUN. [/code] The Patch [code] diff -rc open-cobol-1.1.orig/libcob/strings.c open-cobol-1.1/libcob/strings.c *** open-cobol-1.1.orig/libcob/strings.c 2009-01-24 15:31:30.000000000 +0200 --- open-cobol-1.1/libcob/strings.c 2009-08-28 13:49:27.000000000 +0200 *************** *** 435,440 **** --- 435,441 ---- cob_unstring_init (cob_field *src, cob_field *ptr, const size_t num_dlm) { static size_t udlmcount = 0; + int udlmi = 0; unstring_src_copy = *src; unstring_src = &unstring_src_copy; *************** *** 458,463 **** --- 459,467 ---- } } else { if (num_dlm > udlmcount) { + for(udlmi=0;udlmi' to 'uns_dlm.'. Finally in cob_unstring_delimited the assignment becomes - dlm_list[unstring_ndlms].uns_dlm = *dlm; Roger ---------------------------------------------------------------- Yes, that's the other way I was thinking of doing it as well. Less malloc and free, so bit cleaner. Another option will be to change cobc to create unique cob_field entries for variable length records and use those instead of manipulating a shared/temporary cob_field structure. Might also be useful in other areas. Unfortunately I'm not too familiar with flex+bison. ---------------------------------------------------------------- Subject: OpenCOBOL logo In a recent communication with Roger While he indicated that he would be interested in having a logo for the product. He suggested that we use this forum to develop the idea. I have asked my graphics people to start perculating the project and hope that we can get some input from the forum. jimc ---------------------------------------------------------------- If the logo is ready and we have a small OC teaser like "The open source COBOL based on C" a box like http://www.openengine.de/forum/download/file.php?id=32 would be nice, maybe with symbols of GNU etc. human ---------------------------------------------------------------- How about an O with a smaller C inside, and for the centre, a nice Meh, or other iconic symbol of freedom? If that can be pulled off, it could be used as the O in a longer header line of OpenCOBOL? For a mascot, I'm a fan of Agent Hopper. The figures in the FAQ header line (thanks to Robert) shows the style that I mean; sci-fi suit warriors. Cheers, Brian ---------------------------------------------------------------- I took a crack at such a logo. I'll post it here as soon as I can find a place to put it. ---------------------------------------------------------------- [img]http://cutlergl.webs.com//photos/null/OpenCOBOL-Logo.jpg[/img] ---------------------------------------------------------------- CutlerGL, nothing showed up. The Agent Hopper character is released under open source so she's available for the logo. I think having OpenCobol itself in the logo is important as well as some kind of motto or tagline. Any ideas for a motto? ---------------------------------------------------------------- There are a lot of possible teasers like the plain "The open source COBOL based on C" or something like "The beauty of COBOL together with the speediness of C-Compilers"... I vote for a cheetah as mascot, or, if the warriors are necessary for the most of us replace the Vikings with Knights. ---------------------------------------------------------------- OK - I think I finally got an image posted. Scroll down to look. ---------------------------------------------------------------- Cutler, EXCELLENT Logo. The only thing I might suggest is that instead of the international symbol of hate crossing out cash, it should cross out chains. Just my thought. (International symbol of hate is a joke about the circle with the line drawn through it, from a comedy book I once read years ago...) Human, I'm ok with either. We could have the agent hopper modified. The warriors were more for add1tocobol, but we have no issue loaning them or sharing them with OpenCobol. Also the couple of warriors we have were just examples. The idea being that everyone involved in the projects could have their own warrior, of the type they wish. No matter the culture, or reality, even scifi. The essence being that now it is the Cobolers that are rebels, so the warriors were always in business suits. I don't know if that motif fits OpenCobol or not, but its definitely an add1tocobol concept. Kind Regards ---------------------------------------------------------------- Subject: Announcement: Open Source EZASOKET available Open COBOL Crew, I just released the first version of Open Source EZASOKET. It is designed to work with Open COBOL, MicroFocus, and Fujitsu. It works on Linux and zLinux. I am sure it would work on any *NIX system. Windows support is in the works. It works with EBCDIC and ASCII. It works with 32 and 64 bit. (31 bit for zLinux). http://ezasoket.googlecode.com/ -- Michael Potter Replatform Technologies, LLC. ---------------------------------------------------------------- Thanks Micheal. Running tests right now. Looking good so far. More soon. Cheers, Brian ---------------------------------------------------------------- Pottmi, Thanks for this! ---------------------------------------------------------------- Subject: Small bug concerning BLOCK CONTAINS clause [code] FD MYDAT BLOCK CONTAINS 4 TO 3 RECORDS. 01 MY-RECORD PIC X(2000).[/code] I think it would be good if the compiler would error this typo (should have been 1 TO 3 RECORDS). By the way: Does OC use this clause on run time? human ---------------------------------------------------------------- Subject: How safe is the built in ISAM with BDB? I am considering using the built in ISAM/BDB (emulator?) for a couple of projects. But of course data integrity is paramount. Does anyone have any idea how safe it is? Does using it lead to data loss, or potential data loss? I am aware already that having the bdb files themselves alone, without a separate cobol data layout is not enough to know what is in the file since it lacks (i think) metadata within itself. That I can live with as I will keep definitions tied closely with the files in a separate descriptor. But if the data itself remains safe, I'm willing to steam ahead. Thoughts? Kind Regards ---------------------------------------------------------------- As I've wrote some FR/Bugs concerning BDB, I rather take VB-ISAM (but I'm not gone through all my planned tests). Depending on what you want to do (especially if you need locks and massive reads/updates) it could be better to look for another ISAM than BDB. Maybe you did or want to "put pressure on IBM to release C-ISAM to open source" as Roger suggested [url=http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=48&forum=1]in this forum post[/url]. human ---------------------------------------------------------------- Subject: Notes concerning OC-FAQ, from Cobol-*T docs After going trough the [url=http://www.choyou.fr/host/cobol-it/software/COBOL-IT Compiler Suite/Manual/Getting_Started_with_COBOL-IT_Compiler_Suite.pdf]Getting Started doc from Cobol-*T[/url], I found that some important things about OpenCOBOL are missing. One of these things is the description of warnings (pages 19-20), [quote]All warning are provided in form : -Wwarning-name Enable the warning using : -Wwarning-name Disable the warning using : -Wno-warning-name Warnings are evaluated in the command line order $cobc -Wall -Wno-archaic enable all warnings but the archaic features.[/quote] -Wno-archaic and the other work fine with OC, but this was the first time I've seen this. Maybe there is some time to go through this document and take the useful parts into OC FAQ. Thanks, human ---------------------------------------------------------------- Thanks Human! ---------------------------------------------------------------- Subject: FR: add C-function for getting information of compiled modules For achieving this, we'd need a new function (for example cob_mod_info) in every generated module returning at least the following information: Compiled on: [compiled time of module] Compiled with: [string of cobc --version on compile time] The following information could be added, too: Optimisation (just display -O/-O2/-OS like it was used on compile time), run-time checks enabled (yes/no) Maybe it's even possible to pass a version-info to the module with something like cobc -versioninfo "versionnumber of my app" that is stored there, too (if -versioninfo was not used at compile time, this string would be just empty). With a new utility cobinfo (or maybe a new switch for cobcrun like -moduleinfo) we could access this function to get these information. human ---------------------------------------------------------------- Subject: FR: add numeric version of packaged date to tarstamp.h, maybe to cobc --version, too For different script utilities it would be nice to have a numeric version of octardate. Therefore I suggest the following change of tarstamp.h (I'm not sure if there are more than one tarballs per day. If not, the time could be removed from octardate_num): [code]#ifndef COB_TARSTAMP_H #define COB_TARSTAMP_H static char octardate[] = "Feb 06 2009 10:30:55 CET"; static char octardate_num[] = "090602103055"; #endif /* */ [/code] Should this numeric version be shown in cobc --version (maybe in brackets after the packaged date) or would it be nicer to have this numeric version number in a new command switch like cobc -v? I've added the define of COB_TARSTAMP_H to be able to include tarstamp.h in different source locations. If possible it would be nice to have this in newer versions, too. human ---------------------------------------------------------------- Subject: FIX for Bug: running into segfault during compile when var for CRT STATUS is not defined Here we have a newer bug (the first 1.1 pre releases are fine). If you take SEGF.COB [code] IDENTIFICATION DIVISION. PROGRAM-ID. SEGF. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. CRT STATUS IS my-crt-status. DATA DIVISION. *----------------------------------------------------------------- WORKING-STORAGE SECTION. *77 my-crt-status pic 9(04). 77 somevar pic x(01). *------------------------------------------------------------- PROCEDURE DIVISION. accept somevar at LINE 1 COL 2 end-accept stop run.[/code] and compile it, you're running into a segfault. If you remove the comment from my-crt-status the compiling works fine. human ---------------------------------------------------------------- Small patch. [code] *** typeck.c.orig 2009-01-28 12:57:26.000000000 -0500 --- typeck.c 2009-09-08 09:49:04.000000000 -0400 *************** *** 2822,2828 **** } if (current_program->flag_screen) { /* Bump ref count to force CRT STATUS field generation */ ! cb_field (current_program->crt_status)->count++; if ((CB_REF_OR_FIELD_P (var)) && CB_FIELD (cb_ref (var))->storage == CB_STORAGE_SCREEN) { output_screen_from (CB_FIELD (cb_ref (var)), 0); --- 2822,2830 ---- } if (current_program->flag_screen) { /* Bump ref count to force CRT STATUS field generation */ ! if(current_program->crt_status != NULL) { ! cb_field (current_program->crt_status)->count++; ! } if ((CB_REF_OR_FIELD_P (var)) && CB_FIELD (cb_ref (var))->storage == CB_STORAGE_SCREEN) { output_screen_from (CB_FIELD (cb_ref (var)), 0); *************** *** 2868,2874 **** } } else if (pos || fgc || bgc || scroll) { /* Bump ref count to force CRT STATUS field generation */ ! cb_field (current_program->crt_status)->count++; if (!pos) { cb_emit (cb_build_funcall_7 ("cob_field_accept", var, NULL, NULL, fgc, bgc, scroll, --- 2870,2878 ---- } } else if (pos || fgc || bgc || scroll) { /* Bump ref count to force CRT STATUS field generation */ ! if(current_program->crt_status != NULL) { ! cb_field (current_program->crt_status)->count++; ! } if (!pos) { cb_emit (cb_build_funcall_7 ("cob_field_accept", var, NULL, NULL, fgc, bgc, scroll, [/code] ---------------------------------------------------------------- Patch works fine. ---------------------------------------------------------------- Subject: Install instructions for MAC Hi I am looking for precise install instructions to install open cobol on a mac. I am a novice at using shell commands so it would be great if I could get the steps in the process with the necessary commands. Thanks Bruce ---------------------------------------------------------------- These are the steps I used to install OpenCobol 1.1 (pre-release) on Leopard: (sorry if the instructions below are too verbose, might help someone less experienced) [b]1. Install the GNU MP library[/b] 1.1 Download gmp-4.3.1.tar.gz from http://www.gmplib.org 1.2 Unpack to a directory: tar xzvf gmp-4.3.1.tar.gz (or double-click from Finder) 1.3 From the shell, cd to that directory 1.4 Build and install gmp using the following commands: $ ./configure --enable-shared --disable-static ABI=32 $ make $ make check $ sudo make install (you'll need to enter your admin password for the last step) [b]2. Install the Berkeley DB library[/b] 2.1 Download db-4.7.25.tar.gz from http://www.oracle.com/technology/software/products/berkeley-db/db/index.html 2.2 Unpack to a directory: tar xzvf db-4.7.25.tar.gz 2.3 From the shell, cd to that directory 2.4 Build and install BDB using the following commands: $ cd build_unix $ ../dist/configure $ make $ sudo make install [b]3. Install OpenCOBOL[/b] 3.1 Download open-cobol-1.1.tar.gz from http://www.opencobol.org/modules/mydownloads/singlefile.php?cid=1&lid=2 3.2 Unpack to a directory: tar xzvf open-cobol-1.1.tar.gz 3.3 From the shell, cd to that directory 3.4 Build and install OpenCOBOL using the following commands: $ ./configure LDFLAGS=-L/usr/local/BerkeleyDB.4.7/lib $ make $ make check $ sudo make install [b]4. Test OpenCOBOL[/b] 4.1 From the shell, run 'cobc -V', you should see: cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Sep 07 2009 22:49:57 Packaged Feb 06 2009 10:30:55 CET 4.2 Try the "Hello World!" tutorial from: http://www.opencobol.org/modules/bwiki/index.php?UserManual%2F1#b4d6cbbe [i]Note[/i]: if you copy and paste the example, you may need to add an extra space before each line, so the I of IDENTIFICATION is at column 8 as described in the tutorial. ---------------------------------------------------------------- Subject: install OpenCobol Installation OpenCOBOL with this documentation: "Getting Started with OpenCOBOL for "Windows" Dummies (like me)" by Bill Klein. (Monday, March 2, 2009) It is the best way to install and use OC. THANK THANK THANK THANK ---------------------------------------------------------------- Subject: Problem CRT STATUS on LEOPARD Hello, i have the following problem: when i use the CRT STATUS in a terminal F1, F2, F3, F4 and other keys doesn't work the result of CRT STATUS is 2005 ESC, F5 to F18 works fine the external variablen: COB_SCREEN_EXCEPTIONS=Y COB_SCREEN_ESC=Y always aktiv.. where ist my mistake? i use the example, i have found in this forum: >>SOURCE FORMAT IS FIXED ****************************************************************** * Author: Brian Tiffin * Date: 20-July-2008 * Purpose: Demonstrate screen section and crt status codes * Tectonics: $ cobc -x screencodes.cbl * $ export COB_SCREEN_EXCEPTIONS=Y * $ export COB_SCREEN_ESC=Y * $ ./screencodes 2>screencodes.key * Notes: Displays to syserr. ncurses may hide that so a * redirection may be in order, then cat the file * On my Debian PC, ESC (code 2005) takes a while to * trigger. ****************************************************************** identification division. program-id. screencodes. environment division. configuration section. special-names. crt status is screen-status. data division. working-storage section. copy screenio. 78 red value 4. 78 yellow value 6. 01 screen-status pic 9(4). 01 counter pic 9. 01 hitanykey pic x. screen section. 01 entry-screen. 02 blank screen. 02 line 2 column 20 value "Hit some keys and function keys - loops 8 times". 02 line 10 column 30 value "Key code:". 02 screen-code pic x(4) from screen-status line 10 column 40 foreground-color yellow highlight. 02 screen-count pic x from counter line 10 column 46. 02 filler pic x using hitanykey line 14 column 40 foreground-color red. procedure division. perform varying counter from 1 by 1 until counter > 8 display entry-screen accept entry-screen display screen-status upon syserr end-perform. goback. please help cu kregen cu kregen ---------------------------------------------------------------- hi, i have faound where the problem come from... the setting of the terminal send other codes to the program as it is defined for opencobol. F1 = \033OP -> doesn't work F2 = \033OQ -> doesn't work F3 = \033OR -> doesn't work F4 = \033OS -> doesn't work F5 = \033[15~ this funktionkey and the following working fine.. if there a way to redefined the keys for opencobol... I don't want to change the settings because other programms used the keys right... cu kregen ---------------------------------------------------------------- Subject: Latest version? Hi. I'm comming back to OC to do some hobbyest stuff. How can I get the latest OC? In the download section is OC 1.1 pre-release from 2007!!! Regards. ---------------------------------------------------------------- 2007 is just the announcement time. If you follow the link you will get the latest tarball (from 2009-02-06). The next tarball will have a lot of fixes in and seems to need some more time, so try the one from February, human ---------------------------------------------------------------- Subject: Is there a way to get the name of the current running program? It's often useful to output the name of the current running program if you write a log. Is there a different way to do this without defining a 78 var with the name of the prog? human ---------------------------------------------------------------- human; [code] 01 progname pic x(1024) *> (ish, depends on max os path) display 0 upon argument-number accept progname from argument-value [/code] Cheers, Brian ---------------------------------------------------------------- Brian, Isn't "arguement 0" the neame of the MAIN program and [b]NOT[/b] the name of the currently running program (if it is a subprogram)? ---------------------------------------------------------------- Yes, it is (we have tested this some weeks ago). That's the reason for my new question. To add another one: is it possible to get the FULL path of the currently running module? human ---------------------------------------------------------------- human; I did a little tracing through the CANCEL code, assuming it would need to have access to a call stack structure with names in it. It does, but it's an internal runtime structure as far as I can figure. Module loading for this, is a path search and (again, from a quick grok) this name structure only holds the basename, so FULL path might be hard to pull off even if we could manage a safe way to squirrel into the structure. Cheers, Brian ---------------------------------------------------------------- Therefore for the full path we have to expand the internal structure (holding both the base name AND the full path). Afterwards we could try to access this via some CALL OC_CBL_... I assume the next step would be to convince Roger to agree to this change. human ---------------------------------------------------------------- hello human, i hope it is a little bit helpfull... please compile cobc -x -g ./getpgmname.cbl IDENTIFICATION DIVISION. PROGRAM-ID. getpgmname. DATA DIVISION. WORKING-STORAGE SECTION. 01 DUMMY PIC X. 01 pgmname PIC X(24). 01 error-location PIC X(1023). 01 flags pic s9(9) comp-5 value 0. 01 dir-length pic s9(9) comp-5 value 1023. 01 current-dir pic x(1023). 01 status-code pic s9(9) comp-5. 01 chars pic 9(3) value 0. PROCEDURE DIVISION. A0000-MAIN SECTION. * get current directory call "CBL_GET_CURRENT_DIR" using by value flags by value dir-length by reference current-dir returning status-code end-call * tallying characters in directoryname INSPECT current-dir TALLYING chars FOR CHARACTERS BEFORE " ". * make a little error STRING "GENERATEALITTLEERROR" DELIMITED SIZE INTO DUMMY. * catch the little error MOVE FUNCTION EXCEPTION-LOCATION TO ERROR-LOCATION. * extract the programname from errortext UNSTRING error-location DELIMITED BY ";" INTO pgmname END-UNSTRING. * show directory and program name DISPLAY current-dir(1:chars) '/' pgmname. STOP RUN. cu kregen ---------------------------------------------------------------- Didn't thought of the possibility to use EXCEPTION-LOCATION. Dirty hack but useful. Is there an not-dirty way available (or is somebody able & willing to submit a patch)? human ---------------------------------------------------------------- [quote]human wrote: is it possible to get the FULL path of the currently running module?[/quote] Well, on Win x64 and ia64 it's easy :-) : [code] IDENTIFICATION DIVISION. PROGRAM-ID. say. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 FLAG PIC S9(8) COMP-5 VALUE 4. 01 HMOD PIC S9(18) COMP-5. 01 FNAME PIC X(2048). LINKAGE SECTION. 01 HELLO PIC X(6). 01 WORLD PIC X(6). PROCEDURE DIVISION USING HELLO WORLD. DISPLAY HELLO WORLD. CALL 'GetModuleHandleExA' USING BY VALUE FLAG BY REFERENCE FLAG HMOD END-CALL. DISPLAY 'Module=' HMOD. CALL 'GetModuleFileNameA' USING BY VALUE HMOD BY REFERENCE FNAME BY VALUE 2048 END-CALL. * Now you actually need to find LOW-VALUE delimiting the string DISPLAY 'DLL=' FNAME. * And you actually have to free the HANDLE EXIT PROGRAM. [/code] [code] G:\skatests\cobol\module>cobc -m -static -v say.cob preprocessing say.cob into C:\Temp\cobD62.cob translating C:\Temp\cobD62.cob into C:\Temp\cobD63.c cl -I g:\open-cobol\build_windows\.. -I g:\open-cobol\build_windows\x64 -I g:\op en-cobol\build_windows /MD /LD /Fe"say" /Fo"say" "C:\Temp\cobD63.c" g:\open-co bol\build_windows\x64\debug\libcob.lib g:\open-cobol\build_windows\x64\gmp.lib Microsoft (R) C/C++ Optimizing Compiler Version 14.00.50727.762 for x64 Copyright (C) Microsoft Corporation. All rights reserved. cobD63.c Microsoft (R) Incremental Linker Version 8.00.50727.762 Copyright (C) Microsoft Corporation. All rights reserved. /dll /implib:say.lib /out:say.dll say.obj g:\open-cobol\build_windows\x64\debug\libcob.lib g:\open-cobol\build_windows\x64\gmp.lib Creating library say.lib and object say.exp mt /manifest "say.dll.manifest" /outputresource:"say.dll";#2 Microsoft (R) Manifest Tool version 6.0.4071.0 Copyright (c) Microsoft Corporation 2004. All rights reserved. G:\skatests\cobol\module>hello-dynamic Hello World! Module=+000000000008060928 DLL=G:\skatests\cobol\module\say.dll [/code] On Win32 (x86) you will need external C/C++ program doing the same... still thinking if it's possible on UNIXes ---------------------------------------------------------------- Hmm, Sergey, you have your 64-bit hat on :-) Better would be - [code] 01 HMOD USAGE PROGRAM-POINTER. [/code] That should work for 32 and 64 bit. Also remember that the returned string is NULL terminated. Roger ---------------------------------------------------------------- Hi Roger, [quote]simrw wrote: Better would be - [code] 01 HMOD USAGE PROGRAM-POINTER. [/code] [/quote] You almost right, USAGE POINTER will be correct. [quote]That should work for 32 and 64 bit.[/quote] Unfortunately the issue with 32-bit is different. In 32-bit mode those windoze calls are not "cdecl" but STDCALL, so you can't link this Cobol program. Unfortunately in OC we don't have what Microfocus has, like [code] SPECIAL-NAMES. call-convention 8 is litlink. ... CALL litlink 'CICSAPIWSADDR' USING CICS-ARGS CICS-API-WS-START CICS-API-WS-END. [/code] [quote]Also remember that the returned string is NULL terminated. Roger[/quote] That I've pointed out in comment ---------------------------------------------------------------- Subject: Is there a way to warn for COBOL source in columns 8-11 (fixed format)? Some time ago it was only possible to start paragraph / section names in column 8-11. If other COBOL source was written there, an error occurred. Is there a way to enable this error in current OC, too? human ---------------------------------------------------------------- Subject: why is this PICTURE invalid? (resolved) - a little turn around in my head hi, i'm a german programmer and used decimal-point ist comma, but i get a compile error: ./test.cbl:18: Error: Invalid picture string - '--,---,--9.99' [b][size=x-large]SOURCE[/size][/b] ***************************************************************** IDENTIFICATION DIVISION. ***************************************************************** PROGRAM-ID. testpgm. AUTHOR. KAI REGENSTEIN. DATE-WRITTEN. 12/08/1986. ***************************************************************** ENVIRONMENT DIVISION. ***************************************************************** COPY "config.cpy". * ***************************************************************** DATA DIVISION. ***************************************************************** WORKING-STORAGE SECTION. * 01 ANZEIGE PIC --,---,--9.99. 01 STATUS-FIELD PIC 9(04). ***************************************************************** PROCEDURE DIVISION. ***************************************************************** BUCHUNGS-JOURNAL SECTION. STOP RUN. [b][size=x-large]compileoutput[/size][/b] # Generated by OpenCOBOL 1.1.0 # Built Sep 08 2009 23:06:27 # Packaged Feb 06 2009 10:30:55 CET # Environment # TMPDIR : /var/folders/am/amYigkMpF8iivLK+viDlPE+++TI/-Tmp-/ # COBCPY : is not set # Command : /usr/local/bin/cobc -c -I../screens/ -I../files/ -I../copy/ -t./test.lst ./test.cbl # # 1 "./test.cbl" IDENTIFICATION DIVISION. PROGRAM-ID. testpgm. ENVIRONMENT DIVISION. # 1 "../copy//config.cpy" CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA CRT STATUS IS STATUS-FIELD. # 11 "./test.cbl" DATA DIVISION. WORKING-STORAGE SECTION. 01 ANZEIGE PIC --,---,--9.99. 01 STATUS-FIELD PIC 9(04). PROCEDURE DIVISION. BUCHUNGS-JOURNAL SECTION. STOP RUN. please help.. what must i do, that this picture is working? cu kregen ---------------------------------------------------------------- Subject: Latest version I am just returning from a hiatus and now back to some serious development. I would like to get the very latest and would appreciate pointing me to the place to download. I assume the 1.1 pre-release does have all your latest code. Mike ---------------------------------------------------------------- [quote]I assume the 1.1 pre-release does have all your latest code.[/quote] Ahh assumptions. They get me every time. Of course read before write has also been a good rule which I often neglect. Check the recent query below yours and let the coding begin! Regards, Gerald. ---------------------------------------------------------------- Subject: ACCEPT (SCREENS OR FIELDS) It 'very important ACCEPT (screens or fields) can also use the numeric fields in different forms, queuing on the right, but is now' posiibile only alphanumeric fields with tailback left the field to accept, even if it ' underpinned and 'always put spaces. This' and' a serious failure by having the most 'soon eliminated because' if it supports a field and want to accept the same field is set to open-losing the original value. ---------------------------------------------------------------- Subject: OpenCOBOL 1.1 Programmer's Guide I am reading Gary Cutler's soon to be released 1st edition of the OpenCOBOL 1.1 Programmer's Guide. This is a remarkable publication that will be of great value to each of us as we proceed down the OpenCOBOL path. Remembering that this is a programmer's guide and not a language reference manual, is does a fantastic job of explaining much of the OpenCOBOL environment. This guide will be of great assistance to me and our programmers starting Monday morning. Please join me in encouraging Gary to release this work in it's current state. Everything man made can be improved, but this work is certainly more than good enough to help many of us now. I can only imagine how much time Gary has spent on the project. A simple thank you seems inadequate. jimc ---------------------------------------------------------------- add 1 to gary giving cheers Beauty. Cheers, Brian ---------------------------------------------------------------- If someone responsible for the OpenCOBOL website cares to email me at CutlerGL@gmail.com I'll be happy to send the final PDF in reply so it can be added to the website. The copy I sent to Brian last week had a number of typos that needed correction. Additionally, I added a new section (Introduction to COBOL). This document was a LOT of work, but it was also a lot of fun to write. If Roger and company keep me apprised of upcoming releases/features, I'll be happy to keep the doc up-to-date. For those that haven't heard about or seen a working copy of this document, here's a teaser (the table of contents): [code] FIGURES 5 SUMMARY OF CHANGES 8 1. INTRODUCTION 1-1 1.1. Additional References and Documents 1-1 1.2. Introducing COBOL 1-1 1.2.1. “My Instructor Said COBOL is a Dead Language†1-1 1.2.2. Programmer Productivity – The “Holy Grail†1-3 1.2.3. Notable COBOL/OpenCOBOL Features 1-4 1.2.3.1. Basic Program Readability 1-4 1.2.3.2. COBOL Program Structure 1-5 1.2.3.3. Copybooks 1-5 1.2.3.4. Structured Data 1-5 1.2.3.5. Files 1-5 1.2.3.6. Table Handling 1-8 1.2.3.7. Sorting and Merging Data 1-8 1.2.3.8. String Manipulation 1-8 1.2.3.9. Textual-User Interface (TUI) Features 1-9 1.3. Syntax Description Conventions 1-10 1.4. Source Program Format 1-11 1.5. Use of Commas 1-11 1.6. Using COPY 1-12 1.7. Use of Literals 1-12 1.8. Use of Figurative Constants 1-13 1.9. User-Defined Names 1-13 2. GENERAL OPENCOBOL PROGRAM FORMAT 2-1 2.1. General Format for Nested Source Programs 2-2 2.2. General Format for Nested Source Functions 2-2 3. IDENTIFICATION DIVISION 3-1 4. ENVIRONMENT DIVISION 4-1 4.1. CONFIGURATION SECTION 4-1 4.1.1. SOURCE-COMPUTER Paragraph 4-1 4.1.2. OBJECT-COMPUTER Paragraph 4-1 4.1.3. REPOSITORY Paragraph 4-2 4.1.4. SPECIAL-NAMES Paragraph 4-3 4.2. INPUT-OUTPUT SECTION 4-5 4.2.1. FILE-CONTROL Paragraph 4-6 4.2.1.1. ORGANIZATION SEQUENTIAL Files 4-8 4.2.1.2. ORGANIZATION RELATIVE Files 4-8 4.2.1.3. ORGANIZATION INDEXED Files 4-9 4.2.2. I-O-CONTROL Paragraph 4-10 5. DATA DIVISION 5-1 5.1. FD - File Description 5-2 5.2. SD - SORT Description 5-3 5.3. General Format for Data Descriptions 5-4 5.4. Condition Names 5-15 5.5. Constant Descriptions 5-15 5.6. Screen Descriptions 5-17 6. PROCEDURE DIVISION 6-1 6.1. General PROCEDURE DIVISION Components 6-1 6.1.1. Table References 6-1 6.1.2. Qualification of Data Names 6-1 6.1.3. Reference Modifiers 6-2 6.1.4. Expressions 6-2 6.1.4.1. Arithmetic Expressions 6-3 6.1.4.2. Conditional Expressions 6-4 6.1.5. Use of Periods (.) 6-8 6.1.6. Use of “VERB†/ “END-VERB†Constructs 6-9 6.1.7. Intrinsic Functions 6-10 6.1.8. Special Registers 6-18 6.1.9. Controlling Concurrent Access to Files 6-19 6.1.9.1. File Sharing 6-19 6.1.9.2. Record Locking 6-20 6.2. General Format of the PROCEDURE DIVISION 6-21 6.3. General Format for DECLARATIVES Entries 6-22 6.4. ACCEPT 6-23 6.4.1. ACCEPT Format 1 – Read from Console 6-23 6.4.2. ACCEPT Format 2 – Retrieve Command-Line Arguments 6-23 6.4.3. ACCEPT Format 3 – Retrieve Environment Variable Values 6-24 6.4.4. ACCEPT Format 4 – Retrieve Screen Data 6-25 6.4.5. ACCEPT Format 5 – Retrieve Date/Time 6-26 6.4.6. ACCEPT Format 6 - Retrieve Screen Size Data 6-26 6.4.7. ACCEPT Exception Handling 6-27 6.5. ADD 6-28 6.5.1. ADD Format 1 – ADD TO 6-28 6.5.2. ADD Format 2 – ADD GIVING 6-29 6.5.3. ADD Format 3 – ADD CORRESPONDING 6-29 6.6. ALLOCATE 6-30 6.7. ALTER 6-31 6.8. CALL 6-32 6.9. CANCEL 6-34 6.10. CLOSE 6-35 6.11. COMMIT 6-36 6.12. COMPUTE 6-37 6.13. CONTINUE 6-38 6.14. DELETE 6-39 6.15. DISPLAY 6-40 6.15.1. DISPLAY Format 1 – Upon Console 6-40 6.15.2. DISPLAY Format 2 – Access Command-Line Arguments 6-40 6.15.3. DISPLAY Format 3 – Access or Set Environment Variables 6-41 6.15.4. DISPLAY Format 4 – Screen Data 6-42 6.15.5. DISPLAY Exception Handling 6-42 6.16. DIVIDE 6-42 6.16.1. DIVIDE Format 1 – DIVIDE INTO 6-43 6.16.2. DIVIDE Format 2 – DIVIDE INTO GIVING 6-43 6.16.3. DIVIDE Format 3 – DIVIDE BY GIVING 6-44 6.16.4. DIVIDE Format 4 – DIVIDE INTO REMAINDER 6-44 6.16.5. DIVIDE Format 5 – DIVIDE BY REMAINDER 6-45 6.17. ENTRY 6-46 6.18. EVALUATE 6-47 6.19. EXIT 6-49 6.20. FREE 6-51 6.21. GENERATE 6-52 6.22. GOBACK 6-53 6.23. GO TO 6-54 6.23.1. GO TO Format 1 – Simple GO TO 6-54 6.23.2. GO TO Format 2 – GO TO DEPENDING ON 6-54 6.24. IF 6-55 6.25. INITIALIZE 6-56 6.26. INITIATE 6-57 6.27. INSPECT 6-58 6.28. MERGE 6-61 6.29. MOVE 6-63 6.29.1. MOVE Format 1 – Simple MOVE 6-63 6.29.2. MOVE Format 2 – MOVE CORRESPONDING 6-63 6.30. MULTIPLY 6-65 6.30.1. MULTIPLY Format 1 – MULTIPLY BY 6-65 6.30.2. MULTIPLY Format 2 – MULTIPLY GIVING 6-65 6.31. NEXT SENTENCE 6-66 6.32. OPEN 6-67 6.33. PERFORM 6-68 6.33.1. PERFORM Format 1 – Procedural 6-68 6.33.2. PERFORM Format 2 – Inline 6-69 6.34. READ 6-70 6.34.1. READ Format 1 – Sequential READ 6-70 6.34.2. READ Format 2 – Random Read 6-71 6.35. RELEASE 6-73 6.36. RETURN 6-74 6.37. REWRITE 6-75 6.38. ROLLBACK 6-76 6.39. SEARCH 6-77 6.39.1. SEARCH Format 1 –Sequential Search 6-77 6.39.2. SEARCH Format 2 –Binary, or Half-interval Search (SEARCH ALL) 6-78 6.40. SET 6-80 6.40.1. SET Format 1 – SET ENVIRONMENT 6-80 6.40.2. SET Format 2 – SET Program-Pointer 6-80 6.40.3. SET Format 3 – SET ADDRESS 6-80 6.40.4. SET Format 4 – SET Index 6-81 6.40.5. SET Format 5 – SET UP/DOWN 6-81 6.40.6. SET Format 6 – SET Condition Name 6-81 6.40.7. SET Format 7 – SET Switch 6-82 6.41. SORT 6-83 6.41.1. SORT Format 1 – File-based Sort 6-83 6.41.2. SORT Format 2 – Table Sort 6-85 6.42. START 6-86 6.43. STOP 6-88 6.44. STRING 6-89 6.45. SUBTRACT 6-90 6.45.1. SUBTRACT Format 1 – SUBTRACT FROM 6-90 6.45.2. SUBTRACT Format 2 – SUBTRACT GIVING 6-90 6.45.3. SUBTRACT Format 3 – SUBTRACT CORRESPONDING 6-91 6.46. SUPPRESS 6-92 6.47. TERMINATE 6-93 6.48. TRANSFORM 6-94 6.49. UNLOCK 6-95 6.50. UNSTRING 6-96 6.51. WRITE 6-98 7. THE OPENCOBOL SYSTEM INTERFACE 7-1 7.1. Using the OpenCOBOL Compiler (cobc) 7-1 7.1.1. Introduction 7-1 7.1.2. Syntax and Options 7-1 7.1.3. Compiling Executable Programs 7-2 7.1.4. Dynamically-Loadable Subprograms 7-2 7.1.5. Static Subroutines 7-3 7.1.6. Combining COBOL and C Programs 7-3 7.1.6.1. OpenCOBOL Run-Time Library Requirements 7-3 7.1.6.2. String Allocation Differences Between OpenCOBOL and C 7-4 7.1.6.3. Matching C Data Types with OpenCOBOL USAGEs 7-4 7.1.6.4. OpenCOBOL Main Programs CALLing C Subprograms 7-6 7.1.6.5. C Main Programs CALLing OpenCOBOL Subprograms 7-7 7.1.7. Important Environment Variables 7-8 7.1.8. Using Compiler Configuration Files 7-9 7.2. Running OpenCOBOL Programs 7-11 7.2.1. Executing Programs Directly 7-11 7.2.2. Using the “cobcrun†Utility 7-11 7.2.3. Program Arguments 7-12 7.2.4. Important Environment Variables 7-12 7.3. Built-In Subroutines 7-13 7.3.1. C$CHDIR – Change Current Directory 7-14 7.3.2. C$COPY – Copy a File 7-14 7.3.3. C$DELETE – Delete a File 7-15 7.3.4. C$FILEINFO – Retrieve File Information 7-15 7.3.5. C$JUSTIFY – Left, Right or Center Justify a Field 7-16 7.3.6. C$MAKEDIR – Create a Directory 7-16 7.3.7. C$NARG – Retrieve Number of Subprogram Parameters 7-16 7.3.8. C$PARMSIZE – Retrieve Size of a Subprogram Parameter 7-16 7.3.9. C$SLEEP – Put Program to Sleep (Seconds) 7-17 7.3.10. CBL_AND – Bitwise “AND†7-17 7.3.11. CBL_CHANGE_DIR – Change Current Directory 7-17 7.3.12. CBL_CHECK_FILE_EXIST – Retrieve File Information 7-18 7.3.13. CBL_CLOSE_FILE – Close a File 7-18 7.3.14. CBL_COPY_FILE – Copy a File 7-18 7.3.15. CBL_CREATE_DIR – Create a Directory 7-19 7.3.16. CBL_CREATE_FILE – Create a File 7-19 7.3.17. CBL_DELETE_DIR – Delete a Directory 7-19 7.3.18. CBL_DELETE_FILE – Delete a File 7-20 7.3.19. CBL_ERROR_PROC – Program “Error Handler†Management 7-20 7.3.20. CBL_EXIT_PROC – Program “Exit Handler†Management 7-21 7.3.21. CBL_EQ – Bitwise “Equals†7-22 7.3.22. CBL_IMP – Bitwise “Implies†7-23 7.3.23. CBL_OC_NANOSLEEP – Put Program to Sleep (Nanoseconds) 7-23 7.3.24. CBL_NIMP – Bitwise “NIMP†7-23 7.3.25. CBL_NOR – Bitwise “NOR†7-24 7.3.26. CBL_NOT – Bitwise “NOT†7-25 7.3.27. CBL_OPEN_FILE – Open a File 7-25 7.3.28. CBL_OR – Bitwise “OR†7-26 7.3.29. CBL_RENAME_FILE – Rename a File 7-26 7.3.30. CBL_XOR – Bitwise “XOR†7-26 7.3.31. SYSTEM – Submit a Command to the Operating System 7-27 7.3.32. “Call by Number†Subroutines 7-27 7.3.32.1. Xâ€91†– Miscellaneous Functions 7-28 7.3.32.2. Xâ€F4†– Byte Pack 7-29 7.3.32.3. Xâ€F5†– Byte Unpack 7-29 7.4. Binary Truncation 7-30 8. SAMPLE PROGRAMS 8-1 8.1. Screen-Constants – Useful SCREEN SECTION Constants 8-1 8.2. FileStat-Msgs.cpy – File Status Values 8-2 8.3. cobdump – A Hex/Char Data Dump Subroutine 8-3 8.4. OCic – an OpenCOBOL Full-Screen Compiler Front-End 8-5 8.5. WINSYSTEM - Submit Windows Commands for Cygwin Users 8-22 9. GLOSSARY OF TERMS 9-1 INDEX I [/code] Gary Cutler ---------------------------------------------------------------- Gary, If you send me the latest copies (in addition to the ones that get posted to OCO (here), I will post them on the add1 repository. This way, we have the older copies as well. If you are willing to email me the working formats as well (prior to export to PDF) that would allow others to have the ability to easily modify (or improve) the document, either for release or for their own internal purposes. I am with Jim and Brian on this, Gary did a GREAT job. Being Irish American I'd use words that are generally considered impolite to describe how happy I am with the document and the hard work he has done. But since this is a professional forum, suffice it to say WOWZER! Kind Regards Aoirthoir ---------------------------------------------------------------- Brian, Can you contact Roger about this? I suggest that the guide be distributed right along with the 1.1 version. That would help a lot of folks along right from the rip. ---------------------------------------------------------------- Nice work, Gary ! Thanks Some notes: 1. Page 4-5: The external values of SWITCH-1 through SWITCH-12 ... There are only 8 in OC. 2. Page 5-8: Data will be organized in a “little-endian†form. Not true. It will be organized in "native" form which depends on architecture of CPU. 3. Page 6-7: FRACTIONAL-PART - duplicate with confusing description. Maybe one of them is cob_intr_integer_part ? 4. Page 7-4: 7.1.5.3. Matching C Data Types with OpenCOBOL USAGEs... There are almost no chances that "int" or "unsigned int" is 2-bytes :-) As of now it is 4 on all platforms. "long" could be 4 or 8 bytes depending on platform. 5. Page 7-9...etc: 7.3. Built-In Subroutines Some missing: CBL_TOUPPER CBL_TOLOWER CBL_READ_FILE CBL_WRITE_FILE CBL_FLUSH_FILE CBL_GET_CURRENT_DIR CBL_ERROR_PROC CBL_EXIT_PROC CBL_AND CBL_OR CBL_NOR CBL_XOR CBL_IMP CBL_NIMP CBL_EQ CBL_NOT CBL_XF4 CBL_XF5 CBL_X91 ---------------------------------------------------------------- I've a question for folks about comments to. Is it *> or >*. Because in fixed format I keep trying >* and it's not working. Will add more comments later. Gary, I'm definitely recommending to adding this (along with the sources) to our repository on add1. If you do, (well I can do it myself I mean, thats fine:) ) then many more people will review the documentation and comment on it. They might also be able to help add to it, since you've released it under the GNU FDL. I also recommend you DUAL license under the GNU FDL and CC-BY-SA. That way, we have the option to add more content to it then under the GNU FDL only. Finally our Euro friends have asked if the PDF can be created in A4 format. In the least, if they can have sources then they can convert to A4. Then they can print it, because some of them prefer hard copy. Kind Regards and blessings. ---------------------------------------------------------------- Inline comments in both fixed and free form reference format are introduced by [code] *> [/code] The only time when ">*" would work woudl be if the "*" were in column 7 and fixed form were in effect. ---------------------------------------------------------------- William, And in free format *> is the one also? I'll let Gary know. ---------------------------------------------------------------- Where can I get it? Regards. ---------------------------------------------------------------- Email a request to me at aoirthoir@add1.to and I will send you a copy. As soon as it is approved to post to the repository I'll post it. Andhopefully Roger will be amicable to adding it to future versions of OC releases... ---------------------------------------------------------------- Boy, that ">*" thing sure got a life of its own. It was a simple (and regrettable) typo in a draft version of the Programmer's Guide. Roger is reviewing it now (and suggesting a number of changes). We're also trying to get info from Roger's upcoming new 1.1 tarball so the doc will be current for at least a little while. :-D I'm hoping to have the 1st edition ready for general release by 30 September. The plan is that I'll turn the document over to the OC team and they'll determine the best means to make it available. One (likely) mechanism is through the add1toCOBOL site, although Roger and Company will make the call on that. ---------------------------------------------------------------- I got the draft from Aoirthoir and... [b] Wow! Very nice work! [/b] I think this is a big milestone in OC development. Congratulations Gary, keep the good work! Regards. ---------------------------------------------------------------- Agreed, it is excellent work. Gary excellent. Right now the OC team is basically Roger (unless things have changed lately). Also as posted above we're hoping for the sources as well as the PDF so folks can print it out. I've one fella right now that really needs to convert to his paper format since he generally reads printed docs rather than onscreen. Kind Regards and thanks! ---------------------------------------------------------------- As of five minutes ago, I've sent the "final" PDF and source (MS Word, MS Powerpoint) for the Programmers Guide to Roger. It's been updated to include some (many? most? probably not all) of the new features that Roger says will be present in the next tarball. I leave it to Roger to decide how to make the docs available, but my recommendation is that the PDF be included with tarballs and the latest PDF and source be available from the OC website (and/or add1toCobol website) for those that need printed A4 format or just want to add their own site coding standards et. al. to the doc. I have printed from the PDF quite successfully. It prints in USA letter format (8.5 x 11 inches) which probably will not work (well) for those that need A4 format - hence the need for downloadable source. I have offered to continue on in a document-maintenance role or to bow out gracefully, at Roger's discretion. Either is fine with me - I kind of "crashed your party" by jumping in the way I did and unilaterally putting the document together, but I felt someone needed to jumpstart the documentation issue or it might never have happened (plus I love to write :-D). One final comment. I STRONGLY BELIEVE the documentation should exist as a downloadable document rather than as an online website. Web-based documentation can be slick and you can argue that it can be updated and made available in a more timely manner than a document can, BUT... When you spend 7 hours on a plane, train or simply in an area where you need the document and HAVE NO NETWORK ACCESS (yes - it DOES happen!), a downloadable manual is best. ---------------------------------------------------------------- Gary, Excellent all the way around. As to the website, I believe having a website with the docs and having a pdf are both important. I also think we need to get this up on LULU.com or CAFEPRESS.com with the funds going to you (or at your discretion something else, or just enough to cover the cost of each printing). Having them on a site makes things convenient for those times you're not carrying around the pdf, for instance at a client's site. So http://opencobol.add1tocobol.com/docs/cobolVerb would be a boon to us. But we can handle that from your docs easily enough if we have the source, especially since you released them with the GNU FDL Kind Regards, Aoirthoir ---------------------------------------------------------------- Subject: FR to output IMPLICIT closes on CANCEL statement If a module is CANCELed, it seems like all open files of the module are closed implicit. If a module crashes, all files seem to be closed implicit, too AND this is written to stder. Wouldn't it make sense to do this for implicit CLOSES on CANCEL, too? human ---------------------------------------------------------------- Just so ti is clear, The close of OPEN files (opened by a subroutine) when that subroutine is CANCELed is required by the ANSI/ISO Standards. The one exception, is when the subroutine OPENs an EXTERNAL file. In that case, is must be left OPEN when the subroutine is CANCELed. Similarly, when a MAIN program reaches "normal" termination, ALL files must be closed. What happens on an ABNORMAL termination is totally UNDEFINED by the Standard. ---------------------------------------------------------------- Thank you for making this clear. If an abnormal termination is reached, the error messages of IMPLICIT CLOSES are fine (and it's good that OC does this). On a normal termination all files are closed (which is fine, too) AND an error message about IMPLICIT CLOSES is given. I think the implementor is free to do this. I just like to have an error message (maybe there could be an environment switch for that) for the already done IMPLICIT CLOSES on a CANCEL of subroutines that opened files and do not close them. human ---------------------------------------------------------------- Subject: Install OpenCOBOL in native Windows Mode Hello everyone. Sorry for my bad English. I have installed OpenCOBOL with Cygwin on Windows XP with information found on this site. It was difficult for me who does not know Unix. But I managed successfully. But I read that there was a way to install and use OpenCOBOL on Windows in native port. Despite all my research I found nothing about this possibility. Is there someone who is able to give me a simple way to install and use OpenCOBOL Windows (XP) in native mode. For note : I do not want use à GUI. Thank you in advance. ---------------------------------------------------------------- http://www.kiska.net/opencobol/1.1/ ---------------------------------------------------------------- Hi! You would need a C-Compiler for windows first, I suggest either MinGW or if you aren't a unix guru Microsoft C. You can download the Express version free from Microsoft if you haven't MSVC installed, yet. Then download the fixed source [there are some missing but compiling should work] and project files for MSVC from [url=http://www.kiska.net/opencobol/human/]kiska.net[/url]. After you've compiled these projects you have a native build (and need to have the MSVC runtime installed on the machine you want to run your programs on). human ---------------------------------------------------------------- > You would need a C-Compiler for windows first Has someone used OC with Borland C 5.x compiler? Regards. ---------------------------------------------------------------- Subject: LNK1561: entry point must be defined Newbie (to OpenCOBOL not to COBOL) here ... I am trying to follow the examples in the UserManual/2_3 showing how to link between a COBOL program and a C program. I have downloaded the 1.1 binaries from kiska.net, but only have VS2003 and VS2008 on my machine; not VS2005 so not sure if that is causing the problem. I can compile fine but when I try the following line cobc -x -o hello hello.obj say.obj I get : /out:hello.exe hello.obj say.obj c:/OpenCobol/libcob.lib c:/OpenCobol/gmp.lib Creating library hello.lib and object hello.exp LINK : fatal error LNK1561: entry point must be defined . I have tried putting ENTRY "hello" in hello.cob it tells me I have my entry duplicated. . Would greatly appreciate some pointers. Many thanks in advance. ---------------------------------------------------------------- How did you compile hello.cbl ? ---------------------------------------------------------------- cobc -c -static hello.cob (The web suggests using -fmain but that wasn't recognised, nor was -main which I found in another forum post). ---------------------------------------------------------------- By default "-m" (DLL) assumed cobc -c -x ... ---------------------------------------------------------------- Maybe you want to compile OC with latest 1.1 source + fixes of this community. There are project files available for MSVC 2008 (don't forget to change defaults.h according to your paths). With that files I used [code]cl -I ... -c hello-dynamic.c cobc -x -o hello-d hello-dynamic.obj hello-d.exe Cannot find module 'say' cobc -m say.cob hello-d.exe Hello World! cl -I ... -c hello-static.c cobc -c -static say.cob cobc -x -o hello-s hello-static.obj say.obj hello-s.exe Hello World![/code] There were some warnings during compile but no errors. human ---------------------------------------------------------------- Subject: Bug in cobc for MSVC: mt.exe is called too often There is a small bug in cobc.c concerning the following lines [code]#if _MSC_VER >= 1400 /* Embedding manifest */ if (ret == 0) { if (verbose_output) { sprintf (buff, "mt /manifest \"%s.exe.manifest\" /outputresource:\"%s.exe\";#2", name, name); } else { sprintf (buff, "mt /nologo /manifest \"%s.exe.manifest\" /outputresource:\"%s.exe\";#2", name, name); } ret = process (buff); sprintf (buff, "%s.exe.manifest", name); cobc_check_action (buff); } #endif[/code] This is done too often, we need another check (not only ret == 0). If you have [code]cobc.exe -x HELLO.cob[/code] the call of mt.exe is fine, but it should not be called when you use a precompiled C file (like used in [url=http://www.opencobol.org/modules/bwiki/index.php?cmd=read&page=UserManual%2F2_3#content_1_1]User Manual 2.3, Dynamic C to COBOL[/url])[code]cobc -x -o hello-d hello-dynamic.obj[/code] In the 2nd case there is no manifest, therefore mt.exe fails. human ---------------------------------------------------------------- Looks to me like the "identity" is wrong. I think those "#2" should be "#1". What status/error does mt report? Roger ---------------------------------------------------------------- As I wrote before the first one with -x works fine, but at the 2nd one there is no manifest at all why mt.exe complains about missing manifest (the .exe itself works fine). human ---------------------------------------------------------------- What happens when you change as I suggested? In those calls to "mt", change the ;#2 to ;#1. Roger ---------------------------------------------------------------- [quote]human wrote: If you have [code]cobc.exe -x HELLO.cob[/code] the call of mt.exe is fine, but it should not be called when you use a precompiled C file [code]cobc -x -o hello-d hello-dynamic.obj[/code] In the 2nd case there is no manifest, therefore mt.exe fails. human[/quote] It must be called. There is manifest and I don't see mt.exe failing: [code] G:\open-cobol\build_windows\test>cobc -x -o hello-d -v hello-dynamic.obj cl /MD /Fe"hello-d" "hello-dynamic.obj" g:\open-cobol\build_windows\win32\debug\libcob.lib g:\open-cobol\build_windows\win32\gmp.lib Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. Microsoft (R) Incremental Linker Version 8.00.50727.762 Copyright (C) Microsoft Corporation. All rights reserved. /out:hello-d.exe hello-dynamic.obj g:\open-cobol\build_windows\win32\debug\libcob.lib g:\open-cobol\build_windows\win32\gmp.lib mt /manifest "hello-d.exe.manifest" /outputresource:"hello-d.exe";#2 Microsoft (R) Manifest Tool version 5.2.3790.2075 Copyright (c) Microsoft Corporation 2005. All rights reserved.[/code] Manifest is necessary. I saw exe not running correctly but actually more problems are with DLLs - they could just quietly run incorrectly ---------------------------------------------------------------- In general mt.exe is VERY necessary when using MSVC >= 8. There's no difference in using #1 and #2. Original version "cobc.exe -x HELLO.cob -v", [quote]calling: mt /manifest "HELLO.exe.manifest" /outputresource:"HELLO.exe";#2 Microsoft (R) Manifest Tool version 5.2.3790.2076 Copyright (c) Microsoft Corporation 2005. All rights reserved. Exit code from call: 0[/quote] Original version "cobc -x -o hello-d hello-dynamic.obj -v", [quote]calling: mt /manifest "hello-d.exe.manifest" /outputresource:"hello-d.exe";#2 Microsoft (R) Manifest Tool version 5.2.3790.2076 Copyright (c) Microsoft Corporation 2005. All rights reserved. hello-d.exe.manifest : general error c1010070: Failed to load and parse the manifest. Exit code from call: 31[/quote] New version "cobc.exe -x HELLO.cob -v", [quote]calling: mt /manifest "HELLO.exe.manifest" /outputresource:"HELLO.exe";#1 Microsoft (R) Manifest Tool version 5.2.3790.2076 Copyright (c) Microsoft Corporation 2005. All rights reserved. Exit code from call: 0[/quote] New version "cobc -x -o hello-d hello-dynamic.obj -v", [quote]calling: mt /manifest "hello-d.exe.manifest" /outputresource:"hello-d.exe";#1 Microsoft (R) Manifest Tool version 5.2.3790.2076 Copyright (c) Microsoft Corporation 2005. All rights reserved. hello-d.exe.manifest : general error c1010070: Failed to load and parse the manifest. Exit code from call: 31[/quote] All four are working. [b]It seems like there is no need for mt.exe if there is no preprocessing/translating done by OC AND MSVC 2008 is used[/b]. Is there a possibility to know this and to not call mt.exe in this case? human ---------------------------------------------------------------- Actually, I think the prob is with MSVC 8. The clue is in the version of the mt tool. That's from an earlier MSVC version. According to some reports I looked at on the web, MSVC 8 does not have a mt.exe ? What now? Roger ---------------------------------------------------------------- Ska, did you tried to use a precompiled C file (like used in [url=http://www.opencobol.org/modules/bwiki/index.php?cmd=read&page=UserManual%2F2_3#content_1_1]User Manual 2.3, Dynamic C to COBOL[/url])[code]cobc -x -o hello-d hello-dynamic.obj[/code] There is no manifest generated from cl.exe Version 9 (=MSVC 2008) when you have this special case. Is this different with MSVC 8? human BTW: I use MSVC 9 Express (_MSC_VER = 1500), ska seems to use MSVC 8 (_MSC_VER = 1400). Maybe the mt.exe was not shipped with MSVC 8 Express (if it wasn't shipped it could be downloaded with SDK), but is clearly shipped with MSVC 8. What I find interesting is the version of mt.exe. The one of ska and mine seems to be nearly the same. ---------------------------------------------------------------- [quote]human wrote: Ska, did you tried to use a precompiled C file[/quote] Sure I did VS2008: [code] G:\open-cobol\build_windows\test>cl /c -I g:\open-cobol\build_windows\.. -I g:\open-cobol\build_windows\win32 -Ig:\open-cobol\build_windows /MD /Fo"hello-dynamic.obj" hello-dynamic.c Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. hello-dynamic.c G:\open-cobol\build_windows\test>cl /Od /MD /Fe"hello-d" "hello-dynamic.obj" g:\open-cobol\build_windows\win32\debug\libcob.lib g:\open-cobol\build_windows\win32\gmp.lib Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. Microsoft (R) Incremental Linker Version 9.00.21022.08 Copyright (C) Microsoft Corporation. All rights reserved. /debug /out:hello-d.exe hello-dynamic.obj g:\open-cobol\build_windows\win32\debug\libcob.lib g:\open-cobol\build_windows\win32\gmp.lib[/code] manifest produced - hello-d.exe.manifest [code] [/code] ---------------------------------------------------------------- [quote]human wrote: What I find interesting is the version of mt.exe. The one of ska and mine seems to be nearly the same.[/quote] I have like 7 or 8 mt.exe, some of different sizes, but most of them report version 5.2.3790.2075 There is no mt.exe inside VS2008 directory tree. But cl from VS2008 generates manifest file. I don't know if its embedding is required for VS2008. ---------------------------------------------------------------- I wonder why we even need the separate invocation of "mt". Can't we simply tack on "/LINK /MANIFEST" at the end of the compile/link invocation? Roger ---------------------------------------------------------------- [quote]simrw wrote: I wonder why we even need the separate invocation of "mt". Can't we simply tack on "/LINK /MANIFEST" at the end of the compile/link invocation? Roger[/quote] Hi Roger, Unfortunately "/link /MANIFEST" is a default, and it is not embedding manifest, it is just creating the manifest file. And without embedding most likely you will not be able to load DLL. ---------------------------------------------------------------- I thought this particular thread was about the step when creating executables. So I suppose the question is - If, when and under what circumstances do we need to embed a manifest in a .exe. Roger ---------------------------------------------------------------- Simple answer: always when it is generated. If we would check if a manifest is in place, before calling mt, this would be a solution. If we can force cl to always generate a manifest, we have no problem. Just tested this: If I use /link /MANIFEST on cl.exe, the manifest is generated in this case, too and therefore it's OK to use mt.exe. human ---------------------------------------------------------------- [quote]human wrote: Simple answer: always when it is generated. If we would check if a manifest is in place, before calling mt, this would be a solution. If we can force cl to always generate a manifest, we have no problem. Just tested this: If I use /link /MANIFEST on cl.exe, the manifest is generated in this case, too and therefore it's OK to use mt.exe. human [/quote] Yes, perfect idea. We can check if manifest file is present before calling mt. And I am under impression that manifest is always generated by "link.exe" by default. ---------------------------------------------------------------- So, am I right in the following assuming version >=1400 - Append "/link /manifest" to the compile command when creating module/executable (3 places in cobc.c). If non-verbose I assume we can append "/link /nologo /manifest". Roger ---------------------------------------------------------------- Yes, should work fine. human ---------------------------------------------------------------- I changed my local copy and added "/link /nologo /manifest", tested again and must see: it works fine. human ---------------------------------------------------------------- Subject: Latest draft of ISO COBOL revision The latest draft of the ongoing ISO COBOL revision, is available from the PL22.4 home webpage at: [url=http://www.cobolstandard.info/j4/index.htm]http://www.cobolstandard.info/j4/index.htm[/url] or can be donwloaded directly from: [url=http://www.cobolstandard.info/j4/files/std.zip]http://www.cobolstandard.info/j4/files/std.zip[/url] This is the August 2009, CD 1.2 version. ---------------------------------------------------------------- Thank you! Do you know about the current efforts about [url=http://www.cobolstandard.info/j4/files/07-0005.doc]07-0005 (WG4N0267, DTR 24716, SC22N4172, JTC1N8456)[/url] – Native COBOL Syntax for XML Support (Schricker)? There is one page (42) of unresolved technical issues but the biggest should be resolved with the ANY LENGTH item. human ---------------------------------------------------------------- There were two items that needed MAJOR "re-work" in the revision work - according to the last ISO review. OO polymorphism/overloading and ANY LENGTH. To the best of my knowledge there has been no progress on the ANY LENGTH "re-work". NOTE This does NOT impact the ANY LENGTH 01-level in Linkage Section feature that was introduced in the '02 Standard. As far as XML. The XML TR (Technical Report) is approved and official - but not implemented by anyone. I do not see any of the standards groups having the resources to work on responses to the TR defect paper any time soon. ---------------------------------------------------------------- Hi wmklein, just in case you want to submit a message to the ISO team: There is an important typo, leading in non-compilable sample code. The point is missing (the big one in the code below, after SOURCE-COMPUTER) [code] >>SOURCE FORMAT IS FREE IDENTIFICATION DIVISION. PROGRAM-ID. Free-form-example. SOURCE-COMPUTER[b][size=x-large].[/size][/b] xyz WITH DEBUGGING MODE.[/code] The error was included in ISO/IEC 1989:2002(E), E.23 and is not revised in in ISO/IEC 1989:20xx CD 1.2(E) Chapter C.25. human ---------------------------------------------------------------- Thanks. The editorial correction has been sent in. ---------------------------------------------------------------- Subject: RETURNING structures from COBOL to C Hiya, Firstly thanks to ska and human for their help yesterday. I managed to compile OC11 under VS2008 successfully. I am now trying to build a C program that passes structures to COBOL and returns them. It seems that RETURNING only allows simple structures, such as RETURN-CODE, etc. Is this correct ? Are there any examples of passing and returning larger structures (ala COMMAREAs in CICS). Thanks. ---------------------------------------------------------------- For COBOL, RETURNING is only for moving the internal defined RETURN-CODE to a self defined var. For structures "CALL USING ..." (if C or COBOL are called by COBOL) or "PROCEDURE DIVISION USING ..." (if COBOL was called by another COBOL module or by C) can be used. The sample you've compiled yesterday passes two vars from C to the program with the content "HELLO " and "WORLD!". These could be changed by COBOL and would be available back in C. Try this by "MOVE 'C!' TO WORLD" in say.cob and output this in hello.c to stdout. human ---------------------------------------------------------------- Thanks ... i have worked it out now as long as i have all PIC X in my structures. Out of interest, when is the programming guide expected to be available ? ---------------------------------------------------------------- It should be able to use other PICTUREs, too (especially some nice C types), but I'm not familiar with this. Maybe ska or others have some samples about that. Concerning the guide: it would be better to ask questions about a specific thing in the specific topic. If I'm right there is a draft copy that you can grab. human ---------------------------------------------------------------- Subject: how to call CBL_GET_CURRENT_DIR hi, how to use / call CBL_GET_CURRENT_DIR? i could not found i description... please help... cu kregen ---------------------------------------------------------------- call "CBL_GET_CURRENT_DIR" using by value flags by value dir-length by reference dir returning status-code 01 flags pic s9(9) comp-5 value 0. 01 dir-length pic s9(9) comp-5 value 2048. 01 dir pic x(2048). 01 status-code pic s9(9) comp-5. on success status-code is 0. ---------------------------------------------------------------- thanks a lot... ---------------------------------------------------------------- Brian, please add this to our beloved OC-FAQ! human ---------------------------------------------------------------- Or even - [code] call "CBL_GET_CURRENT_DIR" using by value 0 by value LENGTH OF dir by reference dir returning status-code end-call [/code] Which divorces the actual length of "dir". Note the "returning" is optional in which case the register RETURN-CODE will contain the status. Roger ---------------------------------------------------------------- Subject: WIN32: Problem with "cross" compiling, e.g. use compiler 1 for OC itself and compiler 2 with OC If you use MSVC 2000 for compiling OC (on machine 1) and MSVC 2008 as your compiler (on machine 2) you have a problem. Same occurs if you use MinGW on 1st/2nd time. The problem: We use compiler switches like "#ifdef _MSC_VER" = compile time. Therefore if you compiled the OC compiler & runtime with MSVC 2000 (or MinGW) mt.exe would never be called, although it would be necessary on machine two where you use the compiled stuff of machine 1 to compile with MSVC 2008. It would be better to use only "#ifdef _WIN32" and decide what compiler options we should use on run time via environment switches. For a quick & dirty hack we could force the user to set things like MSCVER=14, ... human ---------------------------------------------------------------- [quote]human wrote: The problem: We use compiler switches like "#ifdef _MSC_VER" = compile time.[/quote] Hi Human, Unfortunately the problem in OC is bigger than that if you want to cross-compile into different platform/arch. You can't produce 64-bit using OC compiled with 32-bit and vice versa. My point is that "it is not a problem". It is a known issue, and because you always have OC sources, than you always can make OC for your platform. Period. I think much better investment would be to switch from "char cc[n]" representation of Cobol structures into named struct/unions, and eventually to C++ generation, so for the Cobol 01 V PIC S9(9)V99 you can produce C++ COMP3<11,2> V; ---------------------------------------------------------------- Subject: WRITE ... FROM ... AFTER ADVANCING PAGE - bug ?? Hi, It seems to me the following code does not work right. And the problem is that we don't put trailing "\n" if we have AFTER ADVANCING PAGE. We are setting "f->flag_needs_nl = 1" but not using it later :-( Possibly this patch is not enough because I think we should "eat" previous [CR]LF if we are writing FF test: [code] 000050 IDENTIFICATION DIVISION. 000060 PROGRAM-ID. PRNTEST. 000130 ENVIRONMENT DIVISION. 000140 CONFIGURATION SECTION. 000150 INPUT-OUTPUT SECTION. 000100 FILE-CONTROL. 000120 SELECT AUDPRINT 000300 ASSIGN EXTERNAL PRINT1 000330 ORGANIZATION IS LINE SEQUENTIAL. 000170 DATA DIVISION. 000180 FILE SECTION. 000190 FD AUDPRINT 000230 LABEL RECORDS ARE STANDARD. 000240 01 PRINT-LINE. 000240 05 PRINT-FILLER PIC X VALUE SPACE. 000240 05 PRINT-LINE-1 PIC X(113). 000410 WORKING-STORAGE SECTION. 000710 01 PAGE-CNTR PIC 9(3) VALUE 0. 000000 01 PRINT-TITLE00. 000000 05 FILLER PIC 9 VALUE 1. 05 P-FILLER PIC X(113) VALUE SPACES. 001160 01 PRINT-TITLE0. 002110 05 FILLER PIC X(02) VALUE SPACES. 001180 05 FILLER PIC X(11) 001190 VALUE 'REPORT ID :'. 001200 05 REPORT-ID PIC X(09) VALUE '12345'. 001210 05 FILLER PIC X(13) VALUE SPACES. 001220 05 FILLER PIC X(37) 001230 VALUE '**** ***** ***** REPORT ** ***** ****'. 001240 05 FILLER PIC X(12) VALUE SPACES. 001250 05 FILLER PIC X(06) 001260 VALUE 'AS OF '. 001270 05 AS-OF-DATE. 001290 10 FILLER PIC X(10) VALUE '01/01/2001'. 001340 05 FILLER PIC X(04) VALUE SPACES. 001350 05 FILLER PIC X(05) VALUE 'PAGE '. 001360 05 PAGE-COUNT PIC Z,ZZ9. 001390 01 PRINT-TITLE1. 002110 05 FILLER PIC X(02) VALUE SPACES. 001410 05 TITLE-NAME1 PIC X(32) VALUE 'TITLE1'. 002110 05 FILLER PIC X(80) VALUE SPACES. 001440 01 PRINT-TITLE2. 002110 05 FILLER PIC X(02) VALUE SPACES. 001460 05 TITLE-NAME2 PIC X(32) VALUE 'TITLE2'. 002110 05 FILLER PIC X(80) VALUE SPACES. 001490 01 PRINT-TITLE3. 002110 05 FILLER PIC X(02) VALUE SPACES. 001510 05 TITLE-NAME3 PIC X(32) VALUE 'TITLE3'. 002110 05 FILLER PIC X(80) VALUE SPACES. 001050 PROCEDURE DIVISION. 001150 OPEN OUTPUT AUDPRINT. 003130 MOVE ZEROS TO PAGE-CNTR. MOVE SPACES TO PRINT-LINE. MOVE SPACES TO P-FILLER. 003150 ADD 1 TO PAGE-CNTR. 003160 MOVE PAGE-CNTR TO PAGE-COUNT. 003180 WRITE PRINT-LINE FROM PRINT-TITLE00 003200 WRITE PRINT-LINE FROM PRINT-TITLE00 AFTER ADVANCING PAGE 003230 WRITE PRINT-LINE FROM PRINT-TITLE0 003230 WRITE PRINT-LINE FROM PRINT-TITLE1 003200 WRITE PRINT-LINE FROM PRINT-TITLE00 AFTER ADVANCING PAGE 003240 WRITE PRINT-LINE FROM PRINT-TITLE2 003250 WRITE PRINT-LINE FROM PRINT-TITLE3. 003150 ADD 1 TO PAGE-CNTR. 003160 MOVE PAGE-CNTR TO PAGE-COUNT. 003200 WRITE PRINT-LINE FROM PRINT-TITLE0 AFTER ADVANCING PAGE 003180 WRITE PRINT-LINE FROM PRINT-TITLE00 003180 WRITE PRINT-LINE FROM PRINT-TITLE00 003150 ADD 1 TO PAGE-CNTR. 003160 MOVE PAGE-CNTR TO PAGE-COUNT. 003200 WRITE PRINT-LINE FROM PRINT-TITLE0 AFTER ADVANCING PAGE 003180 WRITE PRINT-LINE FROM PRINT-TITLE00 003550 CLOSE AUDPRINT 003640 GOBACK. [/code] patch to fileio.c: [code] *** fileio.c.orig 2009-01-24 08:31:30.000000000 -0500 --- fileio.c 2009-09-16 12:56:03.000000000 -0400 *************** *** 1291,1296 **** --- 1291,1301 ---- f->flag_needs_nl = 0; } + if (f->flag_needs_nl && !unlikely(f->flag_select_features & COB_SELECT_LINAGE)) { + putc ('\n', (FILE *)f->file); + f->flag_needs_nl = 0; + } + if (unlikely(eop_status)) { eop_status = 0; cob_exception_code = 0x0502; [/code] ---------------------------------------------------------------- No, it works correctly as is. The results agree exactly with what Micro Focus produces. Note that in absence of a BEFORE/AFTER clause, a default BEFORE 1 is assumed. Before Bill pipes up and says that the standard says otherwise, note that we are talking about LINE sequential which is a common extension and that Micro Focus also uses this default for L/S files. Roger ---------------------------------------------------------------- [quote]simrw wrote: No, it works correctly as is. The results agree exactly with what Micro Focus produces. Roger[/quote] Hi Roger, My MicroFocus produces different result ! For some strange reason (on both Windows and AIX) it inserts 0D after the line and not NOTHING as OC (but not 0D 0A or 0A on unix) Fujitsu [correctly] adds 0D 0A after line, so 2 lines are not merged, but it does not strip trailing spaces (which is also okay for me) Also, this test works as expected on Mainframe (yes, there are no line sequential) - I mean you don't have 2 lines merged into one. ---------------------------------------------------------------- Bill (not talking about the Standard, but about the Micro Focus documenation), I am [u][i][b]not[/b][/i][/u] certain about this, but given the reports of different behavior between your versions of MF compilers, I checked and there does not (seem) to be a switch/directive for this. [u][i][b]HOWEVER[/b][/i][/u], the doucmenaation on the +L2 run-time switch (which impacts READS) does talk about "compatibility with earlier releases" and does seem as if it MIGHT explain this. Obviously, my recommendation would be to produce the "most useable" file for the (extension) line sequential output - regardless of what MF does. ---------------------------------------------------------------- Hmm, It's this carriage-return thingy. At line 1271 (libcob/fileio.c) we have - [code] if (unlikely(f->flag_select_features & COB_SELECT_LINAGE)) { putc ('\n', (FILE *)f->file); } [/code] Change that to - [code] if (unlikely(f->flag_select_features & COB_SELECT_LINAGE)) { putc ('\n', (FILE *)f->file); } else if (opt & COB_WRITE_PAGE) { putc ('\r', (FILE *)f->file); } [/code] That should cater for both BEFORE and AFTER PAGE. Checked byte for byte against Micro Focus. Note this is peculiar anyway as it depends on what a printer (or printer driver) does with a single CR. It may cause an overprint. I am not particularly happy with this. Single CRs should not appear EXCEPT in one situation which is a BEFORE/AFTER 0 which really should imply/cause an overprint. There is a good case for arguing that OC is already doing the right thing. The basic problem is the implied mixture of AFTER/BEFORE in the prog. (PAGE is not really relevant, same applies to lines) The next tarball will have a compile flag to control default behaviour - "-fwrite-after" so that you may change the default behaviour of implicit BEFORE. Roger Addendum - Actually I am getting more convinced that OC is correct. Consider - WRITE ... AFTER 1. WRITE ... BEFORE 1. What I expect is a new-line followed by the concatenated writes, followed by a new-line. I do NOT expect a CR anywhere in there. Roger ---------------------------------------------------------------- Subject: ASCII Extended (IBM PC Character Set) Hello. Under WinXP in a DOS window how it's possible to display characters of the IBM PC Character Set especially the character hex 128 to 254 (for hex 20 to 7E it is Ok) Thank you for your help. ---------------------------------------------------------------- Subject: OpenCobol Compiler+ Team? - Roger need input. Roger, We've talked before about getting folks to help contribute to the compiler. On add1tocobol we're having folks do things like creating SQL engines and so on. We're going to try to push more of this forward soon. Additionally though there are folks that are willing to help you with the compiler, documentation, libraries and so on. So we would like to proceed with your input. I can be emailed at aoirthoir@add1.to now. Also I am working on getting the Sunday meetings going again so we can start to plan more solidly. If a different day is better, I can modify that. But OC1.1 especially is really moving forward and we'd like to see it be a major force, for our projects and others. Kind Regards Aoirthoir ---------------------------------------------------------------- How can I help? My programming skills are Object Pascal and Java (I was a very good COBOL developer but thats was almost 20 years ago!). Sorry no C, but may be documentation or testing? Some one interested on program generator writen in COBOL? Bindings for GUI? (Win32, sorry no GTK nor KDE) Regards. ---------------------------------------------------------------- ssamayoa, We've need for a lot of things. Right now the following are in process: 1. CGI. (A product CGIgnite is in process soon to be GPLed). 2. MySQL (much done a bit more to do, including copybooks). 3. SQLite. NEW..not done yet 4. PGSQL. 5. ISAM (not sure where we stand with that but BDB has issues right now with losing data occasionaly, so its out). 6. ANY cobol programs that you own the copyrights on that you are willing to FOSS. (We have many now thanks to Vincent). 7. Ditto Cobol Copybooks. Other things include more help with the documentation. I'm not sure how much more we will need beyond CutlerGL's OpenCobol Programmers Guide. But things with screen shots, tutorials and so on, yes very helpful. So we're looking at several main areas if I break it down: 1. Help directly to Roger to implement more options directly in the compiler. Requires knowledge of C AND Roger's coding standards. 2. Help creating callable libraries. Knowledge in C, PHP, Java, Ruby and so on helpful depending on the library we are ultimately linking to. For instance we might for ease of use create callables to PHP string functions. But those might also be C instead and so on. Requires knowledge of how to do OC callables and the language in question AND Roger's naming standards (OC_CBL_SOMEFUNCTION). 3. Documentation, IRC help room, tutorials etc. This also includes articles for Cobol Magazine. The call has gone out several times, including to me. I've missed several opportunities to to time constraints but I'm moving to better manage my time. In any case we've been requested to write as many articles as we can stand for Cobol Magazine about OpenCobol. 4. Programs, copybooks, User Defined Functions (when UDFs are implemented) in Cobol. Would others like to add to the list? Look at my signature to see info about how we're meeting on Sundays. I'll be getting those going again. Kind Regards, ---------------------------------------------------------------- Bumping to the Top and... We are starting to get more folks into the chat so that is good. Now we just need to keep on herding. JCurrey and his crew added their CGIgnite to the repository, I will be making a separate post about that. Thanks guys. More help means more progress for us all. Kind Regards ---------------------------------------------------------------- Subject: command line argument * Hi, i am trying to write some sample programs with OpenCobol just for fun and i am stuck at one point now. I am writing a small calculator, which accepts 3 arguments from the command line, like ./calculator 4 + 28 and displays the result. All fine and good, but when i try to pass a '*' for the multiply operator to the program, like ./calculator 3 * 9, i run into trouble, because * gets expanded to the list of local files, like "echo *" in bash. Replacing '*' with '\*' or putting it into quotes doesn't work either. I tried both to get the arguments, PROCEDURE DIVISION CHAINING... and ACCEPT operand FROM ARGUMENT-VALUE but no success :-( Any ideas what i might do wrong? I am using OpenCobol 1.0.0 under Ubuntu. ---------------------------------------------------------------- The problem is your bash that extends the asterisk. Maybe it's better to use only one command line argument and do[code]UNSTRING cmdarg DELIMITED BY ALL SPACES INTO firstarg secondarg thirdarg END-UNSTRING[/code] and call this prog form cmd-line with [code]./myprog "3 * 9"[/code] human ---------------------------------------------------------------- Thanks for the hint, the problem was the script i used to call the program ./calculator $* When i change it to ./calculator 3 \* 9 it works fine :-) ---------------------------------------------------------------- Subject: How to put the cursor in the fourth field Hi there, ich have a screen defined in the screen section with four fields. I want that the user can enter both fields. but when the screen is shown i want that the cursor was in the fourth field. How con i do it? SCREEN SECTION 01 VORSPANN-EIN. 02 LINE 17 COLUMN 20 PIC 99 USING DAT-TAG AUTO. 02 LINE 17 COLUMN 23 PIC 99 USING DAT-MON AUTO. 02 LINE 17 COLUMN 26 PIC 9999 USING DAT-JAHR AUTO. 02 LINE 19 COLUMN 20 PIC X(10) USING PASSWORT-1 SECURE. PROCEDURE DIVISION. . . . . ACCEPT VORSPANN-EIN <-- What must following here? best regards kregen ---------------------------------------------------------------- The concept of screen element is that all must be entered in the order of the sub elements from first element to last unless of course the input inst canceled via exception key. There is no way to tell to a cobol program to start input in othere subelement than firts via ACCEPT statement. There is no simple way to acomplish what you want to do. Regards. ---------------------------------------------------------------- I'm not sure if this works for OC or not, but we have the CURSOR IS clause, [quote][url=http://www.cobolstandard.info/j4/files/std.zip]latest COBOL draft[/url] wrote: During execution of an ACCEPT screen statement, the cursor is initially positioned at the first elementary screen item in the screen description entry whose specification includes a TO or USING phrase, unless the CURSOR clause is specified in the SPECIAL-NAMES paragraph, in which case the cursor is positioned as specified in that clause. [...] The initial position of the cursor is determined by the CURSOR clause in the SPECIAL-NAMES paragraph. a) If the CURSOR clause is not specified, the initial cursor position during the execution of an ACCEPT screen statement is the start of the first input field declared within screen-name-1. b) If the CURSOR clause is specified, the initial cursor position is that represented by the value of the cursor locator at the beginning of the execution of the ACCEPT screen statement. If the cursor locator does not indicate a position within an input field, the cursor shall be positioned as if the CURSOR clause had not been specified.[/quote] human ---------------------------------------------------------------- Subject: Cobol Birthday Party and the Results Well me and two of my crew met for the Cobol Birthday Party today. It was a small affair, ourselves and the editor of http://www.cobolmagazine.com Frank. We talked a lot about the future of Cobol and he has a LOT of ideas. REALLY good ideas. I will be filling in some tomorrow morning at the weekly meeting. But next week I'll be scheduling a midweek meeting so a LOT to go over with yens. It's all good and interesting news. Kind Regards ---------------------------------------------------------------- Howdy ALL! As some of yens know it is 50 years since Cobol was first given life by means of being given its name. Several of my crew had a brief lunch In Akron Ohio with Frank, the founder and editor of Cobol Magazine. So here are the results. First we are ALL pumped. This includes Frank, our local team here in Cleveland Ohio and the Add1toCobol teams. So I hope more of yall start joining us at: http://bit.ly/add1toChat for chat, shared ideas, training, and so on. More of us are starting to IDLE in there, so if you join, please feel free to idle. The more of us there, the greater chance someone will be around when you are there. Frank will make some announcements himself but he has a way for folks that want to use a proprietary compiler, to upload programs to his server for compile. Agreements are in place with the provider of the compiler, so its legal and provides an interesting business model. Of course we talked about doing the same thing with OpenCobol. I've already started to hand out user accounts on my dreamhost for people that want to test OpenCobol with the web. But if we could move entirely to a Web Based interface, including a web based IDE, even better! He did give us some recommends to make OpenCobol an even stronger competitor in the market, which covered the same issues we talked about in #add1.to chat. These include documentation (on the way thanks to Gary), a support system for PAID support (ideas are flowing but we need help!), GUI, easy web interface, easy windows install, User Defined Functions and other things. Basically the very same things we've been talking about for a while and have gradually been implementing. But now we want to move full steam ahead. Another thing he wants to do is FOSS a LOT of code. He, and many Cobolers have DECADES of code available. Thanks to Vincent Coen, we've already got a lot of code. But the more we get, the better the ecosystem for all of us. He knows many Cobolers and is already in talks with them to FOSS their code. So this looks to move ahead rapidly. As much as possible the code will be posted to the add1 subversion Repository. We will keep everyone updated. Anyone that would like to add their own code just email me at aoirthoir@add1.to. Another topic he brought up was that all of the Cobol compilers are basically stealing customers from each other. But having the issues above solved, will create reasons for persons to choose Cobol instead of say php, c, ruby, and so on. We've talked more about this on add1.to chat yesterday. So Currey Adkins (Jim and his crew) are already studying what they need to do to contribute. I will be sending out another, but we really need to get a team together to help Roger so we can push this stuff forward and the team is forming. If you want to be a part of it, please be in #add1.to chat on irc.mibbit.com (from the web again that address is http://bit.ly/add1toChat ). Even if you are idling, you'll be able to skim the chat and contribute, or benefit real time. If anyone has any questions please feel free to respond, we're excited about where we are going to be taking Cobol thanks greatly to OpenCobol amongst many others. Kind Regards Aoirthoir -- Aoirthoir An Broc http://www.add1.to Regular Add 1 To meetings: Where: MIBBIT IRC (irc.mibbit.com) Channel: #add1.to Access from the web: http://bit.ly/add1toChat Date: Sundays Time: 9:00am Eastern ::::::::NOTE IMPORTANT:::::::::: There has been some confusion as to the time. I believe this is because the United States uses Daylight Savings Time. On top of this the Government recently extended the dates that EDT (eastern daylight time) would run. So to be sure that you make it at 9am Eastern, I have this link: http://www.timeanddate.com/worldclock/city.html?n=179 That shows the time in New York City at the moment of viewing. It also explains the current UTC offset for the Eastern Zone in the United States. Simply compare the current time that site states, with your current time and you will know how far off we are from you. :::::::::::::::::::::::::::::::: We're there all of the time, even when we do not have a meeting. Stop on by for OpenCobol and Add 1 To Support and chat. ---------------------------------------------------------------- Subject: Im promoting OpenCobol but it is too complex for newcomers Hi. Im promoting OpenCobol in some group I participate (www.escobol.com and some Yahoo based Argentina's group) but when peope come here there is no simple way to get OC up and running like download then run. The two or tree answers I got where that there is only OC old 1.0 version and beta 1.1 with the additional problem that is linux centric. What I saw often in this groups is that they use Windows (well, I also use Windows...) and they donrt have the enougth skills to build the compiler and so. I will see how to make work the OC with Borland's compiler and write a Wiki or so but OC site need some maitenance to make more "newcommer frendly". Regards. ---------------------------------------------------------------- Agreed. The Add 1 to Cobol project is getting together more often (and we've more professionals now on board) to try to address these issues. Part of the problem is that we need a team rather than putting all of the work on Roger to implement this stuff. But also we cannot add things to this website (like a wiki or such). As well on add1tocobol.com we've installed TikiWiki which has forums, articles and so on. But it is so large (over 70mb) that it has a large learning curve. So we've been discussing doing these things in OC itself and keeping it simple. This was more difficult before, but now we're getting more tools available like CGIgnite. In short we're pushing to fulfill these needs and we need more members to help us. Join us in chat if you can: irc.mibbit.com #add1.to or http://bit.ly/add1toChat Kind Regards ---------------------------------------------------------------- You can download VS project files with patched OC sources from http://kiska.net/opencobol/human/ I'm waiting for the next pre-release to submit newer ones and current binaries for Win32. After these things I want to use the free Borland C++ 5.5 for easier distribution than with VC Express (I've started the project files already) - but I personal think Roger will need at least two weeks for the next pre-release. human ---------------------------------------------------------------- > I want to use the free Borland C++ 5.5 for easier distribution than with VC Express (I've started the project files already) How can I help you? Regards. ---------------------------------------------------------------- I can send you the current project files, and you can try to fix the Borland C compiler errors. There seem to be quite a lot things this compiler doesn't understand. The first thing would be to use defines to make the code valid for Borland, too, example from coblocal.h, [code]#ifndef __BORLANDC__ COB_HIDDEN extern long long cob_get_long_long (cob_field *); #else // Borland has no type "long long" (8 bit), we use the bigger "long double" (10 bit) instead COB_HIDDEN extern long double cob_get_long_long (cob_field *); #endif[/code] This needs some time especially if you have to do a web search for every point because you do not know about Borland C restrictions and how to work around them (like I'd have to). You could be really helpful by doing this. human ---------------------------------------------------------------- Sorry to be negative, but I am afraid that if I were trying to "promote" COBOL to Windows people who know COBOL but do not know - Unix or Linux - C that I would look for another solutions - such as the free Fujitsu Version 3 product that is available on the web. The whole OC "environment" is just to Unix/Linux/C "centric". The lack of integrated editors and source level interactive debugging - and the fact that all "discussions" about fixes/patches, etc ASSUME a "Linux/Unix" or similar "open source" mindset simply do NOT fit into the way that MOST existing COBOL people or Windows people think/work. I know that others are trying to "address" this slowly, but if you follow this group, I think that any "objective" reader would see that there is LOTS of assumptions" that relate to unfamiliar ways of working for the average Windows/COBOL (much less mainframe COBOL) person to be comfortable. Certainly "COBOL-IT" tries to address some of this. I haven't used it, so I don't know how well it succeeds. Bottom-Line: (from my perspective) If one is coming from an "OpenSource" (probably Unix/Linux) environment - especially if one is familiar with C and "C-like" environments, then there is definite place for you with OC. If, however, you are trying to "promote" COBOL to Windows or Mainframe people who know COBOL - but not C, then this is probably NOT the way to go. ---------------------------------------------------------------- I disagree with wmklein. Although you can get most out of OC (especially fix things yourself) if you have the background you're told about, we're should be able to help "Windows people" more and more. COBOL-*T has build a nice installer (something I should be able to do, too) for using it on WIN-Systems with VC 2005 or VC 2008/2008 Express (they have to be installed first). Instead of having the need to install VC Express if you haven't VC, we could have a small download with the free Borland C++ 5.5, but this needs some code adjustments (I'd really like to know about people willing and able to help with this point). The same as the installer does can be done by giving out WIN binaries (one thing I want to do after the next tarballs). For removing the need to distribute different binaries for every C compiler, I'd like to submit some patches (should be cobc only) for being able to choose the compiler via environment. As soon as I can take care of the binaries (who is willing to host them?), I'll post a short how-to for using them with PSPad. This leads to an editor with integrated "compile button", which shows you all errors directly into your source files (some things are missing in syntax highlighting but I hope the author add them - they are hardwired for COBOL in this app). COBOL-*T has two good points: - a COBOL debugger (the thing I miss most for OC), this is surely an important thing for OC to do. - paid support (I think Roger mentioned he is willing to do this, too; but I'm not sure about his time for that) The other points should be achieved more easy. human ---------------------------------------------------------------- Human I have a couple of windows licenses, so I could set up a system at my home to test all of this. I agree with everything you say. I would also like to see installs as easy for GNU/Linux as for windows, so apt-get based on Debian. I don't use the others so no word on any of that. BUT as important is the need for our programs to install, without the need to install OC or compile and so on. Basically these are the things we are talking about in the chat, so the more participation we get the more we can start to create lists. Also as far as hosting your binaries, I'm more than willing. Kind Regards, ---------------------------------------------------------------- For the distributing of OC programs you need libcob.dll (+ cobcrun.exe if you haven't compiled the main program with -x) + isam dll (libdb44.dll / libvbisam.dll / ...) + screen dll (ncurses.dll) + runtime dll from C compiler (for example Visual C++ Runtime, not sure about Borland C [but that's a longer way to go]) and if cygwin was used all these dlls must be taken from the cygwin installation + cygwin1.dll (maybe some others, too). @aoirthoir: should I send the binaries to your add1.to address? @aoirthoir (2): I still wait for the dreamhost login, maybe you didn't received my mail (I've sent it shortly after your offer)? human ---------------------------------------------------------------- Yes, I would like to see the installation easier for Windows people. HOWEVER, I don't think that is where the problems exist. The problems exist in: - Editing the source code - debugging applications - building the applications - interfaces with packages (DB, GUI, etc) - final applicaion packaging - application distribution ALL of those, with OC, currently seem to be Linux/Unix/C "based". If you don't understand how those work (or other 'OpenSource" tools work), a Windows or mainframe COBOL programmer will get frustrated and not "prommoted" to use COBOL by the OC system. Or at least that is my impression. ---------------------------------------------------------------- William, Yes those are the things we need to fix. And why we need a team. Human, email me, I am setting you up entirely. I am also adding you to the add1 subversion repository. Commit early, commit often. In any case, everything should be in the repo so we have a running history of it. I'm going to start putting the OC files in there as well, do a diff from release to release, and commit the changes, so all of us can follow. Regards ---------------------------------------------------------------- Subject: where are the latest sources of OC 1.1? I througt that lates sources where in sf but it says that last commit was in oct 2008. Where can I get them? I mean, latest sources of OC 1.1 Regards. ---------------------------------------------------------------- You find the last ones (currently from February) to the left "1.1 pre-release". human ---------------------------------------------------------------- But has "Submitted Date: 2007/12/27". Or is another outdated text in the site... And the LATEST working copy of the OC? Regards. ---------------------------------------------------------------- The current pre-release is working quite well, as always: the next will be better. The Date is the announcement (= 1st OC 1.1 pre-release), when you open it you find a tarstamp.h inside, telling you the "real date" of the tarball. I personally would like to have each pre-release on sf, too, but Roger doesn't want to have the extra effort (@Roger: if you would add me to the project team at sf, I'd like to take care of adding the pre-releases for you). human ---------------------------------------------------------------- The latest date that I have for that Human is Feb 09. Anyone know where we stand or how we can help Roger with this? Roger, we've a lot of folks offering time, what can we do? ---------------------------------------------------------------- Subject: How to share programs and data with OpenCOBOL Let 2 PC, the PC A and PC B. Both running under WinXP. OpenCOBOL is installed on the PC A under Cygwin and everything works fine. On this PC A I can compile and run my programs in the “d:\oc\pgms” directory. In this directory are also data files. Since the PC B I would like to share these programs and data. On the PC B I copied all the DLL Cygwin in the “c:\dllcygwin” directory I then added that directory to the "path" When I run a program located on the PC A in “d:\oc\pgms” I have the following message: "Error opening terminal: cygwin. " I also try with the DLL Cygwin directly in the Windows\system32 directory of the PC A and then same error. Can anyone help me? Thank you. ---------------------------------------------------------------- Subject: Add 1 to Chat Regular Meeting Schedule, Call for Comments We are now having greater numbers of folks idling in chat. Some of yens might be coming from here, others seem to be coming from mibbit itself. We are trying to move forward a LOT with OpenCobol and all of the libraries, Cobol Code contributions and other plans. Of course we are in #add1.to chat on irc.mibbit.com (from the web: http://bit.ly/add1toChat ) practically all of the time now. So a lot of topics are covered throughout the day. If you're not there you're missing out on some interesting conversations. But besides these we want to meet every week to get us all on the same page, with the same plans. SOOOOOO I am seeking comments on when would be the best time for us to meet in regular meetings. Please respond via this forum or the email (preferably both to spur conversation) as to the best times personally for you. During the week? Evenings? Mornings? Weekends? Sundays? (If you like, you can join our Cobol meetup at http://cobol.meetup.com/1 even if you do not live in the Cleveland area and respond to the poll here: http://cobol.meetup.com/1/polls/205324/ ) I will tally all of the requests and try to create flexible meetings so the most folks can attend. Kind Regards. ---------------------------------------------------------------- Subject: SHARED PROGRAMS AND DATA Hello. Sorry, I do not use UNIX, C, and Cygwin like a guru. I can handle (a bit) Windows, MSDOS and COBOL. I managed (with the help of some members) to run (compile and run) programs written with OpenCOBOL. It's works fine. Under WinXP + Cygwin. When multiple users wish to share programs and data located on a single computer of the group, should there be a C compiler (and runtime) installed on each of them or only on the computer where CYGWIN, OpenCOBOL well on programs and data. Thank you for your help. ---------------------------------------------------------------- The C compiler needs to be only on the compiling PC. The others will need the right dll files, which are at least (for cygwin): cygcob-*.dll, cyggmp-*.dll, cygintl-*.dll, cygdb-*.dll (when BDB is used, if not, take cygvbisam-*.dll), cygiconv-*.dll and cygncurses-*.dll. You can copy them to %WINDIR%\SYSTEM32 or (which I would do) just put them to the folder where your programs are. human ---------------------------------------------------------------- Human. Thank you very much for your help. But, sorry, I still have the same error message: Error opening terminal: cygwin I have forgotten something ... but what? In the 2 cases : DLL in the programs'folder or in the windows\system32 folder ---------------------------------------------------------------- You mention "terminal". Does your COBOL pegram use "enhanced Accept/Display' for SCREEN I/O. I am out-of-my-depth here, but I would guess that you may need some/most "lots" of the NCURSES stuff, if yo do that. I don't know how that works with "native" Windows and not CCygwin or similar environments. ---------------------------------------------------------------- Hello M. Bill Klein. Thank you for your help. I used your valuable documentation "Getting Started with OpenCOBOL for Dummies (like me)" to install OpenCOBOL with Gygwin under a Windows XP platform with success. Thank you. Everything works perfectly on this computer (edit,compiling and run programs). I work under WinXP in a DOS windows (in character mode) and I used to accept / display in extended mode but no screen section. My problem lies in the sharing of programs and data. On the development PC everything works well C:\cygwin and C:\OC\PGMS (or D:\OC\PGMS - the D: Disk is shared and mapped in M:) But from another PC where I copied all the DLL cygwin in C:\WINDOWS\SYSTEM32 directory I have the message: "Error opening terminal: cygwin" when I launch a program located on the first PC in D:\OC\PGMS or C:\OC\PGMS (M: is in this case the letter disk) I think this is a problem adjusting cygwin. I continue my research, but if you have an idea ... Hope to read you. PS: When I acquired the necessary skills, I intend to write a short installation guide to install OC with cygwin for French WIN Users. In any case I am delighted to have found OC and I am impressed by the work done by all those who have established and maintain the project OC. Bravo and thank you again. ---------------------------------------------------------------- [url=http://lists.silcnet.org/pipermail/silc-devel/2002-March/000690.html]Solutions from short google search[/url]: [quote]Error opening terminal: cygwin. This error indicates that ncurses, which are [... linked to libcob] are unable to find terminfo record for cygwin terminal. _Theoretically_ should work [before calling your start program, maybe via batch file] c:\>set TERM=3Dvt100 so ncurses will lookup TERM variable and should not use INIX terminfo because windows have for vt100 own terminfo.[/quote] human ---------------------------------------------------------------- Thank you Human. I tried to find the answer on google, but without result. I remember that I am a Windows user and I do not know UNIX / Linux and Cygwin. I tried your advice but still the same bug! Now the message is: Error opening terminal: 3Dvt100 Thank you for your help and pleasure to read ---------------------------------------------------------------- Did you tried "set TERM=vt100", too? ---------------------------------------------------------------- Hello same message on the PC N° 2 with vt100 but on the first PC if you use TERM=vt100 > no color I continue to try others way ... ---------------------------------------------------------------- I think that I asked earier if you used "scren I/O in your program. If you do, then you probably NEED to have NCURSES for Windows installed on the machine that you want to run your program on. Check out the "Download NCURSES for Windws" page at: http://gnuwin32.sourceforge.net/packages/ncurses.htm If you use the "SETUP" version from there that installs all the dependencies, then I think (but am not certain) that your screen I/O OC program MAY work. ---------------------------------------------------------------- Don't install curses on your win machines. Use the win binaries you've downloaded and wait for the next binaries for use of screen i/o despite off DISPLAY / ACCEPT without any additional clauses. human ---------------------------------------------------------------- There is either a language or a "typo" problem with the last post. I don't understand, [quote]for use of screen i/o despite off DISPLAY / ACCEPT without any additional clauses[/quote] Are you saying that with the Windows binaries, you can or cannot use "enhanced" Accept/Display - with either screen section or "at" phrases (and without NCURSES installed)? And more importantly, will this work with programs that are compiled on one machine and moved to another (where OC is not installed)? I beieve that the OP problem/question was how to compile on Windows machine and move the "object code" to another machine where NOTHING from OC has been installed. If not, what is the MINIMUM that must be installed on that 2nd machine in order to run the "compiled" program (wnd which compile options/directives should be selected when compiling theprogram - for it to run on another machine.) If there is a way to do this, then this information should be in the FAQ (or the programming guide). ---------------------------------------------------------------- The problem is that the binaries you had compiled where compiled without curses and therefore only VERY simple ACCEPT/DISPLAY work. I've put the library and the header file into the project files you currently host. Maybe you want to recompile your version with ncurses activated in config.h with these two files (if yes, please include the patch for PDcurses with colors). I wrote in the other topic which dll's are necessary. They can all be included in a distribution of the generated programs and all is fine. human ---------------------------------------------------------------- There is no native Win/DOS port for ncurses, and requires the Cygw*n POSIX UN*X like emulation layer. On the other hand, PDcurses as a front-end to the Win32(64 ???) console API, and runs in a Win-console. The library can be compiled, out of the box, using many native C compilers, including gcc-MinGW and VC. Note that a Win-console is NOT a (pseudo)terminal, in the UN*X sense of the word. In any case, I think the original posting inquired on how to run OC applications across a network share (client-server). In theory, this could be achieved by having all binaries reside on the server. A client side short-cut would set up all the paths and run the application in a Win-console, or terminal emulator. In practice, I don't think OC, using the client-server model, has been tested on either UN*X or WinXX. ---------------------------------------------------------------- I think this will be my last post to this topic... OC works very fine with PDcurses. With the patches we have in this forum use of colours works, too. But OC has to be compiled with PDcurses-support (and linked against the dll). If you put all the necessary binaries in one folder you can access your programs very fine over network share. This works fine for WIN-Systems when using VC or MinGW generated OC and files, cygwin is somewhat tricky and I wont recommend this. After the next pre release (or pre releases, depending on how much forum patches are going to be included) I'll distribute OC binaries for easy use together with a very short (more is not necessary) explanation. I don't want to do it before because the "official" pre release and the version I use (with the forum patches applied and some small other changes) are too different. human ---------------------------------------------------------------- Subject: OpenCOBOL on WinXP Native Hello to all. I do not know unix! I do not know the C language! I work with Windows XP/VISTA and WinServer. I master quite well COBOL. I ask myself the following question: Why is it so difficult to install OpenCOBOL under WINDOWS in Native mode ?? With the documentation of Mr. Bill Klein I could just touch OpenCOBOL with cygwin under WinXP (but with somes problems). Now, I was beginning to think that OpenCOBOL is reserved only for UNIX and C 'gurus. I am a little discouraged, because what interests me is OpenCOBOL, not Unix, not the C language. We are millions in this case. I find it really unfortunate because the little I have seen OpenCOBOL won me over. If we had (we puppets WinXP) what OpenCOBOL without installing cygwin or MinGW / MSYS could be a small contribution to the popularization of OpenCOBOL. Nonetheless, there still a big thank you to all those who have enabled this project to emerge. Sorry for my bad english (thank Google/translate) ---------------------------------------------------------------- Please wait some weeks, I'll distribute some VC binaries after the next patch(es). You can use the binaries from kiska.net in the meantime (copy them to C:\OpenCOBOL). The only thing that is necessary is that you install VC2008 Express (on the PC where you want to develop with OC). human ---------------------------------------------------------------- Hello from France Human. I'll wait of course. However I find it is incredible that at least one person was not able to install OC Windows natively. Thank you for your reply. Hope to read you. ---------------------------------------------------------------- Subject: OpenCobol on Win32 Platform Hello. Meanwhile ... I installed Microsoft Visual C + + 2008. From kiska.net I have downloaded these 2 files: open-cobol-1.1.20090206.tar.gz and open-cobol-1.1-win32-bin.zip After what should I do? There is no explanation how to make the installation. Frankly it should be a god or a prophet to understand ! I am lost and very, very tired. ---------------------------------------------------------------- To not spam this forum I answer your last post from another topic here, [quote] aouizerate wrote: However I find it is incredible that at least one person was not able to install OC Windows natively.[/quote] There were surely a lot of people able to do so before, either with MinGW/GNUC or with VS. I think most, if not all, compiled OC themselves but with the binaries you've downloaded (forget the .tar - these are just the sources that were used by ska to compile OC). Important information: the binaries you've downloaded are NOT capable of running input/output other than simple DISPLAY and ACCEPT. The binaries I'll distribute will be able to do so. To compile and run the programs do the following: I) For the PC that should compile: 0. Install a version of VC++, if you haven't already. 1. Extract the win32-bin.zip to C: 2. Save the following as C:\OpenCobol\set_env.bat [code]@echo off call "%VS90COMNTOOLS%vsvars32.bat" echo Setting environment for OpenCOBOL set PATH="C:\OpenCOBOL";%PATH%[/code] (if one uses an older version of VC [you don't do this], one has to change the 2nd line to VS80, ...) 3. Open the command line (for example by using [WIN]+[R], entering cmd, pressing [Enter]) 4. Enter C:\OpenCobol\set_env.bat 5. You can compile your programs by using "cobc" (for modules) or "cobc -x" (for applications), the generated .manifest-files can be deleted or left as they are. II) For every PC: 0. Be sure you have the necessary VC runtime(s) installed. Just install vcredist_x86.exe (found in the folder C:\OpenCobol), if you use another version for using OpenCobol than it was compiled with (you do, ska compiled it with VC 2005) you have to install a runtime for your VS, too (for your specific version it can be found at [url=http://www.microsoft.com/DOWNLOADS/details.aspx?FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&displaylang=en]http://www.microsoft.com/DOWNLOADS/details.aspx?FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&displaylang=en[/url]). 1. For running compiled programs put all *.dll from C:\OpenCOBOL to the folder where you have placed your programs (the generated .exe and .dll), if you don't compiled you start program(s) with -x you have to copy C:\OpenCobol\cobcrun.exe to this folder, too. human ---------------------------------------------------------------- Subject: FR: Change version number of pre release to 1.2, reason: incompatible modules Modules compiled with early 1.1 can not be run with current pre release (complaining about something not found, I think it was cob_new_display and some other entry points). Because OC having an internal check if the modules match the version of libcob/cobcrun, it would be nice to level the version number 1 step upwards. human ---------------------------------------------------------------- Subject: Error While Installing the open-cobol-1 in the Linux Sever (SUSE Ent Server 10.2) Hi , While Installing the Open-cobol-1.0 in the SUSE Linux Ent Server 10.2 I am getting this Error linux1:/home3/os_cobol/install/open-cobol-1.0 # ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether to enable maintainer-specific portions of Makefiles... no checking for gcc... no checking for cc... no checking for cc... no checking for cl... no configure: error: no acceptable C compiler found in $PATH See `config.log' for more details. Could you Please help me how to solve this Issue Thanks Karthik ---------------------------------------------------------------- Subject: File Status = 91 what does it mean??? it should mean: For VSAM only: Password failure. but i have no idea, what i do wrong i want to update a record, so i open a "line sequential" file in i-o mode(is that ok?) and use rewrite-methode. after that, i get this file status.... i use opencobol 1.1 ---------------------------------------------------------------- From looking at libcob/fileio.c [code] ... case COB_STATUS_91_NOT_AVAILABLE: msg = "Runtime library is not configured for this operation"; break; ... [/code] A quick glance over the fileio.c, 91 usually seems to get triggered if the compiler was built without WITH_DB or WITH_ANY_ISAM, but that seems a curious ./configure for OC. So, without more info on the tectonics of the compiler build (./configure especially) it remains ... curious. Cheers, Brian ---------------------------------------------------------------- Subject: Error While Installing open-cobol-1.0 (make and make install Errors) Hi , As iam trying to install the open-cobol-1.0 in the suse Linux Iam getting the Following error messages As per the Installation notes ./configure is Success Make – throws the error messages fileio.c:3488: error: 'struct indexed_file' has no member named 'key' make[2]: *** [libcob_la-fileio.lo] Error 1 make[2]: Leaving directory `/home3/os_cobol/install/open-cobol-1.0/libcob' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home3/os_cobol/install/open-cobol-1.0' make: *** [all] Error 2 Make Install – throws the Same Error message make[2]: *** [libcob_la-fileio.lo] Error 1 make[2]: Leaving directory `/home3/os_cobol/install/open-cobol-1.0/libcob' make[1]: *** [install-recursive] Error 1 make[1]: Leaving directory `/home3/os_cobol/install/open-cobol-1.0' make: *** [install] Error 2 Could any one help in this issue Thanks Karthik ---------------------------------------------------------------- Subject: problem with variable length records look at this programm: IDENTIFICATION DIVISION. PROGRAM-ID. test. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT daten ASSIGN TO "daten.dat" ORGANIZATION IS LINE SEQUENTIAL. DATA DIVISION. FILE SECTION. FD daten RECORD IS VARYING IN SIZE FROM 11 TO 65 CHARACTERS DEPENDING ON recSize. 01 StudentRec. 88 EndOfFile VALUE IS HIGH-VALUE. 02 matrNr PICTURE IS 9(7). 02 sep2 PICTURE IS X VALUE IS ";". 02 studString PICTURE IS X(57). WORKING-STORAGE SECTION. 01 recSize PICTURE IS 999. PROCEDURE DIVISION. begin. OPEN OUTPUT daten. MOVE 1000001 TO matrNr. MOVE ";" TO sep2. MOVE "aaa/bbb" TO studString. MOVE 15 TO recSize. WRITE StudentRec. ADD 1 TO matrNr. MOVE SPACES to studString. MOVE "aa/bb" to studString. MOVE ";" TO sep2. MOVE 13 TO recSize. WRITE StudentRec. CLOSE daten. OPEN INPUT daten. READ daten. DISPLAY StudentRec. DISPLAY recSize. READ daten. DISPLAY StudentRec. DISPLAY recSize. CLOSE daten. STOP RUN. END PROGRAM test. after the execution of the programm i get this in the console: 1000001;aaa/b 013 1000001;aa/bb 013 "daten.dat" is ok: 1000001;aaa/bbb 1000001;aa/bb but why is the output in the concole wrong??? :-( :-( :-( ---------------------------------------------------------------- I am NOT positive on this. (espeically as Line Sequential is not an ANSI/ISO Standard organization) Under your FD (with the VARYING IN SIZE clause) you have a FIXED length record defined. If you changed your FD record to [code] 01 StudentRec 05 Each-Byte occurs 11 to 65 Depending on RecSize times PIc X. [/code] and moved your actual "detailed" record to Working-Storage and did WRITE FROM and READ INTO, then I [u][b]think[/b][/u] you would get the results you want. Whether this should work the way you originally had it is not something that I am certain of. Whent the VARING IN SIZE differs from the actual defined RECORD layout, I can't remember which SHOULD win. ---------------------------------------------------------------- sorry for not answering so long. i hcanged access mode to sequential and now i read char after char and so i get my lines. I didnot try your suggestion, so i dont know whether it works. Problem solved:) ---------------------------------------------------------------- Johnny_AW; You've uncovered a bug I think. When I tried playing around with your sample, the last recSize used in the WRITE seems to place an erroneous limit on later READ statements. Something curious going on. Having said that, LINE SEQUENTIAL and VARYING IN SIZE of the READs and WRITEs may be a little strange, coding wise, but it still seems like a bug reportable issue. Cheers, Brian ---------------------------------------------------------------- Subject: will open-soucr-cobol supports INFORMIX-ESQL/COBOL Hi , Please let me know Is open-source-cobol will works with the INFORMIX-ESQL/COBOL Thanks karthik ---------------------------------------------------------------- karthik; You could try running OpenCOBOL destined sources through the Informix EXEC preprocessor and see. OpenCOBOL doesn't trip up on many COBOL statements and it has very robust dynamic link support. It might "just work". We tried with [b]gpre[/b] for the Firebird SQL engine. We had linkage issues. Some of the generated code didn't match the shared libraries. Someone would have to run an Informix experiment, but it might just work. Cheers, Brian ---------------------------------------------------------------- Karthik, Do you have any updates on informix ESQL with OC? Thanks ---------------------------------------------------------------- Subject: will open-soucr-cobol supports INFORMIX-ESQL/COBOL Hi , Please let me know Is open-source-cobol will works with the INFORMIX-ESQL/COBOL Thanks karthik ---------------------------------------------------------------- It depends on what precompiler emits and if that output is compatible with OC. Did you try? Regards. ---------------------------------------------------------------- Subject: Info: Current status of BORLAND C 5.5 support I checked the sources of both VBISAM and OC and made some necessary changes (with #ifdef __BORLANDC__). Both can be compiled now, VBISAM seems to work, OC can not be run (with BORLAND C), but this seems like problems with linking. After this works, some changes to cobc.h are still open (for calling BCC as compiler). The only thing that appears to be not possible is the support of large files, because the function lseeki64 seems to not exist (at least not in the free BCC 5.5). I'll submit the patches after the next pre release from Roger. Nonetheless I'd rather use MinGW or VC builds on WIN systems. human ---------------------------------------------------------------- Subject: Patch (FR): Add C$GETPID I've seen the C$function C$GETPIDfrom ACU. Here is a patch for OC to support this (works for UNIX and WIN systems): Add the following to ... common.h (to #ifdef _MSC_VER): [code]int getpid (void);[/code] common.c: [code]int cob_getpid (void) { return getpid(); }[/code] system.def: [code]COB_SYSTEM_GEN ("C$GETPID", 0, cob_getpid)[/code] Tested with [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. 'PIDTST'. * DATA DIVISION. WORKING-STORAGE SECTION. 77 PROCESS-ID pic 9(07). 77 omitted-var pic x. *----------------------------------------------------------------- PROCEDURE DIVISION. *----------------------------------------------------------------- main section. 00. CALL "C$GETPID" GIVING PROCESS-ID END-CALL display 'PID of current process: "' PROCESS-ID '".' end-display * display ' ' end-display accept omitted-var end-accept * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program PIDTST ---------------------------------------[/code] human ---------------------------------------------------------------- That's nice to see human. You have your head around making C level code changes. :) Cool. But ... getpid is in libc, so [code] 01 result USAGE BINARY-LONG. CALL "getpid" RETURNING result END-CALL [/code] will do in this case. Not even a need to change any tectonics for that to work. libc functions are alway available and you don't have to worry about linkage arguments for the compiles. The beauty (imho) of most of the stock library is when the C code manages the C data forms to COBOL data forms safely and auto magically. This one has no need. Just for fun. [b]getapid.cob[/b] [code] *> *************************************************************** *> Tectonics: cobc -x getapid.cob *> *************************************************************** identification division. program-id. getapid. data division. working-storage section. 01 ppid usage binary-long. 01 pid usage binary-long. *> *************************************************************** procedure division. call "getppid" returning ppid end-call call "getpid" returning pid end-call call "SYSTEM" using "ps -AF" end-call display "Process: " pid " from parent " ppid end-display goback. end program getapid. [/code] produces [code] UID PID PPID C SZ RSS PSR STIME TTY TIME CMD ... brian 5376 4205 0 1279 1004 0 01:19 pts/3 00:00:00 ./getpid brian 5377 5376 0 945 1044 0 01:19 pts/3 00:00:00 ps -AF Process: +0000005376 from parent +0000004205 [/code] Ahh, casual COBOL at 1am. Life is good. Thanks human. ;) Cheers, Brian ---------------------------------------------------------------- I cannot find getppid and getpid in the OC source at all, where are they? They would be useful because they should work for every system while "ps -AF" does not, of course. The fix I posted may be useful for migration issues from ACU-COBOL (which I didn't had there). human ---------------------------------------------------------------- Human - Brian is using the fact that any entry point that is visible at runtime is actually callable from COBOL. In this case "getpid" is in the standard C library BUT care is required when doing this. You must specifically know what parameters/return value the routine requires. For the C$GETPID - For POSIX type systems we need to make sure we include "unistd.h" (and possibly "sys/types.h"). Note that generally speaking, the return type is "pid_t". For MinGW/MSVC, we need "process.h". Then - [code] int cob_getpid (void) { #ifdef _WIN32 return (int)_getpid (); #else return (int)getpid (); #endif } [/code] Roger ---------------------------------------------------------------- If I'm right all necessary includes are included in the other included header files. Should we include them in common.c again? For POSIX, we should take care of the define HAVE_UNISTD_H, (that includes unistd_h in common.c) therefore better use something like [code] int cob_getpid (void) { #ifdef _WIN32 return (int)_getpid (); #elif defined (HAVE_UNISTD_H) return (int)getpid (); #else return 0; #endif } [/code] and somewhere (common.c or common.h?) [code] #ifdef _WIN32 #include #endif [/code] human ---------------------------------------------------------------- Subject: Converting MMDDYY to YYMMDD I've recently started working with OC, and have created a dialog front-end for compiling programs on linux that is working well, and have been converting programs from our cobol course to OS from an old M$/MF compiler. So, far only minor changes have been required, but have just run into some things that didn't work. Converting mmddyy to yymmdd was a process of just multiplying by 10000.01 and that works in both COBOL and RPG with the fixed size numbers using High and Low order truncation. I did come up with this formula to handle the conversion. compute date-to-be-paid-wk = function integer (date-to-be-paid-in / 100) + function mod (date-to-be-paid-in, 100) * 10000. I had tried subdividing the original field into mmdd and yy and doing yy * 10000 + mmdd and that would work, but then moving the original number to an edited field resulted in no /s. The only other issue I've run into is combined write lines, were I found putting a hex 0D would get the results the same. Very impressive project.. ---------------------------------------------------------------- eg. [code] IDENTIFICATION DIVISION. PROGRAM-ID. tdate. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DATA DIVISION. WORKING-STORAGE SECTION. 01 MMDDYY-FLD. 03 MM-FLD PIC 99 VALUE 10. 03 DD-FLD PIC 99 VALUE 04. 03 YY-FLD PIC 99 VALUE 09. 01 YYMMDD-FLD. 03 YY-FLD PIC 99. 03 MM-FLD PIC 99. 03 DD-FLD PIC 99. 01 YYMMDD-FLD-EDITED. 03 YY-FLD PIC 99. 03 FILLER PIC X VALUE '/'. 03 MM-FLD PIC 99. 03 FILLER PIC X VALUE '/'. 03 DD-FLD PIC 99. PROCEDURE DIVISION. MOVE CORRESPONDING MMDDYY-FLD TO YYMMDD-FLD. MOVE CORRESPONDING MMDDYY-FLD TO YYMMDD-FLD-EDITED. DISPLAY YYMMDD-FLD END-DISPLAY. DISPLAY YYMMDD-FLD-EDITED END-DISPLAY. GOBACK. [/code] Roger ---------------------------------------------------------------- Thanks for the reply. Yes, that would work, but in the case of this program, there are three dates included in the input. Date to be paid (MMDDYY) Discount date (MMDDYY) Due date (MMDDYY) The problem includes calculating a discount if the Date to be paid is on or before the discount date. By converting the date to a YYMMDD format a simple IF works. Similarly, the penalty is if the Date to be paid is after the due date. The YYMMDD is only needed in the IF statements to determine if the discount or penalty is to be applied. The output still prints the date in the original MM/DD/YY format. In this case changing the 3 multiply by 10000.01 made everything else work with no other changes. compute date-to-be-paid-wk = function integer (date-to-be-paid-in / 100) + function mod (date-to-be-paid-in, 100) * 10000. compute due-date-wk = function integer (due-date-in / 100) + function mod (due-date-in, 100) * 10000. compute discount-date-wk = function integer (discount-date-in / 100) + function mod (discount-date-in, 100) * 10000. Also, found another program in what the date was redefined, so that 1 could be added to the year so as to not change the day portion of the date, but for some reason, it went to 99, and then never changed. Just used the function mod to limit it to two digits and that worked. Mainly just looking at were existing cobol code works differently with the opencobol. Thanks again. ---------------------------------------------------------------- [quote] msetzerii wrote: Mainly just looking at were existing cobol code works differently with the opencobol.[/quote] This is very good. Go on with that. Please submit examples of the old non-working stuff and, if possible, explain why they should work. Given this information we can have a look where the differences are and if they should be there. human BTW: Please use the [ code]Your COBOL Code[ /code] Tags (without the spaces after "[") every time you post code. This way your postings are easier to read (maybe you try to edit your code postings in this topic). ---------------------------------------------------------------- Another issue that I've run into involves a program that produces a deprecation chart. The input includes the original purchase date, and then year is to be incremented without changing the day. The method method used was to copy the date to teh year-end-date-wk fields, but increment the year-wk field, so it will go from 99 to 00. With the current method thou, the number goes up to 99 like it should, but then remains at 99 for other cycles? 01 YEAR-END-DATE-WK PIC 9(6). 01 YEAR-END-DATE-WK2 REDEFINES YEAR-END-DATE-WK. 05 MONTH-WK PIC 99. 05 DAY-WK PIC 99. 05 YEAR-WK PIC 99. ADD 1 TO YEAR-WK The fix that I found for this is. compute year-wk = function mod (year-wk + 1, 100) The other issue is that when writing a line that uses after advancing it doesn't return the cursor to the beginning of the line. In this program the first line includes info that is not repeated on the other lines. With OC first line has the extra blank spaces. Fixing this is done by adding a CR to the first line. 01 DETAIL-LINE1. 05 FILLER PIC X VALUE SPACE. 05 ITEM-NO-OUT PIC X(5). 05 FILLER PIC X(6) VALUE SPACE. 05 DESCRIPTION-OUT PIC X(15). 05 DATE-ACQ-OUT PIC 99/99/99. 05 FILLER PIC X(3) VALUE SPACE. 05 COST-OUT PIC ZZ,ZZZ.99. 05 FILLER PIC X(6) VALUE SPACE. 05 LIFE-OUT PIC Z9. 05 FILLER PIC X(8) VALUE SPACE. 05 ANNUAL-DEP-OUT PIC ZZ,ZZ9.99. 05 filler pic x value X'0D'. 01 DETAIL-LINE2. 05 FILLER PIC X(79) VALUE SPACE. 05 YEAR-END-DATE-OUT PIC 99/99/99. 05 FILLER PIC X(4) VALUE SPACE. 05 DEP-VALUE-OUT PIC ZZ,ZZ9.99. ---------------------------------------------------------------- Aaah, now I see what is going on :-) You are relying on overflow behaviour. However, the DEFAULT behaviour when a field overflows, in absence of an ON OVERFLOW clause, is to leave the field UNCHANGED. Try compiling with either "-fno-trunc" or "-std=mf". That should solve both/all your problems. Re. AFTER ADVANCING. Sounds to me as though the file is not defined as LINE SEQUENTIAL. Post the SELECT statement and the WRITE statements. Roger ---------------------------------------------------------------- Please use the code tags... Concerning the ADD thing: It's known that different COBOL vendors make this wrong. According to the standard (you may want to have a look at [url=http://www.cobolstandard.info/j4/files/std.zip]the latest draft[/url]) the ON OVERFLOW clause should be used and the var should not be changed. Therefore the proper use (if you want the behaviour of your old vendor) is [code]ADD 1 TO YEAR-WK ON OVERFLOW MOVE 0 TO YEAR-WK END-ADD[/code] human Edit: Roger was faster... ---------------------------------------------------------------- In looking at the page, on page 431, it seems to state what you say if the on size error is there, but further down it states if it is not their the truncation process occurs? 3) if the absolute value of the result of an arithmetic statement exceeds the largest value that may be contained in the associated resultant data item, the EC-SIZE-TRUNCATION exception condition is set to exist, Of course, that was a quick scan, and perhaps the new standards have changed this. Thanks again for the info. Will have to find some time to look thru the document in more detail. ---------------------------------------------------------------- SELECT SALES ASSIGN TO "/DATA/RPG072.DAT", ORGANIZATION IS LINE SEQUENTIAL. SELECT REPORT-OUT ASSIGN TO "SCN", ORGANIZATION IS LINE SEQUENTIAL. WRITE RECOUT FROM DETAIL-LINE1 AFTER ADVANCING 1 LINE. WRITE RECOUT FROM DETAIL-LINE2 BEFORE ADVANCING 1 LINE Without the X'0D', the first time it prints line2 after line1, it will have the extra 79 blank spaces. With the X'0D', it shows on the screen as a new line, but the printout is correct with line1 and line2 being on the same line. 01 DETAIL-LINE1. 05 FILLER PIC X VALUE SPACE. 05 ITEM-NO-OUT PIC X(5). 05 FILLER PIC X(6) VALUE SPACE. 05 DESCRIPTION-OUT PIC X(15). 05 DATE-ACQ-OUT PIC 99/99/99. 05 FILLER PIC X(3) VALUE SPACE. 05 COST-OUT PIC ZZ,ZZZ.99. 05 FILLER PIC X(6) VALUE SPACE. 05 LIFE-OUT PIC Z9. 05 FILLER PIC X(8) VALUE SPACE. 05 ANNUAL-DEP-OUT PIC ZZ,ZZ9.99. 05 filler pic x value X'0D'. 01 DETAIL-LINE2. 05 FILLER PIC X(79) VALUE SPACE. 05 YEAR-END-DATE-OUT PIC 99/99/99. 05 FILLER PIC X(4) VALUE SPACE. 05 DEP-VALUE-OUT PIC ZZ,ZZ9.99. ---------------------------------------------------------------- The relevant quote from the '02 Standard concerning receiving itemes and size error conditions, is on page 402, Rule 4a: [quote]If the size error condition is raised during the initial evaluation, none of the resultant data items are changed and execution proceeds as indicated in 14.6.4, SIZE ERROR phrase and size error condition.[/quote] ---------------------------------------------------------------- For some reason that is page 433 on the copy of STD.BK.PDF that was linked in the earlier message. As it links back to the size error phrase, I was under the impression that the default option if the phrase was not present was to do the high order truncation. As I am new to OpenCobol, it may be that a default compiler option is activating this check even without it being listed. I'm just taking programs that work as run on our older compiler, and also ran on our IBM 34 and IBM AS/400 and PCs in the past. I ran into many of these same issues when I had students to the same programs in C. Thanks again. ---------------------------------------------------------------- Subject: Testing with VBISAM Ran the first test with VBISAM. Seems to have worked well the first time through. I used BTIFFIN's example program from the OpenCobol FAQ at http://opencobol.add1tocobol.com/ specifically the code here at http://opencobol.add1tocobol.com/#does-opencobol-support-isam . It compiles well and runs and creates the two files indexing.dat and indexing.idx NOTE: I changed line 222 in paragraph start-at-key so that the end-display was on its own line, because indented properly it was one character past the allowable for fixed format. NOTE: In file control I changed line 20 assign to "indexing.dat" to assign to "indexing" as VBISAM adds the proper extensions (.dat and .idx) automatically. So assign to "indexing.dat" created two files, indexing.dat.dat and indexing.dat.idx. So the content of indexing.dat is human readable via a cat. Is this proper? And would this give me any issues with multi-line records? Such for instance as if I stored HTML in a record? Comments welcome. ---------------------------------------------------------------- aoirthoir; re readable with cat. yep, in this case all the binary speedy bits are in the .idx file. re VBISAM. It can break. hard. Erroneous code in terms of working storage records mismatching fd's can nuke files. I have a sample somewhere, but I named it something stupid at the time and can't find it yet. To be honest, I [i]would not trust[/i] programs compiled with versions of cobc [b]./configured --with-vbisam[/b] with production files over the long haul. Umm, assuming I didn't miss a memo about new versions of the VBISAM sources. I haven't caught up on all the recent posts. And I also think the VBISAM module could use some brave testers/patchers as getting it reliable is a worthy goal. Cheers, Brian ---------------------------------------------------------------- There wasn't any announcement of newer VBISAM versions from Roger, only some fixes (mainly for WIN) by Sergey and me (including fixes for BORLAND C done by me not posted yet). Personally, I [i]would not trust[/i] programs compiled with versions of cobc [b]./configured --with-db[/b] with production files over the long haul. According to the Oracle forums, the implementation in OC is not quite right (see [url=http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=642&post_id=3233&order=0&viewmode=flat&pid=0&forum=1#forumpost3233]my post here[/url]). With BDB in the current implementation, there is no file status 39 at all, and with massive READs (done with OPEN INPUT!) with parallel processes using the same files the whole system breaks (at least if you use the env DB_HOME which seems to be necessary to get record locking). BDB belongs to Oracle, therefore there could be licence issues, too. Taking these arguments together I'd not use BDB any more. @btiffin: Please try to get the "breaking code" back (reproduce it if necessary), it would be useful to have it for further testing and fixing VBISAM, which can be achieved by us and Roger (contrary to BDB which should be fixed by Oracle). @aoirthoir: The .dat are readable, although there should be the possibility for compression, according to the files shipped with VBISAM (Roger posted that it was busted in an older version, not sure about the version that is currently downloadable from his server). I think there should be no problem with multiline records. human ---------------------------------------------------------------- Subject: FR: Use strftime/localtime to set/format cb_oc_build_stamp / octardate When output_header (codegen.c) is called, locbuff is set with strftime/localtime, which is fine. The other time stamps are not localized. FR: use localized time for output of cb_oc_build_stamp / octardate, too (if possible even for cobc -v) human ---------------------------------------------------------------- Subject: FR taken back: Change "Generated from:" in C files from name to full path (codegen.c) We have comments in every generated C file. It would be nice if we could have the full path of the COBOL source file instead of the name there. human Edit: I'm taking this FR back because you'll find it in C files as it were used by calling cobc. IF you use a full name there, you'll find the full name in the generated c-files, too. ---------------------------------------------------------------- Subject: FR for VBISAM: Put all errors to stderr, add gettext You find all errors in stdout, stderr seems to be always empty. For fixing that most occurrences of printf have to be changed to fprintf first. To add gettext could be useful. human ---------------------------------------------------------------- Subject: FR for VBISAM: Add NL+summary to vbcheck You can pass more than one file name to vbcheck. If you do so you get an output like this, [quote]C:\vbisam\bin>vbcheck.exe C:\vbisam_test\file1 C:\vbisam_test\file2 C:\vbisam_test\file3 C:\vbisam_test\file4 Processing: C:\vbisam_test\file1 Table node size: 4096 bytes Index 1: ISNODUPS Part 1: 4,13,CHARTYPE Index 2: ISDUPS Part 1: 17,27,CHARTYPE Index 3: ISDUPS Part 1: 44,21,CHARTYPE Processing: C:\vbisam_test\file2 Table node size: 4096 bytes Index 1: ISNODUPS Part 1: 4,27,CHARTYPE Error 2 opening C:\vbisam_test\file3 Processing: C:\vbisam_test\file4 Table node size: 4096 bytes Index 1: ISNODUPS Part 1: 209,12,CHARTYPE Bad data row pointer! Index 2: ISDUPS Part 1: 4,90,CHARTYPE Bad data row pointer! Index 3: ISDUPS Part 1: 221,1,CHARTYPE Bad data row pointer! Index 4: ISDUPS Part 1: 751,25,CHARTYPE Bad data row pointer! Index 5: ISDUPS Part 1: 94,115,CHARTYPE Bad data row pointer! Index 6: ISDUPS Part 1: 3448,20,CHARTYPE Bad data row pointer! Index 7: ISDUPS Part 1: 3468,20,CHARTYPE Bad data row pointer! Index 8: ISDUPS Part 1: 3488,20,CHARTYPE Bad data row pointer! Rebuilding index free list Rebuilding keys: 1 2 3 4 5 6 7 8[/quote] I thought about a summary (and a newline after each file) like that, [quote]C:\vbisam\bin>vbcheck.exe C:\vbisam_test\file1 C:\vbisam_test\file2 C:\vbisam_test\file3 C:\vbisam_test\file4 Processing: C:\vbisam_test\file1 Table node size: 4096 bytes Index 1: ISNODUPS Part 1: 4,13,CHARTYPE Index 2: ISDUPS Part 1: 17,27,CHARTYPE Index 3: ISDUPS Part 1: 44,21,CHARTYPE Processing: C:\vbisam_test\file2 Table node size: 4096 bytes Index 1: ISNODUPS Part 1: 4,27,CHARTYPE Error 2 opening C:\vbisam_test\file3 Processing: C:\vbisam_test\file4 Table node size: 4096 bytes Index 1: ISNODUPS Part 1: 209,12,CHARTYPE Bad data row pointer! Index 2: ISDUPS Part 1: 4,90,CHARTYPE Bad data row pointer! Index 3: ISDUPS Part 1: 221,1,CHARTYPE Bad data row pointer! Index 4: ISDUPS Part 1: 751,25,CHARTYPE Bad data row pointer! Index 5: ISDUPS Part 1: 94,115,CHARTYPE Bad data row pointer! Index 6: ISDUPS Part 1: 3448,20,CHARTYPE Bad data row pointer! Index 7: ISDUPS Part 1: 3468,20,CHARTYPE Bad data row pointer! Index 8: ISDUPS Part 1: 3488,20,CHARTYPE Bad data row pointer! Rebuilding index free list Rebuilding keys: 1 2 3 4 5 6 7 8 Summary: File Errors: 1 Processed Files: 3 No Error: 2 Rebuilded keys: 1[/quote] Maybe the summary should only occur if we use a special switch like --with-summary. What do you think about this? human ---------------------------------------------------------------- Subject: Bug in VBISAM: Crash in libvbisam.dll after rebuilding keys I've took the [url=http://opencobol.add1tocobol.com/#does-opencobol-support-isam]ISAM sample that can be found in OC FAQ[/url]. After compile and running this with current OC (build with vbisam) I have two files: indexing.dat.dat and indexing.dat.inx. Running vbcheck.exe indexing leads to [quote]Processing: indexing.dat Table node size: 4096 bytes Index 1: ISNODUPS Part 1: 0,8,CHARTYPE Index 2: ISDUPS Part 1: 8,5,CHARTYPE[/quote] After deleting one row manually from indexing.dat.dat with an editor (for testing vbcheck) and running vbcheck again I get [quote]Processing: indexing Table node size: 4096 bytes Index 1: ISNODUPS Part 1: 0,8,CHARTYPE Bad data row pointer! Index 2: ISDUPS Part 1: 8,5,CHARTYPE Bad data row pointer! Rebuilding keys: 1 2[/quote] This is fine but afterwards libvbisam.dll crashes with an "unhandled exception", "memory access violation". Every time I try to check this file again, libvbisam.dll crashes immediately. I traced this problem with the debugger and the error seem to occur in vbkeysio.c on line 129 (no idea where the error during rebuild has it origin): [code] if (pstree->pskeycurr->iisdummy && pstree->pskeycurr->psprev && pstree->pskeycurr->psprev->iishigh) { pstree->pskeycurr = pstree->pskeycurr->psprev; }[/code] The same error occurs with unix binaries. Has anybody a solution for this problem? human ---------------------------------------------------------------- Subject: FR for VBISAM: Output the reason for file errors (mainly vbcheck) If a file isn't there at all, only the index file is missing, or you don't have the necessary rights for one/both files and you try to access them via vbcheck you always get, [quote]Error 2 opening ...[/quote] Can we output the reason for this error? human ---------------------------------------------------------------- Subject: SYMBOLIC CHARACTERS Does OC support the SYMBOLIC characters portion of SPECIAL-NAMES? We are converting HP COBOL to OC COBOL and are getting compile time errors when defining things like BELL, Escape, CR, etc. ---------------------------------------------------------------- I suggest that you post the code that you are trying to compile, along with the error message you are getting, and which version of the compiler you are using. ---------------------------------------------------------------- Here's the code. I know that some of this is most likely not supported (like switches beyond 8), but it would be nice to be able to get the escape and other ASCII control characters defined in this way... [code]SPECIAL-NAMES. QNXT-SORT-SEQ is "RHFABCDEGIJKLMNOPQSTUVWXYZ" SW0 is SW-0, ON status is SW0-ON SW1 is SW-1, ON status is SW1-ON SW2 is SW-2, ON status is SW2-ON SW3 is SW-3, ON status is SW3-ON SW4 is SW-4, ON status is SW4-ON SW5 is SW-5, ON status is SW5-ON SW6 is SW-6, ON status is SW6-ON SW7 is SW-7, ON status is SW7-ON SW8 is SW-8, ON status is SW8-ON SW9 is SW-9, ON status is TEST-ON SW10 is SW-10, ON status is SW10-ON SW11 is SW-11, ON status is SW11-ON SW12 is SW-12, ON status is SW12-ON SW13 is SW-13, ON status is SW13-ON SW14 is SW-14, ON status is SW14-ON SW15 is SW-15, ON status is SW15-ON * SW-0 %100000 * SW-1 % 40000 * SW-2 % 20000 * SW-3 % 10000 * SW-4 % 4000 * SW-5 % 2000 * SW-6 % 1000 * SW-7 % 400 * SW-8 % 200 * SW-9 % 100 * SW-10 % 40 * SW-11 % 20 * SW-12 % 10 * SW-13 % 4 * SW-14 % 2 * SW-15 % 1 * CONDITION-CODE is HP-CC * SYMBOLIC CHARACTERS NULL-CHAR is 1, SOH-CHAR is 2, BELL-CHAR is 8, LINE-FEED-CHAR is 11, OCTAL-13 is 12, FORM-FEED-CHAR is 13, CARRIAGE-RETURN is 14, OCTAL-16 is 15, OCTAL-17 is 16, OCTAL-20 is 17, OCTAL-26 is 22, CONTROL-Y is 25, ESCAPE-CHAR is 28, OCTAL-34 is 29, OCTAL-41 is 33, DOUBLE-QUOTE is 35, OCTAL-53 is 44, OCTAL-61 is 50, OCTAL-176 is 127, OCTAL-201 is 130, OCTAL-202 is 131, OCTAL-203 is 132, OCTAL-204 is 133, OCTAL-205 is 134, OCTAL-206 is 135, OCTAL-207 is 136, OCTAL-210 is 137, OCTAL-211 is 138, OCTAL-212 is 139.[/code] ---------------------------------------------------------------- If I got it right you don't want to get the standard values for keys but the values you set in your program. Is this correct? [quote] wmklein wrote: I suggest that you post the code that you are trying to compile, [b]along with the error message you are getting, and which version of the compiler you are using[/b].[/quote] Please submit that information, too. ---------------------------------------------------------------- I would like to see the exact message, but from the source code, my suggestion would be to COMMENT OUT all of the phrases before the Symblic LCharacter phrase and then try compiling that. ---------------------------------------------------------------- While putting together the OpenCOBOL Programmer's Guide (available soon), I found that OpenCOBOL indeed DOES NOT support the SYMBOLIZc CHARACTERS clause of SPECIAL-NAMES as of the February 6 2009 tarball. Roger While has told me, however, that an upcoming tarball release WILL support it. The schedule for that release is unknown at present, however. I know this isn't quite the same thing, but it may be good enough for your purposes at the moment - you could do the following... [code] 78 NULL-CHAR VALUE X'00'. 78 SOH-CHAR VALUE X'01'. 78 BELL-CHAR VALUE X'07'. (etc.) [/code] Note that OpenCOBOL does support the figurative constant NULL today, so code that uses "ALL NULL-CHAR" could be changed to "ALL NULL". ---------------------------------------------------------------- Here's the compile results: cobc -x main.pam -o main *.xl specname.cpy:68: Warning: 'SYMBOLIC CHARACTERS' not implemented specname.cpy:68: Warning: 'SYMBOLIC CHARACTERS' not implemented specname.cpy:68: Warning: 'SYMBOLIC CHARACTERS' not implemented specname.cpy:68: Warning: 'SYMBOLIC CHARACTERS' not implemented I'm guessing the tarball we have does not have support for SC... We'll be looking forward to that. ---------------------------------------------------------------- The code we posted is from HP COBOL, and for some reason, they decided to start their count of ASCII characters from 1 instead of 0, so their count is probably one number off from what you might otherwise expect. That is easy to change to fit OC, but it looks like SYMBOLIC CHARACTERS is not implemented. ---------------------------------------------------------------- I got a copy of the Programmer's Guide (thanks!!!) and that will be very helpful. I'm sure we can work around these problems. I was hoping to adapt the code on the HP side first, and make sure it works there first; that way, we know that if the migrated code does not function properly, it is an OC problem. HP COBOL does not appear to support the representation of ASCII non-printing characters as hex values, as in VALUE X'00'. Still looking for another way outside of SYMBOLIC CHARACTERS. But we may be able to wait for SC to be implemented. ---------------------------------------------------------------- Just so it is clear, the numeric value in the Symbolic Character phrase is an ORDINAL number that must start from "1" and no conforming compiler would start from "0" (reflecting a "bit pattern". ---------------------------------------------------------------- @dakine: If you submit some "does not work" it's always good to post the version of OC you're writing about. You can get this information by doing "cobc -version", but I assume you're using an unpatched version of the latest tarball, [quote]cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Oct 06 2009 08:33:18 Packaged Feb 06 2009 10:30:55 CET[/quote] human ---------------------------------------------------------------- As stated earlier, the next tarball will support SYMBOLIC (including the IN alphabet phrase). It will also support 16 switches; per default with names SWITCH-0, ... SWITCH-15. Per compile option ("-fsyntax-extension"), it will also be possible to specify SW0, ... SW15. (This is a "HP-ism"). What we will NOT support is CONDITION-CODE. That is a very specific HP syntax and relates to their " CALL INTRINSIC 'prog' " extension. Roger ---------------------------------------------------------------- There are so many nice things in the next tarball. Do you have any time schedule for releasing it? What about releasing another VBISAM (I suppose it would be 2.1 pre-release)? human ---------------------------------------------------------------- [quote] wmklein wrote: Just so it is clear, the numeric value in the Symbolic Character phrase is an ORDINAL number that must start from "1" and no conforming compiler would start from "0" (reflecting a "bit pattern".[/quote] Thanks for clearing that up. ---------------------------------------------------------------- Thanks, Roger! That is great news.:-D I had no expectation that MPE intrinsic calls would be supported, so that is not a problem at all. We tried to avoid using them as much as possible in any case. And I am particularly happy that you will be supporting 15 switches. I'll be looking forward to that tarball when you can get around to it, but there is plenty of other stuff to work on in the meantime. ---------------------------------------------------------------- [quote] human wrote: @dakine: If you submit some "does not work" it's always good to post the version of OC you're writing about. You can get this information by doing "cobc -version", but I assume you're using an unpatched version of the latest tarball, [quote]cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Oct 06 2009 08:33:18 Packaged Feb 06 2009 10:30:55 CET[/quote] human[/quote] Duly noted! ---------------------------------------------------------------- Subject: OpenCobol for Windows Try http://www.kiska.net/opencobol/1.1/ Sergey knows what's what and usually has a variety pre-builts there. Cheers, Brian ---------------------------------------------------------------- I am not new to COBOL, but I am new to OpenCobol. I downloaded the installation file, only to find out it was a version for Unix/Linux. How do I download a Windows version - either *.exe, *.com, or *.zip (eithers Windows zip format or WinZip format). ---------------------------------------------------------------- Subject: Thread drift This is just a personal request that posters [u][i][b]TRY[/b][/i][/u] to aovid "thread drift" while posting to existing threads in this forum. If you are are talking about arithmeric truncation, plese stick to that. If you are talking about a specific vendor extenison, stick to that. Start a new thread (possibly referencing the old one) if you have a "while we are on this, how about whatever" quesiton or comment. ---------------------------------------------------------------- I totally agree with you! human ---------------------------------------------------------------- I'm also curious what yall think about running OpenCobol on a VAX/MIS system and.... :D In other words Bill, I totally agree with you. And I'm guilty of it somewhat in the past so will keep on board for the future. ---------------------------------------------------------------- Subject: libcob: Cannot find module 'eco_alc', 'eco_def', eco_str' Hi, I have compiled a .cob program but in the execution i am getting below exceptions libcob: Cannot find module 'eco_alc' libcob: Cannot find module 'eco_str' Could any one please help me to resolve these issue? Any help will be highly appreciated. Thanks Deepak ---------------------------------------------------------------- More information needed... What OC version? (use cobc -version) I suppose you have a CALL 'eco_alc' in your program? If yes, you should compile the program eco_alc, too. If not, please submit your code here and use the code-tags (Button <>) for code postings. human ---------------------------------------------------------------- Subject: FR (parser.y): Relaxed Syntax check for "Error: REDEFINES clause must follow entry-name" Compiling the sample code [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. COMPILET. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. DATA DIVISION. * WORKING-STORAGE SECTION. 01 F1-9 PIC 999999999V99. 01 F1-X PIC XXXXXXXXXXX REDEFINES F1-9. *----------------------------------------------------------------- PROCEDURE DIVISION. main section. 00. * continue. ex. stop run. *----------------------------------------------------------------- *--- End of program COMPILET -------------------------------------[/code] with [quote]$ cobc --version cobc (OpenCOBOL) 1.1.2 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Sep 04 2009 14:26:47 Packaged Feb 06 2009 10:30:55 CET[/quote] results in [quote]$ cobc -W COMPILET.COB COMPILET.COB:12: Error: REDEFINES clause must follow entry-name[/quote] I guess it's parser.c. human ---------------------------------------------------------------- Can you tell me what is wrong with that message? The REDEFINES clause is wrong in that it follows the PICTURE clause and does not immediately follow the entry name "F1-X" where it should be coded. From the draft revision, Page 275 - SR(4) under "13.16 Data description entry" [quote]The REDEFINES clause, if specified, shall immediately follow the entry-name clause, if specified; otherwise, the REDEFINES clause shall immediately follow the level-number.[/quote] ---------------------------------------------------------------- Ah I see, thank you! Indeed [code] 01 F1-9 PIC 999999999V99. 01 F1-X REDEFINES F1-9 PIC XXXXXXXXXXX.[/code] works fine. I've changed the topic to FR (was BUG before) about a "relaxed" syntax check for that. The original code works with other vendors, therefore a relaxed check (configurable, not standard) would be useful. human ---------------------------------------------------------------- It's allowed when you specify "-std=mf". See config/default.conf and config/mf.conf ("relaxed-syntax-check"). We could have eg. "-frelax-syntax" to selectively turn on this and maybe one or more of the "relaxed" syntax variations (eg. " relax-level-hierarchy", "top-level-occurs-clause", etc.) Roger ---------------------------------------------------------------- [quote] simrw wrote: [..] We could have eg. "-frelax-syntax" to selectively turn on this and maybe one or more of the "relaxed" syntax variations (eg. " relax-level-hierarchy", "top-level-occurs-clause", etc.) [...][/quote] More than one "relaxed" syntax variation sound nice. human ---------------------------------------------------------------- Subject: Patch (error.c, file.c, typeck.c) for Bug: cobc complaining about "WORK$" (instead of FILLER) With the latest tarball cobc outputs FILLER (instead of the old WORK$99) in most cases. This patch fixes some missed points that can be seen with [code] *----------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. COMPILE2. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. DATA DIVISION. * WORKING-STORAGE SECTION. 01 FILLER PIC X(01). 88 val-0 VALUE ZERO. 88 val-1 VALUE 1. 01 FILLER. 88 val-x VALUE 'X'. 01 FILLER PIC x. 88 val-x VALUE 'X'. 01 FILLER PIC x. 03 FILLER PIC 9. 88 val-2 VALUE 2. 01 FILLER PIC X USAGE COMP-1 value 'A'. *----------------------------------------------------------------- PROCEDURE DIVISION. main section. 00. set val-1 to true set val-x to true * continue. ex. exit program. *----------------------------------------------------------------- *--- End of program COMPILE2 -------------------------------------[/code] which currently results in different 'WORK$' when doing [code]cobc -fsyntax-only -W COMPILE2.COB[/code] [code]--- error.c.old Sat Jan 24 15:31:30 2009 +++ error.c Thu Oct 08 14:58:00 2009 @@ -225,7 +232,7 @@ case CB_TAG_FIELD: for (p = CB_FIELD (y)->parent; p; p = p->parent) { strcat (errnamebuff, "in '"); - strcat (errnamebuff, p->name); + strcat (errnamebuff, check_filler_name((char *)p->name)); strcat (errnamebuff, "' "); } break; [/code] [code]--- field.c.old Sat Jan 24 15:31:30 2009 +++ field.c Thu Oct 08 15:06:16 2009 @@ -556,13 +556,13 @@ if (f->flag_item_78) { cb_error_x (x, _("Value required for constant item '%s'"), name); } else { - cb_error_x (x, _("PICTURE clause required for '%s'"), name); + cb_error_x (x, _("PICTURE clause required for '%s'"), check_filler_name (name)); } return -1; } } if (f->pic != NULL && need_picture == 0) { - cb_error_x (x, _("'%s' cannot have PICTURE clause"), name); + cb_error_x (x, _("'%s' cannot have PICTURE clause"), check_filler_name (name)); } /* validate USAGE */ [/code] [code]--- typeck.c.old Wed Jan 28 19:57:26 2009 +++ typeck.c Thu Oct 08 14:58:58 2009 @@ -3889,9 +3893,9 @@ !strcmp (f->name, "NUMBER-OF-CALL-PARAMETERS")) { cb_warning (_("Internal register '%s' defined as BINARY-LONG"), f->name); } else if (f->pic) { - cb_warning_x (loc, _("'%s' defined here as PIC %s"), f->name, f->pic->orig); + cb_warning_x (loc, _("'%s' defined here as PIC %s"), check_filler_name ((char *)f->name), f->pic->orig); } else { - cb_warning_x (loc, _("'%s' defined here as a group of length %d"), f->name, f->size); + cb_warning_x (loc, _("'%s' defined here as a group of length %d"), check_filler_name ((char *)f->name), f->size); } } [/code] human ---------------------------------------------------------------- Subject: Unable to install OpenCOBOL in CYGWIN [b]when trying to install the OpenCOBAL recived the following error.[/b] grep: /usr/lib/libiconv.la: No such file or directory /usr/bin/sed: can't read /usr/lib/libiconv.la: No such file or directory libtool: link: `/usr/lib/libiconv.la' is not a valid libtool archive make[2]: *** [libcob.la] Error 1 make[2]: Leaving directory `/cygdrive/d/unix/open-cobol-1.1/libcob' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/cygdrive/d/unix/open-cobol-1.1' make: *** [all] Error 2 please help me on the issue..!! Thanks in Advance...!! ---------------------------------------------------------------- Read the README. There is a list of additional packages that are needed for OC. Close cygwin, install these dependencies (both runtime and devel-packages) with cygwin setup, reopen cygwin and retry ./configure. human ---------------------------------------------------------------- Subject: Success report: Installing on Mac OS X 10.5 (Leopard) I've seen a few threads regarding installation of OC on Mac OS X. I thought I'd share my steps to get it done successfully. These steps work both on the 1.0 release, the 1.1 pre-release, and today's CVS version. Note that I use the bash shell. If you use csh, "export" is "setenv". PREREQUISITES: - Apple Developer Tools (for gcc) Just install these if you hadn't yet. - MacPorts (http://www.macports.org, for gmp, db and gettext) Just install the current package from the web site if you don't have it. If you do a fresh install, remember to run [code]sudo port -v selfupdate[/code] INSTALL MAC PORTS PACKAGES: - run [code]sudo port install gmp db46 gettext[/code] This will download, configure and install the gmp, db-4.6 and gettext packages and their dependencies in /opt/local. BUILD AND INSTALL OPEN-COBOL: - Download and unzip, or check out, OC. - Change directory to OC top directory (e.g. "cd open-cobol-1.0"). - Set the CPPFLAGS environment variable: [code]export CPPFLAGS="-I/opt/local/include -I/opt/local/include/db46"[/code] - Set the LDFLAGS environment variable: [code]export LDFLAGS="-L/opt/local/lib -L/opt/local/lib/db46"[/code] (Note that the db-4.6 include files and libraries are in a db46 subdirectory) - OPTIONAL: change the loadable module extension from "dylib" to "bundle". See note. Skip if you don't care. - Configure the installation. I installed in /usr/local. Take your pick. [code]./configure --prefix=/usr/local --with-db[/code] - Build OC [code]make[/code] - Install OC [code]sudo make install[/code] - Test installation [code]cobc -h[/code] If everything worked out, you should be in business. NOTE About loadable module extensions. As far as I know, things are like this on Mac OS X: - Shared libraries must have the dylib extension (as in libcob.dylib). - Loadable modules have no default extension, but [i]by convention[/i] should have the bundle extension (as in HELLO.bundle). The OC configure script accurately identifies dylib as the shared library extension, which is good. It then uses that same extension for loadable modules, which is not wrong, but somewhat un-Macish. (I realize that .so is used both ways on Linux, so that's why, probably.) By using the bundle extension a) OC would be even more Mac friendly (yay!) and, b) your OC modules get the funky LEGO™-block icon that bundles get in the Finder. To make this happen, you need one small edit in configure before running it. Find the line that looks like this: [code]COB_MODULE_EXT=`echo "$shlibext" | sed 's/dll\.a/dll/'`[/code] and extend it to look like this:[code]COB_MODULE_EXT=`echo "$shlibext" | sed 's/dll\.a/dll/' | sed 's/dylib/bundle/'`[/code] This is purely cosmetic, but then, it's Mac OS X. :-) Cheers, and good luck, Erwin ---------------------------------------------------------------- Tried following your instructions but get errors. Here is the contents of the terminal window: Last login: Thu Aug 26 21:18:23 on console ~ > sudo port -v selfupdate Password: ---> Updating the ports tree Synchronizing local ports tree from rsync://rsync.macports.org/release/ports/ receiving file list ... done ./ sent 59 bytes received 471242 bytes 104733.56 bytes/sec total size is 26740421 speedup is 56.74 Creating port index in /opt/local/var/macports/sources/rsync.macports.org/release/ports Total number of ports parsed: 0 Ports successfully parsed: 0 Ports failed: 0 Up-to-date ports skipped: 7305 ---> Updating MacPorts base sources using rsync receiving file list ... done sent 36 bytes received 6810 bytes 2738.40 bytes/sec total size is 2879032 speedup is 420.54 MacPorts base version 1.9.1 installed, MacPorts base version 1.9.1 downloaded. ---> MacPorts base is already the latest version The ports tree has been updated. To upgrade your installed ports, you should run port upgrade outdated ~ > sudo port install gmp db46 gettext ---> Computing dependencies for gmp ---> Fetching gmp ---> Attempting to fetch gmp-5.0.1.tar.bz2 from http://lil.fr.distfiles.macports.org/gmp ---> Verifying checksum(s) for gmp ---> Extracting gmp ---> Applying patches to gmp ---> Configuring gmp ---> Building gmp ---> Staging gmp into destroot ---> Installing gmp @5.0.1_0+universal ---> Activating gmp @5.0.1_0+universal ---> Cleaning gmp ---> Computing dependencies for db46 ---> Fetching db46 ---> Attempting to fetch patch.4.6.21.1 from http://lil.fr.distfiles.macports.org/db4/4.6.21_6 ---> Attempting to fetch patch.4.6.21.2 from http://lil.fr.distfiles.macports.org/db4/4.6.21_6 ---> Attempting to fetch patch.4.6.21.3 from http://lil.fr.distfiles.macports.org/db4/4.6.21_6 ---> Attempting to fetch patch.4.6.21.4 from http://lil.fr.distfiles.macports.org/db4/4.6.21_6 ---> Attempting to fetch db-4.6.21.tar.gz from http://lil.fr.distfiles.macports.org/db4/4.6.21_6 ---> Verifying checksum(s) for db46 ---> Extracting db46 ---> Applying patches to db46 ---> Configuring db46 ---> Building db46 ---> Staging db46 into destroot ---> Installing db46 @4.6.21_6+universal ---> Activating db46 @4.6.21_6+universal ---> Cleaning db46 ---> Computing dependencies for gettext ---> Fetching gettext ---> Attempting to fetch gettext-0.18.1.1.tar.gz from http://lil.fr.distfiles.macports.org/gettext ---> Verifying checksum(s) for gettext ---> Extracting gettext ---> Applying patches to gettext ---> Configuring gettext ---> Building gettext ---> Staging gettext into destroot ---> Installing gettext @0.18.1.1_2+universal ---> Activating gettext @0.18.1.1_2+universal ---> Cleaning gettext ~ > export CPPFLAGS="-I/opt/local/include -I/opt/local/include/db46" ~ > cd Desktop/open-cobol-1.0\ 2/ open-cobol-1.0 2 > ls ABOUT-NLS Makefile.in cobc configure.ac m4 AUTHORS NEWS compile cpucheck.c missing COPYING README config depcomp mkinstalldirs COPYING.DOC THANKS config.guess install-sh po COPYING.LIB TODO config.h.in lib tests ChangeLog aclocal.m4 config.rpath libcob texi INSTALL bin config.sub libcob.h Makefile.am cob-config.in configure ltmain.sh open-cobol-1.0 2 > export LDFLAGS="-L/opt/local/lib -L/opt/local/lib/db46" open-cobol-1.0 2 > ./configure --prefix=/usr/local --with-db checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes /bin/sh: /Users/mtyers/Desktop/open-cobol-1.0: No such file or directory configure: WARNING: `missing' script is too old or missing checking for gawk... no checking for mawk... no checking for nawk... no checking for awk... awk checking whether make sets $(MAKE)... yes checking whether to enable maintainer-specific portions of Makefiles... no checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking how to run the C preprocessor... gcc -E checking for egrep... grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking whether ln -s works... yes checking for a BSD-compatible install... /usr/bin/install -c checking build system type... i386-apple-darwin10.4.0 checking host system type... i386-apple-darwin10.4.0 checking for a sed that does not truncate output... /usr/bin/sed checking for ld used by gcc... /usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld checking if the linker (/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld) is GNU ld... no checking for /usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld option to reload object files... -r checking for BSD-compatible nm... /usr/bin/nm checking how to recognize dependent libraries... pass_all checking dlfcn.h usability... yes checking dlfcn.h presence... yes checking for dlfcn.h... yes checking the maximum length of command line arguments... 196608 checking command to parse /usr/bin/nm output from gcc object... rm: conftest.dSYM: is a directory rm: conftest.dSYM: is a directory rm: conftest.dSYM: is a directory rm: conftest.dSYM: is a directory ok checking for objdir... .libs checking for ar... ar checking for ranlib... ranlib checking for strip... strip rm: conftest.dSYM: is a directory rm: conftest.dSYM: is a directory checking if gcc supports -fno-rtti -fno-exceptions... rm: conftest.dSYM: is a directory no checking for gcc option to produce PIC... -fno-common checking if gcc PIC flag -fno-common works... rm: conftest.dSYM: is a directory yes checking if gcc static flag -static works... rm: conftest.dSYM: is a directory no checking if gcc supports -c -o file.o... rm: conftest.dSYM: is a directory yes checking whether the gcc linker (/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld) supports shared libraries... yes checking dynamic linker characteristics... darwin10.4.0 dyld checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking for dlopen in -ldl... yes checking whether a program can dlopen itself... yes checking whether a statically linked program can dlopen itself... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes configure: creating libtool checking whether make sets $(MAKE)... (cached) yes checking for ANSI C header files... (cached) yes checking for stdint.h... (cached) yes checking for sys/types.h... (cached) yes checking signal.h usability... yes checking signal.h presence... yes checking for signal.h... yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking malloc.h usability... no checking malloc.h presence... no checking for malloc.h... no checking locale.h usability... yes checking locale.h presence... yes checking for locale.h... yes checking stddef.h usability... yes checking stddef.h presence... yes checking for stddef.h... yes checking wchar.h usability... yes checking wchar.h presence... yes checking for wchar.h... yes checking for dlfcn.h... (cached) yes checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking for an ANSI C-conforming const... yes checking whether byte ordering is bigendian... no checking for size_t... yes checking whether struct tm is in sys/time.h or time.h... time.h checking for inline... inline checking for working alloca.h... yes checking for alloca... yes checking for vprintf... yes checking for _doprnt... no checking for memmove... yes checking for memset... yes checking for regcomp... yes checking for setlocale... yes checking for fcntl... yes checking for strerror... yes checking for strcasecmp... yes checking for strchr... yes checking for strrchr... yes checking for strdup... yes checking for strstr... yes checking for strtol... yes checking for gettimeofday... yes checking for ld used by GCC... /usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld checking if the linker (/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld) is GNU ld... no checking for shared library run path origin... done checking for iconv... yes checking how to link with libiconv... -liconv checking for iconv declaration... extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); checking for nl_langinfo and CODESET... yes checking for getopt_long_only... yes checking kpathsea/getopt.h usability... no checking kpathsea/getopt.h presence... no checking for kpathsea/getopt.h... no checking getopt.h usability... yes checking getopt.h presence... yes checking for getopt.h... yes checking gmp.h usability... yes checking gmp.h presence... yes checking for gmp.h... yes checking for __gmp_randinit in -lgmp... yes checking whether NLS is requested... yes checking for msgfmt... /opt/local/bin/msgfmt checking for gmsgfmt... /opt/local/bin/msgfmt checking for xgettext... /opt/local/bin/xgettext checking for msgmerge... /opt/local/bin/msgmerge checking whether NLS is requested... yes checking for GNU gettext in libc... no checking for iconv... (cached) yes checking how to link with libiconv... -liconv checking for GNU gettext in libintl... yes checking whether to use NLS... yes checking where the gettext function comes from... external libintl checking how to link with libintl... -lintl -liconv -lc checking ncurses.h usability... yes checking ncurses.h presence... yes checking for ncurses.h... yes checking pdcurses.h usability... no checking pdcurses.h presence... no checking for pdcurses.h... no checking ncurses/ncurses.h usability... yes checking ncurses/ncurses.h presence... yes checking for ncurses/ncurses.h... yes checking curses.h usability... yes checking curses.h presence... yes checking for curses.h... yes checking for initscr in -lncurses... yes checking for BDB db.h version >= 4.1 ... yes (4.6) checking for BDB 4.1 compatibility in db ... yes checking for dlopen in -lc... yes configure: creating ./config.status config.status: creating cob-config config.status: creating Makefile config.status: creating lib/Makefile config.status: creating libcob/Makefile config.status: creating cobc/Makefile config.status: creating bin/Makefile config.status: creating po/Makefile.in config.status: creating texi/Makefile config.status: creating config/Makefile config.status: creating tests/atlocal config.status: creating tests/Makefile config.status: creating tests/cobol85/Makefile config.status: creating config.h config.status: executing tests/atconfig commands config.status: executing depfiles commands config.status: executing default-1 commands config.status: creating po/POTFILES config.status: creating po/Makefile OpenCOBOL Configuration: CC gcc COB_CC gcc CFLAGS -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k COB_CFLAGS -I/usr/local/include -I/opt/local/include -I/opt/local/include/db46 -O2 COB_EXTRA_FLAGS LDFLAGS -L/opt/local/lib -L/opt/local/lib/db46 COB_LDFLAGS -L/opt/local/lib -L/opt/local/lib/db46 COBC_LIBS -L/opt/local/lib -lintl -L/opt/local/lib -liconv -lc -R/opt/local/lib COB_LIBS -L/opt/local/lib -L/opt/local/lib/db46 -L${exec_prefix}/lib -lcob -lm -lgmp -L/opt/local/lib -lintl -L/opt/local/lib -liconv -lc -R/opt/local/lib -lncurses -ldb COB_CONFIG_DIR ${prefix}/share/open-cobol/config COB_LIBRARY_PATH .:${exec_prefix}/lib/open-cobol COB_MODULE_EXT dylib COB_SHARED_OPT -bundle -flat_namespace -undefined suppress COB_PIC_FLAGS -fno-common -DPIC COB_EXPORT_DYN COB_STRIP_CMD strip -x Dynamic loading System Use gettext for international messages: yes Use Berkeley DB for file I/O: yes Use enhanced Berkeley DB (>= 4.1) yes Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: yes open-cobol-1.0 2 > make Creating defaults.h... make all-recursive Making all in lib if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT dummymac.o -MD -MP -MF ".deps/dummymac.Tpo" -c -o dummymac.o dummymac.c; \ then mv -f ".deps/dummymac.Tpo" ".deps/dummymac.Po"; else rm -f ".deps/dummymac.Tpo"; exit 1; fi rm -f libsupport.a ar cru libsupport.a dummymac.o ranlib libsupport.a Making all in libcob if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF ".deps/libcob_la-common.Tpo" -c -o libcob_la-common.lo `test -f 'common.c' || echo './'`common.c; \ then mv -f ".deps/libcob_la-common.Tpo" ".deps/libcob_la-common.Plo"; else rm -f ".deps/libcob_la-common.Tpo"; exit 1; fi mkdir .libs gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF .deps/libcob_la-common.Tpo -c common.c -fno-common -DPIC -o .libs/libcob_la-common.o common.c: In function 'cob_accept_time': common.c:1437: warning: format '%2.2ld' expects type 'long int', but argument 5 has type 'int' gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF .deps/libcob_la-common.Tpo -c common.c -o libcob_la-common.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF ".deps/libcob_la-call.Tpo" -c -o libcob_la-call.lo `test -f 'call.c' || echo './'`call.c; \ then mv -f ".deps/libcob_la-call.Tpo" ".deps/libcob_la-call.Plo"; else rm -f ".deps/libcob_la-call.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF .deps/libcob_la-call.Tpo -c call.c -fno-common -DPIC -o .libs/libcob_la-call.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF .deps/libcob_la-call.Tpo -c call.c -o libcob_la-call.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF ".deps/libcob_la-strings.Tpo" -c -o libcob_la-strings.lo `test -f 'strings.c' || echo './'`strings.c; \ then mv -f ".deps/libcob_la-strings.Tpo" ".deps/libcob_la-strings.Plo"; else rm -f ".deps/libcob_la-strings.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF .deps/libcob_la-strings.Tpo -c strings.c -fno-common -DPIC -o .libs/libcob_la-strings.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF .deps/libcob_la-strings.Tpo -c strings.c -o libcob_la-strings.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-move.lo -MD -MP -MF ".deps/libcob_la-move.Tpo" -c -o libcob_la-move.lo `test -f 'move.c' || echo './'`move.c; \ then mv -f ".deps/libcob_la-move.Tpo" ".deps/libcob_la-move.Plo"; else rm -f ".deps/libcob_la-move.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-move.lo -MD -MP -MF .deps/libcob_la-move.Tpo -c move.c -fno-common -DPIC -o .libs/libcob_la-move.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-move.lo -MD -MP -MF .deps/libcob_la-move.Tpo -c move.c -o libcob_la-move.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF ".deps/libcob_la-numeric.Tpo" -c -o libcob_la-numeric.lo `test -f 'numeric.c' || echo './'`numeric.c; \ then mv -f ".deps/libcob_la-numeric.Tpo" ".deps/libcob_la-numeric.Plo"; else rm -f ".deps/libcob_la-numeric.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF .deps/libcob_la-numeric.Tpo -c numeric.c -fno-common -DPIC -o .libs/libcob_la-numeric.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF .deps/libcob_la-numeric.Tpo -c numeric.c -o libcob_la-numeric.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic.lo -MD -MP -MF ".deps/libcob_la-intrinsic.Tpo" -c -o libcob_la-intrinsic.lo `test -f 'intrinsic.c' || echo './'`intrinsic.c; \ then mv -f ".deps/libcob_la-intrinsic.Tpo" ".deps/libcob_la-intrinsic.Plo"; else rm -f ".deps/libcob_la-intrinsic.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic.lo -MD -MP -MF .deps/libcob_la-intrinsic.Tpo -c intrinsic.c -fno-common -DPIC -o .libs/libcob_la-intrinsic.o intrinsic.c: In function 'cob_intr_current_date': intrinsic.c:822: warning: format '%2.2ld' expects type 'long int', but argument 5 has type 'int' gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic.lo -MD -MP -MF .deps/libcob_la-intrinsic.Tpo -c intrinsic.c -o libcob_la-intrinsic.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF ".deps/libcob_la-fileio.Tpo" -c -o libcob_la-fileio.lo `test -f 'fileio.c' || echo './'`fileio.c; \ then mv -f ".deps/libcob_la-fileio.Tpo" ".deps/libcob_la-fileio.Plo"; else rm -f ".deps/libcob_la-fileio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF .deps/libcob_la-fileio.Tpo -c fileio.c -fno-common -DPIC -o .libs/libcob_la-fileio.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF .deps/libcob_la-fileio.Tpo -c fileio.c -o libcob_la-fileio.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-termio.lo -MD -MP -MF ".deps/libcob_la-termio.Tpo" -c -o libcob_la-termio.lo `test -f 'termio.c' || echo './'`termio.c; \ then mv -f ".deps/libcob_la-termio.Tpo" ".deps/libcob_la-termio.Plo"; else rm -f ".deps/libcob_la-termio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-termio.lo -MD -MP -MF .deps/libcob_la-termio.Tpo -c termio.c -fno-common -DPIC -o .libs/libcob_la-termio.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-termio.lo -MD -MP -MF .deps/libcob_la-termio.Tpo -c termio.c -o libcob_la-termio.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-screenio.lo -MD -MP -MF ".deps/libcob_la-screenio.Tpo" -c -o libcob_la-screenio.lo `test -f 'screenio.c' || echo './'`screenio.c; \ then mv -f ".deps/libcob_la-screenio.Tpo" ".deps/libcob_la-screenio.Plo"; else rm -f ".deps/libcob_la-screenio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-screenio.lo -MD -MP -MF .deps/libcob_la-screenio.Tpo -c screenio.c -fno-common -DPIC -o .libs/libcob_la-screenio.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-screenio.lo -MD -MP -MF .deps/libcob_la-screenio.Tpo -c screenio.c -o libcob_la-screenio.o >/dev/null 2>&1 /bin/sh ../libtool --tag=CC --mode=link gcc -DSUPER_OPTIMIZE -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -L/opt/local/lib -L/opt/local/lib/db46 -o libcob.la -rpath /usr/local/lib -version-info 1:0:0 -no-undefined libcob_la-common.lo libcob_la-call.lo libcob_la-strings.lo libcob_la-move.lo libcob_la-numeric.lo libcob_la-intrinsic.lo libcob_la-fileio.lo libcob_la-termio.lo libcob_la-screenio.lo -lm -lgmp -L/opt/local/lib -lintl -L/opt/local/lib -liconv -lc -R/opt/local/lib -lncurses -ldb gcc -dynamiclib -o .libs/libcob.1.0.0.dylib .libs/libcob_la-common.o .libs/libcob_la-call.o .libs/libcob_la-strings.o .libs/libcob_la-move.o .libs/libcob_la-numeric.o .libs/libcob_la-intrinsic.o .libs/libcob_la-fileio.o .libs/libcob_la-termio.o .libs/libcob_la-screenio.o -L/opt/local/lib -L/opt/local/lib/db46 -lm /opt/local/lib/libgmp.dylib /opt/local/lib/libintl.dylib /opt/local/lib/libiconv.dylib -lc -lncurses -ldb -install_name /usr/local/lib/libcob.1.dylib -compatibility_version 2 -current_version 2.0 (cd .libs && rm -f libcob.1.dylib && ln -s libcob.1.0.0.dylib libcob.1.dylib) (cd .libs && rm -f libcob.dylib && ln -s libcob.1.0.0.dylib libcob.dylib) ar cru .libs/libcob.a libcob_la-common.o libcob_la-call.o libcob_la-strings.o libcob_la-move.o libcob_la-numeric.o libcob_la-intrinsic.o libcob_la-fileio.o libcob_la-termio.o libcob_la-screenio.o ranlib .libs/libcob.a creating libcob.la (cd .libs && rm -f libcob.la && ln -s ../libcob.la libcob.la) Making all in cobc make all-am if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-cobc.o -MD -MP -MF ".deps/cobc-cobc.Tpo" -c -o cobc-cobc.o `test -f 'cobc.c' || echo './'`cobc.c; \ then mv -f ".deps/cobc-cobc.Tpo" ".deps/cobc-cobc.Po"; else rm -f ".deps/cobc-cobc.Tpo"; exit 1; fi if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-config.o -MD -MP -MF ".deps/cobc-config.Tpo" -c -o cobc-config.o `test -f 'config.c' || echo './'`config.c; \ then mv -f ".deps/cobc-config.Tpo" ".deps/cobc-config.Po"; else rm -f ".deps/cobc-config.Tpo"; exit 1; fi if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-tree.o -MD -MP -MF ".deps/cobc-tree.Tpo" -c -o cobc-tree.o `test -f 'tree.c' || echo './'`tree.c; \ then mv -f ".deps/cobc-tree.Tpo" ".deps/cobc-tree.Po"; else rm -f ".deps/cobc-tree.Tpo"; exit 1; fi if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-reserved.o -MD -MP -MF ".deps/cobc-reserved.Tpo" -c -o cobc-reserved.o `test -f 'reserved.c' || echo './'`reserved.c; \ then mv -f ".deps/cobc-reserved.Tpo" ".deps/cobc-reserved.Po"; else rm -f ".deps/cobc-reserved.Tpo"; exit 1; fi if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-error.o -MD -MP -MF ".deps/cobc-error.Tpo" -c -o cobc-error.o `test -f 'error.c' || echo './'`error.c; \ then mv -f ".deps/cobc-error.Tpo" ".deps/cobc-error.Po"; else rm -f ".deps/cobc-error.Tpo"; exit 1; fi error.c: In function ‘ambiguous_error’: error.c:234: warning: format not a string literal and no format arguments if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-parser.o -MD -MP -MF ".deps/cobc-parser.Tpo" -c -o cobc-parser.o `test -f 'parser.c' || echo './'`parser.c; \ then mv -f ".deps/cobc-parser.Tpo" ".deps/cobc-parser.Po"; else rm -f ".deps/cobc-parser.Tpo"; exit 1; fi parser.c: In function ‘yyparse’: parser.c:9745: warning: format not a string literal and no format arguments if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-scanner.o -MD -MP -MF ".deps/cobc-scanner.Tpo" -c -o cobc-scanner.o `test -f 'scanner.c' || echo './'`scanner.c; \ then mv -f ".deps/cobc-scanner.Tpo" ".deps/cobc-scanner.Po"; else rm -f ".deps/cobc-scanner.Tpo"; exit 1; fi if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-field.o -MD -MP -MF ".deps/cobc-field.Tpo" -c -o cobc-field.o `test -f 'field.c' || echo './'`field.c; \ then mv -f ".deps/cobc-field.Tpo" ".deps/cobc-field.Po"; else rm -f ".deps/cobc-field.Tpo"; exit 1; fi if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-typeck.o -MD -MP -MF ".deps/cobc-typeck.Tpo" -c -o cobc-typeck.o `test -f 'typeck.c' || echo './'`typeck.c; \ then mv -f ".deps/cobc-typeck.Tpo" ".deps/cobc-typeck.Po"; else rm -f ".deps/cobc-typeck.Tpo"; exit 1; fi typeck.c: In function ‘move_error’: typeck.c:3341: warning: format not a string literal and no format arguments typeck.c:3345: warning: format not a string literal and no format arguments if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-codegen.o -MD -MP -MF ".deps/cobc-codegen.Tpo" -c -o cobc-codegen.o `test -f 'codegen.c' || echo './'`codegen.c; \ then mv -f ".deps/cobc-codegen.Tpo" ".deps/cobc-codegen.Po"; else rm -f ".deps/cobc-codegen.Tpo"; exit 1; fi codegen.c: In function ‘output_indent’: codegen.c:251: warning: format not a string literal and no format arguments if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-ppparse.o -MD -MP -MF ".deps/cobc-ppparse.Tpo" -c -o cobc-ppparse.o `test -f 'ppparse.c' || echo './'`ppparse.c; \ then mv -f ".deps/cobc-ppparse.Tpo" ".deps/cobc-ppparse.Po"; else rm -f ".deps/cobc-ppparse.Tpo"; exit 1; fi if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-pplex.o -MD -MP -MF ".deps/cobc-pplex.Tpo" -c -o cobc-pplex.o `test -f 'pplex.c' || echo './'`pplex.c; \ then mv -f ".deps/cobc-pplex.Tpo" ".deps/cobc-pplex.Po"; else rm -f ".deps/cobc-pplex.Tpo"; exit 1; fi /bin/sh ../libtool --tag=CC --mode=link gcc -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -L/opt/local/lib -L/opt/local/lib/db46 -o cobc cobc-cobc.o cobc-config.o cobc-tree.o cobc-reserved.o cobc-error.o cobc-parser.o cobc-scanner.o cobc-field.o cobc-typeck.o cobc-codegen.o cobc-ppparse.o cobc-pplex.o -L/opt/local/lib -lintl -L/opt/local/lib -liconv -lc -R/opt/local/lib ../lib/libsupport.a mkdir .libs gcc -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -o cobc cobc-cobc.o cobc-config.o cobc-tree.o cobc-reserved.o cobc-error.o cobc-parser.o cobc-scanner.o cobc-field.o cobc-typeck.o cobc-codegen.o cobc-ppparse.o cobc-pplex.o -L/opt/local/lib -L/opt/local/lib/db46 /opt/local/lib/libintl.dylib /opt/local/lib/libiconv.dylib -lc ../lib/libsupport.a Making all in bin if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/local/include -I/opt/local/include/db46 -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobcrun-cobcrun.o -MD -MP -MF ".deps/cobcrun-cobcrun.Tpo" -c -o cobcrun-cobcrun.o `test -f 'cobcrun.c' || echo './'`cobcrun.c; \ then mv -f ".deps/cobcrun-cobcrun.Tpo" ".deps/cobcrun-cobcrun.Po"; else rm -f ".deps/cobcrun-cobcrun.Tpo"; exit 1; fi /bin/sh ../libtool --tag=CC --mode=link gcc -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -L/opt/local/lib -L/opt/local/lib/db46 -o cobcrun cobcrun-cobcrun.o -L../libcob -lcob -lm -lgmp -L/opt/local/lib -lintl -L/opt/local/lib -liconv -lc -R/opt/local/lib -lncurses -ldb mkdir .libs libtool: link: cannot find the library `' or unhandled argument `2/libcob' make[2]: *** [cobcrun] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 open-cobol-1.0 2 > sudo make install Password: make install-recursive Making install in lib make[3]: Nothing to be done for `install-exec-am'. make[3]: Nothing to be done for `install-data-am'. Making install in libcob test -z "/usr/local/lib" || /bin/sh ../mkinstalldirs "/usr/local/lib" /bin/sh ../libtool --mode=install /usr/bin/install -c 'libcob.la' '/usr/local/lib/libcob.la' /usr/bin/install -c .libs/libcob.1.0.0.dylib /usr/local/lib/libcob.1.0.0.dylib (cd /usr/local/lib && { ln -s -f libcob.1.0.0.dylib libcob.1.dylib || { rm -f libcob.1.dylib && ln -s libcob.1.0.0.dylib libcob.1.dylib; }; }) (cd /usr/local/lib && { ln -s -f libcob.1.0.0.dylib libcob.dylib || { rm -f libcob.dylib && ln -s libcob.1.0.0.dylib libcob.dylib; }; }) /usr/bin/install -c .libs/libcob.lai /usr/local/lib/libcob.la /usr/bin/install -c .libs/libcob.a /usr/local/lib/libcob.a chmod 644 /usr/local/lib/libcob.a ranlib /usr/local/lib/libcob.a ---------------------------------------------------------------------- Libraries have been installed in: /usr/local/lib If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable during execution See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- test -z "/usr/local/include/libcob" || /bin/sh ../mkinstalldirs "/usr/local/include/libcob" mkdir /usr/local/include/libcob /usr/bin/install -c -m 644 'byteswap.h' '/usr/local/include/libcob/byteswap.h' /usr/bin/install -c -m 644 'common.h' '/usr/local/include/libcob/common.h' /usr/bin/install -c -m 644 'move.h' '/usr/local/include/libcob/move.h' /usr/bin/install -c -m 644 'numeric.h' '/usr/local/include/libcob/numeric.h' /usr/bin/install -c -m 644 'exception.def' '/usr/local/include/libcob/exception.def' /usr/bin/install -c -m 644 'termio.h' '/usr/local/include/libcob/termio.h' /usr/bin/install -c -m 644 'fileio.h' '/usr/local/include/libcob/fileio.h' /usr/bin/install -c -m 644 'screenio.h' '/usr/local/include/libcob/screenio.h' /usr/bin/install -c -m 644 'strings.h' '/usr/local/include/libcob/strings.h' /usr/bin/install -c -m 644 'call.h' '/usr/local/include/libcob/call.h' /usr/bin/install -c -m 644 'intrinsic.h' '/usr/local/include/libcob/intrinsic.h' /usr/bin/install -c -m 644 'codegen.h' '/usr/local/include/libcob/codegen.h' /usr/bin/install -c -m 644 'system.def' '/usr/local/include/libcob/system.def' Making install in cobc make install-am test -z "/usr/local/bin" || /bin/sh ../mkinstalldirs "/usr/local/bin" /bin/sh ../libtool --mode=install /usr/bin/install -c 'cobc' '/usr/local/bin/cobc' /usr/bin/install -c cobc /usr/local/bin/cobc make[4]: Nothing to be done for `install-data-am'. Making install in bin /bin/sh ../libtool --tag=CC --mode=link gcc -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -L/opt/local/lib -L/opt/local/lib/db46 -o cobcrun cobcrun-cobcrun.o -L../libcob -lcob -lm -lgmp -L/opt/local/lib -lintl -L/opt/local/lib -liconv -lc -R/opt/local/lib -lncurses -ldb libtool: link: cannot find the library `' or unhandled argument `2/libcob' make[2]: *** [cobcrun] Error 1 make[1]: *** [install-recursive] Error 1 make: *** [install] Error 2 open-cobol-1.0 2 > cobc -h Usage: cobc [options] file... Options: --help Display this message --version, -V Display compiler version -v Display the programs invoked by the compiler -x Build an executable program -m Build a dynamically loadable module (default) -std= Compile for a specific dialect : cobol2002 Cobol 2002 cobol85 Cobol 85 ibm IBM Compatible mvs MVS Compatible bs2000 BS2000 Compatible mf Micro Focus Compatible default When not specified See config/default.conf and config/*.conf -free Use free source format -fixed Use fixed source format (default) -O, -O2, -Os Enable optimization -g Produce debugging information in the output -debug Enable all run-time error checking -o Place the output into -b Combine all input files into a single dynamically loadable module -E Preprocess only; do not compile, assemble or link -C Translation only; convert COBOL to C -S Compile only; output assembly file -c Compile and assemble, but do not link -t Generate and place a program listing into -I Add to copybook search path -L Add to library search path -l Link the library -D Pass to the C compiler -conf= User defined dialect configuration - See -std= --list-reserved Display all reserved words -save-temps Do not delete intermediate files -MT Set target file used in dependency list -MF Place dependency list into -ext Add default file extension -Wall Enable all warnings -Wobsolete Warn if obsolete features are used -Warchaic Warn if archaic features are used -Wcolumn-overflow Warn any text after column 72 -Wredefinition Warn redefinition of data items -Wconstant Warn inconsistent constant -Wparentheses Warn lacks of parentheses around AND within OR -Wterminator Warn lacks of scope terminator (END-XXX) -Wstrict-typing Warn type mismatch strictly -Wcall-params Warn non 01/77 items for CALL params (NOT set with -Wall) -Wtruncate Warn possible field truncation (NOT set with -Wall) -ftrace Include trace code in the output -fsyntax-only Syntax error checking only; don't emit any output -fstatic-call Output static function calls for the CALL statement -fdebugging-line Enable debugging lines -fsource-location Include source location in the output -fimplicit-init Do automatic initialization of the Cobol runtime system -fline-directive Include line directive in the output -fstatic-linkage Statically allocate non-USING LINKAGE parameters -fsign-ascii Numeric display sign ASCII (Default on ASCII machines) -fsign-ebcdic Numeric display sign EBCDIC (Default on EBCDIC machines) -fstack-check PERFORM stack checking (Turned on by -debug or -g) -fnotrunc Do not truncate binary fields according to PIC (ala MF) open-cobol-1.0 2 > ---------------------------------------------------------------- When I try to compile some code I get this error: examples > ls bubblesort.for decision.for hello.for input.hs bubblesortfor functions.for hello.hs prime.for conditional.for hello.cob input.for examples > cobc -x -free hello.cob /usr/share/open-cobol/config/default.conf: No such file or directory error: failed to load the initial config file examples > Have tried the fox described here: http://www.opencobol.org/modules/newbb/viewtopic.php?viewmode=flat&topic_id=928&forum=1 but the directory /usr/local/share/open-cobol/ does not exist! Can anyone help? Cheers ---------------------------------------------------------------- Where is your cobc located? My installation is : /Users/bosmangh/Development/COBOL/open-cobol-1.0 This location contains a bin folder (with the cobc) and a config folder with the default.conf ---------------------------------------------------------------- Looks like it never got installed. ~ > sudo find / -name "open-cobol*" Password: find: /dev/fd/3: Not a directory find: /dev/fd/4: Not a directory /Users/mtyers/Desktop/open-cobol-1.0 2 /Users/mtyers/Desktop/open-cobol-1.0 2/po/open-cobol.pot /Users/mtyers/Desktop/open-cobol-1.0 2/texi/open-cobol.info /Users/mtyers/Desktop/open-cobol-1.0 2/texi/open-cobol.texi /Users/mtyers/Downloads/open-cobol-1-1.0.tar /Users/mtyers/Downloads/open-cobol-1.0 /Users/mtyers/Downloads/open-cobol-1.0/po/open-cobol.pot /Users/mtyers/Downloads/open-cobol-1.0/texi/open-cobol.info /Users/mtyers/Downloads/open-cobol-1.0/texi/open-cobol.texi /Users/mtyers/Downloads/open-cobol-1.0.tar ~ > ---------------------------------------------------------------- I was able to get it installed using the FAQ. The only difference is I had to install vbisam first and the run ./configure --without-db --with-vbisam for openCOBOL. Worked like a champ! I also have XAMPP for mac running for cgi cobol coding. Cheers! ---------------------------------------------------------------- Thanks for the reply. Bit of a noob so can I get clarification. The instructions are exactly as described in the first post except there is an additional step before the ./configure step plus the ./configure step needs changing slightly? How do you install vbisam? cheers for your help. ---------------------------------------------------------------- vbisam in general: ./configure make make install ---------------------------------------------------------------- But that is exactly the same as the original instructions - that didn't work. Looks like I am on a loser with trying to teach students Cobol. Will take it off the teaching programme. Thanks for all the help guys. ---------------------------------------------------------------- Can you post the logs? It would help if you could tell us the errors you get from ./configure and make. vbisam should install just fine on the MAC. What OS X version are you on? once vbisam is installed the OpenCOBOL should install with ./configure --without-db --with-vbisam Cheers ---------------------------------------------------------------- Hi DamonH I posted all my logs earlier in the forum. Unfortunately I can't help beyond that. Not a UNIX expert so need my hand holding on this. thanks for offering to take a look. Mark ---------------------------------------------------------------- OK. So I installed VIrtual Box, Installed Ubuntu, used Ubuntu Software Centre to install OpenCOBOL. Took all day to get this far... Ran a few tests to make sure it was installed: whereis cobc cobc: /usr/bin.cobc /usr/share/man/man1/cobc.1.gz which cobc /usr/bin/cobc Created a simple hello world program: IDENTIFICATION DIVISION. PROGRAM-ID. HELLO-WORLD. * simple hello world program PROCEDURE DIVISION. DISPLAY 'Hello world!'. STOP RUN. ran the compiler: cobc -free -x -o helloworldcob hello.cob and got these errors: /tmp/cob1903_0.c: In function ‚ÄòHELLO_2DWORLD_‚Äô: /tmp/cob1903_0.c:75: warning: dereferencing type-punned pointer will break strict-aliasing rules /tmp/cob1903_0.c:76: warning: dereferencing type-punned pointer will break strict-aliasing rules /tmp/cob1903_0.c:77: warning: dereferencing type-punned pointer will break strict-aliasing rules /tmp/cob1903_0.c:88: warning: dereferencing type-punned pointer will break strict-aliasing rules /tmp/cob1903_0.c:107: warning: dereferencing type-punned pointer will break strict-aliasing rules /tmp/cob1903_0.c:111: warning: dereferencing type-punned pointer will break strict-aliasing rules What am I doing wrong! cheers...... ---------------------------------------------------------------- Seems like Ubuntu Software Centre used some wrong params for compiling. What version of cobc did it installed (cobc -version)? Because you only get C compiler warnings you should be able to run the compiled programs (maybe you have to change -o param to HELLO-WORLD, because you don't have an entry point helloworldcob). I assume ./HELLO-WORLD works fine? human ---------------------------------------------------------------- Subject: COBOL Programming in mainframe enviroment Hi! i was wondering if someone here could help me in creating a program using a psc, in-rec and headers. ---------------------------------------------------------------- Subject: Gartner group reference to production COBOL lines of code I bump into, and have referred to, the 1997? Gartner Group study on the global source code line count for production systems. It's the famous 300 thousand million total, 200+ thousand million in COBOL, with 5 thousand million new lines a year. Does anyone have a citation to the original? A link? Is this a defensible advocacy anecdote? Cheers, Brian ---------------------------------------------------------------- Hi, I don't know if this link will help you - but it is 2009/05 [url=http://blogs.systeminetwork.com/isnblogs/industrybits/2009/05/cobol_celebrates_50_yearsalone.html]50 Years Cobol[/url] [EDIT] found another one (also updated 2009) maybe this one is "nicer" [url=http://www.jsayles.com/ibm/cobol/COBOL2009.htm]COBOL 2009[/url] Greetings Gandalf ---------------------------------------------------------------- Thanks Gandalf, that second link has quite a few tasty figures, and better yet, references. ;) But I'll still leave open the question of the reference to the oft quoted Gartner Group study. Cheers, Brian ---------------------------------------------------------------- Subject: Borland BCC55 linking issue? I've been using OpenCobol on Linux with no problems, but my students don't generally have linux, so I was looking at setting it up using the Borland free compiler. I've gotten it to compile the cobol code to c and it compiles, but I get link errors after the compile. I am guessing something needs to be modified in some header files or compiler option. The is the output with the default setting give this. Adding -u- gives the same but leading _ removed from _cob. C:\borland\Bin>bcc32 -Ic:\borland\include -Lc:\borland\lib sc27811.c Borland C++ 5.5 for Win32 Copyright (c) 1993, 2000 Borland sc27811.c: Warning W8070 sc27811.c 621: Function should return a value in function SC278A_ Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland Error: Unresolved external '_main' referenced from C:\BORLAND\LIB\C0X32.OBJ Error: Unresolved external '_cob_exception_code' referenced from C:\BORLAND\BIN\SC27811.OBJ Error: Unresolved external '_cob_initialized' referenced from C:\BORLAND\BIN\SC27811.OBJ Error: Unresolved external '_cob_check_version' referenced from C:\BORLAND\BIN\SC27811.OBJ Error: Unresolved external '_cob_set_cancel' referenced from C:\BORLAND\BIN\SC27811.OBJ Error: Unresolved external '_cob_zero' referenced from C:\BORLAND\BIN\SC27811.OBJ Error: Unresolved external '_cob_malloc' referenced from C:\BORLAND\BIN\SC27811.OBJ Error: Unresolved external '_cob_call_params' referenced from C:\BORLAND\BIN\SC27811.OBJ Error: Unresolved external '_cob_save_call_params' referenced from C:\BORLAND\BIN\SC27811.OBJ Error: Unresolved external '_cob_open' referenced from C:\BORLAND\BIN\SC27811.OBJ Error: Unresolved external '_cob_accept_date' referenced from C:\BORLAND\BIN\SC27811.OBJ Error: Unresolved external '_cob_cmp' referenced from C:\BORLAND\BIN\SC27811.OBJ Error: Unresolved external '_cob_close' referenced from C:\BORLAND\BIN\SC27811.OBJ Error: Unresolved external '_cob_read' referenced from C:\BORLAND\BIN\SC27811.OBJ Error: Unresolved external '_cob_add' referenced from C:\BORLAND\BIN\SC27811.OBJ Error: Unresolved external '_cob_cmp_numdisp' referenced from C:\BORLAND\BIN\SC27811.OBJ Error: Unresolved external '_cob_move' referenced from C:\BORLAND\BIN\SC27811.OBJ Error: Unresolved external '_cob_write' referenced from C:\BORLAND\BIN\SC27811.OBJ Error: Unresolved external '_cob_current_module' referenced from C:\BORLAND\BIN\SC27811.OBJ Error: Unresolved external '_cob_error_file' referenced from C:\BORLAND\BIN\SC27811.OBJ Error: Unresolved external '_cob_default_error_handle' referenced from C:\BORLAND\BIN\SC27811.OBJ Error: Unresolved external '_cob_stop_run' referenced from C:\BORLAND\BIN\SC27811.OBJ Error: Unresolved external '_cob_fatal_error' referenced from C:\BORLAND\BIN\SC27811.OBJ ---------------------------------------------------------------- Others will have better more complete answers, but try to ensure that [b]libcob[/b] is linked. I'm usually on Debian, but if I had this problem I'd run a trusted cobc with [b]-v[/b] and try to match up the include and link options. For example, mine looks like [code] preprocessing spin.cob into /tmp/cob8837_0.cob translating /tmp/cob8837_0.cob into /tmp/cob8837_0.c gcc -I/usr/local/include -fwrapv -pipe -Wno-unused -fsigned-char -Wno-pointer-sign -shared -fPIC -DPIC -Wl,--export-dynamic -o spin.so /tmp/cob8837_0.c -L/usr/local/lib -lcob -lm -lgmp -lncurses -ldb [/code] I'll bet the -lcob, -lm, ... are critical linker options, but to be honest I really don't know Borland. Cheers, Brian ---------------------------------------------------------------- Thanks for the Reply. With Fedora, I had to add the line /usr/local/lib to /etc/ld.so.conf and then run ldconf That then adds the directory with the library to the path from the linker. Then was able to run without a problem with linux with no other mods. With Windows I downloaded a binary of the opencobol, and use it with the cobc -C to create the C code. I then copied all the library files to the borland lib directory and the include directories. The compile works with no errors to produce the .c files. But when I compile with the c code with the batch file that includes the library directory were the files are located results in the errors. ---------------------------------------------------------------- BCC isn't supported yet. You have to be aware that maybe not all C code generated by the binary you are using will compile, but as long as no compile error occur, you're fine. You need to compile with libcob.lib, a special BCC one is needed. Try [url=http://www.easy-share.com/1908092860/libcob.lib]this one (generated with BCC)[/url] and use [code]cobc.exe -C HELLO.cob bcc32 -WDR HELLO.c libcob.lib[/code] Then you'll get your .dll. But what do you want to do with that? For executables you can try [code]cobc.exe -C -x HELLO.cob bcc32 -WCR HELLO.c libcob.lib[/code] You can use human BTW: create bcc32.cfg and ilink32.cfg in your borland bin directory with all necessary -L and -I switches (google will help you) ---------------------------------------------------------------- I was able to get it to compile with the about but had to use lower case -wcr. But then it had a run time error. I wondering it also needs a special libcob.dll. ---------------------------------------------------------------- Exactly this is the reason why there aren't BCC binaries yet. I've changed all necessary code parts and with these compiled OC (cobcrun.exe, cobc.exe, libcob.dll). But I get a runtime error in using compiled programs in OC (even cobcrun.exe without any input files chrashes, cobc.exe works fine). I'm not sure if we need some special linking options or there are missing code changes. The necessary changes were done for VBISAM, too. I've compiled it with the same options and vbcheck.exe, vbrecover.exe and libvbisam.dll seem fine - no runtime error there. Sounds like we need a BCC expert?!? I plan to submit the patch for BCC compatibility (at least compiler compatibility) soon (after I solved the last open point to change cobc.c for using BCC), but still something seems to be missing. human ---------------------------------------------------------------- Subject: error installing openCobol Hi all, I followed the instruction manual to install OpenCOBOL1.1 pre-release. All the steps given where executed correctly till I reached the ./configure command(I used the first ./configure command). It shows an error: configure: error: gmp.h required. Then, when I try entering the "make" commnad it throws an error stating make: *** No targets specified and no makefile found. Stop Can anyone help me out please?? I am working on a project to convert COBOL programs to Jimple. This is my first step and am stuck here. The sooner you help me the better it would be for me... Thanks in advance all... ---------------------------------------------------------------- You need to install all prerequisites before. Read the README. If you have files in a non standard folder you have to tell ./configure about these directories. human ---------------------------------------------------------------- Subject: FR cobc (typeck.c?): output value size for "Value size exceeds data size" If you have a big move with multiple lines (using "-" in column 7 for fixed format) and a "Value size exceeds data size" occurs, it would be nice to know the size of the constant moved to the var. Example: [code] move "999999 sdffffffff sagf sgdsghudguidgsuidgsuiasdg ioasdg - " sdf awrasgh nnknh fdhgdfh gdfgygfy jmky - " - " njbasdgf k0454 252 - "25116 - " 12345 lkgfdsg" TO MY-DATA[/code] results in [quote]TSTBM.COB:85: Warning: Value size exceeds data size TSTBM.COB:17: Warning: 'MY-DATA' defined here as a group of length 205[/quote] better would be something like [quote]TSTBM.COB:85: Warning: Value size of 214 exceeds data size TSTBM.COB:17: Warning: 'MY-DATA' defined here as a group of length 205[/quote] human ---------------------------------------------------------------- Subject: enscript and COBOL syntax highligter Would anyone else ever use a [b]/usr/share/enscript/hl/cobol.st[/b] syntax highlighter for the [b]enscript[/b] program? I started horsing about with Foswiki http://foswiki.org and its SyntaxHighlighterPlugin uses enscript. I have it recognizing comment lines, strings and a few keywords. Do I bother filling in the rest and publishing? Cheers, Brian ---------------------------------------------------------------- Subject: Patch for small Bug in common.c: #endif was set wrong The error is in cob_sig_handler, [code]static void COB_NOINLINE cob_sig_handler (int sig) { #ifdef SIGSEGV if (sig == SIGSEGV) { if (cob_source_file) { fprintf (stderr, "%s:%d: ", cob_source_file, cob_source_line); } fprintf (stderr, "Attempt to reference unallocated memory (Signal SIGSEGV)\n"); fprintf (stderr, "Abnormal termination - File contents may be incorrect\n"); fflush (stderr); exit (SIGSEGV); } #endif if (cob_initialized) { cob_screen_terminate (); cob_exit_fileio (); fprintf (stderr, "Abnormal termination - File contents may not be correct\n"); fflush (stderr); } switch (sig) { #ifdef SIGHUP case SIGHUP: if ((hupsig != SIG_IGN) && (hupsig != SIG_DFL)) { (*hupsig) (SIGHUP); } break; #endif #ifdef SIGINT case SIGINT: if ((intsig != SIG_IGN) && (intsig != SIG_DFL)) { (*intsig) (SIGINT); } break; #endif #ifdef SIGQUIT case SIGQUIT: if ((qutsig != SIG_IGN) && (qutsig != SIG_DFL)) { (*qutsig) (SIGQUIT); } break; [b]} #endif[/b] exit (sig); }[/code] must be changed to [code]static void COB_NOINLINE cob_sig_handler (int sig) { #ifdef SIGSEGV if (sig == SIGSEGV) { if (cob_source_file) { fprintf (stderr, "%s:%d: ", cob_source_file, cob_source_line); } fprintf (stderr, "Attempt to reference unallocated memory (Signal SIGSEGV)\n"); fprintf (stderr, "Abnormal termination - File contents may be incorrect\n"); fflush (stderr); exit (SIGSEGV); } #endif if (cob_initialized) { cob_screen_terminate (); cob_exit_fileio (); fprintf (stderr, "Abnormal termination - File contents may not be correct\n"); fflush (stderr); } switch (sig) { #ifdef SIGHUP case SIGHUP: if ((hupsig != SIG_IGN) && (hupsig != SIG_DFL)) { (*hupsig) (SIGHUP); } break; #endif #ifdef SIGINT case SIGINT: if ((intsig != SIG_IGN) && (intsig != SIG_DFL)) { (*intsig) (SIGINT); } break; #endif #ifdef SIGQUIT case SIGQUIT: if ((qutsig != SIG_IGN) && (qutsig != SIG_DFL)) { (*qutsig) (SIGQUIT); } break; [b]#endif }[/b] exit (sig); }[/code] Otherwise the "switch (sig) {" is not closed. human ---------------------------------------------------------------- Hi, I don't know if my problem is related to this, but the error message I found is in the code above. I hope someone can help me. I migrated a RM/Cobol application to a OpenCobol 1.1, in Linux. Someone developed all the screens as Web application with Spring. Right now we are integrating Web application to Business logic (in OpenCobol) thru JNI. Testing funcionality is good for a while and suddenly the server crash with the following OpenCobol message: "Attempt to reference unallocated memory (Signal SIGSEGV) Abnormal termination - File contents may be incorrect" Can someone give me a hint about how this error is produced? The Cobol object program is as ".so" We did the following tests: 1. Web(java) to JNI (dummy) --> OK 2. JNI to .so --> OK 3. Web to JNI to .so --> OK for a while and crash suddenly. Thank you in advance, Fernando ---------------------------------------------------------------- I don't normally answer with 100% certainty. In this case, this is utterly unrelated. A segfault is caused (most commonly by null pointers) by referencing unowned memory. "gimme the contents of address x" where x is outside the current virtual memory working set. Same for writing. It protects your system's legs when you try to get it to shoot off it's foot. :) Cheers, Brian ---------------------------------------------------------------- btiffin is correct: It's totally unrelated as the bug in common.c would occur on compile time of common.c. Concerning your problem: I suggest to use cobc -debug when compiling your so files (at least on testing). This way a lot of useful checks are integrated into the .so-files. They will lead to error messages like "index out of bounds" or "BASED var not ALLOCATED" and an exit as clear as possible in this case. I always use this switch, even in production environment, although it slows down the .so a little bit (no big problem as most time goes to screen/file-io in our programs) and makes it grow (no problem as it's not that bad). human ---------------------------------------------------------------- Thank you very much for your support, is good feeling no to be alone. I tried with -debug, and can identify the line number with error, is GOBACK. My case is that need to do multiple calls, one por each record comming from Java thru JNI. The call and the result are ok. Just the ocasionally crash after finish. Some idea is about Java garbage collector and variables created in JNI and passed to cobol, but no sure. Here made a change in the GOBACK to EXIT PROGRAM but now the problem is that at reach EXIT PROGRAM instead of exit, the program execute another time and then exit (Execute two times). Taking off the instruction (No exit program, nor Goback, neither Stop run) acts like EXIT PROGRAM. Trying STOP RUN, at reach instruction ends cobol program and java. I can understand as normal, but would prefer to return at caller. I will keep trying, now compiling with -fimplicit-init and GOBACK. I'm trying with a dummy cobol program, just one variable and one display at enter, in order to isolate the problem, but message come from OpenCobol - common.c. The most rare is why after finish fine with right results many calls it crash. Any ideas? I thank you in advance. Regards, Fernando :hammer: ---------------------------------------------------------------- Moving to a new topic... See segfault on GOBACK. http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1311&post_id=6613&order=0&viewmode=flat&pid=0&forum=1#forumpost6613 Cheers, Brian ---------------------------------------------------------------- Subject: Bug??? Why don't we want to use signal.h for Windows in common.c? Quote from lines 36-42: [code]#ifdef _WIN32 #define WINDOWS_LEAN_AND_MEAN #include #include #include [b]#undef HAVE_SIGNAL_H[/b] #endif[/code] If the used config.h has [code]#define HAVE_SIGNAL_H 1[/code] I expected signal.h to be used. human ---------------------------------------------------------------- Subject: EOF error with MSC-builds when compiling source files in native mac format... I've tried to compile sources with mac line endings (x'0D'). There are no problems on MinGW builds but MSC-builds are always complaining about unexpected eof. Could we tweak the source with a #ifdef _MSC_VER somewhere to support files in mac format, too? human ---------------------------------------------------------------- Subject: INSPECT REPLACING TRAILING = non-standard? I'm kind of shocked... I've just had a look at the replacing phrase in the ANSI 85, ISO 2002 and 20xx draft. They all don't have TRAILING in the replacing-phrase, therefore it seems to be an implementor extension. Are there implementors that don't have this? @wmklein: Would it make sense to submit this for the next ISO standard for being standardized? human ---------------------------------------------------------------- 1) Very few implementationshave this. (IBM doesn't and I don't think that any of the other "major" mainframe compilers have/had it. (I think MF may have it, but I don't think that Fujitsu does) 2) It has been repeatedly submitted as an "enhancement suggestion" to the Standards committees; it is always rejected. I can't remember all the detials, but, Inspect tallying trialing... Function Reverse (whatever) is valid tody. Inspect with REPLACING trailing only requires a temp data item and funciton reverse. In general (with some exceptions) the Standards committee doesn't like enhancements for things that can already be done easily - or relatively easily. ---------------------------------------------------------------- I think you meant [code]MOVE FUNCTION REVERSE (mytext) TO mytemp INSPECT mytext REPLACING LEADING SPACES BY LOW-VALUES MOVE FUNCTION REVERSE (mytemp) TO mytext[/code] instead of [code]INSPECT mytext REPLACING TRAILING SPACES BY LOW-VALUES[/code] Right? Yes, this would work (never thought of it), but the 2nd one is clearly more beautiful (an argument the committees wouldn't count, I guess...). Nice to have this extension in our beloved OC. human ---------------------------------------------------------------- Subject: What kind of front ends are used with OC? Rather than doing things manually, I created a little dialog script that I've been testing, and have the basics down. It includes options to download and upload files, since students use shared labs. Here is the script that works fine with regular linux, and have used it with cygwin but changed editor to nano. [code] #!/bin/sh # # ## Michael Setzer II - Program Modifications : ${DIALOG=dialog} : ${DIALOG_OK=0} : ${DIALOG_CANCEL=1} : ${DIALOG_ESC=255} : ${EDITOR=gedit} set_dir() { cd ~ userroot=`echo $prg | cut -b 1-5` if [ ! -d $userroot ] ; then mkdir ~/$userroot fi cd ~/$userroot } # window title backtitle="cobol menu" if [ -n "$1" ] ; then prg="$1" prg=`echo $prg | tr '[:lower:]' '[:upper:]'` set_dir else prg="" fi Download="\Z1NO DOWNLOAD\Zn" sel=0 while [ $sel = 0 ] do $DIALOG --backtitle "$backtitle" --colors \ --title "COBOL MENU - $Download" \ --menu "Choose your desired mode:" 0 0 0 \ "A: Program Name" "Get Program Name ($prg)" \ "B: Edit Program " "Edit Program" \ "C: Compile Program " "Compile Program" \ "D: Run Program" "Run Program" \ "E: Display Output" "Display Output" \ "F: Print Output" "Print Output" \ "G: Download Files" "Download and Unzip Files"\ "H: Upload Files" "Zip Files and Upload"\ "X: X-REF View" "Create and View X-REF"\ 2> /tmp/frontout.$$ sel=$? option=`cat /tmp/frontout.$$ | cut -b 1-1` case $option in "A") $DIALOG --backtitle "$backtitle" \ --inputbox "Enter Program name" 0 0 2>/tmp/input.$$ sel=$? prg=`cat /tmp/input.$$ | tr '[:lower:]' '[:upper:]'` set_dir ;; "B") if [ ! -e $prg.CBL ] ; then $DIALOG --radiolist "Select Template" 10 40 2 \ 1 "Old Template" off \ 2 "New Template" on 2>/tmp/input.$$ opt=`cat /tmp/input.$$` if [ "$opt" = "2" ] ; then cp /DATA/START2.CBL $prg.CBL else cp /DATA/START1.CBL $prg.CBL fi fi $EDITOR $prg.CBL expand $prg.CBL >$prg.txt rm $prg.CBL mv $prg.txt $prg.CBL Download="\Z3DOWNLOAD with Changes\Zn" ;; "C") cobc -x -O2 $prg.CBL 2>OUT echo " **** End of Errors **** " >>OUT $DIALOG --backtitle "$backtitle" --timeout 10 --textbox OUT 0 0 ;; "D") ./$prg unix2dos SCN fixscn rm SCN mv SCN2 SCN ;; "E") $EDITOR SCN ;; "F") lp SCN ;; "G") set_dir ncftpget -u user -p password ftpserver . $userroot.ZIP unzip -u $userroot Download="\Z2DOWNLOAD\Zn" ;; "H") set_dir zip $userroot.ZIP *.CBL ncftpput -u user -p password ftpserver . $userroot.ZIP Download="\Z6SAVED\Zn" sleep 10 ;; "X") cobc -x -O2 $prg.CBL -t $prg.CBL.t 2>OUT cobxref $prg.CBL.t -R $EDITOR $prg.CBL.lst ;; esac done rm /tmp/*.$$ if [ -e OUT ]; then rm OUT fi if [ -e OUT ]; then rm SCN fi cd ~ [/code] END OF COBMENU SCRIPT The fixscn program is used for lines that double print on the same line. Works to the printer, but on screen was showing on separate lines. [code] #include // Program to fix output lines that print on same line. // Line 1 prints Salesman name with CR at end of line. // Line 2 prints blanks to correctly position Sales data // Screen view shows as to lines, but printer correctly prints. // This program strips the CR and extra blanks to make a single line. int main() { FILE *in, *out; char c; int count=0,i; in=fopen("SCN","rb"); out=fopen("SCN2","wb"); do { c=getc(in); if (c != 13) { putc(c,out); count++; } else { c=getc(in); if (c == 10) { putc(13,out); putc(10,out); count=0; } else { for (i=1;ibody = cb_list_append (current_statement->body, l) +#define output_error 1 +#define output_warning 0 + /* Global variables */ size_t sending_id = 0; @@ -3870,7 +3877,7 @@ */ static void -warning_destination (cb_tree x) +warning_destination (cb_tree x, unsigned char output_as_error) { struct cb_reference *r; struct cb_field *f; @@ -3883,21 +3890,32 @@ if (r->offset) { return; } - - if (!strcmp (f->name, "RETURN-CODE") || - !strcmp (f->name, "SORT-RETURN") || - !strcmp (f->name, "NUMBER-OF-CALL-PARAMETERS")) { - cb_warning (_("Internal register '%s' defined as BINARY-LONG"), f->name); - } else if (f->pic) { - cb_warning_x (loc, _("'%s' defined here as PIC %s"), f->name, f->pic->orig); + if (output_as_error) { + if (!strcmp (f->name, "RETURN-CODE") || + !strcmp (f->name, "SORT-RETURN") || + !strcmp (f->name, "NUMBER-OF-CALL-PARAMETERS")) { + cb_warning (_("Internal register '%s' defined as BINARY-LONG"), f->name); + } else if (f->pic) { + cb_warning_x (loc, _("'%s' defined here as PIC %s"), check_filler_name ((char *)f->name), f->pic->orig); + } else { + cb_warning_x (loc, _("'%s' defined here as a group of length %d"), check_filler_name ((char *)f->name), f->size); + } } else { - cb_warning_x (loc, _("'%s' defined here as a group of length %d"), f->name, f->size); + if (!strcmp (f->name, "RETURN-CODE") || + !strcmp (f->name, "SORT-RETURN") || + !strcmp (f->name, "NUMBER-OF-CALL-PARAMETERS")) { + cb_error (_("Internal register '%s' defined as BINARY-LONG"), f->name); + } else if (f->pic) { + cb_error_x (loc, _("'%s' defined here as PIC %s"), check_filler_name ((char *)f->name), f->pic->orig); + } else { + cb_error_x (loc, _("'%s' defined here as a group of length %d"), check_filler_name ((char *)f->name), f->size); + } } } static int -move_error (cb_tree src, cb_tree dst, const size_t value_flag, const int flag, - const int src_flag, const char *msg) +move_error (cb_tree src, cb_tree dst, const size_t value_flag, const unsigned char flag, + const unsigned char src_flag, const char *msg) { cb_tree loc; @@ -3913,9 +3931,9 @@ if (flag) { cb_warning_x (loc, msg); if (src_flag) { - warning_destination (src); + warning_destination (src, output_warning); } - warning_destination (dst); + warning_destination (dst, output_warning); } } @@ -3966,6 +3984,7 @@ } if (CB_TREE_CATEGORY (dst) == CB_CATEGORY_BOOLEAN) { cb_error_x (loc, _("Invalid destination for MOVE")); + warning_destination (src, output_error); return -1; } @@ -4067,10 +4086,12 @@ if (l->sign != 0 && !f->pic->have_sign) { if (is_value) { cb_error_x (loc, _("Data item not signed")); + warning_destination (src, output_error); return -1; } if (cb_warn_constant) { cb_warning_x (loc, _("Ignoring negative sign")); + warning_destination (src, output_warning); } } @@ -4354,6 +4375,7 @@ goto invalid; } cb_warning_x (loc, _("Move non-integer to alphanumeric")); + warning_destination (dst, output_warning); break; } if (CB_TREE_CATEGORY (src) == CB_CATEGORY_NUMERIC @@ -4380,6 +4402,7 @@ break; default: cb_error_x (loc, _("Invalid source for MOVE")); + warning_destination (src, output_error); return -1; } break; @@ -4400,15 +4423,17 @@ } else { cb_error_x (loc, _("Invalid MOVE statement")); } + warning_destination (dst, output_error); return -1; numlit_overflow: if (is_value) { cb_error_x (loc, _("Invalid VALUE clause - literal exceeds data size")); + warning_destination (dst, output_error); return -1; - } - if (cb_warn_constant) { + } else if (cb_warn_constant) { cb_warning_x (loc, _("Numeric literal exceeds data size")); + warning_destination (dst, output_warning); } return 0; [/code] human ---------------------------------------------------------------- Subject: Typical Newbie Questions I have a lot of Acucobol programs which use the Acucobol index files. Is it feasible to convert to OpenCobol and what would I use for my files to retrieve and update simply. (I do have a simple mind! HA!) I want to run under Windows XP if possibe. Thanks Donnie :-D ---------------------------------------------------------------- 1. WinXP: I suggest you download the 1.1 binaries from kiska.net and install a MS-C compiler (Express versions will work, too) for being able to compile your programs. 2. Remove all split keys from your index files (there is currently no support for that in OC) 3. If you want to use your old data, export it to a text file, use it as input for a new written program in OC to read the text file and write the parts to ISAM. 4. Compile all your programs with cobc (the necessary code changes depend on the amount of ACU features you are using). human ---------------------------------------------------------------- Thank you for your reply ---------------------------------------------------------------- Subject: Human, Please clarify to a dummy (me) Back to the Acucobol question. Are you saying to re-write all the COBOL source code to C ? That is a couple of hundred programs. Thanks Donnie ---------------------------------------------------------------- You will not need to rewrite all of the programs. The OpenCobol compiler is written in C and will need to be compiled in order to run on your machine. By the way the compiler takes your source code and generates C which is then compiled to create your run-time object. The vast majority of your code should work without modification. As you are probably aware some Cobol compiler support extentions to the Cobol standards and you may have to make some changes to your code in order to get OpenCobol to handle your code. I don't mean to speak for Human but because of the time differences I thought I could get you an answer sooner. ---------------------------------------------------------------- OK thanks guys. I'm glad you're there for me! Donnie ---------------------------------------------------------------- As jcurrey explained it, you only have to rewrite the non-standard things. I'm not aware of all ACU extensions, but there could be some C$routines that aren't in OC. If there are some specific ones that you are using quite often it may could be useful to ask for support. You may face a lot of warnings if compiled with -Wall (enables most warnings) or even -W (enables even the strictest warnings), but all "real" COBOL source should work. human ---------------------------------------------------------------- Subject: cobcrun error says: cob_init() has not been called cobc -x hello.cob ./hello.exe works fine. BUT cobc -m hello.cob cobcrun hello says libcob: cob_init() has not been called cobcrun ./hello says libcob: No error in no case does hello.dll produce the display Hello World! I am using cygwin on windowsxp. I used cvs to download the latest version using anonymous login. ---------------------------------------------------------------- I have no problems with OC (current pre-release). What cvs are you talking about? human ---------------------------------------------------------------- CVS is Concurrent Versions System http://www.opencobol.org/modules/bwiki/index.php?InstallGuide If you are a developer, consider building the latest OpenCOBOL from the CVS repository. How to fetch opencobol with cvs http://sourceforge.net/scm/?type=cvs&group_id=34923 cvs -d:pserver:anonymous@open-cobol.cvs.sourceforge.net:/cvsroot/open-cobol login cvs -z3 -d:pserver:anonymous@open-cobol.cvs.sourceforge.net:/cvsroot/open-cobol co -P open-cobol ---------------------------------------------------------------- This CVS isn't used for "daily" developing any more. Roger uses his own CVS because of speed issues. You can see this if you look at the CVS statistics on sourceforge - there are only read transactions for over 12 months. It's good that you wanted to use the latest version, just take the current pre-release and build OC again. You can find it on this page in Download, "OpenCOBOL 1.1 pre-release". Don't get confused because of the old "announcing date" (it's the date we got the first 1.1 pre-release). You can see the real date after downloading in tarstamp.h or after installing when doing cobc -version. human ---------------------------------------------------------------- ok, I downloaded pre-rel OC 1.1 (Feb 2009) and ran configure, make, and make install. I restarted the cygwin shell just for good measure. It has exactly the same problem behavior reported at the start of this thread. I did get a warning about -ldb (I only have a cygwin static lib for 1.86 of BDB db) libtool will only create a static version of it (meaning libcob I guess) I earlier did manage to get ncurses and gmp installed, gmp has both static and dynamic. cygcheck ./hello.dll does not show anything missing. ---------------------------------------------------------------- Concerning BDB, the README says, [quote] o Berkeley DB (libdb) 1.85 or later http://www.oracle.com/ [b]BOTH runtime AND development components required. Recommended is version 4.x as 1.85 is known to have problems.[/b] [...] Berkeley DB is distributed under the original BSD License (1.85) or their own open-source license (2.x or later). Note that, as of 2.x, if you linked your software with Berkeley DB, you must distribute the source code of your software along with your software, or you have to pay royalty to Oracle.[/quote] But your problem seems to be not related to ISAM access. If you're using cobcrun the case of the PROGRAM-ID must match. Try cobcrun HELLO. If this doesn't help, please post the used hello.cob here. I'll try to compile and run it in my cygwin environment, where I have no problems with cobcrun. human ---------------------------------------------------------------- $ cat hello.cob 000100* HELLO.COB OpenCOBOL FAQ example 000200 IDENTIFICATION DIVISION. 000300 PROGRAM-ID. hello. 000400 PROCEDURE DIVISION. 000500 DISPLAY "Hello World!". 000600 STOP RUN. I think this is straight off of your website. I did this cobc hello.cob or cobc -m hello.cob then cobcrun hello libcob: cob_init() has not been called and cobcrun ./hello libcob: No error but it does not print "Hello World!" cobc -x hello.cob ./hello does say "Hello World!" ---------------------------------------------------------------- cobcrun ./hello should not work because you pass only the name of the module to it, not the place. cobcrun hello works for me with your sample using WinXP+cygwin. Please check the version of the installed cobc again, it should look like [quote]$ cobc -version cobc (OpenCOBOL) 1.1.2 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Sep 04 2009 14:26:47 Packaged Feb 06 2009 10:30:55 CET[/quote] human ---------------------------------------------------------------- Two quick things to try, sudo ldconfig or perhaps cobc -fimplicit-init hello.cob, see if that changes the cobcrun. Cheers, Brian ---------------------------------------------------------------- Thanks, Brian, that works. cobc -fimplicit-init hello.cob I see that the cobc --help says -fimplicit-init Do automatic initialization of the Cobol runtime system Why do you suppose this flag is necesary for me, but not for other users? ---------------------------------------------------------------- This is perhaps not the final answer, but this link http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=22&forum=1#forumpost116 discusses why the implicit-init option was added (years ago now). Looking at it, it may be that your default dialect config file has something weird in it?? See http://opencobol.add1tocobol.com/#what-dialects-are-supported-by-opencobol for what little I know about the -std= and the config/.conf files. Maybe? Cheers, Brian ---------------------------------------------------------------- Subject: Updated gedit to support cobol highlighting? I've been working with gedit with my Fedora systems, and the classbrowser and splitview2 have been nice extensions, but have cobol not being one of the languages for the highlight option. I have taken the fortran.lang file and modified it somewhat by putting in the OC Keywords and modified it to support the * in column 7 comment and >> comments. The file is named cbl.lang and is placed in the following location - /usr/share/gtksourceview-2.0/language-specs with the other .lang files. I choose the type to show the Keywords in Green instead of Red, but perhaps others can point out things that need to be added. [code] text/x-cobol *.f;*.f9[05];*.cbl;*.CBL ! ! " echo " " echo " " echo "

${scriptName} variables

" echo " " echo " " echo " " echo " " echo " " echo " " echo " " echo " " echo " " echo " " echo " " echo " " echo " " echo "
scriptName: ${scriptName}
debugMe: ${debugMe}
MyHomeDirectory: ${MyHomeDirectory}
OpenCOBOLdirectory: ${OpenCOBOLdirectory}
requestedURI: ${requestedURI}
pathName: ${pathName}
dirname: ${dirName}
fileName: ${fileName}
ext: ${ext}
program: ${program}
COB_LIBRARY_PATH: ${COB_LIBRARY_PATH}
QUERY_STRING: ${QUERY_STRING}
" echo " " echo "" else if [ -f $dirName/$program.so ] then cd ${dirname} ${OpenCOBOLdirectory}/cobcrun $program 2>&1 else echo "No such file

${REDIRECT_URL} does not exist

" fi fi [/code] ---------------------------------------------------------------- The Compile scripts. I've divided these into a number of files so I can individually compile when needed. They are: downloadTars.sh for when we do want to get new downloads (shouldn't need it until 2.0 comes out). [code] #! /bin/bash wget ftp://ftp.gnu.org/gnu/gmp/gmp-4.2.4.tar.gz wget http://www.sim-basis.de/vbisam-2.0.tar.gz wget http://www.sim-basis.de/open-cobol-1.1.tar.gz [/code] programsDir.sh to verify if /home/username/programs exists and if not to make it. It also sets the var ${programDirs} [code] #! /bin/bash programsDir=~/programs if [ ! -d ${programsDir} ] then mkdir ${programsDir} fi [/code] vbIsam.sh for installing vbisam. [code] #! /bin/bash set -xv source programsDir.sh rm -rf vbisam-2.0 tar -xzf vbisam-2.0.tar.gz cd vbisam-2.0/ ./configure --prefix=${programsDir} make make install cd .. [/code] gmp.sh for installing gmp. [code] #! /bin/bash set -xv source programsDir.sh rm -rf gmp-4.2.4 tar -xzf gmp-4.2.4.tar.gz cd gmp-4.2.4/ ./configure --prefix=${programsDir} make make install cd .. [/code] oc.sh for installing OpenCOBOL. [code] #! /bin/bash #set -xv source programsDir.sh rm -rf open-cobol-1.1 tar -xzf open-cobol-1.1.tar.gz cd open-cobol-1.1 export CPPFLAGS=-I${programsDir}/include export LDFLAGS=-L${programsDir}/lib ./configure --prefix=${programsDir} $* make make install cd .. cobc --version [/code] install.sh for installing the entire shebang at once based on whether you type --without-db, --with-db, or --with-vbisam. [code] #! /bin/bash #set -xv vbIsam=no bdb=no withoutDB=yes for arg in "$@" do if [ $arg == "--with-vbisam" ] then vbIsam=yes bdb=no withoutDB=no fi if [ $arg == "--with-db" ] then bdb=yes vbIsam=no withoutDB=no fi if [ $arg == "--without-db" ] then withoutDB=yes vbIsam=no bdb=no fi done ./gmp.sh if [ $vbIsam == "yes" ] then ./vbisam.sh ./oc.sh --with-vbisam elif [ $bdb == "yes" ] then ./oc.sh --with-db else ./oc.sh --without-db fi [/code] ---------------------------------------------------------------- Good information. Both links you've provided: http://a.add1tocobol.com/ocwebtest.cobol and http://a.add1tocobol.com/ocwebtest.txt don't exist on the server. As written in the vbisam-thread: I think one should use a patched version, not the old 2.0 that can be found at sim-basis. human ---------------------------------------------------------------- [quote] human wrote: Good information. Both links you've provided: http://a.add1tocobol.com/ocwebtest.cobol and http://a.add1tocobol.com/ocwebtest.txt don't exist on the server. As written in the vbisam-thread: I think one should use a patched version, not the old 2.0 that can be found at sim-basis. human[/quote] Fixed. I tried the version 2.1.1 of vbisam, but will have to hunt down issues there. ---------------------------------------------------------------- The links simply don't work... they result in "the server a.add1tocobol.com cannot be found" vbisam in the other thread. human ---------------------------------------------------------------- Since [url=http://a.add1tocobol.com]http://a.add1tocobol.com[/url] is down, try: [url=http://cobc.c-wd.net]http://cobc.c-wd.net[/url] or [url=http://cobol.c-wd.net]http://cobol.c-wd.net[/url] The source code for both subdomains are contained in the top right corner. The latter site contains a simple CMS (Content Management System). The MySQL C Wrapper from sanpontze, PSQL Wrapper, and the SQLite Wrapper will be included on one or the other, haven't decided which one yet. Most likely [url=http://cobol.c-wd.net]http://cobol.c-wd.net[/url] Thank you for your time, erstazi ---------------------------------------------------------------- Human, as mentioned it's a temporary link. I just installed Wordpress on add1tocobol.com proper and moved the tikiwiki version of our site to a subdomain to hold for historical purposes, until we translate all of the articles from that to the new. So now I will be moving to accomplish the changes for these tests to be pointing to the active domain. That will include a permanent download. ---------------------------------------------------------------- Subject: Posts Gets Puts Deletes coming soon! In the coming few days I will have a COBOL program set up which will provide all GETS, POSTS, PUTS and DELETES from a browser form into COBOL tables. These will be fully searchable. This way no more parsing the web input, just search your table or loop through it, to gather the fields you know should be there. This will be much like the PHP $_GET/$_POST options. Stay tuned! ---------------------------------------------------------------- Subject: History of COBOL As a follow-up to a recent thread in comp.lang.cobol, I finally got around to doing something that I have been meaning to do for a while. I have "cut-and-pasted" (and reformatted) the information from the '85 Standard and its amendments with all the detail you might EVER WANT about the history of COBOL. To view this material, pleas see: PDF version: [url=http://home.comcast.net/~wmklein/DOX/History.pdf]http://home.comcast.net/~wmklein/DOX/History.pdf[/url] HTML version: [url=http://home.comcast.net/~wmklein/DOX/History.htm]http://home.comcast.net/~wmklein/DOX/History.htm[/url] Anyone NOT interested in "trivia" will probably find this pretty boring. However, as a fairly definitive and comprehensive history, it should be a useful reference. ---------------------------------------------------------------- Thank you for these documents. Some thoughts: - the end is missing (stops in the middle of a sentence) - maybe you are able to add some short summary of the documents you name for history after 1984 human ---------------------------------------------------------------- Thanks for pointing out the missing end of sentence at the end of the document. I have gone ahead and added a LITTLE about the post 1993 documents. Much more than this is hard for me to find as "direct quotes" in the documents. However, I was able to find places that you can download or puchase each of these. So that may help some. ---------------------------------------------------------------- Thank you for these good information and the nice PDF! human ---------------------------------------------------------------- Hello William, What is the copyright on your writeup? And what are your thoughts on this being distributed? (This is something I would love to have in the OCKit) Also, if you get the chance, join on irc.mibbit.net in the channel: #add1.to We would love to have you join! Thank you for your time, erstazi ---------------------------------------------------------------- Subject: First try at compiling an original program.. Errors This is the first "trial" code I'm trying to compile.. I'm not sure if there's something I'm missing from the installation, or if my first time amateur COBOL code is wrong. I get the error "trial.COB:1: Error: Invalid indicator 'F' at column 7" when trying to compile the following code: [code] IDENTIFICATION DIVISION. PROGRAM-ID. trial. ENVIRONMENT DIVISION INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT HistFile ASSIGN TO "ITEMHI.DAT" ORGANIZATION IS LINE SEQUENTIAL DATA DIVISION. FILE SECTION. FD HistFile. 01 FILLER. 03 IH-STAT PIC XX. 03 IH-FILE-NAME PIC X(8) VALUE "ITEMHI". 03 IH-NAME PIC X(30) VALUE SPACES. 03 IHK-ITEM-STORE-PROM. 05 IHK-IS-ITEM-NO PIC X(15). 05 IHK-IS-STORE-NO PIC 999. 05 IHK-IS-PROM-ID PIC X(4). 05 IHK-IS-YEAR PIC 9(4). 05 IHK-IS-MONTH PIC 9(4). 05 IHK-IS-TYPE-RCD PIC X. 03 IHK-PROM-ITEM-STORE. 05 IHK-PIS-PROM-ID PIC X(4). 05 IHK-PIS-ITEM-NO PIC X(15). 05 IHK-PIS-STORE-NO PIC 999. 05 IHK-PIS-YEAR PIC 9(4). 05 IHK-PIS-MONTH PIC 9(4). 05 IHK-PIS-TYPE-RCD PIC X. PROCEDURE DIVISION. Begin. OPEN INPUT HistFile READ HistFile AT END MOVE HIGH-VALUES TO IHK-IS-ITEM-NO END-READ PERFORM UNTIL IHK-IS-ITEM-NO = HIGH-VALUES DISPLAY IH-STAT SPACE IH-FILE-NAME SPACE IH-NAME DISPLAY "ITEM NO" SPACE IHK-IS-ITEM-NO SPACE IHK-IS-STORE-NO SPACE IHK-IS-PROM-ID SPACE IHK-IS-YEAR SPACE IHK-IS-MONTH SPACE IHK-IS-TYPE-RCD DISPLAY IHK-PIS-PROM-ID SPACE IHK-PIS-ITEM-NO SPACE IHK-PIS-STORE-NO SPACE IHK-PIS-YEAR SPACE IHK-PIS-MONTH SPACE IHK-PIS-TYPE-RCD DISPLAY READ HistFile AT END MOVE HIGH-VALUES TO IHK-IS-ITEM-NO END-READ END-PERFORM CLOSE HistFile STOP RUN. [/code] EDIT: corrected code format ---------------------------------------------------------------- Is your code indented? The first seven columns in COBOL are reserved . . . you begin tour code in the eighth column. It sounds like The letter "F" in the word "IDENTIFICATION" is in the "indicator area" (column seven) and the compiler doesn't know what to do with it (this column is usually used for continuation characters). Hope this helps. :-D ---------------------------------------------------------------- Better yet, compile requesting "free form reference format" and you do NOT need to have the first 7 columns blank. ---------------------------------------------------------------- Subject: VBISAM compile errors SOLVED...see second post. Human here is the information you requested I think. I can give you access to the server directly if it will help. ---- checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking dlfcn.h usability... yes checking dlfcn.h presence... yes checking for dlfcn.h... yes checking the maximum length of command line arguments... 98304 checking command to parse /usr/bin/nm -B output from gcc object... ok checking for objdir... .libs checking for ar... ar checking for ranlib... ranlib checking for strip... strip checking if gcc supports -fno-rtti -fno-exceptions... no checking for gcc option to produce PIC... -fPIC checking if gcc PIC flag -fPIC works... yes checking if gcc static flag -static works... yes checking if gcc supports -c -o file.o... yes checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes configure: creating libtool checking whether make sets $(MAKE)... (cached) yes checking for ANSI C header files... (cached) yes checking for stdint.h... (cached) yes checking for sys/types.h... (cached) yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking malloc.h usability... yes checking malloc.h presence... yes checking for malloc.h... yes checking stddef.h usability... yes checking stddef.h presence... yes checking for stddef.h... yes checking wchar.h usability... yes checking wchar.h presence... yes checking for wchar.h... yes checking for an ANSI C-conforming const... yes checking whether byte ordering is bigendian... no checking for size_t... yes checking for long long... yes checking whether struct tm is in sys/time.h or time.h... time.h checking for working alloca.h... yes checking for alloca... yes checking for vprintf... yes checking for _doprnt... no checking for memmove... yes checking for memset... yes checking for fcntl... yes checking for strcasecmp... yes checking for strchr... yes checking for strrchr... yes checking for strdup... yes checking for strstr... yes checking for strtol... yes configure: creating ./config.status config.status: creating Makefile config.status: creating libvbisam/Makefile config.status: creating bin/Makefile config.status: creating tests/atlocal config.status: creating tests/Makefile config.status: creating config.h config.status: executing tests/atconfig commands config.status: executing depfiles commands VBISAM Configuration: CC gcc CFLAGS -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k C-ISAM compatible mode no Debugging mode no make + make make all-recursive make[1]: Entering directory `/home/USERNAME/OpenCOBOL4Dreamhost/Installs/vbisam-2.0' Making all in libvbisam make[2]: Entering directory `/home/USERNAME/OpenCOBOL4Dreamhost/Installs/vbisam-2.0/libvbisam' if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libvbisam_la-isdecimal.lo -MD -MP -MF ".deps/libvbisam_la-isdecimal.Tpo" -c -o libvbisam_la-isdecimal.lo `test -f 'isdecimal.c' || echo './'`isdecimal.c; \ then mv -f ".deps/libvbisam_la-isdecimal.Tpo" ".deps/libvbisam_la-isdecimal.Plo"; else rm -f ".deps/libvbisam_la-isdecimal.Tpo"; exit 1; fi mkdir .libs gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libvbisam_la-isdecimal.lo -MD -MP -MF .deps/libvbisam_la-isdecimal.Tpo -c isdecimal.c -fPIC -DPIC -o .libs/libvbisam_la-isdecimal.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libvbisam_la-isdecimal.lo -MD -MP -MF .deps/libvbisam_la-isdecimal.Tpo -c isdecimal.c -o libvbisam_la-isdecimal.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libvbisam_la-ishelper.lo -MD -MP -MF ".deps/libvbisam_la-ishelper.Tpo" -c -o libvbisam_la-ishelper.lo `test -f 'ishelper.c' || echo './'`ishelper.c; \ then mv -f ".deps/libvbisam_la-ishelper.Tpo" ".deps/libvbisam_la-ishelper.Plo"; else rm -f ".deps/libvbisam_la-ishelper.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libvbisam_la-ishelper.lo -MD -MP -MF .deps/libvbisam_la-ishelper.Tpo -c ishelper.c -fPIC -DPIC -o .libs/libvbisam_la-ishelper.o ishelper.c:147: error: conflicting types for 'isrelrec' ../vbisam.h:221: error: previous declaration of 'isrelrec' was here ishelper.c:195: error: conflicting types for 'issetunique' ../vbisam.h:229: error: previous declaration of 'issetunique' was here ishelper.c:226: error: conflicting types for 'isuniqueid' ../vbisam.h:232: error: previous declaration of 'isuniqueid' was here make[2]: *** [libvbisam_la-ishelper.lo] Error 1 make[2]: Leaving directory `/home/USERNAME/OpenCOBOL4Dreamhost/Installs/vbisam-2.0/libvbisam' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/USERNAME/OpenCOBOL4Dreamhost/Installs/vbisam-2.0' make: *** [all] Error 2 make install + make install Making install in libvbisam make[1]: Entering directory `/home/USERNAME/OpenCOBOL4Dreamhost/Installs/vbisam-2.0/libvbisam' if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libvbisam_la-ishelper.lo -MD -MP -MF ".deps/libvbisam_la-ishelper.Tpo" -c -o libvbisam_la-ishelper.lo `test -f 'ishelper.c' || echo './'`ishelper.c; \ then mv -f ".deps/libvbisam_la-ishelper.Tpo" ".deps/libvbisam_la-ishelper.Plo"; else rm -f ".deps/libvbisam_la-ishelper.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libvbisam_la-ishelper.lo -MD -MP -MF .deps/libvbisam_la-ishelper.Tpo -c ishelper.c -fPIC -DPIC -o .libs/libvbisam_la-ishelper.o ishelper.c:147: error: conflicting types for 'isrelrec' ../vbisam.h:221: error: previous declaration of 'isrelrec' was here ishelper.c:195: error: conflicting types for 'issetunique' ../vbisam.h:229: error: previous declaration of 'issetunique' was here ishelper.c:226: error: conflicting types for 'isuniqueid' ../vbisam.h:232: error: previous declaration of 'isuniqueid' was here make[1]: *** [libvbisam_la-ishelper.lo] Error 1 make[1]: Leaving directory `/home/USERNAME/OpenCOBOL4Dreamhost/Installs/vbisam-2.0/libvbisam' make: *** [install-recursive] Error 1 cd .. + cd .. ---- ---------------------------------------------------------------- Thanks to Minemaz for the following solution: Had to run patch on vbiasm. The scripts have been updated to do this automatically and the patch is now distributed with the OC for Dreamhost package. Thanks Minemaz! [code] diff -ur vbisam-2.0/libvbisam/isdelete.c vbisam-2.0.patched/libvbisam/isdelete.c --- vbisam-2.0/libvbisam/isdelete.c 2008-08-25 05:31:14.000000000 -0700 +++ vbisam-2.0.patched/libvbisam/isdelete.c 2010-10-03 08:59:15.000000000 -0700 @@ -186,7 +186,7 @@ } int -isdelrec (const int ihandle, off_t trownumber) +isdelrec (const int ihandle, vbisam_off_t trownumber) { struct DICTINFO *psvbptr; int iresult = 0; diff -ur vbisam-2.0/libvbisam/ishelper.c vbisam-2.0.patched/libvbisam/ishelper.c --- vbisam-2.0/libvbisam/ishelper.c 2008-08-28 07:03:52.000000000 -0700 +++ vbisam-2.0.patched/libvbisam/ishelper.c 2010-10-03 08:58:52.000000000 -0700 @@ -144,7 +144,7 @@ } int -isrelrec (const int ihandle, const off_t trownumber) +isrelrec (const int ihandle, const vbisam_off_t trownumber) { struct DICTINFO *psvbptr; @@ -192,7 +192,7 @@ } int -issetunique (const int ihandle, const off_t tuniqueid) +issetunique (const int ihandle, const vbisam_off_t tuniqueid) { struct DICTINFO *psvbptr; off_t tvalue; @@ -223,7 +223,7 @@ } int -isuniqueid (const int ihandle, off_t *ptuniqueid) +isuniqueid (const int ihandle, vbisam_off_t *ptuniqueid) { struct DICTINFO *psvbptr; off_t tvalue; diff -ur vbisam-2.0/libvbisam/isrewrite.c vbisam-2.0.patched/libvbisam/isrewrite.c --- vbisam-2.0/libvbisam/isrewrite.c 2008-08-25 05:31:14.000000000 -0700 +++ vbisam-2.0.patched/libvbisam/isrewrite.c 2010-10-03 08:59:38.000000000 -0700 @@ -295,7 +295,7 @@ } int -isrewrec (const int ihandle, const off_t trownumber, char *pcrow) +isrewrec (const int ihandle, const vbisam_off_t trownumber, char *pcrow) { struct DICTINFO *psvbptr; int ideleted, inewreclen, ioldreclen = 0, iresult = 0; [/code] ---------------------------------------------------------------- Seems you've used an unpatched vbisam version... The patch you quote is quite old. Some other patches should be available at kiska.net/opencobol/human. Hmm, maybe we should look for someone who is willing to host a community-based version of vbisam (which seems to be quite easy) and someone who starts fixing the open points, especially the recovery and some stuff for variable record length. human ---------------------------------------------------------------- Hi, Following instructions from a post in this forum, in order to install VBISAM, I do this: 1.Download file http://www.sim-basis.de/vbisam-2.0.tar.gz 2./configure 3.sudo make 4.sudo make install And I found the same error that start this thread. Can you tell me where to download last VBISAM versión with patches? Thank you in advance. Fernando. ---------------------------------------------------------------- Human, yup. Regarding a community version and hosting it, that's what the OpenCOBOL Kit is going to be. We are right now putting together all the packages one by one by one. We are meeting in the chat room at http://bit.ly/add1toChat every single day. Jcurrey has donated a server which we will use once I have every single thing tested. I don't want to install things on it until we're set to go with a big shebang. Fernando, you can get the version I am using along with the patch at http://a.add1tocobol.com/OpenCOBOL4Dreamhost.tar.gz More coming soon. Human I also tested vbisam 2.1.1 and it compiled just fine. But then OC didn't want to compile with it. My skype is aoirthoir, please when you get a chance msg me. It's pretty important. Kind Regards, Aoirthoir ---------------------------------------------------------------- Thank you very much. Maybe I can help doing some test or something else, please let me know. Experience with RM/Cobol, AS/400 Cobol, J2EE. Programmer Cobol for 29 years and J2EE architec developer last 10 years. Regards, Fernando. ---------------------------------------------------------------- Please always give the online source when talking about vbisam, because this gets too weird. I guess you've tested the C*T-version, which is likely to not work without C*T at all... I try to get my different versions together, setting the version to 2.1.5 and get them into a zip file. You can test it and put everything into a tar.gz file which can be hosted afterwards. human ---------------------------------------------------------------- Human, the version that I originally tested and worked with the patch from Minemaz was the one from Roger. The 2.1.1 version I got from another person. Basically I am going to stick to the patched one in email. But I will test your version and if it works, just distribute that instead. Fti, Yes we are looking for volunteers. A LOT is happening now. We meet at http://bit.ly/add1toChat every day, most of the day now. If you don't get a reply when you enter please be patient. Lots of people join, say hi, don't get an immediate response and then leave. Then we are able to respond quite often just after they have left. Also sign up at http://add1tocobol.com if you like. ---------------------------------------------------------------- Subject: BDB Errors Trying to get OpenCOBOL to compile with BDB support. I suspect from reading the forums it might be that Dreamhost has the binaries installed for BDB but not the development libraries. I'm not sure how to install them in either case on my system, trying resulted in many errors as well. Again I can provide access :D if someone would prefer to look at it directly rather than third and fifth party. ./oc.sh --with-db checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether to enable maintainer-specific portions of Makefiles... no checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking how to run the C preprocessor... gcc -E checking for egrep... grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking whether ln -s works... yes checking for a BSD-compatible install... /usr/bin/install -c checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking for a sed that does not truncate output... /bin/sed checking for ld used by gcc... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for /usr/bin/ld option to reload object files... -r checking for BSD-compatible nm... /usr/bin/nm -B checking how to recognize dependent libraries... pass_all checking dlfcn.h usability... yes checking dlfcn.h presence... yes checking for dlfcn.h... yes checking the maximum length of command line arguments... 98304 checking command to parse /usr/bin/nm -B output from gcc object... ok checking for objdir... .libs checking for ar... ar checking for ranlib... ranlib checking for strip... strip checking if gcc supports -fno-rtti -fno-exceptions... no checking for gcc option to produce PIC... -fPIC checking if gcc PIC flag -fPIC works... yes checking if gcc static flag -static works... yes checking if gcc supports -c -o file.o... yes checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking for shl_load... no checking for shl_load in -ldld... no checking for dlopen... no checking for dlopen in -ldl... yes checking whether a program can dlopen itself... yes checking whether a statically linked program can dlopen itself... no checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes configure: creating libtool checking whether make sets $(MAKE)... (cached) yes checking for ANSI C header files... (cached) yes checking for stdint.h... (cached) yes checking for sys/types.h... (cached) yes checking signal.h usability... yes checking signal.h presence... yes checking for signal.h... yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking malloc.h usability... yes checking malloc.h presence... yes checking for malloc.h... yes checking locale.h usability... yes checking locale.h presence... yes checking for locale.h... yes checking stddef.h usability... yes checking stddef.h presence... yes checking for stddef.h... yes checking wchar.h usability... yes checking wchar.h presence... yes checking for wchar.h... yes checking for dlfcn.h... (cached) yes checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking for an ANSI C-conforming const... yes checking whether byte ordering is bigendian... no checking for size_t... yes checking whether struct tm is in sys/time.h or time.h... time.h checking for inline... inline checking for working alloca.h... yes checking for alloca... yes checking for vprintf... yes checking for _doprnt... no checking for memmove... yes checking for memset... yes checking for setlocale... yes checking for fcntl... yes checking for strerror... yes checking for strcasecmp... yes checking for strchr... yes checking for strrchr... yes checking for strdup... yes checking for strstr... yes checking for strtol... yes checking for gettimeofday... yes checking for ld used by GCC... /usr/bin/ld -m elf_x86_64 checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes checking for shared library run path origin... done checking for iconv... yes checking for iconv declaration... extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); checking for nl_langinfo and CODESET... yes checking for getopt_long_only... yes checking kpathsea/getopt.h usability... no checking kpathsea/getopt.h presence... no checking for kpathsea/getopt.h... no checking getopt.h usability... yes checking getopt.h presence... yes checking for getopt.h... yes checking gmp.h usability... yes checking gmp.h presence... yes checking for gmp.h... yes checking for __gmp_randinit in -lgmp... yes checking whether NLS is requested... yes checking for msgfmt... /usr/bin/msgfmt checking for gmsgfmt... /usr/bin/msgfmt checking for xgettext... /usr/bin/xgettext checking for msgmerge... /usr/bin/msgmerge checking whether NLS is requested... yes checking for GNU gettext in libc... yes checking whether to use NLS... yes checking where the gettext function comes from... libc checking for initscr in -lncurses... yes checking ncurses.h usability... yes checking ncurses.h presence... yes checking for ncurses.h... yes checking db.h usability... no checking db.h presence... no checking for db.h... no checking db_185.h usability... no checking db_185.h presence... no checking for db_185.h... no checking db3/db_185.h usability... no checking db3/db_185.h presence... no checking for db3/db_185.h... no checking db4/db_185.h usability... no checking db4/db_185.h presence... no checking for db4/db_185.h... no checking db4.1/db_185.h usability... no checking db4.1/db_185.h presence... no checking for db4.1/db_185.h... no checking db4.2/db_185.h usability... no checking db4.2/db_185.h presence... no checking for db4.2/db_185.h... no checking db4.3/db_185.h usability... no checking db4.3/db_185.h presence... no checking for db4.3/db_185.h... no checking db4.4/db_185.h usability... no checking db4.4/db_185.h presence... no checking for db4.4/db_185.h... no checking db4.5/db_185.h usability... no checking db4.5/db_185.h presence... no checking for db4.5/db_185.h... no checking for __db_open in -ldb-4.5... yes checking for dlopen in -lc... yes configure: creating ./config.status config.status: creating cob-config config.status: creating Makefile config.status: creating lib/Makefile config.status: creating libcob/Makefile config.status: creating cobc/Makefile config.status: creating bin/Makefile config.status: creating po/Makefile.in config.status: creating texi/Makefile config.status: creating config/Makefile config.status: creating copy/Makefile config.status: creating tests/atlocal config.status: creating tests/Makefile config.status: creating tests/cobol85/Makefile config.status: creating config.h config.status: executing tests/atconfig commands config.status: executing depfiles commands config.status: executing default-1 commands config.status: creating po/POTFILES config.status: creating po/Makefile OpenCOBOL Configuration: CC gcc COB_CC gcc CFLAGS -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k COB_CFLAGS -I/home/USERNAME/programs/include -I/home/USERNAME/programs/include COB_EXTRA_FLAGS LDFLAGS -L/home/USERNAME/programs/lib COB_LDFLAGS -L/home/USERNAME/programs/lib COB_LIBS -L/home/USERNAME/programs/lib -L${exec_prefix}/lib -lcob -lm -lgmp -lncurses -ldb-4.5 COB_CONFIG_DIR ${prefix}/share/open-cobol/config COB_COPY_DIR ${prefix}/share/open-cobol/copy COB_LIBRARY_PATH ${exec_prefix}/lib/open-cobol COB_MODULE_EXT so COB_SHARED_OPT -shared COB_PIC_FLAGS -fPIC -DPIC COB_EXPORT_DYN -Wl,--export-dynamic COB_STRIP_CMD strip --strip-unneeded Dynamic loading System Use gettext for international messages: yes Use Berkeley DB for file I/O: yes Use enhanced Berkeley DB (>= 4.1) no Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: yes Creating defaults.h... make all-recursive make[1]: Entering directory `/home/USERNAME/OpenCOBOL4Dreamhost/Installs/open-cobol-1.1' Making all in lib make[2]: Entering directory `/home/USERNAME/OpenCOBOL4Dreamhost/Installs/open-cobol-1.1/lib' if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/USERNAME/programs/include -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT dummymac.o -MD -MP -MF ".deps/dummymac.Tpo" -c -o dummymac.o dummymac.c; \ then mv -f ".deps/dummymac.Tpo" ".deps/dummymac.Po"; else rm -f ".deps/dummymac.Tpo"; exit 1; fi rm -f libsupport.a ar cru libsupport.a dummymac.o ranlib libsupport.a make[2]: Leaving directory `/home/USERNAME/OpenCOBOL4Dreamhost/Installs/open-cobol-1.1/lib' Making all in libcob make[2]: Entering directory `/home/USERNAME/OpenCOBOL4Dreamhost/Installs/open-cobol-1.1/libcob' if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/USERNAME/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF ".deps/libcob_la-common.Tpo" -c -o libcob_la-common.lo `test -f 'common.c' || echo './'`common.c; \ then mv -f ".deps/libcob_la-common.Tpo" ".deps/libcob_la-common.Plo"; else rm -f ".deps/libcob_la-common.Tpo"; exit 1; fi mkdir .libs gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/USERNAME/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF .deps/libcob_la-common.Tpo -c common.c -fPIC -DPIC -o .libs/libcob_la-common.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/USERNAME/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF .deps/libcob_la-common.Tpo -c common.c -o libcob_la-common.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/USERNAME/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF ".deps/libcob_la-call.Tpo" -c -o libcob_la-call.lo `test -f 'call.c' || echo './'`call.c; \ then mv -f ".deps/libcob_la-call.Tpo" ".deps/libcob_la-call.Plo"; else rm -f ".deps/libcob_la-call.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/USERNAME/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF .deps/libcob_la-call.Tpo -c call.c -fPIC -DPIC -o .libs/libcob_la-call.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/USERNAME/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF .deps/libcob_la-call.Tpo -c call.c -o libcob_la-call.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/USERNAME/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF ".deps/libcob_la-strings.Tpo" -c -o libcob_la-strings.lo `test -f 'strings.c' || echo './'`strings.c; \ then mv -f ".deps/libcob_la-strings.Tpo" ".deps/libcob_la-strings.Plo"; else rm -f ".deps/libcob_la-strings.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/USERNAME/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF .deps/libcob_la-strings.Tpo -c strings.c -fPIC -DPIC -o .libs/libcob_la-strings.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/USERNAME/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-strings.lo -MD -MP -MF .deps/libcob_la-strings.Tpo -c strings.c -o libcob_la-strings.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/USERNAME/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-move.lo -MD -MP -MF ".deps/libcob_la-move.Tpo" -c -o libcob_la-move.lo `test -f 'move.c' || echo './'`move.c; \ then mv -f ".deps/libcob_la-move.Tpo" ".deps/libcob_la-move.Plo"; else rm -f ".deps/libcob_la-move.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/USERNAME/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-move.lo -MD -MP -MF .deps/libcob_la-move.Tpo -c move.c -fPIC -DPIC -o .libs/libcob_la-move.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/USERNAME/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-move.lo -MD -MP -MF .deps/libcob_la-move.Tpo -c move.c -o libcob_la-move.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/USERNAME/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF ".deps/libcob_la-numeric.Tpo" -c -o libcob_la-numeric.lo `test -f 'numeric.c' || echo './'`numeric.c; \ then mv -f ".deps/libcob_la-numeric.Tpo" ".deps/libcob_la-numeric.Plo"; else rm -f ".deps/libcob_la-numeric.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/USERNAME/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF .deps/libcob_la-numeric.Tpo -c numeric.c -fPIC -DPIC -o .libs/libcob_la-numeric.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/USERNAME/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-numeric.lo -MD -MP -MF .deps/libcob_la-numeric.Tpo -c numeric.c -o libcob_la-numeric.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/USERNAME/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic.lo -MD -MP -MF ".deps/libcob_la-intrinsic.Tpo" -c -o libcob_la-intrinsic.lo `test -f 'intrinsic.c' || echo './'`intrinsic.c; \ then mv -f ".deps/libcob_la-intrinsic.Tpo" ".deps/libcob_la-intrinsic.Plo"; else rm -f ".deps/libcob_la-intrinsic.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/USERNAME/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic.lo -MD -MP -MF .deps/libcob_la-intrinsic.Tpo -c intrinsic.c -fPIC -DPIC -o .libs/libcob_la-intrinsic.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/USERNAME/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-intrinsic.lo -MD -MP -MF .deps/libcob_la-intrinsic.Tpo -c intrinsic.c -o libcob_la-intrinsic.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/USERNAME/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF ".deps/libcob_la-fileio.Tpo" -c -o libcob_la-fileio.lo `test -f 'fileio.c' || echo './'`fileio.c; \ then mv -f ".deps/libcob_la-fileio.Tpo" ".deps/libcob_la-fileio.Plo"; else rm -f ".deps/libcob_la-fileio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/USERNAME/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF .deps/libcob_la-fileio.Tpo -c fileio.c -fPIC -DPIC -o .libs/libcob_la-fileio.o fileio.c:311: error: expected specifier-qualifier-list before 'DB' fileio.c: In function 'cob_sync': fileio.c:639: error: 'struct indexed_file' has no member named 'db' fileio.c:640: error: 'struct indexed_file' has no member named 'db' fileio.c:640: error: 'struct indexed_file' has no member named 'db' fileio.c:645: error: 'struct indexed_file' has no member named 'db' fileio.c:649: error: 'struct indexed_file' has no member named 'db' fileio.c:649: error: 'struct indexed_file' has no member named 'db' fileio.c: In function 'indexed_open': fileio.c:1899: error: 'BTREEINFO' undeclared (first use in this function) fileio.c:1899: error: (Each undeclared identifier is reported only once fileio.c:1899: error: for each function it appears in.) fileio.c:1899: error: expected ';' before 'info' fileio.c:1954: error: 'struct indexed_file' has no member named 'db' fileio.c:1954: error: 'DB' undeclared (first use in this function) fileio.c:1954: error: expected expression before ')' token fileio.c:1959: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:1960: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:1961: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:2000: error: 'info' undeclared (first use in this function) fileio.c:2002: error: 'R_DUP' undeclared (first use in this function) fileio.c:2013: error: 'struct indexed_file' has no member named 'db' fileio.c:2013: warning: implicit declaration of function 'dbopen' fileio.c:2013: error: 'DB_BTREE' undeclared (first use in this function) fileio.c:2014: error: 'struct indexed_file' has no member named 'db' fileio.c:2020: error: 'struct indexed_file' has no member named 'db' fileio.c:2020: error: 'struct indexed_file' has no member named 'db' fileio.c:2027: error: 'struct indexed_file' has no member named 'db' fileio.c:2028: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2029: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2041: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2042: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2050: error: 'struct indexed_file' has no member named 'key' fileio.c:2050: error: 'DBT' undeclared (first use in this function) fileio.c:2051: error: 'struct indexed_file' has no member named 'data' fileio.c:2067: error: 'struct indexed_file' has no member named 'db' fileio.c:2067: error: 'struct indexed_file' has no member named 'db' fileio.c:2067: error: 'struct indexed_file' has no member named 'key' fileio.c:2067: error: 'struct indexed_file' has no member named 'data' fileio.c:2067: error: 'R_FIRST' undeclared (first use in this function) fileio.c:2070: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2070: error: 'struct indexed_file' has no member named 'key' fileio.c:2070: error: 'struct indexed_file' has no member named 'key' fileio.c:2072: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_close': fileio.c:2115: error: 'struct indexed_file' has no member named 'db' fileio.c:2116: error: 'struct indexed_file' has no member named 'db' fileio.c:2116: error: 'struct indexed_file' has no member named 'db' fileio.c:2118: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2119: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2126: error: 'struct indexed_file' has no member named 'db' fileio.c:2127: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2128: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2129: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c: In function 'indexed_start_internal': fileio.c:2169: error: 'struct indexed_file' has no member named 'key' fileio.c:2169: error: 'struct indexed_file' has no member named 'key' fileio.c:2178: error: 'struct indexed_file' has no member named 'db' fileio.c:2178: error: 'struct indexed_file' has no member named 'db' fileio.c:2178: error: 'struct indexed_file' has no member named 'key' fileio.c:2178: error: 'struct indexed_file' has no member named 'data' fileio.c:2178: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:2183: error: 'struct indexed_file' has no member named 'key' fileio.c:2191: error: 'struct indexed_file' has no member named 'db' fileio.c:2191: error: 'struct indexed_file' has no member named 'db' fileio.c:2191: error: 'struct indexed_file' has no member named 'key' fileio.c:2191: error: 'struct indexed_file' has no member named 'data' fileio.c:2191: error: 'R_LAST' undeclared (first use in this function) fileio.c:2197: error: 'struct indexed_file' has no member named 'db' fileio.c:2197: error: 'struct indexed_file' has no member named 'db' fileio.c:2197: error: 'struct indexed_file' has no member named 'key' fileio.c:2197: error: 'struct indexed_file' has no member named 'data' fileio.c:2197: error: 'R_PREV' undeclared (first use in this function) fileio.c:2206: error: 'struct indexed_file' has no member named 'db' fileio.c:2206: error: 'struct indexed_file' has no member named 'db' fileio.c:2206: error: 'struct indexed_file' has no member named 'key' fileio.c:2206: error: 'struct indexed_file' has no member named 'data' fileio.c:2208: error: 'struct indexed_file' has no member named 'key' fileio.c:2212: error: 'struct indexed_file' has no member named 'db' fileio.c:2212: error: 'struct indexed_file' has no member named 'db' fileio.c:2212: error: 'struct indexed_file' has no member named 'key' fileio.c:2212: error: 'struct indexed_file' has no member named 'data' fileio.c:2218: error: 'struct indexed_file' has no member named 'key' fileio.c:2219: error: 'struct indexed_file' has no member named 'db' fileio.c:2219: error: 'struct indexed_file' has no member named 'db' fileio.c:2219: error: 'struct indexed_file' has no member named 'key' fileio.c:2219: error: 'struct indexed_file' has no member named 'data' fileio.c:2219: error: 'R_NEXT' undeclared (first use in this function) fileio.c:2226: error: 'struct indexed_file' has no member named 'db' fileio.c:2226: error: 'struct indexed_file' has no member named 'db' fileio.c:2226: error: 'struct indexed_file' has no member named 'key' fileio.c:2226: error: 'struct indexed_file' has no member named 'data' fileio.c:2232: error: 'struct indexed_file' has no member named 'db' fileio.c:2232: error: 'struct indexed_file' has no member named 'db' fileio.c:2232: error: 'struct indexed_file' has no member named 'key' fileio.c:2232: error: 'struct indexed_file' has no member named 'data' fileio.c:2238: error: 'struct indexed_file' has no member named 'key' fileio.c:2242: error: 'struct indexed_file' has no member named 'db' fileio.c:2242: error: 'struct indexed_file' has no member named 'db' fileio.c:2242: error: 'struct indexed_file' has no member named 'key' fileio.c:2242: error: 'struct indexed_file' has no member named 'data' fileio.c:2253: error: 'struct indexed_file' has no member named 'key' fileio.c:2255: error: 'struct indexed_file' has no member named 'data' fileio.c:2257: error: 'struct indexed_file' has no member named 'key' fileio.c:2257: error: 'struct indexed_file' has no member named 'data' fileio.c:2258: error: 'struct indexed_file' has no member named 'key' fileio.c:2259: error: 'struct indexed_file' has no member named 'db' fileio.c:2259: error: 'struct indexed_file' has no member named 'db' fileio.c:2259: error: 'struct indexed_file' has no member named 'key' fileio.c:2259: error: 'struct indexed_file' has no member named 'data' fileio.c:2293: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2293: error: 'struct indexed_file' has no member named 'key' fileio.c:2295: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2297: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2297: error: 'struct indexed_file' has no member named 'key' fileio.c:2299: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c: In function 'indexed_read': fileio.c:2534: error: 'struct indexed_file' has no member named 'data' fileio.c:2535: error: 'struct indexed_file' has no member named 'data' fileio.c:2535: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_read_next': fileio.c:2794: error: 'R_NEXT' undeclared (first use in this function) fileio.c:2806: error: 'R_LAST' undeclared (first use in this function) fileio.c:2808: error: 'R_PREV' undeclared (first use in this function) fileio.c:2811: error: 'R_FIRST' undeclared (first use in this function) fileio.c:2823: error: 'struct indexed_file' has no member named 'data' fileio.c:2836: error: 'struct indexed_file' has no member named 'key' fileio.c:2837: error: 'struct indexed_file' has no member named 'key' fileio.c:2837: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2841: error: 'struct indexed_file' has no member named 'db' fileio.c:2841: error: 'struct indexed_file' has no member named 'db' fileio.c:2841: error: 'struct indexed_file' has no member named 'key' fileio.c:2841: error: 'struct indexed_file' has no member named 'data' fileio.c:2845: error: 'struct indexed_file' has no member named 'data' fileio.c:2847: error: 'struct indexed_file' has no member named 'key' fileio.c:2847: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2847: error: 'struct indexed_file' has no member named 'key' fileio.c:2848: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2852: error: 'struct indexed_file' has no member named 'db' fileio.c:2852: error: 'struct indexed_file' has no member named 'db' fileio.c:2852: error: 'struct indexed_file' has no member named 'key' fileio.c:2852: error: 'struct indexed_file' has no member named 'data' fileio.c:2854: error: 'struct indexed_file' has no member named 'data' fileio.c:2857: error: 'struct indexed_file' has no member named 'key' fileio.c:2857: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2857: error: 'struct indexed_file' has no member named 'key' fileio.c:2858: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2859: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2859: error: 'struct indexed_file' has no member named 'data' fileio.c:2864: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2864: error: 'struct indexed_file' has no member named 'data' fileio.c:2867: error: 'struct indexed_file' has no member named 'key' fileio.c:2868: error: 'struct indexed_file' has no member named 'key' fileio.c:2868: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2869: error: 'struct indexed_file' has no member named 'db' fileio.c:2869: error: 'struct indexed_file' has no member named 'db' fileio.c:2869: error: 'struct indexed_file' has no member named 'key' fileio.c:2869: error: 'struct indexed_file' has no member named 'data' fileio.c:2906: error: 'struct indexed_file' has no member named 'key' fileio.c:2907: error: 'struct indexed_file' has no member named 'key' fileio.c:2907: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2911: error: 'struct indexed_file' has no member named 'db' fileio.c:2911: error: 'struct indexed_file' has no member named 'db' fileio.c:2911: error: 'struct indexed_file' has no member named 'key' fileio.c:2911: error: 'struct indexed_file' has no member named 'data' fileio.c:2911: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:2930: error: 'struct indexed_file' has no member named 'key' fileio.c:2930: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2930: error: 'struct indexed_file' has no member named 'key' fileio.c:2932: error: 'struct indexed_file' has no member named 'data' fileio.c:2934: error: 'struct indexed_file' has no member named 'key' fileio.c:2934: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2934: error: 'struct indexed_file' has no member named 'key' fileio.c:2935: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2939: error: 'struct indexed_file' has no member named 'db' fileio.c:2939: error: 'struct indexed_file' has no member named 'db' fileio.c:2939: error: 'struct indexed_file' has no member named 'key' fileio.c:2939: error: 'struct indexed_file' has no member named 'data' fileio.c:2941: error: 'struct indexed_file' has no member named 'data' fileio.c:2959: error: 'struct indexed_file' has no member named 'key' fileio.c:2959: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2959: error: 'struct indexed_file' has no member named 'key' fileio.c:2960: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2986: error: 'struct indexed_file' has no member named 'db' fileio.c:2986: error: 'struct indexed_file' has no member named 'db' fileio.c:2986: error: 'struct indexed_file' has no member named 'key' fileio.c:2986: error: 'struct indexed_file' has no member named 'data' fileio.c:3003: error: 'struct indexed_file' has no member named 'key' fileio.c:3003: error: 'struct indexed_file' has no member named 'key' fileio.c:3005: error: 'struct indexed_file' has no member named 'data' fileio.c:3007: error: 'struct indexed_file' has no member named 'key' fileio.c:3007: error: 'struct indexed_file' has no member named 'data' fileio.c:3008: error: 'struct indexed_file' has no member named 'key' fileio.c:3009: error: 'struct indexed_file' has no member named 'db' fileio.c:3009: error: 'struct indexed_file' has no member named 'db' fileio.c:3009: error: 'struct indexed_file' has no member named 'key' fileio.c:3009: error: 'struct indexed_file' has no member named 'data' fileio.c:3048: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:3048: error: 'struct indexed_file' has no member named 'key' fileio.c:3048: error: 'struct indexed_file' has no member named 'key' fileio.c:3050: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:3052: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:3052: error: 'struct indexed_file' has no member named 'key' fileio.c:3054: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:3068: error: 'struct indexed_file' has no member named 'data' fileio.c:3069: error: 'struct indexed_file' has no member named 'data' fileio.c:3069: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'get_dupno': fileio.c:3084: error: 'struct indexed_file' has no member named 'key' fileio.c:3084: error: 'struct indexed_file' has no member named 'key' fileio.c:3085: error: 'struct indexed_file' has no member named 'key' fileio.c:3085: error: 'struct indexed_file' has no member named 'key' fileio.c:3090: error: 'struct indexed_file' has no member named 'db' fileio.c:3090: error: 'struct indexed_file' has no member named 'db' fileio.c:3090: error: 'struct indexed_file' has no member named 'key' fileio.c:3090: error: 'struct indexed_file' has no member named 'data' fileio.c:3090: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:3092: error: 'struct indexed_file' has no member named 'key' fileio.c:3092: error: 'struct indexed_file' has no member named 'key' fileio.c:3093: error: 'struct indexed_file' has no member named 'data' fileio.c:3097: error: 'struct indexed_file' has no member named 'db' fileio.c:3097: error: 'struct indexed_file' has no member named 'db' fileio.c:3097: error: 'struct indexed_file' has no member named 'key' fileio.c:3097: error: 'struct indexed_file' has no member named 'data' fileio.c:3097: error: 'R_NEXT' undeclared (first use in this function) fileio.c: In function 'check_alt_keys': fileio.c:3116: error: 'struct indexed_file' has no member named 'key' fileio.c:3116: error: 'struct indexed_file' has no member named 'key' fileio.c:3117: error: 'struct indexed_file' has no member named 'db' fileio.c:3117: error: 'struct indexed_file' has no member named 'db' fileio.c:3117: error: 'struct indexed_file' has no member named 'key' fileio.c:3117: error: 'struct indexed_file' has no member named 'data' fileio.c:3120: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_write_internal': fileio.c:3168: error: 'struct indexed_file' has no member named 'key' fileio.c:3168: error: 'struct indexed_file' has no member named 'key' fileio.c:3185: error: 'struct indexed_file' has no member named 'data' fileio.c:3186: error: 'struct indexed_file' has no member named 'data' fileio.c:3187: error: 'struct indexed_file' has no member named 'db' fileio.c:3187: error: 'struct indexed_file' has no member named 'db' fileio.c:3187: error: 'struct indexed_file' has no member named 'key' fileio.c:3187: error: 'struct indexed_file' has no member named 'data' fileio.c:3187: error: 'R_NOOVERWRITE' undeclared (first use in this function) fileio.c:3193: error: 'struct indexed_file' has no member named 'data' fileio.c:3193: error: 'struct indexed_file' has no member named 'key' fileio.c:3195: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:3205: error: 'struct indexed_file' has no member named 'data' fileio.c:3206: error: 'struct indexed_file' has no member named 'data' fileio.c:3215: error: 'struct indexed_file' has no member named 'key' fileio.c:3215: error: 'struct indexed_file' has no member named 'key' fileio.c:3216: error: 'struct indexed_file' has no member named 'db' fileio.c:3216: error: 'struct indexed_file' has no member named 'db' fileio.c:3216: error: 'struct indexed_file' has no member named 'key' fileio.c:3216: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_write': fileio.c:3292: error: 'struct indexed_file' has no member named 'key' fileio.c:3292: error: 'struct indexed_file' has no member named 'key' fileio.c:3294: error: 'struct indexed_file' has no member named 'key' fileio.c:3296: error: 'struct indexed_file' has no member named 'key' fileio.c:3296: error: 'struct indexed_file' has no member named 'key' fileio.c:3299: error: 'struct indexed_file' has no member named 'key' fileio.c:3299: error: 'struct indexed_file' has no member named 'key' fileio.c: In function 'indexed_delete_internal': fileio.c:3312: error: 'DBT' undeclared (first use in this function) fileio.c:3312: error: expected ';' before 'prim_key' fileio.c:3359: error: 'struct indexed_file' has no member named 'key' fileio.c:3359: error: 'struct indexed_file' has no member named 'key' fileio.c:3360: error: 'struct indexed_file' has no member named 'db' fileio.c:3360: error: 'struct indexed_file' has no member named 'db' fileio.c:3360: error: 'struct indexed_file' has no member named 'key' fileio.c:3360: error: 'struct indexed_file' has no member named 'data' fileio.c:3365: error: 'prim_key' undeclared (first use in this function) fileio.c:3365: error: 'struct indexed_file' has no member named 'key' fileio.c:3368: error: 'struct indexed_file' has no member named 'data' fileio.c:3370: error: 'struct indexed_file' has no member named 'key' fileio.c:3370: error: 'struct indexed_file' has no member named 'key' fileio.c:3371: error: 'struct indexed_file' has no member named 'key' fileio.c:3371: error: 'struct indexed_file' has no member named 'key' fileio.c:3374: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:3374: error: 'struct indexed_file' has no member named 'key' fileio.c:3374: error: 'struct indexed_file' has no member named 'key' fileio.c:3375: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:3380: error: 'struct indexed_file' has no member named 'db' fileio.c:3380: error: 'struct indexed_file' has no member named 'db' fileio.c:3380: error: 'struct indexed_file' has no member named 'key' fileio.c:3382: error: expected ';' before 'sec_key' fileio.c:3388: error: 'struct indexed_file' has no member named 'db' fileio.c:3388: error: 'struct indexed_file' has no member named 'db' fileio.c:3388: error: 'struct indexed_file' has no member named 'key' fileio.c:3388: error: 'struct indexed_file' has no member named 'data' fileio.c:3388: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:3390: error: 'sec_key' undeclared (first use in this function) fileio.c:3390: error: 'struct indexed_file' has no member named 'key' fileio.c:3391: error: 'struct indexed_file' has no member named 'key' fileio.c:3393: error: 'struct indexed_file' has no member named 'data' fileio.c:3398: error: 'struct indexed_file' has no member named 'db' fileio.c:3398: error: 'struct indexed_file' has no member named 'db' fileio.c:3398: error: 'struct indexed_file' has no member named 'key' fileio.c:3404: error: 'struct indexed_file' has no member named 'db' fileio.c:3404: error: 'struct indexed_file' has no member named 'db' fileio.c:3404: error: 'struct indexed_file' has no member named 'key' fileio.c:3404: error: 'struct indexed_file' has no member named 'data' fileio.c:3404: error: 'R_NEXT' undeclared (first use in this function) fileio.c:3421: error: 'struct indexed_file' has no member named 'db' fileio.c:3421: error: 'struct indexed_file' has no member named 'db' fileio.c: In function 'indexed_rewrite': fileio.c:3584: error: 'struct indexed_file' has no member named 'key' fileio.c:3584: error: 'struct indexed_file' has no member named 'key' make[2]: *** [libcob_la-fileio.lo] Error 1 make[2]: Leaving directory `/home/USERNAME/OpenCOBOL4Dreamhost/Installs/open-cobol-1.1/libcob' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/USERNAME/OpenCOBOL4Dreamhost/Installs/open-cobol-1.1' make: *** [all] Error 2 make install-recursive make[1]: Entering directory `/home/USERNAME/OpenCOBOL4Dreamhost/Installs/open-cobol-1.1' Making install in lib make[2]: Entering directory `/home/USERNAME/OpenCOBOL4Dreamhost/Installs/open-cobol-1.1/lib' make[3]: Entering directory `/home/USERNAME/OpenCOBOL4Dreamhost/Installs/open-cobol-1.1/lib' make[3]: Nothing to be done for `install-exec-am'. make[3]: Nothing to be done for `install-data-am'. make[3]: Leaving directory `/home/USERNAME/OpenCOBOL4Dreamhost/Installs/open-cobol-1.1/lib' make[2]: Leaving directory `/home/USERNAME/OpenCOBOL4Dreamhost/Installs/open-cobol-1.1/lib' Making install in libcob make[2]: Entering directory `/home/USERNAME/OpenCOBOL4Dreamhost/Installs/open-cobol-1.1/libcob' if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/USERNAME/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF ".deps/libcob_la-fileio.Tpo" -c -o libcob_la-fileio.lo `test -f 'fileio.c' || echo './'`fileio.c; \ then mv -f ".deps/libcob_la-fileio.Tpo" ".deps/libcob_la-fileio.Plo"; else rm -f ".deps/libcob_la-fileio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/home/USERNAME/programs/include -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF .deps/libcob_la-fileio.Tpo -c fileio.c -fPIC -DPIC -o .libs/libcob_la-fileio.o fileio.c:311: error: expected specifier-qualifier-list before 'DB' fileio.c: In function 'cob_sync': fileio.c:639: error: 'struct indexed_file' has no member named 'db' fileio.c:640: error: 'struct indexed_file' has no member named 'db' fileio.c:640: error: 'struct indexed_file' has no member named 'db' fileio.c:645: error: 'struct indexed_file' has no member named 'db' fileio.c:649: error: 'struct indexed_file' has no member named 'db' fileio.c:649: error: 'struct indexed_file' has no member named 'db' fileio.c: In function 'indexed_open': fileio.c:1899: error: 'BTREEINFO' undeclared (first use in this function) fileio.c:1899: error: (Each undeclared identifier is reported only once fileio.c:1899: error: for each function it appears in.) fileio.c:1899: error: expected ';' before 'info' fileio.c:1954: error: 'struct indexed_file' has no member named 'db' fileio.c:1954: error: 'DB' undeclared (first use in this function) fileio.c:1954: error: expected expression before ')' token fileio.c:1959: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:1960: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:1961: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:2000: error: 'info' undeclared (first use in this function) fileio.c:2002: error: 'R_DUP' undeclared (first use in this function) fileio.c:2013: error: 'struct indexed_file' has no member named 'db' fileio.c:2013: warning: implicit declaration of function 'dbopen' fileio.c:2013: error: 'DB_BTREE' undeclared (first use in this function) fileio.c:2014: error: 'struct indexed_file' has no member named 'db' fileio.c:2020: error: 'struct indexed_file' has no member named 'db' fileio.c:2020: error: 'struct indexed_file' has no member named 'db' fileio.c:2027: error: 'struct indexed_file' has no member named 'db' fileio.c:2028: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2029: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2041: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2042: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2050: error: 'struct indexed_file' has no member named 'key' fileio.c:2050: error: 'DBT' undeclared (first use in this function) fileio.c:2051: error: 'struct indexed_file' has no member named 'data' fileio.c:2067: error: 'struct indexed_file' has no member named 'db' fileio.c:2067: error: 'struct indexed_file' has no member named 'db' fileio.c:2067: error: 'struct indexed_file' has no member named 'key' fileio.c:2067: error: 'struct indexed_file' has no member named 'data' fileio.c:2067: error: 'R_FIRST' undeclared (first use in this function) fileio.c:2070: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2070: error: 'struct indexed_file' has no member named 'key' fileio.c:2070: error: 'struct indexed_file' has no member named 'key' fileio.c:2072: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_close': fileio.c:2115: error: 'struct indexed_file' has no member named 'db' fileio.c:2116: error: 'struct indexed_file' has no member named 'db' fileio.c:2116: error: 'struct indexed_file' has no member named 'db' fileio.c:2118: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2119: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2126: error: 'struct indexed_file' has no member named 'db' fileio.c:2127: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2128: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2129: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c: In function 'indexed_start_internal': fileio.c:2169: error: 'struct indexed_file' has no member named 'key' fileio.c:2169: error: 'struct indexed_file' has no member named 'key' fileio.c:2178: error: 'struct indexed_file' has no member named 'db' fileio.c:2178: error: 'struct indexed_file' has no member named 'db' fileio.c:2178: error: 'struct indexed_file' has no member named 'key' fileio.c:2178: error: 'struct indexed_file' has no member named 'data' fileio.c:2178: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:2183: error: 'struct indexed_file' has no member named 'key' fileio.c:2191: error: 'struct indexed_file' has no member named 'db' fileio.c:2191: error: 'struct indexed_file' has no member named 'db' fileio.c:2191: error: 'struct indexed_file' has no member named 'key' fileio.c:2191: error: 'struct indexed_file' has no member named 'data' fileio.c:2191: error: 'R_LAST' undeclared (first use in this function) fileio.c:2197: error: 'struct indexed_file' has no member named 'db' fileio.c:2197: error: 'struct indexed_file' has no member named 'db' fileio.c:2197: error: 'struct indexed_file' has no member named 'key' fileio.c:2197: error: 'struct indexed_file' has no member named 'data' fileio.c:2197: error: 'R_PREV' undeclared (first use in this function) fileio.c:2206: error: 'struct indexed_file' has no member named 'db' fileio.c:2206: error: 'struct indexed_file' has no member named 'db' fileio.c:2206: error: 'struct indexed_file' has no member named 'key' fileio.c:2206: error: 'struct indexed_file' has no member named 'data' fileio.c:2208: error: 'struct indexed_file' has no member named 'key' fileio.c:2212: error: 'struct indexed_file' has no member named 'db' fileio.c:2212: error: 'struct indexed_file' has no member named 'db' fileio.c:2212: error: 'struct indexed_file' has no member named 'key' fileio.c:2212: error: 'struct indexed_file' has no member named 'data' fileio.c:2218: error: 'struct indexed_file' has no member named 'key' fileio.c:2219: error: 'struct indexed_file' has no member named 'db' fileio.c:2219: error: 'struct indexed_file' has no member named 'db' fileio.c:2219: error: 'struct indexed_file' has no member named 'key' fileio.c:2219: error: 'struct indexed_file' has no member named 'data' fileio.c:2219: error: 'R_NEXT' undeclared (first use in this function) fileio.c:2226: error: 'struct indexed_file' has no member named 'db' fileio.c:2226: error: 'struct indexed_file' has no member named 'db' fileio.c:2226: error: 'struct indexed_file' has no member named 'key' fileio.c:2226: error: 'struct indexed_file' has no member named 'data' fileio.c:2232: error: 'struct indexed_file' has no member named 'db' fileio.c:2232: error: 'struct indexed_file' has no member named 'db' fileio.c:2232: error: 'struct indexed_file' has no member named 'key' fileio.c:2232: error: 'struct indexed_file' has no member named 'data' fileio.c:2238: error: 'struct indexed_file' has no member named 'key' fileio.c:2242: error: 'struct indexed_file' has no member named 'db' fileio.c:2242: error: 'struct indexed_file' has no member named 'db' fileio.c:2242: error: 'struct indexed_file' has no member named 'key' fileio.c:2242: error: 'struct indexed_file' has no member named 'data' fileio.c:2253: error: 'struct indexed_file' has no member named 'key' fileio.c:2255: error: 'struct indexed_file' has no member named 'data' fileio.c:2257: error: 'struct indexed_file' has no member named 'key' fileio.c:2257: error: 'struct indexed_file' has no member named 'data' fileio.c:2258: error: 'struct indexed_file' has no member named 'key' fileio.c:2259: error: 'struct indexed_file' has no member named 'db' fileio.c:2259: error: 'struct indexed_file' has no member named 'db' fileio.c:2259: error: 'struct indexed_file' has no member named 'key' fileio.c:2259: error: 'struct indexed_file' has no member named 'data' fileio.c:2293: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2293: error: 'struct indexed_file' has no member named 'key' fileio.c:2295: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2297: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2297: error: 'struct indexed_file' has no member named 'key' fileio.c:2299: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c: In function 'indexed_read': fileio.c:2534: error: 'struct indexed_file' has no member named 'data' fileio.c:2535: error: 'struct indexed_file' has no member named 'data' fileio.c:2535: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_read_next': fileio.c:2794: error: 'R_NEXT' undeclared (first use in this function) fileio.c:2806: error: 'R_LAST' undeclared (first use in this function) fileio.c:2808: error: 'R_PREV' undeclared (first use in this function) fileio.c:2811: error: 'R_FIRST' undeclared (first use in this function) fileio.c:2823: error: 'struct indexed_file' has no member named 'data' fileio.c:2836: error: 'struct indexed_file' has no member named 'key' fileio.c:2837: error: 'struct indexed_file' has no member named 'key' fileio.c:2837: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2841: error: 'struct indexed_file' has no member named 'db' fileio.c:2841: error: 'struct indexed_file' has no member named 'db' fileio.c:2841: error: 'struct indexed_file' has no member named 'key' fileio.c:2841: error: 'struct indexed_file' has no member named 'data' fileio.c:2845: error: 'struct indexed_file' has no member named 'data' fileio.c:2847: error: 'struct indexed_file' has no member named 'key' fileio.c:2847: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2847: error: 'struct indexed_file' has no member named 'key' fileio.c:2848: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2852: error: 'struct indexed_file' has no member named 'db' fileio.c:2852: error: 'struct indexed_file' has no member named 'db' fileio.c:2852: error: 'struct indexed_file' has no member named 'key' fileio.c:2852: error: 'struct indexed_file' has no member named 'data' fileio.c:2854: error: 'struct indexed_file' has no member named 'data' fileio.c:2857: error: 'struct indexed_file' has no member named 'key' fileio.c:2857: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2857: error: 'struct indexed_file' has no member named 'key' fileio.c:2858: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2859: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2859: error: 'struct indexed_file' has no member named 'data' fileio.c:2864: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2864: error: 'struct indexed_file' has no member named 'data' fileio.c:2867: error: 'struct indexed_file' has no member named 'key' fileio.c:2868: error: 'struct indexed_file' has no member named 'key' fileio.c:2868: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2869: error: 'struct indexed_file' has no member named 'db' fileio.c:2869: error: 'struct indexed_file' has no member named 'db' fileio.c:2869: error: 'struct indexed_file' has no member named 'key' fileio.c:2869: error: 'struct indexed_file' has no member named 'data' fileio.c:2906: error: 'struct indexed_file' has no member named 'key' fileio.c:2907: error: 'struct indexed_file' has no member named 'key' fileio.c:2907: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2911: error: 'struct indexed_file' has no member named 'db' fileio.c:2911: error: 'struct indexed_file' has no member named 'db' fileio.c:2911: error: 'struct indexed_file' has no member named 'key' fileio.c:2911: error: 'struct indexed_file' has no member named 'data' fileio.c:2911: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:2930: error: 'struct indexed_file' has no member named 'key' fileio.c:2930: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2930: error: 'struct indexed_file' has no member named 'key' fileio.c:2932: error: 'struct indexed_file' has no member named 'data' fileio.c:2934: error: 'struct indexed_file' has no member named 'key' fileio.c:2934: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2934: error: 'struct indexed_file' has no member named 'key' fileio.c:2935: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2939: error: 'struct indexed_file' has no member named 'db' fileio.c:2939: error: 'struct indexed_file' has no member named 'db' fileio.c:2939: error: 'struct indexed_file' has no member named 'key' fileio.c:2939: error: 'struct indexed_file' has no member named 'data' fileio.c:2941: error: 'struct indexed_file' has no member named 'data' fileio.c:2959: error: 'struct indexed_file' has no member named 'key' fileio.c:2959: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2959: error: 'struct indexed_file' has no member named 'key' fileio.c:2960: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2986: error: 'struct indexed_file' has no member named 'db' fileio.c:2986: error: 'struct indexed_file' has no member named 'db' fileio.c:2986: error: 'struct indexed_file' has no member named 'key' fileio.c:2986: error: 'struct indexed_file' has no member named 'data' fileio.c:3003: error: 'struct indexed_file' has no member named 'key' fileio.c:3003: error: 'struct indexed_file' has no member named 'key' fileio.c:3005: error: 'struct indexed_file' has no member named 'data' fileio.c:3007: error: 'struct indexed_file' has no member named 'key' fileio.c:3007: error: 'struct indexed_file' has no member named 'data' fileio.c:3008: error: 'struct indexed_file' has no member named 'key' fileio.c:3009: error: 'struct indexed_file' has no member named 'db' fileio.c:3009: error: 'struct indexed_file' has no member named 'db' fileio.c:3009: error: 'struct indexed_file' has no member named 'key' fileio.c:3009: error: 'struct indexed_file' has no member named 'data' fileio.c:3048: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:3048: error: 'struct indexed_file' has no member named 'key' fileio.c:3048: error: 'struct indexed_file' has no member named 'key' fileio.c:3050: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:3052: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:3052: error: 'struct indexed_file' has no member named 'key' fileio.c:3054: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:3068: error: 'struct indexed_file' has no member named 'data' fileio.c:3069: error: 'struct indexed_file' has no member named 'data' fileio.c:3069: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'get_dupno': fileio.c:3084: error: 'struct indexed_file' has no member named 'key' fileio.c:3084: error: 'struct indexed_file' has no member named 'key' fileio.c:3085: error: 'struct indexed_file' has no member named 'key' fileio.c:3085: error: 'struct indexed_file' has no member named 'key' fileio.c:3090: error: 'struct indexed_file' has no member named 'db' fileio.c:3090: error: 'struct indexed_file' has no member named 'db' fileio.c:3090: error: 'struct indexed_file' has no member named 'key' fileio.c:3090: error: 'struct indexed_file' has no member named 'data' fileio.c:3090: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:3092: error: 'struct indexed_file' has no member named 'key' fileio.c:3092: error: 'struct indexed_file' has no member named 'key' fileio.c:3093: error: 'struct indexed_file' has no member named 'data' fileio.c:3097: error: 'struct indexed_file' has no member named 'db' fileio.c:3097: error: 'struct indexed_file' has no member named 'db' fileio.c:3097: error: 'struct indexed_file' has no member named 'key' fileio.c:3097: error: 'struct indexed_file' has no member named 'data' fileio.c:3097: error: 'R_NEXT' undeclared (first use in this function) fileio.c: In function 'check_alt_keys': fileio.c:3116: error: 'struct indexed_file' has no member named 'key' fileio.c:3116: error: 'struct indexed_file' has no member named 'key' fileio.c:3117: error: 'struct indexed_file' has no member named 'db' fileio.c:3117: error: 'struct indexed_file' has no member named 'db' fileio.c:3117: error: 'struct indexed_file' has no member named 'key' fileio.c:3117: error: 'struct indexed_file' has no member named 'data' fileio.c:3120: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_write_internal': fileio.c:3168: error: 'struct indexed_file' has no member named 'key' fileio.c:3168: error: 'struct indexed_file' has no member named 'key' fileio.c:3185: error: 'struct indexed_file' has no member named 'data' fileio.c:3186: error: 'struct indexed_file' has no member named 'data' fileio.c:3187: error: 'struct indexed_file' has no member named 'db' fileio.c:3187: error: 'struct indexed_file' has no member named 'db' fileio.c:3187: error: 'struct indexed_file' has no member named 'key' fileio.c:3187: error: 'struct indexed_file' has no member named 'data' fileio.c:3187: error: 'R_NOOVERWRITE' undeclared (first use in this function) fileio.c:3193: error: 'struct indexed_file' has no member named 'data' fileio.c:3193: error: 'struct indexed_file' has no member named 'key' fileio.c:3195: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:3205: error: 'struct indexed_file' has no member named 'data' fileio.c:3206: error: 'struct indexed_file' has no member named 'data' fileio.c:3215: error: 'struct indexed_file' has no member named 'key' fileio.c:3215: error: 'struct indexed_file' has no member named 'key' fileio.c:3216: error: 'struct indexed_file' has no member named 'db' fileio.c:3216: error: 'struct indexed_file' has no member named 'db' fileio.c:3216: error: 'struct indexed_file' has no member named 'key' fileio.c:3216: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_write': fileio.c:3292: error: 'struct indexed_file' has no member named 'key' fileio.c:3292: error: 'struct indexed_file' has no member named 'key' fileio.c:3294: error: 'struct indexed_file' has no member named 'key' fileio.c:3296: error: 'struct indexed_file' has no member named 'key' fileio.c:3296: error: 'struct indexed_file' has no member named 'key' fileio.c:3299: error: 'struct indexed_file' has no member named 'key' fileio.c:3299: error: 'struct indexed_file' has no member named 'key' fileio.c: In function 'indexed_delete_internal': fileio.c:3312: error: 'DBT' undeclared (first use in this function) fileio.c:3312: error: expected ';' before 'prim_key' fileio.c:3359: error: 'struct indexed_file' has no member named 'key' fileio.c:3359: error: 'struct indexed_file' has no member named 'key' fileio.c:3360: error: 'struct indexed_file' has no member named 'db' fileio.c:3360: error: 'struct indexed_file' has no member named 'db' fileio.c:3360: error: 'struct indexed_file' has no member named 'key' fileio.c:3360: error: 'struct indexed_file' has no member named 'data' fileio.c:3365: error: 'prim_key' undeclared (first use in this function) fileio.c:3365: error: 'struct indexed_file' has no member named 'key' fileio.c:3368: error: 'struct indexed_file' has no member named 'data' fileio.c:3370: error: 'struct indexed_file' has no member named 'key' fileio.c:3370: error: 'struct indexed_file' has no member named 'key' fileio.c:3371: error: 'struct indexed_file' has no member named 'key' fileio.c:3371: error: 'struct indexed_file' has no member named 'key' fileio.c:3374: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:3374: error: 'struct indexed_file' has no member named 'key' fileio.c:3374: error: 'struct indexed_file' has no member named 'key' fileio.c:3375: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:3380: error: 'struct indexed_file' has no member named 'db' fileio.c:3380: error: 'struct indexed_file' has no member named 'db' fileio.c:3380: error: 'struct indexed_file' has no member named 'key' fileio.c:3382: error: expected ';' before 'sec_key' fileio.c:3388: error: 'struct indexed_file' has no member named 'db' fileio.c:3388: error: 'struct indexed_file' has no member named 'db' fileio.c:3388: error: 'struct indexed_file' has no member named 'key' fileio.c:3388: error: 'struct indexed_file' has no member named 'data' fileio.c:3388: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:3390: error: 'sec_key' undeclared (first use in this function) fileio.c:3390: error: 'struct indexed_file' has no member named 'key' fileio.c:3391: error: 'struct indexed_file' has no member named 'key' fileio.c:3393: error: 'struct indexed_file' has no member named 'data' fileio.c:3398: error: 'struct indexed_file' has no member named 'db' fileio.c:3398: error: 'struct indexed_file' has no member named 'db' fileio.c:3398: error: 'struct indexed_file' has no member named 'key' fileio.c:3404: error: 'struct indexed_file' has no member named 'db' fileio.c:3404: error: 'struct indexed_file' has no member named 'db' fileio.c:3404: error: 'struct indexed_file' has no member named 'key' fileio.c:3404: error: 'struct indexed_file' has no member named 'data' fileio.c:3404: error: 'R_NEXT' undeclared (first use in this function) fileio.c:3421: error: 'struct indexed_file' has no member named 'db' fileio.c:3421: error: 'struct indexed_file' has no member named 'db' fileio.c: In function 'indexed_rewrite': fileio.c:3584: error: 'struct indexed_file' has no member named 'key' fileio.c:3584: error: 'struct indexed_file' has no member named 'key' make[2]: *** [libcob_la-fileio.lo] Error 1 make[2]: Leaving directory `/home/USERNAME/OpenCOBOL4Dreamhost/Installs/open-cobol-1.1/libcob' make[1]: *** [install-recursive] Error 1 make[1]: Leaving directory `/home/USERNAME/OpenCOBOL4Dreamhost/Installs/open-cobol-1.1' make: *** [install] Error 2 ---------------------------------------------------------------- This is an old mistake of the configure script (newer versions would give you an error before starting make). As you can see in [quote]checking db.h usability... no checking db.h presence... no checking for db.h... no checking db_185.h usability... no checking db_185.h presence... no checking for db_185.h... no checking db3/db_185.h usability... no checking db3/db_185.h presence... no checking for db3/db_185.h... no checking db4/db_185.h usability... no checking db4/db_185.h presence... no checking for db4/db_185.h... no checking db4.1/db_185.h usability... no checking db4.1/db_185.h presence... no checking for db4.1/db_185.h... no checking db4.2/db_185.h usability... no checking db4.2/db_185.h presence... no checking for db4.2/db_185.h... no checking db4.3/db_185.h usability... no checking db4.3/db_185.h presence... no checking for db4.3/db_185.h... no checking db4.4/db_185.h usability... no checking db4.4/db_185.h presence... no checking for db4.4/db_185.h... no checking db4.5/db_185.h usability... no checking db4.5/db_185.h presence... no checking for db4.5/db_185.h... no checking for __db_open in -ldb-4.5... yes[/quote] there is the possibility to link against the library (last entry) but no header file can be found (all entries before). Seems like you have to look for it on your machine and tell configure where it is stored. human ---------------------------------------------------------------- Ok. Hopefully we can get word about the newer versions. We're ready to go very soon with a lot of things. Knowing where the compiler stands would help greatly so our libraries are future-proof. ---------------------------------------------------------------- Sounds like you did not understand what I meant: 1. Find possible db.h files on your machine 2. tell the configure where to look and do configure again 3. do 2 until it founds a valid db.h 4. do make again human ---------------------------------------------------------------- " tell configure where it is stored." How do I do that? I'll want to automate the process. Though my preferred method would be to just include bdb in the tar I am distributing. I had downloaded and compiled it, but OC didn't use it perhaps, or perhaps I did something else wrong, because the OC gave me compile errors then too. However vbisam is working. So I wonder if this is an exercise in anything other than semantics. If vbisam is better than bdbd for our purposes, maybe the time could be better put elsewhere. What do you think? ---------------------------------------------------------------- Hey Joe, Make sure to run ldconfig (as root) after getting Berkeley DB installed. ---------------------------------------------------------------- [quote] erstazi wrote: Hey Joe, Make sure to run ldconfig (as root) after getting Berkeley DB installed.[/quote] Erstazi, We can't. This is on Dreamhost we're having the issues. I don't think I've had any issues getting OpenCOBOL to install on my system proper. But I'm trying to get libraries together for Dreamhost and other hosts, which the user does not have root on. ---------------------------------------------------------------- From configure --help (or the FAQ), [quote] LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory [/quote] As the BDB lib seems to be found I would try to do something like [code]export CPPFLAGS=$CPPFLAGS -I/local/include ./configure[/code] I guess dreamhost has a fine bdb version installed, you only have to know where (maybe ask their support?) and set the env vars correct before configure. If they don't have, you can use your own version. I really want to push VBISAM further (we need someone who will look at it, as written before), the OC part seems fine (with 2.0, there are some errors with early 1.1 [not sure about the feb09 version]). human ---------------------------------------------------------------- Alright I will do that, just adding it to the mods I am already doing to those environment vars with an : in between each. I will start another thread if needed, but the looking at vbisam that you mean is what? To bring it up to some standard? Are there things that need to be fixed? ---------------------------------------------------------------- Subject: UNIX: Reading from stdin Is there anyway to read some command line options into a COBOL program? For example, I wanted something like: ./command -h and I am trying to get my program to read stdin from the command prompt, but when I run my program, it gives me the following error: libcob: File does not exist (STATUS = 35) File : 'STDIN' My program is: [code] IDENTIFICATION DIVISION. PROGRAM-ID. CL. ENVIRONMENT DIVISION. CONFIGURATION SECTION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT CL-OPTIONS ASSIGN TO "STDIN" ORGANIZATION IS LINE SEQUENTIAL. DATA DIVISION. FILE SECTION. FD CL-OPTIONS. 01 CL-OPTIONS-REC PIC X(10). PROCEDURE DIVISION. 0000-CONTROL. OPEN INPUT CL-OPTIONS. READ CL-OPTIONS. DISPLAY CL-OPTIONS-REC. CLOSE CL-OPTIONS. STOP RUN. [/code] Any ideas? ---------------------------------------------------------------- ACCEPT identifier FROM COMMAND-LINE. [code] IDENTIFICATION DIVISION. PROGRAM-ID. CL. ENVIRONMENT DIVISION. CONFIGURATION SECTION. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. WORKING-STORAGE SECTION. 01 CL-OPTIONS-REC PIC X(10). PROCEDURE DIVISION. 0000-CONTROL. ACCEPT CL-OPTIONS-REC FROM COMMAND-LINE. DISPLAY CL-OPTIONS-REC. STOP RUN. [/code] ---------------------------------------------------------------- Thanks, that worked. :-D ---------------------------------------------------------------- See http://opencobol.add1tocobol.com/#can-opencobol-be-used-to-write-command-line-stdin-stdout-filters for ways to get at stdin. It comes down to ASSIGN TO KEYBOARD and ASSIGN TO DISPLAY for the FD's. Cheers, Brian ---------------------------------------------------------------- Subject: auto skip option hi, i am new to open cobol. in my program auto-skip in accept statement is not working. every time enter is required. is there any changes required in configuration file or ncurses. ---------------------------------------------------------------- Please post your source code here by doing: [code] [code] Your code goes here… [\code] [/code] Use / instead of \ (just was using backslash instead of forward slash to demonstrate) Thank you for your time, erstazi ---------------------------------------------------------------- 1005-DISPLAY-PARA. PERFORM BLANK-SCRN . DISPLAY "Give file name ( 8 Characters):" AT 0505. ACCEPT W-FILE-NM AT 0538. DISPLAY "give 1 for new-file; 2 for continue" at 0605. ACCEPT WS-DUM AT 0650 WITH AUTO-SKIP BELL. in this code in last accept statement any option included after with like AUTO-SKIP BEEP BELL not working. also in accepting file name i have to give full 8 characers for file name. entering less than 8 char and pressing enter not working. ---------------------------------------------------------------- Despite of telling you: please use code tags, I can tell you we need at least the definitions for the vars you use in the snipped (I guess erstazi asked for a sample program that one can just compile and test). For being able to help you, we need some configuration details, at least the output from cobc -version and where you got this version from. human ---------------------------------------------------------------- IDENTIFICATION DIVISION. PROGRAM-ID. PRESH. * AUTHOR. ajay kulkarni. * *------------------------------------------------------------ ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. OBJECT-COMPUTER. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT IN-FILE ASSIGN TO W-FILE-INP ORGANIZATION IS SEQUENTIAL ACCESS SEQUENTIAL FILE STATUS IS INP-ST. SELECT OUT-FILE ASSIGN TO W-FILE-OUT ORGANIZATION IS LINE SEQUENTIAL. *------------------------------------------------------------- DATA DIVISION. FILE SECTION. FD IN-FILE. 01 IN-REC. 05 FILLER PIC X(240). *------------------------------------------------------------ FD OUT-FILE. 01 OUT-REC. 05 FILLER PIC X(240). *------------------------------------------------------------ WORKING-STORAGE SECTION. 01 W-FILE-INP PIC X(12). 01 W-FILE-OUT PIC X(12). 77 INP-ST PIC XX. 77 W-EOF PIC X(01) VALUE "N". 77 W-REC-CNT PIC 9(06) VALUE 0. *----------------------------------------------------------------- PROCEDURE DIVISION. MAIN SECTION. 000-MAIN. PERFORM 100-OPEN-PARA. PERFORM 200-READ-PROCESS UNTIL W-EOF = "Y". PERFORM 300-TERMINATION. STOP RUN. *----------------------------------------------------------------- 100-OPEN-PARA. DISPLAY SPACES AT LINE 1 COL 1. DISPLAY " ENTER DATA FILE NAME :" AT LINE 07 COL 10. DISPLAY " ENTER OUTPUT FILE NAME :" AT LINE 09 COL 10. DISPLAY "ENTER SPACES TO EXIT " AT LINE 20 COL 10. ACCEPT W-FILE-INP WITH AUTO-SKIP AT LINE 07 COL 37 . IF W-FILE-INP = SPACES STOP RUN. OPEN INPUT IN-FILE. IF INP-ST NOT = "00" DISPLAY "ERROR: " AT LINE 22 COL 10 DISPLAY W-FILE-INP AT LINE 22 COL 17 DISPLAY " DOES NOT EXISTS" AT LINE 22 COL 29 STOP RUN. ACCEPT W-FILE-OUT WITH AUTO-SKIP AT LINE 09 COL 37. IF W-FILE-OUT = SPACES STOP RUN. OPEN OUTPUT OUT-FILE. *----------------------------------------------------------------- 200-READ-PROCESS. READ IN-FILE AT END MOVE "Y" TO W-EOF. IF W-EOF NOT = "Y" ADD 1 TO W-REC-CNT PERFORM 210-PRINT. *---------------------------------------------------------------- 210-PRINT. MOVE IN-REC TO OUT-REC WRITE OUT-REC. *----------------------------------------------------------------- 300-TERMINATION. CLOSE IN-FILE OUT-FILE. DISPLAY "NUMBER OF RECORDS READ :" AT LINE 12 COL 12. DISPLAY W-REC-CNT AT LINE 12 COL 37. ******************************************************************* i an using opencobol v1.0 on redhat linux to compile above program. i download opencobol v1.0 form opencobol.org site  ---------------------------------------------------------------- Again: please use code tags for posting code (it would be good to edit your two previous code postings...). Your bug report seems like a bug of 1.0 IF there is no compile error. The 1.1-pre-release from feb09 and upcoming 2.0 produce [quote]tests/PRESH.cbl: In paragraph '100-OPEN-PARA': tests/PRESH.cbl:49: Error: syntax error, unexpected AT tests/PRESH.cbl:58: Error: syntax error, unexpected AT[/quote] simply because the WITH clause must be AFTER the AT clause. If you put it in the correct order everything works. Hint: If you want to give the user the possibility to read what you've DISPLAYed, you should ACCEPT dummy-var END-ACCEPT before STOP RUN. human ---------------------------------------------------------------- Subject: OC in your native language - translators needed Hi folks! We're starting to translate upcoming versions into different languages. The necessary code changes for OC 2.0 were already done. Now we need translators. Before posting every stuff here I want to gather the translators here. Who is able and willing to translate the strings (currently 724) into what language(s) [or has somebody who does this]? From the last discussions I remember people wanting to do this for French, Italian, Spanish, German but I don't remember who exactly said that he/she will help. We already have a Japanese translation, but that needs an heavy update. [b]Edit:[/b] For a new translation create a new catalogue from the pot file. I encourage everybody to use a GUI for that. Some explanations how to do that with my favourite language file editor [url=http://www.poedit.net/]Poedit[/url] and some general instructions: - File->New catalogue from POT-file (choose latest open-cobol.pot) - Insert project name: "open-cobol 2.0" and the rest as needed - Save file with chosen language abbreviation like it is placed in http://www.iana.org/assignments/language-subtag-registry - Start translation Some hints for Poedit first-time-users: - Choose the string you want to translate in the upper pane. - Translate the text in the lower pane. - Always keep special characters like %s, %d, \n, ... The % are place holders (values will be inserted there by OpenCOBOL). \n is a line break, \t a tab, ... - Use [ALT]+[C] often. It copies the original string to the translation field where you can change what's needed. This function can be found in edit menu, too. - If you're not sure if one of the translations is correct mark it as fuzzy with [ALT]+[U] or via edit menu. Current assignments of translations: fr: eraso (finished [updates will be needed later]) [earlier: Bear (maybe aouizerate, too)] hi: Yanni de: erstazi es: jcurrey (finished [updates will be needed later]) ja: minemaz (later) it: ?federico? OK, here is the [url=http://www.filedropper.com/open-cobol]pot-file from 11-09-06[/url]. human ---------------------------------------------------------------- Hello Human, Definitely, I am willing to help with translation of German and Spanish, if need be. Also, if you get the time, please join on irc.mibbit.net in #add1.to to discuss further. Thanks, erstazi ---------------------------------------------------------------- We have programmers that speak Spanish (the Mexican variant) that I can assign to doing the translation if their dialect is acceptable As for me, I am still trying to master English (the American variant) and thus have little to offer :-) . (dot for human) ---------------------------------------------------------------- Hello. I am willing to try to help in translating English to French. Even if I do not master English excellently I have American friends around me who can give me valuable assistance. At your disposal. Cordial greetings. Rene Aouizerate ---------------------------------------------------------------- My wife and I could do Hindi or German. ---------------------------------------------------------------- @aouizerate: If you can, join the channel #add1.to on the irc.mibbit.net network. Also, if you do not have an IRC client, check my signature for a web-based solution to chat with us. Just do not leave without waiting as some of us are working and not always able to respond promptly. Thank you! ---------------------------------------------------------------- Bonjour OpenCobol Team This are really good news from OC team. I can help in translating into french. Regards ---------------------------------------------------------------- Update (in first post): link to the pot-file and some translation instructions. I wrote down the translation assignments there. federico has a ? because he did not show up here, but I think he'll translate to Italy. jcurrey's programmers can check the Spanish translation and transform it to es_MX when erstazi has finished it. aouizerate can check the French translation when Bear has finished it. Please upload the files somewhere (if you don't now where just take mediafire.com) and post the link here when you've done with some translation. If you are not sure about some translations mark them as fuzzy for later checks. Thank you for helping to translate OpenCOBOL! human ---------------------------------------------------------------- @Human, Erstazi got busy so he and I agreed that my people would do the initial translation into Spanish. We are located on the border with Mexico so our translations may tend to be more Mexican in flavor than Spanish. We have finished our work. We did use Poedit as you suggested. @Erstazi, let me know how to get the file to you. jimc ---------------------------------------------------------------- [quote] our translations may tend to be more Mexican in flavor than Spanish. [/quote] I think the only difference between spanish/mx-la transaltions against spanish/spain is the use of "fichero" and "archivo". Other strings should use "usted" so even if spanish people trend to use "vosotros" former is more adecuate. If you need assitance let me know. Regards. ---------------------------------------------------------------- Hi Human ! I wanted to say that I can do Russian and Ukrainian and Belorussian and maybe Polish translations, but I've realised I will not do that. It is just not necessary. a) Almost nobody is using COBOL there b) If some people even using it, they perfectly read English That just remind me of the COBOL usage in ex-USSR - it was not in use at all, but maybe in some companies in Latvia and/or Lithuania (I'm speaking of late 70-s). The COBOL was TRANSLATED into Russian - I mean ALL COBOL KEYWORDS ! And that what translation means. If you still need to write "PERFORM" in English, it is not a translation, and noone needs messages to be translated. Just the waste of time IMHO. ---------------------------------------------------------------- It is also my opinion. With all due respect to other languages, I think a translation into 6 languages is quite sufficient. English, French, German, Italian, Portuguese, and Spanish. I also think it would be nice to consolidate all the results of translation in a single location. Human, as you said: a single person for a language. This person will be responsible for seeking the means of his choice to obtain as quickly as possible the best result. Regards. ---------------------------------------------------------------- To read/write COBOL one doesn't need to be able to understand the English language well. For understanding the messages and help (for command line parameters) it needs quite more understanding. This is where the translations come in. You just doesn't need that much time to get to know your compiler if the help and the messages are in a language you understand quite well. This is the reason why I would like to see translations in languages "where COBOL is not used that much", too, as I'm seeing OpenCOBOL not only as "move old source to a new base" but as a possible development tool for new projects, too. Why not teach first-time-programmers COBOL instead of BASIC? If there is somebody to translate into Russian and other languages it would be nice. I'm quite sure there are people speaking Russian better than the 6 languages aouizerate mentioned. @ska & aouizerate: Did you get my point (even if you don't think it's very important)? human ---------------------------------------------------------------- It is also true. Everything depends on the goal. If it comes to the promotion of COBOL, it is actually good to have the range of languages as large as possible. But I think that this is not the only goal. I feel that the initiators of this project were first called for an "Open" COBOL is to say a "big" COBOL , therefore freely available to the greatest number has most of it. It is the quality and richness of Open COBOL that his promotion will initially. However, if there are many translations will be even better cel. To finish with humor: Who will do the translation into Chinese? Regards ---------------------------------------------------------------- Update: - pot file updated to 11/09/06 - es.po was finished (will need an update later on) - fr is now assigned to eraso - ja will be done later by minemaz I hope the others that signed in will post a translated file too (if you are not finished but currently have no time - please post the current version [maybe other translators will finish it]). Who knows, maybe we get new volunteers (a lot of languages are still unassigned)? human ---------------------------------------------------------------- Interesting link, although the numbers represent speaking, not reading/writing. [url=http://www2.ignatius.edu/faculty/turner/languages.htm]Most widely spoken languages[/url] ---------------------------------------------------------------- Subject: How imminent is OpenCOBOL 2.0 and.. Human, How close is OpenCOBOL 2.0 to being released? Should we hold off on creating any C libraries or changes to our existing C libraries (like the mysql wrapper that erstazi created)? Is it substantially different to 1.1? Will our existing C libraries compile in it? Rather than using CBL_OC_ for our prefixes, should we use something else to prevent conflicts? What features will it have? Report Writer? User Defined Functions? OOP? Thanks. ---------------------------------------------------------------- Definitely would like to answer some of this. [quote]Should we hold off on creating any C libraries or changes to our existing C libraries (like the mysql wrapper that erstazi created)?[/quote]I am holding off on upgrading to the changes made in 1.1 2009-Jun (and on) but I am adding features that are needed on my end (such as better handling of Prepared Statements) [quote]Is it substantially different to 1.1?[/quote]Most definitely. Without going into detail, the 2009-Jun version was drastically different in libcob calls to the 2009-Feb version. We can only expect 2.0 being a major revision release to be have some major changes. [quote]Will our existing C libraries compile in it?[/quote]Joe, with this one, most definitely not. That is why the library programmer has to change calls on new releases of any software for their library. [quote]Rather than using CBL_OC_ for our prefixes, should we use something else to prevent conflicts?[/quote]This is something Roger wanted. Personally, I am comfortable with CBL_OC_ being used for prefixes in libraries. Sets a standard that we can follow. ---------------------------------------------------------------- [quote] erstazi wrote: [quote]Rather than using CBL_OC_ for our prefixes, should we use something else to prevent conflicts?[/quote] This is something Roger wanted. Personally, I am comfortable with CBL_OC_ being used for prefixes in libraries. Sets a standard that we can follow.[/quote] I am too as long as we know that it's never going to conflict with something that is in the compiler, or another library someone has. Does using the prefix enable it to fold back into the OpenCOBOL compiler itself. Would it need to? Anyway the more we know before release, the more we can make sure we are on parity. In particular it would be really nice to be able to test pre-release, and then have our libraries set to come out exactly at the same time. ---------------------------------------------------------------- I'd like to get a copy early enough to have an updated Programmer's Guide ready for it too! Maybe it could include documentation on some of the things you've been working on as well. ---------------------------------------------------------------- Only Roger can answer most of your questions. I'm sure there will be some pre-releases before the final version because it's good to have many people testing the BIG changes we will see in 2.0. OOP will definitely not be in. Roger told me he wrote some first support for Report Writer and user FUNCTIONs, but it's currently not all in the current dev sources. Therefore these points may be in one of the 2.0 pre-releases. One thing it will have (if enough translators are found, see the according thread) is a multi-language interface. I'd stay to CBL_OC_ if Roger wanted that and personally thing that there have to be some changes to existing C libraries (I'd like to see some #if in the C libraries for them being usable in 1.0, 1.1 (Feb) and 2.0) but I personally think they won't be THAT big. Therefore: Creating/Changing libraries should be not a lot of wasted time (especially if they work in older versions of OC, too). human ---------------------------------------------------------------- Human, Thanks. If you are talking to him lately please let him know we're ready to help in a variety of ways. Already two folks have offered to do translations. If we know the format for translations needed, maybe others not in the OpenCOBOL or Add 1 to COBOL projects could help. But the more we know timelines, the more we can prepare ourselves. ---------------------------------------------------------------- I also like to get a OC copy (and new guide) early enough to integrate in virtual machine COBOL DOS. I think it was a good idea to upload an alpha, beta, pre-release or what ever for developers. :-D ---------------------------------------------------------------- I also like to get a OC copy (and new guide) early enough to integrate in virtual machine COBOL DOS. I think it was a good idea to upload an alpha, beta, pre-release or what ever for developers. :-D ---------------------------------------------------------------- Subject: Open COBOL Guides Gary has done an excellent job on the Programmer's guide. I finished reading it in its entirety and it helped tremendously. As a programmers guide it of course lacked a lot of examples, as such do not really belong in a guide of that nature. So along those lines I think we need to revisit the idea of other guides. My team and I here are going to be starting on a Getting Started with OpenCOBOL which will cover installing, compiling your sample programs. The guide will be specific mostly to the OCKit, because that will have all things needed already. So this weeks meeting will be covering just what we need for that. Please stop into the chatroom at http://bit.ly/add1toChat at 3pm Saturday Eastern Time USA (please verify the time as compared to your timezone) if you would like to volunteer to help with this project. Kind Regards, Aoirthoir ---------------------------------------------------------------- I just "finished" coding up a COBOL version of the Robert Hayden's "geek code" version 2.1 . . . I can post the code if anyone is interested, although its my first COBOL program in nine years so it might look a little obtuse. :-D ---------------------------------------------------------------- Yanni, we wont mind it looking obtuse:D. Within a week or so I should have Gantry fully figured out, and then we'll have an even newer, new site over at Add 1 to COBOL. So I'll give you a spot there to post your code. Kind Regards, Aoirthoir ---------------------------------------------------------------- Ok, no prob! :-) ---------------------------------------------------------------- Subject: adisctrl how to change screen input control keys (ADISCF in mf cobol) in opencobol ---------------------------------------------------------------- If I'm right this is not possible in OC directly. Depending on the system you use, you can use TERM-settings before running cobcrun. human ---------------------------------------------------------------- ADISCTRL is a program that runs as an interface between the cobol program and the screen. All cobol screen output is filtered by adisctrl and blended with data from the adiscfg file before being sent to the screen. Screen input is controlled in the same manner. If you are ambitious, you could create a hex dump of a screen using MFcobol, and create the same screen with OC, and then compare. This issue, by the way, is the reason that I have not implemented OC in production. Users with 20+ years of keyboard expectations will just become frustrated. Jack ---------------------------------------------------------------- What kind of keyboard expectations? ---------------------------------------------------------------- Number Name -------------------------------------------------------------------------------- 1 User function keys enable/disable 2 Range of data keys accepted 3 Prompt character 4 Prompt character used in PIC N and PIC G fields 5 Pre-display of fields before an accept 6 Accept in a SECURE field 7 Auto-skip between fields 8 Termination of an accept 9 Validation control if accept is terminated by a function key 10 End of field effects 11 Field overflow buffers enable/disable 12 Auto-restore during backspace in replacement editing mode 13 Accepts into numeric edited fields 14 Accepts into non-edited numeric fields 15 Enable/Disable auto-clear or pre-clear 16 Force field to be updated if it is not altered 17 Remembering where the end of the field is 18 RM style numeric data entry 19 Restricting maximum field size to one line 20 Control of cursor positioning after an accept 21 Control of whether UPDATE clauses perform implicit CONVERTs 22 Selection of the function key list to be used 23 Selection of the action for COLUMN + n clauses 24 Selection of the default action if no color specified 25 Control of whether cursor left/right keys can exit a field 26 Left justification of free-format edited numerics 27 Validation control on FULL/REQUIRED fields 28 Control of ADIS keys defined as function keys 29 Control of the read screen option for an accept 30 Control of whether protected fields are skipped 31 Control of special action for Kanji modifier characters 32 Selection of the units used when calculating timeout 33 Control of whether timeout is reset on each keystroke This is the questionaire that is used to configure the adisctrl program, and how it adjusts screen input and output. If I can find a pdf or html manual that describes each question and its consequences, I will forward it to you. [url=http://supportline.microfocus.com/documentation/books/ocds42/oc42indx.htm]Microfocus Adiscf documentation for version 4.2[/url] click search, and enter 'adis' Jack ---------------------------------------------------------------- Jack thanks! ---------------------------------------------------------------- i am using opencobol 1.0 on redhat linux system. and unable to configure screen input. ---------------------------------------------------------------- Screen input is currently only configurable by changing term settings. I think this won't change in upcoming 2.0. human ---------------------------------------------------------------- [QUOTE]i am using opencobol 1.0 on redhat linux system. and unable to configure screen input. [/QUOTE] You have to upgrade to 1.1 in order to use the screen section. ---------------------------------------------------------------- Subject: Windows MinGW problem I installed the Windows/MinGW version which I downloaded from the Wiki. This allows me to compile and run programs on several PC's with WinXP, Vista and Win7. However, on some WinXP PCs the programs compile, but when the compiled program is called from the command line a Windows message appears that the program had to be terminated and I should report that to Microsoft. This also happens when I compile and run the shortest possible program: "program-id. a." I observed that the problem appears on old, slow PCs while newer PCs work OK. Does anyone have a clue what to look for to fix this? Georg ---------------------------------------------------------------- Hello. I also use this distribution as well under Win.XP and Win 7 32 and 64 bits. I've never had this kind of message which, I think, is not with the compiler but probably from the OS or your PC. Could you provide some more detail on cases that bug. Also have you changed your environment variable or you go through a .bat file ? Looking forward to hearing from you. Regards. Rene Aouizerate ---------------------------------------------------------------- Do you have the same problems when doing cobc --version or cobc --help? If yes I suggest to do some checks with http://www.dependencywalker.com/. Download it, put it in OpenCOBOL-1.1-06FEB2009-mingw\bin and drag cobc.exe on it. You may can see some problems directly. Or not. Depends... human ---------------------------------------------------------------- The cobc compiler seems to work OK, the problem arises when I enter disp1.exe on the command line. On one PC I changed the environment variables and on the others I used my batch file. This makes no difference. Georg __________________________________________ Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\opencobol>cobc --version cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Sep 10 2010 10:12:33 Packaged Feb 06 2009 10:30:55 CET C:\opencobol>cd samples C:\opencobol\samples>cobc -xv disp1.cob preprocessing disp1.cob into C:\DOKUME~1\GEORGP~1\LOKALE~1\Temp\cobE7.cob translating C:\DOKUME~1\GEORGP~1\LOKALE~1\Temp\cobE7.cob into C:\DOKUME~1\GEORGP ~1\LOKALE~1\Temp\cobE8.c gcc -pipe -c -I/mingw/include -Wno-unused -fsigned-char -o C:\DOKUME~1\GEORGP ~1\LOKALE~1\Temp\cobE9.o C:\DOKUME~1\GEORGP~1\LOKALE~1\Temp\cobE8.c gcc -pipe -Wl,--export-all-symbols -Wl,--enable-auto-import -o disp1 C:\DOKUME~ 1\GEORGP~1\LOKALE~1\Temp\cobE9.o -L/mingw/lib -lcob -lm -lgmp -lpdcurses -ldb ________________________________________________ SET COB_CONFIG_DIR=c:\opencobol\config SET COB_COPY_DIR=c:\opencobol\copy SET COB_LIBRARY_DIR=c:\opencobol\bin SET COB_SCREEN_ESC=Y SET COB_SCREEN_EXCEPTIONS=Y path=%path%;c:\opencobol\bin ---------------------------------------------------------------- can you provide the source code of your program disp1.cob ---------------------------------------------------------------- The problem occurs with any program, colors.exe too. It also occurs with the one line program: [code] program-id. a. [/code] which does absolutely nothing. I can also compile disp1.cob on a PC where it will not run and then move the exe file to a different PC and it will run there fine without change. Here is the code for disp1: [code] Identification Division. Program-ID. disp1. Environment Division. Data Division. Working-Storage Section. 01 TermFld Pic X. 88 TermNow Value "T". Screen Section. 01 ScrName Background-color 3 Foreground-color 7 HIghlight. 05 Column 10 Line 3 Value "Enter 'T' to terminate this test". 05 Column Plus 2 Background-color 7 Foreground-color 4 Pic X Using TermFld. Procedure Division. Mainline. Perform until TermNow Display ScrName Accept ScrName End-Perform GoBack. End Program disp1. [/code] ---------------------------------------------------------------- Do you have the same problems running cobcrun -version? Please do the depends-check on cobcrun. Maybe some problems can be seen. If not do this depends-test on a WinXP machine where everything works. Then have a look at the differences (if all files and messages are the same look at the different versions of the libraries used). This will be easier if both PCs have the same SP and all Windows updates installed. human ---------------------------------------------------------------- I retrieved a drwtsn32.log entry from the program termination. It shows that the cause of the problem is an illegal instruction in the gmpn_mul_1 function. Maybe this is an instruction which is only available on later PCs. Maybe an earlier version of gmp can be used. [code] Anwendungsausnahme aufgetreten: Anwendung: (pid=1544) Wann: 09.10.2010 @ 14:41:47.968 Ausnahmenummer: c000001d (Ungültige Anweisung) *----> Systeminformationen <----* Computername: WIN2000GP Benutzername: Administrator Prozessoranzahl: 1 Prozessortyp: x86 Family 6 Model 8 Stepping 1 Windows 2000-Version: 5.0 Aktuelles Build: 2195 Service Pack: 4 *----> Taskliste <----* 0 Idle.exe 8 System.exe 144 smss.exe ........... 1544 colors.exe ........... 1588 drwtsn32.exe 0 _Total.exe Statusabbild für Threadkennung 0x55c eax=003f5274 ebx=0022fe40 ecx=00000001 edx=003f5274 esi=0005f5e1 edi=00000001 eip=6acd6fa2 esp=0022fe1c ebp=0022fe98 iopl=0 nv up ei ng nz ac pe cy cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00000293 Funktion: _gmpn_mul_1 6acd6f80 8b542404 mov edx,[esp+0x4] ss:00cb9d03=???????? 6acd6f84 8b442408 mov eax,[esp+0x8] ss:00cb9d03=???????? 6acd6f88 8b4c240c mov ecx,[esp+0xc] ss:00cb9d03=???????? 6acd6f8c 0f6e ??? 6acd6f8e 7c24 jl _gmpn_divrem+0x324 (6acd7fb4) 6acd6f90 100f adc [edi],cl ds:00000001=?? 6acd6f92 ef out dx,eax 6acd6f93 f683f90473200f test byte ptr [ebx+0x207304f9],0xf ds:20960339=?? 6acd6f9a 6e outsb 6acd6f9b 008d40048d52 add [ebp+0x528d0440],cl ss:52b002d8=?? 6acd6fa1 040f add al,0xf 6acd6fa3 f4 hlt 6acd6fa4 c70fd4f00f7e mov dword ptr [edi],0x7e0ff0d4 ds:00000001=???????? 6acd6faa 72fc jb _gmpn_divrem+0x318 (6acd7fa8) 6acd6fac 0f73 ??? 6acd6fae d6 ??? 6acd6faf 204975 and [ecx+0x75],cl ds:00a89ee7=?? 6acd6fb2 e60f out 0f,al 6acd6fb4 7ef0 jle _gmpn_divrem+0x316 (6acd7fa6) 6acd6fb6 0f77 ??? 6acd6fb8 c3 ret 6acd6fb9 83e103 and ecx,0x3 *----> Stack Back Trace <----* FramePtr ReturnAd Param#1 Param#2 Param#3 Param#4 Function Name 0022FE98 6ACD3EDD 664195CC 0022FEC4 00000001 00000001 !_gmpn_mul_1 0022FED8 662C19ED 00000002 00008000 78033DA0 78001199 !_gmpz_ui_pow_ui 0022FF28 0040130C 00000001 003F25F0 00401860 004012F5 !cob_init 0022FF58 004010B6 00000001 003F25F0 003F2D08 0040B004 !main 0022FFA0 00401148 00000001 00000000 00000000 77E81AF3 ! 0022FFC0 77E81AF6 00000000 0013C6E8 7FFDF000 C000001D ! 0022FFF0 00000000 00401130 00000000 000000C8 00000100 kernel32!OpenEventA [/code] ---------------------------------------------------------------- I can report that I fixed the problem. I downloaded the current Mingw version and replaced the "libgmp-10.dll" file in the opencobol/bin directory with the latest version from the Mingw download. After that the programs worked on the old PC. Georg ---------------------------------------------------------------- Subject: Back again Modred, Go ahead and go with the 1.1 as that's the latest. 2.0 is not even set for prerelease yet. When it is they'll let us know. Kind Regard, Aoirthoir ---------------------------------------------------------------- I am considering upgrading a suite of COBOL programs that I wrote for the PC a few years back. Its an inventory management system. I see the past "release" was 1.1 and that was some time ago. Can I gain access to the latest iteration? ---------------------------------------------------------------- Subject: Cobol for CGI? I used cobol years back and I wonder if there is a web server plugin to use cobol (like php)? ---------------------------------------------------------------- [smiles] We've been working on just that. There's quite a few posts for using OpenCOBOL for the web. We're also in the process of creating the OpenCOBOL Kit (OCKit) which will have all sorts of libraries built in and ready to go. I posted a few links but I am in the process of moving things around, and trying to get our Add 1 to COBOL CMS running as a Wordpress+Gantry combination. Once I have that done and out of the way the links will go live again. In the meantime feel free to join us daily in chat at http://bit.ly/add1toChat Kind Regards, Aoirthoir ---------------------------------------------------------------- Subject: I'd like to use it! Howzit! New old guy on the block requiring some guidance. Will an old COBOL 1 program compile and run correctly in LINUX using OpenCOBOL? A company was supposed to convert a module from COBOL to Natural. They did a sterling job of messing it up. The project is now at risk due to the new module not working. Therefore my descision to run 1 COBOL module in the new retrofitted LINUX system. Any guidance on pitfalls and potential problems will be more than welcome. :hammer: ---------------------------------------------------------------- When you say [quote] old COBOL 1 program [/quote] Let me guess. You are an IBM mainframer and by this term you mean "OS/VS COBOL"? If so,, then the answer is MAYBE. All of the ANSI '68 and ANSI '74 stuff should work. (Well, actually MOST of it). Did you compile the OS/VS COBOL stuff with LANGLVL (1) or (2)? If you compiled with LANGLVL(1), then some COPY/REPLACING probably won't work and some combined abbreviated conditionals would also be a problem. (These are the same things that would have caused you problems going to VS COBOL II or any LE COBOL compiler). In addition, there are other things like ISAM ("old" IBM file system, not to be confused with "ISAM" meaning COBOL indexed access method). If you still have OS/VS COBOL *and* it is V2.4, then you could compile with the MIGR compiler option and see POSSIBLE problems. There are SOME of the things that MIGR will flag that OC will support. (e.g. EXHIBIT and TRANSFORM are supported but EXAMINE is not) I think your best bet would just be to TRY to compile the program and see what happens. NOTE" If by "COBOL 1" you do NOT mean "IBM OS/VS COBOL", then tell us what you do mean. ---------------------------------------------------------------- Thanks Bill. It is mainfraime, but not sure of the LANGVL. I'll go check. In short, get it compiled with the latest version we've got and make it work. Then we port it to LINUX. ---------------------------------------------------------------- Problem! We installed and loaded all necessary software as in the readme. Executing the "make" command is problematic. We are getting errors. A lot about missing prototypes. Any assistance will be welcome. I've included a few lines of the dump. Creating defaults.h... make all-recursive make[1]: Entering directory `/work/Cobol/open-cobol-1.0' Making all in lib make[2]: Entering directory `/work/Cobol/open-cobol-1.0/lib' if gcc -DHAVE_CONFIG_H -I. -I. -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT dummymac.o -MD -MP -MF ".deps/dummymac.Tpo" -c -o dummymac.o dummymac.c; \ then mv -f ".deps/dummymac.Tpo" ".deps/dummymac.Po"; else rm -f ".deps/dummymac.Tpo"; exit 1; fi rm -f libsupport.a ar cru libsupport.a dummymac.o ranlib libsupport.a make[2]: Leaving directory `/work/Cobol/open-cobol-1.0/lib' Making all in libcob make[2]: Entering directory `/work/Cobol/open-cobol-1.0/libcob' if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF ".deps/libcob_la-common.Tpo" -c -o libcob_la-common.lo `test -f 'common.c' || echo './'`common.c; \ then mv -f ".deps/libcob_la-common.Tpo" ".deps/libcob_la-common.Plo"; else rm -f ".deps/libcob_la-common.Tpo"; exit 1; fi mkdir .libs gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF .deps/libcob_la-common.Tpo -c common.c -fPIC -DPIC -o .libs/libcob_la-common.o gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-common.lo -MD -MP -MF .deps/libcob_la-common.Tpo -c common.c -o libcob_la-common.o >/dev/null 2>&1 if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSUPER_OPTIMIZE -I.. -O2 -finline-functions -fomit-frame-pointer -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-call.lo -MD -MP -MF ".deps/libcob_la-call.Tpo" -c -o libcob_la-call.lo `test -f 'call.c' || echo './'`call.c; \ then mv -f ".deps/libcob_la-call.Tpo" ".deps/libcob_la-call.Plo"; else rm -f ".deps/libcob_la-call.Tpo"; exit 1; fi ---------------------------------------------------------------- You may want to try OC 1.1 pre-release from feb09 (download is available here to the left). For helping you with the make problem please post some logs. Do [code]./configure 1>conf.log 2>conf.err make 1>make.log 2>make.err[/code]. But missing prototypes should only be warnings, not errors. Did you test if make check works? human BTW: If you don't upload the logs somewhere but want to put it here, PLEASE use code tags for that. ---------------------------------------------------------------- Subject: Compiler example connection DB2 Exp Hi all, as to compile an example of connection to database DB2 (sample) from Windows XP ? The example code is:[code] identification division. program-id. cblsql2. environment division. input-output section. file-control. data division. file section. * working-storage section. 77 w-start-ws pic X(08) value 'Start WS'. 77 w-sqlcode pic z(8)9+. 77 w-dis-count pic z(8)9+. 77 displ-salary pic -Z,ZZZ,ZZ9.99. 01 switsjes. 03 sw-800-curs pic 9. 88 sw-800-curs-open value 1. 88 sw-800-curs-fets value 2. 88 sw-800-curs-clos value 3. / DB2 thingies EXEC SQL include sqlca END-EXEC. EXEC SQL begin declare section END-EXEC. 01 w-userid pic x(08). 01 w-password pic x(08). 01 w-count pic S9(04) comp-5. 01 w-empno pic x(06) value space. 01 w-1st-name. 49 w-1st-name-len pic S9(04) comp-5 value zero. 49 w-1st-name-dat pic x(12) value space. 01 w-birthdate pic x(10) value space. 01 w-workdept pic x(03) value space. 01 w-workdept-NULL pic S9(04) comp-5. 01 w-salary pic S9(7)V9(2) comp-3. 01 k-empno-start pic x(06) value low-value. 01 k-empno-stop pic x(06) value high-value. EXEC SQL end declare section END-EXEC. / PROCEDURE DIVISION. 000-000-main section. ************************************ 000-010. perform 020-000-init-connect. perform 100-000-main-process. perform 090-000-exit-reset. 000-090. stop run. / 020-000-init-connect section. ************************************ 020-010. EXEC SQL connect to sample END-EXEC. if SQLCODE not equal zero then move SQLCODE to w-sqlcode display 'CONNECT failed with rc ' w-sqlcode else display 'CONNECT :)' end-if. 020-090. exit. * 090-000-exit-reset section. ************************************ 0090-010. EXEC SQL connect reset END-EXEC. if SQLCODE not equal zero then move SQLCODE to w-sqlcode display 'reset CONNECT failed with rc 'w-sqlcode else display 'reset CONNECT :)' end-if. 0090-090. exit. 100-000-main-process section. ************************************ 100-010. set sw-800-curs-open to true. perform 800-000-process-emply-cursor. if SQLCODE equal zero then set sw-800-curs-fets to true perform 800-000-process-emply-cursor perform until SQLCODE not equal zero perform 110-000-process-emply-row perform 800-000-process-emply-cursor end-perform end-if if SQLCODE equal +100 then set sw-800-curs-clos to true perform 800-000-process-emply-cursor end-if. 100-090. exit. 110-000-process-emply-row section. ************************************ 110-010. if w-workdept-NULL less than zero then move space to w-workdept end-if move w-salary to displ-salary display w-empno space w-1st-name-dat space w-workdept space w-birthdate space displ-salary. 110-090. exit. / CURSOR 800-000-process-emply-cursor section. ************************************* * Declare EXEC SQL declare c8000 cursor for select empno , firstnme , workdept , birthdate , coalesce(salary,-1) from employee where empno between :k-empno-start and :k-empno-stop order by firstnme END-EXEC. 800-010. evaluate true * Open when sw-800-curs-open EXEC SQL open c8000 END-EXEC * Fetch when sw-800-curs-fets initialize w-1st-name EXEC SQL fetch c8000 into :w-empno , :w-1st-name , :w-workdept :w-workdept-NULL , :w-birthdate , :w-salary END-EXEC * Close when other EXEC SQL close c8000 END-EXEC end-evaluate. if SQLCODE equal zero or +100 then continue else move SQLCODE to w-sqlcode display 'sqlCode : ' w-sqlcode space display 'sw-800-curs : ' sw-800-curs space display 'sqlerrm : ' sqlerrm space end-if. 800-090. exit.[/code] I have made thus, prompt DOS DB2: 1) db2 connect to sample 2) db2 prep cblsql2.sqb bindfile target ANSI_COBOL In COBOL-IT menu Project | Properties: 1) tab Environment: 1.1) Path: Include folders: C:\Program Files\IBM\SQLLIB\include\cobol_a 1.2) Library path: C:\Program Files\IBM\SQLLIB\lib 2) tab Link: 2.1) Options: Link the library : db2api.lib db2apie.lib db2ApiInstall.lib I am successful to compile the code, having put to place the environment variables of the db2: COB_LIBRARY_PATH = C:\COBOL\CobolIT\lib;C:\Program Files\IBM\SQLLIB\include\cobol_a. The other environment variables are: COB_CONFIG_DIR = C:\COBOL\CobolIT\config COB_COPY_DIR = C:\COBOL\CobolIT\copy;C:\Program Files\IBM\SQLLIB\include\cobol_a COBOLITDIR = C:\COBOL\CobolIT;C:\COBOL\CobolIT\bin COB_SCREEN_ESC = Y COB_SCREEN_EXCEPTIONS = Y Starting exe I obtain this message: "libcob: Cannot find module 'sqlgstrt' ". What I have forgotten to make ? Some lacks the environment variables ? ---------------------------------------------------------------- What do you have forgotten? 1. To use OpenCOBOL instead of COBOL-IT. 2. To give a short info/link to the DB2 API docs. 3. To post your source in code tags. After you changed 1st, edit your post for 2nd and write a reply to this post for 3rd we may can help you. human ---------------------------------------------------------------- Hi human, I have compiled the code cblsql2.cbl with OpenCOBOL 1.1, but the result is not changed. It explains to me like inserting the tag? ---------------------------------------------------------------- [size=x-small]Double post removed[/size] ---------------------------------------------------------------- Hi human, I have compiled the code cblsql2.cbl with OpenCOBOL 1.1, but the result is not changed. The file cblsql2.cbl: [quote] identification division. program-id. cblsql2. environment division. input-output section. file-control. data division. file section. * working-storage section. 77 w-start-ws pic X(08) value 'Start WS'. 77 w-sqlcode pic z(8)9+. 77 w-dis-count pic z(8)9+. 77 displ-salary pic -Z,ZZZ,ZZ9.99. 01 switsjes. 03 sw-800-curs pic 9. 88 sw-800-curs-open value 1. 88 sw-800-curs-fets value 2. 88 sw-800-curs-clos value 3. / DB2 thingies EXEC SQL include sqlca END-EXEC. EXEC SQL begin declare section END-EXEC. 01 w-userid pic x(08). 01 w-password pic x(08). 01 w-count pic S9(04) comp-5. 01 w-empno pic x(06) value space. 01 w-1st-name. 49 w-1st-name-len pic S9(04) comp-5 value zero. 49 w-1st-name-dat pic x(12) value space. 01 w-birthdate pic x(10) value space. 01 w-workdept pic x(03) value space. 01 w-workdept-NULL pic S9(04) comp-5. 01 w-salary pic S9(7)V9(2) comp-3. 01 k-empno-start pic x(06) value low-value. 01 k-empno-stop pic x(06) value high-value. EXEC SQL end declare section END-EXEC. / PROCEDURE DIVISION. 000-000-main section. ************************************ 000-010. perform 020-000-init-connect. perform 100-000-main-process. perform 090-000-exit-reset. 000-090. stop run. / 020-000-init-connect section. ************************************ 020-010. EXEC SQL connect to sample END-EXEC. if SQLCODE not equal zero then move SQLCODE to w-sqlcode display 'CONNECT failed with rc ' w-sqlcode else display 'CONNECT :)' end-if. 020-090. exit. * 090-000-exit-reset section. ************************************ 0090-010. EXEC SQL connect reset END-EXEC. if SQLCODE not equal zero then move SQLCODE to w-sqlcode display 'reset CONNECT failed with rc ' w-sqlcode else display 'reset CONNECT :)' end-if. 0090-090. exit. 100-000-main-process section. ************************************ 100-010. set sw-800-curs-open to true. perform 800-000-process-emply-cursor. if SQLCODE equal zero then set sw-800-curs-fets to true perform 800-000-process-emply-cursor perform until SQLCODE not equal zero perform 110-000-process-emply-row perform 800-000-process-emply-cursor end-perform end-if if SQLCODE equal +100 then set sw-800-curs-clos to true perform 800-000-process-emply-cursor end-if. 100-090. exit. 110-000-process-emply-row section. ************************************ 110-010. if w-workdept-NULL less than zero then move space to w-workdept end-if move w-salary to displ-salary display w-empno space w-1st-name-dat space w-workdept space w-birthdate space displ-salary. 110-090. exit. / CURSOR 800-000-process-emply-cursor section. ************************************* * Declare EXEC SQL declare c8000 cursor for select empno , firstnme , workdept , birthdate , coalesce(salary,-1) from employee where empno between :k-empno-start and :k-empno-stop order by firstnme END-EXEC. 800-010. evaluate true * Open when sw-800-curs-open EXEC SQL open c8000 END-EXEC * Fetch when sw-800-curs-fets initialize w-1st-name EXEC SQL fetch c8000 into :w-empno , :w-1st-name , :w-workdept :w-workdept-NULL , :w-birthdate , :w-salary END-EXEC * Close when other EXEC SQL close c8000 END-EXEC end-evaluate. if SQLCODE equal zero or +100 then continue else move SQLCODE to w-sqlcode display 'sqlCode : ' w-sqlcode space display 'sw-800-curs : ' sw-800-curs space display 'sqlerrm : ' sqlerrm space end-if. 800-090. exit. [/quote] ---------------------------------------------------------------- I have installed db2 Express-C and I work. I use OpenCOBOL 1,1 in Windows XP using like MinGW compiler. I have written the following code of example (cblsql2.sqb): [code] identification division. program-id. cblsql2. environment division. input-output section. file-control. data division. file section. * working-storage section. 77 w-start-ws pic X(08) value 'Start WS'. 77 w-sqlcode pic z(8)9+. 77 w-dis-count pic z(8)9+. 77 displ-salary pic -Z,ZZZ,ZZ9.99. 01 switsjes. 03 sw-800-curs pic 9. 88 sw-800-curs-open value 1. 88 sw-800-curs-fets value 2. 88 sw-800-curs-clos value 3. / DB2 thingies EXEC SQL include sqlca END-EXEC. EXEC SQL begin declare section END-EXEC. 01 w-userid pic x(08). 01 w-password pic x(08). 01 w-count pic S9(04) comp-5. 01 w-empno pic x(06) value space. 01 w-1st-name. 49 w-1st-name-len pic S9(04) comp-5 value zero. 49 w-1st-name-dat pic x(12) value space. 01 w-birthdate pic x(10) value space. 01 w-workdept pic x(03) value space. 01 w-workdept-NULL pic S9(04) comp-5. 01 w-salary pic S9(7)V9(2) comp-3. 01 k-empno-start pic x(06) value low-value. 01 k-empno-stop pic x(06) value high-value. EXEC SQL end declare section END-EXEC. / PROCEDURE DIVISION. 000-000-main section. ************************************ 000-010. perform 020-000-init-connect. perform 100-000-main-process. perform 090-000-exit-reset. 000-090. stop run. / 020-000-init-connect section. ************************************ 020-010. EXEC SQL connect to sample END-EXEC. if SQLCODE not equal zero then move SQLCODE to w-sqlcode display 'CONNECT failed with rc ' w-sqlcode else display 'CONNECT :)' end-if. 020-090. exit. * 090-000-exit-reset section. ************************************ 0090-010. EXEC SQL connect reset END-EXEC. if SQLCODE not equal zero then move SQLCODE to w-sqlcode display 'reset CONNECT failed with rc ' w-sqlcode else display 'reset CONNECT :)' end-if. 0090-090. exit. 100-000-main-process section. ************************************ 100-010. set sw-800-curs-open to true. perform 800-000-process-emply-cursor. if SQLCODE equal zero then set sw-800-curs-fets to true perform 800-000-process-emply-cursor perform until SQLCODE not equal zero perform 110-000-process-emply-row perform 800-000-process-emply-cursor end-perform end-if if SQLCODE equal +100 then set sw-800-curs-clos to true perform 800-000-process-emply-cursor end-if. 100-090. exit. 110-000-process-emply-row section. ************************************ 110-010. if w-workdept-NULL less than zero then move space to w-workdept end-if move w-salary to displ-salary display w-empno space w-1st-name-dat space w-workdept space w-birthdate space displ-salary. 110-090. exit. / CURSOR 800-000-process-emply-cursor section. ************************************* * Declare EXEC SQL declare c8000 cursor for select empno , firstnme , workdept , birthdate , coalesce(salary,-1) from employee where empno between :k-empno-start and :k-empno-stop order by firstnme END-EXEC. 800-010. evaluate true * Open when sw-800-curs-open EXEC SQL open c8000 END-EXEC * Fetch when sw-800-curs-fets initialize w-1st-name EXEC SQL fetch c8000 into :w-empno , :w-1st-name , :w-workdept :w-workdept-NULL , :w-birthdate , :w-salary END-EXEC * Close when other EXEC SQL close c8000 END-EXEC end-evaluate. if SQLCODE equal zero or +100 then continue else move SQLCODE to w-sqlcode display 'sqlCode : ' w-sqlcode space display 'sw-800-curs : ' sw-800-curs space display 'sqlerrm : ' sqlerrm space end-if. 800-090. exit. [/code] I have then made prompt dos db2: [code] db2 connect to sample db2 prep cblsql2.sqb bindfile target ANSI_COBOL [/code] I have thus obtained the following code (cblsql2.cbl): [code] identification division. program-id. cblsql2. environment division. input-output section. file-control. data division. file section. * working-storage section. 01 SQLDA-ID pic 9(4) comp-5. 01 SQLDSIZE pic 9(4) comp-5. 01 SQL-STMT-ID pic 9(4) comp-5. 01 SQLVAR-INDEX pic 9(4) comp-5. 01 SQL-DATA-TYPE pic 9(4) comp-5. 01 SQL-HOST-VAR-LENGTH pic 9(9) comp-5. 01 SQL-S-HOST-VAR-LENGTH pic 9(9) comp-5. 01 SQL-S-LITERAL pic X(258). 01 SQL-LITERAL1 pic X(130). 01 SQL-LITERAL2 pic X(130). 01 SQL-LITERAL3 pic X(130). 01 SQL-LITERAL4 pic X(130). 01 SQL-LITERAL5 pic X(130). 01 SQL-LITERAL6 pic X(130). 01 SQL-LITERAL7 pic X(130). 01 SQL-LITERAL8 pic X(130). 01 SQL-LITERAL9 pic X(130). 01 SQL-LITERAL10 pic X(130). 01 SQL-IS-LITERAL pic 9(4) comp-5 value 1. 01 SQL-IS-INPUT-HVAR pic 9(4) comp-5 value 2. 01 SQL-CALL-TYPE pic 9(4) comp-5. 01 SQL-SECTIONUMBER pic 9(4) comp-5. 01 SQL-INPUT-SQLDA-ID pic 9(4) comp-5. 01 SQL-OUTPUT-SQLDA-ID pic 9(4) comp-5. 01 SQLA-PROGRAM-ID. 05 SQL-PART1 pic 9(4) COMP-5 value 172. 05 SQL-PART2 pic X(6) value "AEANAI". 05 SQL-PART3 pic X(24) value "wAIXMLKa01111 2 ". 05 SQL-PART4 pic 9(4) COMP-5 value 8. 05 SQL-PART5 pic X(8) value "GIORGIO ". 05 SQL-PART6 pic X(120) value LOW-VALUES. 05 SQL-PART7 pic 9(4) COMP-5 value 8. 05 SQL-PART8 pic X(8) value "CBLSQL2 ". 05 SQL-PART9 pic X(120) value LOW-VALUES. 77 w-start-ws pic X(08) value 'Start WS'. 77 w-sqlcode pic z(8)9+. 77 w-dis-count pic z(8)9+. 77 displ-salary pic -Z,ZZZ,ZZ9.99. 01 switsjes. 03 sw-800-curs pic 9. 88 sw-800-curs-open value 1. 88 sw-800-curs-fets value 2. 88 sw-800-curs-clos value 3. / DB2 thingies *EXEC SQL include sqlca * END-EXEC * SQL Communication Area - SQLCA COPY 'C:\Program Files\IBM\SQLLIB\include\cobol_a\sqlca.cbl'. *EXEC SQL begin declare section END-EXEC. 01 w-userid pic x(08). 01 w-password pic x(08). 01 w-count pic S9(04) comp-5. 01 w-empno pic x(06) value space. 01 w-1st-name. 49 w-1st-name-len pic S9(04) comp-5 value zero. 49 w-1st-name-dat pic x(12) value space. 01 w-birthdate pic x(10) value space. 01 w-workdept pic x(03) value space. 01 w-workdept-NULL pic S9(04) comp-5. 01 w-salary pic S9(7)V9(2) comp-3. 01 k-empno-start pic x(06) value low-value. 01 k-empno-stop pic x(06) value high-value. *EXEC SQL end declare section END-EXEC / PROCEDURE DIVISION. 000-000-main section. ************************************ 000-010. perform 020-000-init-connect. perform 100-000-main-process. perform 090-000-exit-reset. 000-090. stop run. / 020-000-init-connect section. ************************************ 020-010. *EXEC SQL connect to sample * END-EXEC CALL "sqlgstrt" USING BY CONTENT SQLA-PROGRAM-ID BY VALUE 0 BY REFERENCE SQLCA MOVE 1 TO SQL-STMT-ID MOVE 1 TO SQLDSIZE MOVE 2 TO SQLDA-ID CALL "sqlgaloc" USING BY VALUE SQLDA-ID SQLDSIZE SQL-STMT-ID 0 MOVE "sample" TO SQL-LITERAL1 MOVE 6 TO SQL-HOST-VAR-LENGTH MOVE 452 TO SQL-DATA-TYPE MOVE 0 TO SQLVAR-INDEX MOVE 2 TO SQLDA-ID CALL "sqlgstlv" USING BY VALUE SQLDA-ID SQLVAR-INDEX SQL-DATA-TYPE SQL-HOST-VAR-LENGTH BY REFERENCE SQL-LITERAL1 BY VALUE 0 0 MOVE 0 TO SQL-OUTPUT-SQLDA-ID MOVE 2 TO SQL-INPUT-SQLDA-ID MOVE 4 TO SQL-SECTIONUMBER MOVE 29 TO SQL-CALL-TYPE CALL "sqlgcall" USING BY VALUE SQL-CALL-TYPE SQL-SECTIONUMBER SQL-INPUT-SQLDA-ID SQL-OUTPUT-SQLDA-ID 0 CALL "sqlgstop" USING BY VALUE 0 . if SQLCODE not equal zero then move SQLCODE to w-sqlcode display 'CONNECT failed with rc ' w-sqlcode else display 'CONNECT :)' end-if. 020-090. exit. * 090-000-exit-reset section. ************************************ 0090-010. *EXEC SQL connect reset * END-EXEC CALL "sqlgstrt" USING BY CONTENT SQLA-PROGRAM-ID BY VALUE 0 BY REFERENCE SQLCA MOVE 0 TO SQL-OUTPUT-SQLDA-ID MOVE 0 TO SQL-INPUT-SQLDA-ID MOVE 3 TO SQL-SECTIONUMBER MOVE 29 TO SQL-CALL-TYPE CALL "sqlgcall" USING BY VALUE SQL-CALL-TYPE SQL-SECTIONUMBER SQL-INPUT-SQLDA-ID SQL-OUTPUT-SQLDA-ID 0 CALL "sqlgstop" USING BY VALUE 0 . if SQLCODE not equal zero then move SQLCODE to w-sqlcode display 'reset CONNECT failed with rc ' w-sqlcode else display 'reset CONNECT :)' end-if. 0090-090. exit. 100-000-main-process section. ************************************ 100-010. set sw-800-curs-open to true. perform 800-000-process-emply-cursor. if SQLCODE equal zero then set sw-800-curs-fets to true perform 800-000-process-emply-cursor perform until SQLCODE not equal zero perform 110-000-process-emply-row perform 800-000-process-emply-cursor end-perform end-if if SQLCODE equal +100 then set sw-800-curs-clos to true perform 800-000-process-emply-cursor end-if. 100-090. exit. 110-000-process-emply-row section. ************************************ 110-010. if w-workdept-NULL less than zero then move space to w-workdept end-if move w-salary to displ-salary display w-empno space w-1st-name-dat space w-workdept space w-birthdate space displ-salary. 110-090. exit. / CURSOR 800-000-process-emply-cursor section. ************************************* * Declare *EXEC SQL declare c8000 cursor for * select empno * , firstnme * , workdept * , birthdate * , coalesce(salary,-1) * from employee * where empno between :k-empno-start * and :k-empno-stop * order by firstnme * END-EXEC 800-010. evaluate true * Open when sw-800-curs-open *EXEC SQL open c8000 * END-EXEC CALL "sqlgstrt" USING BY CONTENT SQLA-PROGRAM-ID BY VALUE 0 BY REFERENCE SQLCA MOVE 2 TO SQL-STMT-ID MOVE 2 TO SQLDSIZE MOVE 2 TO SQLDA-ID CALL "sqlgaloc" USING BY VALUE SQLDA-ID SQLDSIZE SQL-STMT-ID 0 MOVE 6 TO SQL-HOST-VAR-LENGTH MOVE 452 TO SQL-DATA-TYPE MOVE 0 TO SQLVAR-INDEX MOVE 2 TO SQLDA-ID CALL "sqlgstlv" USING BY VALUE SQLDA-ID SQLVAR-INDEX SQL-DATA-TYPE SQL-HOST-VAR-LENGTH BY REFERENCE K-EMPNO-START BY VALUE 0 0 MOVE 6 TO SQL-HOST-VAR-LENGTH MOVE 452 TO SQL-DATA-TYPE MOVE 1 TO SQLVAR-INDEX MOVE 2 TO SQLDA-ID CALL "sqlgstlv" USING BY VALUE SQLDA-ID SQLVAR-INDEX SQL-DATA-TYPE SQL-HOST-VAR-LENGTH BY REFERENCE K-EMPNO-STOP BY VALUE 0 0 MOVE 0 TO SQL-OUTPUT-SQLDA-ID MOVE 2 TO SQL-INPUT-SQLDA-ID MOVE 1 TO SQL-SECTIONUMBER MOVE 26 TO SQL-CALL-TYPE CALL "sqlgcall" USING BY VALUE SQL-CALL-TYPE SQL-SECTIONUMBER SQL-INPUT-SQLDA-ID SQL-OUTPUT-SQLDA-ID 0 CALL "sqlgstop" USING BY VALUE 0 * Fetch when sw-800-curs-fets initialize w-1st-name *EXEC SQL fetch c8000 * into :w-empno * , :w-1st-name * , :w-workdept * :w-workdept-NULL * , :w-birthdate * , :w-salary * END-EXEC CALL "sqlgstrt" USING BY CONTENT SQLA-PROGRAM-ID BY VALUE 0 BY REFERENCE SQLCA MOVE 3 TO SQL-STMT-ID MOVE 5 TO SQLDSIZE MOVE 3 TO SQLDA-ID CALL "sqlgaloc" USING BY VALUE SQLDA-ID SQLDSIZE SQL-STMT-ID 0 MOVE 6 TO SQL-HOST-VAR-LENGTH MOVE 452 TO SQL-DATA-TYPE MOVE 0 TO SQLVAR-INDEX MOVE 3 TO SQLDA-ID CALL "sqlgstlv" USING BY VALUE SQLDA-ID SQLVAR-INDEX SQL-DATA-TYPE SQL-HOST-VAR-LENGTH BY REFERENCE W-EMPNO BY VALUE 0 0 MOVE 12 TO SQL-HOST-VAR-LENGTH MOVE 448 TO SQL-DATA-TYPE MOVE 1 TO SQLVAR-INDEX MOVE 3 TO SQLDA-ID CALL "sqlgstlv" USING BY VALUE SQLDA-ID SQLVAR-INDEX SQL-DATA-TYPE SQL-HOST-VAR-LENGTH BY REFERENCE W-1ST-NAME BY VALUE 0 0 MOVE 3 TO SQL-HOST-VAR-LENGTH MOVE 453 TO SQL-DATA-TYPE MOVE 2 TO SQLVAR-INDEX MOVE 3 TO SQLDA-ID CALL "sqlgstlv" USING BY VALUE SQLDA-ID SQLVAR-INDEX SQL-DATA-TYPE SQL-HOST-VAR-LENGTH BY REFERENCE W-WORKDEPT W-WORKDEPT-NULL BY VALUE 0 MOVE 10 TO SQL-HOST-VAR-LENGTH MOVE 452 TO SQL-DATA-TYPE MOVE 3 TO SQLVAR-INDEX MOVE 3 TO SQLDA-ID CALL "sqlgstlv" USING BY VALUE SQLDA-ID SQLVAR-INDEX SQL-DATA-TYPE SQL-HOST-VAR-LENGTH BY REFERENCE W-BIRTHDATE BY VALUE 0 0 MOVE 521 TO SQL-HOST-VAR-LENGTH MOVE 484 TO SQL-DATA-TYPE MOVE 4 TO SQLVAR-INDEX MOVE 3 TO SQLDA-ID CALL "sqlgstlv" USING BY VALUE SQLDA-ID SQLVAR-INDEX SQL-DATA-TYPE SQL-HOST-VAR-LENGTH BY REFERENCE W-SALARY BY VALUE 0 0 MOVE 3 TO SQL-OUTPUT-SQLDA-ID MOVE 0 TO SQL-INPUT-SQLDA-ID MOVE 1 TO SQL-SECTIONUMBER MOVE 25 TO SQL-CALL-TYPE CALL "sqlgcall" USING BY VALUE SQL-CALL-TYPE SQL-SECTIONUMBER SQL-INPUT-SQLDA-ID SQL-OUTPUT-SQLDA-ID 0 CALL "sqlgstop" USING BY VALUE 0 * Close when other *EXEC SQL close c8000 * END-EXEC CALL "sqlgstrt" USING BY CONTENT SQLA-PROGRAM-ID BY VALUE 0 BY REFERENCE SQLCA MOVE 0 TO SQL-OUTPUT-SQLDA-ID MOVE 0 TO SQL-INPUT-SQLDA-ID MOVE 1 TO SQL-SECTIONUMBER MOVE 20 TO SQL-CALL-TYPE CALL "sqlgcall" USING BY VALUE SQL-CALL-TYPE SQL-SECTIONUMBER SQL-INPUT-SQLDA-ID SQL-OUTPUT-SQLDA-ID 0 CALL "sqlgstop" USING BY VALUE 0 end-evaluate. if SQLCODE equal zero or +100 then continue else move SQLCODE to w-sqlcode display 'sqlCode : ' w-sqlcode space display 'sw-800-curs : ' sw-800-curs space display 'sqlerrm : ' sqlerrm space end-if. 800-090. exit. [/code] From the prompt DOS OpenCobol: [code] cobc -x cblsql2.cbl -L"C:\OpenCOBOL-1.1-mingw\lib" -ldb [/code] I have obtained the file cblsql2.exe but when start cblsql2.exe, I obtain the message: [quote] libcob: Cannot find module 'sqlgstrt' [/quote] ---------------------------------------------------------------- From the last post you've made (editing the previous would have been better) I know what you mean. If you just put all OC/MinGW-dlls in one folder and start cblsql2.exe (what I guess, because you did not write that) the runtime starts and breaks because the dll sqlgstrt cannot be loaded. You have to either copy the correct DB2-dlls (I guess they're named db2api.dll db2apie.dll db2ApiInstall.dll) into that folder, too or set [url=http://opencobol.add1tocobol.com/ocfaq.html#what-is-cob-library-path]COB_LIBRARY_PATH[/url] to the folder where they are located. If this doesn't work the function-names are not the same as the module-names you may have to set [url=http://opencobol.add1tocobol.com/ocfaq.html#what-is-cob-pre-load]COB_PRE_LOAD[/url]. If this works, please either write a short tutorial (How to use OC with DB2 Express) with the samples of the last post, together with all necessary prerequisites (and where to get them), necessary compile-flags/environment entries and a sql-script for creating the sample-db you connect to (if this isn't a sample db included in the DB2 installation). Thank you! human ---------------------------------------------------------------- Hi human, opss :-o the DB2-dlls (db2api.dll db2apie.dll db2ApiInstall.dll) not there are, but there are only the .lib. The DB2-dlls does not serve, as use the libs that there are the static libraries in Windows. ---------------------------------------------------------------- Then you need like[code]cobc -x cblsql2.cbl -L"C:\IBM\SQLLIB\lib" -ldb2api -ldb2apie -ldb2ApiInstall[/code] but I guess that this will not work as you cannot link static VisualStudio libraries this way with MinGW. You could link them together to an db2libs.o with [code]gcc *.lib -o db2libs.o[/code] (does not work with the MinGW package from the wiki) and do [code]cobc -x cblsql2.cbl db2libs.o[/code]. But I guess it would be easier if you use a VisualStudio environment (see www.kiska.net/opencobol for binaries) and do [code]cobc -x cblsql2.cbl db2api.lib db2apie.lib db2ApiInstall.lib[/code] human ---------------------------------------------------------------- Hi human, in the URL www.kiska.net/opencobol for binaries the OpenCobol Pre-Release 1.1 binaries is for Microsoft Visual C++ 2008 Express ? ---------------------------------------------------------------- It doesn't matter if you use Express versions or not. If you look at in http://www.kiska.net/opencobol/1.1/ you see "x86-64 (AMD-64) Windows (64-bit) VS2008" [this is a snapshot of an unsupported source version] and some "Windows" binaries with the text "This build is using Microsoft C version 8 (from VS2005)". It's no problem if you use VS2008 (2010 should work, too). with these builds. The only thing that may happens is that some temporary files (especially the .manifest) are not deleted after compile. human ---------------------------------------------------------------- Ok human. I have tried to compile the *.lib in db2libs.o but, as I thought, it has not made it because an entry point as type main... . The problem of the topic is therefore to have the DLLs of db2 Express-C. But they are not successful to find them on the IBM URL... . ---------------------------------------------------------------- As written before: If you use the VC version you can directly compile the static libs into your program. If you want to use MinGW/cygwin you should have libraries for use with that (maybe something like reimp works but I would not suggest to try it). human ---------------------------------------------------------------- Someone is successful to connect a database DB2 (Express-C on Windows XP) with OpenCOBOL 1.1 on Windows XP? If yes, you can be thus kind to indicate to me like? ---------------------------------------------------------------- ... start again ... What environment do you use? The current MinGW-package from the wiki needs some update before it can link MS static libs. The VC-package should work for compiling. Where is your current problem? human ---------------------------------------------------------------- OK human, Windows XP, OpenCOBOL with Visual C++ 2008 Express, DB2 Express-C on Windows XP. [code] cobc -x cblsql2.cbl [/code] OK: cblsql2.exe run cblsql2 [quote] C:/OpenCOBOL-1.1-VC++/sviluppo/cblsql2/cblsql2.cbl:0: libcob: Cannot find module 'sqlgstrt ' Cobol memory dump +++++++++++++++++ PROGRAM ID : cblsql2 (C:/OpenCOBOL-1.1-VC++/sviluppo/cblsql2/cblsql2.cbl) Current line : C:/OpenCOBOL-1.1-VC++/sviluppo/cblsql2/cblsql2.cbl:0 ---------------------------- not compiled with -g or -fmem-info ---------------------------- [/quote] ---------------------------------------------------------------- We can go further with this information. You left out the static libs. At least when errors occur you should compile with -debug, therefore do something like [code]cobc -x -debug cblsql2.cbl lib1.lib lib2.lib lib3.lib[/code] human ---------------------------------------------------------------- [code] cobc -x -debug cblsql2.cbl -L"C:\OpenCOBOL-1.1-VC++ \" libdb44.lib [/code] [quote] cob84.c cblsql2_main.c LINK : warning LNK4044: opzione '/LC:\OpenCOBOL-1.1-VC++ libdb44.lib cblsql2_main.obj /DE FAULTLIB:MSVCRT.LIB' non riconosciuta; verrà ignorata Creazione della libreria cblsql2.lib e dell'oggetto cblsql2.exp in corso... MSVCRT.lib(crtexe.obj) : error LNK2019: riferimento al simbolo esterno _main non risolto n ella funzione ___tmainCRTStartup cblsql2.exe : fatal error LNK1120: 1 esterni non risolti [/quote] ---------------------------------------------------------------- giorgik; Try running [b]ldd[/b] or with Windows [b]depends[/b] on your binary to list all the dependencies. Then take a look at http://opencobol.add1tocobol.com/#what-is-cob-pre-load and see if you can't wrangle a solution. ldd will usually give a 'can't find' message if a link symbol is not in the search path. Can be a great clue. But, seeing tmainCRTStartup, hmm, ncurses-devel package? Or if it is _main, be careful which -b, -m, -c, and -x cobc options are in place along with other source compiles to make sure you know where the entry point main function is defined. [b]There can be only one![/b] [i]Highlander reference if you've never seen the movie.[/i] :-) Failing that, and none of the modules have a main, don't forget [b]cobcrun[/b]. http://opencobol.add1tocobol.com/#what-is-cobcrun Cheers, Brian ---------------------------------------------------------------- @giorgik: Im facing alike problem with Cobol-IT (I know, I known, is not the same but have same roots). I'm using Cobol-IT because there is no Win-32 binaries for VS2008+, I have VS2010 intalled in my Windows 7 machine. What I found is that call is done with cob_call_resolve_1. If I set "static" option I got an error about unresolved symbol: C:\temp\locura>cobc -x -free -static db1.cbl c:\FireBird156\lib\fbclient_ms.lib cobD7F9.c db1_main.c Creando biblioteca db1.lib y objeto db1.exp db1.obj : error LNK2019: símbolo externo _isc_attach_database sin resolver al que se hace referencia en la función _db1_ db1.exe : fatal error LNK1120: 1 externos sin resolver Adding the -L switch pointing to the lib file I got the same warning (LNK4044 option /L... not recognized, ommited) then the same link error: C:\temp\locura>cobc -x -free -static db1.cbl -Lc:\FireBird156\lib\fbclient_ms.li b cobA22A.c db1_main.c LINK : warning LNK4044: opción '/Lc:\FireBird156\lib\fbclient_ms.lib' no reconocida; omitida Creando biblioteca db1.lib y objeto db1.exp db1.obj : error LNK2019: símbolo externo _isc_attach_database sin resolver al que se hace referencia en la función _db1_ db1.exe : fatal error LNK1120: 1 externos sin resolver So, there are two posinble causses: 1. Symbol isnt found because leading "_" 2. LIB file isnt included in the EXE. I also tried setting COB_LIBRARY_PATH and PATH pointing to where Firebird's dll is located but no luck. Is some way to call functions located inside existing DLL/SO files? LoadLibrary() / GetProcAddress()? I guess OC/CIT do something alike but how to force from Cobol code? Regards. ---------------------------------------------------------------- @ssamayoa: 1st: you can take the VC2008 binaries, there should be no problems of using them with VC2010 (despite of the dependencies for both runtimes). By the way: You can download the VC project files from kiska.net and build a VC2010 binary yourself. This has the advantage of setting the defaults (OC root path, ...) according to your environment. If you want to call functions located in some dll/so just do CALL 'myfunction' USING xyz END-CALL. Take care that lower/upper-case must match as the function was exported (if it was exported to _myfunction you should call that, just as the type of the params must match. If the dll/so is called like the first function of it, that you use you don't have to do some additional loadings, if not, use COB_PRE_LOAD as btiffin mentioned. COB_LIBRARY_PATH is only for the runtime, you get problems at compile time Ensure that c:\FireBird156\lib\fbclient_ms.lib is a static library. If not use cobc db1.cbl -lfbclient_ms -Lc:\FireBird156\lib. When you have Firebird running with OC please submit a How-To here. If you want further help you should either use OpenCOBOL and stay in this board or go to C*T forum and TRY to get help there (I haven't seen any solutions there lately...) The linking and calling stuff is quite different between our beloved OC and this French fork. @giorgik: It doesn't seem that you know what you're doing, but this doesn't prevent us of telling you what to do. You try to link a non-static lib: libdb44.lib. It is already linked in libcob.dll and is used for ISAM support. You want to link db2api.lib, db2apie.lib, ... @all: If you want to link to a static library with OpenCOBOL 1.1 and VC you have to do the following: 1. BACKUP all the lib-files you want to link as they could be destroyed if something goes wrong. 2. Always use cobc -x as my late-night-debugging showed problems if cobc -m (standard) is used [Roger is informed]. 3. Just pass all the static libraries directly to cobc, like [code]cobc -x -debug mysouce.cbl D:\statlibs\statlib1.lib D:\statlibs\statlib2.lib[/code] human ---------------------------------------------------------------- Hi human, I have downloaded OpenCOBOL-1.1-VC++ from the URL: http://www.kiska.net/opencobol/1.1. Now what councils to make me? Explains to me step by step, thus I try to make it. ---------------------------------------------------------------- It's enough if you do as I wrote before [quote] human wrote: [...] 1. BACKUP all the lib-files you want to link as they could be destroyed if something goes wrong. 2. Always use cobc -x as my late-night-debugging showed problems if cobc -m (standard) is used [Roger is informed]. 3. Just pass all the static libraries directly to cobc, like [code]cobc -x -debug mysource.cbl D:\statlibs\statlib1.lib D:\statlibs\statlib2.lib[/code][/quote] Some preparations for easy testing: I suggest to use the feb09 version from http://www.kiska.net/opencobol/1.1/opencobol-1.1-win32-bin.zip (just ignore the missing colour feature for now). It's a little bit easier if you put the download in the folder where it was compiled for (if you don't do so you have to set some additional env vars). This is C:\OpenCOBOL Open cmd.exe and go to this folder. Then do [code]cobc -help[/code] If you get error messages install vc_redist.exe from that folder. Put cblsql2.cob to C:\COBOL and copy all libs from DB2 (C:\Program Files\IBM\SQLLIB\lib) to this folder, too (this way you have a backup of them if something goes wrong). Copy the COBOL copy dir (C:\Program Files\IBM\SQLLIB\include\cobol_a) to the same folder to. Then you have: C:\OpenCOBOL (and subdirs) C:\COBOL\cblsql2.cob C:\COBOL\*.lib C:\COBOL\cobol_a Then open a command line and do [code]SET PATH=C:\OpenCOBOL;%PATH% call "%VS90COMNTOOLS%vsvars32.bat" cd C:\COBOL cobc -x -debug -Icobol_a cblsql2.cob db2api.lib db2apie.lib -v 1>cobc.log 2>cobc.err cblsql2.exe 1>cblsql2.log 1>cblsql2.err[/code] If you have VS 2005 the correct name is "%VS90COMNTOOLS%vsvars32.bat", if you have VS 2010 installed the correct name is "%VS100COMNTOOLS%vsvars32.bat" Then post the content of the logs and error files here. human ---------------------------------------------------------------- @human: Thank you. At least I can attach to database with the following steps in OC and COBOL-IT in Windows: 1. Link to libs isnt necesary. 2. set COB_PRE_LOAD=fbclient 3. set COB_LIBRARY_PATH=c:\temp\locura\ I mean, where firebird's dll is. Setting full path in COB_PRE_LOAD dont work. 3.5 OC: Set VS2010 enviroment. 4. Compile the program: cobc -x -free db1.cbl 5. Run: status: +0000000001 status: +0335544472 status: +0000000000 status: +0000000000 status: +0000000000 status: +0000000000 status: +0000000000 status: +0000000000 status: +0000000000 status: +0000000000 status: +0000000000 status: +0000000000 status: +0000000000 status: +0000000000 status: +0000000000 status: +0000000000 status: +0000000000 status: +0000000000 status: +0000000000 Your user name and password are not defined. Ask your database administrator to set up a Firebird login. c:\ls\data\pp.fdb +0000000000 +0335544472 It is ok because DPB has no values. 6. Setting ISC_USER and ISC_PASSWORD enviroment variables the run: c:\ls\data\pp.fdb +0000000001 +0000000000 This is the source code: [code] identification division. program-id. db1. *> set COB_PRE_LOAD=fbclient *> set COB_LIBRARY_PATH=c:\temp\locura\ data division. working-storage section. 01 isc_values. 05 status_vector. 10 i_status binary-long signed occurs 20 times. 05 db_name_length binary-short signed. 05 db_name pic X(80). 05 db_handle binary-long value 0. 05 parm_buffer_length binary-short signed. 05 parm_buffer pic X(10) value low-values. 05 isc_status binary-long signed value 0. 05 isc_status1 binary-long signed value 0. 77 i binary-short signed. procedure division. main-para. move 17 to db_name_length. string "c:\ls\data\pp.fdb", x'00' delimited by size into db_name. call "isc_attach_database" using by reference status_vector by value db_name_length by reference db_name by reference db_handle by value parm_buffer_length by reference parm_buffer giving isc_status end-call. if isc_status is not zero then perform varying i from 1 by 1 untinbl i = 20 display "status: ", i_status (i) end-perform call "isc_print_status" using by reference status_vector giving isc_status1 end-if. display db_name. display db_handle. display isc_status. stop run. [/code] C definition is: [code] ISC_STATUS isc_attach_database( ISC_STATUS *status_vector, short db_name_length, char *db_name, isc_db_handle *db_handle, short parm_buffer_length, char *parm_buffer); [/code] So, now I have the crazy idea to write a GPRE alike in OCOBOL for the sake of mental excercise (I'm tempted to check precompiler for ODBC but I'm too old to learn another language...). Firebird GPRE for COBOL only supports RM/COBOL in Windows in versions 2.1.x and later 2.5. Lates time I tried it uses BLR to talk between Cobol program and database. I dont known if still does that in RM/Version. Regards. ---------------------------------------------------------------- Hi giorgik: As you may already known I got a database connection to firebird using only the dll (still to see if can reproduce it on other platform). So, compile your precompiled cobol program with out including the libs. If the compilation is successfull, try setting the enviroment variables COB_PRE_LOAD and COB_LIBRARY_PATH. In COB_PRE_LOAD separate each dll with ";" (I guess is ":" in *ux), without the extension, for example (dont know exactly the DB2 dll names): set COB_PRE_LOAD=db2sql;dbcx;another Please tell us if worked. Regards. ---------------------------------------------------------------- Hi ssamayoa, I have made as you have said, in the environment variables of Windows XP I have added: [code] COB_PRE_LOAD=C:\OpenCOBOL-1.1-VC++\; COB_LIBRARY_PATH=C:\OpenCOBOL-1.1-VC++\; [/code] I have compiled with: [code] cobc -x cblsql2.cbl -L"C:\OpenCOBOL-1.1-VC++\" -llibdb44 [/code] OK: cblsql2.exe then from the same prompt DOS where I have compiled: [code] cblsql2 [/code] ho ottenuto questo: [quote] libcob: Cannot find module 'sqlgstrt' [/quote] what I must make? ---------------------------------------------------------------- Hi human, I have made all as you have written and I put the log obtained to you. 1- cobc -x -debug -Icobol_a cblsql2.cbl db2api.lib db2apie.lib -v 1>cobc.log 2>cobc.err cobc.log: [code] cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Sep 10 2010 10:12:33 Packaged Feb 06 2009 10:30:55 CET [/code] cobc.err blank I have not obtained the cblsql2.exe 2- cblsql2.exe 1>cblsql2.log 1>cblsql2.err cblsql2.log blank cblsql2.err: [code] cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Sep 10 2010 10:12:33 Packaged Feb 06 2009 10:30:55 CET [/code] ---------------------------------------------------------------- Sorry, I mixed up the different versions of OC. OC 1.1 doesn't have the -v switch as I thought. Please do the same again without it. human ---------------------------------------------------------------- OK human, 1- cobc -x -debug -Icobol_a cblsql2.cbl db2api.lib db2apie.lib 1>cobc.log 2>cobc.err: cobc.err: [quote] db2api.lib:1: Error: Invalid indicator '>' at column 7 [/quote] ---------------------------------------------------------------- I guess you didn't use the binaries I've told you to use. Just tried this and get no errors with that command line. Please recheck what you've done. human ---------------------------------------------------------------- Yes human, now I have rifared all l' operation and now I have cblsql2.exe. cobc.log: [quote] cob18.c c:\documents and settings\giorgio\local settings\temp\cob18.c(1411) : warning C4715: 'cblsql2_': non tutti i percorsi di controllo restituiscono un valore Microsoft (R) Incremental Linker Version 9.00.30729.01 Copyright (C) Microsoft Corporation. All rights reserved. /out:cblsql2.exe cblsql2.obj db2api.lib db2apie.lib c:/OpenCobol/libcob.lib c:/OpenCobol/gmp.lib [/quote] cobc.err: [quote] Microsoft (R) 32-bit C/C++ Optimizing Compiler versione 15.00.30729.01 per 80x86 Copyright (C) Microsoft Corporation. All rights reserved. [/quote] cblsql2.log blank cblsql2.err: [quote] cblsql2.cbl:103: libcob: Cannot find module 'sqlgstrt' [/quote] ---------------------------------------------------------------- OK, short summary: You've now a cblsql2.exe which includes two static libs from db2. Now you have to find out where and how sqlgstrt is exported. Do [code]dumpbin /exports db2api.lib[/code] and look if it's in there. If not, go on with the other libs until you find the correct one. If it's neither db2api.lib nor db2api.lib add them to the cobc-command. human ---------------------------------------------------------------- I have made as you have said and never does not appear db2api.lib Then I have made: [quote] dumpbin /exports db2apie.lib [/quote] same result. Then I have made thus: [quote] cobc -x -debug -Icobol_a cblsql2.cbl 1>cobc.log 2>cobc.err cblsql2.exe 1>cblsql2.log 2>cblsql2.err [/quote] the result is always the same one before ---------------------------------------------------------------- Wrong again... a static lib has no exports. You should do "dumpbin /symbols xyz.lib > xyz.txt" for every static lib from db2 and check if you find sqlgstrt in the txt-file until you find the lib, that has the function you want to call (in this case sqlgstrt, likely to be written with at least one additional underscore like _sqlgstrt or __sqlgstrt_) in it and how it is written. When you have it you can link with that library as before. If you don't link with the correct lib the function cannot be found. human ---------------------------------------------------------------- sorry I had understood your explanation badly. Yes: [quote] dumpbin /symbols db2api.lib > db2api.txt [/quote] I have found: [quote] _sqlgstrt@12 _sqlgstrt _SQLGSTRT@12 _SQLGSTRT [/quote] ---------------------------------------------------------------- Hm... I think using [code]cobc -x -debug -Icobol_a cblsql2.cbl db2api.lib[/code] should work then. You could try to search and replace sqlgstrt with _sqlgstrt in the generated COBOL source but I guess this wouldn't help. Please upload db2api.lib somewhere (I don't want to download that package again... - if you don't know where use mediafire.com ) I try to have another look at this. human ---------------------------------------------------------------- OK, I have uploaded the file db2api.lib in the mediafire.com ---------------------------------------------------------------- In the mediafire.com my nick is giorgik and in my files: db2api.lib human you succeed to download it ? ---------------------------------------------------------------- You have to go to "My Files" and click on "Share". There you get a download link for the file. human ---------------------------------------------------------------- Sharing URL: [quote] http://www.mediafire.com/?6sfw93pfizy56yy [/quote] URL with File Name: [quote] http://www.mediafire.com/file/6sfw93pfizy56yy/db2api.lib [/quote] ---------------------------------------------------------------- COB_PRE_LOAD must list all DB2 dlls separated by ; without extension Example: COB_PRE_LOAD=sqldb2;db2a;other This preloads sqldb2.dll, db2a.dll and other.dll and exported functions of such dll are available to your cobol program. Set this to the real ones (I dong have db2 installed so I dont known which ones). COB_LIBRARY_PATH must point to where DB2 dlls are. Example: COB_LIBRARY_PATH=C:\DB2EXP\lib I dont known if multiple paths can be set vis this environment variable. Regards. ---------------------------------------------------------------- human you succeed to unload it ? ---------------------------------------------------------------- @ssamayoa: COB_LIBRARY_PATH can have multiple entries, but as giorgik said there are only static libs and no dll's this does not help. @giorgik: Yes, I'll have a look at this tomorrow. Maybe you can have a look if there are db2-dlls that can be used as ssamayoa suggested with use of COB_PRE_LOAD and COB_LIBRARY_PATH. human ---------------------------------------------------------------- Since Im between projects and I hate left things without finish, I installed DB2 Express-C in my machine and compiled and run the program. It doesnt showed the results but al least connected to the database. NOTE: I intalled DB2 in c:\IBM\SQLLIB. Steps: 1. Preprocess the ecbl file. [code] db2 connect sample db2 prep cblsql2.ecbl target ANSI_COBOL [/code] 2. Compile the program with cobc: [code] cobc -x cblsql2.cbl [/code] No need to include libs, calls will be dynamic. Note that I copied sqlca.cbl from c:\IBM\SQLLIB\include. 3. I "greped" the dlls in c:\IBM\SQLLIB\bin for the symbol "sqlgstrt" and "sqlgaloc" and both are in db2agapi.ddl so I set the OC's library environment variables to: [code] set COB_PRE_LOAD=db2agapi set COB_LIBRARY_PATH=c:\IBM\SQLLIB\BIN\ [/code] 4. Run the compiled program and this is the output: [code] CONNECT :) sqlCode : 302- sw-800-curs : 1 sqlerrm : reset CONNECT :) [/code] I googled for sqlcode -302 but find nothing. So, at least the program ran. Regards. ---------------------------------------------------------------- FWIW: Removed the "where" from the sql statement and at least fetchs first record, then returns sqlcode -501. Regards. ---------------------------------------------------------------- Hi ssamayoa, nice that you has a look at this, too. Did you ensure that you ran this program as data base user? You can choose one on installing db2, if I'm right and are able to set the db user later on. human BTW: Did you use C*T or OC in your tests? Is there anything that speaks against OC for your further use? ---------------------------------------------------------------- Hi Human. I test in both: OC and C*T. I installed in Windows and my Windows user where defined as database user also. I did some further testing. Last test I did was only select two columns of the table (empno and firstname) and the program crashes when trying to fetch 3 row. I mean, program connects to DB2, opens the cursor and fetchs first two records from the database then windows tells me "cblsql3.exe dejó de funcionar" (my Windows is in spanish) in a window asking me to close the program or debug it. This is the ouuput of the program before it stops working: [code] CONNECT :) open 800-010 sw-800-curs : 2 fetch 000150 +0005 BRUCE 0.00 fetch 000010 +0009 CHRISTINE 0.00 fetch [/code] And about OC vs C*T: I first selected C*T because it is simpler to install and use than OC and has recent binary builds. For OC testing Im using VS2005 build with dblib from more than 1 year. I more an application developer than "systems" or "tools" developer so building from sources may be simple for you but I preffer "packaged" binaries. For now I will test against OC 1.1 and C*T 2.5 Regards. ---------------------------------------------------------------- I'd test to use static libs but I miss cobol_a. Can someone zip and upload the whole cobol_a folder? @ssamayoa: I guess the result is the same using OC/C*T? Please compile with "-debug -ftrace-all" and run the program with [code]cblsql2.exe 1>cblsql2.out 2>cblsql2.err[/code] This way we should have the full trace in cblsql2.err and can see where the program stops working exactly. human ---------------------------------------------------------------- @human: this the share file zipped cobol_a: http://www.mediafire.com/?47mlha8ih1yjvb4 @ssamayoa: COB_PRE_LOAD=db2api I must put it in the environment variables of Windows XP? @human and @ssamayoa: the db2api.dll not exist in my installation DB2 EXpress-C. ---------------------------------------------------------------- @human, @ssamayoa: I have made thus, environment variables Windows XP: [quote] COB_PRE_LOAD=db2agapi;db2api COB_LIBRARY_PATH=C:\Program Files\IBM\SQLLIB\BIN [/quote] From Windows XP Start, All Programs, IBM DB2, DB2COPY1, Command Line Tools, Command Window: [quote] C:\Program Files\IBM\SQLLIB\BIN>db2 connect to sample Database Connection Information Database server = DB2/NT 9.7.2 SQL authorization ID = GIORGIO Local database alias = SAMPLE C:\Program Files\IBM\SQLLIB\BIN>cd c:\cobol C:\COBOL>cblsql2.exe CONNECT :) sqlCode : 818- sw-800-curs : 1 sqlerrm : reset CONNECT :) [/quote] ---------------------------------------------------------------- OK, I got this working with static libraries now, too. When using static lib's one has to use -x (otherwise the libs are broken - this one is going to be fixed in 2.0) and -static cause if one doesn't to this the entry points are not resolved internal. The only problem on this: everything CALLed has to be resolved by the linker, therefore: - it either has to be in the static libs (like db2api.lib in the command below) - or you have to do the whole compiling in one step (giving all COBOL source files-->resulting in one big .exe) - or you have to compile every COBOL prog you call from this -x -static one with -c to get an object file of them and use them the one the command line of the -x -static one as progname.obj - or you have to compile every COBOL prog you call from this -x -static one with --save-temps before to get a (non-static) lib file of them and use the one the command line of the -x -static one as -lprogname - or you have to put every COBOL prog into one source file I'll talk to Roger if he has any idea to make this work better. This command works for that special program: [code]cobc -debug -static -x cblsql2.cbl db2api.lib[/code] But be aware that there are still libraries (for example DB2AGAPI.DLL) needed. The main advantage over the not-static variant is that you don't need to set COB_PRE_LOAD. The main disadvantages are: - prog must be compiled to an executable (subprogs should be able to call the functions if they were called once in the main prog) --> this disadvantage is going to be solved in 2.0 - all "real" COBOL progs that are called from that program need changed compilation parameters --> maybe this can be changed with 2.0, not sure about that. Therefore I'd currently use the non-static variant. human ---------------------------------------------------------------- @human, @ssamayoa: thanks of all ---------------------------------------------------------------- @ssamayoa: on the COBOL-IT which they are the formulations to make in the Properties of the project cblsql2? ---------------------------------------------------------------- Exactly the same as OC. I tested the way human did (with static lib) and the compiled program ran (OC and C*T) but the problem I reported before persists: when trying to fetch the 3r record program hangs. So, do you successfuly ran the program in your enviroment? I mean, successfully fetch all the records? I take a look at the C code genetaed by both compilers and see that the calls to function libraries are ok (check sqlaprep.h in include dir of your DB2 install dir). By the way, db2api.dll insnt longer deployed with db2. Now is db2agapi.dll. Also note that DB2 precompiler creates a package in the server to which your program communicates. It seems (I dont have the docs at hand) that if you precoompile to bind file you have to manually create the package in the server. If not, prep does for you. Regards. ---------------------------------------------------------------- Hi ssamayoa, for my test I have used the following code found on the handbook of IBM in order to make test on the DB2: [quote] * --------------------------------------------------- * Module Name: coboldb2.sqb * * Description: Sample COBOL with DB2 program. * * Purpose: Performs a Select on the employee table * in the Sample database shipped with DB2. * * COMPLILER OPTIONS (be sure to change the USERNAME and PASSWORD): * DATA,EXIT(ADEXIT(FTTDBKW)),sql('database sample user USERNAME using PASSWORD') * * SYSLIB: * C:\Program Files\IBM\SQLLIB\INCLUDE\COBOL_A * * ILINK OPTIONS: * /de db2api.lib * * --------------------------------------------------- Identification Division. Program-ID. coboldb2. Data Division. *Make sure you have SQLCA included in Working-Storage Working-Storage Section. EXEC SQL INCLUDE SQLCA END-EXEC. *Data structure to store the Firstname of the employee 01 Program-pass-fields. 05 Name PIC X(12). Procedure Division. *A Connection to the database must be made! EXEC SQL CONNECT TO sample END-EXEC. *Performs a SQL SELECT to get the firstname of the employee *with the employee number of 10. EXEC SQL SELECT firstnme INTO :Name FROM employee WHERE empno = '000010' END-EXEC. *Displays the firstname we pulled from the Sample *database. Display "Firstname". Display "=========". Display Name. Display " ". *Displays the status of the SQL statements Display SQLCA. Goback. [/quote] When I precompile the coboldb2.sqb [quote] db2 prep coboldb2.sqb bindfile target ANSI_COBOL [/quote] I have an error on the variable Name like not identified: [quote] C:\COBOL>db2 prep coboldb2.sqb bindfile target ANSI_COBOL LINE MESSAGES FOR coboldb2.sqb ------------------------------------------------------------ SQL0060W The "COBOL" precompiler is in progress. 38 SQL0306N The host variable "NAME" is undefined. SQL0095N No bind file was created because of previous errors. SQL0091W Precompilation or binding was ended with "2" errors and "0" warnings. [/quote] why ? ---------------------------------------------------------------- [quote] 38 SQL0306N The host variable "NAME" is undefined. [/quote] Just guessing: May be precompiler dont handles identifiers mixed case well. Or may be host variables must be between begin/end declare section. BTW, I think that if you use bindfile such file should be uploaded to the db2 server. Precompile your cobol files without such option and the package will be created/replaced in the database automatically. Regards. ---------------------------------------------------------------- By the way, why are you testing OC with DB2? Just for curiosity/hobbie? Or for application migration? Regards. ---------------------------------------------------------------- Hi ssamayoa, I write code in C, C++, C# and OpenSource (excuse me my very bad English). The Cobol I have begun to study it. Now I'm without job (the society for which job it has closed) and I would want to be able to enter in bank or assurances like programmer Cobol, DB2. I would want to try to understand like "to speak" to the DB2 with the Cobol. ---------------------------------------------------------------- If I write in this way, the db2 prep it succeeds to compile without errors: [quote] ... EXEC SQL BEGIN DECLARE SECTION END-EXEC. 01 Program-pass-fields. 05 Firstnme PIC X(12). * 01 Firstnme PIC X(12). EXEC SQL END DECLARE SECTION END-EXEC. ... [/quote] but thus making the exe that I obtain it sends in crash the program ---------------------------------------------------------------- So "begin/end declare" is required. Some other precompilers dont have such limitation. I have the same problem with OC/C*T with DB2: The programs allways crashes. I dont have time now to investigate further but I suspect that could be some string not terminated by x'00' send from database server. About your job objetive: From your messages I guess you expect a job in a IBM Mainframe centric shop. AFAIK in such installations they use COBOL + CICS. In that case I suggest you get a copy of "Murach's CICS for the COBOL Programmer". But dont expect a Senior position since people still doing COBOL + CICS have at least 10 or more years of experience. BTW, where you live? Regards. ---------------------------------------------------------------- I live in Italy to Turin. It would appeal to me to work in the data processing center of a bank, initially like cobol programmer. ---------------------------------------------------------------- Subject: Validation I am trying to write up some code that will validate some user-entered data. The problem that I am encountering is that the user should enter a number to choose an option from a menu; but I want to see to it that if he or she enters a letter or something invalid that that paragraph just loops until he enters a correct option. Does anyone have any clue as to how this can be done? I tried letting the user enter data into an alphanumeric field, then I used the IF . . . NOT NUMERIC keywords to type the data, but that doesn't seem to be working. Any ideas? ---------------------------------------------------------------- What do you mean with "it doesn't seem to be working"? Should do. I'd use something like one one these samples [code]77 inp-var pic x. [...] display 'Enter some number' end-display perform with test after until inp-var numeric accept inp-var end-accept end-perform[/code][code]77 inp-var pic x. [...] display 'Enter some number' end-display perform with test after until inp-var >= '0' and inp-var <= '9' accept inp-var end-accept end-perform[/code][code]01 inp-var pic x. 88 inp-var-valid values '0' thru '9'. [...] display 'Enter some number' end-display perform with test after until inp-var-valid accept inp-var end-accept end-perform[/code] human ---------------------------------------------------------------- I just wrote a test program to see if this was working. What I wrote was this: [code] IDENTIFICATION DIVISION. PROGRAM-ID. NUM. DATA DIVISION. WORKING-STORAGE SECTION. 77 WS-TYPE PIC XX VALUE SPACES. PROCEDURE DIVISION. 000-NUM. DISPLAY "Enter stuff.". ACCEPT WS-TYPE END-ACCEPT. IF WS-TYPE NUMERIC DISPLAY "Numeric" ELSE DISPLAY "Not Numeric" END-IF. STOP RUN. [/code] I compiled it and ran the program and when I entered the number 3, the output was : Not Numeric . . . so what am I doing wrong? The output of the cobc --version command is: cobc (OpenCOBOL) 1.1.0 Built Jul 27 2009 03:03:22 Packaged Mon Aug 11 11:27:01 CEST 2008 Copyright (C) 2001-2008 Keisuke Nishida / Roger While and am running 2.6.32.21-168 on Fedora. ---------------------------------------------------------------- As said before: this only works if every part of the var is numeric. You defined a "PIC XX", therefore after entering "3" the var is "3 " and the space isn't numeric. You can either switch the var to "PIC X" or translate it with something like [code]if var (2:1) = space move var (1:1) to var (2:1) move 0 to var (1:1) end-if[/code] human ---------------------------------------------------------------- Ok, that was dumb, I didn't think of the non-numeric part of the field. Thanks a bunch; that worked. :-D ---------------------------------------------------------------- In the future it will be possible, to define own character classes like "numeric". Then you can define a class like "numeric-and-space", and it works too. For example: [code] identification division. program-id. a. environment division. configuration section. special-names. class numeric-and-space is "0" thru "9" " " . data division. working-storage section. 01 x pic x(2) value "9". procedure division. a000-steuerung section. if x is numeric display "numeric" else display "not numeric" end-if if x is numeric-and-space display "numeric-and-space" else display "not numeric-and-space" end-if . exit program. [/code] The output is: [code]not numeric numeric-and-space [/code] ---------------------------------------------------------------- OK, thanks, that will be really useful. I do this kind of validation a lot in my programs. ---------------------------------------------------------------- Subject: First Program in Open COBOL I just finished my first program in OpenCobol. The sourceode is available [url=http://sourceforge.net/projects/geekcode21gener/files/]here[/url] if any one is interested in using or critiquing it. Thanks a bunch to all those that assisted me. :-D ---------------------------------------------------------------- It's quite nice for your first program. Therefore you have Cob+. But you surely should place a copy of the GPL in your tar-file. For raising your Cob-level you may consider: - Use more 88 vars and set them to true via SET, not MOVE - If you have switches define them as [code]01 filler pic 9 value 0 comp-5. 88 value-init value 0. 88 value-one value 1. ...[/code] this speeds up the program (not important here as most stuff is screen i/o - but geeky) - use EVALUATE var / EVALUATE TRUE - Use SCREEN SECTION - Translating with cobc -x -W (or, if you don't have the -W switch with -Wall) and fix the warnings. I personally like the usage of SECTIONs and less jumping-around in the source by placing the stuff that performs each other together, but I think this can be seen as personal style guideline. For raising your geek- and Cob-level even more you could write a COBOL layer for your screen-io by doing that in a subprogram, giving you the possibility to use HTML/GTK/JAVA/... screen i/o later on. BTW: the geek code itself needs an urgent update human ---------------------------------------------------------------- OK, thanks for the advice. I have never used the "Screen" section before, but I will look into it. A copy of GPLv3 was in the "COPYING" file. The geek code is ancient in computer terms, and others have written better generators than this, but it covered the basic functions that I was interested in trying out . . . reading input, writing to a file, displaying data and so forth, so it was a fun first try. Was interesting, I kind of got obsessed by it and coded like mad until it was done. :P Thanks again for the advice, I will try to add it in when I polish it up some. :) ---------------------------------------------------------------- where can I download the source? TIA ---------------------------------------------------------------- The "here" in the first post is a link. human ---------------------------------------------------------------- irado-sp; In the original post, the word "here" is a link. Hard to tell, but it's a link. :) Cheers, Brian Edit: human beat me to it, it seems. Gives you a warm fuzzy feeling, doesn't it? :-) ---------------------------------------------------------------- @btiffin: Nope, actually I'd like others to reply more often. human ---------------------------------------------------------------- Actually, I was referring to the knowledge that the place can be full of keeners. Ahh, Warm. :-) And to the sentiment at hand; your efforts are greatly appreciated, human. 8-) I like to think of it as doing a thing that may cause a thing. Those things are cool. Cheers, Brian ---------------------------------------------------------------- Subject: Call OpenCOBOL programs from Vala Hi again, Just horsing around... Tectonics: [code] cobc -fimplicit-init -C ochello.cob valac callcobol.vala ochello.c -X -L/usr/local/lib -X -lcob ./callcobol [/code] [b]ochello.cob[/b] [code] OCOBOL*>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20101017 *> Purpose: Call ochello from Vala in a from.vala Class *> Tectonics: *> cobc -fimplicit-init -C ochello.cob *> valac callcobol.vala ochello.c -X -L/usr/local/lib -X -lcob *> *************************************************************** identification division. program-id. from_vala_ochello. *> *************************************************************** procedure division. display "Hello OpenCOBOL's Wonderful World!" end-display move 42 to return-code goback. end program from_vala_ochello. [/code] [b]callcobol.vala[/b] [code] /* Call OpenCOBOL from Vala */ public class from.vala { public static int main(string[] args) { stdout.printf("Result: %d\n", ochello()); return 0; } [import()] public extern static int ochello(); } [/code] ./callcobol Produces: [code] Hello OpenCOBOL's Wonderful World! Result: 42 [/code] Final executable 17K You may not need to pass the -X -L/usr/local/lib but will need the -X -lcob to link to libcob.so The trickery bits are the implicit-init and knowing that inside a from.vala class ochello() will be linked as from_vala_ochello, so we name our program-id appropriately. A cool bit is OpenCOBOL's -C option that generates C code for the valac compiler command. More fun with [b]callcobolgui.vala[/b] [code]/* Call OpenCOBOL program from Vala and show the return code on a button */ using Gtk; public class from.vala { public static int cobolcode; public static int main (string[] args) { Gtk.init (ref args); var window = new Window (WindowType.TOPLEVEL); window.title = "Invoke OpenCOBOL program and be a flashy git with the result"; window.set_default_size (300, 50); window.position = WindowPosition.CENTER; window.destroy.connect (Gtk.main_quit); cobolcode = ochello(); var button = new Button.with_label (cobolcode.to_string()); button.clicked.connect (() => { button.label = "Thanks for all the fish!"; }); window.add (button); window.show_all (); Gtk.main (); return 0; } [import()] public extern static int ochello(); } [/code] and Tectonics with [code] valac --pkg gtk+-2.0 callcobolgui.vala ochello.c -X -lcob ./callcobolgui [/code] and watch the all-pretty-like flashy gui show off a 42. [b]EVEN MORE FUN[/b] Call OpenCOBOL from a button [b]new callcobolgui.vala[/b] [code] /* Call OpenCOBOL program from Vala and show the return code on a button */ using Gtk; public class from.vala { public static int cobolcode; public static int main (string[] args) { Gtk.init (ref args); var window = new Window (WindowType.TOPLEVEL); window.title = "Invoke OpenCOBOL program and be a flashy git with the result"; window.set_default_size (300, 50); window.position = WindowPosition.CENTER; window.destroy.connect (Gtk.main_quit); cobolcode = ochello(); var button = new Button.with_label (cobolcode.to_string()); button.clicked.connect (() => { button.label = "Thanks for all the fish!"; fishy(); }); window.add (button); window.show_all (); Gtk.main (); return 0; } [import()] public extern static int ochello(); public extern static int fishy(); } [/code] along with [b]ochellogui.cob[/b] [code] OCOBOL*>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20101017 *> Purpose: Call ochello from Vala in a from.vala Class *> Tectonics: *> cobc -fimplicit-init -C ochellogui.cob *> valac --pkg gtk+2.0 callcobolgui.vala ochellogui.c -X -lcob *> *************************************************************** identification division. program-id. from_vala_ochello. procedure division. display "Hello OpenCOBOL's Wonderful World!" end-display move 42 to return-code goback. end program from_vala_ochello. *> *************************************************************** *> *************************************************************** program-id. from_vala_fishy. procedure division. display "We really do mean, thanks for all the fish!" end-display goback. end program from_vala_fishy. [/code] And you get to watch [code] Hello OpenCOBOL's Wonderful World! We really do mean, thanks for all the fish! We really do mean, thanks for all the fish! We really do mean, thanks for all the fish! We really do mean, thanks for all the fish! We really do mean, thanks for all the fish! We really do mean, thanks for all the fish! [/code] as you click on the button. 22K executable. This really is a wonderful world. :-) The connect could be directly to fishy as [i]button.clicked.connect(fishy)[/i] but then the import of fishy has to be return type [b]void[/b]. That'll trash the run-time stack until we get the OpenCOBOL that supports RETURNING NULL out in the wild. Ok sorry, one more. [b]Connect some COBOL to a timer[/b]. The date starts out as YYYYMMDDhhmmsscc-tzon (down to hundredths of a second) [code] OCOBOL*>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20101017 *> Purpose: Call ochello from Vala in a from.vala Class *> Tectonics: *> cobc -fimplicit-init -C ochellogui.cob *> valac --pkg gtk+-2.0 callcobolgui.vala ochellogui.c -X -lcob *> *************************************************************** identification division. program-id. from_vala_ochello. procedure division. display "Hello OpenCOBOL's Wonderful World!" end-display move 42 to return-code goback. end program from_vala_ochello. *> *************************************************************** *> *************************************************************** program-id. from_vala_fishy. procedure division. display "We really do mean, thanks for all the fish!" end-display goback. end program from_vala_fishy. *> *************************************************************** *> *************************************************************** program-id. from_vala_datey. data division. working-storage section. 01 editted-date pic XXXX/XX/XXBXX/XX/XXXXXXX/XX. procedure division. move function current-date to editted-date inspect editted-date replacing all "/" by ":" after initial space display editted-date end-display goback. end program from_vala_datey. [/code] The TimeoutSource is set to fire every 50 milliseconds. [i]And in the capture it seems the first couple fired a little early, fair with an unpredictable non realtime os, so ... don't be running any LHC experiments with this level of code just yet.[/i] [code] /* Call OpenCOBOL program from Vala and show the return code on a button */ using Gtk; public class from.vala { public static int cobolcode; public static int main (string[] args) { Gtk.init (ref args); var time = new TimeoutSource(50); var window = new Window (WindowType.TOPLEVEL); window.title = "Invoke OpenCOBOL program and be a flashy git with the result"; window.set_default_size (300, 50); window.position = WindowPosition.CENTER; window.destroy.connect (Gtk.main_quit); cobolcode = ochello(); var button = new Button.with_label (cobolcode.to_string()); button.clicked.connect (() => { button.label = "Thanks for all the fish!"; stdout.printf("%d\n", fishy()); }); time.set_callback(() => { datey(); return true; }); time.attach(null); window.add (button); window.show_all (); Gtk.main (); return 0; } [import()] public extern static int ochello(); public extern static int fishy(); public extern static int datey(); } [/code] Now we get [code] $ ./callcobolgui Hello OpenCOBOL's Wonderful World! 2010/10/17 12:36:2452-04:00 2010/10/17 12:36:2456-04:00 2010/10/17 12:36:2461-04:00 2010/10/17 12:36:2465-04:00 2010/10/17 12:36:2470-04:00 2010/10/17 12:36:2475-04:00 2010/10/17 12:36:2480-04:00 2010/10/17 12:36:2485-04:00 2010/10/17 12:36:2490-04:00 2010/10/17 12:36:2495-04:00 We really do mean, thanks for all the fish! 0 2010/10/17 12:36:2500-04:00 2010/10/17 12:36:2505-04:00 2010/10/17 12:36:2510-04:00 2010/10/17 12:36:2515-04:00 2010/10/17 12:36:2520-04:00 2010/10/17 12:36:2525-04:00 2010/10/17 12:36:2530-04:00 2010/10/17 12:36:2535-04:00 2010/10/17 12:36:2540-04:00 2010/10/17 12:36:2545-04:00 2010/10/17 12:36:2550-04:00 2010/10/17 12:36:2555-04:00 $ [/code] So, being old, I got the mouse to the button and then the close X in [i]just[/i] over 1 second. ;-) Cheers, Brian ---------------------------------------------------------------- You are aware that you missed the most important stuff: Passing Linkage section (for example 2 edits with fixed length (one of it being a mulitline edit), two checkboxes, an option group with at least 2 option fileds and 4 buttons that pass different codes and all edits to the same program, maybe with additional keylistener sample, let's say give ENTER and ESC to the program, too). Can you come up with a sample for that, too? human ---------------------------------------------------------------- Sure. Well, a lazy first cut... In real life there would be a [i]just a little[/i] more safety code. This may well be hacky, as I just kinda guessed at what syntax to use. Which seems to work nicely. Worries: Vala strings are unicode, so I'm cheating a little. There is more to study on Vala [b]in[/b] and [b]out[/b] parameter passing modifiers. [code] /* Call OpenCOBOL program from Vala and show the return code on a button */ using Gtk; public class from.vala { public static int cobolcode; public static int main (string[] args) { Gtk.init (ref args); var time = new TimeoutSource(50); var window = new Window (WindowType.TOPLEVEL); window.title = "Invoke OpenCOBOL program and be a flashy git with the result"; window.set_default_size (300, 50); window.position = WindowPosition.CENTER; window.destroy.connect (Gtk.main_quit); cobolcode = ochello(); var button = new Button.with_label (cobolcode.to_string()); button.clicked.connect (() => { button.label = "Thanks for all the fish!"; stdout.printf("%d\n", fishy()); }); time.set_callback(() => { var t = Time.local(time_t()); string fromvala = "From vala string type + time to_string: " + t.to_string(); string fromcobol = "xxxx/xx/xxbxx/xx/xxxxxxx/xx"; stdout.printf("Vala fromcobol string was : %s\n", fromcobol); datey(fromvala, fromcobol); stdout.printf("Vala fromcobol string set to: %s\n", fromcobol); return true; }); time.attach(null); window.add (button); window.show_all (); Gtk.main (); return 0; } [import()] public extern static int ochello(); public extern static int fishy(); public extern static int datey(string arg1, string arg2); } [/code] [code] OCOBOL*>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20101017 *> Purpose: Call ochello from Vala in a from.vala Class *> Tectonics: *> cobc -fimplicit-init -C ochellogui.cob *> valac --pkg gtk+-2.0 callcobolgui.vala ochellogui.c -X -lcob *> *************************************************************** identification division. program-id. from_vala_ochello. procedure division. display "Hello OpenCOBOL's Wonderful World!" end-display move 42 to return-code goback. end program from_vala_ochello. *> *************************************************************** *> *************************************************************** program-id. from_vala_fishy. procedure division. display "We really do mean, thanks for all the fish!" end-display goback. end program from_vala_fishy. *> *************************************************************** *> *************************************************************** program-id. from_vala_datey. data division. working-storage section. 01 editted-date pic xxxx/xx/xxbxx/xx/xxxxxxx/xx. linkage section. 01 datafromvala pic x(60). 01 datafromcobol pic x(27). procedure division using datafromvala datafromcobol. move function current-date to editted-date inspect editted-date replacing all "/" by ":" after initial space display editted-date end-display display datafromvala end-display move editted-date to datafromcobol goback. end program from_vala_datey. [/code] Produces [code] ... Vala fromcobol string was : xxxx/xx/xxbxx/xx/xxxxxxx/xx 2010/10/17 18:19:5598-04:00 From vala string type + time to_string: 2010-10-17 18:19:55 Vala fromcobol string set to: 2010/10/17 18:19:5598-04:00 Vala fromcobol string was : xxxx/xx/xxbxx/xx/xxxxxxx/xx 2010/10/17 18:19:5603-04:00 From vala string type + time to_string: 2010-10-17 18:19:56 Vala fromcobol string set to: 2010/10/17 18:19:5603-04:00 ... [/code] while I raced to click button "42" and close the window... To whomever feels like digging in, there will be techniques and safety mechanisms to learn, but this combination of C, Vala, Genie and OpenCOBOL seems to me to be [b]da bomb![/b] at least in terms of feeling a giddy sense of limitlessness while having way too much fun. :-) Cheers, Brian ---------------------------------------------------------------- Hi I installed the (nice !) vala compiler on a WINDOWS XP machine, then I wrote and compiled a simple vala gui program: [code] using Gtk; int main (string[] args) { Gtk.init (ref args); var window = new Window (); window.title = "First GTK+ Program"; window.set_default_size (300, 50); window.position = WindowPosition.CENTER; window.destroy.connect (Gtk.main_quit); var button = new Button.with_label ("Click me!"); button.clicked.connect (() => { button.label = "Thank you"; }); window.add (button); window.show_all (); Gtk.main (); return 0; } [/code] and I compiled it succesfully with: valac --pkg gtk+-2.0 gui.vala command after I wanted to compiled a cobol "C" generated file valac --pkg gtk+-2.0 gui.vala test.c But whent I try to compile (adding a test.c) that simple does a cobol 'hello' display.. he shows me(obviously) that he cannot C:/VALA-0~1.5/testc:13:20: libcob.h: No such file or directory (load the .h file). What's the include directive for VALAC ? ps. I already tried "--includedire=C:\opencobol\include thanks for your feedback.. Federico ---------------------------------------------------------------- Hi I installed the (nice !) vala compiler on a WINDOWS XP machine, then I wrote and compiled a simple vala gui program: [code] using Gtk; int main (string[] args) { Gtk.init (ref args); var window = new Window (); window.title = "First GTK+ Program"; window.set_default_size (300, 50); window.position = WindowPosition.CENTER; window.destroy.connect (Gtk.main_quit); var button = new Button.with_label ("Click me!"); button.clicked.connect (() => { button.label = "Thank you"; }); window.add (button); window.show_all (); Gtk.main (); return 0; } [/code] and I compiled it succesfully with: valac --pkg gtk+-2.0 gui.vala command after I wanted to compiled a cobol "C" generated file valac --pkg gtk+-2.0 gui.vala test.c But whent I try to compile (adding a test.c) that simple does a cobol 'hello' display.. he shows me(obviously) that he cannot C:/VALA-0~1.5/testc:13:20: libcob.h: No such file or directory (load the .h file). What's the include directive for VALAC ? ps. I already tried "--includedir=C:\opencobol\include thanks for your feedback.. Federico ---------------------------------------------------------------- First, try looking at -X compiler option. It'll allow you to pass args to the C compiler; ala -X '-I/usr/opencobol/include' But I'm not sure what CC you are using, it won't be /usr/opencobol/include, but it [i]might[/i] be the -I CC option, or something similar. Plus you'll need to make sure you use [b]-fimplicit-init[/b] when you [b]cobc -C[/b] or you'll have to call cob_init explicitly. You'll likely end up having to pass a [b]-l cob[/b] option as another valac -X argument sequence. Vala really aims to have a .vapi file for headers and linkage. I haven't figured out the syntax (umm, haven't not read it in detail) yet, but for full on Vala integration, that (a .vapi file) would be the way to go. Cheers, Brian ---------------------------------------------------------------- I added the library using the -X features and I ran without issuing the missing .h include, but after arrived other internal reference error. I can suppose that the Windows xp platform is (as always) not mature to use this package without doing me crazy... :-) However I am continuing to evaluate vala that is really a nice object. I am becoming to think that it could be the best way to write a gui for opencobol. The link problems could be solved with other (mingw or cywin shell...) but the goal of the test is: 1) write a basic gui from vala (precticable) 2) connect the event to a cobol (static if link solved) or dynamic call 3) using external data definition for data link or at least use a xml data file for the link between vala & oc. Working ONLY on ubuntu I am sure I won't have this link errors but since I am a windows user I would like continue to doing the test in the windows environment. Federico ---------------------------------------------------------------- I added the library using the -X features and I ran without issuing the missing .h include, but after arrived other internal reference error. I can suppose that the Windows xp platform is (as always) not mature to use this package without doing me crazy... :-) However I am continuing to evaluate vala that is really a nice object. I am becoming to think that it could be the best way to write a gui for opencobol. The link problems could be solved with other (mingw or cywin shell...) but the goal of the test is: 1) write a basic gui from vala (precticable) 2) connect the event to a cobol (static if link solved) or dynamic call 3) using external data definition for data link or at least use a xml data file for the link between vala & oc. Working ONLY on ubuntu I am sure I won't have this link errors but since I am a windows user I would like continue to doing the test in the windows environment. Federico ---------------------------------------------------------------- Ahh, so much better forum access. Worth trying to respond more now. :-) Yeah, Federico, if you are up for it; we could try and pull off a vapi file from include/libcob/common.h. I think it could make for a sweet system. Vala/Genie to GObject land, with libraries a-plenty, and gui, and [i]things[/i] all in a nice sane interface. If you get the itch, drop me a note. I'll try and help (but unlikely to initiate for the foreseeable future). Cheers, Brian ---------------------------------------------------------------- Ok, Just curious, are there any technical matter available on Vala/GTK to help me with the following? :-? Basically, what I would like to do is create a simple framework [and the utility] to read an existing screen definition, in which then build the necessary generic Vala code to handle various attributes, input fields, & events of the GUI interface. I would then like the Vala code to perform the initial field type validation [like checking rather or not the user enters numeric data in a numeric field, etc.] and upon events received such as the enter key or function keys press, then dynamically call Cobol programs as specified in the screen definitions. My intent, with this framework, is to so degree, port over existing Cobol/CICS programs. ---------------------------------------------------------------- I found some interesting documents and tools about GTK, http://wingtk.sourceforge.net/ Federico ---------------------------------------------------------------- Subject: Connect DB2 EXpress-C and OpenCOBOL 1.1 Someone is successful to connect a database DB2 (Express-C on Windows XP) with OpenCOBOL 1.1 on Windows XP? If yes, you can be thus kind to indicate to me like? ---------------------------------------------------------------- You already have a topic open about that. If you have any problems open - answer there. human ---------------------------------------------------------------- you have reason human, me are shrewed to have too much wrong late. If you think opportune, you can move it on the old one topic? ---------------------------------------------------------------- I don't have any mod rights in this forum. This will only change after update of this board (I guess it's still some months). Just go on answering my last suggestions in the old topic. And I will see if I can help you. human ---------------------------------------------------------------- The argument continues in the following topic: "Compiler example connection DB2 Exp" ---------------------------------------------------------------- Subject: Calling a C function which returns some value? I have the crazy idea of do some Firebird stuff calling C API from OC. So, it is possible from OC to call a C function which returns some value? Regards. ---------------------------------------------------------------- You have the params where you can put values in and (if it's and int you return in C) you should be able to do get it with something like [code]CALL 'myfunc' USING param-1 param-2 END-CALL IF RETURN-CODE NOT = 0 PERFORM stuff END-IF[/code]or [code]CALL 'myfunc' USING param-1 param-2 RETURNING cretcode END-IF EVALUATE cretcode WHEN 0 PERFORM stuff WHEN 1 MOVE cretcode TO somevar PERFORM stuff2 END-EVALUATE[/code] At least this is what I'd try... human ---------------------------------------------------------------- Thanks. I was confused because I take a look at the c code generated by the compiler but now that I have called a function inside dll I think known how to do that. Regards. ---------------------------------------------------------------- ssamayoa; The FAQ is loaded with examples of this. Start at section 5.10 http://opencobol.add1tocobol.com/#does-opencobol-support-message-queues and then read through some of the others to see the various ways of getting data into and out of C code. Be aware: The Feb 09 1.1 pre-release does NOT properly handle [b]void[/b] return calls. cobc expects a value on the stack. That is being fixed, and we'll soon have RETURNING NULL support, but in the meanwhile you have to write a small wrapper layer of C that calls the void and returns a 0 or some other suitable value for cobc. In the [i]what does the future hold[/i] department: I've fallen for a language called Vala. http://live.gnome.org/Vala It's C on steroids. Well, not really, it's the C application binary interface on steroids. Plus you get a compilable version of a Python like language, Genie, built in. http://live.gnome.org/Genie All the code pumped out by valac is directly callable from OpenCOBOL (using some very predictable linker names). GTK+ GUIs with ease. Webkit, Poppler PDF, GStreamer, and the absolute plethora of Gnome toolkits being built up. If all goes to plan, I'll try and pester some Vala people in order to get VAPI files figured out and publish an ease of use layer for Vala and OpenCOBOL integrations. On the mythical [i]someday soon[/i]. Cheers, Brian ---------------------------------------------------------------- Subject: How to create a compile listing from cobc I have just successfully installed OpenCOBOL on Windows Vista and was able to compile the 2 programs that I found in the Windows Installation Guide (very useful and good guide) And I am trying to compile programs I have written using MF Cobol 4.5 and got some errors. How can I get a compile listing of a program using cobc? What are the directives? In the Installation guide it is mentioned that "cobc -x pgmname.cbl > errlist.lst 2>%1" creates errlist.lst but it only contains the errors. How can I get the full compile list. Thanks for sharing.. ---------------------------------------------------------------- Welcome to OC and this forum! As I don't want to hide all the nice options from you: just do cobc --help. I think you'll find the correct one. human ---------------------------------------------------------------- Thanks for welcoming me and for your reply Human! I have downloaded the OpenCOBOL 1.1 Programmer's Guide but did not find the -t entry on page 7-1. But thanks to your input I found out how to do and I managed to get a compile list when entering cobc --help from OpenCOBOL 1.1 using CygWin. But still the errors are not printed in the compile list, while this is what I actually needed. Any ideas on how to print the errors and which line causes it? [quote] human wrote: Welcome to OC and this forum! As I don't want to hide all the nice options from you: just do cobc --help. I think you'll find the correct one. human[/quote] ---------------------------------------------------------------- There is no such option available in OpenCOBOL 1.1. The listing is just the pre-parsed input from all files that cobc uses in a second step to do the translation. But from cobc compiler messages you should be able to find the error line, aren't you? If somebody likes to, he could write a script that includes the error messages of cobc into that list file. human ---------------------------------------------------------------- Take a look at http://opencobol.add1tocobol.com/#does-opencobol-work-with-make and see if you can gleam any clues as to how to get errors into a file that can be used with most programmer's editor [b]quickfix[/b] mode with Windows. The entries I was thinking about are the [i]hack extensions[/i] .q and .qw make rules. cobc error message are printed to stderr, these can be captured. They are also in a file:line form, perfect for vim's quickfix mode. Most of the information and how-tos I post here are for GNU/Linux, but it can [i]usually[/i] be mashed around to work with Windows. Cheers, Brian ---------------------------------------------------------------- I did the same with PSPad (a windows editor) by setting a "compile_oc.bat" that does [code]cobc -W -debug %1 1>cobc.err 2>cobc.log[/code] You can tell PSPad where compiler output files can be found, it links everything to the correct COBOL line. human ---------------------------------------------------------------- Subject: Embedded SQL standard? There is some starndard about embedded SQL inside Cobol programs? Each database uses its own set of statements and I was wondering if ther is some standard (maybe from XOpen)? Regards. ---------------------------------------------------------------- May be this? X/Open CAE Specification Data Management Structured Query Language (SQL), Version 2 ---------------------------------------------------------------- Subject: C equivalents for OC data items Hi, what are the equivalents of below Open Cobol variables in C language ( I'm using GCC on Ubuntu 10.04 - x64) PIC S9(7) COMP-3. PIC S9(8) COMP or PIC S9(8) COMP-5. Having browse through OC Programmer's Guide, came to know options for passing data to C programs. I can't use BINARY-SHORT & BINARY-LONG as per my site standards. Any solution ? ---------------------------------------------------------------- Really dont understand what you mean. Bu anyway, check for "binary-size" in page 7-11 of the manual. Regards. ---------------------------------------------------------------- I forgot to mention that I use -std=mvs with cobc ---------------------------------------------------------------- It uses mvs.conf file localted at /config/mvs.conf which has the following content: [code] # COBOL compiler configuration -*- sh -*- include "default.conf" name: "IBM COBOL for MVS & VM" assign-clause: ibm pretty-display: no complex-odo: yes indirect-redefines: yes binary-size: 2-4-8 binary-truncate: no perform-osvs: yes sticky-linkage: yes top-level-occurs-clause: ok eject-statement: ok entry-statement: ok relax-level-hierarchy: yes not-reserved: CYCLE not-reserved: NORMAL [/code] ---------------------------------------------------------------- Yeah! I know the mvs.conf file. Still, I'm not getting the solution. Just provide me the equivalent C data types. ---------------------------------------------------------------- If you are C developer check the OC sources. ---------------------------------------------------------------- I personally would use -debug -C to compile a program that has these types in a CALL USING and look in the c-source files what type is generated for them. human ---------------------------------------------------------------- Hi human, I used your method to see generated types. For example 9(7) COMP-3 it has generated below code, which I could not figure out what is the exact C type; I tried with short, unsigned short, int, unsigned int and long, but unable to see the correct value in C program. [code] static unsigned char b_7[4] __attribute__((aligned)); /* WS-TEST-COMP3 */ static const cob_field_attr a_1 = {18, 7, 0, 0, NULL}; static cob_field f_7 = {4, b_7, &a_1}; /* WS-TEST-COMP3 */ [/code] ---------------------------------------------------------------- Ahh, the beauty of sources... You have [code] static const cob_field_attr a_1 = {18, 7, 0, 0, NULL}; [/code] in libcob/common.h [code] /* Field attribute structure */ typedef struct { unsigned short type; /* Field type */ unsigned short digits; /* Digit count */ signed short scale; /* Field scale */ unsigned short flags; /* Field flags */ const char *pic; /* Pointer to picture string */ } cob_field_attr; [/code] so the type is 18. in cobc/tree.h [code] /* Field types */ enum cb_usage { CB_USAGE_BINARY, /* 0 */ CB_USAGE_BIT, /* 1 */ CB_USAGE_COMP_5, /* 2 */ CB_USAGE_COMP_X, /* 3 */ CB_USAGE_DISPLAY, /* 4 */ CB_USAGE_FLOAT, /* 5 */ CB_USAGE_DOUBLE, /* 6 */ CB_USAGE_INDEX, /* 7 */ CB_USAGE_NATIONAL, /* 8 */ CB_USAGE_OBJECT, /* 9 */ CB_USAGE_PACKED, /* 10 */ CB_USAGE_POINTER, /* 11 */ CB_USAGE_PROGRAM, /* 12 */ CB_USAGE_LENGTH, /* 13 */ CB_USAGE_PROGRAM_POINTER, /* 14 */ CB_USAGE_UNSIGNED_CHAR, /* 15 */ CB_USAGE_SIGNED_CHAR, /* 16 */ CB_USAGE_UNSIGNED_SHORT, /* 17 */ CB_USAGE_SIGNED_SHORT, /* 18 */ CB_USAGE_UNSIGNED_INT, /* 19 */ CB_USAGE_SIGNED_INT, /* 20 */ CB_USAGE_UNSIGNED_LONG, /* 21 */ CB_USAGE_SIGNED_LONG, /* 22 */ CB_USAGE_COMP_6 /* 23 */ }; [/code] So you have a field that will be treated as a SIGNED SHORT for the s9(7) comp-3. [i]Umm, I'm pretty sure. 0.99%, ;) no, more like 97ish.[/i] Would need a few tests. And perhaps clarification if you compiled s9 or just 9? Cheers, Brian ---------------------------------------------------------------- Hi Brian, Thank you verymuch for sharing the inner workings of OC. However I could not get result I was expecting. Let me post with my simple examples. cobc -x TESTCOB.cbl [code] IDENTIFICATION DIVISION. PROGRAM-ID. TESTCOB. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-VARS. 05 WS-COMP3-S-1 PIC S9(7) COMP-3. 05 WS-COMP3-US-1 PIC 9(7) COMP-3. PROCEDURE DIVISION. MOVE 111 TO WS-COMP3-S-1. MOVE 222 TO WS-COMP3-US-1. CALL 'TESTC' USING WS-VARS. STOP RUN. [/code] TEST.c [code] /* Compile: gcc -Wall -fPIC -c TESTC.c gcc -shared -o TESTC.so TESTC.o */ #include struct __attribute__ ((packed)) _WS_VARS { short WS_COMP3_S_1; unsigned short WS_COMP3_US_1; }; int TESTC (struct _WS_VARS *WS_VARS) { printf("WS_COMP3_S_1 : %d \n", WS_VARS->WS_COMP3_S_1); printf("WS_COMP3_US_1 : %d \n", WS_VARS->WS_COMP3_US_1); return 1; } [/code] ---------------------------------------------------------------- Ok, so I looked. http://www.3480-3590-data-conversion.com/article-packed-fields.html s9(7) comp-3 is a 4 byte field. And with comp-3 you'll need to do some fancy unpacking on the C side to get what native chip storage form would be. Going from s9(7) to s9(3) gives a 16-bit field, but it will still require proper unpacking. I'm not sure what your requirements are, but comp-5 will pass data to and fro C in native form [code] IDENTIFICATION DIVISION. PROGRAM-ID. cstruct. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-VARS. 05 WS-COMP3-S-1 SYNC PIC S9(3) COMP-5. 05 WS-COMP3-US-1 SYNC PIC 9(3) COMP-5. PROCEDURE DIVISION. display function byte-length(ws-vars) display function byte-length(ws-comp3-s-1) display function byte-length(ws-comp3-us-1) MOVE 111 TO WS-COMP3-S-1. MOVE 222 TO WS-COMP3-US-1. CALL 'TESTC' USING WS-VARS. STOP RUN. [/code] and [code]/* Compile: gcc -Wall -fPIC -c TESTC.c gcc -shared -o TESTC.so TESTC.o */ #include struct __attribute__ ((packed)) _WS_VARS { short WS_COMP3_S_1; unsigned short WS_COMP3_US_1; }; int TESTC (struct _WS_VARS *WS_VARS) { printf("Sizeof %d\n", sizeof *WS_VARS); printf("WS_COMP3_S_1 : %d \n", WS_VARS->WS_COMP3_S_1); printf("WS_COMP3_US_1 : %d \n", WS_VARS->WS_COMP3_US_1); return 1; } [/code] giving [code] [cobol]$ cobc -x cstruct.cob test.c [cobol]$ ./cstruct 00000004 00000002 00000002 Sizeof 4 WS_COMP3_S_1 : 111 WS_COMP3_US_1 : 222 [/code] Cheating on the fieldnames, being comp-5 and all. Cheers, Brian ---------------------------------------------------------------- Thank you Brian, Now I understood, COMP-5 declaration will do for my job. I have written small C function to convert COMP-3 item to integer variable, just for the reference below is the code. [code] int PackedToDecimal (unsigned char *buffer, short bufferlen) { int result, iSub, jSub, kSub; unsigned char byte, byte2; result = 0; kSub = bufferlen; for (iSub = 0; iSub < bufferlen; iSub++) { byte = buffer[iSub]; if (iSub == bufferlen -1) jSub = byte >> 4; else jSub = (byte & 0x0F) + ((byte >> 4) * 10); if (kSub == 4) result += jSub * 100000; else if (kSub == 3) result += jSub * 1000; else if (kSub == 2) result += jSub * 10; else result += jSub; kSub--; } byte2 = (byte & 0x0F); if (byte2 == 0x0D) result = 0 - result; return result; } [/code] I have to write a DecimalToPacked() function to put an integer variable in C into OC COMP-3 variable. This shall suffice my requirement. Thanks for your kind help. ---------------------------------------------------------------- Absolutely. And thanks for the code snippet. I'm a fan of doing things that cause other things. If I could ask your permission, I's like to post your code in a What the hell is computational-3? faq entry. Cheers, Brian ---------------------------------------------------------------- I will be happy to contribute to OC Faq, you can use the code snippet. ---------------------------------------------------------------- And if you go a little bit further, you can try this direction :-) That's for SIGNED COMP-3 packed.h [code] #ifdef _MSC_VER #pragma once #endif #include #include #include #include void comp3asgn(char * value, int M, int N, const char * vvalue, int P, int Q); void comp3plus(char * value, int M, int N, long long v); void comp3minus(char * value, int M, int N, long long v); template class COMP3 { public: char value[(M+N+2)/2]; // constructors/copy/destructor COMP3(); template COMP3 & operator=(const COMP3 & rhs); template COMP3(const COMP3 & rhs) { *this = rhs; }; ~COMP3() {} template COMP3(const C & c) { *this = c; } // operators COMP3 & operator=(const long long & i); COMP3 & operator=(const int & i) { return this->operator=((long long) i); } COMP3 & operator=(const double & d); COMP3 & operator+=(const long long & i); COMP3 & operator+=(const int & i) { return this->operator+=((long long) i); } COMP3 & operator-=(const long long & i); COMP3 & operator-=(const int & i) { return this->operator-=((long long) i); } COMP3 operator+(const long long & i) const { COMP3 r = *this; r += i; return r; } COMP3 operator+(const int & i) const { COMP3 r = *this; r += i; return r; } COMP3 operator-(const long long & i) const { COMP3 r = *this; r -= i; return r; } COMP3 operator-(const int & i) const { COMP3 r = *this; r -= i; return r; } COMP3 operator-() const { COMP3 r = *this; bool neg = (value[sizeof(value)-1] & 0x0F) == 0x0D; r.value[sizeof(value)-1] &= 0xF0; r.value[sizeof(value)-1] |= neg ? 0x0C : 0x0D; return r; } operator long long(); // functions void print(FILE * f); void print() { print(stdout);} }; template COMP3 operator+(const LHS & lhs, const COMP3 & rhs) { return rhs + lhs; } template COMP3 & COMP3::operator=(const long long & n) { long long v = n; char sign; if(v < 0) { v = -v; sign = 0x0D; } else { sign = 0x0C; } int nd = sizeof(value) * 2 - M - 1; char buf[((M+N+2)/2)*2]; memset(buf, 0, sizeof(buf)); buf[sizeof(buf)-1] = sign; char * p = buf + nd - 1; if(((N+M+1) & 1) != 0) --nd; while(nd > 0) { *p = (char)(v % 10); v /= 10; --nd; --p; } p = value; for(int i = 0; i < sizeof(buf); i += 2) { *p = (char)((buf[i] << 4) | buf[i+1]); ++p; } return *this; } template COMP3::operator long long() { long long v = 0; char * p = value; int nd = sizeof(value) * 2 - M - 1; for(int i = 0; i < nd; ++i) { v *= 10; if((i & 1) == 0) { v += (*p >> 4) & 0x0F; } else { v += *p & 0x0F; ++p; } } return v; } template template COMP3 & COMP3::operator=(const COMP3 & v) { if(M == P && N == Q) { if((void *)this != (void *)&v) memcpy(value, v.value, sizeof(value)); return *this; } comp3asgn(value, M, N, v.value, P, Q); return *this; } template COMP3 & COMP3::operator=(const double & d) { double v = d * pow(10.0, M); v = floor(v + 0.5); char sign; if(v < 0) { v = -v; sign = 0x0D; } else { sign = 0x0C; } int nd = sizeof(value) * 2 - 1; char buf[((M+N+2)/2)*2]; memset(buf, 0, sizeof(buf)); buf[sizeof(buf)-1] = sign; char * p = buf + nd - 1; if(((N+M+1) & 1) != 0) --nd; while(nd > 0) { *p = (char)(((long long) v) % 10); v /= 10; --nd; --p; } p = value; for(int i = 0; i < sizeof(buf); i += 2) { *p = (char)((buf[i] << 4) | buf[i+1]); ++p; } return *this; } template COMP3 & COMP3::operator+=(const long long & n) { if(n == 0) return *this; long long v = n; bool neg = (value[sizeof(value)-1] & 0x0F) == 0x0D; if(v < 0 && neg) { v = -v; neg = false; } if(v < 0 || neg) { // sub comp3minus(value, M, N, (v < 0) ? -v : v); return *this; } comp3plus(value, M, N, v); return *this; } template COMP3 & COMP3::operator-=(const long long & n) { if(n == 0) return *this; long long v = n; bool neg = (value[sizeof(value)-1] & 0x0F) == 0x0D; if(v < 0 && neg) { v = -v; neg = false; } if(v < 0 || neg) { // add comp3plus(value, M, N, (v < 0) ? -v : v); return *this; } comp3minus(value, M, N, v); return *this; } template void COMP3::print(FILE * f) { if((value[sizeof(value)-1] & 0x0F) == 0x0D) fprintf(f, "-"); else fprintf(f, "+"); int iend = 0; if(((N+M+1) & 1) != 0) iend = 1; int ip = 0; for(int i = 0; i < sizeof(value); ++i) { if(ip == N) fprintf(f, "."); if(i != 0 || iend == 0) { fprintf(f, "%X", (value[i] >> 4) & 0x0F); ++ip; } if(i != sizeof(value) - 1) { if(ip == N) fprintf(f, "."); fprintf(f, "%X", value[i] & 0x0F); ++ip; } } fprintf(f, "\t"); for(int i = 0; i < sizeof(value); ++i) { fprintf(f, "%02X ", value[i] & 0xFF); } fprintf(f, "\n"); } [/code] packed.cpp [code] #include #include #include #include #include "packed.h" void comp3asgn(char * value, int M, int N, const char * vvalue, int P, int Q) { int vlen = (M+N)/2 + 1; int vvlen = (P+Q)/2 + 1; memset(value, 0, vlen); value[vlen-1] = vvalue[vvlen-1] & 0x0F; int nd = vlen * 2 - M - 1; int ndv = vvlen * 2 - Q - 1; char * p = value + (nd/2); const char * q = vvalue + (ndv/2); for(int i = nd, j = ndv; ((i < nd + M) && (j < ndv + Q)); ++i, ++j) { if((i & 1) != 0) { if((j & 1) != 0) { *p = (char)((*p & 0xF0) | (*q & 0x0F)); ++p; ++q; } else { *p = (char)((*p & 0xF0) | ((*q >> 4) & 0x0F)); ++p; } } else { if((j & 1) != 0) { *p = (char)(*q << 4); ++q; } else { *p = (char)(*q & 0xF0); } } } p = value + ((nd-1)/2); q = vvalue + ((ndv-1)/2); int iend = 0; if(((N+M+1) & 1) != 0) iend = 1; while(nd > iend && ndv > 0) { if((nd & 1) != 0) { if((ndv & 1) != 0) { *p = (char)((*p & 0x0F) | (*q & 0xF0)); --p; --q; } else { *p = (char)((*p & 0x0F) | ((*q << 4) & 0xF0)); --p; } } else { if((ndv & 1) != 0) { *p = (char)((*q >> 4) & 0x0F); --q; } else { *p = (char)(*q & 0x0F); } } --nd; --ndv; } } void comp3plus(char * value, int M, int N, long long v) { int len = (M+N+2)/2; int nd = len * 2 - M - 1; char * p = value + ((nd-1)/2); int iend = 0; if(((N+M+1) & 1) != 0) iend = 1; int over = 0; while(nd > iend && (v != 0 || over != 0)) { int x = (int)(v % 10) + over; v /= 10; if((nd & 1) != 0) { x += ((*p >> 4) & 0x0F); if(x > 9) { over = 1; x %= 10; } else { over = 0; } *p = (char)((*p & 0x0F) | (x << 4)); --p; } else { x += (*p & 0x0F); if(x > 9) { over = 1; x %= 10; } else { over = 0; } *p = (char)((*p & 0xF0) | x); } --nd; } } void comp3minus(char * value, int M, int N, long long v) { int len = (M+N+2)/2; int nd = len * 2 - M - 1; char * p = value + ((nd-1)/2); int iend = 0; if(((N+M+1) & 1) != 0) iend = 1; int over = 0; while(nd > iend && (v != 0 || over != 0)) { int x = (int)(v % 10) + over; v /= 10; if((nd & 1) != 0) { x = ((*p >> 4) & 0x0F) - x; if(x < 0) { over = 1; x += 10; } else { over = 0; } *p = (char)((*p & 0x0F) | (x << 4)); --p; } else { x = (*p & 0x0F) - x; if(x < 0) { over = 1; x += 10; } else { over = 0; } *p = (char)((*p & 0xF0) | x); } --nd; } if(over) { // restore & change sign nd = len * 2 - 1; p = value + len - 1; if((*p & 0x0F) == 0x0D) { *p = (char)((*p & 0xF0) | 0x0C); } else { *p = (char)((*p & 0xF0) | 0x0D); } while(nd > iend) { if((nd & 1) != 0) { int x = 9 - ((*p >> 4) & 0x0F) + over; if(x > 9) { over = 1; x = 0; } else { over = 0; } *p = (char)((*p & 0x0F) | (x << 4)); --p; } else { int x = 9 - (*p & 0x0F) + over; if(x > 9) { over = 1; x = 0; } else { over = 0; } *p = (char)((*p & 0xF0) | x); } --nd; } } } [/code] Cheers. ---------------------------------------------------------------- Sorry that I didn't reply to this thread earlier. As the OP mentioned "std=MVS", i think that this is eiether development FOR an IBM mainframe or portation from one. Either way, IBM provides some very good information on COBOL/C "ILC" (Inter-language Communciation). Check out the book at: [url=http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/CEEA4180/CCONTENTS]http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/CEEA4180/CCONTENTS[/url] and look for the chapter: [quote] Chapter 4. Communicating between C and COBOL [/quote] Of particular interest/elevance to the original question is the topic, "Data Equivalents" at [url=http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/CEEA4180/4.4]http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/CEEA4180/4.4[/url] I haven't compared this to how OC works or is documented, but this should be useful for those working with IBM (mainframe) COBOL/C interactions. ---------------------------------------------------------------- Subject: to compile with 2 files cbl I have 2 files cbl: checkerr.cbl, testdb2.cbl In the testdb2.cbl call checkerr. Which cobc I must give in order to compile them ? (example: cobc -x -Icobol_a testdb2.cbl checkerr.cbl db2api.lib) ---------------------------------------------------------------- Queted from "OpenCobol Programmers Guide": 7.1.3. Compiling Executable Programs The simplest mode of compilation is to generate a single executable file from one or more OpenCOBOL source files: cobc –x prog1.cbl prog2.cbl prog3.cbl The main program must be the first program unit found in the “prog1.cbl” file. The remainder of “prog1.cbl” as well as all of “prog2.cbl” and “prog3.cbl” must be subprograms or nested subprograms. so... RTFM! :p Regards. ---------------------------------------------------------------- ... or, if you don't need a single executable file: compile every file on it's own (without -x) for obtaining a dll/so and compile only the main program with -x (and the static libs, if needed). This way you can change only the parts that have changed and don't need to recompile everything. human ---------------------------------------------------------------- thanks @human and @ssamayoa me have helped a lot ---------------------------------------------------------------- Subject: Open Cobol How to compile a 'C' code , which is a converted 'C' code from COBOL code using Open COBOL ? ---------------------------------------------------------------- As normal C program with your tool set. ---------------------------------------------------------------- The most common ways in win environments are MS VC (Express) and MinGW+gcc. In all other environments gcc is mostly used. Intel C-compiler and others work, too. If you have an environment that supports ./configure the C compiler is detected automatically, OC is build and if you compile a COBOL source with OC the binaries for the COBOL prog(s) are compiled using the C compiler automatically. human ---------------------------------------------------------------- Just so everyone knows; cobc supports .c input files and [i]does the right thing[/i]. from a transcript [code] [btiffin@home cobol]$ vi hello.c [btiffin@home cobol]$ cobc hello.c [btiffin@home cobol]$ cobcrun hello Hello C compiled with cobc, run from hello.so with cobcrun [btiffin@home cobol]$ cobc -x hello.c [btiffin@home cobol]$ ./hello Hello C compiled with cobc [/code] This ended up with [i]hello.c, hello.so and hello[/i] [b]hello.c[/b] [code] #include int main(int argc, char *argv[]) { printf("Hello C compiled with cobc\n"); return 0; } int hello(int argc, char *argv[]) { printf("Hello C compiled with cobc, run from hello.so with cobcrun\n"); return 42; } [/code] and [code] $ ls -l hello* -rwxrwxr-x. 1 btiffin btiffin 7335 Oct 26 21:49 hello -rw-rw-r--. 1 btiffin btiffin 349 Oct 27 02:43 hello.c -rwxrwxr-x. 1 btiffin btiffin 6488 Oct 27 02:43 hello.so [/code] not bad, 7K no bloat load time. And Pradipta; A nice trick is [b]cobc -v[/b]. It can be very informative as to how things are glued together. [code] [btiffin@home cobol]$ cobc -v -x hello.c Executing: gcc -c -I/usr/local/include -pipe -Wno-unused -fsigned-char -Wno-pointer-sign -o "/tmp/cob2785_0.o" "hello.c" Return status: 0 Executing: gcc -Wl,--export-dynamic -o "hello" "/tmp/cob2785_0.o" -L/usr/local/lib -lcob -lm -lgmp -lncurses -ldb -ldl Return status: 0 [/code] And one step further with the magical COB_PRE_LOAD [b]hello.c[/b] [code] #include int main(int argc, char *argv[]) { printf("Hello C compiled with cobc\n"); } int hello(int argc, char *argv[]) { printf("Hello C compiled with cobc, run from hello.so with cobcrun\n"); } int greet(int argc, char *argv[]) { printf("greet a module, compiled with cobc, run with COB_PRE_LOAD=hello cobcrun greet\n"); } [/code] with a run of [code] $ cobc hello.c $ export COB_PRE_LOAD=hello $ cobcrun greet greet a module, compiled with cobc, run with COB_PRE_LOAD=hello cobcrun greet $ unset COB_PRE_LOAD $ cobcrun greet libcob: Cannot find module 'greet' $ COB_PRE_LOAD=hello cobcrun greet greet a module, compiled with cobc, run with COB_PRE_LOAD=hello cobcrun greet [/code] OpenCOBOL really does, kick some ass. :-) Cheers, Brian [i]Umm, I started with a little C how-to, and stuck with it. These can and should mostly be program-id. and not some paren paren squiggly squiggly thingies.[/i] ---------------------------------------------------------------- Subject: Calling a subprogram I am trying to call a subprogram in a paragraph and each time I do this I get the following error: libcob: Cannot find module 'decode' The calling statement looks like this: call "decode" end-call Anybody have any ideas where I am screwing up? The compiled "decode" program is in the same directory as the calling program, btw, if that makes any difference. TIA. ---------------------------------------------------------------- 1st: Compile your programs with -debug for get some additional outputs if errors appear. 2nd: If you call a subprogram it must be a module (like the error said), I guess you may have compiled decode with -x (the exact command line for both programs would help us to help you). 3rd: If you are on a case-sensitive file system the module could be in the wrong case (it would help us to help you if you could tell us how the files are written on the file system - including the file extension). 4th: (The most common problem:) the PROGRAM-ID in decode.cbl is not "decode" (lower case), but the CALL from the other program use this lower case. human ---------------------------------------------------------------- Yes, I did compile it with the -x option. I used the -m option and this seems to have gotten rid of the error . . . I didn't think of this before, thanks. It works now. ---------------------------------------------------------------- Subject: Named Pipes on AIX I tried the cornpipe example in the forum using the OC 1.0 download from Sergey's website on AIX 5.3 using xlc 8.0. libcob: Permanent file error (STATUS = 30) File : 'corncob' The named pipe is working. I tested the example replacing ./popcorn with cat corncob. I modified the example to use CBL_OPEN_FILE, CBL_WRITE_FILE, and CBL_CLOSE_FILE. The open and close work, but the Write gets a -1 return code. Looking in fileio.c, the -1 comes from a seek. It also appears that there is a difference between an OPEN OUTPUT and the CBL_OPEN_FILE. The first uses fopen while the second uses open. Since I'm not a C programmer, I don't know what the difference is, just that I saw there was one. Is there anyone on AIX that recreate this issue? I have tried a two separate boxes and got the same error. ---------------------------------------------------------------- Sorry, I really can't on this little Fedora box, but...[b]I want someone to help you[/b]. :-) Cheers, Brian ---------------------------------------------------------------- Had somebody tested this pipe stuff with OC 1.0 already? (just to make sure it is not an OC 1.0 problem) human ---------------------------------------------------------------- [quote] the -1 comes from a seek. [/quote] Mmmmm.... fifo files shouldn't be "seeked", isnt? I did a proof of concept programs in RM/Cobol in linux for a customer of mine but using LINE SEQUENTIAL files and worked as expected. I tried the same programs with C*T (which is based on OC) but didnt worked. Which kind of file are you trying to write? Regards. ---------------------------------------------------------------- For 1.0 vs. 1.1, I compared the fileio.c code and did not see any differences for the opening and reading in the c code. The FD is SEQUENTIAL. ---------------------------------------------------------------- Subject: Installing OpenCOBOL on MacOS SnowLeopard I am trying to get OpenCOBOL installed on MacOS, and have been following the instructions found here: http://opencobol.add1tocobol.com/. Everything seemed to be going along smoothly, however when I got the step: ./configure CPPFLAGS="-I/opt/local/var/macports/software/gmp/5.0.1_0/opt/local/include/ -I/usr/local/BerkeleyDB.5.1/include/" LDFLAGS="-L/opt/local/var/macports/software/gmp/5.0.1_0/opt/local/lib -L/usr/local/BerkeleyDB.5.1/lib/" I am getting the following errors that seem to be resulting in a blank make file: checking for BDB 4.1 compatibility in db ... yes checking for dlopen in -lc... yes configure: creating ./config.status config.status: creating cob-config sed: 20: ./confstatoAlwGw/subs-3.sed: unescaped newline inside substitute pattern sed: 12: ./confstatoAlwGw/subs-2.sed: unescaped newline inside substitute pattern config.status: creating Makefile sed: 12: ./confstatoAlwGw/subs-2.sed: unescaped newline inside substitute pattern sed: 20: ./confstatoAlwGw/subs-3.sed: unescaped newline inside substitute pattern config.status: creating lib/Makefile sed: sed: 12: ./confstatoAlwGw/subs-2.sed: unescaped newline inside substitute pattern 20: ./confstatoAlwGw/subs-3.sed: unescaped newline inside substitute pattern config.status: creating libcob/Makefile sed: 12: ./confstatoAlwGw/subs-2.sed: unescaped newline inside substitute pattern sed: 20: ./confstatoAlwGw/subs-3.sed: unescaped newline inside substitute pattern config.status: creating cobc/Makefile sed: 20: ./confstatoAlwGw/subs-3.sed: unescaped newline inside substitute pattern sed: 12: ./confstatoAlwGw/subs-2.sed: unescaped newline inside substitute pattern config.status: creating bin/Makefile sed: 12: ./confstatoAlwGw/subs-2.sed: unescaped newline inside substitute pattern sed: 20: ./confstatoAlwGw/subs-3.sed: unescaped newline inside substitute pattern config.status: creating po/Makefile.in sed: 12: ./confstatoAlwGw/subs-2.sed: unescaped newline inside substitute pattern sed: 20: ./confstatoAlwGw/subs-3.sed: unescaped newline inside substitute pattern config.status: creating texi/Makefile sed: 12: ./confstatoAlwGw/subs-2.sed: unescaped newline inside substitute pattern sed: 20: ./confstatoAlwGw/subs-3.sed: unescaped newline inside substitute pattern config.status: creating config/Makefile sed: 20: ./confstatoAlwGw/subs-3.sed: unescaped newline inside substitute pattern sed: 12: ./confstatoAlwGw/subs-2.sed: unescaped newline inside substitute pattern config.status: creating tests/atlocal sed: 20: ./confstatoAlwGw/subs-3.sed: unescaped newline inside substitute pattern sed: 12: ./confstatoAlwGw/subs-2.sed: unescaped newline inside substitute pattern config.status: creating tests/Makefile sed: 12: ./confstatoAlwGw/subs-2.sed: unescaped newline inside substitute pattern sed: 20: ./confstatoAlwGw/subs-3.sed: unescaped newline inside substitute pattern config.status: creating tests/cobol85/Makefile sed: 20: ./confstatoAlwGw/subs-3.sed: unescaped newline inside substitute pattern sed: 12: ./confstatoAlwGw/subs-2.sed: unescaped newline inside substitute pattern config.status: creating config.h If anyone can provide me with some assistance I would greatly appreciate it. ---------------------------------------------------------------- Found the solution by following the instructions in this post. http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=316&forum=1#forumpost1717 ---------------------------------------------------------------- Subject: COBOL "on the rise" From a "7 languages on the rise" article. http://infoworld.com/d/developer-world/7-programming-languages-the-rise-620 Who knew? :-) Cheers, Brian ---------------------------------------------------------------- Wait a few years and build another list of languages that are in popular use. As in the past many of these languages will disappear and COBOL will still be heavily in the mix. ---------------------------------------------------------------- Subject: Quick & Dirty portable OC Installation... ...search for better way! Hello, I use the simple installation way to use OC under windows ([url=http://www.ritter.biz/de/programmieren/cobol/38-der-schnelle-weg-zur-opencobol-installation]desc click here [DE][/url]). What is your way to install OC on USB device - I hope better? thx ---------------------------------------------------------------- The problem is not the make OC portable (it has few files) but the MinGW or Visual Studio which compiles and links the intermediate C files produced by OC. Regards. ---------------------------------------------------------------- Subject: CALL-CONVENTION hi all, i am new in cobol, just wondering in opencobol, can i use CALL-CONVENTION or not? i have a code with following lines : [code] SPECIAL-NAMES. CALL-CONVENTION 0 IS WINAPI CALL-CONVENTION 74 IS WIN32API. [/code] i can't compile it, Error: Unknown system-name 'CALL-CONVENTION' any idea? Thanks ---------------------------------------------------------------- Not supported in current releases or pre-releases. Not to say it won't ever be. Cheers, Brian ---------------------------------------------------------------- Just put an asterix in column 7 for getting further. Upcoming 2.0 will compile that (but I guess it's just ignoring it). human ---------------------------------------------------------------- Subject: Feature Request; Support (ALL) table modifier in FUNCTION Roger; I was updating a few FAQ entries, and well... I'd like to pester for TABLE support in some of the Intrinsics. RANGE, PRESENT-VALUE, MIN, MAX, STANDARD-DEVIATION et-al. [code] DISPLAY FUNCTION MIN(the-table(ALL)) END-DISPLAY [/code] seems far more [i]programmable[/i] than [code] DISPLAY FUNCTION MIN( 123 456 789 012 345 678 910) END-DISPLAY [/code] which I would probably code as DISPLAY 12 END-DISPLAY [i]at the appropriate due peril[/i]. It seems to make sense to pull the arguments from a table in most real world applications, or even reasonable demos, ummm, it seems. Please, pretty please. :-) Cheers, Brian ---------------------------------------------------------------- I'll second that pretty please. I have migrated about 200,000 lines of HP COBOL to OpenCOBOL now, and one of the very few things that I have not been able to easily work around is the lack of the ALL subscript for a STANDARD DEVIATION function call :-( ---------------------------------------------------------------- Subject: Cross platform newline, how? I usually like to intersperse new lines in strings, instead of breaking a sequence up into DISPLAY and DISPLAY WITH NO ADVANCING. You may have noticed I usually use 01 newline pic x(1) value x'0a'. I rarely use Windows or Macs, and I can only guess that this doesn't work. So, going over the CHARACTERS keyword it donned on me to use something like [code] OCOBOL*>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20101031 *> Purpose: Try out SYMBOLIC CHARACTERS *> Tectonics: cobc -x figurative.cob *> Rave: OpenCOBOL is stone cold cool *> *************************************************************** identification division. program-id. figurative. environment division. configuration section. special-names. symbolic characters TAB is 10 LF is 11 CMA is 45. data division. working-storage section. 01 a-comma pic x(1) value ",". 01 lots-of-commas pic x(20). *> *************************************************************** procedure division. display "thing" TAB "tabbed thing" LF "and" TAB "another tabbed thing" LF "other" CMA " things" end-display move a-comma to lots-of-commas display "MOVE a-comma : " lots-of-commas end-display move CMA to lots-of-commas display "MOVE symbolic: " lots-of-commas end-display goback. end program figurative. [/code] which outputs [code] $ ./figuratives thing tabbed thing and another tabbed thing other, things MOVE a-comma : , MOVE symbolic: ,,,,,,,,,,,,,,,,,,,, [/code] on a posix box. So now I'm questing for more portability in something like [code] special-names. symbolic characters TAB is 10 LF is 11 or LF is 14 or LF is 14 11 (NOT LEGAL) CMA is 45. [/code] What's an easy to explain way to get CR LF for windows, newline for POSIX and the CR for Mac. As LF 14 11 isn't legal, only wishful. OR is it better to just have [code] 01 newline pic x(1) value x'0a'. 01 newline pix x(2) value x'0d0a'. [/code] for samples? Just asking; and I may just stick to lazy, err, layman, when writing up short how-to's. Cheers, Brian ---------------------------------------------------------------- [quote]I rarely use Windows or Macs, and I can only guess that this doesn't work.[/quote] Have you tried ? [code] Microsoft Windows [Version 5.2.3790] (C) Copyright 1985-2003 Microsoft Corp. G:\skatests\cobol>\open-cobol_vs2008\build_vbisam\cobenv64.cmd Setting environment for using Microsoft Visual Studio 2008 Beta2 x64 tools. G:\skatests\cobol>cobc -x figurative.cbl cob17C5.c G:\skatests\cobol>figurative thing tabbed thing and another tabbed thing other, things MOVE a-comma : , MOVE symbolic: ,,,,,,,,,,,,,,,,,,,, G:\skatests\cobol>figurative > out.txt G:\skatests\cobol>dump out.txt out.txt: Addr 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 2 4 6 8 A C E -------- ---- ---- ---- ---- ---- ---- ---- ---- ---------------- 00000000 7468 696e 6709 7461 6262 6564 2074 6869 thing.tabbed thi 00000010 6e67 0d0a 616e 6409 616e 6f74 6865 7220 ng..and.another 00000020 7461 6262 6564 2074 6869 6e67 0d0a 6f74 tabbed thing..ot 00000030 6865 722c 2074 6869 6e67 730d 0a4d 4f56 her, things..MOV 00000040 4520 612d 636f 6d6d 6120 3a20 2c20 2020 E a-comma : , 00000050 2020 2020 2020 2020 2020 2020 2020 2020 00000060 0d0a 4d4f 5645 2073 796d 626f 6c69 633a ..MOVE symbolic: 00000070 202c 2c2c 2c2c 2c2c 2c2c 2c2c 2c2c 2c2c ,,,,,,,,,,,,,,, 00000080 2c2c 2c2c 2c0d 0a ,,,,,..[/code] And yes, it will not work on Mainframe :-) ---------------------------------------------------------------- Way cool. And, to be honest, I'll let those with access to frames to, umm, know more COBOL than I do. ;-) I kinda fear a day where someone shows up here and takes me to task for posting slacker how-to's. [i]It all seems eerily too easy[/i]. Cheers, Brian ---------------------------------------------------------------- I personally would use the pic x(02) newline and check some env var (for example PATH) for setting it correct. human BTW: Upcoming 2.0 will have a pre-parser included for stuff like [code]$IF WIN 78 newline value x'0D0A'. $ELSE 78 newline value x'0A'. $END-IF[/code] (where you specify on the command line if WIN is defined or not) - but this is not as portable as the env var which should work for all COBOL implementations/systems. ---------------------------------------------------------------- Will it support both the Micro Focus and ISO2002 variations, i.e. [code] $IF MF code goes here $end-if [/code] and [code] >>IF ISO2002 code goes here >>end-if [/code] ---------------------------------------------------------------- If it's not too late, I'd vote for >> first and foremost and $ as a nicety. Cheers, Brian ---------------------------------------------------------------- Hey: It's Roger who did that - therefore I'm quite sure he put both in. human ---------------------------------------------------------------- Subject: Offtopic; Pounds of code Just curious. I had a roommate, COBOLer, he was responsible for offsite backup, and had the briefcase of media and boxes and boxes of 132 column fan pages; all for one system. I'd guess at about 5 pounds a box? their system was a good 30, 35 pounds of source code. Any toppers? Cheers, Brian ---------------------------------------------------------------- You have to more explicit. :-D Source code listings, or Compiled source code, Compiled source code with copy code, Compiled source code with cross reference, Compiled source code with copy code and cross reference, Compiled source code with cross reference and linkage map. A standard box of one part paper has about 3000 sheets, at 54 to 60 lines per page. That's about 150000 lines of code per box. ---------------------------------------------------------------- The listings in question were probably generated by the backup utility. They probably listed one line per file backed up. I never encountered a shop where they printed their programs with every backup. jimc ---------------------------------------------------------------- This was the source code, listed to paper once per major release, so not very often ...just in case... and yes Jim, it likely included more than just the sources, what with headers and file details etc. I never looked in any of the boxes. And I wish I could remember roughly what a box weighed. But I do remember lugging them around more often than I cared to. ;) Cheers, Brian ---------------------------------------------------------------- Subject: How to compile Pro*Cobol with OpenCobol Does anybody know how to compile a cobol program which is precompiled before with oracle precompiler? Thanks ---------------------------------------------------------------- I never did that but I guess it should be as simple as run COBC and include the respective libs of the OCI interface. Post some code. Regards. ---------------------------------------------------------------- To my knowledge, in the current version there is no precompiler support. But you can call procob before you call cobc. cp a.cbl bak.cbl procob iname=a.cbl oname=temp.cbl mv temp.cbl a.cbl cobc a.cbl mv bak.cbl a.cbl ---------------------------------------------------------------- For the compilation part, this is it. Pay attention to : cobol standard used by opencobol, procob assume you use binary-size: 2-4-8 And procob transform all COMP variable used as host variable to COMP-5. If you are on a little endian machine (x86), and do group zone containing host variable, you will have trouble. Oracle recommand to tell the compiler to use native order for COMP (binary-byteorder: native) For the link edit part, use those parameters to cobc ${ORACLE_HOME}/precomp/lib/cobsqlintf.o -L${ORACLE_HOME}/lib - lclntsh Regards, Angus ---------------------------------------------------------------- Subject: OC on MacOSX Snow Leopard It's probably old hat for the rest of you, but I finally got OC1.1 built, tested and installed on my MacBook. It took a bit of fiddling with macports and configure but finally I issued the command ./configure --with-db LDFLAGS=-L/opt/local/lib LDFLAGS=-L/opt/local/lib/db47 CPPFLAGS=-I/opt/local/include CPPFLAGS=-I/opt/local/include/db47 and got somewhere useful. Kind regards, Bruce. $ uname -a Darwin Bassano.local 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386 i386 $ cobc -V cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Nov 02 2010 11:52:14 Packaged Feb 06 2009 10:30:55 CET ---------------------------------------------------------------- Welcome to the show Cheers, Brian ---------------------------------------------------------------- Subject: Offtopic; SELinux Don't do this without safety nets... Turn off SELinux for a minute so you can test... [code] su echo 0 >/selinux/enforce [/code] back on with [code] su echo 1 >/selinux/enforce [/code] Set a file to turn off the warning during browser access... [code] su chcon -t https_sys_content_t /var/www/html/ajaxenv.html or in a general case chcon -R -t httpd_sys_content_t /var/www/html/ [/code] Cheers, Brian [i]I guess I'm old and not used to some of the new fangled ... so I posted ...[/i] ;-) ---------------------------------------------------------------- Subject: Good free cobol editor for Windows Hi. I just got a small contract for Cobol development so I need a good free Cobol editor for Windows. I been using Notepad++ (just doing some programming as hobbiest) but I need a more robust, cobol oriented editor with the nice things that modern editors have such code completion, code folding, etc. Do you known about one? Thanks. ---------------------------------------------------------------- There is a plugin for eclipse. And cobos, based on this plugin, but you can't compile with one click... ---------------------------------------------------------------- You could use vim for Windows or PSPad. With adjusting some settings you can get a nice editor. You may want to have a look at this thread: http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=315&forum=1 - please post further questions to editors there (both options I've mentioned are discussed there, too). human ---------------------------------------------------------------- http://www.crimsoneditor.com/ Crimson is a beauty. You may have to tweak the COBOL syntax highlighter with a few keywords, but it'll do what you need in my humble opinion. And you can have it run cobc -x program.cob then your program with some hot keys definitions. I used it when I was stuck on Windows during early REBOL/3 development (and the only available REBOL/3 alpha was for Windows) Gladly those days are long gone...[i]and Fedora 14 awaits, as of today.[/i] Or, as mentioned, Vim / gVim. Real programmers use ...[i]butterflies, trained to flaps wings when it is exactly right to tweak the cosmic rays to flip magnetic bits on the hard drive[/i] ... or Vim. [i](Thanks to xkcd for that one)[/i] [i]Sorry human, I wanted to put that opine in this thread...[/i] Cheers, Brian ---------------------------------------------------------------- Thanks. The eclipse plugin was recently archived, is no more active. The project is a Java-Cobol integration so Cobos seems ok. Regards. ---------------------------------------------------------------- [url=http://marketplace.eclipse.org/search/apachesolr_search/COBOL]Here are some eclipse plugins[/url]... - 2 free, 1 free for non commercial [url=http://notepad-plus-plus.org/]Here is Notepad++[/url] - think syntax highlight are supported... Micro Focus provides [url=http://download.cnet.com/Net-Express-with-NET/3000-2069_4-10866201.html?tag=mncol;9] NetExpress (is here)[/url] free for education - but I think it doesn't work with win7 ---------------------------------------------------------------- Subject: Add 1 to COBOL new site live, with WIKI and FORUM. Just letting everyone know that the Add 1 to COBOL site at http://add1tocobol.com is now live. I've switched the entire site to WordPress. It has a brand new theme, and quite a bit more functionality. Along with that we've set up WordPress Multisite. So we were able to install both a Forum and a Wiki as simply WordPress themes. We'll also be able to give anyone that wants it, a site of their own for blogging, forums, updates about their apps, you name it. The site is going to be seeing a lot of activity, with a great portion of it OpenCOBOL focused. Just some tidbits: 1. OCKit will be hosted there. I'll be posting a lot of updates about the kit in the next few days. All versions of the OCKit by Add1toCOBOL will be free of charge as well as free and open source. The first version will be going live in just a few weeks as a hosted solution. This provides the advantage of being an "instant on" installation of OpenCOBOL. Of course OCKit will include a lot of features such as Federico's debugger, CGI web apps, MySQL and more. So start following along at http://add1tocobol.com/ockit 2. A lot of libraries and tools for OpenCOBOL are going to be discussed, created, hosted, maintained, improved, documented and supported at add1tocobol.com. 3. We'll be providing space for those that want to Free their COBOL programs. If you own the rights to a COBOL app that you would like to release under license that is compatible with the GNU GPL, we'll provide you blogging space, hosting for your files, a subversion repository, forum, wiki and more. Just contact me at 440.941.3396 or shoot me an email at aoirthoir@add1tocobol.com. 4. We're hosting a wiki and forum for COBOL general purpose and OpenCOBOL specifically, including all of the libraries and tools already mentioned. We'll add categories as needed. This should make finding specific information quicker and easier. 5. We're going to be starting online (and in person) classes for COBOL. Anyone that wants to join may do so via Skype, but space will be limited. These are just a few of the highlights for what's going on. So register if you wish to participate. (Reading content is free, but anyone wishing to edit the Wiki or add Forum posts will need an account.) NOTE: The couple of folks that registered within the last few weeks will need to reregister. But they won't be having to do this again. Also you'll only need one signon for the main site, wiki and forum. Kind Regards, Aoirthoir ---------------------------------------------------------------- Thanks for all the efforts Aoirthoir. I want to say something funny, or derogatory in jest, but no, just thanks. Thanks. Brian ---------------------------------------------------------------- I'm all for something funny or satirical in jest, considering that Aoirthoir means Satirist. :D We're working on a bug trackernow. Buggy Press seems to be the ticket but I cannot get it to display posts at all. So some digging to do. ---------------------------------------------------------------- Laurel and I added a post about site privileges at: http://add1tocobol.com/blog/2010/11/04/publishing-privileges-on-add1tocobol-com/ If anyone has articles they'd like to publish, COBOL related, or OpenCOBOL related, they can do so immediately as Contributors. It won't take but a couple of articles though for someone to move to self publishing status as an Author. Kind Regards, Aoirthoir ---------------------------------------------------------------- What is the different between opencobol.org and add1tocobol? Why two forums and wikis? Where are the right place to post? ---------------------------------------------------------------- NoSpam, Add 1 to COBOL is a COBOL advocacy group. We promote COBOL itself. So we're a resource for learning, sharing COBOL programs, helping people with COBOL and so on. All of this regardless of compiler. So we've got Forums and a WIKI to help us with all of that. In the near future we'll be holding classes, posting Videos, running a Video and Podcast and more. However, OpenCOBOL is our compiler of choice, for many reasons including it's being Free and Open Source Software, fast, robust, cross platform, supported and many other reasons. So we already have sections dedicated to it, including on the WIKI and the Forums. We did this to give ourselves and others more flexibility. The forums on Add 1 to COBOL are categorized. This way topics will be easier to find and return to in the future. Grouping similar topics together will also make it easier to find related posts, see who has had similar issues and how they resolved them. All in all it's just an added resource for OC. I myself will be posting here and at Add1 and will continue to follow both. ---------------------------------------------------------------- Hello everyone. Like NoSpam, I asked myself the question: why 2 forums / wikis ... But good to have cool water is best two sources! Anyway, congratulations to Aoirthoir for his remarkable work. ---------------------------------------------------------------- aouizerate, Thanks! A lot of people helped with the site. Laurel and Phil here locally. Erstazi has been a big help over the past weeks, not to mention Btiffin, VBCoen and others. Another thing we're doing with the content, is licensing everything under CC-BY-SA. So this allows for commercial use of the Wiki, Forum, main site, content and so on, while making sure that everyone gets credit for their contributions. Laurel will be making a blog post about it later today. Kind Regards, Aoirthoir ---------------------------------------------------------------- As many people (or at least me) will not have the time to look into two forums and the search function of this forum should help us, please post the most relevant information about OC-related stuff, maybe with links to the other site, here from time to time. human ---------------------------------------------------------------- Human, I'll be cross posting quite a bit. Still, I'll be posting at add1 in categories. So though there is a search function, having things categorized makes "discovery" easier. A lot of times I find I'm inspired by looking at things similar to what I need. Searching can help only so much in that way as it depends on keyboards being in my search. Also searches tend to bring up multiple posts in the same thread requiring more digging. So the convenience of organization cannot be over-emphasized. That being said though, it also gives us a place to have sections dedicated to specific COBOL programs. So for instance Federico's debugger can have its very own forum. Or VBCoen's accounting software can. My COBOL CMS can have its own section and so on. While Federico's debugger posts should be cross posted, my CMS and VBcoen's accounting software probably should not be as they would clutter the forum. In that case having separate places will actually decrease the time someone spends on the forums and wiki, rather than increase it, even though there are two places. My general rule of thumb is, is it about the OpenCOBOL compiler? Then it has to be posted here. If it is about a subproject (and they are growing in number) then they should be posted to that projects area. Kind Regards ---------------------------------------------------------------- Hi, I like "The compiler is licensed under GNU General Public License. The run-time library is licensed under GNU Lesser General Public License.", because we known our programs or products can provided under commercial, free, shar, oss or other license. But... - code posted in this forum is missing some license informations ([url=http://www.opencobol.org/modules/newbb/viewtopic.php?viewmode=thread&topic_id=1163&forum=1&post_id=5810#5810]example is here[/url]). - some useful "wiki-code" missing license informations (for example filestat-msgs.cpy). Add1ToCobol tells us now "So we’ve avoided using licenses that restrict commercial use of the works that will be posted here. CC-BY-SA meets this requirement." I hope all attachments comes also with free license (GPL is not free (for commercial use)!) like BSD, Apache, EUPL, EPL, ... ---------------------------------------------------------------- NoSpam, [quote]Add1ToCobol tells us now "So we’ve avoided using licenses that restrict commercial use of the works that will be posted here. CC-BY-SA meets this requirement." [/quote] The licensing on Add 1 to COBOL doesn't apply to other sites, including OpenCOBOL.org [quote]I hope all attachments comes also with free license (GPL is not free (for commercial use)!) like BSD, Apache, EUPL, EPL, ...[/quote] GPL is a commercially compatible license. All versions of the GNU GPL license allow for commercial use. You can sell a program, charge for installing it, distributing it, compiling it, etc. You can use it for online SaaS (software as a service) solutions). The restriction with GPL is that you cannot refuse the code to someone downstream. And even then you can charge a fee for that code. In short the GNU GPL prevents someone downstream from turning code proprietary. Some do not like this restriction of the GNU GPL and that's fine. They can use any non-GPL style license they wish. At Add 1 to COBOL, we'll accept any GPL compatible code that a person wishes to use for their code or programs. I prefer GPL for my code. Others at the Add 1 to COBOL site prefer other licenses. None of us will not let our personal preferences for a specific license interfere with the license choice of another. ---------------------------------------------------------------- Subject: Strange compile error During a compile of a long list of programs into a library file, I am getting the following compile errors: [code] /tmp/cob2043_156.c:1913:33: warning: trigraph ??/ ignored, use -trigraphs to ena ble /tmp/cob2043_156.c:1913:36: warning: trigraph ??/ ignored, use -trigraphs to ena ble /tmp/cob2043_156.c:1953:33: warning: trigraph ??/ ignored, use -trigraphs to ena ble /tmp/cob2043_156.c:1953:36: warning: trigraph ??/ ignored, use -trigraphs to ena ble [/code] There is no program name listed in the compile listing, so I do not know what program to look at, and even if I did, I do not know what the error is about. Does anyone have any ideas about this? [code] cobc -V cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Oct 23 2010 11:54:28 Packaged Feb 06 2009 10:30:55 CET [/code] ---------------------------------------------------------------- Yep, Try cobc -v -g -debug -ftraceall, trace through which .cob is generating tmp/cob2043_156.c (it may not be that same name over successive compiles) Use -save-temps=DIR to have OpenCOBOL leave the .c files around and check out line 1913 of the generated file the C compiler blames. The generated C (especially with the debug and tracer lines is pretty easy to map back to the COBOL source that is generating the warning generating C code. And [i]depending[/i], it is just a warning, [i]always worthy of analysis of course[/i]. If you need the code and need to roll, capture the -v output, and if absolutely necessary, tweak the C compiler statements to include the afore mentioned -trigraphs option. (If you can wait, -A and -Q cobc options are in the pipeline and they will support passing options to the C compiler and the linker. For now you may have to capture the commands, keeping the save-temps files, modify the commands by hand and execute as a script.) Cheers, Brian ---------------------------------------------------------------- If you compile with -save-temps the c-files get the name according to the COBOL source file. This should make it easier to see what program creates this compiler warning. The problem can occur if you have a COBOL string that begins with two question marks, something like [code] 78 myconst value '??123'.[/code] or [code]move '??123' to myvar[/code] These strings are taken into C-source but as sequences with ?? have a special meaning in the C-compiler involved you get the warning. The workaround is simple: If possible replace the question marks with something else or use STRING or FUNCTION CONCATENATE to put the two question marks together in one string. I didn't checked if this "problem" has got an internal workaround in upcoming OC, yet. human ---------------------------------------------------------------- Hi Brian, Thanks for your response! I saved your instructions for help in the future. As you mentioned, it's just a warning, and it looks benign to me, so I'll look into it eventually. ---------------------------------------------------------------- Hi human, You nailed it, I'm pretty sure. I have not done the trace yet, but we use strings like "???", "??xxxxx", etc in several places. I can change these to avoid the warning. Thanks!!! ---------------------------------------------------------------- One more reply, just to round out. I haven't tried but (and I didn't look up the ascii for ?, so I'll use 0 and be so wrong as to be just wrong). [code] move x'00' & x'00' & "other string" to ... [/code] as well. Just to add to what's already said. Cheers, Brian ---------------------------------------------------------------- Subject: A little file chooser Just fiddling ... and, anyone out there no how to flub through safe faking of argc argv? [b]gtkfilechooser.c[/b] [code] /* Call up a file chooser */ #include int CBL_OC_CHOOSE_FILE(char *name, int *len) { GtkWindow *window; GtkWidget *dialog; int fakecount = 0; char **fake = {"CBL_OC_CHOOSE_FILE"}; gtk_init(&fakecount, &fake); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); dialog = gtk_file_chooser_dialog_new("Open File", window, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { char *filename; filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); strncpy(name, filename, *len); *len = strlen(filename); g_free(filename); } gtk_widget_destroy(dialog); gtk_widget_destroy((GtkWidget *)window); return 0; } [/code] [b]filechooser.cob[/b] [code] OCOBOL*>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20101103 *> Purpose: GUI file chooser *> Tectonics: cobc -c gtkfilechooser.c *> -I$(pkg-config --cflags gtk+-2.0) *> cobc -x filechooser.cob gtkfilechooser.o *> -l$(pkg-config --libs gtk+-2.0) *> *************************************************************** identification division. program-id. filechooser. data division. working-storage section. 01 filename pic x(256). 01 len usage binary-long value 256. 01 result usage binary-long. *> *************************************************************** procedure division. call "CBL_OC_CHOOSE_FILE" using by reference filename by reference len returning result end-call display "Filename: " filename end-display goback. end program filechooser. [/code] [b]run[/b] [code] $ cobc -c gtkfilechooser.c -I $(pkg-config --cflags gtk+-2.0) $ cobc -x filechooser.cob gtkfilechooser.o -L$(pkg-config --libs gtk+-2.0) $ ./filechooser ... insert nifty looking file selector screen shot here ... Filename: /home/btiffin/lang/cobol/accept-from.cob $ ./filechooser | cut -d' ' -f2 ... insert redundant looking file selector image ... /home/btiffin/writing/ocpygments.py [/code] But, there are warnings and umm, I'm pretty sure it needs more fencing / memory / exit handling. [i]But, it didn't explode, always nice for late night lazy meddling[/i]. Cheers, Brian ---------------------------------------------------------------- Subject: GUI Hello everyone. For the next version of OC we will have tools to produce applications with GUI? It would be a wonderful gift (Christmas is coming ...) Great thank to our Christmas-fathers ... ---------------------------------------------------------------- Have a look at the FAQ how GUI can be achieved, for example with GTK+ human ---------------------------------------------------------------- Subject: Reading keyboard input with timeout, and no echo, and single-chars I am migrating a large HP3000 COBOL application (~300,000 lines) to Ubuntu Linux and OpenCOBOL. We have a scripted migration process that creates a copy of the HP source code, manipulates the source files' contents to make them compatible with OC, ftp's the new files to Linux, and compiles the application. We expect to be able to repeat the migration process over time as we phase out the HP3000 for our clients. The OC compiler found a few problems that the HP compiler overlooked or handled in some way, so it was nice to "clean up" our code even more. I am more impressed with OpenCOBOL every day. I would like to ask the forum's help in solving one technical problem that has arisen, and that has to do with accepting user input. The ACCEPT verb in COBOL does not have the functionality we need. We isolate capturing user keyboard input in one subprogram. Any time we accept input from the keyboard, we need to be able to do three things: 1) Force a single-char read. We want control to return to the program after the user has entered one character (the user does not have to terminate input with an enter key). Otherwise, we limit the input to an arbitrary limit of ~78 characters. 2) Post a timeout against the read. We want control to return if the input is not completed within x seconds. 3) Turn off echoing characters to the screen as needed. For password entry. On the HP, we call a system "intrinsic" called "fopen" to open a file called $STDINX, then we can call "fread" to accept keyboard input, with options to handle all 3 of the above requirements. I have been researching the web and I see that there are stdio functions in C, so I am thinking of calling these from OpenCOBOL, like I call the intrinsics on the HP. We already call the C sockets routines from COBOL successfully on Linux, so I am comfortable with this. We cannot use the Screen Section, as it is not available on the HP. We may want to be able to get each character from the keyboard as it is entered, and then optionally put that char out to STDOUT... I am not a C programmer, so this is why I am asking the forum for ideas. How can this be done?? :-o ---------------------------------------------------------------- dakine, While we are not migrating off of the HP3000 we have been working with it since 1979 and have many systems and customers still on it. We faced a similiar requirement relative to the ACCEPT statement. The link below will show you how to accept one character at a time in the Debian Linux environment: http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1054&forum=1#forumpost5176 We have not addressed terminating the ACCEPT after some amount of time elapses. We handle turning echo off by issuing the following statement in the COBOL program that calls a system command (intrinsic) [code] CALL "SYSTEM" USING "stty -echo". [/code] and turn echo back on by issuing the same statement without the minus sign. FYI we have also developed a screen handler similar to VPLUS (without editing and most of the other features--really just a BLOCK MODE get the screen or put the screen) that we use when we are not using a CGI/HTML interface to our OpenCOBOL programs. jimc ---------------------------------------------------------------- Yeah, you can go the safe Jim way, or, you can go deep...and go S-Lang. :) http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=589&forum=1#forumpost2983 Excuse the interruption. Safe and simple is usually the wise course, but, maybe not as fun to play with. ;-) And s-lang is a nice little library, imho. Cheers, Brian ---------------------------------------------------------------- jcurrey, Thank you very much for your reply. The stty commands did the trick. I will be experimenting with the getchar. My research into the timeout found one interesting suggestion: start the input as a child process and have the parent "sleep" for the timeout period. I guess the child process has to wake up the parent when it is finished. This is beyond me right now, but I will keep looking around. ---------------------------------------------------------------- Brian, Ok... it looks interesting... and when I am finished crawling around Linux and can actually walk, I might be ready for it! It might be what I need eventually, since our app depends on HP terminal emulation, and sometimes certain keystrokes (like backspace) display on the screen. I'm trying to avoid kludgy stuff, so a more robust solution may be needed. ---------------------------------------------------------------- Ok, I had to look again [i]Itchy need scratchy[/i] :-) [code] OCOBOL*>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20101107 *> Purpose: Try timed ACCEPTs *> Tectonics: cobc -x timedkeys.cob *> *************************************************************** identification division. program-id. timedkeys. data division. working-storage section. 01 result usage binary-long. 01 vid pic x(16). 01 newline pic x value x'0a'. *> *************************************************************** procedure division. call "SYSTEM" using "stty raw min 0 time 20 -icanon" end-call display "Waiting 20 tenths of a second? " with no advancing end-display accept vid end-accept call "SYSTEM" using "stty -raw" end-call display newline "Very Important Data = :" vid ":" end-display goback. end program timedkeys. [/code] Sets up the console to wait two seconds (the time parameter of stty is in tenths) after an idle keyboard; meaning, you can type away for fifteen minutes without terminating, but idle for two seconds and it'll terminate. At least with my Gnome terminal running Fedora 14 test. [i]Not a great interface imho, but may do.[/i] In real life, the stty would be captured and restored, not just tweaked. Yada yada. And when you go all [b]zen with the OpenCOBOL[/b], the stty reset really should be part of a CBL_EXIT_PROC ala http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=589&forum=1#forumpost2983 Caveats and ass coverin': The stty commands may need -echo and echo reset on some terminals [i](or emulators, termcap info files (many things can bork this)[/i]. Your mileage will most definitely vary. Cheers, Brian ---------------------------------------------------------------- WOW! Thanks very much for this! I logged on to pass along that I had learned there was an alarm() function that could also be used to timeout a read, but your solution looks far easier. What's more, it fits in with the way we did it on the HP, by using a built-in capability. Very nice!!! :-D ---------------------------------------------------------------- Absolutely. OpenCOBOL itchies are [i]good[/i] itchies. ;-) Cheers, Brian ---------------------------------------------------------------- Subject: Off topic, jokey; OpenCOBOL "haiku" turned down Not complaining, just mentioning..., [i]err, e-boasting? in that sad 3rd millennium irrelevant quest for electronic attention?[/i] :-) http://en.wikipedia.org/wiki/Talk:Haiku_in_English#Can_I_add_computer_source_code_Haiku.3F It got turned down... :-( And for our (to me) international viewers; I'm from Ontario and when I was in high school, ANYTHING 5-7-5 was "haiku". I'll stand by the third argument and the program's haiku-eey-ness, even if the expression is used improperly. ;-) Cheers, Brian ---------------------------------------------------------------- Subject: Pondering post about ROOT/CINT and interactive OpenCOBOL Started horsing around with ROOT/CINT today. CERN really does give away cool things. Have to try the [code] root[0] .L opencobol.C+ [/code] command and see if the generated .so libraries are sympatico. Highly likely. And then, see if the .c files from [i]cobc -C[/i] generate code that CINT can handle. Less likely, but worthy of wishful hoping. If so, what it means is, there is a viable path to [b]pseudo interactive OpenCOBOL development[/b] at least to testing program-id subprograms from a console. Maybe. So far, looks like it might work. Cheers, Brian ---------------------------------------------------------------- Umm, more reading required. The easy looking [code] $ cobc hello.cob $ root root [0] gSystem->Load("hello.so"); root [1] hello(); Error: Function hello() is not defined in current scope (tmpfile):1: Will you try loading hello.so(y/n)? y *** Interpreter error recovered *** Note: File "hello.so" already loaded Error: failed to load hello.so root [2] [/code] doesn't work. So, if anyone happens to know if ROOT is hiding the symbol in a namespace? Or, might have to go all out, compile standalone CINT to get at the [i]makecint[/i] command to run a special Makefile compile pass to get a CINT interactively loadable shared library with exposed symbols. Worthy of more reading. If it works, we should be able to test subprograms with something like [code] root [3] printf("%s\n", "I want this for OpenCOBOL!"); I want this for OpenCOBOL! root [4] printf("%s %d\n", "Interactive testing is a good kinda testing", 42); Interactive testing is a good kinda testing 42 [/code] Have to figure out the glue, then... [code] root [4] cobolprogram("string", 123); ok root [5] cobolprogram("another test", 0); Holy crap! Zero value bug! root [6] [/code] with a fairly simple header, a makecint pass, and then a handy console for exploring without the edit/compile/link/go cycle. With C code, this is built into the ROOT framework loader [b]greet.c[/b] [code] #include int main(int argc, char *argv[]) { printf("Hello C compiled with cobc\n"); } int hello(int argc, char *argv[]) { printf("Hello C compiled with cobc, run from hello.so with cobcrun\n"); } int greet() { printf("greet a module, compiled with cobc, run with COB_PRE_LOAD=hello cobcrun greet\n"); return 0; } [/code] In ROOT... [code] [btiffin@home cobol]$ root -l root [0] .L greet.c+ Info in : creating shared library /home/btiffin/lang/cobol/./greet_c.so In file included from /home/btiffin/lang/cobol/./greet_c_ACLiC_dict.h:33:0, from /home/btiffin/lang/cobol/./greet_c_ACLiC_dict.cxx:16: /home/btiffin/lang/cobol/./greet.c:2:5: warning: unused parameter ‘argc’ /home/btiffin/lang/cobol/./greet.c:2:5: warning: unused parameter ‘argv’ /home/btiffin/lang/cobol/./greet.c: In function ‘int hello(int, char**)’: /home/btiffin/lang/cobol/./greet.c:8:1: warning: no return statement in function returning non-void /home/btiffin/lang/cobol/./greet.c: At global scope: /home/btiffin/lang/cobol/./greet.c:6:5: warning: unused parameter ‘argc’ /home/btiffin/lang/cobol/./greet.c:6:5: warning: unused parameter ‘argv’ root [1] greet(); greet a module, compiled with cobc, run with COB_PRE_LOAD=hello cobcrun greet root [2] [/code] Of course, the message is lying. More reading, because this looks like it might be fun [i](and all sciency like)[/i] Sadly, the lazy man test didn't quite work. [code] $ cat hello.cob program-id. hello. procedure division. display "hello". $ cobc -C -free hello.cob root [0] .L hello.c+ Info in : creating shared library /home/btiffin/lang/cobol/./hello_c.so Error: Assignment type incompatible FILE:/home/btiffin/lang/cobol/./hello.c.l.h LINE:20 Error: Assignment type incompatible FILE:/home/btiffin/lang/cobol/./hello.c.l.h LINE:20 In file included from /home/btiffin/lang/cobol/./hello.c:44:0, from /home/btiffin/lang/cobol/./hello_c_ACLiC_dict.h:33, from /home/btiffin/lang/cobol/./hello_c_ACLiC_dict.cxx:16: /home/btiffin/lang/cobol/./hello.c.l.h: In function ‘int hello_(int)’: /home/btiffin/lang/cobol/./hello.c.l.h:24:1: warning: missing braces around initializer for ‘cob_call_union’ /home/btiffin/lang/cobol/./hello.c.l.h:24:1: warning: missing braces around initializer for ‘cob_call_union’ In file included from /home/btiffin/lang/cobol/./hello_c_ACLiC_dict.h:33:0, from /home/btiffin/lang/cobol/./hello_c_ACLiC_dict.cxx:16: /home/btiffin/lang/cobol/./hello.c:97:24: warning: dereferencing type-punned pointer will break strict-aliasing rules /home/btiffin/lang/cobol/./hello.c:107:17: warning: dereferencing type-punned pointer will break strict-aliasing rules /home/btiffin/lang/cobol/./hello_c_ACLiC_dict.cxx: At global scope: /home/btiffin/lang/cobol/./hello_c_ACLiC_dict.cxx:73:12: warning: ‘int G__hello_c_ACLiC_dict__0_1812(G__value*, const char*, G__param*, int)’ defined but not used dlopen error: /home/btiffin/lang/cobol/./hello_c.so: undefined symbol: cob_fatal_error Load Error: Failed to load Dynamic link library /home/btiffin/lang/cobol/./hello_c.so In file included from /home/btiffin/lang/cobol/./hello.c:44:0, from /home/btiffin/lang/cobol/./hello_c_ACLiC_dict.h:33, from /home/btiffin/lang/cobol/./hello_c_ACLiC_dict.cxx:16: /home/btiffin/lang/cobol/./hello.c.l.h: In function ‘int hello_(int)’: /home/btiffin/lang/cobol/./hello.c.l.h:24:1: warning: missing braces around initializer for ‘cob_call_union’ /home/btiffin/lang/cobol/./hello.c.l.h:24:1: warning: missing braces around initializer for ‘cob_call_union’ /home/btiffin/lang/cobol/./hello_c_ACLiC_dict.cxx: At global scope: /home/btiffin/lang/cobol/./hello_c_ACLiC_dict.cxx:73:12: warning: ‘int G__hello_c_ACLiC_dict__0_1812(G__value*, const char*, G__param*, int)’ defined but not used /usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../lib64/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' /home/btiffin/lang/cobol/./hello_c_ACLiC_dict.o: In function `hello_(int)': hello_c_ACLiC_dict.cxx:(.text+0x4a): undefined reference to `cob_module_enter' hello_c_ACLiC_dict.cxx:(.text+0xb7): undefined reference to `cob_display' hello_c_ACLiC_dict.cxx:(.text+0xdc): undefined reference to `cob_module_leave' hello_c_ACLiC_dict.cxx:(.text+0x100): undefined reference to `cob_check_version' hello_c_ACLiC_dict.cxx:(.text+0x10c): undefined reference to `cob_set_cancel' hello_c_ACLiC_dict.cxx:(.text+0x14e): undefined reference to `cob_fatal_error' collect2: ld returned 1 exit status *** Interpreter error recovered *** root [1] hello(); Error: Function hello() is not defined in current scope (tmpfile):1: Will you try loading hello.so(y/n)? n *** Interpreter error recovered *** root [2] .L hello.c+ root [3] hello(); /usr/bin/root.exe: symbol lookup error: /home/btiffin/lang/cobol/./hello_c.so: undefined symbol: cob_module_enter [/code] So close...itchy. Cheers, Brian ---------------------------------------------------------------- Not sure if it's good to go further... ...but I suggest to tell root that hello.c should be linked to libcob (directly via command line or indirect with gcc's environment vars). We may can have a look at the other errors you get if you post the whole C-code that you want to compile. human ---------------------------------------------------------------- Thanks human, you tweaked a brain cell. I'll disagree that it might not be good to continue... ;) [code] $ cobc -free -fimplicit-init -C hello.cob $ root -l root [0] gSystem->Load("/usr/local/lib/libcob"); root [1] .L hello.c+ Info in : creating shared library /home/btiffin/lang/cobol/./hello_c.so Error: Assignment type incompatible FILE:/home/btiffin/lang/cobol/./hello.c.l.h LINE:20 Error: Assignment type incompatible FILE:/home/btiffin/lang/cobol/./hello.c.l.h LINE:20 In file included from /home/btiffin/lang/cobol/./hello.c:44:0, from /home/btiffin/lang/cobol/./hello_c_ACLiC_dict.h:33, from /home/btiffin/lang/cobol/./hello_c_ACLiC_dict.cxx:16: /home/btiffin/lang/cobol/./hello.c.l.h: In function ‘int hello_(int)’: /home/btiffin/lang/cobol/./hello.c.l.h:24:1: warning: missing braces around initializer for ‘cob_call_union’ /home/btiffin/lang/cobol/./hello.c.l.h:24:1: warning: missing braces around initializer for ‘cob_call_union’ In file included from /home/btiffin/lang/cobol/./hello_c_ACLiC_dict.h:33:0, from /home/btiffin/lang/cobol/./hello_c_ACLiC_dict.cxx:16: /home/btiffin/lang/cobol/./hello.c:97:24: warning: dereferencing type-punned pointer will break strict-aliasing rules /home/btiffin/lang/cobol/./hello.c:107:17: warning: dereferencing type-punned pointer will break strict-aliasing rules /home/btiffin/lang/cobol/./hello_c_ACLiC_dict.cxx: At global scope: /home/btiffin/lang/cobol/./hello_c_ACLiC_dict.cxx:73:12: warning: ‘int G__hello_c_ACLiC_dict__0_1812(G__value*, const char*, G__param*, int)’ defined but not used root [2] hello(); hello root [3] [/code] And for those that like cleaner... [code] $ root -l root [0] gSystem->Load("/usr/local/lib/libcob.so"); root [1] .L hello.c+ root [2] hello(); hello root [3] [/code] On second runs, the hello_c.so is seen as current by the ROOT loader, and just works. More soon. We're in. [b]Woohoo[/b]. Interactive COBOL sub program testing... [i]And just so you know.[/i] I have secret-sam plans to try and get OpenCOBOL included in the VTOOLS Large Computer Grid suite of software. Sure, scientists need languages for large scale matrix calculations, but hey, maybe the managers can get in on the game and port over some business code or students can get busy writing up some reports... Envision a future where an OpenCOBOL program gets a microsecond of GRID and processes a few trillion data items into a management friendly summary (with graphs). [i]I do. All the time.[/i] When they find the Higgs boson, someone will want to know what it's worth ... to the penny. :-) Cheers, Brian Oh yeah, thanks to Masaharu Goto and the good folks at CERN. ---------------------------------------------------------------- For those of us that are ignorant (namely me)... Could you tell us what Root/CINT even is? Danke:D ---------------------------------------------------------------- Sure; ROOT is the (well, a, they probably have more than one) CERN high energy physics data crunching framework. CINT is a (completely robust with great coverage) C/C++ interpreter. The objective is to allow scientists to write "scripts" and interact with the console ... in C or C++. Way cool. And, if you can't tell, I'm impressed. CINT reads OpenCOBOL generated C, just fine it seems, at least Hello World. More testing soon. One small feature snipped from the Discovering ROOT page [quote] You can save your data (and any C++ object) in a compressed binary form in a ROOT file. The object format is also saved in the same file. ROOT provides a data structure that is extremely powerful for fast access of huge amounts of data - orders of magnitude faster than any database.[/quote] and I believe them. Just one of the many features hidden in the 1200 or so high level classes exposed by the ROOT framework, all accessible from the ROOT/CINT console. And now [b]OpenCOBOL[/b]. We can leverage this tool to our (and hopefully their) benefit. Oh, and the interactive plots and graphics don't hurt either. --- A little explanation of the screen output I pasted here. The magic is [b]gSystem->Load()[/b] to prep libcob [i]but don't worry, that part will get buried with a thin layer, these are scripts.[/i] The [b].L[/b] is ROOT's Load command. Above I asked to load [i]hello.c[/i] generated by the [b]cobc -C[/b]. The [b]+[/b] on the end of hello.c+ asks ROOT/CINT to not just interpret the C file, but to load it in as a ROOT linked library. [i]hello_c.so[/i]. (The -fimplicit-init ensures the cob_init is called). You end up with COBOL routines that you can then call as CINT functions at the console. [b]hello();[/b] This is all gelling well with my plans to see OpenCOBOL help out with the Large Hadron Collider project. ;-) [i]I see skies of blue, clouds of white, the bright blessed day, the dark sacred night...[/i] Cheers, Brian ---------------------------------------------------------------- [i]I see skies of gray, clouds of shame...[/i] ;-) So, it turns out, that passing data maybe a little, umm, fatally borked. [code] OCOBOL*>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20101119 *> Purpose: Pass arguments to ROOT/CINT invoked subprograms *> Tectonics: cobc -fimplicit-init -C parameters.cob *> *************************************************************** identification division. program-id. parameters. data division. linkage section. 01 a-number usage binary-long. *> *************************************************************** procedure division using by reference a-number. display a-number end-display move a-number to return-code goback. end program parameters. [/code] gets greeted with [code] [btiffin@home cobol]$ cobc -fimplicit-init -C parameters.cob [btiffin@home cobol]$ root -l root [0] gSystem->Load("/usr/local/lib/libcob.so"); root [1] .L parameters.c+ Info in : creating shared library /home/btiffin/lang/cobol/./parameters_c.so Error: Assignment type incompatible FILE:/home/btiffin/lang/cobol/./parameters.c.l.h LINE:20 Error: Assignment type incompatible FILE:/home/btiffin/lang/cobol/./parameters.c.l.h LINE:20 In file included from /home/btiffin/lang/cobol/./parameters.c:44:0, from /home/btiffin/lang/cobol/./parameters_c_ACLiC_dict.h:33, from /home/btiffin/lang/cobol/./parameters_c_ACLiC_dict.cxx:16: /home/btiffin/lang/cobol/./parameters.c.l.h: In function ‘int parameters_(int, unsigned char*)’: /home/btiffin/lang/cobol/./parameters.c.l.h:24:1: warning: missing braces around initializer for ‘cob_call_union’ /home/btiffin/lang/cobol/./parameters.c.l.h:24:1: warning: missing braces around initializer for ‘cob_call_union’ In file included from /home/btiffin/lang/cobol/./parameters_c_ACLiC_dict.h:33:0, from /home/btiffin/lang/cobol/./parameters_c_ACLiC_dict.cxx:16: /home/btiffin/lang/cobol/./parameters.c:88:19: warning: dereferencing type-punned pointer will break strict-aliasing rules /home/btiffin/lang/cobol/./parameters.c:109:24: warning: dereferencing type-punned pointer will break strict-aliasing rules /home/btiffin/lang/cobol/./parameters.c:119:17: warning: dereferencing type-punned pointer will break strict-aliasing rules /home/btiffin/lang/cobol/./parameters_c_ACLiC_dict.cxx: At global scope: /home/btiffin/lang/cobol/./parameters_c_ACLiC_dict.cxx:73:12: warning: ‘int G__parameters_c_ACLiC_dict__0_1812(G__value*, const char*, G__param*, int)’ defined but not used root [2] [/code] and the sad error lines come from [b]parameters.c.l.h[/b] [code] /* OpenCOBOL package date Feb 20 2010 13:59:57 UTC */ /* Compile command cobc -fimplicit-init -C parameters.cob */ /* Program local variables for 'parameters' */ /* Module initialization indicator */ static unsigned int initialized = 0; /* Module structure */ /* Module user parameters for CALL statements */ static cob_field *cob_user_parameters[COB_MAX_FIELD_PARAMS]; static struct cob_module module = { NULL, cob_user_parameters, "parameters", COB_MODULE_FORMATTED_DATE, COB_SOURCE_FILE, (void *(*)())parameters, (void *(*)())parameters_, NULL, NULL, NULL, NULL, &cob_module_path, 0, COB_MODULE_DATE, COB_MODULE_TIME, 0, 1, 0, 0, '.', '$', ',', 1, 1, 1, 0, 0, 0, 0 }; [/code] meaning OpenCOBOL produces C code [code](void *(*)())parameters, (void *(*)())parameters_,[/code] that CINT doesn't interpret the way we need it to be interpreted. Rats! There goes lazy man. Getting this to work might be tricky. :-) Cheers, Brian ---------------------------------------------------------------- Sounds like a bug of CINT if it cannot compile this but result in [quote]Error: Assignment type incompatible FILE:/home/btiffin/lang/cobol/./parameters.c.l.h LINE:20[/quote] Not sure if it will be as you need it if they fix that, but I suggest to ask them. human ---------------------------------------------------------------- I do plan on posting the challenge to Mr Goto and the CINT team. :-) The casting of (void *(*)())parameters is actually a [b]union[/b] slot of the cob_module struct, a union that accounts for the new more robust CALL interface and is fair to complicated. [i]and not to place any "blame trails" yet; I was using a work-in-progress OC compiler, and perhaps it doesn't lay down C data types tight enough for CINT to allow through, etc...[/i] But, [b]the current Feb 2009 pre-release compiler works the charm[/b] ... kinda ... with a little techno-geek-speak in between. [b]cobparams.cob[/b] [code] OCOBOL*>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20101119 *> Purpose: Pass arguments to ROOT/CINT invoked subprograms *> Tectonics: cobc -fimplicit-init -C cobparams.cob *> *************************************************************** identification division. program-id. cobparams. data division. linkage section. 01 a-number usage binary-long. *> *************************************************************** procedure division using by reference a-number. display a-number end-display move a-number to return-code goback. end program cobparams. [/code] and then into root [code] $ cobc -fimplicit-init -C cobparams.cob $ root -l root [0] gSystem->Load("/usr/local/lib/libcob.so"); root [1] .L cobparams.c+ root [2] int a = 0; root [3] int d = 42; root [4] a = cobparams((unsigned char*)&d); +0000000042 root [5] printf("%d\n", a); 42 root [6] [/code] OpenCOBOL 1.1 Feb2009 lays down an interface of [i]unsigned char *[/i] to get at BY REFERENCE data. In the above snippet, after pre-loading libcob, and then having ROOT do it's link loader magic with cobparams.c, some integers, a and d, are defined on the fly. int a is set to zero and will get the RETURN-CODE from cobparams, d is set to 42 and it's address is passed (cast to the unsigned char pointer) to cobparams USING a-number. a-number is put on DISPLAY by OpenCOBOL and the int a should have the same value from the RETURN-CODE; an interactive printf statement later, and yep, a is 42. ROOT/CINT integration might really help out with some deep COBOL debugging test passes...but, [i]it may be a limited time offer[/i]. When the next, bigger, better, stronger CALL interface is shipped to the world, it may generate code a tad too complex for the needs of the ROOT/CINT scientists, in which case this lazy man layer will have to shored up with a little more magic... [i]I see skies off-blue, clouds of wights, ... err, might, yeah might[/i] Cheers, Brian ---------------------------------------------------------------- [i]Blue skies, puffy white clouds[/i] Who am I kidding. Charts and Graphs! ;-) This is getting fun. ROOT/CINT is one powerfully dangerous console. Nice! Given [b]cobparams.cob[/b] [code] OCOBOL*>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20101119 *> Purpose: Pass arguments to ROOT/CINT invoked subprograms *> Tectonics: cobc -fimplicit-init -C cobparams.cob *> *************************************************************** REPLACE ==ARRAYSIZE== BY ==450==. identification division. program-id. cobfloats. data division. working-storage section. 01 cnt pic 999. 01 val usage float-short. 01 xes. 02 an-x usage float-short occurs ARRAYSIZE times. 01 yes. 02 an-y usage float-short occurs ARRAYSIZE times. linkage section. 01 vxes. 02 an-x usage float-short occurs ARRAYSIZE times. 01 vyes. 02 an-y usage float-short occurs ARRAYSIZE times. *> *************************************************************** procedure division using by reference vxes, vyes. perform varying cnt from 1 by 1 until cnt >= ARRAYSIZE compute val = cnt * function random() end-compute move cnt to an-x in xes(cnt) move val to an-y in yes(cnt) end-perform move xes to vxes move yes to vyes move cnt to return-code goback. end program cobfloats. [/code] And then [code] $ cobc -fimplicit-init -C cobparams.cob $ vi cobparams.c (Add a #pragma K&R to the top of cobparams.c so CINT lets up on type safety) [btiffin@home cobol]$ root -l root [0] gSystem->Load("/usr/local/lib/libcob.so"); root [1] .L cobparams.c+ root [2] int a = 0; float x[450]; float y[450]; root [3] a = cobfloats(&x, &y); root [4] a (int)450 root [5] TGraph *graph1 = new TGraph(450, x, y); root [6] graph1->Draw("A*"); [/code] [img align=right]http://opencobol.add1tocobol.com/images/rootgraph1.png[/img] shows the plot imaged here. And it's a live graph. Drag the points around and it'll influence the copy of the x and y float arrays in ROOT space. Use a different interface for CINT to OpenCOBOL parameter handling and these changes would be reflected live in the COBOL data set as well. [i]But, umm, dragging a bar chart down to account for the missing 12 cents in payroll might get someone in trouble...[/i] :-) Easy peasy charts and graphs. Interactive COBOL with interactive plots. It's like nerd heaven. And if you are into Polar graphs, changing the [i]float-short[/i] to [i]float-long[/i] in cobparams.cob and then [code] root [2] int a = 0; double x[450]; double y[450]; root [3] a = cobfloats(&x, &y); root [4] printf("%f %f\n", x[42], y[42]); 43.000000 8.232543 root [5] TGraphPolar *polar1 = new TGraphPolar(450, x, y); root [6] polar1->SetLineColor(2); root [7] polar1->Draw("AOL"); [/code] [img]http://opencobol.add1tocobol.com/images/rootgraph2.png[/img] gives the second plot. Which shows, umm, a circular view of the same random numbers. How cool is that. Cheers, Brian ---------------------------------------------------------------- Subject: Moving old COBOL source files to Linux Box We are moving our old VMS COBOL source files to a new virtual Linux box and trying to compile with OpenCOBOL and receiving error messages. The following is the program (don't laugh, we know it's old) and when compiling I get the error message: SARAP_110910.COB:49: Error: syntax error, unexpected "Identifier", expecting EXTERNAL or GLOBAL Since this is a newer compiler from what we used in the past, I'm stuck. Any help would be greatly appreciated. ~Bruce IDENTIFICATION DIVISION. PROGRAM-ID. SARAP. AUTHOR. JOHN MCHALE. DATE-WRITTEN. JUNE 29,1983. DATE-COMPILED. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. DECSYSTEM-20. OBJECT-COMPUTER. DECSYSTEM-20. SPECIAL-NAMES. C01 IS TOP-OF-PAGE. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT TBP-IN-FILE ASSIGN TO DSK. SELECT AP-FEED-FILE ASSIGN TO DSK. SELECT REPORT-FILE ASSIGN TO DSK. SELECT CONTROL-FILE ASSIGN TO DSK. DATA DIVISION. FILE SECTION. FD TBP-IN-FILE RECORD CONTAINS 226 CHARACTERS LABEL RECORDS ARE STANDARD VALUE OF FILE-ID IS 'SARAP.INP' DATA RECORD IS TBP-REC. 01 TBP-REC PIC X(226). FD AP-FEED-FILE LABEL RECORDS ARE STANDARD VALUE OF FILE-ID IS 'SARAP.SAR' DATA RECORD IS AP-TRANS-REC. 01 AP-TRANS-REC PIC X(128). FD REPORT-FILE RECORD CONTAINS 132 CHARACTERS LABEL RECORDS ARE STANDARD VALUE OF FILE-ID IS 'SARAP.RPT' DATA RECORD IS PRINT-LINE. 01 PRINT-LINE PIC X(132). FD CONTROL-FILE RECORD IS VARYING TO 211 CHARACTERS LABEL RECORDS ARE STANDARD VALUE OF FILE-ID IS 'SARAP.INI' DATA RECORD IS CNTRL-OUT-REC. 01 CNTRL-OUT-REC. 03 C-HEADG-OUT PIC X(19). 03 C-DATE-OUT PIC X(6). 03 C-VCHR-NUM-OUT PIC 9(7). 03 C-BATCH-NUM-OUT PIC 999. 03 FILLER PIC X(176). WORKING-STORAGE SECTION. 01 CONTROL-HEADG PIC X(19) VALUE 'VOUCHER.CONTROL.REC'. 01 FAS-ACCT-NUM PIC X(10) VALUE '0150202700'. 01 WS-VAL-ID. 03 WS-VAL-FIRST-SIX PIC X(6). 03 WS-VAL-LAST-THREE PIC XXXX VALUE '.SAR'. 01 COUNTERS. 03 VCHR-COUNT PIC 9(7). 03 TRANS-COUNT PIC 9(5). 03 TOT-REC-COUNT PIC 9(5). 03 BATCH-AMT-COUNT PIC S9(9)V99. 03 TOT-AMT-COUNT PIC S9(9)V99. 03 RPT-PAGE-COUNT PIC 999. 03 RPT-LINE-COUNT PIC 99. 03 WRNG-COUNT PIC 9. 03 BTCH-CNT PIC 999. 03 INQ-COUNT PIC 9999 VALUE ZERO. 03 TOT-AMT-REQ PIC S9(5). 03 TOT-AMT-VEND PIC S9(5). *Rider Mod - Replacing SSN with Colleague ID *01 TBP-LAYOUT. * 03 TBP-SSNO. * 05 TBP-SSNO-1-3 PIC XXX. * 05 TBP-SSNO-4-5 PIC XX. * 05 TBP-SSNO-6-9 PIC X(4). 01 TBP-LAYOUT. 03 TBP-COLLID. 05 TBP-COLL-ID PIC X(7). 05 FILLER PIC X(2). *Rider Mod ends 03 TBP-EC PIC XXX. 03 TBP-AMOUNT PIC S9(9)V99. 03 TBP-CR-ACCT. 05 TBP-CR-ACCT-NUM-1 PIC X. 05 TBP-CR-ACCT-NUM-2-6 PIC X(5). 05 TBP-CR-ACCT-NUM-7-10 PIC X(4). 03 TBP-DB-ACCT. 05 TBP-DB-ACCT-NUM-1 PIC X. 05 TBP-DB-ACCT-NUM-2-6 PIC X(5). 05 TBP-DB-ACCT-NUM-7-10 PIC X(4). 03 TBP-BANK-NUM PIC XX. 03 TBP-TRANS-DATE. 05 TBP-YEAR PIC XX. 05 TBP-MONTH PIC XX. 05 TBP-DAY PIC XX. 03 TBP-REV-NBR PIC X(8). 03 TBP-NAME. 05 TBP-LNAME PIC X(15). 05 TBP-FNAME PIC X(15). 05 TBP-MI PIC X(1). 03 FILLER PIC X(4). * Added by SPK from student master file Jan 10, 2002 03 SMF-NAME PIC X(30). 03 HOME-STREET PIC X(30). 03 HOME-STR2 PIC X(15). 03 HOME-CITY PIC X(20). 03 HOME-STATE PIC XX. 03 HOME-ZIP-COUNTRY. 05 HOME-ZIP-CD. 07 H-ZIP. 09 HOME-ZIP PIC 9(5). 09 HOME-ZIP-2 PIC X(4). 07 FILLER PIC X(5). 05 HOME-COUNTRY REDEFINES HOME-ZIP-CD PIC X(14). * End of SPK added fields 01 VENDOR-KEY. 03 FILLER PIC X(4) VALUE 'TEMP'. 03 VEND-COUNT PIC 9999. 03 FILLER PIC XXX VALUE ALL SPACES. 01 WS-TODAY. 03 WS-DATE. 05 WS-YEAR PIC XX. 05 WS-MONTH PIC XX. 05 WS-DAY PIC XX. 03 WS-CENT. 05 WS-CENTURY PIC XX. 05 WS-DD PIC XXX. 03 WS-TIME. 05 WS-HOURS PIC XX. 05 WS-MINUTES PIC XX. 05 WS-SECONDS PIC XX. 05 FILLER PIC XX. 01 INDICATORS. 03 REC-IND PIC XXX. 88 FIRST-RECORD VALUE 'INI'. 88 MID-FILE VALUE 'MID'. 88 END-OF-FILE VALUE 'EOF'. 03 STATUS-IND PIC XXX. 88 ERROR-CND VALUE 'ERR'. 88 CLEAR-CND VALUE 'CLR'. 88 WRNG-CND VALUE 'WRG'. 03 READ-FILE-IND PIC X. 88 INQ-FILE-READ VALUE 'A'. 88 STD-FILE-READ VALUE 'S'. 01 SWITCHES. 03 STATE-FOUND-SW PIC X. 88 STATE-FOUND VALUE 'Y'. 88 STATE-NOT-FOUND VALUE 'N'. *Rider Mod - Replacing SSN with Colleague ID *01 NO-DUP-VARIABLES. * 03 PREV-SSNO PIC X(9) VALUE SPACES. 01 NO-DUP-VARIABLES. 03 PREV-COLLID PIC X(9) VALUE SPACES. 03 TOT-REC PIC 9(4) VALUE 0. 03 DUPL-SUM PIC S9(9)V99. 01 INDICES. 03 TABLE-IND PIC 9(4). 03 BATCH-IND PIC 9(4). 03 TBP-IND PIC 9(4). ********* INQUIRY WORK AREA TO STRING INQ LAST,FIRST & MI INTO A NAME. 01 POINTX USAGE POINTER. 01 WORK-AREAS. 03 W-NAME PIC X(30). 01 SP PIC X VALUE SPACES. 01 WS-MI PIC X. 01 RETURN-STATUS PIC S9(9) COMP. 01 NBR-CHARS PIC S9(9) COMP. ******** 01 CONTROL-REC. 03 CONTROL-LIT PIC X(19). 03 CONTROL-DATE PIC X(6). 03 CONTROL-NUM PIC 9(6). 03 CONTROL-BATCH PIC 999. 03 FILLER PIC X(46). 01 STATES. 03 FILLER PIC XX VALUE 'AL'. 03 FILLER PIC XX VALUE 'AK'. 03 FILLER PIC XX VALUE 'AZ'. 03 FILLER PIC XX VALUE 'AR'. 03 FILLER PIC XX VALUE 'CA'. 03 FILLER PIC XX VALUE 'CO'. 03 FILLER PIC XX VALUE 'CT'. 03 FILLER PIC XX VALUE 'DE'. 03 FILLER PIC XX VALUE 'DC'. 03 FILLER PIC XX VALUE 'FL'. 03 FILLER PIC XX VALUE 'GA'. 03 FILLER PIC XX VALUE 'HI'. 03 FILLER PIC XX VALUE 'ID'. 03 FILLER PIC XX VALUE 'IL'. 03 FILLER PIC XX VALUE 'IN'. 03 FILLER PIC XX VALUE 'IA'. 03 FILLER PIC XX VALUE 'KS'. 03 FILLER PIC XX VALUE 'KY'. 03 FILLER PIC XX VALUE 'LA'. 03 FILLER PIC XX VALUE 'ME'. 03 FILLER PIC XX VALUE 'MD'. 03 FILLER PIC XX VALUE 'MA'. 03 FILLER PIC XX VALUE 'MI'. 03 FILLER PIC XX VALUE 'MN'. 03 FILLER PIC XX VALUE 'MS'. 03 FILLER PIC XX VALUE 'MO'. 03 FILLER PIC XX VALUE 'MT'. 03 FILLER PIC XX VALUE 'NE'. 03 FILLER PIC XX VALUE 'NV'. 03 FILLER PIC XX VALUE 'NH'. 03 FILLER PIC XX VALUE 'NJ'. 03 FILLER PIC XX VALUE 'NM'. 03 FILLER PIC XX VALUE 'NY'. 03 FILLER PIC XX VALUE 'NC'. 03 FILLER PIC XX VALUE 'ND'. 03 FILLER PIC XX VALUE 'OH'. 03 FILLER PIC XX VALUE 'OK'. 03 FILLER PIC XX VALUE 'OR'. 03 FILLER PIC XX VALUE 'PA'. 03 FILLER PIC XX VALUE 'PR'. 03 FILLER PIC XX VALUE 'RI'. 03 FILLER PIC XX VALUE 'SC'. 03 FILLER PIC XX VALUE 'TN'. 03 FILLER PIC XX VALUE 'UT'. 03 FILLER PIC XX VALUE 'VT'. 03 FILLER PIC XX VALUE 'VA'. 03 FILLER PIC XX VALUE 'WA'. 03 FILLER PIC XX VALUE 'WV'. 03 FILLER PIC XX VALUE 'WI'. 03 FILLER PIC XX VALUE 'WY'. 01 STATE-TABLE REDEFINES STATES. 03 ST-CODE OCCURS 51 TIMES INDEXED BY IND PIC XX. 01 VEND-TRANS. *ac- total 128 bytes, according to definition 117 bytes used 03 VEND-TC PIC XXX. 03 VEND-NUM. 05 VEND-NUM-1-4 PIC X(04). 05 VEND-NUM-5-8 PIC X(04). 05 VEND-NUM-9-11 PIC X(03). 03 VEND-NAME PIC X(30). *ac 03 VEND-CITY PIC X(20). 03 VEND-STATE PIC XX. 03 VEND-ZIP. *ac 05 VEND-ZIP-CODE PIC X(12). 03 VEND-COUNTRY PIC X(3). 03 VEND-HOLD PIC X. 03 VEND-DOLL-LIM PIC X. 03 VEND-TYPE PIC XX. 03 VEND-DISC PIC XX. 03 VEND-COMM PIC XXX. 03 VEND-CURR PIC XXX. 03 VEND-RETENT PIC XX. 03 VEND-1099 PIC X. 03 VEND-FED-TAX-ID PIC X(9). *ac 03 VEND-FILLER PIC X(12). 03 filler PIC X(11). 01 ADDR-TRANS REDEFINES VEND-TRANS. 03 ADDR-TC PIC XXX. 03 ADDR-VEND-NUM PIC X(11). 03 ADDR-LINE-TWO PIC X(30). 03 ADDR-LINE-THREE PIC X(30). 03 ADDR-FILL PIC X(54). 01 VCHR-TRANS REDEFINES VEND-TRANS. 03 VCHR-TC PIC XXX. 03 VCHR-VEND-NUM PIC X(11). 03 VCHR-NUM PIC 9(7). 03 VCHR-ACCT-NUM PIC X(10). 03 VCHR-PO-NUM PIC X(7). 03 VCHR-INV-NUM PIC X(14). 03 VCHR-DESC PIC X(15). 03 VCHR-INV-DATE. 05 VCHR-INV-MONTH PIC XX. 05 VCHR-INV-DAY PIC XX. 05 VCHR-INV-CENTURY PIC XX. 05 VCHR-INV-YEAR PIC XX. 03 VCHR-DUE-DATE. 05 VCHR-DUE-MONTH PIC XX. 05 VCHR-DUE-DAY PIC XX. 05 VCHR-DUE-CENTURY PIC XX. 05 VCHR-DUE-YEAR PIC XX. 03 VCHR-INV-AMT PIC 9(9)V99. 03 VCHR-P-F-IND PIC X. 03 VCHR-DISC-AMT PIC X(9). 03 VCHR-DISC-CODE PIC XX. 03 VCHR-DISC-TYPE PIC X. 03 VCHR-BANK-NO PIC XX. 03 VCHR-HOLD-FLAG PIC X. 03 VCHR-ENCL-FLAG PIC X. 03 VCHR-TAX-CODE PIC XX. 01 AP-BTCH-TRANS REDEFINES VEND-TRANS. 03 BTCH-TC PIC XXX. 03 BTCH-KEY. 05 BTCH-ALPHA PIC XXX. 05 BTCH-NUM PIC XXX. 03 BTCH-DATE. 05 BTCH-MONTH PIC XX. 05 BTCH-DAY PIC XX. 05 BTCH-CENTURY PIC XX. 05 BTCH-YEAR PIC XX. 03 BTCH-DESC PIC X(15). 03 BTCH-LIST-TRAN PIC X. 03 BTCH-USER-ID PIC XX. 03 BTCH-REC-COUNT PIC 9(5). 03 BTCH-AMT PIC 9(9)V99. 03 BTCH-SUSP-ID PIC XXX. 03 BTCH-ORIGIN PIC X(8). 03 BTCH-BANK-NUM PIC XX. 03 BTCH-HLD-VCHR PIC X. 03 BTCH-ACCT-FEED PIC X. 03 BTCH-VCHR-FEED PIC X. 03 BTCH-OUT-BAL PIC X. 03 BTCH-FILL PIC X(60). 01 TRANS-ARRAY. 03 TABLE-ITEM OCCURS 1000 TIMES PIC X(128). 01 TBP-ARRAY. 03 TBP-ITEM OCCURS 1000 TIMES PIC X(80). 01 ERROR-MESSAGES. 03 ERR-MSG-1. 05 FILLER PIC X(52) VALUE 'ERR-01 FIRST RECORD IS EOF PLEASE CHECK FILE STATUS!'. 05 FILLER PIC X(80) VALUE ALL SPACES. 03 ERR-MSG-2. 05 FILLER PIC X(60) VALUE 'ERR-02 FIRST RECORD IS NOT CONTROL RECORD, PLEASE RERUN WITH'. 05 FILLER PIC X(31) VALUE 'THE PROPER CONTROL RECORD FIRST'. 05 FILLER PIC X(41) VALUE ALL SPACES. 03 ERR-MSG-3. 05 FILLER PIC X(53) VALUE 'ERR-03 THERE IS NO DATA TO BE PROCESSED IN THIS FILE!'. 05 FILLER PIC X(79) VALUE ALL SPACES. 01 HEADING-LINES. 03 HEAD-ONE. 05 FILLER PIC X(15) VALUE ' PROGRAM: SARAP'. 05 FILLER PIC X(28) VALUE ALL SPACES. 05 FILLER PIC X(43) VALUE 'RIDER UNIVERSITY ACCOUNTS RECEIVABLE SYSTEM'. 05 FILLER PIC X(36) VALUE ALL SPACES. 05 FILLER PIC X(6) VALUE 'PAGE: '. 05 PAG-NUM-OUT PIC ZZ9. 05 FILLER PIC X VALUE ALL SPACES. 03 HEAD-TWO. 05 FILLER PIC X(54) VALUE ALL SPACES. 05 FILLER PIC X(22) VALUE 'STUDENT REFUND LISTING'. 05 FILLER PIC X(56) VALUE ALL SPACES. 03 HEAD-THREE. 05 FILLER PIC X(59) VALUE ALL SPACES. 05 FILLER PIC X(6) VALUE 'AS OF '. 05 RPT-MONTH-OUT PIC XX. 05 FILLER PIC X VALUE '/'. 05 RPT-DAY-OUT PIC XX. 05 FILLER PIC X VALUE '/'. 05 RPT-YEAR-OUT PIC XX. 05 FILLER PIC X(59) VALUE ALL SPACES. 03 DET-HEAD-ONE. 05 FILLER PIC X(3) VALUE ALL SPACES. 05 FILLER PIC X(7) VALUE 'STUDENT'. 05 FILLER PIC X(122) VALUE ALL SPACES. 03 DET-HEAD-TWO. 05 FILLER PIC X(3) VALUE ALL SPACES. 05 FILLER PIC X(8) VALUE 'BRONC ID'. 05 FILLER PIC X(11) VALUE ALL SPACES. 05 FILLER PIC X(7) VALUE 'STUDENT'. 05 FILLER PIC X(22) VALUE ALL SPACES. 05 FILLER PIC X(6) VALUE 'STREET'. 05 FILLER PIC X(50) VALUE ALL SPACES. 05 FILLER PIC X(7) VALUE 'REQUEST'. 05 FILLER PIC X(8) VALUE ALL SPACES. 05 FILLER PIC X(7) VALUE 'REQUEST'. 05 FILLER PIC X(3) VALUE ALL SPACES. 03 DET-HEAD-THREE. 05 FILLER PIC X(3) VALUE ALL SPACES. 05 FILLER PIC X(6) VALUE 'NUMBER'. 05 FILLER PIC X(13) VALUE ALL SPACES. 05 FILLER PIC X(4) VALUE 'NAME'. 05 FILLER PIC X(25) VALUE ALL SPACES. 05 FILLER PIC X(7) VALUE 'ADDRESS'. 05 FILLER PIC X(22) VALUE ALL SPACES. 05 FILLER PIC X(4) VALUE 'CITY'. 05 FILLER PIC X(16) VALUE ALL SPACES. 05 FILLER PIC X(5) VALUE 'STATE'. 05 FILLER PIC X(2) VALUE ALL SPACES. 05 FILLER PIC X(4) VALUE 'DATE'. 05 FILLER PIC X(11) VALUE ALL SPACES. 05 FILLER PIC X(6) VALUE 'AMOUNT'. 05 FILLER PIC X(2) VALUE ALL SPACES. 01 DETAIL-LINES. 03 DET-LINE. 05 FILLER PIC XXX VALUE ALL SPACES. *Rider Mod - Replacing SSN with Colleague ID * 05 SSNO-OUT. * 10 SSNO-1-3-OUT PIC XXX. * 10 FILLER PIC X VALUE '-'. * 10 SSNO-4-5-OUT PIC XX. * 10 FILLER PIC X VALUE '-'. * 10 SSNO-6-9-OUT PIC X(4). 05 COLLID-OUT. 10 COLL-ID-OUT PIC X(9). *Rider Mod ends 05 FILLER PIC X(6) VALUE ALL SPACES. 05 NAME-OUT PIC X(24). 05 FILLER PIC X(4) VALUE ALL SPACES. 05 STREET-OUT PIC X(30). 05 FILLER PIC X(4) VALUE ALL SPACES. 05 CITY-OUT PIC X(18). 05 FILLER PIC XXX VALUE ALL SPACES. 05 STATE-OUT PIC XX. 05 FILLER PIC X(4) VALUE ALL SPACES. 05 REQ-DATE-OUT. 10 REQ-MONTH-OUT PIC XX. 10 FILLER PIC X VALUE '/'. 10 REQ-DAY-OUT PIC XX. 10 FILLER PIC X VALUE '/'. 10 REQ-YEAR-OUT PIC XX. 05 FILLER PIC X(4) VALUE ALL SPACES. 05 REQ-AMT-OUT PIC $$$,$$$.99-. 05 FILLER PIC X(7) VALUE ALL SPACES. 03 TOTAL-LINE-ONE. 05 FILLER PIC X(15) VALUE ALL '*'. 05 FILLER PIC X(46) VALUE ' THE TOTAL NUMBER OF STUDENTS REQUESTING WAS: '. 05 TOT-REQ-AMT-OUT PIC ZZZZ9. 05 FILLER PIC X(48) VALUE ' AND THE TOTAL NUMBER OF STUDENTS REFUNDED IS: '. 05 TOT-REFD-OUT PIC ZZZZ9. 05 FILLER PIC X(12) VALUE ALL SPACES. 03 TOTAL-LINE-TWO. 05 FILLER PIC X(30) VALUE ALL '*'. 05 FILLER PIC X(49) VALUE 'THE TOTAL DOLLAR AMOUNT REFUNDED IN THIS RUN IS: '. 05 TOT-AMT-OUT PIC $$,$$$,$$$.99. 05 FILLER PIC X(40) VALUE ALL SPACES. PROCEDURE DIVISION. MAIN-INIT-000. ACCEPT WS-TIME FROM TIME. MOVE WS-TIME TO WS-VAL-FIRST-SIX. OPEN INPUT TBP-IN-FILE. * OPEN INPUT STD-MST-FILE ALLOWING ALL. * OPEN INPUT INQ-FILE ALLOWING ALL. OPEN OUTPUT AP-FEED-FILE REPORT-FILE CONTROL-FILE. MOVE 0 TO TBP-IND. PERFORM INIT-RTN THRU INIT-EXIT. READ TBP-IN-FILE INTO CONTROL-REC AT END MOVE ERR-MSG-1 TO PRINT-LINE PERFORM ABORT-RTN THRU ABORT-EXIT GO TO MAIN-CLOSE-999. IF CONTROL-LIT NOT EQUAL CONTROL-HEADG MOVE ERR-MSG-2 TO PRINT-LINE PERFORM ABORT-RTN THRU ABORT-EXIT GO TO MAIN-CLOSE-999 ELSE MOVE CONTROL-BATCH TO BTCH-CNT MOVE CONTROL-NUM TO VCHR-COUNT. PERFORM PROCESS-CHECKS-RTN THRU PROCESS-CHECKS-EXIT UNTIL END-OF-FILE. PERFORM FINISH-UP-RTN THRU FINISH-UP-EXIT. MAIN-CLOSE-999. CLOSE TBP-IN-FILE, * STD-MST-FILE, * INQ-FILE, AP-FEED-FILE, REPORT-FILE, CONTROL-FILE. DISPLAY 'INQUIRY USAGE COUNT: ' INQ-COUNT WITH CONVERSION. STOP RUN. * PROCESS-CHECKS-RTN. IF FIRST-RECORD MOVE "MID" TO REC-IND READ TBP-IN-FILE INTO TBP-LAYOUT AT END MOVE 'EOF' TO REC-IND GO TO PROCESS-CHECKS-EXIT. IF TBP-EC = "AAA" GO TO PROCESS-CHECKS-READ. IF TBP-AMOUNT = +0.00 IF NOT END-OF-FILE GO TO PROCESS-CHECKS-READ. * MOVE TBP-COLLID TO SMF-REC-KEY. * MOVE 'S' TO READ-FILE-IND. * READ STD-MST-FILE * INVALID KEY * DISPLAY 'NOT ON STD MSTR ' SMF-REC-KEY * MOVE 'WRG' TO STATUS-IND. * PERFORM READ-INQ-FILE-RTN THRU READ-INQ-FILE-EXIT. * IF NOT WRNG-CND ADD 1 TO TOT-AMT-VEND. PERFORM MAKE-VEND-RTN THRU MAKE-VEND-EXIT. PERFORM MAKE-ADDR-RTN THRU MAKE-ADDR-EXIT. PERFORM MAKE-VCHR-RTN THRU MAKE-VCHR-EXIT. ADD 1 TO TOT-AMT-REQ. PERFORM REPORT-DETAIL-RTN THRU REPORT-DETAIL-EXIT. PROCESS-CHECKS-READ. READ TBP-IN-FILE INTO TBP-LAYOUT AT END MOVE 'EOF' TO REC-IND. PROCESS-CHECKS-EXIT. EXIT. MAKE-VEND-RTN. IF VEND-COUNT EQUAL 99 PERFORM NEW-AP-BTCH-RTN THRU NEW-AP-BTCH-EXIT. ADD 1 TO VEND-COUNT, TABLE-IND, TRANS-COUNT, TOT-REC-COUNT. INITIALIZE VEND-TRANS. MOVE VENDOR-KEY TO VEND-NUM. MOVE '121' TO VEND-TC. MOVE SMF-NAME TO VEND-NAME. MOVE HOME-CITY TO VEND-CITY. PERFORM STATE-SEARCH-RTN THRU STATE-SEARCH-EXIT. IF STATE-FOUND MOVE HOME-STATE TO VEND-STATE MOVE HOME-ZIP TO VEND-ZIP-CODE ELSE MOVE 'NJ' TO VEND-STATE MOVE '08648' TO VEND-ZIP-CODE MOVE 'LAWRENCEVILLE' TO VEND-CITY. MOVE 'SR' TO VEND-TYPE. MOVE ALL SPACES TO VEND-HOLD, VEND-DOLL-LIM, VEND-DISC, VEND-COMM. *ac MOVE '06' TO VEND-RETENT. MOVE VEND-TRANS TO TABLE-ITEM(TABLE-IND). MAKE-VEND-EXIT. EXIT. MAKE-ADDR-RTN. ADD 1 TO TRANS-COUNT, TOT-REC-COUNT, TABLE-IND. INITIALIZE ADDR-TRANS. MOVE VENDOR-KEY TO ADDR-VEND-NUM. MOVE '122' TO ADDR-TC. IF STATE-FOUND MOVE HOME-STREET TO ADDR-LINE-TWO ELSE MOVE ALL SPACES TO ADDR-LINE-TWO. MOVE ALL SPACES TO ADDR-LINE-THREE, ADDR-FILL. MOVE ADDR-TRANS TO TABLE-ITEM(TABLE-IND). MAKE-ADDR-EXIT. EXIT. MAKE-VCHR-RTN. ADD 1 TO TRANS-COUNT, TOT-REC-COUNT, TABLE-IND. INITIALIZE VCHR-TRANS. MOVE VENDOR-KEY TO VCHR-VEND-NUM. MOVE '142' TO VCHR-TC. ADD 1 TO VCHR-COUNT. MOVE VCHR-COUNT TO VCHR-NUM. MOVE FAS-ACCT-NUM TO VCHR-ACCT-NUM. MOVE ALL SPACES TO VCHR-PO-NUM, VCHR-DISC-TYPE, VCHR-HOLD-FLAG, VCHR-ENCL-FLAG, VCHR-BANK-NO, VCHR-INV-NUM, VCHR-DESC. MOVE 'STUDENT REFUND' TO VCHR-INV-NUM. MOVE TBP-MONTH TO VCHR-INV-MONTH, VCHR-DUE-MONTH. MOVE TBP-DAY TO VCHR-INV-DAY, VCHR-DUE-DAY. MOVE TBP-YEAR TO VCHR-DUE-YEAR, VCHR-INV-YEAR. IF TBP-YEAR = '99' MOVE '19' TO VCHR-DUE-CENTURY, VCHR-INV-CENTURY ELSE MOVE '20' TO VCHR-DUE-CENTURY, VCHR-INV-CENTURY. MOVE TBP-AMOUNT TO VCHR-INV-AMT. MOVE SPACES TO VCHR-P-F-IND. MOVE ALL SPACES TO VCHR-DISC-AMT. ADD TBP-AMOUNT TO BATCH-AMT-COUNT, TOT-AMT-COUNT. MOVE VCHR-TRANS TO TABLE-ITEM(TABLE-IND). MAKE-VCHR-EXIT. EXIT. NEW-AP-BTCH-RTN. MOVE ALL SPACES TO BTCH-FILL. MOVE '$$$' TO BTCH-TC. MOVE 'SAR' TO BTCH-ALPHA. ADD 1 TO BTCH-CNT. MOVE BTCH-CNT TO BTCH-NUM. MOVE WS-MONTH TO BTCH-MONTH. MOVE WS-DAY TO BTCH-DAY. MOVE '20' TO BTCH-CENTURY. MOVE WS-YEAR TO BTCH-YEAR. MOVE 'SAR INTERFACE' TO BTCH-DESC. MOVE BATCH-AMT-COUNT TO BTCH-AMT. MOVE 'SARAP ' TO BTCH-ORIGIN. MOVE SPACES TO BTCH-FILL, BTCH-SUSP-ID, BTCH-USER-ID. MOVE TRANS-COUNT TO BTCH-REC-COUNT. MOVE 'N' TO BTCH-HLD-VCHR, BTCH-VCHR-FEED. MOVE 'Y' TO BTCH-ACCT-FEED, BTCH-OUT-BAL, BTCH-LIST-TRAN. MOVE '04' TO BTCH-BANK-NUM. MOVE AP-BTCH-TRANS TO TABLE-ITEM(BATCH-IND). ADD 1 TO TABLE-IND. MOVE TABLE-IND TO BATCH-IND. MOVE ALL ZEROES TO VEND-COUNT, BATCH-AMT-COUNT, TRANS-COUNT. NEW-AP-BTCH-EXIT. EXIT. INIT-RTN. MOVE 'CLR' TO STATUS-IND. MOVE 'INI' TO REC-IND. MOVE 'N' TO STATE-FOUND-SW. MOVE ALL ZEROES TO VCHR-COUNT, TRANS-COUNT, VEND-COUNT, TOT-REC-COUNT, BATCH-AMT-COUNT, TOT-AMT-COUNT. MOVE 1 TO TABLE-IND, BATCH-IND. MOVE ALL SPACES TO PRINT-LINE, VEND-TRANS. ACCEPT WS-DATE FROM DATE. ACCEPT WS-CENT FROM DAY. ACCEPT WS-TIME FROM TIME. MOVE WS-MONTH TO RPT-MONTH-OUT. MOVE WS-DAY TO RPT-DAY-OUT. MOVE WS-YEAR TO RPT-YEAR-OUT. PERFORM HEADING-RTN THRU HEADING-EXIT. INIT-EXIT. EXIT. STATE-SEARCH-RTN. SET IND TO 1. SEARCH ST-CODE AT END MOVE 'N' TO STATE-FOUND-SW WHEN ST-CODE(IND) EQUAL HOME-STATE MOVE 'Y' TO STATE-FOUND-SW. IF STATE-NOT-FOUND IF HOME-STATE EQUAL 'NB' MOVE 'NE' TO HOME-STATE MOVE 'Y' TO STATE-FOUND-SW. STATE-SEARCH-EXIT. EXIT. FINISH-UP-RTN. PERFORM NEW-AP-BTCH-RTN THRU NEW-AP-BTCH-EXIT. MOVE 0 TO TABLE-IND. MOVE TOT-AMT-REQ TO TOT-REQ-AMT-OUT. MOVE TOT-AMT-VEND TO TOT-REFD-OUT. WRITE PRINT-LINE FROM TOTAL-LINE-ONE AFTER ADVANCING 3 LINES. MOVE TOT-AMT-COUNT TO TOT-AMT-OUT. WRITE PRINT-LINE FROM TOTAL-LINE-TWO AFTER ADVANCING 2 LINES. MOVE BTCH-CNT TO C-BATCH-NUM-OUT. MOVE CONTROL-HEADG TO C-HEADG-OUT. MOVE VCHR-COUNT TO C-VCHR-NUM-OUT. MOVE WS-DATE TO C-DATE-OUT. WRITE CNTRL-OUT-REC. FINISH-UP-LOOP. ADD 1 TO TABLE-IND. INITIALIZE AP-TRANS-REC. WRITE AP-TRANS-REC FROM TABLE-ITEM(TABLE-IND). IF TABLE-IND <= TOT-REC-COUNT GO TO FINISH-UP-LOOP. ADD 1 TO TABLE-IND. WRITE AP-TRANS-REC FROM TABLE-ITEM(TABLE-IND). FINISH-UP-EXIT. EXIT. HEADING-RTN. MOVE ZERO TO RPT-LINE-COUNT. ADD 1 TO RPT-PAGE-COUNT. MOVE RPT-PAGE-COUNT TO PAG-NUM-OUT. MOVE ALL SPACES TO PRINT-LINE. WRITE PRINT-LINE FROM HEAD-ONE AFTER ADVANCING TOP-OF-PAGE. WRITE PRINT-LINE FROM HEAD-TWO AFTER ADVANCING 2 LINES. WRITE PRINT-LINE FROM HEAD-THREE AFTER ADVANCING 2 LINES. WRITE PRINT-LINE FROM DET-HEAD-ONE AFTER ADVANCING 2 LINES. WRITE PRINT-LINE FROM DET-HEAD-TWO AFTER ADVANCING 1 LINES. WRITE PRINT-LINE FROM DET-HEAD-THREE AFTER ADVANCING 1 LINES. ADD 14 TO RPT-LINE-COUNT. MOVE ALL SPACES TO PRINT-LINE. HEADING-EXIT. EXIT. ABORT-RTN. WRITE PRINT-LINE AFTER ADVANCING 4 LINES. MOVE ALL '*' TO PRINT-LINE. ABORT-LOOP. WRITE PRINT-LINE AFTER ADVANCING 1 LINES. ADD 1 TO RPT-LINE-COUNT. IF RPT-LINE-COUNT < 13 GO TO ABORT-LOOP. ABORT-EXIT. EXIT. *Rider Mod - Replacing SSN with Colleague ID *REPORT-DETAIL-RTN. * MOVE TBP-SSNO-1-3 TO SSNO-1-3-OUT. * MOVE TBP-SSNO-4-5 TO SSNO-4-5-OUT. * MOVE TBP-SSNO-6-9 TO SSNO-6-9-OUT. REPORT-DETAIL-RTN. MOVE TBP-COLLID TO COLLID-OUT. *Rider Mod ends. IF WRNG-CND MOVE 'STD NOT ON STD MST FILE' TO NAME-OUT MOVE "NO REF'D GENERATED " TO STREET-OUT MOVE 'CLR' TO STATUS-IND GO TO REPORT-DETAIL-WRITE. MOVE SMF-NAME TO NAME-OUT. MOVE HOME-STREET TO STREET-OUT. MOVE HOME-CITY TO CITY-OUT. MOVE HOME-STATE TO STATE-OUT. MOVE TBP-MONTH TO REQ-MONTH-OUT. MOVE TBP-DAY TO REQ-DAY-OUT. MOVE TBP-YEAR TO REQ-YEAR-OUT. MOVE TBP-AMOUNT TO REQ-AMT-OUT. REPORT-DETAIL-WRITE. WRITE PRINT-LINE FROM DET-LINE AFTER ADVANCING 2 LINES. ADD 2 TO RPT-LINE-COUNT. IF RPT-LINE-COUNT > 56 PERFORM HEADING-RTN THRU HEADING-EXIT. MOVE ALL SPACES TO PRINT-LINE. REPORT-DETAIL-EXIT. EXIT. READ-INQ-FILE-RTN. * MOVE SMF-REC-KEY TO A-SSNO. * MOVE ZERO TO A-SEQ-NBR. * READ INQ-FILE * INVALID KEY * MOVE 'WRG' TO STATUS-IND. * MOVE 'A' TO READ-FILE-IND. * IF NOT WRNG-CND * PERFORM INQ-STRING-NAME * MOVE W-NAME TO SMF-NAME * MOVE A-STREET-ADDR TO HOME-STREET * MOVE A-STREET-ADDR2 TO HOME-STR2 * MOVE A-CITY TO HOME-CITY * MOVE A-COUNTRY TO HOME-COUNTRY * MOVE A-STATE TO HOME-STATE * ADD 1 TO INQ-COUNT. * MOVE A-ZIP TO H-ZIP. READ-INQ-FILE-EXIT. EXIT. INQ-STRING-NAME. *@@@@ MOVE SPACES TO ***** THE HOLD-NAME IN PROGRAM. * MOVE SPACES TO W-NAME. * MOVE 1 TO POINTX. * STRING A-LAST-NAME DELIMITED BY " " INTO W-NAME WITH POINTER POINTX. * STRING " " DELIMITED BY SIZE INTO W-NAME WITH POINTER POINTX. * STRING A-FIRST-NAME DELIMITED BY " " INTO W-NAME WITH POINTER POINTX. * STRING " " DELIMITED BY SIZE INTO W-NAME WITH POINTER POINTX. * * String in full middle name only if there is sufficient room in field A-NAME * else string in middle initial only!!! * * IF A-MI > SPACES * CALL "STR$POSITION" USING BY DESCRIPTOR A-MI SP GIVING RETURN-STATUS * ADD POINTX RETURN-STATUS GIVING NBR-CHARS * SUBTRACT 2 FROM NBR-CHARS * IF NBR-CHARS < 21 * STRING A-MI DELIMITED BY SPACES INTO W-NAME WITH POINTER POINTX * ELSE * MOVE A-MI TO WS-MI * STRING WS-MI DELIMITED BY SIZE INTO W-NAME WITH POINTER POINTX. ***** THIS WILL MOVE THE STRINGED NAME INTO YOUR PROGRAM'S NAME FIELD ***** MOVE W-NAME TO YOUR-NAME-FIELD. ---------------------------------------------------------------- Using linux ubuntu 10.04 and cobc version 1.1. 1 Insert "source free". 2 Replace all "*" with "*>". 3 Remove "with conversion" from line 462. Compiles with no further problem. John. ---------------------------------------------------------------- And as a sign of things to come... [i]reformatting the post the FIXED form, shuffling the comment lines back...etc I only had to clean up a few long strings, easy peasy with vim's COBOL syntax highlighter. It shows off FIXED form lines that exceed position column 72. (lines 319, 742)[/i] Then ... the soon (we hope) to be seen parser catches this unsupported extension as [code] $ cobc -x forumpost.cob forumpost.cob: In paragraph 'MAIN-CLOSE-999': forumpost.cob:462: Error: syntax error, unexpected WITH [/code] Things only get better with the next OpenCOBOL release. :-) Cheers, Brian ---------------------------------------------------------------- Brian, Sorry but I have no clue what you're saying here. Please forgive me as I'm not sure what I need to do. Please elaborate on the thread. I understand the :462:Error ... there is WITH CONVERSION in that line. I can remove that but the rest is foggy. Thanks for your input. Greatly appreciated. ~Bruce :-? ---------------------------------------------------------------- John, Thanks for the note. I get 2 and 3 and will try it but not sure what or where on number 1. What is it and where is it inserted? I'm a COBOL user but an old VMS COBOL user not familiar with the new wave. Thanks again for your help. ~Bruce ---------------------------------------------------------------- The main problem here is that OpenCOBOL uses fixed format as standard. Therefore you can either change your code to "real" free format (I assume you have to replace the FIRST * in a comment line by *> because this is the way how comments are marked in free format) or you can change your source to "real" fixed format (taking care that the source does not extend column 72). If you want to use free format you have to tell this cobc by either calling it with the parameter -free or use compiler directives by placing ">>SOURCE FORMAT IS FREE" in column 8. human BTW: It's much more easier to read the code and to do copy-and-paste for trying to compile/fix code if you put it in code tags. Please edit your first post and change it that way. ---------------------------------------------------------------- Bruce Human has already answered your query to me. I should add that in the general case you should check after substituting "*>" for "*" that you have no compute statements in the program. In the side bar of this page under "Documentation" there is a heading for "User Manual".Clicking will take you to the book written by G Cutler.It is called "OpenCobol 1.1 Programmers Guide". This is a very good publication and will answer many of the questions you will have. It is also worth exploring this whole site. The faq is helpful as are many other sections. John. ---------------------------------------------------------------- Subject: Guile extension revisited (well, re-read) and name dropping I was poking around this evening, a little daunted by the ROOT/CINT docs and the best way to be lazy and get it working, [i]so that means it was time to wander off[/i]. I was looking at the Guile in OpenCOBOL sample; and then decided to read up some more. See if building OpenCOBOL with [b]./configure --with-guile[/b] is actually feasible. Guess who's name popped up? Our good [b]Keisuke Nishida[/b]. He is mentioned in the Guile FAQ... http://www.gnu.org/software/guile/docs/faq/guile-faq.html#Is-there-a-Scheme-code-profiler-that-works-with-Guile_003f In reference to a post from 2000 [quote] Keisuke Nishida asks and answers his own question, supplying a patch to implement such a profiler. Hmm, how would that look on a call-graph? (smile) [/quote] As a fan-boy...that's like, incentive. :-) Cheers, Brian ---------------------------------------------------------------- I just installed Guile 2.0.2. I'm keen again. When I asked a question on #guile Freenode IRC today, the first response back was "Is that the cobol Keisuke Nishida worked on?" So he's a known entity in that circle for sure. Anyway, here's a useless but fun call using libguile-2.0. [i]Please excuse some of the language[/i]. bf is one of the newly supported scripting engines in Guile 2, except it's not really called "bf". callbf.cob [code] OCOBOL >>SOURCE FORMAT IS FREE *> *************************************************************** *> Author: Brian Tiffin *> Date: 20110704 *> Purpose: Demonstrate libguile bf interactions *> Tectonics: cobc -x -debug -lguile-2.0 callbf.cob *> *************************************************************** identification division. program-id. callbf. data division. working-storage section. 77 scm-result usage pointer. *> *************************************************************** procedure division. display "OC: initialize libguile" end-display call "scm_init_guile" on exception display "guile linkage problem: " function exception-location end-display stop run end-call display "OC: compile and load Hello bf code" end-display call "scm_c_eval_string" using "(load-compiled (compile-file " & quote & "hello.bf" & quote & "#:from 'brainfuck))" & x"00" returning scm-result on exception display "guile linkage problem: " function exception-location end-display stop run end-call goback. end program callbf. [/code] hello.bf (from http://en.wikipedia.org/wiki/Brainfuck) [code] ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>. [/code] with a run sample of [code] $ cobc -x callbf.cob -lguile-2.0 $ ./callbf OC: initialize libguile OC: compile and load Hello bf code Hello World! [/code] One of the most convoluted Hello World samples I've ever encountered. Sweet. Oh, the new Guile 2 does ECMAScript too. [code] OCOBOL >>SOURCE FORMAT IS FREE *> *************************************************************** *> Author: Brian Tiffin *> Date: 20110704 *> Purpose: Demonstrate libguile bf interactions *> Tectonics: cobc -x -lguile-2.0 callbf.cob *> *************************************************************** identification division. program-id. callbf. data division. working-storage section. 77 scm-result usage pointer. *> *************************************************************** procedure division. display "OC: initialize libguile" end-display call "scm_init_guile" on exception display "guile linkage problem: " function exception-location end-display stop run end-call display "OC: compile and load Hello bf code" end-display call "scm_c_eval_string" using "(load-compiled (compile-file " & quote & "hello.bf" & quote & "#:from 'brainfuck))" & x"00" returning scm-result on exception display "guile linkage problem: " function exception-location end-display stop run end-call display "OC: compile and load some ECMAScript" end-display call "scm_c_eval_string" using "(load-compiled (compile-file " & quote & "some.js" & quote & "#:from 'ecmascript))" & x"00" returning scm-result on exception display "guile linkage problem: " function exception-location end-display stop run end-call goback. end program callbf. [/code] some.js [code] write([0,1,2,3,4,5].length * 7); [/code] giving [code] $ cobc -x -debug callbf.cob -lguile-2.0 $ ./callbf OC: initialize libguile OC: compile and load Hello bf code Hello World! OC: compile and load some ECMAScript 42 [/code] And, just to demonstrate the EXCEPTION-LOCATION [code] OCOBOL >>SOURCE FORMAT IS FREE *> *************************************************************** *> Author: Brian Tiffin *> Date: 20110704 *> Purpose: Demonstrate libguile bf interactions *> Tectonics: cobc -x -debug -lguile-2.0 callbf.cob *> *************************************************************** identification division. program-id. callbf. data division. working-storage section. 77 scm-result usage pointer. *> *************************************************************** procedure division. display "OC: initialize libguile" end-display call "scm_init_guile" on exception display "guile linkage problem: " function exception-location end-display stop run end-call display "OC: compile and load Hello bf code" end-display call "scm_c_eval_string" using "(load-compiled (compile-file " & quote & "hello.bf" & quote & "#:from 'brainfuck))" & x"00" returning scm-result on exception display "guile linkage problem: " function exception-location end-display stop run end-call display "OC: compile and load some ECMAScript" end-display call "scm_c_eval_string" using "(load-compiled (compile-file " & quote & "some.js" & quote & "#:from 'ecmascript))" & x"00" returning scm-result on exception display "guile linkage problem: " function exception-location end-display stop run end-call. demonstrate-error section. display x"0a" "OC: compile and load some ECMAScript, and screw up the CALL" end-display call "scm_c_eval_stringggggggg" using "(load-compiled (compile-file " & quote & "some.js" & quote & "#:from 'ecmascript))" & x"00" returning scm-result on exception display "OC: guile linkage problem: " function exception-location end-display stop run end-call goback. end program callbf. [/code] which runs as [code] $ cobc -x -debug callbf.cob -lguile-2.0 $ ./callbf OC: initialize libguile OC: compile and load Hello bf code Hello World! OC: compile and load some ECMAScript 42 OC: compile and load some ECMAScript, and screw up the CALL OC: guile linkage problem: callbf; demonstrate-error; 41 [/code]as I misspelled the CALL as scm_c_eval_stringgggg on line 41, inside the demonstrate-error section. The tectonics require -debug for FUNCTION EXCEPTION-LOCATION to have enough information to make it useful. [i]And for the keen eyed[/i], note how I cheated on the newline after the ECMAScript write of 42. It's 2am and I didn't feel like fighting with escaping a \n escape thingy in the some.js script file Fun. And just to un-obfuscate the actual Guile Scheme code in use here... from a Guile REPL prompt... [code] (load-compiled (compile-file "some.js" #:from 'ecmascript)) 42 [/code] Again, 2am and I didn't feel like fighting OpenCOBOL quoted strings that include both " and '. Lots and lots of fun. Really. ;-) Cheers, Brian ---------------------------------------------------------------- Bumping my own post, as it is really is a lot of useless fun as I come to grips with the work that may become ./configure --with-guile. From http://esoteric.sange.fi/brainfuck/bf-source/src-bf/ Prime number display, up to a user entered value [code] =================================================================== ======================== OUTPUT STRING ============================ =================================================================== >++++++++[<++++++++>-]<++++++++++++++++.[-] >++++++++++[<++++++++++>-]<++++++++++++++.[-] >++++++++++[<++++++++++>-]<+++++.[-] >++++++++++[<++++++++++>-]<+++++++++.[-] >++++++++++[<++++++++++>-]<+.[-] >++++++++++[<++++++++++>-]<+++++++++++++++.[-] >+++++[<+++++>-]<+++++++.[-] >++++++++++[<++++++++++>-]<+++++++++++++++++.[-] >++++++++++[<++++++++++>-]<++++++++++++.[-] >+++++[<+++++>-]<+++++++.[-] >++++++++++[<++++++++++>-]<++++++++++++++++.[-] >++++++++++[<++++++++++>-]<+++++++++++.[-] >+++++++[<+++++++>-]<+++++++++.[-] >+++++[<+++++>-]<+++++++.[-] =================================================================== ======================== INPUT NUMBER ============================ =================================================================== + cont=1 [ - cont=0 >, ======SUB10====== ---------- [ not 10 <+> cont=1 =====SUB38====== ---------- ---------- ---------- -------- > =====MUL10======= [>+>+<<-]>>[<<+>>-]< dup >>>+++++++++ [ <<< [>+>+<<-]>>[<<+>>-]< dup [<<+>>-] >>- ] <<<[-]< ======RMOVE1====== < [>+<-] ] < ] >>[<<+>>-]<< =================================================================== ======================= PROCESS NUMBER =========================== =================================================================== ==== ==== ==== ==== numd numu teid teiu ==== ==== ==== ==== >+<- [ >+ ======DUP====== [>+>+<<-]>>[<<+>>-]< >+<-- >>>>>>>>+<<<<<<<< isprime=1 [ >+ <- =====DUP3===== <[>>>+>+<<<<-]>>>>[<<<<+>>>>-]<<< =====DUP2===== >[>>+>+<<<-]>>>[<<<+>>>-]<<< < >>> ====DIVIDES======= [>+>+<<-]>>[<<+>>-]< DUP i=div << [ >>>>>+ bool=1 <<< [>+>+<<-]>>[<<+>>-]< DUP [>>[-]<<-] IF i THEN bool=0 >> [ IF i=0 <<<< [>+>+<<-]>>[<<+>>-]< i=div >>> - bool=0 ] <<< - DEC i << - ] +>>[<<[-]>>-]<< >[-]< CLR div =====END DIVIDES==== [>>>>>>[-]<<<<<<-] if divides then isprime=0 << >>[-]>[-]<<< ] >>>>>>>> [ - <<<<<<<[-]<< [>>+>+<<<-]>>>[<<<+>>>-]<<< >> =================================================================== ======================== OUTPUT NUMBER =========================== =================================================================== [>+<-]> [ ======DUP====== [>+>+<<-]>>[<<+>>-]< ======MOD10==== >+++++++++< [ >>>+<< bool= 1 [>+>[-]<<-] bool= ten==0 >[<+>-] ten = tmp >[<<++++++++++>>-] if ten=0 ten=10 <<- dec ten <- dec num ] +++++++++ num=9 >[<->-]< dec num by ten =======RROT====== [>+<-] < [>+<-] < [>+<-] >>>[<<<+>>>-] < =======DIV10======== >+++++++++< [ >>>+<< bool= 1 [>+>[-]<<-] bool= ten==0 >[<+>-] ten = tmp >[<<++++++++++>>>+<-] if ten=0 ten=10 inc div <<- dec ten <- dec num ] >>>>[<<<<+>>>>-]<<<< copy div to num >[-]< clear ten =======INC1========= <+> ] < [ =======MOVER========= [>+<-] =======ADD48======== +++++++[<+++++++>-]<-> =======PUTC======= <.[-]> ======MOVEL2======== >[<<+>>-]< <- ] >++++[<++++++++>-]<.[-] =================================================================== =========================== END FOR =============================== =================================================================== >>>>>>> ] <<<<<<<< >[-]< [-] <<- ] ======LF======== ++++++++++.[-] [/code] and called with [code] OCOBOL >>SOURCE FORMAT IS FREE *> *************************************************************** *> Author: Brian Tiffin *> Date: 20110704 *> Purpose: Demonstrate libguile bf interactions *> Tectonics: cobc -x -lguile-2.0 callbf.cob *> *************************************************************** identification division. program-id. callbf. data division. working-storage section. 77 scm-result usage pointer. *> *************************************************************** procedure division. display "OC: initialize libguile" end-display call "scm_init_guile" on exception display "guile linkage problem: " function exception-location end-display stop run end-call display "OC: compile and load Hello bf code" end-display call "scm_c_eval_string" using "(load-compiled (compile-file " & quote & "hello.bf" & quote & "#:from 'brainfuck))" & x"00" returning scm-result on exception display "guile linkage problem: " function exception-location end-display stop run end-call display "OC: compile and load prime bf code" end-display call "scm_c_eval_string" using "(load-compiled (compile-file " & quote & "prime.bf" & quote & "#:from 'brainfuck))" & x"00" returning scm-result on exception display "guile linkage problem: " function exception-location end-display stop run end-call goback. end program callbf. [/code] with a run sample of (I typed the '50') [code] $ cobc -x -lguile-2.0 -debug callbf.cob $ ./callbf OC: initialize libguile OC: compile and load Hello bf code Hello World! OC: compile and load prime bf code Primes up to: 50 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 [/code] and a timing exercise with [code] $ echo '99' | time ./callbf OC: initialize libguile OC: compile and load Hello bf code Hello World! OC: compile and load prime bf code Primes up to: 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 7.25user 0.01system 0:07.29elapsed 99%CPU (0avgtext+0avgdata 18072maxresident)k 0inputs+40outputs (0major+4657minor)pagefaults 0swaps [/code] I wouldn't want to go much past 99 on my little Acer, as it really started to spin the CPU fan at about 71, busy little bf. ;) Ok, fine, here's the run to 199 as I was typing this (with the output split to keep the post from going too wide). [code] $ echo '199' | time -p ./callbf OC: initialize libguile OC: compile and load Hello bf code Hello World! OC: compile and load prime bf code Primes up to: 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 real 104.18 user 103.91 sys 0.02 [/code]You can't beat waiting 104 seconds to KNOW that 199 is a prime. ;-) And then hey, why not modify hello.bf to include a more appropriate greeting. (with some comments this time, as it really is hard on the brain) [b]helloOC.bf[/b] (modified from the sample at http://en.wikipedia.org/wiki/Brainfuck) [code] +++++ +++++ initialize counter (cell #0) to 10 [ use loop to set the next four cells to 70/100/30/10 > +++++ ++ add 7 to cell #1 > +++++ +++++ add 10 to cell #2 > +++ add 3 to cell #3 > + add 1 to cell #4 <<<< - decrement counter (cell #0) ] > ++ . print 'H' > + . print 'e' +++++ ++ . print 'l' . print 'l' +++ . print 'o' > ++ . print ' ' << +++++ ++ . print 'O' > + . print 'p' ----- ----- - . print 'e' +++++ ++++ . print 'n' < ----- ----- -- . print 'C' +++++ +++++ ++ . print 'O' ----- ----- --- . print 'B' +++++ +++++ +++ . print 'O' --- . print 'L' >> + . print '!' > . print '\n' [/code] the OpenCOBOL changes to [code] OCOBOL >>SOURCE FORMAT IS FREE *> *************************************************************** *> Author: Brian Tiffin *> Date: 20110709 *> Purpose: Demonstrate libguile bf interactions *> Tectonics: cobc -x -lguile-2.0 callbf.cob *> *************************************************************** identification division. program-id. callbf. data division. working-storage section. 77 scm-result usage pointer. *> *************************************************************** procedure division. display "OC: initialize libguile" end-display call "scm_init_guile" on exception display "guile linkage problem: " function exception-location end-display stop run end-call display "OC: compile and load HelloOC bf code" end-display call "scm_c_eval_string" using "(load-compiled (compile-file " & quote & "helloOC.bf" & quote & "#:from 'brainfuck))" & x"00" returning scm-result on exception display "guile linkage problem: " function exception-location end-display stop run end-call goback. end program callbf. [/code] and then, tada! [code] $ cobc -x -debug -lguile-2.0 callbf.cob $ ./callbf OC: initialize libguile OC: compile and load HelloOC bf code Hello OpenCOBOL! [/code] and because it's hard on the brain, ([i]so worth doing[/i]). [code] +++++ +++++ initialize counter (cell #0) to 10 [ use loop to set the next six cells to 70/80/100/110/30/10 > +++++ ++ add 7 to cell #1 > +++++ +++ add 8 to cell #2 > +++++ +++++ add 10 to cell #3 > +++++ +++++ + add 11 to cell #4 > +++ add 3 to cell #5 > + add 1 to cell #6 <<<<<< - decrement counter (cell #0) ] > ++ . print 'H' >> + . print 'e' > -- . print 'l' . print 'l' +++ . print 'o' > ++ . print ' ' <<< - . print 'O' >> + . print 'p' < . print 'e' > -- . print 'n' <<< ----- . print 'C' > . print 'O' < - . print 'B' > . print 'O' --- . print 'L' >>> + . print '!' > . print '\n' [/code] Which keeps the runtime math (after initializing the first few memory cells) to +/- 5. And to make it harder on the brain, call a one-liner. [code] OCOBOL >>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20110709 *> Purpose: Demonstrate libguile bf interactions *> Tectonics: cobc -x -lguile-2.0 ocone.cob *> *************************************************************** identification division. program-id. ocone. *> *************************************************************** procedure division. call "scm_init_guile" end-call call "scm_c_eval_string" using "(load-compiled (compile-file " & quote & - "ocone.bf" & quote & "#:from 'brainfuck))" & x"00" end-call goback. end program ocone. [/code]and [b]ocone.bf[/b][code] ++++++++++[>+++++++>++++++++>++++++++++>+++++++++++>+++>+<<<<<<-]>++.>>+.>--..+++.>++.<<<-.>>+.<.>--.<<<-----.>.<-.>.---.>>>+.>. [/code] as[code]$ ./ocone Hello OpenCOBOL! [/code] And here is one for a co-worker. [code] OCOBOL >>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20110720 *> Purpose: Demonstrate libguile bf interactions *> Tectonics: cobc -x -lguile-2.0 derps.cob *> *************************************************************** identification division. program-id. derps. data division. working-storage section. 77 derps pic x(124) value "+++++ +++++ [ > +++++ ++ > +++++ +++ > + <<< - ] >" & - " -- . + . > ++ . -- . > . > , [ <<< - . + . " & - "> ++ . -- . > . > - ]". 77 scm-result usage pointer. *> *************************************************************** procedure division. call "scm_init_guile" end-call *> eval-string in bf context, res is unspecified call "scm_c_eval_string" using function concatenate( "(use-modules (ice-9 eval-string))" '(define derps "' derps '")' "(define res (eval-string derps #:lang 'brainfuck))" low-value) returning scm-result on exception display function exception-location end-display end-call goback. end program derps. [/code] which, prompts with DERP and prints DERP ASCII value times. (Control-K being 12). [code] $ ./derps DERP ^K DERP DERP DERP DERP DERP DERP DERP DERP DERP DERP DERP [/code] Cheers, Brian ---------------------------------------------------------------- Subject: OC 2 - when will be ready? what new features will have? Hi. OC 2 - when will be ready? what new features will have? Some preview for Windows? Regards. ---------------------------------------------------------------- BUMP - So? Regards. ---------------------------------------------------------------- ssamayoa, Right now we're all just speculating about what will be in OC2. None of us have the answer except Roger. In any case your original post and the bump were 10 hours apart:D. ---------------------------------------------------------------- I don't have any kinda real info, but, hints of parser.y kicks ass; the parser overhaul is a beauty to behold. I hope ... a lot of FUNCTION-ID is stubbed in. THAT will be cool. GO and ALTER (OC 2 should fully support Flying Spaghetti Monster legacy sources. [i]And I think it comes with lasers to blast any programmer that tries to slip ALTER into a new codebase without proper shielding[/i].) It seems Report Writer may get a visit ... but that is a fair to huge sub-system and I'd not want to get too many hopes up. COMP-6, unsigned COMP-3 cobc -Xref that calls up Vincent's handy cross referencer cobc -K for static link CALL code generation of , I think, unexplored, but if it works, then things like SWI-Prolog get easier to link to. ...lots... Umm, it'll be worth the wait. Cheers, Brian ---------------------------------------------------------------- Subject: Offtopic; Canadian Rememberance Day is Nov 11. A short poem Excuse the interruption everyone. I have no real idea who I wrote this for, but I need to tell someone. Way off topic. To all past, present and future veterans and to all of us that stand by and not notice... [i]Umm, if you don't like the heavy swear words, skip the last few lines.[/i] [code] I know my back is covered In blood, sweat and fear we band of brothers toil in freedom's fight over here Eager, brave and willing to pay Back home we make news three minutes a day Situations so complex we don't quite know who is frank and who is Charlie With balls on the line there is never enough We get by Back home we may make the news for three minutes today The dirt, the death the sin, the hate Fear mixed with disdain Patrols and plans Can trust be gained We'll pay the price and make the news three minutes today But let me tell you If I'm going to pay to injure and die I need you to know What the fuck is freedom and Who The Fuck Am I -- Know by btiffin [/code] ---------------------------------------------------------------- Subject: ACCEPT fieldname FROM POST "field-from-html-form" I might have posted this idea before, or perhaps if so, it was in deep in a topic. I've been thinking about how great it would be to essentially ACCEPT a post or get var that was sent to us via CGI from an html form. The compiler would handle the URL-DECODING and other incidentals. Having such a feature would make OpenCOBOL incredibly competitive. The ease of use for the web would be fantastic. I've posted more at: http://add1tocobol.com/blog/2010/11/11/accept-fieldname-from-post-fieldname/ but I will be following up here and there. What are everyone's thoughts? Do you think we could convince Roger to add this in 2.0.1? Kind Regards, Aoirthoir ---------------------------------------------------------------- Even if is a nice idea, this extension isnt moving OC out of the standard? I was thinking about alike idea but instead of adding new language elements maybe make a replazable SCREEN SECTION handler and convert it to html/jscript UI. But there is a lot of other details arround it. Regards. ---------------------------------------------------------------- The standard allows for extensions to the language. Whether it allows for this kind of extension or not, I don't know. But enhancements to COBOL seem to be par for the course with each compiler. Then those enhancements often become part of the standard. We've been having the very discussion you mentioned regarding screen section at http://add1tocobol.com/chat/live-chat-now/ and have batted it back and forth. Because of the nature of HTML I am not sure if it would be easy to implement a screen section HTML UI. However, I have already completed experiments using group level data structures for an input and the results were pretty interesting. I will be making a post about them on add1toCOBOL soon. ---------------------------------------------------------------- It seems to me that rather than this extension, what you may want to look at is the two existing XML support features 1) The ISO TR on this. (Micro Focus already supports something similar to this) See: [url=http://www.cobolstandard.info/j4/files/07-0005.doc]http://www.cobolstandard.info/j4/files/07-0005.doc[/url] 2) The IBM "XML GNERATE/PARSE" statements, see; [url=http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/IGY3PG50/5.1 ]http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/IGY3PG50/5.1 [/url] * * * * I know that getting HTML input is NOT the same thing as parging/generating XML, but I think the similarities are such that using one of these two featurs could be extended to do what you are thinking about ---------------------------------------------------------------- [quote] wmklein wrote: It seems to me that rather than this extension, what you may want to look at is the two existing XML support features 1) The ISO TR on this. (Micro Focus already supports something similar to this) See: [url=http://www.cobolstandard.info/j4/files/07-0005.doc]http://www.cobolstandard.info/j4/files/07-0005.doc[/url] 2) The IBM "XML GNERATE/PARSE" statements, see; [url=http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/IGY3PG50/5.1 ]http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/IGY3PG50/5.1 [/url] * * * * I know that getting HTML input is NOT the same thing as parging/generating XML, but I think the similarities are such that using one of these two featurs could be extended to do what you are thinking about[/quote] I would have to dig into them a bit to see. However, the way XML day is formatted is fairly different from what we get in a query_string (for gets) or READ FROM KEYBOARD (for posts). The pattern in each of these is: var=someval&var2=someval&var3=someval etc. Of course some val could have values that need to be decoded using a URL-DECODE functionality. Basically replacing %## with its hex equivalent (I think). Thus %20 is a space. Now this can be done already natively with OpenCOBOL fairly easily. A few unstrings, SUBSTITUTES. Jim Currey's method of doing it is fairly nice, just a CALL. And that certainly works. I am proposing this idea because really a post or a get is nothing more than an accept. Utilizing this methodology would bring OpenCOBOL more in line with other languages. It would also add more to "native" web capability. ACCEPT VAR FROM POST "var" seems really intuitive to me as well. It's just natural. If someone wanted to make it more clear it could be FROM HTML-FORM-POST or WEB-POST or something. But I've a feeling that POST/GET would be just fine (would need to support both). It might be interesting to allow User Defined ACCEPTS. Then the functionality could be entirely coded in OpenCOBOL. ---------------------------------------------------------------- Subject: Two small questions When using VALUE SPACES or VALUE ' ' in the picture clause, I get nulls (ASCII 0) in the output file. However, if I move spaces to that variable - I get spaces (ASCII 0x20). Am I misunderstanding PICTURE clauses? Second question is how do you deal with the annoying non-breaking spaces at the front of some unicode files? Specifically UTF-8? ---------------------------------------------------------------- Dunno but the Add 1 to COBOL team loves your nick. ---------------------------------------------------------------- It would be nice to see the code (remember to use code tags). You may have tried to place your value statements inside the FD. It seems to me that some compilers allow this syntax but the contents of the data fields within an FD need to be set by the programmer at run time. I may be wrong on this issue, but that is my recollection. jimc ---------------------------------------------------------------- That's exactly it. I have the pic clause within an FD: 000000 FD SEQ-TICKER-DATA. 000000 01 TICKER-DATA. 000000 05 TRADE-DATE. 000000 10 TRADE-YEAR PIC 9(4). 000000 10 TRADE-MONTH PIC 9(2). 000000 10 TRADE-DAY PIC 9(2). 000000 05 SOME-BLANKS PIC X(2) VALUE ' '. 000000 05 OPEN-PRICE PIC 9(6)V9(2). 000000 05 HIGH-PRICE PIC 9(6)V9(2). 000000 05 LOW-PRICE PIC 9(6)V9(2). 000000 05 CLOSE-PRICE PIC 9(6)V9(2). 000000 05 VOLUME PIC 9(12). ---------------------------------------------------------------- All FD items are not allocated and therefore not initialized on program start (I think this is standard conform). If you want to initialize them do so by using [code]INITIALIZE TICKER-DATA ALL TO VALUE[/code] human ---------------------------------------------------------------- Subject: OC Kit from Add 1 to COBOL The OCKit is planned in stages. It's taking a long time to put together, because there is a lot to put together, trying to get all of the pieces right. Stage 1: OCKit4Web. This is a version of OpenCOBOL and company, entirely as a hosted solution. So persons will be able to sign up for free. They will receive a shell account from me. They'll then have a console in GNU/Linux to compile and test OpenCOBOL programs. If the tests that DamonH is doing turn out well, the entire interface may even be Web based. This version will have a great focus on Web App production. Stage 2: OCKitVM. This is a version of OpenCOBOL a guest inside a VirtualBox virtual machine (VM henceforth). Initially it will be Debian or Ubuntu [server] based. In the future other VMs might follow (BSD, Fedora, Suse, Puppy Linux etc). Due to licensing restrictions we will never be able to distribute a VM with Windows or Mac as the guest operating system. But the VMs we distribute will run on Windows, Mac and anywhere else VirtualBox runs. VirtualBox allows many useful features to allow OpenCOBOL inside a VM and apps compiled inside that VM to seem as if they are runing native. The two primary features are Seamless Windows and the fact that the Guest can communicate with the Host. So now output from STDIN, STDOUT, STDERR and others, can be routed both ways. OCKitVM will allow us to distribute a version of OpenCOBOL and company (see below) that doesn't really require native installs. So it will "just work" regardless of the operating system if runs in. So long as VirtualBox just works that is. Stage 3: OCKitNative. This version will be a native install for various operating systems. The first release of OCKitNative will be Ubuntu/Debian based. Fedora, BSD, OpenSolaris, Windows, Mac and others will follow. This is the largest undertaking because it requires a lot of testing and answering a lot of questions. Do we install OpenCOBOL to compile with VisualC? A freeware C compiler? GCC? If VisualC for instance, then we have to get a license for VisualC so we can test properly (I don't break software licenses). Because this is the largest of the jobs, it's also last on the list. The original idea for OCKit didn't even entail a native install, just an "instant on" virtual machine distribution. But demand for native installs means that eventually we'll need to create them. To do so we need volunteers. :D A note: Most of the conversation regarding OCKit will be taking place at http://add1tocobol.com. I have a plethora of tools there (more coming) that will allow me to track the OCKit varieties development, set roadmaps, tasks, follow bug reports and more there, that this forum doesn't really offer us. Link for this blog post: http://add1tocobol.com/blog/2010/11/12/ockit-stages/ ---------------------------------------------------------------- Hello. I hope this kit will also include all the tools to easily install and use Open COBOL under MS Windows,(Note to users unfamiliar with the Unix world and who do not practice the C language! and they are very very many ...) For me, the most efficient way to install and use Open COBOL under this OS is the distribution (beautifully documented) by Gary Cutler [06FEB2009]. If a developing solution SIMPLE GUI (still under MS Windows) is also available and well documented I'm interested. Regards. ---------------------------------------------------------------- Subject: HowTo: Create object files with OC cobc Hello, I want create object file (*.o | *.obj), but it doesn't work directly. I can create this over this command line... but hope also direct (!!! please help me !!!) [code]H:\mingw\bin>cobc -S \A.cbl & gcc.exe -c \A.s -o \A.o[/code] ...but this doesn't work... [code]H:\mingw\bin>cobc -c \A.cbl[/code] Please help me - Thanks -- Compiler: [code] cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Sep 10 2010 10:12:33 Packaged Feb 06 2009 10:30:55 CET [/code] The Program: [code] IDENTIFICATION DIVISION. program-id. A. DATA DIVISION. PROCEDURE DIVISION. display "Hello " with no advancing display "OpenCOBOL Developer" goback. exit program. [/code] The compiler line (Windows): [code]H:\mingw\bin>cobc -c \A.cbl[/code] The displays: [code]\A.cbl:1: unknown tag '' \A.cbl:2: unknown tag '' \A.cbl:4: unknown tag '' \A.cbl:6: unknown tag '' \A.cbl:7: unknown tag '' \A.cbl:8: unknown tag '' \A.cbl:10: unknown tag '' \A.cbl:12: unknown tag '' \A.cbl: no definition of 'name' \A.cbl: no definition of 'tab-width' \A.cbl: no definition of 'text-column' \A.cbl: no definition of 'assign-clause' \A.cbl: no definition of 'binary-size' \A.cbl: no definition of 'binary-byteorder' \A.cbl: no definition of 'filename-mapping' \A.cbl: no definition of 'pretty-display' \A.cbl: no definition of 'binary-truncate' \A.cbl: no definition of 'auto-initialize' \A.cbl: no definition of 'complex-odo' \A.cbl: no definition of 'indirect-redefines' \A.cbl: no definition of 'larger-redefines-ok' \A.cbl: no definition of 'relaxed-syntax-check' \A.cbl: no definition of 'perform-osvs' \A.cbl: no definition of 'sticky-linkage' \A.cbl: no definition of 'relax-level-hierarchy' \A.cbl: no definition of 'author-paragraph' \A.cbl: no definition of 'memory-size-clause' \A.cbl: no definition of 'multiple-file-tape-clause' \A.cbl: no definition of 'label-records-clause' \A.cbl: no definition of 'value-of-clause' \A.cbl: no definition of 'data-records-clause' \A.cbl: no definition of 'top-level-occurs-clause' \A.cbl: no definition of 'synchronized-clause' \A.cbl: no definition of 'goto-statement-without-name' \A.cbl: no definition of 'stop-literal-statement' \A.cbl: no definition of 'debugging-line' \A.cbl: no definition of 'padding-character-clause' \A.cbl: no definition of 'next-sentence-phrase' \A.cbl: no definition of 'eject-statement' \A.cbl: no definition of 'entry-statement' \A.cbl: no definition of 'move-noninteger-to-alphanumeric' \A.cbl: no definition of 'odo-without-to'[/code] ---------------------------------------------------------------- Quoting from the command cobc -h: [quote][code] -E Preprocess only; do not compile, assemble or link -C Translation only; convert COBOL to C -S Compile only; output assembly file -c Compile and assemble, but do not link -t Generate and place a program listing into [/code][/quote] I just tested to verify and -c will give a .o file. If that is the object file you are looking for, then you are good to go. ---------------------------------------------------------------- Except you said it is giving you issues. Missed that part. That's what I get for being tired all the time:D ---------------------------------------------------------------- -c does not work in the current mingw build. It's interpreted as short form for -conf. This is the reason why you get these warnings - it's just not a conf file you pass to cobc. The command -c is tested during "make check". Therefore I guess this important step was not done when compiling this MinGW version. It's very likely that one need a newer OC MinGQW binary for solving this issue (likely it has to be recompiled with newer MinGW libraries). human ---------------------------------------------------------------- Subject: CISAM files.... Hello... After lots of hours we managed to get some programms running! Most problems were at DISPLAY AND ACCEPT.. However all of them are fixed... Sometimes we can put background and foreground color together i dont know why.. However the problem... The old files were seperated to a data file(no extension) and an index (.idx) file... Found that it is C-ISAM file! The problem is that opencobol doesnt understand them.. The one solution is to regenerate them IT is possible because of the fixed length records.. However i found that there is a config option --with cisam However the library is missing configure: error: isam.h is required for CISAM Can i do anything for this??? :-D :-D ---------------------------------------------------------------- Yeah, See if you can't locate isam.h and get the dir included in the -I search path or Try and find out what development sources Roger had in mind when he tried out --with-cisam, --with-disam and --with-vbisam. [b]Roger?[/b] I'd like to add a source location in the FAQ. [i]cisam is a near useless googleword[/i]. ;) or stick with bdb, write conversion from the cisam system to flat, read the flat with a stock OpenCOBOL and write to a nicely soaked and fair to robust file system. Cheers, Brian ---------------------------------------------------------------- C-ISAM (the original one) is property of IBM. As they don't want to give it away free or open source you need to have it purchased. I think it doesn't make sense if you don't have it already. Be aware that MicroFocus use a different version of C-ISAM and that they maybe aren't 100% compatible. I suggest to convert the files as btiffin wrote: Convert the files to non-indexed files from the old COBOL runtime and load them into indexed files with OC. human ---------------------------------------------------------------- Thank you for the responses! The conversion isnt a big deal so we are going to convert them:). IBM claims that c-isam is faster than database etc. ---------------------------------------------------------------- I think both C-ISAM and VB-ISAM are faster than databases / OC's way of handling BDB like ISAM. If you rely on fast ISAM access you may give it a try, if not: use BDB (as most OC users do). human ---------------------------------------------------------------- Be aware of the license of Berkley-DB: For commercial programs you need to license BDB. See the posting here: http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1077&forum=1#forumpost5330 ---------------------------------------------------------------- What of this? http://www.mission-base.com/peter/source/pbl/doc/isamfile.html ---------------------------------------------------------------- And these.... http://freshmeat.net/articles/non-sql-databases-for-linux http://linuxfinances.info/info/dbmsisam.html And that leads me back to vb-isam. It seems that it stores the files in plain text. Maybe not but they are certainly readable via a cat at the command line. So I am curious if the issues with vbisam are all related to this? It would be great if we could compile all the isams in, or create our own via a plugable system. Then at compile time we could specify which isam we were using. In any case in those links are a couple of items that claim to be implementations of c-isam and others. What are the chances of us getting one of those and getting the aoirthoir away from bdb? ---------------------------------------------------------------- Which libraries claim to be C-ISAM compatible in the links you'Ve posted? I've only seen D-ISAM (OC's configure has --with-disam already). I'd check pblIsam and would patch OC for using it but only if there are C-ISAM compatible functions available (there is a PDF from IBM somewhere which explains every function), which doesn't seem to be, yet. You may want to talk with the developer of pblIsam about that topic. The type of ISAM is unimportant at compile time, because everything is done and linked to libcob.so/dll. Therefore you need to compile OC with every isam you'd like to have, once (you need the development headers of the different isams for that and the lib-files) and put them into own subfolders. You then could write an own startup wrapper reading some special env var, setting the correct $LD_LIBRARY_PATH/%PATH% variable afterwards and start the program (via cobcrun) with the parameters passed. But I'm not sure if this would be THAT cool. Better set COB_LIBRARY_PATH once and start cobcrun from the correct folder. human ---------------------------------------------------------------- There are only a couple that are C-ISAM. http://www.mission-base.com/peter/source/pbl/doc/isamfile.html as linked originally, which you've already read. The others are: Informix C-ISAM, OpenGroupISAM which is based on Informix, ByteDesigns, also claims compatibility to Informix. There are others that do not claim C-ISAM compatibility. but might or might not work. Am I understanding that you can compile all of the ISAMs into an OpenCOBOL install at once? Or would we have to have multiple compiles of OpenCOBOL to accomplish this? Ultimately i personally don't care about any specific Isam, just as long as it works, offers multiuser, doesn't break, doesn't lose data and so on. I keep being told that vb-isam gives us some issues, so not to keen on that. Since it stores data as plain text I've speculated whether that is the cause of its issues or not. BDB has the licensing issues already mentioned, so getting away from that would be great. ---------------------------------------------------------------- As far as I know, the OpenGroup makes only standards, not real implementations. The OpenGroup ISAM (standard) is only mainly based on Informix ISAM. ByteDesigns is DISAM which already works in OC as mentioned before. BNut be aware that there are licensing issues, too: you have to either pay a fee for a full version (with direct support) or register and update your version regularly as the evaluation versions have a time expiration (and FAQ/forum support only) AND THEY CANNOT BE DISTRIBUTED). The implementations inside OpenCOBOL for C-ISAM, DISAM and VBISAM are nearly the same (as they are nearly compatible). Therefore they work all well (or bad) in the same way. There could be issues with one of these inside the ISAM library (I read of problems with not-fixed formats for VBISAM and know of missing [working] recovery options for VBIASM files). By the way: Despite of the licensing issues of BDB I don't know of any working recovery option for broken BDB "ISAM" files. For OC: the only part that is compiled for special ISAM versions and linked to the libraries is libcob itself. If you compile something with cobc it is linked to libcob. Therefore you could compile programs and change the ISAM access by only using another libcob (that you have compiled before - with access to the dev-packages for the ISAMs you want to access). human ---------------------------------------------------------------- So why nobody makes a CISAM implementation? Is that so difficult? http://50001.com/db/informixside/data/cisam.pdf Is this the specification ?? I am thinking to implement one.. Berkeley database has issues.. Because programs crash or dont close properly , DB_HOME files have to be deleted... THis is a problem..I wonder how people deal with this since opencobol doesnt use DB_RECOVER flag.. Also files get screwed resulting in infite loops ,dont know why.. I think that improper lock releasing.. ---------------------------------------------------------------- I may did not made myself clear: VB-ISAM is a free and open source CISAM implementation. You can use it with OpenCOBOL if you like to. If you find any issues inside VB-ISAM you're free to fix them (although I'd suggest to start with the fixes that are available already). human ---------------------------------------------------------------- But VB-ISAM has a serius bug.. I have posted the bug no solution. The fix isnt easy..(Allows same primary key) ---------------------------------------------------------------- I'm quite sure fixing this bug in VB-ISAM is easier than implementing C-ISAM from scratch (and have to deal with the same problem). You're free to start your fix :-) human ---------------------------------------------------------------- Of course it is easier but because of the java connectors i would stick with Berkeley DB.. I noticed at fileio.c that secondary databases arent implemented as secondary database tables no db->associate(). I get corrupted files and i notice secondary indexes to be missing! Primary table has 1,2,3,4,5 primary keys for example.. Secondary database keys may be missing and not refe to primary! ---------------------------------------------------------------- When writing your own C-ISAM implementation you'd have to write your own data connector for it, too, OR try to use the commercial C-ISAM connectors [there are possibilities for evaluation versions] as you could do with VB-ISAM, too (if you do so please inform us about the outcome). From a quick glance, db->associate could be used, and it seems that this would simplify the data handling, too (as tables for ALTERNATE RECORD KEYs have not not be updated by libcob anymore). If you feel like, you're free to change fileio.c from feb-09 tarball and post the results (patch file / tests) in teh forum. This could work and if it does it may find it's way into OpenCOBOL 2.0. human ---------------------------------------------------------------- ok.. but i would like to know if you have made changes for berkeley at fileio.c for OC 2.0. ---------------------------------------------------------------- Of course there are a lot of fixes in fileio.c for upcoming OpenCOBOL 2.0, the BDB interface makes no exception. As there are currently no ground-braking changes (no db->associate, no DB_RECOVER, ...) I'd integrate your changes into the 2.0 version and pass it to Roger for a final examination. Therefore it's fine if you patch the feb09 tarball (latest public pre-release of 1.1). As it is good to do one by one please only change the db->associate stuff. For tests: especially have a look what happens when one of the BDB files for ALTERNATE KEYs is missing and if everything works fine WITH DUPLICATEs for them and without. human BTW: On changing fileio.c you may think about a possible way of returning status 39 (file definition does not match the COBOL definition), as this is one of the missing points in BDB interface (this is still true for OpenCOBOL 2.0) ---------------------------------------------------------------- The main problem (bug) with version VB-ISAM 2 is concurrency. Meaning that record locks do not work, neither on a locally or NFS. This results in the data file, and probably the index file, to become corrupt, when more that one process access the same VB-ISAM file at the same time. There are other bugs in version VB-ISAM 2, but the local concurrency (NFS ?) bug is the the most critical. It's solution would make VB-ISAM some what usable. OC's implementation with BDB, on the other hand, just duplicates C/D/VB-ISAM functionality, and is NOT free for commercial use. For mission critical applications, I would use C/D/-IS*M. Both companies have Linux versions, and can be configured for use with OC. ---------------------------------------------------------------- @essex: I've edited your post and inserted "VB-ISAM" where necessary. To BDB: I'm no lawyer but I thought there is an older version that could be used (maybe not distributed) with commercial use, too. human ---------------------------------------------------------------- I am not sure whether i should add things for berkeley database or fix VB-ISAM ( fork propably) and write java etc wrappers for it.. I am wondering why there isnt a good ISAM free implementation there or something equilivment.. ---------------------------------------------------------------- Yes, you may be able to use an early version of BDB. But you would have to go back, way back, to version prior to 1.86. That is when the license was changed. Version 1.85.4 is distributed under the Berkeley license. It is functional, but does not support file locks and has several serious bugs. Not really a realistic option, I don't think. ---------------------------------------------------------------- While working on TC, I wasted a lot of time searching for an open source ISAM library. I found bits and pieces here and there, but nothing close to VB-ISAM, bugs and all. So VB-ISAM is likely your best bet. ---------------------------------------------------------------- BDB prior to 1.86 is surely no option... I'm not sure but I thought you're free to use BDB and only aren't allowed to distribute it (this means bundling). Often BDB is used and one doesn't know it - for example in subversion. I think it's often installed by default in a lot of linux-distros, too. I'd personally like to see BDB improvements in fileio.c where we know it could help (db->associate in this case) and where we know it needs this (return file status 39, for example). Afterwards VB-ISAM improvements would be nice. I think it doesn't make sense to fork VB-ISAM currently as the author Trevor Van Bremen is back and wanted to get some patches in (his version is the original version 1.x of the VB-ISAM project at sourceforge). AND there is already a patched (but not yet published) version 2.0 (based on Rogers work, with all patches available in this forum and much more - but no solves for the locking problem) that will be available at the VB-ISAM project at sourceforge, too (when I find the time publish it). If you like to do work with VB-ISAM now, a JAVA data connector (based on the 2.0 version) would help. human ---------------------------------------------------------------- Perhaps it would be better, in the long term, do drop BDB. And concentrate development on VB-ISAM and other projects, such as a SQL pre-processor. ---------------------------------------------------------------- I am checking the vbisam code , it is nice but there are some problems there. I did a quick fix and it wont allow duplicate primary keys.I'll post the changes if any when complete.. ---------------------------------------------------------------- While the COBOL standard does not allow duplicate primary keys, C/VB-ISAM does allow duplicate primary keys depending on the 'k_flags' option (ISDUPS | ISNODUPS). The only unique key is record number (isrecnum). So I'm confused. What does 'a quick fix and it wont allow duplicate primary keys' actually mean. ---------------------------------------------------------------- http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1276&forum=1 Check this post.... Index is cached in vbisam,there was a flag indexchanged in vbisam but never set to true (not zero)..Setting that to true when writing a new index for example forces the program to read blocks of B+Tree nodes from start ,so problem solved partially...( not sure about performance issues) I want to check other details too. ---------------------------------------------------------------- I see. So this is part of the concurrency issue. I have a set of interactive programs, written in C, with add, change, delete functionality. The advantage of these is that these programs interface with the vb-isam library directly (no OC run-time). Due to it's size, I will not post these here, but if some one would like a copy, let me know. Also, the other OC also have a version of vb-isam, version 2.1.1 (last I checked), which fixes the concurrency issue. Well locally at least, not when using NFS. It is distributed under the GPL, so it may be used as reference. ---------------------------------------------------------------- Are you sure that 2.1.1 fixes the issue? ---------------------------------------------------------------- Well, the short answer would be NO. Perhaps the question would be better addressed by the maintainers of that version of vb-isam. AFAIK, there is no test suite available to verify ANY vb-isam version. Also, no tests to verify the OC run-time using any of the ISAM options. The C test programs I wrote are meant to be used a debugging tool. The current version run using the following options. - Primary key is set to ISNODUPS - Secondary keys are set to ISDUPS or ISNODUPS. - File cluster open is set to ISINOUT+ISFIXLEN+ISAUTOLOCK. Under these options, vb-isam-it-2.1.1 passed the tests, when run on a local Linux x86-32 machine. And failed when using NFS, under certain conditions. All versions of vb-isam-2 failed even these basic tests. ---------------------------------------------------------------- If you could send me your prog it would be nice. However i believe that if it worked it is because the disabled cache ,as i saw in change log.. ---------------------------------------------------------------- I've placed the source code tar archive [url=http://cobol.sourceforge.net/docs/d0123456789.tar.bz2]HERE[/url]. ---------------------------------------------------------------- Would be nice to see a preliminary patch, or at least the source code location of the 'flag index changed'. ---------------------------------------------------------------- I had lot of work to do and i havent paid too much attention at vbisam..yet The problem is that it caches the index nodes and it doesnt check whether changes have been done in the physical index file. I think that this may scr*w the B+Tree. As i know -not sure- there isnt a 100000% reliable way to tell whether changes have been made to file at least with 100% precision and not have significant cost. stat results may be faked by user, or filesystem issues ,or not good precision.So the solution would be to read from disk the necesary blocks again,or a special flag in the file maybe, or some Inter Process Comm stuff. In vbkeysio.c [code]static int itreeload (const int ihandle, const int ikeynumber, const int ilength, unsigned char *pckeyvalue, off_t tdupnumber)[/code] There is } else if (psvbptr->iindexchanged) { However iindexchanged is always=0. I set iindexchanged to a non zero value in irowinsert and seems to work.. However this isnt ok.I think that it loads the whole tree --not good idea. I have also reviewed in some detail vblowlevel.c There things seem to be ok ,however if a file is already opened and you try to open it again it wont get a new handle,as they are cached..I dont know whether this is a problem but opening the same file more than one time in one proccess locking wont work as expected. Also for windows strcmp should i strcmpi i think as in windows files are case insensitive.However just a new handle would be created not real problem though. ---------------------------------------------------------------- Works when a change is made, but does not seam to work for add or delete. It will delete/add the data record and index entries in the deletion/add instance. The index entries for the other instance are not updated. Example: [code] Instance 1: #detest07 Open file status=0, iserrno=0, isrecnum=1 Instance 2: #detest07 Open file status=0, iserrno=0, isrecnum=1 Instance 1: Select action [ a=add c=change d=delete x=exit ] :d Enter key :41 Delete (Read): key 041 isrecnum=15 status=0 iserrno=0 '041 Group041 Item041 0150 ' Delete (Delete): isrecnum=15 : '041 Group041 Item041 0150 ' Select action [ a=add c=change d=delete x=exit ] :b Enter key :151 Browse (ReadError): key 151 isrecnum=0 status=-1 iserrno=111 'No row found ' Instance 2: Select action [ a=add c=change d=delete x=exit ] :b Enter key :41 Browse (Display): recnum=15 '' Select action [ a=add c=change d=delete x=exit ] :a Enter key :151 Add (ReadError): key 151 isrecnum=0 status=-1 iserrno=111 No row found Enter group :151 Enter item :151 Enter description :0151 New record : isrecnum=32, '151 Group151 Item151 0151' [/code] BTW, I found the following comments which are of interest. isinternal.h [code] struct DICTINFO { ... off_t ttranslast; /* Used to see whether to set iindexchanged */ unsigned char iindexchanged; /* Various */ /* 0: Index has NOT changed since last time */ /* 1: Index has changed, blocks invalid */ /* 2: Index has changed, blocks are valid */ ... [/code] vblocking.c [code] If we're in C-ISAM mode, then there is NO way to determine if a given node has been updated by some other process. Thus *ANY* change to the index file needs to invalidate the ENTIRE cache for that table!!! If we're in VBISAM 64-bit mode, then each node in the index table has a stamp on it stating the transaction number when it was updated. If this stamp is BELOW that of the current transaction number, we know that the associated VBTREE / VBKEY linked lists are still coherent! [/code] ---------------------------------------------------------------- Subject: Compute not working as expected We have a few Programs that do some date arithmetic using the compute statemant to trim of the day of a date and substituting it by 01. In the following example we would expect a result of 20991201, but are getting 20991232. While using 2 computes gives us the correct result. Compute MYDATE-1 = MYDATE-1 / 100 Compute MYDATE-1 = MYDATE-1 * 100 + 1 BTW. MF-Cobol gives us the expected result. Does anyone have an idea? [code] IDENTIFICATION DIVISION. PROGRAM-ID. comptest. ENVIRONMENT DIVISION. CONFIGURATION SECTION. DATA DIVISION. WORKING-STORAGE SECTION. 01 MYDATE-1 PIC 9(8) VALUE 20991231. PROCEDURE DIVISION. display 'before Compute MYDATE-1=' MYDATE-1 compute MYDATE-1 = MYDATE-1 / 100 * 100 + 1. display 'after Compute MYDATE-1=' MYDATE-1 goback. [/code] Regards, Franklin ---------------------------------------------------------------- The result without compileflags with MF Cobol is 20991232. The compute should round only at the end of a calculation. With MF you can control the behavior by setting the compileflag ARITHMETIC to OSVS: cob -zgU -C "ARITHMETIC=OSVS" a.cbl ---------------------------------------------------------------- Thanks Mado, Yes, you're absolutly right. We have a specific option in the MF cobol.dir which is: ARITHMETIC"VSC2". This allows us to be Host compatible. Is there a way of changing the arithmetic behavour of OpenCobol? Regards, Franklin ---------------------------------------------------------------- Subject: How to get record size of indexed file Hi, I'm trying to find out the actual record size of an indexed file. I'm using default BDB on Ubuntu linux, created a index file with record size of 80 bytes. When I'm reading that file with READ statement but this time my FD record size is 60 bytes only, I'm expecting file status to be '02' as the actual record size is 80 bytes. I'm getting '00' file status with data truncated to 60 bytes. Is there a way I could detect data getting truncated ?. ---------------------------------------------------------------- You mean from OC program? Or you want to see the physical structure (rec len, keys, etc.) giving some indexed file? If former, it seems that OC doesnt do any check if the physical file matches with declared sizes and keys. If later, check in Oracle's (or over the web) site if is any BDB utilities to do that. Regards. ---------------------------------------------------------------- I saw this at work, thinking all uppety, that I'd just have to post Look for db_stat Yeah, not so. Ran it on the indexing.dat sample and got, [code] $ db_stat -d indexing.dat -f Wed Nov 17 21:21:45 2010 Local time 53162 Btree magic number 9 Btree version number Little-endian Byte order Flags 2 Minimum keys per-page 4096 Underlying database page size 1007 Overflow key/data size 0 Number of levels in the tree 12 Number of unique keys in the tree 12 Number of data items in the tree 0 Number of tree internal pages 0 Number of bytes free in tree internal pages (0% ff) 0 Number of tree leaf pages 0 Number of bytes free in tree leaf pages (0% ff) 0 Number of tree duplicate pages 0 Number of bytes free in tree duplicate pages (0% ff) 0 Number of tree overflow pages 0 Number of bytes free in tree overflow pages (0% ff) 0 Number of empty pages 0 Number of pages on the free list [/code] Yeah, ok, 12 records. What else? Where is the key info, bob loblaw. So, now humbled. ;-) And from a Google book, scroll to page 12 from http://books.google.ca/books?id=eEWRf3scrfwC [quote] On the one hand, Berkeley DB cannot provide the programmer with any information on the contents or structure of the values that it stores. The application must understand the keys and values that it uses. ... [/quote] So I doubt you'll get any tools from Oracle for quick info. But, we have access to OC source code. Time to dig in... ... poking around in libcob/fileio.c, the IndexFile struct doesn't seem to hold much easy to get at stuff. A sample call definition [code] static int indexed_read (cob_file *, cob_field *, const int); [/code] doesn't really help either. All the record and key size information seems to be in the COBOL data division. :cry: and this just reinforces that belief. [code] struct cob_file_key { cob_field *field; /* Key field */ int flag; /* WITH DUPLICATES (for RELATIVE/INDEXED) */ /* ASCENDING/DESCENDING (for SORT) */ unsigned int offset; /* Offset of field */ }; [/code] More soon if anything comes up. More reading to do. Cheers, Brian ---------------------------------------------------------------- After going through BDB documentation, I came to know that, after READ, BDB does provides record size. And I traced it to below code snippet in libcob/fileio.c [code] f->record->size = p->data.size; memcpy (f->record->data, p->data.data, p->data.size); ... ... switch (ret) { case COB_STATUS_00_SUCCESS: f->flag_first_read = 0; f->flag_read_done = 1; f->flag_end_of_file = 0; f->flag_begin_of_file = 0; if (f->record_size && f->organization != COB_ORG_LINE_SEQUENTIAL) { cob_set_int (f->record_size, (int) f->record->size); } break; [/code] Okay now, how do I access this f->record_size variable back in COBOL program ? If I can, my problem is solved. ---------------------------------------------------------------- Yeah, I'm pretty sure f->record_size is loaded from the FD and 01 record definition. So, I think the source code knows, but it might not be a field you can query. This could get deep. ;-) Cheers, Brian ---------------------------------------------------------------- After tracing lot of code, I have come to conclusion that we can use below COBOL facility to capture the record size [code] FD MASTER-FILE RECORD VARYING FROM 1 TO 1024 CHARACTERS DEPENDING ON WS-RECORD-LENGTH. ... ... 01 WS-RECORD-LENGTH PIC 9(4) COMP. [/code] After the READ statement, WS-RECORD-LENGTH variable will have the actual record size read. Happy to go with this approach :-) ---------------------------------------------------------------- [i]... it could get deep ...[/i] or it could be built in. ;) Nice. Cheers, Brian ---------------------------------------------------------------- If you don't have a VARYING clause OC should fire status 39 if the record length is not the same as it should. I don't have access to OC environment in the next days, can someone please check if the size is compared after the READ to the size the file should have? BTW: the keys are splitted to sub-files by OpenCobol, therefore BDB can never know how many keys the file has. human ---------------------------------------------------------------- You should never get a FS=39 on a READ only on an OPEN. It is intended to indicate that the "physical file attribes" at OPEN time (for input or I-O) does not match the attributes that were assigned the file when it was created. As I understand this thread, they are just trying to get the record length of a specific RECORD at READ time, not of the file (at OPEN time) ---------------------------------------------------------------- @wmklein: yes, I'm aware of this. If I remember right, OC does not fire status 39 with BDB at all, but it seems that it could be done at least for record length (maybe structure, too) via some (internal) READ on OPEN. human ---------------------------------------------------------------- I'm now hit with roadblock, I have a indexed file which does not have VARYING clause in FD section; is there any alternative way to get record size for the READ record ? ---------------------------------------------------------------- You own the source code don't you? Why notADD the VARYING clause to your FD? Then you can get the record length each time you do a READ. ---------------------------------------------------------------- Subject: Looking for Alpha Tester Hello, we write an OSS Eclipse PlugIn for COBOL Development (use OpenCOBOL as Compiler). I hope here are one, two or more people who want to test the first [b]alpha[/b] version? With best regards Sebastian ---------------------------------------------------------------- Nerger, Would it be cool for us to post the call on Add1tocobol.com? Or if you prefer you can add it yourself? I am available to beta test, but this week is mad busy so alpha testing is out of the question until December for me. ---------------------------------------------------------------- I would like to test it - thought about writing my own plugin for a few times! ---------------------------------------------------------------- Show us the link to download it. Better if can be put in "dropins". BTW, I used lates the eclipe's Cobol plugin (now archived), Cobos and Cobol-IT and the best to my point of view is Cobol-IT's plugin. Regards. ---------------------------------------------------------------- Hello, the first informations for COBOL development Environment (like CDT or JDT we called it CODE). CODE is hosting at GoogleCode EclipseLabs and need to work a Eclipse HELIOS release (3.6). We have uploaded a "pre"-alpha version (for us to test installation way) and you to test. [b]compiler[/b] CODE need a existing OpenCOBOL compiler and complete environment (next CODE "milestone" included inline environment configuration). See here on OpenCOBOL.org for OpenCOBOL installation and Programmers Guide to set environment variables. It is a good idea to use WASCANA on windows platforms. [b]online installation[/b] You can install CODE over Eclipse Marketplace or using [url=http://svn.codespot.com/a/eclipselabs.org/code/trunk/UpdateSite/]UpdateSite URL "http://svn.codespot.com/a/eclipselabs.org/code/trunk/UpdateSite/"[/url]. [b]offline installation (dropins)[/b] Use online installation. Use online Installation! OK, use online Installation (!!!) or browse between our [url=http://code.google.com/a/eclipselabs.org/p/code/source/browse/trunk/UpdateSite/]SVN repository to UpdateSite[/url]. Download all files from feature and plugins folder to local $ECLIPSES_HOME/dropins/code/feature or .../plugins folder and restart Eclipse. [b]deinstallation[/b] Goto "Help=>About" dialog and click "installation details" button. Select CODE in the installation list and press "Uninstall" button. [b]configure compiler path[/b] You need to select compiler path and name in COBOL preferences (Menu Window=>Preferences). The version 0.1.2 is a pre-alpha-release and can only :-D : - simple syntax highlightning - create COBOL project - incremental compile source (only with param -S), because -c doesn't work - bad content assist What do you really want? We want to implement at next: + multiple build targets - .o / executable / shared object (dll) + environment variable for full IDE + better content assist + wizards for cobol source files + integrate help (but programmers guide only PDF?) + integrate TP-COBOL-DEBUGGER ...and test under linux With Regards Sebastian -- Installation hat in Berlin geklappt, könnte auch in Bochum funktionieren :-D ---------------------------------------------------------------- Hi, installed in without no time. But there is a problem with my cygwin cobc.exe. Everytime I chose the correct path to the cobc.exe (C:\cygwin\bin) my Eclipse 3.6 will freeze. The porgress panel shows "Invoke Open Cobol" for ever. Could it be that the use of the param "-S" is not the best way to do so? Beacuse you will need a gcc compiler in the same path? What about invoking cobc with "-E" -> so I could see the compile errors without invoking gcc. Up to today I'm using UltraEdit with a custom command invoking "-g -Wall -Wcolumn-overflow -Wtruncate -Wlinkage -Wunreachable -Wstrict-typing -fsyntax-only -v". So for me it would be nice if you could give me the chance to invoke cobc.exe with my own parameters :-). Further things - I don't have any syntax highlighting - no content assist what I really want - own cobc parameter because of bs2000 conf file and so on... - section/paragraph outline if i could give you some help, i will do so in the next week (short holiday trip from now to monday sry about that :-)) EDIT: Here is the output log with "-v" [code] preprocessing C:\cob\testcob.cob into /cygdrive/c/DOKUME~1/GANDALF8/LOKALE~1/Temp/cob6852_0.cob translating /cygdrive/c/DOKUME~1/GANDALF8/LOKALE~1/Temp/cob6852_0.cob into /cygdrive/c/DOKUME~1/GANDALF8/LOKALE~1/Temp/cob6852_0.c gcc -pipe -I/usr/local/include -Wno-unused -fsigned-char -shared -DDLL_EXPORT -DPIC -Wl,--export-all-symbols -Wl,--enable-auto-import -o C:\cob\testcob.dll /cygdrive/c/DOKUME~1/GANDALF8/LOKALE~1/Temp/cob6852_0.c -L/usr/local/lib -lcob -lm -lgmp -lintl -lncurses -ldb sh: gcc: command not found [/code] ---------------------------------------------------------------- Hi Gandalf80, [quote] installed in without no time. But there is a problem with my cygwin cobc.exe. Everytime I chose the correct path to the cobc.exe (C:\cygwin\bin) my Eclipse 3.6 will freeze. [/quote] Please edit your eclipse.ini file and insert in first line "-consoleLog". I hope a Java Exception come to show the reason. [quote] The porgress panel shows "Invoke Open Cobol" for ever. [/quote] I don't know and haven't see it. Can you make a screenshot? [quote] So for me it would be nice if you could give me the chance to invoke cobc.exe with my own parameters :-). [...] what I really want - own cobc parameter because of bs2000 conf file and so on... [/quote] We have extend the main COBOL preference site. A simple help, while build concept not implemented. [quote] Further things - I don't have any syntax highlighting - no content assist [/quote] Please check follow: Are COBOL sources in ResourceView marked with blue .cbl Icon? I hope so! Then use one time the Context Menu on file, select OpenWith... and COBOL Source (next Version COBOL Editor). I think you open COBOL sources only with TextEditor. TextEditor have no COBOL specific functions... [quote] what I really want [...] - section/paragraph outline [/quote] For good OutlineView we need a AST (Abstract Syntax Tree) implemented in Java. I found KOOPA, but it doesn't compile here. I think minimalistic parser can easy identify SECTIONs, because it is a section then... ... no special identifier on index 6 == pos 7 ... not a comment ... not a reserved word ... user word following by SECTION following by dot and is start a section. With best regards Sebastian -- Ich hoffe dein Urlaub war schön, ich und Sebastian nutzen hier MinGW... Bei uns liegt "cobc" im gleichen Verzeichnis wie der GCC. Während des Compilieren wird nun der PATH um den Pfad des cobc erweitert, so dass auch der gcc gefunden wird. Scheinbar ist dies bei dir / bei cygwin anders, da du die Fehlermeldung erhälst sh: gcc: command not found... Einen Versuch wäre Wert, die PATH Variable vor dem Start von Eclipse auf das gcc-Verzeichnis zu erweitern. ---------------------------------------------------------------- Hi Sebastian, fantastic news! Seems like you've just joined and directly started to do such cool things (are there other persons here from your project/company)? Do you see any problems using a VC- or WATCOM-build of OpenCOBOL for use with CODE? One thing is missing in your minimalistic section parser: the user word (= section name) must follow a dot, must be followed by section, must be followed by dot. You could outline paragraphs, too, by doing the same like you want to do for sections, but: The user word (= paragraph name) must follow and be followed by a dot. Maybe you want to use the parsers from cobc to do "live syntax checking" during source editing (like you can enable for JAVA and C++ in eclipse). One of the later COBOL for eclipse project does this (I think it was COBOS). If you could get this to work you save a lot of parser stuff. Despite of the things said already by others (and said that there was no testing by me, yet): For the editor: I'd like you to add .cob, .cobol, .cpy and .copy as additional file extensions for COBOL source files. I'd like to see the definitions of vars without the need of going to the program head (or to search the copies for the definitions, but the copy-files-part can be done later). I'd like to see the possibility to go to called programs in the editor (at least if they are in the same source file or there is a source file with the same name within the same COBOL project) / used copies. I'd like to have code-folding one day. I'd like to have an option to add other extensions [especially useful if pre-parsers or some weird source extensions are used]. I'd like to see a pre-parser option. The most simply solution would be a batch that is called before cobc is invoked. The generated .cbl-file should be saved somewhere if you want to debug it later on. Maybe an option "call cobc directly" or "call cobc indirectly, using a batch file" would be good in every case. With that option one could create a batch where all necessary env vars and other stuff (like call of pre-parsers) could be set before cobc is invoked. Later on an option "call cobc remote" would be nice, where a server IP/Port can be chosen. On that port there has to be a server prog that listens for eclipse (or other) clients that send COBOL source files and compile options. These would be processed by a batch file and possible error lists would be send back. What do you think of all these points? human BTW: Do you have a roadmap/bug-/feature-tracker online, already? What are the release plans for alpha2? ---------------------------------------------------------------- Hi, I've done two things today in the morning. - added cygwin/bin to my path - Open With "Cobol-Editor" 1. works better now but not good :-(. Here is a short example of my problem [code] C:\cygwin\bin\cobc.exe -S C:\Java\workspaceEclipse36\testcob\src\cbl/testcob.cbl [/code] works fine while [code] C:\cygwin\bin\cobc.exe -S -v C:\Java\workspaceEclipse36\testcob\src\cbl\testcob.cbl /cygdrive/c/DOKUME~1/GANDALF/LOKALE~1/Temp/cob3428_0.c:0: fatal error: can't open C:JavaworkspaceEclipse36testcobsrccbltestcob.s for writing: No such file or directory compilation terminated. [/code] will abort. With changing only the last "\" to "/" cobc works? Well I hate this "\" "/" things :-) - not sure what to do with it. The second command is the command invoked by eclipse now :-(. 2. Creating a new File called "testcob.cbl" will not be opened by the cobol editor automatically. You have to choose the cobol editor first but then it works an I have some Syntaxhighlighting. About the outline - when you search for "SECTION." it must not be the last word in a line - it can be followed by spaces or something like that. (I'm using a reg exp for my UltraEdit fetching the section names :-) ) Greetings from Bochum Stefan PS Vielleicht sollte ich doch mingw mal installieren, ist aber auf dem Firmenrechner nicht gewünscht während cygwin hier bereits vorinstalliert ist :-). ---------------------------------------------------------------- Subject: Link Error Hello All, I am getting "test1.obj : error LNK2019: unresolved external symbol __imp__cob_display referenced in function _test1_" at the time of linking my first opencobol program. I am using Windows 7 64-bit and opencobol 1.1 binary. Please help. Thanks Joydeep ---------------------------------------------------------------- Which binary do you talk about? Do you link with cobc directly or not (seems like the link to libcob.lib is missing)? Please post the exact link to the binary (or link to source files and link to project file) and the output from cobc -verbose [your params]. human ---------------------------------------------------------------- You wrote in other thread that you are using VS2010, and I don't have it yet, so I can't say for sure, but it looks like MS changed naming. Assuming you are exactly precise on what you wrote, I see unresolved as "__imp__cob_display" with 2 underscores between "imp" and "cob". VS2008 produces name "__imp_cob_display" - with 1 underscore, and this name is present in libcob.lib So, it looks you have 2 choices. The first one is to build OC using VS2010, and the second is to install VS2008, or at least free SDK with VC++ compiler from VS2008 (i.e. Microsoft (R) C/C++ Optimizing Compiler Version 15.00.30729.01 for x64) ---------------------------------------------------------------- Now I am using VC++ 2008 Express. But still I am getting that error with Kiska OC 64-bit binary. [code]c:\OpenCobol>cobc -version cobc (OpenCOBOL) 1.1.20100317 Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Keisuke Nishida Copyright (C) 2006,2007,2008,2009,2010 Roger While This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Built Mar 22 2010 15:29:59 Packaged Mar 17 2010 19:06:34 UTC c:\OpenCobol>cobc -x test1.cob cob71BA.c test1.obj : error LNK2019: unresolved external symbol __imp__cob_stop_run referenced in function _main test1.obj : error LNK2019: unresolved external symbol __imp__cob_init referenced in function _main test1.obj : error LNK2019: unresolved external symbol __imp__cob_set_cancel referenced in function _test1_ test1.obj : error LNK2019: unresolved external symbol __imp__cob_check_version referenced in function _test1_ test1.obj : error LNK2019: unresolved external symbol __imp__cob_fatal_error referenced in function _test1_ test1.obj : error LNK2019: unresolved external symbol __imp__cob_module_leave referenced in function _test1_ test1.obj : error LNK2019: unresolved external symbol __imp__cob_display referenced in function _test1_ test1.obj : error LNK2019: unresolved external symbol __imp__cob_module_enter referenced in function _test1_ test1.exe : fatal error LNK1120: 8 unresolved externals [/code] Thanks. ---------------------------------------------------------------- Can you post the result of [code]cobc -v -x test1.cob[/code] ? ---------------------------------------------------------------- [code]c:\OpenCobol>cobc -v -x test1.cob Preprocessing: test1.cob to C:\Users\Joy\AppData\Local\Temp\cobBA9E.cob Return status: 0 Parsing: C:\Users\Joy\AppData\Local\Temp\cobBA9E.cob Return status: 0 Translating: C:\Users\Joy\AppData\Local\Temp\cobBA9E.cob to C:\Users\Joy\AppData\Local\Temp\cobBA9F.c Executing: cl /c -I c:/OpenCobol /MD /Fo"test1.obj" "C:\Users\Joy\AppData\Local\Temp\cobBA9F.c" Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. cobBA9F.c Return status: 0 Executing: cl /MD /Fe"test1" "test1.obj" c:/OpenCobol/libcob.lib c:/OpenCobol/mpir.lib /link /manifest Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. Microsoft (R) Incremental Linker Version 9.00.30729.01 Copyright (C) Microsoft Corporation. All rights reserved. /out:test1.exe /manifest test1.obj c:/OpenCobol/libcob.lib c:/OpenCobol/mpir.lib test1.obj : error LNK2019: unresolved external symbol __imp__cob_stop_run referenced in function _main test1.obj : error LNK2019: unresolved external symbol __imp__cob_init referenced in function _main test1.obj : error LNK2019: unresolved external symbol __imp__cob_set_cancel referenced in function _test1_ test1.obj : error LNK2019: unresolved external symbol __imp__cob_check_version referenced in function _test1_ test1.obj : error LNK2019: unresolved external symbol __imp__cob_fatal_error referenced in function _test1_ test1.obj : error LNK2019: unresolved external symbol __imp__cob_module_leave referenced in function _test1_ test1.obj : error LNK2019: unresolved external symbol __imp__cob_display referenced in function _test1_ test1.obj : error LNK2019: unresolved external symbol __imp__cob_module_enter referenced in function _test1_ test1.exe : fatal error LNK1120: 8 unresolved externals Return status: 2[/code] Thanks. ---------------------------------------------------------------- [code]Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86 [/code] - you are using 32-bit compiler and trying to link to 64-bit libraries :-) This OpenCobol build is 64-bit and requires x64 compiler. ---------------------------------------------------------------- VC++ 2008 Express 32-bit is available from MS website. I didn't get 64-bit VC Express. And for OpenCobol, I am using OpenCOBOL-1.1-06FEB2009-mingw about which it is written in the website - "The EXEs and DLLs have been run on Windows XP, Windows Vista and Windows 7 systems using both AMD and Intel processors with both 32-bit and 64-bit operating systems." Thanks. ---------------------------------------------------------------- Than you can get and check 32-bit VS2008 version of OpenCobol from http://kiska.net/opencobol/1.1/opencobol-1.1-win-vb-win32-bin.zip ---------------------------------------------------------------- Now I am getting this error with OC 32-bit from Kiska. [code]c:\OpenCobol>cobc -x test1.cob test1.cob:11: Warning: Line not terminated by a newline cobE05F.c 'mt' is not recognized as an internal or external command, operable program or batch file.[/code] Thanks. ---------------------------------------------------------------- When invoking MS C compiler from command line (which is done implicit by cobc for VC) all env vars should be set before. For VC2008 it is [code]%VS90COMNTOOLS%\vsvars.bat cobc -x test1.cob[/code] human ---------------------------------------------------------------- Thank you, Human. That solved my problem. Now I have VC++ 2008 Express and OC 32 bit. That kind of solved my other problem in ODBC (in other thread). Thank you all. :-) But now do I have to call %VS90COMNTOOLS%\vsvars.bat everytime before I call cobc? How do I write those VC++ env variables permanently? Thanks again. :-) ---------------------------------------------------------------- You have to call this batch only one time per console. If you don't start cobc from console but from another program I suggest to not call cobc.exe but cobc.bat with a content like [code]%VS90COMNTOOLS%\vsvars.bat cobc %*[/code] human BTW: You can set some OC vars in this batch if you have an OC -version compiled for C:\OpenCOBOL and want to put it in a different directory, too. Parameters you're always using (like -std for example) can be put there, too. ---------------------------------------------------------------- Subject: OCWebEditor Project I just wanted to wet everyones appetite for the new OCWebEditor.  Currently it is still in pre-alpha meaning it is still in design/development phase. The intention of this project is to provide an on-line Editor/Compiler/Debugger for OpenCOBOL.  The idea was arrived at looking at Gary Cutlers OCic.  I thought that was a wonderful idea and I created a very simple front-end for the compiler on the web.  During the iterations of edit/upload/compile/test I was getting more and more frustrated with all the switching from one app to another. That was when I decided I needed a full COBOL IDE with the ability to compile right there on the web. Thus the OCWebEditor was born. For further information head on over to Add1to[url=http://add1tocobol.com]Add1to Cobol[/url] ---------------------------------------------------------------- Just to ditto; I've had the honour of testing a few of the pages. Damon is on to something here. It's pretty cool, and I'd like to do a little motivational "hear hear" ;-) Umm, [i]hear, hear[/i] Cheers, Brian ---------------------------------------------------------------- Please don't forgive to make the use of one (or more) pre-compilers possible by some config entry etc., for being able to "do stuff" with the files from the web interface. I think the most easiest way of doing that would be calling a batch file for compiling (one could do all the pre-parsers there). The only problem here could be the debugger. As mentioned to Federico before: His debugger could be used for that (and other purposes), too, if one would split screen i/o into sub-programs that could be changed. The standard sub-prog would do real screen i/o, another could do that on the web, ... human ---------------------------------------------------------------- Hey thanks guys. I really appreciate the support. As I move forward I would like to incorporate all good ideas into the OCWebEditor. As I am a newbie at pretty much most of this technology going into this I am sure I will need mucho grande help. So, having said that. Once I have the alpha stage moving where it is viable for the single user model, I want to get all the source up on an svn. Aoirthoir has indicated that he should have this available sometime next week Once moved there I will let you know. Maybe this can collaborative effort? I dunno.. I am willing to give it my best go though. Tonight I am hooking in the RUN button to allow you to actually run the COBOL you just compiled. The best part is it is at a stage now where I can do most of my dev online using the editor :D. Anyway, again thanks for the encouragement. Cheers! Damon ---------------------------------------------------------------- Subject: How to call a DLL function with VC OpenCobol Hi, using the binaries VC from http://www.kiska.net/opencobol/ I tried to call C DLL functions from Cobol. I only got this to work if the DLL has got the same name as the function I'd like to call, e.g. to call x() it has to be in x.dll But, as I have several functions in the DLL, this is not a good way. I built with: cl /LD /o chello.dll cargs.c cobc -x cmain.cbl -l chello.lib does not work, this is being passed to the linker who complains that it does not know the option. I also had a look at this thread, but found no solution: http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1135&forum=1&viewmode=flat&order=ASC&start=40 Thanks, Juergen ---------------------------------------------------------------- OC CALL interface uses LoadLibrary() & GetProcAddress() functions in case of Windows OS. It will always look for the *.dll '*' being module name you supply to CALL statement. May be I would try passing function name as part of the CALL stmt and then in the dll code I would call required function based on the function name received. This approach will fail, if the dll you are calling is a third party dll. ---------------------------------------------------------------- Continuation to my previous reply..... If it is a third party library, you could write a small wrapper module in C to call specific library function. You can then call this wrapper from OC program supplying necessary arguments. Hope this will overcome the hurdle :-) ---------------------------------------------------------------- See http://opencobol.add1tocobol.com/#what-is-cob-pre-load just in case. It might help. Cheers, Brian ---------------------------------------------------------------- COB_PRE_LOAD would surely help. OK, this can be annoying if you have a lot of dlls you want to use that way. But it DOES work! human ---------------------------------------------------------------- In x64 mode it is easy: dyn2.cbl [code] IDENTIFICATION DIVISION. PROGRAM-ID. DDD. ENVIRONMENT DIVISION. CONFIGURATION SECTION. DATA DIVISION. WORKING-STORAGE SECTION. PROCEDURE DIVISION. display 'Program DDD in dyn2.dll'. goback.[/code] dyn.cbl [code] IDENTIFICATION DIVISION. PROGRAM-ID. DYN. ENVIRONMENT DIVISION. CONFIGURATION SECTION. DATA DIVISION. WORKING-STORAGE SECTION. 01 DLL-NAME. 05 FILLER PIC X(8) VALUE 'dyn2.dll'. 05 FILLER PIC X VALUE LOW-VALUE. 01 PGM-NAME. 05 FILLER PIC X(3) VALUE 'DDD'. 05 FILLER PIC X VALUE LOW-VALUE. 01 HANDLE PROCEDURE-POINTER. 01 FILLER. 05 PGM PROCEDURE-POINTER. 05 PGMI REDEFINES PGM PIC S9(18) COMP-5. PROCEDURE DIVISION. DISPLAY 'Program dyn'. CALL 'LoadLibraryA' USING DLL-NAME RETURNING PGM. IF PGMI = 0 DISPLAY 'Can not load ' DLL-NAME GOBACK END-IF. MOVE PGM TO HANDLE. CALL 'GetProcAddress' USING BY VALUE HANDLE, BY REFERENCE PGM-NAME RETURNING PGM. IF PGMI = 0 DISPLAY 'Can not resolve ' PGM-NAME GOBACK END-IF. CALL PGM. DISPLAY 'End program dyn'. GOBACK.[/code] result: [code]G:\skatests\cobol>cobc -m dyn2.cbl cob2C2.c Creating library dyn2.lib and object dyn2.exp G:\skatests\cobol>cobc -x -fstatic-call dyn.cbl cob2C6.c G:\skatests\cobol>dyn Program dyn Program DDD in dyn2.dll End program dyn[/code] ---------------------------------------------------------------- As I understand this is a Visual Studio Windows only problem, isn't it? Unfortunately the given workarounds seem not to be the most comfortable ones. Wouldn't it possible to dispatch to C dlls directly like on the other platforms? Maybe one could link the Cobol executable with the .lib files of the dlls and the runtime could resolve the functions within the linked libs. Or one could use a mechanism like Microsoft's ancient .def files which could be used by the cobol compiler at compile time to resolve dynamically called dll functions. I guess this would basically be COB_PRE_LOAD compiled into the executable. Juergen ---------------------------------------------------------------- The option -l of cobc was only working for MinGW in Windows. All other compilers including VC, Watcom, Borland, ... were broken [MAYBE Intel worked, too]. I've fixed that for the Win-Compilers that I can access some months ago, the fix will be included in the 2.0 pre-release (hopefully coming in December '10/January '11). If you want to compile OC on your own I can publish the fixed part in cobc again. Therefore: Seems like a solved problem (OK, you maybe have a little bit to wait for the pre-release) human ---------------------------------------------------------------- I think you always can do static linking: [code] IDENTIFICATION DIVISION. PROGRAM-ID. DSTAT. ENVIRONMENT DIVISION. CONFIGURATION SECTION. DATA DIVISION. WORKING-STORAGE SECTION. 01 PGM PIC X(8). PROCEDURE DIVISION. DISPLAY 'Program dstat'. CALL 'DDD'. MOVE 'DDD' TO PGM. CALL PGM. DISPLAY 'End program dstat'. GOBACK.[/code] [code]G:\skatests\cobol>cobc -m --save-temps dyn2.cbl dyn2.c Creating library dyn2.lib and object dyn2.exp G:\skatests\cobol>cobc -x -fstatic-call dstat.cbl cob10C9.c dstat.obj : error LNK2019: unresolved external symbol _DDD referenced in function _DSTAT_ dstat.exe : fatal error LNK1120: 1 unresolved externals G:\skatests\cobol>cobc -x -fstatic-call dstat.cbl -Q dyn2.lib cob10CC.c G:\skatests\cobol>dstat Program dstat Program DDD in dyn2.dll Program DDD in dyn2.dll End program dstat[/code] ---------------------------------------------------------------- Subject: ODBC Error Hi all, I am using OpenCobol 1.1 on Win7. I created ODBC for my access database testdb. I precompiled my program with ESQL and compiled ok. But when I try to execute it says "libcob: Cannot find module 'OCSQL' ". How can I solve this problem? Thanks ---------------------------------------------------------------- See http://opencobol.add1tocobol.com/#what-is-cob-pre-load just in case. It might help. Cheers, Brian ---------------------------------------------------------------- I got the same error - libcob: Cannot find module 'OCSQL'. ---------------------------------------------------------------- I used [code]cobc testsql.cob[/code] Then when I run with cobcrun I get [code]J:\Programs\COBOL>cobcrun testsql libcob: LoadLibrary/GetProcAddress error 127[/code] What is error 127? How to fix that? Thanks ---------------------------------------------------------------- If you get any runtime error add -debug to your cobc command line to get further info on run time. And check COB_PRE_LOAD to solve the issue. human BTW: If you want to get help you should always provide the output from cobc --version. ---------------------------------------------------------------- [code]cobc --version --debug -x testsql.cob cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Sep 10 2010 10:12:33 Packaged Feb 06 2009 10:30:55 CET testsql testsql.cob:130: libcob: Cannot find module 'OCSQL'[/code] How do I run COB_PRE_LOAD? Thanks ---------------------------------------------------------------- set COB_PRE_LOAD= set COB_LIBRARY_PATH= For example: set COB_PRE_LOAD=db2agapi set COB_LIBRARY_PATH=c:\IBM\SQLLIB\BIN\ Regards. ---------------------------------------------------------------- Where did you get ESQL and what version ? What version of Visual Studio / runtime are you using ? ---------------------------------------------------------------- I downloaded ESQL binary x64 from http://www.kiska.net/opencobol/esql/. I am using VC++ 2010 on Windows 7 64-bit. OpenCobol v 1.1 from MingW. ---------------------------------------------------------------- I have no dlls, only one cob file generated by the ESQL precompiler testsql.cob. I am trying to access MS-Access 2010. Thanks ---------------------------------------------------------------- Than you have "ocsql.dll" with those binaries (make sure you've got the latest - there was one very buggy version) The problem why OC can't find OCSQL could be connected to the fact that ocsql.dll has been compiled using VS2008, so most likely it is missing VS2008 SP1 runtime. Try to download and install 2008 runtime: http://www.microsoft.com/downloads/en/details.aspx?familyid=a5c84275-3b97-4ab7-a40d-3802b2af5fc2&displaylang=en ---------------------------------------------------------------- I uninstalled VC++ 2010 and installed VC++ 2008 Express. But still I am getting that error. [code]set COB_PRE_LOAD=C:\OpenCobol\ESQL\release\ocsql set COB_LIBRARY_PATH=%COB_LIBRARY_PATH%;C:\OpenCobol\ESQL\release cobc --version --debug -x testsql.cob cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Sep 10 2010 10:12:33 Packaged Feb 06 2009 10:30:55 CET J:\Programs\COBOL>testsql libcob: Cannot find module 'OCSQL'[/code] Thanks ---------------------------------------------------------------- Try with: set COB_PRE_LOAD=ocsql Instead of: set COB_PRE_LOAD=C:\OpenCobol\ESQL\release\ocsql I found that COB_PRE_LOAD is the bare name (without extension and path) of the shared library (dll or so) which you want to load. It is searched in COB_LIBRARY_PATH. Im interested on the results, please post here. Regards. ---------------------------------------------------------------- I did. Same error. [code]esqlOC -static testsql.sqb cobc --debug -x testsql.cob set COB_PRE_LOAD=ocsql set COB_LIBRARY_PATH=%COB_LIBRARY_PATH%;C:\OpenCobol\ESQL\release J:\Programs\COBOL>testsql libcob: Cannot find module 'OCSQL'[/code] ---------------------------------------------------------------- Mmmmm.... weird. LoadLibrary() Windows API isnt case sensitive but may be search in OC is case sensitive? What is the exact name of the DLL? uppercase or lowercase? Regards. ---------------------------------------------------------------- I'll just ditto (as the post was sitting in a timed-out edit box... ;) Case sensitivity? Look to changing ocsql to OCSQL (and make sure your CALL is to "ocsql" vs "OCSQL"). PROGRAM-ID is case sensitive. Umm, just in case, if ocsql.so is something you wrote, then simply mention it in the cobc file list. Here's hoping. This is a surmountable problem. It'll come down to a setting, me thinks. Cheers, Brian ---------------------------------------------------------------- Same error. [code]J:\Programs\COBOL>set COB_PRE_LOAD=OCSQL J:\Programs\COBOL>testsql testsql.cob:130: libcob: Cannot find module 'OCSQL'[/code] ocsql.dll call generated from the procompiler ESQL. Thanks ---------------------------------------------------------------- It doesn't matter if you use VC2008 (Express) or VC2010 in this case. The only important thing is that you have VC2008 runtime installed. EVERYTIME when you have a problem loading a dll I suggest to use http://www.dependencywalker.com/ Are there any errors shown when using that on ocsql.dll? (BTW: you see the external name that has to be called there, too) human ---------------------------------------------------------------- Hi, have you tried precompiling your source with the -static option? [code] esqloc -static yourpgm.sqb [/code] and then compile und link with the esql library [code] cobc -x -fstatic yourpgm.cob ocsql.lib [/code] this should solve your problems. Regards, Franklin ---------------------------------------------------------------- Checked dependency walker. Results: Exported function names are in capital letters, therefore it should be [code]call 'OCSQL'[/code] and because of the dll being in small letters you should do [code]set COB_PRE_LOAD=ocsql set COB_LIBRARY_PATH=%COB_LIBRARY_PATH%;C:\OpenCobol\ESQL\release[/code] Does this work? Edit: If this doesn't work I suggest to use both OC compiler/runtime and ESQL with VC binaries. Grab them from http://www.kiska.net/opencobol/1.1/opencobol-1.1-win-amd64-bin.zip human ---------------------------------------------------------------- Now I am getting error in ocsql.lib. [code]J:\Programs\COBOL>cobc -x -fstatic testsql.cob C:\OpenCobol\ESQL\release\ocsql.lib C:/OpenCobol/ESQL/release/ocsql.lib:1: Error: Invalid indicator '>' at column 7[/code] How do I fix error in lib? Thanks. ---------------------------------------------------------------- I could not run OC binary 64-bit from kiska. I am on Win 7 64-bit. So I downloaded Gary Cutler MingW binary and it works fine on Win 7. I understand I am trying to use so many different systems together. Is ESQL MingW binary available? ?Thanks. ---------------------------------------------------------------- Linking .libs currently work only in VC/WATCOM/BCC builds, not with MinGW. Why can't you run the 64bit binary from kiska? human ---------------------------------------------------------------- [url=http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1178&forum=1]http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1178&forum=1[/url] Thanks ---------------------------------------------------------------- [quote] human wrote: [...] it should be [code]call 'OCSQL'[/code] [...] you should do [code]set COB_PRE_LOAD=ocsql set COB_LIBRARY_PATH=%COB_LIBRARY_PATH%;C:\OpenCobol\ESQL\release[/code][/quote] Did you tried that with your MinGW build (according to your posts you forgot to set COB_LIBRARY_PATH)? human ---------------------------------------------------------------- Yes, I tried with that option. But still I am getting [code]J:\Programs\COBOL>esqlOC -static testsql.sqb esqlOC: ESQL for OpenCobol Version 2 Build Sep 22 2010 J:\Programs\COBOL>set COB_LIBRARY_PATH=%COB_LIBRARY_PATH%;C:\OpenCobol\ESQL\release J:\Programs\COBOL>cobc -x -fstatic testsql.cob C:\OpenCobol\ESQL\release\ocsql.lib C:/OpenCobol/ESQL/release/ocsql.lib:1: Error: Invalid indicator '>' at column 7[/code] Thanks. ---------------------------------------------------------------- As I said before: Linking lib-files does not work with current version. Please do (with MinGW) [code]set COB_PRE_LOAD=ocsql set COB_LIBRARY_PATH=%COB_LIBRARY_PATH%;C:\OpenCobol\ESQL\release cobc --debug -x testsql.cob testsql[/code] human ---------------------------------------------------------------- Sorry, i haven't read the whole post and missed the part about you running on 64bit windows. :-( It works for me on 32bit. Regards, Franklin esqlOC.exe: ESQL for OpenCobol Version 2 Build Apr 14 2010 cobc (OpenCOBOL) 1.1.20090206 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Aug 01 2009 12:38:36 Packaged Feb 06 2009 10:30:55 CET Visual Studio 2010 ---------------------------------------------------------------- Thank you all. :-) I downloaded OC 32-bit from Kiska and ESQL 32-bit binary with VC++ 2008 Express. Called %VS90COMNTOOLS%\vsvars.bat. And it did work. [code]J:\Programs\COBOL>esqlOC -static testsql.sqb esqlOC: ESQL for OpenCobol Version 2 Build Sep 22 2010 J:\Programs\COBOL>cobc -x testsql.cob cob9BC8.c J:\Programs\COBOL>testsql SQLSTATE=IM002, SQLCODE=+000000000 SQL Error message:[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified SQLSTATE=08003, SQLCODE=-000008003 SQL Error message:The connection does not exist. SQLSTATE=08003, SQLCODE=-000008003 SQL Error message:The connection does not exist. SQLSTATE=08003, SQLCODE=-000008003 SQL Error message:The connection does not exist.[/code] Now this is another new problem. But this thing works on Win7 64-bit. Thanks :-) ---------------------------------------------------------------- Subject: OCWebEditor now in ALPHA The OCWebEditor is now in alpha testing and is available for one and all. Remember that this is single user mode so everyone's code is available to all. Play nice. [url=http://add1tocobol.com/blog/2010/11/18/496/]OCWebEditor at Add1tocobol.com[/url] Cheers! P.S. Sorry human...I hit the wrong button. Didn't mean to start another thread. ---------------------------------------------------------------- Subject: rewrite not work for line sequential hi, i am using opencobol 1.1 on red RHEL 5.4, but rewriting the line sequential files is not possible. Is there any alternet way to do this, please help. ---------------------------------------------------------------- OpenCOBOL 1.1 Programmers Guide -Gary Cutler page 6-78: "3. The REWRITE statement may not be used with ORGANIZATION IS LINE SEQUENTIAL files". John. ---------------------------------------------------------------- Read in source, write out new dest. As you can't use rewrite, you'll need to create a new file from your source, merged with the mods you planned on rewriting. See http://opencobol.add1tocobol.com/#can-opencobol-be-used-to-write-command-line-stdin-stdout-filters as something that might help get you started. Cheers, Brian ---------------------------------------------------------------- Subject: PERFORM vs PERFORM THRU http://add1tocobol.com/blog/category/best-practices/ ---------------------------------------------------------------- Subject: Bug in ADD and -std=ibm or std=mf caused by binary-truncate:no We have big trouble with the ADD Statement using COMP-3 Fields. The Results are wrong when using the compile flags "-std=ibm" or -std=mf". I managed to find out which of the options is the tricky one, it is the "binary-truncate: no" that makes the results wrong. Here is my test source: [code] IDENTIFICATION DIVISION. PROGRAM-ID. addtest. ENVIRONMENT DIVISION. CONFIGURATION SECTION. DATA DIVISION. WORKING-STORAGE SECTION. 01 REAL-WERT PIC 9(3) COMP-3 VALUE 100. 01 ERG PIC 9(5)V999 COMP-3 VALUE 0. PROCEDURE DIVISION. Add REAL-WERT TO ERG. display 'REAL-WERT=' REAL-WERT display 'ERG=' ERG goback. [/code] and here are the results with "-std=default" [code] REAL-WERT=100 ERG=00100.000 [/code] and the results with "-std=ibm" the decimal-point is not included due to the "pretty-display: no", the result in ERG is 10000.000 [code] REAL-WERT=100 ERG=10000000 [/code] Regards, Franklin cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Jul 22 2010 16:05:02 Packaged Feb 06 2009 10:30:55 CET ---------------------------------------------------------------- WOW. Holly ... ! And none of ANSI tests caught that ! Too bad. Probably it's necessary to run ANSI suite with std=ibm and possibly adjust failed tests/results for that. I can't imagine how this bug managed to survive for 5 years :-) ---------------------------------------------------------------- Thanks for your comfirmation Sergey. I hope i can get some help on fixing this one. We've just migrated a large application from MF to OC and want to deploy to a production state. I'm also surprized by the fact that this problem just turned up today, but it is giving us big trouble. The reason for using the -std=ibm is because this application originally designed for z/OS or MVS. I wouldn't like to set "truncate-binary: yes" and then run into other problems. Regards, Franklin ---------------------------------------------------------------- I did put Windows win32 and x64 VS2008 builds on my site updated with a fix for that, as well as with pointers issue fix. Get the project zip if you need other platforms, at least the sources will match. It's been too many changes to what have been officially published, so I don't want to post the "diffs" in order not to confuse. ---------------------------------------------------------------- I'm very happy :-) to hear that the problem has been fixed, but couldn't find the patched files :-(. After doing some investigation, i determined that the problem could be found in "cobc", so at least i know that we are going to recompile all our sources again. The main difference between the two options is as follows. [b]-std=default[/b] [code] cob_add (&f_6, &f_5, 2); [/code] and [b]-std=ibm[/b] [code] cob_add_int (&f_6, cob_get_packed_int (&f_5)); [/code] Regards, Franklin ---------------------------------------------------------------- Just figured out that I've missed the same bug in other function - cob_complement_packed. Rebuild VS2008 builds. Basically the changes in numeric.c are following: [code] *** \open-cobol-1.1\libcob\numeric.c Wed May 12 01:25:20 2010 --- numeric.c Thu Nov 25 07:49:19 2010 *************** *** 666,680 **** int tval; int carry = 0; unsigned int msn; ndigs = COB_FIELD_DIGITS(f) - COB_FIELD_SCALE(f); if (COB_FIELD_NO_SIGN_NIBBLE (f)) { msn = COB_FIELD_SCALE(f) % 2; } else { msn = 1 - (COB_FIELD_SCALE(f) % 2); } ! p = f->data + (ndigs / 2) - (1 - msn); while (ndigs--) { if (!msn) { tval = *p & 0x0f; --- 666,683 ---- int tval; int carry = 0; unsigned int msn; + int emptydig; ndigs = COB_FIELD_DIGITS(f) - COB_FIELD_SCALE(f); if (COB_FIELD_NO_SIGN_NIBBLE (f)) { msn = COB_FIELD_SCALE(f) % 2; + emptydig = COB_FIELD_DIGITS(f) % 2; } else { msn = 1 - (COB_FIELD_SCALE(f) % 2); + emptydig = 1 - (COB_FIELD_DIGITS(f) % 2); } ! p = f->data + ((ndigs + emptydig) / 2) - (1 - msn); while (ndigs--) { if (!msn) { tval = *p & 0x0f; *************** *** 712,717 **** --- 715,721 ---- unsigned int zeroes = 0; unsigned int origdigs; unsigned char savedata[36]; + int emptydig; ndigs = COB_FIELD_DIGITS(f) - COB_FIELD_SCALE(f); if (ndigs <= 0) { *************** *** 726,733 **** --- 730,739 ---- if (COB_FIELD_NO_SIGN_NIBBLE (f)) { msn = COB_FIELD_SCALE(f) % 2; + emptydig = COB_FIELD_DIGITS(f) % 2; } else { msn = 1 - (COB_FIELD_SCALE(f) % 2); + emptydig = 1 - (COB_FIELD_DIGITS(f) % 2); } /* -x +v = -(x - v), -x -v = -(x + v) */ *************** *** 738,744 **** val = -val; subtr = 1; } ! p = f->data + (ndigs / 2) - (1 - msn); origdigs = ndigs; while (ndigs--) { if (val) { --- 744,750 ---- val = -val; subtr = 1; } ! p = f->data + ((ndigs + emptydig)/ 2) - (1 - msn); origdigs = ndigs; while (ndigs--) { if (val) { [/code] ---------------------------------------------------------------- Thanks Sergey, i'm having trouble getting the patch into the sources though. The OC version that i downloaded from Roger doesn't have a function called cob_complement_packed in "libcob/numeric.c" so the patch file doesn't correspond. I even tried using your whole numerc.c but got many compile errors. I don't know what other changes you made and couldn't just take all the sources as i didn't find a makefile in your ZIP-Archive. BTW. I'm doing this on Linux (SLES 11). Regards, Franklin ---------------------------------------------------------------- Probably this will work for your version. Anyway, it is 3 lines of changes, and you can search for "ndigs" in numeric.c and manually do the appropriate changes. [code]*** numeric.c Sat Jan 24 07:31:30 2009 --- numeric.c Mon Nov 29 10:37:55 2010 *************** *** 630,635 **** --- 630,636 ---- unsigned int subtr = 0; unsigned int zeroes = 0; unsigned int origdigs; + int emptydig; ndigs = COB_FIELD_DIGITS(f) - COB_FIELD_SCALE(f); if (ndigs <= 0) { *************** *** 637,642 **** --- 638,644 ---- } sign = cob_packed_get_sign (f); msn = 1 - (COB_FIELD_SCALE(f) % 2); + emptydig = 1 - (COB_FIELD_DIGITS(f) % 2); /* -x +v = -(x - v), -x -v = -(x + v) */ if (sign < 0) { *************** *** 646,652 **** val = -val; subtr = 1; } ! p = f->data + (ndigs / 2) - (1 - msn); origdigs = ndigs; while (ndigs--) { if (!msn) { --- 648,654 ---- val = -val; subtr = 1; } ! p = f->data + ((ndigs + emptydig) / 2) - (1 - msn); origdigs = ndigs; while (ndigs--) { if (!msn) { [/code] ---------------------------------------------------------------- Thank you so much Sergey, That did it :-) We'll do some more testing now :idea: Regards, Franklin ---------------------------------------------------------------- Subject: bug in pointers So far nothing to add. going to fix in a version I have... [code] IDENTIFICATION DIVISION. PROGRAM-ID. PROG. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 PTR1 POINTER VALUE NULL. 01 PTR2 POINTER VALUE NULL. 01 FPTR1 PROCEDURE-POINTER VALUE NULL. 01 FPTR2 PROCEDURE-POINTER VALUE NULL. PROCEDURE DIVISION. IF PTR1 = PTR2 DISPLAY '=='. IF FPTR1 = FPTR2 DISPLAY 'F=='. IF PTR1 < PTR2 DISPLAY '<'. IF PTR1 NOT = PTR2 DISPLAY '!='. IF FPTR1 NOT = FPTR2 DISPLAY 'F!='. * and that should be illegal but you can try :-) * IF FPTR1 < FPTR2 * DISPLAY 'F<'. GOBACK.[/code] And you will get much more fun debugging OC if by occasion you put [code] 01 FPTR1 PROCEDURE-POINTER VALUE NULL. 02 FPTR2 PROCEDURE-POINTER.[/code] ---------------------------------------------------------------- Subject: Fossil distributed source code management Discovered this from a REBOL Blog comment. Thought I'd pass it on. I'm impressed. http://www.fossil-scm.org In the vein of hg, darcs, git with some nice extensions. Tickets and wiki (and docs) with the repositories. It's an underdog, but it's a nice system. And any source tar ball that has [quote] .plan -- Fossil, the DG Bwahahahaha! The cover art could be an homo erectus skull lying on some COBOL code...[/quote] in a todo file, well, has to be ok. ;-) C code, produces a single [i]fossil[/i] binary. [code] $ make ... nice clean build once openssl-devel was yummed in $ sudo cp fossil /usr/local/bin $ fossil help Usage: fossil help COMMAND. Available COMMANDs: add co import redo tag addremove commit info remote-url ticket all configuration init rename timeline annotate deconstruct leaves revert ui artifact delete ls rm undo branch descendants merge scrub unset cgi diff mv search update changes export new server user checkout extras open settings version ci finfo pull sha1sum wiki clean gdiff push sqlite3 zip clone help rebuild status close http reconstruct sync This is fossil version [cf178577ec] 2010-11-17 13:38:25 UTC [/code] Fairly easy to use... [code] $ fossil init project $ fossil server project [/code] from another terminal. I use opera, but any browser pointed at http://localhost:8080 [code] $ opera http://localhost:8080 [/code] and that will let you configure your project from an admin mode. Then some actual source coding... [code] $ mkdir work/project $ cd work/project $ vi README $ fossil clone http://localhost:8080 workcobol Bytes Cards Artifacts Deltas Sent: 53 1 0 0 Received: 500 4 2 0 Total network traffic: 202 bytes sent, 0 bytes received Rebuilding repository meta-data... 100.0% complete... project-id: 7b60734ffd6d09b3ba726d6fa121c386b74ccbf9 server-id: dd4abceeb24f4a428c23681e5ebc8c4215590495 admin-user: btiffin (password is "0f3903") $ fossil open workcobol $ fossil add README ADDED README $ fossil commit -m "Added README" Autosync: http://localhost:8080 Bytes Cards Artifacts Deltas Sent: 130 1 0 0 Received: 124 2 0 0 Total network traffic: 254 bytes sent, 0 bytes received New_Version: 0fa21f9310ba4f8765a5d272b8889f6e40a10287 Autosync: http://localhost:8080 Bytes Cards Artifacts Deltas Sent: 739 6 2 0 Received: 216 4 0 0 Total network traffic: 513 bytes sent, 0 bytes received $ fossil push Server: http://localhost:8080 Bytes Cards Artifacts Deltas Sent: 314 5 0 0 waiting for server...Total network traffic: 356 bytes sent, 0 bytes received [/code] It offers up the sqlite3 shell so you can look around (and being a power tool, perhaps shoot yourself through feet and hands) [code] $ fossil sqlite3 sqlite> .tables attachment config mlink private tag unsent backlink delta orphan rcvfrom tagxref user blob event phantom reportfmt ticket concealed filename plink shun unclustered sqlite> select * from filename; 1|README [/code] [img]http://opencobol.add1tocobol.com/images/fossiltimeline.png[/img] A nice touch with the tickets and wiki too. Anyway, I suggest checking it out, if you happen to be looking for a distributed source code manager. Cheers, Brian ---------------------------------------------------------------- Subject: First timer When I cut'n'pasted your sample into vim, I get [code] 000100 IDENTIFICATION DIVISION. 000200 PROGRAM-ID. test. [/code] so it looks like a BOM (byte order marker) (unicode editor?, word processor versus text editor?) slipped in between the sequence number and the ID. I'm pretty sure the BO markers have to be first to be treated as BOM. Try this version; with some changes. [code]000100 IDENTIFICATION DIVISION. 000200 PROGRAM-ID. testing. 000300 ENVIRONMENT DIVISION. 000400 CONFIGURATION SECTION. 000500 INPUT-OUTPUT SECTION. 000600 FILE-CONTROL. 000650 data division. 000700 WORKING-STORAGE SECTION. 000800 PROCEDURE DIVISION. 000900 DISPLAY "GOOD BYE". 000200 END PROGRAM testing. [/code] Removed the chars, TEST is reserved, OUTPUT section is actually INPUT-OUTPUT SECTION, added DATA DIVISION, had to tweak the quotes on good bye. Make sure it is saved as plain-text, compile with [code] cobc -x testing.cob or even better cobc -g -debug -v -x testing.cob [/code]You need the -x to make an executable. The -v verbose output can really help see what's what and how everything glues together. -g and -debug can make debugging pretty easy here in the OC. Other than that. Welcome and well met. OpenCOBOL is a pretty neat product, in my humble opinion. Don't forget to check out the FAQ and Gary's awesome http://opencobol.add1tocobol.com/OpenCOBOL%20Programmers%20Guide.pdf Cheers, Brian ---------------------------------------------------------------- I used gedit to create a small source file: 000100 IDENTIFICATION DIVISION. 000200 PROGRAM-ID. test. 000300 ENVIRONMENT DIVISION. 000400 CONFIGURATION SECTION. 000500 OUTPUT SECTION. 000600 FILE-CONTROL. 000700 WORKING-STORAGE SECTION. 000800 PROCEDURE DIVISION. 000900 DISPLAY “GOOD BYE”. 000200 END PROGRAM test. I compiled the program: (cobc test.cob) & received the following results: test.cob:1: Error: syntax error, unexpected $end, expecting PROGRAM_ID What did I miss? ---------------------------------------------------------------- Subject: DISPLAY and SIZE As you see there http://publib.boulder.ibm.com/infocenter/iadthelp/v7r5/index.jsp?topic=/com.ibm.etools.iseries.langref.doc/c0925395395.htm there is SIZE keyword... OpenCobol doesnt support this:(And i have 500 files with several SIZE inside.Is there any easy workarround ? Or if i could add this feature to the compiler through c code! ---------------------------------------------------------------- For files were the layout is umm, 'permissive' you could awk across the files and drop SIZE clauses inside DISPLAY. Especially if you like playing with pattern matching. Or, if you really want to dig in or change of layout is unacceptable... this is the OC; we DO get sources. :-) Snag a 1.1 pre-rel from the rightside menu. Extract. look at cobc/parser.y. You you should get a quick feel for the changes that will be required. For a first grok, hit line 4200 ish (ok, 4226) and scan down. This is one touch-point where you'd add SIZE parsing. This is NOT easy stuff. Parsing COBOL is frickin' complex. Adding SIZE here, you'll need to verify it doesn't screw up source scans that include other SIZE in it's various contexts. For instance 1.1 pre-rel has beta CALL ... SIZE IS constructs...[i](that work great by the way)[/i]. Look to libcob/screenio.c for runtime issues. Line 121 for a first peek at the task ahead. [i]Not actually many lines of code, just perfecting where those lines go, in sync with the rest of the complexity...[/i] I'd be smack down happy if you think you might be able to code this up. We need a few guru level compiler source people. [i]Well, really, we could use as many 'any level' compiler source people in the opencobol.org forum as skills permit.[/i] ;) Cheers, Brian ---------------------------------------------------------------- I'd try to include the fix in the current compiler version if you got it working. As there was the question for a workaround, I have a vary dirty one (if more than one var or strings are used): [code] 77 var1 pic x(30) value all 'A'. 77 var2 pic x(30) value all 'B'. ... display 'This is a test!' with size 10 end-display display var1 with size 10 end-display display var1 with size 50 end-display display var1 var2 with size 50 end-display[/code] becomes [code] 77 var1 pic x(30) value all 'A'. 77 var2 pic x(30) value all 'B'. ... display function concatenate ( 'This is a test!') (01:10) end-display display var1 (01:10) end-display display function concatenate ( var1 ' ') (01:50) end-display display function concatenate ( var1 var2) (01:50) end-display[/code] human ---------------------------------------------------------------- Thank you human! This is a great hack :) I tried to do a test alteration to c source but as a Linux newbie i fail when trying to execute MakeFile. However i would try sometime. :D ---------------------------------------------------------------- Brian i'll give it a try ! ---------------------------------------------------------------- Subject: Concatenate and Trim function throwing errors When I attempted to use the concatenate function I received: cobs/ocdirtreectl.cob:73: Error: 'CONCATENATE' undefined gettreeinfo. MOVE CONCATENATE(userName, "/", userProject,"/") TO listing. DISPLAY listing. end-gettreeinfo. also same happened when I attempted to use TRIM(userName). So I am not sure what is happening. The Programmers Manual says I can use it as well as I know it is in the compiler as an intrinsic keyword. [ernieball]$ cobc --version cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Nov 09 2010 10:28:06 Packaged Feb 06 2009 10:30:55 CET ---------------------------------------------------------------- [code] move function concatenate( function trim(userName) "/" function trim(userProject) "/") to listing display listing [/code] Didn't even know this existed! Would be nice if I could get it added to IBM Enterprise COBOL. I won't hold my breath... Frank ---------------------------------------------------------------- @Damon: It seems you want to use intrinsic functions without the keyword. Try the following cobc option, quote from cobc --help [code] -ffunctions-all Allow use of intrinsic functions without FUNCTION keyword[/code] @infocat: Why not using it directly in DISPLAY? [code] display function concatenate( function trim(userName) "/" function trim(userProject) "/") end-display[/code] human ---------------------------------------------------------------- Frank; You might like this one too... http://opencobol.add1tocobol.com/#function-substitute Cheers, Brian ---------------------------------------------------------------- Why you dont use STRING statement? ---------------------------------------------------------------- [quote] human wrote: @Damon: It seems you want to use intrinsic functions without the keyword. Try the following cobc option, quote from cobc --help [code] -ffunctions-all Allow use of intrinsic functions without FUNCTION keyword[/code] [/quote] Cool. I'm interested how the parser deals with this. I assumed that the FUNCTION keyword was necessary because of parsing, but perhaps that's not true. If not, though, I don't see any good reason for it. It's only an annoyance. Perhaps COBOL didn't want to lose its reputation for being verbose??? :-) [quote] @infocat: Why not using it directly in DISPLAY? [code] display function concatenate( function trim(userName) "/" function trim(userProject) "/") end-display [/code] [/quote] I was just copying the OP. (I think!) Why the end-display? There's no conditional logic. [code] display concatenate(trim(userName) "/" trim(userProject) "/") [/code] Not sure this even looks like COBOL anymore! :-) Frank ---------------------------------------------------------------- human: thanks for the response. I am still learning OpenCOBOL and all it's abilitie's. One of the things I am doing us writing a bunch of example programs and this is one of them. So, having examples using intrinsic functions will be valuable. I will make note of the compiler option. As for not using display, I am moving this to a var in order use in a CALL "SYSTEM" USING listing statement. I am building a "ls" command. I need directory info in order to build a TreeView object in HTML/CSS for my online editor. ssamayoa: As for not using string I am actually now using that along with the trim() function. ---------------------------------------------------------------- human, can the "-ffunctions-all" be added to the default.conf file or can it only be done via the command line ? ---------------------------------------------------------------- See http://opencobol.add1tocobol.com/#repository and you can control this in the source code. I don't think there is a configuration item for this. [i]Well, I kinda know there isn't.[/i] [code] environment division. configuration section. repository. function all intrinsic. [/code] And see http://opencobol.add1tocobol.com/#does-opencobol-work-with-make for a way of building make rules that provide ease of use for compiling. Cheers, Brian ---------------------------------------------------------------- Answering Frank's pondering: [quote] Cool. I'm interested how the parser deals with this. I assumed that the FUNCTION keyword was necessary because of parsing, but perhaps that's not true. If not, though, I don't see any good reason for it. It's only an annoyance. [/quote] It's a trick in cobc/scanner.l. It kinda cheats, but not really. scanner.l does all kinds of back and forth to get a proper lexical scan before passing the tokens off to the parser. And for at least one extension WHEN-COMPILED, it's a bit of a burn. [code] DISPLAY WHEN-COMPILED. DISPLAY FUNCTION WHEN-COMPILED. 07/05/0805.15.20 2008070505152000-0400 [/code] Not sure how that should be handled, aside from enforcing that the WHEN-COMPILED noun is obsolete. Cheers, Brian ---------------------------------------------------------------- The '02 Standard fully deals with the question of whether FUNCTION is or is not required. It uses the REPOSITORY paragraph to specify this. It also lists a few intrinsic functions that MUST have the word FUNCTION specified. My suggesion would be that rather than using non-Standard compile-time switches for this, the '02 Standard feature should be included in a (future) release of OC. ---------------------------------------------------------------- What standard feature do you mean? [url=http://opencobol.add1tocobol.com/#repository]REPOSITORY[/url] is supported in OpenCOBOL. BTW: Which intrinsic funtions must have the word FUNCTION specified? human ---------------------------------------------------------------- In the '02 Standard, (similar words in the FCD) [quote] If intrinsic-function-name-1 or the ALL phrase is specified in the REPOSITORY paragraph or if function-prototype-name-1 is specified, the word FUNCTION may be omitted from the function-identifier; otherwise the word FUNCTION is required [/quote] and [quote] Intrinsic-function-names may be used as user-defined words and system-names, except for — intrinsic function names LENGTH, RANDOM, SIGN, and SUM; and — intrinsic function names identified in a function-specifier in the REPOSITORY paragraph {/quote] ---------------------------------------------------------------- Subject: Using TextPad as the editor for OpenCOBOL A while back I stumbled upon a tutorial covering using TextPad with OpenCOBOL. Now that I have OpenCOBOL installed, I can't locate the TextPad article. Can anyone point me to the TextPad article/page? Thanking you in advance. ---------------------------------------------------------------- If your intention is only syntax highlighting, please look at [url=http://www.textpad.com/add-ons/syna2g.html]http://www.textpad.com/add-ons/syna2g.html[/url] ---------------------------------------------------------------- Click the "Wiki" link on the left of this screen, then click the "Assorted Documents" link. You'll find a link to the document you're looking for (along with lots of other good stuff) there. ---------------------------------------------------------------- Subject: ACCEPT and numbers! Hello again... I am in progress of migrating some old MF cobol code... Another problem for which i have found several workarounds but they are painfull to apply for every of 500 files, is this: [quote]77 AC9 PIC S9(9)V99 TRAILING SEPARATE. [/quote] This works great but when trying ACCEPT AC9 LINE X COLUMN Y. Doesnt work as expected... MF had something like ACCEPT AC9 LINE X COLUMN Y CONVERT. It need to be right aligned somehow!otherwise PIC 999 and typing 9 becomes 900 However the first workaround was to read it as character and use NUMVAL afterwards... I found that this isnt obligatory as i can read it like to 77 TEST PIC X(number). ACCEPT TEST. and then just MOVE TEST TO AC9. And seems to work correctly... Any ideas on this? Thank you again ---------------------------------------------------------------- I did a little dig in code.... I found out that it has almost nothing for automatic number reading... At file screenio.c starting at line 902.. [code]if (!(attr & COB_SCREEN_UPDATE)) { if (COB_FIELD_IS_NUMERIC (f)) { //cob_move (&cob_zero, f); memset (f->data, ' ', f->size); } else { memset (f->data, ' ', f->size); } }[/code] commenting out the above line dld the trick and using NUMVAL to it without having to declare as PIC X.. Also i let +,-,',',. characters to be insterted... Also to avoid manual conversion i added after the reading for loop I know that this method sucks but it is the best i can do for now. [code]if (COB_FIELD_IS_NUMERIC (f)) { cob_move(cob_intr_numval(f),f); }[/code] without cob_move f=cob_intr_numval(f); didnt work dont know wht. ---------------------------------------------------------------- Well, it doesn't suck if it works. ;) But I fear it might, mostly, work. There is at least the cob_intr_numval_c currency handler thingy, and ... But yeah, if it works for the fields you need, and you can manage any maintenance, I'm all for some hand-rolled OC's we can test and maybe get to Roger. Cheers, Brian ---------------------------------------------------------------- Starting again from a fresh OC1.1 install i am wondering how you read numbers from the console :)If there is a way to avoid the modification it would be great ---------------------------------------------------------------- Without screen section, accept of numerics works the beauty. For screen sections (or simple AT - anything that kicks curses), you can [code] 01 the-number pic 999. 01 form-number pic xxx. ... accept form-number at 1001 end-accept move form-number to the-number [/code] By COBOL's nature, MOVE will do the right thing when moving string digits to numerics. [i]Haven't explicitly tested, but I'm pretty sure this will work with TRAILING SEPARATE and floating decimal points[/i] (when aligned as per COBOL oh-so-easy-to-comprehend-with-only-14-pages-of-explanatory-text rules). ;-) Until we get proper internal numeric handling in the screen section support code that is. Cheers, Brian ---------------------------------------------------------------- This works great but the problem is that the code i have now based on RM cobol accepts numbers from PIC 999 instead of PIC XXX and that is the problem... Although the code i posted before works great ,it doenst work on other machine...i get errors of type Attempt to reference unallocated memory (Signal SIGSEGV)| at cob_move()... ---------------------------------------------------------------- Well i found that o should place this line at screenio.h [code]extern cob_field *cob_intr_numval (cob_field *);[/code] Seems logical but i dont know why it fails on the other machine and not mine.. the only difference is the 32 , 64 bit i think... ---------------------------------------------------------------- Subject: accept screen ESC is not working Environment vars are case sensitive, export COB_SCREEN_ESC and COB_SCREEN_EXCEPTIONS and try again. human ---------------------------------------------------------------- environment TERM = VT100 cob_screen_ESC='Y' cob_screen_exceptions='Y' SCREEN SECTION 01 x-screen PROCEDURE DIVISION accept x-screen if key_status= cob_screen_ESC this statement fails if key_status=cob_screen_(F1..F4) it's working properly Any suggestion is appreciated Thanx ---------------------------------------------------------------- Subject: New example of OpenCOBOL on the Web I had a need for a treecontrol for a project. I was originally using a jQuery plugin but I wanted more control and I really have trouble with JavaScript, sooooo. I built my own. Using OpenCOBOL, and a little javascripting for AJAX (XHR). You can see it work here: [url=http://cobol-examples.plpwebs.com/octree-control.html]Tree Control[/url] I provided the HTML and COBOL Source Code. I will try to post the CSS as well. You can get to the HTML and JS by right clicking the site. Originally I wanted to recurse through a directory and display the folders/sub-folders/files, but it really gets crazy and I put it off for a later date. For now this is a prototype. Hopefully it can become a reusable generic program you can call. I look forward to comments and suggestions for doing things better. Cheers! Damon ---------------------------------------------------------------- As the by the by. I should update the FAQ CGI sample to include Set-Cookie: We should start to secure things (umm, not secure so much as a sense of acquaintance versus stranger) as we go. [i]And by we, I might mean you, Damon. You may get to do all the heavy lifting on this framework.[/i] ;-) Keep going... Cheers, Brian ---------------------------------------------------------------- Subject: 1 question and 1 bug in SORT for tables Hi, with iso2002 you can sort tables with SORT Format 2. If you have a multidimensional table you have to use INDEXED BY and set the index before you sort the table. Example: [code] *================================================================= IDENTIFICATION DIVISION. *================================================================= PROGRAM-ID. a. *================================================================= DATA DIVISION. *================================================================= ****************************************************************** WORKING-STORAGE SECTION. ****************************************************************** * 01 TAB-1 OCCURS 2 INDEXED BY I-1. 05 TAB-2 OCCURS 2. 10 FIELD-1 PIC 9(1). 10 FIELD-2 PIC 9(1). *================================================================= PROCEDURE DIVISION. *================================================================= ****************************************************************** A000-STEUERUNG SECTION. ****************************************************************** MOVE 6 TO FIELD-1(1 1) MOVE 3 TO FIELD-2(1 1) MOVE 4 TO FIELD-1(1 2) MOVE 2 TO FIELD-2(1 2) MOVE 8 TO FIELD-1(2 1) MOVE 4 TO FIELD-2(2 1) MOVE 2 TO FIELD-1(2 2) MOVE 1 TO FIELD-2(2 2) DISPLAY FIELD-1(1 1) " / " FIELD-2(1 1) DISPLAY FIELD-1(1 2) " / " FIELD-2(1 2) DISPLAY FIELD-1(2 1) " / " FIELD-2(2 1) DISPLAY FIELD-1(2 2) " / " FIELD-2(2 2) DISPLAY "---" SET I-1 TO 1 SORT TAB-1 ASCENDING SORT TAB-2 ASCENDING FIELD-1 FIELD-2 DISPLAY FIELD-1(1 1) " / " FIELD-2(1 1) DISPLAY FIELD-1(1 2) " / " FIELD-2(1 2) DISPLAY FIELD-1(2 1) " / " FIELD-2(2 1) DISPLAY FIELD-1(2 2) " / " FIELD-2(2 2) EXIT PROGRAM. [/code] The SORT have to sort the two entrys (1 1) and (1 2) because I-1 is set to 1. The output is correct: [code] >cobcrun a 6 / 3 4 / 2 8 / 4 2 / 1 --- 4 / 2 6 / 3 8 / 4 2 / 1 [/code] If you want sort the entrys (2 1) and (2 2), you have to set I-2 to 2. Example: [code] *================================================================= IDENTIFICATION DIVISION. *================================================================= PROGRAM-ID. a. *================================================================= DATA DIVISION. *================================================================= ****************************************************************** WORKING-STORAGE SECTION. ****************************************************************** * 01 TAB-1 OCCURS 2 INDEXED BY I-1. 05 TAB-2 OCCURS 2. 10 FIELD-1 PIC 9(1). 10 FIELD-2 PIC 9(1). *================================================================= PROCEDURE DIVISION. *================================================================= ****************************************************************** A000-STEUERUNG SECTION. ****************************************************************** MOVE 6 TO FIELD-1(1 1) MOVE 3 TO FIELD-2(1 1) MOVE 4 TO FIELD-1(1 2) MOVE 2 TO FIELD-2(1 2) MOVE 8 TO FIELD-1(2 1) MOVE 4 TO FIELD-2(2 1) MOVE 2 TO FIELD-1(2 2) MOVE 1 TO FIELD-2(2 2) DISPLAY FIELD-1(1 1) " / " FIELD-2(1 1) DISPLAY FIELD-1(1 2) " / " FIELD-2(1 2) DISPLAY FIELD-1(2 1) " / " FIELD-2(2 1) DISPLAY FIELD-1(2 2) " / " FIELD-2(2 2) DISPLAY "---" SET I-1 TO 2 SORT TAB-1 ASCENDING SORT TAB-2 ASCENDING FIELD-1 FIELD-2 DISPLAY FIELD-1(1 1) " / " FIELD-2(1 1) DISPLAY FIELD-1(1 2) " / " FIELD-2(1 2) DISPLAY FIELD-1(2 1) " / " FIELD-2(2 1) DISPLAY FIELD-1(2 2) " / " FIELD-2(2 2) EXIT PROGRAM. [/code] The output is wrong, because OC sorts the entrys (1 1) and (1 2) and not the entrys (2 1) and (2 2): [code] >cobcrun a 6 / 3 4 / 2 8 / 4 2 / 1 --- 4 / 2 6 / 3 8 / 4 2 / 1 [/code] Output from cobc -V: [code] >cobc -V cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Keisuke Nishida Copyright (C) 2006,2007,2008,2009,2010 Roger While This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Built Jul 20 2010 12:59:12 Packaged Jun 10 2010 06:45:57 UTC C version "9.0.0.0" [/code] Also, I am surprised that I can write the SORT command like this. In the Table SORT Syntax diagram the second SORT (the word!) after ASCENDING is not allowed. Only a data item is allowed there. Regards, Mado ---------------------------------------------------------------- The history of the syntax for "table sorts" is a long and "sad" one. It was originall introduced in the Codasyl JOD - and allowed Input/Output procedures, different input and output tables, and a lot of other things. It was then introduced (slightly simpler) in the draft of the '02 Standard. (That was the version that I think Micro Focus implemented). At the last minute it was changed again. It is being changed YET AGAIN in the revision that is now out for FCD. I don't know which version VS2000 has or what OC has done. You *might* want to look at what the FCD is doing, but I don't guarantee that even this is "stable". ---------------------------------------------------------------- I think the compiler might be seeing this as [code] SORT TAB-1 ASCENDING. SORT TAB-2 ASCENDING FIELD-1 FIELD-2. [/code] With the periods, no? Maybe? It looks that way from cobc/parser.y, (but I might have missed the critical bit). Cheers, Brian ---------------------------------------------------------------- In the FCD (page 570) the "key" data item is optional. See the diagram and rule "15) The KEY phrase may be omitted only if the description of the table referenced by data-name-2 contains a KEY phrase." However, it doesn't look like this example HAD an ASCENDING KEY IS phrase, so acording to the FCD it would be invalid. ---------------------------------------------------------------- Actually Bill, according to the FCD, "data-name-1" is optional in Format 2. So - SORT TAB-1 ASCENDING is valid as I interpret the FCD (the "KEY" clause is present). What it should do in this case is another matter. However the second sort - SORT TAB-2 ASCENDING FIELD-1 FIELD-2 is, according to the FCD, NOT valid. There is a note under 8.4.1.2.2 referring to subscripts - ######### NOTE When used as the subject of a SORT statement, the number of subscripts is equal to one less than the number of OCCURS clauses in the description of the table element being referenced, unless the rightmost subscript is the word ALL. ######### So - SORT TAB-2 (I-1) ASCENDING FIELD-1 FIELD-2 is what I believe to be correct. As noted, OC does not handle this correctly. Roger ---------------------------------------------------------------- Subject: OCHTML – using copybooks for HTML With advent of being able to use OpenCOBOL (OC) as cgi in an internet application Aoirthoir and I have been discussing making OCHTML copybooks. This thread is an attempt to get things started. I've been thinking this over for quite awhile and think I have an idea to get started. Making the WS is no issue as I have found when doing this as you can see over at example. Essentially you can setup the following: 01 HTML_TAGS. 05 TAG_INPUT PIC x(07) VALUE "". Each HTML TAG can be setup this way. You'll see the method to my madness in a little while. Keep reading. Since each tag can have many attributes in many combinations I though it would be more prudent to create another working storage for the attributes: 01 HTML_ATTRIBUTES. 05 A_ID PIC x(04) VALUE "ID= ". 05 A_NAME PIC x(06) VALUE "NAME= ". 05 A_CLASS PIC x(07) VALUE "CLASS= ". 05 A_TYPE PIC x(06) VALUE "TYPE= ". Now what if you want an HTML Input like this: You can do this by displaying directly: DISPLAY "". Or using the WS you can do: DISPLAY TAG_INPUT, A_ID, QUOTE, "my_id", QUOTE A_NAME, QUOTE, "my_name", QUOTE, A_CLASS, QUOTE, "my_class", QUOTE, A_TYPE, "text", CLOSE_INPUT. That is a generic structure proposal. We can take it even further: 01 HTML_ATTRIBUTES. 05 A_ID 10 FILLER PIC x(04) VALUE "ID= ". 10 FILLER PIC X(01) VALUE QUOTE. 10 ws_id PCI x(35) VALUE SPACES. 10 FILLER PIC X(01) VALUE QUOTE. 10 FILLER PIC X(01) VALUE SPACE. 05 A_NAME PIC x(06) VALUE "NAME= ". 10 FILLER PIC x(04) VALUE "ID= ". 10 FILLER PIC X(01) VALUE QUOTE. 10 ws_name PCI x(35) VALUE SPACES. 10 FILLER PIC X(01) VALUE QUOTE. 10 FILLER PIC X(01) VALUE SPACE. 05 A_CLASS PIC x(07) VALUE "CLASS= ". 10 FILLER PIC x(04) VALUE "ID= ". 10 FILLER PIC X(01) VALUE QUOTE. 10 ws_class PCI x(35) VALUE SPACES. 10 FILLER PIC X(01) VALUE QUOTE. 10 FILLER PIC X(01) VALUE SPACE. 05 A_TYPE PIC x(06) VALUE "TYPE= ". 10 FILLER PIC x(04) VALUE "ID= ". 10 FILLER PIC X(01) VALUE QUOTE. 10 ws_type PCI x(35) VALUE SPACES. 10 FILLER PIC X(01) VALUE QUOTE. 10 FILLER PIC X(01) VALUE SPACE. Now you can do: MOVE "my_id" to ws_id. MOVE "my_name" to ws_name. MOVE "my_class" to ws_class. MOVE "text" to ws_type. DISPLAY TAG_INPUT, A_ID, A_NAME, A_CLASS, A_TYPE, CLOSE_INPUT. Thoughts? Comments? Praise, glory? ---------------------------------------------------------------- Praise. :-) Umm, glory, that might have to wait. ;) Comments; I'd set this up as a Table. A symbol table. ... if this is the path. If you are as serious as I get the feeling you are Damon, take a look through http://www.cobolstandard.info/j4/index.htm and http://www.cobolstandard.info/j4/files/07-0005.doc for what would be a cool layer to work towards supporting. Even if the proposed XML isn't in OpenCOBOL's immediate future, it would be smart to try and keep in line. And yes, lets talk more. This might be a piece better suited to C code (which also means Vala/Genie) and a CALL or five. And by Vala/Genie; look through http://live.gnome.org/Vala/BindingsStatus for a list of accessors only a scant few lines of code away from OpenCOBOL accessors. The binding for libxml-2.0 in particular. Better yet, see http://live.gnome.org/Vala/LibSoupSample for a glimpse at how easy Vala and libsoup make web access a scant few lines of code. And if we want to game the system and make it look like COBOL, it turns out that adding an intrinsic FUNCTION or nine is not really overly burdensome (touch points in the compiler source counted in ones if names are chosen properly) ... strictly as a third party, for patch your own compiler people. Those functions could then be replaced by FUNCTION-ID subprograms if that comes to light,... bob loblaw And once again, lets talk more. Cheers, Brian [i]Oh, and you can edit your post for BBCODE (square, not angle brackets around code and quote), it'll read better.[/i] ---------------------------------------------------------------- btiffin: Thanks for the info. I will look into this. I do LOVE OpenCOBOL. I just hope that OC2 will be posted SOON. I am also hoping that OC moves towards OOP. It would be great to create new classes with methods and properties. That would make something like what I am doing a breeze. As for building intrinsic functions into the compiler I'll have to leave that to people who are much better at the low level stuff than I am. I have a need though for all these things I am doing since I am working on web apps. I hate java and javascript since I know just enough to be dangerous. I'd rather do everything I can in OC and use HTML/CSS/JS for UI and front end stuff. Besides I really believe in having a business layer that will handle all the critical heavy lifting. Anyway, thanks for the encouragement and YES we MUST get together at some time. Cheer! ---------------------------------------------------------------- I have been doing CGI with COBOL since the mid 90s. Originally on OS/2 with Netscape Server and Microsoft COBOL 4.x. Later on Windows with Xitami server, the Linux with Apache Server. The same source code with just a few lines changed works for all these. I don't have any HTML in the program, not in working-storage, nor in literals. The output is (and should be) templated. The programs assemble the data into a data structure and CALL the template module passing it this table. This table includes the name of the template file so that this can be varied depending on the nature of the output. The template could be HTML, XML, CSV, printed text or Postscript. The program neither knows nor cares what the actual output is. Doing it this way means that the actual page can change without having to change the program. Just edit the template. If the program outputs a table and the user wants a CSV of the data items then it is a simple matter to have a different template for this. Apart from the default template name for each function I cater for the template name being input on the URL. This allows a page to have a clickable link: 'CSV of this Data'. It is not hard to write a templating module and once done it can be used for many other things too, even printed reports. ---------------------------------------------------------------- I fully agree with you on templates. Many CMS systems use the template approach for interaction with cgi. If I wasn't doing so much with ajax I would use that approach. But, with ajax I can use the JS to make the AJAX call and get the data. So far I have written a TreeControl. COBOL handles getting the data and sending it back. JS simply sends/receives the request. So instead of having to learn more JavaScript than I really need to, why not use COBOL? But, I do agree it would be great to have a framework that you have suggested. Especially for static webapps (Non-AJAX). Have you got an example of the templating module? Cheers Damon ---------------------------------------------------------------- I am not sure why you think that AJAX is incompatible with templates. JSON is just a form of text output. Having it in a template makes it easier to change without needing to recompile the program. All my AJAX uses templates for sending the data back to JS. Sometimes this is JSON, sometimes HTML for innerHTML. One templating scheme uses sections so that any repeats are done by repeatedly calling the template output. Where data is to be put is marked with tags such as: *SECTION HEADER ... <script ... ... <table border="1"> <caption>Order Number <!%ORDERNO%></caption> <thead><tr><th>Line</th><th>Product Code</th>... </thead><tbody> *END *SECTION LINEITEM <tr><td><!%LINENO%></td> <td><!%PRODUCT%></td> ... </tr> *END *SECTION TRAILER </tbody></table> ... </html> *END </code> Then in the program a table: <code> 01 CGI-Merge-Data. 03 MD-Template PIC X(12). 03 MD-Function PIC X. * O=Open W=Writesection X=Close 03 MD-Section PIC X(12). ... 03 MD-Data. 05 FILLER PIC X(12) VALUE "ORDERNO". 05 MD-OrderNo PIC X(40). 05 FILLER PIC X(12) VALUE "CUSTOMER". 05 MD-Customer PIC X(40). .... 05 FILLER PIC X(12) VALUE "ORDERDATE". 05 MD-OrderDate PIC X(40). ... 05 FILLER PIC X(12) VALUE "LINENO". 05 MD-LineNo PIC X(40). 05 FILLER PIC X(12) VALUE "PRODUCT". 05 MD-Product PIC X(40). 05 FILLER PIC X(12) VALUE "QUANITY". 05 MD-Quantity PIC X(40). .... </code> Fill in the data and call the template module: <code> MOVE "ORDER" TO MD-Template MOVE "W" TO MD-Function MOVE "HEADER" TO MD-Section MOVE OR-OrderNo TO MD-OrderNo OL-OrderNo ... CALL "template" USING CGI-Merge-Data MOVE "LINEITEM" TO MD-Section START OrderLines KEY >= OL-OrderNo ... PERFORM UNTIL OL-OrderNo NOT = OR-OrderNo READ OrederLines MOVE .... CALL "template" USING CGI-Merge-Data .... MOVE "TRAILER" TO MD-Section CALL "template" USING CGI-Merge-Data MOVE "X" TO MD-Function CALL "template" USING CGI-Merge-Data </code> To output this as JSON, or CSV, or XML, or a printed report only requires a different template file. ---------------------------------------------------------------- One point that I failed to make was that the data items in thetable should be redefined as: <code> 03 MD-Redefined REDEFINES MD-Data. 05 MD-Items OCCURS nn. 07 MD-Name PIC X(12). 07 MD-Value PIC X(40). </code> This is used by the template module to substitute the tags. This program steps through the lines of a section looking for "<!%" then for "%>" what lies between is the tag name. This name is searched for in the table and the value is substituted. ---------------------------------------------------------------- We use an approach like Riplin's. In our case we placed the html code in a template file and the cgi manipulation code in routines that we CALL. While developed originally for the HP3000, we only changed a few lines to get it running with OpenCOBOL 1.1. jimc ---------------------------------------------------------------- Another reason to use HTML copybooks is for a plug-in system. Along with templating you can use plug-ins which define a specific function say like a TreeControl. Or with CMS system which uses templates you can create plug-ins for widgets etc. All of which you'll want to use some OC with HTML genteration ability. I think there is room for both and I will certainly be doing so with many of the apps I plan on building. Currently for the OCWebEditor I am building I am using the template/plug-in approach. Also, I am learning a lot on my own doing it this way since there really is no tutorials out there. So, one of the goals is to document as much as I can and post it as tutorials for future reference for newbies. But I do appreciate ALL the input thus far. Gives me more things to think about and play with :D ---------------------------------------------------------------- Damon, You are absolutely right in saying that there is room for multiple approaches. I have not found a situation where that was not true. Keep up the good work. jimc ---------------------------------------------------------------- Subject: JavaScript and OC btiffin. I was reading the FAQ and looking at the example for wrapping SpideMonkey engine to use JavaScript. First what would be the benefit of doing that? 2nd. Do I need to have the SpiderMonkey installed? If so this would probably not be useful on a hosted site. If I do find a need for something other than COBOL, wouldn't C be a better option? Thanks ---------------------------------------------------------------- Well, if you take the sample one step forward, you can expose OpenCOBOL 'objects' to scripting. That requires more glue, but not a whole lot. [i]To be honest, the day(s) I wrote that up, I was looking for a regex engine to play with.[/i] ;-) And yes, it requires an install with the source headers etc. If you don't need regex or a scripting aspect to your app, C is a grand choice. ;) [i]And I'm going to keep poking you to check out Vala/Genie and that whole angle. Vala writes C intermediate that OpenCOBOL compiles nicely. OpenCOBOL writes C intermediate that Vala compiles nicely. Along with the good old C Application Binary Interface.[/i] It's a heap-o-functions paradigm. Cheers, Brian ---------------------------------------------------------------- you just keep on poking. I will get around to it. I would like to see a complete wrapper for a gui front end be it Vala/Genie or Tcl/Tk or something else. Cheers Damon ---------------------------------------------------------------- If you don't mind tickle, Rildo Pragna (author of Tiny COBOL, which was learning ground for early OpenCOBOL development) already has a full on Tcl/Tk binding, which works right out of the box with OpenCOBOL. I got his glad permission to publicize that code base with OpenCOBOL. See the FAQ. But, I'm a GTK+ guy now. C ABI, Vala bindings exist. Easy peasy to link / glue to. Umm, see the FAQ for the start of a raw C GTK+ from OC binding layer. Lots more typing for that one, as we'd have to do the work that Vala's vapigen has already automated. Just comes down to someone getting the itch and digging in. The concepts are already proven. Cheers, Brian ---------------------------------------------------------------- Subject: Running a make on OpenCobol for minor chagne I am a new member of this forum and am evaluating OPenCobol as a replacement for our current Cobol environment. This analysis is using Oracle Linux 5.4. When I ran my first compile I found that version 1.1 doesn't allow 77 FILLER lines. I found a post called OC 1.1 IBM compatibility - degradation That describes some code changes to fix this. I applied those changes and then did a make clean make make install I then ran my compile again and receive the same error message for the compiler. I did install the additional packages listed for a developer environment on Linux. That didn't seem to make a difference. I am not a C programmer so I wonder if anyone can point me in the right direction to figure out what I am missing to make this change take. Thanks, Steve ---------------------------------------------------------------- Just in case; GNU/Linux systems keep a link library cache. After installing any new OC, follow up with $ sudo ldconfig .so files may be in ram already, that flushes them out. bash also keeps a hash table of commands, so it won't have to scan dirs in the path if it's already found $ hash -r recycles the bash command location hash table. or, from your commands it looks like the install is into userspace (make install uses the default from the ./configure prefix, usually /usr/local. install will require super user privs to write to these dirs... so if you are doing a local tree configure, make sure (use which) you get the new version of cobc and not something already in the path Or ... more discussion required if those don't work out. Cheers, Brian ---------------------------------------------------------------- Welcome! ... and if you make ANY code changes your not 100% sure about (doesn't harm if done every time): run "make check" before "make install". human ---------------------------------------------------------------- I ran the bash -r and the ldconfig. I am running the make as root and the install is going to the default locations. /usr/local/bin /usr/local/lib I ran as root. * make clean * make * make install The I ran the ldconfig. I returned to my user ID and ran "babsh -r and then the cobc against my cobol program and to the error message: rbshc001.cob:653: Error: Item requires a data name Below I show the bin and lib directories to show that everything got replaced. /usr/local/bin/ -rwxr-xr-x 1 root root 507882 Dec 9 10:47 cobc -rwxr-xr-x 1 root root 1376 Dec 9 10:47 cob-config -rwxr-xr-x 1 root root 9797 Dec 9 10:47 cobcrun /usr/local/lib/ -rw-r--r-- 1 root root 323410 Dec 9 10:47 libcob.a -rwxr-xr-x 1 root root 810 Dec 9 10:47 libcob.la lrwxrwxrwx 1 root root 15 Dec 9 10:47 libcob.so -> libcob.so.1.0.0 lrwxrwxrwx 1 root root 15 Dec 9 10:47 libcob.so.1 -> libcob.so.1.0.0 -rwxr-xr-x 1 root root 220959 Dec 9 10:46 libcob.so.1.0.0 I image I don't have something set up right. I ran cobc -V and get cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Dec 09 2010 08:30:30 Packaged Feb 06 2009 10:30:55 CET The build time is correct in the message above. ---------------------------------------------------------------- Simple answer: You changed a yac-file and only generated from C-sources (which were not changed). You must use bison first to regenerate parser.c and parser.h from your changed file. human ---------------------------------------------------------------- I ran Bison against parser.y. What came out of that is parser.tab.c and parser.tab.h. Since I am not a C programmer, I am also not a Bison person either. I tried a gcc against parser.tab.h and get a missing config.h and a missing lib/gettext.h. I also tried a gcc -g as well with the same results. Is there a developer document on how to set all this up? Thanks, Steve ---------------------------------------------------------------- Everything depends on your configuration. I'd try to rename these files to parser.c and parser.h, replace the original two sources with them and do "make" (there is no change in configuration, thereofre no need for ./configure) "make check" "make install". human ---------------------------------------------------------------- Thanks for the instructions. I made those changes and the compiler no longer complains about 77 FILLER items. SteveO ---------------------------------------------------------------- Subject: OpenCOBOL 2.0? So I am going to bring it up. We've heard several things about OC2 and one of things that we (we meaning community) really are anticipating is the UDF (User Defined Function) ability. Working on getting a web app going I keep running into things like accepting input and parsing input. I would LOVE to build a functions library for use with the web. Things like function parseJSON (), function parseXML() etc would be wonderful to have in my web tool library. So the burning question is... where, when will we get a beta of OC2? Don't mean to ruffle feathers or anything, but OC is WONDERFUL and POWERFUL. I would love to have OC handle OOP, but know how difficult creating a compiler is, so won't expect the moon. :D Anyway, that was my burning question. Roger and all who are working on the core THANK YOU THANK YOU THANK YOU. I look forward to being able to give quality contributions. Cheers Damon ---------------------------------------------------------------- Subject: Please help me. I am a student who currently taking computer programming. We are using COBOL. I am new at this. So I have no idea where to start. I need a program that can excute COBOL source code. I don't take the class directly in the classroom because it is by contract. I have to do certain programs but I don't have a program to compile the cource so I can't tell if the source code is correct or not. I don't understand at all how to install Open cobol even following the instructions. Given at the site. Please if its not to much to ask. Can someone help me. :-( I been searching for endless days trying to find a program that can help me understand if my code is right or wrong. I tried with Micro Visual free trial that works with Visual Studio 2010 but -_- the free trail was expried soon as I installed it. an example being of source code i have to so IDENTIFICATION DIVISION. PROGRAM-ID. EXAM1PROG AUTHOR. STUDENT NAME GOES HERE INSTALLATION. PAINTING MASTERS DATE-WRITTEN. 11 OF OCTOBER 2010. DATE-COMPILED. UNKNOWN SECURITY. CONFIDENTIAL. ENVIRONMENT DIVISION. CONFIGURATION SECTION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT PAINTER-MASTERS-IN ASSIGN TO F:/PAINTERMASTER.MDB ORGANIZATION IS LINE SEQUENTIAL. SELECT LIST-PAINTER-OUT ASSIGN TO F:/PAINTERLIST.DOC ORGANIZATION IS LINE SEQUENTIAL. I know there are errors in this but -__- I wouldn't know where, or how to fix it. Please please help me understand what programs I need. My professor tell me Fujitsu Cobol 3.0 helps helps helps. But how can something I don't have help me. Please reply soon I don't want to fail this class. Thank You. ---------------------------------------------------------------- Welcome to the world of COBOL! Welcome to OC (forget about the Fujitsu Compiler). I think the most fastest way to get you running up is to point you to the wiki, assorted documents, OpenCOBOL-1.1-06FEB2009-mingw.zip (don't forget to read the text to this file, too) human ---------------------------------------------------------------- Subject: Fix for synchronize size calculations Hi, After looking at your code to inspire our own size calculations, I came to realize that your were missing a corner case in the synchronized slack byte calculation and a special SYNVH case. I'd like to return the favor and share our findings with you. That is from IBM reference: Slack bytes can also be added by the compiler when a group item is defined with an OCCURS clause and contains within it a SYNCHRONIZED binary data item. Reconstructing in C what we did in our code (Java and based on very different underlying facility). Look for rec_align_size for changes: static int compute_size (struct cb_field *f) { struct cb_field *c; int size; int align_size; int rec_align_size; int pad; if (f->level == 66) { /* rename */ if (f->rename_thru) { f->size = f->rename_thru->offset + f->rename_thru->size - f->redefines->offset; } else { f->size = f->redefines->size; } return f->size; } if (f->children) { /* groups */ size = 0; rec_align_size = 1; for (c = f->children; c; c = c->sister) { if (c->redefines) { c->offset = c->redefines->offset; compute_size (c); /* increase the size if redefinition is larger */ if (c->level != 66 && c->size * c->occurs_max > c->redefines->size * c->redefines->occurs_max) { if (cb_larger_redefines_ok) { cb_warning_x (CB_TREE (c), _("Size of '%s' larger than size of '%s'"), c->name, c->redefines->name); size += (c->size * c->occurs_max) - (c->redefines->size * c->redefines->occurs_max); } else { cb_error_x (CB_TREE (c), _("Size of '%s' larger than size of '%s'"), c->name, c->redefines->name); } } } else { c->offset = f->offset + size; size += compute_size (c) * c->occurs_max; /* word alignment */ if (c->flag_synchronized && cb_verify (cb_synchronized_clause, "SYNC")) { align_size = 1; switch (c->usage) { case CB_USAGE_BINARY: case CB_USAGE_COMP_5: case CB_USAGE_COMP_X: case CB_USAGE_FLOAT: case CB_USAGE_DOUBLE: if (c->size == 2 || c->size == 4 || c->size == 8) { align_size = c->size; } break; case CB_USAGE_INDEX: case CB_USAGE_LENGTH: align_size = sizeof (int); break; case CB_USAGE_OBJECT: case CB_USAGE_POINTER: case CB_USAGE_PROGRAM_POINTER: case CB_USAGE_PROGRAM: align_size = sizeof (void *); break; default: break; } if (c->offset % align_size != 0) { pad = align_size - (c->offset % align_size); c->offset += pad; size += pad; if (align_size > rec_align_size) { rec_align_size = align_size; } } } } } if (fld->occurs_max > 1 && size % rec_align_size != 0) { size += rec_align_size - (size % rec_align_size); } f->size = size; } else { /* elementary item */ ...rest unchanged Also, your code seems to not support using the SYNCHRONIZED keyword at the 01 level as supported by the spec: The SYNCHRONIZED clause can be specified for elementary items and for level-01 group items, in which case every elementary item within the group item is synchronized. Thanks Alain ---------------------------------------------------------------- Subject: Open Cobol 1.1prerelease install error.Please help. I use wmware workstation run Redhat enterprise 5 edtion . [root@localhost open-cobol-1.1]# uname -a Linux localhost.localdomain 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:21 EST 2007 i686 i686 i386 GNU/Linux [root@localhost open-cobol-1.1]# cd /usr/local/BerkeleyDB.5.1/ [root@localhost BerkeleyDB.5.1]# ls bin docs include lib [root@localhost BerkeleyDB.5.1]# Setp 1: ./configure This step ran ok. [root@localhost open-cobol-1.1]# ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether to enable maintainer-specific portions of Makefiles... no checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking how to run the C preprocessor... gcc -E checking for egrep... grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking whether ln -s works... yes checking for a BSD-compatible install... /usr/bin/install -c checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking for a sed that does not truncate output... /bin/sed checking for ld used by gcc... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for /usr/bin/ld option to reload object files... -r checking for BSD-compatible nm... /usr/bin/nm -B checking how to recognize dependent libraries... pass_all checking dlfcn.h usability... yes checking dlfcn.h presence... yes checking for dlfcn.h... yes checking the maximum length of command line arguments... 98304 checking command to parse /usr/bin/nm -B output from gcc object... ok checking for objdir... .libs checking for ar... ar checking for ranlib... ranlib checking for strip... strip checking if gcc supports -fno-rtti -fno-exceptions... no checking for gcc option to produce PIC... -fPIC checking if gcc PIC flag -fPIC works... yes checking if gcc static flag -static works... yes checking if gcc supports -c -o file.o... yes checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking for shl_load... no checking for shl_load in -ldld... no checking for dlopen... no checking for dlopen in -ldl... yes checking whether a program can dlopen itself... yes checking whether a statically linked program can dlopen itself... no checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes configure: creating libtool checking whether make sets $(MAKE)... (cached) yes checking for ANSI C header files... (cached) yes checking for stdint.h... (cached) yes checking for sys/types.h... (cached) yes checking signal.h usability... yes checking signal.h presence... yes checking for signal.h... yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking malloc.h usability... yes checking malloc.h presence... yes checking for malloc.h... yes checking locale.h usability... yes checking locale.h presence... yes checking for locale.h... yes checking stddef.h usability... yes checking stddef.h presence... yes checking for stddef.h... yes checking wchar.h usability... yes checking wchar.h presence... yes checking for wchar.h... yes checking for dlfcn.h... (cached) yes checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking for an ANSI C-conforming const... yes checking whether byte ordering is bigendian... no checking for size_t... yes checking whether struct tm is in sys/time.h or time.h... time.h checking for inline... inline checking for working alloca.h... yes checking for alloca... yes checking for vprintf... yes checking for _doprnt... no checking for memmove... yes checking for memset... yes checking for setlocale... yes checking for fcntl... yes checking for strerror... yes checking for strcasecmp... yes checking for strchr... yes checking for strrchr... yes checking for strdup... yes checking for strstr... yes checking for strtol... yes checking for gettimeofday... yes checking for ld used by GCC... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for shared library run path origin... done checking for iconv... yes checking for iconv declaration... extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); checking for nl_langinfo and CODESET... yes checking for getopt_long_only... yes checking kpathsea/getopt.h usability... no checking kpathsea/getopt.h presence... no checking for kpathsea/getopt.h... no checking getopt.h usability... yes checking getopt.h presence... yes checking for getopt.h... yes checking gmp.h usability... yes checking gmp.h presence... yes checking for gmp.h... yes checking for __gmp_randinit in -lgmp... yes checking whether NLS is requested... yes checking for msgfmt... /usr/bin/msgfmt checking for gmsgfmt... /usr/bin/msgfmt checking for xgettext... /usr/bin/xgettext checking for msgmerge... /usr/bin/msgmerge checking whether NLS is requested... yes checking for GNU gettext in libc... yes checking whether to use NLS... yes checking where the gettext function comes from... libc checking for initscr in -lncurses... yes checking ncurses.h usability... yes checking ncurses.h presence... yes checking for ncurses.h... yes checking db.h usability... no checking db.h presence... no checking for db.h... no checking db_185.h usability... no checking db_185.h presence... no checking for db_185.h... no checking db3/db_185.h usability... no checking db3/db_185.h presence... no checking for db3/db_185.h... no checking db4/db_185.h usability... no checking db4/db_185.h presence... no checking for db4/db_185.h... no checking db4.1/db_185.h usability... no checking db4.1/db_185.h presence... no checking for db4.1/db_185.h... no checking db4.2/db_185.h usability... no checking db4.2/db_185.h presence... no checking for db4.2/db_185.h... no checking db4.3/db_185.h usability... no checking db4.3/db_185.h presence... no checking for db4.3/db_185.h... no checking db4.4/db_185.h usability... no checking db4.4/db_185.h presence... no checking for db4.4/db_185.h... no checking db4.5/db_185.h usability... no checking db4.5/db_185.h presence... no checking for db4.5/db_185.h... no checking for __db_open in -ldb-4.5... no checking for dbopen in -ldb-4.5... no checking for __db_open in -ldb-4.4... no checking for dbopen in -ldb-4.4... no checking for __db_open in -ldb-4.3... yes checking for dlopen in -lc... no checking for dlopen in -ldl... (cached) yes configure: creating ./config.status config.status: creating cob-config config.status: creating Makefile config.status: creating lib/Makefile config.status: creating libcob/Makefile config.status: creating cobc/Makefile config.status: creating bin/Makefile config.status: creating po/Makefile.in config.status: creating texi/Makefile config.status: creating config/Makefile config.status: creating copy/Makefile config.status: creating tests/atlocal config.status: creating tests/Makefile config.status: creating tests/cobol85/Makefile config.status: creating config.h config.status: config.h is unchanged config.status: executing tests/atconfig commands config.status: executing depfiles commands config.status: executing default-1 commands config.status: creating po/POTFILES config.status: creating po/Makefile OpenCOBOL Configuration: CC gcc COB_CC gcc CFLAGS -O2 -march=i686 -mtune=pentium4 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k COB_CFLAGS -I/usr/local/include COB_EXTRA_FLAGS -march=i686 -mtune=pentium4 LDFLAGS COB_LDFLAGS COB_LIBS -L${exec_prefix}/lib -lcob -lm -lgmp -lncurses -ldb-4.3 -ldl COB_CONFIG_DIR ${prefix}/share/open-cobol/config COB_COPY_DIR ${prefix}/share/open-cobol/copy COB_LIBRARY_PATH ${exec_prefix}/lib/open-cobol COB_MODULE_EXT so COB_SHARED_OPT -shared COB_PIC_FLAGS -fPIC -DPIC COB_EXPORT_DYN -Wl,--export-dynamic COB_STRIP_CMD strip --strip-unneeded Dynamic loading System Use gettext for international messages: yes Use Berkeley DB for file I/O: yes Use enhanced Berkeley DB (>= 4.1) no Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: yes Step 2 :make, Give error. fileio.c:2000: error: 'info' undeclared (first use in this function) fileio.c:2002: error: 'R_DUP' undeclared (first use in this function) fileio.c:2013: error: 'struct indexed_file' has no member named 'db' fileio.c:2013: warning: implicit declaration of function 'dbopen' fileio.c:2013: error: 'DB_BTREE' undeclared (first use in this function) fileio.c:2014: error: 'struct indexed_file' has no member named 'db' fileio.c:2020: error: 'struct indexed_file' has no member named 'db' fileio.c:2020: error: 'struct indexed_file' has no member named 'db' fileio.c:2027: error: 'struct indexed_file' has no member named 'db' fileio.c:2028: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2029: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2041: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2042: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2050: error: 'DBT' undeclared (first use in this function) fileio.c:2050: error: 'struct indexed_file' has no member named 'key' fileio.c:2050: error: 'struct indexed_file' has no member named 'key' fileio.c:2050: error: 'struct indexed_file' has no member named 'key' fileio.c:2050: error: 'struct indexed_file' has no member named 'key' fileio.c:2050: error: 'struct indexed_file' has no member named 'key' fileio.c:2050: error: 'struct indexed_file' has no member named 'key' fileio.c:2050: error: 'struct indexed_file' has no member named 'key' fileio.c:2050: error: 'struct indexed_file' has no member named 'key' fileio.c:2050: error: 'struct indexed_file' has no member named 'key' fileio.c:2050: error: 'struct indexed_file' has no member named 'key' fileio.c:2051: error: 'struct indexed_file' has no member named 'data' fileio.c:2051: error: 'struct indexed_file' has no member named 'data' fileio.c:2051: error: 'struct indexed_file' has no member named 'data' fileio.c:2051: error: 'struct indexed_file' has no member ....... fileio.c:3398: error: 'struct indexed_file' has no member named 'db' fileio.c:3398: error: 'struct indexed_file' has no member named 'db' fileio.c:3398: error: 'struct indexed_file' has no member named 'key' fileio.c:3404: error: 'struct indexed_file' has no member named 'db' fileio.c:3404: error: 'struct indexed_file' has no member named 'db' fileio.c:3404: error: 'struct indexed_file' has no member named 'key' fileio.c:3404: error: 'struct indexed_file' has no member named 'data' fileio.c:3404: error: 'R_NEXT' undeclared (first use in this function) fileio.c:3421: error: 'struct indexed_file' has no member named 'db' fileio.c:3421: error: 'struct indexed_file' has no member named 'db' fileio.c: In function 'indexed_rewrite': fileio.c:3584: error: 'struct indexed_file' has no member named 'key' fileio.c:3584: error: 'struct indexed_file' has no member named 'key' make[2]: *** [libcob_la-fileio.lo] Error 1 make[2]: Leaving directory `/tmp/open-cobol-1.1/libcob' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/tmp/open-cobol-1.1' make: *** [all] Error 2 ---------------------------------------------------------------- ricky; Yeah, You need dev headers for libdb (you don't have, or perhaps configure can't handle v5 yet?), ncurses (you have) and libgmp (you have) for a clean cobc build. So yum install db4-devel (I'm on Fedora, it might be db5-devel in RHEL) or, for anyone else reading (can't remember the package name) -dev package on Debian. Those three pre-reqs are pretty easy to miss. Cheers, Brian ---------------------------------------------------------------- Thanks brian's reply, i try db-4.1.25 also,it's doesnot work. i try give install path when i make opencobol --prefix=/usr/local/db-4.1.25.it's doesnot work also. ---------------------------------------------------------------- --prefix is only for the directory where OC is installed via make install, not where the sources are. ./configure --help would have shown you this, as it recommends to set CFLAGS and CPPFLAGS if you have stuff in non-standard directories. What Brian wanted to say is: You need the dev-packages for the prerequisites (they contain the c-header files), too and likely only have the runtime packages (containing the runtime libraries). The later ones are found [code]checking for __db_open in -ldb-4.3... yes[/code] but the headers aren't [quote]checking db.h usability... no checking db.h presence... no checking for db.h... no checking db_185.h usability... no checking db_185.h presence... no checking for db_185.h... no [...] checking db4.3/db_185.h usability... no checking db4.3/db_185.h presence... no checking for db4.3/db_185.h... no[/quote] Take care you have the correct headers according to the lib and we can go on further. @Brian: BDB 4.5 is no problem. human ---------------------------------------------------------------- ya,i got your idear,i still cannot solved it .I never use linux before, i worked on zos. I now the place where store db.h. I donot know how tell OC configure program. I try set it in /etc/ld.so.conf,it's doesnot work. Can u give some details things. Thanks. ---------------------------------------------------------------- Try [code] $ sudo yum install db4-devel [/code] [b]sudo[/b] meaning you have to do the [b]yum install[/b] as root ([i]assuming a normal setup with /usr/local/ as the top[/i]). And [i]db4-devel[/i], as I think most of us run using the 4.5 release, so it is the most soaked. You seem to already have gmp-devel and ncurses-devel, the other pre-reqs for a normal OC build. Cheers, Brian ---------------------------------------------------------------- Subject: Rave post; Vala assisted libsoup HTTP server Another Sunday evening; Given [b]soupserver.vala[/b] [code] // vala .10 specific. .11 changes string to uint8 array // valac -c --pkg libsoup-2.4 --thread soupserver.vala // Give the server a default void default_handler (Soup.Server server, Soup.Message msg, string path, GLib.HashTable? query, Soup.ClientContext client) { string response_text = """ <html> <body> <p>Current location: %s</p> <p><a href="/xml">Test XML</a></p> <p><a href="/cobol">Test COBOL</a></p> <p><a href="/exit">Tell server to exit</a></p> </body> </html>""".printf (path); msg.set_response ("text/html", Soup.MemoryUse.COPY, response_text, response_text.size ()); msg.set_status (Soup.KnownStatusCode.OK); } void xml_handler (Soup.Server server, Soup.Message msg, string path, GLib.HashTable? query, Soup.ClientContext client) { string response_text = "<node><subnode>test</subnode></node>"; msg.set_response ("text/xml", Soup.MemoryUse.COPY, response_text, response_text.size ()); } void cobol_handler (Soup.Server server, Soup.Message msg, string path, GLib.HashTable? query, Soup.ClientContext client) { string response_text = """ <html> <body> <p>Current location: %s</p> <p><a href="/xml">Test XML</a></p> <p><a href="/">Home</a></p> <p><a href="/exit">Tell server to exit</a></p> </body> </html>""".printf (path); msg.set_response ("text/html", Soup.MemoryUse.COPY, response_text, response_text.size ()); msg.set_status (Soup.KnownStatusCode.OK); } void exit_handler (Soup.Server server, Soup.Message msg, string path, GLib.HashTable? query, Soup.ClientContext client) { server.quit(); } int CBL_OC_SOUPSERVER(ref Soup.Server* ss, int port) { var server = new Soup.Server(Soup.SERVER_PORT, port); server.add_handler("/", default_handler); server.add_handler("/xml", xml_handler); server.add_handler("/cobol", cobol_handler); server.add_handler("/exit", exit_handler); ss = (owned)server; stdout.printf("ss: %X\n", (uint)ss); return 0; } int CBL_OC_SOUPRUN(Soup.Server ss) { ss.run(); return 0; } [/code] and [b]ocsoup.cob[/b] [code] OCOBOL*>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20101205 *> Purpose: An HTTP server with libsoup *> Tectonics: valac -c --pkg libsoup-2.4 --thread soupserver.vala *> cobc -x ocsoup.cob soupserver.vala.o -lglib-2.0 *> -lsoup-2.4 -lgobject-2.0 *> *************************************************************** identification division. program-id. ocsoup. data division. working-storage section. 01 soup-server usage pointer. 01 port usage binary-long value 8088. 01 result usage binary-long. *> *************************************************************** procedure division. call "g_type_init" end-call display "Initialize soup HTTP server on port " port end-display call "CBL_OC_SOUPSERVER" using by reference soup-server by value port returning result end-call display "Result: " result " Server at: " soup-server end-display display "About to run server, ^C to terminate" end-display call "CBL_OC_SOUPRUN" using by value soup-server returning result end-call goback. end program ocsoup. [/code] and [code] $ valac -c --pkg libsoup-2.4 --thread soupserver.vala $ ... some warnings about unused methods ... $ cobc -x ocsoup.cob soupserver.vala.o -lglib-2.0 -lsoup-2.4 -lgobject-2.0 $ ./ocsoup Initialize soup HTTP server on port +0000008088 ss: 21CF060 Result: +0000000000 Server at: 0x00000000021cf060 About to run server, ^C to terminate [/code] You get RESTful screen shots like... [img]http://opencobol.add1tocobol.com/images/ocsouphome.png[/img][img]http://opencobol.add1tocobol.com/images/ocsoupxml.png[/img][img]http://opencobol.add1tocobol.com/images/ocsoupcobol.png[/img] The next steps are getting the add_handler callbacks into COBOL, and then play with the template and replace model. Cheers, Brian P.s. This was just a little bit more fun than usual; with the Fossil scm. It's a beauty tool. [i]And why not look at your own face for your local repos[/i] [code] $ fossil add ocsoup.cob soupsample.vala $ fossil ci -m "soup server sample" $ opera http://localhost:8080/opencobol/timeline [/code] [img align=center]http://opencobol.add1tocobol.com/images/fossiloctimeline.png[/img] ---------------------------------------------------------------- Subject: Cobol Cross-Reference and Animator Hi all, I have implemented the Cross-Reference functionality into the OC compiler. New flag "-xref". I also took Federico's ideas for the Animator/Debugger and implemented that also into the OC compiler and run-time. New flag "-a". And for running it just set COB_ANIM=Y. My code changes are based on OC release 1.1 but are too massive to post here. :-( If Roger can sent me a PM we can discuss about how he wants them handed over. And maybe they can be implemented in 2.0? :-D ---------------------------------------------------------------- I have seen it working and have seen (and heard) Ed working on it as well ;-) It was a great joy to feed him my ideas as well :-D. Creating debug/animator code from the Cobol-compiler works fast and reliable. It works comparable to MF though it lacks a lot of functionality from MF. The animator is able to view/set variable-values. Also, the animator is mostly written in Cobol and therefore easy adaptable. I do hope it may become standard functionality in OC2.x ---------------------------------------------------------------- If you are interested, I'm sure add1tocobol.com could host the sources. If you know unified diff ... [code] $ diff -u original.c new.c >original.patch [/code] then we can [code] $ cd cobc $ patch < original.patch [/code] Unified diff will let patch pick the file to tweak. ;) And if you have the original tar extract and your working dir, [code]diff -rupN original/cobc/ eds/newcobc/ >original.patch[/code] And a single patch file can hit the whole tree. [i]and if you post one of the interesting patch files, it'll get the forum viewers more and more used to the C code ... a good thing, in my humble.[/i] Cheers, Brian ---------------------------------------------------------------- Wow! Thank you ---------------------------------------------------------------- In the meantime ACCEPT WITH TIMEOUT is implemented. This makes it possible for the animator to be interrupted during 'go'. Not too bad... ---------------------------------------------------------------- Hello all, a first version of documentation for the Cobol Animator (we call it OCEAN) is available. You may find it [url=http://www.borchert.nl/OceanV1.00.pdf]here as a PDF at this download link[/url]. We have not yet put the sourcecode available to download yet. Please let us know if you are interested. Any comments are welcome. Enjoy! ---------------------------------------------------------------- Mr. Heirbaut, We would love to try out this exciting addition to the family of resources. Please let me know how I can get a copy. jimc ---------------------------------------------------------------- Some questions to this interesting "addon": Q1. As you may know, unofficial 2.0 pre-releases have a switch for calling cobxref. What does your switch do? If there is an own cross reference, how does it differ from cobxref? Q2. Did you tested it with an unofficial 2.0 pre-release? If not I'd like to do so in January, as I have access to these. Q3. Does this stuff works without using BDB at all and using VBISAM instead? Some stuff I'd like to see on the ToDo-List: T1. Add the functionality of remote-debugging by using SOCKETs. This is especially useful if the COBOL modules are run on a non-monitor terminal or you want to do so via network (multi developer environment). Additional it gives the possibility to run the debugger in a different language (for example JAVA within Eclipse for a nice IDE) because it's only necessary to develop a communication protocol (which is not that hard). T2. Enable display/accept/watch with reference modification. This could be a possible workaround for the current limitations, too. Keep the good work. human ---------------------------------------------------------------- I will discuss with Ed about how we can make this available. I know that Ed has been in contact with Roger about pre-implementing this into OC2.0 and test it but I do not know the current status. re Q1: the -Xref flag creates an .xrf file (textfile) that lists all data-items, labels and sections, the programlines on which these are defined and the lines they are used (if any). I may post an example if you like. re Q2: not yet. re Q3: it uses BDB and no VBISAM. Might be a possibility in the future. re T1: interesting feature... re T2: not sure, but I think this is already possible. May be I misunderstand. ---------------------------------------------------------------- Just a small addition to Q1. In our implementation the Xref functionality is embedded in the OC compiler. In the option you mentioned a separate program is called. ---------------------------------------------------------------- Subject: Downloading OpenCobol when I tried to download OpenCobol, I got a message that said the download would begin soon. It said if there was a download problem to click on a link provided or choose a mirror download. The download did not work, nor did the direct link or the mirror. What is wrong? ---------------------------------------------------------------- That depends. Where did you try and download from? The best bet is from the left menu bar here, bold Download and OpenCOBOL 1.1 pre-release. Next screen is a direct link to a tar.gz file. There should not be any "Download to start soon" ad page in between. And if are running GNU/Linux, apt-get install opencobol or yum install opencobol will snag 1.0 binary builds. But all the fun is in the 1.1 pre-rel. ;) I'll be honest, my first glance at OpenCOBOL was from a Debian repo. Once I saw the source tar ball...heaven. Cheers, Brian ---------------------------------------------------------------- The first thing to know: under what operating system you want to run OpenCobol. If it is MS Windows XP / SEVEN 32 or 64 bits, so in my opinion the best distribution is that of Gary Cutler. To recover you must go on "Main Menu" (top left of the page OpenCOBOL.org) then click "Wiki" and then "Assorted Documents". The last download "OpenCobol-1.1-06FEB2009-mingw.zip" is correct. The author clearly understands the needs of the poor who are unfamiliar with the UNIX world and I thank him! I hope that we will present the same with the next version 2.0. Regards. Rene ---------------------------------------------------------------- btiffin: apt-get install opencobol does not work. [code] damon@altair1:/$ sudo apt-get install opencobol Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package opencobol [/code] ---------------------------------------------------------------- Oops; For Debian, it's [code] apt-get install open-cobol [/code] for Fedora, it's also [code] yum install open-cobol [/code] Cheers, Brian ---------------------------------------------------------------- Subject: ACCEPT / DISPLAY 2nd generation Hello everyone. [Open COBOL on MSWindows] Anyone know if there is a simple way to replace the instructions "ACCEPT" and "DISPLAY" to obtain semi graphical display? Example with "CALL" on a library written in C, if it exists of course! Regards. Rene ---------------------------------------------------------------- I'm not sure I understand what you want to do... Get and put data from/to the console from COBOL without use of OC-routines (that use curses)? Please give some details why and what you want to achieve. human ---------------------------------------------------------------- Hi Rene, I worked on it a time ago. Lot of conversation with Roger in my posts. As I understand you're living in France, so you can e-mail me in French (my email is valid). If we find solutions we post then in this forum ... regards François - Bear PS I'm working with acucobol, and this is the method I use for my office Cobol developpement. ---------------------------------------------------------------- Hello François. Thank you for your reply. The verbs "ACCEPT" and "DISPLAY" is in my opinion the best way to develop interfaces for flexibility. Working only under MS Windows (sorry) and knowing nothing of C (sorry again) I felt very quickly jammed into the windows in character mode. So I started searching in all directions to find a way to replace these two verbs by one or more functions to do almost the same thing but in a limited but sufficient graphical environment to display text with the choice of fonts for example. By examining the MS Windows API it realizes that it is possible (provided you master the correct C). So I started to study C (but the road that I have to do is still very long). What can I do if there are volunteers, is to list (not exhaustive) functions to achieve with the details of their mechanism. I'll answer your mail (which I thank you) in detail and we can all see if I'm not in utopia. A breakthrough of this sort would be really beneficial for OpenCOBOL. For info, I use the superb cast of Gary Cutler. See you soon. Regards. Rene Aouizerate ---------------------------------------------------------------- Hello Human. What I want is very simple ... to explain ... but surely very complicated to achieve. Currently I use the distribution of OpenCobol 1.1 of Gary Cutler under MSWindows XP / Seven. It's almost perfect if you want to stay in text mode. While knowing nothing about UNIX world and C/C++/C# I wish today to take a new step with OpenCobol. I read some tutorials about MSWindows'API and I think it is possible to produce a simple graphical interface, replacing the "ACCEPT - DISPLAY" verbs by a number of plugins that are called via a CALL, and that obtains beautiful graphicals windows (with choice of fonts and more, but without exaggeration). Moreover, the creation of such a library would be limitless! I tried ScreenIO (a Graphical User Interface for COBOL) that is not, in my opinion, flexible because it is a RAD with all its constraints. I never liked to make blocks of PANELS , much less SCREEN SECTION. So I began to study the C since it is impossible to do anything without this language. I got close to Bear on this subject seems to interest him as well. Do you think I'm in utopia? Are there any other tracks? Regards. Rene Aouizeate ---------------------------------------------------------------- See http://opencobol.add1tocobol.com/#does-opencobol-support-the-gimp-toolkit-gtk for proof of concept using GTK. Vala also works well, ..., on the GNU/Linux side. A Windows layer would be similar. A few hundred lines of wrapper and you can make full on OpenCOBOL gui apps. Cheers, Brian ---------------------------------------------------------------- Brian. Hello and thank you. If I understand I need to learn a little C and GTK + to do what I want. If you had already use GTK+ for MSWindows with OpenCOBOL can you tell me which packages (versions) I have to install on my PC that I use in knowing the distribution of Gary Cutler OpenCobol to 1.1 under MSWindows XP 32b and MSWindows Seven 64b. Regards. Rene Aouizerate ---------------------------------------------------------------- Subject: libcob: Cannot find module 'orasql9' Newbie to OC, long term on MF cobol. Was able to successfully download OC 1.1 on windows and able to compile the cobol code with procob preprocessor. Fantastic instructions on installation and it was a breeze. linked the code but the exe does not run fails on libcob: Cannot find module 'orasql9' error, Set the env var COB_PRE_LOAD=ORASQL9.DLL ( DLL has a soft link to /usr/bin which is in the path. Any help is appreciated. Compiled with static link option, was able to get over this error. -fstatic-call ---------------------------------------------------------------- For future reference; Don't add any extensions in the COB_PRE_LOAD list. OC does the right thing for each platform. And any libraries mentioned have to be in the shared library loader path. LD_LIBRARY_PATH on GNU/Linux, SHLIB_PATH on HPUX, LIBPATH on AIX ... and I don't know the Windows side off hand. Cheers, Brian ---------------------------------------------------------------- What about adding the path to COB_LIBRARY_PATH, OC does the right thing for each platform here, too. human ---------------------------------------------------------------- Subject: ODBC Error Hi, I am using Windows 7 64-bit with OpenCobol binary from Kiska 32-bit and VC++ Express 32-bit. I created an ODBC connection for Oracle database using sysWOW64 ODBCAD32.exe. I precompiled the program with ESQLOC 32-bit. It went OK. Then I compiled it OK. But when I try to run the program, it says "SQL Error message:[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified". Please help. Thanks! ---------------------------------------------------------------- Hi, Oracle has its own Pro*COBOL, and I think it's much better to use this one and not ODBC. So the "ocsql" runtime has never been done for Oracle. It contains some MSSQL and DB2 - specific stuff, and those need to be removed from the code. Of course it's not a big deal to adjust, but "as is" it will not work anyway. I can't check 32-bit version - just don't have 32-bit Oracle client / ODBC drivers... ---------------------------------------------------------------- I have same error for MS ACCESS. Thanks ---------------------------------------------------------------- Subject: Controlling Font Size Is it possible to control font size when printing a report with OpenCobol? ---------------------------------------------------------------- Hello. When the layout before the WRITE (line or page) you must fill in relevant codes (PCL, ESC ...) to get the font, size, color and attributes of your choice (depending of your printer). Regards Rene Aouizerate ---------------------------------------------------------------- As an example. I use the following to change the HP printers to lanscape mode to present a format similar to 11x14 inch paper on 8.5 x 11 in landscape mode for printer reports to an HP printer. [code] 01 HP-SETUP. * Reset Printer 05 filler pic x value X'1B'. 05 filler pic x value 'E'. * Landscape, top margin 1,60 lpp, 8 lines per inch 05 filler pic x value X'1B'. 05 filler pic x(11) value '&l1o1e60f8D'. * Left margin 0, Right margin 132 05 filler pic x value X'1B'. 05 filler pic x(9) value '&a0l132M'. * 13 point font 05 filler pic x value X'1B'. 05 filler pic x(5) value '(s13H'. [/code] Then just write this perform anything else before advancing 1 line. ---------------------------------------------------------------- You didn't say what OS you are using, but sometimes its easier and more flexible to put the escape sequences in the printer driver rather than the report, and just direct the report to a print destination with the appropriate setup. This assumes that you are printing the entire report in a single font. ---------------------------------------------------------------- You can also try installing cups-pdf and get some beauty reports from text files. See http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=961&forum=1#forumpost4713 for a short sample. Cheers, Brian ---------------------------------------------------------------- Subject: XML Syntax Extensions Hi, I currently think about whether I want to process XML with COBOL. With MF COBOL I have the ability to use the XML Syntax Extension. Does anyone know if there are chances that this will be included in the COBOL standard, or whether it will be possible with OC? Regards, Mado ---------------------------------------------------------------- See http://www.cobolstandard.info/j4/files/07-0005.doc from http://www.cobolstandard.info/j4/index.htm for a near final? draft of the XML support expected in the current standards efforts. [i]personal opinion[/i] I'd like to see ORGANIZATION IS XML support in OpenCOBOL someday. It's a big ticket wishlist item though. Another wishy, support for some of the TCP protocols. HTTP and HTTPS being biggies. I do believe OC would need to blaze trail on that one though. I haven't seen many (any?) standards documents that would help make (standard) COBOL IP network aware. Cheers, Brian ---------------------------------------------------------------- Subject: Running OC outside cygwin Is it absolutely required to run OC compiled applications from within cygwin? Is there a collection of DLLs that I can place in the directory with the executable that would allow it to be run from Windows directly? Thanks Bob ---------------------------------------------------------------- No. It isn't necessary at all if you use another environment like MinGW (see wiki, assorted documents) or use a cobc that was compiled with Microsoft C-Compiler (Express versions work, you could take the binaries from http://www.kiska.net/opencobol/1.1/) or Intel C (If you own that compiler and build OC on your own). If you want to use cygwin you'd need to place all the necessary dlls into the same folder. For knowing what dlls that would be create a new folder, copy cygcob-1.dll in that folder and use http://www.dependencywalker.com/ to find out what dlls are missing (open the dll with depends.exe, copy the missing dlls into that folder, recheck with depends.exe and so on). But I think it will need some time and I'm not sure if it would be legaly OK to distribute these dlls. human ---------------------------------------------------------------- Subject: Smithsonian's Cobol history on the web [url=http://americanhistory.si.edu/exhibitions/small_exhibition.cfm?key=1267&exkey=988&pagekey=989]Cobol History[/url] ---------------------------------------------------------------- Is this the mockery? Too bad the museum does not exceed the 70. We hear about it in 10 years OK? ---------------------------------------------------------------- Whats really scary is that I am old enough to have used COBOL61 ---------------------------------------------------------------- [quote] Whats really scary is that I am old enough to have used COBOL61 [/quote] Wow! A real programmer I would say. Was in IBM's or another platform? First time I used Cobol (MS Cobol in MS/DOS 2.x) was 74 in late 86. The only thing I can say to you is: "live long and prosper"... Regards. PS: Yes, I'm a treky! ---------------------------------------------------------------- Univac 1100 series, I don't remember if it was a 1106 or 1108. Operating system was Exec 2. Processing cost 20 to 60 cents (CAD) per cpu second depending on priority. We used about an hour of cpu per month to process 250 invoices per day. Fortunately about a month after I started writing cobol (all the previous code was in Fortran V), they upgraded to cobol 68 and had sector addressable disk files. ---------------------------------------------------------------- My first experience with COBOL was in 1968 with a 4 tape 1401. I was an assembly (Autocoder) programmer and we decided to try COBOL in anticipation of moving to a 360. The compiler generated Autocoder code that then had to be macro assembled. We could not afford the compile time (15 minutes or so for a simple read and list program) so we went back to assembler. By the way, we tried RPG also. It generated SPS code which was a fixed format predecessor to Autocoder. We had the same result. jimc ---------------------------------------------------------------- jgt, don't feel alone ! I knew Cobol61 .... in the 70's, and worked hard on it ! ---------------------------------------------------------------- Subject: COMPILING ocgtk.c ERRORS Hello World of OpenCobol, I'm trying to compile gtkhello & ocgtk. Some errors happened on ocgtk. compiling : [code] soft@fransozich:~/example$ cobc -c `pkg-config --cflags gtk+-2.0` ocgtk.c ocgtk.c: In function ‘CBL_OC_GTK_WINDOW_SET_TITLE’: ocgtk.c:45: error: invalid type argument of ‘->’ (have ‘int’) ocgtk.c:47: error: invalid type argument of ‘->’ (have ‘int’) ocgtk.c: In function ‘CBL_OC_GTK_MENU_ITEM_NEW_WITH_LABEL’: ocgtk.c:124: error: invalid type argument of ‘->’ (have ‘int’) ocgtk.c:126: error: invalid type argument of ‘->’ (have ‘int’) ocgtk.c: In function ‘CBL_OC_GTK_ENTRY_GET_TEXT’: ocgtk.c:197: error: invalid type argument of ‘->’ (have ‘int’) [/code] what's wrong ? My Development Environment is Debian Lenny - gcc version 4.3.2 (Debian 4.3.2-1.1) - Regards Francois ---------------------------------------------------------------- Bear! I'll have to look Francois. I likely coded to a specific version that went stale. I'm all like, robust that way. :) It might be a day or two though. 2am, just getting off work, no end in sight. Cheers, Brian ---------------------------------------------------------------- Yes Brian, old 'good bear' is still alive :-) ! Thank you for quick answer. I'll wait a bit, huge work till X-mas. Regards Francois ---------------------------------------------------------------- Subject: How to tell which mechanism is handling Indexed files. Seasons greetings all, Just a quickie - How do I tell which of the various DB handlers OC is actually using for Indexed files? The reason I ask, is that I can read and write seqeuential files, with no issue. However when I try to create (OPEN OUTPUT or I-O), I get a File Status 35 error (as you'd expect as the file isn't there yet). However, when I try a WRITE, I get a file status 48. I was under the impression that BDB is setup as the default (I compiled db 5.1.19 up before OC, and ldconfig'd after.) I've a pause in a quick test stop of code, but lsof isn't giving any indication, neither is there a pointer [to any file other than the psuedoterm in /proc/(process id)/fd] So... Anyone any ideas as to tell which handler is looking after indexed files? Kind Regards Rob. ---------------------------------------------------------------- Try "cobc -i". ---------------------------------------------------------------- cobc --info would help but it's only implemented in later build (not in the current official pre-release). As you did not show the output of cobc --version I assume you use the 090206 tarball. And as this information is missing, too, I assume you use some native unix. BDB is surely the default (if not changed via configure). You can check this by opening config.log in open-cobol directory and search for LIBCOB_LIBS. I assume you have -ldb for BDB library or something similar in that line. If the first byte of the file status is not 0 there is something wrong and you should not try to do a WRITE. Status 35 normally should neither occur on OPEN OUTPUT nor on OPEN I-O (with SELECT OPTIONAL)! I'd try to use a very simple file name, let's say "MYFILE" in ASSIGN clause to verify that it isn't a problem with your build in general. If you still have problems submit the information mentioned above and a simple code sample you've tried. human ---------------------------------------------------------------- Hi Human, --info isn't implemented on this version. However --version gives: cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Nov 24 2010 00:03:21 Packaged Feb 06 2009 10:30:55 CET It was downloaded from the OC1.1 link on the left hand side of this forum. I'm running OpenSuSE 11.0 on the box. config.log is telling me that I told it where to find BDB, ala : $ ./configure --with-db=/usr/local/BerkeleyDB.5.1 However, there are no other references to 'db' anywhere else in config.log Interestingly, LIBCOB_LIBS='-lm -lgmp -lncurses' says to me that there's no reference to -ldb so I'm not suprised. The thing is, I'm pretty sure that when I compiled it without specifiying --with-db that I was getting error messages similar to various people on here who compile out of the box - when it can't find the version of db. As for the code (excuse the Q+D, let me say I 'cough' wouldn't 'cough' normally write code like this 'cough' - I just wanted to test the indexing...honest...) IDENTIFICATION DIVISION. PROGRAM-ID. testindexfile. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT TestIndex ASSIGN TO "/tmp/NEWINDEX" ORGANIZATION IS INDEXED ACCESS MODE IS DYNAMIC RECORD KEY IS TestInd-KEY FILE STATUS IS TestInd-STAT. DATA DIVISION. FILE SECTION. FD TestIndex. 01 TestDetails. 03 TestInd-KEY. 05 TestInd-Id PIC 9(7). 03 TestInd-Info. 05 TestInd-Blah PIC X(20). 05 TestInd-Stuff PIC XX. WORKING-STORAGE SECTION. 01 TestInd-STAT PIC XX. PROCEDURE DIVISION. Begin. OPEN I-O TestIndex. display "status is " TestInd-STAT. DISPLAY "Enter a load of stuff :". display "(Enter no data to end.)". PERFORM GetDetails. PERFORM UNTIL TestDetails = SPACES display "before write, status is " TestInd-STAT WRITE TestDetails display "and after is " TestInd-STAT PERFORM GetDetails END-PERFORM. CLOSE TestIndex. STOP RUN. GetDetails. DISPLAY "STUFF:". ACCEPT TestDetails. I'm pretty sure that the issue is with OC not being bound with any db, so the best course of action might be to recompile it. Unless anyone can spot any glaring other mistook? Cheers Rob. ---------------------------------------------------------------- I think OC should return a runtime error (file status 35) with the code you've supplied because the OPTIONAL clause is missing in the SELECT body and you did not define a DECLARATIVES. If you change it to OPEN OUTPUT it should work (given that you have access to /tmp/ and that there isn't any file called NEWINDEX there), but I guess this won't work if libcob was linked neither to any ISAM library not BDB. --with-db is standard. ./configure interprets --with-db=something as --with-db=no, this is the reason why the OPEN doesn't work. If OC isn't configured for ISAM access, the runtime should return 91, which will be done in newer versions. I guess your ./configure resulted in something like [quote] ISAM I/O (no handler configured): NO[/quote] and in config.log there is no entry [code]#define WITH_DB 1[/code] For compiling OC with non standard paths one should set CPPFLAGS and LDFLAGS correct. Do so, run make clean and start over again (no need to compile your COBOL programs again as this won't change anything with the compiler). human BTW: Please use code-tags when posting sources (editing your first post would be a good start ; - ). ---------------------------------------------------------------- Ahhhh - that's interesting, I didn't realise that the OPTIONAL clause was required under OC - I thought that OPTIONAL was optional, the same goes with any DECS, I'll have a play with the code. Well... A quick change from I-O to OUTPUT did the trick, thanks for that! Obvious really, and I should have spotted it, but there you go. It's strange that a new file wasn't automagically created, but then I suppose that protects us somewhat from inadvertantly writing to a mis-spelt filename (if someone's been playing with copybooks, or a lookup table) and then blindly going on writing to a totally different file. Rob. ---------------------------------------------------------------- This is just to confirm that if OC is NOT returning "35" for an OPEN I-O without OPTIONAL for a file that is not "avaialble", then that is a bug. ---------------------------------------------------------------- You may want to add a DECLARATIVES with an error procedure for your file. You could put a continue there (for returning to the code without any runtime file error) [this may not be necessary, not 100% sure what the standard says here] and check the status after your OPEN I-O. If the first number is not '0' there was an error. If it's '35' you can either do an OPEN OUTPUT or ask the user if he wants to create the file. human ---------------------------------------------------------------- Subject: OpenCOBOL + GTK/QT Hello to you all. Setting: MSWindows OS 32/64b, OpenCobol 1.1 [06FEB2009 Version] MinGW G. Cutler'Distribution Anyone know what it takes to: 1 - Correctly install GTK + 2 - Compile (most simply) for C and obtain executable file format. "exe". 3 - The same thing with QT That in order to add to OpenCobol plugins. In the meantime, good Christmas (for the new year I expect a bit ...) Regards. Rene Aouizerate ---------------------------------------------------------------- Subject: OpenCOBOL C compiler Hello to you all. Setting: MSWindows OS 32/64b, OpenCOBOL 1.1 [06FEB2009 Version] MinGW G.CutlerDistribution Please forgive my ignorance, my questions may be ridiculous. What is the C compiler used in the OpenCOBOL' distribution above-cited ? Then can I compile with it C programs and obtain executable (. exe)? In the meantime, good Christmas (for the new year I expect a bit ...) Regards. Rene Aouizerate ---------------------------------------------------------------- One should be able to see the compiler invoked using -v but this doesn't work with that package. MinGW mostly uses GCC, this is true here, too. If you call gcc -v from bin directory you see the exact version of the compiler [quote]gcc version 3.4.5 (mingw-vista special r3)[/quote] When you use cobc -x an exe is generated, therefore it surely works with the gcc in that package. human ---------------------------------------------------------------- human. Thank you for your quick response. ---------------------------------------------------------------- Subject: how to install open cobol in windows xp I went to ( wiki - assorted documents - [http://www.mediafire.com/file/v943ibx2p89osdp/OpenCOBOL-1.1-06FEB2009-mingw.zip] ) Extracted the files of that 30mb file! I read the instruction file to install open cobol ! I don't understand the step ----> " Add definitions for the environment variables to the windows registry " :-( please help :-( ---------------------------------------------------------------- Right-click "My Computer", select "Properties" then "Advanced" and finally "Environment Variables" (I'm doing this from memory, but I think that's the sequence for XP). ---------------------------------------------------------------- Exactly. And this is perfectly described in the literature accompanying the package (OpenCobol-1.1-06FEB2009-MinGW-Distribution-README.pdf). This distribution is splendid. THANK YOU Mr. CUTLER. ---------------------------------------------------------------- I have added the variables in the environment variables section of my " My computer " and assigned the value to the respective path of my OpenCOBOL files How to compile the hello world program ? I couldn't find any trace of open cobol been installed in my system ? ? ? Please Help ? ---------------------------------------------------------------- In the x:\OpenCOBOL folder create a sub folder "x:\OpenCOBOL\PG" where you do your tests, by placing the program "helloworld.cob" or "helloworld.cbl" In command line mode (DOS) navigate to that folder (PG). You will be able to start the compilation (COBC) with all its settings and variations. Please refer to accompanying documents. The simplest formula (the one I chose) to compile and obtain an executable (.exe) is the following: cobc -xv hellowold.cob or helloworld.cbl There are so many other parameters associated with "cobc" Everything is in the documentation. ---------------------------------------------------------------- When I type the " cobc -xv helloworld.cob " I get the output in a separate window as an executable file But the dos windows disappears immediately ! Is there any way I can see the output for a long time ? so that I can analyze my output ? ---------------------------------------------------------------- ok. the dos command to keep the dos windows open is : "cmd /k" For this command you can view all parametrers with "cmd /?" Create a shortcut "dos command" on the Windows desktop and make your tests into the associated dos-window. You can also view all parameters for cobc with "cobc -h" regards René Aouizerate ---------------------------------------------------------------- Subject: download opencobol cvs It's been years since I tried. Can someone remind me how I can download the latest CVS version? Thanks, Frank ---------------------------------------------------------------- As far as I know, there is no public repository for the sources (yet). But there is the Feb 2009 pre-release. Left side menu, Download, OpenCOBOL 1.1 pre-release. Then see http://opencobol.add1tocobol.com/#how-do-i-install-opencobol for some details on installing with GNU/Linux. If, by sad twist of fate, you find yourself needing to develop for Windows, Gary Cutler has been doing some awesome work to ease things for people. His efforts are under the Main Menu -> Wiki -> Assorted Documents. http://www.opencobol.org/modules/bwiki/index.php?Assorted%20Documents Cheers, Brian ---------------------------------------------------------------- Hmm, I could swear that in the past there were pre-releases more often that could be downloaded via CVS. Perhaps I am misremembering, and I just got them directly from Roger? I have successfully installed the Feb 2009 pre-release on Mac OS X 10.5. I just thought there would be more recent pre-release versions available. Frank ---------------------------------------------------------------- Subject: OPEN I-O on non-existent file If I open a file for I-O which does not exist, should it be created on the open, or should I get an error? MF returns an error. OC creates the file. I think MF is right as far as standards are concerned here. What do you think? ---------------------------------------------------------------- With MFCOBOL and OpenCOBOL When I want to open a file (organization indexed / access dynamic) which does not exist I have: File Status = 35 Message "Attempt to access a file with incorrect permission" I think it's normal ... Please give us more détail about your test. Regards René Aouizerate ---------------------------------------------------------------- You can have also the message : "An OPEN statement with the I-O INPUT, or EXTEND phrases has been attempted on a non-OPTIONAL file that is not present" It's also normal ---------------------------------------------------------------- I think it is a bug, at least for Berkeley DB indexed files what we use. See fileio.c in libcob (1.0 as wel as 1.1). See line 1944. <snippet> case COB_OPEN_OUTPUT: #ifdef USE_DB41 flags |= DB_CREATE; #else flags |= O_RDWR | O_CREAT | O_TRUNC; #endif break; case COB_OPEN_I_O: case COB_OPEN_EXTEND: #ifdef USE_DB41 flags |= DB_CREATE; #else flags |= O_RDWR | O_CREAT; #endif break; </snippet> I think the "break;" is missing. Therefore it falls to COB_OPEN_EXTEND and gets the DBCREATE flag. ---------------------------------------------------------------- Yeah maybe a bug, but it sure looks like design intent... Cheers, Brian ---------------------------------------------------------------- The first thing to clear up is if the OPTIONAL clause was used in the SELECT statement. If yes, the file should be created, if not a file error 35 should occur. If you look down in the C code there should be something like [code](mode == COB_OPEN_OUTPUT || f->flag_optional == 1)[/code] if the file was not found. human ---------------------------------------------------------------- No OPTIONAL was declared within the SELECT. ---------------------------------------------------------------- Just before getting deeper to this (again, as I've sent some patches for fileio.c to Roger): What environment do you use to reproduce that mistake? I assume an unpachted (at least compiler and fileio.c) tarball with a package date Feb-09 on some standard linux environment with use of BDB 4.x. Is this correct? Can you please post your sample program for easier checks without the need to code those 10-100 lines? human ---------------------------------------------------------------- Sure... [code] identification division. program-id. testopio. environment division. configuration section. special-names. decimal-point is comma. input-output section. file-control. select tst assign to tst-path organization is indexed access mode is dynamic record key is tst-key file status is tst-status. data division. file section. fd tst. 01 tst-rec. 03 tst-key. 05 tst-seqno pic 9(7). 03 tst-type pic x. 03 tst-area pic x(65). working-storage section. 01 file-path-info. 03 tst-path pic x(256). 03 tst-status pic 99. procedure division. main section. main-00. move "testfile.db" to tst-path. open i-o tst. if tst-status not = 0 display " Error opening file: " tst-status stop run end-if. close tst. stop run. [/code] We do work in a patched environment but I don't think fileio.c has been changed around there. I will test the above testprogram on a clean install asap (OpenSuSE 11.3 32bits) ---------------------------------------------------------------- Maybe the compiler got broken in your patches. I've tested this with the MinGW build available in wiki->assorted documents and in some Suse environment, both result in the expected [quote] Error opening file: 35 [/quote] and no file created (no matter if DB_HOME is set, which changes the BDB behaviour). human ---------------------------------------------------------------- 2 options select OPTIONAL or open OUTPUT close open i-o ---------------------------------------------------------------- Subject: Table Size Hi I'm running OpenCOBOL 1.1.0 (Built Sep 10 2010 10:12:33) on Windows 7 64bit. Playing with Tables, and especially the Sort and Search verbs, I was able to define a simple table containing 15 million entries, populate it and sort it. The speed was pretty impressive, btw. If I try a greater number, things go strange, end in failure to compile, or to execute. I just wondered if there was a limitation to the array size or the number of entries in the array (the combination of both would count, of course). I get this compiler error if I try a table that's too big:- In file included from C:\Users\NeilHome\AppData\Local\Temp\cob7C4.c:20: C:\Users\NeilHome\AppData\Local\Temp\cob7C4.c.h:27: error: size of array `b_5' is negative But as I'm approaching the max, the program compiles, but fails to execute either silently, or with a windows error. Just wondered - I know that a 15 million table entry is pushing things a bit, but who knows when such a thing might be useful? ---------------------------------------------------------------- No warnings wit -Wall on compile time and with -debug on run time? Please submit a compile time error sample (in code tags) for beeing able to check if that problem exists with newer versions, too. BTW: The important time from cobc --version is the "Package Date" human ---------------------------------------------------------------- OK - I'm away from w/s but do this as soon as I get back. ---------------------------------------------------------------- Subject: Rave post; Falcon and well, C++ UPDATE This is really from the bottom of the post...but the Falcon programming language embeds in OpenCOBOL crack dandy. with [b]falconscript.fal[/b][code] > "Falcon list comprehension called from OpenCOBOL" sums = [].mfcomp( {x,y=> x+y}, .[1 2 3], .[4 5 6] ) return sums.describe() [/code] it goes[code] [btiffin@home falcon]$ ./callfalcon argv[1]: falconscript.fal Falcon list comprehension called from OpenCOBOL VM Output: [ 5, 6, 7, 6, 7, 8, 7, 8, 9] Intermediate: [ 5, 6, 7, 6, 7, 8, 7, 8, 9] Falcon says: [ 5, 6, 7, 6, 7, 8, 7, 8, 9] [/code] Back to the original posting from a few minutes ago... This is kinda working... [code] [btiffin@home falcon]$ g++ $(falcon-conf --cflags-only-I) $(falcon-conf -L) ocfalcon.cpp -c [btiffin@home falcon]$ cobc -x callfalcon.cob ocfalcon.o $(falcon-conf --libs-only-l) -lstdc++ [btiffin@home falcon]$ ./callfalcon IoError LD0202: File not found (falconscript.fal in path .;.;/usr/local/lib/falcon) [/code] THAT is wicked cool for a first try...kinda...I had to cheat on C++ link name, but that's surmountable... From [code] /* MODIFIED BY btiffin to interface with OpenCOBOL FALCON - The Falcon Programming Language. FILE: falcon_embed_3.cpp Embedding samples Adding VM interaction - input parameters and output result VM can give the embedder program access to exported symbols. The items inside the VM can be inspected and changed. The core module exports three symbols that every kind embedder should fill: the scriptName, scriptPath and args global variables. When a script returns from a routine, or from the main code, the return value is left in the A register of the VM. This script will transform that item in a string and will report it as output. Compile with g++ $(falcon-conf --cflags-only-I) $(falcon-conf -L) \ falcon_embed_3.cpp -o falcon_embed_3 ------------------------------------------------------------------- Author: Giancarlo Niccolai Begin: 2007-08-11 19:49:00 ------------------------------------------------------------------- (C) Copyright 2004: the FALCON developers (see list in AUTHORS file) See LICENSE file for licensing details. */ // Inclusion of the Falcon Engine #include <falcon/engine.h> #include <iostream> class AppFalcon { public: AppFalcon(); ~AppFalcon(); const char* embed( const char *script_name, int argc, char **argv ); }; AppFalcon::AppFalcon() { Falcon::Engine::Init(); } AppFalcon::~AppFalcon() { Falcon::Engine::Shutdown(); } // This is the routine that embeds falcon const char* AppFalcon::embed( const char *script_name, int argc, char **argv ) { // first of all, we need a module loader to load the script. // The parameter is the search path for where to search our module Falcon::ModuleLoader theLoader("."); // As we want to use standard Falcon installation, // tell the loader that is safe to search module in system path theLoader.addFalconPath(); // Allow the script to load iteratively other resources it may need. Falcon::Runtime rt( &theLoader ); rt.loadFile( script_name ); // We are ready to go. Let's create our VM and link in minimal stuff Falcon::VMachineWrapper vm; vm->link( Falcon::core_module_init() ); // add the core module // try to link our module and its dependencies. // -- It may fail if there are some undefined symbols vm->link( &rt ); // Now that we have linked everything, we can set the script name, // the script path and the arguments. Falcon::Item *scriptName = vm->findGlobalItem( "scriptName" ); Falcon::Item *scriptPath = vm->findGlobalItem( "scriptPath" ); Falcon::Item *args = vm->findGlobalItem( "args" ); // get the topmost (and so, the main) module, just to set the correct name. const Falcon::Module *mainMod = vm->mainModule()->module(); //items can directly be set to Core and Garbage object pointers. *scriptName = new Falcon::CoreString( mainMod->name() ); *scriptPath = new Falcon::CoreString( script_name ); // create the arguments. // It is correct to pass an empty array if we haven't any argument to pass. Falcon::CoreArray *argsArray = new Falcon::CoreArray; for( int i = 0; i < argc; i ++ ) { argsArray->append( new Falcon::CoreString( argv[i] ) ); } *args = argsArray; // end of parameters // we're ready to go. Still, we may fail if the script has not a main routine. vm->launch(); // We should have now an output value. It is advisable to turn it // in a string before to show it. Falcon::String str_regA; vm->regA().toString( str_regA ); // Falcon provides a nice helper to convert falcon strings into char * or wchar_t Falcon::AutoCString c_regA( str_regA ); std::cout << "VM Output: " << c_regA.c_str() << std::endl; return c_regA.c_str(); } const char* CBL_OC_FALCON( int argc, char *argv[] ) { //==================================================== // Falcon engine initialization. AppFalcon myApp; char *script_name; if ( argc < 2 ) { std::cout << "Please, provide a script name" << std::endl; return NULL; } script_name = argv[1]; // now we also pass the arguments. try { return myApp.embed( script_name, argc - 2, argv + 2 ); } catch( Falcon::Error* err ) { // This time let's use a Falcon stream, // that knows how to handle Falcon strings. Falcon::Stream* stdErr = new Falcon::StdErrStream(); stdErr->writeString( err->toString() ); err->decref(); delete stdErr; } } [/code] and [code] OCOBOL*>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20101231 *> Purpose: Try embedding Falcon *> Tectonics: cobc -x callfalcon.cob ocfalcon.o *> $(falcon-conf --libs-only-l) -lstdc++ *> *************************************************************** identification division. program-id. callfalcon. data division. working-storage section. 01 argc usage binary-long value 2. 01 argv. 03 pointers usage pointer occurs 2 times. 01 mock. 03 strings pic x(80) occurs 2 times. 01 result usage pointer. *> *************************************************************** procedure division. move "callfalcon" & x"00" to strings(1) move "falconscript.fal" &x"00" to strings(2) set pointers(1) to address of strings(1) set pointers(2) to address of strings(2) *call "CBL_OC_FALCON" returning result end-call call "_Z13CBL_OC_FALCONiPPc" using by value argc by reference argv returning result end-call goback. end program callfalcon. [/code] So OpenCOBOL is getting into the Falcon interpreter. More in a bit. Excited once again, so I posted early in the exploration... Changed the interface a little, as I got in over my head with the way it should be using RETURNING. Now [b]callfalcon.cob[/b][code] OCOBOL*>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: *> Purpose: *> Tectonics: cobc -x callfalcon.cob ocfalcon.o *> $(falcon-conf --libs-only-l) -lstdc++ *> *************************************************************** identification division. program-id. callfalcon. data division. working-storage section. 01 argc usage binary-long value 2. 01 argv. 03 pointers usage pointer occurs 2 times. 01 mock. 03 strings pic x(80) occurs 2 times. 01 stat usage binary-long. 01 result pic x(80). 01 resmax usage binary-long value 80. 01 display-string pic x(80). *> *************************************************************** procedure division. *> Setup an argc, argv thingy move "callfalcon" & x"00" to strings(1) move "falconscript.fal" &x"00" to strings(2) set pointers(1) to address of strings(1) set pointers(2) to address of strings(2) call "CBL_OC_FALCON" using by value argc by reference argv by reference result by value resmax returning stat end-call string result delimited by low-value into display-string end-string display "Falcon says: " display-string end-display goback. end program callfalcon. [/code] and, [i]with EXTERN "C" to get C++ to play nice with the nameing[/i] [code] /* MODIFIED BY btiffin to interface with OpenCOBOL FALCON - The Falcon Programming Language. FILE: falcon_embed_3.cpp Embedding samples Adding VM interaction - input parameters and output result VM can give the embedder program access to exported symbols. The items inside the VM can be inspected and changed. The core module exports three symbols that every kind embedder should fill: the scriptName, scriptPath and args global variables. When a script returns from a routine, or from the main code, the return value is left in the A register of the VM. This script will transform that item in a string and will report it as output. Compile with g++ $(falcon-conf --cflags-only-I) $(falcon-conf -L) \ falcon_embed_3.cpp -o falcon_embed_3 ------------------------------------------------------------------- Author: Giancarlo Niccolai Begin: 2007-08-11 19:49:00 ------------------------------------------------------------------- (C) Copyright 2004: the FALCON developers (see list in AUTHORS file) See LICENSE file for licensing details. */ // Inclusion of the Falcon Engine #include <falcon/engine.h> #include <iostream> #include <string.h> class AppFalcon { public: AppFalcon(); ~AppFalcon(); const char* embed( const char *script_name, int argc, char **argv ); }; AppFalcon::AppFalcon() { Falcon::Engine::Init(); } AppFalcon::~AppFalcon() { Falcon::Engine::Shutdown(); } // This is the routine that embeds falcon const char* AppFalcon::embed( const char *script_name, int argc, char **argv ) { // first of all, we need a module loader to load the script. // The parameter is the search path for where to search our module Falcon::ModuleLoader theLoader("."); // As we want to use standard Falcon installation, // tell the loader that is safe to search module in system path theLoader.addFalconPath(); // Allow the script to load iteratively other resources it may need. Falcon::Runtime rt( &theLoader ); rt.loadFile( script_name ); // We are ready to go. Let's create our VM and link in minimal stuff Falcon::VMachineWrapper vm; vm->link( Falcon::core_module_init() ); // add the core module // try to link our module and its dependencies. // -- It may fail if there are some undefined symbols vm->link( &rt ); // Now that we have linked everything, we can set the script name, // the script path and the arguments. Falcon::Item *scriptName = vm->findGlobalItem( "scriptName" ); Falcon::Item *scriptPath = vm->findGlobalItem( "scriptPath" ); Falcon::Item *args = vm->findGlobalItem( "args" ); // get the topmost (and so, the main) module, just to set the correct name. const Falcon::Module *mainMod = vm->mainModule()->module(); //items can directly be set to Core and Garbage object pointers. *scriptName = new Falcon::CoreString( mainMod->name() ); *scriptPath = new Falcon::CoreString( script_name ); // create the arguments. // It is correct to pass an empty array if we haven't any argument to pass. Falcon::CoreArray *argsArray = new Falcon::CoreArray; for( int i = 0; i < argc; i ++ ) { argsArray->append( new Falcon::CoreString( argv[i] ) ); } *args = argsArray; // end of parameters // we're ready to go. Still, we may fail if the script has not a main routine. vm->launch(); // We should have now an output value. It is advisable to turn it // in a string before to show it. Falcon::String str_regA; vm->regA().toString( str_regA ); // Falcon provides a nice helper to convert falcon strings into char * or wchar_t Falcon::AutoCString c_regA( str_regA ); std::cout << "VM Output: " << c_regA.c_str() << std::endl; return c_regA.c_str(); } extern "C" { int CBL_OC_FALCON(int argc, char* argv[], char* result, int resmax) { //==================================================== // Falcon engine initialization. AppFalcon myApp; char *script_name; const char *intermediate; if ( argc < 2 ) { std::cout << "Please, provide a script name" << std::endl; return 0; } script_name = argv[1]; std::cout << "argv[1]: " << script_name << std::endl; // now we also pass the arguments. try { intermediate = myApp.embed( script_name, argc - 2, argv + 2 ); std::cout << "Intermediate: " << intermediate << std::endl; memcpy(result, intermediate, resmax); return 0; } catch( Falcon::Error* err ) { // This time let's use a Falcon stream, // that knows how to handle Falcon strings. Falcon::Stream* stdErr = new Falcon::StdErrStream(); stdErr->writeString( err->toString() ); err->decref(); delete stdErr; return 0; } } } [/code]and [b]falconscript.fal[/b][code] > "Falcon called from OpenCOBOL" return "42" [/code] gives [code] [btiffin@home falcon]$ g++ $(falcon-conf --cflags-only-I) $(falcon-conf -L) ocfalcon.cpp -c [btiffin@home falcon]$ cobc -x callfalcon.cob ocfalcon.o $(falcon-conf --libs-only-l) -lstdc++ [btiffin@home falcon]$ ./callfalcon argv[1]: falconscript.fal Falcon called from OpenCOBOL VM Output: 42 Intermediate: 42 Falcon says: 42 [/code] with [b]falconscript.fal[/b][code] > "Falcon list comprehension called from OpenCOBOL" sums = [].mfcomp( {x,y=> x+y}, .[1 2 3], .[4 5 6] ) return sums.describe() [/code] it goes[code] [btiffin@home falcon]$ ./callfalcon argv[1]: falconscript.fal Falcon list comprehension called from OpenCOBOL VM Output: [ 5, 6, 7, 6, 7, 8, 7, 8, 9] Intermediate: [ 5, 6, 7, 6, 7, 8, 7, 8, 9] Falcon says: [ 5, 6, 7, 6, 7, 8, 7, 8, 9] [/code] This worked fairly well. And Falcon is pretty cool in it's coolness. http://www.falconpl.org/ Cheers, Brian ---------------------------------------------------------------- Subject: COBOL Exception Condition handling I've just started looking OC again after not looking at it for a while. I'm happy to see that OC now makes some use of exception conditions. For example: [code] compute first-days = function integer-of-date(first-date) if function exception-status <> SPACE display "invalid date: " first-date stop run. display first-days [/code] If the value "first-date" is not an number that can be converted to a valid date then intrinsic function EXCEPTION-STATUS returns the string "EC-ARGUMENT-FUNCTION". So if I had set first-date to 20101313 the above would display:[code]invalid date: 20101313[/code] If I set first-date to 20101212 the above would display:[code]+0000149730[/code] All pretty cool. But what if you don't check EXCEPTION-STATUS after invoking any routine that might raise an exception condition? Currently it appears that unless it's an EC-I-O condition it will just silently continue on, most likely having done something "undefined". In the above case it appears that FUNCTION INTEGER-OF-DATE will return 0 if there is an EC-ARGUMENT-FUNCTION exception. Anyway! Obviously(?) OC needs to implement the >>TURN directive to better handle exception conditions. Also desirable would be the USE AFTER EXCEPTION CONDITION statement within DECLARATIVES. I was thinking of trying my hand at implementing this. (Assuming it's not already been worked on...?) I've had the ISO/IEC 1989:2002 COBOL standard for years, and I currently use the 1989:20XX draft dated 2010-07-01. In all this time I've only recently come to understand (I think!) how exception condition handling is supposed to work according to the standard. But I'd like some validation before I even start trying to figure out how to make OC support it. So let's expand on the above. According to the standard, there is an implied [code]>>TURN EC-ALL CHECKING OFF[/code] at the beginning of any compile unit. When checking is off for a particular exception it appears (I think!) that, as with OC currently, when that exception is raised the run-time is to simply continue with the next statement. As I said above, if there is an EC-I-O exception then OC will, if no FILE STATUS was specified in the SELECT and there is no applicable USE AFTER STANDARD ERROR declarative statement then OC will invoke implicit error handling and end the run unit with an appropriate error message. So my first assumption is that if exception condition checking is turned on, ie: [code]>>TURN EC-ALL CHECKING ON WITH LOCATION[/code] then OC would want to also terminate the run unit with an appropriate error message. Does the above sound true so far? If so, then lets continue... Let's say that we want, in general, to have implicit handling of all conditions (EC-ALL, via the TURN ON above), but in one particular case we wish to programatically "catch" the exception. Essentially like the original example, only this time we surround it with TURN OFF and TURN ON so that it is obvious we don't want this condition implicitly handled. So could have: [code] >>TURN EC-ARGUMENT-FUNCTION CHECKING OFF compute first-days = function integer-of-date(first-date) >>TURN EC-ARGUMENT-FUNCTION CHECKING ON WITH LOCATION if function exception-status <> SPACE display "invalid date: " first-date stop run. display first-days compute second-days = function integer-of-date(second-date) display second-date [/code] Note I added a second compute for a different data item, not surrounded by TURN OFF and TURN ON. So if first-date was invalid we'd do what we did originally, which is display "invalid date: " followed by the bad field, followed by termination of the run unit. But if first-date was valid and second-date was not the OC would not continue to "display second-date" but rather would terminate the run unit with (I assume!) an appropriate error message. I'm going to stop here just in case I'm already on the wrong track. In the future I will want to discuss USE AFTER EXCEPTION CONDITION declarative processing. Thanks for any input! Frank ---------------------------------------------------------------- Frank; good topic. More soon I hope, but for now, a little-bit off-thread; See http://svn.wp0.org/ocdocs/brian/errorproc.cob for a sample for error procedures. off-thread because; setting an exception to exist is not an error from the point of view of CBL_ERROR_PROC. Only adding to the thread as error handlers can [i]save face[/i] sometimes. [i]another side-note:[/i] Looking at an alpha of the next round of compiler sources (and I do mean alpha, the copy I have ... I revert back to Feb2009 vintage for a lot of the more delicate systems interfacing. I find the public pre-rel to be reliable, robust and really, really good at a lot of things; usually read upcoming sources to compare, but anyway). USE FOR DEBUGGING declaratives look sweeet! Cheers, Brian ---------------------------------------------------------------- Interesting. I know nothing about CBL_ERROR_PROC. Appears to be a MicroFocus extension. I'm a mainframe Coboler, but I imagine that IBM Language Environment might have something similar. That being said, I prefer "pure, idiomatic COBOL" whenever possible. Thus my desire to implement exception handling within the language itself. Thanks for the interest! The OC version I have is from Feb 06 2009, which is the most recent I can find. Where do you find more recent versions? Frank ---------------------------------------------------------------- Access to more recent versions is only granted by Roger itself, as there is no public pre-release. Newer sources SHOULD NOT be sent out and I personally don't think one should use binaries from them (only for testing purposes). As Roger (and others) changed a lot in the sources I'd personally not advise anybody to do too much patching for OC 1.1 pre-release if not really necessary. I personally THINK that public pre-releases of 2.0 will be available before end of Feb 2011. But the stuff you're talking about sounds good. I'll have a look at this when I find some time. human ---------------------------------------------------------------- Just put this into some source to see the output. Feb 09 (with wrong line numbers for these warnings), [quote]Warning: Invalid directive - ignored[/quote] Dec 10 (unofficial alpha version) [quote]Warning: Ignoring invalid directive - '>>TURN'[/quote] I hope that Roger can put this into the parser for 2.0, at least with "not implemented". human ---------------------------------------------------------------- Roger, General comment on exceptions (per the Standard) A) If exception checking is turned on for a specific exception, the exception occurs, BUT there is no declarative for that exception, then the "next" action depends on whether the exception is makred FATAL or NON-FATAL in "Table 14 — Exception-names and exception conditions (Continued)". If it is NF, then execution continues (even with c hecking turned on) B) If checking is NOT turned on for an exception and it occurs (and there is no specific ON SIZE, ON EXCEPTION, INVALID KEY, etc) phrase, then resutls are (usually) unpredictable. Execution MAY continue or may not, receiving items may or may not be impacted, etc. This is SIMIALR to what has happened for years with I-O errors if there is no declarative or file-status checking and an I-O error occurs. (Cf, because I know you know this environment, IBM mainframe VSAM file handling with no file status or declarative coded) NOTE WELL: OC allowing the checking of the intrinsic functions, EXCEPTIOON-STATEMENT and EXCEPTION-STATUS "in-line" (where the exception would occur) is an EXTENSION. The Standard only allows these to be checked in declaratives -as I recall ---------------------------------------------------------------- Hey Bill, Just when I thought I understood how it works I once again no longer have any idea. The current draft of the upcoming standard has the following example: [code] >>TURN EC-ARGUMENT CHECKING ON COMPUTE day-difference = FUNCTION INTEGER-OF-DATE (first-date) - FUNCTION INTEGER-OF-DATE (second-date) IF FUNCTION EXCEPTION-STATUS = "EC-ARGUMENT" ... *> here one would attempt to figure out what was wrong. [/code] Somehow I ran in the wrong direction while interpreting it. So I'm fairly certain that much, if not all, of my examples were not correct. Frustrating. I had thought that it would be possible to have a way of doing optional "inline" handling of all exceptions. Like the way other languages have try/catch blocks. But now it appears(?) that this only works for non-fatal exceptions, like the above? In the above would it be true to say that if checking were turned off then EXCEPTION-STATUS would always be blank? Gosh this is perplexing. Does the standards committee have any documents describing in more detail how exception condition handling should work in practice? Frank ---------------------------------------------------------------- It is certainly true tht if exception checking is turned off for a specific exception type and that exception situation occurs, that exception status will be spaces (unlee, of couse, some other exception has also occurred). As far as "inline checking" goes, I have sent a note to a Standards group as I *think* the example cited is in error. It was my understanding (memory) that the EXCEPTION-xxxx intrinsic function could only be check within a DECLARATIVE. Therew was MUCH "debate" about this (and I was one who thought this was/is wrong), but it was my memory that this were true. I may (or may not) get a reply to this. Of COURSE, any implementation may have an extension (and I think OC does) that allows these to checked "inline". For those interested in another approach in COBOL, you may want to see how Micro Focus has introduced TRY .. CATCH ... FINALLY ... END-TRY syntax. I certainly wouldn't think that this would be a bad extension for OC to consider. It's long (and I am not positive it will work) but I think this is a URL to let you see that syntax. [url=http://documentation.microfocus.com/help/topic/GUID.644D9B68.2EB3.48B6.BB87.11B7D96ADE57/HRLHLHPDFC0H.html]http://documentation.microfocus.com/help/topic/GUID.644D9B68.2EB3.48B6.BB87.11B7D96ADE57/HRLHLHPDFC0H.html[/url] ---------------------------------------------------------------- Subject: Of cursors and ncurses Hey folks. I have been looking at things and have run into a problem. I need to find the current cursor position. NOT position the cursor but find out where it is at. I've poured over the forum, FAQ, and programmers manual. I can't seem to figure out how to do that. Now I was looking at the ncurses site and there seems to be an intrinsic function getyx() that is supposed to return the yx co-ordinates of the cursor in the arguments passed to it. My question is can I call this intrinsic ncurses function and if so, how? Thanks for bearing with me. Cheers! ---------------------------------------------------------------- Damon, [i]this blurb is directed to everyone...[/i] If you are in a screen section, then you are golden ... kinda. The ncurses call would be [code] CALL "getyx" USING by value stdscr by reference int-y by reference int-x END-CALL [/code] and that would work with ANY cobc that has curses support without any change to normal compiles (no -l or other options required, the library is already included). But life is not always that easy. ;-) getyx return type is VOID. No good until the OpenCOBOL pre-release that supports RETURNING NULL is shipped. Plus, getting at stdscr is curses.h C land as well, so... A small snippet of C will do: [i]Umm, assuming you know that your system already supports curses...[/i] [b]CBL_OC_GETYX.c[/b] [code] #include <curses.h> int CBL_OC_GETYX(int *y, int *x) { getyx(stdscr, y, x); return 0; } [/code] and [code] 01 int-y usage binary-long 01 int-x usage binary-long 01 result usage binary-long CALL "CBL_OC_GETYX" USING BY REFERENCE int-y BY REFERENCE int-x RETURNING result END-CALL [/code] Now you have to modify your tectonics to mention CBL_OC_GETYX.c (or .o if you pre-compile it. cobc is smart that way and will do the right thing), ala: [code] $ cobc -x myprogram.cob CBL_OC_GETYX.c [/code] [i]rants and warnings:[/i] That mini-function Won't work if a SCREEN SECTION hasn't been started, as this assumes the [b]initscr[/b] function has already been called. You could put in some fencing; check stdscr for null, and set y (line) and x (column) to zero or garbage and return 1 if you want to go all 'professional' [i]which is a good and proper thing if you are writing code for others to use, and not just a how-to or for one-off personal use.[/i] As a matter of fact, I haven't even bothered with the new code human pointed out to make Windows linkage work. [i]Apologies to those that may care.[/i] I don't normally go out of my way to make things easy for Windows people. I figure that is strictly a 'for money' world, and developers in that domain should be getting paid, and, by definition, already 'professional'. My view of life may not always be appropriate, but it is what it is. :-) [b]Note about the y,x arguments:[/b] on all the systems I've checked with man pages, getyx is a macro. And the y and x arguments would usually be passed by address-of (with & in C or declared *) to allow writing the integers in the function. The macro takes care of the referencing... (I don't personally care for that kinda voodoo, but it is what it is). I never tried any of the above code by the way... he said, covering arse. If you don't have a SCREEN SECTION (which in 1.1 is as simple as saying DISPLAY AT) then we can talk about the wonky way of getting the data from ANSI terminal control codes and a CSI 6n (Device Status Report), but man, ... what an interface. The data is returned as if someone typed it at the keyboard...so you really, really have to know what is going on with SYSIN, SYSOUT, KEYBOARD and DISPLAY assigns (or play with the CBL_READ_FILE stream operator). Hopefully not needed, but we can discuss this possibility if it is. Cheers, Brian ---------------------------------------------------------------- Thanks btiffin! The first example works. I really appreciate the input. My assumption is that any of the ncurses intrinsic functions should then work. The current version I tried this on: [code] cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Sep 10 2010 10:12:33 Packaged Feb 06 2009 10:30:55 CET [/code] So this is something for me to play with and document for future users. I do love the power of OpenCOBOL. The next thing to work on is other hardware information such as registers. :D Why? I dunno... because we should be able to? Cheers DamonH ---------------------------------------------------------------- Damon; Just to clarify... you tried the easy CALL "getyx" USING or the C code version? Careful, if the CALL ... void returns are bad for now. It'll chew up your return stack. It'll be fixed with RETURNING NULL (and I believe compiler patches have been posted by people that needed the support now versus later). I find it easier/safer/warmer/fuzzier to thin-wrap a snippet of C that plops an int on the return stack for cobc's current CALL mechanism. Cheers, Brian ---------------------------------------------------------------- on the registers... [i]our good Bill might think this is thread drift...but perhaps it should be buried, not to see much light[/i] Umm, we should be able to, and we can, but do we really want to? ;-) It's fairly specific... Here's one way of playing assembler that works for my Fedora and gcc system...but I'll bet that it will detour for just about anyone that tries it at home... [b]registers.c[/b] [code] int add(int x) { int a = 42; __asm__("addl %%ebx,%%eax" :"=a"(x) :"a"(a), "b"(x) ); return x; } [/code] and [b]registeraccess.cob[/b] [code]OCOBOL*>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20110104 *> Purpose: Assembler access *> Tectonics: cobc -x registeraccess.cob registers.c *> *************************************************************** identification division. program-id. registeraccess. data division. working-storage section. 01 x usage binary-long value 84. 01 thesum usage binary-long value 0. *> *************************************************************** procedure division. call "add" using by value x returning thesum end-call display thesum end-display goback. end program registeraccess. [/code] tectonics: [code] [btiffin@home cobol]$ cobc -x registeraccess.cob registers.c [btiffin@home cobol]$ ./registeraccess +0000000126 [/code] And there you have 42 and 84 addl'ed through registers. But, again...assembler is so, umm, seat specific. On the third hand though, once you wrote a layer of in/outs you could take on getting OpenCOBOLCam device drivers written in near pure COBOL :-) That might be cool to see. Cheers, Brian ---------------------------------------------------------------- ACCEPT xxx FROM LINES. ACCEPT yyy FROM COLUMNS. Roger ---------------------------------------------------------------- What about CURSOR [IS] in SPECIAL NAMES? See http://supportline.microfocus.com/documentation/books/nx60/lhpdf205.htm (not tried with OC yet) human ---------------------------------------------------------------- Generally here - Mostly things here are "supposed" to be "compatible" to xyz. What "compatible" and "xyz" actually mean is something else. What about it :-) How about a patch :-). (Note - Human is a major testing contributor!) Roger ---------------------------------------------------------------- I appreciate all the input. I am in the process of working solutions with all the information gathered. ---------------------------------------------------------------- Subject: Social: We missed OpenCOBOL 1.0's 3rd birthday. It was Dec 27th. Happy belated birthday to 1.0 and to Roger, Keisuke; Thanks. Cheers, Brian ---------------------------------------------------------------- Oh, I've missed that, too. Happy birthday and a big THANK YOU! human ---------------------------------------------------------------- Subject: UNICODE confusion Dear OC community, After several days of testing with OC 1.1 while using unicode ISO 8859-2 encoding I'm totally confused. A deep search of all post did not reveal similar thread so I decided to post a question. This problem applies to several different linux distributions (open suse, Ubuntu, FC). ..... DISPLAY "ŠĐŽČĆ šđžčć". ..... displays correctly while ..... DISPLAY "ŠĐŽČĆ šđžčć" LINE xx COLUMN yy. ..... displays garbage on screen. ?!?!?!? Sames apply on accept command when input ISO 8859-2 special characters are used. ...... ACCEPT var LINE xx COLUMN yy WITH PROMPT. ...... display garbage on screen during input. But to make more confusion ...... DISPLAY var LINE xx COLUMN yy. (the same variable inputed using the upper ACCEPT command using ISO-8859-2 characters) ...... showed perfectly on screen. ?!?!?! That's mean that the field inputed using ISO 8859-2 characters can not be displayed during ACCEPT command but written in the base correctly. I'm in the preparation to convert my RM Cobol application to OPEN COBOL but without ISO 8859-2 support I will not be able to finalize it. Till now I was using CP852 but I want to migrate to UNICODE standard. Is there a way to resolve it? Or is there some additional setting that I miss on my linux system? Thank you in advance. ---------------------------------------------------------------- Yep, seems like confusion... 1. "Real" Unicode means every character needs than one byte per character. I guess you use PIC X (for alphanumeric) in your programs. These use only one byte and therefore it's not possible to save Unicode data there. COBOL has PIC N (for national), being able to save Unicode characters. If you want to change this you likely have to change most of your programs (national items cannot be used in every case like alphanumeric items). You may want to have a look at the current draft of the COBOL standard http://www.cobolstandard.info/j4/files/std.zip for a deeper understanding of this topic. Be aware that OC 1.1 has no (full?) support for national characters. OC 2.0 will have a lot of adjustments here (I didn't test it as I don't use it and this is a real large testing bed). Good news: You should be able to use "normal" PIC X items together with codepage settings etc. to save these items you've mentioned. 2. DISPLAY/ACCEPT is done in two VERY different ways in OpenCOBOL. If you don't have screen clauses (like LINE/COL/BLINK/...) or SCREENs the "normal" console I/O is used. From the first SCREEN or screen clause on, the screen I/O is done via curses. I guess you need to tell curses to use the right setting to display these chars correct. Maybe some other users can help you with this topic. human ---------------------------------------------------------------- Ok, I got this from a post from someone called Bear. I'll bet that Bear might be from France. ;-) It has to do with _XOPEN_SOURCE_EXTENDED, the wide versions of ncurses headers and libraries, and calling [b]setlocale[/b] before initscr. You need to hack libcob/screenio.c (around line 1110) to look like [code] ... #define _XOPEN_SOURCE_EXTENDED #ifdef HAVE_NCURSES_H #include <ncursesw/ncurses.h> #define COB_GEN_SCREENIO #elif defined(HAVE_NCURSES_NCURSES_H) #include <ncursesw/ncurses.h> #define COB_GEN_SCREENIO #elif defined(HAVE_PDCURSES_H) #include <pdcurses.h> #define COB_GEN_SCREENIO #elif defined(HAVE_CURSES_H) #include <curses.h> #define COB_GEN_SCREENIO #endif ... [/code] then rebuild and reinstall cobc. With a [b]make check[/b] in the middle... [i](I didn't know which logical was actually defined in my run of ./configure when I was in editting, so I changed both ncurses.h includes to the wide version. Either way, on my system, that will compile and not break).[/i] Your mileage may require more detours. One of the steps requires including a call to setlocale at the top of your main to ensure your current process environment is unicode locale friendly. C program space usually defaults to locale "C", which is not what you want I hear. By asking for LC_ALL and "", it causes the program space to pick up your shell environment locale settings. (I didn't try without the CALL, as the setlocale may already be in a normal cobc run, but I was monkeying instructions from a usenet post, and haven't whittled down which of the nine steps may be redundant.) Then it gets a little more [i]manual[/i]... Using [code] OCOBOL >>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20110104 *> Purpose: HACK unicode in screen section *> Tectonics: cobc -v -x unicode.cob *> cobc -C unicode.cob *> cut-n-paste-n-hack the two gcc commands *> *************************************************************** identification division. program-id. unicode. data division. working-storage section. 01 anything pic x. 01 result usage binary-long. 01 empty pic x value x"00". *> *************************************************************** procedure division. call "setlocale" using by value 6 by reference empty returning result end-call DISPLAY "ŠĐŽČĆ šđžčć" LINE 10 COLUMN 01 accept anything at 1101 goback. end program unicode. [/code] (The 6 is [b]LC_ALL[/b], a locale.h enum), in C it's [i]setlocale(LC_ALL, "");[/i] You have to hack the verbose output of a compile pass, ala [code] [btiffin@home cobol]$ cobc -x unicode.cob [btiffin@home cobol]$ cobc -x -v unicode.cob preprocessing unicode.cob into /tmp/cob30612_0.cob translating /tmp/cob30612_0.cob into /tmp/cob30612_0.c gcc -pipe -c -I/usr/local/include -Wno-unused -fsigned-char -Wno-pointer-sign -o /tmp/cob30612_0.o /tmp/cob30612_0.c gcc -pipe -Wl,--export-dynamic -o unicode /tmp/cob30612_0.o -L/usr/local/lib -lcob -lm -lgmp -lncurses -ldb -ldl [btiffin@home cobol]$ cobc -x -C unicode.cob [/code] cut-n-paste-n-change those two gcc lines as [code] gcc -pipe -c -I/usr/local/include -Wno-unused -fsigned-char -Wno-pointer-sign -o unicode.o unicode.c gcc -pipe -Wl,--export-dynamic -o unicode unicode.o -L/usr/local/lib -lcob -lm -lgmp -lncursesw -ldb -ldl [/code] changing the /tmp/cob30612_0.c (and .o) to your real name that -C outputs, unicode.c in my case. And then linking to [b]ncursesw[/b] by changing the -l And you should be nearer to golden. I go from (capture is from the curses screen, not stdio) [code] $ cobc -x unicode.cob $ ./unicode M-EM- M-D~PM-EM-=M-D~LM-D~F M-EM-!M-D~QM-EM->M-D~MM-D~G [/code] to [code] [btiffin@home cobol]$ cobc -x -C unicode.cob [btiffin@home cobol]$ gcc -pipe -c -I/usr/local/include -Wno-unused -fsigned-char -Wno-pointer-sign -o unicode.o unicode.c [btiffin@home cobol]$ gcc -pipe -Wl,--export-dynamic -o unicode unicode.o -L/usr/local/lib -lcob -lm -lgmp -lncursesw -ldb -ldl [btiffin@home cobol]$ ./unicode ŠĐŽČĆ šđžčć [/code] Hope that makes sense and hope it helps ... BUT please be warned ... This is quick'n[b]'dirty[/b] [i]I may have just made Roger a little sad inside.[/i] More civilized changes can be made if you need this for more than a one-off. Cheers, Brian p.s. Bear, is that you at http://newsgroups.derkeiler.com/Archive/Rec/rec.games.roguelike.development/2010-09/msg00053.html ?? I'd bet, umm, 3 bucks. :-) I hope so, then we can chatter on about the amulet of yendor. ---------------------------------------------------------------- Horsing around a little; Ok, so, add this to a makefile (after the #include ncursesw/ hacks and compiler rebuild) ... [code] unicode: unicode.cob cobc -x -C unicode.cob gcc -pipe -c -I/usr/local/include -Wno-unused -fsigned-char -Wno-pointer-sign -o unicode.o unicode.c gcc -pipe -Wl,--export-dynamic -o unicode unicode.o -L/usr/local/lib -lcob -lm -lgmp -lncursesw -ldb -ldl [/code] where the two gcc lines are cut-n-pasted-n-changed from a [code] cobc -x -v unicode.cob [/code] output. That'll make life a little less manual. And testing with [code] OCOBOL*>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20110110 *> Purpose: Unicode input and output *> Tectonics: cobc -x -C unicode.cob *> then hack-n-slash the gcc commands from cobc -x -v *> so that ncursesw is linked in *> *************************************************************** identification division. program-id. unicode. environment division. input-output section. file-control. select theseefile assign to "unicode.out" organization line sequential. data division. file section. fd theseefile. 01 seedata pic x(80). working-storage section. 01 anything pic x. 01 something pic n(40). 01 result usage binary-long. 01 empty pic x value x"00". *> *************************************************************** procedure division. call "setlocale" using by value 6 by reference empty returning result end-call display "ŠĐŽČĆ šđžčć" at 1001 end-display accept something at 1101 end-accept display something at 1201 end-display display function byte-length(function trim(something)) at 1301 end-display accept anything at 1401 end-accept open output theseefile move something to seedata write seedata end-write close theseefile goback. end program unicode. [/code] and cut-n-pasting the display data into the accept, unicode.out looks like [code] $ cat unicode.out ŠĐŽČĆ šđžčć [/code] so it seems that ncursesw allows for unicode input in screen sections as well. [i]and, being lazy, the byte-length displayed as ^U, 21[/i] BUT... I don't understand the ins-n-outs of Unicode. What BEWARE signs have to be hung when dealing with keyboard input and (from what I can tell, nearly impossible to predict) byte sizes? Will COBOL's 'get rid of the trailing spaces' mentality ever hurt a unicode sequence? I.e, do any unicode encodings end with 32? Are there [i]safe[/i] PIC clauses? PIC N (as it exists in our ever favourite OC1.1-feb2009 vintage) is just a two-byte field, and from what I gather, some unicode encoded characters run up to three (or more...) So could a PIC N(1) crash programs with some weird cut-off codepoint? [i]Of course, that's most likely to happen right when an OpenCOBOL shop is about to break it big internationally and the bank treasurer tries his nation's currency symbol during the demo.[/i] ;-) So, we should discuss some of the finer points, with an eye toward posting up proper HERE BE MONSTERS signs. Cheers, Brian ---------------------------------------------------------------- I came across this problem today. However when trying at the latest ubuntu version had absolutely no problem. But now at Debian i have this problem... Luckily there is a solution but seems like a headache. isnt there a simpler way? To use for example the desired version of ncurses somehow? ---------------------------------------------------------------- Umm, aside from the #include change that will require a re-compile of OpenCOBOL, AND if you know you always want wide ncurses; you can create a symlink to the ncursesw library. This would mean that all your apps that want ncurses support will link to the wide version. But, it will allow simple cobc -x program.cob and you can skip over the cut-n-paste-n-hack hassles. Note that this is a relatively dangerous thing to do on a 'general purpose' computer that may well need the normal ncurses for other programs. Tread lightly here. OR ... along with the #include change, we'll need to figure out where cobc builds in the linkable libraries and make a change to ncursesw there. If you want to continue; I'll/we'll spend the time to hunt through and find a patch point. I couldn't find where cobc builds it's gcc commands on my first pass through, but I only spent a few minutes. OR ... we pester Roger to build a --with-curses-wide into ./configure so we can all safely build compilers that handle Unicode in screen sections for ncurses supported platforms. Roger? ;-) Cheers, Brian [b]Note:[/b] I still worry about the questions posed in my previous post. Will a non all-in Unicode compiler produce programs that may have data dependent, executable ending bugs? Hard enough to catch that it may be better to just advertise our current 1.1's as not safe for Unicode? Or are there safe ways to create char based programs with all the various encodings that we could publish on a BEWARE, KNOW THIS sign? ---------------------------------------------------------------- I couldnt output iso8859-7 to curses as i previously said... Setting export LANG=el_gr ,worked fine:) ---------------------------------------------------------------- Actually this is a PITA. The ncurses versus ncursesw is mostly irrelevant as they may be the same. The problem is that the ncurses devs decided to make it locale aware. This means that when echoing a character back, ncurses decides, on the basis of the current locale, whether, or not, to mangle the output. Geez. Note this hits the EU hard. How can I have a prog that accepts and correctly displays my ISO-8859-xxx characters for ALL "extended ASCII codes" with this? ie. I have German locale but I want to input/display cedilla,accent, etc. (Mostly they do not overlap in extended ASCII). HOWEVER, it appears that there is a workaround. The ncurses that have this "feature :/-" also have a routine called "use_legacy_coding". With a configure check, we can then insert [code] use_legacy_coding (2); [/code] immediately after the (successful) call to "initscr". Roger ---------------------------------------------------------------- Hi Roger, nice to read you here again! If I got this right we can use the function [url=http://www.unix.com/man-page/FreeBSD/3/use_legacy_coding/]use_legacy_coding[/url] in OC to work in curses mode with all extended ASCII (128-255) chars which can be saved in PIC X, too. But what about REAL unicode chars (needing more than one byte)? How can one accept/display these? Is PIC N always a two byte field in OC? human ---------------------------------------------------------------- First part - Correct. Tested with every combination available to me. (With/without use_legacy_coding) PIC N is implementor defined. If you are thinking of wchar_t, then that is 2 bytes on Win, 4 bytes on Linux and ??? on other. The getch/wgetch decsion is not, ATTM, a priority. Roger ---------------------------------------------------------------- Thank you for yours fast reply and lot of idea to work on. Compiling with ncursesw resolved the issue for now. I will continue my work on this subject and post my results as soon as I have any. ---------------------------------------------------------------- What about adding only [code]use_legacy_coding (2);[/code] immediately after the (successful) call to "initscr" and change nothing else? human ---------------------------------------------------------------- Correct me if I'm wrong or do not understand correctly this mater. initscr function, by my understanding, is started by a screen section of the cobol program. Since I'm not using screen section in my programs I have doubts on the way to call use_legacy_coding () function. Is it better/enough to insert in cobol program thoose two lines ... CALL "initscr". CALL "use_legacy_coding" using value 2. ...... or make a c subroutine just to call both function? What would be the preferred method? ---------------------------------------------------------------- initscr is called when you do the first DISPLAY/ACCEPT of SCREEN items or use the AT or WITH clause. The preferred method would be to do this small hack to screenio.c and rebuild OpenCOBOL. human ---------------------------------------------------------------- Subject: opencobol and qpid I would like to be able to call qpid apis from a cobol program. I have tried to give the cobc a library file name and it says it can't find it but when I go to /usr/lib it is there. What do I need to do? ---------------------------------------------------------------- Please submit output from cobc --version and the command line for cobc you're using, together with the error messages you get. human ---------------------------------------------------------------- cobc (OpenCOBOL) 1.1.0 Built Jul 27 2009 03:03:22 Packaged Mon Aug 11 11:27:01 CEST 2008 Copyright (C) 2001-2008 Keisuke Nishida / Roger While localhost Stratus]$ cobc -x smk_mmi_srv.cobol qpid_cli_api.o qpid_cli_api.o: In function `Listener::received(qpid::client::Message&)': qpid_cli_api.cpp:(.text+0x3f): undefined reference to `qpid::client::Message::getData()' qpid_cli_api.cpp:(.text+0x50): undefined reference to `std::cout' qpid_cli_api.cpp:(.text+0x55): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)' qpid_cli_api.cpp:(.text+0x61): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' qpid_cli_api.cpp:(.text+0x69): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)' qpid_cli_api.cpp:(.text+0x71): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))' qpid_cli_api.cpp:(.text+0xa1): undefined reference to `qpid::client::Message::getDestination() const' qpid_cli_api.cpp:(.text+0xb3): undefined reference to `std::cout' qpid_cli_api.cpp:(.text+0xb8): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)' qpid_cli_api.cpp:(.text+0xc7): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' qpid_cli_api.cpp:(.text+0xcf): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)' qpid_cli_api.cpp:(.text+0xd7): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))' qpid_cli_api.cpp:(.text+0xe8): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()' qpid_cli_api.cpp:(.text+0xff): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()' qpid_cli_api.cpp:(.text+0x111): undefined reference to `qpid::client::Message::getDestination() const' qpid_cli_api.cpp:(.text+0x129): undefined reference to `qpid::client::SubscriptionManager::cancel(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' qpid_cli_api.cpp:(.text+0x13a): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()' qpid_cli_api.cpp:(.text+0x151): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()' qpid_cli_api.o: In function `c_init_queue(char*, char*, int*)': qpid_cli_api.cpp:(.text+0x17e): undefined reference to `std::allocator<char>::allocator()' qpid_cli_api.cpp:(.text+0x198): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)' qpid_cli_api.cpp:(.text+0x1a3): undefined reference to `std::allocator<char>::allocator()' qpid_cli_api.cpp:(.text+0x1bd): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)' qpid_cli_api.cpp:(.text+0x1c8): undefined reference to `std::allocator<char>::allocator()' qpid_cli_api.cpp:(.text+0x1e2): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)' qpid_cli_api.cpp:(.text+0x1ed): undefined reference to `std::allocator<char>::allocator()' qpid_cli_api.cpp:(.text+0x206): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)' qpid_cli_api.cpp:(.text+0x23d): undefined reference to `qpid::client::Connection::open(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > c it look like I need to link with c++ libraries and the qpid libraries. I haven't been using for a while and when I try to add the -L and -l options with qpid libraries and the g++ libraries it can't fine them. ---------------------------------------------------------------- I'd suggest that if OC 1.1 is used it should be the latest official pre-release from FEB09. Your command line doesn't have anything about the qpid libraries in. Please use -L to set the paths these libraries can be found and -llibname for all these libraries (I guess c++ libraries are added by the linker without the need to add them via -l). This should work. human ---------------------------------------------------------------- ddunning; [i]and everyone else[/i] There is an issue with C++ and linker names in the OpenCOBOL / C Application Binary Interface world. C++ requires that linkers have access to duplicate names. These duplicate names are encoded by the various compilers and take into account all the object oriented features and call datatype signatures. myfunc(1,2.0) is linked to differently than myfunc(1,2,3,4) as the signatures are int myfunc (int, float) and int myfunc(int, int, int, int). C knows nothing about duplicate names with different signatures. So ... you either have to [i]cheat the system[/i] and decode the encoded names yourself. Royal pain in the arse, but not impossible. Just use [b]nm[/b] to see the exposed function names from the object or library files. I use this method during early exploring, to see if progressing is worthwhile. Or, the much better way [code] extern "C" { int myfunc(int i, float f) { ... } } [/code] Tells C++ to generate a straight up "myfunc" linker name entry. OpenCOBOL likes these. human has discovered Windows friendly versions of the [b]extern "C"[/b] modifier. So if you want to play in C++ land, you may need to write wrapper functions. Easy, but kinda boring, so you want to try and limit the touch points. :-) See http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1221&forum=1 for one method of beating down the C++ interface and library naming to the much more friendly C ABI. Cheers, Brian ---------------------------------------------------------------- I finally got my cobol program to build using the c++ api program by putting the -L -l options in the correct place. I haven't been able to test it yet because I have to change the cobol to call the c++ methods. thank for all help and suggestions. ---------------------------------------------------------------- Subject: Help Getting Started Hello, 30 years in COBOL on IBM Mainframes. Last 1.5 years we worked to migrate our M/F environment to a Windows environment using a 3rd party suite of products, including their version of Cobol integrated with MS Visual Studio. Long story short, the project was cancelled shortly before going live when the company we lease our M/F from reduced our operating cost significantly (I guess they figured some income was better than no income). Our folks making the decision we're happy to continue on the M/F at a reduced rate. Still, the project had the benefit of reducing cost, just not in the way we expected. We we're leasing the 3rd party products and since we won't be converting, we let the lease expire. But, I did get the bug for COBOL on Windows platform and would like to further extend my skill set. So far, from my limited Windows experience, COBOL is still COBOL (our programs moved nicely from the M/F to Windows with most having no compile issues, other issues were minimal). My issues are in running the programs. M/F applications use JCL (Job Control Language) which is very robust. Our 3rd party solution converted the JCL at execution time so we were spoiled in that we did not need to learn windows job control (scripts I guess). For those of you that came from a similar M/F background (I would assume that may be many), what advice do you have? For example, should I be using OpenCOBOL with something like CYGWIN or is there something that makes more sense coming from the M/F background? Or should I just download OpenCOBOL and use it natively? Any tips on getting started? Thanks in advance. parsons ---------------------------------------------------------------- For windows, go to the Wiki on the left of this page and from there to "Assorted Documents". The last item is a pointer to the easiest entry to OpenCobol and it also contains all the other documents on the page. The OpenCOBOL Programmers Guide is a must for anyone no matter how OpenCobol is acquired. It is also worthwhile to get the FAQ which is also available from the left panel of this page. John ---------------------------------------------------------------- John - thanks. Just what I was looking for to get started. Thanks again. Parsons ---------------------------------------------------------------- I am not certain exactly what the OP is asking for. Are you asking for a "personal COBOL" that you can "play with"? Are you looking for a product taht you can use to help migrate production code from the (IBM) mainframe to Linux/Unix/Winjdows (and if so, which)? Are you looking for an environment where you can offload development of existing production COBOL that is intended to stay on the mainframe? Are you looking for something else (or a combination of things)? To me, the question of when/if OC is a good way to go depends on exactly what you are trying to do with COBOL. It certainly CAN Be used for most (or even all) of these, but exactly how well it will work and whether it is the "best" solution does (IMHO) depend on what you want to do with COBOL. ---------------------------------------------------------------- wmklein - thanks for taking the time to reply. The answer I got from JohnS pointed me in the right direction. Thanks ---------------------------------------------------------------- Subject: Download version 1.1 pre-release Hi, I notice that version 1.1 pre-release has a old date 2007/12/27 this means ? the project has not release any version from this date? Greetings ---------------------------------------------------------------- http://www.kiska.net/opencobol/1.1/ Ciao Federico ---------------------------------------------------------------- The quickest way to install and use OpenCOBOL under MS-Windows is the Gary Cutler ‘ distribution (superb). Last Update : 02 DEC 2010 Go to the Wiki on the left of this page and from there to "Assorted Documents". The last item is a pointer to the easiest entry to OpenCOBOL and it also contains all the other documents on the page. ---------------------------------------------------------------- The latest version I suggested has this version sign: cobc (OpenCOBOL) 1.1.20100520 Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Keisuke Nishida Copyright (C) 2006,2007,2008,2009,2010 Roger While This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Built Nov 24 2010 20:00:03 Packaged May 19 2010 16:17:26 UTC Has someone already tried it? Federico ---------------------------------------------------------------- @sergioszy: the 2007 is just the date of the first 1.1 pre-release. If you download the file you see the real date: 2009-02-06. It is quite good. If you want to use it in WIN environments you should take the patched version available in the wiki. @federico: I'm not sure if there will be a newer 1.1 than the current pre-release at all. The version number of the cobc -version you quote was changed to 2.0 later on. This version can only be seen as an ALPHA FOR TESTING PURPOSES ONLY and was changed heavily later on. Don't expect this version to be supported at all as this was not released as public version. human ---------------------------------------------------------------- human; Come on man ... hook a dude up. Need a hit of Alpha... [i]Or, if things are what they are ... I'll have to wait until the Festivus for the Restufus[/i] :-) Cheers, Brian ---------------------------------------------------------------- [quote] federico wrote: http://www.kiska.net/opencobol/1.1/ [/quote] Does this mean that the source repository on SourceForge is not up to date? Or is there no more active development? Michael ---------------------------------------------------------------- There is heavy development in the background but it seems pre-releases for 2.0 will need additional time. The SourceForge repository for OpenCOBOL has only final versions and is therefore up-to-date in this point of view. Get newest pre-release AS A SERVICE FROM THE PORJECT HEAD Roger While from the download link to the left. human ---------------------------------------------------------------- Subject: Problem strange with data descriptor (exceeded 72 colums) [SOLVED] I am in progress of converting some files... However i came accross a problem which i cant explain... in other situations i solved it without knowing how... the code is here.... http://pastebin.com/CsdsC5Qm I get sMISA.cbl:54: Error: syntax error, unexpected "Identifier", expecting LEADING or TRAILING If i remove SIGN Trailing seperate works but not as i want... :-o I am very confused! Please help :) Thank you again ---------------------------------------------------------------- Ok problem solved... The problem was that the space between identifier and PIC was hudge.. Unluckily it is limited ---------------------------------------------------------------- Just adding for clarity... It wasn't that there were a bunch of spaces to align the source code on PIC ... it was that the keyword SEPARATE ended up [b]past column 72[/b], so OpenCOBOL only sees SEPARA and takes that as a reference to an identifier. Cheers, Brian ---------------------------------------------------------------- Yes i found out that later.. I am not a Cobol programmer:),just learning to do some conversions.. However -free option overcomes this limitation ---------------------------------------------------------------- Yeah, kinda. Your sample would not have worked -free. You can't use a plain asterisk in column 7 when in FORMAT FREE. But with a few tricks; using [b]*>[/b] comments (with the * in column 7) in particular, makes FIXED source code work in a FREE form way. And yeah, with -free you can go to much longer lines. 255 chars if I'm not mistaken when looking through pplex.c Cheers, Brian ---------------------------------------------------------------- Please edit your first post and set a title according to the REAL problem. Maybe something like "syntax error in lines with more than 72 chars [SOLVED]". human ---------------------------------------------------------------- The pastebin ref's been removed now. I'd be intrigued to have nosey'd at the code... ---------------------------------------------------------------- Subject: Organizing program files Hello... I compile my programs using -m as modules... The programs are in 4 different folders.. The problem is that with MF cobol someone could do CALL "/usr1/ba/blah" ... In OC you cant.Thats a problem... 2 solutions come to my mind.. put everything to one folder... or create symbolik links at one folder. But i feel something is wrong there.... Any suggestion? ---------------------------------------------------------------- Parhs; If none of the CALL names conflict (duplicates across directories) then take a look at http://opencobol.add1tocobol.com/#what-is-cob-pre-load and http://opencobol.add1tocobol.com/#what-is-cob-library-path See if those two environment settings can help. If you have duplicate names across dirs ... well, you have a problem that will require more manual intervention and code maintenance. ;-) Cheers, Brian ---------------------------------------------------------------- I think something is wrong at your site because this definitly has to work. Always provide the output of cobc -version and a small sample prog if you think something is wrong. For your tests: don't use an extension as I think it has to be left out. human ---------------------------------------------------------------- Subject: Open Cobol with as/400 Hello, I need to know if it is possible to create a cobol program to run in a IBM AS/400 enviroment. I find out binaries for as/400 and download it (opencobol-1.1-as400-bin.zip), but i don't know how to use it. Could anyone help me with this issue? Regards, Manuela ---------------------------------------------------------------- I don't have access to an AS/400 any more, but I'd suggest to unzip it, upload it via FTP (byte-mode) to the machine, unpack LIBCOB.FILE on the server machine (I guess you know how to do this). human ---------------------------------------------------------------- Hello, Thanks for your answer. But i have another doubt, after unpacking file how can i compile cobol programs? Thanks ---------------------------------------------------------------- Hi, In this zip you have a portion which is a "savefile" of LIBCOB library. You just need to restore it. The rest should go to IFS /usr/local/... directories You have "runonce" file in /usr/local/bin which you need to execute once from QSH (just look inside - there are 2 commands) On AS400 to compile program with OpenCobol you need to do that from QSH, which is a short version of unix shell, i.e. cobc -x test.cbl Cobol sources and copybooks should reside in IFS. Before going to qshell, you need to set LIBCOB.LIB into your library list, and set CURRENT library. OpenCobol on AS400 compiles object, modules and programs into CURRENT library or, if it is not set, to QTEMP ---------------------------------------------------------------- Hi, Thanks for your help. But i have another doubt. After compiling program i can run it using call command in AS/400 command line? Regarding DB2 it is needed to perform some aditional settings? I found a post regarding this matter, that mention scripts, but where i can find that scripts? Thanks ---------------------------------------------------------------- As this information is missing: Did you tried to install OpenCOBOL and compile a sample prog like ska answered? If you mention some posts you should place the link to them, too. human ---------------------------------------------------------------- Subject: FILES WITHOUT CLOSE Hello. I use OpenCobol 1.1 06FEB2009-mingw under MS-Windows (distribution Gary Cutler) 1 / I wonder if anyone has tested what happens at the data files opened in IO when I close the window, where runs the program, clicking the X in the upper right. That is to say without closing the file with a CLOSE. For me, the files remain accessible and in good condition according to my tests, but i'am not sure. 2 / Second: is there a way to rebuild a data file if a problem like this: Stop the program without going through the CLOSE for data files. Thanks in advance for your comments. ---------------------------------------------------------------- In BDB there is db_recover, but according to infos from oracle BDB forums this only is useful for cleaning unfinished transactions with .log-files (which are not used by OpenCOBOL). In MOST cases the files should be OK. If you close the command window the running commands inside get a kill signal. OC forces file closes in this case. This is nice if it works, which depends on the system (and the time that passes until the application is forced to stop). You can try if this is done by using cobcrun (or your main prog) 1>out.log 2>out.err and closing the window afterwards [there should be file i/o without the need of screen input, of course and curses should not be in use]. If it works you get a nice out.err with the message from OC that several files were forced to be closed. The same applies to runtime crashes. WARNING: If you use DB_HOME for applying record locks correctly, it's likely that the system can not start again. You either have to run db_recover in this case or simply delete the __db.* files (nothing else is done if no transaction logs are available). BTW: If you use VBISAM there is a nice vbcheck, that is OpenSource and can (must) be changed to work corrext in every cases (I did not made any corrupt VBISAM file work with this tool, yet). human ---------------------------------------------------------------- Thank you very much for all these details. For now, I've never managed to corrupt an indexed file opened in I-O by a crash program. It seems that this part is very solid. This is good news for me. I'll try some tests similar in multi users environment as possible.(not possible to do this alone!) Regards. Rene Aouizerate. ---------------------------------------------------------------- Subject: Open COBOL GUI Hello. I use OpenCobol 1.1 06FEB2009-mingw under MS-Windows (distribution Gary Cutler) I am currently working on the possibility of a GUI (GTK + C +) as I had been advised in using CALL. It's very hard for me who does not handle correctly the C. Question to our "God" will there be in the next version (2.) a graphical mode development? If it did, it would allow me to devote my efforts on another part on OpenCobol. If it was not the case (bhooooou) would not it be wise for the community to concentrate efforts on this topic to a single location? I'm willing to give big time for this ... ---------------------------------------------------------------- I'm quite sure you refer to Roger and I'm quite sure there won't be any GUI. TUI (Textual User Interface) will be improved with better SCREEN and DISPLAY/ACCEPT WITH support. For the community call: yes, it would be really nice if there is a layer prog for building GUIs. Really cool would be a parsing of (old) COBOL sources and kind of a rebuild of these for calling the layer prog with the correct params instead of using DISPLAY/ACCEPT. There were several discussions about that before: every body was excited but there was no result more than a sample that it is possible to build such a layer. To make my point clear: If there is a community effort for GUI, it should be a layer concept. Therefore: Call only one COBOL program with a clear definition. In this COBOL program: Use GTK and/or others (depending on settings; but it seems GTK would be a good first start) to do the C calls. With this concept the one community program (and the C layers, supplied by the community) can be changed if there are changes necessary for higher OC versions and different libraries can be used for screen/io (GTK/JAVA/HTML/... local/via sockets/...). There is no need to change the COBOL progs again and again (because they only call the COBOL layer prog, which is changed). human ---------------------------------------------------------------- Ok I will continue my hard work with C and GTK + ... but I feel a little get away from COBOL ... ---------------------------------------------------------------- Just in case you haven't seen it yet. Check out http://opencobol.add1tocobol.com/#does-opencobol-support-the-gimp-toolkit-gtk That's mostly C code. But, in my humble, we'll get a lot more mileage and bang for the buck using Vala and Genie to write up the interfacing layers... See http://opencobol.add1tocobol.com/#can-opencobol-interface-with-vala It's a lot more fun. I have a plan, that should see light of day soonish, to host a Fossil based collaborative project for GUI access from OpenCOBOL. (The GUI framework will just be one of many fossils, I hope). [i]For the curious, Fossil is a distributed revision control system with a very nice feature set.[/i] http://www.fossil-scm.org/ Cheers, Brian ---------------------------------------------------------------- Subject: OS X install issues Hi, Having issues trying to get OC working on a iMac (a 2007 aluminum) w/OSX 10.6. Sorry if this was supposed to be part of another thread; but ones I found were pretty old - 2006 & 2009. This is the same problem as has been posted - libdb is required - searched for, looked at and tried suggestions from prev posts and other sites and got no joy. Would appreciate ideas on this. Used the Ganymeade guidelines for 10.5/10.6. macports seemed to be OK gmp seemed to be OK BerkDB 501 seemed to be OK Quick personal background: 25+ yrs cobol mainframe, 8+ yrs IDMS/ADSO RDBMS + some RPG,REXX,Assembler, TSO command line 20+ yrs using personal Macs (some database (4d & filemaker types), not much programming (a little pascal a long time ago) some Windows very little UNIX I live in the country and am stuck with a crappy phone line (typically 2-3 KB/s), so downloads are a real sore point. Several other questions/observations: 1 - I can run XP or Ubuntu with VirtualBox. Is the potential of either of those being SIGNIFICANTLY easier to install than Mac (it appears the process is basically the same; but do they have a more robust or mature installation) 2 - Finds db.h; but not finding db_open, db_185, etc - is this an issue? checking db.h usability... yes checking db.h presence... yes checking for db.h... yes checking db_185.h usability... no checking db_185.h presence... no checking for db_185.h... no … checking for __db_open in -ldb-4.5... no checking for dbopen in -ldb-4.5... no 3 - will the 32/64 bit issue with iMacs be a problem now or later for any of this? host='i386-apple-darwin10.5.0' vs i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664) Target: i686-apple-darwin10 I’d appreciate any further thoughts, suggestions or fixes. Thanks. Bob ---------------------------------------------------------------- I can't help with Mac or with your download speed. If the virtual box works like the real box: 1. For XP getting OC is just as easy as any windows program.Go to the Wiki on this page, thence to "Assorted Documents", thence to the last item. G Cutler has put together a very simple to run package. After the download you need no more than 10 minutes to be writing and compiling your first program. 2. For Ubuntu what I did was to go to the Synaptic Package Manager and get open-cobol. Ubuntu only has version 1 as is their policy. I downloaded version 1.1 from this site. Then: tar xvzf open-cobol-1.1.tar.gz cd open-cobol-1.1 ./configure make make check sudo make install hash -r sudo ldconfig I now have openCOBOL 1.1 under Ubuntu. I have said here what I did, because I have virtually no experience with linux. I hope I was not the beneficiary of a miracle. Version 2 is coming and I hope I will be able to upgrade in the same way. John. ---------------------------------------------------------------- db_185 is another possible name for db.h, therefore this is no issue. What is an issue is the missing dbopen. Most likely you simply have to set LDFLAGS and LD_LIBRARY_PATH before configure to ppint to the library folder of BDB, something like [code]export LDFLAGS="-L/opt/local/var/macports/software/gmp/5.0.1_0/opt/local/lib -L/usr/local/BerkeleyDB.5.0/lib/ $LDFLAGS" export LD_LIBRARY_PATH=/opt/local/var/macports/software/gmp/5.0.1_0/opt/local/lib:/usr/local/BerkeleyDB.5.0/lib/:$LD_LIBRARY_PATH"[/code] with the paths of your system. You may want to try to use VBISAM instead of BDB (small download size). Grab it from http://www.sim-basis.de/vbisam-2.0.tar.gz, untar it, build with ./configure+make+make install and tell OC to use it with ./configure --with-vbisam human ---------------------------------------------------------------- I use Macports to install things like GMP and Berkeley DB. They install in to /opt/local/... instead of /usr/local/... For some reason DB goes in a subdirectory with it's name. So when I run configure I do this: ./configure LDFLAGS="-L/opt/local/lib -L/opt/local/lib/db46" CPPFLAGS="-I/opt/local/include -I/opt/local/include/db46" Probably could use environment variables, but I haven't tried that. This is a PPC iMac, by the way, with Mac OS X 10.5.8. Frank ---------------------------------------------------------------- Thanks for the help. Reinstalled with vbisam for now, works great! Thanksa again. Bob ---------------------------------------------------------------- Subject: Public repository When will we have a pubic repository @github or @bitbucket? Sourceforge is a PITA to download these days. All Javascript and ads p0rn getting in the eay. Also, you do not have a Ohloh profile and you really deserve it! Anyway, good job! Thanks. ---------------------------------------------------------------- Subject: screen section overwriting and crt status. The Guide notes that up arrow and down arrow are not supported by Windows systems. It appears they are not supported by Ubuntu 10.04. In checking this point it also became apparent that displaying a heading on top of a heading with different attributes is not possible. Ubuntu 10.04 OC 1.1 built Jul 05 2010 packaged Feb 06 2009. [code] identification division. program-id. ts5. environment division. configuration section. special-names. crt status is keyboard-status. data division. working-storage section. 78 black value 0. 78 blue value 1. 78 green value 2. 78 cyan value 3. 78 red value 4. 78 magenta value 5. 78 yellow value 6. 78 white value 7. 01 keyboard-status pic 9(4). 88 enter-pressed value 0. 88 f1-pressed value 1001. 88 f2-pressed value 1002. 88 up-arrow-pressed value 2003. 88 down-arrow-pressed value 2004. 01 pickers. 02 choice pic 9. 02 m-sub pic 9. 02 choice-key pic x. 02 ok pic x. screen section. 01 screen02. 02 settings blank screen background-color blue. 02 m-items. 03 line 1 column 1 value "read". 03 line 1 column 10 pic x reverse-video to choice-key. 03 line 2 column 1 value "add". 03 line 2 column 10 pic x reverse-video to choice-key. 03 line 3 column 1 value "change". 03 line 3 column 10 pic x reverse-video to choice-key. 03 line 4 column 1 value "delete". 03 line 4 column 10 pic x reverse-video to choice-key. 03 line 5 column 1 value "browse". 03 line 5 column 10 pic x reverse-video to choice-key. 02 screen03. 03 filler line 12 column 1 value "read" foreground-color cyan highlight. 02 screen04. 03 filler line 13 column 1 value "add" highlight. 02 screen05. 03 filler line 14 column 1 value "change" highlight. 02 screen06. 03 filler line 15 column 1 value "delete" highlight. 02 screen07. 03 filler line 16 column 1 value "browse" highlight. procedure division. begin. display settings set environment "cob_screen_exceptions" to "y". move 1 to m-sub move 0 to choice perform slide with test after until enter-pressed display "choice is" line 10 column 1 display choice at line 10 column 11 accept ok at line 10 column 12 goback. slide. display m-items evaluate m-sub when 1 display screen03 when 2 display screen04 when 3 display screen05 when 4 display screen06 when 5 display screen07 end-evaluate perform slide2. slide2. accept m-items if enter-pressed move m-sub to choice end-if * if up-arrow-pressed and m-sub not < 2 subtract if f1-pressed and m-sub not < 2 subtract 1 from m-sub end-if * if down-arrow-pressed and m-sub not > 4 if f2-pressed and m-sub not > 4 add 1 to m-sub end-if. [/code] When this program is run the initial menu item-"read" appears on line 12 in cyan. If f2 is pressed twice "add" and "change" appear on lines 13 and 14 highlighted. Pressing "enter" causes "choice is 3" to appear on line 10. If the line numbers for screen03 to screen07 are changed to 1 to 5 so that the menu at the top should be overprinted; it is not.The original menu is unchanged. If instead of f1-pressed and f2-pressed the commented lines are restored, the crt status ignores the key press and when "enter" is pressed "choice is 1" appears. I have used code tags as instructed but they seem to have no effect. Sorry. John. ---------------------------------------------------------------- You were nearly correct with your code tags. Remove the " from them and the'll work. BTW: It's simpler to just press the <> button during post/edit, enter something (for example a space or a DOT) and press OK. This way, you have empty code tags inserted and are able to paste your code into them. Just had a small look into your sample prog in my win test environment (OC 2.0 unofficial pre-release from Dec 2010), to check if 2.0 will work correct: - Arrow keys for navigating through the fields [unchanged code] work fine (I guess this did not work before in [native?] win). - Because of the navigation function, the arrow keys can not be passed as key value to the COBOL program. This can only work if either screen section is NOT used or if it's possible to disable navigation. I could come up with a patch for that (something like COB_SCREEN_NONAV) that could be set. Would it be useful? - After changing the line numbers the original menu is overwritten, but only one time (seems like a bug). If I change the level numbers for screen03-screen07 to 01 (what I would expect them to be) it works fine. You may want to try that with your version, too. human ---------------------------------------------------------------- There is not much general information published as far as I know about techniques for using the screen section. The ideas behind my example come from: The Cobol Companion Yorke & Spence Edward Arnold 1994 ISBN 0 340 579889. On page 15 there is a discussion "Scrolling Menu Bar". My example tries to implement the idea. Advanced Interactive Cobol for Micros LeBert & Massoni Prentice Hall 1988 ISBN 0 13 011479 0 025. On page 10 they mention displaying field-identifiers of invalid data at a brighter intensity than those of correctly entered fields. They use this technique in the examples later in the book. I think the ideas are useful, but others may not agree. In re-checking my program, I had to get rid of "f1-pressed" and add "f3-pressed" because Gnome wants F1 for help. When this is done you can go up and down the menu, although you can't see the cursor move. You just know because of the end printout. When you change the level numbers of the screens 03-07 to 1, and change the display lines to 1-5, the overprint is ignored, but the final "choice is..." displays the correct line. If the output lines are changed to 12-16, the outputs appear on the display. So it seems to me that the display behaviour does not change. I have edited the first post and hopefully the code tags work. John. ---------------------------------------------------------------- As G Cutler (Guide page 4-5) and Human make plain, the up and down arrow keys cannot be used as recognised terminators. However there is an error in my program which prevents overwriting. If the prompt and response are not under the same level then the prompt can be overwritten. Thus in the revised program that follows it is possible to have a sliding highlight on the menu. One has to use a weirdo use of the function keys, but if oc at some point follows what the manual says, it will be possible to have normal highlighted sliding menus. [code] identification division. program-id. ts8a. environment division. configuration section. special-names. crt status is keyboard-status. data division. working-storage section. 78 black value 0. 78 blue value 1. 78 green value 2. 78 cyan value 3. 78 red value 4. 78 magenta value 5. 78 yellow value 6. 78 white value 7. 01 keyboard-status pic 9(4). 88 enter-pressed value 0. 88 f2-pressed value 1002. 88 f3-pressed value 1003. 01 pickers. 02 choice pic 9. 02 m-sub pic 9. 02 choice-key pic x. 02 ok pic x. screen section. 01 screen02. 02 settings blank screen background-color blue. 02 m-items foreground-color white. 03 line 1 column 1 value "Slide down the menu with F2 up wi - "th F3.Press Enter to get the number of the item selected.Pre - "ss Enter again to finish.". 03 line 3 column 1 value "read". 03 line 4 column 1 value "add". 03 line 5 column 1 value "change". 03 line 6 column 1 value "delete". 03 line 7 column 1 value "browse". 02 n-items. 03 line 7 column 10 pic x to choice-key. 02 p-items foreground-color red highlight. 03 screen03. 05 line 3 column 1 value "read" background-color white blink. 03 screen04. 05 line 4 column 1 value "add" background-color white blink. 03 screen05. 05 line 5 column 1 value "change" background-color white blink. 03 screen06. 05 line 6 column 1 value "delete" background-color white blink. 03 screen07. 05 line 7 column 1 value "browse" background-color white blink. procedure division. begin. display settings set environment "cob_screen_exceptions" to "y". move 1 to m-sub move 0 to choice perform slide with test after until enter-pressed display "choice is" line 10 column 1 display choice at line 10 column 11 accept ok at line 10 column 12 goback. slide. display m-items evaluate m-sub when 1 display screen03 when 2 display screen04 when 3 display screen05 when 4 display screen06 when 5 display screen07 end-evaluate perform slide2. slide2. accept n-items if enter-pressed move m-sub to choice end-if if f3-pressed and m-sub not < 2 subtract 1 from m-sub end-if if f2-pressed and m-sub not > 4 add 1 to m-sub end-if. [/code] John. ---------------------------------------------------------------- I should have mentioned that the revised version was produced with the G Cutler build running under Vista. This allows the use of "blink" to provide a highlighted background. John. ---------------------------------------------------------------- Subject: New Here - Introduction Greetings I just installed opencobol on my linux machine. I was a COBOL mainframe (openvms) programmer for 20+ years and we migrated over to a different platform about 4 years ago. With the system we now have I do not get to really write code unless it is for personal reasons. I wish to start writing COBOL programs again with sql interfaces (call me insane) since I deal with sql databases on a daily basis. I did read the faq sect. 5.4. I currently program in either VB/ gambas/ C depending on the nature of the request but I have been missing COBOL's structure and logic. I remember writing my first COBOL program back in '84 and swearing never to write in pascal again. I just writing this to say hello and please excuse any silly questions which I might have like does opencobol have any sort of programming gui or should I just stick with the plain text editor and go from there? Ivan ---------------------------------------------------------------- Welcome to this board and to a wonderful COBOL compiler/runtime. There is no real GUI for OpenCOBOL, if you want to see what other users did have a look at http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=315&forum=1 In addition to "normal" text editors you way want to use OCic for a TUI between your editor and your compiler. You can grab it from wiki->assorted documents. You can find a lot of useful stuff there, especially the OpenCOBOL-1.1-06FEB2009-Programmers-Guide.pdf human ---------------------------------------------------------------- Subject: OpenCobol Tutorial? I've been writing MF COBOL for 25+ years. My new client won't pay for any MF debugging tools (Xpeditor, Intertest, etc...). For debugging, I'd like to copy my program to my desktop. It's all flat files, so SQL is not an issue. How do I start? Does OpenCobol have a GUI? Thanks in advance. ---------------------------------------------------------------- The quickest way to install and use OpenCOBOL under MS-Windows is the Gary Cutler ‘ distribution (superb). Build from the 06FEB2009 OC 1.1 distribution [Last Update : 02 DEC 2010] Go to the Wiki on the left of this page and from there to "Assorted Documents". The last item is a pointer to the easiest entry to OpenCOBOL and it also contains all the other documents on the page. Unfortunately no GUI, but there are solutions that come as soon as possible ... If you know C well you should be able to obtain results with GTK and more. You can look at : http://opencobol.add1tocobol.com/#does-opencobol-support-the-gimp-toolkit-gtk ---------------------------------------------------------------- MFGuy; For debugging, we always have the fallback of gdb, but that requires a little C knowhow to be effective. The top-o-the-pile development aid may be Federico's Animator. Read through http://www.opencobol.org/modules/newbb/viewtopic.php?viewmode=flat&topic_id=943&forum=1 for some details. Along with Gary's Guide, see the FAQ (left-side Documentation menu here) for some how-tos and my attempts to show everyone the unlimited potential of OpenCOBOL development. What can't it do? I've tried [i]and failed[/i] to answer that question so far. :-) Sure there are some limitations, but none have proven insurmountable to date. Plus, you may want to dig into the mf.conf file (/usr/local/share/open-cobol/config for OpenCOBOL built from a pre-release on GNU/Linux systems) and see where you can tweak the compiler to be more MF compatible. Cheers, Brian ---------------------------------------------------------------- While I don't have personal experience with it. NetCobol appears to be a version of Cobol that incorporates the .NET API (since it's also from Fujitsu, probably also includes at least some of of MicroFocus Cobol's API.) As such, it probably is a superset of standard Cobol. [url=http://www.essaywriter.co.uk/dissertation-writing.aspx]dissertation topics[/url] ---------------------------------------------------------------- Subject: Anyone here use (or want to use) MongoDB? Hi, I've been pestered to play with MongoDB to see what I think. And well, I find I can't play with things now a days without keeping an eye on how it could be leveraged by OpenCOBOL. For good or ill, it's where the itch is. ;-) So, before I start off on another proof of concept binding, I thought I'd ask first, see if there are experts. [i]See, I write crap code when I do samples, and well, experts can be harsh and scary[/i]. :-) It looks pretty cool at first glance. (Falcon 9.6.8 has a binding as well, and a three-for-one would be kinda nice). Just as a heads up; MongoDB is NOT SQL, it's key:value pair ala JSON, with a reference shell based on Javascript. And it's meant to perform on huMONGOus datasets. [code] SELECT * FROM users WHERE age>33 AND age<=40 SELECT * FROM users WHERE name LIKE "Joe%" [/code]equate to[code] db.users.find({'age':{$gt:33,$lte:40}})}) db.users.find({name:/^Joe/}) [/code] On Fedora install was simply [code] $ sudo yum install mongodb mongodb-devel [/code] and then you get to run a server with the hip name [i]mongod[/i]. If this becomes itchy, it'll end up either in an embedded js, ala the one done for SpiderMonkey, or based on the C driver. [i]And the C Driver could then end up a COBOL Driver, given things get itchier.[/i] http://www.mongodb.org/ and http://www.mongodb.org/display/DOCS/Tutorial (I don't really speak javascript, so this still feels 'codey' to me, but I can only imagine a native speaker would see the elegance and ease of use.) The straight up C might read better, to be determined... Ending with the same question that opened, Any MongoDB info you'd like to share? Cheers, Brian ---------------------------------------------------------------- Bravo for finding MongoDB, according to some, NoSQL databases will soon take over traditional db's, or maybe not. I would urge you to try CouchDB. It is an Apache Project and has a "RESTful" interface which s/b fairly easy to implement in OC. I have been using CouchDB, Javascript, CSS3 and HTML5 to develop a project that was supposed to use OC as the server side language but as yet I have not needed to go to the server for anything. Accessing the database is very straight forward using Javascript and JSON. Regards, rkeane ---------------------------------------------------------------- Subject: configure: error: gmp.h is required/ make failure Attempting to install OC on a DEC Alphaserver 4000 running Tru64 Unix V5.1B. Downloaded & installed gmp-4.3.2 and libtool-2.4 per the pre-reqs, but configure will not work. keeps stopping with the error: checking for iconv declaration... extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); checking for nl_langinfo and CODESET... yes checking for getopt_long_only... no checking gmp.h usability... no checking gmp.h presence... no checking for gmp.h... no configure: error: gmp.h is required gmp.h is in /usr/local/include ... How to resolve ?? Thanks ---------------------------------------------------------------- As it seems you've installed both the runtime- and the dev-package have a look at config.log in your oc folder. It will show you everything it has done in detail. I guess only /usr/include is used by default on your system. Try to use something like [code]./configure CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib[/code] human ---------------------------------------------------------------- Excellent - Thank You Very Much, I was also using --without-db, so when I did: ./configure CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib --without-db It worked great.... ---------------------------------------------------------------- Went to do the make, but it bombed out with: ranlib .libs/libcob.a creating libcob.la (cd .libs && rm -f libcob.la && ln -s ../libcob.la libcob.la) Making all in cobc Multiple rules lines for `%.c' Make: Don't know how to make parser.l. Stop. *** Exit 1 Stop. *** Exit 1 Stop. What now ? ---------------------------------------------------------------- Seems like you try to make dev stuff. This is only needed if you change the .l or .y files. If you really need to do that you need bison and flex. Just do ./configure+make+macke check+make install and you should not have these problems. BTW: Check out the README... human ---------------------------------------------------------------- I am not purposely trying to do any 'dev' stuff (although we do want to use OC to develop with)... We're trying to replace costly MicroFocus Cobol with OpenCOBOL, but so far the only platform we've been able to install it on is RedHat... I have checked out the README.... but still don't understand what I've done wrong... You;ve helped me resolve my configure issue and I am thankfull for that ! Now I just want to get a 'make' to complete.... but can't, maybe because none of the tools (make,ld,cc etc. ) are not GNU tools, but proprietary DEC/HP tools I've never touched any .l or .y files... ---------------------------------------------------------------- With 'dev-stuff' (really misleading here as we all want to develop WITH OpenCOBOL) I thought of changing OpenCOBOL sources and doing something like make dist afterwards. It seems that your make is somehow fuzzy. You can do something like [code]./configure yourconfigoptions 1>myconfig.log 2>myconfig.err make 1>mymake.log 2>mymake.err[/code] and post these four files, together with config.log (created by configure) here (please use code tags for posting that kind of stuff). Please edit your first posts for matching both the gmp.h and the current problem for making it easier to others if they want to help. human BTW: You use the 2009-02-06 tarfile, don't you? ---------------------------------------------------------------- Thank You, - Will do so, won't be able to do until tomorrow, have to get and MRI done on my leg today... Would it be OK if I post all the the zipped log files on our FTP site ? ---------------------------------------------------------------- FTP is OK although I'd use web-access like http://pastebin.com more. Set it to "Private" if you like to and post the link(s) here. human ---------------------------------------------------------------- I was originally attempting with 1.0, but figured I should be using the 1.1 since you referred to the Feb 6,09 tar file date..(which was used to generate these log files). So I started over with 1.1 and did as you requested and posted to pastebin link is below. Thanks for your help. http://pastebin.com/F7eEgjfd ---------------------------------------------------------------- I'm no linux guru but that is what I've recognized: You may get rid of "configure: WARNING: gmp.h: accepted by the compiler, rejected by the preprocessor!" if you add CPPFLAGS=-I/usr/local/include to your configure line. Warning: fileio.c can be ignored as you don't want to use ISAM access (as you've used --without-db). getmaxyx unresolved --> it's likely to crash on first DISPLAY/ACCEPT of SCREENs or first DISPLAY/ACCEPT AT/WITH. You may want to get a newer curses for fix this issue. Isn't this defined in your curses.h? Maybe you want to pastebin this file, too. But all in all it seems to be not easy to make OpenCOBOL on that machine. Are you able to get a GNU make working on that machine or able to port everything to your RedHat-Machine where configure+make worked fine? human ---------------------------------------------------------------- This is not Linux, but rather DEC UNIX (AlphaServer 4000), but it's 'supposed' to be POSIX compatible. This machine does not have GNU make, but rather a proprietary DEC/UNIX make (in /sbin). I could install GNU make and see if that works better than the one we're currently using. file make produces: make: COFF format alpha dynamically linked, demand paged executable or object module stripped - version 3.13-14 Our programmer wants us to install OpenCOBOL on a total of seven of our development / support machines, which include Linux, HPUX (on both RISC and Itanium), solaris, AIX, and even an ancient NCR/Unix box (not much evolved from SYS-V, we have one banking customer in Europe that refuses to modernize, but keeps renewing support) With all this effort, it may not be cost effective to keep persueing.. If we're having this much trouble getting it to install/work, I can just imagine what a customer would have to go thru to install a run-time package so they could use our product... ---------------------------------------------------------------- Well I downloaded and installed GNU make, massaged my PATH to put /sbin at the end, and a 'make' succeeds now !! Running 'make check' and so far all tests are passing... Just goes to show ya, open source tools work best with other open source tools (or at least GNU tools)... If all the tests pass, I'll do a 'make install' and turn the programmer loose on the box to test... ---------------------------------------------------------------- Good to know. Take care of the possible crash when using SCREEN section or DISPLAY/ACCEPT WITH/AT (I think these are not included in make check). If you have problems there, reconfigure and remake with a newer curses version. Please make a short summary what you've needed to do for each of your systems to get OC running. human ---------------------------------------------------------------- - Yes, programmer requested ncurses also get installed, so I downloaded & isntalled gnu-ncurses. Here's a list of what all I had to do to get OpenCobol 1.1 installed & working on Dec-UNIX - Tru64 Unix V5.1B-4 B27 Patch Kit 6 8-32-2007 running on an AlphaServer 4000: 1. Downloaded & installed gnu-gmp package. 2. ran './configure CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib --without-db' 3. downloaded & installed gnu-make into /usr/local/bin/. 4. Adjust my PATH so the gnu make was found/used before native make. 5. Ran 'make', then 'make test', then 'make install' ---------------------------------------------------------------- Hi I have just installed 1.1 prerelease on a ubuntu 11.4 version (installed into a virtual vmware box). I got the same trouble also invoking the .configure CFLAGS... and so on arguments.. Is there a specific trouble installing 1.1. with 11.4 version ? Thanks in advance for your help. Federico ---------------------------------------------------------------- The one Linux environment I installed OC in (CentOS 4.6) went pretty smooth, I did not have to play any path games or any thing else, just basically make, make check, then make install.... ---------------------------------------------------------------- I solved by installing (usig ubuntu) the gmp library with this command: sudo apt-get install libgmp3-dev Federico ---------------------------------------------------------------- Subject: Linux guru level help request, /proc/kcore [SOLVED] I was mucking about with the information exposed by the /proc virtual directory. Umm, /proc/kcore is 140737486266368 ... I wish I had that many donuts. Using a code block to align things... [code] man proc documents it as physical ram + 4k. I would have guessed something closer to 4,000,000,000 (maybe 10 gig if swap is counted), not 140,737,486,266,368 [/code] Can anyone explain why I'm seeing this value off by 5 orders of magnitude? Am I missing a signed conversion or some such under 64bit Linux? An over zealous Vmem setting? I'm about to reboot and see what the next live value is, but wouldn't it be nice to be running a 140 terabyte home machine. ;) Thanks to anyone that can shed light...[i]and don't worry too too much, I'm not yet, and if I do get worried I'll ask on some other linux-ey forums.[/i] By the way ... if you haven't, checkout [code] $ cat /proc/cpuinfo $ cat /proc/version [/code] it beats [b]uname[/b] at getting your system info by a mile and a half. Cheers, Brian [b]Edit; Nevermind.[/b] 64 bit Linux kernels list this as 128TB by design intent. ---------------------------------------------------------------- Subject: Compile error on zLinux When I try to run ./configure for OC on zLinux I get an error that gmp.h is required, even though gmp 4.2.3 is already installed. So I tried to configure gmp 4.2.3 from source but the 'make test' gives an error 'libgmp.so undefined reference to 'sdiv_qrnnd' How can I get gmp.h and are there any zlinux binaries for OC? Ron ---------------------------------------------------------------- 'human' helped me with the same error, His suggestion worked for me: he said: guess only /usr/include is used by default on your system. Try to use something like ./configure CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ---------------------------------------------------------------- If you have libgmp in a nonstandard directory you need to set LD_LIBRARY_PATH before running OC-Progs (what is done in make check). Do something like [code]export LD_LIBRARY_PATH=/opt/myspeciallibdir:$LD_LIBRARY_PATH[/code] before make check and before cobcrun in general. human ---------------------------------------------------------------- If you mean libgmp.so, I have it in /usr/lib64. I tried export LD_LIBRARY_PATH=/usr/llib64:$LD_LIBRARY_PATH but the configure still gives ther same error checking gmp.h usability... no checking gmp.h presence... no checking for gmp.h... no configure: error: gmp.h is required ---------------------------------------------------------------- OK, for make check (and running OC later) you need a correct LD_LIBRARY_PATH: [code]export LD_LIBRARY_PATH=/path/to/gmp/libs:$LD_LIBRARY_PATH[/code] and you have to give configure the correct paths, elsewise it is not able to pass them to the C-compiler (gmp.h) and to the linker (libgmp): [code]./configure CFLAGS=-I/path/to/gmp/ includes LDFLAGS=-L/path/to/gmp/libs[/code] The first thing is to find these two paths and do the export and configure. Then run make and make check in your opencobol folder. If you want to use OC outside of your opencobol folder you have to do make install afterwards (and use --prefix= during configure if you want to install it in a special folder). human ---------------------------------------------------------------- If you are using SLES on zSeries check that you have a gmp-devel package this package should bring /usr/include/gmp.h /usr/lib64/libgmp.so http://www.novell.com/products/linuxpackages/server10/sp1/s390x/gmp-devel.html ldconfig should make aware yours system of all librarys and their paths Hope that this help. ---------------------------------------------------------------- Yes, the gmp-devel package was missing, all is well now. I also had to do ldconfig /usr/local/lib for the compiles. Just an unrelated question, is it possible to read in EBCDIC data into the openCOBOL program on z/Linux without having to convert it to ASCII. This might be helpful for us as the data has Arabic characters and also packed fields etc which might cause a problem if they are converted. ---------------------------------------------------------------- Completely new topic, open a new thread for this (if there isn't any opend yet). human ---------------------------------------------------------------- Subject: libcob: Cannot find module I am trying to call one cobol program from another. But getting "libcob: Cannot find module" error. Here is the code what I am trying to run: I compiled both sample1.cob and sample2.cob with cobc -v -x sample1.cob cobc -v -x sample2.cob Here is my output while running sample1 $ sample1 I am in the first program... libcob: Cannot find module 'sample2' $ Any help, please? [code]sample1.cob IDENTIFICATION DIVISION. PROGRAM-ID. sample1. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 ws-pgms PIC X(10). PROCEDURE DIVISION. BEGIN-PGM. display 'I am in the first program...'. move "sample2" to ws-pgms. call ws-pgms. display 'I am out of sample2'. exit. [/code] [code]sample2.cob IDENTIFICATION DIVISION. program-id. sample2. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 ws-reply PIC X(10). PROCEDURE DIVISION. BEGIN-PGM. display "I am in the second program...". exit. [/code] ---------------------------------------------------------------- As you didn't post what cobc-commands you've used we cannot help you. If you've just compiled with cobc (no additional params) and started sample1 with cobcrun sample1 all would've worked. If you want help tell us how you've compiled these progs and how you've started the COBOL runtime. human BTW: Please use code tags for posting source. There is a <> button in post/edit mode for that, it would be good to try this via editing your first post. ---------------------------------------------------------------- Hi, Thank you very much for your reply. I edited the original post. I tried with cobcrun and it worked. Thanks for your help. ---------------------------------------------------------------- OK. You can use cobc -x for the starting COBOL program if you like to, but the called modules have to be in module format (no -x). If you need to have to COBOL progs compiled with -x you can try to call them via call "SYSTEM" (see the FAQ). human ---------------------------------------------------------------- Just to add; The cobc is one powerful compiler command. ;-) [code] cobc -x sample1.cob sample2.cob [/code] Will build all the object files into the executable, sample1. [code] $ cobc -v -x sample1.cob sample2.cob preprocessing sample1.cob into /tmp/cob2815_0.cob preprocessing sample2.cob into /tmp/cob2815_1.cob translating /tmp/cob2815_0.cob into /tmp/cob2815_0.c gcc -pipe -c -I/usr/local/include -Wno-unused -fsigned-char -Wno-pointer-sign -o /tmp/cob2815_0.o /tmp/cob2815_0.c translating /tmp/cob2815_1.cob into /tmp/cob2815_1.c gcc -pipe -c -I/usr/local/include -Wno-unused -fsigned-char -Wno-pointer-sign -o /tmp/cob2815_1.o /tmp/cob2815_1.c gcc -pipe -Wl,--export-dynamic -o sample1 /tmp/cob2815_0.o /tmp/cob2815_1.o -L/usr/local/lib -lcob -lm -lgmp -lncurses -ldb -ldl $ ./sample1 I am in the first program... I am in the second program... I am out of sample2 [/code] cobc will do the right thing when all the files are passed in one "compile pass". The files named can be COBOL, C, or object. Shared libraries will need -l / -L or use of COB_PRE_LOAD. See http://opencobol.add1tocobol.com/#what-is-cob-pre-load and http://opencobol.add1tocobol.com/#does-opencobol-support-modules for some details. Why does this work? Roger smart, he haz cheezeburgerz. :-) [i]Might as well mention the other brain behind the scenes too, Keisuke Nishida[/i]. Cheers, Brian ---------------------------------------------------------------- Thanks Brian. Could able to compile and run without any issues. Cheers to Roger and others. :-) ---------------------------------------------------------------- Subject: A Fossil is in the offing [two up now] [b]Edit:[/b] An experimental (but production grade) Fossil is now being hosted at http://fossile.plpwebs.com:8080/ocweb (for HTTP and TCP/IP extension experiments) and another at http://fossile.plpwebs.com:8080/ocfaq (for general information and a copy of the OpenCOBOL FAQ sources) ===== Just successfully tested a Fossil distributed repository on a DreamHost server. Real soon now. Hopefully by February 7th, I'll take requests for access permissions and we can start some collaborative projects. Posting early (a) because I'm impatient when I get the rave on, and (b) so anyone that may feel inclined, can get to http://www.fossil-scm.org/ and prep their own fossil executables. Dirt simple. Download the tar ball and make. (Or cheat and snag a pre-built). Dr. Hipp uses very portable C and the dependencies are minimal. You end up with one binary and a self contained file per project. Sweeet. But you will need to build a binary if you want to clone out projects and play on your desktop machine. [i]As part of the rave; From wget of the Fossil source, through make to running a configured server, and a successful pull/push, 4 minutes. Four minutes. Paint me impressed.[/i] How great will it be to have dinosaur COBOL source code forever fossilized, running well into the 3rd millennium. Hey, why not even imagine some poor sod faced with y10k issues and wondering why things aren't as simple as they used to be, way back at the dawn of the computer era. ;-) Cheers, Brian ---------------------------------------------------------------- Bumping my own announcement. The ocweb fossil is now accessible under httpd at http://fossile.plpwebs.com/ocweb.cgi That'll mean it'll be up as close to 24/7 as DreamHost is. There may be one last change, as I get better at playing with the subdomain and the ocweb.cgi may be a redirect from index.html soon. Umm, and maybe I'll get someone to correct the spelling of fossil in the subdomain, someday. If anyone cares...this is how hard it was [code] #!/home/me/bin/fossil repository: /home/me/fossils/ocweb.fossil [/code] Where the [i]me[/i] is a user account that I don't feel like publishing. Work on some form of [b]ACCEPT var FROM HTTP-POST identifier[/b] support in cobc will resume soon. This might be straight up C, or it might rely on libcurl or libwww and we get a boat load of power for cheap with the small addition of a dependency to a compiler build. It'll open up a network aware compiler with relatively very little effort. SELECT ddname ASSIGN TO "http://example.com/myresource" anyone? Straight up C, while not impossible to support all the ubiquitous protocols, would take a little more testing and debugging. Cheers, Brian ---------------------------------------------------------------- What do you think of a vbisam fossil? I'd upload my current work version there... just give me a fossil and a HowTo... human ---------------------------------------------------------------- If you folks want a domain name let me know and I will set it up and btiffin can move it over. damon ---------------------------------------------------------------- I think a vbisam fossil is a grand idea. Drop me a pm and I'll give you an admin password and a HowTo. I'm writing it up in Latex, so the real HowTo won't be done for a few hours. The fossil setup is a few minutes, then a few more to make the homepage all nicey nice. The "for now" HowTo; You'll need to snag a fossil binary for local work. See http://www.fossil-scm.org/download.html and grab a copy that suits. The source tarballs are extremely friendly. Once you get a password it'll be [code] fossil clone http://you:yourpass@fossile.plpwebs.com/ocvbisam.cgi yourreponame fossil open yourreponame fossil add sourcetree fossil commit -m "Initial checkin" [/code] Then you can go in and tweak the plpwebs homepage as you see fit. In particular, if you don't like auto-sync then tweak that early. But it'll mean an explicit [code] fossil sync or fossil push [/code] when you want to distribute commits. I like the auto-sync feature, but it's a personal preference. [i]Write down the password that the fossil clone command outputs, so that you can manage your own local repository file remotely, if needed, before you get a chance to set a sane password from the local web admin panel or the [b]fossil user password[/b] command line option.[/i] More real soon. Back to some LaTeX. Cheers, Brian ---------------------------------------------------------------- I've posted another fossil, at http://fossile.plpwebs.com/ocsamples.cgi So far it only has the Falcon embedding in OpenCOBOL how-to, but I'll be adding a lot more over the next few days. If you log in anonymously, you can click Files, hit the [9fde280654] link, and you'll get a screen that let's you download a Zip archive of that source tree. Cheers, Brian ---------------------------------------------------------------- You are now able to self register. Enjoy this new repository for your work. You still must get the original openCOBOL source from it's usual place. The fossil is not meant to replace OpenCOBOL. Cheers Damon [i]Moderator edit: Removed some spam, and this post was a child. Original by damonh. Apologies to Damon.[/i] ---------------------------------------------------------------- Note to anyone that may have cloned any of the fossils at http://fossile.plpwebs.com The server side was recently updated to the release of 2011-05-28 18:51:22, and the repositories rebuilt. This upgrade includes what is called an [url=http://www.fossil-scm.org/fossil/event/a1f9f17b6]irreversible schema change[/url] by Dr. Hipp. Click the link to read his explanation. This should be a rare event, but you will need to [b]fossil rebuild thefossil[/b] where [i]thefossil[/i] is your local fossil database, after installing a fossil binary dated after 2011-05-12. Apologies for the inconvenience, but [i]you can't stop progress[/i]. On the upside, I'm revisiting ACCEPT var FROM HTTP-POST, but I'm going to start a thread on how this experiment should be named. Cheers, Brian ---------------------------------------------------------------- Subject: DreamHost and other shell account hosting Well I had a chance to muck around in a DreamHost shell today. Have cobc 1.1pre-rel built with bdb 4.5, ncurses and gmp that can compile binaries that DO NOT need LD_LIBRARY_PATH set. The trick is [b]LD_RUN_PATH[/b] at compile time. This is on DreamHost Given [code] identification division. program-id. hello. procedure division. display "Hello" at 1111 end-display call "CBL_OC_NANOSLEEP" using 1000000000 end-call goback. [/code] and [code] ~/lang/cobol$ cobc -x hello.cob ~/lang/cobol$ ./hello ./hello: error while loading shared libraries: libcob.so.1: cannot open shared object file: No such file or directory ~/lang/cobol$ LD_RUN_PATH=~/usr/local/lib cobc -x hello.cob ~/lang/cobol$ ./hello ~/lang/cobol$ echo $LD_RUN_PATH [/code] A black screen, white text at line 11 col 11 shows up, then a one second pause and Bob's your uncle. The run path was only set while the compiler was running, due to the way the shell lets you set env vars before it parses a command. So, these executables are safe to go in cgi-bin directories while enjoying a full on 1.1pre-rel OpenCOBOL program feature set. [code] ~/lang/cobol$ cobc --version cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Feb 05 2011 20:35:04 Packaged Feb 06 2009 10:30:55 CET [/code] The LD_RUN_PATH, set during compile time builds the binary with the -rpath (RECORD PATH) built into the executable. So no more need to run CGI programs through wonky scripts to get environment settings. Just set the LD_RUN_PATH at compile time. Thought some of you might like to know. ;-) Build history (with typos and a few experiments redacted) went like [code] 195 w3m gmplib.org 198 tar xvf gmp-5.0.1.tar.bz2 199 cd gmp-5.0.1 200 ./configure --prefix=/home/btiffinoc/usr/local 201 make 202 make check 203 make install 286 wget http://download-east.oracle.com/berkeley-db/db-4.5.20.tar.gz 287 tar xvf db-4.5.20.tar.gz 288 cd db-4.5.20 289 ls 290 cd build_unix/ 291 ls 292 ../dist/configure --enable-compat185 --prefix=/home/btiffinoc/usr/local 293 make 294 make install 306 wget http://www.sim-basis.de/open-cobol-1.1.tar.gz 307 tar xvf open-cobol-1.1.tar.gz 308 cd open-cobol-1.1 309 export CPPFLAGS=-I/home/btiffinoc/usr/local/include 310 export LDFLAGS=-L/home/btiffinoc/usr/local/lib 478 export CFLAGS='-Xlinker -rpath=/home/btiffinoc/usr/local/lib -L/home/btiffinoc/usr/local/lib' 479 ./configure --prefix=/home/btiffinoc/usr/local --with-gnu-ld 480 make check 483 export LD_RUN_PATH=/home/btiffinoc/usr/local/lib 484 make check 485 make install 486 unset LD_RUN_PATH [/code] Then the above hello.cob test. So, setting LD_RUN_PATH lets OpenCOBOL's make check succeed, as well as later cobc program that we can write up. [i]To be honest, I'm not sure if the -Xlinker -rpath=... really had any influence. But it worked, and I left it in this screen cut-n-paste[/i] On line 195 of the history, while running w3m, I just had to hit the 'a' key over the Download link to start the download of the GNU Multi Precision bignum library. The make check on line 480 failed miserably, the one on line 484 worked the charm. And this DreamHost shell already had the ncurses (with dev headers) installed. We can now build and install the compiler (and its dependencies) without super user powers on hosting services. Then compile programs (with developer environment variable settings) that will run WITHOUT special environment variable settings. As this is an early, all excited post, there may be some simplifications to the build. (I have to experiment with the -Xlinker CFLAGS setting. I think it's useless.) And the choice of $HOME/usr/local is just a convention. You can ./configure --prefix= to wherever you like, as long as the LD_RUN_PATH is set to find the shared libraries when you compile. Also, please note; If you build a program with anything above bdb 1.85 (The last SleepyCat release, with a different license) then you need to provide source code to meet the newer license requirements. That responsibility would hold for CGI programs on hosting services, yada yada. Cheers, Brian ---------------------------------------------------------------- Fandangtastic! Thanks btiffin! Once you startup the fossil server again we can get that into the wiki. This is exciting. I am currently trying to get MySQL stuff to work on DH and will probably be calling on you with questions. I WILL figure this out. But, with bdb working that makes ISAM files more desirable. Need to play around with OCwebkit for DH and update it for the route you took. ---------------------------------------------------------------- Excuse a little bit of thread drift... two topics at once http://fossile.plpwebs.com:8080/ocweb should be running all the time now. (We may want to choose a prettier URL someday). Perhaps I'll post up the ocfaq fossil sooner rather than later for items like DreamHost building. The ocweb project, (in my opinion) should focus on HTTP and TCP/IP extensions. [i]As a heads up, it'll likely be http://fossile.plpwebs.com:8080/ocfaq [/i] and it'll run out of the same server. We can plan a little and discuss, but each project (or class of project, e.g. embedding scripting engines) should get a fossil. The OpenCOBOL Comprehensive Archive Network can then be the master of select fossils, which are really just simple accessor links, as well as other file stashing along with a nicey nice OpenCOBOL desktop app for indexing, downloading and other goodies. One problem to avoid is multiple copies of any of the source code. All the projects I foresee on DreamHost can (and should) be sectioned off from each other. Cheers, Brian ---------------------------------------------------------------- 1. Let me know the url. If you want maybe I can setup a poll with a list of urls. The highest votes gets it. 2. Since it is up are you going to open it up for registration? 3. What are the guidelines? I understand that we are not FORKING OC but providing a much needed repository for other projects involving OC. 4. How about a Dummies guide? I tried to get a clone going yesterday and failed. Cheers Damon ---------------------------------------------------------------- For gmp: [code]wget http://ftp.gnu.org/gnu/gmp/gmp-5.0.1.tar.bz2 [/code] Also I had trouble with the bdb link in btiffin's log. Here is a site with mirrors: [code]http://www.filewatcher.com/m/db-4.5.20.tar.gz.9281894.0.0.html[/code] and here is my OpenCOBOL configuration [code] OpenCOBOL Configuration: CC gcc COB_CC gcc CFLAGS -Xlinker -rpath=/home/testoc/usr/local/lib -L/home/testoc/usr/local/lib -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k COB_CFLAGS -I/home/testoc/usr/local/include -I/home/testoc/usr/local/include -Xlinker -rpath=/home/testoc/usr/local/lib -L/home/testoc/usr/local/lib COB_EXTRA_FLAGS LDFLAGS -L/home/testoc/usr/local/lib COB_LDFLAGS -L/home/testoc/usr/local/lib COB_LIBS -L/home/testoc/usr/local/lib -L${exec_prefix}/lib -lcob -lm -lgmp -lncurses -ldb COB_CONFIG_DIR ${prefix}/share/open-cobol/config COB_COPY_DIR ${prefix}/share/open-cobol/copy COB_LIBRARY_PATH ${exec_prefix}/lib/open-cobol COB_MODULE_EXT so COB_SHARED_OPT -shared COB_PIC_FLAGS -fPIC -DPIC COB_EXPORT_DYN -Wl,--export-dynamic COB_STRIP_CMD strip --strip-unneeded Dynamic loading System Use gettext for international messages: yes Use Berkeley DB for file I/O: yes Use enhanced Berkeley DB (>= 4.1) yes Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: yes [/code] **************************** After all that I tried the example for STATIC COBOL to C as found here: [code] http://www.opencobol.org/modules/bwiki/index.php?cmd=read&page=UserManual%2F2_3#content_1_0 [/code] Here is the result: STATIC [code]testoc@ernieball:~/mysql$ cobc -c -static hello.cob testoc@ernieball:~/mysql$ cobc -x -o hello hello.o say.o /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' collect2: ld returned 1 exit status[/code] SHARED: [code]testoc@ernieball:~/mysql$ cc -shared -fPIC -o say.so say.c testoc@ernieball:~/mysql$ cobc -x -o hello hello.cob testoc@ernieball:~/mysql$ export COB_LIBRARY_PATH=. testoc@ernieball:~/mysql$ ./hello ./hello: error while loading shared libraries: libcob.so.1: cannot open shared object file: No such file or directory[/code] So by setting up the LD_RUN_PATH [code]export LD_RUN_PATH=/home/btiffinoc/usr/local/lib [/code] and recompiling the dynamic I get: [code] testoc@ernieball:~/mysql$ ./hello Hello World! [/code] ---------------------------------------------------------------- [quote] 1. Let me know the url. If you want maybe I can setup a poll with a list of urls. The highest votes gets it. 2. Since it is up are you going to open it up for registration? 3. What are the guidelines? I understand that we are not FORKING OC but providing a much needed repository for other projects involving OC. 4. How about a Dummies guide? I tried to get a clone going yesterday and failed.[/quote] 1. For now the URLs will all be rooted off of http://fossile.plpwebs.com:8080/ with ocweb and ocfaq defined. The cool thing with Fossil is that we can move these as things evolve as a single file copy and then those that have clones with push privs just need to execute [code]fossil remote-url [the new url][/code] 2. Done. (for ocweb). Click the "create one" to register a Reader account. Reader gets clone and ticket create permissions. Those developers that want to dig in and play, can send me a note here for now, or ask on the add1.to irc.mibbit.net IRC channel and we'll get the Developer bit turned on. 3. To Be Determined. And will require a fair amount of discussion and planning. Until those rules get posted up, I'd warn everyone that is an experiment and could explode. Or we could accidentally discover the next big thing. 4. That will come hand in hand with #3. Once we come to grips on how this should flow, I'd like to keep Developer access limited. But as a hint for now, when you clone as a Developer... [code] $ mkdir workingdir $ cd workingdir $ fossil clone http://username:userpass@fossile.plpwebs.com:8080/ocweb myrepo.fossil [/code] to carry through proper push to central privs. If you change your password, then [code] $ fossil remote-url http://username:newpass@fossile.plpwebs.com:8080/ocweb [/code] Then when you have a local [b]myrepo[/b] file (I usually use a .fossil extension) use [code] $ fossil open myrepo.fossil [/code] which will create a _FOSSIL_ file. You can fossil close, but there isn't really any point until you want to copy the entire repo to some other location. Another hint, if you do copy your repo to someone, [i]fossil scrub[/i] it first. This safely removes security info such as passwords. From fossil help scrub:[code] By default, only passwords are removed. However, if the --verily option is added, then private branches, concealed email addresses, IP addresses of correspondents, and similar privacy-sensitive fields are also purged. [/code] We'll add to that guide as things gel and place a link on the home pages of the projects. Cheers, Brian ---------------------------------------------------------------- Subject: OpenCOBOL & MongoDB I was studying the RDBMS [b]MongoDB[/b] named. I noticed he has a lot of the DB, but supports TCP / IP. In addition to several advanced features. One point is that it could be adapted to work with OpenCobol, replacing (additional support) to the current DB. In addition to having support for multi-users, it presents the same model NoSQL DB. [size=medium][color=000099] [b]Anybody's interest to help make OpenCobol to work natively with MongoDB? [/b] :-) [/color][/size] ---------------------------------------------------------------- Welcome to oc.o Willian; And yeah, I'm kinda keen. See http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1239&forum=1 for a post I made a few weeks ago. We have Fossil running on DreamHost now, and we'll be formalizing a way to request push/pull credentials. A MongoDB project seems like something we could collaborate on. http://fossile.plpwebs.com:8080/ocweb is the first project posted. There will be fossils for other project soon. In particular, I'm keen on formalizing an embedded Guile Scheme interpreter. The OpenCOBOL source code system has ./configure options for [code] --with-seqra-extfh (OpenCOBOL) Use external SEQ/RAN file handler --with-index-extfh (OpenCOBOL) Use external ISAM file handler [/code] So we shouldn't even have to muck around in the core source code to get this running. Umm, but I've never actually spent the time to figure EXTFH out. It's a feature that Fabrizio Calabretta is listed in the THANKS file for assisting with. [i]As an aside, I have a layer to embed the SpiderMonkey javascript engine in OpenCOBOL. If the MongoDB js engine is open source, we can probably embed it along with mongo and score a bit of a two-fer.[/i] The first Fossil collaboration site was only brought up yesterday, so it'll likely be a week before we get a push/pull credential request system perfected. [i]Willian, as you may be new here, one of my favourite things in life is extending OpenCOBOL. Whether anyone else cares for the feature or not is secondary.[/i] ;-) Cheers, Brian ---------------------------------------------------------------- Subject: Anyone up to writing a tutorial? I've set up a hosted Fossil for OpenCOBOL faq related information. As the subject says, anyone up for writing some tutorial information to augment Gary's awesome Programmer's Guide http://opencobol.add1tocobol.com/OpenCOBOL%20Programmers%20Guide.pdf and the FAQ? I'll be adding a document to explain how to compile OpenCOBOL 1.1pre-rel on DreamHost to the http://fossile.plpwebs.com:8080/ocfaq fossil wiki. If you feel up to it, that being writing some helper files, snag a copy of Fossil http://www.fossil-scm.org and then drop me a PM here on the oc.o (opencobol.org) forum and I'll get you push/pull credentials for the repository and/or write privs to the wiki. The more the merrier. Cheers, Brian ---------------------------------------------------------------- Brian, what do you have in mind relative to tutorials? What kind of source code would you like to have posted? How do we PM you on this forum (forgive me if this is obvious but I am a command-line type) :-) jimc ---------------------------------------------------------------- Hi Jim. I have an outline of a series of video tutorials. One of them would be about the compiler and the different options. But moving forward I wanted to go from the ground up. Basic to complex in building a complete COBOL application. Such as a DVD library application. At least that is my thinking. I also know that aoirthoir has discussed with me a Head First type of tutorial. I am currently working on the first set. Installing OpenCOBOL on Ubuntu Desktop 10.04. I will post it when it is completed. Cheers. Damon ---------------------------------------------------------------- PM in this forum: 1. Log in 2. Click on a user name (you get the user information screen) 3. Click on the PM button See your PMs, possibility 1: 1. Log in 2. Click on your user name (you get to your user information screen) 3. Click on Inbox See your PMs, possibility 2: 1. Log in 2. Click on Home 3. Click on Inbox (can be found at the right side and is highlighted if you received new PMs) PMs can be answered and deleted there. human ---------------------------------------------------------------- What did I have in mind? Quick Start OpenCOBOL Using COBOL in the Internet Age Umm, How to use OpenCOBOL to Eradicate Pestilence in 21 Days. :-) The one I have on my plate is transaction processing; the whole MASTER-FILE, INPUT-FILE, detail/error report thing (with OC's current LINAGE support for summary reporting). [i](So far, there isn't any C code in the examples, and just a wee-bit of shell).[/i] Cheers, Brian ---------------------------------------------------------------- Subject: ASSIGN TO RANDOM ... Hi, i was working with AcuCobol for a long time and this syntax is allowed SELECT MYFILE ASSIGN TO RANDOM F-ID-MYFILE ACCESS MODE IS DYNAMIC RECORD KEY KEY-MYFILE FILE STATUS STAT-MYFILE RANDOM is identical to DISK Greetings ---------------------------------------------------------------- Nice to know, but do you really just want to tell us that this was working with AcuCobol? If you want to add this to the compiler: Hack parser.y (should be no problem in this case as one has just to add RANDOM to the DISK clause), compile parser.y with bison and recompile OC. Edit: OK, it's not that easy because RANDOM is reserved from COBOL 2002 on for the ACCESS IS clause. You may have to have a deeper look if you want to add this. BTW: What is the problem in changing RANDOM to DISK in your sources? human ---------------------------------------------------------------- human, thanks; I don't know if was difficult or not change the parser. I can change my sources no problem. I think this change or addon, could improbe opencobol. Greetings. ---------------------------------------------------------------- Invalid - see http://microfglobal.http.internapcdn.net/MicroFGlobal/supportline/docs/acu/900/docs/wwhelp/wwhimpl/js/html/wwhelp.htm Roger ---------------------------------------------------------------- Seems valid. Enter "File-Control Paragraph" in search and open 4.3.1 [quote]Device must be one of these words: INPUT, OUTPUT, INPUT-OUTPUT, RANDOM, DISK, DISC, PRINT, PRINTER, PRINTER-1, TAPE, CASSETTE, CARD-PUNCH, CARD-READER, CONSOLE, MAGNETIC-TAPE, DISPLAY, KEYBOARD, SORT, MERGE, SORT-MERGE or SORT-WORK. The last four may be used only with sort files. [/quote] and later on [quote]The device phrase of the ASSIGN clause is not required. If it is specified, it can affect the processing of the file in a variety of ways. If the file is not a sequential file, then the device phrase is ignored. If it is a sequential file, then the following applies depending on the device phrase used: [...] 4. RANDOM, DISK, DISC, TAPE, CONSOLE - Indicates no additional processing. This is the same as if the device phrase were omitted. [/quote] human ---------------------------------------------------------------- Subject: Wish List Hey folks. My father is an old COBOLer from the early 70's. I turned him onto OC and he is very happily trying to convert all his old Realia source over. He just sent me an email of a wish list and I am posting it. ---------------------------------------- I have a few suggestions for addition to OpenCobol. I expect they would be implemented as separate functions (to be CALLed). I hope the boys are open to suggestions... [code] 1. Keyboard_Status 01 KbdStatus pic x(001). 88 KeyAvailable value high-value. 88 NoKeyAvailable value low-value. If at least one key is available, Kbd_Status returns high-value; no key available, low-value is returned. 2. Scan_Keyboard pic 9(002). Returns a count of buffer contents (leaving buffer intact). 3. Get_Cursor_Line_Column pic 9(004). *> 99 line 99 col Set_Cursor_Line_Column pic 9(004). *> 99 line 99 col 4. Key_Pressed pic 9(004). *> Returns Numeric of key pressed. or Key_Pressed pic x(001). *> Returns Hex of key pressed. 5. Set_Ctrl_Break_On / Set_Ctrl_Break_Off --- Y/N 6. Change_Cursor_Character, x' ' WingDing???? 7. Read_Screen_Byte_With_Attribute --- NON-DESTRUCTIVE Currently, when 'accept at line x col x', Contents of line x col x are DESTROYED!!! (Even with option UPD [/code] ---------------------------------------------------------------- Damon, As a quick cop-out answer, if your dad is ok with CALL; we get _nc_free_and_exit _nc_freeall _nc_tracebits _traceattr _traceattr2 _tracechar _tracechtype _tracechtype2 _tracedump _tracef _tracemouse add_wch add_wchnstr add_wchstr addch addchnstr addchstr addnstr addnwstr addstr addwstr assume_default_colors attr_get attr_off attr_on attr_set attroff attron attrset baudrate beep bkgd bkgdset bkgrnd bkgrndset border border_set box box_set can_change_color cbreak chgat clear clearok clrtobot clrtoeol color_content color_set copywin curs_set curses_version def_prog_mode def_shell_mode define_key del_curterm delay_output delch deleteln delscreen delwin derwin doupdate dupwin echo echo_wchar echochar endwin erase erasechar erasewchar filter flash flushinp get_wch get_wstr getattrs getbegx getbegy getbegyx getbkgd getbkgrnd getcchar getch getcurx getcury getmaxx getmaxy getmaxyx getmouse getn_wstr getnstr getparx getpary getparyx getstr getsyx getwin getyx halfdelay has_colors has_ic has_il has_key hline hline_set idcok idlok immedok in_wch in_wchnstr in_wchstr inch inchnstr inchstr init_color init_pair initscr innstr innwstr ins_nwstr ins_wch ins_wstr insch insdelln insertln insnstr insstr instr intrflush inwstr is_cleared is_idcok is_idlok is_immedok is_keypad is_leaveok is_linetouched is_nodelay is_notimeout is_scrollok is_syncok is_term_resized is_wintouched isendwin key_defined key_name keybound keyname keyok keypad killchar killwchar leaveok longname mcprint meta mouse_trafo mouseinterval mousemask move mvadd_wch mvadd_wchnstr mvadd_wchstr mvaddch mvaddchnstr mvaddchstr mvaddnstr mvaddnwstr mvaddstr mvaddwstr mvchgat mvcur mvdelch mvderwin mvget_wch mvget_wstr mvgetch mvgetn_wstr mvgetnstr mvgetstr mvhline mvhline_set mvin_wch mvin_wchnstr mvin_wchstr mvinch mvinchnstr mvinchstr mvinnstr mvinnwstr mvins_nwstr mvins_wch mvins_wstr mvinsch mvinsnstr mvinsstr mvinstr mvinwstr mvprintw mvscanw mvvline mvvline_set mvwadd_wch mvwadd_wchnstr mvwadd_wchstr mvwaddch mvwaddchnstr mvwaddchstr mvwaddnstr mvwaddnwstr mvwaddstr mvwaddwstr mvwchgat mvwdelch mvwget_wch mvwget_wstr mvwgetch mvwgetn_wstr mvwgetnstr mvwgetstr mvwhline mvwhline_set mvwin mvwin_wch mvwin_wchnstr mvwin_wchstr mvwinch mvwinchnstr mvwinchstr mvwinnstr mvwinnwstr mvwins_nwstr mvwins_wch mvwins_wstr mvwinsch mvwinsnstr mvwinsstr mvwinstr mvwinwstr mvwprintw mvwscanw mvwvline mvwvline_set napms newpad newterm newwin nl nocbreak nodelay noecho nofilter nonl noqiflush noraw notimeout overlay overwrite pair_content pechochar pnoutrefresh prefresh printw putp putwin qiflush raw redrawwin refresh reset_prog_mode reset_shell_mode resetty resizeterm restartterm ripoffline savetty scanw scr_dump scr_init scr_restore scr_set scrl scroll scrollok set_curterm set_term setcchar setscrreg setsyx setterm setupterm slk_attr slk_attr_off slk_attr_on slk_attr_set slk_attroff slk_attron slk_attrset slk_clear slk_color slk_init slk_label slk_noutrefresh slk_refresh slk_restore slk_set slk_touch standend standout start_color subpad subwin syncok term_attrs termattrs termname tgetent tgetflag tgetnum tgetstr tgoto tigetflag tigetnum tigetstr timeout touchline touchwin tparm tputs tputs trace typeahead unctrl unget_wch ungetch ungetmouse untouchwin use_default_colors use_env use_extended_names use_legacy_coding vid_attr vid_puts vidattr vidputs vline vline_set vw_printw vw_scanw vwprintw vwscanw wadd_wch wadd_wchnstr wadd_wchstr waddch waddchnstr waddchstr waddnstr waddnwstr waddstr waddwstr wattr_get wattr_off wattr_on wattr_set wattroff wattron wattrset wbkgd wbkgdset wbkgrnd wbkgrndset wborder wborder_set wchgat wclear wclrtobot wclrtoeol wcolor_set wcursyncup wdelch wdeleteln wecho_wchar wechochar wenclose werase wget_wch wget_wstr wgetbkgrnd wgetch wgetn_wstr wgetnstr wgetstr whline whline_set win_wch win_wchnstr win_wchstr winch winchnstr winchstr winnstr winnwstr wins_nwstr wins_wch wins_wstr winsch winsdelln winsertln winsnstr winsstr winstr winwstr wmouse_trafo wmove wnoutrefresh wprintw wredrawln wrefresh wresize wscanw wscrl wsetscrreg wstandend wstandout wsyncdown wsyncup wtimeout wtouchln wunctrl wvline wvline_set "for free" with the ncurses library. For all the deets, man ncurses, which leads to the man pages describing all these functions. [b]Note:[/b] Of course using these functions willy-nilly could well bork the compiler's expectations when dealing with advanced ACCEPT and DISPLAY operations, so "caveat amplificator", developer beware. For some advanced keyboard and keyboard buffer control, see http://opencobol.add1tocobol.com/#can-opencobol-interface-with-s-lang. And not to forget Warren's contributions http://opencobol.add1tocobol.com/#what-is-cobcurses (a very powerful kit that was written before OC got SCREEN SECTION support) Cheers, Brian ---------------------------------------------------------------- I kind of dislike direct curses calls... Think of possible frontend changes (in the wide future) to other libraries (GTK, Java, HTML, whatever). For 3. some quotes [quote]ACCEPT xxx FROM LINES. ACCEPT yyy FROM COLUMNS. Roger[/quote] Possible extension: [quote][...] CURSOR [IS] in SPECIAL NAMES? See http://supportline.microfocus.com/documentation/books/nx60/lhpdf205.htm[/quote] Is this wish list rooted in mind or in extensions from other COBOL vendors? If these are existing extensions somewhere else please provide docs to them: It's nice if OC supports extensions (where possible), it's not that nice if we come up with a complete new extension where there are existing ones (that we don't support). If 7. is a bug report please open a new thread for it providing sample code and expected results. human ---------------------------------------------------------------- Subject: OC support for the enterprise We are planning to migrate from MF cobol to OC 1.1 We had POC OC on both HP-UX and Linux, works fine. Thanks to all the support from the forum and prompt response. As this will be rolled out to production, we were wondering is there paid annual support model from the community. Please advise. If so whom do I reach out to. ---------------------------------------------------------------- We have discussed this in the past. I'm a volunteer at heart, so my business savvy would likely sink most companies. ;) But there are others that have business models in mind and given this carrot, might step up as a business leader and lead those of us with some tech savvy into a cohesive unit with a high chance of success. I know I'd relish a chance to put in some hours in a support/development role and would feel honoured to work with many of the OpenCOBOL community members. But again, I'm also wise enough to realize that I'm too nice to play the business man game and win. I'm here to scratch itches and for the fun. :-) I try and advocate the product with the hope that [i]others[/i] will feel confident to take on the serious business role. In my humble opinion, OpenCOBOL is eminently suited to serious business [i](with the immeasurable benefit of freedom and openness)[/i]. Visit http://add1tocobol.com and then hang out in the irc.mibbit.net #add1.to IRC channel and ask there (you can click the Chat menu link for a web interface). I have a lot of respect for most of the regulars, both from a technical and business savvy perspective. Cheers, Brian ---------------------------------------------------------------- @balbab: I think it highly depends on what you understand by "annual support model" (as "paid" is clear). Keep in mind that [quote]This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."[/quote] Do you think of: - Hotline (mail and/or telephone/chat)? - Extensions in the compiler? - COBOL coding for you? - Binaries (if yes for what kind of system)? I know that Roger is willing to do some "stuff", others too, but we need to know exactly what you want. human ---------------------------------------------------------------- Hi. [url=http://www.cobolit.com]CobolIT[/url] is derivated from OC and AFAIK they have support plans. Regards. ---------------------------------------------------------------- ... and annual fees for the compiler, long solved bugs, missing (and additional) extensions, not the community we have here, ... again: I think it's highly depending what is requested as 1) the compiler will stay free 2) there will be no paid version 3) the "other stuff" is possible. human ---------------------------------------------------------------- Of course ! Contact me ! Roger ---------------------------------------------------------------- Thanks for all response. I was looking for support for enterprise in the following terms. 1. Bug fixes and patches related to enterprise platform. 2. Tech support hotline email/chat 3. Any code specific issues related to OC with the implementation. I do understand that compiler is free and so is the community support. When rolling out to enterprise platform, question of product support needs to answered to make solution palatable to management. ---------------------------------------------------------------- balbab, I understand your need to help management become comfortable. While I am not in a position to provide the three types of support that you are looking for, I can offer the following: http://opencobol.add1tocobol.com go to item 1.16.2 in the FAQ also http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=577&forum=1#forumpost3050 We are well at well over 250,000 lines of code now and have found no show-stoppers yet. Once again, I will be happy to talk with someone from your team if you think that it might help. jimc ---------------------------------------------------------------- Subject: Windows manager Hi, I has some experience with ncurses in the past, so, i was looking at libcob/screenio.c and seems not so difficult to change it to support windows. But my problem is how to parse new statements like DISPLAY WINDOW LINE 3 COLUMN 10 LINES 15 SIZE 70 [ BOX ] HANDLER alfanumericvar --> in curses if at initscreen time WINDOW mainframe = newwin(0,0,0,0); then WINDOW alfanumericvar = subwin( mainframe, 15,70,2,9 ); else WINDOW alfanumericvar = newwin( 15, 70, 2, 9 ); now alfanumericvar points to the current window. all subsequents displays and accepts happends in the current window. to close the window in Cobol CLOSE WINDOW alfanumericvar --> in curses werase( alfanumericvar ) or wclear( alfanumericvar ) delwin( alfanumericvar ) now or before exit. Greetings ---------------------------------------------------------------- I'd have a look at the parser but I think screenio.c is not that easy. You have to pass the window handle as optional parameter in DISPLAY/ACCEPT, check this for validity, ... For the COBOL part: Do you have some docs from other vendors with window managers? Are you sure that every curses version supports windows? What should the runtime do if this isn't supported? If you really like to get this forwand we may could work up a patch togehter. You'd have to tweak screenio.c. What do you think of that? human ---------------------------------------------------------------- Hi human, i see that but must be necessary a kind of structure to store the windows handlers (lists, vectors, arrays ). So if you display a window these become the current window, then subsequents displays and accepts happen in this window. Note was desirable doing a specific display in specific window ( UPON WINDOW come here). unix curses support windows/subwindows at least for 10 years for windows system you have pdcurses, and in theory support this for a long time too. so first of all i tweak screenio.c then after some tests you do cobol part? Here the docs: DISPLAY WINDOW creates and displays a subwindow. DISPLAY {SUBWINDOW} {WINDOW } [ UPON new-window ] Remaining phrases are optional, can appear in any order. AT screen-loc AT LINE NUMBER line-num AT {COLUMN } NUMBER col-num {COL } {POSITION} {POS } SIZE length LINES height {ERASE} SCREEN {BLANK} {REVERSE-VIDEO} {REVERSE } {REVERSED } WITH {COLOR } color-val {COLOUR} {FOREGROUND-COLOR } IS fg-color {FOREGROUND-COLOUR} {BACKGROUND-COLOR } IS bg-color {BACKGROUND-COLOUR} {HIGHLIGHT} {HIGH } {BOLD } {LOWLIGHT } {LOW } {STANDARD } {BACKGROUND-HIGH } {BACKGROUND-LOW } {BACKGROUND-STANDARD} BOXED SHADOW [TOP ] [CENTERED] TITLE IS title [BOTTOM] [LEFT ] [RIGHT ] WITH NO SCROLL WITH NO WRAP CONTROL VALUE IS control-val POP-UP AREA IS save-area Syntax Rules 1. Different formats of the DISPLAY statement may be mixed together in one DISPLAY statement, as long as no ambiguity results. The effect is the same as specifying each DISPLAY statement separately. 2. New-window is a USAGE HANDLE or PIC X(10) data item. If used, the UPON phrase must be the first optional phrase specified. 3. Screen-loc is an integer data item or literal containing exactly 4 or 6 digits. It may also be a group item of 4 or 6 characters. If a numeric item is used, it must be a non-negative integer. 4. Line-num, col-num, length, and height are numeric data items or literals. They may be non-integer values. You can also specify the value of any of these items with an arithmetic expression. 5. Color-val is a numeric data item or literal. It can also be an arithmetic expression, except when used in the Screen Section. 6. Fg-color and bg-color are integer literals or numeric data items. They may be arithmetic expressions. See section 6.4.9, "FOREGROUND-COLOR and BACKGROUND-COLOR Phrases", for a more detailed discussion of color settings and values. 7. Title is an alphanumeric literal or data item. 8. Control-value is a numeric expression. 9. Save-area is a USAGE HANDLE or PIC X(10) data item. 10. If the UPON phrase is specified, it must be the first optional phrase. 11. If the AT phrase is specified, neither the LINE nor the COLUMN phrase may be specified. 12. If the COLOR phrase is specified, neither the FOREGROUND-COLOR nor the BACKGROUND-COLOR phrase may be specified. 13. The POP-UP phrase may be specified anywhere in the statement after the required initial elements. 14. WINDOW and SUBWINDOW are synonymous. The SUBWINDOW synonym is available to improve code clarity. Its use makes it clear that a SUBWINDOW is created. 15. IS and "=" are synonymous. 16. COLUMN, COL, POSITION, and POS are equivalent. 17. BLANK and ERASE are equivalent. 18. HIGHLIGHT, HIGH, and BOLD are synonymous. 19. LOWLIGHT and LOW are equivalent. 20. UNDERLINE and UNDERLINED are equivalent. 21. REVERSE-VIDEO, REVERSE, and REVERSED are equivalent. 22. COLOR and COLOUR are synonymous. 23. FOREGROUND-COLOR and FOREGROUND-COLOUR are synonymous. 24. BACKGROUND-COLOR and BACKGROUND-COLOUR are synonymous. 25. The LINES phrase can take a numeric expression. General Rules 1. The DISPLAY SUBWINDOW verb creates or modifies the current subwindow. The subwindow is a rectangular region of the screen. In essence, the current subwindow defines a virtual terminal screen that occupies some area of the user's physical screen. Line and column numbers for ACCEPT and DISPLAY statements are computed from the upper left-hand corner of the current subwindow. For example, the statement DISPLAY SPACE, ERASE SCREEN erases only the current subwindow. 2. When used with floating windows (Format 11), this verb creates a subwindow in the current floating window. Note that every floating window has an implicit subwindow. Each time a floating window is made current, its subwindow is also made current. 3. When used with floating windows, subwindow coordinates are relative to the current floating window. Initially, this is the main application window. The subwindow never extends past the boundaries of the current floating window. 4. The initial subwindow is set to the entire screen. When created inside a floating window, the subwindow is set to the floating window's display area (the area inside the borders, menu bar, toolbar, and title bar). 5. Any subwindows contained in a floating window are automatically closed if the floating window is closed. LINE NUMBER Phrase 6. The LINE NUMBER phrase sets the top line of the subwindow. In this context, line number one refers to the top line of the current floating window. 7. If this phrase is missing, then the top line of the current floating window is used. COLUMN NUMBER Phrase 8. The COLUMN NUMBER phrase sets the leftmost column of the window. Column number one refers to the left side of the current floating window. 9. If this phrase is not specified, column number one is used. AT Phrase 10. The AT phrase sets both the starting line and column number. It is described in section 6.4.9, "Common Screen Options." The line and column numbers arrived at are interpreted as described in the LINE NUMBER and COLUMN NUMBER sections described above. SIZE Phrase 11. The SIZE phrase sets the number of columns the subwindow will contain. If this causes the window to extend past the right edge of the current floating window, the subwindow's width is adjusted to fit. 12. If this phrase is missing, the subwindow extends to the right edge of the current floating window. LINES Phrase 13. The LINES phrase sets the number of rows the subwindow will contain. If this causes the window to extend past the bottom of the current floating window, the height will be adjusted to fit. 14. If this phrase is missing, the subwindow extends to the bottom edge of the current floating window. 15. The LINES phrase of a DISPLAY WINDOW, DISPLAY LINE, or DISPLAY BOX verb can take a numeric expression. ERASE Phrase 16. When the ERASE phrase is specified, the window will be cleared immediately after it is created. Otherwise the window's contents will not be changed. When a window is cleared, it is set to spaces with the current foreground and background colors. 17. This phrase is implied by the BOXED and REVERSED phrases. BOXED Phrase 18. The BOXED phrase causes a box to be drawn around the new window. The box is drawn outside of the window. Any portions of the box that lie off the screen will not be drawn. 19. The terminal's line drawing set is used to draw the box. If the terminal does not have a line drawing set, hyphens and vertical bar characters are used. 20. If the POP-UP phrase is also specified, the box will overlay any other boxes on the screen. If this phrase is not specified, the box drawn will be attached to any other boxes it intersects. 21. This phrase implies the ERASE phrase. REVERSED Phrase 22. The REVERSED phrase exchanges the window's foreground and background colors. This will affect every ACCEPT and DISPLAY statement in the new window. 23. This phrase implies the ERASE phrase. Note that this will usually cause the entire window to be set to reverse video spaces when it is initially created. COLOR Phrase 24. The COLOR phrase sets the window's foreground and background colors. These colors are used whenever the window is erased and as default colors for future ACCEPT and DISPLAY statements. Color-val contains a numeric representation of the colors to use. See section 6.4.9, "Common Screen Options," COLOR Phrase, for detailed information on setting numeric values for colors. 25. If the foreground color is not specified, the new window inherits the current window's foreground color. If the background color is not specified, the new window inherits the current window's background color. 26. You may use the WINDOW-INTENSITY configuration variable to control whether the intensity information in the COLOR setting should be used or ignored (see Appendix H for details). HIGH, LOW, and STANDARD Phrases 27. The HIGH, LOW, and STANDARD phrases set the foreground intensity of the subwindow. This affects any drawing done to the subwindow itself (such as its border or title). In addition, they set the default intensity for any future ACCEPT/DISPLAY statements made to this window. The STANDARD option indicates that a system-dependent default value should be used. You can affect this value with the FOREGROUND-INTENSITY configuration option. If no option is given, the current subwindow's foreground intensity is used (inherit the foreground intensity of the parent). BACKGROUND-HIGH, BACKGROUND-LOW, and BACKGROUND-STANDARD Phrases 28. The BACKGROUND-HIGH, BACKGROUND-LOW, and BACKGROUND-STANDARD phrases set the background intensity for the subwindow. This works in a fashion analogous to the foreground intensity described above. Note that the COLOR phrase, if present, takes precedence over the BACKGROUND phrases. CONTROL VALUE Phrase 29. The CONTROL VALUE phrase provides a method for specifying certain window characteristics at run time. Control-value must be a numeric expression that contains one or more of the following values added together: Boxed 1 Shadow 2 No Scroll 4 No Wrap 8 Reverse 16 TITLE Phrase 30. The TITLE phrase causes a title to be printed in the window's border. This has effect only if the BOXED phrase is also specified. 31. One top title and one bottom title may be specified for each window. Top titles can be placed in one of three positions in the border region: top left, top center, or top right. Bottom titles can be placed in the bottom left, bottom center, or bottom right. If TOP or BOTTOM is not specified, TOP is used. If LEFT, CENTERED, or RIGHT is not specified, CENTERED is used. NO SCROLL and NO WRAP Phrases 32. Specifying NO SCROLL disables automatic scrolling for the new window. Normally, when the cursor is moved past the bottom edge of the window, the window is scrolled up one line. If NO SCROLL is specified, then the window will not be scrolled. The bottom line will be overwritten instead. When NO SCROLL is specified, then the only way to scroll a window is explicitly with a SCROLL phrase on a Format 1 DISPLAY statement. 33. Specifying NO WRAP disables line wrap for the window. Normally, a line that extends past the right edge of the window is wrapped around to the next line. If NO WRAP is specified, then the line is truncated instead. This will leave the cursor logically positioned on the same line just to the right of the window's edge. Further output will not be visible until the cursor is repositioned inside the window. 34. The scroll and wrap states of the current window are saved when a pop-up window is created. When that pop-up window is closed, the scroll and wrap states of the old window are restored. 35. Note that the ACUCOBOL-GT runtime system contains two configuration variables, SCROLL and WRAP, that control the scroll and wrap states of all windows. When these variables are set to zero, then scrolling or wrapping for all windows is disabled regardless of the scroll and wrap states of the individual windows. When these variables are non-zero, then the window's individual states determine the use of scrolling and wrapping. POP-UP AREA Phrase 36. The POP-UP AREA phrase causes the screen manager to save information about the current subwindow prior to creating the new window. This information can be used by the screen manager later to remove the new window and restore the saved window. This is meant to be used to create "pop-up" windows. 37. Boxed pop-up windows are automatically detached slightly from any intersecting line segments, such as the borders of other windows. 38. The save-area is an elementary data item described by a PICTURE X(10) clause. It is filled in with information about the current window dimensions and contents before the new window is created. This data item is required for restoration of a window and must not be subsequently modified in any way. It can be referenced in a CLOSE WINDOW verb to restore the saved window to the screen and re-establish the saved window as the current window. 39. Pop-up subwindows are an older technology that is not compatible with graphical controls. You should avoid using pop-up windows if you also use controls. Use floating windows instead. SHADOW Phrase 40. The SHADOW phrase causes the window to appear to float over the screen, giving it a three-dimensional effect. The way the shadow is displayed is determined by the SHADOW-STYLE setting of the SCREEN option in your runtime configuration file. When a shadow is specified for a window, that window is automatically detached slightly from any intersecting line segments, such as the borders of other windows. Note: Phrases not described above are described in section 6.4.9, "Common Screen Options." ---------------------------------------------------------------- Seems like ACU-Cobol. Please put the syntax part into quote/code-tags for easier reading. Let's put it that way: when you think you finished screenio.c (based on feb-09 tarball [or a newer one if you have access to it]) I try to get this into current sources and start to do the COBOL part. We may get this into 2.0 (depending how fast we are and how long we have to wait for 2.0). I'll see how difficult it would be to tweak the 1.1pre-release for the COBOL part. The basics for COBOL parsing are simple: mostly some tweaking in parser.y and generating parser.c/h from that using bison. I think it would be good to start with a simple WINDOW and DISPLAYs of WORKING-STORAGE and SCREEN SECTION items to get this working. The next would be two simple WINDOWs and DISPLAYs with/without UPON. human ---------------------------------------------------------------- Ok, i have this version open-cobol-1.1.tar.gz feb-2009 ( last ChangeLog 2008-11-17 Roger While <simrw@sim-basis.de> ). I start the changes today, any doubt or when i finish, write here. With syntax quoted/tagged. Greetings. ---------------------------------------------------------------- Subject: RETURN-CODE size It would appear that for 64-bit Micro Focus installations that RETURN-CODE has a size of 8 bytes. I would appreciate confirmation of this. Especially WIN-64. [code] DISPLAY LENGTH OF RETURN-CODE END-DISPLAY [/code] Roger ---------------------------------------------------------------- Interesting question. From the MF docs [quote]There are two methods for passing return codes back from the called program to the calling program. You can use the: * RETURN-CODE special register. The called program puts a value in the RETURN-CODE register before passing control back to the calling program with an EXIT PROGRAM or GOBACK statement. The RETURN-CODE register of the calling program is then automatically updated with the called program's return code and this register can be examined accordingly. The RETURN-CODE register is predefined as PIC S9(9) COMP; this can be changed using the [url=http://documentation.microfocus.com/help/index.jsp?topic=%2Fcom.microfocus.eclipse.infocenter.visualcobol.r3eclipseux%2FHRCDRHCDIR5S.html]RTNCODE-SIZE[/url] Compiler directive. * RETURNING or GIVING phrase. The preferred, and more flexible, way of handling return codes is to use the RETURNING or GIVING phrase of the CALL, EXIT PROGRAM, GOBACK, and STOP RUN statements. This phrase enables you to define the format of the return code yourself and so cope with whatever size of return code you require.[/quote] it seems that it's still PIC S9(9) COMP (if not changed). Maybe you change the topic of your post to something like "Help needed: RETURN-CODE size in 64-bit" human ---------------------------------------------------------------- I downloaded the trial version of Visual COBOL 10 a bit ago, and it's not run out yet, so... When compiled using "Platform x86" this returns 4. When compiled using "Platform x64" it returns 8. So...consider it confirmed...? Frank ---------------------------------------------------------------- Check out the RETURN-CODE-SIZE directive (available in every MF release that I know of) at: [url=http://documentation.microfocus.com/help/topic/com.microfocus.eclipse.infocenter.visualcobol.r3vc/HRCDRHCDIR5S.html]http://documentation.microfocus.com/help/topic/com.microfocus.eclipse.infocenter.visualcobol.r3vc/HRCDRHCDIR5S.html[/url] ---------------------------------------------------------------- Subject: FOREVER and a small request for involvement I just updated the FAQ and was wondering if anyone could come up with a better/different short sample program than the one I use in http://opencobol.add1tocobol.com/#forever The one I have also demonstrates the CYCLE clause of EXIT PERFORM, but reading it, it seems a little, umm, lame for what is a pretty powerful program flow construct. [i]Plus I'd like to show off a little more community involvement and spread some credit around.[/i] Cheers, Brian ---------------------------------------------------------------- I think it's fine and think you should leave it as it is... human ---------------------------------------------------------------- human; I know it's "fine", kinda, but I'm also trying to get some of the lurkers out into the open. :-) Hoping that some small steps will lead to bigger bolder steps. Plus, the post was a thinly veiled self promotion and the, [i]as always[/i], greater desire to inform that OpenCOBOL supports FOREVER along with EXIT PERFORM CYCLE. As I add reserved words to the FAQ in the future, I may post up more of these challenges [i]in a thinly veiled disguise to highlight the feature[/i]. Cheers, Brian ---------------------------------------------------------------- As one of the "lurkers", may I offer an excuse. I think that many of us who do not make a contribution, are ordinary cobol people who know nothing of C or web based extensions or GUI or database extensions. Much of the discussion here seems pretty esoteric. There is no place where one feels that it would be appropriate to post ordinary basic cobol programs or even tips. I think this is a pity, but I don't have any solutions. Going way back to the computer language cobol group in the pre YK2 years, it was apparent that cobol programmers were a most ungenerous lot. "Do your own homework", and "I do this for money not for free" were common responses with a few exceptions like WM Klein and J McLendon. Perhaps the decline of cobol might have made people more open. Even though cobol is the accounting language, you can't I think find books with debtors, creditors, stock payroll and general ledger. You can find them in basic, but not cobol. I think that if there was a place where low level people could contribute, perhaps they might. It is not approprate to clutter up this forum, but it would need to be a place which is just as simple to write to, else most of us would be unable to join in. John. ---------------------------------------------------------------- Thanks for the post John. Exactly the catch-22 I wanted to break here. OpenCOBOL is for sharing. And yes, old school COBOL is/was very much "top-secret, tight lipped programming". We can change that. No need to feel you have to talk C bindings, or GUI or highfalutin issues. A nice challenge on a short sample of [code] PERFORM FOREVER do some thing now get me outta here do some other thing END-PERFORM [/code] was what I wanted to start up. A sample on a neat INSPECT trick, or a blurb on preferred section/paragraph naming. Anything. OpenCOBOL doesn't have to be closed like the olden days. [i]And to be honest, it is to great credit that most COBOLers kept their tight lips, when I just know that some of them wanted to help, or point out mistakes, or show off, but couldn't, due to the nature of the work they were/are doing.[/i] We can, and we should, flap some loose lips. :-) Do that here on opencobol.org. I'd read the posts, and feel better for the reading, and the learning, of all the old and new techniques. I blather on with samples and bindings to show what OpenCOBOL is capable of, but a pure COBOL discussion would be more than welcome. It'd be appreciated. Unless it sounds like actual homework and it'd hurt more than help, there won't be many "Do your own homework" remarks...umm, I hope ([i]no, I'm pretty sure[/i]). [b]To everyone[/b]; join in, the water's fine. ;-) In the FAQ as it stands, there are over 500 reserved words in section 4 and only a mere hundred or so have code samples. I'd gladly read submissions here, get permission and then include them (with or without credit at author's desire) for everyone's benefit. If we start to overwhelm the forum and people want to direct compiler questions to Roger, we can work out a way to keep his perception of the signal to noise ratio high enough for productive usage of time. Cheers, Brian ---------------------------------------------------------------- Did not know that existed. [code] >>SOURCE FORMAT IS FREE id division. program-id. read_forever. environment division. input-output section. file-control. select my-file organization line sequential assign to "myfile". data division. file section. fd my-file. 01 my-record pic x(80). procedure division. open input my-file perform forever read my-file at end exit perform end-read display my-record end-perform close my-file goback. [/code] Cool. No need for a goto, a file status, or any working-storage at all. Too bad it's apparently not standard. ---------------------------------------------------------------- Yep, no standard - but a real nice extension. If you want to do this the standard way do [code] [...] perform until 0 = 1 read my-file at end exit perform end-read display my-record end-display end-perform [...][/code] OpenCOBOL may supports PERFORM UNTIL EXIT, too (this is a MF extension, if I remember this correct). human ---------------------------------------------------------------- OK Brian here is how we did this in the original dialects of COBOL. In an effort to show how the language has changed, I offer the following version of Brian's program. While many styles can be effectively used in COBOL programming, this program is an example of the style used in programming shops where I worked. The first six colums of each source line were reserved for the source code sequence number (usually page and line number). We generally used the first three columns to represent the ascending page number and the last three for the line number on the page. Skipping ten numbers between each original line allowed us to insert additional lines when needed. You can see that an insertion was made at 001045. These sequence numbers were desirable in that the program was punched on cards with one card for each line. If the source card deck was accidently dropped the sequence numbers allowed us to get the source deck back into order. You will also notice that the code is all in uppercase. Quite simply, early line printers could not print lowercase. Take a look at line 001080. While even early compilers would have allowed us to write "VALUE 0" we would spell out the word zero since the difference in appearance between an alphabetic letter O and a numeric zero was easy to miss when reading the program. All of the environment division has been left out of this program, although it was almost always necessary. The numbers after "FOREVERLOOP" on line 001070 were the version number of the program. It was our habit to keep a journal (in comment lines) at the beginning of the program describing modifications that were made to the program. The variable names start with "WS-". This allowed the reader of the program to understand that the variable in question was in the WORKING- STORAGE instead of being part of a file descriptor, thus making it easier to find. Numeric fields were almost always signed, both for efficiency at run-time and to allow for the possibility of a value going negative even if it should not. COMP asked the compiler to use the most efficient method to store the value on the architecture on which the program was going to run. You will see that the display statements start their display with "I) ". We used this to make reading console output easier. "I)" was for normal information, "W)" was for warnings, and "T)" was for terminal conditions. From a syntactical standpoint this code was written to the COBOL-68 standard. Structured programming constructs were not available. Paragraphs were numbered in ascending sequence in order to make finding a paragraph easier. Sentences were kept short and periods were used as often as we could use them. [code] 001010 IDENTIFICATION DIVISION. 001020 PROGRAM-ID. FOREVERLOOP. 001030* 001040 DATA DIVISION. 001050 WORKING-STORAGE SECTION. 001060 01 WS-PROGRAM-NAME PIC X(16) 001070 VALUE "FOREVERLOOP 001". 001080 01 WS-COBOL PIC S9 COMP VALUE ZERO. 001090 01 WS-C PIC S9 COMP VALUE 1. 001100 01 WS-FORTRAN PIC S9 COMP VALUE 2. 001110 01 WS-ED1S PIC Z-. 001110* 001010 PROCEDURE DIVISION. 001020 DISPLAY "I) PROGRAM ", WS-PROGRAM-NAME, " BEGINNING". 001030 0100-LOOP. 001040 ADD 1 TO WS-COBOL. 001045 MOVE WS-COBOL TO WS-ED1S. 001050 DISPLAY "I) COBOL AT ", WS-ED1S. 001060 IF WS-COBOL IS GREATER THAN WS-FORTRAN 001070 THEN GO TO 0800-ENDER. 001080 IF WS-COBOL IS EQUAL TO 1 001090 THEN DISPLAY "I) COBOL STILL CREEPING UP ON C". 001100 GO TO 0100-LOOP. 001110* 001120 0800-ENDER. 001130 DISPLAY "I) COBOL SURPASSED C AND FORTRAN". 001140 DISPLAY "I) PROGRAM ", WS-PROGRAM-NAME, " TERMINATED". 001150* 001160 STOP RUN. [/code] The run-time output is below: [code] I) PROGRAM FOREVERLOOP 001 BEGINNING I) COBOL AT 1 I) COBOL STILL CREEPING UP ON C I) COBOL AT 2 I) COBOL AT 3 I) COBOL SURPASSED C AND FORTRAN I) PROGRAM FOREVERLOOP 001 TERMINATED [/code] Please note that I am not advocating this style. However it is a good example of traditional methods. ---------------------------------------------------------------- You made one "syntax" error for duplicating "old-style" (required for Standard conformance) programming. You hae DISPLAY statement immediately following the PROCEDURE DIVISON header. Up until "more recent" Standards, you were required to have either a section or paragraph header and could NOT have statements "outside" of a named procedure. P.S. In the days of "numbered lines" and all upper-case, you probably would have also had a REMARKS paragraph, but that was optional. ---------------------------------------------------------------- As is usually the case, Mr. Klein is correct. :-) Chalk it up to CRS (Can't Remember Stuff). Yes the "old-style" relied a lot more on the environment division, including the ability to specify both a source computer and an object computer. This would allow the compilers that supported it to output different object code depending on the object computer specified. A compile of a simple listing program done on a four tape 1401 would take about 15 minutes and then you had to run the result through the Autocoder macro assembler. The 360's would generally compile directly (without the Autocoder step) and would get the job done in a few minutes but if you were not authorized to be in the computer room you had to wait until someone in production saw fit to run your compile for you. ---------------------------------------------------------------- Like OMG! I learned COBOL on the 1401. And I remember pops letting me practice on the week ends on the 360. Good times... But the PC is so much more convenient! ---------------------------------------------------------------- Now thats what I'm talking about. John, Jim, Frank, Bill, human; If you don't mind, I'd like to include nearly this entire thread in the FAQ, (under what heading I'm not sure, but this is some wicked good COBOL technical [i]and cultural[/i] wisdom). Damon; not to worry, I plan on including as many of your snippets as the future will bear. ;-) More of this please...[i]he said, hinting towards the anonymous readers[/i]. Cheers, Brian ---------------------------------------------------------------- Brian, permission granted. ---------------------------------------------------------------- I added a more contemporary method of doing the same thing for the COBOL newbies. [code] 001010 IDENTIFICATION DIVISION. 001020 PROGRAM-ID. FOREVERLOOP. 001030* 021611************************************************************** 021611* * 021611* This program will demonstrate various techniques and * 021611* coding styles. * 021611* * 021611* Version 001--Shows a COBOL68 technique * 021611* 02/15/2011--J C Currey * 021611* * 021611* Version 002--Shows an OpenCOBOL 1.1 technique * 021611* 02/16/2011--J C Currey * 021611* * 021611************************************************************** 001040 DATA DIVISION. 001050 WORKING-STORAGE SECTION. 001060 01 WS-PROGRAM-NAME PIC X(16) 021611 VALUE "FOREVERLOOP 002". 001080 01 WS-COBOL PIC S9 COMP VALUE ZERO. 001090 01 WS-C PIC S9 COMP VALUE 1. 001100 01 WS-FORTRAN PIC S9 COMP VALUE 2. 001110 01 WS-ED1S PIC Z-. 001110* 001010 PROCEDURE DIVISION. 001020 DISPLAY "I) PROGRAM ", WS-PROGRAM-NAME, " BEGINNING". 021611* 021611* THIS CODE SHOWS HOW WE WOULD DO IT WITH COBOL68 021611* 001030 0100-LOOP. 001040 ADD 1 TO WS-COBOL. 001045 MOVE WS-COBOL TO WS-ED1S. 001050 DISPLAY "I) COBOL AT ", WS-ED1S. 001060 IF WS-COBOL IS GREATER THAN WS-FORTRAN 001070 THEN GO TO 0800-ENDER. 001080 IF WS-COBOL IS EQUAL TO 1 001090 THEN DISPLAY "I) COBOL STILL CREEPING UP ON C". 001100 GO TO 0100-LOOP. 001110* 001120 0800-ENDER. 001130 DISPLAY "I) COBOL SURPASSED C AND FORTRAN". 021611 DISPLAY " ". 021611* 021611* Now we will do the same thing a newer way 021611* 021611 perform with test after 021611 varying ws-cobol from 1 by 1 021611 until ws-cobol is greater than ws-fortran 021611 move ws-cobol to ws-ed1s 021611 display "I) COBOL at ", ws-ed1s 021611 evaluate ws-cobol 021611 when 1 021611 display "I) COBOL still creeping up on C" 021611 when 3 021611 display "I) COBOL surpassed C and FORTRAN" 021611 end-evaluate 021611 end-perform. 021611* 001140 DISPLAY "I) PROGRAM ", WS-PROGRAM-NAME, " TERMINATED". 001150* 001160 STOP RUN. [/code] The explanation was then updated [code] In an effort to show how the language has changed, I offer the following version of Brian's program. While many styles can be effectively used in COBOL programming, this program is an example of the style used in programming shops where I worked. The first six colums of each source line were reserved for the source code sequence number (usually page and line number). We generally used the first three columns to represent the ascending page number and the last three for the line number on the page. Skipping ten numbers between each original line allowed us to insert additional lines when needed. You can see that an insertion was made at 001045. These sequence numbers were desirable in that the program was punched on cards with one card for each line. If the source card deck was accidently dropped the sequence numbers allowed us to get the source deck back into order. You will also notice that the code is all in uppercase. Quite simply, early line printers could not print lowercase. Take a look at line 001080. While even early compilers would have allowed us to write "VALUE O" we would spell out the word zero since the difference in appearance between an alphabetic letter O and a numeric zero was easy to miss when reading the program. All of the environment division has been left out of this program, although it was almost always necessary. The numbers after "FOREVERLOOP" on line 001070 were the version number of the program. It was our habit to keep a journal (in comment lines) at the beginning of the program describing modifications that were made to the program. The variable names start with "WS-". This allowed the reader of the program to understand that the variable in question was in the WORKING- STORAGE instead of being part of a file descriptor, thus making it easier to find. Numeric fields were almost always signed, both for efficiency at run-time and to allow for the possibility of a value going negative even if it should not. COMP asked the compiler to use the most efficient method to store the value on the architecture on which the program was going to run. You will see that the display statements start their display with "I) ". We used this to make reading console output easier. "I)" was for normal information, "W)" was for warnings, and "T)" was for terminal conditions. From a syntactical standpoint this code was written to the COBOL-68 standard. Structured programming constructs were not available. Paragraphs were numbered in ascending sequence in order to make finding a paragraph easier. ************************* Version 002 shows how one might code the application with OpenCOBOL 1.1. A modification log has been added via comments at the beginning of the program. Note that the sequence numbers are now being used to store the date that the new or changed code was made. By looking at the modification date and then referring to the modification log, one can determine what changed from version to version. Structured programming constructs have been used. [/code] I expect that there may be some discussion as to which method is easier to read and understand. jimc ---------------------------------------------------------------- This is a variation of the 'perform forever' program. [code] >>SOURCE FORMAT IS FREE program-id. "readForever". *>_______________________________________________________________________________________ *> *> Author. rkeane *> Written: 16 Feb 2011 *> Purpose: A variation of submitted "read-forever" *>_______________________________________________________________________________________ environment division. input-output section. file-control. select my-file assign to "myFile" organization line sequential. data division. file section. fd myFile. 01 myRecord pic x(80). working-storage section. *>_______________________________________________________________________________________ procedure division. main. open input myFile perform forever read myFile not at end display myRecord at end perform finish goback *>Program exit end-read *>End read myFile end-perform *>End perform forever exit. finish. close my-file exit. <[/code] ---------------------------------------------------------------- Using non-structured statements: [code] procedure division. main. open input myFile. 0100-loop. read myFile next record at end close myFile stop run. display myRecord. go to 0100-loop. [/code] ---------------------------------------------------------------- Brian, use anything I write any way except in a court of law against me. One thing I am not clear on. Are small (say 300 line) programs welcome here, which are posted for information because the poster thinks they may be useful, not because they give rise to a query (not working)? Or is there some other place connected to OC which would be better? John ---------------------------------------------------------------- John; Here is great for small (and medium) programs. There are movements afoot to create public source code repositories, and collaborative development environments, but right now and into the foreseeable future, opencobol.org is the place to be. When we finally get a source repo, (and oldsite.add1tocobol.com was one previous kick at such an animal) we'll do what we can to drag any and all source snippets from here to the new thing. I've been hinting at calling one aspect of the new thing, the Open COBOL Comprehensive Archive Network. OCCAN. The add1tocobol team does have an SVN stash, and now has a WordPress site, add1tocobol.com but it is still in it's infancy. A server is being built that should allow for more down'n'dirty programmer collaboration as well, umm, real soon now. Until then, opencobol.org, and even after, this will continue to be the place that gets the news of any developments. Being the central point of contact has powerful advocacy merits. Cheers, Brian ---------------------------------------------------------------- I am currently uploading a full accounting - G/L, Debtors/Accounts Receivable, Creditors/Accounts Payable, Stock/Inventory, Job Costing, Production, Quotations, Orders, Invoicing, Business management reporting and point-of-sale system (written in COBOL) onto Apac Accounting on sourceforge under the GPL. The system was originally written using MS COBOL and running on CPM, then converted to MSDOS and then converted to MFCOBOL. It is written using the older method of code, however I have made changes to more modern coding. I have modified the code over the years to run on WINDOWS (not GUI as the MF compiler and run time licenses became too expensive for the smaller users). My intention has always been to ensure that small businesses could afford to have a system that could be as good as anything the bigger companies were using. I have recently included a lot more remarks in the code to enable other interested developers to get involved. My intention is to convert the system to run using Open-COBOL and hopefully all the code will have been uploaded by 28 Feb. There will have to be some work, hopefully not too much to get it compiled using Open-COBOL but I am hopeful that others are willing to also get involved and the system can continue on and be of use to many. I will keep you informed as to the status of the upload. ---------------------------------------------------------------- Looking forward jwl. I don't know if anyone else is getting this sensation, but is COBOL becoming cool enough for the internet generation now? Thanks to open folk and OpenCOBOL? [i]Or did I just jinx the tide?[/i] :-) Cheers, Brian ---------------------------------------------------------------- Hi all, I have uploaded the source to Sorceforge and although I have not as yet made the changes for OpenCobol, the source is available and maybe a few of you will be interested enough to pitch in with some of the amendments that will be required. Source can be found under Apac Accounting. Hope this helps with the Open COBOL Development as there should be some code that can be used for testing of the various VERBS etc. The software has been written using MF Cobol functions as well as some other features of MF. James ---------------------------------------------------------------- For everybody who wants to have a look at it, here is the SourceForge projext link: http://sourceforge.net/projects/apac-accounting It currently has an 11,6 MB file APACSRC8.zip, including a lot of stuff (as you can see I didn't figured out what is what inside) together with 1200 files of COBOL source (unpacked 48 MB)!!! @james: Some questions: - Is there some "how to build" file I did not recognized? - Does everything is compilable with OC, yet? Does it work with OC? - Do you mind of putting every source into SVN version control at SourceForge? If you need further information and/or help, contact me per PM about that. human ---------------------------------------------------------------- Hi human, I would like some help regarding how to get the source to SVN etc. It is a complete Accounting/Job Costing/Production/Point of Sale, including Inventory, Creditors(Accounts Payable), Debtors (Accounts Receivable), Quotations, Picking Slips, Invoicing ....... I am busy with changes for OC and will keep everyone informed with progress. I have written a few filter programs to make some of the amendments which I have scheduled for the weekend. The source as it appears on SourceForge is still MF compatible. Thanks James ---------------------------------------------------------------- I guess the source will be both MF and OC-compatible afterwards. It would be really interesting to have such a big COBOL project as OpenSource (working with an open source compiler). Concerning SVN: I've sent you a message via SF with some details. human ---------------------------------------------------------------- To all those involved, this thread is now in the FAQ at http://opencobol.add1tocobol.com/#forever Thanks. Brian ---------------------------------------------------------------- Brian, don't get me wrong, but I really think this time you copied too much. The FAQ entry was originally about PERFORM FOREVER, now it's full of stuff that has nothing to do with that topic. If you want to know my opinion to that (which I imply as you've posted the link here) here is it: 1. make a complete new entry like "PROGRAM FLOW" (maybe with a different name) and place the stuff there - but kick out any side topics (like OPAC, "granted", ...) 2. put a link to that in every entry, that has to do with program flow 3. reduce the FOREVER entry to FOREVER human ---------------------------------------------------------------- Agree. I'll break it out and link to it. Thanks human. Cheers, Brian Edit: Done. http://opencobol.add1tocobol.com/#performing-forever ---------------------------------------------------------------- Brian, what do you think about placing the link at #go #exit, too? I'd suggest to add some samples at #go, especially for DEPENDING (maybe at #depending?), something like [code] SAMPLE SECTION. S-BEG. IF SAMPLE-MODE NOT = OLD-MODE GO TO S-SHW, S-CHG, S-ADD DEPENDING ON SAMPLE-MODE. GO TO S-END. S-SHW. DISPLAY 'ENTRY "' S-ENTRY '"'. DISPLAY 'VALUE "' S-VAR '"'. GO TO S-END. S-CHG. DISPLAY 'ENTER NEW VALUE FOR "' S-ENTRY '": '. ACCEPT S-VAR. GO TO S-END. S-ADD. DISPLAY 'ENTER NEW ENTRY: '. ACCEPT S-ENTRY. DISPLAY 'ENTER VALUE FOR "' S-ENTRY '": '. ACCEPT S-VAR. GO TO S-END. * S-END. EXIT.[/code] with values for SAMPLE-MODE from 0 (go to end) to 3 (go to S-ADD) I'd still kick most (unrelated) stuff out of #performing-forever, for example "granted", forum, OCCAN, ... human ---------------------------------------------------------------- More good ideas. I'll do (or at the least, pull a Not-Yoda and Try over the next few days). I'm close to trying, err, doing, a publish pass with the Sphinx system. Nice toolkit. Thanks human. Cheers, Brian ---------------------------------------------------------------- Subject: make check failures on HPUX Was able to configure and compile, install, but make check tests failed... Attempted to send an e-mail to open-cobol-list@lists.sourceforge.net but all 3 msgs was rejected so here they are: Syntax Failures: http://pastebin.com/Ln8Ve5QP Data-rep failures: http://pastebin.com/b0SHUPFU And run failures: http://pastebin.com/TGgSzxbv ---------------------------------------------------------------- I haven't gone through all the details, but the -R that shows up in the COB_FLAGS might be a problem. It might be better to build the compiler using LD_RUN_PATH (if that works in HPUX, don't know). I just discovered the "record path" thingy the other day, and haven't had to work through enough problem cases to know exactly where it fits in the chain. There are maybe some -Wl (pass to linker) convoluted tricky bits that can be tried to control how cobc invokes gcc when linking versus compiling. We can work through this with a little chit-chat back and forth, or someone that knows might just give up an answer. Cheers, Brian ---------------------------------------------------------------- OK - I'm game to try anything that will get it to work, just let me know where to start or what to try first.... Thanks ---------------------------------------------------------------- Let the chit-chat begin. Have you visited Sergey's stash of pre-builts? http://www.kiska.net/opencobol/1.1/ Will the HP-UX binary he has posted there help? In a nutshell, when I was trying to get a working compiler on DreamHost, it came down to.. 1) Build the compiler 1b) this required settings to let ./configure figure out where the gmp, bdb and ncurses libraries where. Both with include path settings and then LD_RUN_PATH set so that some of the ./configure tests would succeed. 2) [b]make check[/b] required LD_RUN_PATH set to allow for a clean test pass. 3) LD_RUN_PATH needs to be set during [b]cobc[/b] so that the binaries know where to look for local installed libraries, but don't need to be set when running custom OpenCOBOL apps once that is done. That's assuming no superuser powers. If you have superuser powers then it just comes down to proper ./configure options to match HPUX file locations under "normal" app building for the [b]make install[/b] to put things in a sane place. Cheers, Brian ---------------------------------------------------------------- Yes I did download the one HPUX binary for IA64 that we have and isntalled that, have not heard back from the programmer yet if it is working for them... We have two HPUX RISC processor based HP9000 machines I'm trying to get OC to work on that there are no binaries available for... one 11.00 and one 11.11. The configure succeeds with or without the options 'CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib' that were suggested by 'human' when I had problems on a DEC Unix machine (it fixed the issue of not finding gmp.h on that platform). I'm also using --without-db because the programmer stated that db was not required for their needs.... I will try setting LD_RUN_PATH to point to the /usr/local/lib area where I think the additional libraries are in addition to the std ones and see how that goes.... Thanks Again. I tried setting LD_RUN_PATH to /usr/local/lib, but got same results running make check... ---------------------------------------------------------------- Take a look at http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1245&forum=1#forumpost6256 and see if any of the flailing around I did on DreamHost might contain a few hints you can use. If not, we can keep talking. Cheers, Brian ---------------------------------------------------------------- I've tried setting CPPFLAGS, LDFLAGS, and CFLAGS, but no joy, pretty much same results as before.... What next ?? ---------------------------------------------------------------- The problem is that ./configure sets some flag (-R) that isn't supported with your toolchain. I guess this flag is set in defaults.h, correct (please add the file contents in your pastebin post)? If yes you can remove it there and do a make + make check again. But don't forget to add /usr/local/lib to your LD_LIBRARY_PATH when deleting the -R flag from defaults.h. human ---------------------------------------------------------------- I did as you said - I edited the 'defaults.h' file to remove the '-R /usr/local/lib' option, set the LD_LIBRARY_PATH variable, re-did a make, then a make check, and everything still fails as before... I posted the contents of the defaults.h to my 1st pastebin post and also showed the value of $LD_LIBRARY_PATH... ---------------------------------------------------------------- Seems like something else is wrong. Please upload the new syntax failures, too. I cannot see the defaults.h link in you first post ?!? human ---------------------------------------------------------------- Reposted default.h and all 3 logs Syntax.log & defaults.h http://pastebin.com/yLM3nabA run.log: http://pastebin.com/K5DNa7Nx data-rep.log: http://pastebin.com/cT8QcZDe ---------------------------------------------------------------- Hm, the problem is that make check exports COB_LIBS with -R param and therefore overrides the entries from defaults.h. But I have no idea how to tweak this. Anyone here understanding what make check does? Or knows how to tell ./configure to not add -R switch to COB_LIBS? You could start using OC without make check working after the changes to defaults.h+make+export LD_LIBRARY_PATH and see if it works for you. For example manually copy a failed test (which failed can be seen in the logs, the sources can be found in tests/syntax.src etc) to a file prog.cob and run cobc to manually check the results. For example, test "2. COPY: replacement order" failed. When searching this in tests/syntax.src we find [b]copy.inc[/b][code] 01 TEST-VAR PIC X(2) VALUE "OK".[/code] and [b]prog.cob[/b][code] IDENTIFICATION DIVISION. PROGRAM-ID. prog. DATA DIVISION. WORKING-STORAGE SECTION. COPY "copy.inc" REPLACING ==TEST-VAR== BY ==FIRST-MATCH== ==TEST-VAR== BY ==SECOND-MATCH==. PROCEDURE DIVISION. DISPLAY FIRST-MATCH NO ADVANCING END-DISPLAY. STOP RUN.[/code] and [b]the commands[/b][code]cobc -x -o prog prog.cob ./prog[/code] with the expected result [quote]OK[/quote]. You can check if this works for you. human ---------------------------------------------------------------- It sort of works.... What I can do is cd to ~/tests/syntax.dir/02/ and execute the 'run' script I find in the directory, which re-runs just that test, produces a new 'prog' executable in the directory that works when I execute that: doing ./run produces: ## --------------------------------------- ## ## OpenCOBOL 1.1 test suite: Syntax Tests. ## ## --------------------------------------- ## 2. copy.at:42: testing ... copy.at:63: ${COMPILE} -o prog prog.cob 0a1 > gcc: unrecognized option `-R/usr/local/lib' 2. copy.at:42: FAILED (copy.at:63) ## ------------- ## ## Test results. ## ## ------------- ## ERROR: 1 test was run, 1 failed unexpectedly. ## ----------------------- ## ## syntax.log was created. ## ## ----------------------- ## Please send `syntax.log' and all information you think might help: To: <open-cobol-list@lists.sourceforge.net> Subject: [OpenCOBOL 1.1] syntax: 2 failed ------------------------------ I then have to do a cd .., then cd back down into the '02' directory, where I find new source and executable with current date-time, the 'prog' executes with no errors and displays 'OK' with no errors..... The 'run' script is: ------------------------------------------- #! /bin/sh test "${ZSH_VERSION+set}" = set && alias -g '${1+"$@"}'='"$@"' cd /usr/local/open-cobol-1.1/tests exec ${CONFIG_SHELL-/bin/sh} ././syntax -v -d 2 ${1+"$@"} exit 1 ------------------------------------ If I do a 'cobc -x -o progx prog.cob', it generates a new 'progx' object, which will run if I chmod it to be executable, so it is sort of working in that sense... Maybe I'll have the programmer check it out to see if it works for them... Thanks for the help so far... ---------------------------------------------------------------- Subject: Compile C file Hello everyone. I need to compile a C file generated by the commands "cobc -C". This is the error I Netbeans generates: /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crt1.o: In function `_start': build/Debug/GNU-Linux-x86/appo.o: In function `cob_decimal_set_int': /dati/Lavoro/NetBeans/C/appo.c:18: undefined reference to `__gmpz_set_si' build/Debug/GNU-Linux-x86/appo.o: In function `appo_': /dati/Lavoro/NetBeans/C/appo.c:99: undefined reference to `cob_close' I'm using Ubuntu 10:10 Can anyone help me? Best regards Thanks ---------------------------------------------------------------- You may have to add -fimplicit-init to the cobc -C, (it will generate C code to properly initialize the OpenCOBOL runtime, and then add -lcob to the gcc command, so that it links to libcob. And maybe ensure that libgmp can be found with -lgmp A really good tool to see what cobc does during it's steps is to use [b]-v[/b] [code] cobc -v -fimplicit-init -C program.cob [/code]That will display to stdout all the commands that will be used to generate the C code. [code] cobc -v -fimplicit-init -x program.cob [/code]will display the commands used to compile and link an executable. Monkey the gcc linking options displayed on the last line. ala [code] $ cobc -v -x -free hello.cob preprocessing hello.cob into /tmp/cob3015_0.cob translating /tmp/cob3015_0.cob into /tmp/cob3015_0.c gcc -pipe -c -I/usr/local/include -Wno-unused -fsigned-char -Wno-pointer-sign -o /tmp/cob3015_0.o /tmp/cob3015_0.c gcc -pipe -Wl,--export-dynamic -o hello /tmp/cob3015_0.o -L/usr/local/lib -lcob -lm -lgmp -lncurses -ldb -ldl [/code] So, for me, gcc needed -lcob, -lm, -lgmp, -lncurses, -ldb and -ldl to turn the .o into a proper executable. Adding -fimplicit-init will ensure any generated C source code includes the call to start up the libcob runtime. Cheers, Brian ---------------------------------------------------------------- Subject: Finding the author of a joke I'd like to add a new joke to the FAQ. Anyone know wrote originally coined this one? [i]Paraphrased[/i] [code] A COBOL programmer's husband asks, "Honey can you go to the store and get some milk? And if they have eggs, get a dozen." After twenty minutes she returns and flops 12 bags of milk on the table. He looks at her curiously, "Honey, why did you do that?" She responds flatly, "They had eggs." [/code] Currently I have to credit it to Author unknown, but I'd like to fill in a real attribution. Cheers, Brian ---------------------------------------------------------------- Excellent ! ---------------------------------------------------------------- haha, took a while :-D ---------------------------------------------------------------- Subject: BLANK SCREEN clause The Guide page 5-18 item 9 deals with the BLANK clause of the screen section. I think it is slightly in error. I reproduce it below with a few words enclosed in square brackets. I think that deleting these words makes the paragraph correct. "9. The BLANK clause will blank-out the screen [or line] from the point indicated by any LINE and/or COLUMN clause on the data item. In addition the console window [foreground and] background color[s] will be set to whatever is specified on the item. Use of this clause ANYWHERE within an [01-level] item (or its subordinate items if any) will cause ALL displayed fields ANYWHERE within that [01-level] item (or its subordinate items) to be invisible." There are three points about the changes. First it doesn't matter whether the clause is used on an 01 level or any other level; the restriction remains. Secondly it is never of any effect to specify a foreground color in conjunction with a BLANK SCREEN. Thirdly I have bracketed the "line" on the first line. I think the BLANK LINE clause works without restriction. The restriction I am suggesting relates to BLANK SCREEN. This behaviour is different from Fujitsu and maybe other cobols. You can get the "common" behaviour in OC by specifying foreground and background colors at say 03 and then specifying BLANK SCREEN and and all the detailed lines at 05. In this way you will get a full screen with all items using the color scheme you specify without having your detailed items shown in the default white on black. Of course colors specified for a single line override the group item. The foreground and background colors do not need to be related to a particular item; they are as it were a group item without a group name. So in the example below the deleted 05 item at the top won't work. The corrections to make the screen work are in lower case. This screen will be green on white with the error line red on cyan. [code] 001220 01 CUSTOMER-DATA-SCREEN. 001230* 001240* 05 BLANK SCREEN BACKGROUND-COLOR BLUE FOREGROUND-COLOR 001250* WHITE AUTO. 03 background-color white foreground-color green. 05 blank screen . 001260 05 LINE 1 COLUMN 1 PIC X(80) FROM SCREEN-HEADING-LINE. 001270 05 LINE 3 COLUMN 1 PIC X(80) FROM MESSAGE-LINE-3. 001280 05 LINE 5 COLUMN 1 VALUE "Customer number. . . . . ". 001290 05 LINE 5 COLUMN 26 PIC 9(6) FROM CM-CUSTOMER-NUMBER. 001300 05 LINE 7 COLUMN 1 VALUE "Last name. . . . . . . . ". 001310 05 LINE 7 COLUMN 26 PIC X(30) USING CM-LAST-NAME. 001320 05 LINE 8 COLUMN 1 VALUE "First name . . . . . . . ". 001330 05 LINE 8 COLUMN 26 PIC X(30) USING CM-FIRST-NAME. 001340 05 LINE 9 COLUMN 1 VALUE "Address. . . . . . . . . ". 001350 05 LINE 9 COLUMN 26 PIC X(30) USING CM-ADDRESS. 001360 05 LINE 10 COLUMN 1 VALUE "City . . . . . . . . . . ". 001370 05 LINE 10 COLUMN 26 PIC X(20) USING CM-CITY. 001380 05 LINE 11 COLUMN 1 VALUE "State. . . . . . . . . . ". 001390 05 LINE 11 COLUMN 26 PIC XX USING CM-STATE. 001400 001410 05 LINE 12 COLUMN 1 VALUE "Zip code . . . . . . . . ". 001420 05 LINE 12 COLUMN 26 PIC X(9) USING CM-ZIP-CODE. 001430 001440 05 LINE 23 COLUMN 1 PIC X(80) FROM MESSAGE-LINE-23 blank line background-color cyan foreground-color red 001450 HIGHLIGHT. 001460 05 LINE 24 COLUMN 1 PIC X(80) FROM MESSAGE-LINE-24. 001470* [/code] John. ---------------------------------------------------------------- Thanks for the info John. As far as I've been concerned, we got the SCREEN SECTION support as a favour. Roger added the feature fairly quickly, and for the speed that the compiler code was written, I'm amazed at how much of this complicated handling is done well. But it is not perfect, imho. One thing we can do on our side is to continue with bug reports. One glaring hole is implicit support for numerics. It requires an accept/display field of pic 9 or X, explicitly declared (using MOVE) outside the implicit screen handler. A BINARY-LONG field is displayed as the ascii characters that curses sees from the number and is accepted the the same, an input '9' being stored as the value 57 for instance. BUT, again, a few MOVEs between accept and display can properly handle the numerics. You seem to have uncovered a more subtle problem. Whether these problems bubble up to the top of fix pile for the next round of pre-releases is to be determined. To be honest, I'd not be afraid of writing new SCREEN I/O code, that can work around the quirks during development, but it could be an "exercise" to port a large application that relied on legacy SCREEN SECTION code. Not impossible, but might require more code changes than the average porter would be facing. I may care a lot more soon for knowledge tidbits along the lines of what you just posted, as I have grand plans to implement an OCCAN front end in OpenCOBOL to allow indexing and downloading community code from the (planned) Open COBOL Comprehensive Archive Network. SCREEN SECTION will be my first choice of tool to use for the OCCAN index display front-end. (Note, that from a recent discussion with the add1to team; OCCAN has alway been OpenCOBOL CAN in my feeble little head, but it might be better to use Open COBOL in the acronym instead, foster ANY COBOL submissions and not just our beloved OpenCOBOL. [i]Between you and me though, Open COBOL IS OpenCOBOL[/i].) Cheers, Brian P.S. [i]Being a clown, I was going to go for a "Do your own homework" post first, but I'll save that insider joke till later.[/i] :-) ---------------------------------------------------------------- I tried in my previous post to make minor changes to the text of the Guide. I don't think my changes explained the rules properly. There are three cases. 1. BLANK SCREEN has subordinate clauses. They will be invisible. The only thing that will show is background color. 2. BLANK SCREEN has clauses at the same level. Background color will show in unoccupied areas of the screen. Items at the same level will show with default background and foreground colors (white on black). No other clause has any effect. 3. BLANK SCREEN is subordinate to a clause which contains any of foreground color, background color, auto, reverse-video and highlight. All of these will be effective. In Fujitsu colors and auto may appear in the same clause as BLANK SCREEN. Reverse-video and highlight may only appear at the item level. ---------------------------------------------------------------- Subject: libcob: File already open (STATUS = 41) I am executing a OpenCobol compiled COBOL program on zLinux. When I execute the program and get an error on a file , re-execution of the program gives the error: libcob: File already open (STATUS = 41) File : 'ARCHIVE' WARNING - Implicit CLOSE of SS-ARCHPARM ("ARCHPARM") WARNING - Implicit CLOSE of SS-ARCHIVE ("ARCHIVE") WARNING - Implicit CLOSE of EXTRACT-CONT-FILE ("EXTFILE") WARNING - Implicit CLOSE of PARM-CARD-FILE ("PRMCARD") The message indicates that an Implicit close was executed for ARCHIVE, but the next execution still says the file is open. How do I close the open file from Linux, so I can re-execute the program. ---------------------------------------------------------------- I have had this same problem is the past and I had to make a work-around procedure to get by this problem. Yes...you should be able to close a file and re-open the file numerous times within the same execution of a program. Apparently Open Cobol does not actually "close" the file until the program exits??? So...what I have done in the past is to redefine the same file in the File Section and then open that file. post from: bobscobol ---------------------------------------------------------------- I think you two talk about different things: tsdjim: You did not have a DECLARATIVES in your program and therefore crashed at the first file error, correct? Afterwards you could not OPEN the file again, correct? bobscobol: CLOSE does not work at all??? Please clear this up and give us your system specs: 1. cobc --version 2. use of BDB/VBISAM/CISAM/EXTFH/... (and which version) 3. OS and compiler used If this is possible please provide sample programs/procedure how the problem can be reproduced. I did not heard anything like that before and believe OC is working fine. human ---------------------------------------------------------------- I am using OC 1.1. OS is Linux SLES 11. There are no declaratives in the program, but OC says it issued an implicit close, so why is the file still open. The file is a QSAM file. ---------------------------------------------------------------- As I am no "Mainframer" I looked for QSAM at wikipedia: http://en.wikipedia.org/wiki/QSAM I think we talk about a FILE defined as SEQUENTIAL with a fixed record length. Is this correct? Please provide a small code sample, where you can reproduce this (one or more files needed, WRITE/REWRITE done before, ...), I'll check that on SLES and if I can reproduce it try to work up a patch / see if newer versions are fine. And please provide the exact output from cobc --version and tell us when you use a patched version. human ---------------------------------------------------------------- Subject: Handling of variable length record files from the Mainframe We have a variable length record file on the mainframe that needs to be read in a OpenCobol converted program on Linux. Are there tips on how OpenCobol handles VB files and any compile or execution options that might help in this matter? Do I need to convert the file from EBCDIC to ASCII and how would packed fields etc be handled? ---------------------------------------------------------------- The best way any file conversion between system / COBOL vendors work is: Write small programs for export/import. Export: old SELECT+FD and a new SELECT+FD with fixed record length line sequential file with no packed fields; START+READ+MOVE CORR+WRITE Transfer: If different machine types are involved (like in your case) do FTP as ASCII Import: SELECT+FD with fixed record length line sequential file with no packed fields and "old" SELECT+FD (think about changing the format in this conversion, as you have the change now); START+READ+MOVE CORR+WRITE There are maybe other ways but I believe this would be the fastest one with less possible errors. human ---------------------------------------------------------------- Rule number 1 in file transfers: NEVER, never, try and convert a file from EBCDEIC to ASCII if the same file has both USAGE DISPLAY and COMP, BINARY, COMP-3, PACED-DECIMAL data in it. Some PC/Unix/Linux compilers support working in EBCDIC mode while in an ASCII environment. I do NOT think that OC hs this facility (yet). Therefore, you will want to "convert" your file. You do NOT have to use LINE SEQUENTIAL, but you can. To expand on the what you need to do in your "conversion" program. 1) On the mainframe, the "output" file needs to have all USAGE DISOLAY fileds - including those that are numeric. 2) It is probably useful to use SIGN IS SEPARATE for the numeric signed fileds. 3) If you are using the RECORD IS VARYING IN SIZE phrase (on the mainframe) to specify that your file is VB, then you can add a field at the fornt of your output record with the length of each record (again, USAGE DISPLAY with SIGN IS SPEARATE) 4) Use "MOVE CORR" to populate your output file. Then download with EBCIDIC to ASCII conversion. On the workstation, you will read in your downloaded file and "convdert" it to your progoma; fpr,at )wjat upir [rpgra,o;; ex[ect_/ A) use that "saved" record length to create the record size on the workstation. (I really DO recommend using RECORD VARYING IN SIZE and do NOT call this LINE SEQUENTIAL B) Your workstation file should hae the samje defiition as your original mainframe file (e.g. COMP,BINARY, COMP-3, etc without sign is separate). C) Just use another MOVE CORR to populate the output file * * * * NOTE: There may still be SOME differences in how your program works on the workstation. Remember that the collating sequence of ASCII is different from EBCIC, so something like If "A" > "1" will yield different results on thw workstation than on the mainframe. ---------------------------------------------------------------- To wmklein's note: if really necessary you could use something like [code] OBJECT-COMPUTER. IBM-PC PROGRAM COLLATING SEQUENCE IS EBCDIC-ALPH. SPECIAL-NAMES. ALPHABET EBCDIC-ALPH IS EBCDIC.[/code] to use the original sort order. human ---------------------------------------------------------------- Just to add. OpenCOBOL has a pretty neat trick for the EBCDIC to ASCII to EBCDIC conversions. See http://opencobol.add1tocobol.com/#ebcdic for a sample. But, that's not the whole picture for this problem. As Bill stated, it's dependent on internal fields on what you can and cannot get away with using indexed file structures. Cheers, Brian ---------------------------------------------------------------- Subject: OpenCOBOL as a WordPress Plugin (Who says you can't do it?) OK so I had bug and just had to try to do it. WordPress and OpenCOBOL: [url=http://wptest.plpwebs.com/wordpress/]OpenCOBOL Test Site[/url] Yeah it can be done and it was actually easy once I figured out the stupid php code of WordPress Plugins. The example shown actually is OpenCOBOL producing the HTML code for the form and processing the data from the input field. In this small demo it just echos back what ever you put into the field. {EDITED per request} So doing the COBOL is not the issue. It was getting data from WP, passing it to COBOL, and displaying the returned data. Here is the plugin PHP code: [code] <?php /* Avoid Plugin Name Collision */ //Begin Class the396octest if (!class_exists(“the396octest”)) { class the396octest { function the396octest() { //constructor } function show_form(){ if($_POST['submit']) { // we will add the code to process submitted form here // we can also echo some text here if form is submitted $app = WP_PLUGIN_DIR."/the396octest/oc/testform.cgi ".$_POST['inputname']; $text = shell_exec($app); } else{ $app = WP_PLUGIN_DIR."/the396octest/oc/testform.cgi"; $text = shell_exec($app); } return $text; } }//End Class the396octest }//End Class the396octest //Initialize the Class if (class_exists("the396octest")) { $pg_octest = new the396octest(); }//End initialize class //setup actions and filters if (isset($pg_octest)){ add_shortcode('showForm',array($pg_octest,'show_form'),1); }//End Actions and Filters ?> [/code] Once I figured out how to get the $_POST data (thanks aoirthoir) it was a simple matter to then pass the data to the OC through a CLI call. Getting the data returned was easy. From other examples of creating a WP plugin I was able to finish the plugin. Here is the COBOL Source [code] identification division. program-id. testform. environment division. data division. WORKING-STORAGE SECTION. 01 cmdline PIC x(1024) VALUE SPACES. 01 HTML-TEST-INPUT. 10 FILLER pic x(10) VALUE '<form id="'. 10 WS-FORMID pic x(50) VALUE spaces. 10 FILLER pic x(10) VALUE '" action="'. 10 WS-ACTION pic x(50) VALUE spaces. 10 FILLER pic x(10) VALUE '" method="'. 10 WS-METHOD pic x(50) VALUE spaces. 10 FILLER pic x(3) VALUE '" >'. PROCEDURE DIVISION. ACCEPT cmdline FROM Command-line. MOVE "formid" to WS-FORMID. MOVE "POST" to WS-METHOD. * display "<form id=" & quote & "formid" & quote * & " action=" & quote & quote & " method=" * & quote & "POST" & quote & ">" display HTML-TEST-INPUT display "<input type=" & quote & "text" & quote & " name=" & quote & "inputname" & quote & " value=" & quote & quote & " />" *>**************************************** display "<input type=" & quote "submit" & quote & " name=" & quote & "submit" & quote & " value=" & quote & "submit" & quote & " />" display "</form>" if cmdline not equal to spaces then display "<br><h4> your input was </h4></br>" display cmdline end-if goback. [/code] Cheers ---------------------------------------------------------------- Quite nice! I like to see what you're doing with that. Please submit the points where you struggled first and a sample how to create a WP plugin. I suggest to change the title to: OpenCOBOL as WordPressPlugin (Who says you can't do it?) human ---------------------------------------------------------------- Subject: CBL_EXIT_PROC not working in a module Hi, I'm using CBL_EXIT_PROC in a cobol sub program to close the open files, strangely it is not working in the sub module, when used in a main program it works great. My scenario: - coded CBL_EXIT_PROC in a cobol sub program - compiled it with -m switch - Calling the cobol module from a C program by dynamically loading the subpgm.so using dlopen() & executing the handle returned by dlsysm(). - I'm ensuring cob_init() is called before calling the cob module - Everything is working except the exit procedure not getting executed The reason, I'm using dlopen() instead of cob_resolve() is I want to have exclusive control over loading and unloading of the modules, where as OC is maintaining it in a cache of all called modules and I could not figure out how to unload a module when I wanted it. Please correct me on this approach and to solve the problem. ---------------------------------------------------------------- No idea to CBL_EXIT_PROC, but a short info to unloading modules: - You make the internal module lists in libcob invalid if you dlunload the modules. - Unloading via libcob is not possible in 1.1. - Unloading via libcob will be possible in 2.0 by activating physical cancel and do a simple CANCEL on the module. human ---------------------------------------------------------------- Just to add; It's not "smart", nor clean to rely on this, but OpenCOBOL builds code into binaries that ensure open files are closed (and that ncurses screens are properly reset) during most abends and for image rundown. To the problem at hand; CBL_EXIT_PROC is for main, and main only exit. The exit_hdlrs are NOT called when a subprogram returns. It's kicked at STOP RUN or GOBACK from toplevel. You can cobc -C and check the C source code to get the nitty gritty on code flow control. [b]DANGER DANGER WILL ROBINSON![/b] If you are manually tweaking things and calling loaded COBOL from C and live dangerously...look in libcob/common.c at cobtidy. You might get away with calling cobtidy. Umm, but don't until you can defend your actions to management. "caveat amplificator". Cheers, Brian ---------------------------------------------------------------- Thanks Brian, cobtidy looks promising, I shall try with this and publish the results ---------------------------------------------------------------- Subject: File permissions My program creates some temporary files. The problem is that permission is 755 and i want 775. I set global umask 0002 at debian and that is the mask now but it seems that cobol doesnt care - ignores it... any idea to fix this? ---------------------------------------------------------------- I've glanced through the libcob/fileio.c code and can't see anywhere where the defaults access permissions are tweaked. Your 002 mask should work to allow group read/write/execute. Hmmm... Unless you are using the CBL_OPEN_FILE stock library functions (outside normal FD and OPEN I-O) which seems to call low level POSIX open with octal 0660. I'll admit to being easily confused by mode settings, so I may have missed something obvious. This will be a fixable situation. Once it gets figured out, I'll make a FAQ entry for posterity. More soon, Brian ---------------------------------------------------------------- I am using OPEN OUTPUT.. Is there any workaround? ---------------------------------------------------------------- Subject: Default file-management Hello everyone. I installed opencobol in ubuntu 10.10. I want to know what 'is the default advanced file-management with the distribution of canonical (as indicated in the manual on page 1-7 "ORGANIZATION IS INDEXED"). I would like to read an indexed file. Thanks Sincerely ---------------------------------------------------------------- I haven't done an install from the Ubuntu 10.10 repos, but I'll hazard an educated guess that the ISAM engine built in uses Berkelely DB. They reclassified Bart Martens older Debian build it seems. I'll verify when I'm back in the shop. But for now; yes, you can read and write indexed files. Quite well really. Cheers, Brian ---------------------------------------------------------------- Thanks for your reply. But I want to know if there is a chance to read the indexed files outside opencobol. Maybe with some utility bdb. I look forward also of your checks. ---------------------------------------------------------------- Yep. The bdb bundles comes with a utility layer. db_dump exports a portable text copy. db_load reloads said text files into a database. I'll be honest, the bdb stuff seems to be documented in a way that makes you work to get at good information. But there are other hand-rolled C programs out in the wild, [i]again hidden behind veils of secrecy[/i]. ;-) Under Fedora, the package to install is db4-utils or libdb-utils (for v5 versions) Cheers, Brian ---------------------------------------------------------------- Subject: OpenCOBOL: embedded SQL against Sybase ASE Preliminary work with Sybase ASE 15 indicates that the output of the Sybase precompiler (cobpre64 and cobpre_r64) is compatible with OpenCOBOL. Some fiddling with COB_LIBRARY_PATH and COB_LIBS was necessary to get ld (on AIX 6.1) to see and resolve the externals in the generated code. It's also important to get the "bitness" of the various pieces in agreement, in the UNIX case, 64-bit. Works with UNIX (AIX), also Windows XP and 7 in 32-bit mode. I'll put together a writeup on the process when time permits. Jim ---------------------------------------------------------------- Very cool Jim. If you do post notes, I'll ask you for permission to add them to the OpenCOBOL FAQ. And I'll ask now for permission to add the blurb above to http://opencobol.add1tocobol.com/#does-opencobol-support-any-sql-databases if that is ok by you? Cheers, Brian ---------------------------------------------------------------- Permission granted, Brian. Jim ---------------------------------------------------------------- You might also add that the DB2 preprocessor works. Juergen http://www.opencobol.org/modules/newbb/viewtopic.php?viewmode=thread&topic_id=105&forum=1&post_id=873 ---------------------------------------------------------------- I will Juergen. :) But, it might be a few more days. I'm in the last half, [i]well, the 90/10 part, where the last 10% is going to take 90% of the time,[/i] of converting the FAQ from ReStructuredText to LaTeX. TeX is freekin' cool. But it's put pending on some of the new entries for a while. The PDF that is generating is sweet looking, but the latex2html tool is producing a disappointing mess for the web pages on first try. [i]Fixable I'm sure, I only tried once for a few scant minutes and no RTFM[/i], but the dvipdf is the shiny new thing keeping me up till 5am over the last week :) So much fun. A preview of the new SQL entry is stashed at http://opencobol.add1tocobol.com/pdffaqsample.pdf (when I printed it through cups-pdf to get just the 5 page preview, it lost all the fancy clicky click links). (and it still needs info on the cool looking MySQL extfh ([i]external file handler[/i]) recently posted) Cheers, Brian ---------------------------------------------------------------- Subject: Another indexed file backend? One of the things listed on the ToDo wiki page concerns more indexed I/O backends. I have an interest in adding BASIS, Inc.'s BBx file system ([b][size=small][color=003399][font=Georgia]www.basis.com[/font][/color][/size][/b]) to the list, as we have many gigabytes of data stored therein, with only Pro/5 (Business Basic) available to access this data. It's an interpreted language, and not the speediest offering to come down the pike. Opening up its file system (there's a published API) to OpenCOBOL would bring some benefits from my point of view. Additionally, making OC support more file systems will make it more attractive as a platform. Whatever information/documentation exists to support this effort would be appreciated. I've already begun looking at fileio.c in libcob to get acquainted with the code. Jim ---------------------------------------------------------------- Jim; It's sorely in need of documenting, but OpenCOBOL sources include an API for including external file systems. In libcob/fileio.c you'll see references to extfh_... functions. These get compiled in from ./configure --with-seqra-extfh and --with-index-extfh. I was looking at it today. And I've been meaning to take a kick at replacing reliance on libdb with Tokyo Cabinet (an LGPL licensed DBM replacement with some nice features and a clean codebase). It's detailed work that will require a fair amount of study and crafting to get to an "OpenCOBOL quality" but Roger has already provided hook-points and there are good samples of how to pull off the operations in fileio.c for the other ISAM handlers. If/when I get the itch to really add Tokyo Cabinet, I'll start with documenting the steps. Umm, but don't wait for that promise...as it's not a promise but wishful thinking at this point. :-) Cheers, Brian ---------------------------------------------------------------- Subject: Screen painter rough draft. Preparing screen and printer program texts from layouts is tedious work which must be done with care. A simple program to produce the first draft for a screen section is presented here. A similar program for a printer is available if there is any interest. Please advise of bugs or improvements. So this: [code] ^Journal Transactions ^Account Date ^Ref ^Description ~xxxx !zzzzzzzz ~xxx ~xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ^Message ~xxxxxxxxx ^Enter=Accept F4=End F9=Cancel [/code] produces this: [code] 01 screen01. 05 line (01) column (02) value "Journal Transactions". 05 line (04) column (02) value "Account Date". 05 line (04) column (20) value "Ref". 05 line (04) column (25) value "Description". 05 scf01 line (05) column (02) pic x(04). 05 scf02 line (05) column (10) pic zzzzzzzz. 05 scf03 line (05) column (20) pic x(03). 05 scf04 line (05) column (25) pic x(30). 05 line (10) column (02) value "Message". 05 scf05 line (10) column (11) pic x(09). 05 line (12) column (02) value "Enter=Accept F4=End F9=Cancel". [/code] The program: [code] * * * * identification division. program-id. worklays. ***************************************************************** ** Program purpose is to take a screen layout from an input file ** and format it into cobol screen descriptions. The input file ** is written with a text editor. ** This produces a draft of the screen section. It does not include ** "to, from or using", nor does it have the descriptors such as ** "auto, bell etc". Having produced the draft it is no more work ** for the user to add these items to the program than it would ** have been to use an elaborated worklays program to include them. ** Literals are preceded by a ^. Edit values preceded by a "!" ** are reproduced in the output.Edit values preceded by a ** "~" are shown as a "pic x(n)".The values in the field must be ** "x". ** Edit values and literals are terminated after 80 characters ** or with two spaces or one space and a "^" or "~" or "!" or any ** of "^","~","!" alone . Thus if a literal has successive spaces ** it must be treated as two literals. ** Literals including format marks extending beyond column 80 are ** lost. Format marks are replaced in the output by spaces. ** There will always be at least one space between items and the first ** position in any line must always be a space. A literal which ** is 80 characters long must be reduced to 79 characters. ** Edit characters are treated as normal characters in literals. ** Edit characters > 17 will give an incorrect mask.The validity ** of the mask is not checked. ** Any non edit character in a mask is ignored. ** The screen produced by the program is named screenNN where NN ** is a two digit number. Likewise the variable fields are named ** scfNN. If the user is prepared to accept these names, ** screens can use successive numbers by including the last ** number previously used in the call list. ** Usage: ** Input: layout-file.any, last screen number used (nn), ** last field number used (nn). ** Output: layout-file.out. ** On first use in a set of screens ** the nn is entered as 0. ***************************************************************** environment division. input-output section. file-control. select in-file assign to input-name organization is line sequential file status in-stat. select out-file assign to out-name organization is line sequential. data division. file section. fd in-file. 01 in-record pic x(80). fd out-file. 01 out-record pic x(80). working-storage section. 01 input-name pic x(80) value spaces. 01 last-screen-number pic 99. 01 last-field-number pic 99. 01 arg-list pic x(80). 01 out-name pic x(80) value spaces. 01 input-area. 05 input-record. 10 input-item occurs 80 pic x. 05 input-sub pic 9(3). 05 input-sub-save pic 9(3). 05 edit-save pic x. 88 edit value 'c' 'C' 'd' 'D' 'z' 'Z' '9' '.' ',' '$' '-' '+' 'x' 'X' '/' '*' 'r' 'R' 'b' 'B' 'a' 'A' 'p' 'P' 's' 'S' 'v' 'V'. 05 chr-counter pic 9(2). 05 fld-counter pic 9(2). 05 lit-counter pic 9(3). 01 sw-switches. 05 in-stat pic xx. 88 in-success value "00". 05 pic x value 'n'. 88 literals value 'y'. 88 not-literals value 'n'. 05 pic x value 'n'. 88 edit-picx value 'y'. 88 not-edit-picx value 'n'. 01 literal-buffer. 05 literal-item occurs 82 pic x. 05 literal-sub pic 9(3). 01 output-lines. 05 screen-header-line. 10 pic x(17) value ' 01 screen'. 10 screen-line-value pic 9(2) value zero. 10 pic x value '.'. 05 literal-start-line. 10 pic x(20) value ' 05 line ('. 10 lit-line-value pic x(2). 10 pic x(10) value ') column ('. 10 lit-column-value pic x(2). 10 pic x(8) value ') value '. 05 literal-first-line. 10 pic x(11) value spaces. 10 pic x value quote. 10 first-line pic x(60) value spaces. 05 contination-line. 10 pic x(11) value ' - '. 10 pic x value quote. 10 second-line pic x(60) value spaces. 05 num-edit-line. 10 pic x(18) value ' 05 scf'. 10 field-num-value pic 9(2) value zero. 10 pic x(7) value ' line ('. 10 num-line-value pic x(2). 10 pic x(10) value ') column ('. 10 num-column-value pic x(2). 10 pic x(2) value ') '. 10 pic x(4) value 'pic '. 10 edited-number. 15 edit-mask occurs 18 pic x. 05 char-edit-line. 10 pic x(18) value ' 05 scf'. 10 field-x-value pic 9(2) value zero. 10 pic x(7) value ' line ('. 10 char-line-value pic x(2). 10 pic x(10) value ') column ('. 10 char-column-value pic x(2). 10 pic x(2) value ') '. 10 pic x(6) value 'pic x('. 10 char-x-count pic x(2). 10 pic x(2) value ').'. 05 edit-sub pic 9(3). 05 line-spot pic 9(2) value zero. 05 column-spot pic 9(2). * * * * procedure division. begin-program. perform initialization perform mainline close in-file out-file stop run. initialization. accept arg-list from command-line unstring arg-list delimited by spaces into input-name last-screen-number last-field-number string input-name delimited by "." ".out" delimited by size into out-name open input in-file output out-file initialize input-area literal-buffer edited-number move last-screen-number to screen-line-value move last-field-number to fld-counter. mainline. add 1 to screen-line-value move screen-header-line to out-record perform write-to-output perform until not in-success initialize edit-sub read in-file into input-record if in-success perform get-one-line end-if end-perform. get-one-line. move 0 to lit-counter move 0 to literal-sub add 1 to line-spot perform check-for-end-of-field with test after varying input-sub from 1 by 1 until input-sub is greater than 80. check-for-end-of-field. if input-sub > 80 or (input-item (input-sub) = "^" or "~" or "!") or (input-item (input-sub) = " " and (input-item (input-sub + 1) = " " or "^" or "~" or "!")) if literals perform format-literal else if edit perform format-edited-field end-if end-if end-if perform get-one-character. format-literal. move line-spot to lit-line-value move column-spot to lit-column-value move literal-start-line to out-record perform write-to-output move quote to literal-item (literal-sub + 1) move "." to literal-item (literal-sub + 2) if lit-counter > 58 move literal-buffer (1: 58) to first-line else move literal-buffer (1: 60) to first-line end-if move literal-first-line to out-record perform write-to-output if lit-counter > 58 move literal-buffer (59: 23) to second-line move contination-line to out-record perform write-to-output end-if initialize literal-buffer literal-sub set not-literals to true. format-edited-field. add 1 to fld-counter move fld-counter to field-num-value field-x-value if edit-picx move line-spot to char-line-value move column-spot to char-column-value set not-edit-picx to true move chr-counter to char-x-count move char-edit-line to out-record perform write-to-output else move line-spot to num-line-value move column-spot to num-column-value move "." to edit-mask (edit-sub + 1) move num-edit-line to out-record perform write-to-output end-if initialize edited-number edit-sub chr-counter move spaces to edit-save. write-to-output. write out-record after 1 move spaces to out-record. get-one-character. if literals add 1 to literal-sub if literal-sub = 1 move input-sub to column-spot end-if move input-item (input-sub) to literal-item (literal-sub) add 1 to lit-counter move input-sub to input-sub-save else move input-item (input-sub) to edit-save if edit move input-sub to input-sub-save if edit-picx add 1 to chr-counter if chr-counter = 1 move input-sub to column-spot end-if else add 1 to edit-sub if edit-sub = 1 move input-sub to column-spot end-if move input-item (input-sub) to edit-mask(edit-sub) end-if end-if end-if if input-item (input-sub) equal "^" set literals to true end-if if input-item (input-sub) equal "~" set edit-picx to true end-if. [/code] ---------------------------------------------------------------- Yes, it is a nice little program. Would like to see the printer program. BTW, the is a open-source toolset called cobcurses[1][2], which contains a interactive screen painter. It also generates COBOL code. 1) cobcurses - SF http://sourceforge.net/projects/cobcurses 2) cobcurses - Home http://cobcurses.sourceforge.net/ ---------------------------------------------------------------- Subject: VBISAM Hello. I found out that in order to have record locking with BDB i should set DB_HOME.. The problem is that files arent stored in one place only. Any solution for this? As the application was MF ISAM based i am thinking to try VB ISAM on Debian. VB isam supports locking as you mentioned. Right? However i dont know how to install vbisam... vbisam.h is not included. I searched this forum but couldnt find anything reliable.. Any suggestion? Thank you ---------------------------------------------------------------- I downloaded version 2.0 vbisam , did ./configure and make and make install.. http://www.sim-basis.de/vbisam-2.0.tar.gz Then i did ./configure --with-vbisam make clean make and make install. No problem at all...However when i try to execute a program i get this... cobcrun: error while loading shared libraries: libvbisam.so.1: cannot open shared object file: No such file or directory ---------------------------------------------------------------- http://www.mythtv.org/wiki/Troubleshooting:cannot_open_shared_object_file:_No_such_file_or_directory I did what it says and seems to work... ---------------------------------------------------------------- Note that VBISAM support in OC is marked as experimental. The (correct) vbisam.tar that you've used has some problems especially in WIN environments. Bugfixes for VBISAM itself can be found at http://kiska.net/opencobol/human . The biggest problem with VBISAM itself is that vb_check (this should rebuild broken VBISAM files) does not work at all (but the BDB stuff isn't better). fileio.c contains some bugs in all supported experimental ISAM, that are already fixed for 2.0. If you recognize bugs please post them here (with sample code that reproduces the errors), I'll have a look if they're fixed in 2.0 already. human BTW: I personally would use VBISAM instead of BDB for a lot of reasons. ---------------------------------------------------------------- Yeah, you just to make sure that any .so files are in the standard linker path. If you can't tweak [i]ld.conf[/i] or run [b]sudo ldconfig[/b] then you can always use [code] cobc -Lpath [/code] to help the linker find the libraries. There is also COB_LIBRARY_PATH, COB_PRE_LOAD and LD_LIBRARY_PATH (but many guru's poopoo on setting LD_LIBRARY_PATH and mention that you should set LD_RUN_PATH [b]before and during[/b] compiling so that executables don't need to worry, even if none of the environments variables are set in the process doing the running. See http://opencobol.add1tocobol.com/#what-is-cob-library-path and http://opencobol.add1tocobol.com/#what-is-cob-pre-load for more information on how these environment variables can be used to great effect during testing and experiments. Cheers, Brian ---------------------------------------------------------------- Subject: ISAM File Handling for MySQL I’m writing to suggest a proposal for your Open Cobol Project. I wrote an experimental piece of code in order to handle indexed file backed end for MySQL Data Base. It is an external indexed file Handler (mysql_extfh.c).is a 1000 lines of code; this is a very dirty and experimental version. The following table shows the different data structures of each system and how they correspond to one another. [code] +-----------+----------+ | COBOL | MySQL | +-----------+----------+ | Directory | DataBase | | File | Table | | Record | Row | | Field | Column | +-----------+----------+ [/code] I used Meta Data to Map Database Row to Cobol record. The Table ocmetadata_fields contains this Metada. For Example: COBOL Copy Book: [code] 01 VideoRecord. 02 VideoCode PIC 9(5). 02 VideoTitle PIC X(40). 02 VideoSupplierCode PIC 99. 02 VideoKey2. 03 VideoUbicacion PIC X(8). 03 VideoCode2 PIC 9(5). 02 VideoPrice PIC S9(15)V99 COMP-3. [/code] COBOL Select: [code] SELECT VideoFile ASSIGN TO "IDXVIDEO" ORGANIZATION IS INDEXED ACCESS MODE IS DYNAMIC RECORD KEY IS VideoCode ALTERNATE RECORD KEY IS VideoTitle WITH DUPLICATES ALTERNATE RECORD KEY IS VideoKey2 FILE STATUS IS VideoStatus. [/code] SQL Create Table: [code] CREATE TABLE IDXVIDEO ( VideoCode DECIMAL(5), VideoTitle CHAR(40), VideoSupplierCode DECIMAL(2), VideoUbicacion CHAR(8), VideoPrice DECIMAL(17,2), PRIMARY KEY ( VideoCode ), INDEX VideoTitle ( VideoTitle ), UNIQUE VideoUbicacion ( VideoUbicacion, VideoCode ) ); [/code] Maps to (Meta Data): [code] +------+---------------+-------------------+--------+------+------+--------+-------+-------+------+ | PKID | DB_Table_Name | DB_Field_Name | offset | size | type | digits | scale | flags | pic | +------+---------------+-------------------+--------+------+------+--------+-------+-------+------+ | 1 | IDXVIDEO | VideoCode | 0 | 5 | 16 | 5 | 0 | 0 | NULL | | 2 | IDXVIDEO | VideoTitle | 5 | 40 | 33 | 0 | 0 | 0 | NULL | | 3 | IDXVIDEO | VideoSupplierCode | 45 | 2 | 16 | 2 | 0 | 0 | NULL | | 4 | IDXVIDEO | VideoUbicacion | 47 | 8 | 33 | 0 | 0 | 0 | NULL | | 5 | IDXVIDEO | VideoCode | 55 | 5 | 16 | 5 | 0 | 0 | NULL | | 6 | IDXVIDEO | VideoPrice | 60 | 9 | 18 | 17 | 2 | 1 | NULL | +------+---------------+-------------------+--------+------+------+--------+-------+-------+------+ [/code] I have a Java program that reads COBOL COPY Book and generates the Meta Data Entries and Creates the Table. It requires some additional Manual Work to make final adjustments. mysql_extfh.c takes this input and performs this job. Let the programmer write the program using READ, WRITE, REWITE, DELETE, etc and interacting with a SQL Data Base (MySQL) My purpose is to include this external File handle in Open COBOL Project in order to perfect it. Rewrite the Utility that Parse COBOL COPY Book to Produce the Meta Data and Create Table in a Open Cobol Style (C Languaje, Open Cobol Parser, etc). I look forward to hearing from you. ---------------------------------------------------------------- Hi, this sounds very nice! I THINK you don't need to write any parsing or change OC source at all. These tables must be created in your extfh handler on open output (or open-io open-extend with SELECT OPTIONAL file). The extfh-handlers should have the necessary structure infos for the file already. I suppose to read the necessary informations to the connection (db-server, username, password) from environment vars. Did you try to change you extfh handler that way already? human ---------------------------------------------------------------- I compile and test in Windows. ---------------------------------------------------------------- Looks like a VERY good start. Please edit your previous post, here are some suggestions: - put the source into code tags like [ code]mycode[ /code] (without the space after [) - translate your comments to English - in extfh_cob_init_fileio get MYSQL_EXTFH_DEBUG from environment, too - check current mode in extfh_indexed_open and create the table if necessary (with the description in cob_file) --> this way there is no need for a JAVA mapper Where should one get the mysql headers and libraries? human ---------------------------------------------------------------- Thank you Human for your Advice. The MySQL Headers File are from MySQL Connector Updated 24-Feb-2011 [code] #include <my_global.h> #include <mysql.h> #include "config.h" #include "libcob.h" #include "libcob/coblocal.h" static int MYSQL_EXTFH_DEBUG = 0; static const cob_field_attr MYSQL_FIELD_ATTRIBUTES = {33, 0, 0, 0, NULL}; struct db_field { char *name; size_t offset; size_t size; int synonym; cob_field_attr attr; }; struct db_table_info { my_ulonglong field_count; struct db_field *field; int startcond; /* Previous 'start' condition value */ size_t index; }; static void pretty_display_numeric (cob_field *f, char *out) { unsigned char *p; int i; int digits; int scale; int size; cob_field_attr attr; cob_field temp; unsigned char pic[64]; unsigned char term_buff[260]; digits = COB_FIELD_DIGITS (f); scale = COB_FIELD_SCALE (f); size = (digits + (COB_FIELD_HAVE_SIGN (f) ? 1 : 0) + (scale > 0 ? 1 : 0)); p = pic; temp.size = size; temp.data = term_buff; temp.attr = &attr; COB_ATTR_INIT (COB_TYPE_NUMERIC_EDITED, digits, scale, 0, (char *)pic); memset (pic, 0, sizeof (pic)); memset (term_buff, 0, 256); if (COB_FIELD_HAVE_SIGN (f)) { *p++ = '+'; i = 1; memcpy (p, (unsigned char *)&i, sizeof(int)); p += sizeof(int); } if (scale > 0) { *p++ = '9'; i = digits - scale; memcpy (p, (unsigned char *)&i, sizeof(int)); p += sizeof(int); *p++ = '.'; // jfrd i = 1; memcpy (p, (unsigned char *)&i, sizeof(int)); p += sizeof(int); *p++ = '9'; i = scale; memcpy (p, (unsigned char *)&i, sizeof(int)); p += sizeof(int); } else { *p++ = '9'; i = digits; memcpy (p, (unsigned char *)&i, sizeof(int)); p += sizeof(int); } cob_move (f, &temp); strncpy(out, term_buff, size); out[size] = '\0'; } MYSQL *conn; void extfh_cob_init_fileio (const struct cob_fileio_funcs *sequential_funcs, const struct cob_fileio_funcs *lineseq_funcs, const struct cob_fileio_funcs *relative_funcs, int (*cob_file_write_opt)(cob_file *, const int)) { char *server = getenv("MYSQL_EXTFH_SERVER"); char *user = getenv("MYSQL_EXTFH_USER"); char *password = getenv("MYSQL_EXTFH_PASSWORD"); char *database = getenv("MYSQL_EXTFH_DATABASE"); MYSQL_EXTFH_DEBUG = atoi(getenv("MYSQL_EXTFH_DEBUG")); // Connect to Data Base conn = mysql_init(NULL); if (conn == NULL) { printf("Error %u: %s\n", mysql_errno(conn), mysql_error(conn)); exit(1); } /* Connect to database */ if (!mysql_real_connect(conn, server, user, password, database, 0, NULL, 0)) { fprintf(stdout, "Error %u: %s\n", mysql_errno(conn), mysql_error(conn)); exit(1); } if (MYSQL_EXTFH_DEBUG) printf("extfh_cob_init_fileio File: %s Line : %d\n", __FILE__, __LINE__); } void extfh_cob_exit_fileio (void) { // Disconnect from Data Base mysql_close(conn); if (MYSQL_EXTFH_DEBUG) printf("extfh_cob_exit_fileio File: %s Line : %d\n", __FILE__, __LINE__); } void extfh_indexed_unlock (cob_file *f) { if (MYSQL_EXTFH_DEBUG) printf("extfh_indexed_unlock File: %s Line : %d\n", __FILE__, __LINE__); } int extfh_indexed_locate (cob_file *f, char *filename) { // Do Nothing if (MYSQL_EXTFH_DEBUG) printf("extfh_indexed_locate File: %s Line : %d\n", __FILE__, __LINE__); return 0; } int extfh_indexed_open (cob_file *f, char *filename, const int mode, const int sharing) { MYSQL_RES *result; char query[255]; if (MYSQL_EXTFH_DEBUG) printf("extfh_indexed_open File: %s Line : %d mode %d\n", __FILE__, __LINE__, mode); sprintf(query, "SELECT * FROM ocmetadata_fields WHERE DB_Table_Name = '%s' ORDER BY offset", filename); if (MYSQL_EXTFH_DEBUG) printf("extfh_indexed_open File: %s Line : %d query = %s\n", __FILE__, __LINE__, query); if (mysql_query (conn, query) != 0) /* the statement failed */ { fprintf(stdout, "Error %u: %s\n", mysql_errno(conn), mysql_error(conn)); return COB_STATUS_35_NOT_EXISTS; } /* the statement succeeded; determine whether it returned data */ result = mysql_store_result(conn); if (result) /* a result set was returned */ { /* process rows and then free the result set */ MYSQL_ROW row; struct db_table_info *tab_info; size_t i, j; // Create the Mapper f->extfh_ptr = cob_malloc (sizeof (struct db_table_info)); if (f->extfh_ptr == NULL) return COB_STATUS_39_CONFLICT_ATTRIBUTE; tab_info = (struct db_table_info *) f->extfh_ptr; tab_info->field_count = mysql_num_rows(result); if (tab_info->field_count == 0) { mysql_free_result(result); return COB_STATUS_39_CONFLICT_ATTRIBUTE; } tab_info->field = cob_malloc( sizeof(struct db_field) * (tab_info->field_count)); if (tab_info->field == NULL) { mysql_free_result(result); return COB_STATUS_39_CONFLICT_ATTRIBUTE; } i = 0; while ((row = mysql_fetch_row (result)) != NULL) { if (MYSQL_EXTFH_DEBUG) printf(" File: %s Line : %d name %s offset %s size %s\n", __FILE__, __LINE__, row[2], row[3], row[4]); /* do something with row contents */ tab_info->field[i].name = strdup(row[2]); tab_info->field[i].offset = atoi(row[3]); tab_info->field[i].size = atoi(row[4]); tab_info->field[i].attr.type = atoi(row[5]); tab_info->field[i].attr.digits = atoi(row[6]); tab_info->field[i].attr.scale = atoi(row[7]); tab_info->field[i].attr.flags = atoi(row[8]); if (row[7] != NULL) tab_info->field[i].attr.pic = strdup(row[9]); else tab_info->field[i].attr.pic = NULL; tab_info->field[i].synonym = 0; i++; } mysql_free_result(result); for (i = 0; i < tab_info->field_count; i++) for (j = 0; j < tab_info->field_count; j++) { if ( (i != j) && ( strcmp(tab_info->field[i].name, tab_info->field[j].name ) == 0 ) ) { if (i > j) tab_info->field[i].synonym = 1; else tab_info->field[j].synonym = 1; } } tab_info->startcond = 4; tab_info->index = 0; } else /* no result set was returned */ { /* * does the lack of a result set mean that the statement didn't * return one, or that it should have but an error occurred? */ if (mysql_field_count (conn) == 0) { /* * statement generated no result set (it was not a SELECT, * SHOW, DESCRIBE, etc.); just report rows-affected value. */ if (MYSQL_EXTFH_DEBUG) printf ("Number of rows affected: %lu\n", (unsigned long) mysql_affected_rows (conn)); } else /* an error occurred */ { fprintf(stdout, "Error %u: %s\n", mysql_errno(conn), mysql_error(conn)); } } if (mode == COB_OPEN_OUTPUT) { sprintf(query, "TRUNCATE TABLE %s", filename); if (mysql_query (conn, query) != 0) /* the statement failed */ { fprintf(stdout, "Error %u: %s\n", mysql_errno(conn), mysql_error(conn)); return COB_STATUS_00_SUCCESS; } } if (MYSQL_EXTFH_DEBUG) printf("extfh_indexed_open File: %s Line : %d\n", __FILE__, __LINE__); /* this function could return: COB_STATUS_39_CONFLICT_ATTRIBUTE */ return COB_STATUS_00_SUCCESS; } int extfh_indexed_close (cob_file *f, const int opt) { struct db_table_info *tab_info = (struct db_table_info *) f->extfh_ptr; // Destroy the Mapper if (tab_info->field != NULL) free(tab_info->field); if (f->extfh_ptr != NULL) free(f->extfh_ptr); if (MYSQL_EXTFH_DEBUG) printf("extfh_indexed_close File: %s Line : %d\n", __FILE__, __LINE__); return 0; } int extfh_indexed_start (cob_file *f, const int cond, cob_field *key) { size_t k; size_t i; size_t offset; cob_field *fld; cob_field *rec = f->record; struct db_table_info *tab_info = (struct db_table_info *) f->extfh_ptr; tab_info->startcond = cond; tab_info->index = 0; if (MYSQL_EXTFH_DEBUG) { printf("extfh_indexed_start File: %s Line : %d\n", __FILE__, __LINE__); printf(" cond = %d\n", cond); printf("cob_file f->select_name %s\n", f->select_name); printf("cob_file f->assign %s\n", f->assign->data); printf("cob_file f->file_status %c%c\n", f->file_status[0], f->file_status[1] ); printf("cob_file f->record.data >%s< strlen = %d\n", rec->data, rec->size); printf("cob_file f->record_min %d\n", f->record_min); printf("cob_file f->record_max %d\n", f->record_max); } // Indexes and Keys Infortion for (i = 0; i < f->nkeys; i++) { struct cob_file_key idx = f->keys[i]; cob_field *fld = idx.field; const cob_field_attr *attr = fld->attr; if (MYSQL_EXTFH_DEBUG) printf("cob_file f->keys[i] >%s< strlen = %d offset = %d type = %d digits = %d scale = %d flags = %d pic = %s\n", fld->data, fld->size, idx.offset, attr->type, attr->digits, attr->scale, attr->flags, attr->pic); } /* search KOR */ for (k = 0; k < f->nkeys; ++k) { if (f->keys[k].field->data == key->data) { break; } } tab_info->index = k; fld = f->keys[k].field; offset = fld->data - rec->data; return 0; } int extfh_indexed_read (cob_file *f, cob_field *key, const int read_opts) { char query[250]; char where[250]; size_t k; size_t i; size_t offset; cob_field *fld; cob_field *rec = f->record; MYSQL_RES *result; struct db_table_info *tab_info = (struct db_table_info *) f->extfh_ptr; struct db_field field; /* search KOR */ for (k = 0; k < f->nkeys; ++k) { if (f->keys[k].field->data == key->data) { break; } } fld = f->keys[k].field; offset = fld->data - rec->data; strcpy(where, ""); for (i = 0; i < tab_info->field_count; i++) { field = tab_info->field[i]; if ( (field.offset >= offset) && ( (field.offset + field.size) <= (offset + fld->size) ) ) { char tmp[250]; char value[250]; unsigned char *p = key->data + (field.offset - offset); if (MYSQL_EXTFH_DEBUG) printf(" key field (KOR) is %s \n", field.name); { cob_field cf_from_cobol = { field.size, (unsigned char *) p, &(field.attr) }; cob_field cf_from_mysql = { field.size, (unsigned char *) &value, &MYSQL_FIELD_ATTRIBUTES }; cob_field *cfc = &cf_from_cobol; if ( COB_FIELD_IS_NUMERIC (cfc) ) pretty_display_numeric (cfc, value); else { cob_move( &cf_from_cobol, &cf_from_mysql ); value[field.size] = '\0'; } } sprintf(tmp, "%s = '%s'", field.name, value); if (strlen(where)) strcat(where, " AND "); strcat(where, tmp); } } sprintf(query, "select * from %s where %s", f->assign->data, where); if (mysql_query (conn, query) != 0) /* the statement failed */ { int file_status; fprintf(stdout, "Error %u: %s\n", mysql_errno(conn), mysql_error(conn)); switch (mysql_errno(conn)) { case 1062: file_status = COB_STATUS_22_KEY_EXISTS; break; } return file_status; } result = mysql_store_result(conn); if (result) /* a result set was returned */ { /* process rows and then free the result set */ MYSQL_ROW row; MYSQL_FIELD *mysql_field; if (mysql_num_rows(result) == 0) { mysql_free_result(result); return COB_STATUS_23_KEY_NOT_EXISTS; } while ((row = mysql_fetch_row (result)) != NULL) { char *data = rec->data; mysql_field_seek (result, 0); for (k = 0; k < mysql_num_fields (result); k++) { mysql_field = mysql_fetch_field (result); for (i = 0; i < tab_info->field_count; i++) { struct db_field field = tab_info->field[i]; if ( strcmp(field.name, mysql_field->name ) == 0 ) { cob_field cf_from_cobol = { field.size, (unsigned char *) &(data[field.offset]), &(field.attr) }; cob_field cf_from_mysql = { strlen( row[k] ), (unsigned char *) row[k], &MYSQL_FIELD_ATTRIBUTES }; cob_move( &cf_from_mysql, &cf_from_cobol ); } } } } mysql_free_result(result); } else /* no result set was returned */ { /* * does the lack of a result set mean that the statement didn't * return one, or that it should have but an error occurred? */ if (mysql_field_count (conn) == 0) { /* * statement generated no result set (it was not a SELECT, * SHOW, DESCRIBE, etc.); just report rows-affected value. */ if (MYSQL_EXTFH_DEBUG) printf ("Number of rows affected: %lu\n", (unsigned long) mysql_affected_rows (conn)); } else /* an error occurred */ { fprintf(stdout, "Error %u: %s\n", mysql_errno(conn), mysql_error(conn)); } } if (MYSQL_EXTFH_DEBUG) printf("extfh_indexed_read File: %s Line : %d\n", __FILE__, __LINE__); return 0; } int extfh_indexed_read_next(cob_file *f, const int read_opts) { int opts = read_opts & COB_READ_MASK; char query[250]; char where[250]; char where_value[250]; char orderby[250]; char tmp[250]; size_t k; size_t i; size_t offset; size_t fields_in_order_by; cob_field *fld; cob_field *rec = f->record; MYSQL_RES *result; struct db_table_info *tab_info = (struct db_table_info *) f->extfh_ptr; struct db_field field; if (MYSQL_EXTFH_DEBUG) printf("extfh_indexed_read_next File: %s Line : %d\n", __FILE__, __LINE__); fflush(stdout); /* indexed_start_internal en fileio.c Read Next without a Previous Star Presume PRYMARY Key #define COB_EQ 1 x == y #define COB_LT 2 x < y #define COB_LE 3 x <= y #define COB_GT 4 x > y #define COB_GE 5 x >= y #define COB_NE 6 x != y #define COB_FI 7 First #define COB_LA 8 Last */ switch (read_opts & COB_READ_MASK) { case COB_READ_NEXT: if (MYSQL_EXTFH_DEBUG) printf("extfh_indexed_read_next File: %s Line : %d READ NEXT\n", __FILE__, __LINE__); fflush(stdout); break; case COB_READ_PREVIOUS: if (MYSQL_EXTFH_DEBUG) printf("extfh_indexed_read_next File: %s Line : %d READ PREVIOUS\n", __FILE__, __LINE__); fflush(stdout); break; case COB_READ_FIRST: break; case COB_READ_LAST: break; } fld = f->keys[tab_info->index].field; offset = fld->data - rec->data; /* ORDER BY First in order to Know haw many Fields */ fields_in_order_by = 0; strcpy(orderby, ""); for (i = 0; i < tab_info->field_count; i++) { field = tab_info->field[i]; if ( (field.offset >= offset) && ( (field.offset + field.size) <= (offset + fld->size) ) ) { unsigned char *p = f->keys[tab_info->index].field->data + (field.offset - offset); if (MYSQL_EXTFH_DEBUG) { printf(" key field (KOR) is %s \n", field.name); fflush(stdout); } sprintf(tmp, "%s", field.name); if (strlen(orderby)) strcat(orderby, " ,"); strcat(orderby, tmp); if (opts == COB_READ_PREVIOUS) strcat(orderby, " desc"); fields_in_order_by++; } } strcpy(where_value, ""); strcpy(where, ""); for (i = 0; i < tab_info->field_count; i++) { int field_is_numeric = 0; field = tab_info->field[i]; if ( (field.offset >= offset) && ( (field.offset + field.size) <= (offset + fld->size) ) ) { char value[250]; unsigned char *p = f->keys[tab_info->index].field->data + (field.offset - offset); if (MYSQL_EXTFH_DEBUG) { printf(" key field (KOR) is %s \n", field.name); fflush(stdout); } { cob_field cf_from_cobol = { field.size, (unsigned char *) p, &(field.attr) }; cob_field cf_from_mysql = { field.size, (unsigned char *) &value, &MYSQL_FIELD_ATTRIBUTES }; cob_field *cfc = &cf_from_cobol; if ( COB_FIELD_IS_NUMERIC (cfc) ) { pretty_display_numeric (cfc, value); field_is_numeric = 1; } else { cob_move( &cf_from_cobol, &cf_from_mysql ); value[field.size] = '\0'; } } if (fields_in_order_by > 1) { if (strlen(where)) strcat(where, ", "); if (strlen(where) == 0) strcat(where, "concat("); if (field_is_numeric) { sprintf(tmp, "lpad(%s, %d, '0')", field.name, field.size); strcat(where, tmp); } else strcat(where, field.name); strcat(where_value, value); } else { if ( (opts == COB_READ_NEXT) && (tab_info->startcond == COB_GT) ) sprintf(tmp, "%s > '%s'", field.name, value); else if (opts == COB_READ_PREVIOUS) sprintf(tmp, "%s < '%s'", field.name, value); else sprintf(tmp, "%s = '%s'", field.name, value); if (strlen(where)) strcat(where, " AND "); strcat(where, tmp); } } } if (fields_in_order_by > 1) { if ( (opts == COB_READ_NEXT) && (tab_info->startcond == COB_GT) ) sprintf(tmp, "%s) > '%s' ", where, where_value); else if (opts == COB_READ_PREVIOUS) sprintf(tmp, "%s) < '%s' ", where, where_value); else sprintf(tmp, "%s) = '%s' ", where, where_value); strcpy(where, tmp); } sprintf(query, "select * from %s where %s order by %s limit 1", f->assign->data, where, orderby); if (MYSQL_EXTFH_DEBUG) printf(" query %s \n", query); if (mysql_query (conn, query) != 0) /* the statement failed */ { int file_status; fprintf(stdout, "Error %u: %s\n", mysql_errno(conn), mysql_error(conn)); switch (mysql_errno(conn)) { case 1062: file_status = COB_STATUS_22_KEY_EXISTS; break; } return file_status; } result = mysql_store_result(conn); if (result) /* a result set was returned */ { /* process rows and then free the result set */ MYSQL_ROW row; MYSQL_FIELD *mysql_field; if (mysql_num_rows(result) == 0) { mysql_free_result(result); return COB_STATUS_10_END_OF_FILE; } while ((row = mysql_fetch_row (result)) != NULL) { char *data = rec->data; mysql_field_seek (result, 0); for (k = 0; k < mysql_num_fields (result); k++) { mysql_field = mysql_fetch_field (result); for (i = 0; i < tab_info->field_count; i++) { struct db_field field = tab_info->field[i]; if ( strcmp(field.name, mysql_field->name ) == 0 ) { cob_field cf_from_cobol = { field.size, (unsigned char *) &(data[field.offset]), &(field.attr) }; cob_field cf_from_mysql = { strlen( row[k] ), (unsigned char *) row[k], &MYSQL_FIELD_ATTRIBUTES }; cob_move( &cf_from_mysql, &cf_from_cobol ); } } } } mysql_free_result(result); } else /* no result set was returned */ { /* * does the lack of a result set mean that the statement didn't * return one, or that it should have but an error occurred? */ if (mysql_field_count (conn) == 0) { /* * statement generated no result set (it was not a SELECT, * SHOW, DESCRIBE, etc.); just report rows-affected value. */ if (MYSQL_EXTFH_DEBUG) printf ("Number of rows affected: %lu\n", (unsigned long) mysql_affected_rows (conn)); } else /* an error occurred */ { fprintf(stdout, "Error %u: %s\n", mysql_errno(conn), mysql_error(conn)); } } if (MYSQL_EXTFH_DEBUG) printf("extfh_indexed_read_next File: %s Line : %d\n", __FILE__, __LINE__); return 0; } int extfh_indexed_write (cob_file *f, const int opt) { char query[500]; size_t i; cob_field *rec = f->record; MYSQL_RES *result; struct db_table_info *tab_info = (struct db_table_info *) f->extfh_ptr; if (MYSQL_EXTFH_DEBUG) { printf("extfh_indexed_write File: %s Line : %d\n", __FILE__, __LINE__); printf("cob_file f->select_name %s\n", f->select_name); printf("cob_file f->file_status %c%c\n", f->file_status[0], f->file_status[1] ); printf("cob_file f->record.data >%s< strlen = %d\n", rec->data, rec->size); printf("cob_file f->record_min %d\n", f->record_min); printf("cob_file f->record_max %d\n", f->record_max); } // Indexes and Keys Infortion for (i = 0; i < f->nkeys; i++) { struct cob_file_key idx = f->keys[i]; cob_field *fld = idx.field; const cob_field_attr *attr = fld->attr; if (MYSQL_EXTFH_DEBUG) printf("cob_file f->keys[i] >%s< strlen = %d offset = %d type = %d digits = %d scale = %d flags = %d pic = %s\n", fld->data, fld->size, idx.offset, attr->type, attr->digits, attr->scale, attr->flags, attr->pic); } strcpy(query, "insert into "); strcat(query, f->assign->data); strcat(query, " ("); for (i = 0; i < tab_info->field_count; i++) { struct db_field field = tab_info->field[i]; if (!field.synonym) { if (i > 0) strcat(query, " ,"); strcat(query, field.name); } } strcat(query, ") values ("); for (i = 0; i < tab_info->field_count; i++) { char value[255]; char *data = rec->data; struct db_field field = tab_info->field[i]; if (!field.synonym) { cob_field cf_from_cobol = { field.size, (unsigned char *) &(data[field.offset]), &(field.attr) }; cob_field cf_from_mysql = { field.size, (unsigned char *) &value, &MYSQL_FIELD_ATTRIBUTES }; cob_field *cfc = &cf_from_cobol; if ( COB_FIELD_IS_NUMERIC (cfc) ) pretty_display_numeric (cfc, value); else { cob_move( &cf_from_cobol, &cf_from_mysql ); value[field.size] = '\0'; } if (MYSQL_EXTFH_DEBUG) printf(" File: %s Line : %d value %s\n", __FILE__, __LINE__, value); fflush(stdout); if (i > 0) strcat(query, " ,"); strcat(query, "'"); strcat(query, value); strcat(query, "'"); } } strcat(query, ")"); if (MYSQL_EXTFH_DEBUG) printf(" File: %s Line : %d query %s\n", __FILE__, __LINE__, query); if (mysql_query (conn, query) != 0) /* the statement failed */ { int file_status; fprintf(stdout, "Error %u: %s\n", mysql_errno(conn), mysql_error(conn));fflush(stdout); switch (mysql_errno(conn)) { case 1062: file_status = COB_STATUS_22_KEY_EXISTS; break; case 1110: file_status = COB_STATUS_30_PERMANENT_ERROR; break; default: file_status = COB_STATUS_00_SUCCESS; break; } return file_status; } result = mysql_store_result(conn); if (result) /* a result set was returned */ { /* process rows and then free the result set */ MYSQL_ROW row; tab_info->field_count = 0; while ((row = mysql_fetch_row (result)) != NULL) { /* do something with row contents */ } mysql_free_result(result); } else /* no result set was returned */ { /* * does the lack of a result set mean that the statement didn't * return one, or that it should have but an error occurred? */ if (mysql_field_count (conn) == 0) { /* * statement generated no result set (it was not a SELECT, * SHOW, DESCRIBE, etc.); just report rows-affected value. */ if (MYSQL_EXTFH_DEBUG) printf ("Number of rows affected: %lu\n", (unsigned long) mysql_affected_rows (conn)); } else /* an error occurred */ { fprintf(stdout, "Error %u: %s\n", mysql_errno(conn), mysql_error(conn)); } } return COB_STATUS_00_SUCCESS; } int extfh_indexed_delete (cob_file *f) { char query[250]; char where[250]; size_t i; size_t offset; cob_field *fld; cob_field *rec = f->record; struct db_table_info *tab_info = (struct db_table_info *) f->extfh_ptr; struct db_field field; if (MYSQL_EXTFH_DEBUG) printf("extfh_indexed_delete File: %s Line : %d\n", __FILE__, __LINE__); strcpy(query, "DELETE FROM "); strcat(query, f->assign->data); strcat(query, " WHERE "); fld = f->keys[0].field; offset = fld->data - rec->data; /* Ojo - Este Busqueda deberia ser Capaz de Devolver varios Campos */ strcpy(where, ""); for (i = 0; i < tab_info->field_count; i++) { field = tab_info->field[i]; if ( (field.offset >= offset) && ( (field.offset + field.size) <= (offset + fld->size) ) ) { char tmp[250]; char value[250]; unsigned char *p = f->keys[0].field->data + (field.offset - offset); if (MYSQL_EXTFH_DEBUG) printf(" key field (KOR) is %s \n", field.name); { cob_field cf_from_cobol = { field.size, (unsigned char *) p, &(field.attr) }; cob_field cf_from_mysql = { field.size, (unsigned char *) &value, &MYSQL_FIELD_ATTRIBUTES }; cob_field *cfc = &cf_from_cobol; if ( COB_FIELD_IS_NUMERIC (cfc) ) pretty_display_numeric (cfc, value); else { cob_move( &cf_from_cobol, &cf_from_mysql ); value[field.size] = '\0'; } } sprintf(tmp, "%s = '%s'", field.name, value); if (strlen(where)) strcat(where, " AND "); strcat(where, tmp); } } strcat(query, where); if (MYSQL_EXTFH_DEBUG) printf("extfh_indexed_delete File: %s Line : %d query %s\n", __FILE__, __LINE__, query); if (mysql_query (conn, query) != 0) /* the statement failed */ { int file_status; fprintf(stdout, "Error %u: %s\n", mysql_errno(conn), mysql_error(conn)); switch (mysql_errno(conn)) { case 1062: file_status = COB_STATUS_22_KEY_EXISTS; break; } return file_status; } return COB_STATUS_00_SUCCESS; } int extfh_indexed_rewrite (cob_file *f, const int opt) { char query[250]; char where[250]; size_t i; size_t offset; cob_field *fld; cob_field *rec = f->record; struct db_table_info *tab_info = (struct db_table_info *) f->extfh_ptr; struct db_field field; if (MYSQL_EXTFH_DEBUG) printf("extfh_indexed_rewrite File: %s Line : %d\n", __FILE__, __LINE__); strcpy(query, "UPDATE "); strcat(query, f->assign->data); strcat(query, " SET "); for (i = 0; i < tab_info->field_count; i++) { struct db_field field = tab_info->field[i]; char value[255]; char *data = rec->data; if (!field.synonym) { if (i > 0) strcat(query, " ,"); strcat(query, field.name); strcat(query, " = "); { cob_field cf_from_cobol = { field.size, (unsigned char *) &(data[field.offset]), &(field.attr) }; cob_field cf_from_mysql = { field.size, (unsigned char *) &value, &MYSQL_FIELD_ATTRIBUTES }; cob_field *cfc = &cf_from_cobol; if ( COB_FIELD_IS_NUMERIC (cfc) ) pretty_display_numeric (cfc, value); else { cob_move( &cf_from_cobol, &cf_from_mysql ); value[field.size] = '\0'; } } strcat(query, "'"); strcat(query, value); strcat(query, "'"); } } strcat(query, " WHERE "); fld = f->keys[0].field; offset = fld->data - rec->data; /* Ojo - Este Busqueda deberia ser Capaz de Devolver varios Campos */ strcpy(where, ""); for (i = 0; i < tab_info->field_count; i++) { field = tab_info->field[i]; if ( (field.offset >= offset) && ( (field.offset + field.size) <= (offset + fld->size) ) ) { char tmp[250]; char value[250]; unsigned char *p = f->keys[0].field->data + (field.offset - offset); if (MYSQL_EXTFH_DEBUG) printf(" key field (KOR) is %s \n", field.name); { cob_field cf_from_cobol = { field.size, (unsigned char *) p, &(field.attr) }; cob_field cf_from_mysql = { field.size, (unsigned char *) &value, &MYSQL_FIELD_ATTRIBUTES }; cob_field *cfc = &cf_from_cobol; if ( COB_FIELD_IS_NUMERIC (cfc) ) pretty_display_numeric (cfc, value); else { cob_move( &cf_from_cobol, &cf_from_mysql ); value[field.size] = '\0'; } } sprintf(tmp, "%s = '%s'", field.name, value); if (strlen(where)) strcat(where, " AND "); strcat(where, tmp); } } strcat(query, where); if (MYSQL_EXTFH_DEBUG) printf("File: %s Line : %d query %s\n", __FILE__, __LINE__, query); if (mysql_query (conn, query) != 0) /* the statement failed */ { int file_status; fprintf(stdout, "Error %u: %s\n", mysql_errno(conn), mysql_error(conn)); switch (mysql_errno(conn)) { case 1062: file_status = COB_STATUS_22_KEY_EXISTS; break; } return file_status; } return COB_STATUS_00_SUCCESS; } [/code] ---------------------------------------------------------------- That's wicked awesome. Thanks muchly. Let's hope this spurs other extfh handling. Yayyy! Cheers, Brian ---------------------------------------------------------------- I think we need a additional parameter in extfh_indexed_unlock indicating COMMIT or ROLLBACK. Something like void extfh_indexed_unlock(cob_file *f, const int read_opts) This imply changes in fileio.h and others. ---------------------------------------------------------------- Why do you think you need COMMIT and ROLLBACK? As EXTFH simulates ISAM access you don't have any ROLLBACK. Every DELETE/WRITE/REWRITE must be committed when it is called, the file lock (locking whole table) has to be set at OPEN-OUTPUT or OPEN WITH LOCK, while the record lock depends on the READ and the LOCK clauses of REWRITE. Therefore all COMMIT/ROLLBACK have to be done internal. I guess correct locking is one of the hardest things when writing EXTFH handlers for DB. As soon as you've implemented the table structure and structure checkings in extfh_indexed_open you can fire the test suites on your handler. human ---------------------------------------------------------------- Thank you Human for your comments. If you see fileio.c both void cob_commit (void) generated when the COBOL program uses commit statement and void cob_rollback (void) generated when the COBOL program uses rollback statement calls cob_file_unlock that’s calls extfh_indexed_unlock This way the external file handling knows what action take when extfh_indexed_unlock is called. and will could supports transactions. ---------------------------------------------------------------- Subject: [BUG]UNSTIRNG DELIMITED BY ALL "hoge" hi, I found UNSTRING bug(OC 1.0 or later). this is sample code. [code] IDENTIFICATION DIVISION. PROGRAM-ID. SAMPLE01. ENVIRONMENT DIVISION. CONFIGURATION SECTION. INPUT-OUTPUT SECTION. FILE-CONTROL. * DATA DIVISION. FILE SECTION. * WORKING-STORAGE SECTION. * 01 WRK-AREA. 03 WRK-STR PIC X(100). 03 WRK-STR1 PIC X(30). 03 WRK-STR2 PIC X(30). 03 WRK-STR3 PIC X(30). 03 WRK-STR4 PIC X(30). * PROCEDURE DIVISION. * MOVE "abcabcabcdefabchogeabcmoge" TO WRK-STR UNSTRING WRK-STR DELIMITED BY ALL "abc" INTO WRK-STR1, WRK-STR2, WRK-STR3, WRK-STR4 END-UNSTRING * DISPLAY "WRK-STR1[" WRK-STR1 "]" DISPLAY "WRK-STR2[" WRK-STR2 "]" DISPLAY "WRK-STR3[" WRK-STR3 "]" DISPLAY "WRK-STR4[" WRK-STR4 "]" * STOP RUN . * [/code] it should be [code] WRK-STR1[ ] WRK-STR2[def ] WRK-STR3[hoge ] WRK-STR4[moge ] [/code] howerver, it becomes to [code] WRK-STR1[ ] WRK-STR2[ ] WRK-STR3[ ] WRK-STR4[def ] [/code] patch(for HEAD) is here. [code] Index: strings.c =================================================================== RCS file: /cvsroot/open-cobol/open-cobol/libcob/strings.c,v retrieving revision 1.78 diff -u -r1.78 strings.c --- strings.c 28 Jul 2008 14:22:55 -0000 1.78 +++ strings.c 23 Feb 2011 04:20:07 -0000 @@ -547,7 +547,7 @@ dlm_data = dp; dlm_size = dlsize; if (dlm_list[i].uns_all) { - for (p++ ; p < s; p++) { + for (p+=dlsize ; p < s; p+=dlsize) { if (p + dlsize > s) { break; } [/code] Regards ---------------------------------------------------------------- Good catch! I've included that fix for 2.0. human ---------------------------------------------------------------- Subject: OpenCOBOL Complex ODO (OCCURS DEPENDING ON) Hi, I am new to COBOL(and OpenCOBOL) and my question is about "complex-odo" (OCCURS...DEPENDING ON) in OpenCOBOL. I used 1.0 on following code ...... 01 W-PTDO-PROC-TBL. 05 W-PTDO-PROC-ENTRY OCCURS 0 TO 450 TIMES DEPENDING ON W-PTDO-PROC-MAX INDEXED BY W-PTDO-PROC-INDX. 10 W-PTDO-PROC-APC PIC X(05). 10 W-PTDO-PROC-LNSUB PIC S9(07) COMP-3. 10 W-PTDO-PROC-KEY. 15 W-PTDO-PROC-WA-OFFSET PIC 9(08)V99. 15 W-PTDO-PROC-UNITS PIC 9(09). 10 W-PTDO-PROC-DEVICE-CNT PIC 9(03). 10 W-PTDO-PROC-DARRAY OCCURS 0 TO 450 TIMES DEPENDING ON W-PTDO-DARRAY-MAX INDEXED BY W-PTDO-DARRAY-INDX. 15 W-PTDO-PROC-DHCPCS PIC X(05). 10 W-PTDO-DARRAY-SIZE PIC 9(03). 10 W-PTDO-PROC-TOT-DCHRGS PIC 9(10)V99. 10 W-PTDO-PROC-TOT-DUNITS PIC 9(05). 10 W-PTDO-PROC-USED PIC X(01). ...... and cobc returns with this error msg: Error: 'W-PTDO-PROC-ENTRY' cannot have the OCCURS clause due to 'W-PTDO-PROC-DARRAY' And above error msg is issued from field.c where I found this comment /* the data item that contains a OCCURS DEPENDING clause shall not be subordinate to a data item that has the OCCURS clause */ Is there anyway to make OpenCOBOL support this "complex-odo"? My above code snippet, with "OCCURS DEPENDING" nested under a higher level "OCCURS" clause, seems to be a well-defined "complex-odo" according to appendix of IBM's COBOL Programming Guide. Thank you, Billy Rong ---------------------------------------------------------------- Just in case anyone comes to this thread first... See http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1271&forum=1&post_id=6368#forumpost6368 for more details and a solution. Cheers, Brian ---------------------------------------------------------------- I got same error, still not found any solution. If complex ODO will not support then is any other enterprises product available for ODO? ---------------------------------------------------------------- Sure, there are several options if you want to PURCHASE and IBM mainframe compatible compiler. There are (amont others): - Micro Focus Mainframe Express - Fujitsu (Alchemy) NetCOBOL - not ot mention IBM's own RDz procuct line It you want URLs for any of these commercial products, they are fairly easy to find on the web. Alternatively, I can provide them for you. I don't think any of them are under around $1000 (USD) and some may run up to $5000 per seat. ---------------------------------------------------------------- [quote] wmklein wrote: Sure, there are several options if you want to PURCHASE and IBM mainframe compatible compiler. There are (amont others): - Micro Focus Mainframe Express - Fujitsu (Alchemy) NetCOBOL - not ot mention IBM's own RDz procuct line [/quote] I've tried, but the following code does not compile on Enterprise (z/OS) as well. [code] DATA DIVISION. WORKING-STORAGE SECTION. 77 W-PTDO-PROC-MAX PIC 9(03). 77 W-PTDO-DARRAY-MAX PIC 9(03). 01 W-PTDO-PROC-TBL. 05 W-PTDO-PROC-ENTRY OCCURS 0 TO 450 TIMES DEPENDING ON W-PTDO-PROC-MAX INDEXED BY W-PTDO-PROC-INDX. 10 W-PTDO-PROC-APC PIC X(05). 10 W-PTDO-PROC-LNSUB PIC S9(07) COMP-3. 10 W-PTDO-PROC-KEY. 15 W-PTDO-PROC-WA-OFFSET PIC 9(08)V99. 15 W-PTDO-PROC-UNITS PIC 9(09). 10 W-PTDO-PROC-DEVICE-CNT PIC 9(03). 10 W-PTDO-PROC-DARRAY OCCURS 0 TO 450 TIMES DEPENDING ON W-PTDO-DARRAY-MAX INDEXED BY W-PTDO-DARRAY-INDX. 15 W-PTDO-PROC-DHCPCS PIC X(05). 10 W-PTDO-DARRAY-SIZE PIC 9(03). 10 W-PTDO-PROC-TOT-DCHRGS PIC 9(10)V99. 10 W-PTDO-PROC-TOT-DUNITS PIC 9(05). 10 W-PTDO-PROC-USED PIC X(01). [/code] Well, The problem is with the nesting of the “occurs depending” with the above structure. I believe, the concept of “occurs depending on” should only be applied to varying the number of elements of which are of fixed length. However, since ‘W-PTDO-PROC-DARRAY’, is an subordinate of ‘W-PTDO-PROC-ENTRY’ it’s variable length attribute was not allowed in the above context. As my understanding, the nesting of varying elements are not allowed due to added complexity. I believe, the above structure, is also know as jagged arrays in which where each row may have a different number of sub elements. In my experience, for Cobol running on the mainframe, we either allow the maximum number elements for the inner most arrarys. [code] 10 W-PTDO-PROC-DARRAY OCCURS 450 TIMES INDEXED BY W-PTDO-DARRAY-INDX. [/code] Or create a reference to another variable length array. [code] 10 W-PTDO-PROC-DARRAY-PTR USAGE IS POINTER. [/code] In this case, W-PTDO-PROC-DARRAY-PTR is set to the address of another array. ---------------------------------------------------------------- Subject: OpenCOBOL Complex ODO (OCCURS DEPENDING ON) Hi, I am new to COBOL(and OpenCOBOL) and my question is about "complex-odo" (OCCURS...DEPENDING ON) in OpenCOBOL. I used 1.0 on following code ...... 01 W-PTDO-PROC-TBL. 05 W-PTDO-PROC-ENTRY OCCURS 0 TO 450 TIMES DEPENDING ON W-PTDO-PROC-MAX INDEXED BY W-PTDO-PROC-INDX. 10 W-PTDO-PROC-APC PIC X(05). 10 W-PTDO-PROC-LNSUB PIC S9(07) COMP-3. 10 W-PTDO-PROC-KEY. 15 W-PTDO-PROC-WA-OFFSET PIC 9(08)V99. 15 W-PTDO-PROC-UNITS PIC 9(09). 10 W-PTDO-PROC-DEVICE-CNT PIC 9(03). 10 W-PTDO-PROC-DARRAY OCCURS 0 TO 450 TIMES DEPENDING ON W-PTDO-DARRAY-MAX INDEXED BY W-PTDO-DARRAY-INDX. 15 W-PTDO-PROC-DHCPCS PIC X(05). 10 W-PTDO-DARRAY-SIZE PIC 9(03). 10 W-PTDO-PROC-TOT-DCHRGS PIC 9(10)V99. 10 W-PTDO-PROC-TOT-DUNITS PIC 9(05). 10 W-PTDO-PROC-USED PIC X(01). ...... and cobc returns with this error msg: Error: 'W-PTDO-PROC-ENTRY' cannot have the OCCURS clause due to 'W-PTDO-PROC-DARRAY' And above error msg is issued from field.c where I found this comment /* the data item that contains a OCCURS DEPENDING clause shall not be subordinate to a data item that has the OCCURS clause */ Is there anyway to make OpenCOBOL support this "complex-odo"? My above code snippet, with "OCCURS DEPENDING" nested under a higher level "OCCURS" clause, seems to be a well-defined "complex-odo" according to appendix of IBM's COBOL Programming Guide. Thank you, Billy Rong ---------------------------------------------------------------- The sample can of course only be compiled if [code] 77 W-PTDO-PROC-MAX PIC 9(03). 77 W-PTDO-DARRAY-MAX PIC 9(03).[/code] are added and results in the error messagea [quote]Error: 'W-PTDO-PROC-ENTRY' cannot have the OCCURS clause due to 'W-PTDO-PROC-DARRAY' Error: 'W-PTDO-PROC-DARRAY' cannot have OCCURS DEPENDING[/quote] And this is exactly what the COBOL standard says, quoting 20xx draft, page 333 [quote]13.18.37 OCCURS clause [...] 13.18.37.2 Syntax rules ALL FORMATS 1) The OCCURS clause shall not be specified in a data description entry that: [...] b) Has an occurs-depending table subordinate to it.[/quote] Therefore for getting it to work you need to remove one of the two [code]FROM 0 TO 450 DEPENDING ON[/code] clauses. If there's ever an hack for that it should only be active with -std=mf. It's interesting that the second error message doesn't occur when -std=mf or -std=ibm is used. If anyone know's why, it would be nice to know. human BTW: Please edit the first post and use code tags for the COBOL sources. ---------------------------------------------------------------- Although "complex ODOs" are definitely not part of the COBOL Standard (and haven't been since 1985 - see the substantive change entry in that document), it is also true that this is a VERY common extension to the Standard. The PROBLEM is that although the syntax is portable (as an extenhsion) to many compilers, the actual semantics often differ. Pleasee see the Micro Focus ODO-SLIDE directive to see the two (most common) meanings of this extension. See; [url=http://documentation.microfocus.com/help/topic/com.microfocus.eclipse.infocenter.visualcobol.r3vc/HRCDRHCDIR4N.html]http://documentation.microfocus.com/help/topic/com.microfocus.eclipse.infocenter.visualcobol.r3vc/HRCDRHCDIR4N.html[/url] ---------------------------------------------------------------- What would we do without Mr. Klein? Your knowledge of the standards is incredible. Thank you for all that you do. jimc ---------------------------------------------------------------- There is a configuration option that controls this. Note I don't play with 1.0 much anymore, having the 1.1pre-rel from Feb 2009. Find [b]default.conf[/b] (I have it under [i]/usr/local/share/open-cobol/config/[/i]) See complex-odo: no Change to complex-odo: yes Or, without changing your default, copy it to your working source dir and use [code] cobc -conf=mycobol.conf [/code] or use one of the other 'standard' configuration files. Ala [code] cobc -std=mf [/code] There are stock configurations for mf, ibm, mvs, cobol2000, cobol85 and bs2000. Again, I forget most of my 1.0 lore at this point. But on my system, these configurations mention the control variable. [code] $ grep complex-odo * bs2000.conf:complex-odo: yes default.conf:complex-odo: no ibm.conf:complex-odo: yes mf.conf:complex-odo: yes mvs.conf:complex-odo: yes [/code] [code] cobc --help [/code] will show your -std and -conf capabilities. I'll add an entry about complex Occurs Depending On to the FAQ real soon now. Cheers, Brian ---------------------------------------------------------------- I may not made me clear: it doesn't depend on the -std as cobc doesn't compile it at all (no matter if 1.1 or current 2.0dev is used). I understand that this odo-setting takes care for the second error message, but why not for the first? Is this a bug? human ---------------------------------------------------------------- Have you tried compiling it with either std=IBM or std=mf? Do you get the same compiler messages when those are set? It would surprise me if you did. What is the "first message" that you get when one of these std settings is in effect? (and where and how have you defined the fields that you reference in the DEPENDING ON phrase? I don't see those in your sample code. ---------------------------------------------------------------- I tried to compile with every std that is available as I've thought this would solve the problem of the first post. If you compile without any std switch you get: [quote]Error: 'W-PTDO-PROC-ENTRY' cannot have the OCCURS clause due to 'W-PTDO-PROC-DARRAY' Error: 'W-PTDO-PROC-DARRAY' cannot have OCCURS DEPENDING[/quote] compiled with most std switches you get [quote]Error: 'W-PTDO-PROC-ENTRY' cannot have the OCCURS clause due to 'W-PTDO-PROC-DARRAY'[/quote] human ---------------------------------------------------------------- Subject: Patch for vbisam-2.0 (Linux x86_64) OS: openSuse Linux 11.2 x86_64 gcc: 4.4.1 Download from: [url=http://www.sim-basis.de/vbisam-2.0.tar.gz]http://www.sim-basis.de/vbisam-2.0.tar.gz[/url] --- Compile and Build export CFLAGS=-Wno-strict-aliasing ./configure --with-lfs64 --with-compatcisam --with-debug --libdir=/usr/local/lib64 make make install ldconfig --- Patches [b]vbisam.h[/b] (fix compile error): [code] --- vbisam.h_original 2011-02-25 09:23:27.770433435 -0300 +++ vbisam.h_patched 2011-02-25 09:34:14.333184251 -0300 @@ -25,7 +25,11 @@ #define VBISAM_USE_LONG_LONG /* Note hack for now */ #ifdef VBISAM_USE_LONG_LONG +/* Patch by DeAngeli - Fatto Consultoria e Sistemas #define vbisam_off_t long long +*/ +#define vbisam_off_t off_t +// end of patch #else #define vbisam_off_t int #endif [/code] [b]libvbisam/isinternal.h[/b] (fix bug that builds the index using only two bytes): [code] --- isinternal.h_original 2011-02-25 09:23:05.329185666 -0300 +++ isinternal.h_patched 2011-02-25 09:34:37.202184329 -0300 @@ -203,7 +203,11 @@ #endif #if defined(ALLOW_MISALIGNED) && !defined(WORDS_BIGENDIAN) +/* Patch by DeAngeli #define inl_ldlong(x) (int)(VB_BSWAP_32(*((unsigned short MISALIGNED *)(x)))) +*/ +#define inl_ldlong(x) (int)(VB_BSWAP_32(*((unsigned int MISALIGNED *)(x)))) +// end of patch #else static inline int inl_ldlong (void *pclocation) [/code] [b]libvbisam/vbkeysio.c[/b] (fix bug that returns "not found" if there are more than 128 records in the file): [code] --- vbkeysio.c_original 2011-02-25 09:23:12.356183433 -0300 +++ vbkeysio.c_patched 2011-02-25 09:40:03.569184210 -0300 @@ -682,7 +682,11 @@ case LONGTYPE: iremainder = pskptr->kp_leng; while (iremainder > 0) { + /* Patch by DeAngeli - Fatto Consultoria e Sistemas inl_stlong (ihigh ? LONG_MAX : LONG_MIN, pckeyvalue); + */ + inl_stlong (ihigh ? INT_MAX : INT_MIN, pckeyvalue); + // end of patch pckeyvalue += LONGSIZE; iremainder -= LONGSIZE; } [/code] DeAngeli ---------------------------------------------------------------- As two of the three fixes are already in the fix-package (together with more that you've missed) you should visit http://kiska.net/opencobol/human for accessing the changes we made already. human ---------------------------------------------------------------- posted twice because of 503 Service Temporary not available... just ignore this one. ---------------------------------------------------------------- human. What are the two errors that were already fixed? I already had downloaded that package [url=http://kiska.net/opencobol/human/msvc_mail.zip]http://kiska.net/opencobol/human/msvc_mail.zip[/url], but I didn't see the fix for the second and third errors. Just the first error was fixed by the other way. I believe the other two errors were still without my fixes. DeAngeli ---------------------------------------------------------------- The second one was missing. Although I didn't checked if it's necessary, I've included it in my working copy. We may get a fossil for vbisam and I'd upload my working copy there. Most important changes to the tarball you've used: - Compilable with a lot more compilers (including MSC, BCC, Watcom) - All strings marked as translatable with gettext (didn't had the time to finish that) - Working in Win environments - General bug fixes and a vbcheck that did not chrash on corrupt files (not able to rebuild them either, but it's a start...) human ---------------------------------------------------------------- human I also tried using the version of 2.1.1 ([url=http://add1tocobol.com/wp-content/uploads/2010/11/OCKit4Web.tar.gz]http://add1tocobol.com/wp-content/uploads/2010/11/OCKit4Web.tar.gz[/url]) In this version ([b]vbisam-2.1.1[/b]), the first two problems I mentioned do not occur. On the other hand, the third bug (in [b]vbkeysio.c[/b]) still continues. The fix is the same, but in line 549 instead of 685. Although the new version corrects some bugs, I noticed that there are other bugs, but I still can not resolve them. So I kept the version 2.0. Please, I would like to know what is the latest version? And where can I download it? And what version (and patch) you recommend me? DeAngeli ---------------------------------------------------------------- VBISAM was coded by Trevor van Bremen (the VB comes from his name) but he disappeared long time ago. You need something build upon the 2.0 version Roger While released some years ago (this is the one you've patched) as only this versions will work with OpenCOBOL. What you've found as 2.1.1 was changed from this 2.0 tarball by COBOL-IT (which is a fork from OpenCOBOL) and it's not sure if it works correct with OpenCOBOL at all. I had some quick views on the changes they did (most functional changes were done for variable record length files - and be aware that they've released serveral versions as 2.1.1 without changing the version number and maybe even without changing the Changelogs) but as I did not had the time to investigate them I didn't took them into my personal working copy. This working copy is rooted in 2.0 with patches done by Sergey Kashyrin (compatibility for different systems, including Win and some bugfixes), and taken into some code changes that were done in OpenCOBOL itself, mostly for compatibility for different compilers. Then some gettext preparations were done and the vbcheck (for recovering broken VBISAM files) was tuned. As I've wrote before I did not got it to repair any broken file (by the way: the version from COBOL-IT wasn't able to this, too). It would be interesting what bugs you've noticed in the CIT version. And even more interesting is how well you understand the whole topic and if you are willing to work on VBISAM. What do you think about this? human ---------------------------------------------------------------- I am going to use vbisam for production. I am going to apply these bugfixes. However i converted 15 years data and seem to work without problems. I dont use variable length records. ---------------------------------------------------------------- human, My company provide services to a bank wich uses SCO UNIX with C-ISAM, COBOL and C language as architeture. Now they are upgrading their legacy to Linux OpenSuse (x86_64) using vbisam. The oldest systems written in COBOL was rewritten in C language. At the beginning of the work we developed over vbisam-1.03 and some problems forced us to upgrade to 2.0 version and 2.1.1 later. As we encounter some problems with the three versions, we adopt the 2.0 version to be more used than version 2.1.1. But even with the patches that we found on the Internet, we continue with problems. So I decided to debug the vbisam-2.0 (and also a bit of version 2.1.1). Except for the first change mentioned in the first post, which fixes a compiling problem, the other two had to be made to correct implementation problems. Everything indicates that the second problem (in [b]isinternal.h[/b]) was an error "Copy and Paste". And the third problem (in [b]vbkeyio.c[/b]) who, despite being LONGTYPE, the maximum and minimum values to be used are of an "int" (INT_MAX/INT_MIN instead of LONG_MAX/LONG_MIN). Recalling that in one 64-bit machine (x86_64) INT_MAX = 2,147,483,647 and LONG_MAX = 9,223,372,036,854,775,807 As stated, we are still in the process of approval, so any problem that we detect and correct, we will post here on the forum. DeAngeli ---------------------------------------------------------------- DeAngeli, could you explain me the third bug?? Why it should be INT and not LONG? ---------------------------------------------------------------- He changed it from LONG to INT, because LONG is too big in 64 bit machines. But is INT big enough in 32 bit machines? And when it's about too big, why does it help to fix bug that returns "not found" if there are more than 128 records in the file? human ---------------------------------------------------------------- [b]Parhs[/b] Note the values of the following "C" constants in a 32bit operating system (x86): SHRT_MAX = 32,767 (2^15-1) INT_MAX = 2,147,483,647 (2^31-1) LONG_MAX = [color=008080]2,147,483,647 (2^31-1)[/color] Note the values of these constants in a 64bit operating system (x86_64): SHRT_MAX = 32,767 (2^15-1) INT_MAX = 2,147,483,647 (2^31-1) LONG_MAX = [color=008080]9,223,372,036,854,775,807 (2^63-1)[/color] vbisam has the following constants: INTTYPE with 16 bits, then INTSIZE=16 LONGTYPE with 32 bits, then LONGSIZE=32 So, the [color=FF0000]INT[/color]TYPE biggest value = [color=FF0000]SHRT[/color]_MAX (see line 673 in [b]vbkeyio.c[/b]) and the [color=0000FF]LONG[/color]TYPE biggest value = [color=0000FF]INT[/color]_MAX (bug fixed - line 685 in [b]vbkeyio.c[/b]) It works in a 32bits operating system because INT_MAX = LONG_MAX You must fix the third bug only on 64bit OS. Note: The same happens with "MIN" values. [b]human[/b] I spotted the problem when there was a restructuring of the index. This occurred after 128 records. With fewer records (only a block of records in the index), the problem does not occur. I believe that the snippet was used in the restructuring of the index. DeAngeli ---------------------------------------------------------------- Thank you for the detailed response! I have a 64 bit machine.. I should make and make install ? THen i should do again ldconfig ? Is it going to be overwrited? Also something important.. Do ihave to recreate the files after these patches? I havent noticed a 128 record problem though.. Some files have 1000 records and all were good.... ---------------------------------------------------------------- Parhs, Yes to all. Due to the second problem, I believe you should rebuild the indexes if you have any key using LONGTYPE. Because they were being generated with two bytes instead of four bytes. DeAngeli ---------------------------------------------------------------- Hm i think that keys are of type 999 or XXX in cobol. However i am going to apply the patches... thank you again.. i hope to have no problems! ---------------------------------------------------------------- Having primary key ORGANIZATION INDEXED ACCESS DYNAMIC LOCK MODE IS AUTOMATIC RECORD OR-AA ALTERNATE RECORD OR-AK1 DUPLICATES ALTERNATE RECORD OR-AK2 DUPLICATES I got a duplicate primary key and everything messed up.. How can i have duplicate OR-AA ??? ---------------------------------------------------------------- I get file status 22. But when the file is opened from more than one user it doesnt prevent duplicate primary keys!!!!!! ---------------------------------------------------------------- Parhs, I'm so sorry. I can't help you. I know cobol a little bit. I use "C/C++" with vbisam. DeAngeli ---------------------------------------------------------------- i think that this is an open cobol issue. Seems to occcur with berkeley and vbisam.... index should be refreshed if file has changed or anything.. ---------------------------------------------------------------- Parhs, I have not tried but you could also try using the patch mentioned by human (http://kiska.net/opencobol/human/). DeAngeli ---------------------------------------------------------------- Seems to be vbisam issue... iswrite didnt return an error..... berkeley DB had the same behavior until DB_HOME was set... i have to switch to Berkeley .. ---------------------------------------------------------------- Subject: Working storage printer layout. This is the nearly identical twin of the screen painter posted at http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1266&forum=1&post_id=6341#forumpost6341. The example is adapted from a program in Y Uckan "Application Programming and File Processing in Cobol" D C Heath & Co 1992. The working storage output in the hand crafted original is more tha 120 lines. Worklayp is less frugal. The output is not reproduced, but you can get it in only a few minutes by compiling and running the program. The program is written for 80 column lines. If you use an editor for the draft with longer lines you can alter the program to describe a wider page. The example source: [code] ^NEW NATIONAL BANK ^OXFORD, ^OHIO ^C H E Q U E ^A C C O U N T ^S T A T E M E N T ~XXXXXXXXXXXXXXXXXXXX ^DATE !ZZ/ZZ/ZZ ~XXXXXXXXXXXXXXXXXXXX ^STATEMENT PERIOD ~XXXXXXXXXXXXXXXXXXXX ^FROM !ZZ/ZZ/ZZ ^THROUGH !ZZ/ZZ/ZZ ^DATE ^TRANSACTIONS ^AMOUNT ^BALANCE ^---- ^------------ ^------ ^------- !ZZ/ZZ ~XXXXXXXXXXXXXXXXXXXXXXXXX !ZZZ,ZZZ.ZZ+ !ZZZ,ZZZ.ZZ ^---------------------------------------------------------------------------- ^S U M M A R Y ^O F ^A C C O U N T ^ACCOUNT ^BEGINNING ^TOTAL ^TOTAL ^MISC ^TOTAL ^CURRENT ^NUMBER ^BALANCE ^CREDITS ^DEBITS ^CHARGES ^INTEREST ^BALANCE ~XXXX !ZZZ,ZZZ.ZZ !ZZZ,ZZZ.ZZ !ZZZ,ZZZ.ZZ !ZZZ.ZZ !ZZZ.ZZ !ZZZ,ZZZ.ZZ ^ITEMS ENCLOSED !ZZZ [/code] The program: [code] IDENTIFICATION DIVISION. PROGRAM-ID. worklayp. ***************************************************************** ** Program purpose is to take a printer layout from an input file ** and format it into cobol report descriptions. The input file ** is written with a text editor. ** Literals are preceded by a ^. Edit values preceded by a "!" ** are reproduced in the output.Edit values preceded by a ** "~" are shown as a "pic x(n)".The values in the field must be ** "x". ** Edit values and literals are terminated after 80 characters ** or with two spaces or one space and a "^" or "~" or "!" or any ** of "^","~","!" alone . Thus if a literal has successive spaces ** it must be treated as two literals. ** Literals including format marks extending beyond column 80 are ** lost. Format marks are replaced in the output by spaces. ** There will always be at least one space between items and the first ** position in any line must always be a space. A literal which ** is 80 characters long must be reduced to 79 characters. ** Edit characters are treated as normal characters in literals. ** Edit characters > 17 will give an incorrect mask.The validity ** of the mask is not checked. ** Any non edit character in a mask is ignored. ** The print line descriptions produced by the program are named ** lineNN where NN is a two digit number. Likewise the variable ** fields are named fieldNN. ** Usage: ** Input: layout-file.any ** Output: layout-file.out. ***************************************************************** ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT in-file ASSIGN TO input-name ORGANIZATION IS LINE SEQUENTIAL FILE STATUS in-stat. SELECT out-file ASSIGN TO out-name ORGANIZATION IS LINE SEQUENTIAL. DATA DIVISION. FILE SECTION. FD in-file. 01 in-record PIC x(80). FD out-file. 01 out-record PIC x(80). WORKING-STORAGE SECTION. 01 input-name PIC x(80) VALUE SPACES. 01 out-name PIC x(80) VALUE SPACES. 01 input-area. 05 input-record. 10 input-item OCCURS 80 PIC x. 05 input-sub PIC 9(3). 05 input-sub-save PIC 9(3). 05 edit-save PIC x. 88 edit VALUE 'c' 'C' 'd' 'D' 'z' 'Z' '9' '.' ',' '$' '-' '+' 'x' 'X' '/' '*' 'r' 'R' 'b' 'B' 'a' 'A' 'p' 'P' 's' 'S' 'v' 'V'. 05 fill-counter PIC 9(3). 05 chr-counter PIC 9(2). 05 fld-counter PIC 9(2). 05 lit-counter PIC 9(3). 01 sw-switches. 05 in-stat PIC xx. 88 in-success VALUE "00". 05 PIC x VALUE 'n'. 88 literals VALUE 'y'. 88 not-literals VALUE 'n'. 05 PIC x VALUE 'n'. 88 edit-picx VALUE 'y'. 88 not-edit-picx VALUE 'n'. 01 table-area. 05 table-item OCCURS 82 PIC x. 05 table-sub PIC 9(3). 01 output-lines. 05 header-line. 10 PIC x(15) VALUE ' 01 line'. 10 line-value PIC 9(2) VALUE ZERO. 10 PIC x VALUE '.'. 05 filler-line. 10 PIC x(43) VALUE ' 05 PIC x'. 10 PIC x VALUE '('. 10 fill-value PIC x(3). 10 PIC x(15) VALUE ') VALUE SPACES.'. 05 literal-start-line. 10 PIC x(43) VALUE ' 05 PIC x'. 10 PIC x VALUE '('. 10 lit-value PIC x(3). 10 PIC x(8) VALUE ') VALUE '. 05 literal-first-line. 10 PIC x(11) VALUE SPACES. 10 PIC x VALUE QUOTE. 10 first-line PIC x(60) VALUE SPACES. 05 continuation-line. 10 PIC x(11) VALUE ' - '. 10 PIC x VALUE QUOTE. 10 second-line PIC x(60) VALUE SPACES. 05 num-edit-line. 10 PIC x(20) VALUE ' 05 field'. 10 field-num-value PIC 9(2) VALUE ZERO. 10 PIC x(18) VALUE ' PIC '. 10 edited-number. 15 edit-mask OCCURS 18 PIC x. 05 output-char-edit-mask. 10 PIC x(20) VALUE ' 05 field'. 10 field-x-value PIC 9(2) VALUE ZERO. 10 PIC x(20) VALUE ' PIC x('. 10 char-x-count PIC x(2). 10 PIC x(2) VALUE ').'. 05 blank-line PIC x(80) VALUE SPACES. 05 edit-sub PIC 9(3). PROCEDURE DIVISION. begin-program. PERFORM initialization PERFORM mainline CLOSE in-file out-file STOP RUN. initialization. ACCEPT input-name FROM COMMAND-LINE STRING input-name DELIMITED BY "." ".out" DELIMITED BY SIZE INTO out-name OPEN INPUT in-file OUTPUT out-file INITIALIZE input-area table-area edited-number. mainline. PERFORM UNTIL NOT in-success READ in-file INTO input-record IF input-record NOT EQUAL SPACES INITIALIZE edit-sub fill-counter ADD 1 TO line-value WRITE out-record FROM header-line END-IF IF in-success PERFORM get-one-line END-IF WRITE out-record FROM blank-line END-PERFORM. get-one-line. MOVE 0 TO table-sub PERFORM check-for-end-of-field WITH TEST AFTER VARYING input-sub FROM 1 BY 1 UNTIL input-sub IS GREATER THAN 80. check-for-end-of-field. IF input-sub > 80 OR (input-item (input-sub) = "^" OR "~" OR "!") OR (input-item (input-sub) = " " AND (input-item (input-sub + 1) = " " OR "^" OR "~" OR "!")) IF literals PERFORM format-literal ELSE IF edit PERFORM format-edited-field END-IF END-IF END-IF PERFORM get-one-character. format-literal. MOVE fill-counter TO fill-value WRITE out-record FROM filler-line MOVE lit-counter TO lit-value WRITE out-record FROM literal-start-line MOVE QUOTE TO table-item (table-sub + 1) MOVE "." TO table-item (table-sub + 2) IF lit-counter > 58 MOVE table-area (1: 58) TO first-line ELSE MOVE table-area (1: 60) TO first-line END-IF WRITE out-record FROM literal-first-line IF lit-counter > 58 MOVE table-area (59: 23) TO second-line WRITE out-record FROM continuation-line END-IF INITIALIZE fill-counter lit-counter table-area table-sub SET not-literals TO TRUE. format-edited-field. ADD 1 TO fld-counter MOVE fld-counter TO field-num-value field-x-value MOVE fill-counter TO fill-value WRITE out-record FROM filler-line IF edit-picx SET not-edit-picx TO TRUE MOVE chr-counter TO char-x-count WRITE out-record FROM output-char-edit-mask ELSE MOVE "." TO edit-mask (edit-sub + 1) WRITE out-record FROM num-edit-line END-IF INITIALIZE edited-number fill-counter edit-sub chr-counter MOVE SPACES TO edit-save. get-one-character. IF literals ADD 1 TO table-sub MOVE input-item (input-sub) TO table-item (table-sub) ADD 1 TO lit-counter MOVE input-sub TO input-sub-save ELSE MOVE input-item (input-sub) TO edit-save IF edit MOVE input-sub TO input-sub-save IF edit-picx ADD 1 TO chr-counter ELSE ADD 1 TO edit-sub MOVE input-item (input-sub) TO edit-mask(edit-sub) END-IF END-IF END-IF IF not-literals AND input-item (input-sub) EQUAL SPACE ADD 1 TO fill-counter END-IF IF input-item (input-sub) EQUAL "^" SET literals TO TRUE ADD 1 TO fill-counter END-IF IF input-item (input-sub) EQUAL "~" SET edit-picx TO TRUE ADD 1 TO fill-counter END-IF IF input-item (input-sub) EQUAL "!" ADD 1 TO fill-counter END-IF. [/code] ---------------------------------------------------------------- Can you please show what the program produces like you did with your screen generation program? Is there a way to define that a line should be generated as an OCCURS item like it seems to be necessary for the following line? [code]!ZZ/ZZ ~XXXXXXXXXXXXXXXXXXXXXXXXX !ZZZ,ZZZ.ZZ+ !ZZZ,ZZZ.ZZ[/code] human ---------------------------------------------------------------- The output: [code] 01 line01. 05 PIC x(029) VALUE SPACES. 05 PIC x(017) VALUE "NEW NATIONAL BANK". 01 line02. 05 PIC x(032) VALUE SPACES. 05 PIC x(007) VALUE "OXFORD,". 05 PIC x(002) VALUE SPACES. 05 PIC x(004) VALUE "OHIO". 01 line03. 05 PIC x(012) VALUE SPACES. 05 PIC x(011) VALUE "C H E Q U E". 05 PIC x(003) VALUE SPACES. 05 PIC x(013) VALUE "A C C O U N T". 05 PIC x(003) VALUE SPACES. 05 PIC x(017) VALUE "S T A T E M E N T". 01 line04. 05 PIC x(005) VALUE SPACES. 05 field01 PIC x(20). 05 PIC x(028) VALUE SPACES. 05 PIC x(004) VALUE "DATE". 05 PIC x(006) VALUE SPACES. 05 field02 PIC ZZ/ZZ/ZZ. 01 line05. 05 PIC x(005) VALUE SPACES. 05 field03 PIC x(20). 05 PIC x(028) VALUE SPACES. 05 PIC x(016) VALUE "STATEMENT PERIOD". 01 line06. 05 PIC x(005) VALUE SPACES. 05 field04 PIC x(20). 05 PIC x(028) VALUE SPACES. 05 PIC x(004) VALUE "FROM". 05 PIC x(006) VALUE SPACES. 05 field05 PIC ZZ/ZZ/ZZ. 01 line07. 05 PIC x(053) VALUE SPACES. 05 PIC x(007) VALUE "THROUGH". 05 PIC x(003) VALUE SPACES. 05 field06 PIC ZZ/ZZ/ZZ. 01 line08. 05 PIC x(001) VALUE SPACES. 05 PIC x(004) VALUE "DATE". 05 PIC x(008) VALUE SPACES. 05 PIC x(012) VALUE "TRANSACTIONS". 05 PIC x(034) VALUE SPACES. 05 PIC x(006) VALUE "AMOUNT". 05 PIC x(005) VALUE SPACES. 05 PIC x(007) VALUE "BALANCE". 01 line09. 05 PIC x(001) VALUE SPACES. 05 PIC x(004) VALUE "----". 05 PIC x(008) VALUE SPACES. 05 PIC x(012) VALUE "------------". 05 PIC x(034) VALUE SPACES. 05 PIC x(006) VALUE "------". 05 PIC x(005) VALUE SPACES. 05 PIC x(007) VALUE "-------". 01 line10. 05 PIC x(001) VALUE SPACES. 05 field07 PIC ZZ/ZZ. 05 PIC x(007) VALUE SPACES. 05 field08 PIC x(25). 05 PIC x(016) VALUE SPACES. 05 field09 PIC ZZZ,ZZZ.ZZ+. 05 PIC x(002) VALUE SPACES. 05 field10 PIC ZZZ,ZZZ.ZZ. 01 line11. 05 PIC x(001) VALUE SPACES. 05 PIC x(076) VALUE "---------------------------------------------------------- - "------------------". 01 line12. 05 PIC x(021) VALUE SPACES. 05 PIC x(013) VALUE "S U M M A R Y". 05 PIC x(002) VALUE SPACES. 05 PIC x(003) VALUE "O F". 05 PIC x(002) VALUE SPACES. 05 PIC x(013) VALUE "A C C O U N T". 01 line13. 05 PIC x(001) VALUE SPACES. 05 PIC x(007) VALUE "ACCOUNT". 05 PIC x(003) VALUE SPACES. 05 PIC x(009) VALUE "BEGINNING". 05 PIC x(005) VALUE SPACES. 05 PIC x(005) VALUE "TOTAL". 05 PIC x(007) VALUE SPACES. 05 PIC x(005) VALUE "TOTAL". 05 PIC x(007) VALUE SPACES. 05 PIC x(004) VALUE "MISC". 05 PIC x(006) VALUE SPACES. 05 PIC x(005) VALUE "TOTAL". 05 PIC x(006) VALUE SPACES. 05 PIC x(007) VALUE "CURRENT". 01 line14. 05 PIC x(001) VALUE SPACES. 05 PIC x(006) VALUE "NUMBER". 05 PIC x(004) VALUE SPACES. 05 PIC x(007) VALUE "BALANCE". 05 PIC x(007) VALUE SPACES. 05 PIC x(007) VALUE "CREDITS". 05 PIC x(005) VALUE SPACES. 05 PIC x(006) VALUE "DEBITS". 05 PIC x(006) VALUE SPACES. 05 PIC x(007) VALUE "CHARGES". 05 PIC x(003) VALUE SPACES. 05 PIC x(008) VALUE "INTEREST". 05 PIC x(003) VALUE SPACES. 05 PIC x(007) VALUE "BALANCE". 01 line15. 05 PIC x(002) VALUE SPACES. 05 field11 PIC x(04). 05 PIC x(004) VALUE SPACES. 05 field12 PIC ZZZ,ZZZ.ZZ. 05 PIC x(004) VALUE SPACES. 05 field13 PIC ZZZ,ZZZ.ZZ. 05 PIC x(002) VALUE SPACES. 05 field14 PIC ZZZ,ZZZ.ZZ. 05 PIC x(003) VALUE SPACES. 05 field15 PIC ZZZ.ZZ. 05 PIC x(004) VALUE SPACES. 05 field16 PIC ZZZ.ZZ. 05 PIC x(002) VALUE SPACES. 05 field17 PIC ZZZ,ZZZ.ZZ. 01 line16. 05 PIC x(053) VALUE SPACES. 05 PIC x(014) VALUE "ITEMS ENCLOSED". 05 PIC x(003) VALUE SPACES. 05 field18 PIC ZZZ. [/code] Quite lengthy but it saves a lot of work. The line quoted is simply referenced as often as necessary in the procedure division. There is no occurs clause. The example is adapted from Uckan's book pp248-257. John. ---------------------------------------------------------------- Subject: SELECT filename ASSIGN TO working-storage We have found a problem with the compiler that produces the wrong structures for the ASSIGN TO clause of the SELECT statement in IBM compatibility mode. Someone else may have already found this and others may be able to fix it better that I did, but here is the source change I made to correct the problem: typeck.c:684 return cb_build_alphanumeric_literal ((ucharptr)s, strlen (s)); changed to: if (cfile->external_assign) { p = strrchr (s, '-'); if (p) { s = p + 1; } return cb_build_alphanumeric_literal ((ucharptr)s, strlen (s)); } current_program->reference_list = cb_list_add (current_program->reference_list, name); return name; ---------------------------------------------------------------- Thank you for reporting this, but please include the following information in your post: - version where this problem occurred (package date from cobc --version) - tell us if you applied other patches that may lead to this problem - show us a small cobol sample and the cobc-command you've used - tell us if the problem occurs on compile-time or run-time If I have this information I try to reproduce this and see if the current development version needs this patch, too. human ---------------------------------------------------------------- Hi Human, Thanks for your reply. Here is the information you requested: cobc --version cobc (OpenCOBOL) 1.0.0 Copyright (C) 2001-2007 Keisuke Nishida Copyright (C) 2007 Roger While No patches were applied. select_test.cob IDENTIFICATION DIVISION. PROGRAM-ID. CSMREPBTO. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT BATCH-FILE ASSIGN TO BATCH-FILE-NAME-WS ORGANIZATION IS SEQUENTIAL FILE STATUS BATCH-STATUS. DATA DIVISION. FILE SECTION. FD BATCH-FILE. 01 BATCH-REC PIC X(65). WORKING-STORAGE SECTION. 01 BATCH-FILE-NAME-WS PIC X(63). 01 BATCH-STATUS PIC X(2). PROCEDURE DIVISION. MOVE "TEST-FILE" TO BATCH-FILE-NAME-WS. OPEN INPUT BATCH-FILE. DISPLAY BATCH-STATUS. EXIT PROGRAM. echo "test" > TEST-FILE cobc -x -std=ibm select_test.cob select_test Displays error 35 at runtime. ---------------------------------------------------------------- OK, I've tested this with upcoming 2.0 and got the same results. The reason is that in -std=ibm BATCH-FILE-NAME-WS is not used for assigning the file name at run-time (look at the differences in the generated C-Files (you can save them with --save-temps) when compiling with/without -std=ibm). This seem to be a behaviour by design. I'm not sure if this is a mistake and if it isn't: I think cobc may should output some warning about that when this prog is compiled. Why do you use -std=ibm? human BTW: Please use code tags for posting source. There is a <> button in post/edit mode for that, it would be good to try this via editing your first two posts. ---------------------------------------------------------------- The value in the ASIGN clause in IBM (MVS / z/OS, etc) COBOL is Look first for a "DDNAME" then (only with recent IBM compilers) Look for an environment variable name It is NEVER look in Workgin-Storage for a data-name. For more information see, [url=http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/IGY3LR50/4.2.3]http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/IGY3LR50/4.2.3[/url] and/or [url=http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3pg50/1.1.2.5 ]http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3pg50/1.1.2.5 [/url] ---------------------------------------------------------------- Thank you for this information (I'll add this as C-comments for people knowing there is no need for a patch). Can you please check if the COBOL source given as sample raises any compiler warning/error in IBM compiler? Even if not, do you think it would be valuable to raise a warning (with -Wall/-W only) about the not working ASSIGN TO WORKING-STORAGE item in ibm-mode? human ---------------------------------------------------------------- Gone through the tutorial but my connections are making some problem...Will check this once more. [url=http://www.skyway.co.nz] Auckland Airport Parking [/url] ---------------------------------------------------------------- Well, ok the curiosity got the best of me, so I tried the following Cobol compile on z/OS (MVS). [code] PP 5655-S71 IBM ENTERPRISE COBOL FOR Z/OS 4.2.0 0410 CSMREPBT DATE 03/08/2011 LINEID PL SL ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6----+----7- 000001 IDENTIFICATION DIVISION. 000002 PROGRAM-ID. CSMREPBT. 000003 ENVIRONMENT DIVISION. 000004 INPUT-OUTPUT SECTION. 000005 FILE-CONTROL. 000006 SELECT BATCH-FILE ASSIGN TO BATCH-FILE-NAME-WS 000007 ORGANIZATION IS SEQUENTIAL 000008 FILE STATUS BATCH-STATUS. 000009 000010 DATA DIVISION. 000011 FILE SECTION. 000012 FD BATCH-FILE. 000013 01 BATCH-REC PIC X(65). 000014 WORKING-STORAGE SECTION. 000015 000016 01 BATCH-FILE-NAME-WS PIC X(63). 000017 01 BATCH-STATUS PIC X(2). 000018 PROCEDURE DIVISION. 000019 MOVE "TEST-FILE" TO BATCH-FILE-NAME-WS. 000020 OPEN INPUT BATCH-FILE. 000021 DISPLAY BATCH-STATUS. 000022 GOBACK. 000023 * UNDER MVS (Z/OS) THE FOLLOWING ISN'T A VALID 000024 * EXIT POINT. THIS ACTUALLY CAUSED AN ABEND 000025 * EXIT PROGRAM. ... LINEID MESSAGE CODE MESSAGE TEXT 12 IGYGR1216-I A "RECORDING MODE" OF "F" WAS ASSUMED FOR FILE "BATCH-FILE". MESSAGES TOTAL INFORMATIONAL WARNING ERROR SEVERE TERMINATING PRINTED: 1 1 * STATISTICS FOR COBOL PROGRAM CSMREPBT: * SOURCE RECORDS = 25 * DATA DIVISION STATEMENTS = 3 * PROCEDURE DIVISION STATEMENTS = 4 [/code] When I execute the program for the 1st time, I got the status code of "35" displayed. However, for the second execution, I added an additional statement to allocate the input file as specified in the sample program. [code] //TESTPGM EXEC PGM=CSMREPBT //STEPLIB DD DSN=MRIK.TEST.LOADLIB,DISP=SHR //SYSOUT DD SYSOUT=* //SYSIN DD DUMMY //WS DD * [/code] Then got the status code of "00" displayed. Apparently, in Enterprise Cobol, the text following the last “-“ gets passed. [code] FILE-CONTROL. SELECT BATCH-FILE ASSIGN TO BATCH-FILE-NAME-WS ORGANIZATION IS SEQUENTIAL FILE STATUS BATCH-STATUS. [/code] And of which the following JCL statement satisfies the data file assignment. [code] //WS DD * [/code] I hope, this did not post create more confusion. :-( I guess, the point I was making was that move statement should not have affect what file gets assigned in the Cobol select statement. As in the original OpenCobol example, I’m thinking the program should set the assigned value in the environment variable associated with select statement. ---------------------------------------------------------------- Hi Human and others, I may have failed to mention that we are porting from Micro Focus COBOL. We use the IBM compatibility flag on the MF compiler for some reason that I don't remember at the moment. We have tried compiling without the IBM compatibility flag on OpenCOBOL, but other issues arise in other programs that appear to be related to alignement. Would you consider adding an additional flag to support this behavior? I really don't want to have to hack the compiler to upgrade OpenCOBOL. Martin PS I wasn't sure what you meant about using code tags. I tried editing the post and clicked the <> icon but it asked me to enter the codes I want to add. I'm not sure what this means or how to use it. Sorry. ---------------------------------------------------------------- So, in Micro Focus COBOL [code] FILE-CONTROL. SELECT BATCH-FILE ASSIGN TO BATCH-FILE-NAME-WS ORGANIZATION IS SEQUENTIAL FILE STATUS BATCH-STATUS. DATA DIVISION. FILE SECTION. FD BATCH-FILE. 01 BATCH-REC PIC X(65). WORKING-STORAGE SECTION. 01 BATCH-FILE-NAME-WS PIC X(63). 01 BATCH-STATUS PIC X(2). [/code] Does the following move, actually assigned the correct file name? [code] MOVE "TEST-FILE" TO BATCH-FILE-NAME-WS. [/code] ---------------------------------------------------------------- As is so OFTEN the case, when saying what Micro Focus does, this depends on a directive. In this case, see: [url=http://documentation.microfocus.com/help/topic/com.microfocus.eclipse.infocenter.visualcobol.r3eclipsewin/HRCDRHCDIR1D.html]ASSIGN[/url] ---------------------------------------------------------------- Yes, and with the change I proposed, Open COBOL does too. ---------------------------------------------------------------- Well, apparently this is another one of those Micro Focus Extension. :oops: [url=http://supportline.microfocus.com/documentation/books/sx22sp1/fhpubb.htm]Micro Focus Online Manual[/url] 3.2.2 Dynamic Filename Assignment With dynamic filename assignment, the filename is specified in the ASSIGN clause as a COBOL data item: If you use the ASSIGN"DYNAMIC" Compiler directive, you can omit the word DYNAMIC from the ASSIGN clause. In the following example, the file input.dat is created in the current directory: ... select fd-in-name assign to dynamic ws-in-file. ... working-storage section. 01 ws-in-file pic x(30). ... move "input.dat" to ws-in-file. ... open output fd-in-name. ---------------------------------------------------------------- Subject: Looking for other Enterprise COBOL features in OC Ok, maybe this is another wish list. However, standard in Enterprise Cobol is Null Terminated Alphanumeric literals. Basically, this is a feature available with the z/OS Enterprise Cobol Compiler in that whenever an alphanumeric literal is prefix with a Z, the null character X’00’ is automatically appended to the end of the literal. I am wondering if this could be implemented in a later release of Open Cobol? For example, with the following example in working-storage: [code] 77 WS-ZSTRING PIC X(09) VALUE SPACE. [/code] The following is an example a null terminated string in Cobol: [code] MOVE Z’zstring’ TO WS-ZSTRING [/code] The resulting value of WS-ZSTRING has a value of 0xA9A2A3998995870040 (In EBCDIC, of course) However, also available in Enterprise Cobol is the support for Java Native Interface (JNI). Any chance, could be made available to Open Cobol? For instance, the “INVOKE” statement can create object instances of a COBOL or Java class and can invoke a method defined in a COBOL or Java class. ---------------------------------------------------------------- For Z'lowvalueterminatedstring': It's implemented in the upcoming 2.0 release, already. For INVOKE: Won't be supported until OpenCOBOL supports objects, which isn't likely to be supported in the near future. human ---------------------------------------------------------------- Just to add to what human posted. It seems like Z strings are coming. For now we use the idiom[code]MOVE "string" & x"00" TO WS-ZSTRING[/code] or [code]MOVE FUNCTION CONCATENATE(working-var; x"00") TO WS-ZSTRING[/code] for those times when you can't use ampersand constant concatenation. On Java Native Interface: JNI is totally available to us in OpenCOBOL land. It supports C ABI, we win with anything C ABI. As soon as someone sits down and writes up a how-to, we'll all benefit. As human pointed out, INVOKE is not on the near horizon, but FUNCTION-ID might be. With FUNCTION-ID we get one step closer to creating "ease of use" layers. And with that, hopefully, an explosion of shareable code libraries. Java linkage might just be one of those libs. Cheers, Brian ---------------------------------------------------------------- Because of the "general" nature of the subject of this thread, I thought that I would add my "wish" list item (which I think I have mentioned before). What I would like someone (who knows internals - and maybe for releasee 2.0) to go thru the FULL list of IBM extensions documented at: [url=http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/IGY3LR50/APPENDIX1.1 ]http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/IGY3LR50/APPENDIX1.1 [/url] and document WHICH are (and are not) supported with std=mvs or std=ibm (I don't know the difference between those 2). Now some (many?) of those are features in the 2002 Standard. IBM documents them as extensions as it only claims to conform to the '85 Standard (with amendments). It seems to me that OC supports LOTS of these extensions, but which are and are not supported requires an IBM programmer to research in lots of places (and/or use trial-and-error) ---------------------------------------------------------------- [quote] btiffin wrote: for those times when you can't use ampersand constant concatenation. [/quote] Well, I’ve been up for portability of feature among Cobol Compiler Implementations. And the “FUNCTION CONCATENATE” nor the ampersand constant concatenation is available on z/OS. Then again, maybe the Z”string” was probably just an IBM extension. Then again, maybe I'm Mainframe eccentric when it come to Cobol. Well, whenever I see an open Cobol position available, over 90% of the time it’s on the mainframe. [quote] btiffin wrote: On Java Native Interface: JNI is totally available to us in OpenCOBOL land. It supports C ABI, we win with anything C ABI. As soon as someone sits down and writes up a how-to, we'll all benefit. [/quote] However, I had once experimented with wrapping “C” JNI around Cobol on z/OS. I think, I did that because of z/OS availability the “fetch” and “release” functions to dynamically load executables. The neat thing was that the common runtime was smart enough to know when to initialize the Cobol runtime environment. But if I did decide to write “C” JNI wrappers around Open Cobol modules on the Windows environment, are there precautions I should be aware if I had multiple C/OC composite Java Native Classes running in the same JVM? ---------------------------------------------------------------- On the first one; Yeah, I tend to write OpenCOBOL and only OpenCOBOL when I COBOL :-) but in fairness; you can always go with something like [code] STRING var DELIMITED BY SPACE X"00" DELIMITED BY SIZE INTO z-var END-STRING and UNSTRING val DELIMITED BY LOW-VALUE INTO ... [/code] On the second one; If you really do want to dig in ([i]I tried one day, but I don't have the itch to Java, and didn't get far enough into the documentation to write any code[/i]) [b]cobc -fimplicit-init[/b] will compile such that it makes sure that runtime init is in all the object code. So, that helps with Java using OpenCOBOL callbacks. Once a JNI framework is in place (the scaffolding), cobc will pump out .o files that can be used as easily as C. Getting OpenCOBOL to call Java is a different headache, and that's where I stopped reading. :-) In terms of mixing things in a JVM, umm, cobc does NOT advertise that it'll produce thread safe code. A developer can likely make safe choices, but it's not advertised. In general, freely mixing C and OpenCOBOL is a safe, fun and productive thing to do. [i]imho[/i] And don't forget [b]Vala and Genie[/b]. They pump out GOBJECT oriented code in a nice safe C ABI form, that can play along with C and OpenCOBOL all in the same mix. No doubt object code that JNI would fling around just fine. See http://opencobol.add1tocobol.com/#can-opencobol-interface-with-vala for my fanboy rave on Vala (especially for those developers already in the object oriented head space). Cheers, Brian ---------------------------------------------------------------- Bill; I've posted your APPENDIX1.1 link to my FAQ fossil project. I'll try and produce a table using that page as a base. Cheers, Brian ---------------------------------------------------------------- Are there any restrictions on the size of data records written to or read from a file? I wasn’t sure based upon what I read for the Open Cobol Programmer’s manual. However, the code I would like to port from z/OS has a restriction 32760 bytes per record. As for the “Block contains 0 ...” factor from the file description, can I assume that OC interprets this as unblocked? Though, on the host, this simply instructs the I/O subsystem to determine the optimum block size. Also, with the ISAM implementations available to OC, does any of them allow variable length keyed access records? ---------------------------------------------------------------- To the first item; theoretically not really, maximums are in the 4 billion byte range for Berkeley db. In reality, large records bork all kinds of code, my own being a prime example. On block sizing; that's a detail that implementation documentation would have to address. I think bdb prefers 4K chunks over most other sizing, and it won't care what type of drive you are spinning. The library will let the file system worry about block sizing. Or I could be wrong, having not looked and just spreading rumour based on my own belief system. On the third; I don't think the compiler would support it, even if the isam handler did. It gets pretty weird thinking about indexing a record where the length could be shorter than the key data required. You might be better off writing a separate external index file that holds relative file offsets. Or I could be wrong, having not looked beyond a quick glance to see if I could find evidence that negated my belief system. ;-) Cheers, Brian ---------------------------------------------------------------- Hey, well thank you for your insight. :-) From the mainframe perspective, I had at least a clear understanding of basic file structure. Seemed relatively simple, the size of any logical record is limited to the physical data block stored/retrieved from the disk device. Speaking of the variable length record, I had the following in mind, though it does compile ok. [code] SELECT INVENTORY-FILE ASSIGN TO "F:\src\inventory" ORGANIZATION IS INDEXED ACCESS MODE IS DYNAMIC RECORD KEY IS IR-ITEM-KEY STATUS IS WS-INVENTORY-STATUS. ... FD INVENTORY-FILE. 01 INVENTORY-RECORD. 05 IR-ITEM-KEY. 10 IR-VENDOR PIC X(04). 10 IR-NUMBER PIC X(05). 05 IR-DESCRIPTION PIC X(35). 05 IR-UNIT-PRICE PIC S9(5)V99 COMP-3. 05 IR-AVG-UNIT-COST PIC S9(5)V99 COMP-3. 05 IR-LOCATION-QUANTITY-CNT PIC S9(4) COMP-5. 05 IR-LOCATION-QUANTITY-DATA OCCURS 128 TIMES DEPENDING ON IR-LOCATION-QUANTITY-CNT. 10 IR-LOCATION PIC X(04). 10 IR-QUANTITY-ON-HAND PIC S9(07) COMP-3. 10 IR-REORDER-POINT PIC S9(07) COMP-3. 10 IR-QUANTITY-ON-ORDER PIC S9(07) COMP-3. 10 IR-LAST-REORDER-DATE PIC X(08). [/code] Basically, I was avoiding splitting out the "IR-LOCATION-QUANTITY-DATA" into a separate file. I suppose, for a performance perspective, I guess should. :-? ---------------------------------------------------------------- Umm, I haven't experimented, but that might work?? The record size written might be max size, 128, every time and ignore the DEPENDING? Cheers, Brian ---------------------------------------------------------------- Blocksize much like the fixed source COBOL format, also an I*M contribution, is a legacy issue. Modern mainframe OS have on option to compress the data, on the fly. Anyway, OC treats the 'block contains ...' clause as a comment. Regarding variable length indexed files, if I recall correctly, any OC indexed file options, meets the COBOL-85 standard requirements. If you are using the VB-ISAM or C-I*AM option for indexed files, the following internal limits apply. The max record length for indexed files is 32,511 bytes. For variable length records, ... The total record length can range from 2 to 32,511 bytes; The fixed record length (min) portion can range from 1 to 32,510 bytes. The max key size is 120 bytes. All indexes must be defined in the fixed (min) portion of the record. The fixed record (min) portion is stored in the index file (.idx), and variable portion is stored in the data file (.dat). As for the BDB option, it has support for both variable length keys and records. So a 4000 byte variable length indexed file should not be an issue for OC. I don't think there is a serious performance issue here, and no need to separate the 'IR-LOCATION-QUANTITY-DATA' portion of the record. Hope this helps. ---------------------------------------------------------------- Subject: File sharing... I am facing of a hudge-terrible problem. I am using vbisam /tried berkeley also, but i cant find a good solution regarding my problem... If file A is opened concurently by 2 or more users leads to primary key duplicates!!! No error 21. Example.. User A writes with primary key 5 User A writes with primary key 5 both can write... leading to duplicate primary key and lots of problems. However if user A writes with PK 5 then user B close and open the file ,writing with PK 5 wouldnt be allowed. File status 21.. File should be closed and opened again to see other users changes..It seems like that index is stored in memory and doesnt refresh each time. Any solution,workaround for this? ---------------------------------------------------------------- I think for BDB you need to set an env var DB_HOME=somepath (but be aware that a chrash of one session is likely to chrash all others, too, if this var is set). VBISAM should work, does this occur on an unpatched version, too? As always: when you submit a bug, please submit the output of cobc --version and tell us if any patches where applied. If possible, provide a short COBOL sample for others being able to check this quickly. human ---------------------------------------------------------------- http://dl.dropbox.com/u/4499990/sMFPEL.cbl Here is the program for testing... Run 2 of then at the same time... For the first time remove the comments in order to create the file.. So run the program and test... Enter 10 for example and 10 to the other side. You will get 00 both cases... If you run program then enter 10 you get 00.. If then you run a second instance it wont allow you to enter 10.. you will get 22 error.. cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Feb 22 2011 20:55:25 Packaged Feb 06 2009 10:30:55 CET ---------------------------------------------------------------- DB_HOME has to be set in order this problem not to occur.. However even if DB_HOME is empty it does work.. if DB_HOME doesnt exist as a variable then problems arise.. For vbisam i dont know where exactly is the bug... no time to search though ---------------------------------------------------------------- If you set DB_HOME empty, I guess it defaults to the current directory (check for the files __db.001-004). With VBISAM and your sample everything is fine for me. Here are the steps I did: - downloaded it - replaced all tabs by 9 spaces - changed the PROGRAM-ID to [code]PROGRAM-ID. dupl.[/code] - changed the SELECT to [code]SELECT optional MFPEL ASSIGN "testfile_dupl"[/code] for using the current directory and to open-output the file if it doesn't exist - compiled and run the program, entering 10 two times Result: First time I got 00 displayed, second time 22. Seems like everything is fine. Maybe I misunderstood what you wrote? If not, maybe the problem occurs only because of patches applied or because [url=http://pastebin.com/H9qT4HCg]Sergey's patch to vblockio.c[/url] wasn't applied? I've tested in SLES with 1.1pre-rel(Feb 06 2009) and with WIN with current 2.0 development version (both 32 bit). human ---------------------------------------------------------------- Human, that you for your time... I meant to run two instances of the program concurently!!!! If one instance is running everything is fine... ---------------------------------------------------------------- With VBISAM and your sample I got the same error. Here are the steps I did: - downloaded and changed your sample as mentioned in the previous post - deleted testfile_dupl from file system - started one dupl (process a) - started one dupl (process b) - entered 10 and pressed enter in process a, Status = 00 - entered 10 and pressed enter in process b, Status = 00 ==> BUG I've tested this with a patch VBISAM version in SLES with 1.1pre-rel (Feb 06 2009) and with WIN with current 2.0 development version (both 32 bit). The error occured in both versions. human ---------------------------------------------------------------- So there is a severe bug here.. ---------------------------------------------------------------- Well, just a thought, I may be wrong, but here is how I see the concurrency issue. Basically, when multiple processes share the same file, as long as existing records are updated, a straight forward ‘fcntl’ would suffice. However, when records are either added or deleted, I would think only one process may have exclusive update access to the ISAM file at any given moment of time, while others processes are held waiting until original process completes it’s update. As my understanding, a single lock on a particular area of the file would not suffice, because of the potential effect of updating multiple internal structures of the file. For example, let’s say a new record is being added. Upon verifying that the record does not exists, that record is added in the appropriate data block. As such, an entire lock is needed on the data block. However, depending on the value of the primary key, the immediate index block may also need a lock. But when there is not enough space in either or both the index block and data block, then simple locks on segments of file does not remedy the concurrency issue, because of data/index block splits. As such, potentially the whole internal file structure may change. As with the issue of the duplicate primary keys existing when multiple processes are updating the same file, I see this as a classic case of lost data integrity. Basically, dual processes see the initial index structure, but one update the index before the other one sees the updates, and therefore contradict each others updates. As a suggestion, is it possible within the compiler that outside of the read/update functionality a short term file lock could be implemented? ---------------------------------------------------------------- Subject: Error when compiling the disp1 test program I am busy setting up OpenCobol to compile my accounting and POS system, which will be open source. I downloaded the Windows binaries. COMMAND cobc -x source\disp1.cbl get the following message: 'cl' is not recognized as an internal or external command, operable program or batch file. If I enter cobc -i the following is displayed: cobc (OpenCobol) 1.1.20100520 Copy...... Copy...... . . . Build environment : windows CC : cl . . LDFLAGS : cl . . COB_CC : cl etc Any pointers to look for? Thanks James :-? :-? ---------------------------------------------------------------- Well, I’m relatively new to Open Cobol as well. :-) However, what works for me as to do the following, assuming you have Visual C++ install on your machine: Open All Programs\Visual C++...\Visual Studio Tools\Visual Studio Command Prompt Within this command window, the Visual C++ Compiler (CL) should be available. Hope this helps. ---------------------------------------------------------------- I wrote a batch for doing all necessary stuff for kiska's binaries. Just save the following into a new file set_env.bat and call it once before calling cobc/cobcrun [code]:: Batch for setting OC-Environment in Windows with MSC compiler :: Note: Env vars are set for Sergey's WIN binaries from kiska.net/opencobol @echo off :: Check if this batch was called allready and exit if it was called before. if "%COB_ENV_SET%" NEQ "" goto :eof :: Set the internal env var set COB_ENV_SET=1 :: Check for valid MSC Environment and let it do it's work. if "%VS110COMNTOOLS%" NEQ "" ( call "%VS110COMNTOOLS%vsvars32.bat" ) else if "%VS100COMNTOOLS%" NEQ "" ( call "%VS100COMNTOOLS%vsvars32.bat" ) else if "%VS90COMNTOOLS%" NEQ "" ( call "%VS90COMNTOOLS%vsvars32.bat" ) else if "%VS80COMNTOOLS%" NEQ "" ( call "%VS80COMNTOOLS%vsvars32.bat" ) else if "%VS71COMNTOOLS%" NEQ "" ( call "%VS71COMNTOOLS%vsvars32.bat" ) else if "%VS70COMNTOOLS%" NEQ "" ( call "%VS70COMNTOOLS%vsvars32.bat" ) else ( echo Warning: Not possible to set environment for Microsoft Visual Studio! ) :: Now the stuff for OC echo Setting environment for OpenCOBOL. :: Get the main dir from the batch's position (only works in NT environments) if "%COB_MAIN_DIR%" EQU "" set COB_MAIN_DIR=%~dp0. :: Set the necessary folders for cobc if "%COB_CONFIG_DIR%" EQU "" set COB_CONFIG_DIR=%COB_MAIN_DIR%\config if "%COB_COPY_DIR%" EQU "" set COB_COPY_DIR=%COB_MAIN_DIR%\copy :: Set the necessary options for MSC compiler if "%COB_CFLAGS%" EQU "" set COB_CFLAGS=/I "%COB_MAIN_DIR%" if "%COB_LIB_PATHS%" EQU "" set COB_LIB_PATHS=/LIBPATH:"%COB_MAIN_DIR%" if "%COB_LIBS%" EQU "" ( if exist "%COB_MAIN_DIR%\mpir.lib" set COB_LIBS=libcob.lib mpir.lib if exist "%COB_MAIN_DIR%\gmp.lib" set COB_LIBS=libcob.lib gmp.lib ) :: Add the bin path of OC to PATH for further references set PATH=%COB_MAIN_DIR%;%PATH%[/code] With this batch you can put the OpenCOBOL directory wherever you want and it should work with VisualStudio 2002-2012 (Express Versions will work, too). human ---------------------------------------------------------------- Thanks - The batch file did the trick :-D ---------------------------------------------------------------- Subject: Cannot find sub routines at run-time Hallo, I get the following message [code] /fmp/550/dsp/meserr-01.cbl:13 libcob: Cannot find module 'jeserr.int' WARNING - Implicit CLOSE of fileout ("shlconv") WARNING - Implicit CLOSE of filein ("lstconv") [/code] while running [code] # mk450to550f file=$1 if [ -f lstconv ] then rm lstconv fi if [ -f shlconv ] then rm shlconv fi cat $1 >lstconv /fmp/550/stdok/int/450to550.int if [ -s shlconv ] then cp shlconv $1 fi [/code] with user settings [code] # Sample .profile for SuSE Linux # rewritten by Christian Steinruecken <cstein@suse.de> # # This file is read each time a login shell is started. # All other interactive shells will only read .bashrc; this is particularly # important for language settings, see below. test -z "$PROFILEREAD" && . /etc/profile || true umask 0000 PATH=$HOME:/bin:/sbin:/usr/bin:/u/ute450/bck:/u/ute450/bcp:/u/ute450/bin:/u/ute450/bin87:/u/ute450/biny:/u/ute450/bmk:/u/ute450/bmkjk:/u/ute450/bmkyk:/u/ute450/bmsw:/u/ute450/bsys:/bin:/usr/bin; export PATH MORE=-c; export MORE COB_LIBRARY_PATH=/fmp/550/stdok/int:/fmp/550/stdok/int/s; export COB_LIBRARY_PATH LD_LIBRARY_PATH=/fmp/550/stdok/int:/fmp/550/stdok/int/s; export LD_LIBRARY_PATH cls [/code] main cobol source [code] identification division. program-id. 450to550. *security. nella directory corrente legge filein (lstconv) e * crea fileout (shlconv) * filein contiene in ogni riga una stringa da conver- * tire che contenente le stringa copy "/fmp/450/" * fileout contiene il file di input con le righe conver- * tite * la conversione e` effettuata con sostituzione della * stringa bersaglio con la stringa copy "/fmp/550/". environment division. configuration section. source-computer. unix-mu. object-computer. unix-mu. special-names. decimal-point is comma cursor is crsr console is crt crt status is crt-tus. input-output section. file-control. select filein assign to "lstconv" organization is line sequential access is sequential file status is fli-tus. select fileout assign to "shlconv" organization is line sequential access is sequential file status is flo-tus. data division. file section. fd filein. 01 fli-rec pic x(72). fd fileout. 01 flo-rec pic x(72). working-storage section. copy "/fmp/550/cbl/working1.cbl". copy "/fmp/550/cbl/working.cbl". 01 varie-tus. 02 fli-tus. 03 fli-tus1 pic x(02). 03 fli-tus2 pic x(02). 02 fli-tus9 redefines fli-tus pic x(04). 02 flo-tus. 03 flo-tus1 pic x(02). 03 flo-tus2 pic x(02). 02 flo-tus9 redefines flo-tus pic x(04). 01 wscomodo pic x(01). 01 ws-flo. 02 ws-flo-el occurs 72 pic x(01). 01 ws-tochange pic x(10) value '"/fmp/450/'. 01 ws-changed pic x(10) value '"/fmp/550/'. copy "/fmp/550/lnk/mf-area.lnk". *----------------------------------------------------------------* procedure division. inizio section. in0. move "/fmp/550/stdok/int" to mf-objdir open input filein open output fileout. in1. copy "/fmp/550/cbl/incorso.cbl". perform lavoro. fine. close filein fileout. fine-ex. stop run. *------------------------- lavoro section -----------------------+ lavoro section. ls1. read filein at end go to ls1-ex end-read move fli-rec to ws-flo move zeroes to xind inspect ws-flo tallying xind for all ws-tochange. if xind = 0 go to ls2 end-if inspect ws-flo replacing all ws-tochange by ws-changed. ls2. move ws-flo to flo-rec write flo-rec end-write if flo-tus not = "00" move " scrittura impossibile " to strg1 move "fileout " to strg2 move flo-tus to strg4 move spaces to strg6 move stringa to lnk-erro perform errore move zero to lnk-err go to ls1-ex end-if. ls90. go to ls1. ls1-ex. exit. *--------------------------- area cbl ---------------------------* errore section. copy "/fmp/550/cbl/errore.cbl". copy "/fmp/550/cbl/prpobjps.cbl". *----------------------------------------------------------------* * dsp section * *----------------------------------------------------------------* copy "/fmp/550/dsp/mkaster0-01.cbl". copy "/fmp/550/dsp/errore-01.cbl". copy "/fmp/550/dsp/errore-02.cbl". copy "/fmp/550/dsp/meserr-01.cbl". *----------------------- fine dsp section -----------------------* end program 450to550. [/code] subroutine 1 [code] identification division. program-id. jeserr. * programma per display/accept screen meserr. environment division. configuration section. special-names. decimal-point is comma cursor is crsr console is crt crt status is crt-tus. input-output section. file-control. data division. file section. working-storage section. copy "/fmp/550/cbl/workscr.cbl". copy "/fmp/550/msk/MKASTER0.msw". linkage section. copy "/fmp/550/lnk/mf-area.lnk". copy "/fmp/550/msk/MESERR.msw". screen section. copy "/fmp/550/msk/MESERR-01.ss". procedure division using mf-area meserrx01. inizio section. in1. if meserr-01-0001 = spaces move lnk-erro to meserr-01-0001 end-if if mf-dspacc = "dsp" if mf-modind = 01 perform dspmeserr01 perform mkaster0-01 go to fine end-if end-if. if mf-dspacc = "acc" if mf-modind = 01 perform dspmeserr01 perform mkaster0-01 perform accmeserr01 end-if end-if. fine. move terminating-char to lnk-retchar move crt-tus to scr-tus exit program. *----------------------------------------------------------------* dspmeserr01 section. dspmeserr0101. if lnk-attscr not = lnk-oldscr display spaces end-display end-if display meserr-01 end-display move lnk-attscr to lnk-oldscr. dspmeserr01ex. exit. *----------------------------------------------------------------* accmeserr01 section. accmeserr0101. if dep-crsr not = zero perform poscrsr end-if if mf-system > 1 perform f-key-on end-if accept meserr-01 end-accept. accmeserr01ex. exit. *----------------------------------------------------------------* copy "/fmp/550/cbl/f-key-on.sbr". copy "/fmp/550/cbl/poscrsr.cbl". copy "/fmp/550/dsp/mkaster0-01.cbl". copy "/fmp/550/cbl/prpobjps.cbl". *----------------------------------------------------------------* end program jeserr. [/code] subroutine 2 [code] identification division. program-id. jkaster0. * programma per display/accept screen mkaster0. environment division. configuration section. special-names. decimal-point is comma cursor is crsr console is crt crt status is crt-tus. input-output section. file-control. copy "/fmp/550/cbl/st-ioc.cbl". working-storage section. copy "/fmp/550/cbl/workscr.cbl". linkage section. copy "/fmp/550/lnk/mf-area.lnk". copy "/fmp/550/msk/MKASTER0.msw". screen section. copy "/fmp/550/msk/MKASTER0-01.ss". procedure division using mf-area mkaster0x01. inizio section. in1. if mf-dspacc = "dsp" if mf-modind = 01 perform dspmkaster001 go to fine end-if end-if. fine. if mf-system > 1 perform f-key-on end-if move crt-tus to scr-tus exit program. *----------------------------------------------------------------* dspmkaster001 section. dspmkaster00101. display mkaster0-01 end-display. dspmkaster001ex. exit. *----------------------------------------------------------------* copy "/fmp/550/cbl/f-key-on.sbr". copy "/fmp/550/cbl/poscrsr.cbl". *----------------------------------------------------------------* end program jkaster0. [/code] subroutine 3 [code] identification division. program-id. jrrore. * programma per display/accept screen errore. environment division. configuration section. special-names. decimal-point is comma cursor is crsr console is crt crt status is crt-tus. input-output section. file-control. data division. file section. working-storage section. copy "/fmp/550/cbl/workscr.cbl". linkage section. copy "/fmp/550/lnk/mf-area.lnk". copy "/fmp/550/msk/ERRORE.msw". screen section. copy "/fmp/550/msk/ERRORE-01.ss". copy "/fmp/550/msk/ERRORE-02.ss". procedure division using mf-area errorex01. inizio section. in1. if lnk-erro not = spaces move lnk-erro to errore-01-0001 end-if if mf-dspacc = "dsp" if mf-modind = 01 perform dsperrore01 go to fine end-if if mf-modind = 02 perform dsperrore02 go to fine end-if end-if. if mf-dspacc = "acc" if mf-modind = 01 perform dsperrore01 perform accerrore01 end-if if mf-modind = 02 perform dsperrore02 perform accerrore02 end-if end-if. fine. move terminating-char to lnk-retchar move crt-tus to scr-tus exit program. *----------------------------------------------------------------* dsperrore01 section. dsperrore0101. display errore-01 end-display move lnk-attscr to lnk-oldscr. dsperrore01ex. exit. *----------------------------------------------------------------* dsperrore02 section. dsperrore0201. display errore-02 end-display move lnk-attscr to lnk-oldscr. dsperrore02ex. exit. *----------------------------------------------------------------* accerrore01 section. accerrore0101. if mf-system > 1 perform f-key-on end-if accept errore-01 end-accept. accerrore01ex. exit. *----------------------------------------------------------------* accerrore02 section. accerrore0201. if mf-system > 1 perform f-key-on end-if accept errore-02 end-accept. accerrore02ex. exit. *----------------------------------------------------------------* copy "/fmp/550/cbl/f-key-on.sbr". *----------------------------------------------------------------* end program jrrore. [/code] compilation list (all in one for better handling) [code] # Generated by OpenCOBOL 1.1.0 (Build date - Mar 10 2011 18:33:24) # Environment : # TMPDIR : /tmp # COBCPY : is not set # Compile command : cobc -x -std=mf -g -debug -t /fmg/cmpl45/450to550.lst -Wall 450to550.cbl # 1 "450to550.cbl" identification division. program-id. 450to550. environment division. configuration section. source-computer. unix-mu. object-computer. unix-mu. special-names. decimal-point is comma cursor is crsr console is crt crt status is crt-tus. input-output section. file-control. select filein assign to "lstconv" organization is line sequential access is sequential file status is fli-tus. select fileout assign to "shlconv" organization is line sequential access is sequential file status is flo-tus. data division. file section. fd filein. 01 fli-rec pic x(72). fd fileout. 01 flo-rec pic x(72). working-storage section. # 1 "/fmp/550/cbl/working1.cbl" 01 command-lin. 02 command-lin-lenght pic x(01) comp-x value zero. 01 cx-param35. 02 cx-cfnl pic 9(02) comp value zero. 02 cx-cfname pic x(120) value spaces. 01 cx-tabe. 02 cx-tbnx. 03 cx-tbele occurs 99 pic x(01). 02 cx-tbname redefines cx-tbnx pic x(99). 01 cx-fdetails. 02 cx-fsize pic x(08) comp-x. 02 cx-fdate. 03 cx-fday pic x(01) comp-x. 03 cx-fmonth pic x(01) comp-x. 03 cx-fyear pic x(02) comp-x. 02 cx-ftime. 03 cx-fhours pic x(01) comp-x. 03 cx-fminutes pic x(01) comp-x. 03 cx-fseconds pic x(01) comp-x. 03 cx-fhundredths pic x(01) comp-x. 01 cx-function pic x(01) comp-x value zeroes. 01 cx-function2 pic 9(02) comp value zeroes. 01 cx-param02. 02 cx-02fnl pic 9(02) comp value zero. 02 cx-02flname pic x(99) value spaces. 01 cx-param15. 02 cx-rfnl pic 9(02) comp value 16. 02 cx-rfname pic x(16) value spaces. 01 cx-param17. 02 cx-ofnl pic 9(02) comp value 16. 02 cx-ofname pic x(16) value spaces. 02 cx-nfnl pic 9(02) comp value 16. 02 cx-nfname pic x(16) value spaces. 01 cx-param18. 02 cx-dfnl pic 9(02) comp value 16. 02 cx-dfname pic x(16) value spaces. 01 cx-parpath pic x(80). 01 cx-parrig2. 02 cx-cf2nl pic 9(02) comp value zero. 02 cx-cf2name pic x(31) value spaces. 01 cx-param59. 02 cx-cmdln59 pic x(127) value spaces. 02 cx-cmdlnnul pic x(01) value x"00". 01 cx-result pic x(01) comp-x value zero. 01 cx-result2 pic 9(06) comp value zero. 01 character-found pic x(01). 01 crt-tus. 02 crt-tus1 pic x(02). 02 crt-tus2 pic x(02). 01 crn-tus redefines crt-tus pic x(04). 01 cx-dispmess0 pic x(80) value spaces. 01 cx-dispmess1 pic x(29) value "Ricostruzione indici archivio". 01 cx-dispmess2 pic x(08). 01 cx-dispmess3. 02 cx-dispmess31 pic x(24) value "Numero records letti : ". 02 cx-nrread pic 9(06) value zeroes. 01 cx-dispmess4. 02 cx-dispmess41 pic x(24) value "Numero records scritti: ". 02 cx-nrwrite pic 9(06) value zeroes. 01 cx-dispmess5 pic x(29) value "Sequenzializzazione archivio". 01 cx-dispmess6 pic x(29) value " Indicizzazione archivio ". 01 cx-dispmess7 pic x(29) value " Conversione euro archivio ". 01 fcb. 02 filler pic x(01) value x"00". 02 fcb-nome pic x(08). 02 fcb-ext pic x(03). 02 filler pic x(25). 01 fk-decod pic 9(02). 01 form-length pic 9(04) comp. 01 form-params. 02 io-length pic 9(04) comp. 02 screen-offset pic 9(04) comp. 02 buffer-offset pic 9(04) comp. 01 nullo pic x(01) value x"00". 01 xesc pic x(01) value x"1b". 01 apix pic x(01) value x"22". 01 scan-result pic 9(02) comp. # 39 "450to550.cbl" # 1 "/fmp/550/cbl/working.cbl" 01 crsrx. 02 crrig pic 9(02) value zero. 02 crcol pic 9(02) value zero. 01 crsr redefines crsrx pic 9(04). 01 dataaaa pic s9(04). 01 datxx. 02 datgg pic 9(02). 02 datmm pic 9(02). 02 dataa pic 9(02). 01 datx redefines datxx pic 9(06). 01 datyy pic s9(02). 01 duemiladrittx. 02 datdgg pic 9(02). 02 datdmm pic 9(02). 02 datdaa pic 9(04). 01 duemiladritta redefines duemiladrittx pic 9(08). 01 d2d redefines duemiladrittx pic 9(08). 01 d2m pic 9(08). 01 duemilarovescix. 02 datraa pic 9(04). 02 datrmm pic 9(02). 02 datrgg pic 9(02). 01 duemilarovescia redefines duemilarovescix pic 9(08). 01 d2r redefines duemilarovescix pic 9(08). 01 eot pic 9(01). 88 eotno value 0. 88 eotsi value 1. 01 inderr pic 9(01) value zero. 01 ind9d2 pic 9(02) value zero. 01 invsysdata pic 9(08). 01 mf-objpath pic x(80) value spaces. 01 negativo pic s9(01) value zero. 01 saldo pic s9(13) value zero. 01 saldo2 pic s9(11)v9(02) value zero. 01 saldo59. 02 saldo590 pic s9(11) value zero. 02 saldo591 pic 9(01) value zero. 02 saldo592 pic 9(01) value zero. 02 saldo593 pic 9(01) value zero. 02 saldo594 pic 9(01) value zero. 02 saldo595 pic 9(01) value zero. 02 saldo596 pic 9(01) value zero. 02 saldo597 pic 9(01) value zero. 01 saldo833 redefines saldo59. 02 saldo8 pic s9(11). 02 saldo82 pic 9(02) . 02 saldo823 pic 9(03) . 02 saldo8232 pic 9(02) . 01 saldo815 redefines saldo59. 02 saldo8 pic s9(11). 02 saldo8152 pic 9(02). 02 saldo8151 pic 9(01). 02 saldo8155 pic 9(04). 01 saldo99 redefines saldo59 pic s9(11)v9(07). 01 saldox2 redefines saldo59. 02 saldo92 pic s9(11)v9(02). 02 saldo926 pic 9(05). 01 saldo88 pic s9(11)v9(07). 01 saldoseg pic s9(01) value zero. 01 troncx. 02 ti1 pic 9(11). 02 ti2 pic 9(04). 02 tix2 redefines ti2. 03 ti21 pic 9(02). 03 ti22 pic 9(02). 02 ti3 pic 9(03). 01 tronco redefines troncx pic 9(11)v9(07). 01 tronca pic s9(11)v9(07). 01 troncaseg pic s9(01) value zero. 01 scompnumy. 02 scmpnx. 03 scompnum1 pic 9(11). 03 scompnum2 pic 9(07). 03 scnx2 redefines scompnum2. 04 scompnum21 pic 9(02). 04 scompnum22 pic 9(02). 04 scompnum23 pic 9(03). 02 scomponum redefines scmpnx pic 9(11)v9(07). 01 stato-tus. 02 stato-tus1 pic x(01). 02 stato-tus2 pic x(01). 01 strc pic 9(04) value zero. 01 stringx. 02 strg1 pic x(30). 02 strg2 pic x(08). 02 strg3 pic x(03) value " s:". 02 strg4 pic x(04). 02 strg5 pic x(01) value "k". 02 strg6 pic x(33). 01 stringa redefines stringx pic x(79). 01 strp pic 9(04) value zero. 01 sys-tus. 02 sys-tus1 pic x(01). 02 sys-tus2 pic x(01). 01 sys-tus9 redefines sys-tus pic 9(04) comp. 01 sysdatx. 02 sysaa pic 9(04). 02 sysmm pic 9(02). 02 sysgg pic 9(02). 01 sysdata redefines sysdatx pic 9(08). 01 sysd2000x. 02 sysax. 03 sys2000cc pic 9(02). 03 sys2000aa pic 9(02). 02 sys2000ca redefines sysax pic 9(04). 02 sys2000mm pic 9(02). 02 sys2000gg pic 9(02). 01 sysd2000 redefines sysd2000x pic 9(08). 01 systempox. 02 sysorax. 03 systh pic 9(02). 03 systm pic 9(02). 02 sysora redefines sysorax pic 9(04). 02 sysperdi. 03 sysss pic 9(02). 03 sysds pic 9(02). 01 systempo redefines systempox pic 9(08). 01 sysgiorn. 02 sysjorndat pic 9(08). 02 systimeini pic 9(04). 02 systimefin pic 9(04). 02 sysprog pic x(10). 02 systring pic x(58). 02 sysmess pic x(20) value " Giornale macchina: ". 01 tipo-lavoro pic x(13). 01 ws-file-tus. 02 ws-file-tus1 pic x(01). 02 ws-file-tus2 pic x(01). 01 wscomodino pic x(01). 01 ws-alfnum8 pic x(08). 01 ws-puntatore pic x(02) value "->". 01 ws-cvdattx. 02 ws-cvdat2l occurs 4 pic 9(02). 01 ws-cvdat2m redefines ws-cvdattx pic 9(08). 01 w-scount pic 9(03). 01 ws-data2m pic 9(08). 01 wst-key pic x(08) value spaces. 01 xdiretta pic x(80). 01 xind pic 9(04) value zero. 01 yind pic 9(04) value zero. 01 wind pic 9(04) value zero. 01 hind pic 9(04) value zero. # 1 "/fmp/450/msk/MKASTER0.msw" 01 MKASTER0X01. 02 MKASTER0-01-0001 pic x(10). 02 MKASTER0-01-0002 pic x(10). 02 MKASTER0-01-0003 pic x(11). # 149 "/fmp/550/cbl/working.cbl" # 1 "/fmp/450/msk/MNERO.msw" 01 MNEROX01. 02 MNERO-01-0001 pic x(01). # 150 "/fmp/550/cbl/working.cbl" # 1 "/fmp/450/msk/ERRORE.msw" 01 ERROREX01. 02 ERRORE-01-0001 PIC X(77). 02 ERRORE-01-0002 PIC X(01). # 151 "/fmp/550/cbl/working.cbl" # 1 "/fmp/450/msk/ERRORE1.msw" 01 ERRORE1X01. 02 ERRORE1-01-0001 PIC X(77). 02 ERRORE1-01-0002 PIC X(01). # 152 "/fmp/550/cbl/working.cbl" # 1 "/fmp/450/msk/MESERR.msw" 01 MESERRX01. 02 MESERR-01-0001 PIC X(77). 02 MESERR-01-0002 PIC X(01). # 153 "/fmp/550/cbl/working.cbl" # 1 "/fmp/450/msk/ERRORL.msw" 01 ERRORLX01. 02 ERRORL-01-0001 pic x(77). 02 ERRORL-01-0002 pic x(01). # 154 "/fmp/550/cbl/working.cbl" # 40 "450to550.cbl" 01 varie-tus. 02 fli-tus. 03 fli-tus1 pic x(02). 03 fli-tus2 pic x(02). 02 fli-tus9 redefines fli-tus pic x(04). 02 flo-tus. 03 flo-tus1 pic x(02). 03 flo-tus2 pic x(02). 02 flo-tus9 redefines flo-tus pic x(04). 01 wscomodo pic x(01). 01 ws-flo. 02 ws-flo-el occurs 72 pic x(01). 01 ws-tochange pic x(10) value '"/fmp/450/'. 01 ws-changed pic x(10) value '"/fmp/550/'. # 1 "/fmp/550/lnk/mf-area.lnk" 01 mf-area. 02 mf-terminale pic 9(02). 02 mf-scrname. 03 mf-dspacc pic x(03). 03 mf-modulo pic x(09). 03 mf-modind pic 9(02). 02 mf-utente pic x(10). 02 mf-fmd pic x(25). 02 mf-fmddrive pic x(01). 02 mf-fmp pic x(25). 02 mf-fmpdrive pic x(01). 02 mf-dbname pic x(08). 02 mf-azix. 03 mf-azibase pic x(03). 03 mf-azisecolo pic 9(02). 03 mf-azianno pic 9(02). 03 mf-aziresto pic x(03). 02 mf-azienda redefines mf-azix pic x(10). 02 mf-omega pic 9(02). 02 mf-system pic 9(01). 02 mf-stampa pic x(22). 02 mf-netgroup pic x(08). 02 mf-netseg pic 9(03). 02 mf-usrmenu pic x(08). 02 mf-usrsys pic 9(01). 02 mf-usrlpt1 pic x(08). 02 mf-usrlp1i pic 9(01). 02 mf-usrlpt2 pic x(08). 02 mf-usrlp2i pic 9(01). 02 mf-usrlpt3 pic x(08). 02 mf-usrlp3i pic 9(01). 02 mf-system1 pic x(12). 02 mf-monosezio pic 9(01). 02 mf-sezionale pic 9(01). 02 mf-2000x. 03 mf-secolo pic 9(02). 03 mf-esercizio pic 9(02). 02 mf-anno2000 redefines mf-2000x pic 9(04). 02 mf-objsett pic x(05). 02 mf-objdir pic x(50). 02 mf-objname pic x(15). 02 mf-ojjpath pic x(80). 02 mf-ojjname pic x(15). 02 mf-tmpname pic x(15). 02 mf-d pic 9(01). 02 mf-5 pic 9(01). 02 mf-jsys pic x(01). 02 mf-xsys pic x(01). 02 mf-jnamx. 03 mf-jnamel occurs 15 pic x(01). 02 mf-jname redefines mf-jnamx pic x(15). 02 mf-mname pic x(15). 02 mf-tclpath pic x(80). 02 mf-tclb pic x(20). 02 mf-acrb pic x(10). 02 mf-acrbfile pic x(12). 02 dep-crsr pic 9(04). 02 lnk-erro pic x(79). 02 lnk-erri pic x(01). 02 lnk-err pic 9(01). 02 lnk-retpar pic x(02). 02 lnk-retchar pic 9(02). 02 lnk-attscr pic x(13). 02 lnk-oldscr pic x(13). 02 scr-tus. 03 scr-tus1 pic x(02). 03 scr-tus2 pic x(02). 02 scn-tus redefines scr-tus pic x(04). 02 lnk-tastib. 03 lnk-tstbel occurs 5 pic x(15). 02 lnk-wait pic 9(08). 02 lnk-eof pic x(01). 02 lnk-tclpar. 03 lnk-tclcaller pic x(15). 03 lnk-rettcl pic x(02). 03 lnk-tclend pic x(02). 03 lnk-tclintp pic x(09). # 57 "450to550.cbl" procedure division. inizio section. in0. move "/fmp/550/stdok/int" to mf-objdir open input filein open output fileout. in1. # 1 "/fmp/550/cbl/incorso.cbl" move spaces to lnk-erri lnk-erro meserr-01-0001 meserr-01-0002 move "Attendere: elaborazione in corso ..." to lnk-erro meserr-01-0001 move "dsp" to mf-dspacc perform meserr-01. # 66 "450to550.cbl" perform lavoro. fine. close filein fileout. fine-ex. stop run. lavoro section. ls1. read filein at end go to ls1-ex end-read move fli-rec to ws-flo move zeroes to xind inspect ws-flo tallying xind for all ws-tochange. if xind = 0 go to ls2 end-if inspect ws-flo replacing all ws-tochange by ws-changed. ls2. move ws-flo to flo-rec write flo-rec end-write if flo-tus not = "00" move " scrittura impossibile " to strg1 move "fileout " to strg2 move flo-tus to strg4 move spaces to strg6 move stringa to lnk-erro perform errore move zero to lnk-err go to ls1-ex end-if. ls90. go to ls1. ls1-ex. exit. errore section. # 1 "/fmp/550/cbl/errore.cbl" errr1. move 1 to lnk-err move lnk-erro to errore-01-0001 move spaces to errore-01-0002 move "dsp" to mf-dspacc move "jrrore" to mf-modulo mf-ojjname move 1 to mf-modind move spaces to lnk-attscr string mf-modulo delimited spaces mf-modind delimited size into lnk-attscr end-string perform prpobjpts call mf-ojjpath using mf-area errorex01 cancel mf-ojjpath move "acc" to mf-dspacc move "jrrore" to mf-modulo mf-ojjname move 1 to mf-modind perform prpobjpts call mf-ojjpath using mf-area errorex01 end-call move spaces to lnk-erro errore-01-0001 errore-01-0002. errr-ex. exit. # 106 "450to550.cbl" # 1 "/fmp/550/cbl/prpobjps.cbl" prpobjpts section. prpobps1. move mf-ojjname to mf-jname if mf-dspacc = "dsp" if mf-ojjname = "jeserr " and mf-modind = 01 go to prpobps2 end-if if mf-ojjname = "jstampa " go to prpobps2 end-if end-if if mf-xsys not = spaces move "y" to mf-jnamel (01) move mf-jname to mf-ojjname end-if. prpobps2. move space to mf-ojjpath string mf-ojjname delimited by spaces ".int" delimited size into mf-ojjpath end-string. prpobps1-ex. exit. # 107 "450to550.cbl" # 1 "/fmp/550/dsp/mkaster0-01.cbl" mkaster0-01 section. mkaster0-0101. move "jkaster0 " to mf-modulo mf-ojjname move 01 to mf-modind move mf-utente to mkaster0-01-0001 move mf-azienda to mkaster0-01-0002 move lnk-attscr to mkaster0-01-0003 perform prpobjpts call mf-ojjpath using mf-area mkaster0x01 end-call move mkaster0-01-0001 to mf-utente move mkaster0-01-0002 to mf-azienda move mkaster0-01-0003 to lnk-attscr. mkaster0-01-ex. exit. # 111 "450to550.cbl" # 1 "/fmp/550/dsp/errore-01.cbl" errore-01 section. errore-0101. move "jrrore " to mf-modulo mf-ojjname move 01 to mf-modind move spaces to lnk-attscr string mf-modulo delimited spaces mf-modind delimited size into lnk-attscr end-string perform prpobjpts call mf-ojjpath using mf-area errorex01 end-call. errore-01-ex. exit. # 112 "450to550.cbl" # 1 "/fmp/550/dsp/errore-02.cbl" errore-02 section. errore-0201. move "jrrore " to mf-modulo mf-ojjname move 02 to mf-modind move spaces to lnk-attscr string mf-modulo delimited spaces mf-modind delimited size into lnk-attscr end-string perform prpobjpts call mf-ojjpath using mf-area errorex01 end-call. errore-02-ex. exit. # 113 "450to550.cbl" # 1 "/fmp/550/dsp/meserr-01.cbl" meserr-01 section. meserr-0101. move "jeserr " to mf-modulo mf-ojjname move 01 to mf-modind move spaces to lnk-attscr string mf-modulo delimited spaces mf-modind delimited size into lnk-attscr end-string perform prpobjpts call mf-ojjpath using mf-area meserrx01 end-call. meserr-01-ex. exit. # 114 "450to550.cbl" end program 450to550. [/code] [code] # Generated by OpenCOBOL 1.1.0 (Build date - Mar 10 2011 18:33:24) # Environment : # TMPDIR : /tmp # COBCPY : is not set # Compile command : cobc -m -std=mf -g -debug -t /fmg/cmpl45/jeserr.lst -Wall jeserr.cbl # 1 "jeserr.cbl" identification division. program-id. jeserr. environment division. configuration section. special-names. decimal-point is comma cursor is crsr console is crt crt status is crt-tus. input-output section. file-control. data division. file section. working-storage section. # 1 "/fmp/550/cbl/workscr.cbl" 01 function-key. 02 f-key-routine pic x(01) value x"B0". 02 key-switch-on pic 9(02) comp value 0. 02 f-key-table. 03 terminating-char pic 9(02) comp. 03 length-fk1 pic 9(02) comp value 2. 03 fk1 pic x(02) value x"003B". 03 length-fk2 pic 9(02) comp value 2. 03 fk2 pic x(02) value x"003C". 03 length-fk3 pic 9(02) comp value 2. 03 fk3 pic x(02) value x"003D". 03 length-fesc pic 9(02) comp value 1. 03 fesc pic x(01) value x"1B". 03 length-fk5 pic 9(02) comp value 2. 03 fk5 pic x(02) value x"003F". 03 length-fk6 pic 9(02) comp value 2. 03 fk6 pic x(02) value x"0040". 03 length-fk7 pic 9(02) comp value 2. 03 fk7 pic x(02) value x"0041". 03 length-fk4 pic 9(02) comp value 2. 03 fk4 pic x(02) value x"003E". 03 length-fk9 pic 9(02) comp value 2. 03 fk9 pic x(02) value x"0043". 03 length-fk10 pic 9(02) comp value 2. 03 fk10 pic x(02) value x"0044". 03 fkend pic 9(02) comp value 0. 01 crsrx. 02 crrig pic 9(02) value zero. 02 crcol pic 9(02) value zero. 01 crsr redefines crsrx pic 9(04). 01 crt-tus. 02 crt-tus1 pic x(02). 02 crt-tus2 pic x(02). 01 crn-tus redefines crt-tus pic x(04). 01 mf-objpath pic x(80) value spaces. 01 w-butind pic 9(01). 01 command-lin. 02 command-lin-lenght pic x(01) comp-x value zero. 01 cx-param35. 02 cx-cfnl pic 9(02) comp value zero. 02 cx-cfname pic x(120) value spaces. 01 cx-function pic x(01) comp-x value zeroes. 01 cx-result pic x(01) comp-x value zero. 01 cx-param59. 02 cx-cmdln59 pic x(127) value spaces. 02 cx-cmdlnnul pic x(01) value x"00". # 16 "jeserr.cbl" # 1 "/fmp/550/msk/MKASTER0.msw" 01 MKASTER0X01. 02 MKASTER0-01-0001 pic x(10). 02 MKASTER0-01-0002 pic x(10). 02 MKASTER0-01-0003 pic x(11). # 17 "jeserr.cbl" linkage section. # 1 "/fmp/550/lnk/mf-area.lnk" 01 mf-area. 02 mf-terminale pic 9(02). 02 mf-scrname. 03 mf-dspacc pic x(03). 03 mf-modulo pic x(09). 03 mf-modind pic 9(02). 02 mf-utente pic x(10). 02 mf-fmd pic x(25). 02 mf-fmddrive pic x(01). 02 mf-fmp pic x(25). 02 mf-fmpdrive pic x(01). 02 mf-dbname pic x(08). 02 mf-azix. 03 mf-azibase pic x(03). 03 mf-azisecolo pic 9(02). 03 mf-azianno pic 9(02). 03 mf-aziresto pic x(03). 02 mf-azienda redefines mf-azix pic x(10). 02 mf-omega pic 9(02). 02 mf-system pic 9(01). 02 mf-stampa pic x(22). 02 mf-netgroup pic x(08). 02 mf-netseg pic 9(03). 02 mf-usrmenu pic x(08). 02 mf-usrsys pic 9(01). 02 mf-usrlpt1 pic x(08). 02 mf-usrlp1i pic 9(01). 02 mf-usrlpt2 pic x(08). 02 mf-usrlp2i pic 9(01). 02 mf-usrlpt3 pic x(08). 02 mf-usrlp3i pic 9(01). 02 mf-system1 pic x(12). 02 mf-monosezio pic 9(01). 02 mf-sezionale pic 9(01). 02 mf-2000x. 03 mf-secolo pic 9(02). 03 mf-esercizio pic 9(02). 02 mf-anno2000 redefines mf-2000x pic 9(04). 02 mf-objsett pic x(05). 02 mf-objdir pic x(50). 02 mf-objname pic x(15). 02 mf-ojjpath pic x(80). 02 mf-ojjname pic x(15). 02 mf-tmpname pic x(15). 02 mf-d pic 9(01). 02 mf-5 pic 9(01). 02 mf-jsys pic x(01). 02 mf-xsys pic x(01). 02 mf-jnamx. 03 mf-jnamel occurs 15 pic x(01). 02 mf-jname redefines mf-jnamx pic x(15). 02 mf-mname pic x(15). 02 mf-tclpath pic x(80). 02 mf-tclb pic x(20). 02 mf-acrb pic x(10). 02 mf-acrbfile pic x(12). 02 dep-crsr pic 9(04). 02 lnk-erro pic x(79). 02 lnk-erri pic x(01). 02 lnk-err pic 9(01). 02 lnk-retpar pic x(02). 02 lnk-retchar pic 9(02). 02 lnk-attscr pic x(13). 02 lnk-oldscr pic x(13). 02 scr-tus. 03 scr-tus1 pic x(02). 03 scr-tus2 pic x(02). 02 scn-tus redefines scr-tus pic x(04). 02 lnk-tastib. 03 lnk-tstbel occurs 5 pic x(15). 02 lnk-wait pic 9(08). 02 lnk-eof pic x(01). 02 lnk-tclpar. 03 lnk-tclcaller pic x(15). 03 lnk-rettcl pic x(02). 03 lnk-tclend pic x(02). 03 lnk-tclintp pic x(09). # 19 "jeserr.cbl" # 1 "/fmp/550/msk/MESERR.msw" 01 MESERRX01. 02 MESERR-01-0001 PIC X(77). 02 MESERR-01-0002 PIC X(01). # 20 "jeserr.cbl" screen section. # 1 "/fmp/550/msk/MESERR-01.ss" 01 MESERR-01. 02 LINE 21 COL 1 FOREGROUND-COLOR 0 HIGHLIGHT VALUE "ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ?". 02 LINE 22 COL 1 FOREGROUND-COLOR 0 HIGHLIGHT VALUE "?". 02 COL 80 FOREGROUND-COLOR 0 HIGHLIGHT VALUE "?". 02 LINE 23 COL 1 FOREGROUND-COLOR 0 HIGHLIGHT VALUE "?ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ?". 02 LINE 22 COL 2 FOREGROUND-COLOR 3 HIGHLIGHT PIC X(77) FROM MESERR-01-0001. 02 LINE 22 COL 79 HIGHLIGHT PIC X USING MESERR-01-0002. # 22 "jeserr.cbl" procedure division using mf-area meserrx01. inizio section. in1. if meserr-01-0001 = spaces move lnk-erro to meserr-01-0001 end-if if mf-dspacc = "dsp" if mf-modind = 01 perform dspmeserr01 perform mkaster0-01 go to fine end-if end-if. if mf-dspacc = "acc" if mf-modind = 01 perform dspmeserr01 perform mkaster0-01 perform accmeserr01 end-if end-if. fine. move terminating-char to lnk-retchar move crt-tus to scr-tus exit program. dspmeserr01 section. dspmeserr0101. if lnk-attscr not = lnk-oldscr display spaces end-display end-if display meserr-01 end-display move lnk-attscr to lnk-oldscr. dspmeserr01ex. exit. accmeserr01 section. accmeserr0101. if dep-crsr not = zero perform poscrsr end-if if mf-system > 1 perform f-key-on end-if accept meserr-01 end-accept. accmeserr01ex. exit. # 1 "/fmp/550/cbl/f-key-on.sbr" f-key-on section. fkon1. move zero to key-switch-on call f-key-routine using key-switch-on f-key-table end-call. fkon1-ex. exit. # 74 "jeserr.cbl" # 1 "/fmp/550/cbl/poscrsr.cbl" poscrsr section. poscrsr1. move zero to crsr if dep-crsr not = zero move dep-crsr to crsr move zero to dep-crsr end-if. poscrsr1-ex. exit. # 75 "jeserr.cbl" # 1 "/fmp/550/dsp/mkaster0-01.cbl" mkaster0-01 section. mkaster0-0101. move "jkaster0 " to mf-modulo mf-ojjname move 01 to mf-modind move mf-utente to mkaster0-01-0001 move mf-azienda to mkaster0-01-0002 move lnk-attscr to mkaster0-01-0003 perform prpobjpts call mf-ojjpath using mf-area mkaster0x01 end-call move mkaster0-01-0001 to mf-utente move mkaster0-01-0002 to mf-azienda move mkaster0-01-0003 to lnk-attscr. mkaster0-01-ex. exit. # 76 "jeserr.cbl" # 1 "/fmp/550/cbl/prpobjps.cbl" prpobjpts section. prpobps1. move mf-ojjname to mf-jname if mf-dspacc = "dsp" if mf-ojjname = "jeserr " and mf-modind = 01 go to prpobps2 end-if if mf-ojjname = "jstampa " go to prpobps2 end-if end-if if mf-xsys not = spaces move "y" to mf-jnamel (01) move mf-jname to mf-ojjname end-if. prpobps2. move space to mf-ojjpath string mf-ojjname delimited by spaces ".int" delimited size into mf-ojjpath end-string. prpobps1-ex. exit. # 77 "jeserr.cbl" end program jeserr. [/code] [code] # Generated by OpenCOBOL 1.1.0 (Build date - Mar 10 2011 18:33:24) # Environment : # TMPDIR : /tmp # COBCPY : is not set # Compile command : cobc -m -std=mf -g -debug -t /fmg/cmpl45/jkaster0.lst -Wall jkaster0.cbl # 1 "jkaster0.cbl" identification division. program-id. jkaster0. environment division. configuration section. special-names. decimal-point is comma cursor is crsr console is crt crt status is crt-tus. input-output section. file-control. # 1 "/fmp/550/cbl/st-ioc.cbl" data division. file section. # 13 "jkaster0.cbl" working-storage section. # 1 "/fmp/550/cbl/workscr.cbl" 01 function-key. 02 f-key-routine pic x(01) value x"B0". 02 key-switch-on pic 9(02) comp value 0. 02 f-key-table. 03 terminating-char pic 9(02) comp. 03 length-fk1 pic 9(02) comp value 2. 03 fk1 pic x(02) value x"003B". 03 length-fk2 pic 9(02) comp value 2. 03 fk2 pic x(02) value x"003C". 03 length-fk3 pic 9(02) comp value 2. 03 fk3 pic x(02) value x"003D". 03 length-fesc pic 9(02) comp value 1. 03 fesc pic x(01) value x"1B". 03 length-fk5 pic 9(02) comp value 2. 03 fk5 pic x(02) value x"003F". 03 length-fk6 pic 9(02) comp value 2. 03 fk6 pic x(02) value x"0040". 03 length-fk7 pic 9(02) comp value 2. 03 fk7 pic x(02) value x"0041". 03 length-fk4 pic 9(02) comp value 2. 03 fk4 pic x(02) value x"003E". 03 length-fk9 pic 9(02) comp value 2. 03 fk9 pic x(02) value x"0043". 03 length-fk10 pic 9(02) comp value 2. 03 fk10 pic x(02) value x"0044". 03 fkend pic 9(02) comp value 0. 01 crsrx. 02 crrig pic 9(02) value zero. 02 crcol pic 9(02) value zero. 01 crsr redefines crsrx pic 9(04). 01 crt-tus. 02 crt-tus1 pic x(02). 02 crt-tus2 pic x(02). 01 crn-tus redefines crt-tus pic x(04). 01 mf-objpath pic x(80) value spaces. 01 w-butind pic 9(01). 01 command-lin. 02 command-lin-lenght pic x(01) comp-x value zero. 01 cx-param35. 02 cx-cfnl pic 9(02) comp value zero. 02 cx-cfname pic x(120) value spaces. 01 cx-function pic x(01) comp-x value zeroes. 01 cx-result pic x(01) comp-x value zero. 01 cx-param59. 02 cx-cmdln59 pic x(127) value spaces. 02 cx-cmdlnnul pic x(01) value x"00". # 15 "jkaster0.cbl" linkage section. # 1 "/fmp/550/lnk/mf-area.lnk" 01 mf-area. 02 mf-terminale pic 9(02). 02 mf-scrname. 03 mf-dspacc pic x(03). 03 mf-modulo pic x(09). 03 mf-modind pic 9(02). 02 mf-utente pic x(10). 02 mf-fmd pic x(25). 02 mf-fmddrive pic x(01). 02 mf-fmp pic x(25). 02 mf-fmpdrive pic x(01). 02 mf-dbname pic x(08). 02 mf-azix. 03 mf-azibase pic x(03). 03 mf-azisecolo pic 9(02). 03 mf-azianno pic 9(02). 03 mf-aziresto pic x(03). 02 mf-azienda redefines mf-azix pic x(10). 02 mf-omega pic 9(02). 02 mf-system pic 9(01). 02 mf-stampa pic x(22). 02 mf-netgroup pic x(08). 02 mf-netseg pic 9(03). 02 mf-usrmenu pic x(08). 02 mf-usrsys pic 9(01). 02 mf-usrlpt1 pic x(08). 02 mf-usrlp1i pic 9(01). 02 mf-usrlpt2 pic x(08). 02 mf-usrlp2i pic 9(01). 02 mf-usrlpt3 pic x(08). 02 mf-usrlp3i pic 9(01). 02 mf-system1 pic x(12). 02 mf-monosezio pic 9(01). 02 mf-sezionale pic 9(01). 02 mf-2000x. 03 mf-secolo pic 9(02). 03 mf-esercizio pic 9(02). 02 mf-anno2000 redefines mf-2000x pic 9(04). 02 mf-objsett pic x(05). 02 mf-objdir pic x(50). 02 mf-objname pic x(15). 02 mf-ojjpath pic x(80). 02 mf-ojjname pic x(15). 02 mf-tmpname pic x(15). 02 mf-d pic 9(01). 02 mf-5 pic 9(01). 02 mf-jsys pic x(01). 02 mf-xsys pic x(01). 02 mf-jnamx. 03 mf-jnamel occurs 15 pic x(01). 02 mf-jname redefines mf-jnamx pic x(15). 02 mf-mname pic x(15). 02 mf-tclpath pic x(80). 02 mf-tclb pic x(20). 02 mf-acrb pic x(10). 02 mf-acrbfile pic x(12). 02 dep-crsr pic 9(04). 02 lnk-erro pic x(79). 02 lnk-erri pic x(01). 02 lnk-err pic 9(01). 02 lnk-retpar pic x(02). 02 lnk-retchar pic 9(02). 02 lnk-attscr pic x(13). 02 lnk-oldscr pic x(13). 02 scr-tus. 03 scr-tus1 pic x(02). 03 scr-tus2 pic x(02). 02 scn-tus redefines scr-tus pic x(04). 02 lnk-tastib. 03 lnk-tstbel occurs 5 pic x(15). 02 lnk-wait pic 9(08). 02 lnk-eof pic x(01). 02 lnk-tclpar. 03 lnk-tclcaller pic x(15). 03 lnk-rettcl pic x(02). 03 lnk-tclend pic x(02). 03 lnk-tclintp pic x(09). # 17 "jkaster0.cbl" # 1 "/fmp/550/msk/MKASTER0.msw" 01 MKASTER0X01. 02 MKASTER0-01-0001 pic x(10). 02 MKASTER0-01-0002 pic x(10). 02 MKASTER0-01-0003 pic x(11). # 18 "jkaster0.cbl" screen section. # 1 "/fmp/550/msk/MKASTER0-01.ss" 01 MKASTER0-01. 02 LINE 1 COL 1 BACKGROUND-COLOR 7 FOREGROUND-COLOR 0 HIGHLIGHT VALUE " Utente: ". 02 COL 22 BACKGROUND-COLOR 7 FOREGROUND-COLOR 0 HIGHLIGHT VALUE " Azienda: ". 02 COL 50 BACKGROUND-COLOR 7 FOREGROUND-COLOR 0 HIGHLIGHT VALUE " Modulo: ". 02 COL 78 BACKGROUND-COLOR 7 FOREGROUND-COLOR 0 HIGHLIGHT VALUE " ". 02 LINE 1 COL 12 BACKGROUND-COLOR 7 FOREGROUND-COLOR 0 HIGHLIGHT PIC X(10) FROM mkaster0-01-0001. 02 LINE 1 COL 40 BACKGROUND-COLOR 7 FOREGROUND-COLOR 0 HIGHLIGHT PIC X(10) FROM mkaster0-01-0002. 02 LINE 1 COL 67 BACKGROUND-COLOR 7 FOREGROUND-COLOR 0 HIGHLIGHT PIC X(11) FROM mkaster0-01-0003. # 20 "jkaster0.cbl" procedure division using mf-area mkaster0x01. inizio section. in1. if mf-dspacc = "dsp" if mf-modind = 01 perform dspmkaster001 go to fine end-if end-if. fine. if mf-system > 1 perform f-key-on end-if move crt-tus to scr-tus exit program. dspmkaster001 section. dspmkaster00101. display mkaster0-01 end-display. dspmkaster001ex. exit. # 1 "/fmp/550/cbl/f-key-on.sbr" f-key-on section. fkon1. move zero to key-switch-on call f-key-routine using key-switch-on f-key-table end-call. fkon1-ex. exit. # 45 "jkaster0.cbl" # 1 "/fmp/550/cbl/poscrsr.cbl" poscrsr section. poscrsr1. move zero to crsr if dep-crsr not = zero move dep-crsr to crsr move zero to dep-crsr end-if. poscrsr1-ex. exit. # 46 "jkaster0.cbl" end program jkaster0. [/code] [code] # Generated by OpenCOBOL 1.1.0 (Build date - Mar 10 2011 18:33:24) # Environment : # TMPDIR : /tmp # COBCPY : is not set # Compile command : cobc -m -std=mf -g -debug -t /fmg/cmpl45/jrrore.lst -Wall jrrore.cbl # 1 "jrrore.cbl" identification division. program-id. jrrore. environment division. configuration section. special-names. decimal-point is comma cursor is crsr console is crt crt status is crt-tus. input-output section. file-control. data division. file section. working-storage section. # 1 "/fmp/550/cbl/workscr.cbl" 01 function-key. 02 f-key-routine pic x(01) value x"B0". 02 key-switch-on pic 9(02) comp value 0. 02 f-key-table. 03 terminating-char pic 9(02) comp. 03 length-fk1 pic 9(02) comp value 2. 03 fk1 pic x(02) value x"003B". 03 length-fk2 pic 9(02) comp value 2. 03 fk2 pic x(02) value x"003C". 03 length-fk3 pic 9(02) comp value 2. 03 fk3 pic x(02) value x"003D". 03 length-fesc pic 9(02) comp value 1. 03 fesc pic x(01) value x"1B". 03 length-fk5 pic 9(02) comp value 2. 03 fk5 pic x(02) value x"003F". 03 length-fk6 pic 9(02) comp value 2. 03 fk6 pic x(02) value x"0040". 03 length-fk7 pic 9(02) comp value 2. 03 fk7 pic x(02) value x"0041". 03 length-fk4 pic 9(02) comp value 2. 03 fk4 pic x(02) value x"003E". 03 length-fk9 pic 9(02) comp value 2. 03 fk9 pic x(02) value x"0043". 03 length-fk10 pic 9(02) comp value 2. 03 fk10 pic x(02) value x"0044". 03 fkend pic 9(02) comp value 0. 01 crsrx. 02 crrig pic 9(02) value zero. 02 crcol pic 9(02) value zero. 01 crsr redefines crsrx pic 9(04). 01 crt-tus. 02 crt-tus1 pic x(02). 02 crt-tus2 pic x(02). 01 crn-tus redefines crt-tus pic x(04). 01 mf-objpath pic x(80) value spaces. 01 w-butind pic 9(01). 01 command-lin. 02 command-lin-lenght pic x(01) comp-x value zero. 01 cx-param35. 02 cx-cfnl pic 9(02) comp value zero. 02 cx-cfname pic x(120) value spaces. 01 cx-function pic x(01) comp-x value zeroes. 01 cx-result pic x(01) comp-x value zero. 01 cx-param59. 02 cx-cmdln59 pic x(127) value spaces. 02 cx-cmdlnnul pic x(01) value x"00". # 16 "jrrore.cbl" linkage section. # 1 "/fmp/550/lnk/mf-area.lnk" 01 mf-area. 02 mf-terminale pic 9(02). 02 mf-scrname. 03 mf-dspacc pic x(03). 03 mf-modulo pic x(09). 03 mf-modind pic 9(02). 02 mf-utente pic x(10). 02 mf-fmd pic x(25). 02 mf-fmddrive pic x(01). 02 mf-fmp pic x(25). 02 mf-fmpdrive pic x(01). 02 mf-dbname pic x(08). 02 mf-azix. 03 mf-azibase pic x(03). 03 mf-azisecolo pic 9(02). 03 mf-azianno pic 9(02). 03 mf-aziresto pic x(03). 02 mf-azienda redefines mf-azix pic x(10). 02 mf-omega pic 9(02). 02 mf-system pic 9(01). 02 mf-stampa pic x(22). 02 mf-netgroup pic x(08). 02 mf-netseg pic 9(03). 02 mf-usrmenu pic x(08). 02 mf-usrsys pic 9(01). 02 mf-usrlpt1 pic x(08). 02 mf-usrlp1i pic 9(01). 02 mf-usrlpt2 pic x(08). 02 mf-usrlp2i pic 9(01). 02 mf-usrlpt3 pic x(08). 02 mf-usrlp3i pic 9(01). 02 mf-system1 pic x(12). 02 mf-monosezio pic 9(01). 02 mf-sezionale pic 9(01). 02 mf-2000x. 03 mf-secolo pic 9(02). 03 mf-esercizio pic 9(02). 02 mf-anno2000 redefines mf-2000x pic 9(04). 02 mf-objsett pic x(05). 02 mf-objdir pic x(50). 02 mf-objname pic x(15). 02 mf-ojjpath pic x(80). 02 mf-ojjname pic x(15). 02 mf-tmpname pic x(15). 02 mf-d pic 9(01). 02 mf-5 pic 9(01). 02 mf-jsys pic x(01). 02 mf-xsys pic x(01). 02 mf-jnamx. 03 mf-jnamel occurs 15 pic x(01). 02 mf-jname redefines mf-jnamx pic x(15). 02 mf-mname pic x(15). 02 mf-tclpath pic x(80). 02 mf-tclb pic x(20). 02 mf-acrb pic x(10). 02 mf-acrbfile pic x(12). 02 dep-crsr pic 9(04). 02 lnk-erro pic x(79). 02 lnk-erri pic x(01). 02 lnk-err pic 9(01). 02 lnk-retpar pic x(02). 02 lnk-retchar pic 9(02). 02 lnk-attscr pic x(13). 02 lnk-oldscr pic x(13). 02 scr-tus. 03 scr-tus1 pic x(02). 03 scr-tus2 pic x(02). 02 scn-tus redefines scr-tus pic x(04). 02 lnk-tastib. 03 lnk-tstbel occurs 5 pic x(15). 02 lnk-wait pic 9(08). 02 lnk-eof pic x(01). 02 lnk-tclpar. 03 lnk-tclcaller pic x(15). 03 lnk-rettcl pic x(02). 03 lnk-tclend pic x(02). 03 lnk-tclintp pic x(09). # 18 "jrrore.cbl" # 1 "/fmp/550/msk/ERRORE.msw" 01 ERROREX01. 02 ERRORE-01-0001 PIC X(77). 02 ERRORE-01-0002 PIC X(01). # 19 "jrrore.cbl" screen section. # 1 "/fmp/550/msk/ERRORE-01.ss" 01 ERRORE-01. 02 LINE 21 COL 1 FOREGROUND-COLOR 0 HIGHLIGHT VALUE "ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ?". 02 LINE 22 COL 1 FOREGROUND-COLOR 0 HIGHLIGHT VALUE "?". 02 COL 80 FOREGROUND-COLOR 0 HIGHLIGHT VALUE "?". 02 LINE 23 COL 1 FOREGROUND-COLOR 0 HIGHLIGHT VALUE "?ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ?". 02 LINE 22 COL 2 HIGHLIGHT PIC X(77) FROM errore-01-0001. 02 LINE 22 COL 79 HIGHLIGHT PIC X USING errore-01-0002. # 21 "jrrore.cbl" # 1 "/fmp/550/msk/ERRORE-02.ss" 01 ERRORE-02. 02 LINE 21 COL 1 FOREGROUND-COLOR 0 HIGHLIGHT VALUE "ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ?". 02 LINE 22 COL 1 FOREGROUND-COLOR 0 HIGHLIGHT VALUE "?". 02 COL 80 FOREGROUND-COLOR 0 HIGHLIGHT VALUE "?". 02 LINE 23 COL 1 FOREGROUND-COLOR 0 HIGHLIGHT VALUE "?ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ?". 02 LINE 22 COL 2 HIGHLIGHT PIC X(77) FROM errore-01-0001. 02 LINE 22 COL 79 HIGHLIGHT PIC X USING errore-01-0002. # 22 "jrrore.cbl" procedure division using mf-area errorex01. inizio section. in1. if lnk-erro not = spaces move lnk-erro to errore-01-0001 end-if if mf-dspacc = "dsp" if mf-modind = 01 perform dsperrore01 go to fine end-if if mf-modind = 02 perform dsperrore02 go to fine end-if end-if. if mf-dspacc = "acc" if mf-modind = 01 perform dsperrore01 perform accerrore01 end-if if mf-modind = 02 perform dsperrore02 perform accerrore02 end-if end-if. fine. move terminating-char to lnk-retchar move crt-tus to scr-tus exit program. dsperrore01 section. dsperrore0101. display errore-01 end-display move lnk-attscr to lnk-oldscr. dsperrore01ex. exit. dsperrore02 section. dsperrore0201. display errore-02 end-display move lnk-attscr to lnk-oldscr. dsperrore02ex. exit. accerrore01 section. accerrore0101. if mf-system > 1 perform f-key-on end-if accept errore-01 end-accept. accerrore01ex. exit. accerrore02 section. accerrore0201. if mf-system > 1 perform f-key-on end-if accept errore-02 end-accept. accerrore02ex. exit. # 1 "/fmp/550/cbl/f-key-on.sbr" f-key-on section. fkon1. move zero to key-switch-on call f-key-routine using key-switch-on f-key-table end-call. fkon1-ex. exit. # 91 "jrrore.cbl" end program jrrore. [/code] Can anyone tell me what i'm doing wrong. Marcello ---------------------------------------------------------------- Not really. You can use BBCODE code tags here, for readability. Open square bracket CODE close bracket. It's tricky as I can't show you the closing tag as it trips the closing of the example. [code][code]code listing here, but the slash code ending tag won't have a space in it[ /code][/code] On to the problem: I couldn't find your compiler commands. Try something like [code] cobc -x 450to550.cbl jrrore.cbl jeserr.cbl jkaster.cbl [/code] all as a single command. That will build you an "all in" program, and [b]450to550[/b] will be the binary and the one with the "main" function defined so the operating system knows where to start. Cheers, Brian ---------------------------------------------------------------- Thanks Brian, I'm afraid I can't follow your suggestion. The whole mass is made up by over 6000 sources, placed in different directories to meet my customers' needings. Compiling and grouping is done by sets of shell. Shell sets are settled for, wine producers, chemical analisys laboratories, car accessory suppliers, etc., with commun ones for, i.e., accountancy and sales. At presente I compile single modules in Sco Unix whith MicroFocus opencobol. When necessary, I modify one or some sources, do compiling and positioning by shells and send to my customer ONLY the modifies objects. When necessary, single module handles screen. If unix, screen session, if windows, tcl session. It would be hard to: cobc -x followed by haw-many-names end which-ones? I thought LD_LIBRARY_PATH and/or COB_LIBRARY_PATH could help. How? Marcello ---------------------------------------------------------------- COB_LIBRARY_PATH is the correct thing (OpenCOBOL does the right thing on all systems): On UNIX systems do [code]bindir=/opt/mysoftware/binaries export COB_LIBRARY_PATH=$bindir/specialfolder1:/$bindir/specialfolder2:$bindir/accounting:$bindir/sales[/code] on win system do [code]set bindir=%ProgramFiles%\mysoftware\binaries set COB_LIBRARY_PATH=%bindir%\specialfolder1:%bindir%\specialfolder2:%bindir%\accounting:%bindir%\sales[/code] The main problem is in your code as you string '.INT' into your calls. Just remove this and your code will work with MF (as INT is the standard extension) and in OpenCOBOL environments on both WIN (.dll) and UNIX (.so) - or hack libcob/call.c: try to call the module without the given extension. human BTW: Please edit your first post using code tags as mentioned before. ---------------------------------------------------------------- Thanks human, I didn't completely unterstand what Brian said about BBCODE. I'll find out how to edit my fist post and work on it. Thanks again Marcello ---------------------------------------------------------------- Just as another try at explaining BBCODE. It's easy once you see it, but does have a wall to get over. To get [code] IDENTIFICATION DIVISION. [/code] use [code][code] IDENTIFICATION DIVISION. [/ code][/code] but leave the space out of the closing, slash CODE Without the BBCODE it looks like IDENTIFICATION DIVISION. (And I did try and indent the above when I posted) Ahh, done already, while I was posting. :) But on to the problem; You'll want to read up on COB_LIBRARY_PATH, COB_PRE_LOAD, LD_LIBRARY_PATH (and now, a new thing to me, but [i]super cool[/i] when building the compiler, is [b]LD_RUN_PATH[/b]). Intelligent use of LD_RUN_PATH when you [b]./configure[/b] and [b]make[/b], [b]make install[/b] will let you control what search path the [b]COMPILED[/b] programs use (without setting LD_LIBRARY_PATH in the clients shell process) at runtime. See http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1245&forum=1#forumpost6238 for a blurb on how LD_RUN_PATH helps when building cobc for use on hosted sites. Cheers, Brian ---------------------------------------------------------------- Great. thanks Brian. I've not been active in oc for o long while. When Keisuke said he became "short of time" I thought oc whould not go on any more. Roger (and others) injected new energies. I do belive that, at present, considering also forum's incoming messages, oc is nearly ready to be a totally exhaustive compiler. Unfortunately, one important thing is still missing: split keys. I posted, some time ago, to highlight the matter and offered my help. Someone suggested to insert split-key in fd. But this cannot be, as far as I'm concerned, the solution. consider following select [code] select partia assign to "partia" organization is indexed file status is pra-tus access is dynamic lock mode is manual record key is pra-key alternate record key is pra-descr1 with duplicates alternate record key is pra-barcode with duplicates alternate record key is pra-catdes = pra-catalogo pra-descr1 with duplicates alternate record key is pra-classdes = pra-classe pra-descr1 with duplicates alternate record key is pra-catclass = pra-catalogo pra-classe pra-descr1 with duplicates alternate record key is pra-gmcmkey = pra-gruppo pra-classe pra-codarti pra-varian. [/code] and following fd [code] fd partia. 01 pra-rec. 02 pra-key pic x(30). 02 pra-key1 redefines pra-key. 03 pra-codarti pic x(09). 03 pra-varian pic x(21). 02 pra-key2 redefines pra-key. 03 pra-catalogo pic x(05). 03 pra-codint pic x(25). 02 pra-descrx. 03 pra-descr1 pic x(36). 03 pra-descr2 pic x(36). 02 pra-descri redefines pra-descrx pic x(72). 02 pra-unitrat. 03 pra-unimis pic x(02). 03 pra-unisec pic x(02). 03 pra-coetrasf pic 9(03)v9(03). 03 pra-uniconf pic 9(04). 03 pra-desconf pic x(30). 02 pra-barcode pic x(20). 02 pra-plux. 03 pra-numplu pic x(05). 03 pra-desplu pic x(30). 02 pra-mps pic x(01). 02 pra-grmerce. 03 pra-gruppo pic x(05). 03 pra-classe pic x(05). 02 pra-przuffi pic 9(07)v9(04). 02 pra-consorzio pic 9(05)v9(04). 02 pra-vend. 03 pra-vndtabe occurs 3. 04 pra-przvprezzo pic 9(07)v9(04). 04 pra-przvarrot pic 9(01). 04 pra-przvivasn pic x(01). 04 pra-przvsctabe pic 9(02). 04 pra-przvsccalc pic 9(03)v9(02). 04 pra-przvscdaapp pic 9(01). 04 pra-przvrictabe pic 9(02). 04 pra-przvriccalc pic s9(03)v9(02). 04 pra-przvrcdaapp pic 9(01). 04 pra-przvprovvig pic 9(02). 04 pra-przvdatini pic 9(08). 04 pra-przvdatfin pic 9(08). 04 pra-przvsctid occurs 3 pic 9(03)v9(02). 03 pra-przvf occurs 3 pic 9(01). 03 pra-offvtabe occurs 3. 04 pra-offvprezzo pic 9(07)v9(04). 04 pra-offvarrot pic 9(01). 04 pra-offvivasn pic x(01). 04 pra-offvsctabe pic 9(02). 04 pra-offvsccalc pic 9(03)v9(02). 04 pra-offvscdaapp pic 9(01). 04 pra-offvrictabe pic 9(02). 04 pra-offvriccalc pic s9(03)v9(02). 04 pra-offvrcdaapp pic 9(01). 04 pra-offvqtamin pic 9(02). 04 pra-offvdatini pic 9(08). 04 pra-offvdatfin pic 9(08). 03 pra-offvf occurs 3 pic 9(01). 02 pra-acq. 03 pra-forpri pic 9(06). 03 pra-cdartforpri pic x(30). 03 pra-forsec pic 9(06). 03 pra-cdartforsec pic x(30). 03 pra-acqtabe. 04 pra-przaprezzo pic 9(07)v9(04). 04 pra-przaarrot pic 9(01). 04 pra-przaivasn pic x(01). 04 pra-przasctabe pic 9(02). 04 pra-przasccalc pic 9(03)v9(02). 04 pra-przascdaapp pic 9(01). 04 pra-przadatini pic 9(08). 04 pra-przadatfin pic 9(08). 03 pra-przaf pic 9(01). 03 pra-offatabe. 04 pra-offaprezzo pic 9(07)v9(04). 04 pra-offaarrot pic 9(01). 04 pra-offaivasn pic x(01). 04 pra-offasctabe pic 9(02). 04 pra-offasccalc pic 9(03)v9(02). 04 pra-offascdaapp pic 9(01). 04 pra-offadatini pic 9(08). 04 pra-offadatfin pic 9(08). 03 pra-offaf pic 9(01). 02 pra-misure. 03 pra-dime. 04 pra-alt pic 9(06)v9(02). 04 pra-lar pic 9(06)v9(02). 04 pra-prf pic 9(06)v9(02). 03 pra-peso. 04 pra-pnetto pic 9(07)v9(03). 04 pra-plordo pic 9(07)v9(03). 02 pra-imb. 03 pra-iprovenienza pic x(18). 03 pra-inatura pic x(15). 03 pra-iqualita pic x(15). 03 pra-icolore pic x(06). 03 pra-iannata pic 9(04). 02 pra-dst. 03 pra-dspirito pic x(01). 03 pra-dnatura pic x(25). 03 pra-dcatacce pic x(03). 03 pra-dcontrass pic x(02). * in cblmric contiene sottogruppo numero protocollo 03 pra-utfcodprod pic x(18). 03 pra-utfcapitolo pic x(05). 02 pra-grado pic 9(03)v9(02). 02 pra-mgspctabe. 03 pra-magspec occurs 3 pic x(02). 02 pra-contab. 03 pra-cntcst pic 9(07). 03 pra-cntric pic 9(07). 03 pra-codiva pic 9(02). 03 pra-contriva pic x(03). 02 pra-surrogatabe. 03 pra-surrogato occurs 3 pic x(30). * pra-surrogato (01) contiene CPA utf 02 pra-datingre pic 9(08). 02 pra-datcess pic 9(08). 02 pra-statotabe. 04 pra-stato pic x(01). 04 pra-stdatini pic 9(08). 04 pra-stdatfin pic 9(08). 02 pra-sinomag pic x(01). [/code] When you handle hundreds of thosands of products (car components) you cannot avoid split-keys. I'm still willing to help on it. In the meanwhile, I'm working on inspect ... replacing directely in sources, to replace cobol sentences with equivalent sql ones (450to550 source is first testing step) Cheers Marcello ---------------------------------------------------------------- @Brian: Don't get me wrong, but COB_LIBRARY_PATH is surely the best way to solve the original problem (together with either a remove of '.INT' in the source or a quick hack of libcob/call.c). @marcellom: I guess your original problem is solved? Can you please change the topic title (via editing the first post) to something like "Cannot found sub routines at run-time [SOLVED]"? To split-keys: If you like to discuss that, please open a new thread on this. Are you able to help with C/parser changes for split-key support? human ---------------------------------------------------------------- Hi human. I have not yet applied new suggestions. I'll do it shortely. Afterwards, I'll do what you say in last message. Split keys: My first language is (obviously) cobol. I do low-level handling with c and screen handling with tcl. If someone directs me, I'll surely work on it. Marcello ---------------------------------------------------------------- Hi human, everything done. Any suggestion about going on with split-keys. Thanks, Marcello ---------------------------------------------------------------- human; Agree that COB_LIBRARY_PATH is the sanest solution. But I'm still keen on this LD_RUN_PATH setting now. The freedom provided by OpenCOBOL means that custom builds can be 'shop specific', and a little up front configuration, all compiled apps in the shop already "know" where to find shared libraries. Cheers, Brian ---------------------------------------------------------------- I thought the problem was solved, but it is not so. If a copy of the called subroutine (compiled -m) is in the current directory, even if not the same one of the calling program, all is ok. If not, the module is not found. profile is as followes [code] umask 0000 PATH=$HOME:$HOME/bin:/bin:/usr/bin; export PATH MAIL=/usr/spool/mail/`logname` # mailbox location export PATH MAIL /usr/bin/prwarn # issue a warning if password due to expire umask 000 # set file creation mask PATH=$PATH:/u/ute450/bck:/u/ute450/bcp:/u/ute450/bin:/u/ute450/bin87:/u/ute450/biny:/u/ute450/bmk:/u/ute450/bmkjk:/u/ute450/bmkyk:/u/ute450/bmsw:/u/ute450/bsys:/fms/550/stdok/int:/fms/550/stdok/int/s; export PATH MORE=-c; export MORE LD_LIBRARY_PATH=/pacchetti/mytpcob:/fms/550/stdok/int:/fms/550/stdok/int/s; export LD_LIBRARY_PATH LD_RUN_PATH=/fms/550/stdok/int:/fms/550/stdok/int/s; export LD_RUN_PATH LD_LOAD__PATH=/fms/550/stdok/int:/fms/550/stdok/int/s; export LD_LOAD_PATH COB_LIBRARY_PATH=/fms/550/stdok/int:/fms/550/stdok/int/s; export COB_LIBRARY_PATH [/code] Any suggestion? Thanks Marcello ---------------------------------------------------------------- Remove your OC binaries from every entry except from COB_LIBRARY path, and start your COBOL progs. Then tell us the exact error message from libcob. human ---------------------------------------------------------------- Subject: what will happen when the accept statement will be translated in c hi, I wonder what will happen when you program accept in cobol, so ask for userinput, and then you compile it into c , for windows and then run the program? thanks miguel ---------------------------------------------------------------- Well, I'm assuming you are asking about the functionality of the accept statement. Basically, as I understand it, the Open Cobol source is translated in C, where it is then compiled into an executable. The executable code, does not initiate a GUI interface but rather run as a console application which runs in a command prompt. As for the accept statement, by default the input is read from the console. I'm assuming the accept functions similar the ‘scanf’ function in C. I have included a sample program, which reads a number from the user and display a result to the user. [code] 000100 IDENTIFICATION DIVISION. 000200 PROGRAM-ID. TSTPGMA. 000300 AUTHOR. MARCUS J. WILLIAMS. 001400 001500 ENVIRONMENT DIVISION. 001600 CONFIGURATION SECTION. 001700 SOURCE-COMPUTER. WINDOWS-LAPTOP. 001800 OBJECT-COMPUTER. WINDOWS-LAPTOP. 002600 DATA DIVISION. 004900 WORKING-STORAGE SECTION. 01 WS-ACCEPT-LINE. 02 WS-LINE-IN PIC 99. 01 WS-DISPLAY-LINE. 02 FILLER PIC X(18) VALUE 'And the answer is '. 02 WS-DISP-NO PIC ZZZ,ZZZ,ZZ9. 77 WS-NUM PIC S9(9). PROCEDURE DIVISION. BEGIN. DISPLAY 'Hello, this just a simple display program.' DISPLAY 'Please, enter a (2 digit) number to multiply by 2 ?' ACCEPT WS-ACCEPT-LINE IF WS-LINE-IN IS NUMERIC COMPUTE WS-NUM = +2 * WS-LINE-IN MOVE WS-NUM TO WS-DISP-NO DISPLAY WS-DISPLAY-LINE ELSE DISPLAY 'The number entered was not numeric' END-IF DISPLAY 'See you later' GOBACK. [/code] Hello, this just a simple display program. Please, enter a (2 digit) number to multiply by 2 ? X8 The number entered was not numeric See you later Hello, this just a simple display program. Please, enter a (2 digit) number to multiply by 2 ? 34 And the answer is 68 See you later ---------------------------------------------------------------- Compiling COBOL ACCEPT to C: generation of cob_accept_field or cob_accept_screen (you can see this when using cobc switches -C or --save-temps). Running the program: Depending on the kind of accept-function that was generated: either simply output to stdout or call to curses library (see libcob/screenio.c for details) [If you want a GUI this would be the file to tweak]. human ---------------------------------------------------------------- Subject: FAQ, alpha release of new PDF format As I like to jump in early, I've posted a (likely bug-ridden) PDF of the OpenCOBOL FAQ at http://opencobol.add1tocobol.com/alphaocfaq.pdf Umm, I have a few hundred overfull box warnings, quite a few captions, indexes and references to correct. But this new format should be much more printer friendly. [b]This is an ALPHA release[/b] 3.6Mb Cheers, Brian ---------------------------------------------------------------- Subject: Split-keys in oc. Hallo, I've not been active in oc for o long while. When Keisuke said he became "short of time" I thought oc whould not go on any more. Roger (and others) injected new energies. I do belive that, at present, considering also forum's incoming messages, oc is nearly ready to be a totally exhaustive compiler. Unfortunately, one important thing is still missing: split keys. I posted, some time ago, to highlight the matter and offered my help. Someone suggested to insert split-key in fd. But this cannot be, as far as I'm concerned, the solution. consider following select [code] select partia assign to "partia" organization is indexed file status is pra-tus access is dynamic lock mode is manual record key is pra-key alternate record key is pra-descr1 with duplicates alternate record key is pra-barcode with duplicates alternate record key is pra-catdes = pra-catalogo pra-descr1 with duplicates alternate record key is pra-classdes = pra-classe pra-descr1 with duplicates alternate record key is pra-catclass = pra-catalogo pra-classe pra-descr1 with duplicates alternate record key is pra-gmcmkey = pra-gruppo pra-classe pra-codarti pra-varian. [/code] and following fd [code] fd partia. 01 pra-rec. 02 pra-key pic x(30). 02 pra-key1 redefines pra-key. 03 pra-codarti pic x(09). 03 pra-varian pic x(21). 02 pra-key2 redefines pra-key. 03 pra-catalogo pic x(05). 03 pra-codint pic x(25). 02 pra-descrx. 03 pra-descr1 pic x(36). 03 pra-descr2 pic x(36). 02 pra-descri redefines pra-descrx pic x(72). 02 pra-unitrat. 03 pra-unimis pic x(02). 03 pra-unisec pic x(02). 03 pra-coetrasf pic 9(03)v9(03). 03 pra-uniconf pic 9(04). 03 pra-desconf pic x(30). 02 pra-barcode pic x(20). 02 pra-plux. 03 pra-numplu pic x(05). 03 pra-desplu pic x(30). 02 pra-mps pic x(01). 02 pra-grmerce. 03 pra-gruppo pic x(05). 03 pra-classe pic x(05). 02 pra-przuffi pic 9(07)v9(04). 02 pra-consorzio pic 9(05)v9(04). 02 pra-vend. 03 pra-vndtabe occurs 3. 04 pra-przvprezzo pic 9(07)v9(04). 04 pra-przvarrot pic 9(01). 04 pra-przvivasn pic x(01). 04 pra-przvsctabe pic 9(02). 04 pra-przvsccalc pic 9(03)v9(02). 04 pra-przvscdaapp pic 9(01). 04 pra-przvrictabe pic 9(02). 04 pra-przvriccalc pic s9(03)v9(02). 04 pra-przvrcdaapp pic 9(01). 04 pra-przvprovvig pic 9(02). 04 pra-przvdatini pic 9(08). 04 pra-przvdatfin pic 9(08). 04 pra-przvsctid occurs 3 pic 9(03)v9(02). 03 pra-przvf occurs 3 pic 9(01). 03 pra-offvtabe occurs 3. 04 pra-offvprezzo pic 9(07)v9(04). 04 pra-offvarrot pic 9(01). 04 pra-offvivasn pic x(01). 04 pra-offvsctabe pic 9(02). 04 pra-offvsccalc pic 9(03)v9(02). 04 pra-offvscdaapp pic 9(01). 04 pra-offvrictabe pic 9(02). 04 pra-offvriccalc pic s9(03)v9(02). 04 pra-offvrcdaapp pic 9(01). 04 pra-offvqtamin pic 9(02). 04 pra-offvdatini pic 9(08). 04 pra-offvdatfin pic 9(08). 03 pra-offvf occurs 3 pic 9(01). 02 pra-acq. 03 pra-forpri pic 9(06). 03 pra-cdartforpri pic x(30). 03 pra-forsec pic 9(06). 03 pra-cdartforsec pic x(30). 03 pra-acqtabe. 04 pra-przaprezzo pic 9(07)v9(04). 04 pra-przaarrot pic 9(01). 04 pra-przaivasn pic x(01). 04 pra-przasctabe pic 9(02). 04 pra-przasccalc pic 9(03)v9(02). 04 pra-przascdaapp pic 9(01). 04 pra-przadatini pic 9(08). 04 pra-przadatfin pic 9(08). 03 pra-przaf pic 9(01). 03 pra-offatabe. 04 pra-offaprezzo pic 9(07)v9(04). 04 pra-offaarrot pic 9(01). 04 pra-offaivasn pic x(01). 04 pra-offasctabe pic 9(02). 04 pra-offasccalc pic 9(03)v9(02). 04 pra-offascdaapp pic 9(01). 04 pra-offadatini pic 9(08). 04 pra-offadatfin pic 9(08). 03 pra-offaf pic 9(01). 02 pra-misure. 03 pra-dime. 04 pra-alt pic 9(06)v9(02). 04 pra-lar pic 9(06)v9(02). 04 pra-prf pic 9(06)v9(02). 03 pra-peso. 04 pra-pnetto pic 9(07)v9(03). 04 pra-plordo pic 9(07)v9(03). 02 pra-imb. 03 pra-iprovenienza pic x(18). 03 pra-inatura pic x(15). 03 pra-iqualita pic x(15). 03 pra-icolore pic x(06). 03 pra-iannata pic 9(04). 02 pra-dst. 03 pra-dspirito pic x(01). 03 pra-dnatura pic x(25). 03 pra-dcatacce pic x(03). 03 pra-dcontrass pic x(02). * in cblmric contiene sottogruppo numero protocollo 03 pra-utfcodprod pic x(18). 03 pra-utfcapitolo pic x(05). 02 pra-grado pic 9(03)v9(02). 02 pra-mgspctabe. 03 pra-magspec occurs 3 pic x(02). 02 pra-contab. 03 pra-cntcst pic 9(07). 03 pra-cntric pic 9(07). 03 pra-codiva pic 9(02). 03 pra-contriva pic x(03). 02 pra-surrogatabe. 03 pra-surrogato occurs 3 pic x(30). * pra-surrogato (01) contiene CPA utf 02 pra-datingre pic 9(08). 02 pra-datcess pic 9(08). 02 pra-statotabe. 04 pra-stato pic x(01). 04 pra-stdatini pic 9(08). 04 pra-stdatfin pic 9(08). 02 pra-sinomag pic x(01). [/code] A warehose handling hundreds of thousands of products has to work with split keys. If someone directs me, I'm willing to work on it. Marcello ---------------------------------------------------------------- I must agree that split keys are used extensively in accounting and business systems as they save on having to sort files for different reports and enquiries (English Spelling. I use them extensively in the accounting and point of sale system that I am releasing as open source and have been thinking hard about how I would overcome this problem. It would be a routine to combine these fields in the order specified before adding this generated key to the index. ---------------------------------------------------------------- Oh! this is great, I will inform my brother about this one. Thanks. ---------------------------------------------------------------- Hi Brian, I'm ready to start split-keys parsing. To save time, can you tell me wich is the heather I should analyze first. Thanks Marcello ---------------------------------------------------------------- If you want support for split keys, please be aware that there are currently TWO different syntax variations "in common usage". Both Micro Focus and the ISO 2002 COBOL Standard support these. If you want to add syntax support for these in OC, you should (probably) provide support for both - and have them dependent on the std= directive in effect. the syntax and semantics are "well defined" in both versions, so I would make certain taht you check those out before attempting to add support for this. ---------------------------------------------------------------- Subject: Copybooks What are the chances of allowing the COPY statement to copy a file with a name such as DEBTOR.FD, DEBTOR.SL etc. The reason that I am asking is that my Accounting/Job Costing/Business Management/POS/Business Management system, written for MF, that I am releasing as Open Source and trying to convert to Open Cobol has copybooks with file extensions to distinguish which copybook is being copied. Other extensions that I use are .CRT, .PRO, .DBT, .STK, .GL and so on. :cry: ---------------------------------------------------------------- Subject: Copybooks What are the chances of allowing the COPY statement to copy a file with a name such as DEBTOR.FD, DEBTOR.SL etc. The reason that I am asking is that my Accounting/Job Costing/Business Management/POS/Business Management system, written for MF, that I am releasing as Open Source and trying to convert to Open Cobol has copybooks with file extensions to distinguish which copybook is being copied. Other extensions that I use are .CRT, .PRO, .DBT, .STK, .GL and so on. :cry: ---------------------------------------------------------------- As far as I know this should be supported (no matter which extension is used). As long as you do [code] COPY "SOMEFILE.EXTENSION".[/code] If you have a problem with that: post some simple code where the problem occurs, and as always the info from your cobc --version. human ---------------------------------------------------------------- With MF "'s are not necessary, so I will make changes to a couple of programs and test. Thanks ---------------------------------------------------------------- In OC the "'s are necessary as soon as the file name includes a dot. I'm not sure if either OC or MF is correct (the changes to ppparse.y to have the MF behaviour seem to be not too big). I guess this doesn't work with MF but it works with OC: [code]copy screenio.somesection section.[/code] human ---------------------------------------------------------------- Micro Focus has a directive (of course<G>) to specify which extensions to allow and in what order to look for them. See: [url=http://documentation.microfocus.com/help/topic/com.microfocus.eclipse.infocenter.visualcobol.r3eclipsewin/HRCDRHCDIR27.html]COPYEXT[/url] As far as "right" goes. The Standard is pretty relaxed on what an implmentor may or may not do with both copy member names and library names. Certainly (since the '02 Standard when literals were added), it is ok to have exetnsions in literals. When you don't have literals, the implementor pretty much determines both the format of what can be specified and how it relates to external files to be used. ---------------------------------------------------------------- There are around 1000 programs that need to be changed so I think that I will write a program to read any COBOL source file and check all COPY statements and if necessary insert the "'s. This can then be used by anyone else who might have the same problem! ---------------------------------------------------------------- There is an option in OC to set the extensions allowed and in what order to look for them. My question about "right" points to one thing: Should it be allowed to use file extensions (as they follow a DOT) inside a COBOL program without "'s? human ---------------------------------------------------------------- Subject: Confused with INSPECT REPLACING I was reworking my 99BOB on RosettaCode and thought I'd use INSPECT REPLACING instead of all of those DISPLAY WITH NO ADVANCING. Something isn't quite right but I can't quite figure it out. The code below keeps giving me $ of beer on the wall $ of beer Take $ down and pass it round $ of beer on the wall instead of replacing the "$" with the contents of stringified. Also, is it possible to say INSPECT OUTLINE REPLACING ALL "$" WITH FUNCTION TRIM( STRINGIFIED ) ? Kind regards, Bruce. procedure division. 100-main section. 100-setup. perform varying counter from 99 by -1 until no-bottles-left move spaces to outline perform 100-show-number move "$ of beer on the wall" to outline inspect outline replacing all "$" by stringified display outline move "$ of beer" to outline inspect outline replacing all "$" by stringified display outline move "Take $ down and pass it round" to outline if one-bottle-left inspect outline replacing all "$" by "it" else inspect outline replacing all "$" by "one" end-if display outline subtract 1 from counter giving counter perform 100-show-number move "$ of beer on the wall" to outline inspect outline replacing all "$" by stringified display outline add 1 to counter giving counter display space end-perform. display "No more bottles of beer on the wall" display "No more bottles of beer" display "Go to the store and buy some more" display "Ninety Nine bottles of beer on the wall" stop run. 100-show-number. if no-bottles-left move "No more" to stringified else if counter < 20 move function trim( adigits( counter ) ) to stringified else if counter < 100 move spaces to number-name string atens( tens ) delimited by space, space delimited by size, adigits( digits ) delimited by space into number-name move function trim( number-name) to stringified end-if end-if end-if. if one-bottle-left string function trim(stringified), " bottle" delimited by size into stringified else string function trim(stringified), " bottle" delimited by size into stringified end-if. 100-end. end-program. ---------------------------------------------------------------- Hallo Bruce, please post whole source. Marcello ---------------------------------------------------------------- Historically, COBOL would not allow different sizes in an INSPECT REPLACING, no expansion or contraction of the string. OpenCOBOL has two extensions to help with these kind of operations. But, the extensions aren't standard, See http://opencobol.add1tocobol.com/#function-substitute and http://opencobol.add1tocobol.com/#function-concatentate. For standard code, read up on the STRING and UNSTRING verbs. I'd go with FUNCTION SUBSTITUTE with reference modification MOVE, but you end up with [i]OpenCOBOL only[/i] COBOL. Cheers, Brian ---------------------------------------------------------------- Thanks, Brian. I went with the more generic approach as you may have seen. Might post the OpenCOBOL-only approach later (unless you beat me to it) Kind regards, Bruce. ---------------------------------------------------------------- Just to let you know: Upcoming 2.0 checks this [quote]99BOB.cbl: In section '100-main': 99BOB.cbl: In paragraph '100-setup': 99BOB.cbl: 23: Error: REPLACING operands differ in size 99BOB.cbl: 26: Error: REPLACING operands differ in size 99BOB.cbl: 30: Error: REPLACING operands differ in size 99BOB.cbl: 32: Error: REPLACING operands differ in size 99BOB.cbl: 38: Error: REPLACING operands differ in size[/quote] human ---------------------------------------------------------------- Subject: New version of 99BOB for RosettaCode Please edit your previous post and use code tags for the COBOL source. You may want to change two other things in this run: 1. add missing terminators [quote]99BOB.cbl: In section '100-main': 99BOB.cbl: In paragraph '100-setup': 99BOB.cbl: 69: Warning: STRING statement not terminated by END-STRING 99BOB.cbl: 70: Warning: DISPLAY statement not terminated by END-DISPLAY 99BOB.cbl: 72: Warning: STRING statement not terminated by END-STRING 99BOB.cbl: 73: Warning: DISPLAY statement not terminated by END-DISPLAY 99BOB.cbl: 77: Warning: STRING statement not terminated by END-STRING 99BOB.cbl: 79: Warning: STRING statement not terminated by END-STRING 99BOB.cbl: 81: Warning: STRING statement not terminated by END-STRING 99BOB.cbl: 82: Warning: DISPLAY statement not terminated by END-DISPLAY 99BOB.cbl: 84: Warning: SUBTRACT statement not terminated by END-SUBTRACT 99BOB.cbl: 86: Warning: STRING statement not terminated by END-STRING 99BOB.cbl: 87: Warning: DISPLAY statement not terminated by END-DISPLAY 99BOB.cbl: 88: Warning: ADD statement not terminated by END-ADD 99BOB.cbl: 89: Warning: DISPLAY statement not terminated by END-DISPLAY 99BOB.cbl: 91: Warning: DISPLAY statement not terminated by END-DISPLAY 99BOB.cbl: 92: Warning: DISPLAY statement not terminated by END-DISPLAY 99BOB.cbl: 93: Warning: DISPLAY statement not terminated by END-DISPLAY 99BOB.cbl: 94: Warning: DISPLAY statement not terminated by END-DISPLAY 99BOB.cbl: In paragraph '100-show-number': 99BOB.cbl: 102: Warning: STRING statement not terminated by END-STRING 99BOB.cbl: 106: Warning: STRING statement not terminated by END-STRING 99BOB.cbl: 108: Warning: DIVIDE statement not terminated by END-DIVIDE 99BOB.cbl: 117: Warning: STRING statement not terminated by END-STRING 99BOB.cbl: 119: Warning: STRING statement not terminated by END-STRING[/quote] 2. Change size of outline to pic x(50) as you don't have bigger outputs and pic x(80) may swap the command line output (this is the standard size for command window screens on Windows systems and a DISPLAY uses 1 char more than it's size). human ---------------------------------------------------------------- Thanks for all the help with INSPECT and STRING. I finally have a new version of 99BOB for RosettaCode. This one dispenses with the DISPLAY NO ADVANCING stuff that overwhelmed the first version. Kind regards, Bruce. P.S. I was supposed to be giving attribution to someone; who was it? identification division. program-id. ninety-nine. environment division. data division. working-storage section. 01 counter pic 99. 88 no-bottles-left value 0. 88 one-bottle-left value 1. 01 parts-of-counter redefines counter. 05 tens pic 9. 05 digits pic 9. 01 after-ten-words. 05 filler pic x(7) value spaces. 05 filler pic x(7) value "Twenty". 05 filler pic x(7) value "Thirty". 05 filler pic x(7) value "Forty". 05 filler pic x(7) value "Fifty". 05 filler pic x(7) value "Sixty". 05 filler pic x(7) value "Seventy". 05 filler pic x(7) value "Eighty". 05 filler pic x(7) value "Ninety". 05 filler pic x(7) value spaces. 01 after-ten-array redefines after-ten-words. 05 atens occurs 10 times pic x(7). 01 digit-words. 05 filler pic x(9) value "One". 05 filler pic x(9) value "Two". 05 filler pic x(9) value "Three". 05 filler pic x(9) value "Four". 05 filler pic x(9) value "Five". 05 filler pic x(9) value "Six". 05 filler pic x(9) value "Seven". 05 filler pic x(9) value "Eight". 05 filler pic x(9) value "Nine". 05 filler pic x(9) value "Ten". 05 filler pic x(9) value "Eleven". 05 filler pic x(9) value "Twelve". 05 filler pic x(9) value "Thirteen". 05 filler pic x(9) value "Fourteen". 05 filler pic x(9) value "Fifteen". 05 filler pic x(9) value "Sixteen". 05 filler pic x(9) value "Seventeen". 05 filler pic x(9) value "Eighteen". 05 filler pic x(9) value "Nineteen". 05 filler pic x(9) value spaces. 01 digit-array redefines digit-words. 05 adigits occurs 20 times pic x(9). 01 number-name pic x(15). 01 stringified pic x(30). 01 outline pic x(80). 01 other-numbers. 03 n pic 999. 03 r pic 999. procedure division. 100-main section. 100-setup. perform varying counter from 99 by -1 until no-bottles-left move spaces to outline perform 100-show-number string stringified delimited by "|", space, "of beer on the wall" into outline display outline move spaces to outline string stringified delimited by "|", space, "of beer" into outline display outline move spaces to outline move "Take" to outline if one-bottle-left string outline delimited by space, space, "it" delimited by size, space, "|" into outline else string outline delimited by space, space, "one" delimited by size, space, "|" into outline end-if string outline delimited by "|", "down and pass it round" delimited by size into outline display outline move spaces to outline subtract 1 from counter giving counter perform 100-show-number string stringified delimited by "|", space, "of beer on the wall" into outline display outline add 1 to counter giving counter display space end-perform. display "No more bottles of beer on the wall" display "No more bottles of beer" display "Go to the store and buy some more" display "Ninety-Nine bottles of beer on the wall" stop run. 100-show-number. if no-bottles-left move "No more|" to stringified else if counter < 20 string function trim( adigits( counter ) ), "|" into stringified else if counter < 100 move spaces to number-name string atens( tens ) delimited by space, space delimited by size, adigits( digits ) delimited by space into number-name move function trim( number-name) to stringified divide counter by 10 giving n remainder r if r not = zero inspect stringified replacing first space by "-" end-if inspect stringified replacing first space by "|" end-if end-if end-if. if one-bottle-left string stringified delimited by "|", space, "bottle|" delimited by size into stringified else string stringified delimited by "|", space, "bottles|" delimited by size into stringified end-if. 100-end. end-program. ---------------------------------------------------------------- Subject: run time veriables for Indexed sequenital file is it necessary to define DB_HOME run time veriable to work properly ? how we can use run time veriables? In which file we can define these veriabls like DB_HOME ? is it require to reconfigure COBOL after defineing these variables ? ---------------------------------------------------------------- Subject: Problem using CALL with identifier-1 Hi All, We have discovered another issue in our port from Micro Focus. We use CALL identifier-1 to call an appropriate value checker for an input field. The modules containing the entry points are statically linked. Is there any way to get this to work without making the modules dynamically loadable? There was some mention of using the assembler flag (-S). I have compiled two modules by hand as follows: cobc -S csmvalmin.cob cobc -c -static -v -Wall -std=ibm -ext lib csmvalmin.s and re-linked the executable with csmvalmin.o. The CALL still failed. The calling code looks something like this: MOVE "CSMVALMIN" TO PROCEDURE-NAME. CALL PROCEDURE-NAME USING ... Thanks ---------------------------------------------------------------- [quote] [code] MOVE "CSMVALMIN" TO PROCEDURE-NAME. CALL PROCEDURE-NAME USING ... [/code] [/quote] Wow! :roll: Micro Focus COBOL, most have changed quite a bit, since I first use it in 1993. However, with the other versions of Cobol I've used the so far, the above statement usually generate a Dynamic call (which attempts to locate & execute the call program at runtime. [code] CALL "CSMVALMIN" USING ... [/code] Though, with the above statement, as I recall, results in the called program being statically linked. ---------------------------------------------------------------- I don't see any problem here. Are you 100% sure that it's possible to do static linking in MF with [code]CALL varname[/code]? How should the compiler know the var contents? Just do either dynamic linking or if 100% necessary change your code to [code]CALL "CSMVALMIN"[/code] human ---------------------------------------------------------------- Yes, we run on a number of different systems and do not build dynamic libraries for these modules. I could not find anything in the MF COBOL documentation indicating that the called program must be in a library. It says that identifier-1 can specifiy the name of a library. This seems to be determined by whether the value contains an obvious file name, such as an extension (e.g. ABC.so) or a path name. It turns out that there are only two procedures called in this way. I have changed the code to use an EVALUATE statement to call the correct procedure depending on the value of the PROCEDURE-NAME variable. Thanks for your help, Martin ---------------------------------------------------------------- This is (I think) a terminology difference. With MF, you can have the "dynamically" called subprogram in either a "dynamic library" or as a separately compiled "program". It is NOT "linked" into the same "module" (ever). I think OC supports this also, but I am not positive. ---------------------------------------------------------------- OC support this the same way cobc prog1.cob prog2.cob prog3.cob results in a prog1.dll/prog1.so --> "dynamic library" In the COBOL program you don't see any differences whether the sub program is inside a library or is inside a "library" with only one entry. human BTW: I use CALL VARNAME a lot and don't have any issues - just leave out your static building [the ONLY reason I can think of static building is performance (when the program is called some-thousend times per minute) or you only have a static lib (which will never be the issue with COBOL modules)]. ---------------------------------------------------------------- It's way too complicated to break out of the current build architecture just for two dumb progams. The EVALUATE solution works fine. We can close this issue. Thanks. ---------------------------------------------------------------- Subject: End-String, End-Display, but no End-Inspect. Why? In my 99 bottles of beer posting, @human suggested I put in some end-display, end-string and other end-thingos. Why doesn't INSPECT need an END-INSPECT? Kind regards, Bruce ---------------------------------------------------------------- INSPECT is not a conditional statement. The "-END" is only for conditional statements. But not every STRING/DISPLAY is one. [code]Display "Hello World"[/code] -> No conditional statement; end-display is not necessary. [code] Display "Hello World" on exception display "Error!" end-display [/code] -> Conditional statement; end-display is necessary, if you don't want to end with a period. ---------------------------------------------------------------- You have a terminator for every statement that HAS a possible condition. INSPECT hasn't any condition It never harms if you use terminators wherever possible. It's simply nice coding. human ---------------------------------------------------------------- Are you suggesting code like this? [code] display 'this is a test' end-display call 'test' using one two three end-call string 'this' space 'is' space 'a' space 'test' into my-string end-string write my-record from my-file end-write [/code] Why? If there is no conditional phrase in your statement there's no need for the terminator. If you later add one then you can later add the statement terminator. Frank ---------------------------------------------------------------- There are a [u][i][b]few[/b][/i][/u] times when using the (available but not required) scope terminator for non-conditional statements MAY actually be requierd (or required for getting the desired results. Consider: [code] If abc = "x" Add 1 to Num1 On size erorr Add 1 to bad-count Not on size error Display "Which Add" End-Add . [/code] If you do NOT add an "END-ADD" before the NOT ON SIZE ERROR, then it is matched with the 2nd, not the first ADD statement. Certainly, in most cases, using a scope terminator with an imperative statement is "superfluous" but it NEVER hurts and it may (in obscure case) actually be helpful. ---------------------------------------------------------------- Subject: unable to lock record i am using OC 1.1 & BDB 4.3 on REDHAT. declare run time veriable DB_HOME='/var/lib/rpm' & export it. __db.001 files are present in that folder. but still records are not LOCKED for isam files Is there ant another setting necessary? ---------------------------------------------------------------- Not a setting, but maybe a code change. We cannot tell you this, as we don't know, what you're doing in your code: LOCK MODE AUTOMATIC or MANUAL? READ/WRITE WITH/WITHOUT LOCK, ... Maybe you can post a short sample what you think should work and what doesn't. human ---------------------------------------------------------------- Please consider following test code. if programs runs on 2 machines simaltiniously 3 records of a person who closes last are stored. & who ends earlier gets vanish. IDENTIFICATION DIVISION. PROGRAM-ID. ENTINIT. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT STATISTICS ASSIGN "STATS.FIL" ORGANIZATION IS INDEXED ACCESS MODE IS DYNAMIC LOCK MODE IS MANUAL RECORD KEY IS SC-BATCH FILE STATUS IS STAT-STATUS. * DATA DIVISION. FILE SECTION. FD STATISTICS. 01 SC-REC. 05 SC-BATCH PIC X(8). 05 SC-SUBNO PIC XXX. 05 SX-SUBNO REDEFINES SC-SUBNO. 10 SC-SUBCD PIC XX. 10 SC-PAPER PIC X. 05 SC-ENTRYOVER PIC X. 05 SC-ERRORFREE PIC X. 05 SC-VERIFIED PIC X. 05 SC-XFERRED PIC X. 05 SC-NOOFRECS PIC 9(4). 05 SC-OPID-ENTRY PIC XXX. 05 SC-OPID-CORR PIC XXX. 05 SC-OPID-VERIFY PIC XXX. 05 SC-DATE-ENTRY PIC 9(8). 05 SC-DATE-CORR PIC 9(8). 05 SC-DATE-VERIFY PIC 9(8). 05 SC-ERRRECS PIC 9(4). 05 SC-REC-ID PIC X. * WORKING-STORAGE SECTION. 01 STAT-STATUS PIC XX VALUE SPACES. 01 WS-DUM PIC X VALUE SPACES. 01 RES PIC X VALUE SPACES. 01 SPC PIC X(3000). PROCEDURE DIVISION. 100-MAIN. * OPEN OUTPUT STATISTICS. OPEN I-O STATISTICS. IF STAT-STATUS NOT = "00" DISPLAY "STATISTICS OPEN ERROR " AT 2302 DISPLAY "JOB ABORTED" AT 2325 DISPLAY STAT-STATUS AT 2350 ACCEPT WS-DUM AT 2301 STOP RUN ELSE ACCEPT SC-BATCH AT 1010. WRITE SC-REC WITH LOCK. COMMIT. ACCEPT SC-BATCH AT 1210. WRITE SC-REC WITH LOCK. COMMIT. ACCEPT SC-BATCH AT 1410. WRITE SC-REC WITH LOCK. COMMIT. CLOSE STATISTICS. 9900-END. DISPLAY SPC AT LINE 1 COL 1. STOP RUN. ---------------------------------------------------------------- I'm not 100% sure if I understood this correct: you run the code on two different machines accessing the same files? Do you want the lock still be there after your COMMIT? Why do you use this statement? human BTW: Please edit your previous post and use code tags formating your code. ---------------------------------------------------------------- one program runs simaltiniously on two machines. want to write in STATS.FIL at a time from two machines. COMMIT statement not required , it is removed. only 3 record from one machine written on file which ends at last. [quote] IDENTIFICATION DIVISION. PROGRAM-ID. ENTINIT. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT STATISTICS ASSIGN "STATS.FIL" ORGANIZATION IS INDEXED ACCESS MODE IS DYNAMIC LOCK MODE IS MANUAL RECORD KEY IS SC-BATCH FILE STATUS IS STAT-STATUS. * DATA DIVISION. FILE SECTION. FD STATISTICS. 01 SC-REC. 05 SC-BATCH PIC X(8). 05 SC-SUBNO PIC XXX. 05 SX-SUBNO REDEFINES SC-SUBNO. 10 SC-SUBCD PIC XX. 10 SC-PAPER PIC X. 05 SC-ENTRYOVER PIC X. 05 SC-ERRORFREE PIC X. 05 SC-VERIFIED PIC X. 05 SC-XFERRED PIC X. 05 SC-NOOFRECS PIC 9(4). 05 SC-OPID-ENTRY PIC XXX. 05 SC-OPID-CORR PIC XXX. 05 SC-OPID-VERIFY PIC XXX. 05 SC-DATE-ENTRY PIC 9(8). 05 SC-DATE-CORR PIC 9(8). 05 SC-DATE-VERIFY PIC 9(8). 05 SC-ERRRECS PIC 9(4). 05 SC-REC-ID PIC X. * WORKING-STORAGE SECTION. 01 STAT-STATUS PIC XX VALUE SPACES. 01 WS-DUM PIC X VALUE SPACES. 01 RES PIC X VALUE SPACES. 01 SPC PIC X(3000). PROCEDURE DIVISION. 100-MAIN. * OPEN OUTPUT STATISTICS. OPEN I-O STATISTICS. IF STAT-STATUS NOT = "00" DISPLAY "STATISTICS OPEN ERROR " AT 2302 DISPLAY "JOB ABORTED" AT 2325 DISPLAY STAT-STATUS AT 2350 ACCEPT WS-DUM AT 2301 STOP RUN ELSE ACCEPT SC-BATCH AT 1010. WRITE SC-REC WITH LOCK. ACCEPT SC-BATCH AT 1210. WRITE SC-REC WITH LOCK. ACCEPT SC-BATCH AT 1410. WRITE SC-REC WITH LOCK. CLOSE STATISTICS. 9900-END. DISPLAY SPC AT LINE 1 COL 1. STOP RUN. [/quote] ---------------------------------------------------------------- I've never tried to work with BDB on two different machines accessing the same physical file. As STATS.FIL is accessed from two different machines (via network?), the DB_HOME on both machines should be exported to a directory both can access (shared). Did you do this? Where is your STATS.FIL located? human ---------------------------------------------------------------- i am working to network (Redhat linux). I have export DB_HOME on both machines, but still unsuccessful to write at a time from both machines. my STATS.FIL located in diiffernt folder /state/apps and __db.001 files are located in another folder /var/lib/rpm. I have same access for both users. ---------------------------------------------------------------- Can you describe the network? Are you running the cobol program in two concurrent telnet/ssh sessions on the same host computer, or are the programs running on separate computers using a common data file, and if so what protocol are you using to share the file? ---------------------------------------------------------------- I assume /var/lib/rpm is a local folder. Just to make myself clear: set the DB_HOME to the same network share on both machine (the easiest solution would be to set it to /state/apps, too. As all lockings in BDB are done via the db-files that are found in the DB_HOME folder, it can only work if this folder is physical identical on all machines. human ---------------------------------------------------------------- Tried with setting DB_HOME to /state/apps also try on single machine by opening two GNOME terminals but still it fails to write from both programs. ---------------------------------------------------------------- Since I didn't know what BDB 4.3 was, I googled it, and this was the second hit: [url=http://www.openldap.org/lists/openldap-software/200807/msg00287.html]DBD 4.3[/url] ---------------------------------------------------------------- Subject: OpenCOBOL Service Unavailable Hey folks. I do not know who the hosting is for OpenCOBOL, but I have been running into [code[ Service Temporarily Unavailable The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. Apache/1.3.42 Server at www.opencobol.org Port 80 [/code] More and more. This is getting to be almost a daily occurrence. I just thought I would mention it. Cheers -D ---------------------------------------------------------------- I am also getting it VERY often. Sometimes I get it when just trying to reply to a post. I sent a note to the "OpenCOBOL list" and got back a reply saying this was "long standing problem", but it sure seems to be happening more and MORE ---------------------------------------------------------------- btiffin mentioned that he thinks this error roots in some spam bots that flood the comments in other parts of this site (which should be not that hard as this forum software is quite old and has known weaknesses). I've talked to Roger and he/Roger may give me necessary rights to kick the spam bots. But I'm currently unsure when this will come. human BTW: I get this error surely more than 50% of all my visits, too. ---------------------------------------------------------------- I had the same problem yesterday. Im pretty new to COBOL so I thought there was something wrong on my end like a firewall. But I guess this is not the case? Are too many users accessing the server? Thanks for any information. ---------------------------------------------------------------- Here is my take on it. The Xoops has been swamped by spam on the Links menu Add Comment. The spam is in the thousands. That in and of it self, isn't a big deal as I can only guess few people (re)visit the Links section very often. But Spiders do. Often. And there are a few of the Links pages that cause the SQL engine to time-out / trigger a server time-out. So, as we go about our forum business, Spiders are tripping the spam overload and denying us service. This can only be fixed by removing the comments. So not only do we need to turn off comments (from making it worse every day) we need someone with powers to purge all the comments. Once the purge is done, we'll be back to golden. Unfortunately, XOOPS is usually pretty much a maintenance free system and the admins are busy people that rarely have to look in here. We got tagged and the spam has now accumulated to a point where the SQL engine can't feed the Spiders fast enough and we suffer for it. We may need to pester Keisuke so we can run a raw SQL delete pass. And I figure Keisuke is busy. [b]if starts to drive you nutters, or away from oc, aoirthoir is setting up an OpenCOBOL COBOL fan/support/development site at add1tocobol.com[/b], it's Wordpress. And some of us OpenCOBOL fans hang out on irc://irc.mibbit.net in the #add1.to room. Cheers, Brian ---------------------------------------------------------------- For those experiencing this problem (and who haven't already discovered this), This is USUALLY a very "temporary" problem. When it happens to me, I just keep pressing F5 (refress - for IE) and I am almost always able to get in within 15 to 30 seconds. ---------------------------------------------------------------- I have removed all comments in the Links section and disabled the comment system. Let's see what happens.. Keisuke ---------------------------------------------------------------- Thank you very much!!! At least, I've got no "Service Unavailable" for the last 30 minutes. human ---------------------------------------------------------------- thank you response is immediate the problem has been building up for the last 6 months or so I hope that all is well with you and yours. ---------------------------------------------------------------- Thank you very much. A lot of courage for you and yours. ---------------------------------------------------------------- Thanks Keisuke. All the best to you and your's through this tough time. Cheers, Brian ---------------------------------------------------------------- Subject: Is OC still going? Forum often unavailable. No new downloads for ages. Hi guys, I have worked with Cobol for over 30 years and would love to see if OC is getting to a stage where it could be useful for us. We have quite a number of Cobol applications running at client sites. I tried OC a few years ago but ran into tgrouble compiling some of our applications. Too busy at work to sort it out, so I left it for a while. I recently loaded OC on an Ubuntu machine but found it was an old version (1.0-4; probably the same one I tried years ago). I tried to find a newer version but saw that 1.1 is quite old too. No more recent downloads that I could find from sourceforge. Trying to read a message on this forum is terrible with all the "service unavailable ..." messages. I read somewhere that no-one seems to have admin rights anymore. What is going on? Is OC still an ongoing project? Albert ---------------------------------------------------------------- OpenCOBOL has some BIG internal changes upcoming. These changes make it on the one hand necessary to have thorough tests before official (pre-)releases and on the other hand don't allow current pre-releases to be official (don't ask me why as I won't explain it here - this is the duty and honour of Roger While, when it's time for releases). For the discussion "release versions", see a forum entry currently THREE entries below this topic: http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1228&forum=1 [quote] human wrote: [....] the 2007 is just the date of the first 1.1 pre-release. If you download the file you see the real date: 2009-02-06. It is quite good. If you want to use it in WIN environments you should take the patched version available in the wiki.[/quote] To the forum: currently it's really not fun to use it, but see a forum entry SIX entries below this topic http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1290&forum=1 human BTW: Topics recently discussed shout be discussed there ---------------------------------------------------------------- Thanks. I am glad to hear the project is still ongoing. I will try to see if my sources will compile without changes with Roger's latest version. ---------------------------------------------------------------- vici, As far as viability goes our story is as follows: We are using OC 1.1 in a production environment. Our programs are either for new applications or applications where we are changing the user interface and database. As a result we are either writing new code or making significant changes to existing code and thus compatability with old compilers is not an issue to us. Our environment is OC 1.1, MySQL, and CGI. We are not using a stand-alone ISAM product. We have found very few compiler bugs and if we find one we just code around it. For us the product is viable. The upcoming 2.0 release might have some new features but we have not found anything that we cannot get done with the existing pre-release. By way of referencing scale, our OC 1.1 code base now exceeds 200,000 lines. Let me know if we can help. jimc ---------------------------------------------------------------- Hi Jimc, Thanks for your comments. I am glad to hear the compiler is robust enough to be used in real production environments. We are familiar with "coding around" known bugs. We still have clients running on RM/Cobol-85 runtimes that are not millennium proof. We just built our own date routines to replace the faulty ones in the runtimes. It was cheaper than upgrading the runtimes. We are considering the use of OC for existing terminal based applications on Unix/Linux, so source code compatibility is an issue for us. Currently we use ISAM (with ODBC drivers for client queries) but we are considering moving to a decent database. MySQL is an option. How do you access MySQL from your Cobol programs? Are you using embedded SQL, direct MySQL calls or are you using the standard Cobol READ/WRITE statements? Thanks, Albert ---------------------------------------------------------------- Albert, http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=575&forum=1 should explain where we started with MySQL Since then we have made a few minor changes. We have also written a clunky preprocessor that takes macro statements imbedded in our source code and expands them into the COBOL code needed (this takes a lot of the tedium out of using MySQL [COBOL coders are more used to doing record level I/O and MySQL requires a lot of column (field) coding]). We have developed a schema printer. We also wrote a routine to simulate an HP264X terminal -- I doubt that you guys would need this. We are willing to share the MySQL stuff but in the interest of saving time should probably work over the phone or in the chat room instead of through this forum. Let me know if we can help. jimc ---------------------------------------------------------------- Don't forget that you can use READ/WRITE statements if you put the whole DB-stuff into an extfh wrapper. I'd be interested in seeing this (JUST BECAUSE OF TECHNICAL INTEREST). If you changed some stuff in your MySQL call libraries, please add them in the old forum topic for reference. Thank you! Discussing details between two persons is surely faster in chat. If you get some results a short info here would be nice. human ---------------------------------------------------------------- Thanks guys. Give me a day or so before I reply. ---------------------------------------------------------------- Subject: COMP-1 is float? Hi, I have now installed OC and compiled some of our programs. I had not been aware that there was a major difference between the way different compilers define COMP-1. From the alphaocfaq.pdf (thanks!) I gathered that COMP-1 in OC means: "Single precision float. Equivalent to FLOAT-SHORT." RM/Cobol-85 (1986 language manual) defined COMP-1 as 16-bit two's complement signed binary integer. AcuCobol (8.1.3) defines it as follows: The format of a COMP-1 data item is 16-bit signed binary. The legal values range from -32767 to 32767. The size of the data item is always two bytes, and the high-order half of the data is stored in the leftmost byte. The PICTURE string that describes the item is irrelevant. Unlike other numeric data types, a size error will occur on a COMP-1, COMP-X, or COMP-N data item only when the value exceeds the physical storage of the item (in other words, the number of "9”s in the item’s PICTURE is ignored when size error is determined). I only noticed this difference because OC does not like a PIC clause for a COMP-1 data item compiling produced an associated error. From what I can see on the web it seems that the float and "no PIC allowed" is the way it is implemented by IBM. AcuCobol has a special compile time switch. AcuCobol User's Guide (8.1.3): -Df This option changes the way the compiler treats data items declared as COMP-1 and COMP-2. Some compilers use COMP-1 and COMP-2 to specify single and double precision floating point data items. However, ACUCOBOL-GT assigns a different meaning to COMP-1 and COMP-2 and uses FLOAT and DOUBLE to specify floating point data items. When the “-Df” option is used, the compiler treats data items declared as COMP-1 as if they were declared FLOAT and data items declared as COMP-2 as if they were declared DOUBLE. With the “-Df” option, you have the following correspondence: COMP-1 FLOAT single precision COMP-2 DOUBLE double precision The “-Df” option makes it easier to compile code originally written for another compiler--one that used COMP-1 and COMP-2 to specify floating point data items. The “-Df” option lets you compile such code without having to change COMP-1 and COMP-2 to FLOAT and DOUBLE. Is the reverse of the AcuCobol -Df option available in OC? Have I missed it? Thanks, Albert ---------------------------------------------------------------- http://opencobol.add1tocobol.com/OpenCOBOL%20Programmers%20Guide.pdf ---------------------------------------------------------------- All usages of the fommat COMP-? or COMPUTATIOANL-? are NON-Standard (i.e. not in any ANSI or ISO Standard). Therefore, how each compiler implments them may well vary. If you have code that expects "COMP-1" to be the same as BINARY but you don't want to change every place it is used, you MIGHT find it useful just to use the COBOL REPLACE statrement - i.e. [code] replace ==comp-1== by ==Binary==. [/code] as the first line in your source code (or in your dta division or anyplace before your first use of "COMP-1. I don't know that this "buys" you much over changing your source code. I will say that Usage Binary *is* part of the Standard and should work with any '85 Standard compiler (or later). ---------------------------------------------------------------- Thanks for the link. I was unaware of the existence of the OC Programmer's Guide. ---------------------------------------------------------------- Thanks for the tips! This should be relatively straightforward to change. I do like to work with identical sourcecode (whenever possible) so will look for a permanent solution. From what I just read in the OC Programmer's Guide, in OC BINARY can be the same as "how I/RM/Acu currently use" COMP-1, but it depends on the number of 9's in the PIC clause and a configfile setting (binary-size). I will check to see if changing this config parameter has other effects, and if so which. I do not have the official 85 syntax at my current location. Does anyone have a link to the official 85 syntax? Thanks, Albert ---------------------------------------------------------------- [quote] From the alphaocfaq.pdf (thanks!) I gathered that COMP-1 in OC means: "Single precision float. Equivalent to FLOAT-SHORT." [/quote] That ocfaq version will get better, but as jcurrey pointed out, and you now know about; for straight up documentation, Gary's Guide is the place to be. The FAQ is more of a tidbits file, [i]and hopefully a little inspiration on where OpenCOBOL can be taken[/i]. Cheers, Brian ---------------------------------------------------------------- Subject: ACCEPT and DISPLAY options for individual fields I have tried compiling our sources using OC but am running into problems with ACCEPT and DISPLAY. We use the RM display/accept extensions, NOT the screen section. The AcuCobol manual shows that the ACCEPT (format 1; individual field) and DISPLAY (format 1; individual field) statements have many more options. I tried copying the entries into this message but cannot get all the underlining working. The manuals can be found here: http://microfglobal.http.internapcdn.net/MicroFGlobal/supportline/docs/acu/813/docs/wwhelp/wwhimpl/js/html/wwhelp.htm The entries are in the reference manual. Are there any plans to include the remaining options? Thanks, Albert ---------------------------------------------------------------- ... depends on the options. Some additions (or even a lot of?, I doesn't remember) were done already for OC 2.0. It's unlikely that ALL extensions other vendors have will be supported in the near future. What specific extensions from ACU-COBOL do you need? I'd have a look if they are in upcoming 2.0 already and if not, have a look if it seems easy to add. human ---------------------------------------------------------------- Well, speaking of extensions, I would like to see the following (from VAX, ICOBOL): [code] {ERASE} [TO END OF] {LINE } {BLANK} {SCREEN} [/code] I had been attempting to port over Cobol code that I written for the Dec Vax. ---------------------------------------------------------------- Human: We generate most of our ACCEPT and DISPLAY statements using a generator I wrote in 1988. I have to check the source code of the generator to make sure I include all the options we have in use. I am pretty sure that we use the following ACCEPT options: - LINE - POSITION - SIZE - PROMPT - UPDATE - CONVERT - TAB - NO BEEP (RM/Cobol has default BEEP on every ACCEPT!) - ERASE EOL - ERASE EOS - HIGH - LOW - OFF - BLINK - REVERSE And with DISPLAY: - LINE - POSITION - SIZE - BEEP - ERASE EOL - ERASE EOS - HIGH - LOW - CONVERT - BLINK - REVERSE Could you check if these are included in 2.0? Thanks, Albert ---------------------------------------------------------------- Subject: COBOL field_by_field screen handler Hi, You asked for involvement. Here's some. In 1988 I was sick and tired of writing DISPLAY and ACCEPT statements. What I hated most was having to do a redisplay of numeric fields in order to get them displayed decently on the screen. I don't know how many bugs were due to forgetting stupid little things like that. Solution: write a code generator. So, I did. I added convenient things like automatic input and error messages, automatic PERFORMing of validation routines, uppercase routine (not by INSPECT REPLACING as my compiler did not support it at the time. Really, this should now be changed!) and much more. I have been meaning to upload this for ages. Never had the time. I just uploaded it now. As is (I just changed the copyright messages to 2011!). http://sourceforge.net/projects/vmapcobolfield/ Requirements: Uni/Linux, lex, yacc and a c compiler. $ make -f makefile (this should generate the vs executable) $ make -f make2 (and this one the vspp executable) A few things to remember. This was written more than 20 years ago. It was never intentioned to be released, so there is no manual, sample code, etc. The very small amount of documentation I have is in Dutch and not something I can release in the present state. One day. When I have time ... Does it work? Yes. It is still being used on a daily basis. Clients are running critical applications where screen I/O is generated by this software. NO special runtimes are needed. NO C programing is required. EXAMPLE: Program QQQ. Uses one screen, QQ1. You write an ordinary Cobol program with special macros (VMAPIN, VMAPOUT, VCLEARLINE, etc.). Store in QQQ.VBL vspp reads QQQ.VBL and generates QQQ.CBL screen definitions are to be stored in QQ1.VS vs generates QQ1.MAP Program must contain include a few variables in working storage. Check the generated .MAP to see which ones. Program must also contain a COPY "QQ1.MAP" statement somewhere in the procedure division. Note. A program without macro's can be called .VBL. After preprocessing by vspp to .CBL it will be unchanged. No comments on the style of programming, please. I started writing assembler. Then some Fortran IV and a little bit of Basic. Finally Cobol. I read a book on Unix compiler construction and this was the result. You will see that my style of C programming is not standard C programming. But hey, don't knock it, it works. I hope someone else will benefit from it. Albert ---------------------------------------------------------------- Something I forget to add to the above. I hated SCREEN section. - Why wait for the user to ENTER to start checking validity of the input. Why not do it as soon as he left the field. - Why TAB your way through many fields when you only wanted to change 1 field? I wanted total control over the program/user interaction. Coming from a mainframe I guess SCREEN section made sense. Coming from Unix mini's using RS-232 terminals in character mode it was backwards. That was why I wanted to use ACCEPT/DISPLAY on a field by field basis. ---------------------------------------------------------------- Sounds interesting (I really think there are a lot of these pre-parsers for COBOL used, some in yacc, some in pure C, some even in COBOL or JAVA). Does your pre-parser need lex/yacc for pre-parsing or only for the "internal" C-Code? Does the internal C-Code is compilable and work with other C-Compilers like MS/Intel/Borland/Watcom, too? Do you mind of putting the source into SVN version control at SourceForge? If you need further information and/or help, contact me per PM about that. Can you add some small samples for VBL files (and maybe the generated CBL files, too) in a folder example? Important: as it is licensed under GPL you should add a GPL licence file (with the text of the licence like it is included in OpenCOBOL) into the download. human ---------------------------------------------------------------- Subject: Dynamic field updates In Foxpro, I can do the following: [code] 1 string="CITY=Dallas" 2 x=at("=",string) #x is equal to 5 3 field=substr(string,1,x-1) #field="CITY" 4 value=substr(strin,x+1) #value="Dallas" 5 replace &field with value #replace the contents of field CITY with "Dallas" [/code] Is there a way to accomplish this in cobol (especially line 5), ---------------------------------------------------------------- Kind of everything should be able with COBOL ;-) As STRING and VALUE are reserved words I use strvar/valuevar (and fieldvar for same names) in the following example. For line 5 I guess you mean search and replace withing strings. You can read about this at http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1284&forum=1 , I'd answer the way I understood what you wrote. [code]00001 move "CITY=Dallas" to strvar 00002 move 0 to x 00002 inspect strvar tallying x for all characters before '=' 00003 move strvar (1 : (x - 1) ) to fieldvar 00004 move strvar (x : ) to valuevar 00005 move valuevar to fieldvar[/code] just for reference: most times you would not use another var like x but do something like that for lines 2 to 4: [code]02-04 unstring strvar delimited by '=' into fieldvar, valuevar 02-04 end-unstring[/code] human ---------------------------------------------------------------- The string manipulation seems easy enough, but I don't think that I explained line 5 well enough. Line 5 should replace the contents of the field whose name is the contents of fieldvar with the contents of valuevar. So using the data supplied: MOVE "Dallas" TO CITY. Jack ---------------------------------------------------------------- I don't think it's possible that way. You COULD use SET ADDRESS OF but would have to put it into a big EVALUATE where you could use simple move instructions (SET ADDRESS OF would only make sense if you want to use multiple references of this field). If really needed I'd do something like [code]EVALUATE fieldvar WHEN 'CITY' MOVE valuevar TO city WHEN 'COUNTRY' MOVE valuevar to country [...] END-EVALUATE[/code] human ---------------------------------------------------------------- [quote] jgt wrote: In Foxpro, I can do the following: [code] 1 string="CITY=Dallas" 2 x=at("=",string) #x is equal to 5 3 field=substr(string,1,x-1) #field="CITY" 4 value=substr(strin,x+1) #value="Dallas" 5 replace &field with value #replace the contents of field CITY with "Dallas" [/code] Is there a way to accomplish this in cobol (especially line 5), [/quote] Hello, I’m not sure what is mean by “Dynamic” fields? Do you mean, the length of the field varies as it’s contents are updated? [code] 001000 DATA DIVISION. 001100 WORKING-STORAGE SECTION. 001200 01 WS-POS PIC S9(04) BINARY. 001300 01 WS-STRING PIC X(11) VALUE "CITY=Dallas". 001400 01 WS-WORKAREA. 001500 05 WS-LEN PIC S9(04) BINARY. 001600 05 WS-WORK-FIELD PIC X(11). 001700 01 WS-FIELD2. 001800 05 WS-VALUE-LEN PIC S9(04) BINARY. 001900 05 WS-VALUE. 002000 10 FILLER OCCURS 0 TO 8 DEPENDING ON WS-VALUE-LEN 002100 PIC X. 002200 002300 LINKAGE SECTION. 002400 01 LS-DYNAMIC-FIELD. 002500 05 LS-FIELD-LEN PIC S9(04) BINARY. 002600 05 LS-FIELD. 002700 10 FILLER OCCURS 0 TO 12 DEPENDING ON LS-FIELD-LEN 002800 PIC X. 002900 003000 PROCEDURE DIVISION. 003100 BEGIN. 003200 MOVE +1 TO WS-POS 003300 UNSTRING WS-STRING DELIMITED BY "=" 003400 INTO WS-WORK-FIELD COUNT IN WS-LEN 003500 WITH POINTER WS-POS 003600 END-UNSTRING * Split off the first string prior to the equal sign * WS-POS has the position following the equal sign DISPLAY " POS = " WS-POS DISPLAY " LEN = " WS-LEN 003700 003800 SET ADDRESS OF LS-DYNAMIC-FIELD TO ADDRESS OF WS-WORKAREA * Pretends, LS-FIELD is a new allocated field * which has a length of 4 bytes. 003900 COMPUTE WS-VALUE-LEN = LENGTH OF WS-STRING 004000 - WS-POS + 1 004100 END-COMPUTE DISPLAY " Remaining length " WS-VALUE-LEN 004200 004300 MOVE WS-STRING(WS-POS:WS-VALUE-LEN) TO WS-VALUE * Get's the remaining part of the string 004400* ***********MOVE WS-FIELD2 TO LS-DYNAMIC-FIELD 004500 MOVE WS-VALUE-LEN TO LS-FIELD-LEN 004600 MOVE WS-VALUE TO LS-FIELD * Should be the near equivalent of ‘replace’ * in that the field length & value is updated. * However, in reality the amount of actual storage allocated never changes. DISPLAY " FIELD=" LS-FIELD [/code] ---------------------------------------------------------------- @mwilliams, how do I nicely say that you misunderstood the requirement. What I wanted to accomplish was reading a file that contained an ordered list, and update a master file accordingly. Consider input data as: [code] CUST=1234 NAME=Jack ADDR=123 Main St CITY=Dallas STAT=TX ZIPC=51000 EOFF=EOF [/code] With a program that looks like: [code] FD CUSTOMER-MASTER. 01 CUST-REC. 03 CUST PIC X(4). 03 NAME PIC X(30). 03 ADDR PIC X(30). 03 CITY PIC X(20). 03 STAT PIC X(2). 03 ZIPC PIC 9(5). WORKING STORAGE SECTION. 01 INPUT-DATA. 03 FIELD-NAME PIC X(4). 03 FILLER PIC X. 03 DATA PIC X(30). PROCEDURE DIVISION. SOJ. ACCEPT INPUT-DATA. IF FIELD-NAME EQUAL 'CUST' OPEN I-O CUSTOMER-MASTER MOVE DATA TO CUST READ CUSTOMER-MASTER INVALID STOP RUN. IF FIELD-NAME EQUAL "EOFF" REWRITE CUST-REC CLOSE CUSTOMER-MASTER STOP RUN. MOVE DATA TO &FIELD-NAME. NOTE. the meaning of the above line is that DATA is moved to the field whose name is contained in the variable FIELD-NAME. GO TO SOJ. [/code] ---------------------------------------------------------------- For doing that simply do an EVALUATE FIELD-NAME and MOVE according to that [code][...] SOJ. ACCEPT INPUT-DATA END-ACCEPT. SOJ-2. EVALUATE FIELD-NAME WHEN 'CUST' OPEN I-O CUSTOMER-MASTER MOVE DATA TO CUST READ CUSTOMER-MASTER NOT INVALID KEY GO TO SOJ-2 INVALID KEY GO TO SOJ-END END-READ WHEN 'EOFF' REWRITE CUST-REC END-REWRITE GO TO SOJ-END WHEN 'CITY' MOVE DATA TO CITY WHEN 'COUNTRY' MOVE DATA TO COUNTRY [...] WHEN OTHER DISPLAY 'Wrong field name' END-DISPLAY END-EVALUATE GO TO SOJ. SOJ-END. CLOSE CUSTOMER-MASTER STOP RUN.[/code] human ---------------------------------------------------------------- Subject: WoW Gold All Servers WoW Gold All Servers Due to our large gold stock on World [url=http://www.allthewow.com]wow gold[/url] of Warcraft - US & EU servers, we can guarantee instant & complete [url=http://www.wowgoldyoyo.com/]wow gold[/url] delivery of your Gold. You can expect 110% satisfaction from MMOGCART. 1.All WOW orders are traded by Face-to-Face to insure the safety of the gold, therefore please use the character that you play most frequently online for the pickup. 2.For a smooth and [url=http://www.lightinthewow.com]wow gold[/url] convenient delivery, MMOGCART recommend you to contact our Live Help,tell us your usual online hours - the in game time period, which is very helpful for a quick transaction. 3.Please supply a phone number & MSN that you can be reached most time of the day so that we can contact you when the gold is ready. While others are raising prices, extending delivery times and running out [url=http://www.gamesfleet.net]wow gold[/url] of inventory MMOGCART is giving you More, Delivering it Faster, and giving it to you for LESS Money. Simply select your server from the list on the LEFT and decide how much you want to buy. The more you buy the more you SAVE! Prices have been cut by up to 15% so Stock up Now and Save.Take advantage and stock up before this amazing deal goes away... MMOGCART specializes in WoW Power Leveling, World [url=http://www.lightinthegame.com]wow gold[/url] of Warcraft Gold and services for ALL of your favorite MMORPGs. MMOGCART has the experience and the knowledge to take you to [url=http://www.weboof.com/wow_gold/wow_us_gold.html]wow gold[/url] a higher level - MMOGCART is the premium MMORPG services company people TRUST. MMOGCART has Satisfaction Guaranteed or we will refund the unused portion of your purchase. ---------------------------------------------------------------- Subject: Strategy and Communication Strategy and Communication Tanks, you can’t pull and AE every group in a Heroic (again, until [url=http://www.neverban.com/]wow power leveling[/url] you overgear the content). It’s a good idea to crowd control at least one target -- and sometimes two. As long as you have someone with a long-duration and/or renewable crowd control and someone else with a short crowd control such as a stun or even a snare, you should be fine. We don’t have anything like Heroic Shattered Halls, and [url=http://www.ipowerlevelings.com/]wow power leveling[/url] you don’t need 3 mages for CC. Caster mobs, which are weak but do a lot of damage, are good choices for crowd control. So are mobs that buff other mobs or debuff your group. Don’t waste the CC on non-elite mobs or others that will die quickly. The responsibility for marking and setting the pace often falls upon the tank, but sometimes other experienced players are [url=http://www.mywowpl.com/]wow power leveling[/url] happy to take the mantle. If you are setting the pace, you need to keep an eye on healer mana. Healers will generally have enough mana to keep you alive in any given fight, but you need to be careful not to chain pull repeatedly if their mana is low. Tanks tend to have good situational awareness and are experienced at reducing incoming damage. Where I have personally seen them get into trouble is [url=http://www.toppowerleveling.com]wow power leveling[/url] when they slip into overconfident “I got this” mode and try to tank too many things at once. DPS specs often get blamed the most for not knowing what is going on. It should be your business to understand the mechanics of the fights. You’re a member of a team, not a follower who can always rely on someone else to tell them what to do. Which are the spells that need [url=http://www.77745.com]wow power leveling[/url] to be interrupted? Which are the void zones that you absolutely must get out of? Which are the adds that must be burned down (and conversely, when should you ignore the adds and focus on the boss instead)? If you aren’t sure, then ask. Almost every group would rather take the few seconds to explain a fight than to wipe because you failed to dodge Glubtok's wall of fire [url=http://www.buyaccountol.com/]wow account[/url] or tried to AE Vanessa’s spiders or didn't understand what "Downwind of Altairus" meant. For everyone, regardless of role, I suggest running the dungeons on normal mode until you feel more comfortable with the pulls. Those runs can be quick, the penalty for mistakes isn’t as high, and you can often still earn a little reputation, cloth, or enchanting materials. As a bonus, you’ll probably make a group really happy if you’re geared for Heroics but helping them out in a normal dungeon. ---------------------------------------------------------------- Subject: LF3M 9600GS PST LF3M 9600GS PST I love the Dungeon Finder. I worked on it a lot personally. It is [url=http://www.1stpowerleveling.com/]wow power leveling[/url] quite successful at finding you a group. It doesn't guarantee a successful group. It's a huge improvement over spamming trade chat trying to find a tank for your three-rogue party. But throwing together up to 5 strangers and asking them to do challenging content that some of the group may have never seen before is always going to be risky. World of Warcraft supports a lot of solo play. However, we want [url=http://www.powerlevelings.net]wow power leveling[/url] dungeons to be a group experience. In fact, we think the game is more fun overall when you play with friends, which is why we put so much effort into encouraging players to join guilds for Cataclysm. Running a hard dungeon with friends tends to be a much better experience. Communication feels less awkward, and everyone is generally more supportive of mistakes. You [url=http://www.gmingsale.com/]wow power leveling[/url] learn the strengths and weaknesses and nuances of players that you run with regularly. There tend to be fewer loot arguments as well. PUGs have their place -- don’t get me wrong. But we don’t want to sacrifice [url=http://www.gmingsale.com/wowus/index.jsp]wow power leveling[/url] dungeons being fun and challenging for organized groups in order to have everything be conquered by any possible group. Make sense? I’ve PUGged the Cataclysm content a lot. So have all of the designers. We want [url=http://www.gamercarts.com/cheap-wow-powerleveling/]wow power leveling[/url] to stay in touch with what players are experiencing. Heroic PUGs are definitely harder than going with groups of people you know, but they aren’t impossible. If things start to go wrong, you might want to take a moment to analyze why they are going wrong before you bail. I do weep for those players who join an in-progress Heroic Rajh [url=http://www.accountold.com/]wow power leveling[/url] attempt (with suspicious player skeletons everywhere), immediately pull without any discussion, and then have the tank leave the group following the first wipe. That’s not fun for anyone and not going to lead to success. These aren't the originalScholomance or Arcatraz runs that could take four hours with respawns. Making a couple of concerted attempts on Rajh is probably going to be faster than going into the queue again. ---------------------------------------------------------------- Subject: Some other sneaker notes from All-Star weekend Some other sneaker notes from All-Star weekend Props to Michael Cooper and Lisa Leslie for lacing up the [url=http://www.bidsneakers.com/]nike shoes[/url] Think Pink Hyperdunks this weekend…He may be the most un-gangster guy to have played ball in the ’80s, but it was somehow appropriate to see Bill Laimbeer in white-on-white Air Force 1 lows…Nominee [url=http://www.bestbuyjumpman23.com/]nike shoes[/url] for Most Shafted By His Sneaker Company: Yao Ming. The big man wore his Reebok Omni Hex Ride on Sunday. The same Omni Hex he wears every time he gets on the court. No Phoenix-themed colorways, no nothing. Reebok took care of AI; they couldn’t make moves for Yao?…How cool were [url=http://www.retrojordan23.com/]nike shoes[/url] the All-Star socks? The red (West) and blue (East) coloring up to the All-Star logo was a nice touch by the L. Finally, I wanted to say something about the on-court debut of the Air Jordan 2K9. After the sendoff that the Air Jordan XX3 had (I saw a guy wearing a pair of the limited edition first release XX3’s on the beach this past week), the 2K9 seems to be falling short as [url=http://www.dhlwatches.com/]Replica watches[/url] it branches out on its own. I saw the 2K9 in person just today and my mental jury is still out on it. I think the brand needs to look at a few things before they release the 2K10, or whatever they’ll call [url=http://www.dhljersey.com/]soccer jerseys[/url] the next one. First, they need to get it under a marquee player or two (Melo, CP3 maybe) to put a face to it. Second, Jordan Brand needs to get back to releasing this shoe in the fall at the start of the basketball season. That lets a lot more kids pick up the shoes and wear them through their own seasons and attach their own memories to it. Lastly, the price tag needs to come [url=http://www.watchessalebuy.com/]men's watches[/url] down. 190 bucks? During a recession? Come on, man. I liked Ray Allen’s and Mike Bibby’s the best. They should have released one of those two as the general release. ---------------------------------------------------------------- Subject: Entrepreneur Sues Nike & H.S. Coaches Entrepreneur Sues Nike & H.S. Coaches Nike conspired with an association of high school football coaches to cut out the [url=http://www.bidsneakers.com/]jordan shoes[/url] founder of the Texas Football Combine from the event he spent 8 years building until it included nearly 3,000 prospects from across the country, Terry Burdick claims in Harris County Court. Burdick has owned a sports marketing company and has filmed and helped Houston student athletes for 20 years, he says. In 2000 he founded the Texas Football Combine - a battery of tests by which college recruiters can measure [url=http://www.bestbuyjumpman23.com/]jordan shoes[/url] speed, strength and agility - and entered into a partnership with the Greater Houston Football Coaches Association to staff the event, Burdick says. Burdick says he agreed to create a Web site for the Combine, manage its sponsorships and compile statistics from the event to sell to recruiters. Nike agreed to sponsor the 2008 combine, Burdick [url=http://www.retrojordan23.com/]jordan shoes[/url] says. But recognizing the money to be made from it, Nike persuaded coaches' association to hand over rights to the event, in exchange for Nike's promise to sponsor a high school all-star game, Burdick says. He [url=http://www.dhlwatches.com/]Cheap watches[/url] claims Nike also made the coaches group promise to cease all communication with Burdick 2 months before the Combine. "Plaintiff's success abruptly ended after contracting with Nike to sponsor the 2008 9th Annual TFC," according to the complaint. Nike added the Texas Football Combine to [url=http://www.dhljersey.com/]Wholesale jerseys[/url] the more than 160 other combines it already sponsors, and after pushing Burdick out it unveiled the "Nike SPARQ Training Program," which [url=http://www.watchesgobuy.com/]Rolex watches[/url] tests athletes' prowess and gives them a rating to track their progress against others around the world. ---------------------------------------------------------------- Subject: configure: error: libdb is required Error while running ./configure open-cobol-1.0 Ubuntu 10.04 LTS - the Lucid Lynx Berkeley v4.8 Database Libraries [runtime] is already installed. What do I need to install? sudo apt-get install ???? Thank you! ---------------------------------------------------------------- Yeah, you need ncurses-devel, libdb-devel and libgmp-devel packages. By that I mean the development headers for ncurses, Berkeley db and the GNU Multi Precision libraries. See http://opencobol.add1tocobol.com/ocfaq.html#are-there-pre-built-opencobol-packages for the list that was used to package the Debian version of 1.0. Cheers, Brian ---------------------------------------------------------------- i have ubuntu 10.04. If you go to the Synaptic Package Manager from the System menu you can type in opencobol and you will find it is all there.You just have a one click install.You get version 1. If you want the later version 1.1,you have to download the cobol 1.1 from the pointer on this site. Then: 1. tar xvzf open-cobol-1.1.tar.gz 2. cd open-cobol-1.1 3. ./configure 4. make 5. make-check 6. sudo make-install 7. hash -r 8. sudo ldconfig John. ---------------------------------------------------------------- thanks my friends. I installed using Synaptic as John said it worked. I tested the hello world example http://www.opencobol.org/modules/bwiki/index.php?cmd=read&page=UserManual%2F1 and it also worked. It shows some warnings, but that's ok. leandro@leandro-laptop:~/dev/COBOL$ cobc -x hello.cob /tmp/cob14385_0.c: In function ‘hello_’: /tmp/cob14385_0.c:75: warning: dereferencing type-punned pointer will break strict-aliasing rules /tmp/cob14385_0.c:76: warning: dereferencing type-punned pointer will break strict-aliasing rules /tmp/cob14385_0.c:77: warning: dereferencing type-punned pointer will break strict-aliasing rules /tmp/cob14385_0.c:88: warning: dereferencing type-punned pointer will break strict-aliasing rules /tmp/cob14385_0.c:107: warning: dereferencing type-punned pointer will break strict-aliasing rules /tmp/cob14385_0.c:111: warning: dereferencing type-punned pointer will break strict-aliasing rules ---------------------------------------------------------------- Those warnings can be ignored. COBOL can't define pointers beyond generic data and procedure. C can define pointers that point at specific data structures. But, when the rubber hits the road, on all machines I've ever heard of, a pointer holds an address and addresses are always the same size. So, things still work, as long as the user of the pointer understands what is being addressed. Cheers, Brian ---------------------------------------------------------------- Subject: Replica watches Rolex Air-King Replica watches Rolex Air-King Rolex watches and stylish elegance [url=http://www.dhlwatches.com]wholesale watches[/url] synonymous. Rolex watches guy has been introduced, not only as a status symbol, but also told about the style and taste of the wearer, and [url=http://www.dhljersey.com/]football jerseys[/url] perhaps many other stories, which is why a sense of style, a considerable number of people like Rolex watches, other brands of replica watches. But it is also the fact that different Rolex watches are [url=http://www.watchesgobuy.com/]Rolex[/url] not for everyone, although they each style, and conscious of those things. If you are in the budget and a nice replica watch to support you [url=http://www.watchessalebuy.com/]Men watch[/url] in today's competitive environment, style of view, a copy of the form you watch several other options. You can easily find copies of almost all the well-known brands, but as the labor standard time Shigelinni Governance Master Rolex Air King Rolex replica and replica Rolex different is the final copy of the submarine, and the requirements of [url=http://www.dearwatchesshop.com/]omega[/url] the most copied watches. A copy of the style to increase awareness of these needs a lot of people think that these watches rolex replica rolex watch a good choice to maintain its proper style, and their low-cost method. All their [url=http://www.uggboots4days.com/]ugg boots[/url] grace and style, you can see in this matter between the brand and price, to create a copy of the original Rolex watches are original. ---------------------------------------------------------------- Subject: The bridge between Bryant and Lionel messi The bridge between Bryant and Lionel messi According to reports: Lionel messi [url=http://www.dhljersey.com/]cheap jerseys[/url] is always enjoy watching NBA during his spare time, Spain, the newspaper news, recently he received a gift from the 10th cheap jerseys. What is worth mentioning, remarkably, the cheap jerseys is special for messi custom, his name and number printed in purple shirt. Vice President of international operations in the NBA is invited the Barcelona star watching the game [url=http://www.watchesgobuy.com/]replica watches[/url] on October 7, but the lakers because international relations, Lionel messi for site. The cheap jerseys in the NBA, and in the name of the lakers, Lionel messi after receipt of very happy to hear the NBA, in his invitation Barcelona basketball and the lakers game after, small flea appears very excited. But he told the other, he will follow Argentina in a friendly in Japan together, so he can't go to watch basketball field. When he heard that messi usually like basketball, vice chairman of the NBA right state ", welcome to American see [url=http://www.watchessalebuy.com/]Watches[/url] little Argentina free of any one game, they will receive the VIP anytime. In fact, to look at macy's game, the lakers don't through official Bryant is his master's fans, as long as he arrived in the United States, want to get a VIP tickets fundamental. Bryant in the locker room [url=http://www.dearwatchesshop.com/]Rolex[/url] hanging messi signed poster: "there is no doubt that he is the world's best player, one of the productive and Lionel messi very expressive pitch, every time he will play more powerful than last time,". Because messi, Bryant is often watched the Barcelona game, before his idol is ronaldinho, ronaldinho to SAN siro later, Bryant's favorite [url=http://www.uggboots4days.com/]ugg[/url] players became Lionel messi. Two time, Bryant on the poster locker cupboard door always change. In April this year, when the lakers superstar, charge in October to Barcelona play game, must fit in with Lionel messi cheap jerseys meet. Unfortunately, Lionel messi in that walks internationals, he himself also regret. Fortunately, Lionel messi with kobe Bryant is still having time to meet. ---------------------------------------------------------------- Subject: Error when compiling a COBOL file ... Hi, I have a problem compiling a file (any file) using cobc. whenever i write "cobc file.cbl" i get these: warning: dereferencing type-punned pointer will break strict-aliasing rules. Does anyone know what is the problem ? ---------------------------------------------------------------- hi, That is a warning from GCC and not an error. gcc tries to be more law obedient than the actual law and this warning can also be something about alignment or pointers and not necessarily aliases. The program should be compiled even though you received this warning. gcc's info docs, offer this: `-Wstrict-aliasing' This option is only active when `-fstrict-aliasing' is active. It warns about code which might break the strict aliasing rules that the compiler is using for optimization. The warning does not catch all cases, but does attempt to catch the more common pitfalls. It is included in `-Wall'. `-fstrict-aliasing' Allows the compiler to assume the strictest aliasing rules applicable to the language being compiled. For C (and C++), this activates optimizations based on the type of expressions. In particular, an object of one type is assumed never to reside at the same address as an object of a different type, unless the types are almost the same. For example, an `unsigned int' can alias an `int', but not a `void*' or a `double'. A character type may alias any other type. Pay special attention to code like this: union a_union { int i; double d; }; int f() { a_union t; t.d = 3.0; return t.i; } The practice of reading from a different union member than the one most recently written to (called "type-punning") is common. Even with `-fstrict-aliasing', type-punning is allowed, provided the memory is accessed through the union type. So, the code above will work as expected. However, this code might not: int f() { a_union t; int* ip; t.d = 3.0; ip = &t.i; return *ip; } ... Enabled at levels `-O2', `-O3', `-Os'. To get rid of this warning (There may be a performance penalty, since you're taking away an opportunity for optimization.)you should probably just use -fno-strict-aliasing. jwl ---------------------------------------------------------------- Thank you very much for your explanation :-) . Just one thing i didn't understand. What did you mean by "Enabled at levels `-O2', `-O3', `-Os'." ? And could you please provide an example where type-punning is useful ? ---------------------------------------------------------------- Useful? That would be subjective, but it's usually fun. O2, O3 and Os are documented as Optimize level 2 (which is "even more" than level 1, Optimize level 3 ("yet more"). These are compiler hints to try to optimize for both size and speed, at the expense of compile time and usually leaning for bigger size for faster code. Os is Optimize for size. Turns on all the O2 optimizations that don't usually increase the code size. For instance, O2 may inline two function calls, saving the overhead of a CALL (put things on the stack) and RETURN (pull said things off the stack). Os would do the CALL and RETURN rather than have two identical copies of code in the program. man gcc for all the hairy details. On type punning. As an example; a USAGE FLOAT-SINGLE will be punned so that a routine like CBL_OC_DUMP can show you the hex values in the display, and not the actual floating point number. Whenever you see a debugger dump of a data structure, it's usually been "pun" converted to unsigned 8 bit bytes. Most data type punning is relatively dangerous if the values are used for anything other than output for human consumption. Code that relies on punning has to rely on hardware specific data rules, compiler optimizations not mucking with the assumptions, etc. But, for debug dumps it's pretty common. Exception to the rule; pointers are punned all the time ([i]more concisely, the description of what is being pointed to is punned, not the actual address in the pointer[/i]. An OpenCOBOL routine cannot request [code] CALL "cfunction" USING BY REFERENCE a-pointer (TO A TIME STRUCTURE) [/code] So, the compiler puns the data type of the pointer to CHAR * (pointer to 8 bit bytes) and relies on the programmer to ensure that it properly addresses a 6 byte time structure. We rarely have to think about such conceptual punning as the compilers do all the hard on the brain work. Cheers, Brian ---------------------------------------------------------------- Thanks for the explanation. It really sounds like a messy subject :-? I have a feeling that your explanation will save me a lot of trouble if i encounter a type-punning bug in the future :-D Thanks again. ---------------------------------------------------------------- Subject: MicroFocus _CODESET utility equivalent Hi, all We are converting from MicroFocus Cobol to OpenCobol and ran across the use of the utility function above. We use it in our code in one of our programs to convert a text variable from EBCDIC to ASCII. I haven't found any discussions on such a program in OPenCobol and wondered if someone else has already solved this issue, besides using a program outside of Cobol to convert a whole file? Thanks, Steve ---------------------------------------------------------------- Why not use INSPECT CONVERTING? human ---------------------------------------------------------------- Steve; If it's just "strings" you are converting, then take a look at http://opencobol.add1tocobol.com/#ebcdic for a super easy 'in COBOL' converter, the OpenCOBOL way. [code] SPECIAL-NAMES. ALPHABET ALPHA IS NATIVE. ALPHABET BETA IS EBCDIC. PROCEDURE DIVISION. INSPECT variable CONVERTING ALPHA TO BETA [/code] Or, for entire files, the ubiquitous [b]dd[/b] utility allows conversion to and from ASCII and EBCDIC. [code] dd if=text.ebcdic of=text.ascii conv=ascii [/code] Or even funkier to convert from 132 column EBCDIC records to line sequential ascii [code] dd if=records.ebcdic cbs=132 of=textfile.ascii conv=ascii [/code] BUT, the big BUT. Only for strings. Packed binary values, and a plethora of other pictorial types will bork big time with this type of byte for byte conversion. Cheers, Brian ---------------------------------------------------------------- Thanks very much for the comments. The file does have packed decimal in it so a whole file conversion using dd doesn't look pretty. I will take a look at the link above for the conversion the opencobol way. Thanks, Steve ---------------------------------------------------------------- Subject: Off-topic: My 16 years old son has just published his first iOS game Hi. I'm proud to announce that my 16 years old son has just published his first iOS game: http://itunes.apple.com/us/app/bomb-rush/id425662533?mt=8&ls=1 It is a milestone in his game developer career, take a look, buy it and enjoy! Please tell a friend! Regards. PD: Sorry guys to post this here after the "spam attac" of last days but I'm too proud to be quiet in the forums I participate. ---------------------------------------------------------------- Congrats to your son! I will tell some ppl I know who love this stuff. Unfortunately I do not have an iPhone. Tell him to keep it up! ---------------------------------------------------------------- Subject: Issue with Compiled Modules ( SOLVED ) Hi folks. I am having some issues with compiling modules. the command line is: [code] cobc -m src/clients.cob src/NoNameIndxdIO.cob [/code] When I execute the .so as [code] $:cobcrun clients.so [/code] I get the following error: [code]libcob: Cannot find module 'InitPath_NoNameIndxd' [/code] If I use the -x and then run the executable everything runs as I expect it to. Since I am running these as cgi I need to compile to module and execute cobcrun *.so. So I am stumped. Any help would be apreciated. cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Feb 08 2011 13:22:28 Packaged Feb 06 2009 10:30:55 CET ---------------------------------------------------------------- Where do you have the Program-ID InitPath_NoNameIndxd defined (I guess you CALL that from clients)? BTW: It should be [code]cobcrun clients[/code] only (no need for a file extension here). human ---------------------------------------------------------------- Hi Human. Yeah I realized that but forgot to update the post. This is what happens: [code]testoc@ernieball:~/occgi.plpwebs.com$ cobcrun clients libcob: Cannot find module 'InitPath_NoNameIndxd' testoc@ernieball:~/occgi.plpwebs.com$ [/code] So as you can see the InitPath_NoNameIndxd module is not found which is in NoNameIndxd.cob. Like I said, if I compile it with a -x instead of -m it works. When I get home tonight I will post the code for you to test. Thanks ************************ After chatting with btiffin this evening prior to posting sample code, he suggested using the -b switch, which as all you super OC users know, combines all inputs into a single dynamic module. So, I learn something new. I may have found it myself if I wasn't trying to do this stuff while at the day job. Just can't help myself in between tasks. Heh Anyway, thanks for taking the time. Cheers! ---------------------------------------------------------------- Subject: Off topic raving about regex. I've been impressed by the power of vim's substitute the last few days and [i]just sayin'[/i]. Add a space to the end of all lines, then correct for empty lines. [code] :%s/$/ / :%s/^ $// [/code] Another: I boned up a quick macro and ended up with this in the LaTeX version of the FAQ. [code] ... \subsection{CHAIN}\index{} \label{CHAIN} Invokes a subprogram, with no return of control implied. The chained program unit virtually becomes the main program within the run unit. \subsection{CHAINING}\index{} \label{CHAINING} ... [/code] Where I missed filling in the index entry for a bunch of the reserved words and topics. Fixed with [code] :%s/\\subsection{\(.*\)}\\index{}/\\subsection{\1}\\index{\1}/ [/code] Yayy. It would have been a fair amount of typing. 418 auto changes for subsections, 43 for sections. Yayy. Cheers, Brian ---------------------------------------------------------------- Subject: COBOL question to INSPECT REPLACING and TRAILING clause Hi folks, I've currently debugged a program and used -ftraceall for that (leading to every statement at runtime being shown in stderr). I've seen a big EVALUATE/CONTINUE loop that seems weird. Looking in the code I found something like that [code] perform varying strpoint2 from 10240 by -1 until strpoint2 = 1 evaluate some-text (strpoint2:1) when space continue when x'0D' when x'0A' move space to some-text (strpoint2:1) when other exit perform end-evaluate end-perform[/code] The code above should replace every x'0D'/x'0A' at the end with spaces (x'0D'/x'0A' within the text should stay). The end of the text can include multiple x'0D'/x'0A', even with spaces between them. If possible it would be nice to have some INSPECT like [code] INSPECT some-text CONVERTING TRAILING x'0D0A20' BY ' ' [/code] but the TRAILING clause is not possible for INSPECT CONVERTING. Using INSPECT with REPLACING one could do [code] 77 count-0d0a-before pic 9(04) value 0 comp-5. 77 count-0d0a-after pic 9(04) value 0 comp-5. [...] perform forever move 0 to count-0d0a-before, count-0d0a-after inspect some-text tallying count-0d0a-before for all x'0D' inspect some-text tallying count-0d0a-before for all x'0A' if count-0d0a-before = 0 exit perform end-if inspect some-text replacing trailing x'0D0A' by ' ' inspect some-text replacing trailing x'0D' by ' ' inspect some-text replacing trailing x'0A' by ' ' inspect some-text tallying count-0d0a-after for all x'0D' inspect some-text tallying count-0d0a-after for all x'0A' if count-0d0a-before = count-0d0a-after exit perform end-if end-perform[/code] This would be bigger code but maybe less running time, at least less output with -ftraceall ;-) (especially if there is no x'0D'/x'0A' at end). Do you see any option of improving this? During research I found that there is no TRAILING clause for INSPECT in any COBOL-Standard I have access to, but it seems that some COBOL vendors support that (at least OC does). human ---------------------------------------------------------------- You are correct that TRAILING is NOT a valid phrase in any ANSI or ISO COBOL Standard (and has been rejected multiple times). Nor (do I beleive) is it "common" extension. The (slightly awkward) way around this in Standard COBOL is to use FUNCTION REVERSE to move the original field to a temp field in reverse order, then use INSPECT with LEADING, then use FUNCITON REVERSE to move the temp field back to the oridinal field. ---------------------------------------------------------------- Thank you for this information and the standard conform workaround. Do you know WHY it was rejected? I guess it's to late for 20xx but maybe it would be possible for the next standard. Do you have any good idea how to simplify the code I've posted? human ---------------------------------------------------------------- Subject: segfault on GOBACK [solved] From See http://www.opencobol.org/modules/newbb/viewtopic.php?viewmode=flat&topic_id=792&forum=1 [quote] "Attempt to reference unallocated memory (Signal SIGSEGV) Abnormal termination - File contents may be incorrect" [/quote] ... [quote] Some idea is about Java garbage collector and variables created in JNI and passed to cobol, but no sure. Here made a change in the GOBACK to EXIT PROGRAM but now the problem is that at reach EXIT PROGRAM instead of exit, the program execute another time and then exit (Execute two times). Taking off the instruction (No exit program, nor Goback, neither Stop run) acts like EXIT PROGRAM. [/quote] ... [quote] The most rare is why after finish fine with right results many calls it crash. [/quote] Could be many things, but you are likely getting an underflow of the return stack. Unfortunately, we need to be able to CALL "thing" RETURNING NULL [b]which we can't in Feb 2009 pre-rel[/b] to account for [b]void[/b] C return types. There are workarounds, in the form of thin wrappers that pass the arguments through calling the void function, and returning an [b]int[/b] to OpenCOBOL. OC assumes that there will be a return value from CALL, and builds code that "properly" cleans up the stack, even if you don't mention RETURNING. Umm, that moves the stack pointers of the process space into more and more dangerous ground. Many calls can put it in highly fragile territory and badness happens. Umm, maybe. If you have no void C functions in the chain, then I'm wrong on this assumption and it is something else, likely in the area of malloc and free, or a writer over a pointer. We can talk more... Cheers, Brian ---------------------------------------------------------------- Hi Brian, Thank you for your advice My case is: javaTest -> JavaJNI -> C -> OC JavaTest do a loop for N records, for every record call a JavaJNI which call a C wrapper for OC program. If OC ends with Goback produce a crash after a while. When I tried EXIT PROGRAM, it doesn't crash, but the program execute twice, I checked with displays and a counter variable. I think could be a bug. Can you tell me how "CANCEL" release resources, because of the memory on multiple calls? Regards, Fernando :hammer: (keep trying) ---------------------------------------------------------------- CANCEL does not release any memory in OC 1.1 as it does the cancel only logical. With Upcoming 2.0 you have an option to set CANCEL releasing everything from this module you CANCEL, resulting in less memory but more run time. How does the C wrapper calls the OC program? At first time it should call cob_init (see cobcrun.c for a wrapper example) and maybe CANCEL the cobol module each time (or not if you have every var that needs to be initialized in LOCAL-STORAGE section [the memory there is release every time the program exits]). And in the case you describe you should use GOBACK as EXIT PROGRAM has only an effect if it was called from another COBOL program. human ---------------------------------------------------------------- Hi Human, thanks for your support. Let me say that same error occurs with EXIT PROGRAM just take more time that GOBACK. In order to surround the problem my cobol program only have one small variable, and in procedure just do some displays and problems doesn't change. Right now we made a another small cobol program which use built-in "CBL_ERROR_PROC" subroutine, so can catch the fail and avoid the crash, first test works. I'll keep testing. I think another test with no java, nor C, just the caller OC program and the called OC program, inside a loop for some cases. Simulating the Java needs. Maybe a following test between C calling the OC program. Do you know if there is something like "cob_init" to use after returning OC? I will keep informing. Regards, Fernando :hammer: ---------------------------------------------------------------- Hm, I think you have two choices: a) Start COBOL outside of the JAVA before running JAVA or start it from JAVA with something like shell execute (however this is called in JAVA) and communicate to it via sockets, resulting in small overhead for sockets. This seems to be the most clear way - but need you to have a socket wrapper/server instead of your current implementation. b) Start COBOL via C-wrapper and call cob_init each time before your program is called, doing cleanup each time afterwards (see cobcrun.c how both should be done) resulting in overhead for initialization/cleanup. human ---------------------------------------------------------------- Hi Human, thank you for help. I don't know anything about sockets, so I think is no option for me. The second one is which we are looking for, indeed we are using "cob_init(0, NULL)" before the OC program. I guess the after cleanup is what we need. But we don't know how. Taking your hint I will lookup in google for some info about "cobcrun.c", but I will thank any more help. In other tests we isolate only OC caller loop many times to another OC and it works fine (similar test as the java). In some case the error occurs in a line with a MOVE. So it is weird. What do you think about change the code in "opencobol/libcob/common.c" when print message ... "Attempt to reference unallocated memory (Signal SIGSEGV) Abnormal termination - File contents may be incorrect" for instead abort give a RETURN-CODE? Regards, Fernando ---------------------------------------------------------------- ... to your question: nothing as this is simply... wrong. you can find cobcrun.c in opencobol tarballs in bin folder... human ---------------------------------------------------------------- Hi Human, As fast as I start lookup I found it inside tar.gz, Thank you. I owe you a beer, and Brian too. Reading code, we have seen the cob_stop_run, cobtidy and COB_EXIT_PROC and can figure how release handlers, we are using the C caller to OC, and returning OC we put the code taken from cob_stop_run, as follow: struct exit_handlerlist *h; if (exit_hdlrs != NULL) { h = exit_hdlrs; while (h != NULL) { h->proc (); h = h->next; } } But when test, in the "if", variable "exit_hdlrs" is NULL. I'm looking trying to understand with some help from a mate here. Can you tell me where to find the GOBACK code, because stop run ends with "exit". I'll keep on this. Regards, Fernado ---------------------------------------------------------------- Hi again, I need your opinion. In common.c the function "cob_stop_run", and "cobtidy" we guess it need a "free" instruction in order to really release the memory. It is right? Code of "cob_stop_run" ... [code] void cob_stop_run (const int status) { struct exit_handlerlist *h; if (exit_hdlrs != NULL) { h = exit_hdlrs; while (h != NULL) { h->proc (); <<<<<--------------------"CHECK HERE. In this place we think it's necessary the "Free", to release the node. h = h->next; } } cob_screen_terminate (); cob_exit_fileio (); exit (status); } [/code] In the system routine "CBL_EXIT_PROC" there is a similar code and it has a "free" instruction. [code] int CBL_EXIT_PROC (unsigned char *x, unsigned char *pptr) { struct exit_handlerlist *hp = NULL; struct exit_handlerlist *h = exit_hdlrs; int (**p)(void) = NULL; COB_CHK_PARMS (CBL_EXIT_PROC, 2); memcpy (&p, &pptr, sizeof (void *)); if (!p || !*p) { return -1; } /* remove handler anyway */ while (h != NULL) { if (h->proc == *p) { if (hp != NULL) { hp->next = h->next; } else { exit_hdlrs = h->next; } if (hp) { free (hp); } break; } hp = h; h = h->next; } if (*x != 0 && *x != 2 && *x != 3) { /* remove handler */ return 0; } h = cob_malloc (sizeof(struct exit_handlerlist)); h->next = exit_hdlrs; h->proc = *p; exit_hdlrs = h; return 0; } [/code] ---------------------------------------------------------------- Need for free? Umm, yes and no. STOP RUN terminates the process space. It's wisest to always free allocated memory, but during run down the entire heap is released back to the operating system anyway. The CBL_EXIT_PROC is installing a new handler, [i]within the nested CALL complexities supported by OpenCOBOL[/i], and that code is ensuring that any old routines (and the associated control structure) are released. So you can loop over a whole bunch of CBL_EXIT_PROC calls and not deplete the heap. That isn't necessary during the actual cob_stop_run, as the fat lady is already singing. It seems from looking, [b]cobtidy[/b] is keeping the handlers installed, as it's not intended for terminating the process image. [i]And having just looked, I might be getting in over my head for this post without a few minutes of study[/i]. So I have to put out a warning that what I'm typing right now might be completely off track. Off topic: One bonus, there is [b]cobcommandline[/b] in common.c. That means invoking big engines like GTK can pass argc and the argv array. [i]Like yayy[/i]. Who knew. ;-) Back on topic: un freed memory should rarely cause a segfault on exit. It'll deplete the heap first. The segfault means that the system is referencing something that it thinks it owns, but doesn't. Perhaps a free called too soon?, but more commonly a null or overwritten pointer. Cheers, Brian ---------------------------------------------------------------- Thank you Brian. About this issue I will keep working on. I will post if I found the cause. I remind you the problem is doing a Call from Java thru JNI and C wrapper to OC program. If we test halfway from C to OC everything is OK, another half from Java to C is ok. Right now I am testing in a new installation, to avoid vicious in the process. Regards, :-? ---------------------------------------------------------------- And when compiling the COBOL sources, use [code] cobc -g -debug [/code] it might put in the right amount of tracer rounds to help you track down the culprit(s). If this starts to drive you wonky, try running the app under [b]gdb[/b], a huge topic I won't go into here, but it'll capture the segfault and maybe even give you a nice stack traceback to ponder over. Another one, especially for named paragraph and section source code styles, is [b]-ftraceall[/b], [i]while debugging[/i], it can get pretty verbose for big programs. That switch is really only of use when your are narrowing down what routine might be to blame in a large(r) app. And for motivation, see the recent post that has Java in the mix, http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1314&forum=1&post_id=6644#forumpost6644 Cheers, Brian ---------------------------------------------------------------- [quote] ... And for motivation, see the recent post that has Java in the mix, http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1314&forum=1&post_id=6644#forumpost6644 Cheers, Brian[/quote] Hello, I apologize in advance,[prior to opening my thread] that I did not first realize this thread was already discussing about calling OC from Java. Though, in my experiment I was using the native Win port of OpenCobol based on VC from Sergey Kashyrin. http://kiska.net/opencobol ---------------------------------------------------------------- No need to apologize in my humble. These are two distinct issues that happen to have a common middle ground. ;-) And, I'll wager that very few of us here can afford the time to read all the posts. It's a huge field and if you don't mind fanboyism, you are adding to the party. Cheers, Brian ---------------------------------------------------------------- This error seems disappeared. I did the following: Take a new computer, with a new installation of OpenSuse, then install OpenCobol 1.1 according to guide. And compiling with it, Over this PC I install the web application and test all. Everything seems ok. The previous fail try was Code compiled with OpenCobol in one machine and move the shared libraries (*.so) to the machine within the web application. In production rules don't permit compile OpenCobol, so I think we must produce de C code and pass it to the server. Thank you everybody. Regards, Fernando. ---------------------------------------------------------------- Subject: ./OCic: symbol lookup error: ./OCic: undefined symbol: cob_display I am getting the above mention message after compiling the OCic from the PDF. I have email Gary on this and still not getting this working anyone have any ideas? [root@Ricks Rick]# cobc -v -x -w -ftraceall -w -t OCic.lst OCic.cbl preprocessing OCic.cbl into /tmp/cob761_0.cob translating /tmp/cob761_0.cob into /tmp/cob761_0.c gcc -pipe -c -I/usr/local/include -Wno-unused -fsigned-char -Wno-pointer-sign -o /tmp/cob761_0.o /tmp/cob761_0.c gcc -pipe -Wl,--export-dynamic -o OCic /tmp/cob761_0.o -L/usr/local/lib -lcob -lm -lgmp -lncurses -ldb -ldl [root@Ricks Rick]# ./OCic PROGRAM-ID: OCic: ENTRY OCic PROGRAM-ID: OCic: 000-Main SECTION PROGRAM-ID: OCic: MAIN PARAGRAPH PROGRAM-ID: OCic Line: 576 Statement: PERFORM PROGRAM-ID: OCic: 100-Initialization SECTION PROGRAM-ID: OCic: 101-Determine-OS-Type PROGRAM-ID: OCic Line: 958 Statement: CALL PROGRAM-ID: GETOSTYPE: ENTRY GETOSTYPE PROGRAM-ID: GETOSTYPE: 000-Main SECTION PROGRAM-ID: GETOSTYPE: 010-Get-TEMP-Var PROGRAM-ID: GETOSTYPE Line: 1668 Statement: MOVE PROGRAM-ID: GETOSTYPE Line: 1669 Statement: ACCEPT PROGRAM-ID: GETOSTYPE Line: 1675 Statement: IF PROGRAM-ID: GETOSTYPE Line: 1678 Statement: MOVE PROGRAM-ID: GETOSTYPE Line: 1679 Statement: INSPECT PROGRAM-ID: GETOSTYPE Line: 1681 Statement: IF PROGRAM-ID: GETOSTYPE Line: 1682 Statement: MOVE PROGRAM-ID: GETOSTYPE Line: 1683 Statement: INSPECT PROGRAM-ID: GETOSTYPE Line: 1685 Statement: IF PROGRAM-ID: GETOSTYPE Line: 1686 Statement: MOVE PROGRAM-ID: GETOSTYPE Line: 1694 Statement: GOBACK PROGRAM-ID: OCic: 102-Set-Environment-Vars PROGRAM-ID: OCic: 104-Generate-Banner-Line-Info PROGRAM-ID: OCic: 105-Establish-Switch-Settings ./OCic: symbol lookup error: ./OCic: undefined symbol: cob_display ---------------------------------------------------------------- I've only witnessed this once. There was a change made to linker naming with underscores (due to differences between C and COBOL naming rules) and some object files can have a mismatch. Add /usr/local/lib to a file in /etc/ld.so.conf.d I use opencobol.conf, contents of the file /usr/local/lib So, /etc/ld.so.conf.d/opencobol.conf will have /usr/local/lib in it. Then [code] sudo ldconfig [/code] to make sure you're dynamic link loader is using the most recent libraries, and Fedora doesn't include /usr/local/lib in the ld search path by default. Or at least, to use libraries in synch with compiler version you are using. If that doesn't work, we'll have to dig a little deeper. Cheers, Brian ---------------------------------------------------------------- Subject: HELP !! I'm a open cobol on linux newbie and a linux newbie. Open Cobol caught my eye and have been playing around with it since. But as you can see in my previous post I am having a problem and Gary Cutler has been trying to help me sort it out, but alas he isn't a linux user and couldn't help me much here. I'm also using Fedora 14 x86_64. Just to make it simple I am using the hello program to show the problem. the hello.cbl source; IDENTIFICATION DIVISION. PROGRAM-ID. hello. PROCEDURE DIVISION. DISPLAY "Hello World!". STOP RUN. and now the compile and run; [root@Ricks Rick]# cobc -x hello.cbl [root@Ricks Rick]# ./hello ./hello: symbol lookup error: ./hello: undefined symbol: cob_display [root@Ricks Rick]# [Rick@Ricks ~]$ cobc --version cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Apr 02 2011 15:44:54 Packaged Feb 06 2009 10:30:55 CET According to Gary the cob_display entry point is in "termio.c" which is being used in building the "libcob" run-time library routine when the building opencobol. He also stated The fact that I'm getting this message tells me that the libcob.so module isn't getting found at runtime. Which by the way is in /usr/local/lib. Can anyone give me a suggestion on how to fix this? ---------------------------------------------------------------- Welcome to OpenCOBOL and this board. Did you do ldconfig as root as written in the README? What happens if you compile the program without -x and run [code]cobcrun hello[/code] after compilation? human BTW: Please change the title of this thread to something like "HELP, undefined symbol cob_display (libcob not found?)" by editing your first post in this thread. ---------------------------------------------------------------- This might help: try typing cob-config --libs at a command prompt to see what libraries you are set up to use. Here is the output I get: -L/usr/local/lib -lcob -lm -lgmp -lncurses -ldb If you do not get most of this or a different location for the library than -L/usr/local/lib If this does not help, you might want to try reinstalling Open Cobol from the Fedora repository. I had trouble installing Open Cobol 1.1 on Debian, so I installed version 1.0 from the Debian repository, then installed version 1.1 on top to get the extra features. ---------------------------------------------------------------- Add /usr/local/lib to a file in /etc/ld.so.conf.d I use opencobol.conf, contents of the file /usr/local/lib So, [i]/etc/ld.so.conf.d/opencobol.conf[/i] will have [b]/usr/local/lib[/b] in it. Then run [code] sudo ldconfig [/code] Fedora doesn't seem to include /usr/local/lib in the ld search path by default. Cheers, Brian ---------------------------------------------------------------- Subject: Building JNI with C/C++ and OpenCobol? Hello, I was wondering, has anyone succeeded in building a running OC/C Java Native Interface (JNI) executable? Well, I have done some experiencing with Visual C++ and got an initial working version. Basically, I created a sample OC program and imported the generated C code from the compiler into my project. Of course, the VC project included the generated JNI includes as well. However, I took the following three layer approach, in which I created the Java class, then build the corresponding JNI/C functions in one DLL, and finally build a separate DLL which incorporates the OC code. Here are the components which follows: 1. Supplies.java – which contains the native method: saveVendor() 2. The corresponding Supplies.dll was build from Supplies.cpp & dllmain.cpp (Windows specific events). ** as note, the JVM parameter "-Djava.library.path=" can be used, to located the Supplies.dll 3. The Supplies.dll then loads and executes SupplyData.dll - This dll incorporates the OC generated code - Also, includes dllmain.cpp which includes the event to initiate the Cobol runtime when the DLL is first loaded. *** However, the SupplyData and the OpenCobol modules must be specified the in current path, otherwise this runtime will fail. --- Here are the code fragments part one, the java class [code] public class Supplies { static { System.loadLibrary("Supplies"); } /** * @param args */ public static void main(String[] args) { try { saveVendor("vm01","VMarcus Inc","2300 Main","Stringfield","IN" ,"123456","5557771234",null); saveVendor("vi01","Virtual Vendor","123 South Ave","Smallville" ,"IN","123456","5551234567","Mr. Marco"); } catch (Exception ex) { ex.printStackTrace(); } } private static native int saveVendor(String vKey, String name , String address, String city, String state, String zipCode , String telephone, String contact); // to be implemented later //private static native int saveVendor(String...args); //private static native int saveItem(String...args); //private static native int saveLocation(String...args); } [/code] part 2, code for the Supplies.dll supplies.h [code] /* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class Supplies */ #ifndef _Included_Supplies #define _Included_Supplies #ifdef __cplusplus extern "C" { #endif /* * Class: Supplies * Method: saveVendor * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String; * Ljava/lang/String;Ljava/lang/String;Ljava/lang/String; * Ljava/lang/String;Ljava/lang/String;)I */ JNIEXPORT jint JNICALL Java_Supplies_saveVendor (JNIEnv *, jclass, jstring, jstring, jstring, jstring, jstring, jstring, jstring, jstring); #ifdef __cplusplus } #endif #endif [/code] supplies.cpp [code] // Supplies.cpp : Defines the exported functions for the DLL application. // This is the Java Native Interface (JNI) for Supplies.java #include "stdafx.h" #include "Supplies.h" #include "GlobalObject.h" #define Thread __declspec(thread) #define evalField(dst,src) dst,sizeof(dst),src Thread GlobalInstanceObj *_global = NULL; typedef int (__cdecl *MAINPGM)(char *); //Main program typedef int (__cdecl *ENTRY01)(char *,char *); //Secondary Entry point struct SupplyDataFunctions { //Maintain Function pointers MAINPGM ocSupply; ENTRY01 vendor; }; # pragma pack(push) # pragma pack(1) //align all fields on single byte boundary struct InventoryVendorStruct { // C version of Cobol Layout char code[4]; char name[30]; char address[30]; char city[17]; char state[2]; char zipCode[9]; char telephone[10]; char contact[30]; char _filler; // Dummy Terminator - may not be needed? }; # pragma pack(pop) //restore back to default alignment /**** * The following inline function simply copies the Java String over to * C/C++ characters. Validates for a null pointer and governs the * amount of characters copied. ****/ inline void setField(JNIEnv *env, char *str, int ilen, jstring jstr) { int len; if (jstr != NULL) { len = env->GetStringUTFLength(jstr); memcpy(str,env->GetStringUTFChars(jstr,0),min(ilen,len)); } }; JNIEXPORT jint JNICALL Java_Supplies_saveVendor (JNIEnv *env, jclass cls, jstring vKey, jstring name, jstring address , jstring city, jstring state, jstring zipCode, jstring telephone , jstring contact) { char option[2] = " "; // Simple dummy option for the time being. SupplyDataFunctions *funct = (SupplyDataFunctions *)_global->fpointers(); if (_global->errTxt != NULL) { // Generate Java Exception on Error jclass exception = env->FindClass("java/lang/RuntimeException"); env->ThrowNew(exception,_global->errTxt); return 1; } int rc = 0; struct InventoryVendorStruct cobRec; memset(&cobRec,' ',sizeof(cobRec)); // initialize to spaces cobRec._filler = 0x00; // Zero terminator //Populate fields in Layout with data extracted from Java setField(env,evalField(cobRec.code,vKey)); setField(env,evalField(cobRec.name,name)); setField(env,evalField(cobRec.address,address)); setField(env,evalField(cobRec.city,city)); setField(env,evalField(cobRec.state,state)); setField(env,evalField(cobRec.zipCode,zipCode)); setField(env,evalField(cobRec.telephone,telephone)); setField(env,evalField(cobRec.contact,contact)); rc = funct->vendor(option,(char *)&cobRec); // Execute Cobol code return rc; }; /***** * * Loads instance of DLL & locate individual functions with DLL. * ****/ GlobalInstanceObj::GlobalInstanceObj() { printf(" Hello, initiating instance...\n"); errTxt = NULL; hinstLib = LoadLibrary(TEXT("SupplyData")); if (hinstLib == NULL) { errTxt = "Error: DLL - SupplyData not found"; return; } SupplyDataFunctions *functs = NULL; iptrs = functs = new SupplyDataFunctions; functs->ocSupply = (MAINPGM) GetProcAddress(hinstLib, "ocSupply"); if (functs->ocSupply == NULL) { errTxt = "Error: could not find program - ocSupply"; return; } functs->vendor = (ENTRY01) GetProcAddress(hinstLib, "VENDOR"); if (functs->vendor == NULL) errTxt = "Error: could not find entry - VENDOR"; }; GlobalInstanceObj::~GlobalInstanceObj() { // Free the DLL module. fFreeResult = FreeLibrary(hinstLib); printf(" Releasing, instance...\n"); }; void *GlobalInstanceObj::fpointers() { return iptrs; }; [/code] Remaining code for Supplies.dll - GlobalObject.h & dllmain.cpp [code] class GlobalInstanceObj { HINSTANCE hinstLib; //Local instance of DLL library BOOL fFreeResult; void *iptrs; // pointer of individual function pointers public: GlobalInstanceObj(); ~GlobalInstanceObj(); void *fpointers(); char *errTxt; }; // dllmain.cpp : Defines the entry point for the DLL application. // for Supplies.cpp - Dynamic Link Library #include "stdafx.h" #include "GlobalObject.h" #define Thread __declspec(thread) extern Thread GlobalInstanceObj *_global; //Global Thread Object BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: _global = new GlobalInstanceObj(); break; case DLL_THREAD_ATTACH: _global = new GlobalInstanceObj(); //Added 4/6/2011 break; case DLL_THREAD_DETACH: delete _global; //Added 4/6/2011 break; case DLL_PROCESS_DETACH: delete _global; break; } return TRUE; } [/code] And final, the third part - dllmain.cpp - entry point into SupplyData [code] // dllmain.cpp : Defines the entry point for the DLL application. // associated with the SupplyData DLL // The OpenCobol modules are linked into this DLL #include "stdafx.h" #include <stdio.h> #include <libcob.h> BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: printf(" Initiating Cobol Environment\n"); cob_init(0, NULL); break; case DLL_THREAD_ATTACH: printf("!Warning: Thread was started, but not thread safe\n"); break; case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: printf("... Detaching from process\n"); break; } return TRUE; } [/code] And the actual Cobol code [code] IDENTIFICATION DIVISION. PROGRAM-ID. ocSupply. AUTHOR. M.WILLIAMS. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. WINDOWS. OBJECT-COMPUTER. WINDOWS. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-RUN-STATE PIC X VALUE '1'. 88 FIRST-TIME VALUE '1'. LINKAGE SECTION. 01 LS-OPTION PIC X. 01 LS-VENDOR-RECORD. 05 LS-VENDOR-CODE PIC X(04). 05 LS-VENDOR-NAME PIC X(30). 05 LS-VENDOR-ADDRESS PIC X(30). 05 LS-VENDOR-CITY PIC X(17). 05 LS-VENDOR-STATE PIC XX. 05 LS-VENDOR-ZIP-CODE PIC X(09). 05 LS-VENDOR-TELEPHONE PIC X(10). 05 LS-VENDOR-CONTACT PIC X(30). PROCEDURE DIVISION USING LS-OPTION. BEGIN. IF FIRST-TIME * PERFORM 1000-INITIALIZE MOVE '2' TO WS-RUN-STATE END-IF GOBACK . * *VENDOR entry point ENTRY "VENDOR" USING LS-OPTION, LS-VENDOR-RECORD * IF FIRST-TIME * PERFORM 1000-INITIALIZE DISPLAY " First Time entering into ocSupply..." MOVE '2' TO WS-RUN-STATE END-IF DISPLAY "CODE: " LS-VENDOR-CODE DISPLAY "NAME: " LS-VENDOR-NAME DISPLAY "ADDRESS: " LS-VENDOR-ADDRESS DISPLAY "CITY: " LS-VENDOR-CITY DISPLAY "STATE: " LS-VENDOR-STATE DISPLAY "ZIP CODE: " LS-VENDOR-ZIP-CODE DISPLAY "PHONE: " LS-VENDOR-TELEPHONE DISPLAY "CONTACT: " LS-VENDOR-CONTACT DISPLAY " " MOVE ZERO TO RETURN-CODE GOBACK . [/code] And here is the output: First Time entering into ocSupply... CODE: vm01 NAME: VMarcus Inc ADDRESS: 2300 Main CITY: Stringfield STATE: IN ZIP CODE: 123456 PHONE: 5557771234 CONTACT: CODE: vi01 NAME: Virtual Vendor ADDRESS: 123 South Ave CITY: Smallville STATE: IN ZIP CODE: 123456 PHONE: 5551234567 CONTACT: Mr. Marco Hello, initiating instance... Initiating Cobol Environment ... Detaching from process ---------------------------------------------------------------- Threads!!! :-( Initially, I thought I was OK, until I started experimenting with multiple threads. I realize, I have a number of items to clean up, but I’m wondering about the application of Local Thread Storage. However, does the cob_init() function, initialize other variables outside of “Global Variables” from the include files generated by the OC compiler? Does it matter, if the translated OC code were compiled as C++ as opposed to straight C, while in the VC++ environment? ---------------------------------------------------------------- First; this is a pretty cool post. I'd like to add it to the FAQ. Second; Yeah, OC is definitely going to give you threading headaches. Not insurmountable, but a hassle that will require programmer care and attention. Umm, without thinking, I might try IS RECURSIVE and LOCAL-STORAGE (See http://opencobol.add1tocobol.com/#does-opencobol-support-recursion) for a sample. [i]But to be honest, I'd half expect that to explode in rainbow coloured fail.[/i] Third; A quick scan of libcob/common.c for cob_init, it doesn't look like it does anything "outside" it's box. But being me, I'll add that my view of the box may not match yours. Fourth; I've run generated C code through the ROOT/CINT interpreter with no problems (and much fun) and linked in the C++ Falcon scripting with just as much fun and no "quick tour" problems. [i]By that I mean they worked, but I never tested launching any rockets or running a bank.[/i] See http://opencobol.add1tocobol.com/#can-opencobol-interface-with-root-cint for the ROOT/CINT sample and http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1221&forum=1&post_id=6113#forumpost6113 for the Falcon blurb Fifth; If your first name is Mark, I'll be a fan by indirect association, as Coherent was my favourite thing before Linus unleashed his kernel. (The Mark Williams Company has no direct link to the name, it was a play on Robert Swartz's dad's name, but still. Nostalgia.) ;-) Cheers, Brian ---------------------------------------------------------------- Hi, In the JNI specs. basically says using JNI needs to synchronize. You synchronize the method's invoke or the method itself. In your Java class try somethig as: [code] public class Supplies { static { System.loadLibrary("Supplies"); } /** * @param args */ public static void main(String[] args) { try { for (int i=0; i < 10000; i++) { synchronized("test") { saveVendor("vm01-"+i,"VMarcus Inc","2300 Main","Stringfield","IN","123456","5557771234",null); } } catch (Exception ex) { ex.printStackTrace(); } } private static native int saveVendor(String vKey, String name , String address, String city, String state, String zipCode , String telephone, String contact); } [/code] The syncronize affect the performance but it still is good performance. I suggest you test doing multiple JNI calls to OC programs, as a test battery (or a test loop). I hope it help. ---------------------------------------------------------------- [quote] btiffin wrote: First; this is a pretty cool post. I'd like to add it to the FAQ. Cheers, Brian[/quote] Thanks, sure. Though, I would hope to see a Unix variation as well, some day. :-) ---------------------------------------------------------------- Subject: Code compiled in OC 1.1 built Apr.6,2011 17:13 fail when try to link as Shared library (".so") In OC version 1.1 built Oct.6,2010 it works ok. My code is some complex, so I decide to test as manual says, and next I explain it. Error message: /usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/bin/ld: one.o: relocation R_X86_64_32S against `.data' can not be used when making a shared object; recompile with -fPIC one.o: could not read symbols: Bad value collect2: ld returned 1 exit status Easily reproducible. Just following the manual link "http://www.opencobol.org/modules/bwiki/index.php?cmd=read&page=UserManual%2F2_2#content_1_2" section "Building Library" The test code is very simple. Two similar programs which works fine alone. Commands in console: $ cobc -c one.cbl $ cobc -c two.cbl $ gcc -fPIC -shared -o sharedlib.so one.o two.o As allways thank you Program One [code] IDENTIFICATION DIVISION. PROGRAM-ID. one. ENVIRONMENT DIVISION. DATA DIVISION. LINKAGE SECTION. 01 HELLO PIC X(6). 01 WORLD PIC X(6). PROCEDURE DIVISION USING HELLO WORLD. DISPLAY HELLO WORLD. EXIT PROGRAM. [/code] Program Two [code] IDENTIFICATION DIVISION. PROGRAM-ID. two. ENVIRONMENT DIVISION. DATA DIVISION. LINKAGE SECTION. 01 HELLO PIC X(6). 01 WORLD PIC X(6). PROCEDURE DIVISION USING HELLO WORLD. DISPLAY HELLO WORLD. EXIT PROGRAM. [/code] ---------------------------------------------------------------- 1st: please change the information in your post and the subject to "packaged" instead of "build" as this is the relevant information. I guess you use the Feb09 tarball. Just a quick look at your problem makes me wonder why you didn't use cobc -o sharedlib.so one.o two.o Another thing to wonder: in the sample you've posted there is no call at all, therefore there can't be any static linking. I think you may either missed the main COBOL or C program in your post. human ---------------------------------------------------------------- Hi Human, thank you for your help. I changed the "subject" but when I use "cobc -V" it shows Pack Feb.6,2009 10:30 - Built Apr.6,2011 17:13 The another OC installation shows same Pack Date and different Built Date, I guess Built Date is about installation, Isn't it? Trying as you suggest fail too with another message, I will check if there is something to fix. Basically I followed the sample in the link I posted before. I keep on this. Fernando ---------------------------------------------------------------- Hi, If I try gcc with no "-shared" it need a Main. As shared lib no needs Main. And can be called later. Thanks, Fernando ---------------------------------------------------------------- Hi, I found the problem. Basically it's because I'm using a Linux 64bits, the problem is not in Open Cobol, neither gcc. The error message is [quote] relocation R_X86_64_32S against `.data' can not be used when making a shared object; recompile with -fPIC one.o: could not read symbols: Bad value collect2: ld returned 1 exit status [/quote] This is a Library Load("ld") problem because in order to produce a "shared" library (".so") in 64bits "gcc" needs all the C programs compiled with "-fPIC" additional param. Compiling as follow in 32bits works fine, 64bits fail. This compile with OC producing "one.o" (C compiled) and then compile with "gcc" to produce "testlib.so". [code] cobc -c one.cbl gcc -shared -fPIC -o testlib.so one.o [/code] In 64bits is necessary as follows ... This compile with OC producing "one.c" (C source), then compile C source with "gcc -fPIC" and last compile with "gcc" to produce "testlib.so". [code] cobc -C one.cbl gcc -c -fPIC one.c gcc -shared -fPIC -o testlib.so one.o [/code] Regards, Fernando. :-D ---------------------------------------------------------------- Subject: SMTP/POP3 C Library I was wondering if anyone has done any work with e-mail and OC. I am assuming it is accomplished using c libraries for SMTP/POP3 libraries. If you have, do you have a recommendation of c library and any example coding? Thanks a mil! Damon ---------------------------------------------------------------- @damonh We use sendmail in the debian world. Our routines are setup as copybooks (data, procedure). I can send them to you if you wish. jimc ---------------------------------------------------------------- And I'd like to maybe delve back into occurlrefresh and see how much tweaking it takes to turn a downloader into a mail client. Not much I'll bet. libCURL is funky cool. Cheers, Brian ---------------------------------------------------------------- Hello Jim, Can You send me your copybooks if you don't mind My world is Debian Best regards Francois ---------------------------------------------------------------- First a little bit of Brian's humor: Francois I am confused -- are you a Lyon or are you a Bear :-) I do not have your e-mail address so I am taking the risk of posting the code to the forum. The code is not pretty -- we have never gotten around to cleaning it up -- but it works quite well every day. You will note that we stayed out of C and kept it all in OpenCOBOL. First the data division stuff: [code] ***************************************************** * VARIABLE COPYLIB FOR SENDMAIL-PROCEDURES.CPY * * * * VERSION 001--ORIGINAL VERSION * * 1266048--JIM CURREY * * 06/03/2009--MARC RODRIGUEZ * * VERSION 002--CHANGED TO CORRECTLY COMPARE NULL * * POINTERS. * * 1266048--JIM CURREY * * 08/05/2009-MARC RODRIGUEZ * ***************************************************** * THE FOLLOWING VARIABLES MUST BE NULL TERMINATED! 01 MAIL-TO-ADDRESS PIC X(64). 01 MAIL-SUBJECT PIC X(50). 01 MAIL-FROM-ADDRESS PIC X(64). 01 MAIL-FROM-FULL-NAME PIC X(50). 01 MAIL-BODY-LINE PIC X(256). * END OF NULL TERMINATED VARS * * MAIL-OUTPUT-RECORD MUST BE 2 CHARS LARGER THAN * MAIL-BODY-LINE! 01 MAIL-OUTPUT-RECORD PIC X(258). 01 MAIL-RETURN USAGE BINARY-LONG. * MAIL-ERROR-TEXT WILL BE POPULATED IF AND WHEN AN ERROR OCCURS 01 MAIL-ERROR-TEXT PIC X(80). 01 MAIL-COMMAND-LINE PIC X(256). 01 MAIL-TEMP-FILE-POINTER USAGE POINTER. 080509 01 MAIL-DUMMY-POINTER USAGE POINTER. 01 MAIL-TEMP-FILE-NAME PIC X(256). 01 MAIL-TEMP-FILE-MODE PIC X VALUE "w". * THESE WILL BE USED AS A GENERIC CHAR * (POINTER) FOR * OUR CALLS TO C 01 MAIL-POINTER USAGE POINTER. 01 MAIL-POINTER-2 USAGE POINTER. [/code] Next the procedure division stuff: [code] ***************************************************** * WILL SEND A PLAIN-TEXT EMAIL VIA SENDMAIL * * * * VERSION 001--ORIGINAL VERSION * * 1266048--JIM CURREY * * 06/03/2009--MARC RODRIGUEZ * * VERSION 002--ADDED STANDARDS WARNING COMMENT. * * 1343662--JIM CURREY * * 02/23/2010--JOSE ROSADO * * VERSION 003--CORRECTS HANDLING OF ERRORS - ON THE* * FIRST ERROR, WE EXIT THE ROUTINE AND* * ALLOW THE CALLING PROGRAM TO HANDLE * * DISPLAYING THE ERROR (SEE /private- * * set-1/progroot/task/source/ * * task_entry.cbl * * 1352525--SANDY DOSS * * 07/01/2011--SANDY DOSS * ***************************************************** * BE ADVISED! THIS CODE IS NOT UP TO STANDARDS! THE * * FACT THIS CODE EXISTS AS IT IS DOES NOT AUTHORIZE * * THE USE OF SIMILAR CODE IN FUTURE PROGRAMS! * * --J.C. CURREY * ***************************************************** * MAIL-INIT * * * * ROUTINE WILL SETUP EMAIL * * REQUIRES: MAIL-TO-ADDRESS * * MAIL-SUBJECT * * MAIL-FROM-ADDRESS * ***************************************************** MAIL-INIT. MOVE SPACES TO MAIL-ERROR-TEXT. 080509 INITIALIZE MAIL-DUMMY-POINTER. IF MAIL-TO-ADDRESS IS EQUAL TO SPACES THEN MOVE "MISSING TO-ADDRESS" TO MAIL-ERROR-TEXT GO TO MAIL-INIT-EXIT. IF MAIL-SUBJECT IS EQUAL TO SPACES THEN MOVE "MISSING SUBJECT" TO MAIL-ERROR-TEXT GO TO MAIL-INIT-EXIT. IF MAIL-FROM-ADDRESS IS EQUAL TO SPACES THEN MOVE "MISSING FROM-ADDRESS" TO MAIL-ERROR-TEXT GO TO MAIL-INIT-EXIT. * MAIL-POINTER NOW POINTS TO MAIL-TEMP-FILE-NAME MOVE ADDRESS OF MAIL-TEMP-FILE-NAME TO MAIL-POINTER. CALL "tmpnam" USING BY VALUE MAIL-POINTER. * MAIL-POINTER-2 NOW POINTS TO MAIL-TEMP-FILE-MODE MOVE ADDRESS OF MAIL-TEMP-FILE-MODE TO MAIL-POINTER-2. CALL "fopen" USING BY VALUE MAIL-POINTER BY VALUE MAIL-POINTER-2 RETURNING MAIL-TEMP-FILE-POINTER. 080509* IF MAIL-TEMP-FILE-POINTER IS EQUAL TO ZERO 080509 IF MAIL-TEMP-FILE-POINTER IS EQUAL TO MAIL-DUMMY-POINTER THEN MOVE "UNABLE TO OPEN TEMP FILE" TO 070111* MAIL-ERROR-TEXT. 070111 MAIL-ERROR-TEXT 070111 GO TO MAIL-INIT-EXIT. MAIL-WRITE-HEADERS. MOVE SPACES TO MAIL-BODY-LINE. STRING "To: " DELIMITED BY SIZE MAIL-TO-ADDRESS DELIMITED BY LOW-VALUE X"0A" DELIMITED BY SIZE X"00" DELIMITED BY SIZE INTO MAIL-BODY-LINE. CALL "fputs" USING MAIL-BODY-LINE BY VALUE MAIL-TEMP-FILE-POINTER RETURNING MAIL-RETURN. IF MAIL-RETURN IS LESS THAN OR EQUAL TO ZERO THEN MOVE "ERROR WRITING TO TEMPORARY FILE" TO 070111* MAIL-ERROR-TEXT. 070111 MAIL-ERROR-TEXT 070111 GO TO MAIL-INIT-EXIT. * MOVE SPACES TO MAIL-BODY-LINE. STRING "Subject: " DELIMITED BY SIZE MAIL-SUBJECT DELIMITED BY LOW-VALUE X"0A" DELIMITED BY SIZE X"00" DELIMITED BY SIZE INTO MAIL-BODY-LINE. CALL "fputs" USING MAIL-BODY-LINE BY VALUE MAIL-TEMP-FILE-POINTER RETURNING MAIL-RETURN. IF MAIL-RETURN IS LESS THAN OR EQUAL TO ZERO THEN MOVE "ERROR WRITING TO TEMPORARY FILE" TO 070111* MAIL-ERROR-TEXT. 070111 MAIL-ERROR-TEXT 070111 GO TO MAIL-INIT-EXIT. * MOVE SPACES TO MAIL-BODY-LINE. STRING "Body: " DELIMITED BY SIZE X"0A" DELIMITED BY SIZE X"00" DELIMITED BY SIZE INTO MAIL-BODY-LINE. CALL "fputs" USING MAIL-BODY-LINE BY VALUE MAIL-TEMP-FILE-POINTER RETURNING MAIL-RETURN. IF MAIL-RETURN IS LESS THAN OR EQUAL TO ZERO THEN MOVE "ERROR WRITING TO TEMPORARY FILE" TO MAIL-ERROR-TEXT. MAIL-INIT-EXIT. EXIT. ***************************************************** * MAIL-WRITE-BODY-LINE * * * * WILL WRITE A SINGLE LINE OF TEXT TO AN EMAIL * * MAIL-INIT MUST BE PERFORMED BEFORE THIS ROUTINE! * ***************************************************** MAIL-WRITE-BODY-LINE. MOVE SPACES TO MAIL-ERROR-TEXT, MAIL-OUTPUT-RECORD. 080509* IF MAIL-TEMP-FILE-POINTER IS EQUAL TO ZERO 080509 IF MAIL-TEMP-FILE-POINTER IS EQUAL TO MAIL-DUMMY-POINTER THEN MOVE "INVALID TEMP FILE POINTER" TO MAIL-ERROR-TEXT GO TO MAIL-WRITE-BODY-LINE-EXIT. STRING MAIL-BODY-LINE DELIMITED BY LOW-VALUE X"0A" DELIMITED BY SIZE X"00" DELIMITED BY SIZE INTO MAIL-OUTPUT-RECORD. CALL "fputs" USING MAIL-OUTPUT-RECORD BY VALUE MAIL-TEMP-FILE-POINTER RETURNING MAIL-RETURN. IF MAIL-RETURN IS LESS THAN OR EQUAL TO ZERO THEN MOVE "ERROR WRITING TO TEMPORARY FILE" TO MAIL-ERROR-TEXT. MAIL-WRITE-BODY-LINE-EXIT. EXIT. ***************************************************** * MAIL-SEND * * * * WILL ACTUALLY SEND THE EMAIL; ENDING THE PROCESS * ***************************************************** MAIL-SEND. MOVE SPACES TO MAIL-BODY-LINE. STRING "." DELIMITED BY SIZE X"0A" DELIMITED BY SIZE X"00" DELIMITED BY SIZE INTO MAIL-BODY-LINE. CALL "fputs" USING MAIL-BODY-LINE BY VALUE MAIL-TEMP-FILE-POINTER RETURNING MAIL-RETURN. IF MAIL-RETURN IS LESS THAN OR EQUAL TO ZERO THEN MOVE "ERROR WRITING TO TEMPORARY FILE" TO 070111* MAIL-ERROR-TEXT. 070111 MAIL-ERROR-TEXT 070111 GO TO MAIL-SEND-EXIT. * CALL "fclose" USING BY VALUE MAIL-TEMP-FILE-POINTER RETURNING MAIL-RETURN. 070111 IF MAIL-RETURN IS NOT EQUAL TO ZERO 070111* MAIL-ERROR-TEXT. THEN MOVE "ERROR CLOSING TEMPORARY FILE" TO 070111 MAIL-ERROR-TEXT 070111 GO TO MAIL-SEND-EXIT. * MAIL-POINTER NOW POINTS TO MAIL-BODY-LINE! MOVE ADDRESS OF MAIL-BODY-LINE TO MAIL-POINTER. MAIL-SEND-COMMAND. MOVE SPACES TO MAIL-COMMAND-LINE. STRING 'cat ' DELIMITED BY SIZE MAIL-TEMP-FILE-NAME DELIMITED BY LOW-VALUE ' | /usr/sbin/sendmail -t -f "' DELIMITED BY SIZE MAIL-FROM-ADDRESS DELIMITED BY LOW-VALUE '" -F "' DELIMITED BY SIZE MAIL-FROM-FULL-NAME DELIMITED BY LOW-VALUE '"' DELIMITED BY SIZE INTO MAIL-COMMAND-LINE. CALL "SYSTEM" USING MAIL-COMMAND-LINE RETURNING MAIL-RETURN. 070111 IF MAIL-RETURN IS GREATER THAN ZERO THEN MOVE "ERROR OCCURRED SENDING EMAIL" TO 070111* MAIL-ERROR-TEXT. 070111 MAIL-ERROR-TEXT 070111 GO TO MAIL-SEND-EXIT. MAIL-SEND-CLEANUP. * MAIL-POINTER NOW POINTS TO MAIL-TEMP-FILE-NAME MOVE ADDRESS OF MAIL-TEMP-FILE-NAME TO MAIL-POINTER. CALL "remove" USING BY VALUE MAIL-POINTER RETURNING MAIL-RETURN. IF MAIL-RETURN IS NOT EQUAL TO ZERO THEN MOVE "UNABLE TO DELETE TEMP FILE" TO MAIL-ERROR-TEXT. MAIL-SEND-EXIT. EXIT. [/code] Then the program we used to test it: [code] ***************************************************** * WILL SEND A PLAIN-TEXT EMAIL VIA SENDMAIL * * * * VERSION 001--ORIGINAL VERSION * * 1266048--JIM CURREY * * 06/03/2009--MARC RODRIGUEZ * * VERSION 002--ADDED STANDARDS WARNING COMMENT. * * 1343662--JIM CURREY * * 02/23/2010--JOSE ROSADO * * VERSION 003--CORRECTS HANDLING OF ERRORS - ON THE* * FIRST ERROR, WE EXIT THE ROUTINE AND* * ALLOW THE CALLING PROGRAM TO HANDLE * * DISPLAYING THE ERROR (SEE /private- * * set-1/progroot/task/source/ * * task_entry.cbl * * 1352525--SANDY DOSS * * 07/01/2011--SANDY DOSS * ***************************************************** * BE ADVISED! THIS CODE IS NOT UP TO STANDARDS! THE * * FACT THIS CODE EXISTS AS IT IS DOES NOT AUTHORIZE * * THE USE OF SIMILAR CODE IN FUTURE PROGRAMS! * * --J.C. CURREY * ***************************************************** * MAIL-INIT * * * * ROUTINE WILL SETUP EMAIL * * REQUIRES: MAIL-TO-ADDRESS * * MAIL-SUBJECT * * MAIL-FROM-ADDRESS * ***************************************************** MAIL-INIT. MOVE SPACES TO MAIL-ERROR-TEXT. 080509 INITIALIZE MAIL-DUMMY-POINTER. IF MAIL-TO-ADDRESS IS EQUAL TO SPACES THEN MOVE "MISSING TO-ADDRESS" TO MAIL-ERROR-TEXT GO TO MAIL-INIT-EXIT. IF MAIL-SUBJECT IS EQUAL TO SPACES THEN MOVE "MISSING SUBJECT" TO MAIL-ERROR-TEXT GO TO MAIL-INIT-EXIT. IF MAIL-FROM-ADDRESS IS EQUAL TO SPACES THEN MOVE "MISSING FROM-ADDRESS" TO MAIL-ERROR-TEXT GO TO MAIL-INIT-EXIT. * MAIL-POINTER NOW POINTS TO MAIL-TEMP-FILE-NAME MOVE ADDRESS OF MAIL-TEMP-FILE-NAME TO MAIL-POINTER. CALL "tmpnam" USING BY VALUE MAIL-POINTER. * MAIL-POINTER-2 NOW POINTS TO MAIL-TEMP-FILE-MODE MOVE ADDRESS OF MAIL-TEMP-FILE-MODE TO MAIL-POINTER-2. CALL "fopen" USING BY VALUE MAIL-POINTER BY VALUE MAIL-POINTER-2 RETURNING MAIL-TEMP-FILE-POINTER. 080509* IF MAIL-TEMP-FILE-POINTER IS EQUAL TO ZERO 080509 IF MAIL-TEMP-FILE-POINTER IS EQUAL TO MAIL-DUMMY-POINTER THEN MOVE "UNABLE TO OPEN TEMP FILE" TO 070111* MAIL-ERROR-TEXT. 070111 MAIL-ERROR-TEXT 070111 GO TO MAIL-INIT-EXIT. MAIL-WRITE-HEADERS. MOVE SPACES TO MAIL-BODY-LINE. STRING "To: " DELIMITED BY SIZE MAIL-TO-ADDRESS DELIMITED BY LOW-VALUE X"0A" DELIMITED BY SIZE X"00" DELIMITED BY SIZE INTO MAIL-BODY-LINE. CALL "fputs" USING MAIL-BODY-LINE BY VALUE MAIL-TEMP-FILE-POINTER RETURNING MAIL-RETURN. IF MAIL-RETURN IS LESS THAN OR EQUAL TO ZERO THEN MOVE "ERROR WRITING TO TEMPORARY FILE" TO 070111* MAIL-ERROR-TEXT. 070111 MAIL-ERROR-TEXT 070111 GO TO MAIL-INIT-EXIT. * MOVE SPACES TO MAIL-BODY-LINE. STRING "Subject: " DELIMITED BY SIZE MAIL-SUBJECT DELIMITED BY LOW-VALUE X"0A" DELIMITED BY SIZE X"00" DELIMITED BY SIZE INTO MAIL-BODY-LINE. CALL "fputs" USING MAIL-BODY-LINE BY VALUE MAIL-TEMP-FILE-POINTER RETURNING MAIL-RETURN. IF MAIL-RETURN IS LESS THAN OR EQUAL TO ZERO THEN MOVE "ERROR WRITING TO TEMPORARY FILE" TO 070111* MAIL-ERROR-TEXT. 070111 MAIL-ERROR-TEXT 070111 GO TO MAIL-INIT-EXIT. * MOVE SPACES TO MAIL-BODY-LINE. STRING "Body: " DELIMITED BY SIZE X"0A" DELIMITED BY SIZE X"00" DELIMITED BY SIZE INTO MAIL-BODY-LINE. CALL "fputs" USING MAIL-BODY-LINE BY VALUE MAIL-TEMP-FILE-POINTER RETURNING MAIL-RETURN. IF MAIL-RETURN IS LESS THAN OR EQUAL TO ZERO THEN MOVE "ERROR WRITING TO TEMPORARY FILE" TO MAIL-ERROR-TEXT. MAIL-INIT-EXIT. EXIT. ***************************************************** * MAIL-WRITE-BODY-LINE * * * * WILL WRITE A SINGLE LINE OF TEXT TO AN EMAIL * * MAIL-INIT MUST BE PERFORMED BEFORE THIS ROUTINE! * ***************************************************** MAIL-WRITE-BODY-LINE. MOVE SPACES TO MAIL-ERROR-TEXT, MAIL-OUTPUT-RECORD. 080509* IF MAIL-TEMP-FILE-POINTER IS EQUAL TO ZERO 080509 IF MAIL-TEMP-FILE-POINTER IS EQUAL TO MAIL-DUMMY-POINTER THEN MOVE "INVALID TEMP FILE POINTER" TO MAIL-ERROR-TEXT GO TO MAIL-WRITE-BODY-LINE-EXIT. STRING MAIL-BODY-LINE DELIMITED BY LOW-VALUE X"0A" DELIMITED BY SIZE X"00" DELIMITED BY SIZE INTO MAIL-OUTPUT-RECORD. CALL "fputs" USING MAIL-OUTPUT-RECORD BY VALUE MAIL-TEMP-FILE-POINTER RETURNING MAIL-RETURN. IF MAIL-RETURN IS LESS THAN OR EQUAL TO ZERO THEN MOVE "ERROR WRITING TO TEMPORARY FILE" TO MAIL-ERROR-TEXT. MAIL-WRITE-BODY-LINE-EXIT. EXIT. ***************************************************** * MAIL-SEND * * * * WILL ACTUALLY SEND THE EMAIL; ENDING THE PROCESS * ***************************************************** MAIL-SEND. MOVE SPACES TO MAIL-BODY-LINE. STRING "." DELIMITED BY SIZE X"0A" DELIMITED BY SIZE X"00" DELIMITED BY SIZE INTO MAIL-BODY-LINE. CALL "fputs" USING MAIL-BODY-LINE BY VALUE MAIL-TEMP-FILE-POINTER RETURNING MAIL-RETURN. IF MAIL-RETURN IS LESS THAN OR EQUAL TO ZERO THEN MOVE "ERROR WRITING TO TEMPORARY FILE" TO 070111* MAIL-ERROR-TEXT. 070111 MAIL-ERROR-TEXT 070111 GO TO MAIL-SEND-EXIT. * CALL "fclose" USING BY VALUE MAIL-TEMP-FILE-POINTER RETURNING MAIL-RETURN. 070111 IF MAIL-RETURN IS NOT EQUAL TO ZERO 070111* MAIL-ERROR-TEXT. THEN MOVE "ERROR CLOSING TEMPORARY FILE" TO 070111 MAIL-ERROR-TEXT 070111 GO TO MAIL-SEND-EXIT. * MAIL-POINTER NOW POINTS TO MAIL-BODY-LINE! MOVE ADDRESS OF MAIL-BODY-LINE TO MAIL-POINTER. MAIL-SEND-COMMAND. MOVE SPACES TO MAIL-COMMAND-LINE. STRING 'cat ' DELIMITED BY SIZE MAIL-TEMP-FILE-NAME DELIMITED BY LOW-VALUE ' | /usr/sbin/sendmail -t -f "' DELIMITED BY SIZE MAIL-FROM-ADDRESS DELIMITED BY LOW-VALUE '" -F "' DELIMITED BY SIZE MAIL-FROM-FULL-NAME DELIMITED BY LOW-VALUE '"' DELIMITED BY SIZE INTO MAIL-COMMAND-LINE. CALL "SYSTEM" USING MAIL-COMMAND-LINE RETURNING MAIL-RETURN. 070111 IF MAIL-RETURN IS GREATER THAN ZERO THEN MOVE "ERROR OCCURRED SENDING EMAIL" TO 070111* MAIL-ERROR-TEXT. 070111 MAIL-ERROR-TEXT 070111 GO TO MAIL-SEND-EXIT. MAIL-SEND-CLEANUP. * MAIL-POINTER NOW POINTS TO MAIL-TEMP-FILE-NAME MOVE ADDRESS OF MAIL-TEMP-FILE-NAME TO MAIL-POINTER. CALL "remove" USING BY VALUE MAIL-POINTER RETURNING MAIL-RETURN. IF MAIL-RETURN IS NOT EQUAL TO ZERO THEN MOVE "UNABLE TO DELETE TEMP FILE" TO MAIL-ERROR-TEXT. MAIL-SEND-EXIT. EXIT. [/code] Please ignore my comments inside the code where I warn the staff that these particular programs are not authorization for them to ignore our programming standards. jimc ---------------------------------------------------------------- Wonderful humor ! The Bear is in Lyon, and he is getting older every year. :-D By the way, my email is active on this website. Thank you Jim Regards Francois ---------------------------------------------------------------- What about using "mail"? Would be something like this... [code] OCOBOL >>SOURCE FORMAT IS FIXED *> ************************************************************ <* *> Author: Robert Doerfler *> Date: 2011-12-13 *> Purpose: sending some mail *> Tectonics: cobc *> ************************************************************ <* identification division. program-id. sendsomemail. environment division. input-output section. data division. working-storage section. 01 MAIL-TO-ADDRESS PIC X(64). 01 MAIL-SUBJECT PIC X(64). 01 MAIL-FROM-ADDRESS PIC X(64). 01 MAIL-BODY PIC X(256). 01 MAIL-COMMAND PIC X(512). 01 MAIL-RETURN USAGE BINARY-LONG. procedure division. beginning. MOVE "test@test.org" TO MAIL-TO-ADDRESS. MOVE "COBOL EMAIL TEST" TO MAIL-SUBJECT. MOVE "test@test.org" TO MAIL-FROM-ADDRESS. MOVE "test test test test " TO MAIL-BODY. STRING "echo '" DELIMITED BY SIZE MAIL-BODY-LINE DELIMITED BY SIZE "' | mail -r " DELIMITED BY SIZE MAIL-FROM-ADDRESS DELIMITED BY SIZE "-s " DELIMITED BY SIZE MAIL-SUBJECT DELIMITED BY SIZE MAIL-TO-ADDRESS DELIMITED BY SIZE INTO MAIL-COMMAND. CALL "SYSTEM" USING MAIL-COMMAND RETURNING MAIL-RETURN. goback. [/code] ---------------------------------------------------------------- Ok, i have been asked to post some code how to send a mail with attachments and opencobol. I'm using the MUA named "mutt" for handling all the attachment stuff. It could be done with uuencode, too. [code] OCOBOL >>SOURCE FORMAT IS FIXED *> ************************************************************ <* *> Author: Robert Doerfler *> Date: 2011-12-13 *> Purpose: sending some mail with attachments *> Tectonics: cobc *> ************************************************************ <* identification division. program-id. sendsomemail. environment division. input-output section. data division. working-storage section. 01 MAIL-TO-ADDRESS PIC X(64). 01 MAIL-SUBJECT PIC X(64). 01 MAIL-BODY PIC X(256). 01 MAIL-COMMAND PIC X(600). 01 MAIL-RETURN USAGE BINARY-LONG. 01 MAIL-ATTACHMENT-FILENAME PIC X(64). procedure division. beginning. MOVE "rodo@zlug.org" TO MAIL-TO-ADDRESS. MOVE "COBOL EMAIL TEST" TO MAIL-SUBJECT. MOVE "test test test test " TO MAIL-BODY. MOVE "/tmp/test.pdf" TO MAIL-ATTACHMENT-FILENAME. *> echo 'body line ' | mutt -s 'subject line' -a /tmp/test.pdf <* *> -- rodo@bloerp.de <* STRING "echo '" DELIMITED BY SIZE MAIL-BODY DELIMITED BY SIZE "' | " DELIMITED BY SIZE "mutt " DELIMITED BY SIZE " -s '" DELIMITED BY SIZE MAIL-SUBJECT DELIMITED BY SIZE "' -a " DELIMITED BY SIZE MAIL-ATTACHMENT-FILENAME DELIMITED BY SIZE " -- " DELIMITED BY SIZE MAIL-TO-ADDRESS DELIMITED BY SIZE INTO MAIL-COMMAND. CALL "SYSTEM" USING MAIL-COMMAND RETURNING MAIL-RETURN. goback. [/code] ---------------------------------------------------------------- Subject: COBOL code snippits Greetings one and all. I have been wondering how many of you would like to join in and share your code snippets? I have plenty of space on my DreamHost account and can put up a front end for sharing your code. If you are interested please post here that interest and any suggestions for such a site. If enough people are interested I will go ahead with such a project. We share our help and ideas here, how about sharing the code? Cheers! Damon ---------------------------------------------------------------- I'm in. Here's a haiku-ey execute-y thingy. [code] program-id. sun. procedure division. add 1 to return-code. *btiffin* [/code] Cheers, Brian ---------------------------------------------------------------- So you want my ancient code? :-P ---------------------------------------------------------------- Yes ---------------------------------------------------------------- Trig functions anyone. On the Univac 1100, S9(10)COMP is one 36 bit word. Change the size to S9(8) for 32 bit systems. Originally written about 1975. [code] IDENTIFICATION DIVISION. PROGRAM-ID. SINE. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. UNIVAC-1100-60. OBJECT-COMPUTER. UNIVAC-1100-60. DATA DIVISION. WORKING-STORAGE SECTION. 01 INPUT-SINE PIC 9V9(9) COMP. 01 WORK-ANGLE PIC S9(3)V9(7) COMP. 01 LOW PIC S9(2)V9(8) COMP. 01 ABS-DIFF PIC 9(2)V9(8) COMP. 01 HIGH PIC S9(2)V9(8) COMP. 01 RADIANS PIC 99V9(8) COMP. 01 PI PIC 9V99999999 COMP VALUE 3.14159265. LINKAGE SECTION. 01 FUNCTION PIC X(4). 01 ANGLE-THETA PIC 9(4)V9(6) COMP. 01 SINE-THETA PIC 9(2)V9(8) COMP. PROCEDURE DIVISION USING FUNCTION ANGLE-THETA SINE-THETA. BEGIN. MOVE ANGLE-THETA TO WORK-ANGLE. IF FUNCTION EQUAL 'ASIN' MOVE SINE-THETA TO INPUT-SINE WORK-ANGLE PERFORM CALC-ARCSINE THRU CALC-ARCSINE-EXIT MOVE WORK-ANGLE TO ANGLE-THETA. IF FUNCTION EQUAL 'SIN' MOVE ANGLE-THETA TO WORK-ANGLE PERFORM CALC-SINE. EOJ. EXIT PROGRAM. CALC-SINE. IF WORK-ANGLE EQUAL ZERO MOVE ZERO TO SINE-THETA ELSE COMPUTE RADIANS = PI / (180 / WORK-ANGLE) COMPUTE SINE-THETA = RADIANS - RADIANS ** 3 / 6 + RADIANS ** 5 / 120 - RADIANS ** 7 / 5040 + RADIANS ** 9 / 362880. CALC-ARCSINE. MOVE 90 TO HIGH. MOVE 0 TO LOW. MOVE ZERO TO ABS-DIFF. MOVE ZERO TO SINE-THETA. SPT01. SUBTRACT SINE-THETA FROM INPUT-SINE GIVING ABS-DIFF. IF ABS-DIFF GREATER THAN .00001 ADD LOW HIGH GIVING WORK-ANGLE ROUNDED DIVIDE 2 INTO WORK-ANGLE PERFORM CALC-SINE IF SINE-THETA GREATER THAN INPUT-SINE MOVE WORK-ANGLE TO HIGH GO TO SPT01 ELSE MOVE WORK-ANGLE TO LOW GO TO SPT01. CALC-ARCSINE-EXIT. EXIT. [/code] [code] IDENTIFICATION DIVISION. PROGRAM-ID. TESTSINE. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. UNIVAC-1100. OBJECT-COMPUTER. UNIVAC-1100. DATA DIVISION. WORKING-STORAGE SECTION. 01 FUNCTION PIC X(4). 01 ANGLE-THETA PIC 9(4)V9(6) COMP. 01 SINE-THETA PIC 9(2)V9(8) COMP. 01 ACCEPT-SINE PIC V99999. 01 ACCEPT-ANGLE PIC 99V99. PROCEDURE DIVISION. SOJ. DISPLAY 'ENTER FUNCTION'. ACCEPT FUNCTION. IF FUNCTION EQUAL 'END' GO TO EOJ. IF FUNCTION EQUAL 'SIN' DISPLAY 'ENTER ANGLE-THETA' ACCEPT ACCEPT-ANGLE MOVE ACCEPT-ANGLE TO ANGLE-THETA. IF FUNCTION EQUAL 'ASIN' DISPLAY 'SINE ?' ACCEPT ACCEPT-SINE MOVE ACCEPT-SINE TO SINE-THETA. CALL 'SINE' USING FUNCTION ANGLE-THETA SINE-THETA. DISPLAY 'ANGLE ' ANGLE-THETA ' SINE ' SINE-THETA. GO TO SOJ. EOJ. STOP RUN. [/code] ---------------------------------------------------------------- Soundex function. [code] PROGRAM-ID. FONETC. AUTHOR. JACK TEARLE. PHONETIC SEARCH. DATE-WRITTEN. JULY 1985. REMARKS. CONVERT CHARACTER STRING TO 7 DIGIT PHONETIC CODE BASED UPON ENGLISH PRONUNCIATION. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. UNVIAC-1100. OBJECT-COMPUTER. UNIVAC-1100. DATA DIVISION. WORKING-STORAGE SECTION. 01 TEST-GROUP3. 03 TEST-GROUP2. 05 TEST-CHAR1 PIC X. 05 TEST-CHAR2 PIC X. 03 TEST-GROUP1. 05 TEST-CHAR3 PIC X. 01 S-WORD. 03 S-CHAR PIC X OCCURS 30 TIMES INDEXED BY I. 01 W-BYTE. 03 W-BYTE-N PIC 1(9). 01 W-CODE. 03 W-CODE1 PIC 99. 03 W-CODEN PIC 9 OCCURS 5 TIMES INDEXED BY N. 01 W-CODE-N REDEFINES W-CODE PIC 9(7). LINKAGE SECTION. 01 PHONETIC-CROSS-REFERENCE. 03 PHONETIC-CODE PIC 9(10) COMP. 03 PHONETIC-WORD PIC X(28). PROCEDURE DIVISION USING PHONETIC-CROSS-REFERENCE. SOJ. MOVE ZERO TO W-CODE. MOVE PHONETIC-WORD TO S-WORD. MOVE S-CHAR (1) TO TEST-CHAR1. MOVE S-CHAR (2) TO TEST-CHAR2. MOVE S-CHAR (3) TO TEST-CHAR3. IF TEST-GROUP2 EQUAL 'KN' MOVE 'N' TO S-CHAR (1). IF TEST-GROUP2 EQUAL 'WR' MOVE 'R' TO S-CHAR (1). IF TEST-GROUP2 EQUAL 'PH' MOVE 'F' TO S-CHAR (1) S-CHAR (2). IF TEST-GROUP2 EQUAL 'PN' MOVE 'N' TO S-CHAR (1). IF TEST-GROUP2 EQUAL 'PS' MOVE 'S' TO S-CHAR (1). MOVE S-CHAR (1) TO W-BYTE. IF W-BYTE-N LESS THAN 65 OR GREATER THAN 90 GO TO EOJ. SUBTRACT 64 FROM W-BYTE-N GIVING W-CODE1. SET I TO 1. SET N TO 1. LOOP. SET I UP BY 1. IF N GREATER THAN 5 GO TO EOJ. IF I GREATER THAN 28 GO TO EOJ. IF S-CHAR (I) EQUAL S-CHAR (I - 1) GO TO LOOP. IF S-CHAR (I) LESS THAN 'A' OR GREATER THAN 'Z' GO TO LOOP. MOVE S-CHAR (I) TO TEST-CHAR1. MOVE S-CHAR (I + 1) TO TEST-CHAR2. MOVE S-CHAR (I + 2) TO TEST-CHAR3. IF TEST-GROUP3 EQUAL 'VPH' OR 'PHV' MOVE 1 TO W-CODEN (N) SET N UP BY 1 SET I UP BY 2 GO TO LOOP. IF TEST-GROUP3 EQUAL 'CKS' OR 'CTS' OR 'DGE' OR 'TCH' OR 'TIO' MOVE 2 TO W-CODEN (N) SET N UP BY 1 SET I UP BY 2 GO TO LOOP. IF TEST-GROUP3 EQUAL 'GHT' MOVE 3 TO W-CODEN (N) SET N UP BY 1 SET I UP BY 2 GO TO LOOP. IF TEST-GROUP2 EQUAL 'FV' OR 'PH' OR 'VF' MOVE 1 TO W-CODEN (N) SET N UP BY 1 SET I UP BY 1 GO TO LOOP. IF TEST-GROUP2 EQUAL 'CK' OR 'CS' OR 'KS' OR 'SX' OR 'XS' MOVE 2 TO W-CODEN (N) SET N UP BY 1 SET I UP BY 1 GO TO LOOP. IF TEST-GROUP2 EQUAL 'DT' OR 'TD' MOVE 3 TO W-CODEN (N) SET N UP BY 1 SET I UP BY 1 GO TO LOOP. IF TEST-GROUP2 EQUAL 'MN' OR 'NM' MOVE 5 TO W-CODEN (N) SET N UP BY 1 SET I UP BY 1 GO TO LOOP. IF TEST-CHAR1 EQUAL 'B' OR 'F' OR 'P' OR 'V' MOVE 1 TO W-CODEN (N) SET N UP BY 1 GO TO LOOP. IF TEST-CHAR1 EQUAL 'C' OR 'G' OR 'J' OR 'K' OR 'Q' OR 'S' OR 'X' OR 'Z' MOVE 2 TO W-CODEN (N) SET N UP BY 1 GO TO LOOP. IF TEST-CHAR1 EQUAL 'D' OR 'T' MOVE 3 TO W-CODEN (N) SET N UP BY 1 GO TO LOOP. IF TEST-CHAR1 EQUAL 'L' MOVE 4 TO W-CODEN (N) SET N UP BY 1 GO TO LOOP. IF TEST-CHAR1 EQUAL 'M' OR 'N' MOVE 5 TO W-CODEN (N) SET N UP BY 1 GO TO LOOP. IF TEST-CHAR1 EQUAL 'R' MOVE 6 TO W-CODEN (N) SET N UP BY 1 GO TO LOOP. GO TO LOOP. EOJ. MOVE W-CODE-N TO PHONETIC-CODE. END-SUBR. EXIT PROGRAM. [/code] ---------------------------------------------------------------- Date arithmetic. Converts date to number of days that have elapsed since Jan 1 1901, and reverse. [code] IDENTIFICATION DIVISION. PROGRAM-ID. XDATEX. AUTHOR. JACK TEARLE. DATE-WRITTEN. FEB 1983. REMARKS. CONVERT DATE TO DAY OF CENTURY FROM BASE JAN 1 1901. VALID UNTIL DEC 31 1999. INPUT IS DATE 9(8) IN MMDDYYYY FORMAT. OUTPUT IS NUMBER OF DAYS SINCE JAN 1 1901 PIC S9(10). 2. CONVERT DAY OF CENTURY TO DATE FROM BASE JAN 1 1901. * VALID UNTIL DEC 31 1999. VALID AFTER Jan 1 1901 INPUT NUMBER OF DAYS SINCE JAN 1 1901 OUTPUT DATE 9(8) IN FORMAT MMDDYYYY. OUTPUT DAY OF WEEK PIC 9, WHERE 1 IS SUNDAY AND 7 IS SATU ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. UNVIAC-1100. OBJECT-COMPUTER. UNIVAC-1100. DATA DIVISION. WORKING-STORAGE SECTION. 01 CALC-YEAR PIC S9(10) COMP. 01 CALC-MONTH PIC S9(10) COMP. 01 CALC-DAY PIC S9(10) COMP. 01 DYYR PIC S9(10) COMP. 01 DYWK PIC S9(10) COMP. 01 DYMO PIC S9(10) COMP. 01 TEMP-YEAR PIC S9(10) COMP. 01 TEMP-DAY PIC S9(10) COMP. 01 LEAP-YEAR PIC S9(10) COMP. 01 HOLD-DATE PIC X(8). 01 DAY-NAME-DATA. 03 FILLER PIC X(9) VALUE 'SUNDAY'. 03 FILLER PIC X(9) VALUE 'MONDAY'. 03 FILLER PIC X(9) VALUE 'TUESDAY'. 03 FILLER PIC X(9) VALUE 'WEDNESDAY'. 03 FILLER PIC X(9) VALUE 'THURSDAY'. 03 FILLER PIC X(9) VALUE 'FRIDAY'. 03 FILLER PIC X(9) VALUE 'SATURDAY'. 01 DAY-NAME-TABLE REDEFINES DAY-NAME-DATA. 03 DAY-NAME OCCURS 7 TIMES PIC X(9). 01 MONTH-NAME-DATA. 03 FILLER PIC X(9) VALUE 'JANUARY'. 03 FILLER PIC X(9) VALUE 'FEBRUARY'. 03 FILLER PIC X(9) VALUE 'MARCH '. 03 FILLER PIC X(9) VALUE 'APRIL '. 03 FILLER PIC X(9) VALUE 'MAY '. 03 FILLER PIC X(9) VALUE 'JUNE '. 03 FILLER PIC X(9) VALUE 'JULY '. 03 FILLER PIC X(9) VALUE 'AUGUST '. 03 FILLER PIC X(9) VALUE 'SEPTEMBER'. 03 FILLER PIC X(9) VALUE 'OCTOBER '. 03 FILLER PIC X(9) VALUE 'NOVEMBER '. 03 FILLER PIC X(9) VALUE 'DECEMBER '. 01 MONTH-NAME-TABLE REDEFINES MONTH-NAME-DATA. 03 MONTH-NAME OCCURS 12 TIMES PIC X(9). LINKAGE SECTION. 01 DATE-CROSS-REFERENCE. 02 CALENDAR-DATE. 03 CALENDAR-MONTH PIC 99. 03 CALENDAR-DAY PIC 99. * 03 CALENDAR-YEAR PIC 99. 03 CALENDAR-YEAR PIC 9999. 02 DAYS-SINCE-JAN-1901 PIC S9(10) COMP. 02 DAY-OF-WEEK PIC S9. 02 NAME-OF-DAY PIC X(9). 02 NAME-OF-MONTH PIC X(9). PROCEDURE DIVISION USING DATE-CROSS-REFERENCE. SOJ. IF DAYS-SINCE-JAN-1901 NOT EQUAL ZERO GO TO CENTURY-TO-CALENDAR. MOVE 2 TO LEAP-YEAR. MOVE CALENDAR-DATE TO HOLD-DATE. * MOVE CALENDAR-YEAR TO CALC-YEAR. SUBTRACT 1900 FROM CALENDAR-YEAR GIVING CALC-YEAR. MOVE CALENDAR-MONTH TO CALC-MONTH. MOVE CALENDAR-DAY TO CALC-DAY. DIVIDE 4 INTO CALC-YEAR GIVING TEMP-YEAR. MULTIPLY 4 BY TEMP-YEAR. IF TEMP-YEAR EQUAL CALC-YEAR MOVE 1 TO LEAP-YEAR. MULTIPLY 275 BY CALC-MONTH GIVING DYYR. DIVIDE 9 INTO DYYR. ADD CALC-DAY TO DYYR. SUBTRACT 30 FROM DYYR. IF CALC-MONTH GREATER THAN 2 SUBTRACT LEAP-YEAR FROM DYYR GIVING DYYR. SUBTRACT 1 FROM CALC-YEAR GIVING DAYS-SINCE-JAN-1901. MULTIPLY 1461 BY DAYS-SINCE-JAN-1901. DIVIDE 4 INTO DAYS-SINCE-JAN-1901. ADD DYYR TO DAYS-SINCE-JAN-1901. PERFORM CENTURY-TO-CALENDAR. IF CALENDAR-DATE NOT EQUAL HOLD-DATE MOVE ZERO TO DAYS-SINCE-JAN-1901 CALENDAR-DATE DAY-OF-WEEK MOVE SPACE TO NAME-OF-DAY NAME-OF-MONTH. GO TO EOJ. CENTURY-TO-CALENDAR. DIVIDE 1461 INTO DAYS-SINCE-JAN-1901 GIVING CALC-YEAR. SUBTRACT CALC-YEAR FROM DAYS-SINCE-JAN-1901 GIVING CALC-YEAR. ADD 364 TO CALC-YEAR. DIVIDE 365 INTO CALC-YEAR. SUBTRACT 1 FROM CALC-YEAR GIVING DYYR. MULTIPLY 1461 BY DYYR. DIVIDE 4 INTO DYYR. SUBTRACT DYYR FROM DAYS-SINCE-JAN-1901 GIVING DYYR. MOVE 2 TO LEAP-YEAR. DIVIDE 4 INTO CALC-YEAR GIVING TEMP-YEAR. MULTIPLY 4 BY TEMP-YEAR. IF TEMP-YEAR EQUAL CALC-YEAR MOVE 1 TO LEAP-YEAR. MOVE DYYR TO TEMP-DAY. SUBTRACT LEAP-YEAR FROM 61 GIVING TEMP-YEAR. IF TEMP-DAY GREATER THAN TEMP-YEAR ADD TEMP-DAY LEAP-YEAR GIVING TEMP-DAY. MULTIPLY 9 BY TEMP-DAY GIVING CALC-MONTH. ADD 269 TO CALC-MONTH. DIVIDE 275 INTO CALC-MONTH. MULTIPLY CALC-MONTH BY 275 GIVING DYMO. DIVIDE 9 INTO DYMO. SUBTRACT 30 FROM DYMO. SUBTRACT DYMO FROM TEMP-DAY GIVING DYMO CALC-DAY. ADD 1 DAYS-SINCE-JAN-1901 GIVING DYWK. DIVIDE DYWK BY 7 GIVING TEMP-YEAR REMAINDER DYWK. ADD 1 DYWK GIVING DAY-OF-WEEK. * MOVE CALC-YEAR TO CALENDAR-YEAR. ADD 1900 CALC-YEAR GIVING CALENDAR-YEAR. MOVE CALC-MONTH TO CALENDAR-MONTH. MOVE CALC-DAY TO CALENDAR-DAY. MOVE DAY-NAME (DAY-OF-WEEK) TO NAME-OF-DAY. MOVE MONTH-NAME (CALENDAR-MONTH) TO NAME-OF-MONTH. EOJ. EXIT PROGRAM. [/code] ---------------------------------------------------------------- Subject: TUI Accept Screen Problem Learning OpenCOBOL 1.1 on an XP box with Mingw32. I am using the OCIC.cbl as an example of TUI sereen. Specifically, I am using paragraphs 201 thru 209. The OCIC compile screen displays great and works the way it should. When I try to duplicate this, my TUI will not recognize the COB-SCR-F? keys and always says that 'No Key Pressed'. The screen also jumps around as it is being continuously refreshed. Help and a small example TUI program would be appreciated . . . ---------------------------------------------------------------- See http://opencobol.add1tocobol.com/#does-opencobol-support-screen-section and http://opencobol.add1tocobol.com/#id727 for how to turn on Fkey handling, and a way of controlling the settings inside your running programs. Cheers, Brian ---------------------------------------------------------------- Thanks Brian. I have the environment variables set and still does not work. Since OCIC runs like it is supposed to - it MUST be something I am doing 'somewhere'. I am going to code a new small test program and try to ascertain just where the bad things are happening. ---------------------------------------------------------------- Have you included the "COPY screenio." statement in your working storage? This is the method used in the OCIC program.If you prefer you can use the usual crt status clause in SPECIAL NAMES.It is all written up on pages 4-3 to 4-5 of G Cutlers Guide which is included in your origial download.If this does not help, you need to post your code being careful to use code tags. John. ---------------------------------------------------------------- John, yes - but it was an ID10T type error. Now I remember what assumptions are :). The last, many years ago, TUI screen generator (Visual COBOL) I have used did not need an I/O field. When I added "using x" to the screen it woke up and stuck it's tongue out at me. The help that the Forum responded with was MUCH appreciated. ---------------------------------------------------------------- Subject: need help calling the 'curl_slist_append' function HI - can anybody help me with correctly calling the 'curl_slist_append' function from cobol? Here's the C code: struct curl_slist *headers=NULL; headers = curl_slist_append(headers, "Content-Type: text/xml"); How do you define the 'headers' structure in cobol, and then call curl_slist_append? Thanks! ---------------------------------------------------------------- First, you'll need to visit the curl.h header and find what the type actually is. I get [code] struct curl_slist { char *data; struct curl_slist *next; }; [/code] So, [code] 01 slist_record. 05 slist_data usage pointer synchronized. 05 slist_next usage pointer synchronized. 01 headers usage pointer value null. [/code] then [code] CALL "curl_slist_append" USING BY VALUE headers BY REFERENCE "Content-Type: text/xml" RETURNING headers END-CALL IF headers EQUAL NULL DISPLAY "Something went wrong" END-DISPLAY END-IF [/code] This needs to be tested. The BY VALUE headers is so you get the value of the pointer for C to use, not the address of the [i]headers[/i] pointer as BY REFERENCE would normally pass. The RETURNING 'gets' a C pointer, which the BY VALUE would use on the next call so it knows where it's appending. (First call being the NULL). And it turns out, unless you want to traverse the slist, you don't need any of the slist-record COBOL definition. Just the headers pointer. libCURL will handle the rest of it, you just need to [code]call "curl_slist_free_all" by value headers end-call[/code] when you are done with the linked list. Cheers, Brian ---------------------------------------------------------------- It works now! Thanks for the example and your explanation really helps too! ---------------------------------------------------------------- Glad, Brian ---------------------------------------------------------------- Subject: Item in Linkage-Section versus item with the based attribute Hi guys, I'am converting an ERP-software with 3000 cobol programs from MF-Cobol to OC. I'have used the MF-function "CBL_ALLOC_MEM" to allocate memory and then adressing 01-level-items in linkage section. In the User Guide I found the following description in section 6.6. Allocate: "2. If used, identifier-1 should be an 01-level item defined with the BASED attribute in WORKING-STORAGE or LOCAL-STORAGE. It can be an 01 item defined in the LINKAGE SECTION, but using such a data item is not recommended." Can somebody explain to me, why it is not recommended to use data items in the linkage section for this? Should I change my programs to use based items in Working Storage??. Thanks Michael When our ERP-System is working with OC, I shall write here about my experiences. Our programs has embedded SQL-statemets for DB2 (IBM). It was very easy to use the db2 preprocessor and to load the necessary db2-libraries with db2. ---------------------------------------------------------------- If you know what you are doing, it's ok in my humble. But you really are in charge of ensuring there is no memory management fights between sub systems. For instance, I'd be very afraid to use BASED LINKAGE with Vala/Genie and their libraries. ;) You can test for some things with, compile -g -debug and valgrind the executables. Cheers, Brian ---------------------------------------------------------------- I think the main question is why you want to allocate memory on run time. Are there big storage items that you only need partial run time of one COBOL program? I'd personally use BASED items (defined in WORKING-STORAGE) for this scenario, if this is the case. human ---------------------------------------------------------------- Just a guess, but I think it's more of a "how things should be" than it working any differently. I helped implement BASED in OpenCOBOL. My observation is that, ideally, the LINKAGE SECTION would be used only for, well, LINKAGE. That is, only for those data items specified in the PROCEDURE DIVISION USING/RETURNING clauses. Any dynamically allocated data items should be specified as BASED data items in WS or LS. But the fact of the matter is that many COBOL dialects allowed for "based" data items WAY before the BASED keyword was supported. (IBM mainframe COBOL still does not support BASED.) So I'm guessing for compatibility sake the COBOL standard allowed for this type of use of the LINKAGE section, but also gave us the BASED keyword. Frank ---------------------------------------------------------------- Subject: LDAP Hi, i did some ldap managing tool once in java and i wanted to reimplement the whole thing just for fun in cobol. Is there some (open)ldap support for oc? Greetings ---------------------------------------------------------------- I'd look to libCURL. See http://curl.haxx.se/docs/manual.html and search that page for LDAP for some teasers. And http://opencobol.add1tocobol.com/#what-is-the-current-version-of-opencobol for some links to source code to maybe help get things started. Cheers, Brian ---------------------------------------------------------------- Subject: OpenCOBOL for .NET -- Reopen Discussion? I would like to open a topic back up for discussion if I may... I believe there is a significant opportunity to gain quite a bit of users/market share for OpenCOBOL with a .NET version of the product. Currently there are two options: NetCOBOL (Fujitsu/Alchemy) and VisualCOBOL (Micro Focus), both of which rape you with costs. With the ever increasing popularity of .NET and the cloud, it would make sense to have a native .NET COBOL compiler. So, would anyone be interested? How difficult would a project like this be? I see two options, either go out to C# or straight to MSIL. ---------------------------------------------------------------- That sounds good! what are the problems and benefits? And what about for ultraedit (yep, shareware) and opencobol for a light suite? I have a portable package with resources of VS 2008 and a little bat for compile the sources. For lot of my team mates the problem with this is the size of the tools. The most popular solution is join opencobol with mysql and a light notepad. ---------------------------------------------------------------- Hello, this sounds like a rather interesting concept. However, shouldn’t an undertaking like this, proceed through intermediate stages? As I understand, the current OC compiler translates Cobol source to C, of which is non Object Oriented. I would image, the first requirement to building C# (or MSIL) source, is to build an Object Oriented Model of an existing Cobol Program Structure. I’m thinking, that maybe a significant amount of design and coding from the existing compiler source. However, I suppose, in one phase, the OC Compiler could translate from Cobol to C++ source. And then, eventually to C# (or MSIL). Also, it had just occurred to me, I thought the original build of the OC Compiler was conceptually constructed on UNIX standards. Then later, someone as an independent effort ported the compiler source over to VC++. So wouldn’t a OC compiler to C# be considered a different product? Just a thought... ---------------------------------------------------------------- It would be a large and difficult project. Plus there are patent issues. If you are interested there are tools you could use to build a CSharp parser for COBOL. The first step. There are JavaCC COBOL grammars [12] you could use, with a Java tool called CSharpCC [1]. It generates CSharp parser for a particular language. References: 1) CSharpCC http://code.google.com/p/csharpcc/ http://sourceforge.net/projects/csharpcc/ http://www.codeproject.com/KB/recipes/minossecc.aspx 2) A Cobol Parser http://mapage.noos.fr/~bpinon/a_cobol_parser.htm ---------------------------------------------------------------- Subject: GUI Qt Translation ... hello everyone. Give a GUI for OpenCOBOL is very difficult ... Is there anyone who has used Qt with(or not) OpenCobol ? An other point: The translation project is still alive? Cordial Greetings René ---------------------------------------------------------------- I'm not the right one for the GUI, but there are some forum entries about that, showing it's possible and how. Samples for GTK can be found in the [url=http://opencobol.add1tocobol.com/#does-opencobol-support-the-gimp-toolkit-gtk]FAQ[/url]. To the translation project: It's not dead but the translators seem did not send ANY translations to me, yet. All translations finished will be part of OpenCOBOL 2.0. Bear wanted to do French, you may ask him about it and may get his current work finished yourself. Please discuss this topic at it's own thread http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1127&forum=1#forumpost5852 human ---------------------------------------------------------------- I've used Qt from C++ but I'd not call myself an expert. Gtk is the way to go for OpenCOBOL in my humble. The C ABI is so much easier to play with. Qt will require a binding wrapper for every CALL you want to make from COBOL. Not impossible, (The C++ Falcon engine embedded with ease), but an extra layer of effort and tectonic voodoo. With Gtk, we even get the benefit of Vala ease of use. Turns out to be a pretty sweet combination of powerful GUI building tools. Cheers, Brian ---------------------------------------------------------------- Hello. Thank you Brian. Ok I'll go back to GTK / C + + ---------------------------------------------------------------- Umm, that sounded kinda eeyore, and it doesn't have to. :-) Qt linkage will work fine, given the itch to use it. It simply means, for every CALL you envision (which, really, even with sophisticated GUIs, counts in low hundreds), you need to write a little teenie bit of wrapper code to go along with the CALL. Flows well, once in the flow. My itch lies in the path of straight up C. (usually). I was simply putting forth a humble personal wheeeee susceptible cheerleader fan boy opinion. :) But, yeah. Go with GTK and look to Vala. Wicked cool. As soon as someone gets the itch, plugging in access to a Webkit DOM is only a few calls away. That would add browser to the list of possible front-ends OpenCOBOL could claim support for (or more true, I would get to go wheeeeee about). Cheers, Brian [i]Eeyore is a Winnie the Pooh character. The reference is supposed to be witty, in my nerd fail kinda way.[/i] ---------------------------------------------------------------- @human We have had the Spanish translation ready for some time. Please let me know how to get it to you. jimc ---------------------------------------------------------------- You find my mail address in your PM, I guess it's the easiest way. human ---------------------------------------------------------------- Subject: How to call a OpenCOBOL DLL module from CSharp There are two ways to incorporate OC code with .NET. One is to use managed code by wrapping the OC C code, and run-time, into a COM object. The other is to call OC modules (DLL) directly as un-managed code. While more risky, the second approach offers the ability to leverage the legacy code business logic, and add a winGUI interface. The following simple example is presented as a proof of concept only. cobfunc_dll.cob: [code] IDENTIFICATION DIVISION. PROGRAM-ID. "cobfunc_dll". ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 ws-idx PIC 9(09) COMP-5 VALUE 1. 01 ws-rc PIC S9(09) COMP-5. 01 ws-string-filled-in-dll. 05 ws-string-filled-in-dll-1 PIC X(20). 05 ws-string-filled-in-dll-2 PIC X(01) value X'00'. 01 ws-struct-dll-s. 05 ws-struct-dll-s-count-int PIC S9(09) COMP-5. 05 ws-struct-dll-s-ints-10. 10 ws-struct-dll-s-ints PIC S9(09) COMP-5 OCCURS 10 TIMES. 01 ws-mask PIC Z(01)9 VALUE ZERO. LINKAGE SECTION. 01 an-int PIC 9(05) COMP-5. 01 string-filled-in-dll PIC X(21). 01 struct-dll-s. 05 struct-dll-s-count-int PIC S9(09) COMP-5. *> 05 struct-dll-s-ints-10. *> 15 struct-dll-s-ints PIC S9(09) COMP-5 OCCURS 10 TIMES. 05 struct-dll-s-ints-pt POINTER. 01 ls-struct-dll-s-ints-10. 05 ls-struct-dll-s-ints PIC S9(09) COMP-5 OCCURS 10 TIMES. PROCEDURE DIVISION USING an-int string-filled-in-dll struct-dll-s ls-struct-dll-s-ints-10 . display "cobfunc_dll: enter". *> display "cobfunc_dll called". *> display "---------------". move an-int to ws-mask. display "an_int=" ws-mask. move "String filled in DLL" to ws-string-filled-in-dll-1. move ws-string-filled-in-dll to string-filled-in-dll. move struct-dll-s-count-int to ws-mask . display "count_int=" no advancing. display ws-mask no advancing. display ": " no advancing. perform until ws-idx > 10 display " " no advancing move ls-struct-dll-s-ints (ws-idx) to ws-mask display ws-mask no advancing add 1 to ws-idx end-perform. display " ". display "cobfunc_dll: exit". *> display "-----------------------". multiply an-int by 2 giving ws-rc; move ws-rc to return-code; EXIT PROGRAM. END PROGRAM 'cobfunc_dll'. [/code] program02.cs: [code] using System.Runtime.InteropServices; using System; class Program { // OpenCOBOL run-time - libcob.so.1.1.0 / libcob-1.dll // [DllImport("libcob-1.dll")] [DllImport("libcob.so")] private static extern void cob_init( int ac, [MarshalAs(UnmanagedType.LPArray)] byte[] av ); // [DllImport("libcob-1.dll")] [DllImport("libcob.so")] private static extern void cob_stop_run ( int rc ); [StructLayout(LayoutKind.Sequential, Pack=1)] private struct STRUCT_DLL { public Int32 count_int; public IntPtr ints; // public Int32 ints[10]; } // OC DLL - cobfunc_dll.dll / libcobfunc_dll.so // [DllImport("cobfunc_dll.dll")] [DllImport("libcobfunc_dll.so")] private static extern int cobfunc_dll ( ref uint an_int, [MarshalAs(UnmanagedType.LPArray)] byte[] string_filled_in_dll, ref STRUCT_DLL s, IntPtr intpt ); public static void Main(string[] args) { uint xy = 42; byte[] string_filled_in_dll = new byte[20]; STRUCT_DLL struct_dll = new STRUCT_DLL(); struct_dll.count_int = 10; // int[] ia = new int[10]; Int32[] ia = new Int32[10]; int i = 0; while (i < struct_dll.count_int) { ia[i] = i; i++; } struct_dll.ints = Marshal.UnsafeAddrOfPinnedArrayElement(ia, 0); // Initialize the COBOL run-unit byte[] av = new byte[1]; av[0] = 0; cob_init(0, av); Console.WriteLine("program02: cobfunc_dll called"); Console.WriteLine("-----------------------------"); int ret = cobfunc_dll(ref xy, string_filled_in_dll, ref struct_dll, struct_dll.ints); Console.WriteLine("-----------------------------"); Console.WriteLine("program02: cobfunc_dll return"); Console.WriteLine("Return Value: " + ret); Console.WriteLine("str: " + System.Text.Encoding.ASCII.GetString(string_filled_in_dll)); // Console.Write("Press any key to continue . . . "); // Console.ReadKey(true); // Terminate the COBOL run-unit cob_stop_run(ret); } } [/code] Build command line: [code] mono: cobc --free -v -m cobfunc_dll.cob -o libcobfunc_dll.so gmcs /debug /out:program02.exe program02.cs CSharp: cobc --free -v -m cobfunc_dll.cob -o libcobfunc_dll.dll csc /debug /out:program02.exe program02.cs [/code] Output: [code] >mono program02.exe program02: cobfunc_dll called ----------------------------- cobfunc_dll: enter an_int=42 count_int=10: 0 1 2 3 4 5 6 7 8 9 cobfunc_dll: exit ----------------------------- program02: cobfunc_dll return Return Value: 84 str: String filled in DLL [/code] The sources were tested using Mono v2 (Linux-32) and CSharp v2 / Mingw (winXP-32). As COBOL has limited pointer manipulation, some issues wiere encountered with C structures with dynamic memory allocation. Problem, how to de-reference the C structure pointer in a COBOL sub-program. Example: [code] struct STRUCT_DLL { int count_int; int* ints; }; 01 struct-dll-s. 05 struct-dll-s-count-int PIC S9(09) COMP-5. 05 struct-dll-s-ints-pt POINTER. 01 ls-struct-dll-s-ints-10. 05 ls-struct-dll-s-ints PIC S9(09) COMP-5 OCCURS 10 TIMES. [/code] I could not find a solution using OC, with out getting some sort of compiler error. References: 1) Calling a DLL with C# (C Sharp) http://www.adp-gmbh.ch/csharp/call_dll.html ---------------------------------------------------------------- I just wanted to thank you for this proof-of-concept. I think this is the correct way to use OpenCOBOL within .NET. A wrapper class for OpenCOBOL that tries to load the correct libcob and takes care of runtime initialisation and end would be a good idea. I guess it would be useful to load the COBOL module not directly but via libcob (I guess it's cob_resolve). This surely would server better than calling the generated COBOL module via it's dll/so and has less side bugs. human ---------------------------------------------------------------- The 'cob_resolve' returns a void pointer to a function. Not really the CSharp way of doing things. One could create a DLL/so module using the cobrun C source, then call it. The basic idea is to use COBOL for the business rules (logic) and .NET/CSharp for the data view. For example, a user could read and update an ISAM file. The ISAM data would be read/updated by the COBOL application, and displayed by a .NET application. The COBOL <-> CSharp interface could be encapsulated (into a DLL ?) so that all .NET applications could use. Unfortunately, in most COBOL applications the rules and view are not separated, but are clumped together. ---------------------------------------------------------------- Regarding the dereferencing of C structures: Umm, [code] SET struct-dll-s-ints-pt TO NULL [/code] will "make a reference to the structure from COBOL illegal" but it all comes down to who allocated the ram. [code] CALL ... BY VALUE struct-dll-s-ints-pt [/code] can be used to call any memory free routines required on the c-sharp side. But that sounds scary. For all the bindings I've dabbled in, I've always relied on OpenCOBOL keeping a sound WORKING-STORAGE and the "other side" to do the right thing with it's own luggage. Or am I not getting at what you need? [b]Edit:[/b] Having read it again; ignore my ramblings about deallocation. Take a look at http://opencobol.add1tocobol.com/#how-do-you-print-to-printers-with-opencobol for one way of dereferencing a string. It'll likely give you a good hint. Cheers, Brian ---------------------------------------------------------------- The COBOL DLL example was derived from a C DLL, see reference. So what I needed was the COBOL equivalent to the following code. [code] calling C code: struct STRUCT_DLL { int count_int; int* ints; }; struct STRUCT_DLL S; S.count_int = 10; S.ints = malloc(sizeof(int) * 10); call(... &S); dll C code: ... struct_dll->ints[i]; [/code] However I think you correct in assuming that since the DLL's are COBOL sources, it is unlikely that the above circumstance would occur. There is another issue, with 'cob_stop_run(int)' (STOP RUN), which is used to terminate the COBOL run-unit. The problem is that it also terminates the process using 'exit(int)'. This is a serious issue as it prematurely terminates the .NET application. ---------------------------------------------------------------- Ooops, spoke too soon. In CSharp, most types are allocated dynamically. So there will be some issues with pointer manipulation. But overall, I think this approach it is feasable, or at least considered. ---------------------------------------------------------------- re: cob_stop_run Use [b]cobtidy()[/b] instead of [i]cobexit(stat)[/i] or [i]cob_stop_run(stat)[/i]. See libcob/common.h for the header and libcob/common.c for the code. re: memory management Yeah, there are some techniques to keep everything on the up and up. OpenCOBOL's support of BASED pretty much lets us pull off many many things If you need to, we can discuss those here in the forum. One real gotcha for cross linking. Feb 2009 pre-rel has a fair killer bug when [b]void[/b] returns are used in functions that will be CALLed often. OC expects an int so you need to wrap void functions to return an int or risk depleting the runtime return stack or worse trashing ram outside it's expected range. There is a future pre-rel that includes CALL RETURNING NULL that fixes this, but we are waiting for the next stable pre-rel [i]with many changes[/i] before this one gets out to us in the wild. If it becomes a deal, there are some compiler changes that can be made to support it for a medium-term solution. For now the solution is to wrap; which works surprisingly easily once you track down data types. [i]cobc supports including .c files in the compile line and links them in all nicey nice.[/i] Cheers, Brian ---------------------------------------------------------------- As btiffin suggested, 'cob_stop_run' can be replaced by 'cobtidy'. This will function will terminate the COBOL run-unit, without terminating the process. program02.cs changes: [code] ... // [DllImport("libcob-1.dll")] // [DllImport("libcob.so")] // private static extern void cob_stop_run ( // int rc // ); // [DllImport("libcob-1.dll")] [DllImport("libcob.so")] private static extern int cobtidy (); ... // Terminate the COBOL run-unit - do not exit process ret = cobtidy(); // Note: Do not use - funtion will exit process //cob_stop_run(ret); [/code] I negleted to mention that for mono, the LD_LIBRARY_PATH needs to be set. Otherwise a mono run-time execption will occur. [code] export LD_LIBRARY_PATH=$PWD mono program02.exe [/code] For Win32, the DLLs need to be located in the CWD or in the PATH. re: memory management Yes, I'm aware of the implict 'int' return type, as required by the RETURN-CODE register. A well as the problems that will result when you forget. In this case, all calls are to COBOL programs, so I don't think void types will be a problem. The types used by CSharp to call COBOL, on the other hand, are critical. Being unsafe types, they can cause a run-time execption and an abrupt termination of the process, without a proper termination of the COBOL run-unit. In some tests, when I tried to use fixed size arrays, I managed to crash MONO. Fixed size arrays are a big unsafe NoNo when using CSharp. Well live and learn. ---------------------------------------------------------------- Actually you can do a lot with pointers in COBOL. Regarding original post, consider - [code] IDENTIFICATION DIVISION. PROGRAM-ID. contes2. DATA DIVISION. WORKING-STORAGE SECTION. 01 MYIDX USAGE BINARY-LONG. LINKAGE SECTION. *> NOTE - C does field alignment (per default) *> within a structure. Therefore we must *> define the alignment ourselves. *> ie. On 64-bit without the filler field, the *> structure size is still 16 and the *> pointer would still have offset 8. *> struct cstruct { *> int icount; *> int ifiller; /* Alignment for 64-bit */ *> int *iptr; *> }; 01 CSTRUCT. 05 CSTRUCT-COUNT-INT USAGE BINARY-LONG. 05 FILLER USAGE BINARY-LONG. 05 CSTRUCT-INTS-PTR USAGE POINTER. 01 CSTRUCT-INTS-TABLE. 05 CSTRUCT-INTS USAGE BINARY-LONG OCCURS 1 TO 9999999 TIMES DEPENDING ON CSTRUCT-COUNT-INT. PROCEDURE DIVISION USING CSTRUCT. SET ADDRESS OF CSTRUCT-INTS-TABLE TO CSTRUCT-INTS-PTR. PERFORM VARYING MYIDX FROM 1 BY 1 UNTIL MYIDX > CSTRUCT-COUNT-INT DISPLAY CSTRUCT-INTS (MYIDX) END-DISPLAY END-PERFORM. EXIT PROGRAM. [/code] This is just one way to do this. There are others. Note the alignment comments. I do not know what the C# rules are. Also you could define the integer pointer BEFORE the count in both C and COBOL, in which case you do not need the filler item; neither in C nor COBOL. Roger ---------------------------------------------------------------- It is more complex in CShape, as types have to be converted to unsafe types. Thus passing CShape structure references to COBOL group items is a complex process. Lacking any documentation, I did not find a way to do that conversion. I'll leave that problem for some else to resolve. None the less, I think that using CShape as a way to leverage COBOL legacy code is feasible. ---------------------------------------------------------------- Subject: libcob: Cannot find module 'GETOSTYPE' Hallo. this is user .profile [code] # Sample .profile for SuSE Linux # rewritten by Christian Steinruecken <cstein@suse.de> # # This file is read each time a login shell is started. # All other interactive shells will only read .bashrc; this is particularly # important for language settings, see below. test -z "$PROFILEREAD" && . /etc/profile || true # Most applications support several languages for their output. # To make use of this feature, simply uncomment one of the lines below or # add your own one (see /usr/share/locale/locale.alias for more codes) # This overwrites the system default set in /etc/sysconfig/language # in the variable RC_LANG. # #export LANG=de_DE.UTF-8 # uncomment this line for German output #export LANG=fr_FR.UTF-8 # uncomment this line for French output #export LANG=es_ES.UTF-8 # uncomment this line for Spanish output # Some people don't like fortune. If you uncomment the following lines, # you will have a fortune each time you log in ;-) #if [ -x /usr/bin/fortune ] ; then # echo # /usr/bin/fortune # echo #fi umask 0000 PATH=$HOME:$HOME/bin:/bin:/usr/bin; export PATH MAIL=/usr/spool/mail/`logname` # mailbox location export PATH MAIL /usr/bin/prwarn # issue a warning if password due to expire umask 000 # set file creation mask PATH=$PATH:/u/ute450/bck:/u/ute450/bcp:/u/ute450/bin:/u/ute450/bin87:/u/ute450/biny:/u/ute450/bmk:/u/ute450/bmkjk:/u/ute450/bmkyk:/u/ute450/bmsw:/u/ute450/bsys/s; export PATH MORE=-c; export MORE LD_LIBRARY_PATH=/usr/share/opencobol/lib:/usr/lib; export LD_LIBRARY_PATH COB_LIBRARY_PATH=/usr/share/opencobol/lib:/usr/lib:/fms/550/stdok/int:/fms/550/stdok/int/s; export COB_LIBRARY_PATH [/code] This is working-storage item [code] 01 os-type usage binary-long. 88 os-unknown value 0. 88 os-windows value 1. 88 os-cygwin value 2. 88 os-unix value 3. [/code] This is calling sentence [code] call "GETOSTYPE" end-call move return-code to os-type [/code] Any idea? Thanks Marcello ---------------------------------------------------------------- Hi. What is "GETOSTYPE"? If is a OS tool try to use CALL "SYSTEM" USING "GETOSTYPE" Put the tectonics please. ---------------------------------------------------------------- Hallo, as for user manual, it should be a "call by-name". Marcello ---------------------------------------------------------------- GETOSTYPE is a subroutine that's part of the "OCic" program whose listing is included in the Programmer's Guide. It is NOT a built-in feature of OpenCOBOL. ---------------------------------------------------------------- Subject: Key Compression for Indexed files Anyone know if there is a way to use key compression for indexes. I am busy changing the code (SELECT STATEMENTS) for the APAC Accounting system and have used SET KEYCOMPRESS (MF)for the indexes. Is there something similar in OpenCobol? Should I just delete this feature and hopefully in the future this will become available in OpenCobol. :-( ---------------------------------------------------------------- Some ISAM options, such as VB-ISAM, C-IS*M (D-IS*M ?), do support key compression. However OC does not support key compression for indexes. ---------------------------------------------------------------- Subject: CALL hello. I made ​​my first program GUI (fp.exe) with Qt. This is a simple window display. Launching fp.exe works fine in a simple Cobol program (tc.cob > tc.exe) I want to start fp.exe with a CALL instruction CALL "fp" or CALL "fp.exe" does not work as fp or fp.exe not be found. Yet tc.exe fp.exe and are in the same folder I must be wrong on the coding of the verb CALL ... Can someone help me? thank you OpenCOBOL under MS-Windows Gary Cutler ‘ distribution erb). Build from the 06FEB2009 OC 1.1 distribution [Last Update : 02 DEC 2010] ---------------------------------------------------------------- If you are trying to run an EXE, use the built-in subroutine SYSTEM to execute the command line you need. Check section 7.3.1.39 (CALL “SYSTEM” USING command) of the Programmer's Guide that was included in my 06FEB2009 distribution. ---------------------------------------------------------------- What CutlerGL wanted to say is: CALL-verb calls a COBOL program/module, not an exe-file (which can be called using CALL SYSTEM). I'd suggest to compile fp to a module (just leave the -x switch out) and your CALL will work. If you need to be able to call it both from the COBOL runtime and from outside you can either use [code]cobcrun fp[/code] after you compiled it or write an additional COBOL wrapper fpcall.cob that is compiled with -x and just does a [code]CALL "fp"[/code]. human ---------------------------------------------------------------- Hello. Thank you friends, but as you know I'm not a champion of C. With Qt I found a way to generate C + + programs that work well and could constitute a library to easily manage the GUI for OpenCobol. Could you give me an example please. Thank you in advance Good Easter weekend. ---------------------------------------------------------------- See http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1221&forum=1#forumpost6113 for some hints on getting proper name linkage and other odds and sods. Cheers, Brian ---------------------------------------------------------------- Subject: Solaris x86.64 cannot find files to fix libdb message Hi I've seen this error talked about in a few posts here but I cannot find anything to fix it for Solaris 10 x86_64 .. checking for dbopen in -ldb-4.1... no checking for __db_open in -ldb-4... no checking for dbopen in -ldb-4... no checking for __db_open in -ldb... no checking for dbopen in -ldb... no configure: error: libdb is required Thanks for any help e ---------------------------------------------------------------- Solution 1: Install BDB if it isn't installed or too old (this is not very likely to be the problem) Solution 2: run ldconfig as root Solution 3: add the path from BDB installation to LD_LIBRARY_PATH (this is most likely the problem) human ---------------------------------------------------------------- Thanks for your help, human. I'll work on it once I stop Virtualbox from crashing! ---------------------------------------------------------------- Subject: Newbe stuck on 1st base.... Hi, Im an old mainframe COBOL programmer from 40 years back thinking I would like to get back into COBOL... downloaded 1.0 onto my home XP machine and failing to get past step 1 in the install.... doesn't bode well I guess....anyway, wont give up quite yet...Im in the sys32 command screen and its telling me "./configure" is not recognised as an internal or external command..can someone please point me in the right direction? many thanks David ---------------------------------------------------------------- Try clicking the "Wiki" link on the left of this page. Next, click the "Assorted Documents" link. Scroll down until you find a ".zip" file listed and read it's description. That should be just what you need! ---------------------------------------------------------------- I would definitely go with release 1.1 and not 1.0. Have you ever worked in/with Unix (or Linux). If you have SOME familiarity with it, then you can use my document of OpenCOBOL for Windows users. If you do NOT have any familiarity (or desire for) Linux/Unix (or emulators for such), teen otehrs can help you with the best way for a Windows person to work with OC. ---------------------------------------------------------------- Hiya Tapda01 Me pa is an old COBOLer like you. I set him up with the mingwin package found here: http://www.opencobol.org/modules/bwiki/index.php?Assorted%20Documents It's extremely easy to setup. Just follow the instructions in the zipped file. Let me know if you have any issues. Also if you head over http://add1tocobol.com and join us in chat we can help you live. Cheers! Damon ---------------------------------------------------------------- I've updated the Install Guide to inform everyone that the instructions there are mainly written for POSIX compatible systems, and mentioned Gary's links for developers using Windows. Cheers, Brian ---------------------------------------------------------------- Brian, I didn't check. Do you already mention my "Getting Started with OpenCOBOL for <Windows> Dummies (like me)" at: [url=http://opencobol.add1tocobol.com/oc_gettingstarted_windows.html]http://opencobol.add1tocobol.com/oc_gettingstarted_windows.html[/url] ---------------------------------------------------------------- No I did not. But I will now. :-) Cheers, Brian Edit: Done. ---------------------------------------------------------------- Subject: problem reading file on linux NFS directory I have been searching the forum and can't find anything on this problem. We have a Linux directory in a test are that is linked via NFS to a directory on a Solaris machine. We also have a dvlp area on that same machine where we don't use NFS. When we run the cobol program in the dvlp area, it works. When we run the program test area we get a return code of 30. The file is a standard Unix text file, but in the test area, it is located physically on the Solaris server. In the dvlp area it is located on the Linux server. I verified that we can access this file on the Linux server using vi and cat. A final note, the Solaris box is Sparc and the Linux box is x64. Has anyone had a similar problem with accessing a file via an nfs link? Thanks, Steve ---------------------------------------------------------------- I guess you getting file status 30? What statement provoke this? Does this happen when doing OPEN OUTPUT, too? What version of OpenCOBOL do you use (cobc --version, especially the packaged date) Are you able to debug libcob/fileio.c on this machine if we don't find any solution? human ---------------------------------------------------------------- Hi, The version information is: cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Jan 26 2011 16:08:44 Packaged Feb 06 2009 10:30:55 CET The Cobol statement that gets this error is: OPEN INPUT FILE1 File 1 is defined in FILE-CONTROL as follows: SELECT FILE1 ASSIGN TO "$ITAS_INTRF_FILE" ORGANIZATION IS LINE SEQUENTIAL ACCESS MODE IS SEQUENTIAL FILE STATUS WS-FILE-1-STATUS. The environment variable $ITAS_INTRF_FILE contains the absolute path to the filename like so "/home/tas/test/intrf/file-name". However, since this is a NFS share, a df -h shows the following definition for this directory location: phxbrits05.revenue.int:/u06/tas/test/intrf 68G 22G 46G 33% /home/tas/test/intrf We can certainly do a debug if that proves necessary. Fortunately this is the dev/test server. The main problem we will have is finding a C programmer who has experience working with C in a Unix environment. I am thinking I should write a very short Cobol program that does nothing but open this file and writes it to an output file. That will make testing this problem much simpler. So, while waiting for a response I will be working on a small test program. Thanks, Steve ---------------------------------------------------------------- The small test prog seems the logical step. If you get the same results thre, please try if there is any difference if you use ASSIGN TO "/home/tas/test/intrf/file-name" (therefore if you don't use env vars) and if not if you use the path from df -h ASSIGN TO "/u06/tas/test/intrf". human ---------------------------------------------------------------- I generated a small test progrma and get the same error opening a file for output in that nfs file share. I did as you suggested and tried the direct path replacing the environment variable. No change in behavior. I then tried the path /u06/... which ended with a return code of 30. This program does run if I point it to a non-nfs area. Steve ---------------------------------------------------------------- Just to get this clear: you get a file status 30 in every case on this NFS share, correct? Please submit your small code sample (using code tags, you can insert them using the <>-button), the compile command and output on running it. I guess you didn't have any patches applied to the open-cobol tarbal? human ---------------------------------------------------------------- The original program gets a 30. My test program just hangs. I also noted that when I open a file for output on the nfs share, it does create the file. It just seem word never gets back to Cobol that the file is there for it to use. Again, it just hangs. It takes about a minute before I can cancel the job with a cntl-c. The source code I am running is below. I compiled the program using the command: cobc -x hello.cob I have gone back to using environment variables to specify the input and output locations. All this program does is a file copy. I did change one line in the tarball. This was a change to allow the compiler to accept a 77 filler pic x(32) value"...". We use this to mark the beginning of working-storage. [code] * Sample COBOL program IDENTIFICATION DIVISION. PROGRAM-ID. hello. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT FILE1 ASSIGN TO "$TEST_INPUT_FILE" * ASSIGN TO "/home/tas/dvlp/intrf/CSH_BRITS_test2.TXT" ORGANIZATION IS LINE SEQUENTIAL ACCESS MODE IS SEQUENTIAL FILE STATUS FILE1-STATUS. SELECT FILE2 ASSIGN TO "$TEST_OUTPUT_FILE" * ASSIGN TO "/home/tas/test/intrf/TEST.TXT" * ASSIGN TO "/u06/tas/test/intrf/TEST.TXT" ORGANIZATION IS LINE SEQUENTIAL ACCESS MODE IS SEQUENTIAL FILE STATUS FILE2-STATUS. DATA DIVISION. FILE SECTION. FD FILE1 BLOCK CONTAINS 0 RECORDS LABEL RECORDS ARE STANDARD RECORDING MODE IS F DATA RECORD IS INPUT-RECORD. 01 INPUT-RECORD PIC X(5000). FD FILE2 BLOCK CONTAINS 0 RECORDS LABEL RECORDS ARE STANDARD RECORDING MODE IS F DATA RECORD IS OUTPUT-RECORD. 01 OUTPUT-RECORD PIC X(5000). WORKING-STORAGE SECTION. 01 WORKING-STORAGE-FIELD. 05 FILE1-STATUS. 10 WS-STATUS-11 PIC X. 10 WS-STATUS-12 PIC X. 05 FILE2-STATUS. 10 WS-STATUS-21 PIC X. 10 WS-STATUS-22 PIC X. 05 WS-REC PIC X(5000). 01 PROGRAM-LOOP PIC x(1). 88 FILE-END VALUE 'E'. PROCEDURE DIVISION. DISPLAY "Begin Test". DISPLAY "OPEN FILE1". OPEN INPUT FILE1. IF WS-STATUS-11 > 1 THEN DISPLAY 'FILE1 OPEN FILE STATUS CODE =' FILE1-STATUS STOP RUN END-IF DISPLAY "OPEN FILE2". OPEN OUTPUT FILE2. IF WS-STATUS-21 > 1 THEN DISPLAY 'FILE2 OPEN STATUS CODE = ' FILE2-STATUS CLOSE FILE1 STOP RUN END-IF DISPLAY "PERFORM THE FILE COPY". PERFORM READ-WRITE-FILE UNTIL FILE-END. CLOSE FILE1. CLOSE FILE2. STOP RUN. READ-WRITE-FILE. READ FILE1 AT END SET FILE-END TO TRUE. IF WS-STATUS-11 NOT = 0 AND WS-STATUS-11 NOT = 1 THEN DISPLAY 'FILE1 STATUS CODE =' FILE1-STATUS END-IF MOVE INPUT-RECORD TO WS-REC. WRITE OUTPUT-RECORD FROM WS-REC. IF FILE2-STATUS NOT = '00' THEN DISPLAY 'FILE2 STATUS CODE =' FILE2-STATUS END-IF. [/code] ---------------------------------------------------------------- Hi, just to be sure, it doesn't matter if you use [code] FD FILE1. 01 INPUT-RECORD PIC X(5000).[/code] correct? As a bug sample prog should be easy as possible, this would be better here. Please translate the program and run it according to that with -x -ftraceall and run it [code]cobc -x -ftraceall hello.cob ./hello 1>hello.out 2>hello.err[/code] wait some minutes before terminating hello and post output of hello.out/err here. human ---------------------------------------------------------------- I simplified the program as suggested by commenting out the unneeded lines for both FD statements. I recompiled the program with the -ftraceall option as requested. I waited for several minutes and then terminated the program with a cntl-c. Just as a test, I wrote s simple perl program to do the same thing as this cobol program and it worked fine. hello.out Begin Test OPEN FILE1 hello.err PROGRAM-ID: hello: ENTRY hello PROGRAM-ID: hello: MAIN SECTION PROGRAM-ID: hello: MAIN PARAGRAPH PROGRAM-ID: hello Line: 53 Statement: DISPLAY PROGRAM-ID: hello Line: 54 Statement: DISPLAY PROGRAM-ID: hello Line: 55 Statement: OPEN Abnormal termination - File contents may not be correct ---------------------------------------------------------------- One more piece of technical information. On the Linux side we are using NFS version 4 but we had to use version 3 protocol to make it work with our Solaris 9 environment. ---------------------------------------------------------------- When the system hangs, as described above, it is problably a NFS issue. So you need to try to isolate the problem. Is it a OC specific issue. The following shell script and C program may help. It should create two files, 40 and 200 bytes in size. If the shell script and C program work as expected, then it is a OC specific issue. Shell script: [code] #!/bin/bash - # # Shell script to test NFS using a shell script and a C program # cmd: wtest01.sh [ directory file-name-1 file-name-2 ] # e0a="invalid number of parms..." e0b="invalid option(s) " e0c="Shell script to test NFS using a shell script and a C program" e0d="cmd: wtest01.sh [ directory file-name-1 file-name-2 ]" # p_print1 () { for arg in "$@" do echo $arg >&2 done } # if [ \( "$#" -ne 0 \) -a \( "$#" -ne 3 \) ] then p_print1 "$e0a" "$e0c" "$e0d" exit 1 fi # # Set defaults # /home/tas/test/intrf/file-name d01=/home/tas/test/intrf #d01=. f01=wfile01.txt f02=wfile02.txt # # Override defaults if [ "$#" -eq 3 ] then d01=$1 f01=$2 f02=$3 fi # wst01='1 2 3 4 5 6 7 8 9 0' # exe=wtest02 # # if [ \( ! -d "$d01" \) -o \( ! -x "$d01" \) ] then e1="error: directory $d01 not found or not executable ..." p_print1 "$e1" "$e0c" "$e0d" exit 1 fi # p_main () { # Create test file-1 using re-direction (40 bytes) printf "%s\n%s\n" "$wst01" "$wst01" > $d01/$f01 # Using C program create and read test-file-2 (200 bytes) $exe $d01 $f02 #$exe $d01 $f02 | grep -n 0 # get files sizes ls -l $d01/$f01 $d01/$f02 # Browse files (press q to exit file) #less -N $d01/$f01 $d01/$f02 } # p_main [/code] C program: [code] /* | wtest02.c | | This program will create and read NFS test-file-2 (200 bytes) | cmd: wtest02 directory-name file-name */ #define MAXLEN 1024 #define MAXLENPATH 255 #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <string.h> #include <errno.h> //#include <getopt.h> int main(int ac, char *av[]) { FILE *fp; int r=0, i, bsize; char wst01[21] = "1 2 3 4 5 6 7 8 9 0\n", fname[MAXLEN + 1] = "", fbuf[MAXLEN + 1], errmsg[MAXLEN + 1], errstr01[] = "Invalid number of input parms", errstr02[] = "Program to create and read NFS test-file-2 (200 bytes)", errstr03[] = "cmd: wtest02 directory-name file-name"; /* Check command line parms */ if ( ac != 3) { r = 1; fprintf(stderr, "%s\n%s\n%s\n", errstr01, errstr02, errstr03); return r; } strncpy(fname, av[1], MAXLENPATH); strncat(fname, "/", 2); strncat(fname, av[2], MAXLENPATH); memset(fbuf, '\0', MAXLEN + 1); /* Open file for output */ if ( (fp = fopen(fname, "w")) == NULL) { r = 1; sprintf(errmsg, "%s : Open error for file '%s' errno=%d ", av[0], fname, errno); perror(errmsg); return r; } /* Write output */ strcpy(fbuf, wst01); for (i=0; i<10; i++) fputs (fbuf, fp); /* Close file */ if (fclose(fp) != 0) { r = 2; sprintf(errmsg, "%s : Close error for file '%s' errno=%d ", av[0], fname, errno); perror(errmsg); return r; } /* Open file for input */ if ( (fp = fopen(fname, "r")) == NULL) { r = 3; sprintf(errmsg, "%s : Open error for file '%s' errno=%d ", av[0], fname, errno); perror(errmsg); return r; } /* Read file and display contents */ bsize = sizeof(fbuf); fgets(fbuf, bsize, fp); while (!feof(fp)) { fputs (fbuf, stdout); fgets(fbuf, bsize, fp); } /* Close file */ if (fclose(fp) != 0) { r = 2; sprintf(errmsg, "%s : Clode error for file '%s' errno=%d \n", av[0], fname, errno); perror(errmsg); return r; } return r; } [/code] Make file: [code] SHELL=/bin/sh #g_includes=-I/usr/local/include #g_libraries=-L/usr/local/lib CCX=gcc INCLUDES=-I./ ${g_includes} CCXFLAGS=${INCLUDES} -g LIBS=${g_libraries} EXTRALIBS= LDFLAGS= SRC01 = wtest02.c OBJ01 = $(SRC01:.c=.o) OBJS = $(OBJ01) PROG01 = wtest02 PROGS = $(PROG01) # Rules for compiling .c sources .SUFFIX: .c .o .c.o: $(CCX) $(CCXFLAGS) -c $< # all: ${PROGS} ${PROG01}: ${OBJ01} $(CCX) -o $@ ${OBJ01} $(LDFLAGS) $(LIBS) # strip $@ cleanall allclean: clean cleanfiles clean: @${RM} ${OBJS} $(PROGS) core cleanfiles filesclean: @${RM} /home/tas/test/intrf/wfile01.txt /home/tas/test/intrf/wfile02.txt \ wfile01.txt wfile02.txt [/code] Build and run: [code] make wtest01.sh 2>&1 | tee wtest01.trace.01.txt [/code] Hope this helps. ---------------------------------------------------------------- The instructions above did work as expected. Both files were created in the /home/tas/test/intrf/ NFS shared directory. So, that means the problem is specific to OpenCobol. I don't know what the next steps are but assume we will need a debug session of some kind. I am requesting we get ddb installed on our server and have located a C programmer on our staff to work on this on Monday/Tuesday. Our though, if there are no directed steps from the forum will be to walk through fileio.c and find which command in the c code that the job fails on. Steve ---------------------------------------------------------------- I'm suprised. I expected a NFS problem, considering that the OC run-time is written in C. Maybe it is a compiler directive, as some of those options can cause problems. BTW, I'm ondering if the SUN server uses some form of character encoding. ---------------------------------------------------------------- I was hoping it was NFS too. Then I could get the system admin back in the loop to figure out what's wrong. It could still be some sort of subtle NFS problem, I suppose. As for compiler directives, I am going with the defaults except for using the -x option to generate an executable. I don't know what Sun Sparc does. All I know is that nothing else has this problem. ---------------------------------------------------------------- For file IO, the OC RT uses pointer to functions, so it will be cumbersome to debug. Have you tried any tests using COBOL SEQUENTIAL files. The OC RT uses different C functions for LS and SEQ files. It is long shot, but maybe the problem is specific to certian functions. ---------------------------------------------------------------- Take a peek at http://opencobol.add1tocobol.com/#what-stock-call-library-does-opencobol-offer and 4.5.1 to see if you can't sneak in an error handler to get a peek at the file status before the abend. Cheers, Brian ---------------------------------------------------------------- I just tried changing the organization from line sequential to sequential and I get the same behavior. File not found. ---------------------------------------------------------------- I tried putting in a error handler as you suggested. I don't know if I did it right, but the program just hangs on the attempt to run it and open a file on the NFS share. I then ran it on an non-NFS share where it ran normally. Here is the code for this modified program with the error handler included. We did try running an earlier version of this program using GDB and did see a return code of 35. Then the debugger hung up as well. We had to close the putty session and start over with a new one. [code] * Sample COBOL program IDENTIFICATION DIVISION. PROGRAM-ID. hello_errorhandler. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT FILE1 ASSIGN TO "$TEST_INPUT_FILE" ORGANIZATION IS LINE SEQUENTIAL FILE STATUS FILE1-STATUS. SELECT FILE2 ASSIGN TO "$TEST_OUTPUT_FILE" ORGANIZATION IS LINE SEQUENTIAL FILE STATUS FILE2-STATUS. DATA DIVISION. FILE SECTION. FD FILE1. 01 INPUT-RECORD PIC X(5000). FD FILE2. 01 OUTPUT-RECORD PIC X(5000). WORKING-STORAGE SECTION. * entry point handlers are procedure addresses 78 err-proc-install value 0. 01 install-address usage is procedure-pointer. 01 install-flag pic 9 comp-x value 0. 01 status-code pic s9(9) comp-5. * exit handler address and priority (prio is IGNORED with OC1.1) 01 install-params. 02 exit-addr usage is procedure-pointer. 02 handler-prio pic 999 comp-x. * indexing variable for back scannning error message strings 01 ind pic s9(9) comp-5. * work variable to demonstrate raising exception, not RTE 01 val pic 9. * mocked up error procedure reentrancy control, global level 01 once pic 9 value 0. 88 been-here value 1. * mocked up non-reentrant value 01 global-value pic 99 value 99. 01 WORKING-STORAGE-FIELD. 05 FILE1-STATUS. 10 WS-STATUS-11 PIC X. 10 WS-STATUS-12 PIC X. 05 FILE2-STATUS. 10 WS-STATUS-21 PIC X. 10 WS-STATUS-22 PIC X. 05 WS-REC PIC X(5000). 05 READ-COUNT PIC 9999 VALUE 0. 05 loop-count pic 9999. 01 PROGRAM-LOOP PIC x(1). 88 FILE-END VALUE 'E'. * LOCAL-STORAGE SECTION comes into play for ERROR_PROCs that * may themselves cause run-time errors, handling reentry. local-storage section. 01 reenter-value pic 99 value 11. * Linkage section for the error message argument passed to proc * By definition, error messages are 325 alphanumeric linkage section. 01 err-msg pic x(325). PROCEDURE DIVISION. DISPLAY "Begin Test". DISPLAY "OPEN FILE1". set install-address to entry "err-proc". call "CBL_ERROR_PROC" using err-proc-install, install-address returning status-code. if status-code not = 0 then display "Error: Could not register error procedure" end-if OPEN INPUT FILE1. IF WS-STATUS-11 > 1 THEN DISPLAY 'FILE1 OPEN FILE STATUS CODE =' FILE1-STATUS STOP RUN END-IF DISPLAY "OPEN FILE2". OPEN OUTPUT FILE2. IF WS-STATUS-21 > 1 THEN DISPLAY 'FILE2 OPEN STATUS CODE = ' FILE2-STATUS CLOSE FILE1 STOP RUN END-IF DISPLAY "PERFORM THE FILE COPY". PERFORM READ-WRITE-FILE UNTIL FILE-END. CLOSE FILE1. CLOSE FILE2. DISPLAY "NUMBER OF RECORDS PROCESSED = " READ-COUNT. DISPLAY "END OF COPY JOB". STOP RUN. READ-WRITE-FILE. READ FILE1 AT END SET FILE-END TO TRUE. ADD 1 TO READ-COUNT. IF WS-STATUS-11 NOT = 0 AND WS-STATUS-11 NOT = 1 THEN DISPLAY 'FILE1 STATUS CODE =' FILE1-STATUS END-IF MOVE INPUT-RECORD TO WS-REC. WRITE OUTPUT-RECORD FROM WS-REC. IF FILE2-STATUS NOT = '00' THEN DISPLAY 'FILE2 STATUS CODE =' FILE2-STATUS CLOSE FILE1 CLOSE FILE2 STOP RUN END-IF. * programmer control error procedure 999-err-proc. entry "err-proc" using err-msg. display "*** A runtime error has occurred ***". perform varying ind from 1 by 1 until (err-msg(ind:1) = x"00") or (ind = length of err-msg) continue end-perform. display err-msg(1:ind) end-display. exit program. [/code] ---------------------------------------------------------------- We have found the problem we think. Our C developer did some work with GBD and found in fileio.c the following line 842: if (fcntl (fileno (fp), F_SETLK, &lock) < 0) { This is the command that the system is hanging up on. He did some research and there are some bugs in the way various versions of NFS handle this command. There are a couple of solutions. We are running V3 of NFS on the Solaris server. One suggestion is to back level to version 2.2. Another is to upgrade to V4 on the Solaris server so it is running the same version as our Linux machine. There are a few other things to try as well. I will post later what our fix is. I guess the best news is we don't need to change OC at this time to resolve the problem. Steve ---------------------------------------------------------------- Please give us as much information about the problem as possible: - On what command does the system hang (fcntl/fileno)? - In which cases does the system hang (version nn of xyz)? - Is there a possible code solution? human ---------------------------------------------------------------- The problem is resolved. This ended up not requiring any code changes to OC. In fact is was not an OC problem. It had to do with a missing daemon not running for NFS on our host for the file share and also a version issue between NFS's. Initially, to get the shares to work, our sys admin had, on Linux, version 4 of NFS running in version 3 compatibility mode. Solaris was running version 4. He changed the settings on the Linux server to just be version 4. The second problem was a missing service on the Solaris server that handles the file locking. This service is called "lockd". He started that up as well. Then he re-attached the NFS shares and all of our tests started working. The tester then ran the real Cobol program that we use in production and it ran as well. So, problem solved. Thanks very much for taking the time to help with diagnosing this problem. Steve ---------------------------------------------------------------- Good to know. I still wonder if configure couldn't / shouldn't check if F_SETLK works (I guess this was the problem). This would surely help to see this case BEFORE installation. Is there any possibility that you write a (small as possible) C program creating a new file and set a lock on it? I guess this would hang if the lockd service is not up. IF you could test this, we may could integrate this program into configure checks. human ---------------------------------------------------------------- Sorry for getting back so late. I receive no emails notification at work from the forum. (Maybe I'm not supposed to?). To write such a program will require the services of the C developer that found the problem and he doesn't work on my team. Not yet anyway. I'm hoping he will be available. I will see if i can get approval for him to write such a program. ---------------------------------------------------------------- Subject: Spam in forum (why?) today we got a bunch of "spam" in the forum ("sea glass"). It seemed to me that getting this tarted ABOUT the same time as teh "fix" to not being able to sign-in. Did stopping the problem/dicussions taht were flooding teh web site CAUSE a problem with allowing spam posts? If so, is there a way to fix this? ---------------------------------------------------------------- I guess you're right. When SPAM bots getting network errors they don't try to spam any further. As the forum works well now (after the "fix" you've mentioned [disabling comments in Link area]) they'll come back. A temporary solution would be someone who gets moderation rights ins this board and is able to delete the spam posts/banning the spam bots. The only way to fix this is to change the software of this site by either updating the old Xoops installation to a more recent version or change to Wordpress/etc. As far as I'm informed btiffin is in charge to do so already. @btiffin: The temporary site is down, any new information about this (maybe per PM/Mail)? human ---------------------------------------------------------------- human, I'll send out some details shortly but for now: There is an entire team building up expertise in WordPress. I've been in some heated debate over the last couple of days, expressing my concerns that a change from XOOPS to WP would force us to all to re-register and the loss of the forum history. I've been convinced that that will NOT be the case when a move to WP occurs. The userbase and existing posts will all be migrated. WP has some "other server" based (akismet for instance) and local anti-spam techniques that seem to minimize the manual operations required to keep spammers at bay. And we'll have tools to actively keep up with the rest. The timelines won't likely be as short as everyone would like, but there is a buzz of background activity going on and there should be a burst of visible activity soon. For now, we'll just have to step lightly and try and ignore the poops. Oh, and what I figure happened: The comment poop "satisfied" the spam-bots. When those channels dried up with the recent purge, they started creeping into other corners. When the automated procedures started reporting failure to "attain today's level of poop" the routines got more aggressive and now are posting to the main in order to feel that they "did a good day's work". Soon we'll have an effective old-grouch on the porch that can yell at the spam-bots to "Get off my lawn!". ;-) Cheers, Brian ---------------------------------------------------------------- Sorry for the inconvenience :-( I have added 'human' and 'btiffin' as moderators so that you two can delete spams. Keisuke ---------------------------------------------------------------- OK, I've deleted the recent spam posts. human ---------------------------------------------------------------- Hi Brian, > I've been in some heated debate over the last couple of days, expressing my concerns that a change from XOOPS to WP would force us to all to re-register and the loss of the forum history. I've been convinced that that will NOT be the case when a move to WP occurs. The userbase and existing posts will all be migrated. I think re-registration would be acceptable as 1. there is no raw password in the database, 2. there are lots of spam accounts, and 3. loosing accounts is not crucial. I suppose transferring existing posts is the hard part. I don't want to waste your precious time for this. Having a read-only archive for reference and search (like http://www.opencobol.org/archive/) would be good enough. Keisuke ---------------------------------------------------------------- This all sounds grand. I'll get the push on then. More soon. All be well and Cheers, Brian ---------------------------------------------------------------- Subject: 348 thousand lines of nitty gritty COBOL Hey, rave posting again. If you are new or old to OpenCOBOL, make sure you check out http://opencobol.add1tocobol.com/#does-opencobol-pass-the-nist-test-suite and then go to http://www.itl.nist.gov/div897/ctg/cobol_form.htm uncompress newcob.val.Z and then enjoy reading through thousands of lines of purposely technically demanding COBOL source code that OpenCOBOL just happens to chew through nicely. [i]Well, not all of it, Communication Module and such, but the supported bits (which is a lot).[/i] Great sample code. Old school? yes. Dry boring layout? yes. Perfect. :-) I like this snippet from the debug tests: [code] 066900 DO-NOTHING. DB1014.2 067000 ADD A B C GIVING D. DB1014.2 067100 DO-NOTHING-1. DB1014.2 067200 SUBTRACT A FROM B. DB1014.2 [/code] [i]Umm, what mister Auditor? Nothing untowards here. It says it does nothing.[/i] Cheers, Brian ---------------------------------------------------------------- Subject: Beautiful OpenCOBOL source documentation by Doxygen Holy umm, something Batman I was horsing around, ran another Doxygen pass over cobc Feb2009. Holy umm, moly. Dimitri has a wicked smart generator now. Take a look at http://opencobol.add1tocobol.com/doxy/ [b]This took no effort[/b]. A few Doxyfile config settings and a [i]mainpage.h[/i]. The freekin' latex dir produces a 15 meg, 1400 page beauty of a reference manual too. Sweet. Click here to see: http://opencobol.add1tocobol.com/doxy/ocrefman.pdf ([i]but really don't, it's 15 meg of fairly dry technical totally cool material[/i]). I'm surprised and completely blown away by the quality. Anyone wanting to grok over the OpenCOBOL compiler, start here: http://opencobol.add1tocobol.com/doxy/ Thanks to Dimitri van Heesch, the Graphviz team, Roger and Keisuke. Cheers, Brian [b]Wheee[/b][b][i]eee[/i][/b][i]eee![/i] [b]Edit:[/b] Second round, I included the C code generated from Gary's OCic.cbl, in a --save-temps subdir in the compiler tree and reran Doxygen. It creates call graphs that exercise the runtime and shows how an OpenCOBOL program interacts with OpenCOBOL, right down to the compiler's internals. I'm not sure I'm going to post it though. These are super easy to create at home. The html tree for the second run is 253 meg. :) The PDF is 81meg, 2950 beautiful pages. It changes the P.O.V. from compiler study to application programmer aid. [i]And, umm, for now I'd rather promote compiler study with these pages.[/i] ;-) [b]Wheee[/b][b][i]eee[/i][/b][i]eee![/i] [b]Edit:[/b] Ok, fine, it's too cool. Have to show it off. http://opencobol.add1tocobol.com/doxyapp/ Application coders, have some fun too. This makes nice docs. [b]Edit:[/b] Oh yeah, let it be known. This is NOT a complete picture of the OpenCOBOL build environment. Roger has gone to great lengths to libtoolize the source trees, it's missing many of those supporting files. There isn't a proper copyright notice on mainpage yet. Etc. First cut total fan boy posting. Too easy. Deserving of a few 9 e wheees. ---------------------------------------------------------------- For more Wheeeeeeeees you may want to convince Roger to use Dogygen style comments. This way the docs would not only show where vars/functions/etc are defined but would show a nice description. The internal documentation via comments increases in upcoming 2.0, MAYBE a converting to doxygen style comments would be possible (if you have time you could offer Roger to do this change for him). human ---------------------------------------------------------------- I'm being semi-serious this time. I'm really thinking I'd like someone to hire me to write an app, just so I can run Doxygen across the tree and upsell the docs a few thousand. Seriously; it comes with it's own help, right out of the box. (fluke discovery, the files are already in google). http://opencobol.add1tocobol.com/doxyapp/graph_legend.html Ok, not even pretending to be semi serious now... ;-) Do the Catbert human resource thing and then follow up with Bob the Dinosaur, http://en.wikipedia.org/wiki/Bob_the_Dinosaur. [i]If you don't know Bob, he is head wedgy master and resident COBOL programmer in Dilbert world[/i] Wheeeeee. dgies... And a note to those brave souls that do the serious debugging with gdb (recommended). Roger is nice enough to define fields with working-storage names as comments, so tracer rounds with [b]watch[/b] and [b]rwatch[/b] are not too hard when translating the COBOL point of view, to umm, GNU think. See http://opencobol.add1tocobol.com/doxyapp/d2/d9d/OCic_8c_8h_source.html for a sample. Cheers, Brian p.s. More nerd. human, when I read this you were at 1226 posts. Only a 111 away from leet. Nice. ---------------------------------------------------------------- Subject: Offtopic: Condolences and Congratulations Big news. To all my southern neighbours, congratulations on ending a long draw on chase. Hope it helps brighten days ahead. As always, days remembered. Brian ---------------------------------------------------------------- Subject: A question of style Would you prefer to maintain: [code] OCOBOL >>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 05-May-2011 *> Purpose: Plot Euler's number (using integral of 1 over x) *> Tectonics: requires access to gnuplot. http://www.gnuplot.info *> cobc -Wall -x ploteuler.cob *> OVERWRITES ocgenplot.gp and ocgpdata.txt *> *************************************************************** identification division. program-id. ploteuler. environment division. input-output section. file-control. select scriptfile assign to "ocgenplot.gp" organization is line sequential. select outfile assign to "ocgpdata.txt" organization is line sequential. data division. file section. fd scriptfile. 01 gnuplot-command pic x(82). fd outfile. 01 outrec. 03 x-value pic -z9.999. 03 filler pic x. 03 y-value pic -z9.999. working-storage section. 01 xstep pic 9v99999. 01 x pic 9v99999. 01 recip pic 9v99999. 01 gpcmds pic x(400) value is "set style fill solid 1.0; " & "set grid; " & "set xtics add ('e' 2.71828182); " & "plot [0:3] [0:2] 'ocgpdata.txt' using 1:2 \ " & " with filledcurves below x1 title '1/x'; " & "set terminal png; " & "set output 'images/euler.png'; " & "replot ". 01 line-cnt pic 999. 01 gptable. 05 gpcmd pic x(50) occurs 8 times. 01 gplot pic x(40) value is 'gnuplot -persist ocgenplot.gp'. 01 result pic s9(9). *> *************************************************************** procedure division. display function e end-display *><* Create the script to plot the area of Euler's number open output scriptfile. move gpcmds to gptable perform varying line-cnt from 1 by 1 until line-cnt > 8 move gpcmd(line-cnt) to gnuplot-command write gnuplot-command end-write end-perform close scriptfile *><* Create the reciprocal data open output outfile move spaces to outrec compute xstep = function e / 100 end-compute perform varying x from 1 by xstep until x > function e move x to x-value compute recip = 1 / x end-compute move recip to y-value write outrec end-write end-perform close outfile *><* Invoke gnuplot call "SYSTEM" using gplot returning result end-call if result not = 0 display "Problem: " result end-display stop run returning result end-if goback. end program ploteuler. [/code] vs [code] OCOBOL >>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 29-May-2009 *> Purpose: Plot Euler's number *> Tectonics: requires access to gnuplot. http://www.gnuplot.info *> cobc -Wall -x ploteuler.cob *> OVERWRITES ocgenplot.gp and ocgpdata.txt *> *************************************************************** identification division. program-id. ploteuler. environment division. input-output section. file-control. select scriptfile assign to "ocgenplot.gp" organization is line sequential. select outfile assign to "ocgpdata.txt" organization is line sequential. data division. file section. fd scriptfile. 01 gnuplot-command pic x(82). fd outfile. 01 outrec. 03 x-value pic -z9.999. 03 filler pic x. 03 y-value pic -z9.999. working-storage section. 01 xstep pic 9v999. 01 x pic 9v999. 01 recip pic 9v999. 01 gplot pic x(80) value is 'gnuplot -persist ocgenplot.gp'. 01 result pic s9(9). procedure division. *><* Create the script to plot Euler's number open output scriptfile. move "set style fill solid 1.0; set grid;" to gnuplot-command write gnuplot-command end-write move "plot [0:3] [0:2] 'ocgpdata.txt' using 1:2" & " with filledcurves below x1 title '1/x'" to gnuplot-command write gnuplot-command end-write move "set terminal png; set output 'images/euler.png'; replot" to gnuplot-command write gnuplot-command end-write close scriptfile *><* Create the reciprocal data open output outfile move spaces to outrec compute xstep = function e / 100 end-compute perform varying x from 1 by xstep until x > function e move x to x-value compute recip = 1 / x end-compute move recip to y-value write outrec end-write end-perform close outfile *><* Invoke gnuplot call "SYSTEM" using gplot returning result end-call if result not = 0 display "Problem: " result end-display stop run returning result end-if goback. end program ploteuler. [/code] The second is from the FAQ, the first was yesterday, imaged below. [img]http://opencobol.add1tocobol.com/images/euler-e.png[/img] But, the new cut (wanted to add the e tic) has 400, 50, and 8 magically counted numbers. Not sure, really. So throw in if you have a preference. Cheers, Brian ---------------------------------------------------------------- Well, I think,I would prefer the first one. :-) However, coming from a mainframe Cobol background, I never have alphanumeric literals exceeding 160 characters and like to utilize redefines where ever possible. Also, I have a tendency to have the compiler supply trailing spaces on literal constants. [code] 01 gpcmds. 05 filler pic x(50) value "set style fill solid 1.0;". 05 filler pic x(50) value "set grid;". 05 filler pic x(50) value "set xtics add ('e' 2.71828182);". 05 filler pic x(50) value "plot [0:3] [0:2] 'ocgpdata.txt' using 1:2 \". 05 filler pic x(50) value " with filledcurves below x1 title '1/x';". 05 filler pic x(50) value "set terminal png;". 05 filler pic x(50) value "set output 'images/euler.png';". 05 filler pic x(50) value "replot". 01 gptable redefines gpcmds. 05 gpcmd pic x(50) occurs 8 times. [/code] ---------------------------------------------------------------- Yeah, I was trying to get the script lines in a grokable form. Your's works the beauty and 'fits'. I've updated my sample. Thanks. Cheers, Brian ---------------------------------------------------------------- I'd personally use 78er levels every time for arrays (in OCCURS clause and PERFORM statements) and define every count-only var as comp. [code] 78 gpcmd-range value 8. 01 gpcmds. 05 filler pic x(50) value "set style fill solid 1.0;". 05 filler pic x(50) value "set grid;". 05 filler pic x(50) value "set xtics add ('e' 2.71828182);". 05 filler pic x(50) value "plot [0:3] [0:2] 'ocgpdata.txt' using 1:2 \". 05 filler pic x(50) value " with filledcurves below x1 title '1/x';". 05 filler pic x(50) value "set terminal png;". 05 filler pic x(50) value "set output 'images/euler.png';". 05 filler pic x(50) value "replot". 01 gptable redefines gpcmds. 05 gpcmd pic x(50) occurs gpcmd-range times. 77 line-cnt pic 999 value 0 comp-5. [...] perform varying line-cnt from 1 by 1 until line-cnt > gpcmd-range[/code] What do you think of [code]write gnuplot-command from gpcmd (line-cnt) end-write[/code]? human ---------------------------------------------------------------- Brian, Since the contents of the scriptfile are constant, I would not even have the Cobol program create it. I would use my trusty editor to create the command file and refer to the file when invoking gnuplot. Following in your spirit and thus opening my personal style up for critique, I also offer the following: 1) I generally do not use 66's, 78's, or 88's since they would require me to find them in the data division to see how they are defined as opposed to just reading the code at hand. 2) Capital letters are larger than lowercase ones and thus are easier for me to see. (Also my model 26 keypunch does not support lower case :-) ). 3) Given a choice I prefer shorter sentences to longer ones, so I use periods frequently. 4) I sign all variables that I perform arithmetic with. If I were to decide to have the program output the ocgenplot.gp file, I would prefer your original program since I would be able to see what was being written without having to look at the data division. jimc ---------------------------------------------------------------- Jim; On the script file. I almost did that the other night, just pull out the static text. But I wanted an easy to try example, that also maximized grokability, so I thought I'd ask if the new is more readable than the old. On the other points. I think it's time to job myself out to get in on a Programming In The Large COBOL system. Then to learn the ways of PITL and stop pretending that 50 lines "a-cobol-program makes". :-) As always, you da man. Cheers, Brian ---------------------------------------------------------------- Brian, As you know we each have different uses for the language. You provide a very valuable service when you find ways to integrate OpenCOBOL with various tools that are available now. Mercifully those demonstration programs are normally short and are not subject to ongoing maintenance efforts. They do not require the same kind of coding approach that one might employ when writing a program that could still be in use many years from now. Thank you for your contributions! They expand our horizons. jimc ---------------------------------------------------------------- Ok, so then, here is a slightly more correct version. [code] OCOBOL >>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 29-May-2009 *> Purpose: Plot Euler's number (using integral of 1 over x) *> Tectonics: requires access to gnuplot. http://www.gnuplot.info *> cobc -Wall -x ploteuler.cob *> OVERWRITES ocgenplot.gp and ocgpdata.txt *> *************************************************************** identification division. program-id. ploteuler. environment division. input-output section. file-control. select scriptfile assign to "ocgenplot.gp" organization is line sequential. select outfile assign to "ocgpdata.txt" organization is line sequential. data division. file section. fd scriptfile. 01 gnuplot-command pic x(82). fd outfile. 01 outrec. 03 x-value pic -z9.999. 03 filler pic x. 03 y-value pic -z9.999. working-storage section. 01 xstep pic 9v99999. 01 x pic 9v99999. 01 recip pic 9v99999. *> The plot command is xrange 0:3, y 0:2 data col 1 for x 2 for y 01 gpcmds pic x(400) value is "set style fill solid 1.0; " & "set grid; " & "set xtics add ('e' 2.71828182); " & "plot [0:3] [0:2] 'ocgpdata.txt' using 1:2 \ " & " with filledcurves below x1 title '1/x'; " & "set terminal png; " & "set output 'images/euler.png'; " & "replot ". 01 line-cnt pic 999. 01 gptable. 05 gpcmd pic x(50) occurs 8 times. 01 gplot pic x(40) value is 'gnuplot -persist ocgenplot.gp'. 01 result pic s9(9). *> *************************************************************** procedure division. display function e end-display *><* Create the script to plot the area of Euler's number open output scriptfile. move gpcmds to gptable perform varying line-cnt from 1 by 1 until line-cnt > 8 move gpcmd(line-cnt) to gnuplot-command write gnuplot-command end-write end-perform close scriptfile *><* Create the reciprocal data open output outfile move spaces to outrec compute xstep = function e / 100 end-compute perform with test after varying x from 1 by xstep until x >= function e if x > function e move function e to x-value else move x to x-value end-if compute recip = 1 / x end-compute move recip to y-value write outrec end-write end-perform close outfile *><* Invoke gnuplot call "SYSTEM" using gplot returning result end-call if result not = 0 display "Problem: " result end-display stop run returning result end-if goback. end program ploteuler. [/code] It gets the graphing closer to the e tic by fudging the last step and result a little. [img]http://opencobol.add1tocobol.com/images/euler-e2.png[/img] [i]It was buggin' me[/i] Cheers, Brian ---------------------------------------------------------------- Subject: Getting S0C4 & S0C7 Abends Hi, How to get S0C4 - referring to an array out of boundary & S0C7 - data exception when an non-numeric data is moved to a comp-3 item. These are common errors on Mainframe and I'm trying to simulate getting the same in OC but could not. For S0C4: [code] 01 WS-SUB PIC 9(4) VALUE 7. 01 WS-TEMP. 05 WS-ITEM OCCURS 5 TIMES PIC X(1). ... MOVE 'X' TO WS-ITEM(WS-SUB). * This should give a S0C4 as I'm referring to 7th element [/code] For S0C7: [code] 01 WS-SAL PIC 9(7) COMP-3. 01 WS-CONST PIC X(7) VALUE 'A01@'. ... MOVE WS-CONST TO WS-SAL. ADD 1 TO WS-SAL. * This should give a S0C7 data exception as comp3 item is having non-numeric data [/code] Please help. ---------------------------------------------------------------- Translate with -debug to enable all runtime checks. human ---------------------------------------------------------------- Yes, with -debug flag I'm able to get subscript out of bounds error. Could not get Data exception error :-( cobc -x -debug -o test test.cob [code] IDENTIFICATION DIVISION. PROGRAM-ID. TSTPROG. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-SUB PIC 9(4). 01 WS-COMP3 PIC 9(7) COMP-3. 01 WS-X PIC X(7) VALUE 'A01@'. 01 WS-ARRAY. 05 WS-TABLE OCCURS 5 TIMES PIC X(1). PROCEDURE DIVISION. A00-MAIN SECTION. 001-MAIN-PROCEDURE. DISPLAY "*** S0C7 DATA EXCEPTION ***". MOVE WS-X TO WS-COMP3. ADD 1 TO WS-COMP3. DISPLAY "EXCEPTION-STATUS : " FUNCTION EXCEPTION-STATUS. DISPLAY "EXCEPTION-STATEMENT: " FUNCTION EXCEPTION-STATEMENT. DISPLAY "EXCEPTION-LOCATION : " FUNCTION EXCEPTION-LOCATION. DISPLAY "*** S0C4 OUT OF BOUNDARY MEMORY EXCEPTION ***". MOVE 7 TO WS-SUB. MOVE 'X' TO WS-TABLE(WS-SUB). DISPLAY "EXCEPTION-STATUS : " FUNCTION EXCEPTION-STATUS. DISPLAY "EXCEPTION-STATEMENT: " FUNCTION EXCEPTION-STATEMENT. DISPLAY "EXCEPTION-LOCATION : " FUNCTION EXCEPTION-LOCATION. STOP RUN. [/code] Output [code] *** S0C7 DATA EXCEPTION *** EXCEPTION-STATUS : EXCEPTION-STATEMENT: EXCEPTION-LOCATION : *** S0C4 OUT OF BOUNDARY MEMORY EXCEPTION *** test.cob:31: libcob : Subscript of 'WS-TABLE' out of bounds: 7 [/code] ---------------------------------------------------------------- sajjar; Here is my (completely inexperienced) opinion on the SOC7. [code] MOVE WS-CONST TO WS-SAL [/code] is doing an element to element move, and WS-CONST is being converted to a number for you. A01@ is cast to 0. Try [code] 01 WS-SAL-GROUP. 05 WS-SAL PIC 9(7) COMP-3. 01 WS-CONST PIC X(7) VALUE 'A01@'. MOVE WS-CONST TO WS-SAL DISPLAY WS-SAL MOVE WS-CONST TO WS-SAL-GROUP DISPLAY WS-SAL [/code] the element to group move can't know the datatype so there is a byte for byte move here. The first 4 move into the COMP-3. I get [code] 0 4130314 [/code] Adding 1 to WS-SAL in the first case, is just 1. In the second case, compiled -g -debug and with the ADD, I get [code] ws-const: A01@ ws-sal: 4130314 soc7.cob:26: libcob: 'WS-SAL' not numeric: 'A01@' [/code] without -debug [code] ws-const: A01@ ws-sal: 4130314 ws-sal: 4130315 [/code] So it comes down to the GROUP move versus element move and the [b]-debug[/b] flag. And thanks sajjar; I just re-learned a little something. ;-) [i]anybody reading along[/i]; ADD ... ON SIZE ERROR won't catch these. If you need an OS/2 style crashproof(tm) application, take a look at http://opencobol.add1tocobol.com/#what-stock-call-library-does-opencobol-offer and scroll down to 4.5.1 for an example of setting up ERROR_PROC handlers. Or, better. Take a look at NUMVAL and NUMVAL-C instrinsic functions, or an IF NUMERIC test for code that is properly fenced for packed values that might come from unsavoury sources. If you are still reading and have the experience to explain tried-and-true-and-better methods to the rest of us, please do. If you are curious for details on packed decimal, like right now, check out http://www.simotime.com/datapk01.htm The SimoTime folk have posted a wondrous array of technical bits. [i]But you have to play nice. USE of any of their material is for-fee. So ... looky, no touchy. Or perhaps better, pay and get all their excellent stuffs. Me thinks they haz cheezburgerz.[/i] :-) Cheers, Brian ---------------------------------------------------------------- Thank you very much Human & Brian, problem solved. ---------------------------------------------------------------- For (IBM) mainframers, when you do and don't get a S0C7 is NOT predictable (from the COBOL source code; from the generated Assmembler, it is more so). OS/VS COBOL got different S0C7 Abends that currently supported mainframe compilers. With currently supported compilers, your setting from NUMPROC and ZWB (and possibly OPT) will impact when you do and don't get S0C7 for incompatible data. All the Standard says (and has ever said) is "results are upredictable). (Well, with the 2002 Standard, you can enable checking for EC-DATA-INCOPATIBLE, but no IBM compiler supports that). NOTE: It is ONLY on elementary moves that "incompatible data" becomes an issue. Special note to Micro Focus users. See the use of +/-F run-time switch and 163 errors ---------------------------------------------------------------- Subject: Off topic: web information Feel free to ignore. It's just a curiosity posting. From webinformation.co (bumped into it at random), tried opencobol.org [quote] www.Opencobol.org is ranked #94,023 in India. It contains content about ... Worldwide Rank 370,632 [/quote] So, then I had to visit Alexa to compare numbers. Same. [quote] Country Rank Philippines 9,086 Bangladesh 11,251 Vietnam 38,263 India 94,023 United Kingdom 151,001 United States 223,802 [/quote] What? No Canada? oc.o is a #1 site where I live. And, umm, is there a COBOL shop in the Philippines? One that would want to off-shore some work? ;) Alexa lists opencobol.org as being up 230% over the last three months, reaching 7 out every 10,000 "people". I wonder how that will track given the boot of the ding-bots. Cheers, Brian ---------------------------------------------------------------- A new tidbit. http://www.alexa.com/siteinfo/opencobol.org Hit the Audience tab. Positive Green for 18-24, red for 24-34 and green again for 34-44. [i]At my age of nearer to 50, it'd likely be a nice shade of grey.[/i] Cheers, Brian ---------------------------------------------------------------- Subject: Memory dump of program Hi, Currently with CBL_EXIT_PROC I'm printing error causing statement and location using FUNCTION EXCEPTION-STATEMENT & FUNCTION EXCEPTION-LOCATION. In addition to this, I would like to print program memory dump to a file. How to achieve this in OC ?. to be precise, memory area of all variables used in program, I want to capture. Thanks, Sajjar. ---------------------------------------------------------------- Variant 1: Print all vars into syserr using DISPLAY UPON SYSERR varname END-DISPLAY and using [url=http://opencobol.add1tocobol.com/#update-to-oc-cbl-dump]CLB_OC_DUMP[/url] to output the value. If you don't want a fast program put every variable into one big 01 level and output this. Variant 2: Hack into the C source of OpenCOBOL and add a FUNCTION or a system CALL to do this for you. human ---------------------------------------------------------------- It might be more than you need sajjar, but if you are on GNU/Linux, look into [b]ulimit[/b], in particular [i]ulimit -c unlimited[/i]. Most of the time, people don't care about core dumps, so most distro's ship with coredump limit set to 0 blocks, meaning don't write any core. [i]ulimit -a[/i] will show your current process settings. Global control is from [i]/etc/security/limits.conf[/i] and you'll likely see a line like [code] * soft core 0 [/code] Meaning all domains, soft (versus hard), core limit, 0 blocks. Tread lightly here and do not make changes to this file until you've read up. After that, there are a plethora of ways to get a core dump. Signals are a great way. On Fedora, man 7 signal and look for those listed as 'core'. Mine looks like [code] Signal Value Action Comment ────────────────────────────────────────────────────────────────────── SIGHUP 1 Term Hangup detected on controlling terminal or death of controlling process SIGINT 2 Term Interrupt from keyboard SIGQUIT 3 Core Quit from keyboard SIGILL 4 Core Illegal Instruction SIGABRT 6 Core Abort signal from abort(3) SIGFPE 8 Core Floating point exception SIGKILL 9 Term Kill signal SIGSEGV 11 Core Invalid memory reference SIGPIPE 13 Term Broken pipe: write to pipe with no readers SIGALRM 14 Term Timer signal from alarm(2) SIGTERM 15 Term Termination signal SIGUSR1 30,10,16 Term User-defined signal 1 SIGUSR2 31,12,17 Term User-defined signal 2 SIGCHLD 20,17,18 Ign Child stopped or terminated SIGCONT 19,18,25 Cont Continue if stopped SIGSTOP 17,19,23 Stop Stop process SIGTSTP 18,20,24 Stop Stop typed at tty SIGTTIN 21,21,26 Stop tty input for background process SIGTTOU 22,22,27 Stop tty output for background process [/code] So, a quit ([i]Ctrl-backslash / SysRq[/i]) will actually cause a core dump, as would [code] 01 SOME-VAR PIC X BASED. DISPLAY SOME-VAR END-DISPLAY *> with no allocate [/code] Trying to access an unallocated SOME-VAR will cause a SIGSEGV. or [i]probably better[/i] [code] >>D CALL "abort" END-CALL [/code] compile with cobc -fdebugging-line, the code will SIGABRT and you get a core, compile without debug lines and you'll get a normal run. [i]A very cool feature of OpenCOBOL and cobc is that we get all the libc6 functions 'for free', with no need to modify tectonics.[/i] Then good old [b]gdb[/b] and EXAMINE can be used to look through the entire program space (assuming coredump limit is an appropriate value). See Richard Stallman's notes at http://www.unknownroad.com/rtfm/gdbtut/gdbadvanced.html for some details. For a less geeky solution, see human's latest CBL_OC_DUMP utility listed at http://opencobol.add1tocobol.com/#what-is-cbl-oc-dump (listed twice, with the second one the latest). Set the variable to dump from the top of WORKING-STORAGE and give it an appropriate size. As long as it's contiguous space, all should be well. If you go past working store, it'll be garbage and maybe a SIGSEGV, in which case, hey, core. ;-) If you are looking for something along the lines of SNOBOL and Icon's [b]&dump[/b], end of run dump setting, then you'll need to write it, as human suggested. Cheers, Brian ---------------------------------------------------------------- Trying to chrash the program via accessing unallocated stuff is more than dirty and wouldn't work if you use -debug (what I'd suggest to use in most cases, even in production). The call to abort seems nice. I didn't thought about passing the address of the first var in WORKING-STORAGE to CBL_OC_DUMP together with a size param that has the whole WORKING-STORAGE in. Sounds risky (think of BASED items) and misses the LOCAL-STORAGE and LINKAGE items. human ---------------------------------------------------------------- CBL_OC_DUMP looks very promising, I will give a try. Thanks for different approaches proposed. I'm using Ubuntu 10.04 Linux OS. -Sajjar ---------------------------------------------------------------- Sajjar, human; I tweaked my copy of CBL_OC_DUMP to handle an optional length with [code] LINKAGE SECTION. 01 buffer pic x any length. 01 blen usage binary-long. 77 byte pic x. [/code] and [code] PROCEDURE DIVISION USING buffer optional blen. [/code] and [code] STARTING-ADDRESS SECTION. *00. * Get the length of the transmitted buffer IF blen IS OMITTED CALL 'C$PARAMSIZE' USING 1 GIVING len END-CALL ELSE MOVE blen TO len END-IF [/code] but it changes the interface to [code] CALL "CBL_OC_DUMP" USING buffer OMITTED [/code] for the times you want COBOL to figure out the buffer size. Cheers, Brian ---------------------------------------------------------------- As said before: this is VERY dirty if you pass a big size, because you don't know exactly where to look in the memory for your vars (think of BASED items, for example)! If you doesn't want to dump a whole var use [code] CALL "CBL_OC_DUMP" USING buffer (001:100) END-CALL[/code] human ---------------------------------------------------------------- Subject: Simple profiling of OpenCOBOL programs (and a question) sajjar's last question (and my likely useless response), got me thinking about this little snippet you can add to programs for a 'bird's eye view' profiling the performance. [code] OCOBOL*>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20110512 *> Purpose: Getting at the clock and making core dumps *> Tectonics: cobc -g -x sigsegv.cob *> cobc -g -x -fdebugging-lines sigsegv.cob *> *************************************************************** identification division. program-id. sigsegv. data division. working-storage section. 01 cause-dump pic x based. 01 clocks usage binary-long. 01 loops usage binary-long. *> *************************************************************** procedure division. call "time" using null returning clocks end-call display "epoch time: " clocks end-display call "clock" returning clocks end-call display "clocks: " clocks end-display perform varying loops from 1 by 1 until loops > 100000000 end-perform call "clock" returning clocks end-call display "clocks: " clocks end-display call "time" using null returning clocks end-call display "epoch time: " clocks end-display >>D call "abort" end-call display cause-dump end-display goback. end program sigsegv. [/code] which gives [code] $ cobc -x -fdebugging-line sigsegv.cob $ ./sigsegv epoch time: +1305258115 clocks: +0000000000 clocks: +0000440000 epoch time: +1305258115 Aborted (core dumped) [/code] so my little box evaluates 100 million nothings in under a second. Now the question. While I was horsing around I tried cranking the nothing loop to 1000 million, expecting a predictable order of magnitude change in elapsed time, so somewhere less than 10 seconds. But, life being what it is, I ended up confused. [code] $ time ./sigsegv epoch time: +1305258337 clocks: +0000000000 clocks: +0066150000 epoch time: +1305258403 Aborted (core dumped) real 1m6.411s user 1m6.162s sys 0m0.006s [/code] Over a minute. ??? Umm, I'd like to ask the board why a machine can do 100 million nothings in .44 seconds, but 1000 million nothings in 66? For technical detail junkies; [i]ignoring the usual reluctance to post information that blackhats might find tantalizing[/i] [code] $ cat /proc/cpuinfo processor : 0 vendor_id : AuthenticAMD cpu family : 16 model : 6 model name : AMD Athlon(tm) II X2 215 Processor stepping : 2 cpu MHz : 800.000 cache size : 512 KB physical id : 0 siblings : 2 core id : 0 cpu cores : 2 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 5 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt npt lbrv svm_lock nrip_save bogomips : 5400.71 TLB size : 1024 4K pages clflush size : 64 cache_alignment : 64 address sizes : 48 bits physical, 48 bits virtual power management: ts ttp tm stc 100mhzsteps hwpstate processor : 1 vendor_id : AuthenticAMD cpu family : 16 model : 6 model name : AMD Athlon(tm) II X2 215 Processor stepping : 2 cpu MHz : 800.000 cache size : 512 KB physical id : 0 siblings : 2 core id : 1 cpu cores : 2 apicid : 1 initial apicid : 1 fpu : yes fpu_exception : yes cpuid level : 5 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt npt lbrv svm_lock nrip_save bogomips : 5399.96 TLB size : 1024 4K pages clflush size : 64 cache_alignment : 64 address sizes : 48 bits physical, 48 bits virtual power management: ts ttp tm stc 100mhzsteps hwpstate [/code] And just so you know, that the only change is 100000000 to 1000000000. [code]OCOBOL*>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20110512 *> Purpose: Getting at the clock and making core dumps *> Tectonics: cobc -g -x sigsegv.cob *> cobc -g -x -fdebugging-lines sigsegv.cob *> *************************************************************** identification division. program-id. sigsegv. data division. working-storage section. 01 cause-dump pic x based. 01 clocks usage binary-long. 01 loops usage binary-long. *> *************************************************************** procedure division. call "time" using null returning clocks end-call display "epoch time: " clocks end-display call "clock" returning clocks end-call display "clocks: " clocks end-display perform varying loops from 1 by 1 until loops > 1000000000 end-perform call "clock" returning clocks end-call display "clocks: " clocks end-display call "time" using null returning clocks end-call display "epoch time: " clocks end-display >>D call "abort" end-call display cause-dump end-display goback. end program sigsegv. [/code] So, again, the 0.44 should increase to 4.4, should it not? Cheers, Brian ---------------------------------------------------------------- Run the test again in single user mode. ---------------------------------------------------------------- I tried two other options and neither seem to induce the large change in time. I ran the original version, and got the short time. I ran the original version with additional 0 added to the time, and saw the large increase in time. I then removed the extra 0 of the loop and placed that loop in a perform 5 times loop, and noticed little difference in run time. Then I converted the number to a variable. 01 loops-count usage binary-long value 1000000000. Commented out the 5 times loop, and changed the perform. varying loops from 1 by 1 until loops > loops-count It may be how the loop is using the constant value. I have a AMD Phenom II quad system. ---------------------------------------------------------------- Good to know it's not just my machine, msetzerii. Yeah, the technarcanery of COBOL compares, may be rearing it's head. I'm about to run Doxygen over the save-temps C stashed beside the compiler. Should make it easy to backtrack over the C data types generated by cobc. Try and learn some voodoo, err ahh, [i]digital numerical details that require 3 and 3/4's more IQ points than I'll ever achieve[/i]. :-) Cheers, Brian ---------------------------------------------------------------- Reminded me of a problem I use to show my students in the beginning C class years ago with an old Dos compiler in which they would multiple of integer values and constants and get the wrong answer since it overflowed an integer limit. By adding an L to one of the constants or using a (long) casting would then get the correct answer in the equation. ---------------------------------------------------------------- @msetzerii: I guess you didn't know of your cheating, but I wonder why because cobc tells you about this: "Warning: Value size exceeds data size" for loops-count usage binary-long value 1000000000. Therefore you define 01 loops-count usage binary-long value zero (which of course loops very fast :-) It has no difference if you use a constant or not [code]OCOBOL*>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin, human *> Date: 20110512, 20110516 *> Purpose: Getting at the clock and compare different loops *> Tectonics: cobc -x loopstime.cob *> *************************************************************** identification division. program-id. loopstime. data division. working-storage section. 78 loops-size-1 value 100000000. 78 loops-size-2 value 999999999. 01 clocks usage binary-long. 01 loops usage binary-long. 01 loops-count1 usage binary-long value loops-size-1. 01 loops-count2 usage binary-long value loops-size-2. *> *************************************************************** procedure division. display "looping " loops-size-1 end-display call "time" using null returning clocks end-call display " epoch time: " clocks end-display call "clock" returning clocks end-call display " clocks: " clocks end-display perform varying loops from 1 by 1 until loops > loops-size-1 end-perform call "clock" returning clocks end-call display " clocks: " clocks end-display call "time" using null returning clocks end-call display " epoch time: " clocks end-display * display " " end-display display "looping " loops-size-2 end-display call "time" using null returning clocks end-call display " epoch time: " clocks end-display call "clock" returning clocks end-call display " clocks: " clocks end-display perform varying loops from 1 by 1 until loops > loops-size-2 end-perform call "clock" returning clocks end-call display " clocks: " clocks end-display call "time" using null returning clocks end-call display " epoch time: " clocks end-display * display " " end-display display "looping " loops-count1 " via binary-long" end-display call "time" using null returning clocks end-call display " epoch time: " clocks end-display call "clock" returning clocks end-call display " clocks: " clocks end-display perform varying loops from 1 by 1 until loops > loops-count1 end-perform call "clock" returning clocks end-call display " clocks: " clocks end-display call "time" using null returning clocks end-call display " epoch time: " clocks end-display * display " " end-display display "looping " loops-count2 " via binary-long" end-display call "time" using null returning clocks end-call display " epoch time: " clocks end-display call "clock" returning clocks end-call display " clocks: " clocks end-display perform varying loops from 1 by 1 until loops > loops-count2 end-perform call "clock" returning clocks end-call display " clocks: " clocks end-display call "time" using null returning clocks end-call display " epoch time: " clocks end-display goback. end program loopstime.[/code] The special problem here is indeed the size of the var as 999999999 needs nearly 10 times more than 100000000. See the difference in code generation (--save-temps) for 999999999 with the high-performance cob_cmp_s32_binary [code]((int)cob_cmp_s32_binary (b_8, 999999999) > 0)[/code] and 1000000000 with the slow cob_cmp [code]((int)cob_cmp (&f_8, &c_1) > 0)[/code] Is there somebody out there who wants to have a look at the OC source and tweak that for building a cob_cmp_s64_binary ;-) ? human ---------------------------------------------------------------- Don't understand what you are talking about? Binary-long signed has a range of -2147483648 to +2147483647 So, 1000000000 is not out of range if I am missing something? I also, added display loop-count and it displays +1000000000 In my modification to the program, I assigned the value directly to the binary-long instead of using a 78 variable. In a quick look, I didn't see a mention of what a type 78 uses to store the value. 01 loops-count usage binary-long value 1000000000. But, since the does display the number correct, I don't think it is zero. There is also no error message when I compile. I did just add another 0, and then it does give the error you mentioned. ---------------------------------------------------------------- Taking your program, but changing the first number to be 1,000,000,000 instead of 100,000,000. I get these results??? For some reason, the first loop takes 110 seconds, and the other 3 only 2 seconds each, and the values are only different by 1? I believe the original message was addressing changing from 100,000,000 to 1,000,000,000 and seeing an increase of not just 10 times. So, what is the difference between looping 999,999,999 and 1,000,000,000 that takes an extra 108 seconds. looping 1000000000 1,000,000,000 epoch time: +1305564975 1,305,564,975 clocks: +0000000000 0 clocks: +0108940000 108,940,000 108,940,000 epoch time: +1305565085 1,305,565,085 SECONDS 110 looping 999999999 999,999,999 epoch time: +1305565085 1,305,565,085 clocks: +0108940000 108,940,000 clocks: +0110910000 110,910,000 1,970,000 epoch time: +1305565087 1,305,565,087 SECONDS 2 looping +1000000000 via binary-long 1,000,000,000 epoch time: +1305565087 1,305,565,087 clocks: +0110910000 110,910,000 clocks: +0113000000 113,000,000 2,090,000 epoch time: +1305565089 1,305,565,089 SECONDS 2 looping +0999999999 via binary-long 999,999,999 epoch time: +1305565089 1,305,565,089 clocks: +0113000000 113,000,000 clocks: +0115100000 115,100,000 2,100,000 epoch time: +1305565091 1,305,565,091 SECONDS 2 real 1m55.594s user 1m55.102s sys 0m0.002s ---------------------------------------------------------------- Part of the problem with this exercise is the C compiler. If you use an optimizing compiler, it just may simplify the code to "move 1000000000 to loops" and not do any "add 1 to loops". ---------------------------------------------------------------- but then wouldn't all the loops do the same thing? ---------------------------------------------------------------- I copied the first loop to the end to see it the cycle would change. The first loop was 106 seconds, then 2, 2, 2, and then 107 seconds for the second copy of the first loop. The question is how and a difference of 1 in the counter make a difference. Not sure what the difference is, but it must be something in how the code gets build to make such a difference. ---------------------------------------------------------------- human was right. The binary range of 32 bits is +/- 2 billion, but a COBOL view of 32 bits is s9(9). 9 digits. As soon as we go to s9(10), COBOL has to use a different datatype, and that conversion back and forth for the add and compare is what causes the timing delta. My curiosity is satisfied. And I [i]learned[/i] something. Learned is the wrong word really, more like [i]realized[/i]. COBOL HAS to treat the ranges differently as even though 1000 million will fit in a s9(9), 5000 million will not. So that extra +1, moves the data range into something outside a safe COBOL view of a C 'int'. C folk can code to machines, but COBOL folk are expected to code for bankers. ;-) Thanks to everyone for taking some time to help with the realization. Cheers, Brian ---------------------------------------------------------------- Hm, maybe OC 1.1 is wrong here in using s9(9). [quote] [url=http://www.cobolstandard.info/j4/files/std.zip]COBOL 20xx draft[/url] wrote: The usages binary-char, binary-short, binary-long, and binary-double define integer numeric data items that are held in a binary format suitable for the machine on which the runtime module is to run. The minimum range requirements for each of these usages are shown below. Any integer value of n within the specified range shall be expressible in the given usage. The implementor may allow a wider range. [...] BINARY-CHAR SIGNED -128 [-2**7] < n < 128 [2**7] BINARY-CHAR UNSIGNED 0 ≤ n < 256 [2**8] BINARY-SHORT SIGNED -32768 [-2**15] < n < 32768 [2**15] BINARY-SHORT UNSIGNED 0 ≤ n < 65536 [2**16] BINARY-LONG SIGNED -2147483648 [-2**31] < n < 2147483648 [2**31] BINARY-LONG UNSIGNED 0 ≤ n < 4294967296 [2**32] BINARY-DOUBLE SIGNED -2**63 < n < 2**63 BINARY-DOUBLE UNSIGNED 0 ≤ n < 2**64[/quote] Anybody wants to try the results with BINARY-DOUBLE? human ---------------------------------------------------------------- Remembering that COBOL programs typically do more input and output than they do computing, computational speed was not an early priority for most of us. Most second generation machines (and some more modern ones that had ties to the earlier machines) used decimal arithmetic. Word and register arithmetic did not become prevalent until the third generation and even then were primarily packed decimal. That is not to say that binary arithmetic was slow to come to the party-- it just did not become prevalent until later. Not being an expert on the standards we always believed that COMP meant "whatever is most efficient on this machine". As a result data written from a COMP field on one machine may not mean the same thing on another. If we wanted portability we specified the format (DISPLAY, COMP-3, COMP-5 ... ). HP wrote a nice piece about run-time efficiency for one of their product lines. http://bizsupport2.austin.hp.com/bc/docs/support/SupportManual/c01711098/c01711098.pdf Go to manual page 3-23 or pdf page 73 if you are interested. Not all of what they write applies to OpenCOBOL. It would be interesting to have someone familiar with OpenCOBOL write something along the same lines. jimc ---------------------------------------------------------------- human; Tried BINARY-DOUBLE, same C code emitted. 32 bit literals generate code that will compile optimized, not using an intermediate field, 64 bit it seems to go through a cob_field compare. It's the literal, not the VARYING variable that determines the optimization (in the C code generated). Thinking about it, the C code generator should do it that way, so the generated code will compile on either 32 or 64 bit machine? Maybe? I might be missing something. Cheers, Brian ---------------------------------------------------------------- @btiffin just in short: OpenCOBOL uses #defines generated by ./configure (or manual for VC/BCC/Intel/WATCOM/... on Win) to use the most efficient way. This is true for the runtime AND the compiler. I personal really like it that way. human ---------------------------------------------------------------- That would make me think, that the perform varying should actually check the variables and the values, and use whatever the highest level value is. Generally, in a calculation that is what happens. Unfortunately, the opencobol works a little differently than regular cobol in same ways. The old trick of taking a MMDDYY date and multiplying it by 10000.01 to get YYMMDD doesn't work with open cobol. The method used in regular c works with the open cobol. ---------------------------------------------------------------- Yeah, it comes down to the literal, and not the data types around it in this case. [code] cob_cmp_s64_binary (const unsigned char *p, const int n) [/code] So, the source code generation optimizer expects a C [i]int[/i], otherwise it's left up to gcc to optimize the COBOL field compares, which seems a "little" slower, but really, not really. Hey, if you feel like doing nothing, and you can do that a billion times a minute, all good. ;-) If you use a literal number that fits s9(9), you get some pretty good pre optimizations in the generated intermediate C. Do 100 million nothings, 10 times in a few seconds. Cheers, Brian ---------------------------------------------------------------- Subject: Technical: More C library, printf question Ok, so I was playing more with the native C library functions usable by OpenCOBOL. Tried printf. Became confused. It links and executes, with float datatyping problems, [i](expected, learning curve as to what format to use in the CALL USING)[/i], but with an unexpected lack of back-slash special character handling. Anyone here know where I might start looking as to why [code] OCOBOL*>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20110513 *> Purpose: Try C library formatted printing *> Tectonics: cobc -x formatted.cob *> *************************************************************** identification division. program-id. formatted. data division. working-storage section. 01 newline pic x value x"0a". 01 n usage binary-long. 01 result usage binary-long. *> *************************************************************** procedure division. call "printf" using "Color=%s, number1=%d, number2=%010d, hex=%x, " & "unsigned value=%u.\n" & x"00" "red" & x"00" by value 123456 89 255 -1 end-call display space end-display *perform 5 times * call "scanf" using "%d" n end-call * display result n end-display * call "perror" using "error string: " & x"00" end-call *end-perform goback. end program formatted. [/code] would produce [code] $ ./formatted Color=red, number1=123456, number2=0000000089, hex=ff, unsigned value=4294967295.\n [/code] with the \n and not a newline? Do I look into libc6 inits? Or is the OpenCOBOL stdout stream going through a different enough channel so that it ignores backslash translations? I'm just curious enough to post, and not quite enough to dig through manuals and source codes. ;-) Cheers, Brian ---------------------------------------------------------------- I just replace the \n with x"0a". "unsigned value=%u." & x"0a" & x"00" In Cobol, it is just two characters, and not converted to a newline character? ---------------------------------------------------------------- Yeah, it's partly why I'm not overly curious. COBOL can do formatted output, so printf is not really a [i]gotta have[/i] feature, but I'm still curious as to who normally does the \n replacement? I always thought it was printf. Cheers, Brian ---------------------------------------------------------------- It might also be that OpenCobol is changing the \n into \\n in the process. As an example if you trying to display a directory path in a statement. Display "c:\Place\for\files" The would work, but printf("c:\Place\for\files"); would not. printf("c:\\Place\\for\\files"); So, the just like having to add the Null terminator to strings? ---------------------------------------------------------------- Yeah, it's not the compiler. [code] $ strings formatted ... |$0H Color=%s, number1=%d, number2=%010d, hex=%x, unsigned value=%u.\n 123456 formatted.cob ... [/code] So the compiler is dutifully using the literal as typed. I can't see the compiler's CALL doing anything to ANYTHING when it passes data by reference. I'm leaning toward a basic misunderstanding of a string's dataflow as it worms it's ways through printf, or a terminal type setting that the lowlevel can't get at? Or? Still just going to ponder and not RTFM. ;-) By the way. the scanf tests 'work' until eof conditions, and then it's just chaos. As does sprintf, umm, without the translations... [code] OCOBOL*>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20110513 *> Purpose: Try C library formatted printing *> Tectonics: cobc -g -debug -W -x formatted.cob *> *************************************************************** identification division. program-id. formatted. data division. working-storage section. 01 newline pic x value x"0a". 01 n usage binary-long. 01 result usage binary-long. 01 formatted pic x(132). *> *************************************************************** procedure division. call "printf" using "Color=%s, number1=%d, number2=%010d, hex=%x, " & "unsigned value=%u.\n" & x"00" "red" & x"00" by value 123456 89 255 -1 returning result end-call display space end-display call "sprintf" using by reference formatted "Color=%s, number1=%d, number2=%010d, hex=%x, " & "unsigned value=%u.\n" & x"00" "red" & x"00" by value 123456 89 255 -1 returning result end-call display formatted end-display perform 5 times call "scanf" using "%d" n returning result end-call display "Result: " result " |" n "|" end-display * call "perror" using "error string: " & x"00" end-call end-perform goback. end program formatted. [/code] and [code] $ ./formatted Color=red, number1=123456, number2=0000000089, hex=ff, unsigned value=4294967295.\n Color=red, number1=123456, number2=0000000089, hex=ff, unsigned value=4294967295.\n 1 12 34 bad 42ignored Result: +0000000001 |+0000000001| Result: +0000000001 |+0000000012| Result: +0000000001 |+0000000034| Result: +0000000000 |+0000000034| Result: +0000000000 |+0000000034| [/code] As expected. [i]the 1 12 34 line was typed. If abc def had been typed first, scanf goes into EOF and loops on EOF, future use of scanf is ruthlessly ignored.[/i] [i]and oh yeah, only a sample writing COBOLer uses [b]sprintf[/b] or [b]scanf[/b], real OpenCOBOL programmers use, umm, COBOL or at the very least, size limited versions ala [b]snprintf[/b]. Use of these simple I/O snippets beyond a curiosity is not really recommended. C layers require a whole whack of fencing and voodoo to make safe.[/i] Cheers, Brian ---------------------------------------------------------------- Bumping with a new query; Ok, I'm stumped. I think I'm overlooking something obvious and I'm hoping to be shamed when shown the light. ;) I expected floats to be stumpy, but I can't get my trials to work, umm, at all. Once again, feeling just stumped enough to post here instead of debugging or reading over the sources. So, from this; [code] OCOBOL*>>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20110513 *> Purpose: Try C library formatted printing *> Tectonics: cobc -g -debug -W -x formatted.cob *> *************************************************************** identification division. program-id. formatted. data division. working-storage section. 01 newline pic x value x"0a". 01 result usage binary-long. 01 pie float-short. 01 piel float-long value 3.141. *> *************************************************************** procedure division. move 3.141 to pie call "printf" using "float-short %f" & x"00" by value pie returning result end-call display newline pie space result end-display call "printf" using "float-long %f" & x"00" by value size 8 piel returning result end-call display newline piel space result end-display goback. end program formatted. [/code] and I get the sad, [code] $ cobc -x -g -debug -W formatted.cob $ ./formatted float-short 0.000000 3.14100003242492676 +0000000020 float-long 0.000000 3.14099999999999957 +0000000019 [/code] Both the easy tests failed, so I'm wondering if anyone can pass on a hint about config settings and byte ordering of floats? How to get a C "double"? Cheers, Brian ---------------------------------------------------------------- I modified the program a little taking the full digit values of PI from the Programmers Guide, and had it display that value at the start. 3.1415926535897932384626433832795029 float-short 0.000000 3.141592741012573242 +0000000020 float-long 0.000000 3.141592653589793116 +0000000019 The 20 and 19 are the number of characters that were displayed by the printf call, so not sure what you are expecting with those values? It would seem to show the conversion of the numbers to there binary closest equivalent with the number of digits. ---------------------------------------------------------------- Yeah, what I'm expecting is float-short 3.141000 float-long 3.141000 Or at least one of the float types having a non-zero value. Displaying the result of the printf was just to verify the call was "working", even though the value of PIE and PIEL are not being passed properly, and show as 0.000000. Still confused as to the datatypes. [code] $ cat form.c #include <stdio.h> int main(int argc, char *argv[]) { float a = 3.141; double b = 3.141; return printf("float %f double %f\n", a, b); } $ gcc -o form form.c $ ./form float 3.141000 double 3.141000 $ echo $? 31 [/code] So the question is still, how to get a BY VALUE FLOAT-SHORT (or FLOAT-LONG) to printf %f on the CALL stack properly? Pretty sure it's something obvious. Cheers, Brian ---------------------------------------------------------------- I hadn't noticed the output of the printf call, and was focused on that the value wasn't the 3.141? I did some additional testing, but have not come up with a solution. But here are some interesting things. Changing it to %g instead of %f prints a number, but not the correct one, but it isn't zero. Compiling the source with -C produces C files, and if you look thru it you can see how the program is making the variable, but it is character areas instead of a float. Finally, I just changed the format instead of %f to %x %x %x %x %x %x %x %x. It prints out some strange stuff. 3.1415926535897932384626433832795029 test-format b4115ec0 11ffc40 4 0 c3d97228 1 c3a35e16 601700 3.141590118408203125 +0000000064 test-format b4115eb0 0 c3ad34f0 de708720 de708720 601680 c3a35e16 74736574 3.141589999999999883 +0000000079 ---------------------------------------------------------------- Re \n. The C compiler converts this and other \ escapes in strings at compile time, so printf is passed a string with the newline character in it. So the use of & x"0a" as mentioned elsewhere is required. :-( Cheers Greg ---------------------------------------------------------------- That's awesome information Greg. [i]I'm not going insane[/i]...[i]he cackled[/i] [b]EDIT:[/b] Umm, %f won't work with "printf". No handler for FLOAT-SHORT BY VALUE. Sad, but not overly. COBOL does formatting. :) Cheers, Brian ---------------------------------------------------------------- Subject: cobc tends to stop after first error messages hi all, we experience a strange behavior (with OC1.1 under linux or win as well): the compilation process does not show all errors but stops after some (maybe severe?) errors ... So in order to get "all" errors, you have to correct the first compilation bugs and then get the next two or three errors??? We experimented with various switches but could not get rid of that behavior. Any suggestions - thanks in advance. ---------------------------------------------------------------- reinhardPR The behavior that you describe has been typical of every (as I remember) COBOL compiler that I have ever used since 1968. A syntactical error in one statement can make it impractical for the compiler to know what to do with other statements even correct ones. I do recall that some compilers would allow you to specify how many errors to tolerate before aborting. In all probability your errors are in the environment division where ambiguity can make analysis difficult. For my two cents worth I am happy with the current behavior. jimc ---------------------------------------------------------------- It is best to stop compilation after a serious mistake to let the process continue with a compilation error in each line (because of this serious error). This is perfectly logical. This saves considerable time. ---------------------------------------------------------------- For what is is worth, [b]NONE[/b] of the commercial compilers that I know of "stop" after a single compilation error. This includes IBM, Micro Focus, Fujitsu, Realia. In some (a few) cases, they "skip" to the next recongizaable "marker" (header) i.e. division or seection, but in most cases, the fartherest they skip is to the next period. It is true that SOME compilation errors can have impact on future statements, but it is quite unusual for "production level" compilers to stop after a signle (serious) error. ---------------------------------------------------------------- thanks for your replies so far. Seems I have been spoilt in using MF/Cobol since the last yearthousand ... So, well ... looks I have to live with that "feature". In any case the OC-compiler is really fast, so its not that bad though still unusual. r ---------------------------------------------------------------- I cannot understand the problem as you didn't provide any source code examples. Some years ago I used ACU-COBOL-GT, which stops sometimes very early and with wrong error messages. In most of these cases cobc gives more and better warnings. The parser was completely rewritten for OpenCOBOL 2.0. If you provide source examples I can check them with both 1.1 and 2.0 and see if there is an improvement. If not we MAY could tweak the parser a little bit for better error handling. human ---------------------------------------------------------------- [quote] human wrote: The parser was completely rewritten for OpenCOBOL 2.0. If you provide source examples I can check them with both 1.1 and 2.0 and see if there is an improvement. If not we MAY could tweak the parser a little bit for better error handling. human[/quote] Ok, just curious, as for parser in version 2.0, was this version still written using Bison or FLEX? I first learned about these tools for compiler design over 20 years ago and I didn’t think anyone could successfully write a Cobol compiler using these tools, but you guys did. :-P However, I think it would be helpfully if the author could post sample code. Well, I tried the “Classic” missing periods example and the OC compiler found all the errors. [code] 1 IDENTIFICATION DIVISION. 2 PROGRAM-ID. tstpgm1a. 3 ENVIRONMENT DIVISION. 4 DATA DIVISION. 5 WORKING-STORAGE SECTION. 6 77 WS-VAR-77 PIC X. 7 01 WS-REC-01. 8 02 WS-FIELDA PIC X. 9 02 WS-FIELDB PIC X. 10 01 WS-MISSING 11 02 WS-M-FLD1 PIC X. 12 02 WS-M-FLD2 PIC X. 13 01 14 02 WS-M2-FLD1 PIC X. 15 02 WS-M2-GRP1. 16 03 WS-M2G1-FLD1 PIC X 17 02 WS-M2-FLD2 PIC S9(01). 18 77 WS-VAR-77-2 PIC 9. 19 20 PROCEDURE DIVISION. 21 INITIALIZE WS-REC-01 22 MOVE WS-FIELDA WS-MSG1-FLD1 23 GOBACK 24 . [/code] Version identification [code] F:\src>cobc -version cobc (OpenCOBOL) 1.1.20100520 Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Keisuke Nishida Copyright (C) 2006,2007,2008,2009,2010 Roger While This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Built Nov 24 2010 20:00:03 Packaged May 19 2010 16:17:26 UTC [/code] And here is the compile process... [code] F:\src>cobc -x tstpgm1a.cbl tstpgm1a.cbl:11: Error: syntax error, unexpected Literal, expecting EXTERNAL or GLOBAL tstpgm1a.cbl:14: Error: syntax error, unexpected Literal tstpgm1a.cbl:17: Error: syntax error, unexpected Literal, expecting EXTERNAL or GLOBAL tstpgm1a.cbl:22: Error: syntax error, unexpected Identifier, expecting TO [/code] ---------------------------------------------------------------- Offtopic but as you've asked for it: Yes, bison and flex are still used (and aren't likely to be replaced at all), but need a more recent version than before. @mwilliams: You use an unsupported and not official pre-release of 1.1 that got the version number change to 2.0 later. Most important parser changes were done in this version already. I've checked the program from mwilliams with latest official 1.1 pre-release (Feb-09) and this is the result: [code]errtest.cbl:11: Error: syntax error, unexpected "Literal", expecting EXTERNAL or GLOBAL[/code] Obviously, the main problem of the poster was taken care of in upcoming OpenCOBOL 2.0. human ---------------------------------------------------------------- I'm just going to add one tidbit to the offtopic, one that I'm uber impressed by. The 1.1pre-rel has the line [code] %expect 118 [/code] in cobc/parser.y which means there are 118 cases of Shift-Reduce 'ambiguities' expected in the bison parse tree build. These don't 'fail' mind, but the compiler has to do a little more backtracking (intelligent guessing) than what is optimal. Latest cuts have [code] %expect 0 [/code] which means, even with new features, the parser tree is clean. With 400+ contextual COBOL words, many being multi-purpose and optional, I'm amazed at how clean. Cheers, Brian ---------------------------------------------------------------- In my experience, commercial compilers (mainframe) do have a better tolerance for errors. Some even warn users about missing periods. OC handles errors fairly well, but on occasion, with certain type of errors, the parser will stop after just one or two errors. Off topic: Zero conflicts. For a large language such as COBOL, it is very impressive. Kudos to the authors. BTW, will OC-2 have support for a report generator or nested programs ? ---------------------------------------------------------------- Subject: Compiling simple program on HPUX fails Hi guys, we are testing OC on HPUX 11. We installed a binary. We try to compile a simple program which reads from a file and writes to another file. Here the commandlines: ppsl@hpppsl> cobc -v MACBIB.cbl Preprocessing: MACBIB.cbl to /tmp/cob24587_0.cob Return status: 0 Parsing: /tmp/cob24587_0.cob Return status: 0 Translating: /tmp/cob24587_0.cob to /tmp/cob24587_0.c Executing: cc -I/usr/local/include -I /usr/local/include -I /usr/local/include -AC99 +DD64 +Olit=all +Olit=all -w -b +DD64 -L/usr/local/lib -DPIC -o "MACBIB.so" "/tmp/cob24587_0.c" +DD64 -L/usr/local/lib -L/usr/local/lib -lcob -lm -lgmp -lcurses -ldb "/tmp/cob24587_0.c.h", line 66: error #3696-D: cannot open source file "libcob/codegen.h" #include <libcob/codegen.h> ^ 1 error detected in the compilation of "/tmp/cob24587_0.c". Return status: 512 ppsl@hpppsl> The commandline of the c-compiler "cc" looks very strange. The includes are three times, the -L.. are two times an so on. The "#include <libcob/codegen.h>" which makes the error is posed on the last line of the file "MACBIB.c.h". #define COB_ADD_ALIGN_U32 #include <libcob/codegen.h> In the directory /usr/local/include/libcob there are only two files (common.h and exception.def). The file codegen.h is missing. What may be our problem?? Thanks Michael ---------------------------------------------------------------- With a 1.1pre-rel Feb 2009 [code] $ ls /usr/local/include/libcob/ | fmt -w 80 byteswap.h call.h codegen.h common.h exception.def fileio.h intrinsic.h move.h numeric.h screenio.h strings.h system.def termio.h [/code] Not sure what ./configure does under HPUX, so I'm not sure if we can share or not? Ummm, not that it would help if you want to trust your code, seems like something is not right with the install. Did you get your binary from http://www.kiska.net/opencobol/ ? His 1.0 tarballs seem to have the right includes inside. Cheers, Brian ---------------------------------------------------------------- What version do you use? [code]cobc --version[/code] What exact binary do you use? human ---------------------------------------------------------------- Hi guys, we have the following version: ppsl@hpppsl#TEST 11.31> cobc --version cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Keisuke Nishida Copyright (C) 2006,2007,2008,2009,2010 Roger While This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Built Mar 15 2010 08:36:40 Packaged Mar 14 2010 08:50:02 UTC The directory .../lobcob contains only the following two files: ppsl@hpppsl#TEST 11.31> ls /usr/local/include/libcob/ | fmt -w 80 common.h exception.def We have the binaries from "Kiska": HP Integrity IA-64 HPUX 11.23 (64-bit) This build has been made on 2010/03/15 from 2010/03/15 1.1 snapshot. This build (and all components) is made using HP aC++/ANSI C B3910B A.06.05 [Jul 25 2005] compiler. You can download OpenCobol HPUX IA-64 64-bit binaries, which include GMP version 4.2.1 and Berkeley DB 4.4.20. We have also the binaries for OC 1.0 for HPUX from "Kiska". In this version the ../libcob contains all needed files. What's about my strange cc commandline. Is that normal, that some arguments are multiple contained?? Thanks Michael ---------------------------------------------------------------- I'd suggest NOT to use the unofficial 2010-version, if not 100% necessary. This version was never released to public (for different reasons) and is VERY HIGH unsupported. To the cc-command line: it doesn't harm if there are some arguments more than once. Normally ./configure cares for that. You may want to compile OC on your own on your machine with 1.1-Feb09-tarball, if you don't want to use the 1.0 binaries from kiska.net. human ---------------------------------------------------------------- It looks like tar file was not transferred as binary and have been corrupted. Just download again. ---------------------------------------------------------------- Subject: save-temps flag Hi, When I use -g -debug flags with cobc, it is producing temporary *.c *.h files ; is there a way to stop generating these temp files. I tried with -save-temps=/tmp , but didn't serve the purpose. -Sajjar. ---------------------------------------------------------------- The switch -g is only of temporary use if you need to use a C-debugger for a COBOL source. It shouldn't matter if you have a temporary file in this case (and may be quite helpful). If you use -debug (enable runtime checks) there are no temporary C files. human ---------------------------------------------------------------- Subject: OpenCOBOL MinGW (32-bit) edition If anyone is interested, binaries for OpenCOBOL MinGW (32-bit) are available for download [1]. This version was build using VB-ISAM as the ISAM file option. Prerequisites: A version of MinGW installed on your system. File listing: [code] opencobol-1.1-20090206-ALL.mingw.zip Compiler, Run-Time and module load and run utility. PDcurses library version version 2.4. ISAM library VB-ISAM version 2.0. GMP library version 4.2.1. opencobol-1.1-20090206-DEPS.mingw.zip PDdcurses library version version 2.4. ISAM library VB-ISAM version 2.0. GMP library version 4.2.1. opencobol-1.1-20090206.mingw.exe Compiler, Run-Time and module load and run utility in setup program format. opencobol-1.1-20090206.mingw.zip Compiler, Run-Time and module load and run utility. opencobol-1.1-20090206.zip Source code, build instructions and Inno setup script. [/code] Installation using setup or zip files: [code] Install compiler and support libraries (as required) in the MinGW directory. The default path is 'mingw-dir/local' (ex: C:\mingw\local). Add the BIN path (ex: C:\mingw\local\bin) to the PATH environment variable. NT/Win2K/XP/Vista/Win7 users (CMD): The environment variables are set in the registry on a global or per user basis. Use the properties sheet to set the environment variables values. Example (W2K user level): Left-click 'My Computer', select 'properties', select Advanced on the System properties tab, select 'Environment Variables' option. Change the 'PATH' System variables and append the OC binary path. Example: PATH=...;C:\mingw\local\bin [/code] Testing the compiler: [code] Open CMD window and test OC (cobc --version or cobc --help). Try test compile and run from CMD window using a COBOL source Examples: exe: cobc -x -v test01.cob test01.exe dll: cobc -m -v test02.cob -o test02.dll cobcrun.exe test02 [/code] 1) COBOL-utils project - OpenCOBOL http://cobol.sourceforge.net/files.html http://sourceforge.net/projects/cobol/files/open-cobol/ ---------------------------------------------------------------- Subject: opencobol-mysql connection (WORK IN PROGRESS). Hallo, I need some help to get rid of "Attempt to reference unallocated memory (Signal SIGSEGV)" Connection to mysql is ok [code] inizializzadb section. inzdb0. call "mysql_init" using sql-cid end-call if return-code not = 0 move 9 to mf-omega perform db-error end-if. inzdb1-ex. exit. [/code] Connection to db is ok [code] connettiadb section. connadb0. string mf-hostaddr delimited spaces x"00" delimited size into myhostaddr end-string string mf-utente delimited spaces x"00" delimited size into myuser end-string string mf-password delimited spaces x"00" delimited size into mypassword end-string string mf-azienda delimited spaces x"00" delimited size into mydbase end-string string mf-porta delimited spaces x"00" delimited size into myporta end-string string mf-socket delimited spaces x"00" delimited size into mysocket end-string call "mysql_real_connect" using myhostaddr myuser mypassword mydbase myporta mysocket end-call if return-code not = 0 move 9 to mf-omega perform db-error end-if. connadb1-ex. exit. [/code] Db selection is ok [code] selezionadb section. slzdb0. string mf-azienda delimited spaces x"00" delimited size into mydbase end-string call "mysql_selectdb" using mydbase end-call if return-code not = 0 perform db-error end-if. slzdb1-ex. exit. [/code] Fetch record gives SIGSEGV [code] getuterec section. gtuterec0. move spaces to sql-catalog-name sql-schema-name sql-default-character-set-name sql-default-collation-name sql-sql-path string "sqlute_key" delimited spaces x"00" delimited size into sql-catalog-name end-string string "utenti" delimited size x"00" delimited size into sql-schema-name end-string string "utf8" delimited size x"00" delimited size into sql-schema-name end-string string "utf8.bin" delimited size x"00" delimited size into sql-schema-name end-string. * * should be * SELECT sqlute_key FROM utenti * gtuterec1. perform until sql-eod not = sql-eod call "mysql_fetch_record" using sql-result sql-catalog-name sql-schema-name sql-default-character-set-name sql-default-collation-name sql-sql-path end-call if return-code = -1 display "Nessun altro record disponibile" end-display exit perform end-if if return-code = -9 display "Errato numero di parametri in fetch" end-display exit perform end-if move spaces to sql-buffer string "[" function trim (sql-catalog-name) "] " "[" function trim (sql-schema-name) "] " "[" function trim (sql-default-character-set-name) "] " "[" function trim (sql-default-character-set-name) "] " "[" function trim (sql-sql-path) "] " into sql-buffer end-string display function trim (sql-buffer) end-display end-perform. gtuterec1-ex. exit. [/code] working is as followes [code] * * sqlparam * parametri interconnessione motore mysql * 01 sql-cid usage pointer. 01 sql-result usage pointer. 01 sql-errno pic x(04). 01 sql-msg pic x(80). 01 sql-eod pic x(01). 01 sql-len pic s9(9) comp. 01 sql-buffer pic x(4096). 01 sql-buffer-pointer pic s9(4) comp. 01 sql-sch-buffer. 02 sql-catalog-name pic x(512). 02 sql-schema-name pic x(64). 02 sql-default-character-set-name pic x(32). 02 sql-default-collation-name pic x(32). 02 sql-sql-path pic x(512). 01 w-inspect usage binary-long. 01 w-syscall pic x(80). 01 dirlogin pic x(50). 01 dirstartpar pic x(50). 01 myhostaddr pic x(80). 01 myhostname pic x(80). 01 myuser pic x(80). 01 mypassword pic x(80). 01 mydbase pic x(80). 01 myutenti pic x(80). 01 myporta pic x(80). 01 mysocket pic x(80). 01 env-path pic x(1024). 01 vari-tus. 02 lgn-tus. 03 lgn-tus1 pic x. 03 lgn-tus2 pic x. 02 lgn-tus9 redefines lgn-tus pic 9(4) comp. 02 spr-tus. 03 spr-tus1 pic x. 03 spr-tus2 pic x. 02 spr-tus9 redefines spr-tus pic 9(4) comp. *----------------------------------------------------------------* 01 mf-area. 02 mf-system pic 9(01). * se 0: linux * se 2: cygwin * se 3: windows * se 9: valore indeterminato: errore 02 mf-hostaddr pic x(40). 02 mf-hostname pic x(40). 02 mf-utente pic x(40). 02 mf-password pic x(40). 02 mf-porta pic x(40). 02 mf-socket pic x(40). 02 mf-okko pic x(02). 02 mf-terminale pic 9(02). [/code] connector is [code] /* cob-mysql Version 3.0 23/mar/2011 */ /* Copyright (C) sanpontze. All Rights Reserved */ /********************************************************************** * Version 003--Changed to correctly map to COBOL data types. * 05/07/2009--Marc Rodriguez * Version 004--Changed to correctly place NULLs into numeric types. * 1225978--Sandy Doss * 07/01/2009--Marc Rodriguez * Version 005--Added new MySQL call to fetch entire row selected * using "select *". Also fixed potential bug in * MySQL_fetch_row that compares number of passed * parameters (inclusive of WS-MYSQL-RESULT) against * number of fields returning from MySQL select. * 1331073--Jim Currey * 12/16/2009--Pete McThompson **********************************************************************/ /* compilare con gcc -I/usr/include/mysql -c mysqlapi.c */ #include <stdio.h> #include <string.h> #include <stdarg.h> #include <mysql.h> #include <libcob.h> #include <stdlib.h> #include <syslog.h> #define min(a,b) ((a) < (b) ? (a) : (b)) //function pointer prototype should not include paramater names //static int (*func)(char *errno, const char *errmsg); static int (*func)(char *, const char *); MYSQL sql, *mysql=&sql; static int errout; static const cob_field_attr MYSQL_FIELD_ATTRIBUTES = {33, 0, 0, 0, NULL}; void err_exit(int rc) { char errno[10]; if( !rc ) return; switch(errout){ case 1: fprintf(stderr,"%d\n", mysql_errno(mysql)); fprintf(stderr,"%s\n", mysql_error(mysql)); return; case 2: break; case 3: sprintf(errno,"%d", mysql_errno(mysql)); func(errno, mysql_error(mysql)); } return; } void move_to_cob(char *cob_dat, const char *dat) { int len = strlen(cob_dat); // data length in cob if(dat == NULL) { memset(cob_dat, 0, len); // clear with NULL } else { memset(cob_dat, ' ', len); // clear with spaces memcpy(cob_dat, dat, min(len, strlen(dat))); // data copy } return; } void MySQL_affected_rows(int *no) { *no = mysql_affected_rows(mysql); return; } int MySQL_change_user(const char *user, const char *passwd, const char *db) { int rc; rc = mysql_change_user(mysql, user, passwd, db); err_exit(rc); return rc; } void MySQL_close(void) { mysql_close(mysql); return; } void MySQL_errno(char *errno) { char buf[10]; sprintf(buf,"%d", mysql_errno(mysql)); move_to_cob(errno, buf); return; } void MySQL_error(char *errmsg) { move_to_cob(errmsg, mysql_error(mysql)); return; } void MySQL_fetch_field(MYSQL_RES **result, int *pos, char *field) { MYSQL_FIELD *fields; fields = mysql_fetch_fields(*result); move_to_cob(field, fields[ *pos - 1 ].name); return; } void MySQL_fetch_fields(MYSQL_RES **result, ...) { int rc, j, colms; va_list args; MYSQL_FIELD *fields; va_start(args, result); colms = min(cob_call_params, mysql_num_fields(*result)); fields = mysql_fetch_fields(*result); for(j=0; j<colms; j++){ move_to_cob(va_arg(args, char *), fields[j].name); } va_end(args); return; } int MySQL_fetch_row(MYSQL_RES **result, ...) { MYSQL_ROW res; int rc, j, maxcols; res = mysql_fetch_row(*result); if(res != NULL) { // cob_call_params contains the number of parameters passed. we subtract 1 to // account for the WS-MYSQL-RESULT. //maxcols = min(cob_call_params, mysql_num_fields(*result)); maxcols = min(cob_call_params - 1, mysql_num_fields(*result)); for(j=0; j<maxcols; j++) { cob_field *cf_from_cobol = cob_current_module->cob_procedure_parameters[j+1]; if(res[j] == NULL) { //memset(cf_from_cobol->data, (char)NULL, strlen(cf_from_cobol->data)); memset(cf_from_cobol->data, 0, cf_from_cobol->size); } else { cob_field cf_from_mysql = { strlen( res[j] ), (unsigned char *) res[j], &MYSQL_FIELD_ATTRIBUTES }; cob_move( &cf_from_mysql, cf_from_cobol ); } } rc = 0; } else { mysql_free_result(*result); rc = -1; } return rc; } int MySQL_fetch_record(MYSQL_RES **result, ...) { MYSQL_ROW res; int rc, j, maxcols; char strError[255]; res = mysql_fetch_row(*result); if(res != NULL) { // cob_call_params contains the number of parameters passed. we subtract 1 to // account for the WS-MYSQL-RESULT. if(cob_call_params - 1 != mysql_num_fields(*result)) { mysql_free_result(*result); openlog(NULL, LOG_PERROR | LOG_PID | LOG_NDELAY, LOG_DAEMON); sprintf(strError, "MySQL_fetch_record: fields mismatch. Given %i, expected %i", cob_call_params - 1, mysql_num_fields(*result)); syslog(1, strError); closelog(); exit(0); } maxcols = mysql_num_fields(*result); for(j=0; j<maxcols; j++) { cob_field *cf_from_cobol = cob_current_module->cob_procedure_parameters[j+1]; if(res[j] == NULL) { memset(cf_from_cobol->data, 0, cf_from_cobol->size); } else { cob_field cf_from_mysql = { strlen( res[j] ), (unsigned char *) res[j], &MYSQL_FIELD_ATTRIBUTES }; cob_move( &cf_from_mysql, cf_from_cobol ); } } rc = 0; } else { mysql_free_result(*result); rc = -1; } return rc; } void MySQL_field_count(int *count) { *count = mysql_field_count(mysql); return; } void MySQL_free_result(MYSQL_RES **result) { mysql_free_result(*result); return; } void MySQL_get_character_set_info(char *csname) { MY_CHARSET_INFO cs; mysql_get_character_set_info(mysql, &cs); move_to_cob(csname, cs.name); return; } int MySQL_init(MYSQL **cid, ...) { int rc,n; char *fname; va_list args; *cid = mysql; rc = mysql_init(&sql) != NULL ? 0 : 1; va_start(args, cid); if(cob_call_params > 1){ fname = va_arg(args, char *); } else { fname = ""; } va_end(args); if( !strcmp(fname, "stderr") ){ errout = 1; // stderr } else if( !strcmp(fname,"" ) ){ errout = 2; // default } else { cob_init(0, NULL); func = cob_resolve(fname); if(func == NULL){ fprintf(stderr, "%s\n", cob_resolve_error()); return 1; } errout = 3; // user function } err_exit(rc); return rc; } int MySQL_list_tables( MYSQL_RES **res) { int rc; *res = mysql_list_tables(mysql, NULL); rc = *res != NULL ? 0 : 1; err_exit(rc); return rc; } void MySQL_num_fields(MYSQL_RES **result, int *cols) { *cols = mysql_num_fields(*result); return; } void MySQL_num_rows(MYSQL_RES **result, int *rows) { *rows = mysql_num_rows(*result); return; } int MySQL_query(char *query) { int rc; rc = mysql_query(mysql, query); err_exit(rc); return rc; } int MySQL_real_connect(char *host, char *user, char *passwd, char *db, unsigned int port, char *unix_socket) { int rc; MYSQL *tmp; tmp = mysql_real_connect(&sql, host, user, passwd, db, port, unix_socket, 0); rc = tmp != NULL ? 0 : 1; err_exit(rc); return rc; } int MySQL_selectdb(char *dbname) { int rc; rc = mysql_select_db(mysql, dbname); err_exit(rc); return rc; } int MySQL_set_character_set(char *charset) { int rc; rc = mysql_set_character_set(mysql, charset); err_exit(rc); return rc; } int MySQL_store_result(MYSQL_RES **result) { int rc; *result = mysql_store_result(mysql); rc = result != NULL ? 0 : 1; err_exit(rc); return rc; } int MySQL_use_result(MYSQL_RES **result) { int rc; *result = mysql_use_result(mysql); rc = result != NULL ? 0 : 1; err_exit(rc); return rc; } [/code] someone can help me? Thanks Marcello ---------------------------------------------------------------- @Marcello I am in the mountains and have very poor internet access. I did not see a SELECT before your FETCH. If I missed it I apologize. jimc ---------------------------------------------------------------- Hallo jimc, here it is [code] selutenti section. selute0. * string * mf-azienda delimited spaces * "." delimited size * "utenti" delimited size * x"00" delimited size * into myutenti * end-string move spaces to sql-buffer string "select * from " delimited size "utenti" delimited size * x"00" delimited size ";" delimited size X"00" delimited size into sql-buffer end-string call "mysql_query" using sql-buffer end-call if return-code not = 0 move 9 to mf-omega perform db-error end-if. selute1-ex. exit. *----------------------------------------------------------------* stordbres section. strdbr0. call "mysql_store_result" using sql-result end-call if sql-result = NULL perform db-error end-if. strdbr1-ex. exit. [/code] Thanks, Marcello ---------------------------------------------------------------- Once again, sorry for the brief reply. I do not have access to any of my resources and it takes quite some time for each screen to come up. Does it fail on the first FETCH? Could you use breadcrumbs (display statements showing progress and data results)? ---------------------------------------------------------------- Hallo jcurrey. It's failing on first SELECT column-name FROM table-name. The real problem is that selecting from forum a cbl sample (commented) and a wrapper.c is quite impossible. Someone suggests libdbi (with additional software to install and maintain); Others (mysqlapi.c ocmysqlapi.c, etc, etc) show source from first writing and patches are here and there. Could you suggest me e real and operating wrapper whith correspondig cbl to analyze? I've never used breadcrumbs. Should I get and install it? Thanks, Marcello ---------------------------------------------------------------- May be someone (an SQL beginner like me) might be interested. The first thing to underline is wrapper choice. After tests, I found the following one works well. [code] /* cob-mysql Version 3.0 23/mar/2011 */ /* Copyright (C) sanpontze. All Rights Reserved */ /********************************************************************** * Version 003--Changed to correctly map to COBOL data types. * 05/07/2009--Marc Rodriguez * Version 004--Changed to correctly place NULLs into numeric types. * 1225978--Sandy Doss * 07/01/2009--Marc Rodriguez * Version 005--Added new MySQL call to fetch entire row selected * using "select *". Also fixed potential bug in * MySQL_fetch_row that compares number of passed * parameters (inclusive of WS-MYSQL-RESULT) against * number of fields returning from MySQL select. * 1331073--Jim Currey * 12/16/2009--Pete McThompson **********************************************************************/ /* salvare il wrapper con nome cobmysql.c compilare con gcc -I/usr/include/mysql -c cobmysql.c */ #include <stdio.h> #include <string.h> #include <stdarg.h> #include <mysql.h> #include <libcob.h> #include <stdlib.h> #include <syslog.h> #define min(a,b) ((a) < (b) ? (a) : (b)) //function pointer prototype should not include paramater names //static int (*func)(char *errno, const char *errmsg); static int (*func)(char *, const char *); MYSQL sql, *mysql=&sql; static int errout; static const cob_field_attr MYSQL_FIELD_ATTRIBUTES = {33, 0, 0, 0, NULL}; void err_exit(int rc) { char errno[10]; if( !rc ) return; switch(errout){ case 1: fprintf(stderr,"%d\n", mysql_errno(mysql)); fprintf(stderr,"%s\n", mysql_error(mysql)); return; case 2: break; case 3: sprintf(errno,"%d", mysql_errno(mysql)); func(errno, mysql_error(mysql)); } return; } void move_to_cob(char *cob_dat, const char *dat) { int len = strlen(cob_dat); // data length in cob if(dat == NULL) { memset(cob_dat, 0, len); // clear with NULL } else { memset(cob_dat, ' ', len); // clear with spaces memcpy(cob_dat, dat, min(len, strlen(dat))); // data copy } return; } void MySQL_affected_rows(int *no) { *no = mysql_affected_rows(mysql); return; } int MySQL_change_user(const char *user, const char *passwd, const char *db) { int rc; rc = mysql_change_user(mysql, user, passwd, db); err_exit(rc); return rc; } void MySQL_close(void) { mysql_close(mysql); return; } void MySQL_errno(char *errno) { char buf[10]; sprintf(buf,"%d", mysql_errno(mysql)); move_to_cob(errno, buf); return; } void MySQL_error(char *errmsg) { move_to_cob(errmsg, mysql_error(mysql)); return; } void MySQL_fetch_field(MYSQL_RES **result, int *pos, char *field) { MYSQL_FIELD *fields; fields = mysql_fetch_fields(*result); move_to_cob(field, fields[ *pos - 1 ].name); return; } void MySQL_fetch_fields(MYSQL_RES **result, ...) { int rc, j, colms; va_list args; MYSQL_FIELD *fields; va_start(args, result); colms = min(cob_call_params, mysql_num_fields(*result)); fields = mysql_fetch_fields(*result); for(j=0; j<colms; j++){ move_to_cob(va_arg(args, char *), fields[j].name); } va_end(args); return; } int MySQL_fetch_row(MYSQL_RES **result, ...) { MYSQL_ROW res; int rc, j, maxcols; res = mysql_fetch_row(*result); if(res != NULL) { // cob_call_params contains the number of parameters passed. we subtract 1 to // account for the WS-MYSQL-RESULT. //maxcols = min(cob_call_params, mysql_num_fields(*result)); maxcols = min(cob_call_params - 1, mysql_num_fields(*result)); for(j=0; j<maxcols; j++) { cob_field *cf_from_cobol = cob_current_module->cob_procedure_parameters[j+1]; if(res[j] == NULL) { //memset(cf_from_cobol->data, (char)NULL, strlen(cf_from_cobol->data)); memset(cf_from_cobol->data, 0, cf_from_cobol->size); } else { cob_field cf_from_mysql = { strlen( res[j] ), (unsigned char *) res[j], &MYSQL_FIELD_ATTRIBUTES }; cob_move( &cf_from_mysql, cf_from_cobol ); } } rc = 0; } else { mysql_free_result(*result); rc = -1; } return rc; } int MySQL_fetch_record(MYSQL_RES **result, ...) { MYSQL_ROW res; int rc, j, maxcols; char strError[255]; res = mysql_fetch_row(*result); if(res != NULL) { // cob_call_params contains the number of parameters passed. we subtract 1 to // account for the WS-MYSQL-RESULT. if(cob_call_params - 1 != mysql_num_fields(*result)) { mysql_free_result(*result); openlog(NULL, LOG_PERROR | LOG_PID | LOG_NDELAY, LOG_DAEMON); sprintf(strError, "MySQL_fetch_record: fields mismatch. Given %i, expected %i", cob_call_params - 1, mysql_num_fields(*result)); syslog(1, strError); closelog(); exit(0); } maxcols = mysql_num_fields(*result); for(j=0; j<maxcols; j++) { cob_field *cf_from_cobol = cob_current_module->cob_procedure_parameters[j+1]; if(res[j] == NULL) { memset(cf_from_cobol->data, 0, cf_from_cobol->size); } else { cob_field cf_from_mysql = { strlen( res[j] ), (unsigned char *) res[j], &MYSQL_FIELD_ATTRIBUTES }; cob_move( &cf_from_mysql, cf_from_cobol ); } } rc = 0; } else { mysql_free_result(*result); rc = -1; } return rc; } void MySQL_field_count(int *count) { *count = mysql_field_count(mysql); return; } void MySQL_free_result(MYSQL_RES **result) { mysql_free_result(*result); return; } void MySQL_get_character_set_info(char *csname) { MY_CHARSET_INFO cs; mysql_get_character_set_info(mysql, &cs); move_to_cob(csname, cs.name); return; } int MySQL_init(MYSQL **cid, ...) { int rc,n; char *fname; va_list args; *cid = mysql; rc = mysql_init(&sql) != NULL ? 0 : 1; va_start(args, cid); if(cob_call_params > 1){ fname = va_arg(args, char *); } else { fname = ""; } va_end(args); if( !strcmp(fname, "stderr") ){ errout = 1; // stderr } else if( !strcmp(fname,"" ) ){ errout = 2; // default } else { cob_init(0, NULL); func = cob_resolve(fname); if(func == NULL){ fprintf(stderr, "%s\n", cob_resolve_error()); return 1; } errout = 3; // user function } err_exit(rc); return rc; } int MySQL_list_tables( MYSQL_RES **res) { int rc; *res = mysql_list_tables(mysql, NULL); rc = *res != NULL ? 0 : 1; err_exit(rc); return rc; } void MySQL_num_fields(MYSQL_RES **result, int *cols) { *cols = mysql_num_fields(*result); return; } void MySQL_num_rows(MYSQL_RES **result, int *rows) { *rows = mysql_num_rows(*result); return; } int MySQL_query(char *query) { int rc; rc = mysql_query(mysql, query); err_exit(rc); return rc; } int MySQL_real_connect(char *host, char *user, char *passwd, char *db, unsigned int port, char *unix_socket) { int rc; MYSQL *tmp; tmp = mysql_real_connect(&sql, host, user, passwd, db, port, unix_socket, 0); rc = tmp != NULL ? 0 : 1; err_exit(rc); return rc; } int MySQL_selectdb(char *dbname) { int rc; rc = mysql_select_db(mysql, dbname); err_exit(rc); return rc; } int MySQL_set_character_set(char *charset) { int rc; rc = mysql_set_character_set(mysql, charset); err_exit(rc); return rc; } int MySQL_store_result(MYSQL_RES **result) { int rc; *result = mysql_store_result(mysql); rc = result != NULL ? 0 : 1; err_exit(rc); return rc; } int MySQL_use_result(MYSQL_RES **result) { int rc; *result = mysql_use_result(mysql); rc = result != NULL ? 0 : 1; err_exit(rc); return rc; } [/code] Call to wrapper subroutines are not case insensitive. [code] call "MySQL_fetch_row" [/code] Is not the same as [code] call "mysql_fetch_row" [/code] Program is compiled even with "mysql_fetch_row" but at execution time IT ENDS WITH A SIGSEGV !!! If some needs a track, here it is [code] procedure division. in0. ........... move "<host-name>" to mf-hostaddr move "<dbase-name>" to mf-azienda move "<user-name>" to mf-utente move "<user-password>" to mf-password move "3306" to mf-porta move "<socket-path>" to mf-socket * * <host-name> il probably localhost * <dbase-name> is the real name of database you work on * <user-name> and user-password are your login entries for specific host * <socket-path> is (for my opensuse system) /var/run/mysql/mysql.sock * ........... in1. move zeroes to mf-omega perform inizializzadb if mf-omega not = zero go to in99 end-if move zeroes to mf-omega perform connettiadb if mf-omega not = zero go to in99 end-if perform selezionadb if mf-omega not = zero go to in99 end-if perform selutenti if mf-omega not = zero go to in99 end-if perform getuterec if mf-omega not = zero go to in99 end-if. in99. perform chiudidb. in1-ex. stop run. [/code] This is working-storage. [code] 01 ute-rec. 02 ute-key pic x(0008) . 02 ute-passwd pic x(0010) . 02 ute-group occurs 10 pic x(0008) . 02 ute-menu pic x(0008) . 02 ute-dbname pic x(0008) . 02 ute-jsys pic x(0001) . 01 w-inspect usage binary-long. 01 w-syscall pic x(80). 01 dirlogin pic x(50). 01 dirstartpar pic x(50). 01 myhostaddr pic x(80). 01 myhostname pic x(80). 01 myuser pic x(80). 01 mypassword pic x(80). 01 mydbase pic x(80). 01 myutenti pic x(80). 01 myporta pic x(80). 01 mysocket pic x(80). 01 env-path pic x(1024). *----------------------------------------------------------------* 01 mf-area. 02 mf-system pic 9(01). * se 0: linux * se 2: cygwin * se 3: windows * se 9: valore indeterminato: errore 02 mf-hostaddr pic x(40). 02 mf-hostname pic x(40). 02 mf-utente pic x(40). 02 mf-password pic x(40). 02 mf-porta pic x(40). 02 mf-socket pic x(40). 02 mf-okko pic x(02). 02 mf-dbname pic x(08). 02 mf-azix. 03 mf-azibase pic x(03). 03 mf-azisecolo pic 9(02). 03 mf-azianno pic 9(02). 03 mf-aziresto pic x(03). 02 mf-azienda redefines mf-azix pic x(10). 02 mf-omega pic 9(02). [/code] And cobol subroutines interfacing wrapper are [code] inizializzadb section. inzdb0. call "MySQL_init" using sql-cid end-call if return-code not = 0 move 9 to mf-omega perform db-error end-if. inzdb1-ex. exit. *----------------------------------------------------------------* connettiadb section. connadb0. string mf-hostaddr delimited spaces x"00" delimited size into myhostaddr end-string string mf-utente delimited spaces x"00" delimited size into myuser end-string string mf-password delimited spaces x"00" delimited size into mypassword end-string string mf-azienda delimited spaces x"00" delimited size into mydbase end-string string mf-porta delimited spaces x"00" delimited size into myporta end-string string mf-socket delimited spaces x"00" delimited size into mysocket end-string call "MySQL_real_connect" using myhostaddr myuser mypassword mydbase myporta mysocket end-call if return-code not = 0 move 9 to mf-omega perform db-error end-if. connadb1-ex. exit. *----------------------------------------------------------------* selezionadb section. slzdb0. call "MySQL_selectdb" using mydbase end-call if return-code not = 0 perform db-error end-if. slzdb1-ex. exit. *----------------------------------------------------------------* getchsdbinfo section. gtchsdbinf0. call "MySQL_get_character_set_info" using sql-buffer end-call. gtchsdbinf1-ex. exit. *----------------------------------------------------------------* selutenti section. selute0. call "MySQL_query" using "select * from utenti" end-call if return-code not = 0 move 9 to mf-omega perform db-error end-if call "MySQL_use_result" using sql-result end-call if sql-result = NULL then perform db-error end-if. selute1-ex. exit. *----------------------------------------------------------------* stordbres section. strdbr0. call "MySQL_store_result" using sql-result end-call if sql-result = NULL perform db-error end-if. strdbr1-ex. exit. *----------------------------------------------------------------* getutenr section. getutenr0. call "MySQL_num_rows" using sql-result end-call if sql-result = NULL move 9 to mf-omega perform db-error end-if. getutenr1-ex. exit. *----------------------------------------------------------------* getuterec section. gtuterec0. call "MySQL_fetch_fields" using sql-result ute-key ute-passwd ute-group (01) ute-group (02) ute-group (03) ute-group (04) ute-group (05) ute-group (06) ute-group (07) ute-group (08) ute-group (09) ute-group (10) ute-menu ute-dbname ute-jsys end-call if sql-result = NULL then perform db-error end-if perform until sql-eod not = sql-eod call "MySQL_fetch_row" using sql-result ute-key ute-passwd ute-group (01) ute-group (02) ute-group (03) ute-group (04) ute-group (05) ute-group (06) ute-group (07) ute-group (08) ute-group (09) ute-group (10) ute-menu ute-dbname ute-jsys end-call if return-code = -1 then exit perform end-if display ute-key ute-passwd ute-group (01) ute-group (02) ute-group (03) ute-group (04) ute-group (05) ute-group (06) ute-group (07) ute-group (08) ute-group (09) ute-group (10) ute-menu ute-dbname ute-jsys end-display end-perform. gtuterec1-ex. exit. *----------------------------------------------------------------* chiudidb section. chdb0. call "MySQL_close" end-call. chdb1-ex. exit. *----------------------------------------------------------------* db-error section. db-err0. call "MySQL_errno" using sql-errno end-call call "MySQL_error" using sql-msg end-call display function trim (sql-errno) ":" function trim (sql-msg) end-display. db-err1-ex. exit. [/code] ---------------------------------------------------------------- Congratulations! I apologize for the reference to "bread crumbs". It comes from the fairy tale of Hansel and Gretel. jimc ---------------------------------------------------------------- Hallo, I'm converting from MicroFocus to open-cobol. Up to most recent released version, split-keys are not allowed in Oc (which, instead, I use a lot in my MF programs). Unable to decide between Berckeley db, C-ISAM, V-ISAM, VB-ISAM, etc., etc. I decided to see what happens and what has to be done for MySQL interaction. In previous post, I showed the partial result I obtained. The connector is Marc Rodriguez, Jim Currey and Pete McThompson. Now, some more work has been done (Jim Currey helped me a lot with suggestions and code by private e-mails) I think that what followes might be useful to someone in Forum and could a base to start from, if other peoples wish to work on the same matter. Most of the work (fd --> sql field conversion, subroutines for interaction, etc.) is automatically done by my own tools. If someone is interested, I will share them. But, be aware, they are multi_purpose tools I have been modifying and re-modifying for ages and have become a lot "spaghetti". [code] identification division. program-id. pagapetst. * date-compiled. . * security. programma interfaccia MySQL pagape * environment division. configuration section. source-computer. studiok. object-computer. studiok. special-names. decimal-point is comma cursor is crsr console is crt crt status is crt-tus. input-output section. *----------------------------------------------------------------* file-control. *----------------------------------------------------------------* copy "/fms/550/sel/msgerr.sed". copy "/fms/550/sel/wfarea.sed". data division. *----------------------------------------------------------------* file section. *----------------------------------------------------------------* fd msgerr. 01 msg-rec pic x(250). copy "/fms/550/fd/wfarea.fd". *----------------------------------------------------------------* working-storage section. *----------------------------------------------------------------* copy "/fms/550/cbl/working.cbl". copy "/fms/550/cbl/working1.cbl". copy "/fms/550/sel/msgerr.sew". copy "/fms/550/sel/wfarea.sew". copy "/fms/550/fd/pagape.fdv" replacing ==(pp)== by ==pp== . copy "/fms/550/fd/pagape.ws1". 01 w-valore pic z(04)9,9(04)-. 01 env-path pic x(1024). 01 w-accept pic x(01). 01 w-retry pic 9(04). 01 w-righe pic 9(04). 01 w-inspect usage binary-long. 01 filinfo. 03 file-size pic 9(18) comp. 03 file-dd pic 9(02) comp. 03 file-mo pic 9(02) comp. 03 file-yy pic 9(04) comp. 03 file-hh pic 9(02) comp. 03 file-mm pic 9(02) comp. 03 file-ss pic 9(02) comp. 03 filler pic 9(02) comp. 01 vari-tus. 02 lgn-tus. 03 lgn-tus1 pic x. 03 lgn-tus2 pic x. 02 lgn-tus9 redefines lgn-tus pic 9(4) comp. 02 spr-tus. 03 spr-tus1 pic x. 03 spr-tus2 pic x. 02 spr-tus9 redefines spr-tus pic 9(4) comp. 02 avv-tus. 03 avv-tus1 pic x. 03 avv-tus2 pic x. 02 avv-tus9 redefines avv-tus pic 9(4) comp. copy "/fms/550/tus/msgerr.tus". copy "/fms/550/tus/wfarea.tus". copy "/fms/550/lnk/mf-area.lnk". *copy "/fms/550/cbl/sqlparam.wrk". *----------------------------------------------------------------* * sqlparam.wrk * * parametri interconnessione motore mysql * *----------------------------------------------------------------*- 01 sqcid usage pointer. 01 sqresult usage pointer. 01 sqhostaddr pic x(80). 01 sqhostname pic x(80). 01 sqdbase pic x(80). 01 squser pic x(80). 01 sqpassword pic x(80). 01 sqporta pic x(80). 01 sqsocket pic x(80). 01 sqerrno pic x(04). 01 sqmsg pic x(80). 01 sqrighe pic 9(04). 01 sqomega pic 9(04). 01 sqeod pic x(01). 01 sqlav pic x(01). 01 sqlen pic s9(9) comp-5. 01 sqrows pic s9(9) comp-5. 01 sqcomando pic x(3072). * 01 sqcomando-hold pic x(3072). * 01 sqcomando-data-buffer pic x(4096). * 01 sqbuffer pic x(4096). * 01 sqbuffer-pointer pic s9(4) comp. * 01 sqsch-buffer. * 02 sqcatalog-name pic x(512). * 02 sqschema-name pic x(64). * 02 sqdefault-character-set-name pic x(32). * 02 sqdefault-collation-name pic x(32). * 02 sqpath pic x(512). 01 myhostaddr pic x(80). 01 myhostname pic x(80). 01 myuser pic x(80). 01 mypassword pic x(80). 01 mydbase pic x(80). 01 myutenti pic x(80). 01 myporta pic x(80). 01 mysocket pic x(80). *----------------------------------------------------------------* procedure division. inizio section. in0. move 9 to mf-system perform prelos if mf-system = 9 display "Non posso determinare il sistema opera operativo" end-display go to in1-ex end-if move spaces to dirmsgerr move zeroes to mf-omega sqomega move 1 to w-scount if mf-system = zero move "/fms/dati/msgerr.sdb" to dirmsgerr move "/fms/dati/wfarea" to dirwfarea go to in1 end-if move "c:\fms\dati\msgerr.sdb" to dirmsgerr move "c:\fms\dati\wfarea" to dirwfarea. in1. move "localhost" to mf-hostaddr move "3306" to mf-porta move "/var/run/mysql/mysql.sock" to mf-socket move "mon2011" to mf-azienda move "<your_user_name>" to mf-utente move "<your_user_password>" to mf-password move zeroes to sqomega perform inizializzadb if sqomega not = zero move spaces to w-stringa move 1 to w-scount string "Inizializzazione database non riuscita" delimited size into lnk-erro with pointer w-scount end-string perform errore go to in99 end-if move zeroes to sqomega perform connettiadb if sqomega not = zero move spaces to w-stringa move 1 to w-scount string "Connessione a database non riuscita" delimited size into lnk-erro with pointer w-scount end-string perform errore go to in99 end-if move zeroes to sqomega perform selezionadb if sqomega not = zero move spaces to w-stringa move 1 to w-scount string "Selezione database non riuscita" delimited size into lnk-erro with pointer w-scount end-string perform errore go to in99 end-if move 2011 to pp-esercizio move 123456 to pp-numero * *START: this is a read by primary key perform pagapesel4read perform pagapegetnrows * should return 1 (status 00) * if zero status 23 *END : this is a read by primary key * *START: this is a start/read next move zeroes to sqomega move spaces to sqcomando move 1 to w-scount string "SELECT *" delimited size " FROM pagape WHERE " delimited size "sqlpp_esercizio" delimited size " = '" delimited size pp-esercizio delimited size "'" delimited size " AND " delimited size "sqlpp_numero" delimited size " LIKE '" delimited size "123%" delimited size "'" delimited size x"00" delimited size into sqcomando with pointer w-scount end-string perform pagapegetnrows * number of rows satisfying request * repeat SELECT to start getting rows move zeroes to sqomega move spaces to sqcomando move 1 to w-scount string "SELECT *" delimited size " FROM pagape WHERE " delimited size "sqlpp_esercizio" delimited size " = '" delimited size pp-esercizio delimited size "'" delimited size " AND " delimited size "sqlpp_numero" delimited size " LIKE '" delimited size "123%" delimited size "'" delimited size x"00" delimited size into sqcomando with pointer w-scount end-string perform pagapegetrec * first record handling move 1 to xind. in2. add 1 to xind if xind > pagapenrw go to in50 end-if perform pagapegetnextrec * further records handling go to in2. *END : this is a start/read next in50. move 2011 to pp-esercizio move 123456 to pp-numero move "pippo" to pp-numdoc perform pagaperewrite move 2011 to pp-esercizio move 123456 to pp-numero perform pagapedelete. in80. move 2011 to pp-esercizio move 54321 to pp-numero move 1 to pp-tipdoc move "pappolo" to pp-numdoc move zeroes to pp-datdoc pp-codclf pp-codpag pp-impornet pp-importo move spaces to pp-passato perform pagapeinsert. in99. perform chiudidb. in1-ex. stop run. *------------------- subroutines di copia ---------------------* errore section. copy "/fms/550/cbl/errore.cbl". copy "/fms/550/cbl/prelos.sbr". copy "/fms/550/cbl/prpobjpt.cbl". *copy "/fms/550/cbl/dbasesbr.sbr". *----------------------------------------------------------------* * dbasesbr.sbr * *----------------------------------------------------------------* inizializzadb section. inzdb0. call "MySQL_init" using sqcid end-call if return-code not = 0 move 9 to sqomega perform db-error end-if. inzdb1-ex. exit. *----------------------------------------------------------------* connettiadb section. connadb0. string mf-hostaddr delimited spaces x"00" delimited size into myhostaddr end-string string mf-utente delimited spaces x"00" delimited size into myuser end-string string mf-password delimited spaces x"00" delimited size into mypassword end-string string mf-azienda delimited spaces x"00" delimited size into mydbase end-string string mf-porta delimited spaces x"00" delimited size into myporta end-string string mf-socket delimited spaces x"00" delimited size into mysocket end-string call "MySQL_real_connect" using myhostaddr myuser mypassword mydbase myporta mysocket end-call if return-code not = 0 move 9 to sqomega perform db-error end-if. connadb1-ex. exit. *----------------------------------------------------------------* selezionadb section. slzdb0. call "MySQL_selectdb" using mydbase end-call if return-code not = 0 move 9 to sqomega perform db-error end-if. slzdb1-ex. exit. *----------------------------------------------------------------* chiudidb section. chdb0. call "MySQL_close" end-call. chdb1-ex. exit. *----------------------------------------------------------------* db-error section. db-err0. call "MySQL_errno" using sqerrno end-call call "MySQL_error" using sqmsg end-call display function trim (sqerrno) ":" function trim (sqmsg) end-display. db-err1-ex. exit. *----------------------------------------------------------------* *copy "/fms/550/cbl/pagape.sbr". *----------------------------------------------------------------* * pagape.sbr *----------------------------------------------------------------* pagapesel4read section. pagapesel4read0. move zeroes to sqomega move spaces to sqcomando move 1 to w-scount string "SELECT * FROM " delimited size "pagape" delimited size " WHERE " delimited size "sqlpp_esercizio" delimited size " = '" delimited size pp-esercizio delimited size "'" delimited size " AND " delimited size "sqlpp_numero" delimited size " = '" delimited size pp-numero delimited size "'" delimited size X"00" delimited size into sqcomando with pointer w-scount end-string. pagapesel4read1-ex. exit. *----------------------------------------------------------------* pagapesel4rewdel section. pagapesel4rewdel0. move zeroes to sqomega move spaces to sqcomando move 1 to w-scount string "SELECT * FROM " delimited size "pagape" delimited size " WHERE " delimited size "sqlpp_esercizio" delimited size " = '" delimited size pp-esercizio delimited size "'" delimited size " AND " delimited size "sqlpp_numero" delimited size " = '" delimited size pp-numero delimited size "'" delimited size " FOR UPDATE" X"00" delimited size into sqcomando with pointer w-scount end-string. pagapesel4rewdel1-ex. exit. *----------------------------------------------------------------* pagapegetnrows section. pagapegetnrows0. call "MySQL_query" using sqcomando end-call if return-code not = 0 move 9 to sqomega move "Errore in query pagape " to lnk-erro perform errore move zeroes to lnk-err go to pagapegetnrows1-ex end-if call "MySQL_store_result" using pagaperes end-call if pagaperes = NULL move 9 to sqomega move "Errore in store result pagape " to lnk-erro perform errore move zeroes to lnk-err go to pagapegetnrows1-ex end-if call "MySQL_num_rows" using pagaperes sqrows end-call move sqrows to pagapenrw perform pagapefreeres. pagapegetnrows1-ex. exit. *----------------------------------------------------------------* pagapegetrec section. pagapegetrec0. call "MySQL_query" using sqcomando end-call if return-code not = 0 move 9 to sqomega move "Errore in query pagape " to lnk-erro perform errore move zeroes to lnk-err go to pagapegetrec1-ex end-if call "MySQL_store_result" using pagaperes end-call if pagaperes = NULL move 9 to sqomega move "Errore in store result pagape " to lnk-erro perform errore move zeroes to lnk-err go to pagapegetrec1-ex end-if call "MySQL_fetch_row" using pagaperes pp_key app_esercizio app_numero pp_tipdoc pp_numdoc app_datdoc app_codclf app_codpag app_impornet app_importo pp_passato end-call if return-code = -1 move 9 to sqomega move "Errore in fetch row pagape " to lnk-erro perform errore move zeroes to lnk-err go to pagapegetrec1-ex end-if * in Europe we need conversion US -> EU numbers inspect app-esercizio replacying all " " by "0" move npp-esercizio to pp-esercizio inspect app-numero replacying all " " by "0" move npp-numero to pp-numero inspect app-datdoc replacying all " " by "0" move npp-datdoc to pp-datdoc inspect app-codclf replacying all " " by "0" move npp-codclf to pp-codclf inspect app-codpag replacying all " " by "0" move npp-codpag to pp-codpag inspect app-impornet replacying all " " by "0" inspect app-impornet replacying all "." by "," inspect app-impornet replacying all "-" by "0" move "-" to app-impornetl (01) move npp-impornet to pp-impornet inspect app-importo replacying all " " by "0" inspect app-importo replacying all "." by "," inspect app-importo replacying all "-" by "0" move "-" to app-importol (01) move npp-importo to pp-importo continue. pagapegetrec1-ex. exit. *----------------------------------------------------------------* pagapegetnextrec section. pagapegetnextrec0. call "MySQL_fetch_row" using pagaperes pp_key app_esercizio app_numero pp_tipdoc pp_numdoc app_datdoc app_codclf app_codpag app_impornet app_importo pp_passato end-call if return-code = -1 move 9 to sqomega move "Errore in fetch row pagape " to lnk-erro perform errore move zeroes to lnk-err go to pagapegetnextrec1-ex end-if * in Europe we need conversion US -> EU numbers inspect app-esercizio replacying all " " by "0" move npp-esercizio to pp-esercizio inspect app-numero replacying all " " by "0" move npp-numero to pp-numero inspect app-datdoc replacying all " " by "0" move npp-datdoc to pp-datdoc inspect app-codclf replacying all " " by "0" move npp-codclf to pp-codclf inspect app-codpag replacying all " " by "0" move npp-codpag to pp-codpag inspect app-impornet replacying all " " by "0" inspect app-impornet replacying all "-" by "0" move "-" to pp-impornetl (01) move npp-impornet to pp-impornet inspect app-importo replacying all " " by "0" inspect app-importo replacying all "-" by "0" move "-" to pp-importol (01) move npp-importo to pp-importo continue. pagapegetnextrec1-ex. exit. *----------------------------------------------------------------* pagapeinsert section. pagapeinsert0. * in Europe we need conversion EU-> US numbers move pp-esercizio to npp_esercizio move pp-numero to npp_numero move pp-datdoc to npp_datdoc move pp-codclf to npp_codclf move pp-codpag to npp_codpag move pp-impornet to npp_impornet inspect app-impornet replacying all "," by "." move pp-importo to npp_importo inspect app-importo replacying all "," by "." move spaces to sqcomando move 1 to w-scount string "INSERT INTO " delimited size "pagape" delimited size " (" delimited size "sqlpp_key" delimited size ", " delimited size "sqlpp_esercizio" delimited size ", " delimited size "sqlpp_numero" delimited size ", " delimited size "sqlpp_tipdoc" delimited size ", " delimited size "sqlpp_numdoc" delimited size ", " delimited size "sqlpp_datdoc" delimited size ", " delimited size "sqlpp_codclf" delimited size ", " delimited size "sqlpp_codpag" delimited size ", " delimited size "sqlpp_impornet" delimited size ", " delimited size "sqlpp_importo" delimited size ", " delimited size "sqlpp_passato" delimited size ")" delimited size " VALUES " delimited size "('" delimited size pp-key delimited size "', '" delimited size app-esercizio delimited size "', '" delimited size app-numero delimited size "', '" delimited size pp-tipdoc delimited size "', '" delimited size pp-numdoc delimited size "', '" delimited size app-datdoc delimited size "', '" delimited size app-codclf delimited size "', '" delimited size app-codpag delimited size "', '" delimited size app-impornet delimited size "', '" delimited size app-importo delimited size "', '" delimited size pp-passato delimited size "')" delimited size X"00" delimited size into sqcomando with pointer w-scount end-string call "MySQL_query" using sqcomando end-call if return-code not = 0 move 9 to sqomega move "Errore in insert pagape " to lnk-erro perform errore move zeroes to lnk-err go to pagapeinsert1-ex end-if. pagapeinsert1-ex. exit. *----------------------------------------------------------------* pagaperewrite section. pagaperewrite0. * in Europe we need conversion EU-> US numbers move pp-esercizio to npp_esercizio move pp-numero to npp_numero move pp-datdoc to npp_datdoc move pp-codclf to npp_codclf move pp-codpag to npp_codpag move pp-impornet to npp_impornet inspect app-impornet replacying all "," by "." move pp-importo to npp_importo inspect app-importo replacying all "," by "." move spaces to sqcomando move 1 to w-scount string "UPDATE " delimited size "pagape" delimited size " set " delimited size "sqlpp_key" delimited size " = '" delimited size pp-key delimited size "', " delimited size "sqlpp_esercizio" delimited size " = '" delimited size app-esercizio delimited size "', " delimited size "sqlpp_numero" delimited size " = '" delimited size app-numero delimited size "', " delimited size "sqlpp_tipdoc" delimited size " = '" delimited size pp-tipdoc delimited size "', " delimited size "sqlpp_numdoc" delimited size " = '" delimited size pp-numdoc delimited size "', " delimited size "sqlpp_datdoc" delimited size " = '" delimited size app-datdoc delimited size "', " delimited size "sqlpp_codclf" delimited size " = '" delimited size app-codclf delimited size "', " delimited size "sqlpp_codpag" delimited size " = '" delimited size app-codpag delimited size "', " delimited size "sqlpp_impornet" delimited size " = '" delimited size app-impornet delimited size "', " delimited size "sqlpp_importo" delimited size " = '" delimited size app-importo delimited size "', " delimited size "sqlpp_passato" delimited size " = '" delimited size pp-passato delimited size "'" delimited size " WHERE " delimited size "sqlpp_esercizio" delimited size " = '" delimited size pp-esercizio delimited size "'" " AND " "sqlpp_numero" delimited size " = '" delimited size pp-numero delimited size "'" X"00" delimited size into sqcomando with pointer w-scount end-string call "MySQL_query" using sqcomando end-call if return-code not = 0 move 9 to sqomega move "Errore in rewrite pagape " to lnk-erro perform errore move zeroes to lnk-err go to pagaperewrite1-ex end-if. pagaperewrite1-ex. exit. *----------------------------------------------------------------* pagapedelete section. pagapedelete0. move zeroes to sqomega move spaces to sqcomando move 1 to w-scount string "DELETE FROM " delimited size "pagape" delimited size " WHERE " delimited size "sqlpp_esercizio" delimited size " = '" delimited size pp-esercizio delimited size "'" delimited size " AND " delimited size "sqlpp_numero" delimited size " = '" delimited size pp-numero delimited size "'" delimited size X"00" delimited size into sqcomando with pointer w-scount end-string call "MySQL_query" using sqcomando end-call if return-code not = 0 move 9 to sqomega move "Errore in delete pagape " to lnk-erro perform errore move zeroes to lnk-err go to pagapedelete1-ex end-if. pagapedelete1-ex. exit. *----------------------------------------------------------------* pagapefreeres section. pagapefreeres0. if pagaperes not = NULL call "MySQL_free_result" using pagaperes end-call end-if. pagapefreeres1-ex. exit. *----------------------------------------------------------------* end program pagapetst . [/code] Marcellom ---------------------------------------------------------------- Subject: unable to configure on solaris... Build env: uname -m = sun4u uname -r = 5.9 uname -s = SunOS uname -v = Generic_122300-59 /usr/bin/uname -p = sparc /bin/uname -X = System = SunOS Node = hummer Release = 5.9 KernelID = Generic_122300-59 Machine = sun4u BusType = <unknown> Serial = <unknown> Users = <unknown> OEM# = 0 Origin# = 1 NumCPU = 1 Output from 'configure' -------------- checking for non-GNU ld... /usr/ucb/ld checking if the linker (/usr/ucb/ld) is GNU ld... no checking for shared library run path origin... done checking for iconv... yes checking for iconv declaration... extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); checking for nl_langinfo and CODESET... yes checking for getopt_long_only... no checking gmp.h usability... no checking gmp.h presence... no checking for gmp.h... no configure: error: gmp.h is required hummer # ls -l /usr/local/include/gmp.h -rw-r--r-- 1 root other 86242 May 31 09:42 /usr/local/include/gmp.h hummer # I just installed gmp , but OC does not see it in /usr/local/include where it is... ---------------------------------------------------------------- Really weird. Using the search function I found the solution within 1 click. Really more weird: the solution I found was a solution I gave to you on: 2011/1/29 8:32... Have a look at [url=http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1240&forum=1]this topic[/url] (as you may stumble upon the next step again, too) and post new questions (and you're "all fine, I did ...") here. human ---------------------------------------------------------------- Subject: calling cobol para from C Hi, I want to call a COBOL paragraph from a C program; I'm making use of PROCEDURE-POINTER and ENTRY stmt to get the para Entry pointer and passing this to a C program where I'm doing function call based on this pointer. I'm getting "Attempt to reference unallocated memory" error. Could anyone please help me. I'm using Ubuntu 10.04 OS. HANDCOND.CBL [code] *Compile: cobc -x -o HANDCOND HANDCOND.CBL IDENTIFICATION DIVISION. PROGRAM-ID. HANDCOND. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 HAND-COND-ADDR USAGE PROCEDURE-POINTER. PROCEDURE DIVISION. 000-REGISTER-EXIT-PROC. SET HAND-COND-ADDR TO ENTRY '999-EXIT'. CALL 'CPROG' USING HAND-COND-ADDR. IF RETURN-CODE NOT = 0 DISPLAY 'Error: Could not call CPROG sub program' END-IF. STOP RUN. 999-EXIT-PROC. ENTRY '999-EXIT' DISPLAY 'This is from 999-EXIT-PROC' GOBACK. [/code] CPROG.c [code] /* Compile: gcc -Wall -shared -fpic -Wl,--export-dynamic -o CPROG.so CPROG.c */ #include <stdio.h> #include <stdlib.h> /* function pointer */ typedef void (*pt2Function)(void); int CPROG (pt2Function funcptr) { printf ("@ CPROG enter\n"); // call the function pointer which is pointing to a cobol para (*funcptr)(); printf ("@ CPROG leaving\n"); return 0; } [/code] ---------------------------------------------------------------- CALL 'CPROG' USING HAND-COND-ADDR. I would try changing this to call by-value. Curt ---------------------------------------------------------------- sajjar; Ditto-ing Curt. See http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1320&forum=1#forumpost6681 for an explanation of why. Cheers, Brian ---------------------------------------------------------------- That magic word BY VALUE worked magically :-) Thanks for the help. However, the expected behavior I could not get it. I was expecting after the CALL, the cobol program should stop since the 999-EXIT-PROC para is having GOBACK stmt; but control came back to cobol program and continued till STOP RUN stmt. Is there anyway I could get my expected behavior ?. Thanks, Sajjar. ---------------------------------------------------------------- Couple of things for that then Sajjar. Take a look at Gary's programming guide. CALL has an ON EXCEPTION clause. That is what will fire if the CALL itself has trouble. The RETURN-CODE is actually the result of the sub program, when the CALL itself has already 'succeeded'. Next; GOBACK is, by definition, smart and 'does the right thing' and won't terminate a program run unless it occurs as the last of the call stack when it should return control to the operating system. If you want a subprogram to terminate the run unit as a whole, use STOP RUN. (And for fun, look at EXIT PROGRAM too). Gary's guide does a pretty good job of explaining all of the ins and outs of program flow rules. From C you can call [b]exit(status)[/b] which, by definition, unwinds the return stack and returns control (with the int status as it's result code) to the OS regardless of how deeply nested. That exit(status) is how STOP RUN (after proper COBOL cleanup) actually works as well. You can see the details in the OpenCOBOL sources in libcob/common.c in the function [b]cob_stop_run[/b]. This is versus [b]cobtidy[/b] which properly cleans up COBOL but does NOT terminate the process. Cheers, Brian ---------------------------------------------------------------- Thank you brian for the educative explanation. Now, I understood something on control flow; with this I shall design progs accordingly. Regards, Sajjar. ---------------------------------------------------------------- Subject: The ACCEPT var FROM HTTP-POST experiment Is HTTP-POST the right word to use for the source noun? The intent is to ease CGI programming for the POST/GET HTTP request methods. [i]And for the hipsters, maybe CGI is a stale expression. The clause will be usable for AJAX or other WWW techniques that ride on the hypertext transport protocol.[/i] COBOLScript uses ACCEPT DATA FROM WEBPAGE. Other suggestions are POST, HTTP, CGI. I'm leaning toward HTTP-POST, but anyone deeper in web development, please throw in. [i]Seeing as COBOL is so hip, we want the hippest word for this experimental OpenCOBOL extension.[/i] ... Time passes ... First [i]lazy-man[/i] cut builds on [code] ACCEPT var FROM ENVIRONMENT identifier [/code] Only 5 lines of compiler sources changed. And, hey, kinda works for GET method CGI. What do want for 10 minutes of effort, after 4 months of nothing? ;-) The fossil diff lists cobc/parser.y as: [code] @@ -492,8 +492,9 @@ %token GROUP %token HEADING %token HIGHLIGHT %token HIGH_VALUE "HIGH-VALUE" +%token HTTP_POST "HTTP-POST" %token IDENTIFICATION %token IF %token IGNORE %token IGNORING @@ -3824,8 +3825,12 @@ { cb_emit_accept_environment ($1); } | identifier FROM ENVIRONMENT simple_value on_accp_exception + { + cb_emit_get_environment ($4, $1); + } +| identifier FROM HTTP_POST simple_value on_accp_exception { cb_emit_get_environment ($4, $1); } | identifier FROM ARGUMENT_NUMBER [/code] and reserved.c as [code] @@ -317,8 +317,9 @@ {"HEADING", HEADING}, /* 2002 */ {"HIGH-VALUE", HIGH_VALUE}, /* 2002 */ {"HIGH-VALUES", HIGH_VALUE}, /* 2002 */ {"HIGHLIGHT", HIGHLIGHT}, /* 2002 (C/S) */ + {"HTTP-POST", HTTP_POST}, /* extension BWT */ {"I-O", I_O}, /* 2002 */ {"I-O-CONTROL", I_O_CONTROL}, /* 2002 */ {"ID", IDENTIFICATION}, /* extension */ {"IDENTIFICATION", IDENTIFICATION}, /* 2002 */ [/code] Which allows [code] OCOBOL >>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20110605 *> Purpose: Experimental first prototype of HTTP-POST *> Tectonics: cobc -x httppost.cob *> *************************************************************** identification division. program-id. httppost. data division. working-storage section. 01 sample pic x(256). *> *************************************************************** procedure division. accept sample from http-post "PATH" end-accept display function trim(sample) end-display goback. end program httppost. [/code] giving (with a little line splitting to avoid a wide forum post) [code]$ ./httppost /home/btiffin/bin:/home/btiffin/inst/go/bin:/usr/lib64/qt-3.3/bin:/usr/lib64/ccache: /usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin [/code] Baby step 1, done. Next is the potty training. ;-) In defense of this type of development. I like to work with initial, near to immediate positive feedback, get the juices flowing, which carries forward the momentum to dig in and do the real work. [i]This WILL end up being real work, if it's done right.[/i] [b]Note:[/b] Please be advised that this is NOT main line OpenCOBOL development. It's an experiment, and may never see the light of day outside the little circle of nutters that think "web development" and "COBOL" should occur in the same sentence. Cheers, Brian ---------------------------------------------------------------- Subject: Cannot find module ! (Changing module path at run-time) Hallo, I posted for the same topic some weeks ago. Starting from a common (cobc -x) file, I read a pair of tables from a MySQL (InnoDB) database. Accordingly to what I get from tables, I have to do some settings for all following calls. So, new values are set for LD_LYBRARY_PATH and LD_RUN_PATH to specify directories where subroutines are to be found (cobc -m). BUT, first program has loaded previous settings and ignores new ones. I also tried giving full path to called subroutine. Useless. [code] move spaces to w-syscall move 1 to w-scount string "set LD_LIBRARY_PATH=/usr/local:/usr/local/lib:" delimited size "/usr/local/include:/fms/550/stdok/int:" delimited size "/fms/550/stdok/int/s; export LD_LIBRARY_PATH" delimited size into w-syscall with pointer w-scount end-string call "SYSTEM" using w-syscall end-call [/code] [code] move spaces to w-syscall move 1 to w-scount string "set LD_RUN_PATH=/usr/local:/usr/local/lib:" delimited size "/usr/local/include:/fms/550/obj:/fms/550/obj/s:" delimited size "/fms/550/obj/" delimited size mf-objsett delimited spaces ":/fms/550/obj/" delimited size mf-objsett delimited spaces "/s; export LD_RUN_PATH" delimited size into w-syscall with pointer w-scount end-string call "SYSTEM" using w-syscall end-call. [/code] [code] move spaces to mf-objdir string "/fms/550/obj/" delimited size mf-objsett delimited spaces into mf-objdir end-string move "liccoge" to mf-objname perform prpobjpt call mf-objpath using mf-area end-call. [/code] [code] prpobjpt section. prpobp1. move space to mf-objpath string mf-objdir delimited by spaces "/" delimited by size mf-objname delimited by spaces ".so" delimited size into mf-objpath end-string. if mf-system > 1 inspect mf-objpath replacing all "/" by "\" end-if. prpobp1-ex. exit. [/code] Is there a way to resolve this "busillis". Thanks ---------------------------------------------------------------- I can't say I understand your problem exactly, but... You need to be wary of how process groups work inside the shell and in particular the environment spaces. When you start a Unix process it takes it's environment from it's parent. So your terminal shell, with an export environment variable, will pass that variable to all further children. But when you spawn a program that sets (and exports) variables, they will only be passed "down" a process tree. When you spawn a new job that exports variables, they may not be visible to any sibling processes. Nor can a process alter it's load path using the environment while it's running, as it's too late in that case. [i]Umm, I think. I better check that, and hopefully didn't just start spreading untruth about process invocation.[/i] You might want to look at http://opencobol.add1tocobol.com/#what-is-cob-pre-load and see if some trickery with that setting might help. If that convoluted explanation doesn't help you, we can discuss more. Cheers, Brian ---------------------------------------------------------------- Hi Brian, I try to explain it with an example. Suppose I have, from my .profile or my .bashrc [code] LD_LIBRARY_PATH=/pippo:/pippo/pluto LD_RUN_PATH=/pippo:/alpha/delta [/code] When I execute first program (/pippo/firstprog) it first reads from input (keyboard) database-name, user-name, user-password. This parameters are used to get from database-name.table1 and databasse-name.table2 user specific settings. I get, from tables containt that when THAT user works on THAT database, he is not to use subroutines present in current LD_LIBRARY_PATH LD_RUN_PATH, but those in [code] LD_LIBRARY_PATH=/paperino:/paperino/quiquoqua LD_RUN_PATH=/arabella:/arabella/nonnapapera [/code] I hoped that setting them via a system call could have immediately effect on calling program (I know i does not work this way but I tried this way as well) The second attempt has been done stringing with needed parameters full path to called program [code] string "/arabella/nonnapapera/" delimited size called-soubroutine delimited spaces ".so" delimited size into called-program-path end-string call called-program-path using .... giving ...... end-call [/code] In both ways, I get a ....program not found. Cheers Marcello ---------------------------------------------------------------- First: PLEASE (I mean that the screaming way...) change the title of your first post, as this IS NO BUG AT ALL. A bug is something that either worked in earlier versions or should work according to "the standards" () 2nd: Try to never use system specific stuff like LD_LIBRARY_PATH. For setting the library path(s) for module resolves one should set COB_LIBRARY_PATH. BUT this won't work during run-time. You may want to try one of these: a) Do firstprog in C (or C++), use setenv() there to set COB_LIBRARY_PATH according to your DB data and start your progs (via cob_init/cob_resolve [see cobcrun.c]) from there b) Rewrite firstprog for writing all necessary stuff into a file and use a batch like cobcrun firstprog; set COB_LIBRARY_PATH from file; cobcrun 2ndprog. c) Set COB_LIBRARY_PATH at run-time and call cob_init_call (VERY DIRTY) afterwards. This re-reads the necessary internal structures (and may crash as it isn't meant to be called from the COBOL part). human ---------------------------------------------------------------- Hi uman, did as you suggested. I've not been programming in C for a lot of time. This is the result of my efforts. [code] /* 1stprog.c */ #include <stdlib.h> #include <stdio.h> #include <string.h> #define FILE_NAME "/fms/550/tclf/avvio" extern char **environ; static inline char * safe(char *str) { return (str == NULL) ? "(null)" : str; } static inline void print_getenv(char *name) { char *val = safe(getenv(name)); // ignore errors printf("%p %s %s %p\n", environ, name, val, val); } int main( ) { char str1[70]; /* new COB_LIBRARY_PATH value */ int i = 0; int a; FILE *fp; /* system("/fms/550/obj/2ndprog"); * while testing, file is prepared manually */ if ((fp=fopen(FILE_NAME, "rb")) == NULL) { printf("Open avvio error\n"); exit(1); } if (fread(&str1, sizeof(str1), 1, fp) != 1) { if (feof(fp)) printf("Eof prematuro"); else printf("read avvio error"); fclose(fp); exit(1); } /* some getwchar() to check execution */ fclose(fp); fprintf(stdout, "%s", &str1); print_getenv("COB_LIBRARY_PATH"); if(unsetenv("COB_LIBRARY_PATH") != 0) { printf("variable unsetting impossible"); } getwchar(); /* if(setenv("COB_LIBRARY_PATH", str1, 1) !=0) { printf("variable setting impossible"); } */ if(setenv("COB_LIBRARY_PATH", "/fms/550/obj:/fms/550/obj/s:/fms/550/obj/objxi:/fms/550/obj/objxi/s", 1) !=0) { printf("variable setting impossible"); } /* system("/fms/550/obj/3rdprog"); */ exit(0); } [/code] Still unable to change COB_LIBRARY_PATH. Can you help me? What am I doing wrong? Thanks ---------------------------------------------------------------- I guess you've choosed a and b together??? What did you wanted to do? I'm not sure if I got it right, what you do. I know thinik the following solution would be a little bit dirty but it could work (and you don't have to hack OpenCOBOL or have to do unsupported stuff): 1. write a batch "startbatch" 1.1 if parameter1 is set use it as programname, if not use your startprog (for example prog1) 1.2 if parameter2 is set use it as COB_LIBRARY_PATH, if not, use what you need for running prog1 1.3 do cobcrun progamname 2. in prog1 1.1 get your user input and access database for getting the new COB_LIBRARY_PATH 1.2 do CALL 'SYSTEM' using 'startbatch prog2 newcoblibpath' 1.3 do STOP RUN you may need to something like "sleep 5" in the batch before 1.3 (mostly depending on screen i/o in prog1 via ACCEPT/DISPLAY as the termination of prog1 may interfere with prog2 starting). human BTW: I've tweaked your topic title a little bit further ---------------------------------------------------------------- Hallo, Immagin the following scenario. I am a vet, and have two further activities. In my farm I produce wine, corn and vegetables, to resell. Wine production is a long process and is subject to strict controls by authorities (in America perhaps FDA, in Italy at least 3 authorities are involved and all of them do frequent inspections and expect to find, inter alia, special reports suited to their needs). In corn and vegetable production, I use chemicals and then, special reports (authorities are different). For both activities, I have to keep a rigorous accountancy of waste disposal (stalk, as an example, is considered, in Italy, special waste). In my vet activity, I use poisons, and so, special accountancy, special reports, etc., etc. All of my employees have access to common computerized system, but administrative clerks have NO access to vet poison, chemicals, waste and production handling but HAVE access to accounting, even my vet's one (for payments, collection and tax) Technical employees have access to "special waste" and chemicals handling but NO access to vet poison, accounting, etc. Access is granted (or denied) by a common starting program which requires database-name, database-user-name, database-user-password and internal-user-name. As soon as database access is granted, internal-user-name is used to get specific user's "area-of-interest". The specific "area-of-interest" corresponds to a disk directory containing all programs, and only those, handling that "specific area of interest", with tailored menus, programs, screens and checks. In that directory, I might, afterwards, add new programs to allow one, or a few, of my administrative clerks to have reports (not handling) of chemicals, poisons, waste for transport to landfill. In MF, the call to soubroutine allows full-path to called program. I just don't know how to obtain the same with OC. I modified again "common first program", compiled gcc and sent to /usr/bin (present in all users PATH). I run it from a terminal prompt (just program-name) and check it's execution ( printf, fprintf, getwchar). Steps are ok, settings are ok but have no global effect. If, while executing it, after an unsetenv, which really unsets COB_LIBRARY_PATH, open another terminal to "echo $COB_LIBRARY_PATH" I still get original path. After setenv, inside executing program, path is changed but in second terminal "echo $COB...." is still unchanged. This is modified common-starting-c program. [code] /* firstprog.c */ #include <stdlib.h> #include <stdio.h> #include <string.h> #define FILE_NAME "/fms/550/tclf/avvio" extern char **environ; static inline char * safe(char *str) { return (str == NULL) ? "(null)" : str; } static inline void print_getenv(char *name) { char *val = safe(getenv(name)); // ignore errors printf("\n%s %s\n", name, val); } int main( ) { char str1[68]; /* dimensione della stringa da leggere */ int i = 0; int a; FILE *fp; /* system("/fms/550/obj/1st-cobol-program-accepting-params"); * in fase di testing il file parametri viene preparato separatamente * da tastiera */ if ((fp=fopen(FILE_NAME, "rb")) == NULL) { printf("Errore in apertura avvio\n"); exit(1); } if (fread(&str1, sizeof(str1), 1, fp) != 1) { if (feof(fp)) printf("Eof prematuro"); else printf("errore in lettura avvio"); fclose(fp); exit(1); } /* qualche getwchar() per verificare l'avanzamento */ fclose(fp); fprintf(stdout, "\n%s\n", &str1); print_getenv("COB_LIBRARY_PATH"); if(unsetenv("COB_LIBRARY_PATH") != 0) { printf("Impossibile unsettare la variabile"); } getwchar(); print_getenv("COB_LIBRARY_PATH"); getwchar(); if(setenv("COB_LIBRARY_PATH", str1, 1) !=0) { printf("Impossibile unsettare la variabile"); } print_getenv("COB_LIBRARY_PATH"); /* system("/fms/550/obj/1st-specific-area-of-interest-program"); */ getwchar(); exit(0); } [/code] Thanks ---------------------------------------------------------------- Hallo, I was forgetting. I've tried all "shell" possible solutions. #!/bin/csh, #!/bin/sh, #!/bin/bash, etc for path settings. But as they work in shell-mode, changes go back to original values at shell-exit Thanks ---------------------------------------------------------------- Hallo, I hope this will be my last post for today. In previous scenario, it is impossible .profile or ,bashrc COB_LIBRARY_PATH setting, because, in "wine production area", for example, any terminal can be used interchaneably by accounting clerks, oenologists, laboratory technicians, vintners, etc. ---------------------------------------------------------------- Calling the full qualified name does only work with OpenCOBOL 1.1, if you change the program id according to the later place (VERY stupid solution, but it technically works - doesn't help you, I know :). I meant somethink like that. 1. write a batch "startbatch" [code]#!/bin/sh programname="$1" coblibpath="$2" if test "$programname"==""; then programname="prog1"; fi if test "$coblibpath"==""; then coblibpath="/cobstartdir"; fi export COB_LIBRARY_PATH=$coblibpath sleep 2 cobcrun $programname [/code] 2. in prog1 [code] IDENTIFICATION DIVISION. PROGRAM-ID. 'prog1'. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 77 programname-and-libpath pic x(256). [...] move spaces to programname-and-libpath string programnamefromdb delimited by space ' ' delimited by size librarypathfromdb delimited by space into programname-and-libpath end-string call 'SYSTEM' using programname-and-libpath end-call STOP RUN.[/code] Do you get the idea? Did you tried that? human ---------------------------------------------------------------- Hallo, No matter what I try, the problem is still unresolved. Afaik, the only valid solution is getting libcob to accept a full-path for called dinamically linked module. How can do it? Marcellom ---------------------------------------------------------------- it doesnt.... :( I am not sure what does the standard define (whether full path is allowed) . In RMCobol it was as i know.. ---------------------------------------------------------------- so does MicroFocus. ---------------------------------------------------------------- ... so does OpenCOBOL 2.0 (I don't know when the first public release will come out). As you didn't mentioned it: I still believe the workaround I've posted (with code of startbatch and prog1) will work. Did you tried that? human ---------------------------------------------------------------- I haven't read in detail this whole thread, but just to add to the information. dlopen is the basic shared object operator in use [code] If pathname has dependencies on other objects, these objects are automatically loaded by dlopen(). The directory search path used to find pathname and any dependencies can be affected by setting the environment variable LD_LIBRARY_PATH. Any LD_LIBRARY_PATH variable is analyzed once at process startup. The search path can also be affected from a runpath setting within the object from which the call to dlopen() originates. These search rules will only be applied to path names that do not contain an embed- ded '/'. Objects whose names resolve to the same absolute path name or relative path name can be opened any number of times using dlopen(). However, the object that is referenced will only be loaded once into the address space of the current process. [/code] So, given what that says about runpath, unless you are using a directory structure to overlay the same filenames, if you compile your main binary with [code] EXPORT LD_RUN_PATH=all-the-directories-that-you-could-ever-possibly-want cobc -x main.cob [/code] you should get a binary so that dlopen will happily track through a huge pile of dirs to get at your objects. You might even be able to write a little bash in combination with SQL SELECT to build the string for the LD_RUN_PATH, then recompile before every run if the structure data is apt to change often enough. [i]if you need same-name overlays, this won't work, nor is it of use for non unixy setups.[/i] Cheers, Brian ---------------------------------------------------------------- Subject: Help with GDB Hello.. Although searching i couldnt find an answer.... How can i run my .so opencobol generated module with gdb ??? Note that it has SECURITY env variable and 2-3 others. All the examples use executable examples like cobc -x.. With GDB could i go step by step at C code?Thank you.. Also how tek heck would i run debuging with gdb and having screen section at the same time??? ---------------------------------------------------------------- Ok i found the solution... i redirected stderr and its ok ---------------------------------------------------------------- Please give a detailed example how you got GDB to debug your COBOL programs with screen i/o without chrushing that (compile line for cobc, the way you've started and used GDB, ...). I'm sure this would help a lot of other people that try to do that (and is likely to get into the OC FAQ, if you'Re fine with that). human ---------------------------------------------------------------- First you should compile with -debug and -ftraceall.. Second you should start cobcrun with gdb.. gdb cobcrun Then you should type run the_cobcrun_parameters_you_would_put param[i]... ex cobcrun menu0 run menu0 You should also redirect stderr using "2>" otherwise it will become a mess I redirected it to another terminal window. Example run menu0 2>/dev/pts/1 And works great!! ---------------------------------------------------------------- I've never thought of the possibilty to redirect a GDB programm's output to another terminal and this should be possible for the programs input, too. It could be easier here to simply start the COBOL program (compiled with -x or using cobcrun) in one terminal, opening another terminal with GDB and attach it to the COBOL process of the first terminal (by using the attach [i]progess-id[/i] command instead of run [one gets the progress-id using "top -u [i]own username[/i]" before starting GDB, for example]). I think both techniques should be taken into the FAQ. human ---------------------------------------------------------------- tips: create command-file for gdb and run gdb with -x and --args options. this sample show you segfault-ed line number if you compile with -g option for *.cob file. (but, oc-1.1) file: gdb.cmd [quote] run bt p/d cob_source_line quit [/quote] gdb -x gdb.cmd --args /usr/bin/cobcrun YOURPROG :-D ---------------------------------------------------------------- Subject: Files with multiple record layouts As a general COBOL question, does anyone know of a technique other than assigning a record identifier field in the same column in all records to identify which record belongs with which layout. The example that I have has about 5 or 7 different records all 180 characters long, with packed decimal fields that overlap character fields. I am trying to reconstruct the file layout from a hex dump. ---------------------------------------------------------------- I doubt I understand the problem, but look to 66 RENAMES and REDEFINES. I wrote this the other night, but then didn't post it, as it may not highlight real world use of 66-level fields. [code] OCOBOL >>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20110606 *> Purpose: Demonstration of 66-level datanames *> Tectonics: cobc -x sixtysix.cob *> *************************************************************** identification division. program-id. sixtysix. data division. working-storage section. 01 master. 05 field-1 pic s9(9). 05 field-2 pic x(16). 05 field-3 pic x(4). 05 field-4 pic s9(9). 66 sixtysix renames field-2. 66 group-66 renames field-2 through field-4. *> *************************************************************** procedure division. move -66 to field-1. move "sixtysix" to field-2. move "ABCD" to field-3. multiply field-1 by -1 giving field-4. display "master : " master end-display display "field-1 : " field-1 end-display display "sixtysix: " sixtysix end-display display "group-66: " group-66 end-display goback. end program sixtysix. [/code] giving [code] master : 00000006vsixtysix ABCD000000066 field-1 : -000000066 sixtysix: sixtysix group-66: sixtysix ABCD000000066 [/code] [i]REDEFINES is left as an exercise for the reader.[/i] I didn't really answer your question, but figure this is an excuse for posting the sample. If you have consistent 180 byte records, it's likely multiple 01 record sub-groups with one of the fields being the type in a consistent position that can be used to determine what actual layout to process??? Maybe. Cheers, Brian ---------------------------------------------------------------- I can think of no other practical way. However, the record identifier may well be longer than 1 character/column. Best of luck with what sounds a nightmare. ---------------------------------------------------------------- If there's no record descriptor field in the record, then there is one of two ways: 1) the program interrogates the data and figures out the record descriptor at run time. I've done this before where I was given outside data with no descriptors. 2) the program "knows" internally. It knows how many records it wrote out, and the order they were written. So it knows how many records will come back in, and in which order. This means that the data will always be in the same record count and order for every run. I do not recommend such a technique. It hard couples the data to the program. Data should always be loose coupled as much as possible. Hope this helps. ---------------------------------------------------------------- I hadn't thought of #2. There are header records and detail records, so based on the content of the header record, only certain detail records might be expected. ---------------------------------------------------------------- Well, with the “Header record” concept, I can see how you can get away without having a record type identifier field common to all the varying record types. As you are aware, multiple 01 levels in the same File Description (FD) redefines the same record area. Hopefully, with the following program, you can fill in the blanks. [code] identification division. program-id. MasterRecPGM. environment division. input-output section. file-control. select master-file assign to "master.dat". data division. file section. fd master-file. 01 master-header-rec pic x(180). 01 detail-rec1. * -- fill in detail fields here 01 detail-rec2. * -- fill in detail fields here 01 detail-rec3. * -- fill in detail fields here 01 detail-rec4. * -- fill in detail fields here 01 detail-rec5. * -- fill in detail fields here working-storage section. 01 ws-master-header. 05 ws-recs-cnt-type1 pic s9(5) comp-3. 05 ws-recs-cnt-type2 pic s9(5) comp-3. 05 ws-recs-cnt-type3 pic s9(5) comp-3. 05 ws-recs-cnt-type4 pic s9(5) comp-3. 05 ws-recs-cnt-type5 pic s9(5) comp-3. 01 ws-misc. 05 ws-sub pic s9(4) binary. procedure division. 0000-mainline. open input master-file read master-file into ws-master-header at end continue not at end perform 2000-main-process end-read close master-file goback . *--------------------------------------------------------------- * This process assumes that detail records type 1, 2, 3, ... * * Also the perform varying... was assumed as test prior to * executing the perform paragraph, therefore a record count of * zero does not execute the corresponding paragragh. *--------------------------------------------------------------- 2000-main-process. perform 3000-read-type1-recs varying ws-sub from +1 by +1 until ws-sub > ws-recs-cnt-type1 perform 3010-read-type2-recs varying ws-sub from +1 by +1 until ws-sub > ws-recs-cnt-type2 perform 3020-read-type3-recs varying ws-sub from +1 by +1 until ws-sub > ws-recs-cnt-type3 perform 3030-read-type4-recs varying ws-sub from +1 by +1 until ws-sub > ws-recs-cnt-type4 perform 3040-read-type5-recs varying ws-sub from +1 by +1 until ws-sub > ws-recs-cnt-type5 . 3000-read-type1-recs. read master-file . 3010-read-type2-recs. read master-file . 3020-read-type3-recs. read master-file . 3030-read-type4-recs. read master-file . 3040-read-type5-recs. read master-file . [/code] ---------------------------------------------------------------- So far I have identified 7 different record layouts. Fortunately, I also found an old pad of "Printer Layout Forms" that Moore Business Forms used to give away. I taped two pages together to get 180 columns, and now I am charting each record layout on the form so that I can easily see which columns are common. The following is a partial hex dump of the data portion of an ISAM file created using Microfocus cobol. The "0a" is the record separator, and comp-3 fields generally start with "00" (depends on the value stored) and end with an "f" if not signed, and if signed, end with a "c" if positive, or "d" if negative. The records are not in key sequence probably because the header record is written last. [code]*************************************************************************** e005290 20 0a 30 48 39 35 31 30 20 31 43 41 33 35 33 36 .0H9510 1CA3536 e0052a0 00 35 51 51 74 1c 20 20 20 20 33 33 32 32 38 20 .5QQt. 33228 e0052b0 34 43 43 43 35 30 31 30 34 32 34 32 20 43 41 33 4CCC50104242 CA3 e0052c0 35 33 36 34 43 43 43 35 30 33 33 32 32 38 20 20 5364CCC5033228 e0052d0 30 31 32 4f 4e 48 53 54 20 20 31 30 34 32 34 32 012ONHST 104242 e0052e0 33 20 20 20 20 20 20 00 00 00 1c 00 00 00 1c 00 3 ......... e0052f0 06 10 00 0c 00 00 06 10 0c 20 20 20 20 00 00 00 ......... ... e005300 00 00 0f 00 01 00 00 0f 20 20 20 20 20 20 20 20 ........ e005310 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 e005320 20 20 20 20 20 20 20 20 20 20 20 31 31 00 00 00 11... e005330 00 0c 20 20 00 00 00 00 0c 20 20 20 20 20 20 20 .. ..... e005340 20 20 20 20 59 20 0a 30 48 39 35 31 30 20 32 43 Y .0H9510 2C e005350 41 33 35 33 36 00 35 51 51 74 1c 20 20 20 20 33 A3536.5QQt. 3 e005360 33 32 32 38 20 54 41 58 20 20 20 31 30 34 32 34 3228 TAX 10424 e005370 32 20 43 41 33 35 33 36 54 41 58 20 20 20 33 33 2 CA3536TAX 33 e005380 32 32 38 20 20 30 31 32 4f 4e 48 53 54 53 54 31 228 012ONHSTST1 e005390 30 34 32 34 32 35 00 00 00 79 3c 59 59 31 33 30 042425...y<YY130 e0053a0 30 30 30 30 48 53 54 31 33 30 30 30 30 20 20 20 0000HST130000 e0053b0 30 30 30 30 30 30 20 20 20 30 30 30 30 30 30 20 000000 000000 e0053c0 20 20 30 30 30 30 30 30 20 20 20 30 30 30 30 30 000000 00000 e0053d0 30 20 20 20 30 30 30 30 30 30 20 20 20 20 20 20 0 000000 e0053e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 e0053f0 20 20 20 20 20 20 20 20 20 20 20 0a 30 48 39 35 .0H95 e005400 31 30 20 35 43 41 33 35 33 36 00 35 51 51 74 1c 10 5CA3536.5QQt. e005410 20 20 20 20 33 33 32 32 38 20 34 43 43 53 35 30 33228 4CCS50 e005420 31 30 34 32 34 32 20 43 41 33 35 33 36 34 43 43 104242 CA35364CC e005430 53 35 30 33 33 32 32 38 20 20 30 31 32 4f 4e 48 S5033228 012ONH e005440 53 54 20 20 31 30 34 32 34 32 33 20 20 20 20 20 ST 1042423 e005450 20 00 01 71 0c 00 01 71 0c 00 00 10 76 2c 00 00 ..q...q....v,.. e005460 18 40 3c 20 20 20 20 00 00 00 00 00 0f 00 01 00 .@< ......... e005470 00 0f 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .. e005480 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 e005490 20 20 20 20 20 31 31 00 00 00 00 0c 20 20 00 00 11..... .. e0054a0 00 00 0c 20 20 20 20 20 20 20 53 20 20 20 59 20 ... S Y e0054b0 0a 30 48 39 35 31 30 20 36 20 20 20 20 20 20 00 .0H9510 6 . e0054c0 35 51 51 74 1c 20 20 20 00 35 51 51 74 1c 20 20 5QQt. .5QQt. e0054d0 20 20 20 20 20 20 20 20 20 20 20 00 35 51 51 74 .5QQt e0054e0 1c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00 . . e0054f0 35 51 51 74 1c 20 20 20 20 20 20 20 20 20 20 34 5QQt. 4 e005500 43 4f 4c 4f 55 52 20 49 4d 41 47 45 53 20 20 20 COLOUR IMAGES e005510 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 e005520 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 e005530 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 e005540 e005550* e005560 20 20 20 20 20 0a 30 48 39 35 31 30 20 37 43 41 .0H9510 7CA e005570 33 35 33 36 00 35 51 51 74 2c 20 20 20 20 33 33 3536.5QQt, 33 e005580 32 32 38 20 54 41 58 20 20 20 31 30 34 32 34 32 228 TAX 104242 e005590 20 43 41 33 35 33 36 54 41 58 20 20 20 33 33 32 CA3536TAX 332 e0055a0 32 38 20 20 30 31 32 4f 4e 48 53 54 53 54 31 30 28 012ONHSTST10 e0055b0 34 32 34 32 35 00 00 02 39 2c 59 59 31 33 30 30 42425...9,YY1300 e0055c0 30 30 30 48 53 54 31 33 30 30 30 30 20 20 20 30 000HST130000 0 e0055d0 30 30 30 30 30 20 20 20 30 30 30 30 30 30 20 20 00000 000000 e0055e0 20 30 30 30 30 30 30 20 20 20 30 30 30 30 30 30 000000 000000 e0055f0 20 20 20 30 30 30 30 30 30 20 20 20 20 20 20 20 000000 e005600 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 e005610 20 20 20 20 20 20 20 20 20 20 0a 30 48 39 35 31 .0H951 e005620 30 20 33 43 41 33 35 33 36 00 35 51 51 74 2c 20 0 3CA3536.5QQt, e005630 20 20 00 35 51 51 74 2c 20 20 20 20 20 20 20 20 .5QQt, e005640 20 20 20 20 20 00 35 51 51 74 2c 20 20 20 20 20 .5QQt, e005650 20 20 20 20 20 20 20 20 20 00 35 51 51 74 2c 20 .5QQt, e005660 20 20 20 20 20 20 20 20 20 31 49 33 33 38 30 4d 1I3380M e005670 4d 4e 30 31 36 33 34 20 20 20 20 20 20 20 20 20 MN01634 e005680 20 20 20 20 20 00 00 00 0f 31 31 31 37 31 30 00 ....111710. e005690 00 00 0f 31 32 32 31 31 30 31 32 31 35 31 30 30 ...1221101215100 e0056a0 31 31 35 31 31 43 4d 33 00 00 00 0f 30 30 30 30 11511CM3....0000 e0056b0 20 59 00 00 84 87 0f 00 00 82 66 0f 31 30 37 36 Y........f.1076 e0056c0 32 00 00 00 00 50 0f 31 20 20 20 20 20 20 20 0a 2....P.1 . e0056d0 30 48 39 35 31 30 20 34 43 41 33 35 33 36 00 35 0H9510 4CA3536.5 e0056e0 51 51 74 2c 20 20 20 00 35 51 51 74 2c 20 20 20 QQt, .5QQt, e0056f0 20 20 20 20 20 20 20 20 20 20 00 35 51 51 74 2c .5QQt, e005700 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00 35 .5 e005710 51 51 74 2c 20 20 20 20 20 20 20 20 20 20 32 43 QQt, 2C e005720 41 33 35 33 36 20 20 20 20 20 20 20 20 20 4d 4d A3536 MM e005730 20 20 00 0f 00 0f 20 20 20 20 20 20 20 20 20 20 .... e005740 20 20 20 20 20 20 31 32 32 31 31 30 31 32 32 31 1221101221 e005750 31 30 20 20 20 20 20 20 20 4c 39 57 32 59 20 20 10 L9W2Y e005760 20 20 00 00 00 00 0c 20 00 00 00 00 0c 20 20 20 ..... ..... e005770 20 20 20 20 20 36 20 20 20 20 20 20 20 20 20 20 6 e005780 20 59 20 20 0a 30 48 39 35 31 30 20 20 43 41 33 Y .0H9510 CA3 e005790 35 33 36 31 30 34 32 34 32 30 30 30 00 35 51 51 536104242000.5QQ e0057a0 74 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 00 t, . e0057b0 35 51 51 74 2c 20 20 20 20 20 20 20 20 20 20 20 5QQt, e0057c0 20 20 20 00 35 51 51 74 2c 20 20 20 20 20 20 20 .5QQt, e0057d0 20 20 20 31 5a 53 59 53 54 4d 4d 4e 30 31 36 33 1ZSYSTMMN0163 e0057e0 34 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00 4 . e0057f0 00 00 0f 31 31 32 33 31 30 00 00 00 0f 31 32 32 ...112310....122 e005800 31 31 30 31 32 31 35 31 30 30 31 31 35 31 31 43 110121510011511C e005810 4d 33 00 00 00 0f 30 30 30 30 20 59 00 00 00 00 M3....0000 Y.... e005820 0f 00 00 00 00 0f 30 30 30 30 30 00 00 00 00 00 ......00000..... e005830 0f 31 20 20 20 20 20 20 20 0a 30 48 39 35 31 30 .1 .0H9510 e005840 20 30 43 41 33 35 33 36 00 35 51 51 74 2c 20 20 0CA3536.5QQt, e005850 20 00 35 51 51 74 2c 20 20 20 20 20 20 20 20 20 .5QQt, e005860 20 20 20 20 00 35 51 51 74 2c 20 20 20 20 20 20 .5QQt, e005870 20 20 20 20 20 20 20 20 00 35 51 51 74 2c 20 20 .5QQt, e005880 20 20 20 20 20 20 20 20 32 43 41 33 35 33 36 20 2CA3536 e005890 20 20 20 20 20 20 20 20 4d 4d 20 20 00 0f 00 0f MM .... e0058a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 e0058b0 31 32 32 31 31 30 31 32 32 31 31 30 20 20 20 20 122110122110 e0058c0 20 20 20 4c 39 57 32 59 20 20 20 20 00 00 27 68 L9W2Y ..'h e0058d0 8c 20 00 00 00 00 0c 20 20 20 20 20 20 20 20 36 . ..... 6 e0058e0 20 20 20 20 20 20 20 20 20 20 20 59 20 20 0a 30 Y .0 *************************************************************************** [/code] ---------------------------------------------------------------- The "0a" is the record separator, and comp-3 fields generally start with "00" (depends on the value stored) and end with an "f" if not signed, and if signed, end with a "c" if positive, or "d" if negative. The records are not in key sequence probably because the header record is written last. This isnt true at least at OpenCobol.. OA is the record seperator but 00 seperator is for deleted records. COMP-3 sign depends how you store the sign.. also for negative it isnt always d ---------------------------------------------------------------- Subject: OpenCOBOL 2.0 You know me, I'm not a pushy guy... But when will the OpenCOBOL 2.0 release come out? ---------------------------------------------------------------- hello everyone. that's true, at what level is the version 2 good luck to our builders and THANKS for previous versions. ---------------------------------------------------------------- Full Ack - still waiting for 2.0. Any news/any new plan for this release? ---------------------------------------------------------------- News: I have an alpha copy. New plan: Not sure. It's out there, but not quite ready for public consumption. So, it's the fine line of managing expectations. Know that it's in active development, but don't spend waking hours worrying about when it'll roll-out so as to avoid day to day disappointment? I can say with a fairly high level of confidence that any source code developed with 1.1pre-rel will work out-of-the-box with 2.0, [i]and 1.1pre-rel is pretty cool as-is[/i]. Cheers, Brian ---------------------------------------------------------------- Hi Brian, I just want to make sure that we all know what you're confident about: a) "any [COBOL] source code developed [=compiled] with 1.1pre-rel will work [compile and run] out-of-the-box with 2.0" OR a) "any [C] source code developed [for additional functionality of] 1.1pre-rel will work [compile and run] out-of-the-box with 2.0" human BTW: Any news about a changing opencobol.org from your team? ---------------------------------------------------------------- Yeah, I got an email on Friday, with Aoirthoir's team now assuming "go" on a redesign of opencobol.org. I can't speak as to how or when the DNS cutover may occur. Cheers, Brian ---------------------------------------------------------------- Re the "1.1pre-rel upgrade to 2.0" More like c. I can't say a compiled 1.1pre-rel object or .so will sync in smoothly with 2.0 sources. Might be better to recompile all the sources. Is what I was trying to get at. ;) Cheers, Brian ---------------------------------------------------------------- Just to make this clear: 1.1 objects will surely not work with 2.0 runtime (the version check that comes up "version mismatch" makes sure you do not chrash). human ---------------------------------------------------------------- Subject: Trivial pursuits - shortest source Updated entry on shortest programs. Can't really beat 0 bytes. http://opencobol.add1tocobol.com/#what-is-the-shortest-opencobol-program Oh, and trivia for me. All the Reserved words from A through C now have some form of blurb. Woohoo, A to C. ;-) Cheers, Brian ---------------------------------------------------------------- You are aware that Roger wrote this about upcoming 2.0 version, are you? The option -frelax-syntax isn't available in 1.1 feb09 and cannot be as the necessary parser rewriting occured later (therefore -std does not help in 1.1 feb09, too). human ---------------------------------------------------------------- Yeah I'm aware. I'm still on that weird fence trying not to get people in a day to day expectation of shiny new, while still keeping up with the info and doc writing when I find the time to do, so I didn't mention it explicitly. :-) I left the current 1.1 entries in the FAQ for now. So, for everyone reading, yeah, we have to wait. I don't know how long, so for peace of mind, please try and not worry about it. However unfair that may seem. I have reasons to feel uncomfortable putting people in a wait-expectation loop. [i]I watched a five year (and counting) delay, not in and of itself the worst problem, dampen the spirits of the current REBOL community. It was news of "3.0 is due in a few weeks" that turned out being a bigger issue.[/i] Do that 150 times and expectations turn to frustrations. Not nice. Especially when REBOL 2 is still a wicked cool product, and always will be. OpenCOBOL 1.1 is a wicked cool product, and always will be. 2.0 will be better, and it'll be worth the wait, [i]but its release date is not worth fretting over, nor is it worth putting off any COBOL developments using the current tools[/i], in my humble opinion. And hey, the FAQ still has A thru C reserved word in, as that "future" entry got me revved up to do some backfill typing. ;-) Cheers, Brian ---------------------------------------------------------------- However this has always been acceptable -std=mf This IS the minimal accepted syntax from more than one compiler and AFAIK the absolute minimum for both an exectuble prog and a module. Roger ---------------------------------------------------------------- Subject: Migration from opencobol 0.33 32bits to opencobol 1.1 (or 2.0) 64bits Hello to everyone, For the project I'm working on (still at qualifying step, should be soon in production stage), the platform should change from Linux 32 bits/Oracle 9.2/OC 0.33+DBD 4.2 to Linux 64 bits/Oracle 10.0.4/OC 1.1 (maybe OC 2.0 ?) + DBD 4.x. I have questions (maybe someone has already answered them or they are out of the question because of the architecture of OC). Here are my thoughts/doubts about the migration : I imagine that the only things that could be impacted are : - Recompilation of all cobol programs - The application uses seq indexed files handled by DBD : from 32 bits to 64 bits, should we regenerate those files as for VBISAM ? - OC handles arithmetic operations by gmp : what gives an add operation between two integers (16 bits on 32 bits machine and 32 bits on 64 bits machine) which value could be 65535 each ? in general, are there issues with gmp between 32 bits machine and 64 bits one Thanks in advance for your answers. KR, Eraso ---------------------------------------------------------------- First i think that if the system works fine and there is no other reason ,dont upgrade just to upgrade. Recompilation should work i believe without problems...OC 0.33 was too strict and had problems... BDB has tools to check BDB files,i believe that if you use a later version you should call upgrade command or recreate the index.. ---------------------------------------------------------------- Thanks for your answer Parhs. :-D This all because there will be a major upgrade of the application using OC and the new version will be installed on a new platform which fits to internal specification. KR, eraso ---------------------------------------------------------------- On bdb As Parhs mentioned, for Berkeley DB upgrades you can use db_upgrade (sometimes). See http://pybsddb.sourceforge.net/utility/db_upgrade.html for some hints on how that can be done and caveats on what to watch out for. Our good Bill Klein has mentioned before that the safest way to 'upgrade' (or port) COBOL datasets is to write sequential or line sequential versions using the old COBOL system, then read these sequential files and write to more advanced structures using the new system. (That would apply to many situations; compiler vendor change, ISAM engine, OS change, and on and on). This requires writing some code on both systems, and staging any upgrades accordingly. Once you have a template it usually just comes down to a few mods of the FDs and record layouts. So yeah, regenerate the datasets for sanity. On executables. Yep, always a sane plan to recompile the entire suite of programs in use when porting up or down OpenCOBOL versions. All of them. That can be made super easy with tools like [b]make[/b] and using [b]touch[/b]. Touch will update timestamps, so it may not always be applicable if you like to know the date when a source file was actually last updated. Using an SCM (like Fossil - my favourite), you can automate a checkout in a temporary working dir to pull off the same magic with very little effort and just let the machine spin all the work. On math and gmp. Internally consistent 64 bit gmp usage will be fine once the suite of programs is recompiled, and normally you don't need to think about it. When you do, intelligent use of COBOL PICTURE clauses can guarantee safe portable values. I'd have to play around and test, but USAGE BINARY-SHORT should give LENGTH 2 (range of 0-65535). [i]That really would require a few experiments to verify, and I may be talking out my backside right now.[/i] I've never had to think about 32 bit versus 64 bit gmp, and I've never been in an [i]up-port[/i] situation with critical datasets. Gary's OpenCOBOL Programmer's Guide, has the details in section 5.3. See http://opencobol.add1tocobol.com/OpenCOBOL%20Programmers%20Guide.pdf (an indispensable OpenCOBOL reference, when you really need to know what's what). Cheers, Brian ---------------------------------------------------------------- Subject: 64-BIT Mingw Hey all. Before I get started I was wondering if it will be a waste of my time. I've noticed that there is a 64-bit version of mingw but that msys is still 32-bit. Is there going to be an issue with recompiling OC 1.1 with 64-bit mingw with 32-bit msys installed? Or does msys not matter except to provide the *nix environment of for making the compiles? Cheers UPDATE **** Well I have been trying and trying to get things moving. I downloaded and installed the latest mingw. Installed gmp, pdcurses and get stuck with BDB. I've tried 4.5.20 and 5.0.28 (the latest) My configure is: $ ../dist/configure --enable-mingw --prefix=/mingw --enable-compat185 LIBCSO_LIBS=-lwsock32 LIBXSO_LIBS=-lwsock32 but to no avail. It keeps blowing up with repmgr_posix. Now from what I've read the LIBCSO_LIBS=-lwsock32 LIBXSO_LIBS=-lwsock32 should avoid that. I am at a loss. The system I am trying to get this going on is Windows 7 32 and 64 bit. Any help would be welcome ---------------------------------------------------------------- Subject: Conditional? CALL for samples and experiments I use CBL_OC_DUMP (modified with a passed in len) a lot. I like it. It helped me cypher through the (current) lack of support for FLOAT-SHORT BY VALUE and experiments at getting it REDEFINED into something that was supported for calling printf. Now I use that file for other CALL experiments, and bumped into this today (because I keep forgetting, three days later, to include CBL_OC_DUMP.cob in the compile lines) [code] call "CBL_OC_DUMP" using pie 64 on exception continue end-call display pie end-display [/code]and get [code] $ cobc -x formatted.cob CBL_OC_DUMP.cob ./formatted Offset HEX-- -- -- -5 -- -- -- -- 10 -- -- -- -- 15 -- CHARS----1----5- 000000 db 0f 49 40 00 00 00 00 00 00 00 00 00 00 00 00 �.I@............ 000016 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000032 0a 00 00 00 00 00 00 00 5a 2a 40 00 00 00 00 00 ........Z*@..... 000048 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 3.1415927 [/code] and without including dump in the compile[code] $ cobc -x formatted.cob $ ./formatted 3.1415927 [/code] Super cool. Perhaps not efficient, but here at home exploring I, ahhh, think I'll get less, "you idiot, you forgot to compile in dump". I'll get the dumps when I want them and not when I don't think about it, not getting [code] call "CBL_OC_DUMP" using pie 64 end-call $ cobc -x formatted.cob $ ./formatted libcob: Cannot find module 'CBL_OC_DUMP' [/code] and a 'doh!' moment when I don't really care about dumps in the particular snippet testing. Anyway, ON EXCEPTION CONTINUE. I doubt it'd be smart to use such a sequence in production, but it works for re-using experimental source files. Cheers, Brian [i]Note: the CBL_OC_DUMP is for 64 bytes starting at a FLOAT-SHORT with 3.141592654 moved into it, and a bunch of other WORKING-STORAGE, so it may seem like junk after the first 4 bytes to those reading along.[/i] ---------------------------------------------------------------- Subject: libgmp.so.3 problem I had opencobol 1.1 installed and working. Now it has stopped working. I think upgrading to suse 11.4 may have caused this. I tried to run a compiled program and it says libgmp.so.3 can not be found. I searched for libgmp.so and /usr/lib has libgmp.so.10 How can I fix this? I ran ./configure and it looks ok. But when I ran make it also can not find the file and dies. ---------------------------------------------------------------- Try the easy [code]$ sudo ldconfig[/code] tip to ensure your OS has the correct link loader cache. After that, if it still fails, unpack your OC 1.1 tarball again to a clean directory. When you re-run ./configure from a previous build, it can have a BUNCH of scary libtool cached files that are nearly impossible to debug. An alternative to that is [code] $ make distclean [/code] which tries it's best to clean up cached files (but not as well as a fresh untar in a brand new build tree). If both those steps fail, look for weirdo symbolic links... for example, on my 64bit Fedora [code] $ ls -la /usr/lib64/libgmp* lrwxrwxrwx. 1 root root 15 Nov 7 2010 /usr/lib64/libgmp.so -> libgmp.so.3.5.0 lrwxrwxrwx. 1 root root 15 Nov 7 2010 /usr/lib64/libgmp.so.3 -> libgmp.so.3.5.0 -rwxr-xr-x. 1 root root 380888 Mar 2 2010 /usr/lib64/libgmp.so.3.5.0 lrwxrwxrwx. 1 root root 13 Nov 7 2010 /usr/lib64/libgmpxx.so -> libgmpxx.so.4 lrwxrwxrwx. 1 root root 17 Nov 7 2010 /usr/lib64/libgmpxx.so.4 -> libgmpxx.so.4.1.0 -rwxr-xr-x. 1 root root 17992 Mar 2 2010 /usr/lib64/libgmpxx.so.4.1.0 [/code] libgmp.so is a link to libgmp.so.3.5.0 libgmp.so.3 is a link to libgmo.so.3.5.0 libgmp.so.3.5.0 is the real thing. This is a trick that unixy systems use to allow shared library upgrades on running systems (among other things). And it can be broken sometimes by conflicting package installs. You may need to re-install gmp version 3 (and it's dev headers) again ... with the whole worry about breaking all the other dependencies on your new Suse. I doubt that is the best course. On configure 'succeeding' and make failing. That can happen, especially if the cached libtool files are left lying around from previous runs. Cheers, Brian ---------------------------------------------------------------- It didn't work. The .3 version does not exist in suse 11.4. In fact, it deleted it because it was there before. Ran ldconfig Ran make distclean Ran ./configure [code] # make Creating defaults.h... make all-recursive make[1]: Entering directory `/tmp/cobol/open-cobol-1.1' Making all in lib make[2]: Entering directory `/tmp/cobol/open-cobol-1.1/lib' if gcc -DHAVE_CONFIG_H -I. -I. -I.. -O2 -march=i686 -mtune=athlon -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT dummymac.o -MD -MP -MF ".deps/dummymac.Tpo" -c -o dummymac.o dummymac.c; \ then mv -f ".deps/dummymac.Tpo" ".deps/dummymac.Po"; else rm -f ".deps/dummymac.Tpo"; exit 1; fi rm -f libsupport.a ar cru libsupport.a dummymac.o ar: error while loading shared libraries: libgmp.so.3: cannot open shared object file: No such file or directory make[2]: *** [libsupport.a] Error 127 make[2]: Leaving directory `/tmp/cobol/open-cobol-1.1/lib' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/tmp/cobol/open-cobol-1.1' make: *** [all] Error 2 [/code] [code] # ls -laR /usr/lib/libgmp* -rw-r--r-- 1 root root 3965846 Feb 18 15:54 /usr/lib/libgmp.a lrwxrwxrwx 1 root root 16 May 2 05:33 /usr/lib/libgmp.so -> libgmp.so.10.0.1 lrwxrwxrwx 1 root root 16 May 2 05:18 /usr/lib/libgmp.so.10 -> libgmp.so.10.0.1 -rwxr-xr-x 1 root root 539536 Feb 18 15:54 /usr/lib/libgmp.so.10.0.1 lrwxrwxrwx 1 root root 17 May 2 05:33 /usr/lib/libgmpxx.so -> libgmpxx.so.4.2.1 lrwxrwxrwx 1 root root 17 May 2 05:30 /usr/lib/libgmpxx.so.4 -> libgmpxx.so.4.2.1 -rwxr-xr-x 1 root root 13948 Feb 18 15:54 /usr/lib/libgmpxx.so.4.2.1 [/code] ---------------------------------------------------------------- Somebody please post libgmp.so.3 into the downloads section so that I may install it and get my system running again. For that matter, the downloads section should have all dependent libraries available for download. ---------------------------------------------------------------- I don't know much about openSUSE. But it seems to be a rolling release model. If that is anything like Arch Linux then you may have to build GNU MP v3 from sources. We dumped Arch Linux at the office as it's rolling release model is 'take the latest, and be happy. We don't maintain security updates, on anything but latest upstream'. As our release manager I found that just keeping up with the LIST of latest was a full time job, let alone the packages themselves. Just the LIST was a daily pile of pain. Our product is not a rolling release product, we need stable repos, not bleeding edge. Not that 'current' is bad, just a pain we can't afford, as our embedded product is expected to age gracefully, with (potentially) years between builds. Fedora uses yum. On my end I'd start with [code] yum provides '*/libgmp.so.3' [/code] and with Fedora 14, I get [code] gmp-4.3.1-7.fc14.i686 : A GNU arbitrary precision library Repo : fedora Matched from: Filename : /usr/lib/sse2/libgmp.so.3 Filename : /usr/lib/libgmp.so.3 gmp-4.3.1-7.fc14.x86_64 : A GNU arbitrary precision library Repo : fedora Matched from: Filename : /usr/lib64/libgmp.so.3 gmp-4.3.1-7.fc14.x86_64 : A GNU arbitrary precision library Repo : installed Matched from: Filename : /usr/lib64/libgmp.so.3 [/code] So, using openSUSE tools and the RPM Find data bases, try scanning the weeb for gmp3 see if you can't come up with a repo with a usable version. I found this one at pbone.net [code] ftp.opensuse.org/distribution/11.3/repo/oss/suse/x86_64/libgmp3-4.3.2-1.13.x86_64.rpm [/code]but can't test if an RPM for 11.3 would bork your shiny new 11.4. As always, you'll need to snag an equivalent copy of the gmp3-devel headers (IF it works). I'll help more if need be, but it'll be back and forth through the forum here, as I can't test anything the google searches are coming up with. Sadly, my libtool fu is not strong enough to tell you what simple change may be required to config.h.in to have your ./configure try and use libgmp3, so I'll have to fallback to seeing if an openSUSE install of gmp3 (versus gmp) might save you from the dependency problem. Cheers, Brian ---------------------------------------------------------------- As OpenCOBOL isn't specific to libgmp.so.3 in general it should work with more recent versions, too. Therefore the question is why ./configure chooses libgmp.3.so if you don't have it. Brian may could help you at this point. I guess you may don't have the gmp-devel headers for your version, please check that. human ---------------------------------------------------------------- I searched the text files in the installed OC 1.1 folder. No files have libgmp.so.3. I searched the binary files, and the only file that has libgmp.so.3 is the compiled binary of the hello.cob sample program. It also has number specific references to all the other libraries as well. I don't know how the compiler gets the numbers. I searched the internet and downloaded libgmp3-4.3.2-1.13.i586.rpm for suse and installed it. Now my programs work again. I did not have to rerun config or make. OC 2.0 should open libgmp.so without the number and allow the system to link to the appropriate library. In this case -> libgmp.so.10. If that's not possible, for whatever reason, then there should be a config text file where the user can put libgmp.so.10. And all the other dependency libraries as well. ---------------------------------------------------------------- mrcool. As stated. make distclean may still leave near invisible tracer rounds in the configure cache. The best thing to do in that case is a clean untar into a brand new tree. But, hey. As long as libgmp3 didn't bork any of your other system feature set... ;) And yes, I do believe there has been some added grief for the hobbyists, as the coolest OpenCOBOL is 1.1pre-rel, but it's not in as many repos as the 1.0 'official' and 1.1pre-rel's extras features added to the dependencies normally dealt with by the experts that build packages for the distros. automake/libtool is a steep, steep learning curve, not meant for mere mortals. I imagine that will change for the better for everyone when we get another official OpenCOBOL release. Cheers, Brian ---------------------------------------------------------------- Subject: SET ADDRESS Question I ran across this in another forum and cannot get it to work with OpenCOBOL 1.1. 01 VAR11 PIC XX VALUE "11". 01 VAR22 PIC XX VALUE "22". SET ADDRESS OF VAR22 TO ADDRESS OF VAR11. DISPLAY VAR22. This would supposedly display the "11". The OpenCOBOL 1.1 compiler gives the error "The address of VAR22 cannot be changed. I am running cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Jun 07 2009 06:00:30 Packaged Feb 06 2009 10:30:55 CET Was the post correct? Is this something that can be done with OpenCOBOL 1.1? ---------------------------------------------------------------- jcurrey, on the mainframe i think that would only work if the fields are in the linkage section as you can't change the address of a working storage field (it would not make sense to be able to do that). also on the mainframe you may need to use a pointer variable as i've not tried the "set address of xxx to address of xxx" form of the set statement. one has to be careful when using this type of "redefining" storage locations as its possible to introduce bugs which are difficult to find Chuck Haatvedt ---------------------------------------------------------------- "one has to be careful when using this type of "redefining" storage locations as its possible to introduce bugs which are difficult to find" spoilsport :-) I suppose you were opposed to "ALTER" too. Yes I understand the potential for abuse here, but I would like to know if it can be done. jimc ---------------------------------------------------------------- Yes, the (IBM) mainframe only supports changing the address of a Linkage item. (you may now get the address of a wrking-storage item which you originally could not). Yes, the (IBM) mainframe supports Set Address of xyz to address of ABC (if xyz is in linkage section) I the '02 ANSI/ISO COBOL STandard, a new phrase was added "based". This can be used in any section. In ththat standard you CAN change the address of a BASED item - no matter what section it is in. I do NOT know if OC supports this phrase yet or not. (The '02 STandard also introduced the ALLOCATE and FREE statements to go with BASED items). In the '02 Standard (unlike the IBM manframe) you may NOT change the address of a Linkage section item UNLESSS it explicity has the BASED phrase. ---------------------------------------------------------------- Jim, Just adding to the party... BASED items are unallocated, regardless of VALUE clause and NEED to be assigned valid memory before use. Same for LINKAGE section items. [i](As an aside, ALTER is coming to OpenCOBOL. Works great.)[/i] This works [code] OCOBOL >>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20110701 *> Purpose: change storage address *> Tectonics: cobc -g -debug -W -x setaddr.cob *> *************************************************************** identification division. program-id. setaddr. data division. working-storage section. 01 var11 pic xx value "11". 01 var22 pic xx value "22" based. linkage section. 01 var33 pic xx value "33". *> *************************************************************** *> will come with a warning about linkage section var not used procedure division. set address of var22 to address of var11 set address of var33 to address of var11 display var11 space var22 space var33 end-display call "subprogram" using by content "44" on exception display "call linkage error, 'subprogram'" end-display stop run end-call goback. end program setaddr. *> *************************************************************** *> *************************************************************** identification division. program-id. subprogram. data division. working-storage section. 01 sub11 pic xx value "11". 01 sub22 pic xx based. linkage section. 01 sub33 pic xx. *> *************************************************************** procedure division using sub33. set address of sub22 to address of sub11 set address of sub33 to address of sub11 display sub11 space sub22 space sub33 end-display goback. end program subprogram. [/code] with [code] $ cobc -x -g -debug -W setaddr.cob setaddr.cob:22: Warning: LINKAGE item 'var33' is not a PROCEDURE USING parameter $ ./setaddr 11 11 11 11 11 11 [/code]All the fields reference var11's address space (sub11 in the subprogram) when displayed. [i]the warning is due to having an unused LINKAGE item in this example.[/i] Just to be on the safer side, (valgrind is the defacto memory mis-management tool for OpenCOBOL development on the posix-y systems). [i]Pronounced val-grinned[/i] by the developers. It's a Nordic name, not a "value grinder". [b]Vikings rule![/b] [code] $ valgrind ./setaddr ==13136== Memcheck, a memory error detector ==13136== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. ==13136== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info ==13136== Command: ./setaddr ==13136== 11 11 11 11 11 11 ==13136== ==13136== HEAP SUMMARY: ==13136== in use at exit: 36,896 bytes in 161 blocks ==13136== total heap usage: 230 allocs, 69 frees, 50,345 bytes allocated ==13136== ==13136== LEAK SUMMARY: ==13136== definitely lost: 0 bytes in 0 blocks ==13136== indirectly lost: 0 bytes in 0 blocks ==13136== possibly lost: 0 bytes in 0 blocks ==13136== still reachable: 36,896 bytes in 161 blocks ==13136== suppressed: 0 bytes in 0 blocks ==13136== Rerun with --leak-check=full to see details of leaked memory ==13136== ==13136== For counts of detected and suppressed errors, rerun with: -v ==13136== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 6 from 6) [/code]No errors. A good sign. This won't compile [code] 01 var22 pic xx value "22". $ cobc -x -g -debug setaddr.cob setaddr.cob:22: Error: The address of 'var22' cannot be changed [/code]as it isn't a BASED item, and COBOL allocated WORKING-STORAGE is sacrosanct. You can get a runtime error with [code] 01 var22 pic xx value "22" based. procedure division. display var11 space var22 end-display set address of var22 to address of var11 [/code] either friendly (with -debug) or catastrophic (without) [code] $ cobc -x -g -debug setaddr.cob $ ./setaddr setaddr.cob:22: libcob: BASED/LINKAGE item 'var22' has NULL address $ cobc -x setaddr.cob $ ./setaddr Attempt to reference unallocated memory (Signal SIGSEGV) Abnormal termination - File contents may be incorrect [/code] (The above uses the BASED item before allocation, and the ([b]WRONG: see below[/b].) VALUE "22" is a (less than useless) red herring for someone quickly reading over sources. In short, that sample you saw used a compiler that I would NOT trust as a bank auditor. It breaches the golden rule of COBOL compiler enforced managed memory. Cheers, Brian EDIT: I was just going to correct the post so I didn't come across the fool. But instead I'll put on the dunce cap, sit in the corner and admit; [b]VALUE IS ... BASED isn't useless[/b]. [code] ALLOCATE var22 INITIALIZED [/code]gives "22" ... just like it is supposed to. I will stick by the statement that without BASED or LINKAGE, SET ADDRESS OF .. TO ADDRESS OF .. is double ungood, and OpenCOBOL does the right thing. ---------------------------------------------------------------- Gentlemen, During the first 44 years of my career in data processing I always lived in a proprietary environment with support coming directly from the manufacturer. I dealt with many of them as an OS developer, application programmer, factory representative, and customer. It was with very low expectations that I first started to work with OpenCOBOL about two years ago. What I have experienced here has convinced me that OpenCOBOL is more than a viable alternative to commercial products -- it is superior. The kind of research and analysis that this particular thread shows and the speed with which help was provided is positive proof. Thank you for your help -- I just could not wrap my head around this one. BTW although I agree with the group that shuns the ALTER verb I do remember that in assembly language back on the 1401 we had to use the same kind of technique to return from a subroutine. (SBR EXIT&3) jimc ---------------------------------------------------------------- :-) [b]Vikings rule![/b] Well really, that should be [b]Roger and Keisuke da men![/b] (and now I have to look up if Vikings ever landed in Japan after duking it out with and influencing the Germanics). Thanks Jim (on behalf of OpenCOBOL that is). [b]thread drift, fitting of ALTER[/b] I was a little leery of ALTER and even made a fairly facetious entry in the FAQ about it. UNTIL, I saw the light on it's proper use and how it can really help in control flow for things like Header, Body, Footer processing. So when header processing is complete, just ALTER to body. [code] OCOBOL >>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20110701 *> Purpose: ALTER, why not? *> Tectonics: cobc -x -debug altering.cob *> *************************************************************** identification division. program-id. altering. data division. working-storage section. *> *************************************************************** procedure division. perform 4 times PERFORM 2100-PROCESS-RECORD THRU 2199-EXIT end-perform. goback. *> *************************************************************** 2100-PROCESS-RECORD. GO TO. *> first time, 2110-PROCESS-HEADER. *> code to process a file header 2110-PROCESS-HEADER. DISPLAY "In PROCESS-HEADER, altering to bypass". ALTER 2100-PROCESS-RECORD TO 2120-PROCESS-DETAIL. GO TO 2199-EXIT. *> code to process a detail record 2120-PROCESS-DETAIL. DISPLAY "In PROCESS-DETAIL". 2130-INFORM. DISPLAY "bottom of 2100 process". 2199-EXIT. EXIT. end program altering. [/code] giving... [code] $ ./altering In PROCESS-HEADER, altering to bypass In PROCESS-DETAIL bottom of 2100 process In PROCESS-DETAIL bottom of 2100 process In PROCESS-DETAIL bottom of 2100 process [/code] [i]I still look forward to seeing the OpenCOBOL Flying Spaghetti Monsters though.[/i] For giggles. ;-) Cheers, Brian ---------------------------------------------------------------- So as my understanding there are two variations. 1. set address of an ‘01’ level in linkage which is not associated a “PROCEDURE USING” - (IBM) mainframe version. 2. set address of item as defined with a BASED attribute. - '02 ANSI/ISO COBOL STandard [quote] wmklein wrote: Yes, the (IBM) mainframe only supports changing the address of a Linkage item. (you may now get the address of a working-storage item which you originally could not). Yes, the (IBM) mainframe supports Set Address of xyz to address of ABC (if xyz is in linkage section) In the '02 ANSI/ISO COBOL STandard, a new phrase was added "based". This can be used in any section. In that standard you CAN change the address of a BASED item - no matter what section it is in. I do NOT know if OC supports this phrase yet or not. (The '02 STandard also introduced the ALLOCATE and FREE statements to go with BASED items). In the '02 Standard (unlike the IBM manframe) you may NOT change the address of a Linkage section item UNLESSS it explicity has the BASED phrase.[/quote] Well, not to deviate from the original “SET ADDRESS” question. Seems to me that 'BASED', 'allocate', & 'free' somewhat resembles similar concepts taken from the PL/I language. However, I would image there may be significant amount IBM source code of which utilizes the “set address” statement may not compile under a strict '02 ANSI/ISO compliant compiler (without some modifications). ---------------------------------------------------------------- Sorry, here is another [b]thread drift, fitting of ALTER[/b] [quote] btiffin wrote: I was a little leery of ALTER ... Cheers, Brian[/quote] Interesting, I was taught to avoid “Go To” like the plaque. Let alone to consider “ALTER”. Still, was there a clear advantage of using your “Alter” over the following alternative? [code] data division. working-storage section. 77 ws-process-sw pic x value 'Y'. 88 first-time value 'Y'. *> *************************************************************** procedure division. perform 2100-PROCESS-RECORD 4 times goback. *> *************************************************************** 2100-PROCESS-RECORD. evaluate true when first-time perform 2110-PROCESS-HEADER when other perform 2120-PROCESS-DETAIL perform 2130-INFORM end-evalute . *> code to process a file header 2110-PROCESS-HEADER. DISPLAY "In PROCESS-HEADER, altering to bypass". move 'N' to ws-process-sw . *> code to process a detail record 2120-PROCESS-DETAIL. DISPLAY "In PROCESS-DETAIL". 2130-INFORM. DISPLAY "bottom of 2100 process". [/code] ---------------------------------------------------------------- And to speak for the advocates of GO TO, we use GO TO and PERFORM THRU in our code while avoiding PERFORM. In our view PERFORM makes adding paragraph names in the middle of existing code impractical, thus leading to longer and more complex sentences. Thankfully the language allows each of us to pick our own style. Jimc ---------------------------------------------------------------- [quote]Still, was there a clear advantage of using your “Alter” over the following alternative?[/quote] In my simple case, I doubt it. ;-) But I won't be as fast to diss coders that have used ALTER (with proper respect, and in a fashion that does not unleash Flying Spaghetti Monsters). I've never been afraid of GO TO. I started out with assembly programming, graduated to Forth. JMP is one powerful chip instruction. And if you ever played with SNOBOL, I was amazed at how clean some code that had :S(label1) F(label2) lines could be. That's a GOTO on success and a different GOTO on fail. It was a little different seeing :($('VAR' N)) which is a computed branch to a lable depending on N, and the expression could be as complicated as SNOBOL could handle. Umm, FSM. Luckily most SNOBOL programs had source line counts in 10 and 100s, not 10s of 100s (or the experience of some COBOL sources in the 10s of 100s of 1000s). Now ... I have had to fight FSMs in old line-numbered BASIC code ... those were just a bad read when you got to the 14th GOTO in a hairy control flow problem (in a one page program). In those cases, it was 'find the whacking stick' time. :-x In short, I think it depends more on the cleanliness of the context than the badness of GOTO and ALTER. [i]Many may place this thread drift on the badness side.[/i] :-) Cheers, Brian ---------------------------------------------------------------- We replaced a heavily used subscripted table with SET ADDRESS processing and got a major performance improvement. A 5 hour run was reduced to 22 minutes. These pronounced improvements were found on both the PC and the IBM mainframe. In addition, we did not have to have large tables that took up much memory for jobs that might use much less. Allocates get just what is needed. Needless to say we refactored to use this technique in many of our programs. Recycle your allocates into a free list to be used later. Write a linked list for this. Allocates and frees are a bit expensive. Be sure to free all of the allocated memory at the end of the run. If a customer calls your program, un-freed memory is kept and becomes a memory leak. I'm available for consulting if anyone would like to refactor their code. Let me know. ---------------------------------------------------------------- I'm not sure what you meant. Can you please post some samples ([maybe longer] code snippets before/after your change) that we get a concrete idea? Do you tell us about OpenCOBOL or do you used another compiler? To the "memory leak" (which isn't one because the memory is reused when you call the program again): Many COBOL runtimes have settings to not only do logical CANCEL but releasing the memory, too. While this costs some performance (especially if you used CANCELed programs again and again) it will get you more available memory. (OpenCOBOL 2.0 has this option, too). Everything you want to use throughout your program can be put into LOCAL-STORAGE section. This way, the memory is only used as long as you do not exit your program. And just because I'm curious: if you use OpenCOBOL (1.1 feb09 I guess?) can you please compile your programs with -debug and measure the time needed afterwards? human ---------------------------------------------------------------- I've done a lot of conversions of subscript usage to index usage and seen very significant performance improvements on the IBM Z/OS platform. subscripts can be very inefficient especially depending on the usage type of the subscript. Binary is the best, packed is much worse and display is the worst of all. there is a manual avalable from ibm here... [url=https://www-304.ibm.com/support/docview.wss?rs=203&uid=swg27001475&cs=utf-8?=en&q=7001475&loc=en_US]IBM Enterprise COBOL Version 3 Release 1 Performance Tuning[/url] unfortunately in opencobol, the way it implements indexes does not provide any performance improvements over subscripts from what i could tell. in opencobol it appears that indexes are stored as occurrence numbers not offsets into arrays as they are in the mainframe environment. ---------------------------------------------------------------- The performance I describe is with Micro Focus on the pc. Later it was with AcuCobol. On the mainframe it was the usual IBM Cobol. I haven't used this under OpenCobol yet. (I'm still waiting for a few ACCEPT and DISPLAY fixes before I can go whole hog with OC.) With the memory leak issue, we initialize of all of working storage at startup as a house rule. This caused the head pointer of the free list to get discarded. All of the allocated memory got lost at that point. But it remained reserved to the program. ---------------------------------------------------------------- Subject: FAQ updated. A thru Z done. Plus all Intrinsic functions. [i]Well, 'done' might be a misnomer. I don't plan on ever finishing. OpenCOBOL deserves a few tens of thousands of pages of docs.[/i] Now I have a question. I have no clue how many people read the OC FAQ. I'm prepping it for some 2.0 changes and I'm not sure if changing the section numbering will effect people. I could add a new chapter, 2.0 changes, and will, but I'd rather update the reserved words list in-line. That'll change the numbering of section 4 substantially. That ok? Cheers, Brian ---------------------------------------------------------------- As the FAQ is a work in progress I think it shouldn't matter when section numbers change. As there is currently no 2.0 and there could be reasons to stay on older versions for a while I think it would be nice to have some "OC <= 2.0" mark on these items (would be nice for 1.1, too). human ---------------------------------------------------------------- Good idea, thanks human. Cheers, Brian ---------------------------------------------------------------- Brian, I don't think that I say thank you often enough. You are providing a valuable component of a rich environment. Jimc ---------------------------------------------------------------- All the same back Jim. :-) A through O filled in now. Cheers, Brian ---------------------------------------------------------------- Good work, interesting P and R are next. I just thought of the status "Release Candidate". As P to Z are still open I think "Document format: Release Candidate, Content: work in progress" would be more correct. human ---------------------------------------------------------------- Updated through Q. Changed the Status. ;) Cheers, Brian ---------------------------------------------------------------- Had to bump my own. The OC FAQ now has entries for all 514 words listed in the 1.1pre-rel reserved word list. [i]And no doubt an order of magnitude more mistakes[/i]. Woohoo. Now for a proof reading pass, a few more code samples, including the last couple of straggler INTRINSIC FUNCTIONs, and then I can turn my attention to one of the real reasons I started this whole thing 3 years ago; getting some of the older 'closed' COBOL programmers to pass round some of their hard earned development wisdom before it is forever lost or locked away in some corporate archive. So... got any? :-) [i]Not secrets, or details per say, but the hits, misses and lessons learned with successful large scale programming[/i]. I'll start a more formal thread (or nine) on this topic in the days to come, but for now, tidbits will do. Cheers, Brian ---------------------------------------------------------------- Yep, One thing that I saw on earlier posts to the newsgroup cobol was - What is the need/justification for an empty inline perform group. ie. PERFORM ... END-PERFORM None of the discussions then realized that there is a - EXIT PERFORM [CYCLE] Therefore, it is a method to to define an exit condition without having paragraphs. ie. (very simply) [code] PERFORM READ xxx AT END EXIT PERFORM END-READ MOVE something TO somewhere END-PERFORM [/code] .. test xxx status and somewhere There are, of course, other variations. Basically, it means that you code without using section/paragraphs. (Recommended, if only from performance point of view) Note that the CYCLE option offers interesting possibilities. Roger ---------------------------------------------------------------- Subject: Community involvement So, as a fan, keen on documenting and advocacy, I'd like to suggest to Roger that we add an 'extras/' subdir to OpenCOBOL source tarballs. Things like, syntax highlighters for editors (vim, kate), nifty utility programs such as Gary's OCic.cbl, CBL_OC_DUMP, and whatever else we can bring up to a quality that matches the rest of the distribution. Should I? If I do, what should be in such a directory? Cheers, Brian [i]remember that the bar has been set really high, the field is very diverse and developers ALL have a personal style[/i] so no 'junk/', even though I do have one of those dirs as part of [i]my[/i] personal style ;-) ---------------------------------------------------------------- Yes you should! At least the FAQ had helped me a lot and still does! ---------------------------------------------------------------- Bumping. We have a go for extras/ going into future OpenCOBOL release tarballs. Here are the caveats: Entries MUST be L/GPL. That's Lesser General Public License and/or General Public Licence. Authors MUST be willing to eventually hand copyright over to the FSF. That's the Free Software Foundation, or better, to assign copyright to Roger While (who it seems definitely has plans to mark OpenCOBOL as Copyright FSF). Vincent Coen's cobcxref will be the first extra. That source code will most likely be part of ./configure ; make as cobc will soon have a -Xref option for producing cross reference listings. By the way, you can already snag a version of Vince's code at http://sourceforge.net/projects/cobxref/ I'll chat with human, and get CBL_OC_DUMP.cob prepped as a sample of what may be expected from contributors in terms of coding standards, quality, and automated make check tests. That will likely be the second entry and also the practice run. We, as a community, get to play. I'll assume a role, as will likely human, for now, in getting the contributions ready for inspection. And Roger will be the final arbiter of inclusion. (That may not seem overly fair in an open project, but I truly believe it's a good move. Roger is the reason OpenCOBOL is at the quality standard we enjoy.) As things evolve, that will likely change, especially if/when the FSF accepts copyright responsibility and we attract other world class free compiler writers. I think that initial setup should work out pretty well, as human and I don't always see eye to eye on many issues, so the community will likely benefit from well rounded debates here in the forum and Windows and POSIX should both get proper care, attention and coverage. There are many entries I'd like to see us discuss for inclusion. jrodrigues' external file handler for MySQL being one I'll mention here in this post. Ok, two. Gerald's PostgreSQL callables as well. But there are too many to list here and it'll be up the the forum to bubble the best to the top, duff over and prep for inclusion as an 'official extra'. And, this being an open and free system, authors are always allowed to refuse the two MUSTS, no hard feelings. Freedom is just that, free choice, but they will remain MUSTS regarding license and copyright. A restrictive rule designed to protect other's freedoms. [i]We can debate the GPL philosophy in another thread if need be.[/i] Cheers, Brian ---------------------------------------------------------------- Count us in. We will need help getting the proper language in the releases, but are willing to try. jimc ---------------------------------------------------------------- This is no problem. Coordinate stuff through Brian. A "extras" directory with it's own "Makefile" to gen stuff is trivial. HOWEVER, I do set a high standard what is deposited there :-) The infrastructure to support/install modules (either COBOL or C) is already there. ie. Module search path is already primed for this situation (but not currently used). This involves the environment variable COB_LIBRARY_PATH. Now to acceptance. COBOL source modules should compile warning/error free with options - 1) -W 2) with any of the standard "-std=" options. 3) with either option -fixed(default) or -free 4) Any/all combination of above Further these COBOL modules should execute correctly however they have been compiled (-std=). Roger ---------------------------------------------------------------- Hello all, Does anyone know if there's been much movement on this front of late? Rob. ---------------------------------------------------------------- Rob, SourceForge is the new development hub. /extras is up for submissions. Simon tweaked the build system to include it. ;-) https://sourceforge.net/projects/open-cobol/ All; SourceForge is pushing all projects to upgrade. Similar look, slightly different feature set, but the biggie is new URLs for the code checkouts. That'll have impact on anyone that has cloned out a source tree. So I'd like to take a vote. And, umm, no one posts to the forums. Sad face. Not sure how to pull off the migration, retire the XOOPS on go on the forge. Need some input from all the potential players and anyone new that wants to participate. Cheers, Brian ---------------------------------------------------------------- Subject: OpenCOBOL 2.0 What are the differences between OC-1.1 and OC-2.0 ? ---------------------------------------------------------------- antonmidi; I'm very leery about creating a wait-expectation loop in the opencobol.org community, so please please take this as simple information and not a 'coming soon'. It may not come soon. Basically; it's the same. By that I mean any COBOL you develop in 1.1 will work with 2.0. So don't stop developing in OpenCOBOL just to 'wait'. Having said all that; here are few of the deltas: Internally it's a little cleaner. There will be LC_MESSAGE=lang_code multi-lingual compiler message support. There are a few new intrinsic functions, a few new verbs, ala ALTER and TRANFORM, more docs that ship in the tarball, some new datatypes (FLOAT-DECIMAL-34 for instance), umm, C void return support with RETURNING NULL and a few other CALL interface enhancements, a debug module, integration with a cross reference lister, >>IF, more... The license has been bumped to GPL 3. User defined functions are not yet turned on. Report Writer still needs runtime support (and I really do hope to be directly involved in that part). Again... don't fret the wait. It's not good for a volunteer/hobbyist community to crave for the work of other volunteers [i]that have their reasons to be a little secretive[/i]. Life happens. OC 1.1 does COBOL and it does it very well. Cheers, Brian ---------------------------------------------------------------- Since OC-2.0 in developing advice to improve screenio.cpy, prints easier with Windows printers with USB ports and if possible include a generator of screens. Thanks Antonino Midiri. ---------------------------------------------------------------- Subject: Open Cobol 2.0 Binaries? May be lot of you ("Open Cobolers") are "hard *ux" people who are brave enough to build OC from sources but, just guessing. there are many hobbyest as I that are not so versed on gcc/bin utils and so, so, someone has "stable" binaries of OC 2 for Windows? Or packaged for Ubuntu? Regards. ---------------------------------------------------------------- 2.0 is not released yet. I've been studying Fedora package building, so when the time comes, I'll be trying my hardest to create a quality binary RPM when it rolls. And no doubt the capable people at Debian will do the same for .deb. Cheers, Brian ---------------------------------------------------------------- I just spent the weekend following Gary Cuttlers documentation for MinGW to prep for creating a MinGW package for OC 2. I have been unsuccessful since BDB 5.0.28 fails consistently with the latest MinGW. I even tried the version Gary stated in his docs. Still no joy. I am wondering if there is an issue with Win7. I may try WinXP the next go around. The OC 1.1 MinGW from Gary works just fine under Win7 though my father is complaining heavily about a destructive cursor when doing ACCEPT. I am trying to get the source from him and reproduce the issue before I get into detail. ANyway, if anyone has any insight into getting BDB installed in the latest MinGW on Win7 I would be thankful. And gladly provide a MinGW distro once OC 2.0 hits GA Cheers! ---------------------------------------------------------------- A huge THANK YOU to all those and all those who think users MSWindows (XP/W7 32/64) during the release of version 2. Hopefully we will also have a correct management of the enhanced keyboard (numeric keypad). Thanks again in advance ---------------------------------------------------------------- You can be sure that there are "persons" taking care for Win users, even in the development :-) When 2.0 is ready (whenever this will be) I will provide binaries for MS C (and WATCOM if I can get it working again), but as I only have access to the free version of the MS C compiler, I'm only able to provide Win32-binaries. I'm quite sure Sergey will provide binaries for [url=http://www.kiska.net/opencobol/1.1/]every system he currently does[/url], including 64 bit for Win, within a short period of time after 2.0 release. And to make you happy: all necessary patches for numeric keyboard from "a person" were included by Roger months ago - they work fine. @aouizerate: There ist still the [url=http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1127&forum=1]translators needed topic[/url]. As there isn't a french version yet, you may contact Bear and decide if/how it's possible to come up with a french translation (plese let all public discussions to this topic take place there) @DamonH: if you don't need ISAM at all there is a configure switch --without-db (no ISAM implementation at all--> no BDB) and the switch --with-vbisam (Should build on MinGW without problems). human ---------------------------------------------------------------- Subject: Returning for another look Hello friends I last looked at OpenCOBOL about 2 years ago, it was close to compiling our code base, but had critical errors with nested sub programs and other GLOBAL/EXTERNAL storage issues. I've popped back for another look, but the 1.1 download is still back at 2009. I've looked in the FAQ for another location but can't find one. Is there a download link or a source repository I can get a later version from, to see if these issues have been resolved? My problem was on the 'to do' list, apparently :) Thanks ---------------------------------------------------------------- The dev-versions are currently not public available. I found [url=http://www.opencobol.org/modules/newbb/viewtopic.php?viewmode=flat&topic_id=495&forum=1]your VERY GOOD problem description and sample[/url] and rechecked it. With latest public release the problem still exists, but it was solved some time ago. With the dev-versions this problem is solved, but I have no idea when Roger will release it to public. human ---------------------------------------------------------------- Thanks That's at the same time, quite exciting whilst also disappointing that the fix is not available yet :( It takes me a while to get back into OC each time as the software product I'm compiling comprises over 110,000,000 lines of code (yes, over 110 million COBOL lines) and it takes a while to arrange a test! If there's no release schedule or patch availability, I'll check back some time later. ---------------------------------------------------------------- Subject: The obsolete ENTER verb, maybe EXEC Would I be out of place if I politely asked Roger to add [code] ENTER guile routine-name. ... [/code]to OpenCOBOL? (with appropriate offers of assistance of course, as I've got the itch) ENTER is an obsolete verb defined to allow other program sources in COBOL programs. I don't have enough information about the semantics yet, but I think it would go [code] ./configure --with-guile make make check sudo make install [/code] and allow things like [code] ENTER guile adding. (+ 1 2) ENTER OpenCOBOL. *> I have no idea what the old 1960's spec says about ending an ENTER source block. ... CALL "adding" RETURNING three END-CALL ENTER guile somejs. (load-compiled (compile-file "some.js" #:from 'ecmascript)) ENTER OpenCOBOL. CALL "somejs" END-CALL [/code] and the compiler would do a lot of the plumbing for calling scripts through Guile. Or ... just publish a How-To similar to http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1167&forum=1 and people that care can just call 'scm_init_guile' and it's associated API? Just curious and looking for opinions. [i]I'd like to see ENTER, it could make C snippets a lot easier to integrate into samples (if ENTER C was supported), but it might be seen by many as 'taint', and I'd be ok with that point of view.[/i] Cheers, Brian ---------------------------------------------------------------- I was kind of excited about this feature when I read about it the first time, too. But I don't think it would be a good idea to implement the ENTER statement. The reasons are: 1. It was declardeleted in the 2002 standard. 2. I don't know of any "big" COBOL compiler (still) supporting that. 3. It's very likely that programs using that statement would not compile or work with other compilers. 4. I personally think it's better to keep the program languages seperated. 5. It's quite possible to srcew the memory if you want to share the COBOL items. 6. Every language I can think of can be called from COBOL the standard ways: you only pass the items you'd like to share and the called program does not influence the COBOL part. I'd like to see wrappers for other languages (if needed at all) or code samples using CALL / CALL 'SYSTEM'. Simon ---------------------------------------------------------------- The syntax for the (now deleted) ENTER statement were [code] ENTER language. whatever ENTER COBOL. [/code] My suggestion for "adding foreign syntax" would be to use [code] EXEC whatever foreign code END-EXEC [/code] This is what is done for SQL, i.e EXEC SQL and for IBM maifnrames (anc compatible products) EXEC CICS and EXEC DLI and is similar to XML GENERATE. ---------------------------------------------------------------- In my natal language there is an expression "no hay que gastar polvora en sanates" which means dont waste resources in meaningless objectives. If "EXEC whatever" could be technically achieved to invoke external tool (somewhere in the configuration you must map "whatever" to some command line), sharing Cobol elements with this "whatever" will be a nightmare and for each "whatever" custom code must be writen. Regards. ---------------------------------------------------------------- Maybe we should ask for the ALTER verb :-) Most of what the ENTER verb does can be accomplished with CALL SYSTEM () and ACCEPT FROM ENVIRONMENT. ---------------------------------------------------------------- Re ALTER. It's coming. Added for legacy support. Its addition helps bring the OpenCOBOL coverage of the NIST COBOL85 test suite up from 9082 to 9710 tests tried and passed. Re Guile. And yeah, CALL, does everything we need. ./configure --with-guile could be added as simply as including -lguile (or -lguile-2.0) to the default cobc compile steps. [code] $ cobc -x ocbf.cob ... Executing: gcc -Wl,--export-dynamic -o "ocbf" "/tmp/cob9810_0.o" -L/usr/local/lib -lcob -lm -lgmp -lncursesw -ldb -ldl [/code] to [code] $ cobc -x ocbf.cob ... Executing: gcc -Wl,--export-dynamic -o "ocbf" "/tmp/cob9820_0.o" -L/usr/local/lib -lcob -lm -lgmp -lncursesw -ldb -ldl -l"guile-2.0" [/code] but as an exploratory sample writer I feel the itch to replace [code] call "scm_init_guile" end-call call "scm_c_eval_string" using "(load-compiled (compile-file " & quote & - "ocone.js" & quote & "#:from 'ecmascript))" & x"00" end-call call "scm_c_eval_string" using function concatenate( '(use-modules (ice-9 eval-string))' '(define hello "' hello '")' "(define res (eval-string hello #:lang 'scheme))" "(display res)(newline)" low-value) returning scm-result on exception display function exception-location end-display end-call [/code] with something akin to [code] EXEC guile (load-compiled (compile-file "ocone.js" #:from 'ecmascript)) END-EXEC [/code] or [code] EXEC guile ; Set a scheme variable (define result (+ 40 2)) END-EXEC EXEC guile ; displayed in a different snippet (display result)(newline) END-EXEC 77 cobol-var PIC 99. ... EXEC guile ; Set a working-store record, or field ;; with all the voodoo and type mapping hidden by the engine (define :cobol-var (+ 40 2)) END-EXEC DISPLAY cobol-var END-DISPLAY [/code] Bury most of the dirty work in the compiler (or a preprocessor as I assume mamy EXEC sequences are handled in the real world). But, if it seems counter to "no hay que gastar polvora en sanates", then maybe a simple how-to and letting the developers that care just do the embedding the manual way as I've done so far would be a better use of time? There are so many areas OpenCOBOL can cover, it does get hard to pick which path to explore. I'm ok with the current manual code, but I get a feeling it might be an area of tectonic voodoo that keeps many developers from adding a scripting engine to their applications. When I did the ROOT/CINT experiments, it wasn't because I needed it, it was because I looked forward to a day when a financial analyst posted some news about money wizardry discovered when he plugged a ton of bank data into the ROOT framework and got a visualization of the information that no one had ever thought of before, and made his company a few extra millions. The butterfly effect. It's one of my goals as an OpenCOBOL advocate. To push on the boundaries and see where this awesome programming environment can take developers, [i]which in my humble opinion is unlimited in scope[/i]. Umm, and to have fun. [b]Way too much fun[/b]. :-) For instance: ++++++++++[>+++++++>++++++++>++++++++++>+++++++++++>+++>+<<<<<<-]>++.>>+.>--..+++.>++.<<<-.>>+.<.>--.<<<-----.>.<-.>.---.>>>+.>. evaluating to Hello OpenCOBOL! That was fun. Completely and utterly useless fun. Though I do think the language the script is written in has an inappropriate name and I wish there was an alias to use in Guile's #:lang symbol space so I could have avoided the swear in such an august forum. But it is what it is. [i](I grew up working as a commercial fisherman and have a sailor's vocabulary, and still feel a little embarrassed about the Guile revisited posts.)[/i] :-? Cheers, Brian ---------------------------------------------------------------- Veto to configure --with-guile and some hints: 1. you can hack defaults.h to include some libraries each time 2. You can do "cobc -x -lguile-2.0 ocbf.cob" (which I'd always prefer as you only link the COBOL modules you need to guile and don't link it to all). human ---------------------------------------------------------------- Veto? :-( :-) I don't know if you realize how much synergy surrounds this. Guile is GNU's preferred scripting extension (actually advertised as 'the official extension language for the GNU Operating System' OpenCOBOL aims to be a GNU project Keisuke Nishada started OpenCOBOL Keisuke Nishada worked on the VM and module system for Guile. Roger While was the one that gave me the idea for --with-guile The Guile entry here got wingo (a Guile principle) to post the link in hacker news The hacker news entry got me interested in APL (J) (which, as of today, is callable from OpenCOBOL) Eric Iverson is one of my heroes And human...this is just way too much fun. :-D Cheers, Brian ---------------------------------------------------------------- My veto was because I just want to avoid everybody comes up wanting --with-xyz1 --with-xyz2 --with-xyz3, ... If all that you wrote is true (what I believe) my veto (at least to --with-guile) is taken back :-) I really hope that this does not lead to guile be linked to every module (what would be the result of putting it into defaults.h) but to a nice interface and parser check for the link or, even better: an internal guile wrapper in libcob (meaning only libcob is linked to guile and you can call cob_guile_123). human ---------------------------------------------------------------- No worries. -lguile would only inform the link loader that Guile 'might' be linked. Shared libraries are awesome. It would only ever be a dependency for those that wanted to build COBOL with scripting, very similar in spirit to those doing builds with --with-vbisam. I'd rail against it becoming a 'default' in ./configure. Well, I wouldn't rail very strongly...but I'd still vote --without-guile remain an entrenched default. Cheers, Brian ---------------------------------------------------------------- I think you didn't understand me. -lguile (at least on win systems) informs the linker that a) he should look for guile.lib AND by doing that b) link to guile.dll using guile.lib Therefore, every time you use the linked stuff with -lguile you'll need the guile.lib at compile time and guile.dll at run time. ./configure writes defaults.h. You'll find the standard libraries that are always linked from cobc there. In my opinion guile should not be found there. To achieve this there are two possibilities: a) hack the parser in a way the he knows when guile is needed and do -lguile only in this case OR b) add -lguile only to the linking of libcob and add new system calls like cob_guile_... that can be called from COBOL. human ---------------------------------------------------------------- Thanks for the tips and warnings human. Just got a note from Roger... ENTER isn't really in the cards, too high a risk of conflicting with user named variables. EXEC GUILE will be the way this goes in, IF it goes in. And that's likely a preprocessor pass. I might be able to pull off such a beasty. I'm about 2% into the scm / cob_field data mapping matrix (on paper) so this won't be seeing the light of day in the near term. Maybe the preprocessor should be written in bf? Expected release date 2038, just in time for the epoch rollover. And yeah, while I'm ramping up, the intermediates will mainly be 'straight up' CALL sentences, and I'll try and keep it so that those can be published for those that might want to link to guile without a --with-guile configure pass. And even still, only those folk that have libguile and want the extensions would ever be in a position to ./configure --with-guile. They'd be 'out-of-band' builds for special nerds, err, needs. ;) Open source is so cool. Cheers, Brian ---------------------------------------------------------------- Oh yeah, forgot to thank Bill. Your post cleared up my understanding. The syntax for the (now deleted) ENTER statement were: and My suggestion for "adding foreign syntax" would be to use: Thanks Bill. As stated a minute ago, IF there are foreign language 'extensions' to OpenCOBOL (that aren't straight up CALL, as per existent samples) it'll be [code]EXEC whatever foreign code END-EXEC[/code] Cheers, Brian ---------------------------------------------------------------- Subject: OpenCOBOL made hacker news (and baby steps to APL/J linkage) http://hackerne.ws/item?id=2733280 The Guile entry made wingo (one of the Guile principles) take note. That led me to try and embed a derivative of APL (J), Jsoftware (by the same Eric Iverson, released as GPL in March). I think I need to add a few callbacks before I can get it to display results. :-) Too much fun. Here is the first baby step into J linkage... [code] OCOBOL >>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20110711 *> Purpose: Attempt calling a J sentence. APL in COBOL. *> Tectonics: cobc -x callj.cob -lj *> *************************************************************** identification division. program-id. callj. data division. working-storage section. 77 jptr usage pointer. 77 result usage binary-long. *> *************************************************************** procedure division. call "JInit" returning jptr end-call display jptr end-display call "JDo" using by value jptr by content "a =. 1 + 1" & x"00" returning result end-call display result end-display call "JDo" using by value jptr by content "2 + 2" & x"00" returning result end-call display result end-display call "JDo" using by value jptr by content "('Test Data',CR,LF) 1!:2 <'temp.dat'" & x"00" returning result end-call display result end-display call "JDo" using by value jptr by content "load 'jgplsrc/test/test.ijs'" & x"00" returning result end-call display result end-display call "JDo" using by value jptr by content "bad=: TEST ddall" & x"00" returning result end-call display result end-display call "JDo" using by value jptr by content "BAD ddall" & x"00" returning result end-call display result end-display goback. end program callj. [/code] giving [code] $ cobc -x callj.cob -lj $ ./callj 0x00007fa0863f6010 +0000000000 +0000000000 +0000000003 +0000000021 +0000000000 +0000000000 [/code] It'll need some callbacks before the J I/O routines and path settings will work. Error 3 and 21. But hey, it didn't explode. ;-) [i]Ok, it exploded the first time[/i]...I hadn't read enough of the J sources, and tried [code] call "JDo" by content "a =. 1 + 1" & x"00" end-call [/code] on the very first excited try, and that umm, segfaulted spectacularly. I haven't found any docs on using libj yet and know near to nada about APL. Cheers, Brian ---------------------------------------------------------------- Subject: On community /extras Got any favourites? What source code do you want to see in a /extras folder? Someone has to write a test or two for CBL_OC_DUMP, but after that? Anyone have any style/format/syntax opinions, wishes, before it gets unleashed? I like it and use it all the time. Cheers, Brian ...he posted, thinking that, if it is what it is, then OpenCOBOL will be around for a long time. [i]"I'll make you famous."[/i] Billy the Kid said to his nervous opponent, gun to face in Young Guns. :-) ---------------------------------------------------------------- Brian you're a prodigy. For OpenCOBOL'Extras ... At the risk of a selfish, the only thing that interests me (and I'm certainly not the only one) is to have input-output tools other than accept / display. Despite the information found on the website I am totally unable to produce any piece of program for displays in graphical mode. I confirm that I am perfectly zero in C/C++ and Unix OS and many others ... Parallel to the development of OpenCOBOL it would be good to have clear explanations, illustrated with detailed examples to start producing the bricks to handle keyboard input and displays on screen in graphical mode. I suspect that this should not be very easy but there is in the team a lot of very competent people for whom this must be within reach. My dream: a literature focus only on graphical input-output (keyboard - screen) and why not a development kit ... for MS Windows of course ... No complicated things, just to start replacing this character-mode that many people mocked gently Thank you all for taking the time to read this SOS (in frenchglish !) ---------------------------------------------------------------- Do you mean like GTK Gui's? Here's some samples of where I've been 'successful' at getting graphical modes to function: Straight up GUI programming http://opencobol.add1tocobol.com/#does-opencobol-support-the-gimp-toolkit-gtk A HUGE framework of interactive graphing tools with CERN's ROOT project http://opencobol.add1tocobol.com/#can-opencobol-interface-with-root-cint GTK access with Vala http://opencobol.add1tocobol.com/#call-opencobol-from-a-vala-gtk-gui-application Umm, CGI and browser side http://opencobol.add1tocobol.com/#how-do-i-use-opencobol-for-cgi Rildo Pragana has a TCL/Tk layer at http://opencobol.add1tocobol.com/#can-opencobol-interface-with-tcl-tk Graphical mode programming has proven to be a reasonable and effective thing to do from OpenCOBOL. The simple layer written for straight up GTK could easily be implemented in Windows API CALL form. Now, having said all that, nothing that I've seen would really rate inclusion in extras/ but hopefully this initiative will change that for the better. The GTK bindings aren't really that far away from usable as a general toolkit, aside from time in to complete it. Cheers, Brian ---------------------------------------------------------------- @aouizerate I agree, Brian is a gift to this community. In fact he got us over our initial hurdles and we now enjoy a rich, productive development environment. When we looked at this issue we decided to go with CGI and write a set of routines (in COBOL) that take most of the tedium out of input and output. We wanted to keep the programmers skills to COBOL only if possible. We wanted to avoid the client side compatability issues. On the negative side we had to deal with the stateless nature of CGI which does add to the programming work that has to be done. We ended up writing a statefull version that we use when warranted. Regardless of which tool the programmer uses there is a learning curve and there are designer imposed limitations. If Brian gets the repository up we will probably contribute our CGI routines if the community wants them. jimc ---------------------------------------------------------------- I'd like to put in a request for a copybook. File status. I'd also like it if we duke it out over the form and flavour of said copybook. Is it straight up constants? Conditionals? String messages? All of the above? /usr/local/share/open-cobol/copy/screenio.cpy might be a good format to follow? Cheers, Brian ---------------------------------------------------------------- Subject: Area-B stmts, Coded in Area-A not giving error. Hi, I am using compile option -std=mvs, when I give MOVE statement starting from column 8 I am supposed to get error as area-B statements cannot appear in area-A. Please help me. ---------------------------------------------------------------- I expected the compiler to output warnings in this case, too, but OpenCOBOL doesn't warn this. I was informed that this is rooted in the 2002 standard, defining the fixed format not as areas A/B/C but as "Sequence Number Area" (1-6) "Indicator Area" (7) and "Program-text Area" (8-...). There is simply no restriction for placing statements from column 12 on as it was in earlier standards. (This didn't changed my personal coding style, I'll still start statements in col. 12, it's quite more readable.) If this ever comes (which I currently don't believe) it would/should become as on option for the conf files, only set on -std=cobol85. As always, you're free to submit patches or to change your own version of OpenCOBOL to warn/error in this case. human ---------------------------------------------------------------- The OP says they have std=mvs. This defitely SHOULD cause an error with that setting as NO IBM mainframe compilor conforms to the '02 Standard removal of A-/B-margin rules. In fact, in some cases, IBM mainframe compilers only issue "low-level" messages if you are missing the period before an A-margin entry. This is because they "know" that anything ending before a valid A-margin entry MUST end with a period. See, for example, the Micro Focus "area-check" directive (to match IBM mainframe behavior.) ---------------------------------------------------------------- I'm pretty sure OpenCOBOL ignores 8-12 rules. [i]By nature of the lexical scan[/i]; 1-6, 7, 8-72, no 12. Cheers, Brian ---------------------------------------------------------------- @btiffin: That was exactly what I said, but not so technical :-) Do you think you can come up with a patch for the lexer to warn statements in 8-12 (perfectly would be a warning depending on a conf-entry)? human ---------------------------------------------------------------- Subject: Filehandling in OC with Berkley-DB Hi guys, we are migrating an application from MFC to OC. We are using OC 1.1. with Berkley-DB (>= 4.5). Look at the following scenario (in pseudocode) select File1A assign to external File1 select File1B assign to external File1 open input File1A open I-O File1B read from File1A with key1 rewrite to File1B with key1 read from File1A with key1 close File1A close File1B The second read does not see the update. In MFC the filehandler works different. All reads, updates, deletes works with the actual data from diskfile (here File1). Can somebody explain how OC identify a file in the runtime (we suppose that is the program-name and the logical filename). In our example OC uses two files (File1A and File1B) with two filebuffers and doesn't notice that this is only one physical file. A similar question is, when the same file is used in two different modules (module A opens a file and calls module B, which opens and updates the same file and then returns to module A)? We have some programs which are merging some parts of the same file and inserting in the same file like this: select File1A assign to external File1 select File1B assign to external File1 select File1C assign to external File1 open input File1A open input File1B open I-O File1C start on File1A with key1 start on File1B with key2 read next on File1A ... read next on File1B ... write in File1C ... close File1A close File1B close File1C Can somebody explain (or give us a link), how OC treats this scenarios with Berkley-DB? Is it possible to get the same behavior with OC as in MFC (without reprogramming the logic of the programs)? Thanks Michael ---------------------------------------------------------------- If you are trying to access the same physical file as being OPEN with two logical file-names, I would VERY STRONGLY suggest that you look at "file-sharing" and "record-locking". (THis is available with MF, so if you are converting from there, I would guess you MIGHT be using their EXTFH or some other facility to provide this to you - even if you aren't coding itin your source code. I think with OC, you need to code this explicitly. ---------------------------------------------------------------- Adding to Bill's info; Gary's guide does an awesome job documenting this. See http://opencobol.add1tocobol.com/OpenCOBOL%20Programmers%20Guide.pdf Look to the READ verb and follow through to locks. With Berkeley you can set the environment variable DB_HOME to tweak record lock management, by giving it a directory to stash temp files. Search here in the forum for db_home, human has offered up some wisdom in that area, which might apply, maybe, umm. ;) Cheers, Brian ---------------------------------------------------------------- Subject: Roger's help Hallo, We due a big lot to Roger. But, I think that a stuff like Oc cannot depend on a single helpless person. Roger, if you are there, tell us what we can do to help you releasing 2.0. In my opinion, Oc is suffering. Just say what we can do, and you will find us there. marcellom ---------------------------------------------------------------- marcellom, Here are a few places where I think we, as a band of volunteers, can help: AC_TEST entries. Here's a sample; simple, clean, short tests. ala [code] AT_SETUP([EXTERNAL data item]) AT_KEYWORDS([runmisc]) AT_DATA([callee.cob], [ IDENTIFICATION DIVISION. PROGRAM-ID. callee. DATA DIVISION. WORKING-STORAGE SECTION. 01 EXT-VAR PIC X(5) EXTERNAL. PROCEDURE DIVISION. IF EXT-VAR NOT = "Hello" DISPLAY EXT-VAR END-DISPLAY END-IF. MOVE "World" TO EXT-VAR. EXIT PROGRAM. ]) AT_DATA([caller.cob], [ IDENTIFICATION DIVISION. PROGRAM-ID. caller. DATA DIVISION. WORKING-STORAGE SECTION. 01 EXT-VAR PIC X(5) EXTERNAL. PROCEDURE DIVISION. MOVE "Hello" TO EXT-VAR. CALL "callee" END-CALL. IF EXT-VAR NOT = "World" DISPLAY EXT-VAR END-DISPLAY END-IF. STOP RUN. ]) AT_CHECK([$COMPILE_MODULE callee.cob]) AT_CHECK([$COMPILE -o prog caller.cob]) AT_CHECK([./prog], [0]) AT_CLEANUP [/code] The goal is to get to the point, the one point, and only display results on failure, if at all possible. AT_CHECK can also be (command, status, [sysout compare], [syserr compare]) ala [code] AT_SETUP([LOCAL-STORAGE]) AT_KEYWORDS([runmisc]) AT_DATA([callee.cob], [ IDENTIFICATION DIVISION. PROGRAM-ID. callee. DATA DIVISION. WORKING-STORAGE SECTION. 01 WRK-X PIC XXX VALUE "abc". LOCAL-STORAGE SECTION. 01 LCL-X PIC XXX VALUE "abc". PROCEDURE DIVISION. DISPLAY WRK-X LCL-X NO ADVANCING END-DISPLAY. MOVE ZERO TO WRK-X LCL-X. EXIT PROGRAM. ]) AT_DATA([caller.cob], [ IDENTIFICATION DIVISION. PROGRAM-ID. caller. PROCEDURE DIVISION. CALL "callee" END-CALL. CALL "callee" END-CALL. STOP RUN. ]) AT_CHECK([$COMPILE_MODULE callee.cob]) AT_CHECK([$COMPILE -o prog caller.cob]) AT_CHECK([./prog], [0], [abcabc000abc], []) AT_CLEANUP [/code] [i]By the way, note how these two little snippets hold a plethora of information for developers learning the ins and outs.[/i] Another area is .po files (Portable ... Object? something to do with message translations...), human has a thread at http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1127&forum=1#forumpost5852 Umm, docs and advocacy? .texi writers welcome. ;) For the hard core, read through the sources. Start with it raw, and when you want to explore, run through the Doxygen tree at http://opencobol.add1tocobol.com/doxy/. I started with cobc/parser.y, the language definitions, as I was keen for a refresher on the huge pile of COBOL reserved words. Fascinating. When you want to play with said sources, you need to keep an eye toward GNU Build Tools. autoconf, automake, libtool, and a host of other voodoo that will take [i](for me it was three tries at Hello[/i]) a few brain cycles to get comfy, but once comfy, it all makes sense in the way tying shoelaces makes sense. TechnoVoodoo shoelaces maybe? In essence, the more people that know the GNU Build Tools, the more we can help Roger with OpenCOBOL. Once you get rolling and do a [code] $ make distcheck [/code] and it clears, and you get a snappy new versioned tarball, it Feels Good. distcheck is awesome for delivering sources. The back end 'professional efficiency' does come with a long and steep learning curve (in my humble opinion). GNU Build is technarcane at best, but soon starts to feel like a practical and worn in set of shoelaces, [i]that like to poke you with sharp aglets once every few dozen steps.[/i] [i]personal appeal[/i] Ok ... this has been a goal of mine since I first bumped into OpenCOBOL; Report Writer. I dabbled in getting the lexical analysis put into parser.y. Not too bad, once 'zoned in' to the sources. Semantic tree building is a whole different kettle of fish. Brain food fish. Runtime support shouldn't be too difficult, but the ins and outs of the compile tree is umm, let's say, Roger level development. COBOL is HUGE. If anyone thinks they could help with wrangling around with Report Writer (keeping an eye towards minimizing Mr. While's mentoring time), drop a note and we can start chatting. Everyone; Drop a note on anything and we can chat about it here on good ol' opencobol.org. Cheers, Brian ---------------------------------------------------------------- Hallo Brian, I am back from holidays. I'll analyze your post and see what I will be able to do. Marcellom ---------------------------------------------------------------- Hi Roger & Knishida If you are there, please beat a stroke. A big lot of people is investing considerable resources on OC. But no one of us knows if at the end of game a result will came. We, OC people, do not know what your plans are and, above all, if you are still working on it. Posting on forum could help. There is no new about 2.0 release. Just voices. Databases connected to OC are poor (spilt keys missing, for example, sql connections are on hands of helpless willing people (forgive me Jimc). Oc is considered a full working application. Really? Shall we still belive in OC or have have we better go somewhere else? And what about months spent on OC? If you need a burning bush, we are willing to provide one. Just tell us. Marcellom ---------------------------------------------------------------- Marcellom, and all; OC 2.0 is in the works. It's COBOL, so it's big works. I really want to avoid a wait/expectation loop, and I'd rather continue hyping and stretching 1.1pre-rel, but 2.0 is in the works. For now, just voices. As is a possibly new opencobol.org, for now just voices. Sorry about the continued whisperings, but as stated, there is so much to the current 1.1pre-rel that we still need to explore and can, in my opinion, put to work. Cheers? Brian ---------------------------------------------------------------- Subject: ISAM re-read issue (warning long post) **edit below** I have taken the liberty of removing the first program that I posted for this refugee (he cannot enroll in the forum) and have posted a new program per his request. Roger's suggestion that error testing be done after each I/O operation conforms to the way I like to do things and I would hope that the author will take the suggestion to heart. I am hoping that we can get him enrolled in the forum so that I can get out of the middle of this :-) His environment is Windows [code] Cobc (OpenCOBOL) 1.1.0 Copyright ©2001-2009 Keisuke Nishida / Roger While Built Sep 10 2010 10:12:33 Packaged Feb 06 2009 10:30:55 CET [/code] *** original post below*** A new member of the community contacted me and asked me to post this question/issue since enrollment in opencobol.org is evidently closed. I did not take time to minimize the code to the essentials, thinking that looking at someone else's technique might be of some value. This fellow is a serious COBOLer and it would be helpful if we could get him enrolled. His request is below the line. ------------------ Attached is a code shell you can post for me if you will. Thanks! The key value 00079 is some arbitrary key I picked for this example The routine returns 00079 00079 00079 00079 00079 00079 00079 00079 00079 00079 And I would expect it to return 00079 00078 00077 00076 00075 00074 00073 00072 00071 00070 It looks like the pointer AFTER the READ is completed is at the end of the current record JUST read so the “PREVIOUS” clause moves the pointer back one but that leaves the READ to read the SAME record. The pointer needs to move back 2 before executing the READ code. I tried both ACCESS IS SEQUENTIAL and ACCESS IS DYNAMIC both are the same results. *** new program below *** [code] IDENTIFICATION DIVISION. PROGRAM-ID. RPBUG. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT FILE-IN ASSIGN TO "X:\OPENCOBOL\VFILES\SID.CLU" ACCESS IS SEQUENTIAL ORGANIZATION IS INDEXED RECORD KEY IS VS-KEY FILE STATUS IS FILE-STATUS. DATA DIVISION. FILE SECTION. FD FILE-IN. 01 VS-REC. 05 VS-KEY PIC X(05). 05 VS-DATA PIC X(95). WORKING-STORAGE SECTION. 01 STATUS-SWITCHES. 05 FILE-STATUS PIC 9(02) VALUE ZEROS. PROCEDURE DIVISION. 1000-MAIN SECTION. MOVE '00079' TO VS-KEY *> SOME KEY IN THE MIDDLE START FILE-IN KEY IS = VS-KEY PERFORM 10 TIMES READ FILE-IN PREVIOUS RECORD END-READ DISPLAY VS-REC END-PERFORM. STOP RUN. [/code] ---------------------------------------------------------------- Hmm, registration is really closed (I guess because of the SPAM issues), but Keisuke is the only one that is able to admin this board. I've just sent him a short PM (but I'm not sure if/when he reads it). To the posted problem: 1. Very important information is missing - cobc -v - ISAM library in use (BDB/VBISAM/...) - system specs (I guess it's some Win) 2. The long post is really nice, as that looking at someone else's technique might be of some value, as you've wrote. But if someone wants to check the problem (and to correct it, if necessary) it would be useful to have a short-as-possible sample (in this case without bis screen i/o). Can you take the time to shorten the sample or better: ask the original author to do so? In the case you write him a message: tell him he is warmly welcome here and we try to get him a forum account, too. human Edit: I've just seen that Brian takes care of the registration issue and sent a mail to Keisuke about this topic. I'm sure he will get it up again. ---------------------------------------------------------------- Actually, from code inspection, the solution is obvious :-) The solution is the checking of the file status. 1) No check of file status on OPEN (Geez). 2) READ For sequential reads this should look something like - [code] READ (NEXT/PREVIOUS) IF EOF *> Status 10 ... ELSE IF OK *> Status 00 ELSE *> Unexpected ... END-IF [/code] Roger ---------------------------------------------------------------- Subject: plotutils Another GNU project, libplot. Had to try it. Couldn't wait to finish the work before posting. From the good folks at the plotutils project, then modified to be called from COBOL as a quick test The plan is to replace, all the C code with all COBOL to demonstrate libplot usage. Because charts and graphs are fun. This code is built for command line creation of piecharts using stdin for slice information and stdout for image data. [b]piechart.cob[/b] [code] *> *************************************************************** *> Author: Brian Tiffin *> Date: 20110723 *> Purpose: Call libplot to make piecharts *> Tectonics: cobc -x piechart.cob -lplot pieassist.c *> *************************************************************** identification division. program-id. piechart. environment division. configuration section. repository. function all intrinsic. special-names. symbolic characters BS is 9 TAB is 10 LF is 11 NEWLINE is 11 OCTOTHORPE is 36 CMA is 45 DASH is 46 . input-output section. file-control. select stdin assign to keyboard. select stdout assign to display. data division. file section. fd stdin. 01 inline pic x(32767). working-storage section. 77 commandline pic x(4096). 77 commandopt pic x(4096). 88 islast value low-values. 88 ishelp values '--help' '-h'. 88 istype values '--type' '-T'. 88 istitle values '--title' '-t'. 88 ispull values '--pull' '-p'. 77 outtype pic x(32) value 'X' & x"00". 77 title pic x(64) value 'cobchart' & x"00". 77 pull pic x(64) value x"00". 77 slices pic 99. 01 infile. 03 slice occurs 64 times depending on slices. 05 stext usage pointer synchronized. 05 val float-long synchronized. 05 ftext usage pointer synchronized. 01 intext. 03 textlines occurs 64 times depending on slices. 05 pietext pic x(32). 05 percent pic x(8). 77 revval pic x(32). 77 revtext pic x(32767). 77 workline pic x(32767). 77 workptr usage pointer. 77 filestatus pic x(4). 88 ineof value high-values when set to false is low-values. *> *************************************************************** procedure division. move low-values to commandopt accept commandopt from argument-value perform until islast >>D display ":" trim(commandopt) ":" end-display evaluate true when ishelp display "help? rtfmmf" end-display when istype move low-values to outtype accept outtype from argument-value move concatenate(trim(outtype trailing) x"00") to outtype when istitle move low-values to title accept title from argument-value move concatenate(trim(title trailing) x"00") to title when ispull move low-values to pull accept pull from argument-value move concatenate(trim(pull trailing) x"00") to pull when other display "unknown option: " trim(commandopt) end-display end-evaluate move low-values to commandopt accept commandopt from argument-value end-perform if outtype(1:1) equal low-values or space or dash display "outtype not specified, X default" end-display initialize outtype all to value end-if if title(1:1) equal low-values or space or dash display "title not specified, defaulted" end-display initialize title all to value end-if >>D display >>D 'type :' trim(outtype) >>D newline >>D 'title :' trim(title) >>D newline >>D 'pull :' trim(pull) >>D end-display *> Arguments parsed, time to read some data open input stdin read stdin at end set ineof to true end-read perform until ineof >>D display trim(inline) end-display move trim(inline) to workline if not trim(inline)(1:1) equal octothorpe or space unstring workline delimited by cma into revtext revval end-unstring >>D display >>D ":" revval ":" newline ":" revtext(1:32) ":" >>D end-display add 1 to slices move trim(revval) to val(slices) move concatenate(trim(revtext) x"00") to pietext(slices) set stext(slices) to address of pietext(slices) set ftext(slices) to address of pietext(slices) >>D display val(slices) end-display >>D display stext(slices) end-display read stdin at end set ineof to true end-read end-perform >>D call "CBL_OC_DUMP" using infile on exception continue end-call >>D display "slices: " slices end-display close stdin *> Try it. call "assist" using by value slices by reference infile by reference outtype title pull on exception display "assist linkage problem: " exception-location end-display end-call goback. end program piechart. [/code] and running with [b]probe.in[/b] [code] COBOL, 47 C, 32 REBOL, 8 OTHER, 13 [/code] and [code] $ cobc -g -debug -x piechart.cob -lplot pieassist.c pieassist.c: In function ‘assist’: pieassist.c:363:11: warning: assignment from incompatible pointer type $ ./piechart -T png --pull OTHER --title 'Time spent fiddling, in fizzbuzzes' <probe.in >pie.png $ xdg-open pie.png [/code] giving [img]http://opencobol.add1tocobol.com/images/pie.png[/img] --type can be X, png, pnm, or gif (bitmap formats), or svg, ai, ps, cgm, fig, pcl, hpgl, regis, or tek (vector formats). If you pick X, it starts up an X window. The above is only one of my started/not finished rave posts, but, OpenCOBOL can plot piecharts from a command line now. Soon, with out the C. Cheers, Brian was piechart.c from http://www.gnu.org/s/plotutils/ and http://www.usf.uni-osnabrueck.de/~breiter/tools/piechart/piecharts.en.html, now [b]pieassist.c[/b] I changed [b]main[/b] to [b]assist[/b], along with it's parameter set. The COBOL experiment does the work of process_arguments and read_stdin. [code] /* Bernhard Reiter * $Id: piechart.c,v 1.24 2004/09/28 19:15:08 bernhard Exp $ * * Copyright (C) 1997-2004 by Bernhard Reiter * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * * Creates a piechart, must be linked with a libplot library * reads ascii input file from stdin. * * format: one slice per line. every trailing tab and space will * be ignored. The string after the last tab or space * will be scanned as value. The beginning is the label-text. * Empty lines and lines starting with "#" are ignored * * INSTALLATION: See the makefile on how to build piechart. * You might get a warning about an implicit declaration * of getopt(). You can try and include getopt.h then, * e.g. with commenting out the #include line later in this file. * * KNOWN_BUGS: There is a numerical bug in plotutils-2.4.1 libplot * involving small angles, you can tickle it out with piechart * when using very large and very small numbers. E.g. like: * echo -e 'One 150000000000\nTwo 2' | ./piechart -T X * Workaround: scale down all input numbers * or set reasonably small ones to zero * * * TODO: many improvements possible. * - make stuff more dynamic (input linelength and max # of slices) * - better handling of progname * - move more stuff into command line options * e.g. * + fonts * + rotation of the pie * - use getopt_long * - make better assumptions on how to place the labels * - special handling of very small slices * - make multi line labels possible * - multi-line titles? * - does every system have strdup(), strncpy()? * - * ... * * CONTRIBUTORS: * "Martin J. Evans" <martin@mjedev.demon.co.uk> * pointed out that some systems do not terminate * the target string after strncpy(). * * Jan-Oliver Wagner <jwagner@usf.uni-osnabrueck.de> * created the first version to work with gnu plotutils-2.2. * Added pullout option. * * Tom Peters <tpeters@xs4all.nl> notified me that some * systems have getopt.h . * * Satish Alreja <salreja@hotmail.com> reported a bug * in v0.10 when not displaying percentages. * * Franck Aniere <aniere@genoscope.cns.fr> reported a * bug in v0.11 when using "-f". * * Alexander Pohoyda alexander.pohoyda a.t gmx.net contributed * the "-B" option (incl. a calculcation to keep the aspect ratio) * and the "-n" option. */ #include <stdio.h> /* #include <getopt.h> */ /*include this header file if your system needs it */ #include <plot.h> #define VERSION "0.13 (CVS-$Revision: 1.24 $)" void print_version(FILE *file) { fprintf(file,"piechart version " VERSION "\n"); fprintf(file,"Copyright (C) 1998-2004 Bernhard Reiter.\n" "Piechart is Free Software under " "the GNU GENERAL PUBLIC LICENSE v2 or later.\n" "It comes with ABSOLUTELY NO WARRANTY!\n"); #ifdef DEBUG fprintf(file,"compiled with option: DEBUG\n"); #endif } void print_sign(FILE *file) { fprintf(file,"\n" "*Note:* In general pie graphs are bad for representing information!\n" "The --warning option will print the whole story.\n\n" ); } /* * $Log: piechart.c,v $ * Revision 1.24 2004/09/28 19:15:08 bernhard * Added patch from Alexander Pohoyda for fontsize "-n", * also enabled negative values for "-n" and set the default to -1 * makefile: changed test and moretests to use -n a bit * * Revision 1.23 2004/09/28 18:57:25 bernhard * Patch from Alexander Pohoyda to keep the aspect ratio when -B ing. * makefile: Adjusted test call to display bug fix. * * Revision 1.22 2004/09/28 18:44:59 bernhard * Added Alexander Pohoyda's -B option patch. * * Revision 1.21 2004/09/24 12:39:57 breiter * Added KNOWN_BUGS section with a description of the numerical libplot bug. * * Revision 1.20 2004/09/23 20:13:21 breiter * Bumped copyright year to 2004 and version anticipating next release. * * Revision 1.19 2004/09/23 20:10:27 breiter * Removed use of multi-line string constants. * This makes piechart compile with gcc 3.3.x x>=1 again, * because those strings have been a deprecated extension that got removed. * * Revision 1.18 2003/04/03 18:10:02 breiter * Slightly improved the warning message. * * Revision 1.17 2002/04/12 19:50:10 breiter * - bugfix: buffer for strings too small for "-f" option * - cleanup: minor formatting, version number, copyright year * * Revision 1.16 2001/12/09 12:09:52 breiter * - bugfix: seqfault with not displaying percentages (reported by Satish Alreja)- clean-up: better copyright and license message * - clean-up: minor: some additional comments and typo corrections * - bugfix: error status * - Improved usage help for available display types. * * Revision 1.15 2001/04/18 08:25:38 breiter * Corrected some typos in the warning message. * * Revision 1.14 2000/03/28 21:29:37 breiter * added literature to the warning sign * * Revision 1.13 2000/03/28 20:43:48 breiter * - added: Jan's pullout feature. * - codeclean-up: slice drawing code * - codeclean-up: moved plotsession init and end into functions * - bugfix: almost full circle slices are drawn correctly now * - closing circle code removed because arc are okay with libplot now * - added: Warning sign and story * * - codeclean-up: introduced MAX_RADIUS * - added: options "-f" and "-D" * to show the percentage of the values * * Revision 1.12 1999/10/05 23:29:46 breiter * Added builg information * fixed a few doc typos * * Revision 1.11 1999/04/03 10:26:32 breiter * adapted to plotutils-2.2: added pl_ to all function calls * adjusted help text * more return values are checked now, as the function provide more of them * end circle and middle point are only drawn if LINEWIDTH is not default * changed constant name LINEWIDTH_LINES -> LINEWIDTH * end circle and middle point LINEWIDTH is multiplied with a factor(~1.2) now * extra external variables for getopt() are commented out * * Revision 1.10 1998/07/28 13:41:54 breiter * - Terminating strncpy()ed string now. Thanks to "Martin J. Evans" * for reporting this problem. * - Removed hard limit on label-size. * - Changed inputline buffersize to a new constant defined as LINE_BUFSIZ. * - Cleaned up some comments. * version number incremented to 0.8 * * Revision 1.9 1998/07/07 23:44:26 breiter * added -C option for specifing colors * version number is 0.7 now. * * Revision 1.8 1998/07/07 17:04:40 breiter * major improvements: * - more structure: moves code into functions: process_arguments(),read_stdin() * - new scanning -> multi word labels are possible now * - two new options: -r radius and -d text distance * - errmsgs and usage are printed to stderr now, but to stdout, wenn requested * - fixed debug output typo * * Revision 1.7 1998/01/31 16:13:02 breiter * changed fill() -> filltype() as fill() is only temporarily supported * * Revision 1.6 1998/01/31 16:05:40 breiter * using a path to draw one slice now. This is far simpler. * No need for LINEWIDTH_FILL anymore. * * Revision 1.5 1998/01/30 16:06:37 breiter * adapted for use with libplot from plotutils-2.0 * added +T display-type commandline option therefore. * * Revision 1.4 1997/10/11 17:19:14 breiter * cosmetic changes. version information enhanced. * * Revision 1.3 1997/10/11 16:31:56 breiter * version information enhanced. * * Revision 1.2 1997/10/11 16:09:15 breiter * bug fixes. small improvements. userspace is always square now. * * Revision 1.1 1997/10/11 15:07:27 breiter * Initial revision * */ #include <stdlib.h> #include <math.h> #include <string.h> /* for strdup() */ /* this program used getopt and relys on that it is included in the * stdlib. I wanted to use getopt_long from Gnu, but it is not included * in the clib I have here. So it is still left TODO. */ /******************************************************************************* * Configurations -- change, what you like * If time permits some stuff could be influenced by command line options ******************************************************************************/ /* Color in which the separating lines and the circle are drawn */ #define LINECOLOR "black" /* LINEWIDTH is for the separating lines and the arcs * if closing circle and middle point will be drawn, a factor will be applied * -1 means default ; 0.02 might be a usefull value */ #define LINEWIDTH -1 /* Some hardcoded limits: * the max number of slices (^=MAX_SLICES). * LINE_BUFSIZ is the maxmumlength of input-lines. *(You see, how lasy I was. I was not using some object orientated language * like objective-c and left all the neat dynamic string handling for * the interested hacker and or some version in the future.) */ #define MAX_SLICES 50 #define LINE_BUFSIZ 256 /* MAX_RADIUS limits the slice and accompaining text radius */ #define MAX_RADIUS 1.2 /* if an input line starts with this character, it is ignored. */ #define COMMENTCHAR '#' /* Colors the slices are getting filled with. * the color names are feed into the libplot functions. * The plotutils distribution contains a file doc/colors.txt which lists the * recogized names. * * if the nullpointer is reached the color pointer is resetted starting * with the first color again. */ char *colortable[MAX_SLICES] = { "red","blue","green","yellow", "brown", "coral", "magenta","cyan", "seagreen3", NULL }; /******************************************************************************* * Beware: This following code is for hackers only. * ( Yeah, it is not THAT bad, you can risk a look, if you know some C ..) ******************************************************************************/ /* Program structure outline: * - get all options * - read all input data (only from stdin so far) * - print * + init stuff * + print title * + print color part for slices * + print separating lines and circle * + print labels * + clean up stuff */ /* A nice structure, we will fill some of it, when we read the input. */ struct slice { char *text; /* label for the slice */ double value; /* value for the slice */ char *ftext; /* text showing the percentage */ }; /* one global variable. It is needed everywhere.. */ char * progname; /* for printing errors out */ /* declarations of functions defined after main() */ int init_plotsession(char *display_type, char *bitmap_size); int end_plotsession(int handle); void draw_slice(double center_x, double center_y, double radius, double startangle, double sliceangle); void process_arguments(int argc, char **argv, char **display_type, char ** title, char ** pulled_slice, double *radius, double *text_distance, double *ftext_distance, int *show_fraction, char *colortable[], char **bitmap_size, double *font_size); void read_stdin(int *n_slices, struct slice *slices[MAX_SLICES]); /******************************************************************************* * * Attention: Main Progam to be started.... :) */ // Or was, before a COBOL guy got here int assist(int cob_slices, char *cob_data, char *display_type, char *title, char *pulled_slice) { //char * title=NULL; /* Title of the chart */ //char * pulled_slice=NULL; /* Name of slice to be pulled out */ int pulled_slice_no = -1; /* Number of the slice to be pulled out */ double pullout_direction_angle; /* pull-out direction */ double pullout_center_x; /* center X-coord for pulled slice */ double pullout_center_y; /* center Y-coord for pulled slice */ int return_value; /* return value for libplot calls. */ //char *display_type = "meta"; /* default libplot output format */ int handle; /* handle for open plotter */ struct slice *slices[MAX_SLICES];/* the array of slices */ int n_slices=0; /* number of slices in slices[] ;) */ int t; /* loop var(s) */ double sum; /* sum of all slice values */ int w, h; /* width and height of the plot */ double radius=0.8; /* radius of the circle in plot coords */ double font_size=-1; /* size of text font */ double text_distance=0; /* distance of text from circle */ double ftext_distance=0; /* distance of fraction text from text */ int show_fraction=1; /* flag to show the fraction */ char *bitmap_size=NULL; /* bitmap size of the pixel outputs */ // OC: This will be done in COBOL /* process_arguments(argc,argv, &display_type,&title,&pulled_slice,&radius,&text_distance, &ftext_distance,&show_fraction,colortable,&bitmap_size,&font_size); print_sign(stderr); read_stdin(&n_slices,slices); */ // OC: Fill the C array for the quick test n_slices = cob_slices; for(t=0;t<n_slices;t++) slices[t]=cob_data + t*sizeof(struct slice); /* Let us count the values */ sum=0.; for(t=0;t<n_slices;t++) sum+=slices[t]->value; /* create the text for the percentages, if wanted */ if (show_fraction) { for(t=0;t<n_slices;t++) { slices[t]->ftext=calloc(1,sizeof(char)*20);/*space for int*/ if(!slices[t]->ftext) perror(progname),exit(10); /* well snprintf would be good here, but some systems * or libcs are still missing snprint, we just trust %f*/ sprintf(slices[t]->ftext,"%-.1f%%",(slices[t]->value/sum)*100); } } /* Lets test for the slice to be pulled out */ if (pulled_slice && *pulled_slice) { for (t=0;t<n_slices;t++) if (strcmp(slices[t]->text,pulled_slice) == 0) { pulled_slice_no = t; break; } if (pulled_slice_no == -1) { fprintf(stderr,"The name of the slice to be pulled out can not be found.\n"); exit(1); } } handle=init_plotsession(display_type,bitmap_size); /* creating your user coordinates */ if (bitmap_size != NULL) { sscanf(bitmap_size, "%dx%d", &w, &h); } else { w = MAX_RADIUS; h = MAX_RADIUS; } if(title) { return_value= pl_fspace(-(MAX_RADIUS+0.2), -(MAX_RADIUS+0.2) * h / w, (MAX_RADIUS+0.2), (MAX_RADIUS+0.2) * h / w); } else { return_value= pl_fspace(-MAX_RADIUS, -MAX_RADIUS * h / w, MAX_RADIUS, MAX_RADIUS * h / w); } if(return_value) { fprintf(stderr,"fspace returned %d!\n",return_value); } /* we should be ready to plot, now! */ /* I like to think in degrees. */ #define X(radius,angle) (cos(angle)*(radius)) #define Y(radius,angle) (sin(angle)*(radius)) #define RAD(angle) (((angle)/180.)*M_PI) #define XY(radius,angle) (X((radius),RAD(angle))),(Y((radius),RAD(angle))) /* plot title if there is one */ if(title&&*title) { pl_ffontsize(font_size+0.02); pl_fmove(0,radius+text_distance+0.2); pl_alabel('c','b',title); } pl_pencolorname(LINECOLOR); pl_ffontsize(font_size); /* and now for the slices */ { double distance,angle=0; char **color=colortable; double r=radius; /*the radius of the slice circle*/ pl_savestate(); pl_joinmod("round"); /* drawing the slices */ pl_filltype(1); pl_flinewidth(LINEWIDTH); pl_pencolorname(LINECOLOR); for(t=0;t<n_slices;t++) /* draw one path for every slice */ { distance=(slices[t]->value/sum)*360.; pl_fillcolorname(*color); if (t == pulled_slice_no) { /* test for pulling out */ /* pull-out direction is middle of start and end: */ pullout_direction_angle = distance / 2 + angle; /* pullout_center_(xy) is also used later when adding labels.*/ pullout_center_x = X(0.1, RAD(pullout_direction_angle)); pullout_center_y = Y(0.1, RAD(pullout_direction_angle)); draw_slice(pullout_center_x, pullout_center_y,r,angle,distance); } else { draw_slice(0,0,r,angle,distance); } angle+=distance; /* log fraction of circle already drawn */ color++; /* next color for next slice */ if(!*color) color=colortable;/* start over if all colors used */ } pl_restorestate(); } /* and now for the text */ { double distance,angle=0,place; double r=radius+text_distance;/* radius of circle where text is placed*/ char h,v; char *label; /* helping variabel containing the label */ pl_savestate(); for(t=0;t<n_slices;t++) { distance=(slices[t]->value/sum)*360.; /* let us calculate the position ... */ place=angle+0.5*distance; /* and the alignment */ if(place<180) v='b'; else v='t'; if(place<90 || place>270) h='l'; else h='r'; /* plot now! */ if (t == pulled_slice_no) pl_fmove(X(r,RAD(place))+pullout_center_x,Y(r,RAD(place)) + pullout_center_y); else pl_fmove(XY(r,place)); if (show_fraction && ftext_distance==0) { label=malloc( strlen(slices[t]->ftext)+strlen(slices[t]->text)+2+1); if (!label) perror(progname),exit(10); if (show_fraction==1) sprintf(label,"%s %s",slices[t]->text,slices[t]->ftext); else sprintf(label,"%s %s",slices[t]->ftext,slices[t]->text); } else label=slices[t]->text; pl_alabel(h,v,label); if (show_fraction && (ftext_distance!=0)) { if (t == pulled_slice_no) pl_fmove( X(r+ftext_distance,RAD(place))+pullout_center_x, Y(r,RAD(place)) + pullout_center_y); else pl_fmove(XY(r+ftext_distance,place)); pl_alabel(h,v,slices[t]->ftext); } angle+=distance; } pl_restorestate(); } return end_plotsession(handle); /* Note: We did not free() the allocated space for the slices. */ } /******************************************************************************* * functions */ int init_plotsession(char *display_type, char *bitmap_size) /* Initialise libplot and return handle of wanted plotter. */ { int handle, return_value; return_value=pl_parampl("BITMAPSIZE", bitmap_size); if(return_value<0) { fprintf(stderr,"The plotter does not accept parameters.\n"); exit(1); } handle=pl_newpl(display_type, NULL, stdout, stderr); if(handle<0) { fprintf(stderr,"The plotter could not be created.\n"); exit(1); } return_value=pl_selectpl(handle); if(return_value<0) { fprintf(stderr,"The plotter does not exist or could not be selected.\n"); exit(1); } return_value=pl_openpl(); if(return_value<0) { fprintf(stderr,"The selected plotter could not be opened!\n"); exit(1); } return handle; } /******************************************************************************/ int end_plotsession(int handle) /* Close and delete plotter, return NULL if everything went fine. */ { int err_status=0, return_value; /* end a plot sesssion */ return_value= pl_closepl(); if(return_value<0) { fprintf(stderr,"The plotter could not be closed.\n"); /* no exit, because we try to delete the plotter */ err_status +=1; } /* need to select a different plotter in order to delete our */ return_value=pl_selectpl(0); if(return_value<0) { fprintf(stderr,"Default Plotter could not be selected!\n"); err_status +=1<<1; } return_value=pl_deletepl (handle);/* clean up by deleting used plotter */ if(return_value<0) { fprintf(stderr,"Selected Plotter could not be deleted!\n"); err_status +=1<<2; } return err_status; } /******************************************************************************/ void draw_slice(double center_x, double center_y, double r, double startangle, double sliceangle) /* draw one slice starting at center(xy). Slice has radius an angle we use one filled drawing path, but we might need more than one arc pieces sliceangle is the distance in degrees we still have to go startangle is the angle where the next arc piece starts */ { pl_fmove(center_x,center_y); pl_fcont(X(r, RAD(startangle))+center_x, Y(r,RAD(startangle))+center_y); while(sliceangle>179) { /* we need to draw a circlepart first */ /* we have to be sure to draw counterclockwise (180 wouldn`t work in all cases) */ pl_farc(center_x,center_y, X(r, RAD(startangle))+center_x,Y(r,RAD(startangle))+center_y, X(r,RAD(startangle+179))+center_x, Y(r,RAD(startangle+179))+center_y); startangle+=179; sliceangle-=179; } pl_farc(center_x,center_y, X(r, RAD(startangle))+center_x, Y(r,RAD(startangle))+center_y, X(r,RAD(startangle+sliceangle))+center_x, Y(r,RAD(startangle+sliceangle))+center_y); pl_fcont(center_x,center_y); /* return to center */ pl_endpath(); /* not really necessary, but intuitive */ } /******************************************************************************/ void process_arguments( int argc, char **argv, char **display_type, char ** title, char ** pulled_slice, double *radius, double *text_distance, double *ftext_distance, int *show_fraction, char *colortable[], char **bitmap_size, double *font_size) { /* well, we do not have the gnu getopt long here. :-( * so I use getopt for now */ int c; extern char *optarg; /* optint,opterr,optopt relate to getopt(),see manpage*/ /* but we do not use them so far */ /* extern int optind,opterr,optopt; */ int errflg = 0; int show_usage=0; int show_version=0; int specified_display_type=0; char **help; /* will help splitting the colornames */ char *arg; /* one string argument */ progname=argv[0]; /* fill the only global variable */ c=argc; while(--c) { if ( strcmp("--warning",argv[c]) == 0 ) { printf("\n\ Warning!\n\ \n\ Piecharts are generally not recommended to visualise information!\n\ Use bar- or pointchars instead if the quantities are important.\n\ \n\ Studies have shown that piecharts are hard to read if you actually have to\n\ answer questions about the numbers they represent. They look very pleasing\n\ and can be seen in many places but they are bad to visualise quantitative\n\ information. Analytic thinking persons will read the percentages or values\n\ given on the legend or the chart itself and analyse them in their head\n\ when encountering a piechart.\n\ \n\ This is mostly because differences in angles are not easy to judge \n\ for the human eye and there are a bunch of cases were you make the \n\ piechart experience even worse. There are still reasons to use piecharts.\n\ In certain situations when the raw numbers are not what is needed. You might\n\ go for a more fancy or slick presentation which does not stress the numbers\n\ or the interpretation of them.\n\ \n\ \n\ Some rules to get better piecharts:\n\ * Only use them to display 2 up to 6 fraction of one units\n\ * The values should to be in the same magnitute\n\ * Values shall not be almost the same, differences will be lost\n\ * Use colors with high contrasts to each other\n\ \n\ Edward Tufte [3-5] and Howard Wainer [6] both recommend bar- or pointcharts\n\ for the tasks other people would use piecharts for.\n\ \n\ This program started as an programming example for libplot. \n\ After doing more research about visualisation I found that piecharts are\n\ a bad idea for scientific data display. Therefore I erected this\n\ warning sign as tribute to visualisation scientist, whose words are\n\ lost too often in business noise. It also eases my consciousness.\n\ You are educated now, ready to approach piecharts with a little bit\n\ more scepticism and decide for yourself.\n\ \n\ Bernhard Reiter, April 2003\n\ \n\ Literature:\n\ \n\ \n\ [1] Gary T. Henry. Graphing Data - Techniques for Display and Analysis,\n\ volume 36 of Applied Social Research Methods. \ SAGE Publications, Inc.,1995.\n\ \n\ [2] Calvin Fischer Schmid. Statistical Graphics - Design Principles and\n\ Practices. Wiley, 1983.\n\ \n\ [3] Edward Rolf Tufte. The Visual Display of Quantitative Information.\n\ Graphics Press, PO Box 430, Cheshire, Connecticut 06410, 1983.\n\ \n\ [4] Edward Rolf Tufte. Envisioning Information, 1990.\n\ \n\ [5] Edward Rolf Tufte. Visual Explanations - \ Images and Quantities, Evidence \n\ and Narrative, 1997.\n\ \n\ [6] Howard Wainer. Visual Revelations - Graphical Tales of Fate and De-\n\ ception from Napolean Bonaparte to Ross Perot. \ Copernicus (Springer), 1997.\n\ "); exit(0); } } while ((c = getopt(argc, argv, "Vt:p:f:T:r:d:D:C:hsB:n:")) != EOF) switch (c) { case 'B': *bitmap_size=strdup(optarg); break; case 't': if (*title) errflg++; else *title=strdup(optarg); break; case 'p': if (*pulled_slice) errflg ++; else *pulled_slice = strdup(optarg); break; case 'T': if (specified_display_type) errflg++; else { specified_display_type++; *display_type = strdup(optarg); } break; case 'r': *radius=atof(optarg); if(*radius<0.1||*radius>MAX_RADIUS) errflg++; break; case 'n': *font_size=atof(optarg); if(*font_size>=0 && (*font_size<0.001||*font_size>MAX_RADIUS) ) errflg++; break; case 'd': *text_distance=atof(optarg); if(*text_distance<(-2.0)||*text_distance>MAX_RADIUS) errflg++; /* we have a second check after processing all options*/ break; case 'D': *ftext_distance=atof(optarg); if(*ftext_distance<(-2.0)||*ftext_distance>MAX_RADIUS) errflg++; /* we need the second check after all options */ break; case 'f': switch (optarg[0]) { case 'l': *show_fraction=2; break; case 'r': *show_fraction=1; break; case '-': case 'n': *show_fraction=0; break; default : errflg++; } break; case 'C': help=colortable; arg=strdup(optarg); *help++=strtok(arg,",\0"); if(!*help) errflg++; else while((*(help++)=strtok(NULL,",\0"))); break; case 'V': if (show_version) errflg++; else show_version++; break; case 'h': if (show_usage) errflg++; else show_usage++; break; case '?': errflg++; } /* check if distances are reasonable */ if(*text_distance + *radius < 0 || *text_distance+*radius > MAX_RADIUS) errflg++; if(*ftext_distance + *text_distance+ * radius < 0 || *ftext_distance + *text_distance+*radius > MAX_RADIUS) errflg++; if (errflg) { fprintf(stderr, "parameters were bad!\n"); show_usage++; } if(show_version) { print_version(stdout); print_sign(stdout); exit(1); } if(show_usage) { FILE *f=stdout; if(errflg) f=stderr; else f=stdout; print_version(f); print_sign(f); fprintf(f,"usage: %s [options]\n",progname); fprintf(f,"\t the stdin is read once.\n"); fprintf(f,"\t options are:\n"\ "\t\t-t Title\tset \"Title\" as piechart title\n"\ "\t\t-p name\t\tpull out slice with text=name\n"\ "\t\t-f type\t\tShow percentage. type of:\n"\ "\t\t\t\t'-' or 'n'\twell don't do it\n"\ "\t\t\t\t'l'\t\tplace left of label\n"\ "\t\t\t\t'r'\t\tplace right after label\n"\ "\t\t-T Display-Type\tone of "\ "X, ps, fig, png, meta, cgm,\n" "\t\t\t\thpgl, ai, regis, tek, svg, pnm\n"\ "\t\t\t\t(or whatever your libplot version supports)\n"\ "\t\t\t\tdefault:meta\n"\ "\t\t-r radius\tfloat out of [0.1;%.1f] default:0.8\n"\ "\t\t-n fontsize\tsize of the font used to plot the text\n"\ "\t\t\t\tfloat out of [0.001;%.1f] or negative\n"\ "\t\t\t\tdefault:-1\n"\ "\t\t-d textdistance\tfloat out of "\ "[- r;%.1f-r] default:0.0\n"\ "\t\t-D ftext_distance\tadditional distance for percentage text\n"\ "\t\t\t\tfloat out of [-(r+d);%.1f-(r+d)]\n"\ "\t\t-C colornames\tcomma separated list of colornames\n"\ "\t\t\t\t(see valid names in color.txt of plotutils doc.)\n"\ "\t\t-B size\t\tbitmapsize\tformat WIDTHxHEIGHT\n"\ "\t\t\t\t(Possible: Append start coords for X like +0-5)\n"\ "\t\t\t\tdefault: 570x570 example: 500x500-30+50\n"\ "\t\t-h\t\tprint this help and exit\n"\ "\t\t-V\t\tprint version and exit\n\n"\ "\t\t--warning\tPrint advice against using piecharts.\n"\ ,MAX_RADIUS,MAX_RADIUS,MAX_RADIUS,MAX_RADIUS); exit(1); } /* Everything is fine with the options now ... */ } /******************************************************************************/ void read_stdin(int *n_slices, struct slice *slices[MAX_SLICES]) /* consume all lines from stdin, parse them in the slices array. * allocate, initialise and fill slice structs. */ { char line [LINE_BUFSIZ]; /* input line buffer */ /* So, let us read the standardinput */ while( !(feof(stdin) || ferror(stdin)) ) { char *c; /* string return from fgets */ struct slice * aslice; /* freshly filled slice-structure */ int r; /* help variable for scanning */ char *s,*t; /* help variables for scanning */ c=fgets(line,LINE_BUFSIZ,stdin); if(!c) continue; /* encountered error of eof */ if(line[strlen(line)-1]!='\n') { fprintf(stderr,"line was too long!\n"); exit(2); } /* strip newline */ line[strlen(line)-1]='\0'; /* strip carridge return, if there is one*/ if(line[strlen(line)-1]=='\r') line[strlen(line)-1]='\0'; /* Skip empty lines or lines beginning * with COMMENTCHAR */ if(!(line[0]==COMMENTCHAR || !(line) || strlen(line)==0)) { #ifdef DEBUG fprintf(stderr,"Scanning line: %s\n",line); #endif aslice=malloc(sizeof(struct slice)); if(!aslice) perror(progname),exit(10); /* scanning the last part * after a tab or space as number */ /* delete trailing tabs and spaces */ r=strlen(line); while(r>0 && (line[r-1]==' ' || line[r-1]=='\t') ) line[r---1]='\0'; /* scan for last tab or space */ s=strrchr(line,' '); t=strrchr(line,'\t'); s=(s>t?s:t); /* which is the last white-space? */ /*use full string,if no whitespace found else copy text up to whitespace and get enough memory */ if(s==NULL) { if(!(aslice->text=malloc(1))) perror(progname),exit(10); aslice->text[0]='\0'; s=line; } else { if(!(aslice->text=malloc(strlen(line)-strlen(s)+1))) perror(progname),exit(10); strncpy(aslice->text,line, strlen(line)-strlen(s)); /*some systems don`t terminate target string in strncpy, so we have to do it */ aslice->text[strlen(line)-strlen(s)]='\0'; } /* scan last string for number */ r=sscanf(s,"%lf",&aslice->value); if(r!=1) fprintf(stderr,"number in line couldn`t be scanned\n"), exit(8); if(*n_slices>=MAX_SLICES) fprintf(stderr,"too many slices\n"),exit(8); aslice->ftext=NULL; /* initialise at least the pointer */ slices[(*n_slices)++]=aslice; } } if(ferror(stdin)) { perror(progname); exit(5); } #ifdef DEBUG fprintf(stderr,"Read %d slices!\n",*n_slices); #endif } [/code] ---------------------------------------------------------------- Subject: usql - from transoft.com Does anybody use this product. Its an ODBC driver for cobol files. ---------------------------------------------------------------- Several years ago I tested this product in a microfocus environment. It looked good but the hoped for business requirement didn't turn up so we didn't actually implement. Hope this helps. Steve ---------------------------------------------------------------- Yes, we do - with MF COBOL though, and we only use it in read-only mode for quick ad-hoc report writing and dipping in via ODBC directly into spreadsheets, etc. Why - what's up? ---------------------------------------------------------------- Sent you a PM. ---------------------------------------------------------------- Problem solved. ---------------------------------------------------------------- Would you mind to post a little bit more about the original problem and the final solution? human ---------------------------------------------------------------- This is terrible of me - I've actually only just re-logged in as a user (rather than browsing as a guest) - and this is over a year later. I'm exceedingly sorry about the delay, and I'm glad you got it sorted. Regards Rob. ---------------------------------------------------------------- That's OK, you can make it up with some promo product :-D ---------------------------------------------------------------- Subject: Report-Writer - Which version and WHY? I have seen a number of notes in this forum about adding Report-Writer support to OpenCOBOL. As "standard-conforming" COBOL RW is really aimed at the "green-bar" fixed font, 1970's type reports, I am sort-of interested in WHY there is an interest in doing this feature - which takes a reasonable amount of development for a diminishing use. Of possible interest is the fact that it is being moved from required to optional in the current COBOL revision. However, if work is being done on it, I am interested in why - and which "dialect" is being worked on. If the desire is to support existing source code that uses it, I would like to point out that the MOST common use of it is from "maintained" IBM OS?VS COBOL programs. That produce provided support for the '68 Standard - with variations - and was never upgraded to '74, - much less '85 or '02 Standards. Micro Focus, Realia, provided support for this dialect - and a third party product "SPC" provided support for it on many platforms with many compilers. If the goal is to provide a "semi-modern" report writer, SPC also provided that as well (handling fonts, odd-/even-pages handling, etc). Whatever work is done on this feature, I would strongly suggest that implmentors look at: [url=http://www.spc-systems.com/tutorial/tutorial_cobrwr9.htm#chap5s02p0]http://www.spc-systems.com/tutorial/tutorial_cobrwr9.htm#chap5s02p0[/url] ---------------------------------------------------------------- Well, I’m curious how one could implement a modern Report Writer for Cobol? Based upon my experience with Report Writers, the results were a fixed mono-font [url=http://en.wikipedia.org/wiki/ASA_carriage_control_characters][u]carriage control[/u][/url] print file. Better still, this carriage control characteristics were only supported on a limited number of printers. However, will the new Report Writer implementations have provisions to create either postscript or PDF files directly? Also, will these RW’s be restricted to fixed font characters? Though, I suppose the Report Writer could utilize on add-on’s to convert ASA print files to PDF. [url=http://home.comcast.net/~urbanjost/CLONE/ASA/asa_carriage_control.html][u]ASA Carriage Control Resources[/u][/url] ---------------------------------------------------------------- On versions; I'm aiming for enough Report Writer to pass muster on Michael Coughlan's lectures at http://www.csis.ul.ie/cobol/lectures/ReportWriterWeb.htm [i]which use some plug-in thingy, I don't have, but the text still works[/i]. Starts at http://www.csis.ul.ie/cobol/lectures/default.htm Good stuff for learning. And enough of a target to say that OpenCOBOL supports 'a Report Writer'. After an initial pass at lines and columns, it could be extended with LaTeX output or some such, STYLE ... PRESENT WHEN ... but now I am talking completely out my rear, it's so far in the future as to be gas. ;) But yeah, the initial goal is basic 'Report Writer', let people assume a lowest common denominator, and beat that by a little bit. I have a copy of the 20xx draft (2009) to use as a guide. Being Open, this COBOL could easily (over the time scale I believe it will be 'around') keep up with features, but it's a different game and needs a different head space, in my humble opinion. COBOL is still very much 'closed in the main'. That's ok. Proprietary COBOL feeds an awful lot of people, puts their kids through school, buys buildings, and ..., well, you know, cranks the cogs of economy. Good economy good. I envision a day, perhaps decades away, where a free COBOL is 'the' 'standard' COBOL, free. Not necessarily good enough ([i]see below[/i]) for say, Big Banks or Governments, but more than good enough to practice, learn, add to the learning base and wisdom. Wisdom not yet overtly shared, at cost of those cogs of economy, which is a good, necessary, regretful price to pay ... so far. The world has many millions of people hours in COBOL coding. Most of it limited to closed circles and small teams. OpenCOBOL offers the world a COBOL to share, and possibly archive highlights of the millions of millions of hours of expertise built into 50 years of large scale systems and running the actual cogs. Not perhaps the details, or secrets, but the strategies, tactics, fumbles, and goals. If the addition of Report Writer prompts someone to dump some wisdom, then, I'm in. [i]Plus it's an itch. My first paid gig in COBOL was report writing.[/i] Cheers, Brian And by the way, when I said not necessarily good enough, what I meant was, it could very well be better but it might not advertise itself as such nor make promises to the people that need the faith around 'closed, secret COBOL' source coded systems that, as mentioned, are part of the cogs. ---------------------------------------------------------------- If you want a GREAT tutorial on what a fully implmented (Standard-conforming) COBOL report-writer can do, I suggest you start at: [url=http://www.spc-systems.com/]http://www.spc-systems.com/[/url] And to to the Tutorial & Reference ---------------------------------------------------------------- Thanks, Bill Just the kind of wisdom I'd like to see kicked around here. :-) Cheers, Brian ---------------------------------------------------------------- Subject: forward: unable to register at www.opencobol.org Hello Federico, as i wanted to register to www.opencobol.org as a new user, i permanently receive the following message: Sorry, we are currently closed for new user registrations Sending a message to administrator needs a registration and gives the same message. I am trying since weeks and it doen't change. I haven't found a public email-adress of the admin yet. Would you be so nice and forward my mail to the admin of www.opencobol.org ? Thank you! Alfred ---------------------------------------------------------------- You need to contact one of the forum moderators and hopefully they can sort it out for you, (Brian, Roger) please help here!!! Vince [quote] federico wrote: Hello as i wanted to register to www.opencobol.org as a new user, i permanently receive the following message: Sorry, we are currently closed for new user registrations Sending a message to administrator needs a registration and gives the same message. I am trying since weeks and it doen't change. I haven't found a public email-adress of the admin yet. Would you be so nice and forward my mail to the admin of www.opencobol.org ? Thank you! Alfred[/quote] ---------------------------------------------------------------- Hello all, We have emails out to Keisuke Nishida, the only one with the admin keys to opencobol.org. No response as of yet. But hopefully this doesn't go on for too many more days. Brian ---------------------------------------------------------------- Bumping. Should be fixed. Got word today. Cheers, Brian ---------------------------------------------------------------- yeah, now i am inside :-) many thanks to everyone! Alfred ---------------------------------------------------------------- welcome here! Federico ---------------------------------------------------------------- Sadly, a flood of spam email to two very busy people put paid to open (then human filtered) registrations. [b]It's closed again. Until further notice.[/b] [i]Sorry[/i] Brian ---------------------------------------------------------------- Could we go to a semi-automated approach where people send their request to someone who would then manually add the new user? I don't think that the volume of new users would be very high. On our end we are not looking for more work, but if us volunteering to do the work would allow new users to come on board we would be willing to give it a try. jimc ---------------------------------------------------------------- This is the message a cobol programmer sent me: "Sorry, we are currently closed for new user registrations" The trouble seems to be returned again.. Can the webmaster help this new user to get enrolled here ? Federico ---------------------------------------------------------------- A message from another cobol user. I upload it completely since he is also asking about opencobol features.. ----Messaggio originale---- Da: GPentelow@fnb.co.za Data: 18/11/2011 13.07 A: <priolof@libero.it> Ogg: OpenCobol registration Hi there Federico We’ve set up a Cobol/Mainframe academy within our organization to cater for our need to get some fresh recruits into the business. There really is no-one doing the kind of training we need down here on the end of deep dark Africa J Because we don’t want a lot of n00bs banging around on our mainframe we were looking at pc-based compilers we could use for training purposes. I’m planning on taking a look at the OpenCobol platform but wanted to make sure I could ask a couple of questions of those who have gone before as it were. Unfortunately cannot register on the side and getting a strange "Sorry, we are currently closed for new user registrations" message and your name came up on a thread relating to the same problem Please could you post some kind of a message on the forum to mods to try get the issue sorted Regards Grant ---------------------------------------------------------------- @grant I do not know why the registration is still blocked. For the time being I would be happy to forward any of your questions and post them on the forum. My e-mail address is jcurrey@aol.com ---------------------------------------------------------------- As a point of clarification, if you sent me a note and indicate that you have been trying to register with the forum, I will assume that I have your permission to post it on the forum. jimc ---------------------------------------------------------------- I'm going to offer up another temporary measure. http://forum.peoplecards.ca Register there and I'll fork over any requested posts until the real new thing happens. That should be soon. Brian ---------------------------------------------------------------- It's really an intermediate solution, but a good one (if EVERYTHING is cross posted and the answers can be found here) - I still hope we get the old forum contents into the ne forum. human ---------------------------------------------------------------- Just a note to confirm that I am signed up on the new forum. Brian, do I understand correctly that you intend to take new posts from this forum and post them on the new one? ---------------------------------------------------------------- Other way round Jim. forum.peoplecards.ca is set up solely as an interim solution to the No new registration problem on opencobol.org I'll (and whomever wants to assist) be pitch-forking the posts made on forum.peoplecards.ca to here. Soon, when a permanent solution is found, there will be an effort started to pitch-fork this entire forum archive to the new system. In short, to everyone reading. Stay here at "home" if you have an account. Anyone that can't get in, register at forum.peoplecards.ca and we'll pitch-fork the posts to opencobol.org on your behalf. This site is still the master. Manual and logistical grief, yes, but better than denying any newcomers, in my humble. We are currently looking to Hosted Forum sites that are nice to open source projects. That is the plan, so that forum administration does not steal time away from the principle developments and spam fighting gets done by pros. Cheers, Brian [b]jcurrey and human[/b] accounts are now set as Founders on the forum.peoplecards.ca phpBB site. Walk softly and carry a big stick. ---------------------------------------------------------------- Subject: DATA RECORD IS - OBSOLETE While it is obsolete it still throws an error when REC-OUT (in the example below) is not the same as the 01 level and not to be found elswhere in the program Should it care? 139 001390 FD IRSOUT 140 001400 BLOCK CONTAINS 10 RECORDS 141 001410 LABEL RECORD IS STANDARD 142 001420 DATA RECORD IS REC-OUT. 143 001430 01 OUT-IRS. cob/misc.cob:142: Error: 'REC-OUT' undefined The manual says DATA RECORD identifiers will be verified as within the program.. but compiler won't care if they are records or not THis is using 1.1 pre-release So just checking no way around this except to edit the source ---------------------------------------------------------------- Yes, I think it should get an error. Even if the feature is obsolete, if you have it in your source code, it MIGHT have been intended to mean something. In such cases, you should follow the correct syntax rules. ---------------------------------------------------------------- Subject: ESDS equivalent in OC with bdb Hi, What is the OC equivalent of ESDS (entry sequential data set) files on mainframe environment. I'm using bdb with OC. ---------------------------------------------------------------- I don't think there is an equivalent in OpenCOBOL (out of the box). At least not if you want to use the Relative Byte Addressing mode. If the access methods are strictly sequential record oriented, then ORGANIZATION IS SEQUENTIAL is about as close as you would get. You MIGHT be able to emulate (at some expense) with some trickery and ORGANIZATION IS RELATIVE with 1 byte 'records' and RELATIVE KEY being a byte offset, but that would get complicated when you wanted sequential record access. OpenCOBOL does provide for [code] ./configure --with-seqra-extfh (OpenCOBOL) Use external SEQ/RAN file handler --with-index-extfh (OpenCOBOL) Use external ISAM file handler [/code] so you could always write up ESDS as an external module and allow a RelByteAddr field and use [b]lseek[/b] internally to get at the byte addressing. [i]Not really related, but an awesome code sample for external MySQL access was posted by jrodrigues[/i] at http://www.opencobol.org/modules/newbb/viewtopic.php?viewmode=flat&topic_id=1268&forum=1 ---- Umm, having said all that ... don't believe me. I'm not experienced enough with all the various OC file system options and it'll be worth waiting for other, more 'in the know' answers. Cheers, Brian ---------------------------------------------------------------- Knowing IBM mainframe environments pretty well, if you use an ESDS file on the iBM mainframe and are using cufrrently supported IBM products, there are only two ways (that I know of) that your COBOL program can access them: 1) Through CICS statements 2) VIA "normal" sequential file statements (that look identical to those used for QSAM files - except for the select/assign statement) If you want a CICS emultor with OpenCOBOL, I don't know of any currently available. If you are using normal sequential organizaiton I/O statements in COBOL, then I don't understand what your issue is. The only other POSSIBLE thing that you might be doing is using the same IDCAMS cluster as a KSDS file and its data protion as ESDS. If that is the case, then you will have problems moving to OC. Can you tell us WHY you want "ESDS" support in OC? What are you dong with the file on the mainframe that you can't do treating it as a "normal" ORGANIZATION SEQUENTIAL file with OC? ---------------------------------------------------------------- Well, when I think of ESDS, I imagine an order entry application where each new read is appended to the end of file. As such, whenever the file is re-open for output, the existing data isn’t overwritten but new records are appended to the end of the existing file. However, in special circumstances, random positioning could occur when the Relative Byte Address (RBA) is specified, of a given record. Though, I don’t believe such technique is directly supported in most Cobol implementations. I suspect, ESDS is better supported with IBM products like IMS, CICS, etc. ---------------------------------------------------------------- Thank you all, I solved the problem with IDCAMS REPRO option to put the data in ESDS to a normal PS dataset. This was downloaded and fed to the OC, it works now. ---------------------------------------------------------------- Subject: Cobol Source Code. I have uploaded the latest source of the Apac accounting, POS, etc to Sourceforge - https://sourceforge.net/projects/apac-accounting/files/. I am hoping that some of you might be interested in getting involved in helping to convert the source to run, using Open Cobol. The current source is Apacsrc15.exe. It is also in the SVN repository. If anyone requires the binaries and demo data, please let me know. ---------------------------------------------------------------- Hi jwl, thank you for your efforts in this project. I personally don't want to use the project or support it directly by coding, but I have some ideas/advices. As I understand the readme at SF, the system currently compiles and runs with OpenCOBOL, but one should not choose USB-Printer, correct? Does the system crash or output a nice message "Print routines not available - Defaulting to LPT."? Sample data is always very useful, therefore if you have some, please upload it, too. For someone wanting to check if the system will work for them a binary (build on OpenCOBOL 1.1 pre-rel Feb09) would be very useful, too. human ---------------------------------------------------------------- Subject: ESDS follow-up (BDAM and EXTEND) (I hate thread drift, so I am doing a new thread as a follow-up to the existing one on ESDS. As I supsected, the OP was not really asking for ESDS support in OC, but just hadn't figured out how to work with existing ESDS files on the IBM mainframe that they were just treated as ORGANIZTION SEQUENTIAL) 1) Use of ESDS so that you can "add on to" an existing file. On the mainframe, you can do this with QSAMfiles by using DISP=MOD. HOWEVER, there is no problem porting this to any conforming COBOL implmentation. Simply use [code] Open Extend [/code] rather than OPEN I/O or Output 2) Does (IBM mainframe) COBOL supprot "random access" of (ESDS) sequential files? No, not with native COBOL syntax. If you [u][i][b]were[/b][/i][/u] interested in such a facility (using "RBA" type procesing), you used to be able to do this with OS/VS COBOL and BDAM files. As neither BDAM nor OS/VS COBOL are supported any more (and all processing should now be done with RRDS files), I can't see this ever being a major concern for OC. If anyone does ever ask OC to suport native COBOL handling of BDAM, I hope it is a very LOW priority for this project. 3) I am (sort-of) surprised that we don't se more requests for OC to work with one of the CICS emulators. I guess this may because I don't know of any that are "open source" although there is zCICS [url=http://share.confex.com/share/117/webprogram/Session9280.html]http://share.confex.com/share/117/webprogram/Session9280.html[/url] which does realte to another "open source COBOL" see (for example) [url=http://proceedings.share.org/client_files/Share_in_Orlando_2/Session_9280_handout_1132_0.pdf]http://proceedings.share.org/client_files/Share_in_Orlando_2/Session_9280_handout_1132_0.pdf[/url] ---------------------------------------------------------------- [quote] wmklein wrote: 3) I am (sort-of) surprised that we don't se more requests for OC to work with one of the CICS emulators. I guess this may because I don't know of any that are "open source" although there is zCICS [/quote] :-? Well, for years, I’ve long for a way of porting CICS applications to PC based GUI applications. Though, I am aware the two technologies are vastly different from another. I was hoping if there was a way finding similarities such as for example, taking an existing CICS mapset and translating the collection of fields into an appropriate windows form. To further build a wrapper GUI/Event framework around the newly translated form. Where as events which are driven around the ‘enter’ key, function keys, etc., would call existing CICS/Cobol code that was imported into the framework. Though, I suppose some of code which does data validation on the input fields could be manually moved into the event driven framework. ---------------------------------------------------------------- Bill, zCICS purpotes many things, however, 1) There is no contact person. 2) They state that the 85 tests are so and so. This is not true. A zero return result of executing a test is NOT an indication that the test was successful. The generated file from the test MUST be inspected to determine this. We, of course, do this. Roger ---------------------------------------------------------------- Subject: Split keys and OC2 I have a question regarding split keys for Indexed files and OC2. I know that 1.1 does not cater for split keys. Will 2 include split keys? Currently I am busy looking into a way of handling split keys as they are used in most of the files that are in the package (APAC accounting ....). If 2 will include them, then I can use my efforts on other parts of the project to make it completely OC compatible. I imagine that the ISAM utilities are able to handle split keys and if so can anyone point me the right direction so that I can possibly write some sort of an interface to handle them. Thanks in advance. I am including a select to illustrate my dilemma. (This example only has two split keys but there are others that have as many as 7 - example 2)[code] SELECT NOT OPTIONAL STOCK ASSIGN DISK LOCK MANUAL WITH LOCK ON MULTIPLE RECORDS STATUS WS-STATUS ACCESS DYNAMIC ORGANIZATION INDEXED RECORD STK-CODE ALTERNATE RECORD STK-ACODE DUPLICATES ALTERNATE RECORD STK-BSEQ = STK-BIN STK-CODE ALTERNATE RECORD STK-LSEQ = STK-LDG STK-CODE ALTERNATE RECORD STK-DKEY DUPLICATES ALTERNATE RECORD STK-DKEY2 DUPLICATES ALTERNATE RECORD STK-XREF DUPLICATES. [/code] Example 2. [code] SELECT CARDEX ASSIGN DISK LOCK MANUAL WITH LOCK ON MULTIPLE RECORDS STATUS WS-STATUS ACCESS DYNAMIC ORGANIZATION INDEXED * * Account Number / Stock Code / Date Sequence * RECORD CRD-KEY * * Stock Code / Account Number Sequence * ALTERNATE RECORD CRD-SKEY = CRD-EXT-CODE CRD-AC DUPLICATES * * Stock Code / Reference (Invoice/Credit Note) Sequence * ALTERNATE RECORD CRD-MKEY = CRD-EXT-CODE CRD-REF DUPLICATES * * Account Number / Date Sequence * ALTERNATE RECORD CRD-AKEY = CRD-AC CRD-DTE DUPLICATES * * Date / Account Number Sequence * ALTERNATE RECORD CRD-DKEY = CRD-DTE CRD-AC DUPLICATES * * Date / Stock Code Sequence * ALTERNATE RECORD CRD-DSKEY = CRD-DTE CRD-EXT-CODE DUPLICATES * * Stock Code / Date Sequence * ALTERNATE RECORD CRD-SDKEY = CRD-EXT-CODE CRD-DTE DUPLICATES * * Sales Person / Date / Stock Code Sequence * ALTERNATE RECORD CRD-SMKEY = CRD-SMAN CRD-DTE CRD-EXT-CODE DUPLICATES. [/code] NB. The assign disk clause has been changed for the version that I am currently busy with. Regards James Lemmon ---------------------------------------------------------------- Hi James, I'm not sure how Roger's (pre-)release plans look like, but I can tell you that CURRENTLY there is no split key support in development sources. Therefore I don't know if they'll come in or not. human BTW: Please use code tags when posting COBOL sources, I've edited your post and inserted them for you (this time). ---------------------------------------------------------------- If there are no split keys, I will look at some other way of handling the files. By the way, have the issues with VB-ISAM been resolved for OC2. I know that for the APAC system I can use the Berkley DB for the evaluation binaries, however if the system is used commercially I presume it should use the VB-ISAM system? James ---------------------------------------------------------------- All issues that both VBISAM and BDB had and that I can remember were solved. Both still don't have a working recovery tool. If I'm not wrong BDB can be used commercially (as it is used for SVN and a lot of other stuff) but only if you ship the source code that BDB is used with (at least OpenCOBOL, maybe all other modules, too) - but I'm not a lawyer. VB-ISAM has some issues with multiple user access. human ---------------------------------------------------------------- Thanks for the info human. The system uses its own recovery so that wont be a problem. I will look into the BDB issue just to clarify the requirements. I will do some testing with VB-ISAM as the multi user side is important. james ---------------------------------------------------------------- Subject: GUICOBOL 1.4 OPENSOURCE available at www.tp-srl.it Hi all, since I used first time opencobol I thought it was a great and powerful product and just to help (I hope I did...) the cobol comunity I wrote the tp-cobol-debugger that I hope someone has tried and used for development. But going ahead I realized the OpenCobol has absolutely need to work also with a gui and just to have some ideas I looked at GTK and other gui library utilities. After some test I decided to use GTK library and I started to project a opencobol gui integrated environment. I opted for the use of object orientation syntax and I wrote some (sucessfull) test. the goal of the produc it giving a wysiwyg editor to write cobol with gui objects. and start with a form giving the programmer the opportunity to paint gui objects and write cobol procedures with the event using a simple grammar. this is an example: [code] IDENTIFICATION DIVISION. PROGRAM-ID. test1. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. copy "global". PROCEDURE DIVISION. invoke gtk-form "Opened" move "test form" to "title" of gtk-form. invoke gtk-form "Closed" using "ExitProcedure" invoke gtk-form "execute". STOP RUN. end program lancio1. identification division. program-id. ExitProcedure data division. working-storage section. 77 formname pic x(100) value space. copy "global". procedure division. move "title" of gtk-form to formaname. display "just leaving" formname. invoke gtk-form "terminate". exit program. end program ExitProcedure. [/code] this example open a form ..just put the "test form" for windows title and when the customer clicked the closed "x" it shows... just leaving and close the windows form. the property are simple accessible using the move and the name into the ". the invoke use the ooc sintax also The environment I am using it running on unix also so I think the product will be used with unix or linux Actually I wrote the class preprocesso and I am becoing to prepare the editor and ide. I would like to open the cobol sources by using a good (and callable) editor able to view the cobol sintax during the editing... I am looking for some opensource products Has someone found one that I could use/try ? Thanks for your attention. Federico ---------------------------------------------------------------- Federico, Nice. Umm, editor? Highly personal, but vim's cobol.vim file, modified a bit for OpenCOBOL, highlights well. You can script vi kinda, using a minus sign as filename. - The file to edit is read from stdin. Commands are read from stderr, which should be a tty. Beauty things again Federico. Cheers, Brian ---------------------------------------------------------------- Finally a savior! Thank you very much Federico. I hate to see how it will work under MSWindows. Thank again ---------------------------------------------------------------- @ALL: Hi first I must thank you to Btiffin before and Ed Brochert after. Btiffin told me about a general solution of a troble with the get_title from a window and Ed helped and explained (with so much patient indeed!) how write a correct way to solve. Since we all are also learning here I would like to share with you how we solved. ----ocgtk wrapper C_EXTERN void *CBL_OC_GTK_WINDOW_GET_TITLE(void *window, void *cobfield, int coblen) { gchar *title = gtk_window_get_title(window); memset(cobfield, ' ', coblen); // clear cobol field memcpy(cobfield, title, strlen(title)); // fill the cobol field with the title } ----cobol call CALL "CBL_OC_GTK_WINDOW_GET_TITLE" using by value gtk-form by reference gtk-text by value length of gtk-int. And now..by talking about the gui generator.. (guicobol seems to be a good name I think) The experimental source can now run with this: [code] IDENTIFICATION DIVISION. PROGRAM-ID. lancio1. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. copy "global". PROCEDURE DIVISION. invoke gtk-form "Opened" move "test form" to "title" of gtk-form. move 400 to "width" of gtk-form. move 500 to "height" of gtk-form. invoke gtk-form "Setsize". invoke gtk-form "Closed" using "uscita" invoke gtk-form "execute". STOP RUN. end program lancio1. identification division. program-id. uscita. data division. ....end so on.. [/code] @:BTiffin I have found the pspad editor that has a nice cobol highlight and in general lots of interesting editing features. Only I don't know if it run on linux systems.. Federico ---------------------------------------------------------------- As usual, you're adding to the party Federico. One note (to all); Please take care with memcpy in C code. We need to keep the security that COBOL working storage is sacrosanct, and won't be changed without source code purposely changing it. [code] memcpy(cobfield, source-thing, strlen(source-thing)); [/code] can be a writer across working store for long strlens (anything longer than the cobfield PICTURE). Data dependent strlens that may not show up after months and months of testing. Far better to limit the cpy with a conditional ?: digraph (or strncpy, etc) that limits the destination length of ANY and ALL writes. That's really the reason for the coblen argument; both for the space fill, but more importantly to limit C code from ever exceeding destination sizes. [i]If we ever get any C code into the /extras folder, it WILL be peer audited for possible memory (over)writers.[/i] Now after being all school-masterey, [i]and please don't take anything above as a personal disrespect Federico[/i], only a warning regarding any advice I fling around here. A LOT of my how-to's are riddled with possible writers, for expediency. Just have to be careful to inform people that "real" code needs fencing. And to be honest, COBOL deserves more. ;) There is code in ocgtk.c that squirrels into the cobmodule space and hunts for the arguments as actual cob_field definitions (these are the structures used by OpenCOBOL), and the length is one of the datums tracked for nearly all COBOL variables. But alas, I've not found the 'safe' tricks to access these structures without cheating and going into the compilers private C definitions. ocgtk.c is actually broken on newer OC builds beyond the ubiquitous 1.1pre-rel from Feb 2009. So I haven't fixed it yet, and won't until we see the next stable build of OC. I'd like to promise to write up an article about the ins and outs of [b]cob_field[/b] and what we as developers get as a public interface when [b]#including <libcob.h>[/b], but can't promise, but will try. Cheers, Brian ---------------------------------------------------------------- Hi Brian, you right. The C procedure could be fault I forgot to put the cobol picure gtk-text that is pic x(8192) and to "protect" the working storage this could be a valid update (thanks to Ed. ;-) C_EXTERN void *CBL_OC_GTK_WINDOW_GET_TITLE(void *window, void *cobfield, int coblen) { gchar *title = gtk_window_get_title(window); int i = strlen(title); if i > coblen || ! i) i = coblen; memset(cobfield, ' ', coblen); // clear cobol field memcpy(cobfield, title,i); // fill the cobol field with the title } the promise you would like to do about the article could be very useful I think... Thanks again for your advices Federico ---------------------------------------------------------------- Well, just curious, is there a conceptual write-up of this GUICOBOL package for OPENCOBOL? :-( As what I can tell from the examples, the Cobol module loads and sets various properties the sample form. Then assigns the reference of a Cobol Module to a predefined event (Close) on the form. However, as for handling of individual components of the form, such as text boxes, etc., can I assume that with the use of the “invoke” statement, would be used to establish references to specified Cobol procedures? Speaking of which, would OC implement the invoke statement for objects in general or just for this GUI package? Also, with the “move” statement, would this be new implemented feature to reference properties in addition to identifies (as specified on the right side of the “TO”)? [quote] [code] move "test form" to "title" of gtk-form. [/code] [/quote] As first glance, it appears that the property reference "title" looks like another string literal. I would have thought the reference to the above property would have been defined in the Repository Paragraph. [code] PROPERTY property-name-1 [ AS literal-5 ] [/code] ... [code] move "test form" to property-name-1 of gtk-form. [/code] Also for editing the sample form itself, would this have been in a WYSIWYG manor? Or there have been some (somewhat sweet) form definition language? Not to be critical or anything like that, I was just curious. ---------------------------------------------------------------- Hi Marcus just to explain the work of this experimental tool I will try to give you the information you asked for. Actually opencobol doesn't support (yet) the object orientation. Personally I think this is a lack (does absence explain the same ?). Giving to cobol the object orientation would add it no only 1 more but 1000 thousand power I believe so.. Told this.. since it doesn't allow this I am project the tool by using a preprocessor who translate the cobol oo orientation (JUST ONLY FOR THIS GUI) and write the equivalent ansi85. I am using a method like that I used for writing the animator (tp-cobol-debugger) that I am continuing (when possible!!) to update. For the guicobol actually I am trying solving all troubles I have found and I am going ahead with the project planning to use write cobol inside graphical object with the same method of a visual basic (for example) putting the sintax very similar to cobol. So the move statements will use static definitions just to let the prepocessor to understand what is cobol and what not. the Invoke statement also is pre-processed by the guicobol with the same rule. And also because it could be compatible with fujitsu object cobol, icobol and visual cobol. the guicobol I am working on let you to design the form and the initial instruction to create and prepare the environment won't be accessible to the user. I will try to explain better (better using my bad english) the programmer will design the initial values inside a probject wysiwyg saved in cobol or xml file (or both) designing the text and static and list objects with the event procedures connected them. all using only this cobol and it's "orientation" :-) since a probject will be able to manage a form it will be automatic opened. At this moment this is an experimental work. Going ahead is use lot of free time (that I cannot spend now) but I am planning to use opencobol for the future for professional uses but since it hasn't got the debug and the gui I simple thought.. I must build one if I want to use it. You know that (for example) the debugger is really to a basic version (not so advanced yet) but at least it helped me to solve other troubles with my daily job and it has convinced me that opencobol offers a very robust compiler. Federico ---------------------------------------------------------------- The guicobol is going ahead.. I recorded a simple video to show how is it (timidly.. :-P ) runnining.... Obviously just an experimental video.. You all see the sample by visiting the site of the animator (just after the cobol debugger article) Federico ---------------------------------------------------------------- Hi Federico. Your site - www.tp-srl.it - is only in italian ... Or so I have not seen how the English have ... Am I wrong ? Cordially. ---------------------------------------------------------------- You're right. Meantime I added an Experimental Guicobol menu at the main page so you all can find it quickly. I am going to put and english guide for explain better the experimental tool Federico ---------------------------------------------------------------- Thank You Federico. Do you think this will be easy to transpose/use this graphical environment under MS Windows ? Can we help you in any way? Cordially. René Aouizerate ---------------------------------------------------------------- Actually the experimental tool is RUNNING by using GTK libraries that are availabe for both linux and windows environments. I am writing this experimental using Ms Windows Federico ---------------------------------------------------------------- The experimental tools is going ahead... I added some new features and I have uploaded the article with red lines to enphasize the latest syntax... this is still a pre-pre-pre alpha ..so nothing more than an experimental tool..like i titled it.. however I will add the gui object orientation into the debugger to use it for test also. The article at www.tp-srl.it (see the eXperimental guicobol link) contains also the comment field where you could write some advices (or just reply this on here...). Federico ---------------------------------------------------------------- Federico, It's a very interesting idea to create a GUICobol using GTK. Concerning an editor, did you ever try jEdit (www.jedit.org). It is a great editor running under Linux and Windows and Mac. In fact, it's written in java. It has a syntax highlighting for cobol and many plugins. Regards, Alain ---------------------------------------------------------------- Thanks a lot for the editor you suggested. I tried it and it seems to be a valid stuff for the gui. I also tried vi and pspad. However I will set a guicobol.inf file where one can decide to use own editor with a line like: editor=c:\program\jedit\jedit.exe. Federico ---------------------------------------------------------------- The experimental tool is going ahead... since I started I added lot of new gui objects and I improved the syntax grammar. the tools can manage: move "text" of edit to "title" of gtk-form for example.... but I am thinking that could be useful have a conditional way to manage the object. I added the check box object and I am working for the if "value" of check = GTK-ON where gtk-on is a boolean valute to check the state but in generale also one could write: if "text" of edit = spaces However the big troubles are: the free time.... :-P a good way to manage of multiply windows form invoke Do you know opensource programs that uses gtk to check the better way for that ? Federico ---------------------------------------------------------------- Hi all I upload a new simple video to show how is it runnining with more object and event... also I added a pdf file contains the source of the video... ..too hard chaning the colour source at cms level.. You all see the sample by visiting the site of the animator at www.tp-srl.it on the left side you can click on the Experimental Guicobol. Federico ---------------------------------------------------------------- Well, when you have a look at [url=http://www.gtk.org][color=FF9900]www.gtk.org[/color][/url], you find interesting links. The first is [url=http://glade.gnome.org]Glade[/url] which helps builing the interface. If Cobol could benefit from Glade, it would be a complete environment for developping GUI applications. The second is [url=http://www.gtk-apps.org][color=FF9900]Gtk-apps[/color][/url] wher you may find hundreds of applications written with GTK, including source code. Regards, Alain ---------------------------------------------------------------- http://gtk-apps.org/ looks interesting. About glade. I knew it and I used it just to create some windows to... The gtkcobol tools is a little bit different. And maybe this is not necessary the best (or at lest) a valid solution. However I am planning to give the opportunity to design (like glade) a form moving the object to the specific position but allowing the programmer to write the cobol necessary to manage the events and gui. So the programmer must know only cobol. No other skill is required. the ide will compile and use the animator (for debugging mode). perhaps a too ambitious project... :-) Right now the I must solve some about the multiply opened form..this is a trouble since I must understand better how I can manage them on gtk. About the rest.. I added to the tools already many property but I understand that he'll required hundreds of them before give the opportunity to work with it. I will continue to write here the result of the test I am doing. thanks for your feedback Federico ---------------------------------------------------------------- Some time in the past (may be 95 or 98) a spanish software house wrote a Cobol compiler using Delphi. Some years ago I tried to locate the owner of such piece of code but haven't luck. May be now we could locate this piece of sw and use as basis for OpenCobol GUI but instead of using VCL using Lazarus's LCL. What you think? Regards. ---------------------------------------------------------------- The guicobol use a preprocessor that "simulating" the object orientation create a cobol source that contains the call activity and move to get /set variables. In general this could be done by wrapping other functions (the gui has always the same rules...+/-). If you can put here an example of the opencobol and lazarus' wrapper I could study it also. Actually this is an eXperimental tool. Growing up but always a "test". When I will have finish to create objects and forms I will build (with them) to gui manager itself. The project has an interface. it doesn't know what there is to the other side. Federico. ---------------------------------------------------------------- Hi all, this note just to write about the status of the experimental tool. the trouble with multiply opened forms was solved (at least for the test version). Guicobol can now manage some new functions and properties the modal property to define a form modal or not and then i planned two methods to manage them: invoke self "openform" using "testdll" (the new windows is not modal) invoke self "callform" using "testdll" (the new windows is modal) I need to build a more robust method to manage the instance and parents object (I tried to check them using some gtk methods like [code] C_EXTERN GtkWidget *CBL_OC_GTK_WIDGET_GET_TOPLEVEL(void *widget) { return (GtkWidget*) gtk_widget_get_toplevel(widget); } [/code] but gtk doesn't want to return any good value and it issuing a message to inform that the instanced widget return FALSE at when the internal GTK_IS_WIDGET is done. @btiffin: Brian do you have any idea about this ? I could try to write a cobol temporary file where put the actual STACK of the opened forms.. but this is really a worse way to get the information. @all: advices are welcome The next article written on the site of mine (www.tp-srl.it) at Experimental Guicobol will contain the list of available property and functions. Federico ---------------------------------------------------------------- Federico; It looks from here like that should work. Can you share the CALL code? It might be a reference/dereference issue. Cheers, Brian ---------------------------------------------------------------- You're right Brian the C code is right. I did the call statement invoking it without "by value". this is the correct way to do the call. CALL "CBL_OC_GTK_WIDGET_GET_TOPLEVEL" using by value gtk-form returning this-form. and now the guicobol manage correctly this: move "parent" of selt to this-form ;-) thanks again Federico ---------------------------------------------------------------- Glad to help Federico. You really are adding to the party. Good stuffs. Lots and lots of good stuff. Cheers, Brian ---------------------------------------------------------------- Thanks Brian for you help. @all: I added some polls at the eXperimental guicobol menu (left side) at: www.tp-srl.it please I would like to get your (All) opinion. Please use the polls options there. experimental .... opencobol and cobol in general. also to decide....is the cobol dead ;-) ?? I would like to add other ... if you have any suggestion please let me know. Thanks in advance. Federico ---------------------------------------------------------------- Hi All, I have uploaded the article with latest pdf and the video about the experimental tool (don't forget to clear the cache to get the lastest!). The video shows the combo field and you can find into the latest pdf file the source of the program. The tools can also manage several invoked windows... I must still add the table...the frame .. the color, the fonts...add lots of methods.. only other 100 things to do then...at least....:-S before stop the "eXperiment" and declare it for beta-release... but since it's running fine I will upload the article at least to inform you all about the news. PS. please don't forget to give your opinion by using the polls located in the eXperimental page... thanks. www.tp-srl.it Regards Federico ---------------------------------------------------------------- This just to inform you all about the progress of the experimental tool. It can now manage the frame object also. As usual you can find the new informations reading them inside the article at: www.tp-srl.it And please don't forget to add your opinion at the poll and let me know your advices about the project using the comments features available at the page. Federico ---------------------------------------------------------------- I added the radio buttons at the gui experimental. Look at the site to read the update to the article. Next step will be manage the colours and the font of the gui objects. However the project is going ahead, not so mature but I am evaluating to open a project on sourceforge (like the debugger) with a pre-pre release as soon as it will manage colours. the goal is manage the gui with a wysiwyg ide (like glade) but integrated with the compiler where one can simple choice the object painting it on the form and manage it properties...or building the project writing the "api" (like have seen in the pdf file). however using only cobol. Federico ---------------------------------------------------------------- Hi all, I added a "basic" color property to the experimental tool. I have reorganized the article by (I hope) moving more information. Unfortunately writing the documentation is sometimes more important that writing the software since without first ( especially for one opensource probject) it's almost impossible to understand or try for a test (not for "use" in this case !) the probject. However I am almost arrived to finish the experimental. It must manage the font and other property that could be useful. In future I would like to add other objects.. notepad and other interesting widget that GTK libraries have. Just to ask..there are some voluntary interested to start a test of a windows binary ? Federico ---------------------------------------------------------------- I will be happy to do some testing on Windows binary. ---------------------------------------------------------------- Hi Federico. Yes Yes and Yes I will be happy to help by testing this project under MSWindows Thank you very much ---------------------------------------------------------------- Hi all, thanks for your help. You can just download the binary test package accessing with a recorded user. at www.tp-srl.it Thanks for your support Federico ---------------------------------------------------------------- Federico Bravo! I installed all without too much difficulty. 3 directories, OC, GTK and GUICOBOL on disk D: I like what I get on my screen. I'll try to find time to go further by exploring your source program GUITEST.CBL, but I am already very happy. Once again congratulations. Sincerely, René Aouizerate. ---------------------------------------------------------------- Thank you so much for your support. Just to inform you (and others eventually interested to this project) since the experimental is going ahead I just fixed: the guicobol.inf removing some "." inside added other method, properties and events for setfocus gotfocus and lostfocus, name of the widgets, tooltip help for them and other... upload the article at www.tp-srl.it fixed the string format adding to the value the asciiZ type (a C string must contains \0 at the end) this is because the edit values showed seemed contains strange value (see the video also) not yet upload the next release 0.1.1 that however I will upload as soon as received also your (all?) feedback. If there are other with ubuntu interested in try the build, in this case I could try to upload with next release also the appropriate wrapper so other could be interested in try it..... let me know if need. Thanks again Federico ---------------------------------------------------------------- Hi all, I have upload the article about the guicobol adding new properties. Every new features is added with the // available since 0.1.1 version I added the "font" that seems to be very powerfull indeed. To change a font type and size one can simple move move "arial italic 28" to "font" of label1 or for, for example move "Arial italic bold 16" to "font" of label2. pango library is really great ! Since nobody asked me about the ubuntu pakage and the free time of mine is really short I am going ahead with the windows package that will be available next month with several examples code (one for every objects) otherwise it's becoming to be hard explain all in one... Federico ---------------------------------------------------------------- Hi Federico. I must not be very good! How to get version 0.1.1 ? I start trying "guicobol", it is very nice. I hate to see how work the numeric pad of may keyboard ... (in text mode - without guicobol - the is a problem with ncurses ???) Thank you for everything, especially do not stop! Cordially René ---------------------------------------------------------------- The 0.1.1 version is just available.. always as recorded user at www.tp-srl.it So many things to do... prepare some simple source DEMO. The guisample is full of new features.. but without a logic..just moved them to show how they can run.. but unfortunately I won't be able to spend any time next weeks for the experimental.. Please let me know about the troubles. Don't forget to read the www.tp-srl.it manual to get information about the latest features added. I tried to get it uploaded at every change I made. I must write other 10/15 method before start to write the project to use a wysiwyg framework.. Regards Federico ---------------------------------------------------------------- Hi all I added some to manage the mouse click event (gtk can give you the control about GDK_BUTTON_PRESS, GDK_2BUTTON_PRESS, GDK_3BUTTON_PRESS, and GDK_BUTTON_RELEASE). The experimental is going ahead I am just writing a new invoke method to move the object using a new word "drag" then for example writing: invoke edit "drag" it should give you the opportunity, at runtime, to move the widget you create at the mouse position. This seems to be the fast way to create a wysiwyg gui editor. After you could choice from a list the methods and the properties you can use with it.. this could be a scenario for the work. I am looking at the Gtkapps site to find some C source to avoid to re-do from start one... Federico ---------------------------------------------------------------- The few that I tested on MS Windows 32 works fine. I must now go further in my learning how to program the user-machine dialogue in this mode (by remplacing ACCEPT/DISPLAY). But already I sincerely thank Federico for this work that I did not know, myself, do. Thank you again for this breakthrough. I will provide my first interactive program as soon as possible, knowing that it will not implement all functions. Cordially. ---------------------------------------------------------------- Hi All, the guicobol project has been moved to opensource and available at www.tp-srl.it (from sourceforge.net) I added a folder where you can find sample code for it. the first sample label1.cbl show how manage a label The guitest.cbl has several example (without a logic indeed... .-) but just to show how a method or invoke must be managed. I am working to prepare the drag features and many others... I would like received some test source to add to the project. the video, manuals and pdf sample are available at www.tp-srl.it guicobol page Federico ---------------------------------------------------------------- Thank you Federico. The accents are well managed in this version. What changes! How rich! What choices! The first small programs come ... But it takes a hell of learning, to pass from the character to the pixel! Cordially. René ---------------------------------------------------------------- Happy holidays for you all. Federico ---------------------------------------------------------------- Hi all, the next 1.4 release IS AVAILABLE I also added a sample written with the new version This the version can manage xml file written by using the WYSIWYG GUI glade. (http://glade.gnome.org) Here the example uploaded at sourceforge guicobol project site. As usual the document page at www.tp-srl.it contains the new available methods and objects... The guicobol has new object and method to load a xml you can simple do: 1) write your form using glade (that is a WYSIWYG RAD editor!) 2) load it from guicobol with the appropriate method 3) add method with guicobol way.. the experimental is going ahead... Federico [code] IDENTIFICATION DIVISION. PROGRAM-ID. guixml. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 button usage pointer external. copy "global". PROCEDURE DIVISION. invoke pow-self "loadgui" using "test.xml" returning gtk-builder. invoke gtk-builder "getobject" using "main-window" returning gtk-form. invoke gtk-builder "getobject" using "botton" returning button. 000940 invoke button "clicked" using "click" 000920 invoke gtk-form "Closed" using "exitForm" 001020 invoke gtk-form "showform" 001040 invoke gtk-form "runform". end program guixml. 001380 identification division. 001390 program-id. click. 001400 data division. 001410 working-storage section. 001450 001460 01 edit usage pointer external. 001500 001510 copy "global". 001530 001540 linkage section. 001550 01 gtk-window usage pointer. 001560 01 gtk-data usage pointer. 001570 001580 procedure division using by value gtk-window by value gtk-data. invoke gtk-builder "getobject" using "entry" returning edit. 001590 001600 move "text" of edit to "title" of gtk-form. 001610 001680 exit program. 001690 end program click. 001120 identification division. 001130 program-id. exitForm. 001140 data division. 001150 working-storage section. 001230 copy "global". 001250 001260 procedure division. 001270 001330 invoke gtk-form "closeform". invoke gkt-form "stoprun". 001340 001350 exit program. 001360 end program exitForm. [/code] and there the test.xml (written by using glade) [code] <?xml version="1.0"?> <interface> <requires lib="gtk+" version="2.16"/> <!-- interface-naming-policy project-wide --> <object class="GtkWindow" id="main-window"> <property name="width_request">600</property> <property name="height_request">300</property> <child> <object class="GtkFixed" id="fixed1"> <property name="visible">True</property> <child> <object class="GtkLabel" id="label1"> <property name="width_request">105</property> <property name="height_request">20</property> <property name="visible">True</property> <property name="label" translatable="yes">Window's Title </property> </object> <packing> <property name="x">31</property> <property name="y">44</property> </packing> </child> <child> <object class="GtkToggleButton" id="botton"> <property name="label" translatable="yes">Title assign</property> <property name="width_request">110</property> <property name="height_request">36</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> </object> <packing> <property name="x">20</property> <property name="y">193</property> </packing> </child> <child> <object class="GtkEntry" id="entry"> <property name="width_request">186</property> <property name="height_request">20</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">●</property> </object> <packing> <property name="x">150</property> <property name="y">43</property> </packing> </child> </object> </child> </object> </interface> [/code] [img align=left]http://www.tp-srl.it/federico/animator/GUIXML.JPG[/img] ---------------------------------------------------------------- Another interesting mini-guide to use PSPAD EDITOR. http://askywhale.com/howtos/opencobol/ Federico ---------------------------------------------------------------- Subject: How does one get the external name of a file? Can anyone tell me how to get the [u][b]external[/b][/u] file-name of a file opened in an OpenCobol app? OpenCobol resolves the internal name for a file opened in a COBOL app to an external name by a series of discovery steps: [code] # If yes, file names are resolved at run time using environment variables. # For example, given ASSIGN TO "DATAFILE", the actual file name will be # 1. the value of environment variable `DD_DATAFILE' or # 2. the value of environment variable `dd_DATAFILE' or # 3. the value of environment variable `DATAFILE' or # 4. the literal "DATAFILE" # If no, the value of the assign clause is the file name. [/code] Now suppose we want to copy, delete, rename using a CALL procedure. These require the external pathed name. Is there a convenient way to get the external name of the file that OpenCobol actually resolved it to? Thanks for any help. ---------------------------------------------------------------- This could help: You can get values of environment variables by using ACCEPT. see in "OpenCobol 1.1. - Programmer's Guide": "6.4.3. ACCEPT Format 3 – Retrieve Environment Variable Values" [code]ACCEPT FIELD1 FROM ENVIRONMENT 'DATAFILE'[/code] ati ---------------------------------------------------------------- Thanks for your help. Reading environmental variables doesn't solve the problem because that implies each programmer will have to write a (library) routine that exactly mimicked the code that OpenCobol uses to determine the external file-name. There is no guarantee that OpenCobol will not add to or take away from their algorithm at some future date, leaving any externall implementation dangerously/confusingly out of step. Obviously the OpenCobol run-time has the final external name of the file: why doesn't it make this available to the COBOL programmer (like some other COBOL compilers)? ---------------------------------------------------------------- [quote] JoeRobbins wrote: Obviously the OpenCobol run-time has the final external name of the file: why doesn't it make this available to the COBOL programmer (like some other COBOL compilers)? [/quote] Simply because no one needed it that way. You're free to write a patch for example a new stock library C$FULLNAME (the ACU-routine for the feature you've asked for) and/or the functions of the the other vendors. If you need it and don't want to add something to the compiler, write a sub program that accepts all the environment vars in the correct order (and add the current directory - see CBL_GET_CURRENT_DIR - if necessary). You're invited to publish that program here (if possible under GPL). human BTW: The way how OC determines the file name did not change for years and is likely to not change. ---------------------------------------------------------------- Thanks human - at least I now know categorically this facility is not available. We are currently porting COBOL apps from Microfocus and have been impressed by OpenCobol. As soon as I get some time I'll take at look at the OpenCobol compiler source (to get the definitive steps) and respond to your suggestion. Thanks again! P.S. For 12 years we never found a way to get external file-names from the MicroFocus compiler! ---------------------------------------------------------------- Micro Focus [u][i][b]DOES[/b][/i][/u] allow you to get this information. If you use the FCDREG compiler directive. You follow the FH--FCD, use the XFHFCD.CPY copy book and folow the address to the "filename area". (Check the MF documentation for all of this - for your specific compiler). The reason that I mention this, is that it would be a "nice to have" if OC had an FCDREG compiler directive and a FH--FCD special register. I could be wrong, but I would think that this would be medium-easy to do AND would help n porting some existing MF applicaitons. ---------------------------------------------------------------- Look to [b]libcob/fileio.c[/b] [i]cob_chk_file_mapping[/i] for clues ... but I'm pretty sure that's compiler private, so we might have to squirrel in and provide access to a f.fullname cobfile field somehow, probably in libcob/fileio.c [i]cob_fd_file_open[/i]? Or ask Roger all nicey nice for a C$FULLNAME system def? Nicey nice? :-) Cheers, Brian ---------------------------------------------------------------- Subject: cobc infile.cbl -E -o outfile Hello, the command cobc with option -E preprocesses the copy-commands of a cobol-file. It blanks the comment-lines in the outfile, too :-( Is there a method to preprocess the copy-sources and to keep the comment-lines in this outfile? My cobc-Versions: cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Jun 17 2011 00:06:14 Packaged Feb 06 2009 10:30:55 CET thanks in advance Alfred 8-) ---------------------------------------------------------------- There isn't a switch like that with version 1.1. BTW: -E changes the format to FREE format, too. human ---------------------------------------------------------------- Look to http://svn.wp0.org/add1/tools/cobxref/ Vince's cobc xref is awesome. It's on sourceforge as well, which might be more up to date. Cheers, Brian ---------------------------------------------------------------- Hello Brian, the problem with the compacted outfile of "cobc -E" goes deeper... let me decribe the problem in new posting. Alfred ---------------------------------------------------------------- Subject: simple preprocessed copyfiles needed Hello, two threads, the same problem... perhaps anybody knows the best solution? Thread 1: ========= Federicco's debugger can't display sources, which lay in copyfiles. I've mailed with Federico about this problem and he asked me to start a discussion about a possible solution. The problem: The debugger instrumentizes only the source-lines in the main-cobol-file. The lines outside of this main-file don't get instrumentized. The result: the un-instrumentized code-blocks not shown, but running "in the dark". Solution 1 (my favourite) We need the preprocessed cbl-file as debugger-input. This file contents: all copybooks processed all comment-lines stay originally inside all indents stay originally inside I think, cobc could do the job at best, isn't it? Solution 2 (no, not my favourite) Surely we can create a 150%-compatible-code COPY-processing like the actual cobc... but if a little bit changes in the future within cobc, the result of the debugger could be very ugly. The minimal way would be a standard-subroutine of cobc, which allocates and fetches all the copyfiles together. Thread 2: ========= I've searched a precompiler (embedded sql) for postgres, but i didn't found one. Only a commercial program of cobol-it; but i have never seen, tried and buyed this program. For developing a free postgres-precompiler which works with simple EXEC SQL ... END-EXEC i need the preprocessed sourcelines with all commentlines, the indented lines and so on. My solution bases on the use of ecpg, a precompiler for postgres and C. To resolve the copyfiles i would prefer to use cobc with a nice parameter. In fact the same problem like Thread 1. thanks Alfred ---------------------------------------------------------------- My view is that we can have a short term solution now while Roger works on the issues that he feels may be more important. We wanted a better listing facility (comments and copybooks needed to be included) so we wrote a simple program that reads the source code, includes the copybooks, and numbers the lines to correspond with compiler error messages. The result is a nice source listing. Could we not create a program to read the source file, include the copybooks, comment out the copy statement, and create an intermediate file that one would then compile for use with the debugger? Most of us want these things integrated within the compiler, but joint development of the compiler does not seem to be available at this point. jimc ---------------------------------------------------------------- Excerpt from COBOL standard - [quote]6.4 Logical conversion Source text and library text in fixed-form reference format are logically converted to free-form reference format before the application of replacing and conditional compilation actions. Continued and continuation lines in fixed format and in free format are concatenated to remove continuation indicators, and comments and blank lines are removed from both formats. There is no restriction on the maximum line length of the free-format text resulting from logical conversion. NOTE Fixed-form reference format is logically converted during compilation to free-form to simplify understanding of other rules of the language, for example, the COPY statement with the REPLACING phrase and the REPLACE statement. No implementor is required to perform an actual conversion as long as the effect is as though it were performed. The rules of reference format and text manipulation apply regardless of whether there is or is not an actual conversion. The rules of logical conversion are applied to each line of a compilation group in the order that lines of source text and library text are obtained by the compiler. Lines are examined sequentially beginning with the first line of the compilation group and continuing until the end of the compilation group is reached. The resultant logically converted compilation group is created in free-form reference format as follows: 1) If the line is a SOURCE FORMAT directive, the reference format mode is determined and the SOURCE FORMAT directive line is logically discarded. 2) If the line is a comment line or a blank line, that line is logically discarded. 3) If the line contains an inline comment, the inline comment is replaced by space[/quote] Roger ---------------------------------------------------------------- Thank you Roger for this excerpt, which was totally new for me. Therefore we have two sides: the first (the standard and the current implementation in OpenCOBOL) that has the compiler view and another one with the view of the user that want's to see what the compiler has done - but in a readable way. I guess the only way within cobc would be a second run only for generating the list file (prefered one per COBOL source, therefore possibly more than one for a compilation group). @Roger: Is this correct? Would you consider providing such an interface? Would you prefer an external program that could be called with cobc after compilation (like cobxref)? @Jim: It would be nice if you could post your program as free software so we all are able to test/use use it. If it can be put to GPL it could be used and even shipped within the debugger (keep in mind that it's designed to work with other vendors, too and therefore should not use cobc for a preprocessing). human ---------------------------------------------------------------- I am posting the "prtcbl" program at human's request. This program gives us a complete listing with line numbers that correspond to the compiler error message line numbers. Please note: 1) This was one of the first openCOBOL programs that we wrote. We were more concerned with functionality than with style. 2) I am not a structured programming guy :-) 3) I know the code will be ugly to some of you 4) The copybooks must be placed either in your current directory or another very specific directory. Someone could change the code to handle variable directories. 5) The PCL is simply used to format the page, it is in a fixed directory that you could easily change. I am publishing the code and am granting permission to make it GPL. If someone wants to change it my feelings will not be hurt. If you don't like it, don't use it :-) [code] IDENTIFICATION DIVISION. PROGRAM-ID. PRTCBL. *AUTHOR. J C CURREY. ************************************************************ * PRINTS A COBOL SOURCE FILE WITH IT'S COPY BOOKS * * * * VERSION 001--ORIGINAL VERSION * * 3/26/2009--J C CURREY * * * * 002--ADDS .CPY (CAPS) IF .cpy FAILS TO FIND * * FILE AND EXPANDS INPUT TO 132 CHARACTERS* * 4/09/2009--J C CURREY * * * * 003--ADDS NOLIST AND LIST SUPPORT (NOTE NOT * * SUPPORTED BY OPENCOBOL COMPILER) * * **NOLIST IN COL 7-14 TURNS OFF LISTING * * **LIST IN COL 7-12 TURNS ON LISTING * * 4/22/2009--J C CURREY * * * * 004--ADDS SUPPORT FOR /testing-set-1/copybooks * * Copybooks are searched for first in the * * local directory and if not found, then in * * /testing-set-1/copybooks * * 5/7/2009--J C CURREY * * * * 005--CORRECTS MISSING LINE ISSUE ON PAGE BREAKS* * IN THE COPY FILE PRINTING SECTION. * * 1285451--SANDY DOSS * * 06/19/2009--JEREMY MONTOYA * * * * 006--USES EXTERNAL PCL CODE FILE TO INSERT PCL * * CODE INTO PRINT FILE FOR FORMATTING. * * 1330505--JIM CURREY * * 12/14/2009--PETE MCTHOMPSON * ************************************************************ ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. 121409 SELECT FORMAT-FILE ASSIGN TO WS-NAME-FORMAT-FILE 121409 ORGANIZATION IS LINE SEQUENTIAL. SELECT PRINT-FILE ASSIGN TO WS-NAME-PRINT-FILE ORGANIZATION IS LINE SEQUENTIAL. SELECT INPUT-FILE ASSIGN TO WS-NAME-INPUT-FILE ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-INPUT-FILE-STATUS. SELECT COPY-FILE ASSIGN TO WS-NAME-COPY-FILE ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-COPY-FILE-STATUS. DATA DIVISION. FILE SECTION. * FD PRINT-FILE. 121409 01 FORMAT-LINE PIC X(140). 01 PRINT-LINE. 05 OR-LINE-NUMBER PIC Z(6). 05 OR-FILLER-1 PIC XX. 05 OR-TEXT PIC X(132). 121409* 121409 FD FORMAT-FILE. 121409 01 FORMAT-RECORD PIC X(140). * FD INPUT-FILE. 01 INPUT-RECORD. 05 IR-BUFFER PIC X(132). FD COPY-FILE. 01 COPY-RECORD. 05 CR-BUFFER PIC X(132). **NOLIST * THIS IS ANOTHER LINE **LIST * WORKING-STORAGE SECTION. **************************************************** * CONSTANTS, COUNTERS AND WORK AREAS * **************************************************** 01 WS-NAME-PROGRAM PIC X(12) VALUE 121409 "prtcbl 006". 01 WS-NO-PARAGRAPH PIC S9(4) COMP. 01 WS-I PIC S9(4) COMP. 01 WS-J PIC S9(4) COMP. 01 WS-K PIC S9(4) COMP. 01 WS-NAME-PRINT-FILE PIC X(64) VALUE SPACES. 01 WS-NAME-INPUT-FILE PIC X(64) VALUE SPACES. 01 WS-INPUT-FILE-STATUS PIC XX VALUE "00". 050709 01 WS-NAME-COPY-FILE PIC X(128) VALUE SPACES. 050709 01 WS-HOLD-NAME-COPY-FILE PIC X(128) VALUE SPACES. 121409 01 WS-NAME-FORMAT-FILE PIC X(128) VALUE SPACES. 01 WS-COPY-FILE-STATUS PIC XX VALUE "00". 01 WS-LINE-PRINTER-NAME PIC X(16) VALUE SPACES. 01 WS-LINE-NUMBER PIC S9(6) COMP VALUE ZERO. 01 WS-PAGE-LINE-COUNTER PIC S9(4) COMP VALUE 999. 01 WS-PAGE-NUMBER PIC S9(4) COMP VALUE ZERO. 01 WS-PRINT-COMMAND PIC X(128). * 01 WS-ESCAPE-CHARACTER PIC X VALUE X"1B". * 01 WS-HEADING-LINE PIC X(132). 01 WS-CURRENT-DATE PIC X(21). 01 WS-ED4S PIC ZZZZ-. 042209 01 WS-SWITCH-PRINT PIC X VALUE SPACE. **************************************************************** * PROCEDURE DIVISION * **************************************************************** PROCEDURE DIVISION. 0000-MAIN SECTION. PERFORM 1000-INITIALIZATION THRU 1990-EXIT. PERFORM 2000-PROCESS THRU 2990-EXIT. PERFORM 9000-END-OF-PROGRAM THRU 9990-EXIT. STOP RUN. **************************************************************** * INITIALIZATION * **************************************************************** 1000-INITIALIZATION. MOVE 1000 TO WS-NO-PARAGRAPH. DISPLAY "I) ", WS-NAME-PROGRAM, " BEGINNING AT--" FUNCTION CURRENT-DATE. 1002-GET-INPUT-FILE. DISPLAY "A) ENTER INPUT-FILE NAME " WITH NO ADVANCING. ACCEPT WS-NAME-INPUT-FILE. OPEN INPUT INPUT-FILE. IF WS-INPUT-FILE-STATUS IS EQUAL TO 35 DISPLAY "W) INPUT FILE NOT FOUND" GO TO 1002-GET-INPUT-FILE. DISPLAY "A) ENTER PRINT-FILE (WORK FILE) NAME " WITH NO ADVANCING. ACCEPT WS-NAME-PRINT-FILE. DISPLAY "A) ENTER PRINTER NAME " WITH NO ADVANCING. ACCEPT WS-LINE-PRINTER-NAME. OPEN OUTPUT PRINT-FILE. 121409 MOVE "/ca/laserjet_113D" TO WS-NAME-FORMAT-FILE. 121409 OPEN INPUT FORMAT-FILE. 121409 1010-OUTPUT-PCL-CODES. 121409 READ FORMAT-FILE NEXT RECORD AT END GO TO 1020-FORMAT-EOF. 121409 MOVE FORMAT-RECORD TO FORMAT-LINE. 121409 WRITE FORMAT-LINE. 121409 GO TO 1010-OUTPUT-PCL-CODES. 121409 1020-FORMAT-EOF. 121409 CLOSE FORMAT-FILE. 1990-EXIT. EXIT. ************************************************************** * DETAIL SECTION * ************************************************************** 2000-PROCESS. MOVE 2000 TO WS-NO-PARAGRAPH. READ INPUT-FILE NEXT RECORD AT END GO TO 2990-EXIT. ADD 1 TO WS-LINE-NUMBER. IF WS-PAGE-LINE-COUNTER IS GREATER THAN 112 PERFORM 2800-HEADINGS THRU 2890-EXIT. MOVE WS-LINE-NUMBER TO OR-LINE-NUMBER. MOVE SPACES TO OR-FILLER-1. MOVE INPUT-RECORD TO OR-TEXT. 042209 IF IR-BUFFER (7:6) IS EQUAL TO "**LIST" 042209 MOVE "Y" TO WS-SWITCH-PRINT. 042209 IF WS-SWITCH-PRINT IS EQUAL TO "N" 042209 THEN NEXT SENTENCE 042209 ELSE WRITE PRINT-LINE 042209 ADD 1 TO WS-PAGE-LINE-COUNTER. 042209 IF IR-BUFFER (7:8) IS EQUAL TO "**NOLIST" 042209 MOVE "N" TO WS-SWITCH-PRINT. IF IR-BUFFER (7:1) IS EQUAL TO "*" GO TO 2000-PROCESS. MOVE 1 TO WS-I. 2010-COMPARE-LOOP. IF IR-BUFFER (WS-I:2) IS EQUAL TO "*>" GO TO 2090-ENDER. IF IR-BUFFER (WS-I:6) IS EQUAL TO " COPY " GO TO 2020-COPY. ADD 1 TO WS-I. IF WS-I IS LESS THAN 73 GO TO 2010-COMPARE-LOOP. GO TO 2000-PROCESS. 2020-COPY. SUBTRACT 1 FROM WS-LINE-NUMBER. ADD 6 TO WS-I. MOVE 1 TO WS-J. MOVE SPACES TO WS-NAME-COPY-FILE. 2022-MOVE-LOOP. IF IR-BUFFER (WS-I:1) IS EQUAL TO SPACE GO TO 2030-OPEN-COPYFILE. IF IR-BUFFER (WS-I:1) IS EQUAL TO "." MOVE ".cpy" to WS-NAME-COPY-FILE (WS-J:4) GO TO 2030-OPEN-COPYFILE. MOVE IR-BUFFER (WS-I:1) TO WS-NAME-COPY-FILE (WS-J:1). ADD 1 TO WS-I, WS-J. IF WS-I IS GREATER THAN 73 OR WS-J IS GREATER THAN 64 THEN MOVE "**PROBLEM WITH.COPY STATEMENT ABOVE**" TO OR-TEXT WRITE PRINT-LINE ADD 1 TO WS-PAGE-LINE-COUNTER GO TO 2000-PROCESS. GO TO 2022-MOVE-LOOP. 2030-OPEN-COPYFILE. OPEN INPUT COPY-FILE. IF WS-COPY-FILE-STATUS IS NOT EQUAL TO "00" 040909 MOVE ".CPY" TO WS-NAME-COPY-FILE (WS-J:4) 040909 OPEN INPUT COPY-FILE 040909 IF WS-COPY-FILE-STATUS IS NOT EQUAL TO "00" 050709 MOVE WS-NAME-COPY-FILE TO WS-HOLD-NAME-COPY-FILE 050709 STRING "/testing-set-1/copybooks/" 050709 WS-HOLD-NAME-COPY-FILE 050709 INTO WS-NAME-COPY-FILE * DISPLAY "D) AT.COPY FILE OPEN NAME=\", WS-NAME-COPY-FILE, "\" 050709 OPEN INPUT COPY-FILE 050709 IF WS-COPY-FILE-STATUS IS NOT EQUAL TO "00" 050709 ADD 25 TO WS-J 050709 MOVE ".cpy" TO WS-NAME-COPY-FILE (WS-J:4) * DISPLAY "D) AT.COPY FILE OPEN NAME=\", WS-NAME-COPY-FILE, "\" 050709 OPEN INPUT COPY-FILE 050709 IF WS-COPY-FILE-STATUS IS NOT EQUAL TO "00" 050709 MOVE "***COPY FILE ABOVE NOT FOUND***" TO OR-TEXT 050709 WRITE PRINT-LINE 050709 ADD 1 TO WS-LINE-NUMBER 050709 ADD 1 TO WS-PAGE-LINE-COUNTER 050709 GO TO 2000-PROCESS 050709 END-IF 050709 END-IF 040909 END-IF 040909 END-IF. 2032-PRINT-LOOP. READ COPY-FILE NEXT RECORD AT END GO TO 2039-EOF. ADD 1 TO WS-LINE-NUMBER. 061909* MOVE WS-LINE-NUMBER TO OR-LINE-NUMBER. 061909* MOVE SPACES TO OR-FILLER-1. 061909* MOVE COPY-RECORD TO OR-TEXT. IF WS-PAGE-LINE-COUNTER IS GREATER THAN 112 PERFORM 2800-HEADINGS THRU 2890-EXIT. 061909 MOVE WS-LINE-NUMBER TO OR-LINE-NUMBER. 061909 MOVE SPACES TO OR-FILLER-1. 061909 MOVE COPY-RECORD TO OR-TEXT. 042209 IF CR-BUFFER (7:6) IS EQUAL TO "**LIST" 042209 MOVE "Y" TO WS-SWITCH-PRINT. 042209 IF WS-SWITCH-PRINT IS EQUAL TO "N" 042209 THEN NEXT SENTENCE 042209 ELSE WRITE PRINT-LINE 042209 ADD 1 TO WS-PAGE-LINE-COUNTER. 042209 IF CR-BUFFER (7:8) IS EQUAL TO "**NOLIST" 042209 MOVE "N" TO WS-SWITCH-PRINT. GO TO 2032-PRINT-LOOP. 2039-EOF. CLOSE COPY-FILE. 042209 MOVE "Y" TO WS-SWITCH-PRINT. 2090-ENDER. GO TO 2000-PROCESS. * * PAGE HEADINGS * 2800-HEADINGS. INITIALIZE PRINT-LINE. ADD 1 TO WS-PAGE-NUMBER. MOVE FUNCTION CURRENT-DATE TO WS-CURRENT-DATE. MOVE WS-NAME-INPUT-FILE TO PRINT-LINE. MOVE WS-PAGE-NUMBER TO WS-ED4S. MOVE "PAGE" TO PRINT-LINE (66:4). MOVE WS-ED4S TO PRINT-LINE (71:4). MOVE WS-CURRENT-DATE (5:2) TO PRINT-LINE (80:2). MOVE "/" TO PRINT-LINE (82:1). MOVE WS-CURRENT-DATE (7:2) TO PRINT-LINE (83:2). MOVE "/" TO PRINT-LINE (85:1). MOVE WS-CURRENT-DATE (1:4) TO PRINT-LINE (86:4). MOVE WS-CURRENT-DATE (9:2) TO PRINT-LINE (92:2). MOVE ":" TO PRINT-LINE (94:1). MOVE WS-CURRENT-DATE (11:2) TO PRINT-LINE (95:2). MOVE ":" TO PRINT-LINE (97:1). MOVE WS-CURRENT-DATE (13:2) TO PRINT-LINE (98:2). IF WS-PAGE-NUMBER IS EQUAL TO 1 THEN WRITE PRINT-LINE ELSE WRITE PRINT-LINE AFTER ADVANCING PAGE. INITIALIZE PRINT-LINE. WRITE PRINT-LINE. MOVE 4 TO WS-PAGE-LINE-COUNTER. 2890-EXIT. EXIT. * * END OF JOB * 2990-EXIT. EXIT. **************************************************************** * TERMINATION * **************************************************************** 9000-END-OF-PROGRAM. MOVE 9000 TO WS-NO-PARAGRAPH. CLOSE INPUT-FILE. CLOSE PRINT-FILE. 121409* STRING "lp -d " DELIMITED BY SIZE, 121409* WS-LINE-PRINTER-NAME DELIMITED BY SIZE, 121409* "-o sides=two-sided-long-edge " DELIMITED BY SIZE, 121409* "-o lpi=11 -o cpi=18 -o page-left=34 " DELIMITED BY SIZE, 121409* WS-NAME-PRINT-FILE DELIMITED BY SIZE 121409* INTO WS-PRINT-COMMAND. STRING "lp -d " DELIMITED BY SIZE, WS-LINE-PRINTER-NAME DELIMITED BY SIZE, "-o raw " DELIMITED BY SIZE, WS-NAME-PRINT-FILE DELIMITED BY SIZE INTO WS-PRINT-COMMAND. CALL "SYSTEM" USING WS-PRINT-COMMAND. DISPLAY "I) " WS-NAME-PROGRAM " COMPLETED NORMALLY AT--" FUNCTION CURRENT-DATE. 9990-EXIT. EXIT. [/code] The PCL is below: [code] E&l1S&l0U(s16.66h8.6V&l4.4C&l5E&l113F&l1L&k6.3H&a10L&k2G [/code] where the square is really an escape character. jimc ---------------------------------------------------------------- Subject: Board seems bored So here's a joke. What did the Atlantic Ocean say to the Pacific Ocean? Nothing, it's an ocean, it just waved. ---------------------------------------------------------------- Is this going to be a post builder thread? ---------------------------------------------------------------- Not sure, but I just read on comp.lang.cobol, someone called some of my jokes in the FAQ, lame. Lame. :-) Lame is great. What's a pirates favourite letter? Arrr, you think it'd be R, but they loves the C. Ok, and one I just thought now...lamer. Two coders walk into a store, the COBOLer runs over to a box and starts stacking the shelves. His buddy, "Hey, what are you doing?". Mr. COBOL, "This is the working store". Lamest? ;-) Cheers, Brian ---------------------------------------------------------------- A COBOLer is walking down the sidewalk, and a co-worker rides up on a shiny new bicycle. "Where'd you get the snazzy new bike?" "Well, yesterday I was cutting through the park like I always do, and this gorgeous blonde rides up, stops, drops her bike, undresses, stands in front of me, arms spread and says "Take anything you like." The COBOLer, "Good choice! Her clothes never would have fit you anyway." Author unknown. Cheers, Brian ---------------------------------------------------------------- Maybe we could have a new development environment....the CLAP...Cobol Linux Apache Php ---------------------------------------------------------------- "That was a close call!" "Yeah, I saw my whole life pass before my eyes ... but all I really remember from that now is ..." [code]GOBACK.[/code] [b]Tim Berners-Lee version[/b] "Yeah, I saw the world's life pass before my eyes ... but all I really remember from that now is ..." [code]</html>[/code] me, today. Love lame. ---------------------------------------------------------------- Ok then, a [quote] If we do not find the courage to place wisdom over wealth our intelligence is doomed to destroy us. [/quote] me, 1990ish ---------------------------------------------------------------- and a lamer [code] "It'll be eleven-eleven-eleven soon!" COBOLer: "What?" "11/11/11, soon." ... COBOLer: "Ahhh, how soon they forget." [/code] ---------------------------------------------------------------- Subject: Windows Binaries Busy testing the APAC system with OC. Downloaded the Win32 binary that uses VBISAM from kiska. The version using BDB seems a lot older and from the notes it seems that there are fixes in the VBISAM version that are not included. Is there a newer version using BDB as I will be testing as a multiuser and believe that there is still a problem with VB when running a multiuser environment? Thanks in advance ---------------------------------------------------------------- As there are no new releases there are no new binaries. I suggest to NOT use the newer version (with VBISAM) but the old one with BDB as the other version is an experimental version not supported at all. You can use the 1.1-binaries (with BDB) for VC from kiska.net or the MinGW package from Wiki->Assorted Documents. Don't forget to set DB_HOME before running your OPAC system (this activates multi-user support within BDB). human ---------------------------------------------------------------- Subject: LX / Sequential File / Rewrite Hello, I may have found a problem with sequential files and the rewrite order : I made a test of writing records of 4096 bytes and less then rewriting them : nothing special happens. I made a test of writing records of more than 4096 bytes then rewriting them : the result is that the rewritten records are completely different from the original ones. It seems that the SEEK_INIT macro should also be defined for linux system as for others systems. Here is the test program I used : [code] IDENTIFICATION DIVISION. PROGRAM-ID. TSTSEQREW INITIAL. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT TSTTREW ASSIGN "TREW.seq" ORGANIZATION IS SEQUENTIAL FILE STATUS IS FS-TSTTREW. DATA DIVISION. FILE SECTION. FD TSTTREW. 01 TST-TREW. 05 CH1 PIC X(02). 05 CH2 PIC 9(05). * 05 CH3 PIC X(4089). 05 CH3 PIC X(4090). WORKING-STORAGE SECTION. 01 W-ID PIC 9(1) VALUE 0. LOCAL-STORAGE SECTION. 77 W-CPT PIC 9(5) VALUE 0. 77 FS-TSTTREW PIC 9(02). PROCEDURE DIVISION. DEBUT-PROGRAMME. INITIALIZE FS-TSTTREW. DISPLAY "LENGTH OF RECORD=" LENGTH OF TST-TREW. OPEN OUTPUT TSTTREW. PERFORM WITH TEST AFTER VARYING W-CPT FROM 1 BY 1 UNTIL W-CPT > 10 MOVE W-CPT TO CH2 MOVE "TEST4" TO CH3 DISPLAY "["TST-TREW (1:77)"]" WRITE TST-TREW END-PERFORM. CLOSE TSTTREW. OPEN I-O TSTTREW. PERFORM UNTIL W-ID = 1 READ TSTTREW AT END MOVE 1 TO W-ID NOT AT END MOVE "u" TO CH1 DISPLAY "["TST-TREW (1:77)"]" REWRITE TST-TREW END-READ END-PERFORM. CLOSE TSTTREW. EXIT-PROGRAM. EXIT PROGRAM.[/code] And the results are : 1/[code] LENGTH OF RECORD=4096 cob_open deb cob_open fin [00001TEST4 ] [00002TEST4 ] [00003TEST4 ] [00004TEST4 ] [00005TEST4 ] [00006TEST4 ] [00007TEST4 ] [00008TEST4 ] [00009TEST4 ] [00010TEST4 ] [00011TEST4 ] cob_open deb cob_open fin cob_read deb read 4096/4096>[ ] cob_read fin [u 00001TEST4 ] cob_rewr deb rewr -4096/4096>[u 00001TEST4 ] cob_rewr fin cob_read deb read 4096/4096>[ ] cob_read fin [u 00002TEST4 ] cob_rewr deb rewr -4096/4096>[u 00002TEST4 ] cob_rewr fin cob_read deb read 4096/4096>[ ] cob_read fin [u 00003TEST4 ] cob_rewr deb rewr -4096/4096>[u 00003TEST4 ] cob_rewr fin cob_read deb read 4096/4096>[ ] cob_read fin [u 00004TEST4 ] cob_rewr deb rewr -4096/4096>[u 00004TEST4 ] cob_rewr fin cob_read deb read 4096/4096>[ ] cob_read fin [u 00005TEST4 ] cob_rewr deb rewr -4096/4096>[u 00005TEST4 ] cob_rewr fin cob_read deb read 4096/4096>[ ] cob_read fin [u 00006TEST4 ] cob_rewr deb rewr -4096/4096>[u 00006TEST4 ] cob_rewr fin cob_read deb read 4096/4096>[ ] cob_read fin [u 00007TEST4 ] cob_rewr deb rewr -4096/4096>[u 00007TEST4 ] cob_rewr fin cob_read deb read 4096/4096>[ ] cob_read fin [u 00008TEST4 ] cob_rewr deb rewr -4096/4096>[u 00008TEST4 ] cob_rewr fin cob_read deb read 4096/4096>[ ] cob_read fin [u 00009TEST4 ] cob_rewr deb rewr -4096/4096>[u 00009TEST4 ] cob_rewr fin cob_read deb read 4096/4096>[ ] cob_read fin [u 00010TEST4 ] cob_rewr deb rewr -4096/4096>[u 00010TEST4 ] cob_rewr fin cob_read deb read 4096/4096>[ ] cob_read fin [u 00011TEST4 ] cob_rewr deb rewr -4096/4096>[u 00011TEST4 ] cob_rewr fin cob_read deb cob_read fin[/code] 2/[code] LENGTH OF RECORD=4097 cob_open deb cob_open fin [00001TEST4 ] [00002TEST4 ] [00003TEST4 ] [00004TEST4 ] [00005TEST4 ] [00006TEST4 ] [00007TEST4 ] [00008TEST4 ] [00009TEST4 ] [00010TEST4 ] [00011TEST4 ] cob_open deb cob_open fin cob_read deb read 4097/4097>[ ] cob_read fin [u 00001TEST4 ] cob_rewr deb rewr -4097/4097>[u 00001TEST4 ] cob_rewr fin cob_read deb read 4097/4097>[ ] cob_read fin [u 00002TEST4 ] cob_rewr deb rewr -4097/4097>[ u ] cob_rewr fin cob_read deb read 4097/4097>[ ] cob_read fin [u 00003TEST4 ] cob_rewr deb rewr -4097/4097>[ u ] cob_rewr fin cob_read deb read 4097/4097>[ ] cob_read fin [u 00004TEST4 ] cob_rewr deb rewr -4097/4097>[ u ] cob_rewr fin cob_read deb read 4097/4097>[ ] cob_read fin [u 00005TEST4 ] cob_rewr deb rewr -4097/4097>[ u ] cob_rewr fin cob_read deb read 4097/4097>[ ] cob_read fin [u 00006TEST4 ] cob_rewr deb rewr -4097/4097>[ u ] cob_rewr fin cob_read deb read 4097/4097>[ ] cob_read fin [u 00007TEST4 ] cob_rewr deb rewr -4097/4097>[ u ] cob_rewr fin cob_read deb read 4097/4097>[ ] cob_read fin [u 00008TEST4 ] cob_rewr deb rewr -4097/4097>[ u ] cob_rewr fin cob_read deb read 4097/4097>[ ] cob_read fin [u 00009TEST4 ] cob_rewr deb rewr -4097/4097>[ u ] cob_rewr fin cob_read deb read 4097/4097>[ ] cob_read fin [u 00010TEST4 ] cob_rewr deb rewr -4097/4097>[ u ] cob_rewr fin cob_read deb read 4097/4097>[ ] cob_read fin [u 00011TEST4 ] cob_rewr deb rewr -4097/4097>[ u ] cob_rewr fin cob_read deb cob_read fin [u 00011TEST4 ] cob_rewr deb cob_read deb cob_read fin[/code] Thanks for your help. eraso ---------------------------------------------------------------- Hi eraso! You did a good job with the sample. I added missing code tags for easier copy+paste and reading - and did some minor changes. Afterwards I did some checks: - 1.1 (feb 09) MinGW package: works - 1.1 / 2.0 Win-binaries: work - early 1.1 (not feb 09) Unix: same problem as you've described - 2.0 (dev-only version) Unix: works Therefore Roger had solved this issue already for the next version (no idea when it will see the public light). Nonetheless it's good we're aware that 1.1 has this problem. human ---------------------------------------------------------------- Hello Human, Thank you for your answer but I have a question that comes in my mind (maybe in mind of others too) : - How can I be sure to have the latest package of OC 1.1 since it is not available on opencobol.org site but on simrw site (I found that info on this URL "[url=http://www.kiska.net/opencobol/1.1/]http://www.kiska.net/opencobol/1.1/[/url]" with some binaries packages) ? - Is there an updated changelog reminding which major bugs were fixed like the one above By the way, I am still in the process of migrating from oc 0.33 to oc 1.1 on a 64 bit platform and it's going well globally speaking.:-D eraso ---------------------------------------------------------------- The latest package is always available here (to the left in the download area). The latest 1.1 is feb 09 (and I guess it will be the last 1.1-version), any later version is part of the 2.0 development (where nothing is guaranteed to work at all) and should not be used. You may want to use some patches that you can find in the forum (and at least some of them gathered together at [url=http://www.kiska.net/opencobol/1.1/patches.zip]kiska.net[/url]). I wish I'd had such a nice change log, but I don't have one. There was some doc I made for myself with links for solved/open bugs ans feature requests but it was lost in a HDD crash. You're invited to start a document in the wiki (you could search the forum for "bug" and "fr"). I hope Roger has it and if not, I'm quite sure he can come up with it by crawling the CVS logs on his dev server. human ---------------------------------------------------------------- OK, maybe the date of the last commit should just be showed somewhere. ---------------------------------------------------------------- Subject: Can Redhat OC executables run on Fedora 15? We have an executable consisting of C and OpenCOBOL(1.0) sources that was compiled on Redhat. The options we use to compile the COBOL sources are: -c -static -v -Wall -std=ibm -g -v We use gcc to link the objects. It executes successfully. We ported the executable to a SUSE Linux machine which does not have OpenCOBOL installed and it, too, runs successfully. We ported the executable to Fedora 15 which does not have OpenCOBOL installed. When it is executed, it returns the message: libcob: Cannot find module CSMVALMAX (which is the PROGRAM-ID of one of our COBOL programs). The results of the nm command shows: 0815f400 T CSMVALMAX 0815f200 t CSMVALMAX_ Can Redhat OpenCOBOL apps execute on Fedora 15? Or, is something else wrong? Judy. ---------------------------------------------------------------- First I'll say yes (with the caveat that there are times when they won't, 686 vs X86_64 etc... and it will always be best to build on the target platform from sources). Then I'll suggest taking a look at http://opencobol.add1tocobol.com/#what-is-cob-pre-load, http://opencobol.add1tocobol.com/#what-is-cob-library-path and http://opencobol.add1tocobol.com/#how-do-i-use-ld-run-path-with-opencobol and see if it is an ldconfig (dynamic loader path) issue. Cheers, Brian ---------------------------------------------------------------- Many thanks, Brian. I'll look over the documentation. Regards, Judy. ---------------------------------------------------------------- As Brian stated, executable COBOL programs compiled with OpenCOBOL on RedHat can, indeed, run on Fedora 15. Our problem was that we were "CALL"ing a program with a field that contained the name of the program rather than "CALL"ing the actual program. The field PROCEDURE-NAME can contain one of twenty different program names (one of which is CSMVALMAX). Our old code was: CALL PROCEDURE-NAME USING .... Our new code is: EVALUATE PROCEDURE-NAME WHEN "CSMVALMAX" CALL "CSMVALMAX" USING .... WHEN "ABC" CALL "ABC" USING ..... . . . END-EVALUATE. Judy. ---------------------------------------------------------------- Judy; ====================== [i]EDIT: reread original[/i] Umm, yeah I didn't notice the [b]-static[/b], so all the below blabbing is meaningless to the problem at hand. Leaving it here, for pedagogic reasons while risking the DOH! cap. ;-) With 1.1pre-rel, static linkage support was kinda dropped, but it'll be back with 2. Under those conditions the link symbol WILL need to be known at compile time (a literal) or the linkage has to be dynamic. ====================== That should work, ala [code] OCOBOL >>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20111004 *> Purpose: Demonstrate CALL with link name in field *> Tectonics: cobc -x calling.cob *> *************************************************************** identification division. program-id. calling. data division. working-storage section. 77 result usage binary-long. 01 caller pic x(16). 01 testable pic 9(4). *> -*********-*********-*********-*********-*********-*********-** procedure division. compute testable = function ord("4") - 1 end-compute perform make-a-test compute testable = function ord("A") - 1 end-compute perform make-a-test goback. *> -*********-*********-*********-*********-*********-*********-** make-a-test. display "testable is " space testable end-display move "isalpha" to caller call caller using by value testable returning result end-call display caller space result end-display move "isalnum" to caller call caller using by value testable returning result end-call display caller space result end-display move "isdigit" to caller call caller using by value testable returning result end-call display caller space result end-display . end program calling. [/code] with [code] [btiffin@home cobol]$ cobc -x calling.cob [btiffin@home cobol]$ ./calling testable is 0052 isalpha +0000000000 isalnum +0000000008 isdigit +0000002048 testable is 0065 isalpha +0000001024 isalnum +0000000008 isdigit +0000000000 [/code] 4 is not alpha, is alnum, and is digit A is alpha, is alnum, and is not digit So, I'm curious as to why link-name in a field would cause the dynamic loader to fail? Glad to hear you have things working though. [i]For anyone reading along, a little explanation:[/i] The ORD function in COBOL is 1 relative, subtract one for C's view of ASCII. The is.... functions are part of libc, which we all get for free when compiling, so the tectonics are straight up -x in this case. Cheers, Brian ---------------------------------------------------------------- Subject: Probably opencobol parsing error with table occurs Hi all, during the compilation the opencobol issue an internal error and stop the process. the element "valore" since is an element of 2nd occurs should have 2 indexed values (the mistake is that I wrote one only instead). this is the output of the compiler: codegen.c:459: Invalid type cast from 'null' Tag 1 0 Tag 2 28 Aborting compile of bug1.cbl at line 21 Federico [code] IDENTIFICATION DIVISION. PROGRAM-ID. prova. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 STRINGA PIC X(1020) BASED. 01 P1 USAGE POINTER. 01 A PIC X. 01 tabella1. 02 elemento1 occurs 10 times. 09 elemento2 occurs 20 times. 12 valore pic x. PROCEDURE DIVISION. SET P1 TO ADDRESS OF valore (1). DISPLAY P1. STOP RUN. [/code] ---------------------------------------------------------------- Thank you for reporting this. The generated code of 2.0 works (displaying a pointer address), but I guess it should not compile at all. Roger, Bill, any other person with an idea why this should (not) compile? cobc is using (1, 1) here, if you code (1). human ---------------------------------------------------------------- I think it should [u][i][b]NOT[/b][/i][/u] (cleanly) compile. I can't think of any standard or extension reason that 2 subscripts wouldn't be requried to get "clean" source code. ---------------------------------------------------------------- Subject: For Steve A buddy just sent me an email with the news. It included this [quote] Your time is limited, so don't waste it living someone else's life. - Steve Jobs [/quote] Words to live by. ---------------------------------------------------------------- Subject: Moodle courseware site request for opinions Hello, Seeing as I'm getting close to dropping the RC status of the FAQ 1.0 and will soon be looking for more ways to volunteer, I'm leaning toward trying to put up a Moodle course. It's empty, but it'll start at http://www.peoplecards.ca/opencobol/ I have a contact on compsci.ca that spent a summer tweaking Moodle so I'm not afraid of getting to the nitty gritties of Moodle, this request is for Educational Order of Operations. What, in your opinion, should be the order of importance/necessity for teaching COBOL programming? I want to highlight the import bits first as, to be honest, the keenness of maintaining the site may fade so I want to optimize the enthusiasm up front. There are of course some complicating necessities; the division structure, periods, et al, but that is a 'just have to' even though it may confuse new to COBOL developers before getting to the meaty bits of the power of COBOL using OpenCOBOL. So where should it start? (Aside from the obligatory Hello World samples that will be on the front page). Verbs? Compiler commands? Sections, paragraphs, sentences? DATA DIVISION pictures? Autotools and building the compiler? ([i]being a little facetious now...[/i]) Embedding Guile and interfacing with the CERN ROOT/CINT framework to shift the paradigm of COBOL toward the sciences? Yeah first day ... How to take over the banking industry using the power of sub atomic particle theory in a Common Business environment. ;-) I'm aiming for advice on how to get big bang for little bucks. [i]at first anyway[/i] Initial plans are to leverage the power of Gary's guide and perhaps a few entries from the FAQ, and to target a new to COBOL and new to programming audience. And hey, if anyone wants to participate as a course designer, teacher's assistant or even shared administrator, drop me a note. Cheers, Brian ---------------------------------------------------------------- There are so many "good" ways of teaching people. Here are some thoughts how I'd write the courses. If you like to, start with hello world sample (but not the shortest one as this would not teach "good programming"). Go ahead with the verbs, introducing (and explaining) different DATA-DIVISION entries step by step with the verbs, at start with a sample DATA-DIVISION necessary for the first verbs ACCEPT/DISPLAY/MOVE (without CORRESPONDING / reference modification). I'd teach STRING/UNSTRING [without and with POINTER]/INSPECT and then ADD/SUBTRACT/MULTIPLY/DIVIDE/COMPUTE, after that go onwith CALL (with LINKAGE and RETURN-CODE) and file I/O, together with MOVE CORRESPONDING and reference modification. No compiler commands at all (only "how to compile with maximum warnings"), for a compiler reference copy the stuff from the FAQ (or from cobc --help). Should work for a start ;-) human ---------------------------------------------------------------- We start newbies with a sample program that gets them past all of the Identification Division and Environment Division issues that can require significant knowledge with little perceived results (for them). We take them directly to the Data Division and Procedure Division and then back track to the Identification and Environment Divisions. We feel that this gives the newbie a larger sense of accomplishment and allows them to build momentum before they need to get involved with the tedious parts. Good Luck. jimc ---------------------------------------------------------------- [quote]We start newbies with a sample program that gets them past all of the Identification Division and Environment Division issues that can require significant knowledge with little perceived results (for them).[/quote] I had that exact experience back at Waterloo. My home schooling was Z80 assembler. First university level course was in COBOL, looked like a lot of fluff for no 'executable' ... until it sunk in. Same with the period rules. So, yeah, the first few programs may use OpenCOBOL's forgiving parser to gloss over IDENTIFICATION and ENVIRONMENT division. I'm leaning toward the pre-amble to the first lesson being Hello World in a variety of old-school, new-school, FIXED and FREE form sources, using DISPLAY and OPEN, WRITE. Show off the vast variety of coding styles and potential for personal choice the compiler provides ... before offering my biased opinions on how 'it should be' ;-) So far the roadmap is OC-prereq (install, mostly a 'forum' class). OC-101 Lesson 1, Hello OpenCOBOL. Assignment will be captured output. OC-101 Lesson 2, sequential reads, with some background on files and simple PIC X and 9 data definitions. Lesson 3, indexed writes. Lesson 4 transactional merge to master file. Then some lessons on page-break output processing and the power in the DATA DIVISION. Cheers, Brian ---------------------------------------------------------------- For better or worse, the first snippets of Hello are up at http://peoplecards.ca/opencobol More to come, however slowly, until it's built. Cheers, Brian ---------------------------------------------------------------- I'd like to ask the friendly forum for a JCL wrapped Hello COBOL source code snippet. The listing would be added to the Moodle Hello page. Umm, I can kinda fake it and start simple [code] //<job card> // EXEC PGM=HELLO //STEPLIB DD DISP=SHR,DSN=<steplib DSN> //DDNAME1 DD SYSOUT=* //DDNAME2 DD SYSOUT=* // [/code] but that would be lying, as I have no clue, yet. Anyone? I have no close to hand way of verifying that what I'd make up is actually right. Cheers, Brian ---------------------------------------------------------------- Inform 7 is pretty cool. Interactive fiction development language. One click release of a in the browser playable javascript version. http://peoplecards.ca/inform7/hello101/index.html Source code: [b]Hello OpenCOBOL.Inform[/b] [code] "Hello OpenCOBOL" by "Brian TIffin" The story genre is "Training material". The story headline is "Hello OpenCOBOL 101". The release number is 101. The story creation year is 2012. The story description is "COBOL training material. The object of the exercise is to highlight the order of each DIVISION in a COBOL source program." Release along with a library card, a solution, source text, a website, an interpreter, cover art, an introductory booklet, a file of "Walkthrough" called "solution.txt", a file of "Making of..." called "Overview.html". Use no scoring, the serial comma, and American dialect. [written for the OpenCOBOL Moodle course at http://peoplecards.ca/opencobol] Part 1 - Hidden Details The player wears a student id badge. A chair is a kind of supporter. A chair is always enterable. After examining a thing when something is part of the noun: say "[The noun] includes [the list of things which are part of the noun]." instead of opening the IDENTIFICATION: if IDENTIFICATION is open: say "Computer says no."; now the PROCEDURE is closed; now the DATA is closed; now the ENVIRONMENT is closed; now the IDENTIFICATION is closed; otherwise: now the IDENTIFICATION is open. Instead of opening the ENVIRONMENT: if IDENTIFICATION is not open or the ENVIRONMENT is open: say "Computer says no."; now the PROCEDURE is closed; now the DATA is closed; now the ENVIRONMENT is closed; now the IDENTIFICATION is closed; otherwise: now the ENVIRONMENT is open. Instead of opening the DATA: if ENVIRONMENT is not open or the DATA is open: say "Computer says no."; now the PROCEDURE is closed; now the DATA is closed; now the ENVIRONMENT is closed; now the IDENTIFICATION is closed; otherwise: now the DATA is open. Instead of opening the PROCEDURE: if DATA is not open or the PROCEDURE is open: say "Computer says no."; now the PROCEDURE is closed; now the DATA is closed; now the ENVIRONMENT is closed; now the IDENTIFICATION is closed; otherwise: now the PROCEDURE is open. instead of switching off the computer: say "computer says no."; Instead of examining the computer: say "The machine beckons you to learn COBOL and to open the drawers in the DIVISION order expected by the OpenCOBOL compiler.". Getting help about is an action applying to one topic. Understand "help [text]" as getting help about. Understand "help" as getting help about. Carry out getting help about: say "Welcome to Hello OpenCOBOL 101.[line break]You need to open the drawers in the proper order for COBOL divisional structure. Hint: I enter data properly.". Understand "click [something]" as opening. Chapter 1 - Hello OpenCOBOL The lab is a room. "The lab.[line break]There is a computer here beckoning to say hello." There is a desk in the lab. "On the desk [is-are a list of things on desk]. The desk also has [a list of things which are part of the desk]." There is a chair in the lab. "A nicely padded chair is positioned at the desk". The chair is fixed in place. The computer is a device. "A fairly nice workstation glows away on the desk". The computer is on the desk. The computer is fixed in place. The computer is switched on. A DATA drawer is a closed openable container. It is part of the desk. Understand "D" as the DATA. An ENVIRONMENT drawer is a closed openable container. It is part of the desk. Understand "E" as the ENVIRONMENT. An IDENTIFICATION drawer is a closed openable container. It is part of the desk. Understand "ID" as the IDENTIFICATION. Understand "I" as the IDENTIFICATION. A PROCEDURE drawer is a closed openable container. It is part of the desk. Understand "P" as the PROCEDURE. Every turn: say "[if IDENTIFICATION is open] IDENTIFICATION DIVISION. [line break] PROGRAM-ID. HelloOpenCOBOL.[end if] [if ENVIRONMENT is open][line break] ENVIRONMENT DIVISION.[line break][end if] [if DATA is open] DATA DIVISION.[line break][end if] [if PROCEDURE is open] PROCEDURE DIVISION. [line break] DISPLAY [quotation mark]Hello, OpenCOBOL[quotation mark] END-DISPLAY. [line break] GOBACK. [line break] END PROGRAM HelloOpenCOBOL.[line break] [line break] *Cut and paste the above into a text editor, [line break] * save as HelloOpenCOBOL.cob. [line break] * Then compile with cobc -x HelloOpenCOBOL.cob, [line break] * and test with ./HelloOpenCOBOL [end if]". Chapter 2 - Testing Test computer with "examine computer". [/code] You can try this in the browser at http://peoplecards.ca/inform7/hello101/play.html Looks like... [code] OpenCOBOL Hello OpenCOBOL 101 by Brian TIffin Release 101 / Serial number 120219 / Inform 7 build 6G60 (I6/v6.32 lib 6/12N) SD lab The lab. There is a computer here beckoning to say hello. On the desk is a computer. The desk also has a DATA drawer, an ENVIRONMENT drawer, an IDENTIFICATION drawer, and a PROCEDURE drawer. A nicely padded chair is positioned at the desk >help Welcome to Hello OpenCOBOL 101. You need to open the drawers in the proper order for COBOL divisional structure. Hint: I enter data properly. >open identification drawer IDENTIFICATION DIVISION. PROGRAM-ID. HelloOpenCOBOL. >open environment drawer IDENTIFICATION DIVISION. PROGRAM-ID. HelloOpenCOBOL. ENVIRONMENT DIVISION. >open data drawer IDENTIFICATION DIVISION. PROGRAM-ID. HelloOpenCOBOL. ENVIRONMENT DIVISION. DATA DIVISION. >open p IDENTIFICATION DIVISION. PROGRAM-ID. HelloOpenCOBOL. ENVIRONMENT DIVISION. DATA DIVISION. PROCEDURE DIVISION. DISPLAY "Hello, OpenCOBOL" END-DISPLAY. GOBACK. END PROGRAM HelloOpenCOBOL. * Cut and paste the above into a text editor, * save as HelloOpenCOBOL.cob. * Then compile with cobc -x HelloOpenCOBOL.cob, * and test with ./HelloOpenCOBOL >open p Computer says no. [/code] This is the hasty-post version. I'd like the real Moodle assignment to be a little more fleshed out, something that pumps out (in pieces, as the player explores the lab and manuals). [code]000100 IDENTIFICATION DIVISION. 000200 PROGRAM-ID. HELLOREMARKS. 000300 000400 DATE-WRITTEN. 20120110. 000500 DATE-MODIFIED. JANUARY 10TH, 2012. 000600 DATE-COMPILED. TUESDAY. 000700 AUTHOR. BRIAN TIFFIN. 000800 INSTALLATION. OpenCOBOL, GNU/Linux. 000900 SECURITY. Normal. 001000 001100 REMARKS. 001200 Full on Hello, world 001300 source code example. 001400 001500 ENVIRONMENT DIVISION. 001600 CONFIGURATION SECTION. 001700 SOURCE-COMPUTER. OpenCOBOL. 001800 OBJECT-COMPUTER. OpenCOBOL. 001900 002000 DATA DIVISION. 002100 WORKING-STORAGE SECTION. 002200 010000 PROCEDURE DIVISION. 010100 MAIN-LOGIC SECTION. 010200 BEGIN. 010300 PERFORM HELLO-SECTION 010400 STOP RUN. 010500 010600 HELLO-SECTION. 010700 DISPLAY 010800 FUNCTION SUBSTITUTE("Goodbye, freetime", 010900 "Goodbye", "Hello", 011000 "freetime", "world") 011100 END-DISPLAY 011300 EXIT. [/code] Many many thanks to Graham Nelson and crew at Inform. Awesome compiler. Cheers, Brian ---------------------------------------------------------------- ... OK brian, it's you... "Goodbye, freetime" gets the point. I smiled when I tried to understand what the game (therefore you) wanted me to do. Something you may should change is the title as it leads to "OpenCOBOL was created with Inform and has IFID E9BF4EE2-454D-11E1-956F-001F16FA7F21"... human ---------------------------------------------------------------- So many Inform 7 crib notes, fair learning curve. ;-) The desk drawers are now light up panels on the computer. Soon the chair will expose a 'Ye Olde School / Whippersnapper COBOL' switch, giving sequence numbered formatted or hippie free form COBOL. Early use of more explicit hints will hopefully alleviate most Interactice Fiction confusion as to the purpose and actions required to continue the in game training. It's a game, but it is also a training exercise. No need for the normal 'expect willingly stubborn audience willing to put up with failed attempts' fiction. Start with explicit hints at commands to type to play. A manual that effects usage of REMARKS and other obsoletes in the game winning source code might be in a closed drawer. There will be a picture of Admiral Grace on the desk that is the voice of reason and folklore each turn through the game steps. Way too much fun. This story/game will still weigh in at mere hundreds of lines of Inform 7 source. Cheers, Brian Edit; [i]title changed in the sample listing as human suggested (but not the Looks like)[/i], so if you are looking for what he mentioned, it changed in the source. :-) ---------------------------------------------------------------- Subject: please give your option at the polls Hi all I would like to inform you that on this page there are 3 polls available. http://cms.tp-srl.it/joomla/index.php/guicobol if you will give your option we ALL could have an idea about opencobol usage..(in general) and other that could be useful for us to understand the level of usage of the compiler. Thanks for your feedback. Federico ---------------------------------------------------------------- Thanks Federico. I ran the site from Babelfish, so I think I represented my opinions properly. ;) Brian ---------------------------------------------------------------- Thank you so much for your reply. I have realized that so many people visiting the site www.tp-srl.it cannot understand contents of it since it's written by using my native language that's italian. So I added a joomla translator that allows you all (I hope!) to read with own native version. You can use the menu "translate pages" to obtain your appropriate version. Regards Federico ---------------------------------------------------------------- Subject: How much effort should be put into making OpenCOBOL GIR introspective? http://live.gnome.org/GObjectIntrospection Asking as, if we get GIR, we get a shipload of free bindings into and out of GObject space. I'm either going to spend time writing code to bind to Guile, or GIR. With GIR we'd get a consistent layer and interoperability with Guile, Spidermonkey, Perl, Python, PHP, Lua, Vala, Genie, Ruby, to name a few. GIR will take longer to code up than a 'simple' Guile binding through a scm -> cob_field sequence, but offers more in the end. So this is a poll. Would GObject introspection be a worthy use of time? Cheers, Brian ---------------------------------------------------------------- I don't know how MUCH time this would need, but GIR really sounds like what most of my practical issues need (COBOL with all the logic, xyz doing the library access and GUI). human ---------------------------------------------------------------- I'm going to uneducatedly guess the hours will counted in the hundreds. But the benefits could be vast. An OpenCOBOL PROGRAM-ID will be callable from Javascript. PyGI python, GTK3, etc, all open up. Umm, then eventually the Windows glib, GObject ports will be polished enough for august COBOL coders. ;) Umm too, assuming cob_field can be typedef'ed for GIR. Don't know yet. Cheers, Brian ---------------------------------------------------------------- Subject: For Dennis "C is quirky, flawed, and an enormous success" Thanks for everything Mr Ritchie. goodbye, world ---------------------------------------------------------------- Subject: OpenSUSE COBOL Developer package Anyone else bumped into http://en.opensuse.org/User:Real_bastie/COBOL_DOS ? Haven't tried it as I have most of those packages already setup, but it looks cool and promising. Wondering if anyone can shed light on the COBOL Developer Operating System. Cheers, Brian ---------------------------------------------------------------- It is primary written for SUSE Studio. Have you any questions? http://susestudio.com/a/y3RfnE/cobol-dos ---------------------------------------------------------------- Questions? Not really. But I'll offer up cheerleading and advocacy for the project. ;-) I'll mention the package in the FAQ. Cheers, Brian ---------------------------------------------------------------- Better you look for the the complete appliance. see here: https://rapidshare.com/#!download|672dt|2920843785|COBOL_DOS.x86_64-0.5.0.vmx.tar.bz2|713300 ---------------------------------------------------------------- Subject: limit on "call using" parameters We are using: cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Jun 07 2009 06:00:30 Packaged Feb 06 2009 10:30:55 CET and get a "Trace/breakpoint trap" message when our call statement specifies more than 66 parameters for example 'CALL "foo" USING RESULT A1 A2 A3 ... A65' We are using this technique to access columns in a MySQL table and thus have many parameters. Does anyone have suggestions as to how to achieve our goal? Thank you in advance. jimc ---------------------------------------------------------------- Do you get this message at compile-time or at run-time (if on run-time: directly at the call or when returning to COBOL)? Does it depend only on the number of parameters or is it depending on the parameters itself (size etc)? I'd suggest to write a layer prog in C and pass it three parameters: - number of columns - pointer to a table occurs "number of columns" with the column sizes as 9(05) for example - pointer to a big field where you have all the columns at sub-levels The C prog simply splits the columns with the first two params and pass it to the MySQL table and back. human ---------------------------------------------------------------- @human As always thank you. The error occurs at run-time before execution of the called routine. My suspicion is that there is a limit at either the compiler or the link editor. Good suggestion. (3 parameter program) We need to do some more research before picking a solution. jimc ---------------------------------------------------------------- Jim, I tried [code] OCOBOL >>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20111017 *> Purpose: How many CALL arguments can we use? *> Tectonics: cobc -x -g -debug -W lots.cob *> *************************************************************** identification division. program-id. lots. data division. working-storage section. 77 result usage binary-long. 01 a0 pic x. 01 a1 pic x. 01 a2 pic x. 01 a3 pic x. 01 a4 pic x. 01 a5 pic x. 01 a6 pic x. 01 a7 pic x. 01 a8 pic x. 01 a9 pic x. ... believe me, 60 more defines, but I didn't realize until too late that I didn't need all the names ... 01 h0 pic x. 01 h1 pic x. 01 h2 pic x. 01 h3 pic x. 01 h4 pic x. 01 h5 pic x. 01 h6 pic x. 01 h7 pic x. 01 h8 pic x. 01 h9 pic x. *> -*********-*********-*********-*********-*********-*********-** procedure division. call "printf" using "%s" a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 g0 g1 g2 g3 g4 g5 g6 g7 g8 g9 h0 h1 h2 h3 h4 h5 h6 h7 h8 h9 returning result end-call goback. end program lots. [/code] with [code] $ cobc --version cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built May 01 2011 07:48:58 Packaged Feb 06 2009 10:30:55 CET [btiffin@home forum]$ cobc -x -g -debug -W lots.cob [btiffin@home forum]$ ./lots [btiffin@home forum]$ [/code] showing 81 parameters. printf dutifully printed 1 space (and likely some garbage before it found a null as well as trashing the process' stack in the meanwhile, but hey). Might need more details on what you are calling and from where. I'm running on Fedora 14, 64 bit. I max out at about 350 stack items before the CALL code trips on a segfault (which means I likely don't have that much stack space and the stack overflow occurs causing who knows what to go on). [code] [btiffin@home forum]$ cobc -x -g -debug -W lots.cob [btiffin@home forum]$ ./lots lots.cob:125: Attempt to reference unallocated memory (Signal SIGSEGV) Abnormal termination - File contents may be incorrect [/code] I'm also looking at pages akin to http://stackoverflow.com/questions/2279052/increase-stack-size-in-linux-with-setrlimit Google time. ;) Jim, you da best at coming up with meaty bits. This might be system level, but it might be a buffer in the compiler. Recursive calling works and can run pretty deep stacks (8 meg(ish)), so I think I'm chasing herring here...not sure if it is red. Looking at some libcob and cobc sources, too. Cheers, Brian Edit; Just found, [code] RLIMIT_STACK The maximum size of the process stack, in bytes. Upon reaching this limit, a SIGSEGV signal is generated. To handle this signal, a process must employ an alternate signal stack (sigaltstack(2)).[/code] so if I'm anywhere near the mark on this herring chase, Linux is being nice and actually segfaulting before 'real' ([i]being the unpredictable, not reproducible blue screen kind of[/i]) damage is done... [b]More edit[/b]: And I'm pretty sure rlimit_stack has nothing to do with this issue now. [i]As usual, leaving all the information here, risk looking like the lost...[/i] libcob/common.h [code] #define COB_STACK_SIZE 255 #define COB_MAX_FIELD_PARAMS 64 [/code] worthy of more looking. Ok, so the limit COB_MAX_FIELD_PARAMS is used in generated C code for cob_module, but that's a limit on calling the procedure, not an issue. I think. The parameters are stashed in module.cob_procedure_parameters[] and the array is sized at...don't know yet, but here is what valgrind says (and just to add puzzle, the code does NOT crack running with gdb). [code] ==3726== Invalid write of size 8 ==3726== at 0x802D62: lots_ (lots.c:596) ==3726== by 0x800C12: lots (lots.c:40) ==3726== by 0x800BFD: main (lots.c:32) ==3726== Address 0x212000 is not stack'd, malloc'd or (recently) free'd ==3726== lots.cob:125: Attempt to reference unallocated memory (Signal SIGSEGV) Abnormal termination - File contents may be incorrect [/code] pointing at line 596 in generated C code, so it has something to do with the cob_procedure_parameters (and how bad image ram is by the time this trips, ummm, not sure). cobc -C lots.cob (with 360 args), valgrind is pointing at line 596, in and about here in my copy of lots.c [code] ... module.cob_procedure_parameters[349] = &f_40; module.cob_procedure_parameters[350] = &f_41; module.cob_procedure_parameters[351] = NULL; module.cob_procedure_parameters[352] = NULL; ... [/code] Haven't found the magic allocation number yet or what this is overwriting. Cheers, Brian ---------------------------------------------------------------- Brian, The support we get from this group is better than any we have ever received from a paid vendor. You guys are great! Thank you. The actual code was: [code] CALL "MySQL_fetch_record" USING WS-MYSQL-RESULT TS-ST-RECORD-NUMBER TS-IDP-STORE-NUMBER TS-CL-STORE-NUMBER TS-DIVISION-NUMBER TS-IDP-ASSOC-NUMBER TS-STANDARD-STORE-NUMBER TS-STORE-NAME TS-DBA-NAME TS-STREET-ADDRESS-1 TS-STREET-ADDRESS-2 TS-PO-BOX TS-CITY TS-STATE TS-COUNTRY TS-ZIP-STREET TS-ZIP-PO-BOX TS-CONTACT-NAME TS-CONTACT-PHONE TS-STORE-STATUS TS-DATE-CLOSED TS-DATE-OPENED TS-DATE-LAST-SHIP TS-DATE-QUESTIONNAIRE TS-CLAIM-METHOD TS-SPECIAL-HANDLING TS-EVALUATION TS-RECORD-TYPE TS-VARIANCE-PERCENT TS-NUMBER-SHIPMENTS TS-RATE-STRUCTURE TS-PROCESSING-RATE TS-PROCESSING-MIN TS-POSTAGE-RATE TS-POSTAGE-MIN TS-FLAGS-EACH-1 TS-FLAGS-EACH-2 TS-FLAGS-EACH-3 TS-FLAGS-EACH-4 TS-FLAGS-EACH-5 TS-FLAGS-EACH-6 TS-FLAGS-EACH-7 TS-FLAGS-EACH-8 TS-FLAGS-EACH-9 TS-FLAGS-EACH-10 TS-FLAGS-EACH-11 TS-FLAGS-EACH-12 TS-FLAGS-EACH-13 TS-FLAGS-EACH-14 TS-FLAGS-EACH-15 TS-FLAGS-EACH-16 TS-FLAGS-EACH-17 TS-FLAGS-EACH-18 TS-FLAGS-EACH-19 TS-FLAGS-EACH-20 TS-NO-SALESMAN TS-NO-PAY-TO-STORE TS-SQUARE-FEET TS-CODE-ROUTE TS-PCT-SECURITY TS-SECURITY-MINIMUM TS-SECURITY-NO-PMTS TS-RISK-FACTOR TS-TAX-ID TS-PASSWORD TS-MARKETING-PGM TS-RA1-STORE-NUMBER TS-RA1-DATE-CHANGED TS-RA1-FLAG-EACH-1 TS-RA1-FLAG-EACH-2 TS-RA1-FLAG-EACH-3 TS-RA1-FLAG-EACH-4 TS-RA1-FLAG-EACH-5 TS-RA2-STORE-NUMBER TS-RA2-DATE-CHANGED TS-RA2-FLAG-EACH-1 TS-RA2-FLAG-EACH-2 TS-RA2-FLAG-EACH-3 TS-RA2-FLAG-EACH-4 TS-RA2-FLAG-EACH-5 TS-RA3-STORE-NUMBER TS-RA3-DATE-CHANGED TS-RA3-FLAG-EACH-1 TS-RA3-FLAG-EACH-2 TS-RA3-FLAG-EACH-3 TS-RA3-FLAG-EACH-4 TS-RA3-FLAG-EACH-5 TS-RA4-STORE-NUMBER TS-RA4-DATE-CHANGED TS-RA4-FLAG-EACH-1 TS-RA4-FLAG-EACH-2 TS-RA4-FLAG-EACH-3 TS-RA4-FLAG-EACH-4 TS-RA4-FLAG-EACH-5 TS-RA5-STORE-NUMBER TS-RA5-DATE-CHANGED TS-RA5-FLAG-EACH-1 TS-RA5-FLAG-EACH-2 TS-RA5-FLAG-EACH-3 TS-RA5-FLAG-EACH-4 TS-RA5-FLAG-EACH-5 TS-RA6-STORE-NUMBER TS-RA6-DATE-CHANGED TS-RA6-FLAG-EACH-1 TS-RA6-FLAG-EACH-2 TS-RA6-FLAG-EACH-3 TS-RA6-FLAG-EACH-4 TS-RA6-FLAG-EACH-5 . [/code] I suspect that the problem is with the aggregate length of the variable names. The code was generated by our MySQL preprocessor. In this case we wanted the entire row to be retrieved. It will be a few days before I can dive into this. Thank you for the pointers. They should make finding the issue much easier. jimc ---------------------------------------------------------------- @jimc: I suggest to always use the same call schema for your data handling "fetch_record" etc and to set the command table by the preparser beforehand. @btiffin: Please check if the runtime problem still occurs with latest dev-tarball. The signal handler of libcob should be used and if compiled with -debug there should be a nice error message instead of the signal handler. If one or both problems still occurs with 2.0 dev, please mail this to Roger. human ---------------------------------------------------------------- 2.0 [code] lots.cob: 125: Error: Number of parameters exceeds maximum 36 [/code] Looks like harder limits may be on the horizon. [i]All very cleanly dependent on COB_MAX_FIELD_PARAMS from a quick read over. Umm, and a control structure.[/i] But...for now, I'd like to see if it can't be tweaked without too much fuss in Feb2009. No? Worthy. Cheers, Brian ---------------------------------------------------------------- @btiffin: if you're ready for the game temporarily kick COB_MAX_FIELD_PARAMS of your dev-tarball to something like 1024 and rerun the prog, just to see if the registration of libcobs signal handler works correct (should kick in with and without -debug as there is no need to check if cobc doesn't compile the source). The only tweaking I can think of for feb09-tarball is to get the check of COB_MAX_FIELD_PARAMS into the parser for not compiling the source that is likely to break libcob. human ---------------------------------------------------------------- Subject: Reading COMP/COMP-3 data from ASCII files Hi, We are trying to convert from MF cobol/unix to open cobol/linux in one of our servers. One of our application reads the mainframe file, converts its from ebc to ascii format. the cobol programs then reads this asci file and loads it into our table. We are finding difference with any field having comp/comp-3 usage. For eg: We have a field PIC S9(9) COMP which we are reading from the file. In MF cobol unix the value of the field is 0042260366, but in Open cobol the value is -1898478590. Please let me know if you need more details to look into this issue. Any help is much appreciated. ---------------------------------------------------------------- The simple solution is to unload to a real text-file. Just omit any USAGE clauses during unload to and loading from the ASCII files. human ---------------------------------------------------------------- And to be safe, set the picture of the text file as S9(8) sign is leading separate character. ---------------------------------------------------------------- Subject: move higher level to lower level doesn't seem to work Welcome me, Finally I can get back to this forum again..so happy... Btw, I have a question. please look at the code. After move statement, WS-F1-2 should contain X'0000000C' twice as it does in M/F. But it doesn't. So I looked at the translation. opencobol use memcpy for the whole length while M/F move 1 byte at a time (i think). So please let me know what you think... thank you very much in advance. [code] IDENTIFICATION DIVISION. PROGRAM-ID. TEST1 INITIAL. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM-4331. OBJECT-COMPUTER. IBM-4331. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-F1. 05 WS-F1-1 PIC S9(7) COMP-3 VALUE ZERO. 05 WS-F1-2 PIC X(8). PROCEDURE DIVISION . 0000-PROGRAM-DRIVER. DISPLAY 'WS-F1;1;' WS-F1 MOVE WS-F1 TO WS-F1-2 DISPLAY 'WS-F1;2;' WS-F1 GOBACK. 0000-EXIT. EXIT. [/code] cobc (OpenCOBOL) 1.1.20090206 Copyright (C) 2001-2009 Keisuke Nishida / Roger While ---------------------------------------------------------------- I think this should not be allowed at all. Here's what coming "cobc -Wall" says to this: [quote]test1.cbl: In paragraph '0000-PROGRAM-DRIVER': test1.cbl: 22: Warning: Overlapping MOVE may produce unpredictable results[/quote] Search this forum for "Overlapping" to get the forum posts you may want to read. human ---------------------------------------------------------------- oh thank you very much. it's so sad. in m/f, it's predictable..i think ---------------------------------------------------------------- Well, what is sad is that I'm using older native windows build (1.1.20100520) from following link: http://www.kiska.net/opencobol/1.1/ The fact is that, when I compile the above program with this older release, I don't get the warning as stated and I get the expected display as mentioned. When I look at the "C" translation, I see a memmove statement. ---------------------------------------------------------------- Sorry, post removed... I just found the issue I was looking for: Board entry [url=http://www.opencobol.org/modules/newbb/viewtopic.php?viewmode=flat&order=ASC&topic_id=908&forum=1]MOVE loops when operands are overlaying [solved][/url] ---------------------------------------------------------------- Hey, I don't said, that coming versions do not the the same as MF, there was just a useful warning (on additional level) added because the way the MOVE is done internal may be implementor specific. BTW: FEB09 tarball outputs a warning (on full level), too, just a little bit different [quote]cobc test1.cbl [b]-W[/b] test1.cbl: In paragraph '0000-PROGRAM-DRIVER': test1.cbl:20: Warning: DISPLAY statement not terminated by END-DISPLAY [b]test1.cbl:22: Warning: Sending field larger than receiving field test1.cbl:9: Warning: 'WS-F1' defined here as a group of length 12 test1.cbl:13: Warning: 'WS-F1-2' defined here as PIC X(8)[/b] test1.cbl:23: Warning: DISPLAY statement not terminated by END-DISPLAY[/quote] Testing with latest inofficial dev-tarball had the same result as the MinGW version (which is a patched FEB09 one): WS-F1 contains X'0000000C' twice. @wichien: What does the version you use has in WF-F1 (please check via [url=http://opencobol.add1tocobol.com/#update-to-oc-cbl-dump]OC_CBL_DUMP[/url] because displaying of x'00' may result in strange behaviour). human ---------------------------------------------------------------- Subject: SOLVED: Problems with OpenCOBOL on a AIX 7, help needed I've got a mail and was asked to place it here as the registration of new accounts is disabled (my additional comments are placed in brackets): [quote]We want to use OpenCOBOL on a AIX 7 machine. The best would be if we could use 64 bit but at first we want to test with 32 bit. But we have some problems: 1. Problems during "make check" with our normally [in production (Windows/SLES)] used version of OpenCOBOL 1.1 (March 2008) We are able to compile the OC package with this configuration: [code] ./configure -prefix=/opt/opencobol -without-db --with-patch-level=1 CFLAGS="-L/usr/local/include" LDFLAGS="-L/usr/local/lib"[/code] But at "make check" some of the internal tests failed independent of 32 or 64 bit. (see run.log [removed]). There seems to be a problem with detecting if cob_init() was called. 2. Problems during "make" with the actual pre-release of OpenCOBOL 1.1 (Feb 2009) The compilation (with same configuration as above) of this version fails with the error message [quote] if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobc-parser.o -MD -MP -MF ".deps/cobc-parser.Tpo" -c -o cobc-parser.o `test -f 'parser.c' || echo './'`parser.c; then mv -f ".deps/cobc-parser.Tpo" ".deps/cobc-parser.Po"; else rm -f ".deps/cobc-parser.Tpo"; exit 1; fi cc1: out of memory allocating 4072 bytes after a total of 133579312 bytes make: 1254-004 The error code from the last command is 1.[/quote] What can you suggest? I read that OC is only buildable with xlc, is this true? Thanks in advance. Best regards.[/quote][removed:]run.log at pastebin. As I've never compiled on this machine I cannot say anything to this, but I'm quite sure we can get it to work! human ---------------------------------------------------------------- I've got another mail, they found the solution on their own. If I understood it correct, the main problem was that a static version of libcob was created and AIX linked everything against this libcob.a instead of libcob.so. Therefore COBOL modules did not had the same environments (important for CALLs). Here are some snippets I've got (they apply to an unpatched 1.1, march 08 version, but I guess the steps are similar with the feb 09 version, too): [b]Pre-requisites:[/b] [u]GCC[/u], [u]make[/u] etc. were already available on this machine. [u]ISAM[/u] was disabled (they use some database libraries) by using "-without-db" during ./configure of OpenCOBOL [u]libintl[/u] and [u]libcurses[/u] were were already available on this machine (both 32 and 64 bit), together with the dev-headers. [u]building libgmp targeting 32-bit[/u]: [code]gunzip gmp-5.0.2.tar.gz tar -xvf gmp-5.0.2.tar cd gmp-5.0.2 ./configure ABI=32 make make check su make install[/code][u]building libgmp targeting 64-bit[/u]: [code]gunzip gmp-5.0.2.tar.gz tar -xvf gmp-5.0.2.tar cd gmp-5.0.2 ./configure make make check su make install[/code] [b]Building OpenCOBOL as shared library:[/b] first do[code]gunzip open-cobol-1.1.tar.gz tar -xvf open-cobol-1.1.tar cd open-cobol-1.1[/code] for configuring OC [u]targeting 32-bit[/u][code]./configure -prefix=/opt/opencobol -without-db CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib/ -static-libgcc -L/usr/ccs/lib -L$LIBHOME -Wl,-bstatic -lstdc++ -Wl,-bdynamic -lsupc++"[/code][u]targeting 64-bit[/u][code]./configure -prefix=/opt/opencobol -without-db OBJECT_MODE=64 CFLAGS="-I/usr/local/include -maix64" LDFLAGS="-L/usr/local/lib/ -static-libgcc -L/usr/ccs/lib -L$LIBHOME -Wl,-bstatic -lstdc++ -Wl,-bdynamic -lsupc++ -maix64"[/code] [u]tweaking make[/u] by creating build_so.tar (and place it in directory libcob) [code]#!/bin/sh gcc -shared libcob_la-common.o libcob_la-call.o libcob_la-strings.o libcob_la-move.o libcob_la-numeric.o libcob_la-intrinsic.o libcob_la-fileio.o libcob_la-termio.o libcob_la-screenio.o -o .libs/libcob.so $*[/code] and adding a line to libcob/Makefile (don't forget the tab) [code]libcob.la: $(libcob_la_OBJECTS) $(libcob_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libcob_la_LDFLAGS) $(libcob_la_OBJECTS) $(libcob_la_LIBADD) $(LIBS) [b]./build_so.sh $(LDFLAGS) $(CFLAGS) $(libcob_la_LIBADD) $(LIBS)[/b][/code] change to basedir and do[code]make[/code] [u]tweaking make check[/u] by modifying tests/atlocal [code]export COB_LIBS="[b]${abs_top_builddir}/libcob/.libs/libcob.so[/b] -lm -lgmp -lintl -lcurses"[/code] change to basedir and do[code]make check[/code] (most parts should work) [u]installing OpenCOBOL[/u] by [code]su make install cp config.h /opt/opencobol/include cp libcob/.libs/libcob.so /opt/opencobol/lib[/code] From reading these snippets I guess that cobcrun won't work (as there is no change in the Makefile for cobcrun). If somebody has a better way than the manual changes, please post it. In any case I hope these snippets help if somebody has a similar issue. human ---------------------------------------------------------------- Subject: For John John McCarthy discovered LISP while pondering computational syntax on a blackboard in front of a class, or so the story goes. [i]the actual facts, in his own words, are a little more complicated[/i]. http://www-formal.stanford.edu/jmc/history/lisp/lisp.html Thanks for everything John (exit) ---------------------------------------------------------------- Subject: ideone.com - try compilers online The site, http://ideone.com allows you to cut'n'paste COBOL code into its window and get syntax highlighting as well as compile/runs. Seems cool and it looks to be running open-cobol-1.0 for its COBOL compiler. tiny-cobol-0.65.9 for COBOL85 I only glanced, but it ran and highlighted the historical Hello sample from the wikipedia OpenCOBOL page just fine. Cheers, Brian ---------------------------------------------------------------- Subject: C DATA TYPE... Hi all, I have a trouble with struct C that I am writing using cobol since I need to manage it insiede opencobol. The C struc is [code] struct GdkEventKey { GdkEventType type; GdkWindow *window; gint8 send_event; guint32 time; guint state; guint keyval; gint length; gchar *string; guint16 hardware_keycode; guint8 group; guint is_modifier : 1; }; [/code] here the typedef used by the C structure http://developer.gnome.org/gdk/stable/gdk-Event-Structures.html#GdkEventKey This is the Cobol representation I made [code] 01 GTK-BASE-KEYBOARD based. 02 GTK-BASE-TYPE usage binary-long. 02 GTK-BASE-WINDOWS usage pointer. 02 GTK-BASE-FILLER usage BINARY-CHAR. 02 GTK-BASE-TIME usage BINARY-LONG UNSIGNED. 02 GTK-BASE-STATE usage BINARY-LONG SIGNED. 02 GTK-BASE-VAL usage BINARY-LONG SIGNED. 02 GTK-BASE-SIZE usage BINARY-LONG SIGNED. 02 GTK-BASE-CHAR usage pointer. 02 GTK-BASE-CODE usage BINARY-SHORT SIGNED. 02 GTK-BASE-GROUP usage BINARY-CHAR. 02 GTK-BASE-ID usage unsigned-int. [/code] Do you see some of wrong ? Federico ---------------------------------------------------------------- Well, I would think the issue may be that you are associating a C struct with a Cobol record. ;-) As with the Cobol record layout as specified, I believe the alignment as to where one field ends and where the next starts, is pretty straight forward. Where as with my experience, most C compilers align structure members on 4-byte boundaries, or on their natural alignment boundary depending on whichever is less. However, as with the C compilers I’ve worked with (either VC++ or z/OS), one could specify that the compiler, align structure members on 1-byte boundaries, by the use of the #pragma pack directive. [code] #ifdef _WIN32 #pragma pack(push) #pragma pack(1) #else // __MVS__ #pragma pack(packed) #endif struct GdkEventKey { GdkEventType type; GdkWindow *window; gint8 send_event; guint32 time; guint state; guint keyval; gint length; gchar *string; guint16 hardware_keycode; guint8 group; guint is_modifier : 1; // not sure but the smallest allowed is byte for Cobol }; #ifdef _WIN32 #pragma pack(pop) #else // __MVS__ #pragma pack(reset) #endif [/code] ---------------------------------------------------------------- Take a look at http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1110&forum=1#forumpost5484 as well Federico. SYNCHRONIZED is your friend, and Bill's da bomb. Worst case scenario (and probably the most portable) is a field by field move between the struct and the record when the structs get hairy. Cheers, Brian ---------------------------------------------------------------- Thank you so much for your (all) reply. The Sync "magic" solved all troubles.. the version 0.1.1 of the experimental I uploaded ran fine also (see below) but now I can access all struct item without adjustments. [code] 001880 linkage section. 001890 01 gtk-window usage pointer. 001900 01 gtk-data usage pointer. 001910 001920 procedure division using by value gtk-window by value gtk-data. if "key" of gtk-data = GTK-ESCAPE move "you pressed ESC" to "TEXT" OF EDIT2. [/code] Federico ---------------------------------------------------------------- Subject: missing compiler warning.. Hi this an error that is not caught from the opencobol compiler.. [code] IDENTIFICATION DIVISION. PROGRAM-ID. test1. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 77 TESTO PIC X(100) VALUE SPACE. PROCEDURE DIVISION. IF TESTO NOT = NULL DISPLAY "TEST OK". [/code] I used -save-temps to find the mistake...) test1.c: In function `test1_': test1.c:95: error: invalid operands to binary - Federico ---------------------------------------------------------------- Next version will report as [code] notnull.cob: 11: Error: Invalid expression [/code] but yeah, it's busted in 1.1pre-rel. Then again, it doesn't produce an untrustworthy binary as this is a bug luckily 'caught' further up the compile chain. Cheers, Brian ---------------------------------------------------------------- Hello About the next release ... When will it be available? We will have a correct management of the numeric pad? All news is welcome Thank you very much ---------------------------------------------------------------- Please don't switch the topic, open a new one if you'd like to "discuss" 2.0 release time (which is all up to Roger). human BTW: I'm not happy with waiting for a OC 2.0 pre-release with all the nice new features and the numerous bug fixes (including numeric keypad), too. But I simply have to... ---------------------------------------------------------------- I am missing something. What is wrong with the original cod (and what dialect is being used)? I think that NULL (NULLS) can only be compared to POINTER ty;pe data items in some dialects (where it is NOT a compare to binary zeros, but to an "ivnalid" address). While in other dialects it can be compared to any non-numeric data item (where it is a compare to binary zeros). Is this the issue? if not, what is the issue (and the dialect) ---------------------------------------------------------------- I used the standard opencobol dialect configuration. The trouble was issued from the c compilation step. As Brian told it doesn't compile and any object was produced since the C catch the missing warning.. Only It should be caught from the opencobol scanner parser instead. However nothing of so wrong... one can see the c file and solve .. Federico ---------------------------------------------------------------- Subject: Gambas OpenCOBOL GUI I received this note and am posting it for the sender: Greetings jcurrey, cause it's impossible to subscribe a new account to post the forums I'm writing to You. I only want to deliver to the community one possible sample to interface Open Cobol with Gambas GUI. It's downloadable at http://code.google.com/p/gambascobolgui/downloads/list So long. ---------------------------------------------------------------- That's wicked cool. Another interface. Nice sample code of using ENTRY to expose an effective API in a small piece of source. We need to get everyone in. Sadly, I'll ask through you Jim for permission to make the link a FAQ entry ([i]and pass on the rah-rah-biss-boom-bah[/i]). Cheers, Brian ---------------------------------------------------------------- @Brian (keeper of the FAQ) The original author has granted permission. jimc ---------------------------------------------------------------- Then I'll ask one more favour and have you tell them that it's in, as http://opencobol.add1tocobol.com/#can-opencobol-interface-with-gambas Thanks Jim (pass those thanks on as well if you would). Cheers, Brian ---------------------------------------------------------------- @Brian: I think you should include the GAMBAS definition for fillrow, too (as it is included in the COBOL part and uses COBOL items). human ---------------------------------------------------------------- Subject: Nanner nanner boo boo http://developers.slashdot.org/story/11/12/09/1533252/java-apps-have-the-most-flaws-cobol-the-least Slashdot posted an article about programming flaws. We win. [code] ... Java applications had the most problems and Cobol-built systems, the least. Some 365 million lines of code were analyzed by Cast Software to assess 'technical debt,' or the cost to fix the violations. Java was calculated at $5.42 per line of code, while Cobol did best at $1.26. ... [/code] [i]Being a little more serious than usual:[/i] Java is a great language. COBOL is a great language. I've never met a programming language I didn't like, but I have my own opinions as why COBOL sources incur less technical debt. It's not so much a nature issue as a nurture issue. (Generalizing...) Production COBOL code goes through far more stringent audits, developers expect this up front so pervasive due diligence is the rule not the exception. The nature of COBOL doesn't hurt in this case though. (Oh, and the fact that the world already paid the y2k techdebt, so those monies and efforts were not likely counted in this study) Cheers, Brian ---------------------------------------------------------------- Subject: Question about VALUE NULL, please check with other vendors Hi, I've come across a piece of code crashing an older version of cobc (at least in 1.0). This is fixed in 1.1 feb 09 but I'm unsure if it is valid: [code] 77 CAT-COUNT PIC 9(02) VALUE NULL.[/code] Should the code above compile? Shouldn't there occur some warning (maybe dependent on -std)? Can you verify if this compiles/works with other vendors? human ---------------------------------------------------------------- Cobol 85 on the HP3000 yields this: [code] 00050 004500 56 410 S SYNTAX ERROR. FOUND: NULL; EXPECTING ONE OF THE FOLLOWING: IS <NON-NUMERIC-LIT> <NUMERIC-LIT> <SYMBOLIC-NAME> ALL HIGH-VALUE LOW-VALUE QUOTE SPACE ZERO 00050 004500 60 980 I ATTEMPTING TO RECOVER FROM SYNTAX ERROR. 1 ERROR(s), 0 QUESTIONABLE, 0 WARNING(s) [/code] On the AS/400 the editor (SEU) objects to the syntax even before the compiler gets to see it. The editor error is: [code] CODASYL reserved word NULL found [/code] ---------------------------------------------------------------- To me, the "useful" tests would be to check that it does allow NULL where you want it and not where (some) compilers will reject it. (I.e. is "NULL" the same as LOW-VALUES (binary zeroes) or is it only valid for "undefined address). Thyr this test [code] 77 AlphaNum Pic X(4) Value Null. 77 Addr Value Null. [/code] Does the compiler allow the 2nd case but not the first? ---------------------------------------------------------------- Hmmm, to me zero is zero. However, the difference is the "context" on how it applies with figurative constants. As with the z/OS Cobol compiler [code] 000031 77 CAT-COUNT PIC 9(02) VALUE NULL. [/code] ==000031==> IGYGR1080-S A "VALUE" CLAUSE LITERAL WAS NOT COMPATIBLE WITH THE DATA CATEGORY OF THE SUBJECT DATA ITEM. THE "VALUE" CLAUSE WAS DISCARDED. Though, I didn’t have the time to try a slew of tests. The point being, the compiler only allows the NULL to be associated with pointer types, i.e. “USAGE IS POINTER”, “FUNCTION-POINTER”, etc. Likewise, LOW-VALUES is associated with alpha-number “PIC X” fields, and ZERO is only associated with the various “PIC 9” fields, i.e. “USAGE IS” … DISPLAY, PACKED-DECIMAL, COMP* , etc. Also, [code] 77 Addr Value Null. [/code] Would not compile, due to not have a associated data type nor having any sub-ordinates. ---------------------------------------------------------------- Subject: Installation under Windows 7 64 bit [solved] I had native windows installed under XP. That machine died. I am now attempting to install under Windows 7 and am not getting very far. I downloaded modules from Kiska, obtained C++ 2008 Express, extracted the modules, set the environment and tried to compile. I get a series of LNK1120 errors. I assume I've missed a step out but I cannot find any instructions as to how to do this; I'm sure there are some but I can't find them. Just to be specific I don't want to go down the mingw or cygwin routes. I have a 64 bit machine and downloaded "opencobol-1.1-win-vb-amd64-bin". Is this correct? Can somebody please point out the error(s) of my way. Steve ---------------------------------------------------------------- Are you sure you have an AMD64 installed? If not, download the Win32 binary (both will work on any 64 bit installation with AMD64 processor). Use the set_env.bat I've posted and try to get it working. If it still doesn't work: post exact error messages. human ---------------------------------------------------------------- I downloaded win32 binary; but it made no difference. I am still using 64 bit version of Visual C++. Is this my mistake. The messages I get are as follows: a.obj : error LNK2019: unresolved external symbol __imp__cob_stop_run referenced in function _main a.obj : error LNK2019: unresolved external symbol __imp__cob_init referenced in function _main a.obj : error LNK2019: unresolved external symbol __imp__cob_set_cancel referenced in function _A_ a.obj : error LNK2019: unresolved external symbol __imp__cob_check_version referenced in function _A_ a.obj : error LNK2019: unresolved external symbol __imp__cob_fatal_error referenced in function _A_ a.obj : error LNK2019: unresolved external symbol __imp__cob_module_leave referenced in function _A_ a.obj : error LNK2019: unresolved external symbol __imp__cob_display referenced in function _A_ a.obj : error LNK2019: unresolved external symbol __imp__cob_module_enter referenced in function _A_ a.exe : fatal error LNK1120: 8 unresolved externals This is actually from 64 bit version; but precisely same message for 32 bit. Have both 2008 and 2010 C++ Express Editions; is this confusing the issue in some ways. I have tried OC with both; having amended set_env.bat appropriately. Nothing appears to make any difference. Thanks for help. Steve ---------------------------------------------------------------- Seems like libcob is simply not linked. Please post all output from cobc A.cob -v. human BTW: as you've VS installed, you may want to build OC on your own (see http://www.kiska.net/opencobol/human/ ). ---------------------------------------------------------------- Forgive my ignorance, but how do I direct output of cobc -v to a file? Will try the "build my own OC route", if we can't progress down this track. Steve ---------------------------------------------------------------- Redirect all output from cobc and called compilers: [code]cobc -v A.cob 1>out.log 2>err.log[/code] human BTW: The "build own OC route" has some advantages. One of them: you don't need to set environments at all (if used on a system with same configuration and folders like the build system) - don't forget to change the defaults.h file according to your system. ---------------------------------------------------------------- Err.log output: Preprocessing: a.cbl to C:\Users\Steve\AppData\Local\Temp\cob6FB0.cob a.cbl:13: Warning: Line not terminated by a newline Return status: 0 Parsing: C:\Users\Steve\AppData\Local\Temp\cob6FB0.cob Return status: 0 Translating: C:\Users\Steve\AppData\Local\Temp\cob6FB0.cob to C:\Users\Steve\AppData\Local\Temp\cob6FB1.c Executing: cl -I c:/OpenCobol /MD /LD /Fe"a" /Fo"a" "C:\Users\Steve\AppData\Local\Temp\cob6FB1.c" c:/OpenCobol/libcob.lib c:/OpenCobol/mpir.lib /link /manifest Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. Return status: 2 File out: cob6FB1.c Microsoft (R) Incremental Linker Version 9.00.30729.01 Copyright (C) Microsoft Corporation. All rights reserved. /dll /implib:a.lib /out:a.dll /manifest a.obj c:/OpenCobol/libcob.lib c:/OpenCobol/mpir.lib Creating library a.lib and object a.exp a.obj : error LNK2019: unresolved external symbol __imp__cob_set_cancel referenced in function _A_ a.obj : error LNK2019: unresolved external symbol __imp__cob_check_version referenced in function _A_ a.obj : error LNK2019: unresolved external symbol __imp__cob_fatal_error referenced in function _A_ a.obj : error LNK2019: unresolved external symbol __imp__cob_module_leave referenced in function _A_ a.obj : error LNK2019: unresolved external symbol __imp__cob_display referenced in function _A_ a.obj : error LNK2019: unresolved external symbol __imp__cob_module_enter referenced in function _A_ a.dll : fatal error LNK1120: 6 unresolved externals setenv.bat @echo off call "%VS90COMNTOOLS%vsvars32.bat" echo Setting Environment for OpenCOBOL set PATH="C:\OpenCOBOL";%PATH% ---------------------------------------------------------------- I guess you've downloaded http://www.kiska.net/opencobol/1.1/opencobol-1.1-win-vb-win32-bin.zip and unzipped it to C:\OpenCOBOL correct? Just tested this with VC 2008 Express on WinXP 32 bit and it worked out of the box, doing cobc -v a.cbl (tested only without further switches). human BTW: If you want to use VC Express you have to use the 32 bit versions as 64 bit is not supported in Express versions. ---------------------------------------------------------------- Thank you. Clearly, I'm either doing something silly or things are getting confused with 2008, 2010, 32bit and 64 bit. If the machine isn't I am! I've removed some of the surplus but so far without success. I am in the course of setting up Virtual Box and will try on that. Alternatively, I will try the Ubuntu route. I will report back presently. Thanks for your help. Much appreciated. Steve ---------------------------------------------------------------- Just tested with Win7 64bit. If kiska's win32 are used with VC Express (here 2010) everything is OK. If kiska's win64 are used with VC Express or VC 2011 (full version) I get the same error messages from VC. Therefore I suggest you retry with VC Express (2008 or 2010) and with kiska's win32 package. human BTW (For later, when everything works with 32 bit): If you want to get 64 bit to work with VC express you should have a look at http://jenshuebel.wordpress.com/2009/02/12/visual-c-2008-express-edition-and-64-bit-targets/ (and build OC 64 bit on the new tweaked VC Express). ---------------------------------------------------------------- Have now got open cobol working with both VC Express 2008 and 2010; plus Kiska win32. Initial problems were clearly using Win64 version; later problems may well have been self-inflicted. Thank you very much for your time and patience. Steve ---------------------------------------------------------------- Subject: FR: Implement verb EXHIBIT I just found out about this extension and like it. See [url=http://www.microfocus.co.jp/manuals/VisCobR3_VS/HRLHLHPDF906.html]entry in MF docs[/url] and [url=http://coding.derkeiler.com/Archive/Cobol/comp.lang.cobol/2007-10/msg00350.html]discussion with W. Klein involved[/url]. human ---------------------------------------------------------------- anyone intested in this verb and who has been working with IBM COBOL for many years will know that this was originally an IBM extension, I think. using the CHANGED and NAMED options together provided a great "debugging tool" before interactive debuggers came along. ---------------------------------------------------------------- Thank you for the feedback. I believe that it is still very helpful as debugging via debugger isn't possible sometimes (for example if you need to track down a bug in a customers system guessing that EXHIBIT always goes to stderr). It's simply faster to code than the DISPLAY statements that would be necessary (see sample at [url=http://publib.boulder.ibm.com/infocenter/pdthelp/v1r1/index.jsp?topic=/com.ibm.entcobol.doc_4.1/MG/igymch1025.htm]IBM docs[/url]) human ---------------------------------------------------------------- Well, interesting. while looking through the IBM document, I saw the following: EXHIBIT statement OS/VS COBOL accepted the EXHIBIT statement; Enterprise COBOL does not. With Enterprise COBOL, you can use DISPLAY statements to replace EXHIBIT statements. However, the DISPLAY statement does not perform all the functions of the EXHIBIT statement. Though, I've worked with IBM Cobol for years, it was debugers like "Xpediter" by Compuware seem worth their weight in gold. I swear, back at my job, the last person whom I worked with that knew much about the “READY”, “TRACE”, “[b]EXHIBIT[/b]” also worked with punch cards. Though, I'm curious there was probably a reason why IBM removed it. :-? ---------------------------------------------------------------- History: EXHIBIT and (ready) TRACE were removed with the first relseae of VS COBOL II. This was the first release to introduce "COBTEST" (which replaced TESTCOB). IBM *definitely* wanted to mote users from "single run debugging" to using their interactive (full screen) debugger. If you really want to "test" an IBM mainframe OLD timer, ask them about "debugging packets" or the ON statement. ---------------------------------------------------------------- Subject: Bug (?) with LENGTH OF It is possible to do [code]DISPLAY LENGTH OF myvar END-DISPLAY ADD 1 to LENGTH OF myvar GIVING myvar2 END-ADD[/code] but not [code] PERFORM LENGTH OF myvar TIMES CONTINUE END-PERFORM[/code] This seems a little bit buggy. human ---------------------------------------------------------------- If the compiler allows that, it looks like a bug to me. The intrinsic function LENGTH certainly may NEVER be used as a receiving item. (See the Standard) The special register LENGTH also should not be used as a receiving item for compatibility with IBM, MF, etc. However, as this is an extension,it is up to OC whether they allow it or not. For the IBM restriction, for example, see .[url=http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3lr50/1.3.8.4 ]http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3lr50/1.3.8.4 [/url] By the way, the PERFORM is OK. It is only the ADD that should get a compiler error ---------------------------------------------------------------- The LENGTH is only the source as the ADD has a GIVING clause. I think all samples should compile OK (only the PERFORM is not compilable with OC). human ---------------------------------------------------------------- I also got a reject from the compiler.However when I use the format from G Cutler's Manual viz; length(myvar) times it all works. John. ---------------------------------------------------------------- Thank you for your feedback John. The working LENGTH (myvar) is an INTRINSIC FUNCTION, which works fine. LENGTH OF myvar isn't one. The FUNCTION is surely a workaround, but the bug with LENGTH OF is still a bug. human ---------------------------------------------------------------- I get the same error with DISPLAY as I got with PERFORM viz:"Function length has wrong number of arguments". The length of special register is a non ansi extension.The special registers in opencobol are listed in Table 15 of Paragraph 6.1.8 of G Cutler's Manual. Length of is not in the table. Nor is it present as far as I can see in Fujitsu Cobol. Even when the statement is changed to "display length(myvar) end-disply", it will not work even though it compiles without complaint. I have no authority to quote on this but my experiments suggest that the length function produces a binary number which will not display. You have to move the result to a display variable before you can display it. John. ---------------------------------------------------------------- Subject: Another new (free) COBOL available I have just become aware of another (new I belive) [u][i][b]FREE[/b][/i][/u] COBOL product. If you are interested in seeing it (and comparing it to OC), check out: [url=https://www.elasticcobol.com/]https://www.elasticcobol.com/[/url] The documentation on getting started is NOT very good. (I am still working my way thru it). It seems to have two free options. 1) There is a 14-day trial which allows you to test the more extensive version. I think you just select one of the full products and "cancel" after/before 14 days. 2) The version that I am playing with runs on the Cloud (the IDE and the compiler and the executables ALL run on the cloud, not on your machien. The response time on this is medium slow, but it does seem to be full function product (including SQL, HTML, and even CICS support) Checking the LRM, this compiler accepts a WIDE range of extensions (most Micro Focus and IBM extensions, and a number that I have never seen before) So far, their support has been pretty good in helping me with "getting started". This is [u][i][b]NOT[/b][/i][/u] an OPEN SOURCE product. If you are doing "real work" with their product and go with the non-free version, the pricing scheme is interesting (to me). ---------------------------------------------------------------- Subject: Moving or Renaming a file in 1.1 Gary Cutler's fabulous OpenCOBOL 1.1 Programmer's Guide at section 7.3.1 makes mention of the capability of "moving files (a destructive "copy")". I have not been able to find the CALL syntax for this command listed in the remainder of section 7.3. Have I missed something? If so, please direct me. Otherwise, does anyone know the syntax? jimc ---------------------------------------------------------------- Second last paragraph on page 7-25 [quote] 7.3.1.34. CALL “CBL_RENAME_FILE” USING old-file-path, new-file-path You may use this subroutine to rename a file. The file specified by old-file-path will be “renamed” to the name specified as new-file-path. Each argument may be an alphanumeric literal or data item. Despite what the name of this routine might make you believe, this routine is more than just a simple “rename” – it will actually move the file supplied as the 1st argument to the file specified as the 2nd argument. Think of it as a two-step sequence, first copying the old-file-path to the new-file-path and then a second step where the old-file-path is deleted. If the attempt to move the file fails (for example, it doesn't exist), RETURN-CODE will be set to 128; on successful completion it will be set to 0. [/quote] ---------------------------------------------------------------- Thank you. I looked for that for over an hour. Must have been brain freeze. jimc ---------------------------------------------------------------- Be aware that you have to handle index files yourself (.idx for *ISAM, .1-.n for BDB). human ---------------------------------------------------------------- Subject: Santa Claus. Best wishes to all. Santa has gone. We all hoped he would bring 2.0. No gift under christmas three. I've not been working anymore on oc since late spring. Current 1.1 doesn't handle split keys (so: sql) but not all params are passed to query (see Jim Currey question). It neither allows full path in subprogram calling. For me, it is impossible to go on with oc testing. My offer to Roger to give help has had no answer. I wish you all an happy new year. Marcellom ---------------------------------------------------------------- Sad to read your posting. I'm not sure Father Christmas exists but I wander if OC development is relying on help from his elves! Happy New Year! Felice anno nuovo! ---------------------------------------------------------------- Let's not exaggerate! OpenCOBOL (current version) is already a gift. Check out the side of GUICOBOL and you will see that a "sprite" that really worked for us during the year 2011. This is not a gift that? Some struts of the GUI, but if Santa was a girl, it's something that we would notice first ... I remain convinced that version 2.0 will be available in 2012. Many thanks to all those who have advanced this project. Happy New Year to All. ---------------------------------------------------------------- Allow me to echo aouizerate's sentiment. 1.1 is functional and we are greatful for it. Each of us has different requirements and I am sorry that 1.1 does not fit your needs. When 2.0 comes along we will evaluate it and at that point may even be more blessed. I wish the entire community a wonderful 2012. jimc ---------------------------------------------------------------- An honest politician, a kind lawyer and Santa Claus were walking down the street and saw a $20 bill. Which one picked it up?? Santa! The other two don't exist! Cheers, Brian ---------------------------------------------------------------- Hi Brian, I was told there was a celibate priest as well. Cheers, Marcello ---------------------------------------------------------------- Hi Jim, I agree with you. Anyhow, a push from time to time doesn't waste. Marcello ---------------------------------------------------------------- As a relative new-comer to the "OpenCobol community", I'd like to add my support to the above. I appreciate the work put into OpenCobol and acknowledge the achievements made by the developers: for anyone interested in an open-source Cobol compiler, OpenCobol is the front runner. Thank you to all those involved. But also from the perspective of a new-comer, I wonder if some points are being overlooked by those "close-up" to the project. When first visiting this web-site, you click on "NEWS" and the (only) posting is dated 2007. Click on "READ MORE" and ... well look for yourself. To a new visitor this looks like a "zombie site". I moved on to COBOL-IT - the French branch. Now we're back-tracking our installations away from COBOL-IT reverting to OpenCobol because we now realise that OpenCobol is alive (and kicking)! The same impression is given by the "DOWNLOADS" page. OpenCOBOL version 1.1 prerelease is dated 2007. Now even for a time-served hacker like me who started on COBOL in 1968, 4/5 years is a long time between releases. It generally means one of three things: the product is perfected and requires no further development. Alternatively, the project has run out of steam and is dormant. Or finally, the project has migrated to another home and/or team. From my perspective, it's not that I have a wish list of new features; just the need to know that project is "alive". The superb manual and the FAQ section have reassured us on this score. Thanks again to you all. Oh and: Happy New Year! ---------------------------------------------------------------- Hi, I fully agree with JoeRobbins. Please, Roger, if you are still there, just post something. Say "I have no time." Say "I am working on something else and will be back in open cobol YYYYMMDD". Say "I am working on it but things to do are several and I need xx months". Say "I need cooperation on ....." You cannot go on saying nothing. Marcellom ---------------------------------------------------------------- I'm only 'speaking for Roger' as I feel for us all and the current situation. Work on 2.0 continues. Real life is the priority though. To anyone reading along, there are a few reasons for the current state of silence, but things are progressing in the background. We have two 'elephants in the room' at the moment. opencobol.org became a target for spam. That has to be fixed and again, work is progressing, but in spurts. When a new site is ready, it'll be a flurry of activity. I'm going to try and discuss temporary measures with Keisuke and Roger so we can get new accounts created without overwhelming anyone. 2.0 is still not ready. Might not be for a while. I'm also going to press for 1.1pre-rel being tagged as a 1.1 release so the distro package builders feel confident about updating the open-cobol pre-builts. That could alleviate a lot of the dependency hell that new users are put through getting 1.1 up and running with SCREEN section and an out-of-the-box ISAM. For my part, I'm still playing about with Guile integration and leaning toward full on GObject Introspection http://live.gnome.org/GObjectIntrospection There is no real lack of cool things to do from the community involvement side. We'll still take submissions for the /extras folder and that could get some user written utilities into the mix. Marcellom; and to that, anyone else; If you need more information, drop me a PM and I'll try and pass on my understanding of the current state of affairs. And if you jones to discuss more, drop by irc.mibbit.net and the #add1.to channel with an IRC client. It's a 'hangout', responses may take a while, so post and then hangout. Cheers, Brian ---------------------------------------------------------------- Hallo Brian, thanks for your post. I, and perhaps someone else, now knowes that Roger has ears and thong (you). If you think mibbit is the prefereable mean, ok. thanks again, marcello ---------------------------------------------------------------- Subject: startup questions We know that new users are not able to register to post on the forum right now so I am forwarding notes that I receive. This one is from Yaphet: Hello, I have downloaded and start trying out the OpenCOBOL compiler. It is great! I have learnt a lot about COBOL is just a few days! I am planning to write an application for my own business (a small database). I am using Windows 7. However, I have a few questions: - When trying to use any Text-User-Interface, the command prompt will just fail. The "coloured" text (or text with sound) will just appear, but then it will not go to the next line, and even if I press enter nothing happens until I have to terminate the program by force. Is it that there is something wrong with my command prompt? I cannot even open the TUI that comes with OpenCOBOL . - Second, when I compile my program into an executable .EXE, And I transfer the file into another computer, it says it cannot be executed because it lacks the COBLIB, am I doing something wrong or must I install the COBLIB in every computer I want my program to run. Finally, I would like to join the forum if it is possible, and be part of this community. Thank you, Yaphet ---------------------------------------------------------------- ... standard questions: to 1st: What win binary do you use (MinGW package/binaries from kiska.net/self built with xyz) and which version (cobc --version)? to 2nd: If you want to use the generated programs on other computers (no matter if you compile to an EXE or a DLL) you need all dependencies (which are at least libcob.dll and libgmp.dll and likely some for ISAM like libdb and for graphics like cursees, too). human ---------------------------------------------------------------- Subject: DB2 and sqlstrt Walter sent me this note and I am posting it on the forum for him. Hello, I tried for several weeks to registrate for the OpenCobol forum, but I still get the message that it's not possible. I recently started to use OpenCobol on a Windows computer (OS is Windows Vista). I have been working with a few simple programs and it works well. The next step for me is using DB2 in combination with OpenCobol. After installing DB2 I tried some of the examples that can be found in the folder drive:\IBM\SQLLIB\samples\COBOL\. Pre-compile, compile and binding work fine but the execution of my programs always fail. The connection to the database with user and password are OK but all my compiled programs crash on the execution of the SQL-statement (SELECT or UPDATE or DELETE). I used the DISPLAY-statement and found that the call to "sqlgstrt" is causing the problem. This call is inserted by the precompiler. The same call is used by the connection to the database and it's working without problems there. Do you know what can cause my programs to crash everytime. I believe that "sqlgstrt" is written in C. For the moment I have Visual Studio 2010 installed on my computer. Can you help me to solve my problem or tell me where I can find more information. Kind regards Walter Verbraeken ---------------------------------------------------------------- Well, I have not tried using OC with DB2, however I think there was already a thread opened on the subject. See [url=http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1135&forum=1]Compiler example connection DB2 Exp[/url] ---------------------------------------------------------------- The best way to get this done is by patching the "libcob.h" file in the OpenCobol/include folder. Insert these lines at the end of the file like this: [code] #ifdef DB2SQL #include <sqlaprep.h> #endif #endif /* COB_LIBCOB_H_ */ [/code] After this you will be able to precompile, compile and link with the following options: [code] db2 precompile your_source.sqb bindfile using your_source.bnd target ANSI_COBOL cobc -v -x -I C:\PROGRA~1\IBM\SQLLIB\lib -fstatic -D DB2SQL your_source.cbl [/code] By using the "-D DB2SQL" option the C-Compiler will do the "#include <sqlaprep.h>" and your program will be ready to run. I hope this helps you :-) Regards, Franklin ---------------------------------------------------------------- From Walter: [code] Hello, In the OpenCobol forum there was an answer to the problem I had sent to you for posting since it's still not possible to register as a new user. It concerns the post with subject 'DB2 and sqlstrt'. The reaction to this subject was from Franklin. Could you be so kind to post the following as my reaction to this post : Hello Franklin, Thank you for your reaction. I tried it just as you described it but it seems that the compilation is not working correct because I don't get an .exe file as a result. I also don't get error messages during compilation. This is the content of my libcob.h file : #ifndef COB_LIBCOB_H #define COB_LIBCOB_H #include <gmp.h> #ifdef __cplusplus extern "C" { #endif #include <libcob/byteswap.h> #include <libcob/call.h> #include <libcob/common.h> #include <libcob/fileio.h> #include <libcob/move.h> #include <libcob/numeric.h> #include <libcob/screenio.h> #include <libcob/strings.h> #include <libcob/termio.h> #include <libcob/intrinsic.h> #include <libcob/codegen.h> #ifdef DB2SQL #include <sqlaprep.h> #endif #ifdef __cplusplus } #endif #endif /* COB_LIBCOB_H_ */ After changing the libcob.h file, I precompiled the program : db2 => connect to sample Database Connection Information Database server = DB2/NT 9.7.5 SQL authorization ID = VERBRAWP... Local database alias = SAMPLE db2 => prep g:\eclipse\workspace\test\omzet2\updat.sqb bindfile target ANSI_COBOL LINE MESSAGES FOR updat.sqb ------ -------------------------------------------------------------------- SQL0060W The "COBOL" precompiler is in progress. SQL0091W Precompilation or binding was ended with "0" errors and "0" warnings. db2 => The result is a .bnd file and a .cbl file. The .cbl file is compiled as following : G:\Eclipse\Workspace\Test\OMZET2>cobc -v -x -I f:\ibm\sqllib\lib -fstatic -D DB2SQL updat.cbl cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Sep 10 2010 10:12:33 Packaged Feb 06 2009 10:30:55 CET As a result of the compilation I expected a .exe file which was not generated. Can you tell me what I did wrong and how I can solve it. Kind regards Walter Verbraeken Thank you for posting my reaction. Kind regards Walter Verbraeken [/code] ---------------------------------------------------------------- In this case cobc does not do anything at all, only [code] [b]--version, -V Display compiler version[/b] -v Display the programs invoked by the compile[/code] Either the command processing of this cobc isn't working or -V was used instead of -v. Where is the cobc from? In any case, leaving the -v out could work (as it is only supposed to show what the compiler is doing) - if everything else is OK. human ---------------------------------------------------------------- From Walter: [code] Hello, there was no file made. Meanwhile 'human' posted a response and I would like to post the following comment to it : Hello human, the version of cobc that I'm using is of the mingw package of OC 1.10. I compiled my program without the -v option with the following as result : G:\Eclipse\Workspace\Test\OMZET2>cobc -x -I f:\ibm\sqllib\lib -fstatic -D DB2SQL updat.cbl updat.cbl: In section 'MAIN': updat.cbl:92: Error: 'SQLCA' undefined updat.cbl:164: Error: 'SQLCA' undefined updat.cbl:167: Error: 'SQLCODE' undefined updat.cbl:177: Error: 'SQLCA' undefined updat.cbl:219: Error: 'SQLCODE' undefined updat.cbl:221: Error: 'SQLCA' undefined updat.cbl:233: Error: 'SQLCA' undefined updat.cbl:275: Error: 'SQLCA' undefined updat.cbl:286: Error: 'SQLCA' undefined updat.cbl:328: Error: 'SQLCA' undefined updat.cbl:338: Error: 'SQLCA' undefined updat.cbl:356: Error: 'SQLCA' undefined updat.cbl:366: Error: 'SQLCA' undefined updat.cbl:384: Error: 'SQLCA' undefined I changed my program and added the copy of SQLCA en SQLENV in the working storage section of it. After precompiling I compiled the program again but this time I got error messages concerning syntax errors in sqltypes.h, sql.h and sqlenv.h include/sqltypes.h:17: error: syntax error before "UDWORD" include/sqltypes.h:18: error: syntax error before "UWORD" include/sqltypes.h:24: error: syntax error before "PTR" include/sqltypes.h:25: error: syntax error before "HENV" include/sqltypes.h:26: error: syntax error before "HDBC" include/sqltypes.h:27: error: syntax error before "HSTMT" include/sqltypes.h:29: error: syntax error before "SQLCHAR" include/sql.h:346: error: syntax error before "SQLUSMALLINT" include/sql.h:348: error: syntax error before "SQLCHAR" include/sql.h:349: error: syntax error before "SQLUSMALLINT" include/sql.h:351: error: syntax error before "SQLCHAR" include/sql.h:352: error: syntax error before "SQLCHAR" include/sql.h:357: error: syntax error before "SQLUSMALLINT" include/sql.h:358: error: syntax error before "SQLCHAR" These are just a few of the error messages. Can you help me to find a solution to compile and execute a DB2-programs. I'm using Windows Vista 32-bit with DB2 Express-c version 9.7 and the mingw package of OC. Kind regards Walter Thank you for posting my response. Kind regards Walter Verbraeken [/code] ---------------------------------------------------------------- Hi Walter, the first thing I'd do, is to switch to a VC version instead of the MinGW one. (You can use an "Express" version, too - even for commercial stuff from VC 2008 on.) Here you would get other error messages - I'm sure the DB2 package would work better with VC - you can easily try to use them with [url=http://www.kiska.net/opencobol/1.1/opencobol-1.1-win32-bin.zip]this package[/url] from www.kiska.net (but you need a VC version for compiling and VC redist for using the compiled stuff) - only set some env vars before and modify libcob.h if you want to. You need to know what syntax errors are errored. human ---------------------------------------------------------------- From Walter: [code] Hello, could you be so kind to post this message to the OC forum, concerning the subject 'DB2 and sqlstrt'. Hi human, Visual Studio 2010 is already installed on my computer. I have downloaded and installed the software from www.kiska.net (opencobol-1.1-win32-bin). I believe there are two possibilities for precompiling my DB2-program. The first one is by using the prep-command on the DB2 command-line processor and the second way is using the ESQL for ODBC for OC package from www.kiska.net. Which is the preferred way for precompiling a cobol program that uses DB2 tables. Could you also explain me the advantage of modifying libcob.h. I believe you refer to the following modification of this file : #ifdef DB2SQL #include <sqlaprep.h> #endif Could you also explain me which environmental variables I have to set, for getting the best result. Kind regards Walter Kind regards Walter Verbraeken [/code] ---------------------------------------------------------------- The problem you have is probably caused by doing the #include <sqlaprep.h> at the wrong place. Make sure you put it outside of the closing "}" of the __cplusplus like this: [code] #ifdef __cplusplus } #endif #ifdef DB2SQL #include <sqlaprep.h> #endif #endif /* COB_LIBCOB_H_ */ [/code] Make sure that the Environment variable COBCPY also points to the IBM DB2 Directory for the copybook "sqlca.cbl" and the INCLUDE variable points to the IBM DB2 include dirctory. The reason for patching libcob.h is because the DB2-Api uses the calling-convention __stdcall which is defined by doing this #include. If you don't do this the linker won't be able to resolve the references to the "sql*" entries. I actualy also use Sergey's binary distro from www.kiska.net (opencobol-1.1-win32-bin) with Visual Studio Express 2008 and DB2 V9.7 and it is working fine. I also know that VS Express 2010 works well too. Regards, Franklin ---------------------------------------------------------------- Walter asked me to pull this post down and replace it with the next one in this thread. I do not know the protocol for this so I am leaving the old message up in case someone finds value in it. Walter has asked that I replace this message with the one posted next. ***********************PLEASE DISREGARD THIS POST************* From Walter [code] Hello, could you be so kind to post this message to the OC forum, concerning the subject 'DB2 and sqlstrt'. Hi, I precompiled the cobol program with the prep-command and I got as result an .cbl and a .bnd file. The compilation of the .cbl gives me some errors in the linking stage. G:\Eclipse\Workspace\Test\OMZET2>cobc -x -I F:\IBM\SQLLIB\include\cobol_a updat.cbl cobBFEB.c Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. Microsoft (R) Incremental Linker Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved. /out:updat.exe updat.obj c:/OpenCobol/libcob.lib c:/OpenCobol/gmp.lib MSVCRT.lib(crtexe.obj) : error LNK2019: unresolved external symbol __imp__HeapSetInformation@16 referenced in function ___tmainCRTStartup MSVCRT.lib(crtexe.obj) : error LNK2019: unresolved external symbol __imp__EncodePointer@4 referenced in function _pre_c_init MSVCRT.lib(atonexit.obj) : error LNK2001: unresolved external symbol __imp__EncodePointer@4 MSVCRT.lib(atonexit.obj) : error LNK2019: unresolved external symbol __imp__DecodePointer@4 referenced in function __onexit updat.exe : fatal error LNK1120: 3 unresolved externals Can you explain me how I can solve this errors. I'm using the OC package from www.kiska.net. Kind regards Walter Kind regards Walter Verbraeken [/code] ---------------------------------------------------------------- From Walter: [code] Hello, could you please ignore my previous message and use this one instead of it. Hi Franklin, I just tried out the advice you gave me but I still don't succeed in compiling the program correctly. I changed the libcob.h file : #ifndef COB_LIBCOB_H #define COB_LIBCOB_H #include <gmp.h> #ifdef __cplusplus extern "C" { #endif #include <libcob/byteswap.h> #include <libcob/call.h> #include <libcob/common.h> #include <libcob/fileio.h> #include <libcob/move.h> #include <libcob/numeric.h> #include <libcob/screenio.h> #include <libcob/strings.h> #include <libcob/termio.h> #include <libcob/intrinsic.h> #include <libcob/codegen.h> #ifdef __cplusplus } #endif #ifdef DB2SQL #include <sqlaprep.h> #endif #endif /* COB_LIBCOB_H_ */ I changed the COBCPY variable to : F:\IBM\SQLLIB\include\cobol_a When I compile the program I get some error messages from the linker : G:\Eclipse\Workspace\Test\OMZET2>cobc -x -I F:\IBM\SQLLIB\lib -fstatic -D DB2SQL updat.cbl cob8149.c C:\Users\VERBRA~1\AppData\Local\Temp\cob8149.c(1918) : warning C4133: 'function' : incompatible types - from 'unsigned char [136]' to 'sqlca *' C:\Users\VERBRA~1\AppData\Local\Temp\cob8149.c(2152) : warning C4133: 'function' : incompatible types - from 'unsigned char [136]' to 'sqlca *' C:\Users\VERBRA~1\AppData\Local\Temp\cob8149.c(2320) : warning C4133: 'function' : incompatible types - from 'unsigned char [136]' to 'sqlca *' C:\Users\VERBRA~1\AppData\Local\Temp\cob8149.c(2472) : warning C4133: 'function' : incompatible types - from 'unsigned char [136]' to 'sqlca *' C:\Users\VERBRA~1\AppData\Local\Temp\cob8149.c(2624) : warning C4133: 'function' : incompatible types - from 'unsigned char [136]' to 'sqlca *' C:\Users\VERBRA~1\AppData\Local\Temp\cob8149.c(2713) : warning C4133: 'function' : incompatible types - from 'unsigned char [136]' to 'sqlca *' Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. Microsoft (R) Incremental Linker Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved. /out:updat.exe updat.obj c:/OpenCobol/libcob.lib c:/OpenCobol/gmp.lib updat.obj : error LNK2019: unresolved external symbol _checkerr referenced in function _updat_ updat.obj : error LNK2019: unresolved external symbol _sqlgstop@4 referenced in function _updat_ updat.obj : error LNK2019: unresolved external symbol _sqlgcall@20 referenced in function _updat_ updat.obj : error LNK2019: unresolved external symbol _sqlgstlv@28 referenced in function _updat_ updat.obj : error LNK2019: unresolved external symbol _sqlgaloc@16 referenced in function _updat_ updat.obj : error LNK2019: unresolved external symbol _sqlgstrt@12 referenced in function _updat_ MSVCRT.lib(crtexe.obj) : error LNK2019: unresolved external symbol __imp__HeapSetInformation@16 referenced in function ___tmainCRTStartup MSVCRT.lib(crtexe.obj) : error LNK2019: unresolved external symbol __imp__EncodePointer@4 referenced in function _pre_c_init MSVCRT.lib(atonexit.obj) : error LNK2001: unresolved external symbol __imp__EncodePointer@4 MSVCRT.lib(atonexit.obj) : error LNK2019: unresolved external symbol __imp__DecodePointer@4 referenced in function __onexit updat.exe : fatal error LNK1120: 9 unresolved externals The linker is using a file named kernel32.lib which I could not find on my computer. I've downloaded a version from 2006. Some other files that the linker could not find where on my computer, but after copying these files to the working-directory that problem was solved. Could you tell me which environment variable I have to change so the linker will find these files in their own directories ? The version of Visual Studio 2010 is not the Express version. Could this be a problem ? Could you give me some more advice on what can be wrong. Kind regards Walter Kind regards Walter Verbraeken [/code] ---------------------------------------------------------------- Hi Walter, i just setup a simular environment using Visual Studio 2010, by doing so i was able to find out what i forgot to tell you :-? I've set the following Environment variables: [code] COB_CONFIG_DIR=D:\OpenCobol\config COB_LIBS=libcob.lib gmp.lib db2api.lib COBCPY=C:\Program Files\IBM\SQLLIB\include\cobol_a INCLUDE=C:\Program Files\IBM\SQLLIB\include;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include;D:\OpenCobol\include; LIB=C:\Program Files\IBM\SQLLIB\LIB\win32;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\LIB;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib;D:\OpenCobol\lib [/code] The Problem is the 64bit db2api.lib which is in "C:\Program Files\IBM\SQLLIB\LIB" so make sure the LIB variable points to "C:\Program Files\IBM\SQLLIB\LIB\win32" as described above. The unresolved external symbol "_checkerr" can be resolved by adding the checkerr.cbl to your compile, by doing this the cobol modules will be linked together: [code] cobc -v -x -fstatic -D DB2SQL updat.cbl checkerr.cbl [/code] I haven't been able to get the remaining Warning messages away, they don't seem to disturb. I'll try to find a solution and will let you know. Things should be working for you now, let me know if you have any trouble! Regards, Franklin Ankum If you want to give me a PM, just use my firstname + underscore + lastname at hotmail(dot)com ---------------------------------------------------------------- Hi Walter, Hi Franklin, if you patch libcob.h I'd add the linking of db2api there [code] #ifdef DB2SQL #include <sqlaprep.h> #pragma comment( lib, "db2api" ) #endif[/code] @Walter: As you use a VC version now, the -v switch should work again (showing you what the compiler does). At least for production stage I'd recompile OC using your version of VC - you should not need any lib file you don't have on your computer (project files for building OC on your own can be found at kiska.net, too). human ---------------------------------------------------------------- Hi Human, thanks for the great tip. :-) This will remove the need of adding the db2api.lib to the COB_LIBS environment variable. But still make sure to use the korrekt version (32bit) of db2api.lib Regards, Franklin ---------------------------------------------------------------- Subject: Statefull CGI Michael is unable to register to post on the forum and sent me the following for posting: A great working example written by Brian Tiffin, of COBOL processing an ajax request sent by a client Web browser, cool stuff! if (name-string(name-index) = "REQUEST_METHOD") and (value-string = "POST") open input webinput read webinput at end move spaces to postchunk end-read Then the response is sent back to the client browser, from the server, using a COBOL DISPLAY. Now this gets me thinking about putting many old COBOL apps on the web, and a question comes to mind. Can a single COBOL process send and receive data to and from a web browser, just like it did with the old terminal? The only difference would be instead of the old terminal instructions, it would now send/receive JSON ogjects. The JSON objects would then be processed in the web browser using javascript, could be cool with HTML5 and CSS3. My normal method is to play around with it, and eventually I get the answer from the process. Playing around with it, I modify this example to process multiple ajax requests within the same cgi process. Sadly the next 'read webinput' does not wait for more data to be sent from the browser. I was hoping it would wait, after-all, webinput is actually stdin, and usually when reading from stdin the process will be blocked/locked until there is actual data to be read. The fact is that Web server CGI I/O is non-blocked I/O. Anyone have any suggestions, how would you code this to wait for another ajax request? I'm thinking that maybe FastCGI might be a solution, and since I generally use a Tcl interpretor with COBOL, maybe using Tcl with FastCGI would be even better. -- All ideas welcome! Mike. ---------------------------------------------------------------- Mike, My understanding of the issue led us to the same conclusion: the CGI program terminates when it sends it's output. Years ago we built a product for the HP3000 that allowed us to define an html template (form) and then put data into it and take data from it via a CGI Cobol program. This allowed us to keep the html out of the Cobol code. Alas it was stateless. In the Linux world last year we wrote some programs that use sockets to send data to and receive data from the browser and then route it to a long-running program that does it's I/O though transient programs. We are not completely happy with it. Under some conditions something happens (or does not happen) and we end up with some of the transient programs becoming orphans and never dieing. The users are not affected but we feel that it clutters up our server. Our solution for the time being has been to stop and restart the long-running program once a day. I guess my point is that it is possible to solve the stateless problem and that we are very close. ---------------------------------------------------------------- Well, maybe I’m a bit confused. However, when I think of CGI, I imagine an older design, where a web request is received, which then spawns an internal process that generates a response. When I think of the issue of maintaining states in CGI, I’m wondering what Web Architecture is being used? I question, why should the individual Cobol application program be handling the detail parsing of the input web request? Shouldn’t there be a wrapper or some implemented web server facility to block/unblock individual requests/responses to be passed as parameters into the invoked Cobol program? Should there also be existing web server facilities which could be called from the Cobol program to maintain application/session states? Someone time ago, I though about a concept to create a customize generic Apache/module to serve as a layer/wrapper to individual Cobol modules. Then again, I thought, wouldn’t that be some what like, re-inventing the wheel? Also, wasn't there an existing thread to implement, OC JNI module? Couldn't that concept be experimented with, to work with JSP pages? ---------------------------------------------------------------- Subject: OpenCobol INDEXED FILE: What constraints are placed on key order and presence? I have a problem with ORGANIZATION INDEXED files in OpenCobol. Can anyone please confirm the constraints/limitations OpenCobol imposes: does OpenCobol require all keys to be declared in the SELECT statement (in exactly the same order) each time a specific INDEXED file is opened? As far as I can tell, the constraints imposed by OpenCobol are independant of which ISAM handler is being used. This code in OpenCobol's fileio.c module appears to try to match its list of keys (from the COBOL source program) one-for-one against the "dictionary" of keys provided by the ISAM handler. This crude matching will fail of course, if the COBOL program specs (say) a single (primary) key when the ISAM handler recognises (say) 3 keys. I'll post sample COBOL code in the next message; here's the snippet from fileio.c: [code] for (k = 0; k < fh->nkeys; k++) { memset (&fh->key[k], 0, sizeof(struct keydesc)); isindexinfo (isfd, &fh->key[k], k+1); if (fh->lenkey < fh->key[k].k_leng) { fh->lenkey = fh->key[k].k_leng; } /* Verify that COBOL definition matches the real ISAM file */ if (f->keys[k].flag) { if (!(fh->key[k].k_flags & ISDUPS)) { ret = COB_STATUS_39_CONFLICT_ATTRIBUTE; } } else { if (fh->key[k].k_flags & ISDUPS) { ret = COB_STATUS_39_CONFLICT_ATTRIBUTE; } } if (fh->key[k].k_nparts != 1 || fh->key[k].k_start != f->keys[k].offset || fh->key[k].k_leng != f->keys[k].field->size) { ret = COB_STATUS_39_CONFLICT_ATTRIBUTE; } } [/code] ---------------------------------------------------------------- Here's a COBOL Source to illustrate my suspicions regarding OpenCobol and IDEXED file keys: [code] 000010 identification division. 000020* 000030* isam_05 is a member of the BCS ISAM test suite. 000040* Test: INDEXED file misc tests 000050* 000060*----------------------------------------------------------------- 000070* 000080 program-id. isam_05. 000090 author. BCS/JR. 000100 installation. 000110 date-written. December 2011. 000120 date-compiled. 000130*----------------------------------------------------------------- 000140* 000150 environment division. 000160 configuration section. 000170 special-names. currency sign is "#". 000180 000190 input-output section. 000200 file-control. 000210* Create new file-05 using this FD 000220 select file1 000230 assign to "/tmp/isam-file-05" 000240 status is f-status 000250 lock mode is manual 000260 organization indexed 000270 access sequential 000280 record key file1-key-1 000290 alternate record key file1-key-2 000300 alternate record key file1-key-3. 000310* 000320* Read file-05: keys declared in different order 000330 select file2 000340 assign to "/tmp/isam-file-05" 000350 status is f-status 000360 lock mode is manual 000370 organization indexed 000380 access sequential 000390 record key file2-key-1 000400 alternate record key file2-key-3 000410 alternate record key file2-key-2. 000420* 000430* Read file-05: only primary key declared 000440 select file3 000450 assign to "/tmp/isam-file-05" 000460 status is f-status 000470 lock mode is manual 000480 organization indexed 000490 access sequential 000500 record key file3-key-1. 000510 000520 data division. 000530 file section. 000540 fd file1. 000550 1 file1-record. 000560 2 file1-key-1 pic x(1). 000570 2 file1-key-2 pic x(2). 000580 2 file1-key-3 pic x(3). 000590 2 file1-2 pic x(10). 000600 000610 fd file2. 000620 1 file2-record. 000630 2 file2-key-1 pic x(1). 000640 2 file2-key-2 pic x(2). 000650 2 file2-key-3 pic x(3). 000660 2 file2-2 pic x(10). 000670 000680 fd file3. 000690 1 file3-record. 000700 2 file3-key-1 pic x(1). 000710 2 file3-key-2 pic x(2). 000720 2 file3-key-3 pic x(3). 000730 2 file3-2 pic x(10). 000740 000750 000760*----------------------------------------------------------------- 000770* 000780 working-storage section. 000790 77 version pic x(17) value "4.00 (09082001)". 000800 77 w-eoj pic 9. 000810 88 eoj value 1. 000820 77 f-status pic xx. 000830 88 f-status-ok value "00". 000840* 000850 000860*----------------------------------------------------------------- 000870* 000880 procedure division. 000890 a00-control section. 000900 a00-000. 000910 display version. 000920 perform a10-test-ignored-keys 000930 stop run. 000940*----------------------------------------------------------------- 000950* 000960* Create a file indexed with 3 keys. 000970* Read it via FD with keys declared in different order. 000980* Read it via FD with only 1 index declared. 000990* 001000 a10-test-ignored-keys section. 001010 a10-000. 001020 perform a11-create-file. 001030 perform a12-read-file. 001040 perform a13-read-file. 001050 go to a10-exit. 001060* 001070 a10-exit. 001080 exit. 001090*----------------------------------------------------------------- 001100 a11-create-file section. 001110 a11-000. 001120 display "... creating /tmp/isam-file-05 - MULTIPLE KEYS". 001130 open output file1. 001140 if f-status-ok 001150 display "opened file OK" 001160 else 001170 display "!!! failed to open file: status=" f-status 001180 stop run. 001190 move "A" to file1-key-1. 001200 move "AA" to file1-key-2. 001210 move "AAA" to file1-key-3. 001220 perform a11-100-write thru a11-exit. 001230 move "B" to file1-key-1. 001240 move "BB" to file1-key-2. 001250 move "BBB" to file1-key-3. 001260 perform a11-100-write thru a11-exit. 001270 move "C" to file1-key-1. 001280 move "CC" to file1-key-2. 001290 move "CCC" to file1-key-3. 001300 perform a11-100-write thru a11-exit. 001310* 001320 display "... closing /tmp/isam-file-05". 001330 close file1. 001340 if f-status-ok 001350 display "... a11 create /tmp/isam-file-05 OK" 001360 else 001370 display "!!! failed to close file1: status=" f-status 001380 stop run. 001390 go to a11-exit. 001400* 001410 a11-100-write. 001420 write file1-record. 001430 if not f-status-ok 001440 display "!!! failed to write file: status=" f-status 001450 stop run. 001460 go to a11-exit. 001470* 001480 a11-exit. 001490 exit. 001500*----------------------------------------------------------------- 001510* 001520 a12-read-file section. 001530 a12-000. 001540 display x"0a" "... reading /tmp/isam-file-05 - MULTI KEY". 001550 open input file2. 001560 if f-status-ok 001570 display "opened file OK" 001580 else 001590 display "!!! failed to open file2: status=" f-status 001600 go to a12-exit. 001610 move 0 to w-eoj. 001620 perform a12-100-read thru a12-exit 001630 until eoj. 001640 display "... a12 closing /tmp/isam-file-05". 001650 close file2. 001660 if not f-status-ok 001670 display "!!! failed to close file2: status=" f-status 001680 stop run. 001690 go to a12-exit. 001700* 001710 a12-100-read. 001720 read file2. 001730 if f-status-ok 001740 display "... record: keys :: " 001750 file2-key-1 ", " file2-key-2 ", " file2-key-3 001760 " : " file2-2 001770 else 001780 display "... finished reading: status=" f-status 001790 move 1 to w-eoj. 001800 go to a12-exit. 001810* 001820 a12-exit. 001830 exit. 001840*----------------------------------------------------------------- 001850 001860 a13-read-file section. 001870 a13-000. 001880 display x"0a" "... reading /tmp/isam-file-05 - SINGLE KEY". 001890 open input file3. 001900 if f-status-ok 001910 display "opened file OK" 001920 else 001930 display "!!! failed to open file3: status=" f-status 001940 go to a13-exit. 001950 move 0 to w-eoj. 001960 perform a13-100-read thru a13-exit 001970 until eoj. 001980 display "... a13 closing /tmp/isam-file-05". 001990 close file3. 002000 if not f-status-ok 002010 display "!!! failed to close file3: status=" f-status 002020 stop run. 002030 go to a13-exit. 002040* 002050 a13-100-read. 002060 read file3. 002070 if f-status-ok 002080 display "... record: keys :: " 002090 file3-key-1 ", " file3-key-2 ", " file3-key-3 002100 " : " file3-2 002110 else 002120 display "... finished reading: status=" f-status 002130 move 1 to w-eoj. 002140 go to a13-exit. 002150* 002160 a13-exit. 002170 exit. 002180*----------------------------------------------------------------- 002190 [/code] [b]ON EXECUTION the following output is displayed:[/b] [code] bcs_cobrun isam_05 4.00 (09082001) ... creating /tmp/isam-file-05 - MULTIPLE KEYS opened file OK ... closing /tmp/isam-file-05 ... a11 create /tmp/isam-file-05 OK ... reading /tmp/isam-file-05 - MULTI KEY !!! failed to open file2: status=39 ... reading /tmp/isam-file-05 - SINGLE KEY !!! failed to open file3: status=39 [root@lima cobol]# [/code] ---------------------------------------------------------------- Using MicroFocus COBOL/2 compiler, we get [code] ... creating /tmp/isam-file-05 - MULTIPLE KEYS opened file OK ... closing /tmp/isam-file-05 ... a11 create /tmp/isam-file-05 OK ... reading /tmp/isam-file-05 - MULTI KEY opened file OK ... record: keys :: A, AA, AAA : ... record: keys :: B, BB, BBB : ... record: keys :: C, CC, CCC : ... finished reading: status=10 ... a12 closing /tmp/isam-file-05 ... reading /tmp/isam-file-05 - SINGLE KEY opened file OK ... record: keys :: A, AA, AAA : ... record: keys :: B, BB, BBB : ... record: keys :: C, CC, CCC : ... finished reading: status=10 ... a13 closing /tmp/isam-file-05 [/code] ---------------------------------------------------------------- So everyone knows, there is a fairly well documented IBM extension (to the Standard) that allows one to NOT specify all the alternate keys in every program; only in those programs that "use" that key. This is due (at least in part) to the fact that on IBM mainframes "VSAM" is defined by the operatin system and NOT by theCOBOL system (as with most workstation COBOL's). Therefore, VSAM keeps all the index information "correct" reagardless of what is in the Select/Assign clause. FYI, This is "fully ANSI conforming" as FS=39 is EXPLIXCITLY implmentor defined as to what is and is not checked. ---------------------------------------------------------------- [quote]So everyone knows ... [/quote] No they don't! [quote]FYI, This is "fully ANSI conforming" as FS=39 is EXPLIXCITLY implmentor defined as to what is and is not checked.[/quote] I am not challenging OpenCobol on whether or not it is ANSI compliant. Using your logic: if OpenCobol required the INDEXED FILE keys to be listed in [b]alphabetic[/b] order it would still be ANSI conforming and so that's OK then. This is a rubbish defense. In addition (as far as I can tell) the code I quote above from OpenCobol's fileio.c only applies to external isam handlers only [code]#elif defined(WITH_CISAM) || defined(WITH_DISAM) || defined(WITH_VBISAM) [/code] therefore by the logic of your second paragraph OpenCobol's got it wrong. My argument is (1) OpenCobol doesn't need to check all the keys are declared and in the correct order. It simply needs to check that the keys used in an any COBOL source are supported by the ISAM handler. It's totally unecessary to do more. (2) By imposing this constraint OpenCobol makes it difficult to use in the "real world". Specifically, when porting COBOL source from another compiler you do what is necessary to fix the differences in dialect (e.g. editing in missing implied full-stops at new-line on data declarations) but to edit in all the keys [b]totally unecessarily[/b] is beyond daft. ---------------------------------------------------------------- COBOL software by Micro Focus Copyright (C) Microsoft Corporation 1984,1993. All rights reserved. Copyright (C) Micro Focus Ltd. 1984,1993. All rights reserved. 4.00 (09082001) ... creating /tmp/isam-file-05 - MULTIPLE KEYS opened file OK ... closing /tmp/isam-file-05 ... a11 create /tmp/isam-file-05 OK ◙... reading /tmp/isam-file-05 - MULTI KEY opened file OK ... record: keys :: A, AA, AAA : ... record: keys :: B, BB, BBB : ... record: keys :: C, CC, CCC : ... finished reading: status=10 ... a12 closing /tmp/isam-file-05 ◙... reading /tmp/isam-file-05 - SINGLE KEY !!! failed to open file3: status=39 Had to change the filename to isam-05 as mf does not like the _ underscore Dave ---------------------------------------------------------------- Given the source above, I get [code] [btiffin@home forum]$ cobc -x isam-05.cob [btiffin@home forum]$ ./isam-05 4.00 (09082001) ... creating /tmp/isam-file-05 - MULTIPLE KEYS opened file OK ... closing /tmp/isam-file-05 ... a11 create /tmp/isam-file-05 OK ... reading /tmp/isam-file-05 - MULTI KEY opened file OK ... record: keys :: A, AA, AAA : ... record: keys :: B, BB, BBB : ... record: keys :: C, CC, CCC : ... finished reading: status=10 ... a12 closing /tmp/isam-file-05 ... reading /tmp/isam-file-05 - SINGLE KEY opened file OK ... record: keys :: A, AA, AAA : ... record: keys :: B, BB, BBB : ... record: keys :: C, CC, CCC : ... finished reading: status=10 ... a13 closing /tmp/isam-file-05 [btiffin@home forum]$ cobc --version cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built May 01 2011 07:48:58 Packaged Feb 06 2009 10:30:55 CET [/code] I didn't use bcs_cobrun though, here's the log using cobcrun [code] [btiffin@home forum]$ cobc isam_05.cob [btiffin@home forum]$ cobcrun isam_05 4.00 (09082001) ... creating /tmp/isam-file-05 - MULTIPLE KEYS opened file OK ... closing /tmp/isam-file-05 ... a11 create /tmp/isam-file-05 OK ... reading /tmp/isam-file-05 - MULTI KEY opened file OK ... record: keys :: A, AA, AAA : ... record: keys :: B, BB, BBB : ... record: keys :: C, CC, CCC : ... finished reading: status=10 ... a12 closing /tmp/isam-file-05 ... reading /tmp/isam-file-05 - SINGLE KEY opened file OK ... record: keys :: A, AA, AAA : ... record: keys :: B, BB, BBB : ... record: keys :: C, CC, CCC : ... finished reading: status=10 ... a13 closing /tmp/isam-file-05 [/code] We can track through versioning of libdb, and the ./configure logs to see if we can't get your install fixed, or at least to as how you expect which is what I found, with a trek through dependencies. As an aside; Joe, when Bill said "So everyone knows", that's not "As everyone knows". He was prepping us readers for some upcoming information, not implying we should already know. Watch for posts from wmklein, almost all contain tidbits of truthy wisdom. :-) [i]and by truthy, I mean trustworthy and informative[/i] Cheers, Brian ---------------------------------------------------------------- I have OpenCobol on linux and windows on two partitions of the same machine. The linux version is the ubuntu package updated with the current version from this site. The windows version is the current G Cutler package from the site referenced in the wiki. The linux result is exactly the same as Brian's output. The windows result gives: "...creating /tmp/isam-file-05 - MULTIPLE KEYS !!! failed to open file: status 30" The only difference in the programs is that the windows file is "c:\" etc. I would have thought that the two versions of OC would be the same except for the curses packages. There must be some other differences. John. ---------------------------------------------------------------- Yeah, three major external dependencies. ISAM capable library (default to Berkeley libdb) GNU Multi Precision bignum library and the curses screen handling library. All three can cause wrinkles on various platforms. Not insurmountable wrinkles, but version dependent wrinkles nonetheless. Cheers ---------------------------------------------------------------- I should have read the manual. What I raised is not an isam issue. It's an operating system matter (windows/linux).This is covered in paras 6.1.9.1 and 6.32 of G Cutler's Manual. Sorry for the red herring. John. ---------------------------------------------------------------- Brian: Thanks for your posting and apologies for the delay in replying. Point taken re. "So everyone knows" ... it's an unattractive reflex from someone Burroughs/UNISYS trained to an IBM assumption! It's interesting that your installation ignores the omitted keys in the COBOL SELECT. Can you confirm that you were using CISAM or DISAM or VBISAM. As I read the fileio.c the constraint doesn't apply to other index handlers (e.g. DB). The version of OpenCobol I am using was downloaded from this site: OpenCOBOL 1.1 I have been editing fileio.c so I am reluctant to use our installation as a "reference" site. This might start a wild goose chase. Unfortunately IDEone.com (cf. your earlier post) prohibits writing files (except stdin & stdout) so it's not much use for demonstrating this sort of thing. Soon I'll (re-)make another install that's unchanged from the OpenCobol distribution and perhaps then I'll follow-up on some of this. The good news is that I have edited the parser.y, codegen.c and fileio.c to get round this problem and one or two others. [b]I have also implemented support for split-keys.[/b] We are currently testing all this and when completed I'll post to this forum. Do you know if anyone (e.g. Roger) has been working on fileio.c since OpenCOBOL 1.1 release? I have a notion to re-engineer it. ---------------------------------------------------------------- Sounds interesting. Please test and put your results, together with the changed files here (or at some patebin). OC 2.0 has a complete rewritten parser and a lot of changes in fileio.c, too. But only Roger knows when 2.0 will be ready. If you're able to comment all changed lines in a way I can see "this was changed for split keys/ignore omitted keys/..." someone (maybe Roger or me) can try to get the changes into 2.0. It would be nice if there would be a configuration option (via environment) to tell libcob if file status 39 should occur on omitted keys or not. human ---------------------------------------------------------------- Subject: Sphinx documentation system I've bumped into Sphinx, http://sphinx.pocoo.org/ and I'm wondering if there are any advocates or detractors with opinions. It deals in ReStructuredText, which is a huge plus for me. It'll get the FAQ into a format that GNU will accept in a project package (Texinfo) with a lower risk of crosseyededness. Cheers, Brian ---------------------------------------------------------------- Subject: For new proxy opencobol.org accounts - how to register ############################################################ We have moved the developments to SourceForge. Please see http://sourceforge.net/projects/open-cobol/ Original post is below. The peoplecards.ca forum was deleted giving preference to https://sourceforge.net/p/open-cobol/discussion/ ############################################################ [b][EXPIRED] information as of May 2012, see above[/b] Hello, world If you are having trouble getting a new account on opencobol.org, there is a temporary phpBB forum up and accepting new accounts at http://forum.peoplecards.ca While temporary, instead of denying anyone a chance to speak to the OpenCOBOL community, we will be (manually, if need be) cross-posting entries made on forum.peoplecards.ca [b]back to here, opencobol.org[/b], the main and reference site. opencobol.org cracked under robot spam, and new things are being planned. Perhaps a Hosted forum, from an enterprise that is nice to open source projects. This will alleviate the time drains that the project principles have been experiencing. As a fanboy advocate, I've setup the phpBB forum as a one-click install on a shared Dreamhost account. It will likely be slow at times, and the cross-postings may come in spits and spats, with some delays in between. [b]opencobol.org is still the reference forum for technical help, and the community built knowledge base.[/b] forum.peoplecards.ca is temporary and is really only planned for new users that want to get in on the OpenCOBOL fun, until there is a way to get new members back into the main. We'll work out protocols for moving posts on forum.peoplecards.ca when/if it becomes needed. But please do. If you can't get an account here, try http://forum.peoplecards.ca and we'll help get questions and responses ported back here on your behalf. While we see if this will be feasible, any new registrants at forum.peoplecards.ca are set to have 3 moderated messages before clearance to go. Seems like a reasonable way of keeping bots at bay. So please register, post and as soon a volunteer time permits, we'll do what we can to get OpenCOBOL discussions in full swing again. Have good in 2012. Cheers, Brian ---------------------------------------------------------------- If you cannot post here, please use the new opened board at https://sourceforge.net/apps/phpbb/open-cobol/ (sf-account needed) - thank you. human ---------------------------------------------------------------- Hi; Registered or thought I was but cannot post via the php88 links as vbcoen or vcoen Vince ---------------------------------------------------------------- There is a [url=https://sourceforge.net/apps/trac/sourceforge/ticket/24079]problem on sourceforge with the rights to the hosted app phpbb[/url] - the standard group "registered users" does not has any rights and cannot be added to any forum... I've added every current user by hand to every forum. Should work for you now - for all others, please subbscribe to the hosted app and wait until I add the necessary posting rights for you. human ---------------------------------------------------------------- Subject: OpenCOBOL birthday If the FAQ is right, OpenCOBOL went public on January 25th, 2002. So we have a few days to plan for a 10th anniversary. Cheers, Brian ---------------------------------------------------------------- let me be polemical. Are we to say happy birthday or condoleances? Marcello ---------------------------------------------------------------- My travels and work in many countries have taught me that sometimes translations are not consistent across languages. Using the Oxford family "polemical" is defined here: http://oxforddictionaries.com/definition/polemical?q=polemical For my part (and with great respect to the posters on this forum) OpenCOBOL has provided us with an excellent production quality compiler. We have dozens of applications running every day and literally hundreds of thousands of lines of code successfully compiled and deployed with OpenCOBOL 1.1. I have seen that some of the posters on the forum seem to want OpenCOBOL to handle issues the exact same way as some other compiler that they may be migrating from. Having written my first COBOL program in the 1960's and having migrated code from platform to platform many times, I will state again that I have never gone through a conversion or migration without having to alter the source code. The development team has my admiration, respect and appreciation for what they have given us. New features would be nice but are not necessary for our successful use of OpenCOBOL. jimc ---------------------------------------------------------------- Hi Jim, I apologize, my language is not english, so, I say it in italian "polemico". In my language this means "mettere i puntini sulle i anche quando non e' necessario" (Devoto-Oli dictionary may help you). I know open-cobol team has done a great lot of work in the past. I've been helping for testing since beginning. We due a lot to open-cobol team, BUT, as someone else said 4 years life of beta testing for 1.1 seems abnormal. Version 2.0 is still "private". I've written and rewritten my sources several times to meet new compiler needings and, if necessary, I'll do it more times. Cobol still has a reason for existing just because it handles data as no one else does. Perhaps someone else does not use split keys, BUT in important scenario this is "indispensabile" and is POSIX standard. If not available, mysql (or others ot that type, should be FULLY supported). What "e' inaccettabile e' che il team di sviluppo non abbia dato notizie sullo stato di sviluppo" untill my Santa Claus. I do not work against open cobol. I do work FOR open cobol. You posted recenty for mysql not seeing all fields (above a certain number of them) you had an answer but I still do no get what I needed. When I posted to open cobol to know if I coud get or help to get what I needed about some matters (so far it is not important what I need but what open cobol allowes) I was told that someone had it in his todo list for over one year but had not yet time to do it. Someone posted that from time to time he comes and sees what is new and if what was missing is presents. If not .... Federico is doing a lot of work for debugging. Shall all his work be still useful where 2.0 appears? Finally, what we need is JUST MOVE UP THINGS! If help is needed just say so. We all are here. Please, just don't say open cobol is good as it is. It is not true. I am italian and in my country the habit for stopping someone to do something, is paying him for not doing it. I ask and repent for asking is it so outside Italy? Marcello ---------------------------------------------------------------- Marcello, I felt strongly that this would turn out to be a language issue. In the US a polemic discussion is one that is personal and mean. I knew that you could not have wanted that. I see that in Italian it is an offer to assist. I agree with much of your position. Unfortunately I cannot help you with the ISAM issues. Please keep up your good work. Hope springs eternal. jimc ---------------------------------------------------------------- I must say that I agree with Marcello, regarding the split keys: it is a something that needs to be resolved as it does prevent OC becoming a top of the pile compiler. Other than that, I must take my hat off to the Developers for the dedication and effort that they put into OC! Keep up the good work and I do believe that when ver 2.0 arrives it will be a major stride forward. Release when ready and not to satisfy our desires to have a new compiler. I am currently working on a work around for the split keys and only hope that it will resolve a few problems for those who require split keys in their programs. It is not a permanent fix, but will made life a little easier for myself and hopefully for others. James ---------------------------------------------------------------- I'm thinking that Wednesday will be good for "talk like a Braveheart day". Ai, but not the now. or I wouldn't worry about them. Didn't I tell ya before? It's my island. or You don't speak COBOL? Well that's something we shall have to remedy, isn't it? Those should all fit in on a Wednesday. Cheers, Brian :-) ---------------------------------------------------------------- [i]Bumping: 10th anniversary day[/i] I found opportunity to use all three Braveheart quotes today. And a few "they'll never take away our Freedom!"s too. OpenCOBOL is too much fun. When I got the chance to say "...it's my island.", I was showing off a little bit, as it's kinda true. I grew up a commercial fisherman, and my family has an island on Georgian Bay. My Mom took the pictures shown at [url=http://en.wikipedia.org/wiki/Pointe_au_Baril,_Ontario]http://en.wikipedia.org/wiki/Pointe_au_Baril,_Ontario[/url], where I spent summers working. That link is the first of three wikipedia pages I've been brave enough to create. The lighthouse is about a kilometer from the island (by boat, less than 500m if you portage), the other two pics are from the fish shack porch. Too much fun. Cheers, Brian ---------------------------------------------------------------- Subject: Elastic COBOL - posted on forums.peoplecards.ca Subject: Free COBOL Eclipse IDE Available to anyone at http://elasticcobol.com Runs in the cloud, so no software to install/configure. Supports 15 dialects (including mainframe and Micro Focus). Compiles COBOL and CICS apps to Java source code so they deploy 100% on Java platform. Of course, you could develop your code in the IDE and recompile it under OpenCOBOL for execution when you're done. Would greatly value any feedback from this group (easiest to enter feedback from the website itself, or you can email me direct at gary.crook[remove]@heirloomcomputing.com). Who am I? I ran Global Product Development at Micro Focus from 2001 through end of 2009. Best, Gary. [code] The above was posted to forum.peoplecards.ca and moved here by hand. If you'd like to comment to Gary, I'll cross-post any questions back over and responses back to here. Cheers, Brian [/code] ---------------------------------------------------------------- Subject: .info beta testers, or negative opinions requested Hello, In order to increase the attractiveness of OpenCOBOL to the good people at the GNU Project, http://www.gnu.org, documentation in TexInfo format is required. First I'd like to ask for opinions on whether the forum thinks the FAQ would be suitable for inclusion? Second, assuming the the first answer is not overwhelmingly negative, I'd like to ask for a beta tester or two to try [code] $ info -f ocfaq.info [/code] using the file stashed at http://peoplecards.ca/files/ocfaq.info and then fling as much criticism as it will take to stop me from pushing for the .texi sources to go into the tar ball. :-) Cheers, Brian ---------------------------------------------------------------- Brian, FAQ seems to me a good start for all aspects of OC. I will happily beta test. Is info only available in a linux environment? Not an issue as have VM + Ububtu. Regards Steve ---------------------------------------------------------------- Thanks Steve. [b]info[/b] is a GNU tool, Texinfo is a GNU format. So it'll be running on any OS with the GNU userland. GNU/Linux, Cygwin, et al, but I'm sure there are TexInfo ports to most desktop environments. Sphinx is exciting. The ocfaq.rst sources are now generating html, texinfo, latex and epub outputs. Me likey. Umm, now I get to apply nerd skills to graphic design. Expect fail, fun fun fail. ;-) Cheers, Brian ---------------------------------------------------------------- Subject: As/400 restoring LIBCOB savefile Hello, I'm trying to install OpenCobol in an AS/400 system, when i try to perform a restore of savefile LIBCOB, i receive an error message, describing that the savefile it was created in a diferent as/400 version, and I am not able to go on with instalation. Can someone help me with this issue. Thanks. ---------------------------------------------------------------- Please post the command that you tried as well as the release level of OS/400 that you are running. ---------------------------------------------------------------- Hello, Thank you for your answer. The command line that I am trying is: RSTLIB SAVLIB(LIBCOB) DEV(*SAVF) SAVF(LIBCOB) and the release level: Version 4 release 2 (V4R2). Thanks ---------------------------------------------------------------- I am assuming that you got your savfile from www.kiska.net. You are on Version 4, Release 2 which as you know is quite old. In all probability the savfile was created with a more recent release of OS/400. If I recall correctly OS/400 is pretty good about restoring from a previous release (old to new) but will not allow restoring from a later release. You could always compile the binaries yourself. Are you trying to solve a business problem or are you just thinking that you can reuse your old friend? jimc ---------------------------------------------------------------- Yes, I got savfile from www.kiska.net. You are right, the V4R2 is quite old, but I' trying to solve a business problem. Can you tell me how can I compile the binaries? Or can you say me wich files sould be placed in Libary LIBCOB? I just need to know wich files (objects) should be placed in Libary, as far as I know I would copy it directly into Libary. Thanks ---------------------------------------------------------------- I am assuming that you got your savfile from www.kiska.net. As you know your release of OS/400 is very old. As I recall OS/400 is very good about letting you restore from an older release of the operating system to a newer one, but does not allow going backward. You should be able to compile the code yourself if you have the programmer packages installed. Are you trying to solve a business problem? Are you just trying to re-use an old friend? jimc ---------------------------------------------------------------- Yes, I got savfile from www.kiska.net. You are right, the V4R2 is quite old, but I' trying to solve a business problem. Can you tell me how can I compile the binaries? Or can you say me wich files sould be placed in Libary LIBCOB? I just need to know wich files (objects) should be placed in Libary, as far as I know I would copy it directly into Libary. Thanks ---------------------------------------------------------------- Well, as we say out here in west Texas "I'm not sure that I can get there from here". re: compiling As I recall V4R2 required you to buy each compiler. I gather that you do not have COBOL or RPG on the machine. There was a rumor that the C compiler got included on some shipments without cost. If you have IBM's COBOL then I wonder why you would need OpenCOBOL, but if you want to go down that path then you need to see if you have the C compiler. re: binaries The earlier AS/400's were Complex Instruction Set Computers (CISC). Later machines are Reduced Instruction Set Computers (RISC). The binaries from RISC machines will not run on CISC machines nor will CISC binaries work on RISC machines. In all probability the kiska.net binaries are RISC based, but I do not know that for sure. You need to determine what architecture you have. re: business problem If you are trying to get data off of the AS/400 there are some very handy utilities that may allow you to export and reformat without having to write programs. Feel free to e-mail me at jcurrey-remove this--@aol--remove this too--.com ---------------------------------------------------------------- Subject: Read or Write Data/Attributes to the Screen Does anyone know it it is possible to read or write data and/or attributes to the screen as is possible in MF: CALL "CBL_READ_SCR_ATTRS" USING SAVE-POS W42-ATTRIB W41-LENGTH RETURNING WS-STATUS. CALL "CBL_READ_SCR_CHATTRS" USING SAVE-POS W43-SCREEN W42-ATTRIB W41-LENGTH RETURNING WS-STATUS. CALL "CBL_WRITE_SCR_CHATTRS" USING SAVE-POS W43-SCREEN W42-ATTRIB W41-LENGTH RETURNING WS-STATUS. These are a few examples of the instructions used in MF. Thanks. James ---------------------------------------------------------------- Short answer, yes. OC 1.1 uses stdscr for ncurses 'windows'. It'll be possible to use C and wattr functions from the curses api. This might be deemed a little dirty, so take the longer answer for what it is. I don't think that way, but it comes with warnings that things out-of-order can bork. Ensure you don't call initscr() but have OC have init'ed a curses screen for you before you CALL any libncursesw.so functions. man 3 wattr_get for some starter info. The curses library is 'auto' linked to cobc executables so you can CALL the ncurses functions right from COBOL without C wrappers if that's preferred, (except getting at stdscr perhaps, but that'd be a oneline wrapper) and a oneline CALL RETURNING a POINTER. The functions that work on 'current' will work within OpenCOBOL code once there is an initscr(). Cheers, Brian ---------------------------------------------------------------- To say what Brian said in other words: The CBL_READE/WRITE_SCR_(CH)ATTRS" library calls are not implemented in OC yet, but it should be not so hard to do so. I suggest to write these functions as C libraries calling curses (curses is loaded through libcob on first SCREEN i/o) as Brian suggested. Please post these libraries here, this way others are able to use them and it's not unlikely that they're going into next version of OC as part of the stock library. human ---------------------------------------------------------------- Subject: man page beta testers If you have the time, save a local copy of http://peoplecards.ca/files/cobc.1 and use either [code] $ man -l cobc.1 [/code](Note: that is man minus little-ell and cobc dot one) or [code] $ sudo cp cobc.1 /usr/local/man/man1/ $ man cobc [/code] It's a little sloppy (-std= for example), as this is a machine generated manpage using [b]help2man[/b] with an include file to fill in some of the missing bits. But, I like man pages and this does the job for me. I'd like opinions from others before I pester Roger to update the automake and ./configure files to install some cobc manpages along with the opencobol info files. Extra points for anyone that digs in enough to figure out LOCALE translations as described at http://www.gnu.org/software/help2man/ Cheers, Brian ---------------------------------------------------------------- Brian, Great Job! Personally, I would like to see this as part of the distribution. We will enjoy using it. Thank you. jimc BTW my Debian machine gave me some junk at the beginning. I am posting it below: [code] 0T)07:02:42#man -l cobc.1 Reformatting cobc.1, please wait... From: <Saved by Windows Internet Explorer 8> Subject: Date: Thu, 2 Feb 2012 06:59:58 â€0700 MIMEâ€Version: 1.0 Contentâ€Type: text/html; charset="Windowsâ€1252" Contentâ€Transferâ€Encod†ing: quotedâ€printable Contentâ€Location: http://people†cards.ca/files/cobc.1 Xâ€MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3664 <!DOCTYPE HTML PUBLIC "â€//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Dwindowsâ€1252" = httpâ€equiv=3DContentâ€Type> <META name=3DGENERATOR con†COBC(1) User Commands COBC(1) tent=3D"MSHTML 8.00.6001.18928"></HEAD> <BODY><PRE>. 1.40.2. NAME cobc - manual page for cobc (OpenCOBOL) 1.1.0 SYNOPSIS cobc [options] file... DESCRIPTION OpenCOBOL is an open-source COBOL compiler. OpenCOBOL implements a = sub†stantial part of the COBOL 85 and COBOL 2002 standards, as well as many = extensions of the existent COBOL compilers.=20 [/code] ---------------------------------------------------------------- Jim; Your browser saved the HTTP headers it seems. Try [code] $ ./occurlrefresh http://peoplecards.ca/files/cobc.1 cobc.1 [/code] to get a cleaner copy. Don't have occurlrefresh? http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=285&forum=1#forumpost4593 then replace the command with [code]$ curl http://peoplecards.ca/files/cobc.1 >cobc.1[/code] or [code]$ wget http://peoplecards.ca/files/cobc.1 [/code] or other favourite URL fetching program besides the friendly explorer. ;-) [i]Note; I use Opera and it does the same mime-type by extension or content and 'let me help you with that' screw ups from time to time.[/i] In particular Opera browser Mail won't import a Cake/PHP template (.ctp) without 'helping' and saving as .html. And, yes, I'm planning on sending Roger the changes for automake to generate the man page(s) from the distribution. When I've cleaned it up, I'll post it here for people to play around with. Cheers, Brian ---------------------------------------------------------------- Subject: DB2 Express-C using Windows 7 [i]from iainw on forum.peoplecards.ca, with one edit to put in code blocks[/i] Hello, I'm having problem with a program compiling an OpenCOBOL 1.1 program which uses DB2 Express-C in a Windows 7 environment. Following the advice on the forum I have updated libcob.h, adding: #ifdef DB2SQL #include <sqlaprep.h> #endif Have the following system variables: COB_LIBRARY_PATH = C:\OC\pgms COBCPY = C:\OC\pgms INCLUDE = C:\PROGRA~2\IBM\SQLLIB\INCLUDE;C:\PROGRA~2\IBM\SQLLIB\LIB LIB = ;C:\PROGRA~2\IBM\SQLLIB\LIB LINK = C:\Cobol\lib\db2api.lib PATH is set up to included all required OC and DB2 programs etc. Using the DB2 Express-C line command processor (DOS window), connected to the sample database and precomiled the program: (1) connect to sample (2) prep C:\OC\pgms\db2test2.sqb bindfile using C:\OC\pgms\db2test2.bnd target ANSI_COBOL In Cgywin tried to compile the program, commans used = cobc -v -x -I C:\PROGRA~2\IBM\SQLLIB\lib -fixed -fstatic -D DB2SQL db2test2.cbl Get the following: [code] preprocessing db2test2.cbl into /tmp/cob3872_0.cob translating /tmp/cob3872_0.cob into /tmp/cob3872_0.c gcc-4 -pipe -c -I/usr/local/include -Wno-unused -fsigned-char -Wno-pointer-sig n -IC:PROGRA~2IBMSQLLIBlib -DDB2SQL -o /tmp/cob3872_0.o /tmp/cob3872_0.c gcc-4 -pipe -Wl,--export-all-symbols -Wl,--enable-auto-import -o db2test2 /tmp/ cob3872_0.o -L/usr/local/lib -lcob -lm -lgmp -lintl -lncurses -ldb /tmp/cob3872_0.o:cob3872_0.c:(.text+0xaaf): undefined reference to `_sqlgstrt' /tmp/cob3872_0.o:cob3872_0.c:(.text+0xb84): undefined reference to `_sqlgaloc' /tmp/cob3872_0.o:cob3872_0.c:(.text+0xcbf): undefined reference to `_sqlgstlv' /tmp/cob3872_0.o:cob3872_0.c:(.text+0xdbb): undefined reference to `_sqlgcall' /tmp/cob3872_0.o:cob3872_0.c:(.text+0xe1b): undefined reference to `_sqlgstop' /tmp/cob3872_0.o:cob3872_0.c:(.text+0x11fe): undefined reference to `_sqlgstrt' /tmp/cob3872_0.o:cob3872_0.c:(.text+0x12fa): undefined reference to `_sqlgcall' /tmp/cob3872_0.o:cob3872_0.c:(.text+0x135a): undefined reference to `_sqlgstop' /tmp/cob3872_0.o:cob3872_0.c:(.text+0x147f): undefined reference to `_sqlgstrt' /tmp/cob3872_0.o:cob3872_0.c:(.text+0x1554): undefined reference to `_sqlgaloc' /tmp/cob3872_0.o:cob3872_0.c:(.text+0x169b): undefined reference to `_sqlgstlv' /tmp/cob3872_0.o:cob3872_0.c:(.text+0x17e2): undefined reference to `_sqlgstlv' /tmp/cob3872_0.o:cob3872_0.c:(.text+0x1929): undefined reference to `_sqlgstlv' /tmp/cob3872_0.o:cob3872_0.c:(.text+0x1a70): undefined reference to `_sqlgstlv' /tmp/cob3872_0.o:cob3872_0.c:(.text+0x1bb7): undefined reference to `_sqlgstlv' /tmp/cob3872_0.o:cob3872_0.c:(.text+0x1cfe): more undefined references to `_sqlg stlv' follow /tmp/cob3872_0.o:cob3872_0.c:(.text+0x1f41): undefined reference to `_sqlgcall' /tmp/cob3872_0.o:cob3872_0.c:(.text+0x1fa1): undefined reference to `_sqlgstop' /tmp/cob3872_0.o:cob3872_0.c:(.text+0x22fb): undefined reference to `_sqlgstrt' /tmp/cob3872_0.o:cob3872_0.c:(.text+0x23f7): undefined reference to `_sqlgcall' /tmp/cob3872_0.o:cob3872_0.c:(.text+0x2457): undefined reference to `_sqlgstop' /tmp/cob3872_0.o:cob3872_0.c:(.text+0x25cf): undefined reference to `_sqlgstrt' /tmp/cob3872_0.o:cob3872_0.c:(.text+0x26cb): undefined reference to `_sqlgcall' /tmp/cob3872_0.o:cob3872_0.c:(.text+0x272b): undefined reference to `_sqlgstop' collect2: ld returned 1 exit status [/code] Can anyone suggest what I need to do to get a clean compile please? Regards, iain ---------------------------------------------------------------- Hi and Welcome at opencobol.org (via peoplecards). I think the problem roots in different compiling tools. Either use the DB-Express Win binaries (with Microsoft Visual C [Express]) or compile the libraries from unix sources within Cygwin. human ---------------------------------------------------------------- Hello Human, Thanks for the welcome. I have Visual Studio 2010 Express installed but not using it. I'm not a C/C++ person so can you give me a pointer on how to compile the Cygwin libraries please? My biggest problem is that I'm a mainframe dinosaur, hence the desire to use COBOL! Due to work it will probably be next weekend before I get to sort out this. iain [i]cross posted by btiffin for iainw from forum.peoplecards.ca[/i] ---------------------------------------------------------------- Hi, i havn't tried using Cygwin and DB2 but it looks like 2 problems to me. 1. The -I C:\PROGRA~2\IBM\SQLLIB\lib seems to be interpreted without the backslashes. Try using normal slashes "C:/PROGRA~2/IBM/SQLLIB/lib" or user double backslashes "C:\\PROGRA~2\\IBM\\SQLLIB\\lib" 2. You will need to include the db2api.lib in some way, try using "-l db2api". I hope this will help you. Regards, Franklin ---------------------------------------------------------------- Franklin is right for both problems, but I guess the solution for 2. won't work as the lib won't be found/used as it is an MSC library (try this at least, maybe I'm wrong). If it doesn't work you have three choices: 1. run cygwin setup and try to find DB2 express packages there, if available, install them 2. get sources for compiling the library within Cygwin via ./configure + make + make install (this is the manual way of 1., but I'm not positive this will be possible as I did not found a source tarball at [url=http://www-01.ibm.com/software/data/db2/express/download.html]DB2 Express download page[/url]) 3. Don't use Cygwin for OpenCOBOL but a MSC-package (if you don't knwo how to compile OC with MSC on your own, use a package of http://www.kiska.net/opencobol/1.1/ (I highly suggest NOT to use the binaries from newer snapshots but these from 2009). human ---------------------------------------------------------------- [i]off topic[/i] The one-click easy install forum.peoplecards.ca seems to be suffering the same symptoms that plagued opencobol.org for a while (and why new registrations are still blocked). I'm on an entry level shared server on Dreamhost. Something on the shared server (my guess being, accumulated spam) is tripping the SQL engine watchdog / eating all performance. So, the last two entries are not cross posted. I'm going to look into it / pester Dreamhost / redo on a server I know has cyles. forum.peoplecards.ca has less than 1000 db entries so, I'm guessing, it's another site on the box causing the grief. Or, it's time to officially move the forum part of opencobol.org while the new site is developed. It's in the works, but finding and synchronizing time with the principals is proving difficult. Might just assume go, and go. Brian ---------------------------------------------------------------- Subject: Fatal errors installing on Suse 11.2 64 bit I thought that I had done this successfully before, so maybe I just did something wrong this time. [quote] make.log make all-recursive make[1]: Entering directory `/home/jack/open-cobol-1.1' Making all in lib make[2]: Entering directory `/home/jack/open-cobol-1.1/lib' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/home/jack/open-cobol-1.1/lib' Making all in libcob make[2]: Entering directory `/home/jack/open-cobol-1.1/libcob' if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF ".deps/libcob_la-fileio.Tpo" -c -o libcob_la-fileio.lo `test -f 'fileio.c' || echo './'`fileio.c; \ then mv -f ".deps/libcob_la-fileio.Tpo" ".deps/libcob_la-fileio.Plo"; else rm -f ".deps/libcob_la-fileio.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT libcob_la-fileio.lo -MD -MP -MF .deps/libcob_la-fileio.Tpo -c fileio.c -fPIC -DPIC -o .libs/libcob_la-fileio.o fileio.c:311: error: expected specifier-qualifier-list before 'DB' fileio.c: In function 'cob_sync': fileio.c:639: error: 'struct indexed_file' has no member named 'db' fileio.c:640: error: 'struct indexed_file' has no member named 'db' fileio.c:640: error: 'struct indexed_file' has no member named 'db' fileio.c:645: error: 'struct indexed_file' has no member named 'db' fileio.c:649: error: 'struct indexed_file' has no member named 'db' fileio.c:649: error: 'struct indexed_file' has no member named 'db' fileio.c: In function 'indexed_open': fileio.c:1899: error: 'BTREEINFO' undeclared (first use in this function) fileio.c:1899: error: (Each undeclared identifier is reported only once fileio.c:1899: error: for each function it appears in.) fileio.c:1899: error: expected ';' before 'info' fileio.c:1954: error: 'struct indexed_file' has no member named 'db' fileio.c:1954: error: 'DB' undeclared (first use in this function) fileio.c:1954: error: expected expression before ')' token fileio.c:1959: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:1960: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:1961: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:2000: error: 'info' undeclared (first use in this function) fileio.c:2002: error: 'R_DUP' undeclared (first use in this function) fileio.c:2013: error: 'struct indexed_file' has no member named 'db' fileio.c:2013: warning: implicit declaration of function 'dbopen' fileio.c:2013: error: 'DB_BTREE' undeclared (first use in this function) fileio.c:2014: error: 'struct indexed_file' has no member named 'db' fileio.c:2020: error: 'struct indexed_file' has no member named 'db' fileio.c:2020: error: 'struct indexed_file' has no member named 'db' fileio.c:2027: error: 'struct indexed_file' has no member named 'db' fileio.c:2028: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2029: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2041: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2042: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2050: error: 'struct indexed_file' has no member named 'key' fileio.c:2050: error: 'DBT' undeclared (first use in this function) fileio.c:2051: error: 'struct indexed_file' has no member named 'data' fileio.c:2067: error: 'struct indexed_file' has no member named 'db' fileio.c:2067: error: 'struct indexed_file' has no member named 'db' fileio.c:2067: error: 'struct indexed_file' has no member named 'key' fileio.c:2067: error: 'struct indexed_file' has no member named 'data' fileio.c:2067: error: 'R_FIRST' undeclared (first use in this function) fileio.c:2070: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2070: error: 'struct indexed_file' has no member named 'key' fileio.c:2070: error: 'struct indexed_file' has no member named 'key' fileio.c:2072: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_close': fileio.c:2115: error: 'struct indexed_file' has no member named 'db' fileio.c:2116: error: 'struct indexed_file' has no member named 'db' fileio.c:2116: error: 'struct indexed_file' has no member named 'db' fileio.c:2118: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2119: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2126: error: 'struct indexed_file' has no member named 'db' fileio.c:2127: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2128: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2129: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c: In function 'indexed_start_internal': fileio.c:2169: error: 'struct indexed_file' has no member named 'key' fileio.c:2169: error: 'struct indexed_file' has no member named 'key' fileio.c:2178: error: 'struct indexed_file' has no member named 'db' fileio.c:2178: error: 'struct indexed_file' has no member named 'db' fileio.c:2178: error: 'struct indexed_file' has no member named 'key' fileio.c:2178: error: 'struct indexed_file' has no member named 'data' fileio.c:2178: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:2183: error: 'struct indexed_file' has no member named 'key' fileio.c:2191: error: 'struct indexed_file' has no member named 'db' fileio.c:2191: error: 'struct indexed_file' has no member named 'db' fileio.c:2191: error: 'struct indexed_file' has no member named 'key' fileio.c:2191: error: 'struct indexed_file' has no member named 'data' fileio.c:2191: error: 'R_LAST' undeclared (first use in this function) fileio.c:2197: error: 'struct indexed_file' has no member named 'db' fileio.c:2197: error: 'struct indexed_file' has no member named 'db' fileio.c:2197: error: 'struct indexed_file' has no member named 'key' fileio.c:2197: error: 'struct indexed_file' has no member named 'data' fileio.c:2197: error: 'R_PREV' undeclared (first use in this function) fileio.c:2206: error: 'struct indexed_file' has no member named 'db' fileio.c:2206: error: 'struct indexed_file' has no member named 'db' fileio.c:2206: error: 'struct indexed_file' has no member named 'key' fileio.c:2206: error: 'struct indexed_file' has no member named 'data' fileio.c:2208: error: 'struct indexed_file' has no member named 'key' fileio.c:2212: error: 'struct indexed_file' has no member named 'db' fileio.c:2212: error: 'struct indexed_file' has no member named 'db' fileio.c:2212: error: 'struct indexed_file' has no member named 'key' fileio.c:2212: error: 'struct indexed_file' has no member named 'data' fileio.c:2218: error: 'struct indexed_file' has no member named 'key' fileio.c:2219: error: 'struct indexed_file' has no member named 'db' fileio.c:2219: error: 'struct indexed_file' has no member named 'db' fileio.c:2219: error: 'struct indexed_file' has no member named 'key' fileio.c:2219: error: 'struct indexed_file' has no member named 'data' fileio.c:2219: error: 'R_NEXT' undeclared (first use in this function) fileio.c:2226: error: 'struct indexed_file' has no member named 'db' fileio.c:2226: error: 'struct indexed_file' has no member named 'db' fileio.c:2226: error: 'struct indexed_file' has no member named 'key' fileio.c:2226: error: 'struct indexed_file' has no member named 'data' fileio.c:2232: error: 'struct indexed_file' has no member named 'db' fileio.c:2232: error: 'struct indexed_file' has no member named 'db' fileio.c:2232: error: 'struct indexed_file' has no member named 'key' fileio.c:2232: error: 'struct indexed_file' has no member named 'data' fileio.c:2238: error: 'struct indexed_file' has no member named 'key' fileio.c:2242: error: 'struct indexed_file' has no member named 'db' fileio.c:2242: error: 'struct indexed_file' has no member named 'db' fileio.c:2242: error: 'struct indexed_file' has no member named 'key' fileio.c:2242: error: 'struct indexed_file' has no member named 'data' fileio.c:2253: error: 'struct indexed_file' has no member named 'key' fileio.c:2255: error: 'struct indexed_file' has no member named 'data' fileio.c:2257: error: 'struct indexed_file' has no member named 'key' fileio.c:2257: error: 'struct indexed_file' has no member named 'data' fileio.c:2258: error: 'struct indexed_file' has no member named 'key' fileio.c:2259: error: 'struct indexed_file' has no member named 'db' fileio.c:2259: error: 'struct indexed_file' has no member named 'db' fileio.c:2259: error: 'struct indexed_file' has no member named 'key' fileio.c:2259: error: 'struct indexed_file' has no member named 'data' fileio.c:2293: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2293: error: 'struct indexed_file' has no member named 'key' fileio.c:2295: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2297: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2297: error: 'struct indexed_file' has no member named 'key' fileio.c:2299: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c: In function 'indexed_read': fileio.c:2534: error: 'struct indexed_file' has no member named 'data' fileio.c:2535: error: 'struct indexed_file' has no member named 'data' fileio.c:2535: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_read_next': fileio.c:2794: error: 'R_NEXT' undeclared (first use in this function) fileio.c:2806: error: 'R_LAST' undeclared (first use in this function) fileio.c:2808: error: 'R_PREV' undeclared (first use in this function) fileio.c:2811: error: 'R_FIRST' undeclared (first use in this function) fileio.c:2823: error: 'struct indexed_file' has no member named 'data' fileio.c:2836: error: 'struct indexed_file' has no member named 'key' fileio.c:2837: error: 'struct indexed_file' has no member named 'key' fileio.c:2837: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2841: error: 'struct indexed_file' has no member named 'db' fileio.c:2841: error: 'struct indexed_file' has no member named 'db' fileio.c:2841: error: 'struct indexed_file' has no member named 'key' fileio.c:2841: error: 'struct indexed_file' has no member named 'data' fileio.c:2845: error: 'struct indexed_file' has no member named 'data' fileio.c:2847: error: 'struct indexed_file' has no member named 'key' fileio.c:2847: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2847: error: 'struct indexed_file' has no member named 'key' fileio.c:2848: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2852: error: 'struct indexed_file' has no member named 'db' fileio.c:2852: error: 'struct indexed_file' has no member named 'db' fileio.c:2852: error: 'struct indexed_file' has no member named 'key' fileio.c:2852: error: 'struct indexed_file' has no member named 'data' fileio.c:2854: error: 'struct indexed_file' has no member named 'data' fileio.c:2857: error: 'struct indexed_file' has no member named 'key' fileio.c:2857: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2857: error: 'struct indexed_file' has no member named 'key' fileio.c:2858: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2859: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2859: error: 'struct indexed_file' has no member named 'data' fileio.c:2864: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2864: error: 'struct indexed_file' has no member named 'data' fileio.c:2867: error: 'struct indexed_file' has no member named 'key' fileio.c:2868: error: 'struct indexed_file' has no member named 'key' fileio.c:2868: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2869: error: 'struct indexed_file' has no member named 'db' fileio.c:2869: error: 'struct indexed_file' has no member named 'db' fileio.c:2869: error: 'struct indexed_file' has no member named 'key' fileio.c:2869: error: 'struct indexed_file' has no member named 'data' fileio.c:2906: error: 'struct indexed_file' has no member named 'key' fileio.c:2907: error: 'struct indexed_file' has no member named 'key' fileio.c:2907: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2911: error: 'struct indexed_file' has no member named 'db' fileio.c:2911: error: 'struct indexed_file' has no member named 'db' fileio.c:2911: error: 'struct indexed_file' has no member named 'key' fileio.c:2911: error: 'struct indexed_file' has no member named 'data' fileio.c:2911: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:2930: error: 'struct indexed_file' has no member named 'key' fileio.c:2930: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2930: error: 'struct indexed_file' has no member named 'key' fileio.c:2932: error: 'struct indexed_file' has no member named 'data' fileio.c:2934: error: 'struct indexed_file' has no member named 'key' fileio.c:2934: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2934: error: 'struct indexed_file' has no member named 'key' fileio.c:2935: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2939: error: 'struct indexed_file' has no member named 'db' fileio.c:2939: error: 'struct indexed_file' has no member named 'db' fileio.c:2939: error: 'struct indexed_file' has no member named 'key' fileio.c:2939: error: 'struct indexed_file' has no member named 'data' fileio.c:2941: error: 'struct indexed_file' has no member named 'data' fileio.c:2959: error: 'struct indexed_file' has no member named 'key' fileio.c:2959: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:2959: error: 'struct indexed_file' has no member named 'key' fileio.c:2960: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:2986: error: 'struct indexed_file' has no member named 'db' fileio.c:2986: error: 'struct indexed_file' has no member named 'db' fileio.c:2986: error: 'struct indexed_file' has no member named 'key' fileio.c:2986: error: 'struct indexed_file' has no member named 'data' fileio.c:3003: error: 'struct indexed_file' has no member named 'key' fileio.c:3003: error: 'struct indexed_file' has no member named 'key' fileio.c:3005: error: 'struct indexed_file' has no member named 'data' fileio.c:3007: error: 'struct indexed_file' has no member named 'key' fileio.c:3007: error: 'struct indexed_file' has no member named 'data' fileio.c:3008: error: 'struct indexed_file' has no member named 'key' fileio.c:3009: error: 'struct indexed_file' has no member named 'db' fileio.c:3009: error: 'struct indexed_file' has no member named 'db' fileio.c:3009: error: 'struct indexed_file' has no member named 'key' fileio.c:3009: error: 'struct indexed_file' has no member named 'data' fileio.c:3048: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:3048: error: 'struct indexed_file' has no member named 'key' fileio.c:3048: error: 'struct indexed_file' has no member named 'key' fileio.c:3050: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:3052: error: 'struct indexed_file' has no member named 'last_readkey' fileio.c:3052: error: 'struct indexed_file' has no member named 'key' fileio.c:3054: error: 'struct indexed_file' has no member named 'last_dupno' fileio.c:3068: error: 'struct indexed_file' has no member named 'data' fileio.c:3069: error: 'struct indexed_file' has no member named 'data' fileio.c:3069: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'get_dupno': fileio.c:3084: error: 'struct indexed_file' has no member named 'key' fileio.c:3084: error: 'struct indexed_file' has no member named 'key' fileio.c:3085: error: 'struct indexed_file' has no member named 'key' fileio.c:3085: error: 'struct indexed_file' has no member named 'key' fileio.c:3090: error: 'struct indexed_file' has no member named 'db' fileio.c:3090: error: 'struct indexed_file' has no member named 'db' fileio.c:3090: error: 'struct indexed_file' has no member named 'key' fileio.c:3090: error: 'struct indexed_file' has no member named 'data' fileio.c:3090: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:3092: error: 'struct indexed_file' has no member named 'key' fileio.c:3092: error: 'struct indexed_file' has no member named 'key' fileio.c:3093: error: 'struct indexed_file' has no member named 'data' fileio.c:3097: error: 'struct indexed_file' has no member named 'db' fileio.c:3097: error: 'struct indexed_file' has no member named 'db' fileio.c:3097: error: 'struct indexed_file' has no member named 'key' fileio.c:3097: error: 'struct indexed_file' has no member named 'data' fileio.c:3097: error: 'R_NEXT' undeclared (first use in this function) fileio.c: In function 'check_alt_keys': fileio.c:3116: error: 'struct indexed_file' has no member named 'key' fileio.c:3116: error: 'struct indexed_file' has no member named 'key' fileio.c:3117: error: 'struct indexed_file' has no member named 'db' fileio.c:3117: error: 'struct indexed_file' has no member named 'db' fileio.c:3117: error: 'struct indexed_file' has no member named 'key' fileio.c:3117: error: 'struct indexed_file' has no member named 'data' fileio.c:3120: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_write_internal': fileio.c:3168: error: 'struct indexed_file' has no member named 'key' fileio.c:3168: error: 'struct indexed_file' has no member named 'key' fileio.c:3185: error: 'struct indexed_file' has no member named 'data' fileio.c:3186: error: 'struct indexed_file' has no member named 'data' fileio.c:3187: error: 'struct indexed_file' has no member named 'db' fileio.c:3187: error: 'struct indexed_file' has no member named 'db' fileio.c:3187: error: 'struct indexed_file' has no member named 'key' fileio.c:3187: error: 'struct indexed_file' has no member named 'data' fileio.c:3187: error: 'R_NOOVERWRITE' undeclared (first use in this function) fileio.c:3193: error: 'struct indexed_file' has no member named 'data' fileio.c:3193: error: 'struct indexed_file' has no member named 'key' fileio.c:3195: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:3205: error: 'struct indexed_file' has no member named 'data' fileio.c:3206: error: 'struct indexed_file' has no member named 'data' fileio.c:3215: error: 'struct indexed_file' has no member named 'key' fileio.c:3215: error: 'struct indexed_file' has no member named 'key' fileio.c:3216: error: 'struct indexed_file' has no member named 'db' fileio.c:3216: error: 'struct indexed_file' has no member named 'db' fileio.c:3216: error: 'struct indexed_file' has no member named 'key' fileio.c:3216: error: 'struct indexed_file' has no member named 'data' fileio.c: In function 'indexed_write': fileio.c:3292: error: 'struct indexed_file' has no member named 'key' fileio.c:3292: error: 'struct indexed_file' has no member named 'key' fileio.c:3294: error: 'struct indexed_file' has no member named 'key' fileio.c:3296: error: 'struct indexed_file' has no member named 'key' fileio.c:3296: error: 'struct indexed_file' has no member named 'key' fileio.c:3299: error: 'struct indexed_file' has no member named 'key' fileio.c:3299: error: 'struct indexed_file' has no member named 'key' fileio.c: In function 'indexed_delete_internal': fileio.c:3312: error: 'DBT' undeclared (first use in this function) fileio.c:3312: error: expected ';' before 'prim_key' fileio.c:3359: error: 'struct indexed_file' has no member named 'key' fileio.c:3359: error: 'struct indexed_file' has no member named 'key' fileio.c:3360: error: 'struct indexed_file' has no member named 'db' fileio.c:3360: error: 'struct indexed_file' has no member named 'db' fileio.c:3360: error: 'struct indexed_file' has no member named 'key' fileio.c:3360: error: 'struct indexed_file' has no member named 'data' fileio.c:3365: error: 'prim_key' undeclared (first use in this function) fileio.c:3365: error: 'struct indexed_file' has no member named 'key' fileio.c:3368: error: 'struct indexed_file' has no member named 'data' fileio.c:3370: error: 'struct indexed_file' has no member named 'key' fileio.c:3370: error: 'struct indexed_file' has no member named 'key' fileio.c:3371: error: 'struct indexed_file' has no member named 'key' fileio.c:3371: error: 'struct indexed_file' has no member named 'key' fileio.c:3374: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:3374: error: 'struct indexed_file' has no member named 'key' fileio.c:3374: error: 'struct indexed_file' has no member named 'key' fileio.c:3375: error: 'struct indexed_file' has no member named 'rewrite_sec_key' fileio.c:3380: error: 'struct indexed_file' has no member named 'db' fileio.c:3380: error: 'struct indexed_file' has no member named 'db' fileio.c:3380: error: 'struct indexed_file' has no member named 'key' fileio.c:3382: error: expected ';' before 'sec_key' fileio.c:3388: error: 'struct indexed_file' has no member named 'db' fileio.c:3388: error: 'struct indexed_file' has no member named 'db' fileio.c:3388: error: 'struct indexed_file' has no member named 'key' fileio.c:3388: error: 'struct indexed_file' has no member named 'data' fileio.c:3388: error: 'R_CURSOR' undeclared (first use in this function) fileio.c:3390: error: 'sec_key' undeclared (first use in this function) fileio.c:3390: error: 'struct indexed_file' has no member named 'key' fileio.c:3391: error: 'struct indexed_file' has no member named 'key' fileio.c:3393: error: 'struct indexed_file' has no member named 'data' fileio.c:3398: error: 'struct indexed_file' has no member named 'db' fileio.c:3398: error: 'struct indexed_file' has no member named 'db' fileio.c:3398: error: 'struct indexed_file' has no member named 'key' fileio.c:3404: error: 'struct indexed_file' has no member named 'db' fileio.c:3404: error: 'struct indexed_file' has no member named 'db' fileio.c:3404: error: 'struct indexed_file' has no member named 'key' fileio.c:3404: error: 'struct indexed_file' has no member named 'data' fileio.c:3404: error: 'R_NEXT' undeclared (first use in this function) fileio.c:3421: error: 'struct indexed_file' has no member named 'db' fileio.c:3421: error: 'struct indexed_file' has no member named 'db' fileio.c: In function 'indexed_rewrite': fileio.c:3584: error: 'struct indexed_file' has no member named 'key' fileio.c:3584: error: 'struct indexed_file' has no member named 'key' make[2]: *** [libcob_la-fileio.lo] Error 1 make[2]: Leaving directory `/home/jack/open-cobol-1.1/libcob' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/jack/open-cobol-1.1' make: *** [all] Error 2 [/quote] ---------------------------------------------------------------- Hi, just a guess: configure did not found the correct BDB files. Use CFLAGS to point it to the correct folders. human ---------------------------------------------------------------- Notice how the configure output says that it will not use enhanced db greater than 4.1, yet 4.5 is installed. [quote] checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether to enable maintainer-specific portions of Makefiles... no checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking how to run the C preprocessor... gcc -E checking for egrep... grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking whether ln -s works... yes checking for a BSD-compatible install... /usr/bin/install -c checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking for a sed that does not truncate output... /usr/bin/sed checking for ld used by gcc... /usr/x86_64-suse-linux/bin/ld checking if the linker (/usr/x86_64-suse-linux/bin/ld) is GNU ld... yes checking for /usr/x86_64-suse-linux/bin/ld option to reload object files... -r checking for BSD-compatible nm... /usr/bin/nm -B checking how to recognize dependent libraries... pass_all checking dlfcn.h usability... yes checking dlfcn.h presence... yes checking for dlfcn.h... yes checking the maximum length of command line arguments... 1572864 checking command to parse /usr/bin/nm -B output from gcc object... ok checking for objdir... .libs checking for ar... ar checking for ranlib... ranlib checking for strip... strip checking if gcc supports -fno-rtti -fno-exceptions... no checking for gcc option to produce PIC... -fPIC checking if gcc PIC flag -fPIC works... yes checking if gcc static flag -static works... yes checking if gcc supports -c -o file.o... yes checking whether the gcc linker (/usr/x86_64-suse-linux/bin/ld -m elf_x86_64) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking for shl_load... no checking for shl_load in -ldld... no checking for dlopen... no checking for dlopen in -ldl... yes checking whether a program can dlopen itself... yes checking whether a statically linked program can dlopen itself... no checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes configure: creating libtool checking whether make sets $(MAKE)... (cached) yes checking for ANSI C header files... (cached) yes checking for stdint.h... (cached) yes checking for sys/types.h... (cached) yes checking signal.h usability... yes checking signal.h presence... yes checking for signal.h... yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking malloc.h usability... yes checking malloc.h presence... yes checking for malloc.h... yes checking locale.h usability... yes checking locale.h presence... yes checking for locale.h... yes checking stddef.h usability... yes checking stddef.h presence... yes checking for stddef.h... yes checking wchar.h usability... yes checking wchar.h presence... yes checking for wchar.h... yes checking for dlfcn.h... (cached) yes checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking for an ANSI C-conforming const... yes checking whether byte ordering is bigendian... no checking for size_t... yes checking whether struct tm is in sys/time.h or time.h... time.h checking for inline... inline checking for working alloca.h... yes checking for alloca... yes checking for vprintf... yes checking for _doprnt... no checking for memmove... yes checking for memset... yes checking for setlocale... yes checking for fcntl... yes checking for strerror... yes checking for strcasecmp... yes checking for strchr... yes checking for strrchr... yes checking for strdup... yes checking for strstr... yes checking for strtol... yes checking for gettimeofday... yes checking for ld used by GCC... /usr/x86_64-suse-linux/bin/ld -m elf_x86_64 checking if the linker (/usr/x86_64-suse-linux/bin/ld -m elf_x86_64) is GNU ld... yes checking for shared library run path origin... done checking for iconv... yes checking for iconv declaration... extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); checking for nl_langinfo and CODESET... yes checking for getopt_long_only... yes checking kpathsea/getopt.h usability... no checking kpathsea/getopt.h presence... no checking for kpathsea/getopt.h... no checking getopt.h usability... yes checking getopt.h presence... yes checking for getopt.h... yes checking gmp.h usability... yes checking gmp.h presence... yes checking for gmp.h... yes checking for __gmp_randinit in -lgmp... yes checking whether NLS is requested... yes checking for msgfmt... /usr/bin/msgfmt checking for gmsgfmt... /usr/bin/msgfmt checking for xgettext... no checking for msgmerge... no checking whether NLS is requested... yes checking for GNU gettext in libc... yes checking whether to use NLS... yes checking where the gettext function comes from... libc checking for initscr in -lncurses... yes checking ncurses.h usability... yes checking ncurses.h presence... yes checking for ncurses.h... yes checking db.h usability... no checking db.h presence... no checking for db.h... no checking db_185.h usability... no checking db_185.h presence... no checking for db_185.h... no checking db3/db_185.h usability... no checking db3/db_185.h presence... no checking for db3/db_185.h... no checking db4/db_185.h usability... no checking db4/db_185.h presence... no checking for db4/db_185.h... no checking db4.1/db_185.h usability... no checking db4.1/db_185.h presence... no checking for db4.1/db_185.h... no checking db4.2/db_185.h usability... no checking db4.2/db_185.h presence... no checking for db4.2/db_185.h... no checking db4.3/db_185.h usability... no checking db4.3/db_185.h presence... no checking for db4.3/db_185.h... no checking db4.4/db_185.h usability... no checking db4.4/db_185.h presence... no checking for db4.4/db_185.h... no checking db4.5/db_185.h usability... no checking db4.5/db_185.h presence... no checking for db4.5/db_185.h... no checking for __db_open in -ldb-4.5... yes checking for dlopen in -lc... yes configure: creating ./config.status config.status: creating cob-config config.status: creating Makefile config.status: creating lib/Makefile config.status: creating libcob/Makefile config.status: creating cobc/Makefile config.status: creating bin/Makefile config.status: creating po/Makefile.in config.status: creating texi/Makefile config.status: creating config/Makefile config.status: creating copy/Makefile config.status: creating tests/atlocal config.status: creating tests/Makefile config.status: creating tests/cobol85/Makefile config.status: creating config.h config.status: executing tests/atconfig commands config.status: executing depfiles commands config.status: executing default-1 commands config.status: creating po/POTFILES config.status: creating po/Makefile OpenCOBOL Configuration: CC gcc COB_CC gcc CFLAGS -O2 -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k COB_CFLAGS -I/usr/local/include COB_EXTRA_FLAGS LDFLAGS COB_LDFLAGS COB_LIBS -L${exec_prefix}/lib -lcob -lm -lgmp -lncurses -ldb-4.5 COB_CONFIG_DIR ${prefix}/share/open-cobol/config COB_COPY_DIR ${prefix}/share/open-cobol/copy COB_LIBRARY_PATH ${exec_prefix}/lib/open-cobol COB_MODULE_EXT so COB_SHARED_OPT -shared COB_PIC_FLAGS -fPIC -DPIC COB_EXPORT_DYN -Wl,--export-dynamic COB_STRIP_CMD strip --strip-unneeded Dynamic loading System Use gettext for international messages: yes Use Berkeley DB for file I/O: yes Use enhanced Berkeley DB (>= 4.1) no Use fcntl for file locking: yes Use ncurses/pdcurses/curses for screen I/O: yes [/quote] ---------------------------------------------------------------- You can see that no BDB header is found (only the library). Either the BDB headers are not installed or CFLAGS should be used to point ./configure to the right place. If you install them check for the correct version (must match the installed library). human BTW: next tarball aborts ./configure in this case with a nice message (and in any case for BDB at least version 4.5 is needed). ---------------------------------------------------------------- Success. I copied the db.h files from /usr/local/BerkeleyDB.5.3 to /usr/include, and the libdb to /lib64. ---------------------------------------------------------------- Subject: Intel TBB, Threading Building Blocks It's a C++ library meant to ease (and promote) purposeful use of multiple cores. I was thinking it might make for some nifty moves, table moves and inits. http://threadingbuildingblocks.org/ Open Source, hard core but fathomable. The name Threading isn't quite right, in my humble, more Task. Tiny instance id tasks, ..., in threads. Would it be worthwhile pursuing a binding for OpenCOBOL? Cheers, Brian ---------------------------------------------------------------- In my opinion, no. With a modern multiuser multiprocessing operating system there will be one of two outcomes. The multithreaded job will just gain higher priority, or the system will run slower as a job locks one processor while waiting for a second. If however, you are using XP then none of the above may apply. ---------------------------------------------------------------- Subject: File Creation and OpenCOBOL - from DarkSetz on forum.peoplecards.ca Trying my hand with OpenCOBOL has opened my eyes to just how spoiled rotten I was by the software development environment that I used in the COBOL development house that I worked at previously. Sadly, I never even thought to learn what the JCL compiler was actually doing when it was told to create a new file. All I had to do was OPEN OUTPUT and then CLOSE the file prior its first use and I was good-to-go. I've figured out how to create StreamIO files from within an OpenCOBOL program and I've tried using that method, as well as the Windows OS, to create a file stub which I've then attempted to define and use within a program to create an indexed file. Needless to say, this does not work and I feel n00bish for having tried it. :oops: (I'm using Oracle's Berkeley DB for indexed files.) Can some one please instruct me in the correct method(s) for creating indexed files, both from within a program and from the command line? ---------------------------------------------------------------- DarkSetz; See http://opencobol.add1tocobol.com/#does-opencobol-support-isam for a sample that creates an indexed file. Scan through the FAQ for OPEN OUTPUT for other examples with various ORGANIZATIONs. For INPUT files, you can use OPTIONAL if you are not sure it exists before a run. From the command line (for indexed files) is a different game. Berkeley DB does come with utilities, but I find it easier to write in COBOL and let OpenCOBOL do all the dirty work. http://www.oracle.com/technetwork/database/berkeleydb/overview/index.html For LINE SEQUENTIAL on GNU/Linux, a simple [code] $ touch your-filename-here [/code] will create an empty text file (or update the time stamp if it your-filename-here already exists). Cheers, Brian ---------------------------------------------------------------- [i]Excuse the late manual post (org Feb 16), I didn't notice an icon. From DarkSetz on forum.peoplecards.ca[/i] Hmmm... Let me make sure that I'm understanding this... The presence of an ASSIGN clause in a FILE CONTROL paragraph for an output file will cause a file that does not exist at runtime to be created when an OPEN OUTPUT statement is executed? Comparably, the OPTIONAL clause will cause an input file that does not exist at runtime to be created when an OPEN INPUT statement is executed? Can you use either an ASSIGN or OPTIONAL clause for files that will be OPEN I-O? ---------------------------------------------------------------- OPEN OUTPUT will create, every time. OPTIONAL and OPEN INPUT is a little different. It won't create but it won't abend with file not found on OPEN. Yes for using ASSIGN and OPTIONAL for OPEN I-O. Not entirely sure about all the OPTIONAL's implications though. Not at a place to quickly write up a test. But see http://opencobol.add1tocobol.com/#relative for a sample. And just so you know, DarkSetz, Gary Cutler wrote a world class programmer's guide, at http://opencobol.add1tocobol.com/OpenCOBOL%20Programmers%20Guide.pdf Awesome. Cheers, Brian [i]cross posted to forum.peoplecards.ca[/i] ---------------------------------------------------------------- Subject: OpenCOBOL Italian Group Hi everybody. I am moving the guicobol manual and tp-cobol-debugger to a specific opencobol Italian site. The documents will be available also in English language but the site will contains also information about opensource in italy and who/what could be shared for cobol. If any are interested to share or give any contribute (articles ...code or others) please contact me at priolof(at)tp-srl.it or sending a PM. Ciao a tutti, sto preparando un sito italiano per opencobol dove intendo spostare i nuovi manuali di guicobol (che sta diventando piuttosto corposo) e tp-cobol-debugger aggiungendo ovviamente anche le versioni inglesi. E' mio interesse pubblicare sul sito informazioni sull'opensource e sto contattando persone che si occupano di opensource in Italia. Sarei lieto di ospitare articoli o altro eventuale materiale utile. Se interessati per favore contattatemi pure. Federico ---------------------------------------------------------------- Hi Federico. I am with you. I'm only waiting to see if OC team is really willing to go on. Buondi' Federico, io ci sto. Sto solo aspettando di vedere se OC ha davvero intenzione di proseguire. Marcello ---------------------------------------------------------------- Hi Federico. Same for me. Sorry for the delay on my tests with guicobol. But I do not loose the case. Thank you for everything. René Aouizerate ---------------------------------------------------------------- Hi thanks Marcello and Rene' for support. The site is available at http://opencobol.altervista.org contents are in progress..since I am working at GuiCOBOL (recently unfortunately not so hard indeed..) I started to update the guicobol documentation adding images, examples and other informations. Soon I will update the new version of the Guicobol that is becoming to be almost a "serious" stuff and not an experimental .... Federico ---------------------------------------------------------------- [quote] Hi Federico. I am with you. I'm only waiting to see if OC team is really willing to go on. [/quote] Marcello, as a courtesy and confronting personal fears. The 2.0 development continues. I'm not eager to announce much. The principal developer has reasons for quiet, and Roger will speak to those when, if, he makes the decision and ducks are in rows. I watched the REBOL community implode on a wait-expectation loop that went awry. An early announcement had people on the edge of their seats with promise of 'next week', every week for years. That rubs the nerves into negative territory. Waiting for unknown longer term deadlines is easier, in my humble opinion, as it does not occupy edge of seat head space. OC1.1pre-rel is awesome and requires a lot more exploration into its capabilities. Way too much fun to stretch. I've had email with Roger in the last week, and I'm on the tag for correcting problems with some Texinfo files so they pass GNU Auto-tools acceptable minimums (we'll exceed said standards to OpenCOBOL quality before it ships). So, while wanting to avoid the wait-loop, things are progressing, sadly a little bit in secret, but I'm really getting the vibe that OpenCOBOL 2.0 will be a GNU project when it rolls. That's only a vibe, and I don't know anything really. And if you want in a little deeper, human is still running the translation project for compiler messages. Only Spanish contributed thus far? There are auto-test snippets to code up, umm, /extra contributions still very welcome, etc. For now, 1.1 still beats a lot of compilers on 'modern'. ;-) I'm going to continue to press for 1.1pre-rel being tagged 1.1 so the Feb2009 tarball starts making the distro packaging rounds. Cheers, Brian ---------------------------------------------------------------- The http://opencobol.altervista.org italian opencobol site let you to translate the pages with your native language. I know it is not like a real translation but since it contains the guicobol complete manual (originally written only in italian) this can help you to understand better the guicobol features. The project is going ahead. Federico ---------------------------------------------------------------- Hi all, I started a group for Opencobol Italian group on Facebook. If you like please join at.... http://www.facebook.com/groups/412925732105299/ thanks. Federico ---------------------------------------------------------------- Subject: Cannot find module 'CBL_GET_CSR_POS' - from schnauzman on forum.peoplecards.ca Hi guys, Quick back-story on me. I am web developer not a COBOL programmer, but I have been trying to get a basic understanding of the language for some projects I'm working on. I received source code for many old legacy programs that I am trying to re-compile for use in a 64 bit system. I installed the OpenCOBOL package for windows and followed the installation PDF described here: http://www.mediafire.com/file/v943ibx2p ... -mingw.zip. I did multiple COBOL tutorials to learn the syntax and basic flow of how programs work and so far I can write, compile and run very basic programs. When I start working with these legacy programs, I can compile them but they fail during run-time due to a missing library/module. I can only make assumptions about what this library does based on the code, but it appears to open a file and read a very specific line & cursor position. The subroutine being "CALL"ed is CBL_GET_CSR_POS and CBL_SET_CSR_POS. My problem is that I do not know how include this library, I know that I must compile my executable and statically include this library, but I don't know what library to use. Any help would be greatly appreciated! ---------------------------------------------------------------- Hi schnauzman, the programs use some C-functions from an internal library stock (likely MicroFocus), which aren't part of OC's library stock, yet. Therefore a simple linking with a module won't work. To get it work you have to write a C-wrapper calling curses functions and pass back the data to your COBOL module (or find someone to write it for you). The description of the functions can be found at [url=http://documentation.microfocus.com:8080/help/index.jsp?topic=%2Fcom.microfocus.eclipse.help.windows%2Fhtml%2Frhcall2b.htm]MF docs CBL_GET_CSR_POS[/url] and [url=http://documentation.microfocus.com:8080/help/index.jsp?topic=%2Fcom.microfocus.eclipse.help.windows%2Fhtml%2Frhcall4a.htm]MF docs CBL_SET_CSR_POS[/url] Please post the code of the curses C-wrapper here, if you finally have it for these (and/or other) library stock functions. This way we can place them in OC. human ---------------------------------------------------------------- [i]cross-posted on behalf of schnauzman from forum.peoplecards.ca[/i] Following up on my post... I solved this problem by simply removing the code blocks where the function is being called. The programs now work as expected but the output scrolls off the screen quickly which turns out is not really that important anyways :]~ Hope this helps someone else!! ---------------------------------------------------------------- Subject: Terminal problems [solved] on debian/ubuntu - from seetho at forum.peoplecards.ca [i]from seetho[/i] Hello, It's been quite some time (~25yrs) since I last used COBOL (on a WANG VS100). I just stumbled upon OpenCOBOL recently and felt like picking it up again, especially to build some applications that are heavy on data entry screen. I currently use PERL and LISP so using ncurses is awkward to say the least, and I hate writing GUI apps - call me old fashion. The first thing I tried was of course the short HELLO.COB sample program. No problems here. The trouble started when I modified the DISPLAY statement to: [code]DISPLAY "Hello world!" LINE 5 COL 5 END-DISPLAY[/code] The program would compile normally, but when runned it would output nothing. This was on my Ubuntu 10.04/Gnome machine. The program was run under gnome-terminal. Suspecting some terminal problem I tried xterminal instead - nothing again. Then I switch out to a real (TTY) text terminal, and IT WORKS! I get my "Hello world!" displayed on line 5 and column 5 on the screen. My gnome-terminal session is /dev/pts/0. It would seem that OpenCOBOL (at least on my PC) does not work well with pseudo terminals. If I did: [code]./hello >/dev/tty1[/code] The output will appear on TTY1. I tried recompiling OpenCOBOL 1.1 and ncurses 5.9 and still the same result. I even tried it on a freshly installed Debian 6.04 machine and still no go. Googling did not turn up anything on this so I suspect that I'm the only one having this problem. Am I missing something? Thanks. ---------------------------------------------------------------- seetho, It is actually working, but too fast to see. Add [code] CALL "C$SLEEP" USING 3 END-CALL [/code] just before any stop run, goback. One of the "features" of curses, ncurses is initializing its own screen buffer. This uses stdscr in curses, not stdout. This screen buffer disappears on curses run down and you see your terminal session with the ./hello and no stdout. Flickers fairly quickly. To quickly to notice. Sleeping before image exit will let you see the curses screen. You've made me curious, I wonder if ncurses has an ease of use CALL "dump look of buffer to stdout"? Instead of suggesting people call SLEEP or ACCEPT to wait for return, I looked quick... scr_dump("filename") doesn't cut it, as it seems to dump the screen state, not the screen buffer. An /extra anyone? A nice dump current screen to stdout using the curses library? It's build in, so no strange tectonics required. Cheers, Brian ---------------------------------------------------------------- Hi Brian, a "save curses screen before exit curses and dump it to stdout afterwards" would be really nice, but I'm very sure we have to patch libcob for that (because you can only output the screen to "real" stdout after exiting curses [which is done on cleanup in libcob] and need to save the contents before). I've changed the code to always do something like [code]display ' ' end-display display 'Press ENTER to exit the program' end-display accept dummyvar end-accept[/code] before STOP RUN. human ---------------------------------------------------------------- Hi all, It worked! Now I can continue my quest of trying to go back to being a COBOLER again. Hmmm... that sounded strangely like another profession that is much needed to keep the world on it's feet but much under-appreciated. Anyway, in hindsight, I encountered this problem of disappearing stdscr before when I was learning ncurses years ago. I just forgot about it :mrgreen:. In fact it is documented in the book by Dan Gookin, Programmer's Guide to nCurses. Apparently the culprit is the rmcup "feature" in terminfo that restore the screen after program termination, thus throwing away what I just tried to display. Most software will wait around for user input or user command to terminate so this "feature" will normally not cause any problems. I read that you can remove it all together from terminfo to disable it or you could use xterm where there is a way to disable it at runtime. Thanks for the help and thanks for OpenCOBOL. -- seetho p.s. my apologies for double posting earlier. [i]cross posted from forum.peoplecards.ca for seetho by btiffin[/i] ---------------------------------------------------------------- Welcome to the world of OpenCOBOL seetho. I'd be very interested to find out if there is a one-liner easy way to leave curses screen 'on display'. The refresh happens so fast, that many of us think things aren't working, (or forget the pause before rundown) and that's not great when you are writing a first cut Hello screen, or experimenting with features. I'm going to dig in a little, see if there isn't a semi-sane hint to give out to everyone. Your MCUP information is a hopeful sign. Cheers, Brian [i]cross post from forum.peoplecards.ca[/i] ---------------------------------------------------------------- Yay, found. https://blogs.oracle.com/samf/entry/smcup_rmcup_hate is a great article that discusses and sledge-hammer fixes the curses init screen clearing issue, leaving output on the stdout terminal, not an alternate screen. I just did a (after just in case copying /usr/share/terminfo/x/xterm - find this filename out by running infocmp to stdout first) [code] $ infocmp >xterm.terminfo $ vi xterm.terminfo $ # get rid of smcup= and rmcup= upto and including the comma $ tic xterm.terminfo [/code] in my case, the temporary xterm.terminfo looked like [code] ... rin=\E[%p1%dT, rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?1049l, rmir=\E[4l, rmkx=\E[?1l\E>, rmm=\E[?1034l, rmso=\E[27m, rmul=\E[24m, rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m, sgr0=\E(B\E[m, smacs=\E(0, smam=\E[?7h, smcup=\E[?1049h, [/code] and becomes [code] rin=\E[%p1%dT, rmacs=\E(B, rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmm=\E[?1034l, rmso=\E[27m, rmul=\E[24m, rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m, sgr0=\E(B\E[m, smacs=\E(0, smam=\E[?7h, ... [/code] rmcup and smcup edited out. After the tic command, these is now a shiny new local /home/btiffin/.terminfo/x/xterm compiled terminfo file that has no alternate terminal screen capabilities. That also means, as long as you don't run the term info compiler, tic, as root /usr/share/terminfo/x/xterm is still the original, and a new local copy is made. tic will overwrite the system file if it can, will move on and create a local compiled file if it can't. The script in Sam's blog, mentioned above, will alleviate doing this manually every time the system updates the terminfo database. So now, this [code] identification division. program-id. helloscreen. procedure division. display "Hello, world" at 0212 end-display display "Goodbye, smcup/rmcup" at 0313 end-display goback. end program helloscreen. [/code] and the command below; [i]which blanks the screen but now leaves output on stdout after goback.[/i] [btiffin@home forum]$ ./helloscreen [code] Hello, world Goodbye, smcup/rmcup [btiffin@home forum]$ [/code] Never worry about smcup/rmcup hate on curses init again. Not just OpenCOBOL and curses, but vi, less, man and any alternate screen application. For the win. This change effects old school TE TI termcap calls too, I think; did for my version of LESS without -X. Umm, probably still won't allow screen section programs in pipes; as stdin, stdout are a little special with curses involved. Minor annoyance that won't come up as often. Piping screen interactive programs has always been laden in voodoo anyway. For the win. Cheers, Brian ---------------------------------------------------------------- Subject: Hercules and OS/360 Anyone running this emulator with the OS/360 binaries? I want to try some COBOL circa 1960 and thought this might be a path. I've asked on a few forums, but no old school COBOL developers want to give up the goods with JCL driven COBOL it seems. I started here http://www.jaymoseley.com/hercules/install.htm which includes links to http://www.conmicro.com/hercos360/os360ctl.tar.gz http://www.jaymoseley.com/hercules/download/zips/os360d.tgz http://www.jaymoseley.com/hercules/download/zips/os360s.tgz Which are OS/360 DASD creators and Hercules control files, the driving programs for MFT/MVT, and system files (where the compilers et al live) I'm getting two translation exceptions on the IPL 150 (Hercules console command). A character move and an SSK 360 instruction. Sequence is [code] $ tar xvf os360ctl.tar.gz $ tar xvf os360d.tgz $ tar xvf os360s.tgz $ cd os360mvt $ ./makedasd $ hercules -f gen.cnf [/code] and from another terminal [code] $ telnet localhost 3270 [/code] The hercules console command [b]ipl 150[/b] is failing with the two translation exceptions mentioned above, but still allows the MFT (telnet) console to do its thing. Most of the install goes well, all the way through MFT and MVT builds (a 3270 emulator required, I use x3270-text), but I trip up getting HASP built. I'm assuming it has to do with the initial program load failure of the sysres.150 binary? Just curious if anyone has tried this. I'm wondering if Linux kernels older than my 3.7.1 might work? Too much fun kids. Cheers, Brian [b]P.S. Please don't pass on ANY of the files you get from those links[/b]. IBM sent a letter to ONE person that allowed redistribution of the OS/360 materials. Just pass on the links, not the files. This was a good will measure by IBM and should not be taken for granted or abused. P.P.S. It is pretty neat seeing how bad frames were at date handling pre Y2K. ;-) ---------------------------------------------------------------- bumping own. Success! Running COBOL from MVT. The job from Jay Maynard's os360mvt/sample dir [code] //COBUCLG JOB CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1) //HELOWRLD EXEC COBUCLG,PARM.COB='MAP,LIST,LET' //COB.SYSIN DD * 001 IDENTIFICATION DIVISION. 002 PROGRAM-ID. 'HELLO'. 003 ENVIRONMENT DIVISION. 004 CONFIGURATION SECTION. 005 SOURCE-COMPUTER. IBM-360. 006 OBJECT-COMPUTER. IBM-360. 0065 SPECIAL-NAMES. 0066 CONSOLE IS CNSL. 007 DATA DIVISION. 008 WORKING-STORAGE SECTION. 009 77 HELLO-CONST PIC X(12) VALUE 'HELLO, WORLD'. 075 PROCEDURE DIVISION. 090 000-DISPLAY. 100 DISPLAY HELLO-CONST UPON CNSL. 110 STOP RUN. //LKED.SYSLIB DD DSNAME=SYS1.COBLIB,DISP=SHR // DD DSNAME=SYS1.LINKLIB,DISP=SHR //GO.SYSPRINT DD SYSOUT=A // [/code] I still need to figure out x3270 for screen captures, but here is an extract from the 'printer', prt00e.txt [code] //COBUCLG JOB CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1) //HELOWRLD EXEC COBUCLG,PARM.COB='MAP,LIST,LET' XXCOB EXEC PGM=IKFCBL00,REGION=86K,PARM='LOAD,SUPMAP' 05000018 XXSYSPRINT DD SYSOUT=A 10000018 XXSYSUT1 DD UNIT=SYSDA,SPACE=(460,(700,100)) 15000018 XXSYSUT2 DD UNIT=SYSDA,SPACE=(460,(700,100)) 20000018 XXSYSUT3 DD UNIT=SYSDA,SPACE=(460,(700,100)) 25000018 XXSYSUT4 DD UNIT=SYSDA,SPACE=(460,(700,100)) 30000018 XXSYSLIN DD DSNAME=&LOADSET,DISP=(MOD,PASS),UNIT=SYSDA, 35000018 XX SPACE=(80,(500,100)) 40000018 //COB.SYSIN DD * IEF236I ALLOC. FOR COBUCLG COB HELOWRLD IEF237I 352 ALLOCATED TO SYSPRINT IEF237I 151 ALLOCATED TO SYSUT1 IEF237I 352 ALLOCATED TO SYSUT2 IEF237I 150 ALLOCATED TO SYSUT3 IEF237I 352 ALLOCATED TO SYSUT4 IEF237I 151 ALLOCATED TO SYSLIN IEF237I 150 ALLOCATED TO SYSIN CB545 V2 LVL78 01MAY72 IBM OS AMERICAN NATIONAL STANDARD COBOL DATE FEB 25,1984 1 00001 001 IDENTIFICATION DIVISION. 00002 002 PROGRAM-ID. 'HELLO'. 00003 003 ENVIRONMENT DIVISION. 00004 004 CONFIGURATION SECTION. 00005 005 SOURCE-COMPUTER. IBM-360. 00006 006 OBJECT-COMPUTER. IBM-360. 00007 0065 SPECIAL-NAMES. 00008 0066 CONSOLE IS CNSL. 00009 007 DATA DIVISION. 00010 008 WORKING-STORAGE SECTION. 00011 009 77 HELLO-CONST PIC X(12) VALUE 'HELLO, WORLD'. 00012 075 PROCEDURE DIVISION. 00013 090 000-DISPLAY. 00014 100 DISPLAY HELLO-CONST UPON CNSL. 00015 110 STOP RUN. 2 *STATISTICS* SOURCE RECORDS = 15 DATA DIVISION STATEMENTS = 1 PROCEDURE DIVISION STATEMENTS = 2 *OPTIONS IN EFFECT* SIZE = 81920 BUF = 2768 LINECNT = 57 SPACE1, FLAGW, SEQ, SOURCE *OPTIONS IN EFFECT* NODMAP, NOPMAP, NOCLIST, NOSUPMAP, NOXREF, LOAD, NODECK, APOST, NOTRUNC, NOLIB, NOVERB *OPTIONS IN EFFECT* ZWB IEC130I SYSPUNCH DD STATEMENT MISSING IEC130I SYSLIB DD STATEMENT MISSING IEC130I SYSPUNCH DD STATEMENT MISSING IEF142I - STEP WAS EXECUTED - COND CODE 0000 IEF285I SYS84056.T093538.SV000.COBUCLG.R0000001 SYSOUT IEF285I VOL SER NOS= WORK02. IEF285I SYS84056.T093538.RV000.COBUCLG.R0000002 DELETED IEF285I VOL SER NOS= WORK01. IEF285I SYS84056.T093538.RV000.COBUCLG.R0000003 DELETED IEF285I VOL SER NOS= WORK02. IEF285I SYS84056.T093538.RV000.COBUCLG.R0000004 DELETED IEF285I VOL SER NOS= SYSRES. IEF285I SYS84056.T093538.RV000.COBUCLG.R0000005 DELETED IEF285I VOL SER NOS= WORK02. IEF285I SYS84056.T093538.RV000.COBUCLG.LOADSET PASSED IEF285I VOL SER NOS= WORK01. IEF285I SYS84056.T093538.RV000.COBUCLG.S0000006 SYSIN IEF285I VOL SER NOS= SYSRES. IEF285I SYS84056.T093538.RV000.COBUCLG.S0000006 DELETED IEF285I VOL SER NOS= SYSRES. IEF373I STEP /COB / START 84056.0937 IEF374I STEP /COB / STOP 84056.0937 CPU 0MIN 00.08SEC MAIN 84K LCS 0K XXLKED EXEC PGM=IEWL,PARM='LIST,XREF,LET',COND=(5,LT,COB),REGION=96K 45000018 XXSYSLIN DD DSNAME=&LOADSET,DISP=(OLD,DELETE) 50000018 XX DD DDNAME=SYSIN 55000018 XXSYSLMOD DD DSNAME=&GODATA(RUN),DISP=(NEW,PASS),UNIT=SYSDA, 60000018 XX SPACE=(1024,(50,20,1)) 65000018 //LKED.SYSLIB DD DSNAME=SYS1.COBLIB,DISP=SHR X/SYSLIB DD DSNAME=SYS1.COBLIB,DISP=SHR 70000018 // DD DSNAME=SYS1.LINKLIB,DISP=SHR XXSYSUT1 DD UNIT=(SYSDA,SEP=(SYSLIN,SYSLMOD)),SPACE=(1024,(50,20)) 75000018 XXSYSPRINT DD SYSOUT=A 80000018 IEF236I ALLOC. FOR COBUCLG LKED HELOWRLD IEF237I 151 ALLOCATED TO SYSLIN IEF237I 151 ALLOCATED TO SYSLMOD IEF237I 350 ALLOCATED TO SYSLIB IEF237I 350 ALLOCATED TO IEF237I 150 ALLOCATED TO SYSUT1 IEF237I 151 ALLOCATED TO SYSPRINT F128-LEVEL LINKAGE EDITOR OPTIONS SPECIFIED LIST,XREF,LET DEFAULT OPTION(S) USED - SIZE=(131072,18432) CROSS REFERENCE TABLE CONTROL SECTION ENTRY NAME ORIGIN LENGTH NAME LOCATION NAME LOCATION NAME LOCATION NAME LOCATION HELLO 00 308 ILBODSP0* 308 700 ILBOSTP0* A08 35 ILBOSTP1 A1E LOCATION REFERS TO SYMBOL IN CONTROL SECTION LOCATION REFERS TO SYMBOL IN CONTROL SECTION 260 ILBOSTP0 ILBOSTP0 264 ILBODSP0 ILBODSP0 268 ILBOSTP1 ILBOSTP0 ENTRY ADDRESS 00 TOTAL LENGTH A40 ****RUN DOES NOT EXIST BUT HAS BEEN ADDED TO DATA SET IEF142I - STEP WAS EXECUTED - COND CODE 0000 IEF285I SYS84056.T093538.RV000.COBUCLG.LOADSET DELETED IEF285I VOL SER NOS= WORK01. IEF285I SYS84056.T093538.RV000.COBUCLG.GODATA PASSED IEF285I VOL SER NOS= WORK01. IEF285I SYS1.COBLIB KEPT IEF285I VOL SER NOS= MVTRES. IEF285I SYS1.LINKLIB KEPT IEF285I VOL SER NOS= MVTRES. IEF285I SYS84056.T093538.RV000.COBUCLG.R0000007 DELETED IEF285I VOL SER NOS= SYSRES. IEF285I SYS84056.T093538.SV000.COBUCLG.R0000008 SYSOUT IEF285I VOL SER NOS= WORK01. IEF373I STEP /LKED / START 84056.0937 IEF374I STEP /LKED / STOP 84056.0937 CPU 0MIN 00.04SEC MAIN 96K LCS 0K XXGO EXEC PGM=*.LKED.SYSLMOD,COND=((5,LT,COB),(5,LT,LKED)) 85000018 //GO.SYSPRINT DD SYSOUT=A // IEF236I ALLOC. FOR COBUCLG GO HELOWRLD IEF237I 151 ALLOCATED TO PGM=*.DD IEF237I 352 ALLOCATED TO SYSPRINT HELLO, WORLD IEF142I - STEP WAS EXECUTED - COND CODE 0000 IEF285I SYS84056.T093538.RV000.COBUCLG.GODATA PASSED IEF285I VOL SER NOS= WORK01. IEF285I SYS84056.T093538.SV000.COBUCLG.R0000009 DELETED IEF285I VOL SER NOS= WORK02. IEF373I STEP /GO / START 84056.0937 IEF374I STEP /GO / STOP 84056.0937 CPU 0MIN 00.01SEC MAIN 8K LCS 0K IEF285I SYS84056.T093538.RV000.COBUCLG.GODATA DELETED IEF285I VOL SER NOS= WORK01. IEF375I JOB /COBUCLG / START 84056.0937 IEF376I JOB /COBUCLG / STOP 84056.0937 CPU 0MIN 00.13SEC [/code] and the mvtlog [code] 093712 0000 IEF403I COBUCLG STARTED TIME=09.37.12 093712 0000 IEF285I SYS1.COBLIB KEPT 093712 0000 IEF285I VOL SER NOS= MVTRES. 093712 0000 IEF285I SYS1.LINKLIB KEPT 093712 0000 IEF285I VOL SER NOS= MVTRES. 093712 0000 IEF285I SYS84056.T093538.RV000.COBUCLG.GODATA DELETED 093712 0000 IEF285I VOL SER NOS= WORK01. 093712 0000 IEF404I COBUCLG ENDED TIME=09.37.12 [/code] and on the 3270 console [code] - HELLO, WORLD [/code] I haven't built HASP for this pass, so the card reader is fed from the Hercules console [b]devinit 00c sample/cobuclg.jcl[/b] to kick the run, but woohoo Livin' the good life now people. Big iron (old, rusty, way too cool for the young kids) running beside the penguins. Nice way to start a Saturday. Thanks to the Hercules team and Jay for the leg up on getting the OS initiated. Woohoo. Cheers, Brian ---------------------------------------------------------------- [i]Cross posted from forum.peoplecards.ca user mfisher_ix[/i] btiffin: Just saw your post on this topic at opencobol.org (dated 2012/2/24 1:52). Fun stuff! I haven't used OS/360 per se, but have used Volker Bandke's pre-built Tur(n)key MVS. In combination with the Hercules emulator, the Tur(n)key MVS will get you up and running in the MVS 3.8J operating system for the System/370 architecture. includes the compilers for COBOL, PL1, Fortran, etc. The COBOL compiler is from an older OS version, but has been made to work in MVS 3.8J. The dialect is IBM OS Full American National Standard COBOL circa 1972. This means ANS COBOL-68 with IBM extensions. Gary DeWard Brown's books "System/370 JCL" and "Advanced ANS COBOL with Structured Programming" are good references for this combination of OS and compiler. I've blogged from a beginner's perspective on how to get started using JCL, RPF (a screen editor plus other utilities), etc. to compile and run COBOL in this environment. Have used it both in debian squeeze and Windows. Topics on which I've blogged so far are: - Install/startup/shutdown procedures for Tur(n)key MVS #3 - Submitting a Job from TSO in Tur(n)key MVS #3 - Hello, world in System/370 assembler - Using RPF to view and submit a JCL jobstream - Using RPF to add a JCL jobstream to an existing dataset - Listing partitioned datasets with TSO’s LISTCAT command - Adding the missing cataloged procedure, COBUCL - Using RPF to create the HERC01.TEST.COBOL partitioned dataset - Making COBOL DISPLAY to TSO, and ACCEPT from TSO - PA1 is the “break” key in TSO For a list of my posts on this topic, see: http://high-value.org/?cat=7 I'd be happy to answer any questions you have, or at least try to figure them out. I'm just a hobbyist, not an old school IBM COBOL programmer. - Matt Fisher ---------------------------------------------------------------- Nice. Those snippets are awesome. I like this one from http://www.jaymoseley.com/hercules/download/jcl/ASMFCLG.JCL 9 control lines and 6 lines of frame assembler for Hello, world. Nifty. [code] //ASMFCLG JOB (001),'ASM HELLO WORLD', 00010000 // CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),REGION=128K 00020000 //HELLO EXEC ASMFCLG 00030000 //ASM.SYSUT1 DD UNIT=SYSDA 00040000 //ASM.SYSUT2 DD UNIT=SYSDA 00050000 //ASM.SYSUT3 DD UNIT=SYSDA 00060000 //ASM.SYSGO DD UNIT=SYSDA 00070000 //ASM.SYSIN DD * 00080000 HELLO CSECT 00090000 USING HELLO,15 00100000 SAVE (14,12) 00110000 WTO 'HELLO WORLD!' 00120000 RETURN (14,12),RC=0 00130000 END 00140000 // 00150000 [/code] Cheers, Brian ---------------------------------------------------------------- Subject: How to run MF COBOL on FreeBSD Hi Please, Help me! I have many MF COBOL (execcution) files that compilyed on SCO System V. how do I run these files on FreeBSD 8.0 (i386)? ---------------------------------------------------------------- Are the programs .int or .gnt and do you have the source code? ---------------------------------------------------------------- Subject: Issue between declared variables in linkage section in callee sub and "real" variables in caller sub Hello, I have encountered the code below in the application I'm migrating : PROGRAM PRG1 [code] * IDENTIFICATION DIVISION. PROGRAM-ID. PRG1. DATA DIVISION. WORKING-STORAGE SECTION. 01 STR-PRG1. 10 BUFFER PIC X(2000). PROCEDURE DIVISION. INITIALIZE STR-PRG1. CALL "PRG2" USING STR-PRG1. EXIT PROGRAM. [/code] SUB PRG2 [code] * IDENTIFICATION DIVISION. PROGRAM-ID. PRG2. DATA DIVISION. WORKING-STORAGE SECTION. 01 STR-PRG2. 10 BUFFER PIC X(16000). LINKAGE SECTION. 01 STR-PRG1. 10 BUFFER PIC X(16000). PROCEDURE DIVISION. MOVE STR-PRG1 TO STR-PRG2. EXIT PROGRAM. [/code] As you can read the programs above : - the caller sub declares a variable of 2000 bytes - the callee sub declares the same variable of 16000 bytes through the linkage section and a working variable of the same length The only action made is to copy the value from caller variable to callee variable : The translation in C language for the line [code] MOVE STR-PRG1 TO STR-PRG2.[/code] is [code] { memcpy (b_5, b_7, 16000); }[/code] that is syntactically correct but the real length of b_7 is 2000 not 16000 so an exception is risen "Attempt to reference unallocated memory (Signal SIGSEGV)" (OC 1.1) / "Memory Fault" (OC 0.33) I understand that this issue (maybe someone has already written a post about this problem but I haven't found any) is due to the asset i'm working on but could the problem and the solution may lie between using the cob_module structure and the cob_move function, as when the move action between two variables of different lengths is done by the cob_move function ? KR, eraso ---------------------------------------------------------------- I don't think the memcpy is the problem. [code] [btiffin@home cobol]$ cobc -x prg1.cob prg2.cob [btiffin@home cobol]$ ./prg1 Attempt to reference unallocated memory (Signal SIGSEGV) Abnormal termination - File contents may be incorrect [btiffin@home cobol]$ cobc -x -W -debug -g prg1.cob prg2.cob prg1.cob:11: Warning: CALL statement not terminated by END-CALL prg2.cob:13: Warning: LINKAGE item 'STR-PRG1' is not a PROCEDURE USING parameter [btiffin@home cobol]$ ./prg1 prg2.cob:13: libcob: BASED/LINKAGE item 'STR-PRG1' has NULL address [/code] Looks more like an error with STR-PRG1 naming on the prg2.cob PROCEDURE DIVISION. OpenCOBOL is pretty nice about messages with -W, -g and -debug. Try [code] PROGRAM-ID. PRG2. DATA DIVISION. WORKING-STORAGE SECTION. 01 STR-PRG2. 10 BUFFER PIC X(16000). LINKAGE SECTION. 01 STR-PRG1. 10 BUFFER PIC X(16000). PROCEDURE DIVISION using str-prg1. MOVE STR-PRG1 TO STR-PRG2. EXIT PROGRAM. [/code] and then [code] [btiffin@home cobol]$ cobc -x -W -debug -g prg1.cob prg2.cob prg1.cob:11: Warning: CALL statement not terminated by END-CALL [btiffin@home cobol]$ ./prg1 [btiffin@home cobol]$ [/code] It won't abend, but the last 14000 chars in PRG2 STR-PRG2 is going to be a load of junk. Cheers, Brian ---------------------------------------------------------------- Hello, Btiffin, thanks for your reply. Well I made a mistake when I wrote the program samples for the problem I encountered in the asset I'm working with (I may repeat myselft but, in french, cela va sans dire mais ca va mieux en le disant). What I wanted to point is around the definition of variables in linkage section and their use in callee sub and the real definition in caller sub. So I wrote two executables PRG1 and PRG3 calling PRG2 as you can see below : (I compiled PRG1 and PRG3 as executable - cobc -x -debug - and PRG2 as shared library - cobc -m -debug) PRG1 : [code]* IDENTIFICATION DIVISION. PROGRAM-ID. PRG1. DATA DIVISION. WORKING-STORAGE SECTION. 01 STR-PRG1. 10 BUFFER PIC X([b]2000[/b]). PROCEDURE DIVISION. INITIALIZE STR-PRG1. CALL "PRG2" USING STR-PRG1. EXIT PROGRAM. [/code] PRG3 : [code]* IDENTIFICATION DIVISION. PROGRAM-ID. PRG3. DATA DIVISION. WORKING-STORAGE SECTION. 01 STR-PRG1. 10 BUFFER PIC X([b]16000[/b]). PROCEDURE DIVISION. INITIALIZE STR-PRG1. CALL "PRG2" USING STR-PRG1. EXIT PROGRAM. [/code] PRG2 : [code] IDENTIFICATION DIVISION. PROGRAM-ID. PRG2. DATA DIVISION. WORKING-STORAGE SECTION. 01 STR-PRG2. 10 BUFFER PIC X([i]16000[/i]). LINKAGE SECTION. 01 STR-PRG1. 10 BUFFER PIC X([b][i]16000[/i][/b]). PROCEDURE DIVISION USING STR-PRG1. MOVE STR-PRG1 TO STR-PRG2. DISPLAY "MOVE DONE". EXIT PROGRAM. [/code] As you can read, if everything goes right, "MOVE DONE" is displayed on console. Everything goes right for PRG3 but for PRG1, the output is : [quote]PROGRAM-ID: PRG1: ENTRY PRG1 PROGRAM-ID: PRG1: MAIN SECTION PROGRAM-ID: PRG1: MAIN PARAGRAPH PROGRAM-ID: PRG1 Line: 11 Statement: INITIALIZE PROGRAM-ID: PRG1 Line: 12 Statement: CALL PROGRAM-ID: PRG2 Line: 14 Statement: MOVE PRG2.cbl:14: Attempt to reference unallocated memory (Signal SIGSEGV) Abnormal termination - File contents may be incorrect[/quote] This because in PRG1 STR-PRG1 is defined of 2000 bytes long but in the linkage section of PRG2, STR-PRG1 is defined of 16000 bytes long, so the move order in PRG2 translated to memcopy instruction try to copy 16000 bytes, that is more than the real length of STR-PRG1 defined in PRG1, so that's why the exception "Attempt to reference unallocated memory (Signal SIGSEGV)" is risen. So my question is could the problem and the solution may lie between using the cob_module structure and the cob_move function, as when the move action between two variables of different lengths is done by the cob_move function ? ---------------------------------------------------------------- As btiffin said: This is a coding error, not a runtime issue. Therefore I believe there will be no change to cob_module/cob_move as it SHOULD crash here (Think of important stuff you pass on CALL and expect to be used). What I hope is that the size of the using/linkage items will be checked in the future (at least with -debug) and the runtime exits with an error as a segfault is not easy to find. human ---------------------------------------------------------------- Hello, Thank you for your time Btiffin and Human. Human, the suggestion you made is The solution. By now I rewrite manually the parts wrongly coded. KR, eraso 8-) ---------------------------------------------------------------- Subject: V8 javascript in OpenCOBOL <From a thread on linkedin> Michael, I did (ala http://code.google.com/apis/v8/build.html) [code] $ svn checkout http://v8.googlecode.com/svn/trunk/ v8-read-only $ cd v8-read-only $ scons arch=x64 $ scons arch=x64 library=shared $ g++ -c ocv8js.cpp -Iinclude -L. -o ocv8js.o -lpthread $ cobc -x ocv8.cob ocv8js.o -lv8 -lstdc++ -L . $ LD_LIBRARY_PATH=$PWD ./ocv8 [/code] with [b]ocv8js.cpp[/b] [code] #include <v8.h> #include <string.h> using namespace v8; extern "C" { int CBL_OC_V8JAVASCRIPT(char* arg, char* out, int outlen) { // Create a stack-allocated handle scope. HandleScope handle_scope; // Create a new context. Persistent<Context> context = Context::New(); // Enter the created context for compiling and // running the hello world script. Context::Scope context_scope(context); // Create a string containing the JavaScript source code. Handle<String> source = String::New(arg); // Compile the source code. Handle<Script> script = Script::Compile(source); // Run the script to get the result. Handle<Value> result = script->Run(); // Dispose the persistent context. context.Dispose(); // Convert the result to an ASCII string and cpy to COBOL String::AsciiValue ascii(result); strncpy(out, *ascii, outlen); return 0; } } [/code] and [code] OCOBOL >>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20120227 *> Purpose: Embed V8 javascript *> *> Tectonics: from http://code.google.com/apis/v8/build.html *> and in a fresh svn checkout directory *> scons library=shared arch=x64 *> g++ -c ocv8js.cpp -Iinclude -L. -o ocv8js.o -lpthread *> cobc -x ocv8.cob ocv8js.o -lv8 -lstdc++ -L . *> *************************************************************** identification division. program-id. ocv8. data division. 77 result usage binary-long. 01 v8-value pic x(32767). *> -*********-*********-*********-*********-*********-*********-** procedure division. display "Calling CBL_OC_V8JAVASCRIPT" end-display call "CBL_OC_V8JAVASCRIPT" using "'Hello' + ', world'" & x"00" v8-value by value function length(v8-value) returning result on exception display "v8 linkage problem, result garbage" end-display continue end-call move function substitute(v8-value, x"00", space) to v8-value display "V8 gives :" function trim(v8-value) ":" end-display goback. end program ocv8. [/code] and as none of this is installed, need to tweak the library lookup path for testing [code] $ LD_LIBRARY_PATH=$PWD ./ocv8 Calling CBL_OC_V8JAVASCRIPT V8 gives :Hello, world: [/code] Worked the beauty first try. But, man is the V8 code ever codey, err, I mean top-end C++. :-) [i]v8 sources really are top-end everyone. But C++ is always codey lookin'. The more high end, the codey-er.[/i] Cheers, Brian [i]and I lied, nothing ever works first try, but two in this case...I forgot the BY VALUE on the length int, and first try was a segfault. Always heart warming and very motivational when experimenting with unknown new libraries.[/i] ---------------------------------------------------------------- Ok, three tries. [code] OCOBOL >>SOURCE FORMAT IS FIXED *> *************************************************************** *> Author: Brian Tiffin *> Date: 20120227 *> Purpose: Embed V8 javascript *> *> Tectonics: from http://code.google.com/apis/v8/build.html *> and in a fresh svn checkout directory *> scons library=shared arch=x64 *> g++ -c ocv8js.cpp -Iinclude -L. -o ocv8js.o -lpthread *> cobc -x ocv8.cob ocv8js.o -lv8 -lstdc++ -L . *> *************************************************************** identification division. program-id. ocv8. data division. 77 result usage binary-long. 01 v8-value pic x(32767). *> -*********-*********-*********-*********-*********-*********-** procedure division. display "Calling CBL_OC_V8JAVASCRIPT" end-display call "CBL_OC_V8JAVASCRIPT" using "'Hello' + ', world'" v8-value by value function length(v8-value) returning result on exception display "v8 linkage problem, result garbage" end-display continue end-call display "V8 gives :" function trim(v8-value) ":" end-display goback. end program ocv8. [/code] Forgot the C string null on the CALL literal. [i]I've updated the original post. The listing above is the unsafe version for context.[/i] [b]Don't cut nor paste this one.[/b] ;-) Plus: This discussion on LinkedIn has led to the idea of a new project to attempt to embed Node.js into OpenCOBOL. I'm going to try a CALL interface first. Cheers, Brian ---------------------------------------------------------------- Subject: An excellent article on writing better COBOL sources http://www.tonymarston.net/cobol/cobolstandards.html#introduction Cheers, Brian ---------------------------------------------------------------- Yes, excellent. While I might disagree with some of the conclusions, it is extremely valuable to have standards. Relative to field naming we adopted these standards some number of years ago. Again having a consistent approach is to us more important than the details. [code] Field Naming Conventions Field RPG, IDDU, Image Cobol Address AD ADDRESS Amount AM AMOUNT Code CD CODE Count CT COUNT Cycle CY CYCLE Date DT DATE Edit ED EDIT Filler ZZ FILLER Flag FG FLAG Hour HR HOUR Key KY KEY Pound LB POUND Name NM NAME Number NO NO Percentage PC PCT Quantity QT QUANTITY Rate RT RATE Status ST STATUS Text TX TEXT Type TY TYPE 1) The field name will be constructed as follows: aaa-bbbbb-cccccccccccccccc where aaa is the record that the field is in using the first letter of each word of the record name (limited to 3 positions), working storage fields begin WS bbbbb is the type of field from the above chart cccccccc is the rest of the field name needed to sufficiently describe the field. When used correctly a responsible party name field in the patient master record becomes: PM-NAME-RESPONSIBLE-PARTY in Cobol PNMRES in RPG and IDDU NM-RESP-PARTY in Image 2) The PIC clause will begin in column 50. 3) Source code is to be entered in uppercase only. 4) When using a number in a field name, a dash will be placed before the number (e.g. ADDRESS-1). NOTE: In MySQL underscores “_” are used in place of hyphens “-“. [/code] ---------------------------------------------------------------- Subject: Does OC support 85 Standard (optional) Debugging Module? Does OC support the '85 Standard (optional) Debugging Module? This does NOT relate to debugging lines but does relate to things like: USE FOR DEBUGGING and DEBUG-ITEM (special register) It doesn't seem to me that the NIST/FIPS tests taht are run during instalation verification include the DB programs/ (These are DEBUGGING not DATABASE) ---------------------------------------------------------------- Not yet Bill. But 2.0 will (and does in alpha cuts) NIST test suite up to 9710 successes, compared to 9082 in 1.1pre-rel, 435 of the new passes are in the DB module. Cheers, Brian ---------------------------------------------------------------- Subject: On EXEC Ok, I have two itchy reasons to add EXEC to OpenCOBOL now. EXEC Guile EXEC Node Others might itch more at EXEC SQL ;-) Given that. I'd like to ask the group for opinions on how they envision the best way to proceed. From deep within Flex/Bison (scanner.l and parser.y sources in cobc/)? Putting it fairly firmly in OpenCOBOL's cobc built in COPY preprocessor space. From a completely separate executable? Bits of both? Something completely different? Umm, as wikipedia mottos, Be Bold. I don't think any ideas could be bad ideas, but there will always be implementation [i]and implementer skill level[/i] details to discuss. Cheers, Brian ---------------------------------------------------------------- I guess the best thing would be the following: Tweak cobc to: - parse the EXEC stuff - look for some file like stuff.exec (guile.exec, node.exec, ) where additional config options can be found: How to parse it, command line(s) for external calls (if necessary), special parsing options (if needed, maybe options like "call the external tool BEFORE further parsing" "with the whole cobol source"/"whole cobol source with copybooks included"/"only the EXEC parts", ...), ... After that an external tool has to be written if it's not possible to put all the "how to parse" for that specific EXEC stuff in the specific exec-config file (you may call them exec-rules, if you'd like to). An approach like this has some advantages: - get to work existing external pre-compilers without other calls than cobc - new external precompilers can be used outside of OC (if all necessary COBOL features are available in that compiler ; - ) - don't bloat OC with 500+ EXEC implementations - possibility to add an EXEC onlyineedthisstuff or EXEC thisstuffisverynew without the need to change a line in a used version of OpenCOBOL - easy EXEC implementations could be done via exec-config files (I think of stuff like: if you find "xyz" insert XYZ1 in working-storage, XYZ2 in local-storage and these 500 lines in procedure division [if they weren't inserted before] and this PERFORM on the current line ... just some thoughts ... human ---------------------------------------------------------------- "Historically" there are some failrly significant issues with adding EXEC ... END-EXEC support in compilers. The issue that seems most "controversial" (and/or hardest to implemnt) is what to do with REPLACE and COPY/REPLACING Can you place an EXEC statemen in a COPY file? Does replace process it Can you have a COPY or REPLACE statemet in the middle of an EXEC statement Where does EXEC SQL INCLUDE (or any other INCLUDE) work with COPY statements? There used to be isxues with "_" (nderscore vs "-" hyphen, but with "modern" COBOL supporting underscores in COBOL words, that probably isn't an isssue any more. However, you do need to be "careful" about what COBOL or text word is - when processing EXEC statements. Processing periods (full stops) both within and at the end of exec statements can also be an issue, e.g. [quote] If a = "A" exec whatever end-exec . Else whatever [/quote] Does a period at the end of an EXEC (much less in the middle) terminate a COBOL statement? ---------------------------------------------------------------- Awesome feedback gentlemen. You mean adding EXEC to a compiler is hard? Not an overnighter? :-) [i](Not trying to be facetious, I knew this, but there is that whole realization thing to deal with).[/i] Good to go in properly armed I guess. Wouldn't want to be the guy that brings Nerf to a knife fight. Starts with a specification I guess. And Bill, it'll be even more fun when allowing for >>IF >>ELSE >>ELSE-IF >>END-IF. Along with human's suggestion of a configuration file driving the whole affair, could make for an algorithm. After thinking the whole thing through (for all of 12 seconds), would people mind if the first-cut of OC EXEC was inserted as a last step of the pre-processor pass? Quickly then, with that as a plan; [i]Can you place an EXEC statemen in a COPY file?[/i] [b]Yes.[/b] [i]Does replace process it?[/i] [b]Yes.[/b] Letting the preprocessor do it's thing, unaware of EXEC. [i]Can you have a COPY or REPLACE statemet in the middle of an EXEC statement?[/i] [b]Yes.[/b] Again, try and let it be as unaware as feasible. [i]Where does EXEC SQL INCLUDE (or any other INCLUDE) work with COPY statements?[/i] [b]Umm, so perhaps not so quickly then.[/b] ;-) Cheers, Brian ---------------------------------------------------------------- Subject: Community level developer collaboration site Hello, I'm in the midst of setting up some collaboration tools on an entry level hosted service. developers.peoplecards.ca So far, http://developers.peoplecards.ca/foswiki soon, developers.peoplecards.ca/fossil and maybe some other /somesuch This is an experimental subdomain, and may disappear at any time. I'm putting it up to try a few things. After a little soak time and seeing what the robots try and do, I may ask for some testers to see if community collaboration is a sane thing to try. For now, until I get head 'round, registrations will be disabled. This isn't planned as "upstream" OpenCOBOL development, but community level [b]/extras[/b] type stuff, or experimental sources and perhaps a package or two. Fossil for Software Configuration Management (and reposistory), Foswiki for super-nerd-level-spreadsheet-in-a-webpage wiki-e-ing. OpenCOBOL won't be the only target. Falcon will also play a role, testing out the Nest framework. This could be consolidatory or fragmentative. If it leans towards fragmenting, it'll be dumped post-haste. Cheers, Brian ---------------------------------------------------------------- Subject: COBDUMP example from OpenCOBOL Programmers Guide A quick observation on the COBDUMP utility program supplied in the excellent OC Programmers Guide. I copied and compiled this program using OpenCOBOL compiler. Unfortunately it crashed! Tweeked it and it now runs. Thought it worth comment only because it appears in the manual. Here's the details: Host system: [root@rio c]# uname -a Linux rio.bawtry 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:14 EST 2007 x86_64 x86_64 x86_64 GNU/Linux COBDUMP compilation header: <code> /* Generated by cobc 1.1.0 */ /* Generated from COBDUMP.CBL */ /* Generated at Mar 06 2012 15:21:16 GMT */ /* OpenCOBOL build date Feb 22 2012 15:29:27 */ /* OpenCOBOL package date Feb 06 2009 10:30:55 CET */ /* Compile command /bawtry/cobol/open-cobol/cobc/cobc -v -debug -m -l usercall -l disam -l cobio -std=mf -fixed -save-temps=/root/tmp -t COBDUMP.lst COBDUMP.CBL */ </code> Here's the "test client program": [code] 000010 identification division. 000020 program-id. test-cobdump. 000030 author. jr/bsc. 000040*----------------------------------------------------------------* 000050 environment division. 000060 configuration section. 000070 special-names. switch 1 is w-trace on is trace. 000080*----------------------------------------------------------------* 000090 data division. 000100 working-storage section. 000110 000120 1 1-text. 000130 2 filler pic x(36) value 000140 "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ". 000150 000160 1 2-text. 000170 2 filler pic x(36) value 000180 "0123456789abcdefghijklmnopqrstuvwxyz". 000190*----------------------------------------------------------------* 000200 procedure division. 000210 000220 a01-control section. 000230 a01-000. 000240 call "COBDUMP" using 1-text 36. 000250 call "COBDUMP" using 2-text. 000260 stop run. </code> Here's the exception: <code> COBDUMP.CBL:162: libcob: Subscript of 'Hex-Digit' out of bounds: -7 [/code] [i][b]DIAGNOSIS[/b][/i] The address value picked up by COBDUMP [i]Addr-Number[/i] is [b]negative[/b]. (Consequential to 64-bit AMD processor???). I edited (at start of para. 100-Generate-Address): [code] if (Addr-Number < 0) subtract Addr-Number from 0 giving Addr-Value else MOVE Addr-Number TO Addr-Value. [/code] COBDUMP now displays: [code] <-Addr-> Byte <---------------- Hexadecimal ----------------> <---- Char ----> ======== ==== =============================================== ================ 517E1A60 1 30 31 32 33 34 35 36 37 38 39 41 42 43 44 45 46 0123456789ABCDEF 517E1A50 17 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 GHIJKLMNOPQRSTUV 517E1A40 33 57 58 59 5A WXYZ <-Addr-> Byte <---------------- Hexadecimal ----------------> <---- Char ----> ======== ==== =============================================== ================ 517E1A30 1 30 31 32 33 34 35 36 37 38 39 61 62 63 64 65 66 0123456789abcdef 517E1A20 17 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 ghijklmnopqrstuv 517E1A10 33 77 78 79 7A wxyz [/code] Pretty isn't it? But note the descending addresses .... ---------------------------------------------------------------- Postscript: Back on another host system: [code] Linux lima.bawtry.local 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:21 EST 2007 i686 i686 i386 GNU/Linux [/code] It works fine "out-of-the-box": [code] <-Addr-> Byte <---------------- Hexadecimal ----------------> <---- Char ----> ======== ==== =============================================== ================ 00C61E00 1 30 31 32 33 34 35 36 37 38 39 41 42 43 44 45 46 0123456789ABCDEF 00C61E10 17 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 GHIJKLMNOPQRSTUV 00C61E20 33 57 58 59 5A WXYZ <-Addr-> Byte <---------------- Hexadecimal ----------------> <---- Char ----> ======== ==== =============================================== ================ 00C61E30 1 30 31 32 33 34 35 36 37 38 39 61 62 63 64 65 66 0123456789abcdef 00C61E40 17 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 ghijklmnopqrstuv 00C61E50 33 77 78 79 7A wxyz [/code] I guess it's a 64-bit architecture thing. [b]Note the ascending addresses ...[/b] ---------------------------------------------------------------- Just for getting things clear: Please try [url=http://opencobol.add1tocobol.com/#update-to-oc-cbl-dump]CBL_OC_DUMP[/url], too. human ---------------------------------------------------------------- You are absolutely right Joe; this is a bug in the sources, tripped by 32bit 64bit issues. Given: [code] OCOBOL >>SOURCE FORMAT IS FIXED *> *************************************************************** *> Tectonics: cobc -x -g -debug -W sizes.cob *> *************************************************************** identification division. program-id. sizes. environment division. configuration section. repository. function all intrinsic. data division. working-storage section. 01 addr-ptr usage pointer. 01 addr-num redefines addr-ptr usage binary-long. 01 addr-c-num redefines addr-ptr usage binary-c-long. *> *************************************************************** procedure division. display length(addr-ptr) space length(addr-num) space length(addr-c-num) end-display goback. end program sizes. [/code] gives: [code] [btiffin@home cobol]$ cobc -x -g -W sizes.cob [btiffin@home cobol]$ ./sizes 8 4 8 [/code] With the explanation that the POINTER is 8 bytes, BINARY-LONG is only 4, BINARY-C-LONG is 8 and can safely store the pointer as a numeric in the redefines. As far as I know, OpenCOBOL is off the hook for not warning about this, as REDEFINES is, pretty much by definition, allowed to do mismatched data type casting. So the change to fix COBDUMP should be a simple [code] 01 addr-num redefines addr-ptr usage BINARY-C-LONG. [/code] [i]I say should be, as I didn't read over, nor test the rest of Gary's code listing before posting, and there may be other places that need the BINARY-C-LONG.[/i] Roger added the new data type to deal with machine architecture cell size issues. BINARY-LONG is 32bit, BINARY-C-LONG is guaranteed to be a "C" long, [i]long long actually[/i], 32bit on 32bit, 64 on our new fangled x86_64 rocket machines. ;-) Helps a lot when faced with API bindings and arguments defined as C long long, and in this case, casting POINTERs as numerics. Cheers, Brian P.S. I find DUMP output formats to be a very personal preference kinda thing. But, try and get used to CBL_OC_DUMP as hinted at by human. It'll be a /extras come COBOL 2.0 and you won't have to modify any tectonics to use the CALL. It'll be in the default library path for cobc 2.0 executables. (Umm, unless you tell ./configure and make not to.) No need for [code] $ cobc -x prog.cob CBL_OC_DUMP.cob or $ cobc -x prog.cob CBL_OC_DUMP.o just $ cobc -x prog.cob [/code] And P.P.S. Anyone that wishes that their personal favourite development companion was easily at hand (and gets spread around the globe) ... we are still looking for /extras submissions. /extras is in the 2.0 alpha build and testing out fine. ---------------------------------------------------------------- Thanks Brian. Tried the change to BINARY-C-LONG but this reveals a bigger problem for COBDUMP: it effectively relies on no more tham 8 divisions by 16 to get any address to ZERO. On a 64-bit architecture it crashes: zero value subscript. It's been interesting looking at this but I think COBDUMP (in its present form) is stranded on a 32-bit island. ---------------------------------------------------------------- Subject: OpenCOBOL 1.1pre-rel on Mac OS, thru VirtualBox It works out pretty easy. Install VirtualBox Snag a pre-built Fedora-16 from Virtualboxes Un 7z it New it in as an existing disk Log in Resize to taste Open a terminal [code] $ sudo yum install db4 db4-devel ncurses-devel gmp.devel $ curl http://www.sim-basis.de/open-cobol-1.1.tar.gz >open-cobol-1.1.tar.gz $ tar xvf open-cobol-1.1.tar.gz $ cd open-cobol-1.1 $ ./configure $ make $ make check $ sudo make install $# now a little monkey game on Fedora $# sudo vi (create) /etc/ld.so.conf.d/opencobol.conf $# and place a single line in the conf file $# /usr/local/lib $ sudo ldconfig [/code] [b]yay.cob[/b] [code] program-id. yay. procedure division. display "Yayyyy! OpenCOBOL" end-display. [/code] Then [code] $ cobc -x -free -W -g -debug yay.cob $ ./yay Yayyyy! OpenCOBOL [/code] Good to go. Yayyy. On a Mac, in about an hour of downloads and builds and things. Cheers, Brian ---------------------------------------------------------------- Hi Brian, as an "easy to try" OC on a Mac this could be useful. Maybe you 7zip the machine again and upload it (with link in the Wiki)? But where is the problem to build a native version? I'd look at something like [url=http://acaro.wordpress.com/2008/01/11/using-configure-to-build-macos-universal-binaries/]this link found by google[/url] and would have fun. The only issue for me: I don't own a mac. Maybe you want the mac fun (or send me your mac ; - )? human ---------------------------------------------------------------- :-) Not my Mac. See http://www.youtube.com/watch?v=tOEKBC1JPz4 Funny. Old now, things changed, but Mac killed my inner child is pretty funny. BUT, this is a good idea I think human. For the moodle course I might offer up a dev setup in a VirtualBox. VBox is awesome. I'm in Fedora 16 on Windows at the moment, and feel at home again. I thought Cygwin was cool. VBox and real GNU/Linux, at interface speed difference that is near irrelevant, morer cooler-er. Umm, this sunk in pretty deep today. No need to ask anyone to give up home, but drag around a .vdi, and good to go. Paint me impressed. So yes, there will be a snapshot, maybe two. Fedora with groupinstall 'Development Tools' 'Development Libraries' 'Gnome Software Development' 'Web Server' with builds of OpenCOBOL, Vala, Falcon, Inform-7, Fossil, et al. Perhaps a Hercules and boot strapped OS/360 MVT install. For trying to run interactive courses, could be sweet. I don't think asking people to have VirtualBox is a bad or rude thing now a days, is it? Cheers, Brian ---------------------------------------------------------------- Subject: gambas_gui_to_open_cobol [i]from forum.peoplecards.ca[/i] user [b]splugenbrau[/b] Hello Folks, this to say there's another project from wich Gambas furnish GUI to Open Cobol, URL: http://code.google.com/p/txt-file-splitter-in-grid/downloads/list the other was URL: http://code.google.com/p/gambascobolgui/downloads/list So long. ---------------------------------------------------------------- Subject: a cobol article Interesting article... http://www.computerworld.com/s/article/9225079/Brain_drain_Where_Cobol_systems_go_from_here_ Federico ---------------------------------------------------------------- Subject: SET ENVIRONMENT TROUBLE ? Hi all. As usual I can read the environment variables that are already defined... by using the accept.... this time I cannot set one at runtime.. I wrote this (both method allowed to set one) that doesn't run with Windows and Opencobol [code] IDENTIFICATION DIVISION. PROGRAM-ID. var. DATA DIVISION. * WORKING-STORAGE SECTION. PROCEDURE DIVISION. * first method SET ENVIRONMENT "TEST" TO "BYE". * alternative more verbose method DISPLAY "TEST" UPON ENVIRONMENT-NAME DISPLAY "BYE" UPON ENVIRONMENT-VALUE. [/code] cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Sep 10 2010 10:12:33 Packaged Feb 06 2009 10:30:55 CET Is there a build trouble ? thanks Federico ---------------------------------------------------------------- The environment values are only set in the running COBOL process, not the shell that invoked it. [code] IDENTIFICATION DIVISION. PROGRAM-ID. var. DATA DIVISION. * WORKING-STORAGE SECTION. 77 val pic x(3). PROCEDURE DIVISION. * first method SET ENVIRONMENT "TEST" TO "BYE" ACCEPT val FROM ENVIRONMENT "TEST" END-ACCEPT DISPLAY val END-DISPLAY * alternative more verbose method DISPLAY "TEST" UPON ENVIRONMENT-NAME DISPLAY "YEP" UPON ENVIRONMENT-VALUE ACCEPT val FROM ENVIRONMENT "TEST" END-ACCEPT DISPLAY val END-DISPLAY. [/code] gives [code] [btiffin@home forum]$ cobc -x -g -debug var.cob [btiffin@home forum]$ ./var BYE YEP [btiffin@home forum]$ echo $TEST [btiffin@home forum]$ [/code] Hope that helps with the why. Not sure if it will ever do what you want though Federico. You can't really effect a parent's environment space without mucking about. Even something like CALL "SYSTEM" using "bash -c 'export TEST=YEP'" wouldn't work as help export [quote] Marks each NAME for automatic export to the environment of subsequently executed commands. [/quote] only effecting processes down the tree, never up. There are ways of course, mucking about with having the shell read environment space from data left behind by the child process, but that is non-intuitive, requires extra steps in the job chain and can be a fair to middling security risk. Cheers, Brian ---------------------------------------------------------------- Thanks for the (as usual) precious help. Federico ---------------------------------------------------------------- Subject: Off topic trivia I just heard that 1mm cubed of brain material has more electrical connections than there are stars in a galaxy. How many mm of brain do we have? It's like a Universe humming around in there. This hypothetical is aimed at humanity, not in particular this august forum, but Why are we so dense? ;-) Cheers, Brian ---------------------------------------------------------------- I suppose that our foreign readers may not appreciate this as much as the native English speakers, but anyway: Years ago a very good 1401 assembler guy used to tell me that my problem was my brain and that I was too tense -- my brain was 2/10 of a normal one. :-) ---------------------------------------------------------------- Nice one, though I think you may have your fraction reciprocally wrong for your case. ;) One I had growing up was "Could be tense, or it could be decimals". Cheers, Brian ---------------------------------------------------------------- Subject: Forum problems and path to solutions As everyone probably knows, opencobol.org has been shutdown for new registrations for quite a while now. This has to change, and as for the reasons, it is simply spambots. Overwhelming spambots. Placing the forum is 'request registration via email' just ended up flooding mail boxes of people that cannot afford the time to filter through all the crap. So... We are now on a quest to find a hosted forum solution. I should have been on this task earlier, but life doesn't offer up too many large segments of time now-a-days. I'm going to ask this august forum for opinions on a hosted forum provider that plays nice with open source and may be willing to offer a freebie to the OpenCOBOL community. My attempts at setting up a temporary forum for membership registrations failed for the same spambot reasons, I'm fighting off 40 a day and can't afford the time. This is with modern anti-spambot tools, and it seems spammers are more willing to put in more time than people that actually want to produce software and provide support. So, know of any providers? I'd rather the professionals spend time fighting bots so we all can get on with getting on. For example http://www.zoho.jp/discussions/open-source.html is a possibility and in line with what we may be looking for. I have an 'on my behalf' from Keisuke and I don't want to pester him anymore than absolutely necessary, so if we can find something, I have some power in getting things moved there before a possible DNS cutover. I'll apologize a little for this taking so long, but please bear with and know that things ARE moving. I will try and keep my promise to those that register at http://forum.peoplecards.ca, but man what a hassle. There are more delays than there should be. Cheers, Brian ---------------------------------------------------------------- Bumping. Take a look at http://sourceforge.net/projects/tiny-cobol/forums and see if you think source-forge forums could be used for open-cobol discussions. We can likely get one of the project owners, Bernard Giroud perhaps, to turn up the forum feature on the existent open-cobol project. http://sourceforge.net/projects/open-cobol/ All; the opencobol.org site move will effect everyone, so I'd really appreciate feedback on choices and preferences. [i]I'd like everyone to try and walk a mile in the shoes of the good people that aren't yet members, and can't get in to opencobol.org. It'll seem more time critical and a whole lotta frustrating from that perspective.[/i] Cheers, Brian ---------------------------------------------------------------- @brian The sourceforge environment could be good for sharing message using the forum feature. Also could be appreciable also get from the sourceforge them the latest version of the code (1.1) and (why not?) the build for windows for example the nice build that Gary Cutler uploaded at opencobol wiki assorted documents. compiling opencobol on a unix environment is almost simple..not doing the same on window. @all The tiny cobol has been stopped to be updated. The opencobol seems to be (still) the latest available.. So please give your contribute for improving the project. Federico ---------------------------------------------------------------- Subject: Processing an attribute list Any thoughts on how to process this type of input (other than 4 or 5 lines of code for each field)? There are about 80 lines in the file, to update a single master record. [code] EMPLNO=ABS010 FNAME=Sophia INIT=B LNAME=Smith ADDR1=299 Jane Street CITY=Toronto POSTCD=M9W 1R4 COUNTRY=Canada AREA=416 EXCH=555 NUMB=1212 ISIN=555555555 DOBMM=02 DOBDD=25 DOBYY=1976 DIRDEP=C STARTDT=20020526 TERMDT=00000000 EMPLPROV=ON VCTNRATE1= 4 VCTNRATE2=00 [/code] ---------------------------------------------------------------- Maybe I am missing something, but I would process this the same way that I would a "traditional COBOL input file" with Fields of EMPLNO, FNAME, INIT, etc The only difference beging that I would use an EVALUATE of the beginning characters of the "record" to determine which field I am processing vs using its location within a record. Of course, in a "traditional" record (or database) layout, you get everything at once, while with this type of input, you need to process a "bunch" of individual inputs to get a "full record", but other than that, this is pretty traditional. ---------------------------------------------------------------- I'd do the same as wmklein suggested. Here's my version: [code]INITIALIZE allfields OPEN file PERFORM UNTIL 0=1 READ record AT END EXIT PERFORM END-READ UNSTRING record DELIMITED BY '=' INTO fieldname, fieldvalue END-UNSTRING EVALUATE fieldname WHEN 'EMPLNO' PERFORM check-emplno ... WHEN OTHER PERFORM error-handling END-EVALUATE END-PERFORM PERFORM CHECK-NEEDED-FIELDS CLOSE file [/code] The main reason: In most cases it's a very good idea to check the values from input files (numeric/spaces/unique/reaonable/...) before doing anything with them. Another option (only available if you are 100% sure the data is valid and if all lines exist in every file) would be to declare the file as sequential (not line sequential) and do a [code]READ record UNSTRING record DELIMITED BY '=' OR linefeed INTO dummy1, f-emplno, dummy2, f-fname, dummy3, f-init, [...] END-UNSTRING[/code] But I think the "traditional" way is better - don't trust external files... human ---------------------------------------------------------------- Thanks, I never knew about "string" and "unstring"; I wrote a paragraph to decode a line into field-name and field-data. I ended up writing a ksh script to read a list of the fields and produce the cobol code. ---------------------------------------------------------------- Sounds reasonable. It could help others to see such a script, especially for getting ideas about own generators. Can you post it here? human ---------------------------------------------------------------- Using the original input file (from post 1). [code] !#/usr/bin/ksh #the variable IFS is used by read to identify the field separator character IFS="=" while read FIELD_NAME FIELD_DATA do echo " IF FIELD-NAME EQUAL \"$FIELD_NAME\" echo " MOVE FIELD-DATA TO EMPL-"$FIELD_NAME\. done [/code] I have done more complex ones, but this saved me typing 160 lines of code. ---------------------------------------------------------------- [i]from [b]valdis[/b] on forum.peoplecards.ca[/i] OpenCobol.org has a thread named "Processing an attribute list" that I can not find on peoplecards.ca. I hope this can be cross-posted to OpenCobol.org under that thread. jgt gave a ksh shell script to generate Cobol code. Here is a similar bash script: [code] !#/usr/bin/bash #the variable IFS is used by read to identify the field separator character IFS="=" while read FIELD_NAME FIELD_DATA do echo " IF FIELD-NAME EQUAL \"$FIELD_NAME\"" echo " MOVE FIELD-DATA TO EMPL-$FIELD_NAME" echo " END-IF" done [/code] Here is a Cobol program that does the same thing. Writing a filter in Cobol is not hard and it very useful for code generation like this. (sorry! leading blanks removed by blog software) [i]Note from [b]btiffin[/b]: valdis, I took the liberty of adding BBCODE code blocks, so your code listings should display ok, with leading spaces[/i]. [code] IDENTIFICATION DIVISION. PROGRAM-ID. SPLIT-ATTRIBUTE-LIST. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT ATTRIBUTE-LIST-FILE ASSIGN TO 'attribute_list' ORGANIZATION IS LINE SEQUENTIAL. SELECT COBOL-CODE-FILE ASSIGN TO 'ATTRIBUTE-LIST-CODE.COB' ORGANIZATION IS LINE SEQUENTIAL. DATA DIVISION. FILE SECTION. FD ATTRIBUTE-LIST-FILE. 01 ATTRIBUTE-LIST-RECORD PIC X(50). FD COBOL-CODE-FILE. 01 COBOL-CODE-RECORD PIC X(72). WORKING-STORAGE SECTION. 01 HAS-MORE-RECORDS PIC XXX VALUE 'YES'. 88 NO-MORE-RECORDS VALUE 'NO '. 01 FIELD-NAME PIC X(50). 01 FIELD-VALUE PIC X(50). 01 OUT-LINE-1-PREFIX PIC X(33) VALUE ' IF FIELD-NAME EQUALS "'. 01 OUT-LINE-2-PREFIX PIC X(39) VALUE ' MOVE FIELD-DATA TO EMPL-'. 01 OUT-LINE-3 PIC X(17) VALUE ' END-IF'. PROCEDURE DIVISION. MAIN. OPEN INPUT ATTRIBUTE-LIST-FILE OUTPUT COBOL-CODE-FILE PERFORM UNTIL NO-MORE-RECORDS READ ATTRIBUTE-LIST-FILE AT END SET NO-MORE-RECORDS TO TRUE NOT AT END UNSTRING ATTRIBUTE-LIST-RECORD DELIMITED BY '=' INTO FIELD-NAME FIELD-VALUE END-UNSTRING MOVE SPACES TO COBOL-CODE-RECORD STRING OUT-LINE-1-PREFIX FUNCTION TRIM(FIELD-NAME) '"' INTO COBOL-CODE-RECORD WRITE COBOL-CODE-RECORD MOVE SPACES TO COBOL-CODE-RECORD STRING OUT-LINE-2-PREFIX FUNCTION TRIM(FIELD-NAME) INTO COBOL-CODE-RECORD WRITE COBOL-CODE-RECORD MOVE SPACES TO COBOL-CODE-RECORD WRITE COBOL-CODE-RECORD FROM OUT-LINE-3 END-PERFORM CLOSE ATTRIBUTE-LIST-FILE COBOL-CODE-FILE STOP RUN . [/code] ---------------------------------------------------------------- I remember once when I was working at a service bureau long ago, that they got an ASCII print tape, where the records were blocked. This was an IBM mainframe shop, where everything is in EBCDIC, so they couldn't print it. They gave it to me. I wrote a Cobol program. I used an Unstring command delimited by the ASCII carriage return and page advance, and put the overflow back into the block field. Printed the line, throwing in a page advance whenever the saved delimiter was a page advance. I performed this paragraph until the block field went empty. Looped to read another block and did it again. Worked perfectly, for all of about 15 or 20 lines of code in the main loop. I was a hero for a day. GAWD, I love Cobol. ---------------------------------------------------------------- Subject: Compiling ocgtk.c and gtkhello.cob in MinGW [i]cross posted from forum.peoplecards.ca on behalf of mfisher_ix[/i] For kicks I wanted to try running Brian’s OpenCOBOL GTK+ demo, which consists of ocgtk.c and gtkhello.cob: http://opencobol.add1tocobol.com/sources/ocgtk.c http://opencobol.add1tocobol.com/sources/gtkhello.cob A few errors can occur when compiling. For reference I wanted to list them all here, along with how to resolve them. But first of all I should describe my MinGW, OpenCOBOL, and GTK+ installations. My OpenCOBOL 1.1. installation was built from source code in 64-bit Windows 7, using MinGW. My MinGW/MSYS installation was installed using the MinGW command line interface installer, version mingw-get-0.4-mingw32-alpha-1. Post-installation setup was done using /post-install/pi.sh. In building OpenCOBOL 1.1, I generally followed Gary Cutler’s “Build Guide”, except that I used the latest available versions of PDCurses and GMP, and replaced Berkeley DB with VBISAM 2.0. My GTK+ installation consisted of extracting the latest all-in-one bundle for 32-bit Windows to /mingw/opt/gtk (i.e., C:\MinGW\msys\opt\gtk). I also created a file named .profile in my MSYS home directory, containing the following line: [code]export PATH=$PATH:/opt/gtk/bin[/code] Ordinarily your .profile file will get "sourced" into a new MSYS session, and will set your environment accordingly. To source it into your current MSYS session, use the shell's dot command: [code]$ . .profile[/code] A simple-minded attempt at compiling ocgtk.c to an object module yields the expected error regarding gtk/gtk.h: [code]$ gcc -c ocgtk.c ocgtk.c:8:21: fatal error: gtk/gtk.h: No such file or directory compilation terminated.[/code] A more sophisticated attempt yields errors regarding cob_module: [code]$ gcc -c `pkg-config --cflags --libs gtk+-2.0` ocgtk.c ocgtk.c: In function ‘CBL_OC_GTK_WINDOW_SET_TITLE’: ocgtk.c:30:5: error: unknown type name ‘cob_module’ ocgtk.c:34:12: warning: assignment from incompatible pointer type [enabled by default] ocgtk.c:35:25: error: request for member ‘cob_procedure_parameters’ in something not a structure or union ocgtk.c: In function ‘CBL_OC_GTK_ENTRY_GET_TEXT’: ocgtk.c:107:5: error: unknown type name ‘cob_module’ ocgtk.c:111:12: warning: assignment from incompatible pointer type [enabled by default] ocgtk.c:112:24: error: request for member ‘cob_procedure_parameters’ in something not a structure or union[/code] Edit ocgtk.c, and replace both occurrences of: [code]cob_module *module;[/code] with: [code]struct cob_module *module;[/code] Try compiling ocgtk.c again: [code]$ gcc -c `pkg-config --cflags --libs gtk+-2.0` ocgtk.c[/code] This succeeds, and causes ocgtk.o to be generated. Now try compiling gtkhello.cob and linking it with ocgtk.o: [code]$ cobc -x gtkhello.cob ocgtk.o ocgtk.o:ocgtk.c:(.text+0x2e): undefined reference to `gtk_init_check_abi_check’ ocgtk.o:ocgtk.c:(.text+0×57): undefined reference to `gtk_window_new’ ocgtk.o:ocgtk.c:(.text+0xb1): undefined reference to `gtk_window_get_type’ ocgtk.o:ocgtk.c:(.text+0xc0): undefined reference to `g_type_check_instance_cast’ ocgtk.o:ocgtk.c:(.text+0xcf): undefined reference to `gtk_window_set_title’ ocgtk.o:ocgtk.c:(.text+0xed): undefined reference to `gtk_widget_get_type’ ocgtk.o:ocgtk.c:(.text+0xfc): undefined reference to `g_type_check_instance_cast’ ocgtk.o:ocgtk.c:(.text+0×112): undefined reference to `gtk_widget_set_size_request’ ocgtk.o:ocgtk.c:(.text+0×123): undefined reference to `gtk_container_get_type’ ocgtk.o:ocgtk.c:(.text+0×132): undefined reference to `g_type_check_instance_cast’ ocgtk.o:ocgtk.c:(.text+0x13e): undefined reference to `gtk_container_set_border_width’ ocgtk.o:ocgtk.c:(.text+0x15c): undefined reference to `gtk_vbox_new’ ocgtk.o:ocgtk.c:(.text+0×176): undefined reference to `gtk_hbox_new’ ocgtk.o:ocgtk.c:(.text+0×187): undefined reference to `gtk_box_get_type’ ocgtk.o:ocgtk.c:(.text+0×196): undefined reference to `g_type_check_instance_cast’ ocgtk.o:ocgtk.c:(.text+0x1b7): undefined reference to `gtk_box_pack_start’ ocgtk.o:ocgtk.c:(.text+0x1ce): undefined reference to `gtk_button_new_with_label’ ocgtk.o:ocgtk.c:(.text+0x1db): undefined reference to `gtk_entry_new’ ocgtk.o:ocgtk.c:(.text+0x1e8): undefined reference to `gtk_entry_get_type’ ocgtk.o:ocgtk.c:(.text+0x1f7): undefined reference to `g_type_check_instance_cast’ ocgtk.o:ocgtk.c:(.text+0×206): undefined reference to `gtk_entry_set_text’ ocgtk.o:ocgtk.c:(.text+0x22a): undefined reference to `gtk_entry_get_type’ ocgtk.o:ocgtk.c:(.text+0×239): undefined reference to `g_type_check_instance_cast’ ocgtk.o:ocgtk.c:(.text+0×241): undefined reference to `gtk_entry_get_text’ ocgtk.o:ocgtk.c:(.text+0x2d2): undefined reference to `g_type_check_instance_cast’ ocgtk.o:ocgtk.c:(.text+0x2fc): undefined reference to `g_signal_connect_data’ ocgtk.o:ocgtk.c:(.text+0x30d): undefined reference to `gtk_container_get_type’ ocgtk.o:ocgtk.c:(.text+0x31c): undefined reference to `g_type_check_instance_cast’ ocgtk.o:ocgtk.c:(.text+0x32b): undefined reference to `gtk_container_add’ ocgtk.o:ocgtk.c:(.text+0x33e): undefined reference to `gtk_widget_show’ ocgtk.o:ocgtk.c:(.text+0x34b): undefined reference to `gtk_main’ ocgtk.o:ocgtk.c:(.text+0×358): undefined reference to `gtk_main_quit’ collect2: ld returned 1 exit status[/code] Try again, using pkg-config: [code]$ cobc `pkg-config --cflags --libs gtk+-2.0` -x gtkhello.cob ocgtk.o C:\MinGW\bin\cobc.exe: unrecognised option `-mms-bitfields’[/code] Have a look at what `pkg-config –cflags –libs gtk+-2.0` has been generating: [code]$ pkg-config --cflags --libs gtk+-2.0 -mms-bitfields -IC:/MinGW/msys/1.0/opt/gtk/include/gtk-2.0 -IC:/MinGW/msys/1.0/opt/gtk/lib/gtk-2.0/include -IC:/MinGW/msys/1.0/opt/gtk/include/atk-1.0 -IC:/MinGW/msys/1.0/opt/gtk/include/cairo -IC:/MinGW/msys/1.0/opt/gtk/include/gdk-pixbuf-2.0 -IC:/MinGW/msys/1.0/opt/gtk/include/pango-1.0 -IC:/MinGW/msys/1.0/opt/gtk/include/glib-2.0 -IC:/MinGW/msys/1.0/opt/gtk/lib/glib-2.0/include -IC:/MinGW/msys/1.0/opt/gtk/include -IC:/MinGW/msys/1.0/opt/gtk/include/freetype2 -IC:/MinGW/msys/1.0/opt/gtk/include/libpng14 -LC:/MinGW/msys/1.0/opt/gtk/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl[/code] How to eliminate the unrecognized cobc option? Let’s direct the output from pkg-config to a file: [code]$ echo `pkg-config --cflags --libs gtk+-2.0` > gtk-conf[/code] Edit gtk-conf, and delete “-mms-bitfields”. Try again as follows: [code]$ cobc `cat gtk-conf` -x gtkhello.cob ocgtk.o[/code] This succeeds, and generates gtkhello.exe. Run it: [code]$ gtkhello.exe[/code] You should see Brian’s OpenCOBOL GTK+ demo. (Thanks for the cool code, Brian.) ---------------------------------------------------------------- [i]another cross post on behalf of mfisher_ix from forum.peoplecards.ca[/i] Instead of adding this line to your .profile: [code]export PATH=$PATH:/opt/gtk/bin[/code] ... it's better to add this to your Windows PATH environment variable (which can be either the user or system PATH environment variable as appropriate): [code]C:\MinGW\msys\1.0\opt\gtk\bin[/code] This will allow your GTK+ applications to be launched without errors like any other Windows app (e.g., by double-clicking them in Windows Explorer). ---------------------------------------------------------------- Subject: Weirdness in COBOL Hello, I've had an idea for a while, robot eyes in a digital clock widget at 10:01. For effect it starts out as a simple cartoon graphic and a cheery, "it's ten oh one". Later weeks, the 10:01 triggers a "master, it is now ten oh one", and a less cartoony set of eyes that traverse the screen over the minute. Later weeks, the 10:01 triggers a "human, the time has come", and some, umm, weird not nerdy looking eyes. And a reset to play the month again. And this digital widget should be written in COBOL. No? Anybody? Cheers, Brian [i]ps; human, did I mean you or us?[/i] ;-) ---------------------------------------------------------------- [i]from mfisher_ix on forum.peoplecards.ca[/i] Brian, you live in Ontario, so I have to ask: Does the following video explain the COBOL weirdness that's come over you today? http://www.nfb.ca/film/blackfly/ Counselors are standing by at the Maine Black Fly Insanity Center to take your call. For March Madness calls from Ottawa, please dial 1-800-ONTARIO. As for a cure, I guess you'll have to port something like the gEyes GNOME panel applet to COBOL: http://bazaar.launchpad.net/~vcs-imports/gnome-applets/master/files/head:/geyes/ ---------------------------------------------------------------- Well, the city isn't bad for flies, but... Just read about [i]micromorts[/i], the odds at 1 in a million of dying on the spot. Turns out to be pretty rare for COBOL programmers. Desk work is very low micromorts. For scale, 1 micromort over 1 year is roughly equivalent to the odds of being killed by a space rock; possibly big one mind, the kind that if does hit, takes out a LOT of people. I was a commercial fisherman growing up, and it turns out to be in the 1600 micromort range. Woohoo, lived! :-) I think I'll try and stick with robot eyes coding. Cheers, Brian ---------------------------------------------------------------- Subject: Easter rabbit. Hi, Santa Claus brought nothing. Easter Rabbit has empty hands. Shall we conclude that 1.1 is not the latest but the last version? Marcellom ---------------------------------------------------------------- Marcello, What is it that you need OpenCOBOL to do that it does not do now? Is your concern about longevity? Are there features that you need to make your programming less time consuming? jimc ---------------------------------------------------------------- I'm satisfied that OpenCobol 1.1 handles all of ANSI Cobol-85 very well. I've run extensive tests. Then I did a file compare of over 100,000 output lines with previous tests run in MF and AcuCobol. I was surprised that they were all identical except for the few tests that had a date and time stamp within the data. Thanks for that. I'm impressed. I don't know about Marcello, but for me I can't use 1.1 because there is a defect in the Accept statement using absolute cursor positioning (Accept ws-txt line x position y). For one, it prompts with spaces when no prompting is specified. It erases my screen when it should not. If I just press return, it should accept whatever was displayed there with the previous Display statement. For another, the function keys F1 through F5 work ok, but the rest go haywire. I can't use OC until these issues are fixed. Sure, I could fix them myself. But then I'd be working on a fork of 1.1. When 2.0 comes out, all of my work would be wasted. Please release 2.0. If I have to fix it, I want to work on something that will not fork out of existence. ---------------------------------------------------------------- @Mrcool Yes, We never did use the SCREEN SECTION or fancy ACCEPTS and DISPLAYS (COBOL68 did not support them). We did write a routine that simulates an HP2645 terminal (block mode). Did accepts one character at a time with the help of a very small c program. I doubt that it would help but you are welcome to it. jimc ---------------------------------------------------------------- Hi Jim. Please see "Santa Claus". 1) split-keys missing. A work-around is proposed but not really working. [code] select partia assign to dirpartia organization is indexed file status is pra-tus access is dynamic lock mode is manual record key is pra-key alternate record key is pra-descr1 with duplicates alternate record key is pra-barcode with duplicates alternate record key is pra-catdes = pra-catalogo pra-descr1 with duplicates alternate record key is pra-classdes = pra-classe pra-descr1 with duplicates alternate record key is pra-catclass = pra-catalogo pra-classe pra-descr1 with duplicates alternate record key is pra-gmcmkey = pra-gruppo pra-classe pra-codarti pra-varian. [/code] [code] fd partia. 01 pra-rec. 02 pra-key pic x(30). 02 pra-key1 redefines pra-key. 03 pra-codarti pic x(09). 03 pra-varian pic x(21). 02 pra-key2 redefines pra-key. 03 pra-catalogo pic x(05). 03 pra-codint pic x(25). 02 pra-descrx. 03 pra-descr1 pic x(36). 03 pra-descr2 pic x(36). 02 pra-descri redefines pra-descrx pic x(72). 02 pra-unitrat. 03 pra-unimis pic x(02). 03 pra-unisec pic x(02). 03 pra-coetrasf pic 9(03)v9(03). 03 pra-uniconf pic 9(04). 03 pra-desconf pic x(30). 02 pra-barcode pic x(20). 02 pra-plux. 03 pra-numplu pic x(05). 03 pra-desplu pic x(30). 02 pra-mps pic x(01). 02 pra-grmerce. 03 pra-gruppo pic x(05). 03 pra-classe pic x(05). 02 pra-przuffi pic 9(07)v9(04). 02 pra-consorzio pic 9(05)v9(04). 02 pra-vend. 03 pra-vndtabe occurs 3. 04 pra-przvprezzo pic 9(07)v9(04). 04 pra-przvarrot pic 9(01). 04 pra-przvivasn pic x(01). 04 pra-przvsctabe pic 9(02). 04 pra-przvsccalc pic 9(03)v9(02). 04 pra-przvscdaapp pic 9(01). 04 pra-przvrictabe pic 9(02). 04 pra-przvriccalc pic s9(03)v9(02). 04 pra-przvrcdaapp pic 9(01). 04 pra-przvprovvig pic 9(02). 04 pra-przvdatini pic 9(08). 04 pra-przvdatfin pic 9(08). 04 pra-przvsctid occurs 3 pic 9(03)v9(02). 03 pra-przvf occurs 3 pic 9(01). 03 pra-offvtabe occurs 3. 04 pra-offvprezzo pic 9(07)v9(04). 04 pra-offvarrot pic 9(01). 04 pra-offvivasn pic x(01). 04 pra-offvsctabe pic 9(02). 04 pra-offvsccalc pic 9(03)v9(02). 04 pra-offvscdaapp pic 9(01). 04 pra-offvrictabe pic 9(02). 04 pra-offvriccalc pic s9(03)v9(02). 04 pra-offvrcdaapp pic 9(01). 04 pra-offvqtamin pic 9(02). 04 pra-offvdatini pic 9(08). 04 pra-offvdatfin pic 9(08). 03 pra-offvf occurs 3 pic 9(01). 02 pra-acq. 03 pra-forpri pic 9(06). 03 pra-cdartforpri pic x(30). 03 pra-forsec pic 9(06). 03 pra-cdartforsec pic x(30). 03 pra-acqtabe. 04 pra-przaprezzo pic 9(07)v9(04). 04 pra-przaarrot pic 9(01). 04 pra-przaivasn pic x(01). 04 pra-przasctabe pic 9(02). 04 pra-przasccalc pic 9(03)v9(02). 04 pra-przascdaapp pic 9(01). 04 pra-przadatini pic 9(08). 04 pra-przadatfin pic 9(08). 03 pra-przaf pic 9(01). 03 pra-offatabe. 04 pra-offaprezzo pic 9(07)v9(04). 04 pra-offaarrot pic 9(01). 04 pra-offaivasn pic x(01). 04 pra-offasctabe pic 9(02). 04 pra-offasccalc pic 9(03)v9(02). 04 pra-offascdaapp pic 9(01). 04 pra-offadatini pic 9(08). 04 pra-offadatfin pic 9(08). 03 pra-offaf pic 9(01). 02 pra-misure. 03 pra-dime. 04 pra-alt pic 9(06)v9(02). 04 pra-lar pic 9(06)v9(02). 04 pra-prf pic 9(06)v9(02). 03 pra-peso. 04 pra-pnetto pic 9(07)v9(03). 04 pra-plordo pic 9(07)v9(03). 02 pra-imb. 03 pra-iprovenienza pic x(18). 03 pra-inatura pic x(15). 03 pra-iqualita pic x(15). 03 pra-icolore pic x(06). 03 pra-iannata pic 9(04). 02 pra-dst. 03 pra-dspirito pic x(01). 03 pra-dnatura pic x(25). 03 pra-dcatacce pic x(03). 03 pra-dcontrass pic x(02). * in cblmric contiene sottogruppo numero protocollo 03 pra-utfcodprod pic x(18). 03 pra-utfcapitolo pic x(05). 02 pra-grado pic 9(03)v9(02). 02 pra-mgspctabe. 03 pra-magspec occurs 3 pic x(02). 02 pra-contab. 03 pra-cntcst pic 9(07). 03 pra-cntric pic 9(07). 03 pra-codiva pic 9(02). 03 pra-contriva pic x(03). 02 pra-surrogatabe. 03 pra-surrogato occurs 3 pic x(30). * pra-surrogato (01) contiene CPA utf * pra-surrogato (02) contiene disciplinare 02 pra-datingre pic 9(08). 02 pra-datcess pic 9(08). 02 pra-statotabe. 04 pra-stato pic x(01). 04 pra-stdatini pic 9(08). 04 pra-stdatfin pic 9(08). 02 pra-sinomag pic x(01). [/code] [code] move spaces to dirpartia string mf-fmd delimited spaces "/" delimited size mf-azienda delimited spaces "/" delimited size "partia" delimited size into dirpartia end-string. [/code] As you can see, you cannot avoid using real split-keys. You cannot even use mysql as OC 1.1 does not allow handling so many fields. 2) MF support is asserted to work but, as an esample, "invalid key" still gives compiling error. 3) We were promised a full current ANSI support (see NIST matter). 4) Nested copy does not work. 5) Someone spoke as Roger's voice ( some months ago) and said work was in progress. No further new! From time to time someone comes and asks if OC is totally working in real environment and someone answers with usual Nagasaki prefecture. They probably try converting a few programs and then disappear. I spent months with OC but I still have not what I need, no matter what I try. OC 1.1 does a lot, but a "quid" is still missing and that quid is critical. Cheers, Marcellom ---------------------------------------------------------------- [quote]As you can see, you cannot avoid using real split-keys. [/quote] Why not just duplicate the split key fields at the end of the record in the correct order so that it is no longer split. ---------------------------------------------------------------- [quote] jgt wrote: [...] Why not just duplicate the split key fields at the end of the record in the correct order so that it is no longer split.[/quote] That's the way all OC users I know of that work with ISAM solved this issue. OK, it's definitely not a solve but a workaround. Real split keys would be nice (and I thought someone was working on a patch for OC 1.1 to implement them), but as it is working that way... human ---------------------------------------------------------------- Hi, just because the same field is present in more than one duplicated key and cobol does not allow duplicated field-names inside a record. I know someone is working on it (the news is several months old) but so far ..... And so is for all other topics I high-lighted, but, so far 1.1 is still pre-release and it has been so for years. Marcellom ---------------------------------------------------------------- I also think that (actual) solution could be code the split key adding them at the end of the record and managing them using the reference group name. [code] ..... added "split" key... 02 pra-catdes. 03 pra-catalogo pic x(05). 03 pra-descr1 pic x(36). move all "x" to pra-descr1 of pra-descrx move pra-descr1 of pra-descrx to pra-descr1 of pra-catdes [/code] And compiling way a pre-processor to add the changed cobol into the cobol.. looking at move and write and rewrite statements with inline code. These changes could be made also using a macro with strong editor.. But I think you could solve this..of course as human told not a really solution.. but more a workaround.. Federico ---------------------------------------------------------------- @marcellom I understand and respect your position. Some things need to be clarified however. "You cannot even use mysql as OC 1.1 does not allow handling so many fields." [code] Actually MySQL is quite usable with OpenCOBOL 1.1. There is a problem (see http://www.opencobol.org/modules/newbb/viewtopic.php?viewmode=thread&topic_id=1406&forum=1&post_id=7198#7198) with extremely large calls that we have encountered in one program. The problem occurs because we want to get the whole row (record) in a single FETCH and the row has a lot of columns (fields). Most SQL programs only request the individual fields (columns) that they want for the particular I/O operation and do not process all of the columns in a row (record). We were able to get the data we needed by breaking our rules and asking for only the columns (fields) that we needed. This is a minor inconvenience. We are not using any form of ISAM with OpenCOBOL. We do all of of our file processing with MySQL, random, and sequential files. [/code] "From time to time someone comes and asks if OC is totally working in real environment and someone answers with usual Nagasaki prefecture. They probably try converting a few programs and then disappear." [code] We are developing new applications and modifying old ones every day with OpenCOBOL 1.1. As of today (April 4, 2012) we have over 300 new programs (with over 300,000 lines of code) running in production environments. As far as disappearing goes, I cannot promise what will happen in the future but we are in our 38th year and hope to stay viable in order to support our customers. :-) [/code] I wrote my first Cobol program in 1969. I have never had a compiler that implemented everything that I wanted. OpenCOBOL is no exception. ---------------------------------------------------------------- @Jim About mysql. [code] If you fetch selected columns, how do you handle row-locking (you don't know which column will be changed) in multi-user environment? [/code] About compilers. [code] We must deal with over 4000 programs (million lines of code) and have gone through Honeywell dps4 dps6, ibm s36 s38, etc. It is not a matter of what I want (eventually what I need) but what OC can offer to unsatisfied people coming from other chaining proprietary compilers. [/code] I image Roger's team have what they need. [code] So far, I thought our goal was to have OUR compiler available to anyone, doing what is necessary for everyone (we don't want to give the moon) and getting better and better as new technologies offers new enhancements. [/code] Marcellom ---------------------------------------------------------------- @marcellom As you know locking can be complex. Please see: http://dev.mysql.com/doc/refman/5.0/en/internal-locking.html For our part we frequently issue manual locks and unlocks: http://dev.mysql.com/doc/refman/5.0/en/lock-tables.html I do understand your position about the OpenCOBOL compiler. Your environment requires certain features or the money and time to program around them. I do not know why the OpenCOBOL development process seems to be closed to the public, but for my part I consider myself fortunate that the compiler does what we need as it stands. jimc ---------------------------------------------------------------- Hi, As member of OC forum, I received the following email [code] Dear OpenCOBOL experts, I am working for OSS Consortium, one of the opensource promotion organizations in Japan. We have been working on some enhancement based on OC1.1, including the localization (MBCS support for Usage NATIONAL, etc.) and several minor fixes. Currently we plan to release the enhanced version in the late of this spring. We would like to share the ideas and updates on this mailing list, if it would be appropriate for you. Our version is mainly aimed to fit the needs of Japanese industries, though some of the ideas or codes might be useful in other countries. So we are considering it could be better to fork from the official OC1.1 tree in the future. [/code] This means that people is relaying on OC and working for it's improvement. It seems that only Roger's team is sleeping (or, if not, don't show they are awake). Marcellom ---------------------------------------------------------------- I found that there is an MF extension to the Accept statement that solves the prompting with spaces problem in OC. The extension is the 'with update' phrase. Now it works perfectly. I was using the old Ryan-McFarland format from way back, that didn't have a with update phrase. The only problem remaining with the Accept statement is the function keys F6 through F12, up and down arrows, and some others don't work. ---------------------------------------------------------------- @mrcool When we want to trap ACCEPT at the character level we use a small c program. The c program: [code] #include <stdio.h> // for getchar() #include <stdlib.h> // for system() /******************************************************************************* * acceptchar() * * Gets the next character input from stdin and places it in passed variable. * * * * Parameters * * char * cpReturn - A pointer to the variable to place the next inputted key.* * Regardless of definition of the passed variable, the key value is placed * * in the left most position. * * * * Returns * * int - 0 for success, else failure. * *******************************************************************************/ int acceptchar( char * cpReturn ) { char cInput; system( "stty raw" ); // Set stdin to unbuffered mode // Get next character from standard input cInput = getchar(); system( "stty -raw" ); // Set stdin back to buffered mode // Assign inputted character to return variable cpReturn[ 0 ] = cInput; return 0; } // main() [/code] Which we then compile with: [code] gcc -c -Wall acceptchar.c -o acceptchar.o [/code] A sample Cobol program might look like this: [code] IDENTIFICATION DIVISION. PROGRAM-ID. KEYVAL. ************************************************************ * GET A CHARACTER * * * * VERSION 001--ORIGINAL VERSION * * APRIL 2009--J C CURREY * * * ************************************************************ DATA DIVISION. WORKING-STORAGE SECTION. **************************************************** * CONSTANTS, COUNTERS AND WORK AREAS * **************************************************** 01 WS-NAME-PROGRAM PIC X(12) VALUE "KEYVAL 001". 01 WS-HOLD. 05 WS-FILLER PIC X. 05 WS-READ-AREA PIC X. 01 WS-NUM-VALUE REDEFINES WS-HOLD PIC S9(4) COMP. **************************************************************** * PROCEDURE DIVISION * **************************************************************** PROCEDURE DIVISION. MOVE X"00" TO WS-FILLER. DISPLAY "I) THIS PROGRAM WILL GIVE YOU THE DECIMAL VALUE". DISPLAY " OF A CHARACTER THAT YOU INPUT". DISPLAY "I) KEY SPACE TO TERMINATE". 0100-LOOP. DISPLAY "A) ENTER CHARACTER " WITH NO ADVANCING CALL "acceptchar" USING WS-READ-AREA. DISPLAY " DECIMAL VALUE=", WS-NUM-VALUE. IF WS-READ-AREA IS EQUAL TO " " STOP RUN. GO TO 0100-LOOP. [/code] Which we compile as follows: [code] cobc -x KEYVAL.CBL acceptchar.o [/code] jimc ---------------------------------------------------------------- The function keys, arrows, etc. work with a patch in screenio.c (I've submitted it somewhere here, just don't know where - maybe a forum search for screenio will help). human ---------------------------------------------------------------- The acceptchar.c is a nice piece of work. I made a copy in case I need to use it. It might come in handy. Thanks. I did a search for screenio.c in the forum and didn't find it. I'll look in my libcob and see what's what. Maybe I can just fix it myself. If it only takes an hour or so I'll do it. Then, if I need to add page-up, page-down, or buttons on the numeric keypad, I'll know where. I could really fancy it up with shift-F-keys, ctrl-F-keys, and alt-F-keys. What do you know? This might turn out even better. Hog heaven in Cobol land. ---------------------------------------------------------------- I think the stuff is currently most/all in... A "patch-package" I've made Aug/Sept 2009 can be found at http://www.kiska.net/opencobol/human/ [maybe untested with ./configure] The screenio patch I've wrote for the keys consist mainly of an own new function [code]static void cob_convert_key (int *keyp, const unsigned int field_accept) { /* Map key to KEY_xxx value */ switch (*keyp) { case '\n': case '\r': case '\004': case '\032': *keyp = KEY_ENTER; break; case '\t': *keyp = KEY_STAB; break; case '\b': case 0177: *keyp = KEY_BACKSPACE; break; #ifdef KEY_A1 /* A1, A3, C1, C3 must be present */ case KEY_A1: *keyp = KEY_HOME; break; case KEY_A3: *keyp = KEY_PPAGE; break; case KEY_C1: *keyp = KEY_END; break; case KEY_C3: *keyp = KEY_NPAGE; break; /* Any or all of A2, B1-3, C2 MAY be present */ /* Note B2 ignored */ #ifdef KEY_A2 case KEY_A2: *keyp = KEY_UP; break; #endif #ifdef KEY_B1 case KEY_B1: *keyp = KEY_LEFT; break; #endif #ifdef KEY_B3 case KEY_B3: *keyp = KEY_RIGHT; break; #endif #ifdef KEY_C2 case KEY_C2: *keyp = KEY_DOWN; break; #endif #if defined(__PDCURSES__) && defined(PADSLASH) case PADSLASH: *keyp = '/'; break; case PADSTAR: *keyp = '*'; break; case PADMINUS: *keyp = '-'; break; case PADPLUS: *keyp = '+'; break; case PADENTER: *keyp = KEY_ENTER; break; #ifdef PAD0 case PAD0: *keyp = KEY_IC; break; case PADSTOP: *keyp = KEY_DC; break; #endif /* PAD0 */ #endif /* __PDCURSES__ */ #endif /* KEY_A1 */ } /* Check if key should be ignored */ switch (*keyp) { case KEY_STAB: if (field_accept) { *keyp = 0; } break; case '\033': if (!cob_extended_status || !cob_use_esc) { *keyp = 0; } break; case KEY_PPAGE: case KEY_NPAGE: case KEY_PRINT: if (!cob_extended_status) { *keyp = 0; } break; case KEY_UP: case KEY_DOWN: if (field_accept && !cob_extended_status) { *keyp = 0; } break; } }[/code] and before "if (cob_extended_status)" (this if can be removed [with the inner code be left]" inserting a [code] cob_convert_key (&keyp, 0); if (keyp <= 0) { (void)flushinp (); beep (); continue; }[/code] You may want to give it a try... human BTW: If you work with PDCurses, I did not get it to return KEY_PRINT ---------------------------------------------------------------- marcellom; We have the 1.1ce version started. On split keys. If we can find a suitable engine, the tweaks to parser.y and typeck.c for split keys shouldn't be overly heinous. I'm just not sure if Berkeley is the best path, and know very little about the various open source isam engines. MariaDB has the Aria engine (supersedes MyISAM from MySQL) Might be worthy of investigation. I'm willing to attack parser.y and typeck.c if someone else is willing to find and test engines that are capable of composite keys (and have the data integrity required for COBOL development). Cheers, Brian ---------------------------------------------------------------- Concerning SPLIT KEYs you may want to read [url=http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=981&forum=1#forumpost4787]this post[/url] - but if it's really that easy I'm confused why Roger did not do that already... in any case - good luck. human BTW (as I think you'll ask): I'm currently out of time to do the ISAM-part of split key support ---------------------------------------------------------------- Umm, won't be easy. Nothing in the compiler source tree is easy, just certain parts are "less heinous on the brain". ;) But, with time and effort, and I'll ditto the fact that spare time is short, so the duration of the project would be longish, analyzed and worked in short increments. And it may be a tricky thing to allow to work across the engines, but it'll be good practice. Cheers, Brian ---------------------------------------------------------------- [quote] BTW: If you work with PDCurses, I did not get it to return KEY_PRINT[/quote] On Suse Linux, the Print Screen button brings up a KSnapshot window with a picture of the screen. As far as I can tell Curses will never get KEY_PRINT passed to it from the operating system. Probably MS Windows is the same way. I think the picture goes to the clipboard on MS. It might be best to just give up on the Print Screen button. Just like the Scroll Lock button. "Modern" shells totally ignore Scroll Lock. It seems like a simple request, push the button - lock the scroll. I don't have time to hack bash or some shell to make it work. It's a feature that I want. Alas, I'm giving up on that one too. ---------------------------------------------------------------- Subject: Reference modification? Umm.. is there a problem with reference modification? I wrote something like this: [quote] LINKAGE SECTION. COPY PDSPARAMBLOCK. 01 MAP-DATA PIC X(64000). 01 COMMON-STORAGE PIC X(64000). * PROCEDURE DIVISION USING BY REFERENCE PDS-PARAM-BLOCK BY REFERENCE MAP-DATA BY REFERENCE COMMON-STORAGE. * DISPLAY ' PD001U: PDS-PARAM-BLOCK=>' PDS-PARAM-BLOCK '<' DISPLAY ' PD001U: MAP-DATA>' MAP-DATA(1:50) '<' [/quote] Have a look at MAP-DATA, declared as PIC X(64000). And then, later, DISPLAY MAP-DATA(1:50). But that doesnt work, the DISPLAY statement still displays the full 64000 characters, not the 50, i want to be displayed. Any ideas, is that a known bug? From my long years experiences with IBM COBOL, it should work and display only the first 50 bytes of MAP-DATA... ---------------------------------------------------------------- Worked when I tested. [code] [btiffin@home forum]$ cobc --version cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built May 01 2011 07:48:58 Packaged Feb 06 2009 10:30:55 CET [/code] with [code] [btiffin@home forum]$ cobc -m -Wall -g -debug refmodcall.cob [btiffin@home forum]$ cobcrun refmodcall PD001U: PDS-PARAM-BLOCK=>0x0000000000000000< PD001U: MAP-DATA>abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMN< [btiffin@home forum]$ [/code] using [b]refmodcall.cob[/b] [code] OCOBOL >>SOURCE FORMAT IS FIXED *> *************************************************************** *> Authors: the_piper and Brian Tiffin *> Date: 20120401 *> Purpose: Refmod check *> Tectonics: cobc -m refmodcall.cob *> cobcrun refmodcall *> *************************************************************** identification division. program-id. refmod. data division. LINKAGE SECTION. * COPY PDSPARAMBLOCK. 01 PDS-PARAM-BLOCK USAGE POINTER. 01 MAP-DATA PIC X(64000). 01 COMMON-STORAGE PIC X(64000). * PROCEDURE DIVISION USING BY REFERENCE PDS-PARAM-BLOCK BY REFERENCE MAP-DATA BY REFERENCE COMMON-STORAGE. DISPLAY ' PD001U: PDS-PARAM-BLOCK=>' PDS-PARAM-BLOCK '<' DISPLAY ' PD001U: MAP-DATA>' MAP-DATA(1:50) '<' goback. end program refmod. *> *************************************************************** *> Author: Brian Tiffin *> Date: 20120401 *> Purpose: refmod caller *> Tectonics: cobcrun refmodcall *> *************************************************************** identification division. program-id. refmodcall. data division. working-storage section. 01 pds-pointer usage pointer value null. 01 map-data pic x(64000). 01 common-storage pic x(64000). 77 result usage binary-long. *> -*********-*********-*********-*********-*********-*********-** procedure division. move "abcdefghijklmnopqrstuvwxy" & "z1234567890ABCDEFGHIJKLMN..." to map-data call "refmod" using by reference pds-pointer by reference map-data by reference common-storage returning result end-call goback. end program refmodcall. [/code] I guessed at PDS-PARAM-BLOCK, so it might have something to do with what you witness. Cheers, Brian ---------------------------------------------------------------- Thanks, Brian, for your help, it's working now >.< The problem was a message displayed both in 2 different programs, the C program, which should call a COBOL program and then the COBOL program itself. But now i can pass data from a C program to a statically linked COBOL program, then to a dynamically called COBOL program, then to another dynamically called COBOL program and back ^^ ---------------------------------------------------------------- Subject: a strong, quick, freeware ISAM (to essex, Parhs, human) [i]from splugenbrau at forum.peoplecards.ca[/i] Hie folks, I'm writing about CISAM Files Forum of (2010/11/14) to (2011/6/29). This e-mail to indicate Real ISAM URL: http://www.alpes-software.com/realisam/ I'm not more than a beginner at C language and this is only a suggest: might the Real ISAM work for cobc compiler? One more thing: forbidden duplicates in primary keys is not a big deal when programming COBOL (not to me). Greetings. ---------------------------------------------------------------- I've took a look at this software years ago. It could be useful and seems like an alternative to current ISAM implementations. But: - only WIN-support - quite different from C/D/VBISAM --> quite a lot of changes necessary These are the reasons why I did not start to put this into fileio.c - if somebody wants to do this I may could give him some hints about how to do that, help him to get the dev environment working, would test it and try to merge the source parts into 2.0 sources (do necessary changes and submit a patch to Roger). But I'll surely not add this (because of the given reasons) "just because it could be nice". If somebody has the time to add patches I think it's more worth to put the efforts into split key support (needs not only C knowledge but understanding of OCs bison parser) or VBISAM patches, ... human ---------------------------------------------------------------- Subject: Strange compiler behaviour By narrowing down a problem with generated code, i stumbled about this effect: Program 1 is not working, compiled with cobc -x. Compiled with cobc -C you can see in the C-program, that the procedure division is empty. [code] ----+-*--1----+----2----+----3----+----4----+----5----+----6----+----7-*--+----8 ************************************************************************** * I D E N T I F I C A T I O N D I V I S I O N * ************************************************************************** IDENTIFICATION DIVISION. PROGRAM-ID. DBTEST. AUTHOR. PIPER. DATE-WRITTEN. TODAY. / ************************************************************************** * D A T A D I V I S I O N * ************************************************************************** DATA DIVISION. / ************************************************************************** * W O R K I N G S T O R A G E S E C T I O N * ************************************************************************** WORKING-STORAGE SECTIOn. / ************************************************************************** * P R O C E D U R E D I V I S I O N * ************************************************************************** PROCEDURE DIVISION. DISPLAY 'In dbtest' STOP RUN. [/code] This program does nothing, when you run it. The text is not displayed, nor is a error message given when compiling it with cobc -x dbtest.cob But THIS program does what it should do, display the text. [code] ----+-*--1----+----2----+----3----+----4----+----5----+----6----+----7-*--+----8 ************************************************************************** * I D E N T I F I C A T I O N D I V I S I O N * ************************************************************************** IDENTIFICATION DIVISION. PROGRAM-ID. DBTEST. / ************************************************************************** * D A T A D I V I S I O N * ************************************************************************** DATA DIVISION. / ************************************************************************** * W O R K I N G S T O R A G E S E C T I O N * ************************************************************************** WORKING-STORAGE SECTIOn. / ************************************************************************** * P R O C E D U R E D I V I S I O N * ************************************************************************** PROCEDURE DIVISION. DISPLAY 'In dbtest' STOP RUN. [/code] The only difference is, the first program has an AUTHOR and DATE-WRITTEN, the 2nd not. Try it yourself and see :D I am using cobc (OpenCOBOL) 1.0.0 Copyright (C) 2001-2007 Keisuke Nishida Copyright (C) 2007 Roger While running it under UBUNTU 10.04 ---------------------------------------------------------------- the_piper; First sample works with 1.1 Feb2009. I'm really going to pester Roger to tag 1.1 Feb2009 as RELEASE and get it into the main distribution channels. [b]August board members: do you all agree that 1.1 is street ready and an upgrade from the 1.0 sources?[/b] It should start making the packaging rounds in my humble. As far as I know, all that needs to start the ball rolling is an update of the source codes on sourceforge? http://sourceforge.net/projects/open-cobol/ Cheers, Brian ---------------------------------------------------------------- Thanks, Brian, for your fast reply. As a workaround, my preprocessor will now comment out such lines, AUTHOR, DATE-WRITTEN (insert an asterik in column 7). But, yeah, it would be really nice to release a version of OpenCOBOL, where this strange behaviour is fixed. ---------------------------------------------------------------- Subject: opencobol.org forum replacement test See http://sourceforge.net/projects/open-cobol/ [i]or https://sourceforge.net/projects/open-cobol/ if you have a login key at sourceforge[/i] Check it out, report back or fore. Cheers, Brian ---------------------------------------------------------------- The bb is an "hosted" app. The direct link is [url=https://sourceforge.net/apps/phpbb/open-cobol/]https://sourceforge.net/apps/phpbb/open-cobol/[/url] (I think it's readable without sf-login, too). As there is no sub-forum created it's currently not possible to post anything... (I'd change that but as I'm simply a "normal" user, I don't have the chance to do so) - please take care of this. Did you already tried to import the old forum contents (the steps would be a dump of the old forum, setting up a local version and upgrade + convert to used phpbb-version + import it at SF)? If it'll help I'd try to do that (but would need at least a dump of the current board). human ---------------------------------------------------------------- SourceForge has a long standing bug regarding applying permissions to phpBB forums. For the now, I'm stuck with adding users one at a time. So far, myself and you, human. Hopefully that'll change sooner rather than later. On the knowledge base. I was just going to cut'n'paste entire threads from the opencobol.org Xoops text archives. Last count, 1447 threads. They will be searchable, and I think the only loss will be datestamps and usernames for context. I might be able to wrangle getting a mySQL dump out of the system if you want to play (but that will likely require pestering Keisuke). The phpBB angle will require everyone that wants to post, to have SourceForge logins, which I hope won't detract anyone from wanting to move. The alternative is having anonymous postings, and I ain't fightin' the robot wars that way anymore. Sadly, I can't just apply a Group permission, so there may be some mucking about getting all the SF accounts approved on the phpBB hosted app. As a bonus, SoureForge already has the open-cobol-list mailing list archived, as these features are already enabled: [code] Backups Data Recovery File Manager Download Help Wanted Recruiting Project Database (MySQL) Web Hosting Project Web Web Hosting Virtual Hosts (VHOSTs) Web Hosting CVS Source Control Forums Forums Mailing Lists E-Mail phpBB Forum Project News News / Blog Tracker Bug / Defects [/code] and [code] The following features are available but not enabled: AN Guestbook Guest Book Bazaar Source Control CodeStriker Code Review dotProject Project Management Gallery Image Gallery Git Source Control IdeaTorrent Idea Brainstorm Laconica Microblog LimeSurvey Survey MantisBT Bug Tracking MediaWiki Wiki Mercurial Source Control phpWebSite Content Management Piwik Web Analytics Screenshots Media Subversion Source Control TaskFreak! Task Management Trac Wiki / Bug Tracking / Etc URL Shortening Administrative Wordpress Blogging [/code] I think I like SourceForge, so I'm willing to put in time to make it as attractive to (and as productive for) the community as is feasible. Cheers, Brian ---------------------------------------------------------------- open-cobol 1.0 is getting some 50-70 downloads a day off SourceForge. We really need to get 1.1pre-rel into the mix. 86% Windows. We really need to get GNU/Linux into the hands of COBOL developers. ;-) Cheers, Brian ---------------------------------------------------------------- I agree, it is time (and well gone) for the current SF release to be updated. It is not as if it is not avail elsewhere! ---------------------------------------------------------------- SourceForge has open-cobol 1.0 in CVS. Would people prefer CVS, SVN, Hg, BZR, or GIT if we make a move to post a community edition of 1.1pre-rel? (I can't believe SourceForge doesn't offer Fossil, which would be my preference). ;-) By community edition I kinda mean a 1.1pre-rel that we can all submit patches to, a little bit outside the 'official' release. OR ... make a copy of 1.1 Feb 2009 and we move the community patchable outside SourceForge and leave any copy on SourceForge as 'pristine'? Aside from a sense of over stepping my bounds, I'd like to get a lesser distribution of 1.1pre-rel, like the kiska.net and Cutler copies, that have a few critical patches for void C function handling and more robust NULL support posted up as a start point. Any and all opinions of preferred Source Control welcome. Cheers, Brian ---------------------------------------------------------------- I would prefer something other than CVS. I mostly use SVN but GIT would be fine ---------------------------------------------------------------- I'd vote for subversion. ---------------------------------------------------------------- I'd vote for SVN, too. In any case even a community edition needs a project lead. If there isn't one, the code will end up in too many styles, with too different (may incompatible) approaches for problem solutions, ... If Keisuke/Roger are fine with that I'll vote for SVN@SF --> keep to one (public known) address. As you're a project lead there I suggest you do the leading of the community edition. In any case I thing it's highly important that the community edition will be updated to newer code bases if/when there is a new public "official" version. For being able to do so the community edition needs to keep to Rogers style and approaches. human ---------------------------------------------------------------- I vote subversion. I tried to register at Source Forge over a week ago and haven't gotten the registration email. Do I need to do something else to get registered? There needs to be a project lead. This is true for any project, software or otherwise. I've seen managers throw projects into a developer's "steno pool" with horrible results. For any project to be successful, there has to be someone that "owns" the project. And there can be owners at different levels. A product development "owner", a quality assurance "owner", a platform package and release "owner", and so on. I'm not saying that someone should void the GNU licenses, I'm just saying that the projects should be "owned" by a lead. ---------------------------------------------------------------- mrcool; SourceForge registration worked fine when I first tried; email might get filtered. On the registration. Can people that register post to the Hosted App at https://sourceforge.net/apps/phpbb/open-cobol/ ? The https is for logged in access. http://sourceforge.net/apps/phpbb/open-cobol/ for anonymous views. I don't want to burden anyone with spam, so anonymous can't post, but I'm unclear on how things work for other registered SF users. The phpBB permission system is tweaked for SourceForge. SVN feature turned on, needs to be populated with an initial commit. On lead... human; I'm willing to let people work on 1.1 2009 in the open, and just "drop it" when 2 rolls. Then up port important patches to the new. ?? It'll give us something to do, and fix some minor yet long lived issues. At a minimum, I'll try and lead a project that puts 1.1 pre-rel into an acceptable 1.1final for package builders. That won't be any codebase, just docs and metadata. Cheers, Brian ---------------------------------------------------------------- Subject: (semi-off-topic) Anyone heard from Roger recently? (sorry for this semi-off-topic post, but I do think it has some relevance) Has anyone heard from Roger While directly (or otherwise) recently? I have sent a few private notes and didn't receive any replies, nor have I seen him post here for a while. Hopefully, he is just busy (not ill or without email), but I thought I would check "in public" in order to find out what (if anything) others have heard/know. ---------------------------------------------------------------- I too, sent a few missives and the last received a reply about a updated source to fix the problem/s, but he said that he would advise when it was available but did not. The update was avail. when I downloaded current version a few weeks later (I just forgot about it until the bug reared up again). He has been unwell but I do not know how badly or if he is recovering but clearly it is effecting his abilities to be able to do the level of work that he did on OC but by how much I don't know. May be someone else has more info. ---------------------------------------------------------------- Subject: OpenCobol and MySql precompiler WARNING! WALL OF TEXT!! Recently i had some spare time, so i worked on some stuff to create an environment for OpenCobol, like i used to work with on IBM mainframes and COBOL and DB2 for years. The result right now is a framework and a precompiler for MySql, which should make it easier to write applications using MySql. It's not even beta stage right now, but the first test program is working, so i wanted to post it here and ask for comments, suggesion or better ideas. This all is based on the api for MySql posted in this forum here some years ago. I had to modify that a little bit, add some stuff, but now it's working. So the credits don't only go to me, but too to the people, who created cobmysqlapi.c. And while we are on it, you have to create a table, as they described in their thread about cobmysqlapi.c, example_table, containing field1, field2, field3 to run this example (later, when i release the full source code). The input file for the precompiler is named PCTB001B.scb. This is a naming convention, no idea, how important it will be at the end: PCTB - The category of the program, you can group programs, which belong together with this naming convention. Just 4 letters like PCTB, or TEST, or ACCT or whatever. 001 - just a number to identify a program within a category B - it is a Batch program, future plan is "T" = transactions, which will run in a http server .scb - the suffix, Sql CoBol, the input for the preprocessor The framework itself handles stuff like connecting to a database, provide error handling procedures and such. So, this is how an input for the preprocessor might look like: [code] ----+-*--1----+----2----+----3----+----4----+----5----+----6----+----7-*--+----8 ************************************************************************** * I D E N T I F I C A T I O N D I V I S I O N * ************************************************************************** IDENTIFICATION DIVISION. PROGRAM-ID. PCTB001B. AUTHOR. THE_PIPER. DATE-WRITTEN. TODAY. / ************************************************************************** * D A T A D I V I S I O N * ************************************************************************** DATA DIVISION. / ************************************************************************** * W O R K I N G S T O R A G E S E C T I O N * ************************************************************************** WORKING-STORAGE SECTION. * * The needed working storage stuff for the framework COPY POCTBBATWS. * * This will be displayed in the logfile at runtime 01 POCTB-VERSION PIC X(38) VALUE '20120408 1.0 INITIAL RELEASE'. * 01 FIELD1 PIC X(20). 01 FIELD2 PIC X(16). 01 FIELD3 PIC X(32). * * The communication area for the database EXEC SQL INCLUDE SQLCA. END-EXEC. / ************************************************************************** * P R O C E D U R E D I V I S I O N * ************************************************************************** PROCEDURE DIVISION. * The framework itself, calling POCTB-ACTION to run the users coding EXEC SQL INCLUDE POCTBBAT REPLACING 'TTTTNNNB' BY 'PCTB001B'. END-EXEC. / ************************************************************************** * P O C T B - A C T I O N S E C T I O N * ************************************************************************** POCTB-ACTION SECTION. * DISPLAY 'In POCTB-ACTION.' * PERFORM DISPLAY-ALL-RECORDS * DISPLAY 'Delete entire table' * EXEC SQL DELETE FROM example_table END-EXEC. EVALUATE TRUE WHEN DB-OK CONTINUE WHEN OTHER PERFORM DB-ERROR END-EVALUATE * DISPLAY 'Insert new records' * EXEC SQL INSERT INTO example_table ( FIELD1, FIELD2, FIELD3 ) VALUES ( 'Value1' , 'Value2' , 'Value3' ) END-EXEC. EVALUATE TRUE WHEN DB-OK CONTINUE WHEN OTHER PERFORM DB-ERROR END-EVALUATE * EXEC SQL INSERT INTO example_table ( FIELD1, FIELD2, FIELD3 ) VALUES ( '2Value1' , '2Value2' , '2Value3' ) END-EXEC. EVALUATE TRUE WHEN DB-OK CONTINUE WHEN OTHER PERFORM DB-ERROR END-EVALUATE * EXEC SQL INSERT INTO example_table ( FIELD1, FIELD2, FIELD3 ) VALUES ( '3Value1' , '3Value2' , '3Value3' ) END-EXEC. EVALUATE TRUE WHEN DB-OK CONTINUE WHEN OTHER PERFORM DB-ERROR END-EVALUATE * PERFORM DISPLAY-ALL-RECORDS * DISPLAY 'Update the first record' * EXEC SQL UPDATE example_table SET FIELD1 = 'UpdatedValue1' WHERE FIELD1 = 'Value1' END-EXEC. * DISPLAY 'SQLCA-STATEMENT=' SQLCA-STATEMENT * DISPLAY 'SQLCODE=' SQLCODE * DISPLAY 'SQLCA-COUNT=' SQLCA-COUNT EVALUATE TRUE WHEN DB-OK CONTINUE WHEN OTHER PERFORM DB-ERROR END-EVALUATE * PERFORM DISPLAY-ALL-RECORDS * DISPLAY 'Ende POCTB-ACTION.' * * test test test test test test * MOVE 123 TO SQLCODE * . POCTB-ACTION-EXIT. EXIT. / ************************************************************************** DISPLAY-ALL-RECORDS SECTION. * DISPLAY '-------------------------------------------' * Attention !! Table name is CaSe sensitive!!!!!!!!!!!!! EXEC SQL SELECT FIELD1, FIELD2, FIELD3 INTO :FIELD1 :FIELD2 :FIELD3 FROM example_table END-EXEC. EVALUATE TRUE WHEN DB-OK CONTINUE WHEN DB-NOT-FOUND SET DB-OK TO TRUE MOVE SPACE TO FIELD1 MOVE SPACE TO FIELD2 MOVE SPACE TO FIELD3 WHEN OTHER PERFORM DB-ERROR END-EVALUATE DISPLAY 'FIELD1=' FIELD1 ' FIELD2=' FIELD2 ' FIELD3=' FIELD3 SET DB-OK TO TRUE PERFORM UNTIL NOT DB-OK EXEC SQL FETCH RESULT INTO :FIELD1 :FIELD2 :FIELD3 END-EXEC. EVALUATE TRUE WHEN DB-OK DISPLAY 'FIELD1=' FIELD1 ' FIELD2=' FIELD2 ' FIELD3=' FIELD3 WHEN DB-NOT-FOUND MOVE SPACE TO FIELD1 MOVE SPACE TO FIELD2 MOVE SPACE TO FIELD3 WHEN OTHER PERFORM DB-ERROR END-EVALUATE END-PERFORM SET DB-OK TO TRUE DISPLAY '-------------------------------------------' . DISPLAY-ALL-RECORDS-EXIT. EXIT. [/code] The output of the precompiler, the *.cob file, looks like this: [code] * dbprae: PCTB001B.cob 20120420-224206 ------*------------------------------------------------------------------------- ----+-*--1----+----2----+----3----+----4----+----5----+----6----+----7-*--+----8 ************************************************************************** * I D E N T I F I C A T I O N D I V I S I O N * ************************************************************************** IDENTIFICATION DIVISION. PROGRAM-ID. PCTB001B. DBPRE * AUTHOR. THE_PIPER. DBPRE * DATE-WRITTEN. TODAY. / ************************************************************************** * D A T A D I V I S I O N * ************************************************************************** DATA DIVISION. / ************************************************************************** * W O R K I N G S T O R A G E S E C T I O N * ************************************************************************** WORKING-STORAGE SECTION. * * The needed working storage stuff for the framework COPY POCTBBATWS. * * This will be displayed in the logfile at runtime 01 POCTB-VERSION PIC X(38) VALUE '20120408 1.0 INITIAL RELEASE'. * 01 FIELD1 PIC X(20). 01 FIELD2 PIC X(16). 01 FIELD3 PIC X(32). * * The communication area for the database * EXEC SQL * INCLUDE SQLCA. 01 SQLCA. 05 SQLCA-CID USAGE POINTER. 05 SQLCA-RESULT USAGE POINTER. 05 SQLCA-SEQUENCE PIC 9(08). 05 SQLCA-COUNT PIC 9(08). 05 FILLER PIC X VALUE LOW-VALUE. 05 SQLCA-RETURN-CODE PIC 9(03). 05 SQLCA-CROWCNT PIC X(08). 05 SQLCA-ROWCNT PIC 9(08). 88 SQLCA-NO-ROW VALUE 0. 88 SQLCA-ONE-ROW VALUE 1. 88 SQLCA-MORE-THAN-ONE-ROW VALUE 2 THRU 99999999. 05 FILLER PIC X VALUE LOW-VALUE. 05 SQLCA-HOST PIC X(32). 05 FILLER PIC X VALUE LOW-VALUE. 05 SQLCA-USER PIC X(32). 05 FILLER PIC X VALUE LOW-VALUE. 05 SQLCA-PASSWD PIC X(32). 05 FILLER PIC X VALUE LOW-VALUE. 05 SQLCA-DBNAME PIC X(32). 05 FILLER PIC X VALUE LOW-VALUE. 05 SQLCA-PORT PIC 9(05). 05 FILLER PIC X VALUE LOW-VALUE. 05 SQLCA-SOCKET PIC X(32). 05 FILLER PIC X VALUE LOW-VALUE. 05 SQLCA-QUOTE PIC X VALUE "'". 05 SQLCA-CARD PIC X(80). 05 SQLCA-STATEMENT. 10 SQLCA-STAT-LINE OCCURS 80 PIC X(25). 05 FILLER PIC X VALUE LOW-VALUE. 05 SQLCODE PIC 9(03). 88 DB-OK VALUE 0. 88 DB-NOT-FOUND VALUE 100. DBPRE * END-EXEC. / ************************************************************************** * P R O C E D U R E D I V I S I O N * ************************************************************************** PROCEDURE DIVISION. * The framework itself, calling POCTB-ACTION to run the users coding DBPRE MOVE 1 TO SQLCA-SEQUENCE * EXEC SQL * INCLUDE POCTBBAT REPLACING 'TTTTNNNB' BY 'PCTB001B'. ----+-*--1-!--+----2----+----3----+----4----+----5----+----6----+----7-!--+----8 * MOVE 'PCTB001B' TO POCTB-PROGRAM-NAME * ACCEPT SQLCA-CARD FROM SYSIN IF SQLCA-CARD(1:7) = 'DBHOST=' MOVE SQLCA-CARD(8:38) TO SQLCA-HOST ELSE MOVE SPACES TO POCTB-ERROR-MESSAGE STRING 'Invalid SYSIN card, DBHOST= expected: ' DELIMITED SIZE SQLCA-CARD DELIMITED SIZE INTO POCTB-ERROR-MESSAGE END-STRING PERFORM POCTB-DISPLAY-ERROR MOVE 1 TO RETURN-CODE STOP RUN END-IF * ACCEPT SQLCA-CARD FROM SYSIN IF SQLCA-CARD(1:7) = 'DBUSER=' MOVE SQLCA-CARD(8:38) TO SQLCA-USER ELSE MOVE SPACES TO POCTB-ERROR-MESSAGE STRING 'Invalid SYSIN card, DBUSER= expected: ' DELIMITED SIZE SQLCA-CARD DELIMITED SIZE INTO POCTB-ERROR-MESSAGE END-STRING PERFORM POCTB-DISPLAY-ERROR MOVE 1 TO RETURN-CODE STOP RUN END-IF * ACCEPT SQLCA-CARD FROM SYSIN IF SQLCA-CARD(1:9) = 'DBPASSWD=' MOVE SQLCA-CARD(10:40) TO SQLCA-PASSWD ELSE MOVE SPACES TO POCTB-ERROR-MESSAGE STRING 'Invalid SYSIN card, DBPASSWD= expected: ' DELIMITED SIZE SQLCA-CARD DELIMITED SIZE INTO POCTB-ERROR-MESSAGE END-STRING PERFORM POCTB-DISPLAY-ERROR MOVE 1 TO RETURN-CODE STOP RUN END-IF * ACCEPT SQLCA-CARD FROM SYSIN IF SQLCA-CARD(1:7) = 'DBNAME=' MOVE SQLCA-CARD(8:38) TO SQLCA-DBNAME ELSE MOVE SPACES TO POCTB-ERROR-MESSAGE STRING 'Invalid SYSIN card, DBNAME= expected: ' DELIMITED SIZE SQLCA-CARD DELIMITED SIZE INTO POCTB-ERROR-MESSAGE END-STRING PERFORM POCTB-DISPLAY-ERROR MOVE 1 TO RETURN-CODE STOP RUN END-IF * ACCEPT SQLCA-CARD FROM SYSIN IF SQLCA-CARD(1:7) = 'DBPORT=' MOVE SQLCA-CARD(8:5) TO SQLCA-PORT ELSE MOVE SPACES TO POCTB-ERROR-MESSAGE STRING 'Invalid SYSIN card, DBPORT= expected: ' DELIMITED SIZE SQLCA-CARD DELIMITED SIZE INTO POCTB-ERROR-MESSAGE END-STRING PERFORM POCTB-DISPLAY-ERROR MOVE 1 TO RETURN-CODE STOP RUN END-IF * ACCEPT SQLCA-CARD FROM SYSIN IF SQLCA-CARD(1:9) = 'DBSOCKET=' MOVE SQLCA-CARD(10:40) TO SQLCA-SOCKET ELSE MOVE SPACES TO POCTB-ERROR-MESSAGE STRING 'Invalid SYSIN card, DBSOCKET= expected: ' DELIMITED SIZE SQLCA-CARD DELIMITED SIZE INTO POCTB-ERROR-MESSAGE END-STRING PERFORM POCTB-DISPLAY-ERROR MOVE 1 TO RETURN-CODE STOP RUN END-IF ACCEPT POCTB-DATE FROM DATE ACCEPT POCTB-TIME FROM TIME * DISPLAY '*******************************************' '*********' DISPLAY '* ' ' *' DISPLAY '* ' POCTB-PROGRAM-NAME(1:1) ' ' POCTB-PROGRAM-NAME(2:1) ' ' POCTB-PROGRAM-NAME(3:1) ' ' POCTB-PROGRAM-NAME(4:1) ' ' POCTB-PROGRAM-NAME(5:1) ' ' POCTB-PROGRAM-NAME(6:1) ' ' POCTB-PROGRAM-NAME(7:1) ' ' POCTB-PROGRAM-NAME(8:1) ' ' ' *' DISPLAY '* ' ' *' DISPLAY '* Start..: 20' POCTB-DATE(1:2) '-' POCTB-DATE(3:2) '-' POCTB-DATE(5:2) ' ' POCTB-TIME(1:2) ':' POCTB-TIME(3:2) ':' POCTB-TIME(5:2) ' ' ' *' DISPLAY '* ' ' *' DISPLAY '* Version..: ' POCTB-VERSION '*' DISPLAY '* ' ' *' DISPLAY '*******************************************' '*********' DISPLAY '* DBHOST.......: ' SQLCA-HOST ' *' DISPLAY '* DBUSER.......: ' SQLCA-USER ' *' DISPLAY '* DBPASSWD.....: ' SQLCA-PASSWD ' *' DISPLAY '* DBNAME.......: ' SQLCA-DBNAME ' *' DISPLAY '* DBPORT.......: ' SQLCA-PORT ' *' DISPLAY '* DBSOCKET.....: ' SQLCA-SOCKET ' *' DISPLAY '*******************************************' '*********' * * Initialize the database connection DBPRE MOVE 2 TO SQLCA-SEQUENCE * EXEC SQL * INIT DB DBPRE CALL "MySQL_init" USING SQLCA-CID DBPRE END-CALL DBPRE MOVE RETURN-CODE TO SQLCODE DBPRE * END-EXEC. EVALUATE TRUE WHEN DB-OK CONTINUE WHEN DB-NOT-FOUND SET DB-OK TO TRUE WHEN OTHER PERFORM DB-ERROR END-EVALUATE DBPRE MOVE 3 TO SQLCA-SEQUENCE * EXEC SQL * CONNECT DB DBPRE CALL "MySQL_real_connect" USING DBPRE SQLCA-HOST DBPRE SQLCA-USER DBPRE SQLCA-PASSWD DBPRE SQLCA-DBNAME DBPRE SQLCA-PORT DBPRE SQLCA-SOCKET DBPRE END-CALL DBPRE MOVE RETURN-CODE TO SQLCODE DBPRE * END-EXEC. EVALUATE TRUE WHEN DB-OK CONTINUE WHEN DB-NOT-FOUND SET DB-OK TO TRUE WHEN OTHER PERFORM DB-ERROR END-EVALUATE * * Now execute the user's code PERFORM POCTB-ACTION * * Any errors? PERFORM DB-ERROR * * Commit the work DBPRE MOVE 4 TO SQLCA-SEQUENCE * EXEC SQL * COMMIT DBPRE CALL "MySQL_commit" DBPRE END-CALL DBPRE MOVE RETURN-CODE TO SQLCODE DBPRE IF RETURN-CODE NOT = 0 THEN DBPRE PERFORM DB-ERROR DBPRE END-IF DBPRE * END-EXEC. * * We're done, now close the database and stop the program DBPRE MOVE 5 TO SQLCA-SEQUENCE * EXEC SQL * CLOSE DB DBPRE CALL "MySQL_close" DBPRE END-CALL DBPRE MOVE RETURN-CODE TO SQLCODE DBPRE * END-EXEC. PERFORM DB-ERROR * ACCEPT POCTB-DATE FROM DATE ACCEPT POCTB-TIME FROM TIME DISPLAY '*******************************************' '*********' DISPLAY '* ' ' *' DISPLAY '* ' ' *' DISPLAY '* End....: 20' POCTB-DATE(1:2) '-' POCTB-DATE(3:2) '-' POCTB-DATE(5:2) ' ' POCTB-TIME(1:2) ':' POCTB-TIME(3:2) ':' POCTB-TIME(5:2) ' ' ' *' DISPLAY '* ' ' *' DISPLAY '* ' ' *' DISPLAY '*******************************************' '*********' * * No error, return zero * MOVE 0 TO RETURN-CODE . POCTB-MAIN-EXIT. STOP RUN. / ************************************************************************* POCTB-STATUS SECTION. IF POCTB-ERROR IF POCTB-ERROR-MESSAGE = SPACES STRING POCTB-PROGRAM-NAME DELIMITED BY SIZE ': POCTB-STATUS-FLD ' DELIMITED BY SIZE POCTB-STATUS-FLD DELIMITED BY SIZE ' is set!' DELIMITED BY SIZE INTO POCTB-ERROR-MESSAGE END-IF * * Rollback the work DBPRE MOVE 6 TO SQLCA-SEQUENCE * EXEC SQL * ROLLBACK DBPRE CALL "MySQL_rollback" DBPRE END-CALL DBPRE MOVE RETURN-CODE TO SQLCODE DBPRE IF RETURN-CODE NOT = 0 THEN DBPRE PERFORM DB-ERROR DBPRE END-IF DBPRE * END-EXEC. MOVE 2 TO RETURN-CODE STOP RUN END-IF . POCTB-STATUS-EXIT. EXIT. ************************************************************************* POCTB-DISPLAY-ERROR SECTION. DISPLAY '*******************************************' '******************************' DISPLAY '* E R R O R * E R R O R * E R R O R * E R R' ' O R * E R R O R * E R R O R *' DISPLAY '*******************************************' '******************************' DISPLAY '*** ' ' ***' DISPLAY '** ' POCTB-ERROR-MESSAGE ' **' DISPLAY '*** ' ' ***' DISPLAY '*******************************************' '******************************' DISPLAY '* E R R O R * E R R O R * E R R O R * E R R' ' O R * E R R O R * E R R O R *' DISPLAY '*******************************************' '******************************' DISPLAY '* D A T A B A S E W O R K U N I T ' ' R O L L E D B A C K *' DISPLAY '*******************************************' '******************************' . POCTB-DISPLAY-ERROR-EXIT. EXIT. ************************************************************************* DB-ERROR SECTION. IF SQLCODE NOT = 0 CALL "MySQL_errno" USING POCTB-ERRNO END-CALL DISPLAY 'ERRNO: ' POCTB-ERRNO CALL "MySQL_error" USING POCTB-ERROR-MESSAGE END-CALL DISPLAY POCTB-ERROR-MESSAGE MOVE SPACES TO POCTB-ERROR-MESSAGE STRING 'DB-ERROR: Program ' DELIMITED BY SIZE POCTB-PROGRAM-NAME DELIMITED BY SIZE ' SQLCODE=' DELIMITED BY SIZE SQLCODE DELIMITED BY SIZE ' SQLCA-SEQUENCE=' DELIMITED BY SIZE SQLCA-SEQUENCE DELIMITED BY SIZE ' ' DELIMITED BY SIZE INTO POCTB-ERROR-MESSAGE PERFORM POCTB-DISPLAY-ERROR * * Rollback the work DBPRE MOVE 7 TO SQLCA-SEQUENCE * EXEC SQL * ROLLBACK DBPRE CALL "MySQL_rollback" DBPRE END-CALL DBPRE MOVE RETURN-CODE TO SQLCODE DBPRE IF RETURN-CODE NOT = 0 THEN DBPRE PERFORM DB-ERROR DBPRE END-IF DBPRE * END-EXEC. MOVE 3 TO RETURN-CODE STOP RUN END-IF . DB-ERROR-EXIT. EXIT. DBPRE * END-EXEC. / ************************************************************************** * P O C T B - A C T I O N S E C T I O N * ************************************************************************** POCTB-ACTION SECTION. * DISPLAY 'In POCTB-ACTION.' * PERFORM DISPLAY-ALL-RECORDS * DISPLAY 'Delete entire table' * DBPRE MOVE 8 TO SQLCA-SEQUENCE * EXEC SQL DBPRE * DELETE DBPRE * FROM example_table DBPRE * END-EXEC. DBPRE MOVE LOW-VALUES TO SQLCA-STATEMENT DBPRE STRING DBPRE 'DELETE ' DELIMITED SIZE DBPRE 'FROM ' DELIMITED SIZE DBPRE 'example_table ' DELIMITED SIZE DBPRE INTO SQLCA-STATEMENT DBPRE END-STRING DBPRE CALL 'MySQL_query' USING SQLCA-STATEMENT DBPRE END-CALL DBPRE MOVE RETURN-CODE TO SQLCODE EVALUATE TRUE WHEN DB-OK CONTINUE WHEN OTHER PERFORM DB-ERROR END-EVALUATE * DISPLAY 'Insert new records' * DBPRE MOVE 9 TO SQLCA-SEQUENCE * EXEC SQL DBPRE * INSERT DBPRE * INTO example_table DBPRE * ( DBPRE * FIELD1, DBPRE * FIELD2, DBPRE * FIELD3 DBPRE * ) DBPRE * VALUES DBPRE * ( DBPRE * 'Value1' , DBPRE * 'Value2' , DBPRE * 'Value3' DBPRE * ) DBPRE * END-EXEC. DBPRE MOVE LOW-VALUES TO SQLCA-STATEMENT DBPRE STRING DBPRE 'INSERT ' DELIMITED SIZE DBPRE 'INTO ' DELIMITED SIZE DBPRE 'example_table ' DELIMITED SIZE DBPRE '( ' DELIMITED SIZE DBPRE 'FIELD1, ' DELIMITED SIZE DBPRE 'FIELD2, ' DELIMITED SIZE DBPRE 'FIELD3 ' DELIMITED SIZE DBPRE ') ' DELIMITED SIZE DBPRE 'VALUES ' DELIMITED SIZE DBPRE '( ' DELIMITED SIZE DBPRE '''Value1'' ' DELIMITED SIZE DBPRE ', ' DELIMITED SIZE DBPRE '''Value2'' ' DELIMITED SIZE DBPRE ', ' DELIMITED SIZE DBPRE '''Value3'' ' DELIMITED SIZE DBPRE ') ' DELIMITED SIZE DBPRE INTO SQLCA-STATEMENT DBPRE END-STRING DBPRE CALL 'MySQL_query' USING SQLCA-STATEMENT DBPRE END-CALL DBPRE MOVE RETURN-CODE TO SQLCODE EVALUATE TRUE WHEN DB-OK CONTINUE WHEN OTHER PERFORM DB-ERROR END-EVALUATE * DBPRE MOVE 10 TO SQLCA-SEQUENCE * EXEC SQL DBPRE * INSERT DBPRE * INTO example_table DBPRE * ( DBPRE * FIELD1, DBPRE * FIELD2, DBPRE * FIELD3 DBPRE * ) DBPRE * VALUES DBPRE * ( DBPRE * '2Value1' , DBPRE * '2Value2' , DBPRE * '2Value3' DBPRE * ) DBPRE * END-EXEC. DBPRE MOVE LOW-VALUES TO SQLCA-STATEMENT DBPRE STRING DBPRE 'INSERT ' DELIMITED SIZE DBPRE 'INTO ' DELIMITED SIZE DBPRE 'example_table ' DELIMITED SIZE DBPRE '( ' DELIMITED SIZE DBPRE 'FIELD1, ' DELIMITED SIZE DBPRE 'FIELD2, ' DELIMITED SIZE DBPRE 'FIELD3 ' DELIMITED SIZE DBPRE ') ' DELIMITED SIZE DBPRE 'VALUES ' DELIMITED SIZE DBPRE '( ' DELIMITED SIZE DBPRE '''2Value1'' ' DELIMITED SIZE DBPRE ', ' DELIMITED SIZE DBPRE '''2Value2'' ' DELIMITED SIZE DBPRE ', ' DELIMITED SIZE DBPRE '''2Value3'' ' DELIMITED SIZE DBPRE ') ' DELIMITED SIZE DBPRE INTO SQLCA-STATEMENT DBPRE END-STRING DBPRE CALL 'MySQL_query' USING SQLCA-STATEMENT DBPRE END-CALL DBPRE MOVE RETURN-CODE TO SQLCODE EVALUATE TRUE WHEN DB-OK CONTINUE WHEN OTHER PERFORM DB-ERROR END-EVALUATE * DBPRE MOVE 11 TO SQLCA-SEQUENCE * EXEC SQL DBPRE * INSERT DBPRE * INTO example_table DBPRE * ( DBPRE * FIELD1, DBPRE * FIELD2, DBPRE * FIELD3 DBPRE * ) DBPRE * VALUES DBPRE * ( DBPRE * '3Value1' , DBPRE * '3Value2' , DBPRE * '3Value3' DBPRE * ) DBPRE * END-EXEC. DBPRE MOVE LOW-VALUES TO SQLCA-STATEMENT DBPRE STRING DBPRE 'INSERT ' DELIMITED SIZE DBPRE 'INTO ' DELIMITED SIZE DBPRE 'example_table ' DELIMITED SIZE DBPRE '( ' DELIMITED SIZE DBPRE 'FIELD1, ' DELIMITED SIZE DBPRE 'FIELD2, ' DELIMITED SIZE DBPRE 'FIELD3 ' DELIMITED SIZE DBPRE ') ' DELIMITED SIZE DBPRE 'VALUES ' DELIMITED SIZE DBPRE '( ' DELIMITED SIZE DBPRE '''3Value1'' ' DELIMITED SIZE DBPRE ', ' DELIMITED SIZE DBPRE '''3Value2'' ' DELIMITED SIZE DBPRE ', ' DELIMITED SIZE DBPRE '''3Value3'' ' DELIMITED SIZE DBPRE ') ' DELIMITED SIZE DBPRE INTO SQLCA-STATEMENT DBPRE END-STRING DBPRE CALL 'MySQL_query' USING SQLCA-STATEMENT DBPRE END-CALL DBPRE MOVE RETURN-CODE TO SQLCODE EVALUATE TRUE WHEN DB-OK CONTINUE WHEN OTHER PERFORM DB-ERROR END-EVALUATE * PERFORM DISPLAY-ALL-RECORDS * DISPLAY 'Update the first record' * DBPRE MOVE 12 TO SQLCA-SEQUENCE * EXEC SQL DBPRE * UPDATE example_table DBPRE * SET FIELD1 = 'UpdatedValue1' DBPRE * WHERE FIELD1 = 'Value1' DBPRE * END-EXEC. DBPRE MOVE LOW-VALUES TO SQLCA-STATEMENT DBPRE STRING DBPRE 'UPDATE ' DELIMITED SIZE DBPRE 'example_table ' DELIMITED SIZE DBPRE 'SET ' DELIMITED SIZE DBPRE 'FIELD1 ' DELIMITED SIZE DBPRE '= ' DELIMITED SIZE DBPRE '''UpdatedValue1'' ' DELIMITED SIZE DBPRE 'WHERE ' DELIMITED SIZE DBPRE 'FIELD1 ' DELIMITED SIZE DBPRE '= ' DELIMITED SIZE DBPRE '''Value1'' ' DELIMITED SIZE DBPRE INTO SQLCA-STATEMENT DBPRE END-STRING DBPRE CALL 'MySQL_query' USING SQLCA-STATEMENT DBPRE END-CALL DBPRE MOVE RETURN-CODE TO SQLCODE * DISPLAY 'SQLCA-STATEMENT=' SQLCA-STATEMENT * DISPLAY 'SQLCODE=' SQLCODE * DISPLAY 'SQLCA-COUNT=' SQLCA-COUNT EVALUATE TRUE WHEN DB-OK CONTINUE WHEN OTHER PERFORM DB-ERROR END-EVALUATE * PERFORM DISPLAY-ALL-RECORDS * DISPLAY 'Ende POCTB-ACTION.' * * test test test test test test * MOVE 123 TO SQLCODE * . POCTB-ACTION-EXIT. EXIT. / ************************************************************************** DISPLAY-ALL-RECORDS SECTION. * DISPLAY '-------------------------------------------' * Attention !! Table name is CaSe sensitive!!!!!!!!!!!!! DBPRE MOVE 13 TO SQLCA-SEQUENCE * EXEC SQL DBPRE * SELECT FIELD1, FIELD2, FIELD3 DBPRE * INTO :FIELD1 :FIELD2 :FIELD3 DBPRE * FROM example_table DBPRE * END-EXEC. DBPRE MOVE LOW-VALUES TO SQLCA-STATEMENT DBPRE MOVE 'SELECT FIELD1, FIELD2, FI' TO SQLCA-STAT-LINE (1) DBPRE MOVE 'ELD3 FROM example_table ' TO SQLCA-STAT-LINE (2) DBPRE CALL 'MySQL_query' USING SQLCA-STATEMENT DBPRE END-CALL DBPRE MOVE RETURN-CODE TO SQLCODE DBPRE IF DB-OK DBPRE CALL 'MySQL_use_result' USING SQLCA-RESULT DBPRE END-CALL DBPRE IF SQLCA-RESULT = NULL DBPRE MOVE 100 TO SQLCODE DBPRE ELSE DBPRE MOVE 0 TO SQLCODE DBPRE END-IF DBPRE END-IF DBPRE IF DB-OK DBPRE CALL 'MySQL_fetch_row' USING SQLCA-RESULT DBPRE FIELD1 DBPRE FIELD2 DBPRE FIELD3 DBPRE END-CALL DBPRE IF SQLCA-RESULT = NULL DBPRE MOVE 100 TO SQLCODE DBPRE ELSE DBPRE MOVE 0 TO SQLCODE DBPRE END-IF DBPRE END-IF EVALUATE TRUE WHEN DB-OK CONTINUE WHEN DB-NOT-FOUND SET DB-OK TO TRUE MOVE SPACE TO FIELD1 MOVE SPACE TO FIELD2 MOVE SPACE TO FIELD3 WHEN OTHER PERFORM DB-ERROR END-EVALUATE DISPLAY 'FIELD1=' FIELD1 ' FIELD2=' FIELD2 ' FIELD3=' FIELD3 SET DB-OK TO TRUE PERFORM UNTIL NOT DB-OK DBPRE MOVE 14 TO SQLCA-SEQUENCE * EXEC SQL DBPRE * FETCH RESULT DBPRE * INTO :FIELD1 :FIELD2 :FIELD3 DBPRE * END-EXEC. DBPRE CALL 'MySQL_fetch_row' USING SQLCA-RESULT DBPRE FIELD1 DBPRE FIELD2 DBPRE FIELD3 DBPRE END-CALL DBPRE IF SQLCA-RESULT = NULL DBPRE MOVE 100 TO SQLCODE DBPRE ELSE DBPRE MOVE 0 TO SQLCODE DBPRE END-IF EVALUATE TRUE WHEN DB-OK DISPLAY 'FIELD1=' FIELD1 ' FIELD2=' FIELD2 ' FIELD3=' FIELD3 WHEN DB-NOT-FOUND MOVE SPACE TO FIELD1 MOVE SPACE TO FIELD2 MOVE SPACE TO FIELD3 WHEN OTHER PERFORM DB-ERROR END-EVALUATE END-PERFORM SET DB-OK TO TRUE DISPLAY '-------------------------------------------' . DISPLAY-ALL-RECORDS-EXIT. EXIT. [/code] Compile it with [code] cobc -x PCTB001B.cob cobmysqlapi.o -L/usr/lib/mysql -lmysqlclient [/code] To run it, use this shell script (i am developing using Ubuntu) [code] cat PCTB001B.sysin | PCTB001B >PCTB001B.log [/code] As you can see, you need a SYSIN file for the input cards the framework reads. This file, in this case PCTB001B.sysin looks like this: [code] DBHOST=localhost DBUSER=root DBPASSWD=YourRootPasswordForMySqlHere DBNAME=testdb DBPORT=03306 DBSOCKET=null [/code] Here is the data stored the framework needs to connect to the database (You might have guessed, that you have to replace the DBPASSWD with your own password to connect to MySql, also, if your MySql server is running on another port than 3306, change that too to your needs). And the log file, when you run the program, looks like this: [code] **************************************************** * * * P C T B 0 0 1 B * * * * Start..: 2012-04-21 01:37:58 * * * * Version..: 20120408 1.0 INITIAL RELEASE * * * **************************************************** * DBHOST.......: localhost * * DBUSER.......: root * * DBPASSWD.....: YouWontGuess * * DBNAME.......: testdb * * DBPORT.......: 03306 * * DBSOCKET.....: null * **************************************************** In POCTB-ACTION. ------------------------------------------- FIELD1=UpdatedValue1 FIELD2=Value2 FIELD3=Value3 FIELD1=2Value1 FIELD2=2Value2 FIELD3=2Value3 FIELD1=3Value1 FIELD2=3Value2 FIELD3=3Value3 ------------------------------------------- Delete entire table Insert new records ------------------------------------------- FIELD1=Value1 FIELD2=Value2 FIELD3=Value3 FIELD1=2Value1 FIELD2=2Value2 FIELD3=2Value3 FIELD1=3Value1 FIELD2=3Value2 FIELD3=3Value3 ------------------------------------------- Update the first record ------------------------------------------- FIELD1=UpdatedValue1 FIELD2=Value2 FIELD3=Value3 FIELD1=2Value1 FIELD2=2Value2 FIELD3=2Value3 FIELD1=3Value1 FIELD2=3Value2 FIELD3=3Value3 ------------------------------------------- Ende POCTB-ACTION. **************************************************** * * * * * End....: 2012-04-21 01:37:58 * * * * * **************************************************** [/code] Thats it so far, theres still a lot of work to do and known bugs, i have to work on, but the first test program is working after just a few weeks. Not that bad at all, IMO :) So, any comments, suggestions and such? Feel free to post :D ---------------------------------------------------------------- Well, at least you are on a great start. :-o Does your precompiler, ignore other embedded "EXEC ..." languages outside of SQL? Though, just my opinion, I would probably prefer replacing the accept statement with a call to acquire the initial SQLCA information. I suppose, after looking at countless expanded DB2 source, I sort of miss those DB2 initialization paragraghs which get executed with only upon the first executed SQL statement. Coming from a DB2 environment, does MySql have a concept of DBRMs? Have you worked DB2 Express? ---------------------------------------------------------------- [quote]Does your precompiler, ignore other embedded "EXEC ..." languages outside of SQL? [/quote] Not right now, it checks, if every EXEC SQL has a matching END-EXEC, so any EXEC CICS or so would confuse the preprocessor. [quote] Though, just my opinion, I would probably prefer replacing the accept statement with a call to acquire the initial SQLCA information.[/quote] Nice idea, i'm trying to implement that, reading it in the cobmysql api from a different file. [quote] Coming from a DB2 environment, does MySql have a concept of DBRMs? [/quote] I dont think so, the SQL code is interpreted at runtime, look at my *.cob file, the SQL statement is built using the STRING command and then given to mysql. [quote]Have you worked DB2 Express? [/quote] Not yet, only with DB2 on mainframes. ---------------------------------------------------------------- Hi, Very interested in your dev efforts on this. I'm attempting to create a DAL (Data Access Layer) module that is written for each flat file in an existing application that I have made Open Source. This consists of two parts, 1st is a file handler for a specific file that accepts requests to open, close, read (for a key), read next, write, rewrite etc. This in turn if RDB in use will call a DAL to do the same except process a table Row and move to/from a FD record etc. So far I have one that sort of links to MS SQL 2008 server (using MF Netexpress) and have tried to get a similar one working with DB/2 Express (under Linux) with quite a few problems but there again I cannot compile the DB/2 samples without issues!! On the Mysql front, I need a useful precompiler as well as an updated cobmysqlapi.005.c that has the rest of the missing ops in working with the normal SQL exec code types as well as work with the later versions of OC, eg, later than the Feb 09. Please keep us up2date on your efforts. ---------------------------------------------------------------- [quote]Please keep us up2date on your efforts.[/quote] Will do, i just started a Blog today, where i will post about the development of my tools and links to the source code, which includes the mysql precompiler: http://pipersopencoboltoolbox.blogspot.de/ No need to spam this forum here, i think :) I posted there the modified cobmysqlapi.c i am using right now, if that helps you. I had to do a few changes, since the one i found here in forums was not working. Well, 4 years old, no surprise.. ---------------------------------------------------------------- I'm not sure if the version is newer, but according to btiffins [url=http://opencobol.add1tocobol.com/]OpenCOBOL FAQ[/url] the svn repository for cobmysqlapi.c is [url=http://svn.wp0.org/add1/libraries/mysql4Windows4OpenCobol/]http://svn.wp0.org/add1/libraries/mysql4Windows4OpenCobol[/url]. human ---------------------------------------------------------------- The first release of the source code of dbpre, the precompiler for MySql and OpenCobol + additional files + two example programs can be found here. http://pipersopencoboltoolbox.blogspot.de/ This was developed and tested using Ubuntu, so no idea, if this will work under different distros or other operating systems. @human Thanks for the link, i will have a look at it later, but right now the cobmysqlapi i found in forums does is's job very well, even with my modifications :) ---------------------------------------------------------------- Hmm.... not a single comment about the precompiler since more than a week.. Should i guess that nobody is interested in having/using the precompiler and i should stop working on it? ---------------------------------------------------------------- Don't take no replies as a sign the work is not worthwhile. OpenCOBOL grows with every contribution. Leaps and baby steps, lots of steps will make up a much better whole. In my biased fanboy opinion. For every 1000 lines of code I like to tinker with, if 4 end up used by or helping someone, woohoo for the win. ;-) I'll add, from the same fanboy opinion space, as a volunteer you don't really have to finish anything you don't commit to finishing, in writing. Follow your bliss, and the code will thank you back in spades. Cheers and have good the_piper, Brian [i]for the international crowd, where I'm from "in spades" refers to the top rank of the four playing card suits, a good thing, not say, flying gardening implements or anything that would require ducking from...[/i] ---------------------------------------------------------------- Post a to do list. ---------------------------------------------------------------- @the_piper it is not so. We just knew you were working on it and ware awaiting for news. I, personally, am very interested on the matter. If I can help you, tell me. marcellom ---------------------------------------------------------------- Thanks for your replies. Bug reports and suggestions would help me a lot. Further i have to decide, if the precompiler should support cursors or if the way it's handled now (SELECT can return more than one row, which must be read using the FETCH command) is better. Do we need DECLAREs, so that the precompiler can check variable types? Thats somehow my ToDo list so far. ---------------------------------------------------------------- Congratulations! Keep up the good work. We took a different approach in that our preprocessor can be used to generate the record layout using traditional 01's and 05's. We also chose to have the preprocessor do the tedious work of moving each column of a row in and out of working storage. http://www.opencobol.org/modules/newbb/viewtopic.php?viewmode=thread&topic_id=905&forum=1&post_id=4311#4311 might be of value to you as you continue to develop your more traditional (than ours) implementation of SQL. jimc ---------------------------------------------------------------- Thanks, jimc, for the link and the congratulations, it's interesting to see, what other ppl have done by trying to access databases with OpenCobol. Right, i am coming from DB2, informix and Oracle, so i am using the EXEC SQL..END-EXEC syntax they use. I have in mind, that it might be possible to use OpenCobol as a replacement for IBM COBOL, MicroFocus COBOL and make it easier to port existing code from there to OpenCobol/MySql. Anyways, an update of what i am working on right now: Let there be cursors! http://pipersopencoboltoolbox.blogspot.de/ When the cursors work properly, i will start to think about EXEC SQL DECLARE table structures END-EXEC. and how to check if the data types in COBOL programs are matching with the table definitions in MySql. I know, that i can list the definition of a table in the mysql client with the describe command, but how can i export that definition into a text file? With having table definitions in a text file, a tool could create COBOL definitions (copybooks) of the table definitions, so that they would match with the mysql definitions. And such table definitions could be imported into a repository, where you can search for informations, like, in which tables is a ZIP code used or an account ID and such. Well, future plans :-D ---------------------------------------------------------------- @the_piper [code] I know, that i can list the definition of a table in the mysql client with the describe command, but how can i export that definition into a text file? [/code] We were using cut (from the terminal window) and paste (into a client based text processor) for quite some time. We finally broke down and wrote a schema printer that works in our environment. If someone wants to work with it to make it a true utility program, I will be happy to post it, but since it uses our pre-processor someone would have to spend some time understanding our approach. [code] With having table definitions in a text file, a tool could create COBOL definitions (copybooks) of the table definitions, so that they would match with the mysql definitions. [/code] We took the approach of having the pre-processor (and schema printer) read the meta-data in the MySQL data base and create the Cobol definitions dynamically at compile time. Your work promises to have great value to the user community (especially to those who want to convert from other platforms). jimc ---------------------------------------------------------------- @jcurrey Hmmm... do i got it right, that you are using something like mysql_query() to run the "describe tablename" command or something like "SELECT * FROM SYSFIELDS" or however it's called in DB2, and then read the result and then generate the COBOL structure of a record at precompiling time? That would be a pretty cool idea :) If you could post your schema printer here, that would be great, that would save me some time to find out, how to get the meta data of the tables. I'm going to think about that tomorrow, right now it's too late here in Germany ;) ---------------------------------------------------------------- @the_piper MySQL has a data base named "information_schema" that defines the data elements in a data base. The tables "TABLES" and "COLUMNS" help with the pre-processor and schema printer. The pre-processor takes a COBOL source file with macro statements that the programmer has written and creates an intermediate file that is then compiled by OpenCOBOL. Our programmers do not work directly with the intermediate file, but I have chosen to print the intermediate file for the schema printer (the schema printer is written in OpenCOBOL and uses the pre-processor) so that you will not have to get those programs working in your environment. You asked that I post a copy of the schema printer. Your technique will require that you take a different approach, but at least this program demonstrates that you can automatically get the table and column definitions into a program without having to write a separate copy book. Please remember that the MYSQL blocks ("/MYSQL xxx\" through "/MYSQL-END\") are commented out in the intermediate file and are replaced with generated code from the pre-processor. The schema printer is listed below: [code] IDENTIFICATION DIVISION. PROGRAM-ID. PRTSCHEMA. *AUTHOR. J C CURREY. ************************************************************ * MySQL SCHEMA PRINTER FOR OPEN COBOL 1.1 * * * * THIS PROGRAM PRINTS A SCHEMA FROM A MySQL DATA BASE * * * * VERSION 001--ORIGINAL VERSION * * * * FEBRUARY, 2010--J C CURREY * * * * 002--ONLY PRINTS CHARACTER-SET-NAME, * * COLLATION-NAME, AND PRIVILEGES * * IF THEY ARE NON-STANDARD * * MARCH 11, 2010--J C CURREY * * * * VERSION 003--FIXED THE BUG THAT ALLOWED A LINE TO BE * * SKIPPED AT THE BEGINNING OF A NEW PAGE * * 1353122--RANDY COMAN * * 08/30/2011--EFRAIN AGUILERA * ************************************************************ ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT PRINT-FILE ASSIGN TO WS-NAME-PRINT-FILE ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-PRINT-FILE-STATUS. SELECT FORMAT-FILE ASSIGN TO WS-NAME-FORMAT-FILE ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS WS-FORMAT-FILE-STATUS. DATA DIVISION. FILE SECTION. * FD PRINT-FILE. 01 PRINT-RECORD. 05 PR-BUFFER PIC X(132). FD FORMAT-FILE. 01 FORMAT-RECORD PIC X(140). WORKING-STORAGE SECTION. **************************************************** * CONSTANTS, COUNTERS AND WORK AREAS * **************************************************** 01 WS-NAME-PROGRAM PIC X(14) VALUE "prtschema 003". 01 WS-NO-PARAGRAPH PIC S9(4) COMP. 01 WS-I PIC S9(4) COMP. 01 WS-J PIC S9(4) COMP. 01 WS-K PIC S9(4) COMP. 01 WS-NAME-PRINT-FILE PIC X(64) VALUE SPACES. 01 WS-NAME-FORMAT-FILE PIC X(128) VALUE SPACES. 01 WS-LINE-PRINTER-NAME PIC X(64). * 1 2 3 4 5 6 7 *890123456789012345678901234567890123456789012345678901234567890 01 WS-PRINT-FILE-STATUS PIC XX. 01 WS-FORMAT-FILE-STATUS PIC XX. 01 WS-PRINT-COMMAND PIC X(128). 01 WS-READ-AREA PIC X(80). 01 WS-DATE PIC 9(6). 01 WS-TIME PIC 9(8). 01 WS-ED-TIME PIC 99B99B99B99. 01 WS-ED2 PIC 99. 01 WS-ED2-SECOND PIC 99. 01 WS-ED3S PIC ZZZ-. 01 WS-ED6S PIC ZZZZZ9-. 01 WS-ED8 PIC Z(7)9. 01 WS-ED18S PIC ZZZ,ZZZ,ZZZ,ZZZ,ZZZ,ZZ9-. 01 WS-NAME-DATA-BASE PIC X(30). 01 WS-WHERE PIC X(512). 01 WS-LINE-COUNTER PIC S9(4). 01 WS-PAGE-NUMBER PIC S9(4) VALUE ZERO. 01 WS-HEADING-BUFFER PIC X(132). 01 WS-SWITCH-TABLE PIC X VALUE "N". 031110 01 WS-CHARACTER-SET-NAME PIC X(64). 031110 01 WS-COLLATION-NAME PIC X(64). 031110 01 WS-PRIVILEGES PIC X(80). 083011 01 WS-PRINT-RECORD-HOLD PIC X(132). * * THESE VARIABLES WILL CONTAIN THE INFORMATION USED * TO BUILD THE COBOL DATA DEFINITION * 01 WS-COLUMN-ARRAY-BUFFER. 05 WS-CA-COLUMN-NAME PIC X(32). 05 WS-CA-DATA-TYPE PIC X(12). 05 WS-CA-CHARACTER-MAXIMUM-LENGTH PIC S9(19). 05 WS-CA-NUMERIC-PRECISION PIC S9(19). 05 WS-CA-NUMERIC-SCALE PIC S9(19). 05 WS-CA-PICTURE PIC X(32). */MYSQL VAR\ * BASE=information_schema * TABLE=TABLES,TB * TABLE=COLUMNS,CB COPY MYSQL-VARIABLES. * * DEFINITIONS FOR THE TABLES TABLE * 01 TP-TABLES USAGE POINTER. 01 TD-TABLES. 05 TB-TABLE-CATALOG PIC X(512). 05 TB-TABLE-SCHEMA PIC X(64). 05 TB-TABLE-NAME PIC X(64). 05 TB-TABLE-TYPE PIC X(64). 05 TB-ENGINE PIC X(64). 05 TB-VERSION PIC S9(18) COMP. 05 TB-ROW-FORMAT PIC X(10). 05 TB-TABLE-ROWS PIC S9(18) COMP. 05 TB-AVG-ROW-LENGTH PIC S9(18) COMP. 05 TB-DATA-LENGTH PIC S9(18) COMP. 05 TB-MAX-DATA-LENGTH PIC S9(18) COMP. 05 TB-INDEX-LENGTH PIC S9(18) COMP. 05 TB-DATA-FREE PIC S9(18) COMP. 05 TB-AUTO-INCREMENT PIC S9(18) COMP. 05 TB-CREATE-TIME PIC X(19). 05 TB-UPDATE-TIME PIC X(19). 05 TB-CHECK-TIME PIC X(19). 05 TB-TABLE-COLLATION PIC X(64). 05 TB-CHECKSUM PIC S9(18) COMP. 05 TB-CREATE-OPTIONS PIC X(255). 05 TB-TABLE-COMMENT PIC X(80). * * DEFINITIONS FOR THE COLUMNS TABLE * 01 TP-COLUMNS USAGE POINTER. 01 TD-COLUMNS. 05 CB-TABLE-CATALOG PIC X(512). 05 CB-TABLE-SCHEMA PIC X(64). 05 CB-TABLE-NAME PIC X(64). 05 CB-COLUMN-NAME PIC X(64). 05 CB-ORDINAL-POSITION PIC S9(18) COMP. 05 CB-COLUMN-DEFAULT PIC X(1024). 05 CB-IS-NULLABLE PIC X(3). 05 CB-DATA-TYPE PIC X(64). 05 CB-CHARACTER-MAXIMUM-LENGTH PIC S9(18) COMP. 05 CB-CHARACTER-OCTET-LENGTH PIC S9(18) COMP. 05 CB-NUMERIC-PRECISION PIC S9(18) COMP. 05 CB-NUMERIC-SCALE PIC S9(18) COMP. 05 CB-CHARACTER-SET-NAME PIC X(64). 05 CB-COLLATION-NAME PIC X(64). 05 CB-COLUMN-TYPE PIC X(1024). 05 CB-COLUMN-KEY PIC X(3). 05 CB-EXTRA PIC X(20). 05 CB-PRIVILEGES PIC X(80). 05 CB-COLUMN-COMMENT PIC X(255). */MYSQL-END\ **************************************************************** * PROCEDURE DIVISION * **************************************************************** PROCEDURE DIVISION. 0000-MAIN SECTION. PERFORM 1000-INITIALIZATION THRU 1990-EXIT. PERFORM 2000-PROCESS THRU 7990-EXIT. PERFORM 9000-END-OF-PROGRAM THRU 9990-EXIT. STOP RUN. **************************************************************** * INITIALIZATION * **************************************************************** 1000-INITIALIZATION. MOVE 1000 TO WS-NO-PARAGRAPH. DISPLAY "I) ", WS-NAME-PROGRAM, " BEGINNING AT--" FUNCTION CURRENT-DATE. INITIALIZE WS-COLUMN-ARRAY-BUFFER. 1002-GET-BASE-NAME-FILE. DISPLAY "A) ENTER DATA BASE NAME " WITH NO ADVANCING. ACCEPT WS-NAME-DATA-BASE. MOVE "schema.t" TO WS-NAME-PRINT-FILE. DISPLAY "A) ENTER PRINTER NAME " WITH NO ADVANCING. ACCEPT WS-LINE-PRINTER-NAME. OPEN OUTPUT PRINT-FILE. IF WS-PRINT-FILE-STATUS IS NOT EQUAL TO ZERO DISPLAY "T) CANNOT OPEN PRINT FILE, STATUS=", WS-PRINT-FILE-STATUS STOP RUN. MOVE "/ca/laserjet_113D" TO WS-NAME-FORMAT-FILE. OPEN INPUT FORMAT-FILE. IF WS-FORMAT-FILE-STATUS IS NOT EQUAL TO ZERO DISPLAY "T) CANNOT OPEN FORMAT FILE, STATUS=", WS-FORMAT-FILE-STATUS STOP RUN. 1010-OUTPUT-PCL-CODES. READ FORMAT-FILE NEXT RECORD AT END GO TO 1020-FORMAT-EOF. MOVE FORMAT-RECORD TO PR-BUFFER. WRITE PRINT-RECORD. GO TO 1010-OUTPUT-PCL-CODES. 1020-FORMAT-EOF. CLOSE FORMAT-FILE. */MYSQL INIT\ * * OPEN THE DATABASE * * BASE=information_schema * PASSWORD=mysqlpass MOVE "information_schema" & X"00" TO WS-MYSQL-BASE-NAME. MOVE "localhost" & X"00" TO WS-MYSQL-HOST-NAME. MOVE "mysql" & X"00" TO WS-MYSQL-IMPLEMENTATION. MOVE "mysqlpass" & X"00" TO WS-MYSQL-PASSWORD. MOVE "3306" & X"00" TO WS-MYSQL-PORT-NUMBER. MOVE "/var/run/mysqld/mysqld1.sock" & X"00" TO WS-MYSQL-SOCKET. PERFORM MYSQL-1000-OPEN THRU MYSQL-1090-EXIT. */MYSQL-END\ 031110 MOVE "select,insert,update,references" to WS-PRIVILEGES. 031110 MOVE "latin1" to WS-CHARACTER-SET-NAME. 1990-EXIT. EXIT. ************************************************************** * DETAIL SECTION * ************************************************************** 2000-PROCESS. MOVE 2000 TO WS-NO-PARAGRAPH. INITIALIZE WS-WHERE. STRING 'TABLE_SCHEMA="' FUNCTION TRIM (WS-NAME-DATA-BASE) '"' INTO WS-WHERE. */MYSQL SELECT\ * * SELECT ROWS * * TABLE=TABLES INITIALIZE WS-MYSQL-COMMAND. STRING "SELECT * FROM " "TABLES" " WHERE " WS-WHERE ";" X"00" INTO WS-MYSQL-COMMAND. PERFORM MYSQL-1210-COMMAND THRU MYSQL-1219-EXIT. PERFORM MYSQL-1220-STORE-RESULT THRU MYSQL-1239-EXIT. MOVE WS-MYSQL-RESULT TO TP-TABLES. */MYSQL-END\ IF WS-MYSQL-COUNT-ROWS IS GREATER THAN ZERO THEN NEXT SENTENCE ELSE DISPLAY "T) NO TABLES DEFINED IN " FUNCTION TRIM (WS-NAME-DATA-BASE) STOP RUN. 2010-FETCH-TABLES-LOOP. */MYSQL FETCH\ * * FETCH NEXT RECORD * * TABLE=TABLES MOVE TP-TABLES TO WS-MYSQL-RESULT. CALL "MySQL_fetch_record" USING WS-MYSQL-RESULT TB-TABLE-CATALOG TB-TABLE-SCHEMA TB-TABLE-NAME TB-TABLE-TYPE TB-ENGINE TB-VERSION TB-ROW-FORMAT TB-TABLE-ROWS TB-AVG-ROW-LENGTH TB-DATA-LENGTH TB-MAX-DATA-LENGTH TB-INDEX-LENGTH TB-DATA-FREE TB-AUTO-INCREMENT TB-CREATE-TIME TB-UPDATE-TIME TB-CHECK-TIME TB-TABLE-COLLATION TB-CHECKSUM TB-CREATE-OPTIONS TB-TABLE-COMMENT . */MYSQL-END\ IF RETURN-CODE IS EQUAL TO -1 THEN GO TO 9000-END-OF-PROGRAM. MOVE "Y" TO WS-SWITCH-TABLE. PERFORM 3100-HEADINGS THRU 3190-EXIT. PERFORM 3000-PRINT-LINE THRU 3090-EXIT. MOVE TB-TABLE-NAME TO PR-BUFFER. PERFORM 3000-PRINT-LINE THRU 3090-EXIT. MOVE "TABLE-TYPE" TO PR-BUFFER (16:10). MOVE TB-TABLE-TYPE TO PR-BUFFER (28:64). PERFORM 3000-PRINT-LINE THRU 3090-EXIT. MOVE "ENGINE" TO PR-BUFFER (20:6). MOVE TB-ENGINE TO PR-BUFFER (28:64). PERFORM 3000-PRINT-LINE THRU 3090-EXIT. MOVE "VERSION" TO PR-BUFFER (19:7). MOVE TB-VERSION TO WS-ED18S. MOVE WS-ED18S TO PR-BUFFER (28:24). PERFORM 3000-PRINT-LINE THRU 3090-EXIT. MOVE "ROW-FORMAT" TO PR-BUFFER (16:10). MOVE TB-ROW-FORMAT TO PR-BUFFER (28:10). PERFORM 3000-PRINT-LINE THRU 3090-EXIT. MOVE "TABLE-ROWS" TO PR-BUFFER (16:10) MOVE TB-TABLE-ROWS TO WS-ED18S. MOVE WS-ED18S TO PR-BUFFER (28:24). PERFORM 3000-PRINT-LINE THRU 3090-EXIT. MOVE "AVG-ROW-LENGTH" TO PR-BUFFER (12:14) MOVE TB-AVG-ROW-LENGTH TO WS-ED18S. MOVE WS-ED18S TO PR-BUFFER (28:24). PERFORM 3000-PRINT-LINE THRU 3090-EXIT. MOVE "DATA-LENGTH" TO PR-BUFFER (15:11) MOVE TB-DATA-LENGTH TO WS-ED18S. MOVE WS-ED18S TO PR-BUFFER (28:24). PERFORM 3000-PRINT-LINE THRU 3090-EXIT. MOVE "MAX-DATA-LENGTH" TO PR-BUFFER (11:15) MOVE TB-MAX-DATA-LENGTH TO WS-ED18S. MOVE WS-ED18S TO PR-BUFFER (28:24). PERFORM 3000-PRINT-LINE THRU 3090-EXIT. MOVE "INDEX-LENGTH" TO PR-BUFFER (14:12) MOVE TB-INDEX-LENGTH TO WS-ED18S. MOVE WS-ED18S TO PR-BUFFER (28:24). PERFORM 3000-PRINT-LINE THRU 3090-EXIT. MOVE "DATA-FREE" TO PR-BUFFER (15:9) MOVE TB-DATA-FREE TO WS-ED18S. MOVE WS-ED18S TO PR-BUFFER (28:24). PERFORM 3000-PRINT-LINE THRU 3090-EXIT. MOVE "AUTO-INCREMENT" TO PR-BUFFER (12:14) MOVE TB-AUTO-INCREMENT TO WS-ED18S. MOVE WS-ED18S TO PR-BUFFER (28:24). PERFORM 3000-PRINT-LINE THRU 3090-EXIT. MOVE "CREATE-TIME" TO PR-BUFFER (15:11). MOVE TB-CREATE-TIME TO PR-BUFFER (28:19). PERFORM 3000-PRINT-LINE THRU 3090-EXIT. MOVE "UPDATE-TIME" TO PR-BUFFER (15:11). MOVE TB-UPDATE-TIME TO PR-BUFFER (28:19). PERFORM 3000-PRINT-LINE THRU 3090-EXIT. MOVE "CHECK-TIME" TO PR-BUFFER (16:10). MOVE TB-CHECK-TIME TO PR-BUFFER (28:19). PERFORM 3000-PRINT-LINE THRU 3090-EXIT. MOVE "TABLE-COLLATION" TO PR-BUFFER (11:15). MOVE TB-TABLE-COLLATION TO PR-BUFFER (28:64). 031110 MOVE TB-TABLE-COLLATION TO WS-COLLATION-NAME. PERFORM 3000-PRINT-LINE THRU 3090-EXIT. MOVE "CHECKSUM" TO PR-BUFFER (18:8). MOVE TB-CHECKSUM TO WS-ED18S. MOVE WS-ED18S TO PR-BUFFER (28:24). PERFORM 3000-PRINT-LINE THRU 3090-EXIT. MOVE "CREATE-OPTIONS" TO PR-BUFFER (12:14). MOVE TB-CREATE-OPTIONS TO PR-BUFFER (28:100). PERFORM 3000-PRINT-LINE THRU 3090-EXIT. 031110 MOVE "DEFAULT CHARACTER SET NM" TO PR-BUFFER (2:24). 031110 MOVE WS-CHARACTER-SET-NAME TO PR-BUFFER (28:64). 031110 PERFORM 3000-PRINT-LINE THRU 3090-EXIT. 031110 MOVE "DEFAULT PRIVILEGES" TO PR-BUFFER (8:18). 031110 MOVE WS-PRIVILEGES TO PR-BUFFER (28:80). 031110 PERFORM 3000-PRINT-LINE THRU 3090-EXIT. MOVE "TABLE-COMMENT" TO PR-BUFFER (13:13). MOVE TB-TABLE-COMMENT TO PR-BUFFER (28:80). PERFORM 3000-PRINT-LINE THRU 3090-EXIT. INSPECT PR-BUFFER REPLACING ALL " " BY "*". PERFORM 3000-PRINT-LINE THRU 3090-EXIT. MOVE "N" TO WS-SWITCH-TABLE. INITIALIZE WS-WHERE. STRING 'TABLE_SCHEMA="' FUNCTION TRIM (WS-NAME-DATA-BASE) '" and TABLE_name="' FUNCTION TRIM (TB-TABLE-NAME) '"' INTO WS-WHERE. */MYSQL SELECT\ * * SELECT ROWS * * TABLE=COLUMNS INITIALIZE WS-MYSQL-COMMAND. STRING "SELECT * FROM " "COLUMNS" " WHERE " WS-WHERE ";" X"00" INTO WS-MYSQL-COMMAND. PERFORM MYSQL-1210-COMMAND THRU MYSQL-1219-EXIT. PERFORM MYSQL-1220-STORE-RESULT THRU MYSQL-1239-EXIT. MOVE WS-MYSQL-RESULT TO TP-COLUMNS. */MYSQL-END\ IF WS-MYSQL-COUNT-ROWS IS GREATER THAN ZERO THEN NEXT SENTENCE ELSE GO TO 2010-FETCH-TABLES-LOOP. INITIALIZE PR-BUFFER. MOVE "NULL" TO PR-BUFFER (51:4). MOVE "TYPE" TO PR-BUFFER (56:4). MOVE "SIZE" TO PR-BUFFER (67:4). MOVE "LEFT" TO PR-BUFFER (72:4). MOVE " RT" TO PR-BUFFER (77:4). MOVE "TYPE" TO PR-BUFFER (82:4). MOVE "KEY" TO PR-BUFFER (103:3). PERFORM 3000-PRINT-LINE THRU 3090-EXIT. 2110-FETCH-COLUMNS-LOOP. */MYSQL FETCH\ * * FETCH NEXT RECORD * * TABLE=COLUMNS MOVE TP-COLUMNS TO WS-MYSQL-RESULT. CALL "MySQL_fetch_record" USING WS-MYSQL-RESULT CB-TABLE-CATALOG CB-TABLE-SCHEMA CB-TABLE-NAME CB-COLUMN-NAME CB-ORDINAL-POSITION CB-COLUMN-DEFAULT CB-IS-NULLABLE CB-DATA-TYPE CB-CHARACTER-MAXIMUM-LENGTH CB-CHARACTER-OCTET-LENGTH CB-NUMERIC-PRECISION CB-NUMERIC-SCALE CB-CHARACTER-SET-NAME CB-COLLATION-NAME CB-COLUMN-TYPE CB-COLUMN-KEY CB-EXTRA CB-PRIVILEGES CB-COLUMN-COMMENT . */MYSQL-END\ IF RETURN-CODE IS EQUAL TO -1 THEN GO TO 2010-FETCH-TABLES-LOOP. INITIALIZE PR-BUFFER. PERFORM 3000-PRINT-LINE THRU 3090-EXIT. MOVE CB-COLUMN-NAME TO PR-BUFFER. MOVE CB-IS-NULLABLE TO PR-BUFFER (51:4). MOVE CB-DATA-TYPE TO PR-BUFFER (56:10). MOVE CB-CHARACTER-MAXIMUM-LENGTH TO WS-ED3S. MOVE WS-ED3S TO PR-BUFFER (67:4). SUBTRACT CB-NUMERIC-SCALE FROM CB-NUMERIC-PRECISION GIVING WS-J. MOVE WS-J TO WS-ED3S. MOVE WS-ED3S TO PR-BUFFER (72:4). MOVE CB-NUMERIC-SCALE TO WS-ED3S. MOVE WS-ED3S TO PR-BUFFER (77:4). MOVE CB-COLUMN-TYPE TO PR-BUFFER (82:20). MOVE CB-COLUMN-KEY TO PR-BUFFER (103:3). * MOVE CB-COLUMN-NAME TO WS-CA-COLUMN-NAME. MOVE CB-DATA-TYPE TO WS-CA-DATA-TYPE. MOVE CB-CHARACTER-MAXIMUM-LENGTH TO WS-CA-CHARACTER-MAXIMUM-LENGTH. MOVE CB-NUMERIC-PRECISION TO WS-CA-NUMERIC-PRECISION. MOVE CB-NUMERIC-SCALE TO WS-CA-NUMERIC-SCALE. MOVE SPACES TO WS-CA-PICTURE. * * NOW LET'S BUILD THE COBOL DATA DEFINITIONS FOR THE * TABLES AND COLUMNS * * DATE ITEMS DO NOT SHOW PRECISION IN THE SCHEMA EVALUATE WS-CA-DATA-TYPE WHEN "date" MOVE 10 TO WS-CA-CHARACTER-MAXIMUM-LENGTH WHEN "datetime" MOVE 19 TO WS-CA-CHARACTER-MAXIMUM-LENGTH WHEN "time" MOVE 10 TO WS-CA-CHARACTER-MAXIMUM-LENGTH WHEN "timestamp" MOVE 19 TO WS-CA-CHARACTER-MAXIMUM-LENGTH WHEN "year" MOVE 4 TO WS-CA-CHARACTER-MAXIMUM-LENGTH WHEN "bigint" MOVE 18 TO WS-CA-NUMERIC-PRECISION END-EVALUATE. * DECIMAL ITEMS NEED TO HAVE THEIR LENGTHS FIXED EVALUATE WS-CA-DATA-TYPE WHEN "dec" WHEN "decimal" SUBTRACT WS-CA-NUMERIC-SCALE FROM WS-CA-NUMERIC-PRECISION END-EVALUATE. EVALUATE WS-CA-DATA-TYPE WHEN "blob" WHEN "char" WHEN "date" WHEN "datetime" WHEN "mediumblob" WHEN "mediumtext" WHEN "text" WHEN "time" WHEN "timestamp" WHEN "tinyblob" WHEN "tinytext" WHEN "varchar" WHEN "year" MOVE WS-CA-CHARACTER-MAXIMUM-LENGTH TO WS-ED8 STRING "PIC X(" FUNCTION TRIM (WS-ED8) ")" INTO WS-CA-PICTURE WHEN "bigint" WHEN "decimal" WHEN "int" WHEN "integer" WHEN "mediumint" WHEN "numeric" WHEN "smallint" WHEN "tinyint" MOVE WS-CA-NUMERIC-PRECISION TO WS-ED2 MOVE WS-CA-NUMERIC-SCALE TO WS-ED2-SECOND MOVE "PIC S9(XX) COMP" TO WS-CA-PICTURE MOVE WS-ED2 TO WS-CA-PICTURE (8:2) IF WS-CA-NUMERIC-SCALE IS NOT EQUAL TO ZERO THEN MOVE "V9(XX) COMP" TO WS-CA-PICTURE (11:11) MOVE WS-ED2-SECOND TO WS-CA-PICTURE (14:2) END-IF WHEN OTHER DISPLAY "T) CANNOT HANDLE DATA TYPE FOR ", WS-CA-COLUMN-NAME STOP RUN END-EVALUATE. MOVE WS-CA-PICTURE TO PR-BUFFER (107:25). PERFORM 3000-PRINT-LINE THRU 3090-EXIT. IF CB-COLUMN-DEFAULT IS NOT EQUAL TO SPACES AND CB-COLUMN-DEFAULT (1:1) IS NOT LESS THAN SPACE THEN MOVE "COLUMN-DEFAULT" TO PR-BUFFER (40:14) MOVE CB-COLUMN-DEFAULT TO PR-BUFFER (60:70) PERFORM 3000-PRINT-LINE THRU 3090-EXIT. IF CB-CHARACTER-SET-NAME IS NOT EQUAL TO SPACES AND CB-CHARACTER-SET-NAME (1:1) IS NOT LESS THAN SPACE 031110 AND CB-CHARACTER-SET-NAME IS NOT EQUAL TO WS-CHARACTER-SET-NAME THEN MOVE "CHARACTER-SET-NAME" TO PR-BUFFER (36:18) MOVE CB-CHARACTER-SET-NAME TO PR-BUFFER (60:70) PERFORM 3000-PRINT-LINE THRU 3090-EXIT. IF CB-COLLATION-NAME IS NOT EQUAL TO SPACES AND CB-COLLATION-NAME (1:1) IS NOT LESS THAN SPACE 031110 AND CB-COLLATION-NAME IS NOT EQUAL TO WS-COLLATION-NAME THEN MOVE "COLLATION-NAME" TO PR-BUFFER (40:14) MOVE CB-COLLATION-NAME TO PR-BUFFER (60:70) PERFORM 3000-PRINT-LINE THRU 3090-EXIT. IF CB-EXTRA IS NOT EQUAL TO SPACES THEN MOVE "EXTRA" TO PR-BUFFER (49:5) MOVE CB-EXTRA TO PR-BUFFER (60:20) PERFORM 3000-PRINT-LINE THRU 3090-EXIT. IF CB-PRIVILEGES IS NOT EQUAL TO SPACES 031110 AND CB-PRIVILEGES IS NOT EQUAL TO WS-PRIVILEGES THEN MOVE "PRIVILEGES" TO PR-BUFFER (44:10) MOVE CB-PRIVILEGES TO PR-BUFFER (60:70) PERFORM 3000-PRINT-LINE THRU 3090-EXIT. IF CB-COLUMN-COMMENT IS NOT EQUAL TO SPACES THEN MOVE "COLUMN-COMMENT" TO PR-BUFFER (40:14) MOVE CB-COLUMN-COMMENT TO PR-BUFFER (60:70) PERFORM 3000-PRINT-LINE THRU 3090-EXIT. GO TO 2110-FETCH-COLUMNS-LOOP. * * PRINT A SINGLE LINE * 3000-PRINT-LINE. IF WS-LINE-COUNTER IS GREATER THAN 110 083011* THEN PERFORM 3100-HEADINGS THRU 3190-EXIT. 083011 THEN MOVE PR-BUFFER TO WS-PRINT-RECORD-HOLD 083011 PERFORM 3100-HEADINGS THRU 3190-EXIT 083011 MOVE WS-PRINT-RECORD-HOLD TO PR-BUFFER. WRITE PRINT-RECORD AFTER ADVANCING 1 LINE. ADD 1 TO WS-LINE-COUNTER. INITIALIZE PR-BUFFER. 3090-EXIT. EXIT. * * PAGE HEADINGS * 3100-HEADINGS. INITIALIZE WS-HEADING-BUFFER. ADD 1 TO WS-PAGE-NUMBER. MOVE WS-NAME-PROGRAM TO WS-HEADING-BUFFER. MOVE "--PAGE " TO WS-HEADING-BUFFER (16:7). MOVE WS-PAGE-NUMBER TO WS-ED3S. MOVE WS-ED3S TO WS-HEADING-BUFFER (23:4). MOVE WS-NAME-DATA-BASE TO WS-HEADING-BUFFER (50:32). ACCEPT WS-DATE FROM DATE. ACCEPT WS-TIME FROM TIME. STRING WS-DATE (3:2) "/" WS-DATE (5:2) "/" WS-DATE (1:2) INTO WS-HEADING-BUFFER (110:8). MOVE WS-TIME TO WS-ED-TIME. MOVE WS-ED-TIME (1:8) TO WS-HEADING-BUFFER (120:8). INSPECT WS-HEADING-BUFFER (120:8) REPLACING ALL " " BY ":". IF WS-PAGE-NUMBER IS EQUAL TO 1 THEN WRITE PRINT-RECORD FROM WS-HEADING-BUFFER ELSE WRITE PRINT-RECORD FROM WS-HEADING-BUFFER AFTER ADVANCING PAGE. MOVE SPACES TO WS-HEADING-BUFFER. WRITE PRINT-RECORD FROM WS-HEADING-BUFFER AFTER ADVANCING 2 LINES. MOVE 5 TO WS-LINE-COUNTER. IF WS-SWITCH-TABLE IS EQUAL TO "N" THEN MOVE "NULL" TO PR-BUFFER (51:4) MOVE "TYPE" TO PR-BUFFER (56:4) MOVE "SIZE" TO PR-BUFFER (67:4) MOVE "LEFT" TO PR-BUFFER (72:4) MOVE " RT" TO PR-BUFFER (77:4) MOVE "TYPE" TO PR-BUFFER (82:4) MOVE "KEY" TO PR-BUFFER (103:3) PERFORM 3000-PRINT-LINE THRU 3090-EXIT PERFORM 3000-PRINT-LINE THRU 3090-EXIT. 3190-EXIT. EXIT. * * END OF JOB * 7990-EXIT. EXIT. **************************************************************** * TERMINATION * **************************************************************** 9000-END-OF-PROGRAM. MOVE 9000 TO WS-NO-PARAGRAPH. CLOSE PRINT-FILE. INITIALIZE WS-PRINT-COMMAND. STRING "lp -d " DELIMITED BY SIZE, WS-LINE-PRINTER-NAME DELIMITED BY SIZE, "-o raw " DELIMITED BY SIZE, WS-NAME-PRINT-FILE DELIMITED BY SIZE INTO WS-PRINT-COMMAND. CALL "SYSTEM" USING WS-PRINT-COMMAND. */MYSQL CLOSE\ * * CLOSE THE DATABASE * PERFORM MYSQL-1980-CLOSE THRU MYSQL-1999-EXIT. DISPLAY "I) " WS-NAME-PROGRAM " COMPLETED NORMALLY AT--" FUNCTION CURRENT-DATE. STOP RUN. 9990-EXIT. EXIT. * */MYSQL PRO\ COPY MYSQL-PROCEDURES. */MYSQL-END\ [/code] We have a tiny data base named "presql" that we use for testing. It has two tables (table_one and table_two). table_one has columns for each of the data types that we have chosen to work with. table_two exists primarily for testing. The output from the schema printer for the database "presql" is listed below: [code] schema 001--PAGE 1 presql 12/05/13 12:33:19 table_one TABLE-TYPE BASE TABLE ENGINE InnoDB VERSION 10 ROW-FORMAT Compact TABLE-ROWS 3 AVG-ROW-LENGTH 5,461 DATA-LENGTH 16,384 MAX-DATA-LENGTH 0 INDEX-LENGTH 0 DATA-FREE 0 AUTO-INCREMENT 0 CREATE-TIME 2010-01-31 13:48:44 UPDATE-TIME CHECK-TIME TABLE-COLLATION latin1_swedish_ci CHECKSUM 0 CREATE-OPTIONS TABLE-COMMENT InnoDB free: 850944 kB ************************************************************************************************************************************ NULL TYPE SIZE LEFT RT TYPE KEY fbigint NO bigint 19 bigint(20) PRI PIC S9(18) COMP PRIVILEGES select,insert,update,references fchar NO char 1 char(1) PIC X(1) CHARACTER-SET-NAME latin1 COLLATION-NAME latin1_swedish_ci PRIVILEGES select,insert,update,references fdate NO date date PIC X(10) PRIVILEGES select,insert,update,references fdatetime NO datetime datetime PIC X(19) PRIVILEGES select,insert,update,references fdec NO decimal 5 2 decimal(7,2) PIC S9(05)V9(02) COMP PRIVILEGES select,insert,update,references fdecimal NO decimal 5 2 decimal(7,2) PIC S9(05)V9(02) COMP PRIVILEGES select,insert,update,references fint NO int 10 int(10) PIC S9(10) COMP PRIVILEGES select,insert,update,references finteger NO int 10 int(11) PIC S9(10) COMP PRIVILEGES select,insert,update,references fmediumint NO mediumint 7 mediumint(9) PIC S9(07) COMP PRIVILEGES select,insert,update,references fnumeric NO decimal 6 2 decimal(8,2) PIC S9(06)V9(02) COMP PRIVILEGES select,insert,update,references fsmallint NO smallint 5 smallint(5) PIC S9(05) COMP PRIVILEGES select,insert,update,references ftime NO time time PIC X(10) PRIVILEGES select,insert,update,references ftimestamp NO timestamp timestamp PIC X(19) COLUMN-DEFAULT CURRENT_TIMESTAMP PRIVILEGES select,insert,update,references ftinyblob NO tinyblob 255 tinyblob PIC X(255) PRIVILEGES select,insert,update,references ftinyint NO tinyint 3 tinyint(3) PIC S9(03) COMP PRIVILEGES select,insert,update,references ftinytext NO tinytext 255 tinytext PIC X(255) CHARACTER-SET-NAME latin1 COLLATION-NAME latin1_swedish_ci PRIVILEGES select,insert,update,references fvarchar NO varchar 45 varchar(45) PIC X(45) CHARACTER-SET-NAME latin1 COLLATION-NAME latin1_swedish_ci PRIVILEGES select,insert,update,references schema 001--PAGE 2 presql 12/05/13 12:33:19 table_two TABLE-TYPE BASE TABLE ENGINE InnoDB VERSION 10 ROW-FORMAT Compact TABLE-ROWS 0 AVG-ROW-LENGTH 0 DATA-LENGTH 16,384 MAX-DATA-LENGTH 0 INDEX-LENGTH 0 DATA-FREE 0 AUTO-INCREMENT 0 CREATE-TIME 2010-01-25 11:51:04 UPDATE-TIME CHECK-TIME TABLE-COLLATION latin1_swedish_ci CHECKSUM 0 CREATE-OPTIONS TABLE-COMMENT InnoDB free: 850944 kB ************************************************************************************************************************************ NULL TYPE SIZE LEFT RT TYPE KEY int NO int 10 int(11) PIC S9(10) COMP PRIVILEGES select,insert,update,references [/code] MySQL has some utility programs that for us are more convenient than command line execution. The URL is listed below in case you do not have these yet: http://dev.mysql.com/downloads/gui-tools/5.0.html Good luck! jimc ---------------------------------------------------------------- Thanks jimc for posting your schema printer. After thinking a long time about it, i decided, that my precompiler should work without any connection to any database, just stand alone, and a schema printer, a copy bopk generator should be a single program on it's own. The precompiler should use such an import from a table layout/copybook printer, so the precompiler should work even when the database server is down and should use pre-generated copybooks, and not use copybooks generated at runtime of the precompiler. With my experience programming COBOL for a longer time, it is always a good idea, to keep things seperated, so they, like a precompiler, even work, when something, like a database server, is down. :) More to come later, here is the latest update of my blog: http://pipersopencoboltoolbox.blogspot.de/2012/06/short-update-since-i-have-been-quite.html ---------------------------------------------------------------- @ the_piper. I fully agree with you. Not all sources in a cobol suite of programs need sql connection. A couple of compiling shells (one with sql connector inclusion and one without) would do all. Having a separate module to include at compilation time for sql needings gives much more flexibility, including "sql interface module"'s maintenance. I as well have been working on the matter in past months. I succeded in interfacing mysql except for rows with several fields (OC 1.1 limit?). I can send you the "mysqlconnector" c source I used, if you wish. I prepared, some months ago, a few cobol modules for decimal point conversion (Europe). If you think they might be useful, please let me know. marcellom ---------------------------------------------------------------- Thanks, MarcelloM, for sharing your thoughts. It would be interesting to have a look at your mysqlconnector.c, of course, i am always interested in other/better solutions than mine, just to get some more ideas :) Same with the COBOL modules for decimal point conversion, might be useful, when i will start to process HTML pages with a small HTTP-Server and users can choose, which number format they would like to use. I would be happy, if you could post a link to the source code here, or the full sorce code, if it is not too big for a forum post. ---------------------------------------------------------------- @ The_piper Hi, I will have some time available in my august holidays and am willing to work on the matter. I will, as well, test you addings. Just a question: do you as well have problems in fetching rows with several field? If not, how did you get rid of the problem? Cheers, Marcellom ---------------------------------------------------------------- Hi Marcello, so you forced me to post the source code of the actual development state of dbpre. Well, have fun with it :D http://pipersopencoboltoolbox.blogspot.de/ Any comments or questions are welcome, post here or post a comment in my blog and i will try to help. About rows with multiple fields, no problems encountered right now. Have a look at the generated *.cob or *.lst file by dbpre to see, how i handled fetching rows with multiple fields. Right now it seems to work. If you have any problems or questions, feel free to contact me :) And enjoy your holidays and don't spend all the time in front of your computer ;) Piper ---------------------------------------------------------------- @ The_piper Thanks. I'll let you know. Marcellom ---------------------------------------------------------------- Subject: Information needed on new program supporting source code COPY statements I am rewriting Jim Currey's prtcbl program to support COPY REPLACING clauses so that programmers can have full listing (or an updated source file) that contains all expanded copy clauses along with all comments which OC does not do (at least with comments in a clean layout). This make use of COB_READ_FILE instead of the standard file/s using select, FD open, read close etc by creating and reading from buffers instead. This helps with the copy depth level issues (for more on this, see later on). One of the major issues is for literal replacements where the literal "abcd" can be up to a large limit that exceeds one source line. In the latest Cobol standard manual it states that a literal can be up to 65,536 characters which a large number and personally have had no experience of literals which have to be replaced let alone long ones. Does anyone have any examples of such when using OC? and if so can they provide me with such both as the source file having the copy statement as well as the copy book/s. Is anyone making use of the Leading, Trailing sub clauses and any personal experience of using more than two depths of copy in OC v1.1 (Feb 09) or later? To follow on, the new prtcbl program allows up to a 99 level depth of copy statements. That is a copy book calling another copy book up to 99 times and of course NOT the same copy book. My version checks for that and throws up an error if it see it. Any help here would be appreciated and anyone with such examples of any size of literals going over one line can send me such to vbcoen at gmail dot com with a subject line starting 'Prtcbl'. One idea is to convert any fixed format copy books that are being replaced, to free format but that only covers up to 256 character lines. Any thoughts on that and more importantly any objections? In the meanwhile the latest current version of Prtcbl is available on my website at www.applewoodbbs.mine.nu/prtcbl-latest.zip which has v1.01.9B. This is a reasonably major upgrade from the original version that was listed in the forums some time back. You can also get it via anonymous ftp using applewoodbbs.mine.nu directory: pub but don't forget to issue 'bin' before the 'GET'. Updated versions will also be there under the same name. ---------------------------------------------------------------- @vbcoen re: COPY expansion in "fixed" format My understanding is that any COPY REPLACING command that results in a COBOL statement wider than the "fixed" allowable is not allowed. I never saw a compiler break such statements into multiple lines. Keep up the good work. jimc ---------------------------------------------------------------- A break from the compiler will surely not be done, where it's missing in the source. But if you use stuff like [code]COPY PROGSKEL REPLACING ==place holder== by == DISPLAY 'I write a whole program' END-DISPLAY DISPLAY 'and therefore multiple lines' END-DISPLAY DISPLAY 'in a COPY statement.' END-DISPLAY CONTINUE. bye SECTION. DISPLAY 'This isn't fun for parsers...' END-DISPLAY DISPLAY 'Bye.' END-DISPLAY ==.[/code] you CAN (not should) reach 65,536 characters. human ---------------------------------------------------------------- Nope, 'copy' can go over into free format sizing on 'replacing' according to the Standards manual and that is the problem. OC cheats by the fact that all code is 1st preparsed and converted to free format, removing all comments and all multi spaces also converting to just one space (not literals) as you can see when generating a .i file using any of the various params. When listing eg, creating a .lst file via the -P (after v1.1 Feb 09) or -t below, it is in the same format as supplied. It is obviously building an intermediate file or table to do so. Another problem that prtcbl has, is that it looks for a 'COPY' in all lines from cc1 to the end column and therefore will pick up any example (other than after a comment (floating *> or * in cc7) of ' copy ' where ever it is, including: display "I will now copy the data to fred". Pick up the word copy and try and process the next word as the file name then print '***COPY FILE NOT FOUND***' or words to that effect. This has been found when running the new version through the old one. This problem is still present and I will have to see if there is a simple solution without having to see if a reserved word precedes COPY and ignore it! That said, you can do such as in WS: 01 fred copy foo. or 01 copy foo. Hopefully if COPY is in Procedure Div it starts as 1st word (need to check manual again and no not Gary's one, as he is using the 74/85 syntax only). Both go back to old standards (74) and I have not seen anything to say that has changed. Turned something I thought was going to be straight forward into another ball game!! Now the standard (2009+) says that you can have a literal up to 65.535 chars which is ridiculous but for the moment I will support only lits that start and end on same line and see what problems that produces. Hopefully I will have worked out a way of going it by then !! Another point; the standard mentions that copy is to a depth of five so I have changed the new version to only process source file and nine copy books open at the same time, eg depth of 9. I have no idea what OC does. Onwards and up as they say :) Vince ---------------------------------------------------------------- One small point for everyone, ALL COPY statements MUST end with '.' (the period). There is no 'end-copy', but on your point yes that is exactly what can happen. Grabbing the replacing elements is not a problem in that example as the copy statement is transferred to a one line buffer ( of 1 MB) then broken down into individual replacing elements as source and target of (currently 2 kB). Still have to work out how to process the source code being replaced when its over one or more lines as a literal. Coming to think about it not too fond of your example either :) ---------------------------------------------------------------- As a follow on from prev. msgs: A new version is now available 2.01.x as latest (or will be by 18:00 UTC+1). This version supports: COPY foo|foo.ext|"foo"|"foo.ext" IN|OF path|"path" SUPPRESS | SUPPRESS PRINTING. next is to add replacing clause. As no one has said what kind of literal sizing they use I will have to 'Assume' !! Now the Cobol specification states that processing of replacing is done as part of free format and that appears to be the only way to cater for long line literals and even then its a 'royal pain'. For your info all processing by compilers is that all fixed format is converted to free prior to processing and I cannot see any other way for this program. This means that files that are copied are converted to free format also for printing so that I have to create a >>SOURCE FREE statement preceding each then convert them if a REPLACING clause is connected to the COPY statement. This may look a bit odd for some, however a small benefit will be for those users that want to do a conversion to free format, can then use prtcbl to rebuild a new source file that includes all included copy files as a new free form using the *>NOPRINT | **NOPRINT command which only create a source file and not a report. I still need programmers to let me know just how long their literals are that they 'replace' and not to a character, ie say within 10 chars and if they go over one line etc, as of now I have not had any response to previous request. Any input in this matter would be of help. One lazy idea is just to use INSPECT REPLACING but I don't think it will deal with source and targets of differing lengths but it would make it a lot easier to program and yes I am aware of the spec but OC may not enforce it :) ---------------------------------------------------------------- Vincent, I have not been ignoring you. In our case we do not use REPLACING except on rare occasions, so I felt my input would not be appropriate. Keep up the good work! jimc ---------------------------------------------------------------- Just a short info - as you wrote, an INSPECT REPLACING won't work as it requires same lengths. With OC you have the easy way with it's unique [url=http://opencobol.add1tocobol.com/#function-substitute]FUNCTION SUBSTITUTE[/url], just feed it with every params of your parsing from COPY REPLACING statements. For my own use I think I've had pairs of COPY REPLACING with one side having 28 chars (never used multi lines). I suggest one (extra) command line option to the new prtcbl: --fixed enforce fixed format The reason for that is simple: many (most) programs are only coded in fixed format and a fixed output of prtcbl is nice (you perhaps could even say "necessary for being used") in that case. human ---------------------------------------------------------------- Yep, that looks like it will help, however there is still a problem, and that is if a programmer has literals going over one line. This is where my previous comments come into play. By stitching the literals together prior to modding I have to create free form line/s to compare etc, eg, like for like and this is where the issue is. If all programmers keep to literals on one line both original and within the copy statement is would be easy. Cobol compilers get around this by converting all to free format removing excessive spaces before comparing and then parsing post compile. This is great for them but I have to print out the resultant code as against just processing it. Just look at the output from OC via the .i file. I can for the moment assume that everyone will stick to one literal per line with no overflow. But its one heck of an assumption !! The only gain I have as that as I now use a large buffer for the source (of 1 MB) and grab one record at a time, I can parse through it if I really need too, but even that has its problems. Any suggestions are very welcome. ---------------------------------------------------------------- Vincent, It takes a few days of letting the eyes focus on the details, the haze daze, but all you ever need to know about COBOL pre processing is in [b]cobc/pplex.l[/b], and [b]cobc/scanner.l[/b] (dot ell). After zoning out on all the regex and support details, eventually look through usage of [b]continuation[/b]. Other details could give you a good guess at sizings. I have no idea if that'll help or not, just sayin'. It [i]might[/i] even be worth while taking a stab at linking directly to your local copy of pplex.c and ppinput, let the compiler lexer do some of the weird work. Cheers, Brian ---------------------------------------------------------------- I think human has a great point. While we wanted to keep prtcbl from being a syntax checker it does make sense that it could warn us about lines that violate the "fixed format" width. jimc ---------------------------------------------------------------- To the "assumption" that nobody uses more than one line in COPY REPLACING: I suggest to do a simple check on the buffers for COPY REPLACING, just do an INSPECT buffer with TALLYING for x'0A' and x'0D' - if one of them is in, quit with an error message. If the problem is the missing end of the copy (because you read the file LINE SEQUENTIAL instead of SEQUENTIAL), you can exit with an error quite easy, too. human ---------------------------------------------------------------- Should there be any doubt, a "Standard conforming" compiler [i][b]must[/b][/i] accept X'0A" and X'0D" within an alphanumeric literal when compiling in fixed form reference format. ALL characters within the computer's alphanumeric character repertoire are valid within alphanumeric literals - in fixed form reference format. In FREE form reference format, the implemewntor may restrict some characters. ---------------------------------------------------------------- Your idea of enforcing fixed etc as the result of the copy phase is out of keeping with the behavior of OC or any other compiler. It is the responsibility of the programmer to ensure that the result of a copy replacing clause on a fixed format source file does not exceed the limits imposed eg, going over cc 72. This might be a useful test on OC to see what it does but I have a feeling that it follows the above logic. I am going to try and use the Function SUBSTITUTE but have a nasty idea that it will not copy buffer 1 (pic x(1M) to buffer 2 (1M) [where 1M = 1048576 or 1024 occurs 1024] and substitute matching char strings but still copy over the others that are NOT matched and if it does not then I am struggling to see how it will help! I am beginning to wish I had not started this !! Doing this in Cobol, it just is not the right tool. .. but I will continue at least in the kiss method as a starter, eg, using simple replacements with literal always on one line. Like most, I have never replaced anything that goes over a line, coming to think about it I have never replaced literals, what ho!! PS. This system is NOT notifying me of new posts for this thread, another element that does not work ---------------------------------------------------------------- ok, found out why its not notifying me of new posts, did'nt change settings to tell me by email !! ---------------------------------------------------------------- I have now finished testing and loaded up for all to access the current version of printcbl (2.01.06) which seems to support the full set of COPY clauses with some exceptions. Leading and Trailing is accepted but ignored when replacing due to usage of substitute that is doing the 'replacing' all other sub-clauses of copy are implemented including SUPPRESS but not ALSO as it is not in OC (Mind you I am not too sure of what its really useful for!). Literals are processed one line at a time for the moment both for source (in COPY) and target in copy libs. It has passed both OC regression tests along with mine (included in archive with manual and changelog). Let me know how you get on with it but do read the manual first as you do have to make 2-3 mods before compiling. You can download it at: http://applewoodbbs.mine.nu/files/Cobol-Dev/printcbl-latest.zip or by anonymous ftp: applewoodbbs.mine.nu and cd to pub/Cobol-Dev for the file printcbl-latest.zip This is now a new installation of Mandriva 2011 pwd x64 so please let me know if you have any problems via direct mail to vbcoen at gmail.com Thanks. ---------------------------------------------------------------- Vincent If we can work this out the details of permissions and source tree layout with human, would you mind posting this up on SourceForge under the OpenCOBOL sources, SVN, something akin to [code] svn co https://open-cobol.svn.sourceforge.net/svnroot/open-cobol/community/printcbl printcbl [/code] ?? human? You think we should add to the source tree? Cheers, Brian ---------------------------------------------------------------- Brian; Nope I have no problems with that. I have already given in a similar way the code for Dectrans, cobxref etc to Arthur? so it should not be an issue providing it's easy for me to modify the files as eg, I have made two sets of changes over the last day alone to remedy minor issues. I assume it wil be a reposity for all to get the latest versions of OC and various tools, etc. Are you creating some forums and bug reporting on site to cover feedback from users? Vincent. ---------------------------------------------------------------- We *could* add it to the svn repo, but as it is an own project (as long as it doesn't use/depend on OC-parts) it may would be better placed in an own project/repo? SVN write access can be easily achieved (by being added to the opencobol-project, which can be done by me), finer access (only to /extras for example) cannot be done at SF yet, but I don't think it's a problem as every user must be added first, all changes can be simply reverted (it's a version control management system) and users can be warned/banned if they're writing to the wrong paths. What do you think about adding code like this to the OC repo? How many new directories do we need and for what (what was the exact description to /extras?)? And Vincent has a good point - we should either set up a new hosted app (like MantisBT) and add the community stuff there or add new categories to the main bug/feature tracker. human ---------------------------------------------------------------- Moving to [url=www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1484&forum=1]Things at SourceForge[/url] Cheers, Brian ---------------------------------------------------------------- Subject: Function keys problem solved, not an oc issue. TERM=vt100 does not work for function keys F-5 and above. After some experimenting, I found that TERM=xterm works the best. TERM=konsole works ok, but has a strange flicker problem at times. So I use TERM=xterm. I'm running Suse linux, with a KDE konsole window as a terminal. To use this, type the following in your window: TERM=xterm export TERM It doesn't need to recompile oc or any programs. It turns out that the vt100 emulator handles F-1 through F-4 differently than it does for F-5 and above. Seems that the old VT52 (or some such) only had four F keys. When they came out with the VT100 they added the rest. But the added keys use a different escape sequence than the first 4 F keys. Looking at screenio.c, it can already handle up to 64 F keys, with Ctrl Alt and Shift combinations. If the os will pass them through. I'm good with the 12 I get. Plus the up and down arrows, page up and down, home, and end keys. I've enhanced screenio.c and screenio.cpy to return the tab key as 2007 and the back tab key as 2008, for the extended Accept statement. I don't think the changes apply to the screen section Accept, and I did not test the screen section at all. I believe the screen section uses the tab keys internally to hop between fields. I need the same functionality with the extended Accept statements. Does anybody want a copy of my changes? I'm giving them under the oc GNU lesser license to the oc community. No warranty of any kind, etc... We need testers to test a) it does not mess up the screen section accepts b) numeric fields still work (I accept all fields alphanumeric and do my own numeric validations) c) secure fields (passcode prompts I don't use) d) MS windows (I don't use) e) other platforms (VAX, etc) f) any other tests that can be thought up Also, the user guide needs to be updated. Let me know if I can change this, or to whom to send the changes. ---------------------------------------------------------------- Yes, OC does a good job and yes, all OSes can give you something to do... Good to hear that your problems went away. I'm a little bit confused about your changes: - If it's only about tab/back tab keys as 2007/2008 there should be only some lines changed. - Why do you want to retest everything (that mainly hasn't to do with the necessary changes)? Just some hints: the SCREEN stuff is in complete different functions, therefore it should not cause strange behaviour. Please post patch files (I guess you've patched the feb09 version). About your original problem: Wouldn't it be useful if OC checks the current term settings and internally translates the key codes? If yes, I guess you could come up with a patch for that, do you? human ---------------------------------------------------------------- Here's the reason why I want to run many different tests. I wrote my first Cobol program in 1973, so I've been doing this a while. I've seen seemingly trivial changes that "don't need to be tested much" blow up in my face when they shipped. I worked at a software house with 3,000 customers. When that happened it was embarrassment X 3,000. I've learned to never trust software until q/a has tested it and signed off. Even then, almost all software contracts say "no warranty of any kind..." for a good reason. Plus I'm a newbe at how oc does things. It's good to know that the accept field routine is separate from the screen section. I'd still let everyone know that the screen section isn't tested, just to keep it in the open. Let them decide what that means. It would be nice if oc would interrogate the TERM= settings and handle the input stream for any and all. Especially because newbies often quit when something like that causes them grief. It's terribly frustrating when they want it to run right out of the box and they don't know where to turn. But I have a feeling that it would be a major task. What I have now works, and makes me happy. Maybe we can put it on the to-do list for a later project. Right now, I'd like to put in some other enhancements. For one, the End key should go to the last non-blank, instead of to the end of the field. And I'd like to see the Insert and Delete keys added, with full functionality like it does in Libre Office. I think I'm fixing to dive into the oc pool and start coding like a code monkey. I'll post the files in a few days. Maybe with some more enhancements added. ---------------------------------------------------------------- mrcool; OpenCOBOL can always use more [b]$ make check[/b] tests. We can talk about format for autotest if you'd like. If your patch files get distribution, all builds of OpenCOBOL will get tested along with them. For stree testing an OpenCOBOL modification...this is for anyone reading along that likes to experiment. [code] $ ./configure --enable-debug $ make $ make check $ cd tests/cobol85 $# Download the test archive `newcob.val.Z' from $# http://www.itl.nist.gov/div897/ctg/cobol_form.htm $# Uncompress it: $# uncompress newcob.val.Z $# $# Now with newcob.val (The NIST COBOL 85 testsuite) in tests/cobol85 $ make test $# make coffee...9000 stress tests of overly convoluted, made to break compiler edge cases source code. [/code] Then, all being well and a happy make install and ldconfig. [code] $# just to see that cobc doesn't have any holes poked in it $ valgrind cobc -x sample.cob $ $ cobc -x -g -debug -W sample.cob $ valgrind sample [/code] That'll do a world class job of testing for leaks in compiled code. [i]Trivia: It's Viking ... val grinned, not grind.[/i] Valgrind is nice tool. [i]Yayy vikings[/i]. Now back to the practical side. [i]Information below about the hardships of testing curses keyscans is belief and not rigorous research; happy to be corrected.[/i] Testing the ins and outs of ncurses, pdcurses, curses can be tricky. DejaGNU might work, but emulating keyscans is more approximate than reliably accurate. CUnit tests have an interactive curses mode that lets the user do the typing. If need be, DejaGNU is supported by the autotools in use by OC 1.1 and it probably won't be overly heinous adding it to Makefile.am. Likely more heinous getting any test tool to interact with screen io (in terms of keyscan) with confidence. Looking forward mrcool. From what I'm led to believe, numeric validation of key input is simply someone sitting down and writing the picture editor in C. Not a small task, but more grunt than wizardry. [i]This may get easier once the community gets a collaboration site up and running. Taking wayyy too long now. I'd like to get the nod to open the 1.1pre-rel on SourceForge. Pending.[/i] Cheers, Brian ---------------------------------------------------------------- Yes, automated testing of software is the best thing that's happened to software development since the invention of the keyboard and they got rid of those card readers. Push a button, everything is retested. Nice. It would be great if we can get these changes into the test suite. When I get something in, let's consider it further. Oc does rudimentary numeric validation in extended Accept statements. Digits from '0' to '9' only, from what I can tell. So there's no check for '+' plus sign, '-' minus sign, or '.' decimal point. Then it would get into that whole discussion about how to handle swapped comma and decimal points in Europe. And the dollar sign, pound sign, yen sign, etc... all over the world. I don't think there's a compiler vendor in any language that can come up with a good industry standard about how to handle numerics. I'd advise all developers out there to accept all numeric fields as alphanumeric and do your own numeric validations. That way it won't change when there's a change in compiler vendors. If your Cobol programs are successful with oc, it may be worth your while to buy a compiler on another platform and sell them there. I've changed Cobol compiler vendors so many times I can't even count. So what I'm saying is that oc should probably stay like it is. (I'll get off my soapbox now.) I vote that the 1.1 pre-release should be put on SourceForge as a final release now. It's stable enough. Don't wait for my changes. ---------------------------------------------------------------- Subject: Latest fixes ? Where? Sorry if this is a FAQ, but I couldn't find it in the documentation or FAQ. Back in 2008/2009 I was looking at a conversion of a software product to OpenCOBOL from Server Express. Quite a big project, in the region of 90 million source lines, 6000 source members. Anyway I reported some problems through the mailing list (can't find them now), probably in late 2008 or early 2009 primarily to do with the handling of nested sub programs in OpenCOBOL. There was an issue with nested sub program naming, where the incorrect nested sub was being called, and big problems with GLOBAL storage in nested subs. Indications were at the time that these would be fixed, but the only downloads I can find for OC are from 2007, so this isn't going to contain any fixes for these. Is there a place I can get the latest source from? I seem to remember way back in the distant that I had some URL or other to get a tarball from somewhere else (Roger's server?), but I can't remember where that was either now! Interest is re-starting in this project again now, but it's going to be a none starter if these issues remain unresovled. Thanks! (edit) I realise I last asked this question 9 months ago, so I guess nothing has changed. The reply was back then that my problem reports are fixed, but that I can't have the source. And I imagine that's still the case. Hope not. Please :) ---------------------------------------------------------------- Here is the linkt to [url=http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1372&forum=1#forumpost6999]your original post and my answer[/url]. I'd like to tell you that there is a new public release, but I can't. The last release was published feb-09 and you can download it from the downloads area (ignore the 2007 title, after downloading you see the correct date in the tarball). But as I wrote before, the error you posted in 2009 (with good samples) was fixed a long time ago. You MAY want to check builds from an unofficial version (not supported at all and could be risky if used for production). Sergey uploaded some at [url=http://www.kiska.net/opencobol/1.1/]http://www.kiska.net/opencobol/1.1/[/url], you can have a look if there is a binary that matches your system(s) and if yes, can try if the problem is fixed there. The only one knowing when OpenCOBOL 2.0 sees the public light is Roger... human ---------------------------------------------------------------- And as far as I can tell no-one knows how to contact Roger. (see my recent note on this topic) ---------------------------------------------------------------- Subject: cics on opencobol something I would like to show what I can do with opencobol and thank you opencobol for giving me this great compiler. please let me know what you think. http://www.facebook.com/note.php?note_id=120015894799373 For I am a cobol programmer working in Bangkok, Thailand, so please excuse my english skill. First of all, I dreamt about working at home, so I want to have my own mainframe environment. So I searched the internet and found OPENCOBOL is the best compiler that meet most of my need. From OPENCOBOL, I tried to migrate source code from Mainframe to my PC. What I have to migrate. 1. JCL and batch programs 2. MAP and CICS programs For JCL, I wasted my time translating manually for a while before I couldn't resist myself to write my own program to translate JCL to batch command. Most of translating is done automatically, but I have to do some little manual adjusting however JCL to batch automation save me a lot of time. For 1 day Task of manaully adjusting JCL, without automation, I believe I need like one week for the same JCL. For batch program, I need to translate something also for example putting EIB feature in it. And return code handling, to make the program works well with batch command that simulates the COND in JCL. For MAP, I also write my own program to generate the copybook and the MAPIO to be used with my CICS simulator. For online program, this is the most difficult part as there are many CICS command I have to translate. And the devil is all about memory handling. For assembler programs, I still cannot find any compiler that can generate a com or exe like OPENCOBOL does. So no choice, I have to rewrite them in COBOL. Thank goodness there are not many of them. So the program that do the translation look like this. and the CICS simulator I use source codes at work to test my WDCICS. And it works pretty well. See it in http://www.facebook.com/video/video.php?v=120071701460459 Now I run the batch. If I turn off instant output display, batch will run very much faster than this. Also if I have a better machine. ( I am currently using ASUS 1210 AMD net book. ) After batch finished, there will be a lot of reports showing up for this application. See it in http://www.facebook.com/video/video.php?v=120082088126087 and I can check the result after batch on WDCICS again just like real mainframe. See it in http://www.facebook.com/video/video.php?v=120086661458963 So now theory I can work at home as I dreamt off but in the real world, no company will allow you to work at home. So all of this is like my own toy to myself....... NOTES: If it's not right or against the law to post this video up, please let me know and I will remove it asap. ---------------------------------------------------------------- Assembler code differs from compiler to compiler, but as OC always uses a C-compiler and most (all) C-compilers can handle assembler code it could be useful to put the assembler sources into a C function, compile it using cobc and call this in a COBOL program (which can be compiled as an exe). human ---------------------------------------------------------------- I am NOT recommending a "switch" from OpenCOBOL, but if anyone is interested in a portable, FREE, combination of (IBM mainframe compatible) COBOL IBM Assembler CICS you should at least look at zCOBOL, z390, and zCICS i.e. [url=http://www.z390.org/]http://www.z390.org/[/url] and [url=http://www.z390.org/zcobol/]http://www.z390.org/zcobol/[/url] Last time I checked, most but NOT ALL of the COBOL compiler was "working" (to produce actual executable code) ---------------------------------------------------------------- Thank you for your comment . :-D years ago, I tested many enterprise applications by installing them to my laptop. (I might be jailed for unauthorized use but I couldnt resist my eager to know). I used to parallel run two systems (mainframe and my laptop) and compare the results between them and found out that a company invests millions of dollar on mainframe which only a hundred dollar laptop can also handle the same task. Cost of running a program on mainframe is also very much higher. But ofcourse noone wants to put one's head to guarantee the result so I better keep my mouth shut and let them keep going with the expensive route. ---------------------------------------------------------------- IBM is giving away for free a Cobol compiler that produces IBM mainframe executables (as well as Java and PC executables). They're no fool. By increasing the number of software packages that run on the mainframe, they increase the value of the mainframes they sell. They also know there's millions (billions?) of Cobol programs out there. For us, that means we don't have to buy time on a mainframe to port our software to it. Compile it on a PC and then sell or give away the executables for use on the mainframe. We're happy. Customers are happy. IBM is happy. People keep saying that Cobol is dead. Cobol just ran another lap around the 100 meter track. Dead? If a tree does NOT fall over, but everybody hears it, does it still fall over? ---------------------------------------------------------------- Subject: single character display Running a program compiled with: cobc --version cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Jun 07 2009 06:00:30 Packaged Feb 06 2009 10:30:55 CET I note that the statement [code] DISPLAY "." WITH NO ADVANCING. [/code] does not display the period until another DISPLAY with a carriage return or an ACCEPT statement is executed. I was doing this to try to show continuing progress, i.e. a growing line of ........... as the machine was processing issues that did not need terminal i/o. The periods were to let me know that the program will still alive. (It seems that my HP Itanium box with 64GB and 4 processors thinks that the computing chore that I have it doing should take some time to complete :-) ) I do not know whether the issue is with the compiler or with TeraTerm (the terminal emulator that I am using). This is not a problem to me but I thought I would post the issue in case someone else is confronted with this issue. jimc ---------------------------------------------------------------- As OpenCOBOL only does an automatic flush, when ADVANCING is not used (surely because of performance issues and to avoid flickering), it depends how the underlying curses and/or terminal handles this. I did a quick test with the MinGW package (patched Feb09) with the program [code] identification division. program-id. 'ADVTST'. procedure division. * PERFORM 10 TIMES DISPLAY "." WITH NO ADVANCING END-DISPLAY call 'C$SLEEP' using 1 end-call END-PERFORM DISPLAY "." END-DISPLAY DISPLAY "FINISHED" END-DISPLAY goback. [/code] and everything worked fine. When trying the same prog with scoansi TERM setting on linux I get the same disturbing result as you. As a workaround one could write a small C wrapper for fflush and call this in the COBOL prog. human ---------------------------------------------------------------- Jim; I took human's sample one step further, [i]and cheat a little[/i] [code] identification division. program-id. 'dots'. procedure division. * PERFORM 10 TIMES DISPLAY "." WITH NO ADVANCING END-DISPLAY call "flush_display" end-call call 'C$SLEEP' using 1 end-call END-PERFORM DISPLAY "." END-DISPLAY DISPLAY "FINISHED" END-DISPLAY goback. [/code] with [b]dotflush.c[/b] [code] #include <stdio.h> int flush_display() { fflush(stdout); fflush(stderr); return 0; } [/code] and [code] $ cobc -x dots.cob dotflush.c $ ./dots [/code] and there is one dot per second. This fflushes both stdout and stderr as libcob/termio.c cob_display has [code] void cob_display (const int outorerr, const int newline, const int varcnt, ...) { FILE *fp; cob_field *f; int i; va_list args; if (!outorerr && !cob_screen_initialized) { fp = stdout; } else { fp = stderr; } va_start (args, varcnt); for (i = 0; i < varcnt; ++i) { f = va_arg (args, cob_field *); display (f, fp); } va_end (args); if (newline) { putc ('\n', fp); fflush (fp); } } [/code] and you'd have to predict if screenio had been used along with UPON phrases, so just flush both buffers, (cheating). Cheers, Brian ---------------------------------------------------------------- Subject: I've posted open-cobol-1.1.tar.gz Feb 2009 to SourceForge Yep. http://sourceforge.net/projects/open-cobol/ Next will be putting up the tree for SVN, and then perhaps a version patched to fix void C function calls and CALL RETURNING NULL. Cheers, Brian ---------------------------------------------------------------- Finally (with a delay of three years) there is a 1.1 at SF. This is good, but I'm unsure if the packages will be build on a pre-release version. How is the effort of getting it named as release version (maybe after your patches)? For patching: Please keep in mind that there are a lot of other fixes (most with small code changes) for 1.1 feb09 that we can (should) include. Is there any release plan for the community edition? Would it be useful to add me (with svn access) to the project? human BTW: I wonder that I did not recognized bgiroud as a member (in this case even project manager) at the SF project. ---------------------------------------------------------------- Yeah, in my humble opinion Feb 2009 is ready for distro rollouts, except for a few doc strings regarding version number in some of the older headers, so stickler distributions may well reject and request changes. And yes a community edition could do that nicely. I'll try and squeeze time in to get the repos opened this weekend. I've looked and there should not be many lintian failures. I'm going to try and get my head around the existent CVS repo, (the SourceForge shell has command line access by default ...[i] SourceForge is pretty cool [/i] ...) and try and squirrel a pristine Feb 2009 to that tree, umm without unduly inconveniencing distro package builders that expect to find 1.0 by default. 58 downloads on the first day. There is 88,000 and counting for the 1.0 tar ball. ============= And might as well use this thread for permission requests. sf-mensch is in (with "little pink spam bot fighter" powers). ;-) [i]When fighting spam bots I find it worthwhile youtubing Yoshimi battles the Pink Robots by the Flaming Lips; played over and over again until the cleanup of the evil natured robots is complete.[/i] Cheers, Brian ---------------------------------------------------------------- Revision 1 of OpenCOBOL-1.1pre-rel checked in to SVN at [code]svn co https://open-cobol.svn.sourceforge.net/svnroot/open-cobol open-cobol[/code] Access requests can go in this thread, or at http://forum.peoplecards.ca for those still denied opencobol.org registrations (which may get lost in noise from robots, sorry in advance), and the first and last resort will be the open-cobol mailing list, which has always been hosted out of the SourceForge project. human; If you could, please test with your svn --username. Anyone reading along; I'm informally assuming a leadership role in the OpenCOBOL 1.1 Community Edition, until I get told to stop. I do this as a fan, not a professional, and you may have noticed that I like to clown around. Perhaps too much clowning for the current level of quality of the software. This is not a fork I foresee as long lived. Other sources will supersede the tweaks posted to this tree, but in the mean-while... Criticize at will, please. Cheers, Brian ---------------------------------------------------------------- Even if this may not live long, I highly vote for using "standard" SVN repo structure (trunk/tags/branches). If you're OK with that I'll change the repo structure. Other stuff (patches) I'd like to commit: - some of my patches for other compilers (most WIN) (included by Roger into 2.0) - patch to screenio.c for better key/WIN support and changed cob_bell (including a new FUNCTION for belling the user) (included by Roger into 2.0) - patch for some BDB stuff (included by Roger into 2.0) - slightly changed patch from mrcool [maybe it's better if he commits it?] - patch for EXIT PROGRAM RETURNING (NOT accepted/included by Roger into 2.0, as far as I know) human ---------------------------------------------------------------- human; I'm ok with a repo structure update. And then we should branch I guess and let some patches in. Have fun, and go ahead. Cheers, Brian ---------------------------------------------------------------- Structure (and svn-ignore) done, tag for 1.1pre-rel set. Now I'd submit patches into trunk (trying to submit one by one). What about patches from others? Should they be added to SF project (to get svn rights) and commit their patches themselves? What about the void patch you wrote about? human BTW: As the newcob.val is broken at sim-basis.de and the official site is faster, you may want to change tests/cobol85/README ---------------------------------------------------------------- I'm going to make an announcement post human, but I'd like to ask you to screen any commits and hold the master keys to the SVN repo. Cheers, Brian ---------------------------------------------------------------- > - slightly changed patch from mrcool [maybe it's better if he commits it?] I'll be happy to commit my screenio changes. In one shop I worked in, the developers put labels on all of the files that they checked in. (This was pvcs). The labels were the release numbers. We could check in changes by version. A check in might go to 1.0, 1.1, or 2.0 by the label. We could also move labels up and down the file list if needed. We could check out by release number labels. It was nice to be able to check out a 1.0, 1.1, or 2.0 version and duplicate an issue. In OpenCobol, does the developer do this? Or do tags get assigned to the tips whenever a release is declared complete? Is there a document that describes what needs to happen to commit changes? At a minimum there should be some text describing what changed as a part of the commit. Do we assign labels or tags at commit time? Is there anything else the developer should do? When I get set up on Source Forge I'll start looking into making the screenio.c and screenio.cpy commit. I'd also like to svn update any other patches from screenio.c, and test them, before I commit. It they were committed first that would be good. Otherwise, someone else will have to do the testing. ---------------------------------------------------------------- I'll post most patches to screenio.c (not yours) when I get the necessary information from btiffin concerning copyrights (I suggest that anyone posting at the svn passes them to Roger While) and how to handle stuff that was included (maybe even programmed) by Roger for OpenCOBOL 2.0. I don't think there is a need to label/tag any not released version (if not for branching) - you can get any version from the history. Here are my key points how to commit: - A good description as svn commit message - A short description in the Changelogs (you'll find them on the file system) [with the original date of the first public publishing] @Brian: You have a PM in this board, just in case you did not recognize it. human ---------------------------------------------------------------- boasting on behalf on OpenCOBOL 1000 downloads, 20 days. OC should do ok. ;-) Cheers, Brian ---------------------------------------------------------------- I finally got an account at SourceForge with cobcoder as my handle. I don't know how to send the changes to Roger While for review. He can review what I've posted to this forum and post a message if he wishes. Otherwise, if I haven't heard anything in a few weeks, I'll go ahead and svn check in my screenio.c changes. ---------------------------------------------------------------- Well mrcool, we'll be assuming review responsibilities. By we, I mean us, ok not really but kinda. PM human for SVN access on the forge, he's retagged the 1.1 as 1.1CE, and it's ours to play with. So, for reviews, it'll be human, myself, and anyone else that wants to be involved. human will have final say on bumps, tagging, the trunk branch, and freezes but I'd like to see as many contributors to the tree as is manageable. I'll run builds through 'routine testing', make check and make test (in the NIST cobol85 dir). As I would assume all developers will. Looking ahead a a little, the reference tarball of 1.1 is automake ready (umm, though I haven't ever run from bootstrap), so we should be able to cut new distributions without too much fuss. As to who gets to post a new default download (that may get picked by package maintainers), I think that'll make for a good debate and I really do hope there are contributions made that make the discussion necessary. [b]TO BE CLEAR ON INTENT[/b] The 1.1CE is a community 'clean up' effort while waiting for the 2.0 source tree. The 2.0 beta release date is unknown, so for now I'd like to facilitate anyone that cares to help put a new coat of paint on 1.1, maybe tune the engine. Cheers, Brian ---------------------------------------------------------------- Subject: Extended Accept enhancements I've enhanced the extended Accept statements with the following; - Tab key returns 2007. - Back Tab key returns 2008. - Backspace key moves the remaining characters with cursor. Before it only moved the cursor and erased the character. - End key moves the cursor to first trailing space. Before it moved it to the length of the field. - Added Insert key processing. The default is insert on. The Insert key toggles on and off modes. - Added Delete key processing. It moves the remaining characters to cursor, without moving the cursor. - Accept "with update prompt" at the same time now work together. It provides trailing prompts. Before it processed as either one or the other, with update taking precedence. With secure prompt also provides trailing prompts similar to password logins. All of the keys now follow the behavior of Libre Office, and the editors I tried on Suse Linux. Except that the Insert mode on and off do not change the cursor from vertical bar to rectangle. I put in a change for that, but it doesn't seem to take effect. If someone knows how to change that behavior, please post it here so we can give it a try. To incorporate these enhancements, get the February 2009 tarball of 1.1 or better, then - rename libcob/screenio.c to screenio-old.c and copy in the new screenio.c - copy the screenio.cpy to copy/screenio.cpy If something goes wrong, copy the screenio-old.c back over the screenio.c and these changes will be erased. Then run the make utilities as you would in an initial install. There's no need to recompile your Cobol programs. I did NOT test Screen Section or Windows. It is believed that these changes to not change the Screen Section. I don't use Screen Section so I'm not in a position to test it. If someone would like to see these changes added to the Screen Section, you may copy these changes there. Someone needs to change the documentation for the Tab keys. Here is the screenio.c subprogram. See the next post for the other file. [code] /* * Copyright (C) 2001-2009 Keisuke Nishida * Copyright (C) 2007-2009 Roger While * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1, * or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; see the file COPYING.LIB. If * not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA */ #include "config.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #ifdef HAVE_UNISTD_H #include <unistd.h> #endif #ifdef HAVE_NCURSES_H #include <ncurses.h> #define COB_GEN_SCREENIO #elif defined(HAVE_NCURSES_NCURSES_H) #include <ncurses/ncurses.h> #define COB_GEN_SCREENIO #elif defined(HAVE_PDCURSES_H) #include <pdcurses.h> #define COB_GEN_SCREENIO #elif defined(HAVE_CURSES_H) #include <curses.h> #define COB_GEN_SCREENIO #endif #include "move.h" #include "coblocal.h" #include "screenio.h" /* Global variables */ int cob_screen_initialized = 0; int cob_screen_mode = 0; #ifdef COB_GEN_SCREENIO struct cob_inp_struct { cob_screen *scr; size_t up_index; size_t down_index; int this_y; int this_x; }; #define COB_INP_SIZE 1920 * sizeof(struct cob_inp_struct) /* Local variables */ static struct cob_inp_struct *cob_base_inp = NULL; static size_t curr_index = 0; static size_t totl_index = 0; static size_t cob_has_color = 0; static size_t cob_extended_status = 0; static size_t cob_use_esc = 0; static int global_return; static int cob_current_y = 0; static int cob_current_x = 0; static int cob_max_y = 0; static int cob_max_x = 0; static short fore_color; static short back_color; static int insert_mode = 1; /* insert toggle, default on */ /* Local functions */ static void get_line_column (cob_field *fline, cob_field *fcol, int *line, int *col) { int l; int c; int p; if (fline == NULL) { *line = 0; *col = 0; return; } p = cob_get_int (fline); if (fcol == NULL) { if (fline->size == 4) { l = p / 100; c = p % 100; } else { l = p / 1000; c = p % 1000; } } else { l = p; c = cob_get_int (fcol); } if (l > 0) { l--; } if (c > 0) { c--; } *line = l; *col = c; } static void cob_screen_attr (cob_field *fgc, cob_field *bgc, const int attr) { size_t i; int styles = 0; int line; int column; short fgcolor; short bgcolor; short fgdef; short bgdef; attrset (A_NORMAL); if (attr & COB_SCREEN_REVERSE) { styles |= A_REVERSE; } if (attr & COB_SCREEN_HIGHLIGHT) { styles |= A_BOLD; } if (attr & COB_SCREEN_BLINK) { styles |= A_BLINK; } if (attr & COB_SCREEN_UNDERLINE) { styles |= A_UNDERLINE; } if (styles) { attron (styles); } if (cob_has_color) { fgcolor = fore_color; bgcolor = back_color; if (fgc) { switch (cob_get_int (fgc)) { case COB_SCREEN_BLACK: fgcolor = COLOR_BLACK; break; case COB_SCREEN_BLUE: fgcolor = COLOR_BLUE; break; case COB_SCREEN_GREEN: fgcolor = COLOR_GREEN; break; case COB_SCREEN_CYAN: fgcolor = COLOR_CYAN; break; case COB_SCREEN_RED: fgcolor = COLOR_RED; break; case COB_SCREEN_MAGENTA: fgcolor = COLOR_MAGENTA; break; case COB_SCREEN_YELLOW: fgcolor = COLOR_YELLOW; break; case COB_SCREEN_WHITE: fgcolor = COLOR_WHITE; break; default: break; } } if (bgc) { switch (cob_get_int (bgc)) { case COB_SCREEN_BLACK: bgcolor = COLOR_BLACK; break; case COB_SCREEN_BLUE: bgcolor = COLOR_BLUE; break; case COB_SCREEN_GREEN: bgcolor = COLOR_GREEN; break; case COB_SCREEN_CYAN: bgcolor = COLOR_CYAN; break; case COB_SCREEN_RED: bgcolor = COLOR_RED; break; case COB_SCREEN_MAGENTA: bgcolor = COLOR_MAGENTA; break; case COB_SCREEN_YELLOW: bgcolor = COLOR_YELLOW; break; case COB_SCREEN_WHITE: bgcolor = COLOR_WHITE; break; default: break; } } for (i = 0; i < (size_t)COLOR_PAIRS; i++) { pair_content ((short)i, &fgdef, &bgdef); if (fgdef == fgcolor && bgdef == bgcolor) { break; } if (fgdef == 0 && bgdef == 0) { init_pair ((short)i, fgcolor, bgcolor); break; } } if (i != (size_t)COLOR_PAIRS) { #ifdef HAVE_COLOR_SET color_set (COLOR_PAIR(i), (void *)0); #else attrset (COLOR_PAIR(i)); #endif bkgdset (COLOR_PAIR(i)); } else { attrset (A_NORMAL); } } if (attr & COB_SCREEN_BLANK_SCREEN) { getyx (stdscr, line, column); clear (); move (line, column); } if (attr & COB_SCREEN_BLANK_LINE) { getyx (stdscr, line, column); move (line, 0); clrtoeol (); move (line, column); } if (attr & COB_SCREEN_ERASE_EOL) { clrtoeol (); } if (attr & COB_SCREEN_ERASE_EOS) { clrtobot (); } if (attr & COB_SCREEN_BELL) { beep (); } } static void COB_NOINLINE cob_screen_init (void) { char *s; if (!cob_screen_initialized) { s = getenv ("COB_SCREEN_EXCEPTIONS"); if (s) { if (*s == 'Y' || *s == 'y') { cob_extended_status = 1; s = getenv ("COB_SCREEN_ESC"); if (s) { if (*s == 'Y' || *s == 'y') { cob_use_esc = 1; } } } } fflush (stdout); fflush (stderr); if (!initscr ()) { cob_runtime_error ("Failed to initialize curses"); cob_stop_run (1); } cbreak (); keypad (stdscr, 1); nl (); noecho (); if (has_colors ()) { start_color (); pair_content ((short)0, &fore_color, &back_color); if (COLOR_PAIRS) { cob_has_color = 1; } } attrset (A_NORMAL); getmaxyx (stdscr, cob_max_y, cob_max_x); cob_screen_initialized = 1; } } void cob_screen_terminate (void) { if (cob_screen_initialized) { cob_screen_initialized = 0; endwin (); } } static void COB_NOINLINE cob_check_pos_status (int fret) { cob_field *f; int sline; int scolumn; char datbuf[8]; if (fret) { cob_set_exception (COB_EC_IMP_ACCEPT); } if (cob_current_module->crt_status) { if (COB_FIELD_IS_NUMERIC (cob_current_module->crt_status)) { cob_set_int (cob_current_module->crt_status, fret); } else { sprintf(datbuf, "%4.4d", fret); memcpy (cob_current_module->crt_status->data, datbuf, 4); } } if (cob_current_module->cursor_pos) { getyx (stdscr, sline, scolumn); f = cob_current_module->cursor_pos; if (COB_FIELD_IS_NUMERIC (f) && COB_FIELD_TYPE (f) != COB_TYPE_NUMERIC_DISPLAY) { sline *= 1000; sline += scolumn; cob_set_int (f, sline); } else { if (f->size < 6) { sline *= 100; sline += scolumn; sprintf(datbuf, "%4.4d", sline); memcpy (f->data, datbuf, 4); } else { sline *= 1000; sline += scolumn; sprintf(datbuf, "%6.6d", sline); memcpy (f->data, datbuf, 6); } } } } static void cob_screen_puts (cob_screen *s, cob_field *f) { unsigned char *p; size_t size; int y; int x; int line; int column; getyx (stdscr, y, x); if (!s->line) { line = y; } else { line = cob_get_int (s->line) - 1; if (line < 0) { line = y; } } if (!s->column) { column = x; } else { column = cob_get_int (s->column) - 1; if (column < 0) { column = x; } } if (s->attr & COB_SCREEN_LINE_PLUS) { line = y + line + 1; } else if (s->attr & COB_SCREEN_LINE_MINUS) { line = y - line + 1; } if (s->attr & COB_SCREEN_COLUMN_PLUS) { column = x + column + 1; } else if (s->attr & COB_SCREEN_COLUMN_MINUS) { column = x - column + 1; } move (line, column); cob_current_y = line; cob_current_x = column; cob_screen_attr (s->foreg, s->backg, s->attr); if (s->attr & COB_SCREEN_INPUT) { p = f->data; for (size = 0; size < f->size; size++, p++) { if (s->attr & COB_SCREEN_SECURE) { addch ('*'); } else if (*p <= ' ') { addch ('_'); } else { addch (*p); } } } else { addnstr ((char *)f->data, (int)f->size); } refresh (); } static void cob_screen_get_all (void) { struct cob_inp_struct *sptr; cob_screen *s; unsigned char *p; int keyp; int sline; int scolumn; int cline; int ccolumn; int rightpos; int ateof; int gotbacksp; int ungetched; sptr = cob_base_inp; s = sptr->scr; sline = sptr->this_y; scolumn = sptr->this_x; move (sline, scolumn); cob_screen_attr (s->foreg, s->backg, s->attr); /* RXW p = s->field->data; for (count = 0; count < s->field->size; count++) { if (s->attr & COB_SCREEN_UPDATE) { keyp = *p++; addch (keyp); } else if (s->attr & COB_SCREEN_PROMPT) { addch ('_'); } else { addch (' '); } } move (sline, scolumn); */ ateof = 0; gotbacksp = 0; ungetched = 0; rightpos = scolumn + s->field->size - 1; p = s->field->data; for (; ;) { refresh (); keyp = getch (); if (keyp == KEY_ENTER || keyp == '\n') { break; } if (keyp > KEY_F0 && keyp < KEY_F(65)) { global_return = 1000 + keyp - KEY_F0; break; } if (cob_extended_status) { if (keyp == KEY_PPAGE) { global_return = 2001; break; } if (keyp == KEY_NPAGE) { global_return = 2002; break; } if (keyp == KEY_PRINT) { global_return = 2006; break; } if (cob_use_esc) { if (keyp == 033) { global_return = 2005; break; } } } if (keyp == 011) { if (curr_index < totl_index - 1) { curr_index++; } else { curr_index = 0; } sptr = cob_base_inp + curr_index; s = sptr->scr; sline = sptr->this_y; scolumn = sptr->this_x; ateof = 0; gotbacksp = 0; rightpos = scolumn + s->field->size - 1; p = s->field->data; move (sline, scolumn); cob_screen_attr (s->foreg, s->backg, s->attr); continue; } if (keyp == KEY_BTAB) { if (curr_index > 0) { curr_index--; } else { curr_index = totl_index - 1; } sptr = cob_base_inp + curr_index; s = sptr->scr; sline = sptr->this_y; scolumn = sptr->this_x; ateof = 0; gotbacksp = 0; rightpos = scolumn + s->field->size - 1; if (ungetched) { ungetched = 0; p = s->field->data + rightpos; move (sline, rightpos); } else { p = s->field->data; move (sline, scolumn); } cob_screen_attr (s->foreg, s->backg, s->attr); continue; } if (keyp == KEY_UP) { curr_index = sptr->up_index; sptr = cob_base_inp + curr_index; s = sptr->scr; sline = sptr->this_y; scolumn = sptr->this_x; ateof = 0; gotbacksp = 0; rightpos = scolumn + s->field->size - 1; p = s->field->data; move (sline, scolumn); cob_screen_attr (s->foreg, s->backg, s->attr); continue; } if (keyp == KEY_DOWN) { curr_index = sptr->down_index; sptr = cob_base_inp + curr_index; s = sptr->scr; sline = sptr->this_y; scolumn = sptr->this_x; ateof = 0; gotbacksp = 0; rightpos = scolumn + s->field->size - 1; p = s->field->data; move (sline, scolumn); cob_screen_attr (s->foreg, s->backg, s->attr); continue; } if (keyp == KEY_HOME) { curr_index = 0; sptr = cob_base_inp; s = sptr->scr; sline = sptr->this_y; scolumn = sptr->this_x; ateof = 0; gotbacksp = 0; rightpos = scolumn + s->field->size - 1; p = s->field->data; move (sline, scolumn); cob_screen_attr (s->foreg, s->backg, s->attr); continue; } if (keyp == KEY_END) { curr_index = totl_index - 1; sptr = cob_base_inp + curr_index; s = sptr->scr; sline = sptr->this_y; scolumn = sptr->this_x; ateof = 0; gotbacksp = 0; rightpos = scolumn + s->field->size - 1; p = s->field->data; move (sline, scolumn); cob_screen_attr (s->foreg, s->backg, s->attr); continue; } getyx (stdscr, cline, ccolumn); if (keyp == KEY_BACKSPACE || keyp == ('H' & 037) || keyp == 0177) { if (ccolumn > scolumn) { if (gotbacksp || ccolumn != rightpos) { ccolumn--; } else { ateof = 0; } gotbacksp = 1; move (cline, ccolumn); if (s->attr & COB_SCREEN_SECURE) { addch ('*'); } else { addch ('_'); } move (cline, ccolumn); p = s->field->data + ccolumn - scolumn; *p = ' '; } else { ungetched = 1; gotbacksp = 0; ungetch (KEY_BACKSPACE); ungetch (KEY_BTAB); } continue; } if (keyp == KEY_LEFT) { gotbacksp = 0; if (ccolumn > scolumn) { ccolumn--; move (cline, ccolumn); p = s->field->data + ccolumn - scolumn; } else { ungetched = 1; ungetch (KEY_BTAB); } continue; } if (keyp == KEY_RIGHT) { gotbacksp = 0; if (ccolumn < rightpos) { ccolumn++; move (cline, ccolumn); p = s->field->data + ccolumn - scolumn; } else { ungetch (011); } continue; } if (keyp > 037 && keyp < (int)A_CHARTEXT) { if (COB_FIELD_IS_NUMERIC (s->field)) { if (keyp < '0' || keyp > '9') { beep (); continue; } } gotbacksp = 0; *p = keyp; if (s->attr & COB_SCREEN_SECURE) { addch ('*'); } else { addch ((unsigned int)keyp); } if (ccolumn == rightpos) { if (s->attr & COB_SCREEN_AUTO) { if (curr_index == totl_index - 1) { break; } else { ungetch (011); } } move (cline, ccolumn); if (ateof) { beep (); } else { ateof = 1; } } else { p++; } continue; } gotbacksp = 0; beep (); } refresh (); } static int compare_yx (const void *m1, const void *m2) { const struct cob_inp_struct *s1; const struct cob_inp_struct *s2; s1 = m1; s2 = m2; if (s1->this_y < s2->this_y) { return -1; } if (s1->this_y > s2->this_y) { return 1; } if (s1->this_x < s2->this_x) { return -1; } if (s1->this_x > s2->this_x) { return 1; } return 0; } static void cob_prep_input (cob_screen *s) { struct cob_inp_struct *sptr; int n; switch (s->type) { case COB_SCREEN_TYPE_GROUP: for (s = s->child; s; s = s->next) { cob_prep_input (s); } break; case COB_SCREEN_TYPE_FIELD: cob_screen_puts (s, s->field); if (s->attr & COB_SCREEN_INPUT) { sptr = cob_base_inp + totl_index; sptr->scr = s; sptr->this_y = cob_current_y; sptr->this_x = cob_current_x; totl_index++; } break; case COB_SCREEN_TYPE_VALUE: cob_screen_puts (s, s->value); if (s->occurs) { for (n = 1; n < s->occurs; ++n) { cob_screen_puts (s, s->value); } } break; case COB_SCREEN_TYPE_ATTRIBUTE: cob_screen_attr (s->foreg, s->backg, s->attr); break; } } /* Global functions */ void cob_screen_display (cob_screen *s, cob_field *line, cob_field *column) { int n; if (!cob_screen_initialized) { cob_screen_init (); } switch (s->type) { case COB_SCREEN_TYPE_GROUP: for (s = s->child; s; s = s->next) { cob_screen_display (s, line, column); } break; case COB_SCREEN_TYPE_FIELD: cob_screen_puts (s, s->field); break; case COB_SCREEN_TYPE_VALUE: cob_screen_puts (s, s->value); if (s->occurs) { for (n = 1; n < s->occurs; ++n) { cob_screen_puts (s, s->value); } } break; case COB_SCREEN_TYPE_ATTRIBUTE: cob_screen_attr (s->foreg, s->backg, s->attr); break; } refresh (); } void cob_screen_accept (cob_screen *s, cob_field *line, cob_field *column) { struct cob_inp_struct *sptr; struct cob_inp_struct *sptr2; size_t idx; size_t n; size_t posu; size_t posd; size_t prevy; size_t firsty; int starty; if (!cob_screen_initialized) { cob_screen_init (); } if (!cob_base_inp) { cob_base_inp = cob_malloc (COB_INP_SIZE); } else { memset (cob_base_inp, 0, COB_INP_SIZE); } cob_exception_code = 0; cob_current_y = 0; cob_current_x = 0; totl_index = 0; move (0, 0); cob_prep_input (s); /* No input fields is an error */ if (!totl_index) { cob_check_pos_status (8000); return; } qsort (cob_base_inp, totl_index, sizeof(struct cob_inp_struct), compare_yx); sptr = cob_base_inp; starty = sptr->this_y; posu = 0; posd = 0; prevy = 0; firsty = 0; /* Set up array for Cursor UP/DOWN */ for (n = 0; n < totl_index; n++) { sptr = cob_base_inp + n; if (sptr->this_y > starty) { if (!firsty) { firsty = n; } starty = sptr->this_y; sptr2 = cob_base_inp + posd; for (idx = posd; idx < n; idx++, sptr2++) { sptr2->down_index = n; } posu = prevy; prevy = n; posd = n; } sptr->up_index = posu; } sptr = cob_base_inp; for (n = 0; n < firsty; n++, sptr++) { sptr->up_index = posd; } curr_index = 0; global_return = 0; cob_screen_get_all (); cob_check_pos_status (global_return); } void cob_field_display (cob_field *f, cob_field *line, cob_field *column, cob_field *fgc, cob_field *bgc, cob_field *scroll, const int attr) { int sline; int scolumn; if (!cob_screen_initialized) { cob_screen_init (); } if (scroll) { sline = cob_get_int (scroll); if (attr & COB_SCREEN_SCROLL_DOWN) { sline = -sline; } scrollok (stdscr, 1); scrl (sline); scrollok (stdscr, 0); refresh (); } get_line_column (line, column, &sline, &scolumn); move (sline, scolumn); cob_screen_attr (fgc, bgc, attr); addnstr ((char *)f->data, (int)f->size); refresh (); } void cob_field_accept (cob_field *f, cob_field *line, cob_field *column, cob_field *fgc, cob_field *bgc, cob_field *scroll, const int attr) { unsigned char *p; unsigned char *p2; size_t count; int keyp; int fret; int sline; int scolumn; int cline; int ccolumn; int rightpos; int ateof; int move_char; int prompt_char; /* Initialize the screen. */ if (!cob_screen_initialized) { cob_screen_init (); } if (scroll) { keyp = cob_get_int (scroll); if (attr & COB_SCREEN_SCROLL_DOWN) { keyp = -keyp; } scrollok (stdscr, 1); scrl (keyp); scrollok (stdscr, 0); refresh (); } cob_exception_code = 0; /* Start line and column. */ get_line_column (line, column, &sline, &scolumn); move (sline, scolumn); cob_screen_attr (fgc, bgc, attr); /* Prompt characters. */ p = f->data; for (count = 0; count < f->size; count++) { if (attr & COB_SCREEN_SECURE) { addch ('*'); } else if (attr & COB_SCREEN_UPDATE) { fret = *p++; addch ((unsigned int)fret); } else if (COB_FIELD_IS_NUMERIC (f)) { addch ('0'); } else if (attr & COB_SCREEN_PROMPT) { addch ('_'); } else { addch (' '); } } move (sline, scolumn); /* Initialize field. */ if (!(attr & COB_SCREEN_UPDATE)) { if (COB_FIELD_IS_NUMERIC (f)) { cob_move (&cob_zero, f); } else { memset (f->data, ' ', f->size); } } fret = 0; ateof = 0; rightpos = scolumn + f->size - 1; p = f->data; /* Get characters from keyboard, processing each one. */ for (; ;) { /* Get current line, column. */ getyx (stdscr, cline, ccolumn); /* Trailing prompts. */ if (COB_FIELD_IS_NUMERIC (f)) { prompt_char = '0'; } else if (attr & COB_SCREEN_PROMPT) { prompt_char = '_'; } else { prompt_char = ' '; } for (count = rightpos; count > scolumn - 1; count--) { /* Get character */ p2 = f->data + count - scolumn; move_char = *p2; /* Field prompts. */ if (COB_FIELD_IS_NUMERIC (f)) { /* Numeric prompt zeros. */ if (move_char == '0') { move (cline, count); addch (prompt_char); } else { /* Switch to remove prompts from within field. */ if (attr & COB_SCREEN_SECURE) { prompt_char = '*'; } else { prompt_char = '0'; } } } else { /* Alpha prompts. */ if (move_char == ' ') { move (cline, count); addch (prompt_char); } else { /* Switch to remove prompts from within field. */ if (attr & COB_SCREEN_SECURE) { prompt_char = '*'; } else { prompt_char = ' '; } } } } /* Cursor to current column. */ move (cline, ccolumn); /* Refresh screen. */ refresh (); /* Get a character. */ keyp = getch (); /* Enter key or new line */ if (keyp == KEY_ENTER || keyp == '\n') { break; } /* Function keys F1 through F64 */ if (keyp > KEY_F0 && keyp < KEY_F(65)) { fret = 1000 + keyp - KEY_F0; break; } if (cob_extended_status) { /* Page up. */ if (keyp == KEY_PPAGE) { fret = 2001; break; } /* Page down. */ if (keyp == KEY_NPAGE) { fret = 2002; break; } /* Up arrow. */ if (keyp == KEY_UP) { fret = 2003; break; } /* Down arrow. */ if (keyp == KEY_DOWN) { fret = 2004; break; } /* Print key. */ if (keyp == KEY_PRINT) { fret = 2006; break; } /* Escape key. */ if (cob_use_esc) { if (keyp == 033) { fret = 2005; break; } } /* Tab key. */ if (keyp == '\t') { fret = 2007; break; } /* Back tab key. */ if (keyp == KEY_BTAB) { fret = 2008; break; } /* Insert key toggle. If off turn on, if on turn off. */ if (keyp == KEY_IC) { if (insert_mode == 0) { insert_mode = 1; /* on */ /* to do, needs vertical bar cursor */ /* this doesn't seem to work */ count = curs_set(1); } else { insert_mode = 0; /* off */ /* to do, needs square cursor */ /* this doesn't seem to work */ count = curs_set(2); } continue; } /* Delete key. */ if (keyp == KEY_DC) { /* Delete character, move remainder left. */ for (count = ccolumn; count < rightpos; count++) { /* Get character one position to right. */ p2 = f->data + count - scolumn + 1; move_char = *p2; /* Move the character left. */ p2 = f->data + count - scolumn; *p2 = move_char; /* Update screen with moved character. */ move (cline, count); if (attr & COB_SCREEN_SECURE) { addch ('*'); } else { addch (move_char); } } /* Put space as the right most character. */ p2 = f->data + f->size - 1; if (COB_FIELD_IS_NUMERIC (f)) { *p2 = '0'; } else { *p2 = ' '; } /* Put cursor back to original position. */ move (cline, ccolumn); continue; } } /* Backspace key. */ getyx (stdscr, cline, ccolumn); if (keyp == KEY_BACKSPACE || keyp == ('H' & 037) || keyp == 0177) { if (ccolumn > scolumn) { /* Shift remainder left with cursor. */ for (count = ccolumn; count < rightpos + 1; count++) { /* Get character. */ p2 = f->data + count - scolumn ; move_char = *p2; /* Move the character left. */ p2 = f->data + count - scolumn - 1; *p2 = move_char; /* Update screen with moved character. */ move (cline, count - 1); if (attr & COB_SCREEN_SECURE) { addch ('*'); } else { addch (move_char); } } /* Put space as the right most character. */ p2 = f->data + f->size - 1; if (COB_FIELD_IS_NUMERIC (f)) { *p2 = '0'; } else { *p2 = ' '; } /* Move cursor left one from current. */ ccolumn--; move (cline, ccolumn); p--; } ateof = 0; continue; } /* Home key, move to start of field. */ if (keyp == KEY_HOME) { move (sline, scolumn); p = f->data; ateof = 0; continue; } /* End key. */ if (keyp == KEY_END) { /* Prepare for empty field. */ ccolumn = scolumn; move_char = ' '; /* Find non blank from right. */ for (count = rightpos; count >= scolumn; count--) { /* Get character */ p2 = f->data + count - scolumn; move_char = *p2; /* Non blank stop. */ if (move_char != ' ') { ccolumn = count; count = scolumn; } } /* Cursor to first blank after. */ if (move_char != ' ' && ccolumn != rightpos) { ccolumn++; } move (cline, ccolumn); p = f->data + ccolumn - scolumn; ateof = 0; continue; } /* Left arrow. */ if (keyp == KEY_LEFT) { if (ccolumn > scolumn) { ccolumn--; move (cline, ccolumn); p = f->data + ccolumn - scolumn; continue; } } /* Right arrow. */ if (keyp == KEY_RIGHT) { if (ccolumn < rightpos) { ccolumn++; move (cline, ccolumn); p = f->data + ccolumn - scolumn; continue; } } /* Printable character. */ if (keyp > 037 && keyp < (int)A_CHARTEXT) { /* Numeric field check. */ if (COB_FIELD_IS_NUMERIC (f)) { if (keyp < '0' || keyp > '9') { beep (); continue; } } /* Insert character. */ if (insert_mode == 1) { /* Move remainder to the right. */ for (count = rightpos; count > ccolumn - 1; count--) { /* Get character */ p2 = f->data + count - scolumn - 1; move_char = *p2; /* Move character one right. */ p2 = f->data + count - scolumn; *p2 = move_char; /* Update screen with moved character. */ if (count > scolumn) { move (cline, count); if (move_char != ' ') { if (attr & COB_SCREEN_SECURE) { addch ('*'); } else { addch (move_char); } } } } move (cline, ccolumn); } *p = keyp; /* Display character or '*' if secure. */ if (attr & COB_SCREEN_SECURE) { addch ('*'); } else { addch ((unsigned int)keyp); } if (ccolumn == rightpos) { /* Auto-skip at end of field. */ if (attr & COB_SCREEN_AUTO) { break; } move (cline, ccolumn); if (ateof) { beep (); } else { ateof = 1; } } else { p++; } continue; } beep (); } cob_check_pos_status (fret); refresh (); } void cob_screen_line_col (cob_field *f, const int l_or_c) { if (!cob_screen_initialized) { cob_screen_init (); } if (!l_or_c) { cob_set_int (f, (int)LINES); } else { cob_set_int (f, (int)COLS); } } void cob_screen_set_mode (const size_t smode) { if (!smode) { refresh (); def_prog_mode (); endwin (); } else { reset_prog_mode (); refresh (); } } #else void cob_screen_terminate (void) { } void cob_field_display (cob_field *f, cob_field *line, cob_field *column, cob_field *fgc, cob_field *bgc, const int attr) { } void cob_field_accept (cob_field *f, cob_field *line, cob_field *column, cob_field *fgc, cob_field *bgc, const int attr) { } void cob_screen_display (cob_screen *s, cob_field *line, cob_field *column) { } void cob_screen_accept (cob_screen *s, cob_field *line, cob_field *column) { } void cob_screen_line_col (cob_field *f, const int l_or_c) { } void cob_screen_set_mode (const size_t smode) { } #endif [/code] ---------------------------------------------------------------- Here is the screenio.cpy file. Put it in copy/screenio.cpy. [code] *> Colors 78 COB-COLOR-BLACK VALUE 0. 78 COB-COLOR-BLUE VALUE 1. 78 COB-COLOR-GREEN VALUE 2. 78 COB-COLOR-CYAN VALUE 3. 78 COB-COLOR-RED VALUE 4. 78 COB-COLOR-MAGENTA VALUE 5. 78 COB-COLOR-YELLOW VALUE 6. 78 COB-COLOR-WHITE VALUE 7. *> *> Values that may be returned in CRT STATUS (or COB-CRT-STATUS) *> Normal return - Value 0000 78 COB-SCR-OK VALUE 0. *> Function keys - Values 1xxx 78 COB-SCR-F1 VALUE 1001. 78 COB-SCR-F2 VALUE 1002. 78 COB-SCR-F3 VALUE 1003. 78 COB-SCR-F4 VALUE 1004. 78 COB-SCR-F5 VALUE 1005. 78 COB-SCR-F6 VALUE 1006. 78 COB-SCR-F7 VALUE 1007. 78 COB-SCR-F8 VALUE 1008. 78 COB-SCR-F9 VALUE 1009. 78 COB-SCR-F10 VALUE 1010. 78 COB-SCR-F11 VALUE 1011. 78 COB-SCR-F12 VALUE 1012. 78 COB-SCR-F13 VALUE 1013. 78 COB-SCR-F14 VALUE 1014. 78 COB-SCR-F15 VALUE 1015. 78 COB-SCR-F16 VALUE 1016. 78 COB-SCR-F17 VALUE 1017. 78 COB-SCR-F18 VALUE 1018. 78 COB-SCR-F19 VALUE 1019. 78 COB-SCR-F20 VALUE 1020. 78 COB-SCR-F21 VALUE 1021. 78 COB-SCR-F22 VALUE 1022. 78 COB-SCR-F23 VALUE 1023. 78 COB-SCR-F24 VALUE 1024. 78 COB-SCR-F25 VALUE 1025. 78 COB-SCR-F26 VALUE 1026. 78 COB-SCR-F27 VALUE 1027. 78 COB-SCR-F28 VALUE 1028. 78 COB-SCR-F29 VALUE 1029. 78 COB-SCR-F30 VALUE 1030. 78 COB-SCR-F31 VALUE 1031. 78 COB-SCR-F32 VALUE 1032. 78 COB-SCR-F33 VALUE 1033. 78 COB-SCR-F34 VALUE 1034. 78 COB-SCR-F35 VALUE 1035. 78 COB-SCR-F36 VALUE 1036. 78 COB-SCR-F37 VALUE 1037. 78 COB-SCR-F38 VALUE 1038. 78 COB-SCR-F39 VALUE 1039. 78 COB-SCR-F40 VALUE 1040. 78 COB-SCR-F41 VALUE 1041. 78 COB-SCR-F42 VALUE 1042. 78 COB-SCR-F43 VALUE 1043. 78 COB-SCR-F44 VALUE 1044. 78 COB-SCR-F45 VALUE 1045. 78 COB-SCR-F46 VALUE 1046. 78 COB-SCR-F47 VALUE 1047. 78 COB-SCR-F48 VALUE 1048. 78 COB-SCR-F49 VALUE 1049. 78 COB-SCR-F50 VALUE 1050. 78 COB-SCR-F51 VALUE 1051. 78 COB-SCR-F52 VALUE 1052. 78 COB-SCR-F53 VALUE 1053. 78 COB-SCR-F54 VALUE 1054. 78 COB-SCR-F55 VALUE 1055. 78 COB-SCR-F56 VALUE 1056. 78 COB-SCR-F57 VALUE 1057. 78 COB-SCR-F58 VALUE 1058. 78 COB-SCR-F59 VALUE 1059. 78 COB-SCR-F60 VALUE 1060. 78 COB-SCR-F61 VALUE 1061. 78 COB-SCR-F62 VALUE 1062. 78 COB-SCR-F63 VALUE 1063. 78 COB-SCR-F64 VALUE 1064. *> Exception keys - Values 2xxx 78 COB-SCR-PAGE_UP VALUE 2001. 78 COB-SCR-PAGE_DOWN VALUE 2002. 78 COB-SCR-KEY-UP VALUE 2003. 78 COB-SCR-KEY-DOWN VALUE 2004. 78 COB-SCR-ESC VALUE 2005. 78 COB-SCR-PRINT VALUE 2006. 78 COB-SCR-TAB VALUE 2007. 78 COB-SCR-BACK-TAB VALUE 2008. *> Input validation - Values 8xxx 78 COB-SCR-NO-FIELD VALUE 8000. *> Other errors - Values 9xxx 78 COB-SCR-FATAL VALUE 9000. [/code] ---------------------------------------------------------------- Nice changes with nice comments, coded according to old screenio.c. I'm sure this does not affect SCREENs as they are in different (unpatched) functions. With some slight changes this will work for screen section (not tab/back tab/home/end as these are used for switching between the fields) and for WIN. Do you have other patches? human BTW: You forgot to mention the change "extended support for ACCEPT of numeric vars by adding '0'". ---------------------------------------------------------------- These screenio patches are the only ones I have made. Thanks for reminding me about the numeric change. I did a little testing and debugging on numeric fields. ---------------------------------------------------------------- Subject: OpenCOBOL 1.1 Community Edition Hello all, Well, for better or worse, there is a copy of 1.1pre-rel Feb 2009 on SourceForge and we're going to start applying patches. I'm comfortable hitting documentation files, but I'd like to screen code patches through human if contributors are amenable to such a setup. See http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1474&forum=1&post_id=7581#forumpost7581 to request credentials, or even better, the open-cobol mailing list. Cheers, Brian ---------------------------------------------------------------- Do you mind if I change the package string+version to "OpenCOBOL 1.1 CE" + "1.1 ce"? @all: please don't forget to update the Changelogs before commiting and try to commit one change by one (even if this may extra work) human ---------------------------------------------------------------- Version string can change to whatever you feel comfortable with human. I'm still assuming you will be master of the code repository and in charge of what gets approved and when. Once you settle on a 'working branch' I'll do what I can with all the other documentation and metadata. Or would you like us to create our own branches for merging later? Cheers, Brian ---------------------------------------------------------------- svn=everybody works at the same time (sometimes even in the same sources) trunk=working branch Please commit documentation and metadata there - it should not interfere with the code changes (hey, this is svn). Everything that likely needs more time (and/or a lot of testing) should go to a new branch (If you're unsure how to do that I can branch for you - just post a short message). SPLIT KEYs would be such a thing :-) (good luck with that) human ---------------------------------------------------------------- Subject: opencobol centos5 file sharing/writing [i]from oldgrouse on forum.peoplecards.ca[/i] I have configured opencobol 1.1 with BerkeleyDB4.8 running on a Centos 5 platform. The problem I have is that the data is only physically updated on the disk when the file is closed. This creates a problem with multi-users adding to the same transasction files. I have tried unlock and commit, but only closing of the file works. Am I missing something ? ---------------------------------------------------------------- Is this a RAID configuration? ---------------------------------------------------------------- Is the env var DB_HOME set (for enabling multi user access)? human BTW: Can we close [url=forum.peoplecards.ca]forum.peoplecards.ca[/url] for writing after submitting a sticky post "forum now available at [url=https://sourceforge.net/apps/phpbb/open-cobol/]https://sourceforge.net/apps/phpbb/open-cobol/[/url]"? ---------------------------------------------------------------- [i]from oldgrouse on forum.peoplecards.ca[/i] No I am not running a Raid system. I have DB_HOME set to my working directory where all datafiles are resident. ---------------------------------------------------------------- I just had a quick look what libcob (screenio.c) does: [url=http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbput.html]DB->put[/url] on WRITE, [url=http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbclose.html]DB->close[/url] on CLOSE. DB->close has an automated call to [url=http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbsync.html]DB->sync[/url] which flushes the file to disk. I never had any problems like yours and would suggest to do one (or both) of the following steps: - update to a more recent version of BDB, then re-run configure (checking if the correct/newer version is active)/make/make install, try again - hack libcob/screenio.c [edit: forget it, use COB_SYNC instead] which will result in a clear slowdown of performance. In any case, please report about the results. human ---------------------------------------------------------------- There is an option described in the guide. I'm using Linux examples here. For Windows, setting it may be different. To make all writes immediate: export COB_SYNC=P To defer writes export COB_SYNC= If this works, I suggest putting these in the scripts that run the programs. Use the =P option for interactive programs, and the = (blank) for batch programs. I hope this works. ---------------------------------------------------------------- From a quick look at the code, COB_SYNC does already what I suggested with my patch. Use the env var instead my patch. in Win environment use [code]set COB_SYNC=P[/code] BTW: "P" means "paranoid" (because bdb should sync correctly on it's own), syncing everything, if this work, try to use "Y" meaning manual sync (if I guess correct, only syncing the data file - not the alternate keys) human ---------------------------------------------------------------- Subject: Pygments syntax highlighter I just added a pull request for the upstream Pygments developers to check out the code I use to highlight the FAQ. Linking to the SourceForge forum, to get everyone used to the idea. https://sourceforge.net/apps/phpbb/open-cobol/viewtopic.php?f=5&t=3 And now's the chance to suggest colours / critique the ones used in the FAQ. Cheers, Brian ---------------------------------------------------------------- I've been requested to add a tests/examplefiles source code sample that exercises the syntax highlighter. I'll make one up (well two actually FIXED and FREE), but if anyone has an existent sample that they think would stress test a code highlighter, I'd appreciate seeing it. Still open to comments on the default colours used (see the FAQ source listings for current scheme, http://opencobol.add1tocobol.com/#how-do-i-use-opencobol-for-cgi for example). Oh, and ignore that phpbb link in the parent post, as that external app is going to be dumped from the forge in favour of the built in forum features at SourceForge. Cheers, Brian ---------------------------------------------------------------- Here you go (was a sample for PSPad, but could be useful for general checking [code] * ---------------------------------------------------------------- * Program PSPSAM showing some stuff for testing COBOL lexers * (especially old errors in PSPad COBOL syntax) * ---------------------------------------------------------------- IDENFTIFICATION DIVISION. PROGRAM-ID. 'PSPSAM'. * ---------------------------------------------------------------- ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. SYSERR IS MY-ERR DECIMAL-POINT IS COMMA. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT MY-FILE ASSIGN TO MY-FILE-NAME ORGANIZATION IS LINE SEQUENTIAL FILE STATUS IS MY-FILE-STATUS. SELECT MY-INPFILE ASSIGN TO "INPUT.DAT" ORGANIZATION IS SEQUENTIAL FILE STATUS IS MY-FILE-STATUS. I-O-CONTROL. DATA DIVISION. FILE SECTION. FD MY-FILE. 01 MY-FILE-REC. 02 MY-REC. 03 MY-BIG1 PIC X(32000). 03 MY-BIG2 PIC X(32000). FD MY-INPFILE. 01 MY-INPFILE-REC. 02 MY-INPREC PIC X(320). * ---------------------------------------------------------------- WORKING-STORAGE SECTION. 78 MY-FILE-NAME VALUE 'TEST.DAT'. 77 MY-FILE-STATUS PIC X(02). 01 PARM-1. 05 PARM-1-1 PIC X(12). 05 PARM-1-2 PIC X(10). 01 PARM-2 PIC X(80). 77 mycount pic 9(02) value 0. COPY WSCPY. 77 BVAR PIC X(650000) BASED. * ---------------------------------------------------------------- LOCAL-STORAGE SECTION. *> This var is marked: 01 local-var pic 9 value zero. 88 local-var-unchanged value zero. *> This var is NOT marked (because of two spaces): *> Either all these vars should be marked or none 01 loc2 PIC X(12) VALUE SPACES. 77 loc3 pic 9(05) usage comp-3 value 12. COPY LOCPY. * ---------------------------------------------------------------- LINKAGE SECTION. 01 some-rec. 02 some-rec-1 pic 9(04). 02 some-rec-2 pic x(4096). COPY LICPY. * ---------------------------------------------------------------- PROCEDURE DIVISION USING some-rec. *> Declaratives are very special. If they occur, they start with *> the "declaratives" keyword and end with "end declaratives" (the *> number of spaces between these two words doesn't matter). *> They can contain multiple sections/paragraphs. *> Check that this is recognized correct as an own area (inside *> working storage), not as an empty paragraph. DECLARATIVES. * Error section for MY-FILE: DEC-MY SECTION. USE AFTER STANDARD ERROR PROCEDURE ON MY-FILE. DM-BEG. display 'ERROR IN MYFILE: "' MY-FILE-STATUS '"' end-display accept loc2 end-accept exit program returning 1 DM-END. EXIT SECTION. * Error section for all files opened with INPUT: DEC-MYIN SECTION. USE AFTER STANDARD ERROR PROCEDURE ON INPUT. DMI-BEG. display 'ERROR IN MYINPFILE: "' MY-FILE-STATUS '"' end-display accept loc2 end-accept exit program returning 1 DMI-END. EXIT SECTION. * end declaratives. * ---------------------------------------------------------------- MAIN SECTION. PARA-1. OPEN INPUT MYINPFILE READ MYINP-REC END-READ OPEN OUTPUT MYFILE perform 2 times write MYFILE from myinp-rec end-write end-perform *> perform and end-perform ^could be shown as belonging together *> but this is a bit tricky as there could be so-called *> "out-of-line perform" (even within an inline perform) like perform varying mycount from 2 by 3 until mycount > 9 perform some *> out-of-line perform of section perform para-2 *> out-of-line perform of paragraph *> here comes an out-of-line perform with additional clauses *> and line brakes (COBOL ignores these as it ignores *> the position within the correct coding area) perform para-2 varying mycount from 2 by 3 until mycount > 9 end-perform *> Here the hard sample - a dot closes everything within *> the paragraph/section perform varying mycount from 2 by 3 until mycount > 9 if mycount = 9 evaluate PARM-1 when 'AAA' continue when 'BBB' when 'CCC' if PARM-2 = 'C' write MYFILE from myinp-rec end-evaluate when other call 'SUBPROG' using PARM-1 on exception if PARM-2 = 'C' move PARM-1 to PARM-2. CLOSE MYFILE CLOSE MYINPFILE ALLOCATE BVAR MOVE ALL 'A' TO BVAR CALL 'SUBMOD' USING PARM-1 BVAR PARM-2. FREE ADDRESS OF BVAR go to para-3 continue. PARA-2. continue. PARA-3. EXIT PROGRAM. * ---------------------------------------------------------------- SOME SECTION. move PARM-1 to PARM-2 EXIT SECTION. * ---------------------------------------------------------------- SOME2 SECTION. move PARM-2 to PARM-1 continue. * ----------------------------------------------------------------[/code] Simon 'human' Sobisch ---------------------------------------------------------------- Subject: NEWS : Logiciel de comptabilité publique en production avec OC / Public accounting package using OC --- Nouvelles --- En français : Dans le cadre initial d’une étude de compilateurs COBOL alternatifs à celui de MicroFocus pour le compte du Conseil Général du Val de Marne, OpenCobol a été retenu pour élaborer une maquette pour la compilation d’un progiciel de comptabilité publique (1,5 millions de lignes) La maquette a permis de valider ce choix, y compris avec l’utilisation de fichiers séquentiels indexés, avec OpenCobol version 0.33 moyennant de petites adaptations du code COBOL (principalement utilisation de mots-clés réservés et mots-clés non implémentés). De plus, elle a permis, au moins, de constater aucune perte en performances. Après la qualification fonctionnelle de cette maquette, le progiciel est en production depuis juillet 2011 sous Linux RedHat Entreprise Linux 4 Advanced Server 32 bits en environnement virtualisé VMWARE ESX – 4 Go de mémoire vive – processeur bi-cœur AMD Opteron 6176 (tm). Le progiciel est déployé pour 650 utilisateurs dont 150 connectés simultanément, au moment des pics d’activité. Avec la montée de version du progiciel, une validation fonctionnelle est en cours depuis septembre 2011 avec OpenCobol version 1.1 sous Linux RedHat Entreprise Linux 5 Advanced Server 64 bits et processeur bi-cœur Quad-Core AMD Opteron 8356 (tm). On ne constate aucune perte de performances liée à la nouvelle version d’OpenCobol (mais perte de 10% à 20% liée au progiciel après campagne dans les deux environnements). --- Breaking News --- In english : As part of an initial study for "le Conseil Général du Val de Marne" of COBOL compilers for finding an alternative to that of MicroFocus, OpenCobol was selected to develop a model for the compilation of a public accounting package (1.5 million lines). The model had to validate this choice, including with the use of sequential indexed files, with OpenCobol version 0.33 and small adjustments to the COBOL code (mainly using reserved keywords and keywords not implemented). Furthermore, it showed no loss of performance. After the functional qualification of this model, the software is in production since July, 2011 under Linux RedHat Enterprise Linux 4 Advanced Server 32-bit virtualized environment VMWARE ESX - 4 GB of RAM - processor dual AMD Opteron 6176 (tm). The software package is deployed for 650 users whose 150 connected simultaneously, at the peaks of activity. With the rise of the package version, a functional validation is in progress since September 2011 with OpenCobol version 1.1 under Linux RedHat Enterprise Linux 5 Advanced Server 64-bit and dual Quad-Core AMD Opteron 8356 (tm) processor. No loss of performance related to the new version of OpenCobol (but related to the package of 10% to 20% loss) after campaign in the two environments. eraso (eric.rasoa@sutec.fr) ---------------------------------------------------------------- Nice news Eric. Cheers, Brian ---------------------------------------------------------------- Yes, very nice news. If you talk about performance it is highly interesting what C-compiler (I guess GCC 4.5/4.6 ?) and what command line parameters you've used, especially -O2 (for C compiler optimization), -debug (for enabling run-time checks), -m (dynamic modules), maybe passed C-compiler options for compiling only for the specific processors in use? What ISAM-implemantation do you use (I guess BDB)? Does this work without problems in your multi-user environment? Do you configured your ISAM-backend somehow? human ---------------------------------------------------------------- Hello, With OC 0.33 : - compilation is done with : * -x/-m -free (without any other particular options except for debugging : -debug -ftrace ...) * gcc version is 3.4.6 20060404 (Red Hat 3.4.6-9) - ISAM files are handled by DBBerkeley 4.2.52 without any particular options or configuration With OC 1.1 : - compilation is done with : * -x/-m -fixed (without any other particular options) * gcc version is 4.1.2 20080704 (Red Hat 4.1.2-44) - ISAM files are handled by DBBerkeley 4.3.29 without any particular options or configuration FYI : The main cobol component becomes a program that calls shared libraries. Each cobol program is compiled to become a shared library. ISAM files are only used by batch programs which run nightly. Hope this helps. KR, eraso ---------------------------------------------------------------- Thank you for this additional information. Is it possible to do [code]export CFLAGS=$CFLAGS -march=native[/code] before calling cobc (will lead to modules that won't run on other machines) and add -O2 to the command line for cobc to see how the performance part is changed? human ---------------------------------------------------------------- Subject: Any LLVM clang-ers? I just built OC 1.1pre-rel with clang. Had to remove a "-fno-gcse" from the make check options, and with that small change only 2 tests fail. Sort non-existent file has a goto in the test that Clang complains about, and that is easily fixable; it's not the sort that fails, but the result check. WooHoo. Super easy. [code] $ sudo yum install llvm clang clang-analyzer clang-devel $ export CC=clang $ ./configure OpenCOBOL Configuration: CC clang COB_CC clang CFLAGS -O2 COB_CFLAGS -I/usr/local/include COB_EXTRA_FLAGS LDFLAGS COB_LDFLAGS COB_LIBS -L${exec_prefix}/lib -lcob -lm -lgmp -lncurses -ldb COB_CONFIG_DIR ${prefix}/share/open-cobol/config COB_COPY_DIR ${prefix}/share/open-cobol/copy COB_LIBRARY_PATH ${exec_prefix}/lib/open-cobol COB_MODULE_EXT so COB_SHARED_OPT -shared COB_PIC_FLAGS -fPIC -DPIC COB_EXPORT_DYN -Wl,--export-dynamic COB_STRIP_CMD strip --strip-unneeded Dynamic loading System $ scan-build make scan-build: Removing directory '/tmp/scan-build-2012-05-23-2' because it contains no reports. $ make check # I had to make one change to cobc/cobc.c to remove -fno-gcse to avoid a bunch of make check 'failures' due to a warning about unused -fno-gcse $ sudo make install $ sudo ldconfig cobc is built with clang, and uses clang when compiling the .c generated from the .cob. [btiffin@cobol]$ scan-build cobc -v -x hello.cob scan-build: 'clang' executable not found in '/usr/lib64/clang-analyzer/scan-build/bin'. scan-build: Using 'clang' from path: /usr/bin/clang preprocessing hello.cob into /tmp/cob18158_0.cob translating /tmp/cob18158_0.cob into /tmp/cob18158_0.c clang -pipe -c -I/usr/local/include -Wno-unused -fsigned-char -Wno-pointer-sign -o /tmp/cob18158_0.o /tmp/cob18158_0.c clang -pipe -Wl,--export-dynamic -o hello /tmp/cob18158_0.o -L/usr/local/lib -lcob -lm -lgmp -lncurses -ldb scan-build: Removing directory '/tmp/scan-build-2012-05-23-2' because it contains no reports. [btiffin@cobol]$ ./hello Hello [btiffin@cobol]$ ls -la hello -rwxrwxr-x. 1 btiffin btiffin 9630 May 23 12:37 hello [/code] OpenCOBOL seems to play very nicely with LLVM and Clang. Of course, more testing required and more analysis, but it worked with only one change to sources and setting the CC environment variable to [b]clang[/b]. Not bad for a 15 minute experiment during lunch. Roger and Keisuke write world class source code. Cheers, Brian ---------------------------------------------------------------- Not that this is that hard to find and/or change, but I suggest you post a short patch file (as I think you used #ifdef). OC works quite well with a lot of compilers, especially the dev-version. human ---------------------------------------------------------------- And this isn't just a new C compiler, tested and tried. It's LLVM and where ever that bandwagon may travel. ;-) Win. The C ABI and now the future of the LLVM universe. Sweet. Added to the FAQ. Cheers, Brian ---------------------------------------------------------------- Subject: Project Milestone Reached - Request for info on next stage [b]Big thank you to all involved in the OpenCobol Project.[/b] Our accounts, stock control and SOP system has completed its first month-end using OpenCobol. We ported programs from MicroFocus Cobol to OpenCobol 1.1. We are using Redhat 64-bit LINUX. (I'll add version specifics later.) We use our own in-house B-Tree Isam and our own screen handling. Additionally, all mundane reporting is via our own (coded in C) report handler. The package comprises 1000 (approx) COBOL sources; 383,000 COBOL source lines total. During the project, we tripped over a number of "curiosities" in OpenCobol. For example, we had to modify the compiler to by-pass some optimisation to numeric handling that produced erroneous results whereas the "long" route produced correct results. We also modified the compiler to support split-keys. The hack was slanted towards our own ISAM handler but I believe it would work with VBISAM and could be tweaked for Berkeley DB. I would like to now establish a reference installation of OpenCobol and contribute back to the project. So here's the first question I have: should I download the OpenCobol 1.1 pre-release from this site? If I then retest the anomalies and submit the results here (in this forum), will that be useful? I want to avoid wasting everyone's time by submitting bug reports against superseded versions of OpenCobol. Finally, as I mentioned in an earlier post, I'd like to take a look at fileio.c. Is the version in the download package pretty much the "current" version or are significant changes already in the pipeline? Is there a suite of test COBOL sources that you use to acceptance test changes to the OpenCobol compiler? Advice on this will be gratefully received. And thanks again OpenCobol! ---------------------------------------------------------------- Wondrous news Joe. We have started a Community Edition project on SourceForge. A copy of the 1.1pre-rel is the 'base' checkin. http://sourceforge.net/projects/open-cobol/ I'd like to keep human in charge of the keys to write permissions on the repository (SVN) but it is there and ready to be forked and worked on. Yes there are test-suites, both [b]$ make check[/b] auto-tests and the NIST suite (documented at http://opencobol.add1tocobol.com/#does-opencobol-pass-the-nist-test-suite and in the compiler source tree at [b]tests/cobol85/README[/b] I'd like to see more auto-tests written by the community, and details on that are hinted at at http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1378&forum=1#forumpost7052 As to the future, there are superseding sources, but those are under wrap with no current release dates. It was due to the lack of release date that the 1.1CE was initiated. My preference is to continue with Community Edition changes to 1.1pre-rel and worry about back-porting changes into 2.0 when it officially rolls. Your changes sound very much like a boon to all, and I'd be eager to see them on SourceForge for others to try out. Drop a PM to human, and I'm sure he'll hand over credentials for svn co https://open-cobol.svn.sourceforge.net/svnroot/open-cobol open-cobol Wondrous and awesome news. Cheers, Brian ---------------------------------------------------------------- @JoeRobbins I'm really interested in your work. If you need testing, let me know how to get package. Cheers, Marcello ---------------------------------------------------------------- Sounds great, specially the split keys as I think there are a few people looking at it, me being one. If you have split keys working then maybe we could look at it and do the necessary changes for VB and BDB. I am interested to see what other amendments you made as I am busy converting my system to OC from MF (which I have made open source)and your changes may be a time saving for any of us that are doing these conversions. Look forward to your contributions! ---------------------------------------------------------------- Subject: COPY statement -again) Hello, I have tried to compile cobol code using copy statements. We intensively use copy statements for file declaration and description. It makes maintenance easy with a single make. It looks like that (in free mode, not fixed mode): input-output section. file-control. copy "../src/fc-file1.cpy". copy "../src/fc-file2.cpy". copy "../src/fc-file3.cpy". .... DATA DIVISION. file section. copy "../src/fd-file1.cpy". copy "../src/fd-file2.cpy". copy "../src/fd-file3.cpy". .... working storage section. copy "../src/status.cpy" replacing ==(tag)== by ==file1==. copy "../src/status.cpy" replacing ==(tag)== by ==file2==. copy "../src/status.cpy" replacing ==(tag)== by ==file3==. It does not compile. I have to separate each line with a line with a single "." in order to get the code compiled : copy "../src/fc-file1.cpy". . copy "../src/fc-file2.cpy". . copy "../src/fc-file3.cpy". . Under Cobol-IT (based on OC), it works. It makes me think that an error has been fixed on this compiler. I used OC under Centos 5.4 : cobc (OpenCOBOL) 1.1.0 Copyright (C) 2001-2009 Keisuke Nishida / Roger While Built Jun 06 2012 14:41:45 Packaged Feb 06 2009 10:30:55 CET Best regards, Alain ---------------------------------------------------------------- Hi; Looking at your code it should be working can you confirm that you start each line in column 2. Also what does the compiler do when processing these lines? It might be helpful if you add --save-temps to your command line for cobc so that you can see the file cobfilename.i as this is the file that is created as a precompile step after processing the copy's. If needed I can try it on my system but i do run similar examples but without the ==(tag)== examples eg, copy "../path1/copyfilename.cob". So what we need to work out is if the simple copy's are failing or ... Also what settings (if used) have you for the env. vars. COBCPY or COB_COPY_DIR ? Vince ---------------------------------------------------------------- Why do you think the COPY statement needs to start in column 2 - rather than in column 1? At least with Standard conforming (2002 or later) COBOL, using free form reference format, a COPY statemnt may start in column 1 (following a line ending with a period). A space must ALWAYS be assumed between lines of source code. See 6.3.1 Continuation of lines in the '02 Standard that states, "The last nonblank character of each line is treated as if it were followed by a space." ---------------------------------------------------------------- I do not assume where it starts it was just a question in order to understand his source layout so I can run some tests! ---------------------------------------------------------------- Yeah, sounds weird, that should work, and a quick trial did here. I tried [code] ... input-output section. file-control. copy "../../oc/stdinout.cpy". copy "../../oc/stdinout2.cpy". ...[/code] and got a clean compile pass [code] $ cobc -x -free -E copypath.cbl ... input-output section. file-control. # 1 "../../oc/stdinout.cpy" select stdin assign to keyboard. select stdout assign to display. # 11 "copypath.cbl" # 1 "../../oc/stdinout2.cpy" select stdin2 assign to keyboard. select stdout2 assign to display. # 12 "copypath.cbl" ... $ ./copypath hello, stdout [/code] That may not have exercised enough compiler code paths though. Cheers, Brian ---------------------------------------------------------------- Hello, Here is an example : [code] identification division. program-id. test2. environment division. configuration section. source-computer. linux. object-computer. linux. special-names. console is crt crt status is key-status. input-output section. file-control. copy "file1.sel". DATA DIVISION. file section. copy "file1.fd". WORKING-STORAGE SECTION. 01 key-status. 02 key-type pic x. 02 key-code-1 pic 9(2) comp-x. 02 key-code-1-x redefines key-code-1 pic x. 02 key-code-2 pic 9(2) comp-x. 02 filler pic x. copy "status.tag" replacing ==(tag)== by ==file1==. procedure division. continue. exit program stop run . end program test2. [/code] where file1.sel = [code] select file1 assign to "../fic/file1" organization is indexed access dynamic lock mode is automatic with lock on record record key fdfile1-clef file status sta-file1. [/code] and file1.fd = [code] FD file1. 01 fdfile1. 02 fdfile1-CLEF. 03 fdfile1-x2-langue PIC xx. 03 fdfile1-i2-file1 PIC 99. 02 fdfile1-x20-libelle pic x(20). 02 FILLER PIC X(26). [/code] and status.tag = [code] 01 sta-(tag). 02 sta-x1-s1(tag) pic x. 02 sta-x1-s2(tag) pic x. 02 sta-b1-(tag) redefines sta-x1-s2(tag) pic 99 comp. 01 bool-eof-(tag) pic 9. 88 b88-eof-(tag) value 1 when set to false 0. [/code] If compiled so : [code]cobc -free test2.cbl[/code] you get : [code]test2.cbl:14: Error: syntax error, unexpected DATA, expecting SEQUENTIAL[/code] I compiled so [code]cobc -free -E test2.cbl[/code] there is no error. If you slightly modify the source code (please note the dot alone on the line after copy : [code] input-output section. file-control. copy "file1.sel". . [/code] both cobc -free and cobc -free -E will compile without any error. Regards. Alain ---------------------------------------------------------------- OK, I have just run your examples both exactly as is and changing the program to free format and both run correctly with no warnings or errors using the same and with additional cobc commands. the program for the free format is as follows: [code] >>source free identification division. program-id. test2. environment division. configuration section. source-computer. linux. object-computer. linux. special-names. console is crt crt status is key-status. input-output section. file-control. copy "file1.sel". >>source free DATA DIVISION. file section. copy "file1.fd". >>source free WORKING-STORAGE SECTION. 01 key-status. 02 key-type pic x. 02 key-code-1 pic 9(2) comp-x. 02 key-code-1-x redefines key-code-1 pic x. 02 key-code-2 pic 9(2) comp-x. 02 filler pic x. copy "status.tag" replacing ==(tag)== by ==file1==. >>source free procedure division. continue. exit program stop run. end program test2.[/code] I did also remove blank lines and placed the '.' after 'run' just in case in the last test again with no problems. Brian can you do the same as I have a later compiler installed and can only run the normal make check etc on the Feb 09 version of 1.1. V. ---------------------------------------------------------------- Subject: Read previous at end Open Cobol returns a file status "10" end of file at the beginning of a file. [code] Read key-file previous record at end Move "11" to file-status end-read. [/code] Notice the reset to "11" in the at end clause as shown. The reason end and beginning should be different is that there is a common routine written that handles all file status codes. Using "10" for both means the screen message always says "end of file" when it could be end or beginning. The routine uses "11" as the beginning of file message to keep them different. I'm not suggesting a change to Open Cobol at this time. Although if they did, that would be all right with me. I'm posting this question mostly for Mr Klein (wmklein), Are you on the ANSI/ISO Cobol committee? Could there be a proposal to reserve file status "11" for beginning of file? (Or "12" or "13" or whatever they decide.) I would like to have the committee decide on a code so that my routines will not be in conflict with other Cobol vendors. For example, Ryan-McFarland Cobol (before they were called that) used "B3" for beginning file-status. I think they invented read previous with their call to "C$RDPRV". Other vendors may use something different. Even if Read previous is not ISO yet, they could still reserve "11" for vendors that support it. ---------------------------------------------------------------- Small point, status 10 is actually 'There is no next logical record. You have reached the end od file.' So, by reading reverse the last record (which is actually the first held in the file) IS the last record. Does not a programmer that does a read reversed not expect such logic or am I just being a 65 year old (OK, not till the 23rd June anyway!!) M/F programmer again and having another brain fart. As for a screen message that should be the responsibility of the programmer to create and word correctly. Vincent ---------------------------------------------------------------- You raise a good point. It's a logical end either way. Having different file-status codes for end and begin is nice to have, not a requirement. As shown in the example, I handle it with my own Move "11" to file-status. Even if ISO Cobol picks "10" for a beginning file-status, they should at least put it in the standard so that all vendors can follow it. Right now, I think that the standard does not say anything at all about what to do at the beginning of a file. The standard should pick something that all vendors can agree to. ---------------------------------------------------------------- Sorry, but status 10 IS in the standard and has been since ANSI'74. As far as I know all vendors use it, well the main one's anyway eg, MF, IBM heck even ICL did. ---------------------------------------------------------------- READ PREVIOUS (and other related features WERE new in the '02 Standard, but they are there now (and have been for a decade). File Status "10" for "end of logical sequential processing" has been in the Standard since long before I knew COBOL. You [u][i][b]could[/b][/i][/u] ask for a different FS for reaching the beginning on backwards sequential processing, but I do not (personally) think there is any chance at all you would get it. Does this answer everything addressed to me? ---------------------------------------------------------------- [quote]or am I just being a 65 year old [/quote] I think that makes you a junior member. :-D ---------------------------------------------------------------- Yes, thank you for your reply. And also, thank you for all the work you do for the Cobol community. The "end of logical sequential processing" means a great deal to us developers. I get it. Hopefully all Cobol vendors interpret it the same way. But that quote means nothing to an end user. It is jargon. It will confuse them. The issue that I have is when some developer, such as myself, needs separate messages for beginning and ending of file. They have to use a separate code, in my case "11". When a customer pushes the F-key for read previous, and gets the "Beginning of file: 11" message, they may look up "11" in their Cobol book. They will not find "11". Then they call customer support, asking "what's this?" Then we have to tell them that Cobol doesn't have a separate beginning of file code, so we made one up. Not having a beginning of file status code adds an element of confusion that I would hope the ISO committee would at least consider. To make Cobol friendlier to the end users there should be a code reserved for read previous. ---------------------------------------------------------------- Then why not just show them a "Beginning of file:" message, then they won't go looking for a 10 or 11 they will hopefully relaize they have reached the "beginning of the file". ---------------------------------------------------------------- A good work around, thanks. I hope the ISO Cobol committee realizes that, of the entire ISO Cobol specifications document, the only part that the end user sees is the table of file status codes. The file status codes should be user friendly and complete. ---------------------------------------------------------------- I am a little lost here, 'The end user' only will see what messages etc, that the programmer has specified. The programmer should be aware of how s/he's logic works and create suitable user messages accordingly. The actual status code produced by the compiler is totally immaterial other than to the programmer assuming of course that it complies with the Cobol standards which OC does. ---------------------------------------------------------------- In every shop I've been in, the Cobol file status codes are always included with the message. To not provide them would take me some getting used to. I'm not saying it's wrong to do it that way, it would just take some getting used to. Still, Micro Focus has many implementer defined file status codes, in the form of 9x, where x is a binary number between 0 and 255. I wouldn't want to interrogate that and make a message for each one. Especially since the software is ported to a dozen different platform's Cobol vendors for each release. It's good to be generic. We convert the binary number to a display number and include it in the message. That has sufficed in all cases. Also, there is at least one Cobol vendor that returns 0x status codes, where x is any letter from A to M (upper and lower case). In my mind, I'm happy with "00" telling me that it was successful. I don't need 0x telling me why it was successful. But there's a vendor that does. It's in the ISO specifications for them. Here I thought I'd seen every Cobol compiler in the world. Which vendor does this? ---------------------------------------------------------------- Subject: Things at SourceForge From Information needed on new program supporting source code COPY statements [quote] Are you creating some forums and bug reporting on site to cover feedback from users? Vincent.[/quote] and [quote]We *could* add it to the svn repo, but as it is an own project (as long as it doesn't use/depend on OC-parts) it may would be better placed in an own project/repo? SVN write access can be easily achieved (by being added to the opencobol-project, which can be done by me), finer access (only to /extras for example) cannot be done at SF yet, but I don't think it's a problem as every user must be added first, all changes can be simply reverted (it's a version control management system) and users can be warned/banned if they're writing to the wrong paths. What do you think about adding code like this to the OC repo? How many new directories do we need and for what (what was the exact description to /extras?)? And Vincent has a good point - we should either set up a new hosted app (like MantisBT) and add the community stuff there or add new categories to the main bug/feature tracker. human[/quote] Ok, I'd like to run the forge as is almost. The forum is plain, but functional. I'm confused with the phpBB hosted app, and not sure who can post. Normal user permissions are not enabled, and the permission copy sequence seems borked when trying to setup SourceForge member default access. There is a tracker in place as well, again, simple but functional. On /extras, yeah that should not have come up, unless it's an actual /extras, like OC_CBL_DUMP, copyright to Roger then possibly FSF, ships with the compiler source tarball, etc. /community or pick a better name, /contrib or [i]hopefully not[/i] /apps. On SVN. Hmm, needs some planning me thinks. I'm not sure how easy it is to separate sub-projects, versus how easy it is to open a new SourceForge project. By the by, I'd like to shuffle on over to SourceForge sooner, get the patches published and let new registrations into the mix. Cheers, Brian ---------------------------------------------------------------- New svn structure: https://open-cobol.svn.sourceforge.net/svnroot/open-cobol/trunk/open-cobol-ce https://open-cobol.svn.sourceforge.net/svnroot/open-cobol/trunk/contrib The user vbcoen was added to the SF project with SVN access. New [url=https://sourceforge.net/projects/open-cobol/forums/forum/2526793]forum Contributions[/url] was set up for this stuff (simple one, not the phpBB) and a new [url=https://sourceforge.net/tracker/?group_id=34923&atid=3197050]tracker Contributions[/url] (simple one, no new hosted app), too (together with the category "prtcbl") @Vincent: Please add a new directory prtcbl with a README (and more directories if you have more to contrib). If possible submit the first version you have (Jim Currey's one I guess) and afterwards at least a commit for each version. Do you have patches to contribute to open-cobol-ce, too? @Brian: please keep an eye on the contrib stuff (forum, tracker, svn) while I keep an eye on the open-cobol-ce and new registrations. @all: What do you think of setting an svn-external in contrib/tpdebugg to the latest version of Federico's debugger? Have fun! human ---------------------------------------------------------------- human; Monitoring. But I keep an eye on things with a winky, so... ;-) all; I'd almost like to dump the phpBB Hosted App for now. Me thinks SourceForge is not quite ready (or someone that knows how the permission system changes work, that SourceForge has to do as user account management is internal, can speak up). I also noticed today that a bunch of Features don't show up on the admin list. Until we can find someone willing to put in the time to support extended features, I'd like to stick with the stock SourceForge set, until the developers at Geeknet feel a Hosted App is well enough integrated to make 'standard'. I'm going to make a huge fat post (12 megs uncompressed in 1484 threads as of a few seconds ago) on the OpenCOBOL Discussion forum at the forge that is a straight up text capture of this forum, or make an archive file, or ... something. This knowledge base is not going away, where ever we go and how many steps it takes to get there. And to be honest, not letting new people in to the main project forum is sucky and getting suckier. (Even with the fondness for this place). [b]ALL;[/b] How close is everyone to feeling comfortable pointing the DNS entry for opencobol.org to SourceForge? Cheers, Brian ---------------------------------------------------------------- Subject: Question about WRITE BEFORE ADVANCING on LINE SEQUENTIAL files Because of current state of OpenCOBOL CE I'd like to ask you (especially wmklein) if it should be allowed (from my personal understanding of the 20xx Draft: YES) and how it should work. Test program [code] IDENTIFICATION DIVISION. PROGRAM-ID. prog. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT TEST-FILE ASSIGN "./TEST-FILE" ORGANIZATION IS LINE SEQUENTIAL. DATA DIVISION. FILE SECTION. FD TEST-FILE. 01 TEST-REC PIC X(4). PROCEDURE DIVISION. OPEN OUTPUT TEST-FILE. MOVE "a" TO TEST-REC. WRITE TEST-REC END-WRITE. MOVE "ab" TO TEST-REC. WRITE TEST-REC AFTER 1 LINES END-WRITE. MOVE "abc" TO TEST-REC. WRITE TEST-REC BEFORE 2 LINES END-WRITE. MOVE "abcd" TO TEST-REC. WRITE TEST-REC END-WRITE. CLOSE TEST-FILE. STOP RUN.[/code] result in OC 1.1 Feb-09: [code]a ababc abcd [/code] - in hex [code]61 0a 0a 61 62 61 62 63 0a 0a 61 62 63 64 0a a \n \n a b a b c \n \n a b c d \n[/code] current result in OC CE: [code]a ab abc abcd [/code] - in hex [code]61 0a 0a 61 62 0a 61 62 63 0a 0a 61 62 63 64 0a a \n \n a b \n a b c \n \n a b c d \n[/code] The Mainfraime does not allow this at all [quote] PP 5655-S71 IBM Enterprise COBOL for z/OS 4.2.0 in progress ... LineID Message code Message text 16 IGYPA3217-S "WRITE BEFORE ADVANCING" statement was specified for "LINE SEQUENTIAL" file "TEST-FILE". The statement was discarded. Messages Total Informational Warning Error Severe Terminating Printed: 1 1 End of compilation 1, program PROG, highest severity 12. Return code 12[/quote] MF COBOL for UNIX 4.1r040 on HPUX and MF ServerExpress v2.2 on AIX give nearly the same result as current OpenCOBOL CE: [code]61 0a 0a 61 62 0d 61 62 63 0d 0a 0a 61 62 63 64 0a 00 a \n \n a b \r a b c \r \n \n a b c d \n[/code] ACU COBOL 7.2.0 on UNIX [code]0a 61 0d 0a 61 62 0d 61 62 63 0d 0a 0a 0a 61 62 63 64 0d \r a \r \n a b \r a b c \r \n \n \n a b c d \r[/code] Has somebody the hex dump of other compilers available or a useful opinion about what's right/wrong in this case? Simon 'human' Sobisch ---------------------------------------------------------------- @human I have never worked with a compiler (Wang, Burroughs, IBM [VS, OS/400, System/36, DOS], HP, MicroFocus, AccuCobol) where mixing before and after on the same printer file gave me the results I was hoping for. Maybe the problem has been me all along :-) For our part we ask the programmers to use either before or after but not both in the same program. Getting your question answered might help me to understand something that I have ignored far too long. jimc ---------------------------------------------------------------- As far as I can tell the draft Standard (like all previous standards) has no explicit rule prohibiting the use of WRITE AFTER and WRITE BEFORE for the same file in the same program. HOWEVER, the "behavior" of both phrases is "sort of" up to the implementor. (Cf for example, the IBM ADV/NOADV compiler option). I am with Human, in thinking tha everytime I have seen a program that TRIED to mix these, the run-time results were not what was desired. I thought I had seen a warning against this in the IBM manuals, but haven't been able to find one. I would fully support OC producing a warning or informational message when both phrases were used for the same file in the same program. ---------------------------------------------------------------- Only just seen this sorry, I have used before and after since the early 60's ok, to be specific 1961 on IBM 1401 and ICL 1501's and up through 360/370 and later! I have used it in printcbl. I do not understand the problem as its almost mandatory when writing to a print file in OC in order not to waste paper eg, unneeded page skips at start of the report and yes some of my stuff is still being printed on m/f chain / barrel printers running at 3 - 5,000+ lines per minute and Ops do not like paper wastage or for that matter, paper breaks (slows down keeping the printer correctly feed and cleared. Removal of this function will cause a rather large number of my programs to fail and I would really prefer not to have to change them all because of a change to the standard by OC. As to what IBM allows in 'one' of its compilers is a total nonstarter. What are the system setting for that specific site compiler that caused the error msg? . and yes IBM compilers along with other m/f manufactures do/did the same eg, ICL. The m/f support team install the compiler/s with predefined parameters that help to force site standards and no more. If some one had a look at these setting they might well find that the option is turned off. That said it is not difficult for a programmer to override all of the site params if needed eg, migration from a 'no longer supported' compiler for the latest one assuming the site can afford to upgrade and I don't just mean the price of it!! Vincent, almost now retired 'sic'. ---------------------------------------------------------------- Does printcbl use a COBMINATION of WRITE AFTER ADVANCING and WRITE BEFORE ADNANCING I don't think there is any quesiton that both need to be supported. The only issue (as I understood it) was what happens when you use a combination of the two in the same program against the same (lien sequential) file. So far, I haven't found any "documented" restriciton against it in any compiler, but I did have a "vague" memory of there being problems when the two were mixed. I *KNOW* there are problems when you mix BEFORE/AFTER ADVANCING and' BEFORE/AFTER POSITIONING but "positioning" is an old feature (used for "card stackers" mostly) and I don't even know if OC supports "postioning" ---------------------------------------------------------------- BEFORE/AFTER POSITIONING isn't supported (and isn't part of ISO 20xx draft, not sure if it was a part of the ANSI standard), and I guess there is no real need for that. If there is a real need and if documentation can be shared, we may have a look at it (simply integrating a submitted patch would be more likely, of course). For sure both BEFORE/AFTER ADVANCING will be supported. The question here is how OpenCOBOL should handle the mixture. Please have a look at the differences between 1.1feb09 and current CE-version (one x'0A' in this case). I'm not sure what is "more correct", but as current CE is "nearer" to other vendors than feb09 I'd vote for the current CE one. Any thoughts? Simon 'human' Sobisch ---------------------------------------------------------------- Micro Focus 4.1 (1999) Run on SCO 6.0.0 [code] 0000 61 0a 0a 61 62 0d 61 62 63 0d 0a 0a 61 62 63 64 a..ab.abc...abcd 0010 0a . 0011 [/code] RM Cobol 85 version 6.09 (1997) SCO 6.0.0 [code] 0000 0a 61 0d 0a 61 62 0d 61 62 63 0d 0a 0a 0a 61 62 .a..ab.abc....ab 0010 63 64 0d cd. 0013 [/code] ---------------------------------------------------------------- The last post makes me think that there MIGHT be an issue about what is and is not predictable with WRITE BEFORE/AFTER advancing. It is clear from the Standard (and this has been explicitly discussed within the standards groups), that the ONLY thing that these phrases are "guaranteed" to do is impact how the output appears on a PRINTED page (with a supported printer). For example if you WRITE AFTER ADVANCING 2, this can be done with "two carriage control" characters, two blanks lines, or if the printer supports it, a "skip 2 lines" control character. Furthermore, the same compiler can create DIFFERENT "physical" ways of doing the same thing depending on anything they want (up to and including the time of day!) You need to actually "print" the output of these statements to see if the compiler (and run-time) are working as required. Just "looking at" the bytes in the file is NOT what these statements/clauses are intended to impact. ---------------------------------------------------------------- End of story: I've changed the test suite according to the new behaviour of CE, because nearly all other compilers have a line break between ab and abc. human ---------------------------------------------------------------- Subject: OpenCOBOL ROME (almost ) MEETING.. Last Friday, in Rome, at the Engineering Spa conference hall, (that I really would like to thank for allowing us to have a meeting there), I had a meeting with a manager of Tokio System House and, a consultant of him. We talked about openCOBOL projects ...strengths.. weaknesses, tp-cobol-debugger, Guicobol and the cobol oss Consortium that in Japan is working for improving opencobol. Good to see that there is a so good interested for cobol in general and to know that opencobol in strongly used in production !. Federico :-) ---------------------------------------------------------------- Hi Federico, as OpenCOBOL CE is ongoing I tried to contact the OSS Consortium, but didn't have received any answer yet. Do you have a contact address? If yes, please pass it to me via PM or e-mail. Simon 'human' Sobisch ---------------------------------------------------------------- Federico; Nice news. Human, I'll try and drop them a note as well. Cheers, Brian ---------------------------------------------------------------- Subject: different (wrong) results on comp-3 depending on fnotrunc Hi guys, I'am using OC 1.1 on suselinux. Have a look on this simple program named cobnum.cbl: [code]IDENTIFICATION DIVISION. PROGRAM-ID. cobnum. DATA DIVISION. WORKING-STORAGE SECTION. 01 FLD1 PIC S9(9) COMP-3. 01 FLD2 PIC S9(9) COMP-3. 01 FLD3 PIC S9(9) COMP-3. PROCEDURE DIVISION. 000-Main. DISPLAY 'Testprogramm'. DISPLAY 'Test 1'. MOVE 734683 TO FLD1. DISPLAY 'Inhalt FLD1 =' FLD1. MOVE 734684 TO FLD2. DISPLAY 'Inhalt FLD2 =' FLD2. SUBTRACT FLD2 FROM FLD1. DISPLAY 'Erg FLD1-FLD2 =' FLD1. DISPLAY 'Test 2'. MOVE 734683 TO FLD1. DISPLAY 'Inhalt FLD1 =' FLD1. MOVE 734684 TO FLD2. DISPLAY 'Inhalt FLD2 =' FLD2. SUBTRACT FLD2 FROM FLD1 GIVING FLD3. DISPLAY 'Erg FLD1-FLD2 =' FLD3. DISPLAY 'Test 3'. MOVE 734683 TO FLD1. DISPLAY 'Inhalt FLD1 =' FLD1. MOVE 734684 TO FLD2. DISPLAY 'Inhalt FLD2 =' FLD2. SUBTRACT FLD2 FROM FLD1 GIVING FLD1. DISPLAY 'Erg FLD1-FLD2 =' FLD1. STOP RUN.[/code] Compile this programm with cobc cobnum.cbl. Run this program with cobcrun cobnum and you will see (all is okay): [code]Testprogramm Test 1 Inhalt FLD1 =+000734683 Inhalt FLD2 =+000734684 Erg FLD1-FLD2 =-000000001 Test 2 Inhalt FLD1 =+000734683 Inhalt FLD2 =+000734684 Erg FLD1-FLD2 =-000000001 Test 3 Inhalt FLD1 =+000734683 Inhalt FLD2 =+000734684 Erg FLD1-FLD2 =-000000001[/code] Now compile this programm with cobc -fnotrunc cobnum.cbl. Run this program with cobcrun cobnum and you will see (the first result is quite wrong) : [code]Testprogramm Test 1 Inhalt FLD1 =000734683+ Inhalt FLD2 =000734684+ Erg FLD1-FLD2 =999999999- Test 2 Inhalt FLD1 =000734683+ Inhalt FLD2 =000734684+ Erg FLD1-FLD2 =000000001- Test 3 Inhalt FLD1 =000734683+ Inhalt FLD2 =000734684+ Erg FLD1-FLD2 =000000001-[/code] Why does the fnotrunc-option weight the computation of com-3 fields?? This seems to be a serious bug. With kind regards Michael :-o :-o :-o ---------------------------------------------------------------- Micheal. I'm not going to pretend to be that guy, but Sergey has a good eye to find numeric inaccuracies and the skill to fix them. Watch the SourceForge SVN tree. Sergey has already posted some updates, libcob/numeric.c was one of the files patched so far. Not for this issue though. But do keep an eye of the forge at http://sourceforge.net/projects/open-cobol/ and http://open-cobol.svn.sourceforge.net/viewvc/open-cobol/ Cheers, Brian ---------------------------------------------------------------- Hi Brian, can you please add these two samples to the test suite (it's better to have a failed test in trunk than a bug we forget to fix - or to add a similar bug later on). If it's possible I'd like you to add a test for every bugfix that is checked in. Pleeeeaaase. Simon 'human' Sobisch ---------------------------------------------------------------- numeric.c with corresponding fix commited to SVN. ---------------------------------------------------------------- Hi Sergey, we checked out the newest version today (09/10/2012), but the bug is still present. The module numeric.c was recently changed in september. Michael ---------------------------------------------------------------- Updated to the latest from SVN today - I don't see this error. Everything is correct. And, BTW, I added one thing to your test. If you still have this bug, you will see funny result. [code] IDENTIFICATION DIVISION. PROGRAM-ID. cobnum. DATA DIVISION. WORKING-STORAGE SECTION. 01 FLD1 PIC S9(9) COMP-3. 01 FLD2 PIC S9(9) COMP-3. 01 FLD3 PIC S9(9) COMP-3. 01 FLD4 PIC S9(7)V99 COMP-3. PROCEDURE DIVISION. 000-Main. DISPLAY 'Testprogramm'. DISPLAY 'Test 1'. MOVE 734683 TO FLD1. DISPLAY 'Inhalt FLD1 =' FLD1. MOVE 734684 TO FLD2. DISPLAY 'Inhalt FLD2 =' FLD2. SUBTRACT FLD2 FROM FLD1. DISPLAY 'Erg FLD1-FLD2 =' FLD1. DISPLAY 'Test 1-A'. MOVE 734683.12 TO FLD4. DISPLAY 'Inhalt FLD4 =' FLD4. MOVE 734684 TO FLD2. DISPLAY 'Inhalt FLD2 =' FLD2. SUBTRACT 734684 FROM FLD4. DISPLAY 'Erg FLD4-FLD2 =' FLD4. DISPLAY 'Test 2'. MOVE 734683 TO FLD1. DISPLAY 'Inhalt FLD1 =' FLD1. MOVE 734684 TO FLD2. DISPLAY 'Inhalt FLD2 =' FLD2. SUBTRACT FLD2 FROM FLD1 GIVING FLD3. DISPLAY 'Erg FLD1-FLD2 =' FLD3. DISPLAY 'Test 3'. MOVE 734683 TO FLD1. DISPLAY 'Inhalt FLD1 =' FLD1. MOVE 734684 TO FLD2. DISPLAY 'Inhalt FLD2 =' FLD2. SUBTRACT FLD2 FROM FLD1 GIVING FLD1. DISPLAY 'Erg FLD1-FLD2 =' FLD1. STOP RUN. [/code] ---------------------------------------------------------------- Subject: Off topic: IPython, notebooks and Opera Not really COBOL related (yet). IPython release 0.13 is one nifty shell. Command line, Qt, and collaborative notebook web interfaces. I'm keen to post this as 0.13 works in Opera 12. Opera is my browser of choice, and the IPython team have created an awesome development environment (in my humble). I'm hot on the trail to see if IPy's parallel computing engine can't replace our GNU/Linux fleet management scripts. Yayy for shiny new toys. This may be the hummph needed to get motivated to complete an embedded Python engine for OpenCOBOL. Previous attempts at embedding Python (aside from the super easy high level 'execute scripts for side effect') seemed like too much work (for the expected gains) and the itch stopped there. Getting itchy again. See http://ipython.org/ and for some fanboy screenshots: http://my.opera.com/btiffin/blog/2012/07/06/ipython-0-13 Cheers, Brian ---------------------------------------------------------------- Subject: coblist cobol list utility... Hello Federico, In your announcement at <http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1441&forum=1&post_id=7673#forumpost7673> you asked "and who/what could be shared for cobol. If any are interested to share or give any contribute (articles ...code or others) please contact me at ..." That sounds great and I would like to share some GPL'ed code which I published at http://data.mobach.nl/opencobol/ for anyone. There are two programs to be found, developped and tested with openCOBOL: - coblist, to generate a source listing including copymembers up to 3 levels, and - fldconv, to convert flat files from and to ASCII and EBCDIC, packed decimal / fixed point binary decimal to signed zoned decimal and so on. Best regards, Fred -- Fred Mobach website : https://fred.mobach.nl .... In God we trust .... .. The rest we monitor .. I send a reply at the fred@mobach.nl but always I am getting the message: SMTP protocol diagnostic: 553 5.3.0 We don't accept mail from ...(my mail server mail as iol.it) as most is spam[a] then I am going to upload the reply message here: thanks you so much for the email you sent. I am just having a look at the coblist. it required a file copy at 261 line that seems to be missing. Do I have to get it from another location ? Federico ---------------------------------------------------------------- @Fred: We created an subfolder in the "official" SVN for GPLed code contributions. See [url=http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1484&forum=1#forumpost7649]this topic with details[/url]. Currently there are no external contributions uploaded, so anyone can be the first :-) Simon 'human' Sobisch ---------------------------------------------------------------- Hmm,, someone offered me access to load up my utils but so far no action on the attribs. So have not been able to do so. Vincent ---------------------------------------------------------------- You should be able to upload (as vbcoen), as I've set the same rights for the user as I've set for Ska - who is able to commit. See [url=http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1484&forum=1#forumpost7649]the svn topic[/url] for details. If you have problems to commit send me a PM. Simon ---------------------------------------------------------------- @fred: In general, about the code you sent and uploaded. It's ok. but you please should have to add the COPYING.DOC and add the GPL license into the head of the cobol source and (of course) your NAME as author ;-) Actually it doesnt seem to be enrolled as one. I tried it with the tp-cobol-debugger. just to understand better the logic inside. It looks good. thanks for your mail. ps. mail servers used by me are mail.libero.it and mail.tp-srl.it ping them names to obtain the ip address. Federico ---------------------------------------------------------------- Subject: JAPANESE opensource COBOL 1.2J @All since new users cannot be recorded I am putting here the latest I received from japan... google translator is required to navigate. Chrome allows you to do that automatically.. Federico "In Japan, we finally released our localized version of OpenCOBOL (alias "opensource COBOL" given for some trademark reason in Japan)yesterday, the very last day of July in JST. Distribution location is http://www.osscons.jp/osscobol/download/ but the site still lacks other language versions than Japanese... Kazuyoshi Tanaka ---------------------------------------------------------------- Changes (from tarball->Changelog+NEWS) [quote]2012-07-31 OSS Consortium <ws-opensource-cobol-contact@osscons.jp> * opensource COBOL Version 1.2J released.[/quote] [quote]* Changes in opensource COBOL 1.2J ** Support Feature of Japanese, such as constant and definition of data and operation of data. ** New compile option '-assign_external' and variable 'assign_external=[yes|no]'. Set the file assign to the EXTERNAL file. ** New compile option '-free_1col_aster'. In free format COBOL mode, this option causes the compiler to regard as line comment when first column is asterisk for free format COBOL mode. ** New runtime environment variable OC_USERFH, which enable to run user-defined program in operation OPEN, CLOSE, DELETE, READ, REWRITE, START, WRITE, COMMIT, ROLLBACK and UNLOCK. ** Support currency symbol for Japanese yen, and modify default currency symbol to Japanese yen. ** Changed to apply the alphabetic manner as comparison method in case its operands include group fields. ** Fixed the problem that INSPECT causes incorrect result in case given the AFTER/BEFORE clause with negative value or SIGN SEPARATE field. ** Fixed the problem that value comparison on SIGN SEPARATE fields in IF or EVALUATE statements fails treating such field values as if their sign character were a part of digits. ** Fixed the problem that applying INITIALIZE on 01-level records in EXTERNAL files causes incorrect behavior of following I/O instructions. ** Changed the default actions on unhandled SIZE ERROR according to that specified in Programmer's Guide. ** Fixed the problem that applying INITIALIZE or MOVE ZERO on numeric field of SIGN SEPARATE destroys sign byte. ** Fixed the problem that COPY statement ignores the last line of each copybook when it does not end with line break.[/quote] In total there are 302 changes to 1.1 release, most of them seem to be stuff for supporting Japanese. I'd like to include part of them (slightly changed) into CE-version. Simon 'human' Sobisch ---------------------------------------------------------------- Japanese OSS consortium has started working on opencobol. Still on overdated 1.1 Will someone tell them it would be better work on 2.0 ? marcellom ---------------------------------------------------------------- @all.... Japanese email Dear OpenCOBOL experts, Since the time I wrote here before, Japanese group in OSS consortium had been working on development of localized branch of OpenCOBOL. Though it took more days than our plan, we released the first version of it. Thanks to Mr. Federico Priolo and the follow-up by Mr. Simon 'human' Sobisch, brief information such as summary of our changes, contact address, etc. are available at opencobol.org's web forum article. Thank you for your kind cooperation. Notice: Some changes are useful only in Japan (such as default currency sign '\') and/or incompartible with original OpenCOBOL. They may cause errors or unexcpected behavior with valid COBOL codes for original OpenCOBOL 1.1 pre-release. We are very glad to reply your comments. And if some of the items in our changelog could be also useful in main line (CE?) development, I'm willing to provide more information, individual patch, etc. Regards, Kazuyoshi Tanaka Open COBOL solution group, OSS consortium. ---------------------------------------------------------------- Hi Federico, please pass my mail address to Kazuyoshi Tanaka, there are some things I want to discuss with him via mail (little issues with the J-version, possible individual patches, further use of CE as base for next J-versions). You can add the question concerning the [url=http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1485&forum=1]line break issue[/url], maybe he has some opinion about that. Thank you, Simon ---------------------------------------------------------------- Congratulations to all for successfully porting OpenCobol to Japanese. Good job. Cobol just ran another lap around the 100 meter track. Cobol is dead? Looks fit to me. ---------------------------------------------------------------- Subject: Raspberry Pi Just hooked up my first Raspberry Pi--the $35 computer. http://www.raspberrypi.org/ Used 4GB sd card with Debian 6 "Wheezy" from elementI4. apt-get update -- to bring things up to date apt-get open-cobol -- got version 1.1 FTP'd some source code over and compiled. Worked without a single hitch! ---------------------------------------------------------------- yes OC runs really nicely ont he raspberry pi. i've been using it on one for the last few months (got my raspi in april) with no major problems. CE version fails one test LINE SEQUENTIAL write but from what i've read (iirc) the correct output for that is still up for debate, 1.1 builds and runs well whith the tests taking 16minutes +- a few depending on gcc flags and options used (this is on raspbian armhf distro). I ran the telco benchmark yesterday and the million number file takes 105seconds +-1sec all in all it's pretty good. [note: elastic cobol is also available for the raspi now as well, it has some nice bits such as GUI but it uses JVM which with my irrational dislike of java is a minus for me] ---------------------------------------------------------------- As I guess you don't need to run the binary files generated by the raspi on other systems I suggest to run the compiler/runtime and the programs optimized (only works on GCC 4.2+ [run gcc --version to check]). Build OpenCOBOL again [code]export CFLAGS="$CFLAGS -march=native -O3" ./configure make[/code] and to enable this for compilation with CE [code]cobc -O2 -A -march=native ...[/code] (for enabling this with 1.1 you need to lookup COB_CFLAGS in defaults.h, export this together with -march=native) Please tell us the new benchmark results, just for the record. Simon ---------------------------------------------------------------- the defaults settings for gcc in the raspbian os for the raspberry pi are already set to be -march=armv6 -mfpu=vfp -mfloat-abi=hard so set at their optimum settings already & -O3 doesn't make a difference really at all, maybe a second or two but well within my margin of error for timing so might even already be set as the default setting for gcc too. i could start adding other optimisations but then you start getting to the 1 optimisation helps one program but slows down another so should only be used sparingly and tweaks individually. i could use -mcpu=arm1176jzf-s but so far on other things it's not made a measurable difference to speed of execution over just using -march=armv6 ---------------------------------------------------------------- Thank you for this information. I guess it's done by system default for CFLAGS? Simon ---------------------------------------------------------------- Subject: Porting COBOL from MicroFocus to OpenCOBOL I've written a few notes on porting COBOL apps from MicroFocus to OpenCOBOL. They are available at http://www.bawtry.net/image/bawtry/port-report.html Each issue is illustrated with a COBOL source program and the results from MicroFocus & OpenCOBOL published. The notes may be of narrow interest but I hope they'll be helpful to somebody. ---------------------------------------------------------------- Thank you for this reference. Please post a patch for each mentioned change in the sources (one area by one). This way we can have a look at them and possibly include them into CE version. Are you willing to submit them on your own to the CE-svn (this includes adding split-key support for BDB :-) )? Simon BTW: You forget to mention the flags used for ./configure and the options used for running cobc (I guess you used at least -std=mf), please add them to the paper. Edit for Reference: - switch-0 compiles clean in 2.0 and should do in CE (after a patch, too) - Implied ends compile clean in 2.0 when the new option "-frelax-syntax Relax syntax checking" is used - not sure if we can include this into CE - DELETE File should be not that hard to implement in CE, if we now the possible return/file-io codes (patches are welcome). Current workaround would be to use C$DELETE (which needs the full file name and the type [ISAM yes/no]). - the correct exit (not crash) only occurs if you enable all runtime checks by using cobc -debug (what I always suggest to do), elsewise you get the result you like to have (doing no check and using zero instead) ---------------------------------------------------------------- Thanks Simon. The notes are "work-in-progress". I've amended/re-run example 5.5 to make it clearer and re-posted. I'll revisit 5.1 tomorrow. There were also some "issues" around non-ISAM IO which I'll add later. Will get back to you when I think my hacks (especially split-keys) are fit to be exposed to the public gaze! OpenCOBOL has been great on our production systems - most of the problems encountered have been related to our in-house ISAM handling! ---------------------------------------------------------------- Hi Joe, good work. Please post to this topic when you made changes to the document in the same way as you did yesterday. This helps us to read the parts that changed, instead of everything. I thought part of you hacks (like the pipes) should be near ready for public (maybe needs test/tweaking for Windows systems)? Take the time you need and afterwards a commit to CE will be nice. Simon ---------------------------------------------------------------- Report updated: Resume from ./configurer used to create reference OpenCOBOL added to section 3.1 Section 5.1 elaborated showing results with/without -std=mf ---------------------------------------------------------------- @JoeRobbins It sounds really interesting. As soon as ready I'll help you on tests. @human I think that both JoeRobbins' and the_piper's works should be available as soon as possible on CE (am I wrong in thinking that Roger's 1.1 + 2.0 are definitely dead?). Long-standing problems seem to have finally found a solution. marcellom ---------------------------------------------------------------- @marcellom: Don't get me wrong, I like people being involved... But the changes from JoeRobbins are highly a point of view what's right/wrong (everything despite of SPLIT KEY Support) and most points need a config/compile flag to be enabled. I don't recall the changes of the_piper, what changes to libcob/cobc has he done (a link would be useful). In general I think it's important to keep the "big picture": - don't change the standard behaviour if it isn't clearly a bug (because of possible breaking existing systems) - changes to Screen-IO/ISAM handling need to work exactly the same way on all different curses (including OSes) and ISAM - test, test, test... and provide entries for the test suite Simon 'human' Sobisch BTW: "Roger's 1.1" can only be the "official" 1.1 (available at SourceForge/via aptget and other tools/at this site [wrongly titled as pre-release]), the 2.0 has to wait until Roger shows up again - what I still hope he will (he's currently not available) ---------------------------------------------------------------- @human I think that your comment makes a very good point. It would seem that the OpenCOBOL community consists of members with different goals and needs. Many years ago we learned to avoid proprietary special extentions and to keep our Cobol code as close to standard as we could. Before we started with OpenCOBOL 1.1 it looked like LAMP (Linux, Apache, MySQL, PHP) was going to be our platform going forward, in spite of the difficulties PHP presents in a commercial computing world. When we found OpenCOBOL we were able to go to a CALM (Cobol, Apache, Linux, MySQL) programming environment and have been much more productive as a result. We realize that there are still many things that could be done to OpenCOBOL that would make it easier to convert code from existing Cobol environments, and we hope that those things happen for the community. While version 2.0 promises many features that we would like to see, we are lucky to have version 1.1 and are thankful for it. For us having the ability to move from our "green screen" ISAM oriented products to Web and industry standards based databases has improved our offerings and our future. Thank you to the entire development team and community. jimc ---------------------------------------------------------------- [quote] in spite of the difficulties PHP presents in a commercial computing world. [/quote] Is it possible for you to elaborate? ---------------------------------------------------------------- @jgt I did not mean to incite a debate over that remark. PHP has great value to us in certain applications. For commercial purposes we find that since there is no command to declare (define) a variable we are vulnerable to misspelling of variable names causing results to go off into the "bit bucket" and that variable types change depending upon the data that is assigned (moved) to the variable. Further the programmers tend to slip up when: = means "assign to (move)" == means "is kind of equal to" === means "is really exactly equal to" The default for arithmetic is floating point and that causes difficulty with certain decimal computation. The language is interpreted at run-time, thereby hurting performance. The internal data tables are assigned dynamically, making memory management expensive. There are other issues that in general make us prefer to use Cobol for most commercial applications. Once again, I am not trying to condemn PHP, we have a body of code where it has been very useful. jimc :-) ---------------------------------------------------------------- Actually, I was afraid you were going to say something that I had overlooked or worse, didn't even know! Jack ---------------------------------------------------------------- @human JoeRobbins' and the_piper's work are aimed to add important extensions to OC: 1) split keys; 2) Mf support implementation; 3) Sql extended support (precompiler). The 1st is posix standard 2nd+3rd are asserted by OC to be supported. If OC CE is meant to be as OC 1.1 is, what use is it planned for? I don't mean JR's and the_p's works should be included "as they are". I just say there should be a way to make them available for download and tests "inside or aside" OC CE. JoeRobbins said he worked on a modified .configure. Why not having both .configure and, say, .configure1 in packaged OC CE. We all have been waiting a long time for Roger's showing up with 2.0 but, he does not even show in forum so, immagine. Roger did a great work in the past but it is obvious, at least to me, that he has been, and is, engaged with something else and has no time for OC. marcellom ---------------------------------------------------------------- I think you got me wrong. I want especially the split key stuff in CE (that was based on 1.1 and already has some patches - more if I find the time to sort the parts for the different patches out or if we get patches from others). I've understood the precompiler as an own package (that would be welcome to find it's way to CE/contribute), not a change to cobc. The MF stuff may could be included, but not as a standard behaviour (maybe new config options). What configure changes are in progress? Simon 'human' Sobisch ---------------------------------------------------------------- Hey Joe, are your changes ready for review and include in CE (see the CE thread if you did not do this already)? For the changes of key check please review [url=http://documentation.microfocus.com:8080/help/index.jsp?topic=%2Fcom.microfocus.eclipse.infocenter.visualcobol.eclipsewin%2FHRFLRHEXFH1C.html]MF Docs KEYCHECK[/url] and implement it with env vars (similar to file name mapping "DD_") to be included in CE. If this currently only works for VB/C/D-ISAM that is OK, too [as it isn't the default behaviour], if you can get it to work with BDB now/later this would be really nice. Simon 'human' Sobisch ---------------------------------------------------------------- @human I was awaiting to see JoeRobbinks work. Tried to write a couple of mails to info@bawtry.com but had no answer. Do you have any news? marcellom ---------------------------------------------------------------- Apologies! Apologies! Apologies! I hadn't noticed this thread was being extended. Forgive my dozyness. I will do my best to post this week (with code for split-keys, etc.) marcellom: it's bawtry.net (NOT .com) email to "support@" - I hope that this doesn't "trash" our support mail-box! ---------------------------------------------------------------- Thanks Joe, it is my turn to apologize. marcellom ---------------------------------------------------------------- Subject: Simple cobol benchmark... Hi all just to have an idea I wrote a simple (very indeed!!) cobol benchmark to evaluate opencobol performances. You can read/download it from www.tp-srl.it (at Simple Cobol benchmark section). There you can also read about the test I did on a windows computer with 2 opencobol versions. Could be interesting read about yours test with your opencobol and other (if you have any) just for generic evaluation. Feel free to upload a comment with your results Thanks for your attention Federico ---------------------------------------------------------------- Nice piece of code. For all: [url=http://cms.tp-srl.it/joomla/index.php/benchmark]here's the direct link to the benchmark[/url]. A little discussion about performance and maybe about doing benchmarks can be found [url=http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=661&forum=1]at this forum topic[/url]. As you'll find out there it depends on the options given to the C compiler. On big sources -O2 has an influence, -debug always slows the module a little bit (as there are additional checks inserted [especially to COMPUTE]). As the most stuff is done outside of the COBOL module, the speed highly depends on the options given to the C compiler when libcob and the external libraries (libgmp [most cases highly optimized], libvbisam, ...) where compiled. BTW: The test results for your BENCH01 on my machine is nearly the same as yours, as my machine is nearly identical. Simon 'human' Sobisch ---------------------------------------------------------------- Federico, thank you for doing this. On my RaspberryPI (256MB ram, ARM V6 which appears to be running at 250MHz, Debian "Wheezy", SD card for disk, OpenCOBOL 1.1 [apt-get from debian for ARM]): Elapsed time 00 min:00 sec: 03 hundredths 69 for COMPUTE Elapsed time 00 min:00 sec: 07 hundredths 21 for UNSTRING Elapsed time 00 min:00 sec: 04 hundredths 16 for STRING Elapsed time 00 min:00 sec: 03 hundredths 11 for WRITE Elapsed time 00 min:00 sec: 00 hundredths 64 for READ Elapsed time 00 min:00 sec: 01 hundredths 79 for DELETE Elapsed time 00 min:00 sec: 20 hundredths 63 for COMPLETE TEST Not bad for $35.00 IMHO jimc ---------------------------------------------------------------- On my good old HP N4000 (4 processors [PA8500, 400MHz], 4GB memory, Debian 4.0, OpenCOBOL 1.1 compiled from the pre-release files from this forum): Elapsed time 00 min:00 sec: 03 hundredths 28 for COMPUTE Elapsed time 00 min:00 sec: 05 hundredths 80 for UNSTRING Elapsed time 00 min:00 sec: 04 hundredths 50 for STRING Elapsed time 00 min:00 sec: 01 hundredths 30 for WRITE Elapsed time 00 min:00 sec: 00 hundredths 44 for READ Elapsed time 00 min:00 sec: 00 hundredths 70 for DELETE Elapsed time 00 min:00 sec: 16 hundredths 02 for COMPLETE TEST Maybe it had to translate into Italian and then back to English :-) jimc ---------------------------------------------------------------- @all Interesting could be doing the same test on the same computer with other cobol compilers.. (microfocus, acucobol, fujitsu, realia.. liant.........or other if you have one) just to know the performance and where this compiler arrives.. :-) Federico ---------------------------------------------------------------- On my HP-ITANIUM (4 processors [Madison, 1.5GHz], 28GB memory, Debian 5.0, OpenCOBOL 1.1 compiled from the sources from this forum): Elapsed time 00 min:00 sec: 00 hundredths 75 for COMPUTE Elapsed time 00 min:00 sec: 01 hundredths 20 for UNSTRING Elapsed time 00 min:00 sec: 00 hundredths 84 for STRING Elapsed time 00 min:00 sec: 00 hundredths 42 for WRITE Elapsed time 00 min:00 sec: 00 hundredths 11 for READ Elapsed time 00 min:00 sec: 00 hundredths 41 for DELETE Elapsed time 00 min:00 sec: 03 hundredths 73 for COMPLETE TEST This was on a machine that was running who knows how many other tasks. jimc ---------------------------------------------------------------- @all: you know that the amount of processors and memory (if not under 64MB) has no impact, as OpenCOBOL only uses one processor and this test prog, together with the library does not use much memory (on my environment max. of 3628K private bytes and 29172K virtual memory and 5884K physical memory) The stuff that's important is the processor (type/speed) and for READ/WRITE the storage. Here my results with no additional compiler switches [code]WIN7 x64 Pentium E6600 @ 3.06GHz Gary's MinGW-package (patched OpenCOBOL 1.1) x86 (on x64) Elapsed time 00 min:00 sec: 00 hundredths 29 for COMPUTE Elapsed time 00 min:00 sec: 00 hundredths 79 for UNSTRING Elapsed time 00 min:00 sec: 00 hundredths 38 for STRING Elapsed time 00 min:00 sec: 00 hundredths 29 for WRITE Elapsed time 00 min:00 sec: 00 hundredths 03 for READ Elapsed time 00 min:00 sec: 00 hundredths 19 for DELETE Elapsed time 00 min:00 sec: 01 hundredths 99 for COMPLETE TEST[/code] @jimc: The download of 1.1 from this forum (without any patches) is the same you get via apt-get [the title is simply wrong and cannot be changed currently] Simon ---------------------------------------------------------------- on a raspberry pi running raspbian i get ./bench01 Elapsed time 00 min:00 sec: 04 hundredths 18 for COMPUTE Elapsed time 00 min:00 sec: 05 hundredths 64 for UNSTRING Elapsed time 00 min:00 sec: 03 hundredths 42 for STRING Elapsed time 00 min:00 sec: 02 hundredths 49 for WRITE Elapsed time 00 min:00 sec: 00 hundredths 62 for READ Elapsed time 00 min:00 sec: 01 hundredths 27 for DELETE Elapsed time 00 min:00 sec: 17 hundredths 63 for COMPLETE TEST ---------------------------------------------------------------- @Simon, I updated the CPU specs on my posts. Thank you for the clarification about apt-get being the same as the code on the site. We did our builds for these systems back when apt-get got us OpenCOBOL 1.0. Now you guys have updated the repository to 1.1. Thank you for all of your good work. jimc ---------------------------------------------------------------- Results on same machine with with ACUCOBOL-GT (needed compile switch -Ca to get the results on console) [code]WIN7 Pentium E6600 @ 3.06GHz ACUCOBOL-GT 4.3.0 Elapsed time 00 min:00 sec: 00 hundredths 65 for COMPUTE Elapsed time 00 min:00 sec: 01 hundredths 04 for UNSTRING Elapsed time 00 min:00 sec: 00 hundredths 78 for STRING Elapsed time 00 min:00 sec: 00 hundredths 75 for WRITE Elapsed time 00 min:00 sec: 00 hundredths 38 for READ Elapsed time 00 min:00 sec: 00 hundredths 72 for DELETE Elapsed time 00 min:00 sec: 04 hundredths 32 for COMPLETE TEST[/code] [code]WIN7 Pentium E6600 @ 3.06GHz ACUCOBOL-GT 6.1.0 Elapsed time 00 min:00 sec: 00 hundredths 51 for COMPUTE Elapsed time 00 min:00 sec: 00 hundredths 71 for UNSTRING Elapsed time 00 min:00 sec: 00 hundredths 37 for STRING Elapsed time 00 min:00 sec: 00 hundredths 43 for WRITE Elapsed time 00 min:00 sec: 00 hundredths 22 for READ Elapsed time 00 min:00 sec: 00 hundredths 47 for DELETE Elapsed time 00 min:00 sec: 02 hundredths 71 for COMPLETE TEST[/code] As always: OC rocks - better performance and no weird switches needed. Simon 'human' Sobisch BTW: More test cycles (maybe a switch for doing it 10 times) would be useful to get clearer results ---------------------------------------------------------------- I did some performance testing some years ago and found an unusual result. The hundredths of a second field was only getting updated every 20 hundredths or so. For example, it would go from 1.20 seconds to 1.40. I wrote a program to demonstrate this. To my surprise, the hundredths get updated every .01 seconds, as I would normally expect. I'm not sure if it's different because of open-cobol, or Suse Linux, or the hardware. Here's the sample program. It displays 300 samples of the clock. Use it to check how your platform handles the hundredths. To compile, cobc -x sms.cob. [code] Identification division. Program-id. sms. * * sms * Show Milli Seconds. * * Displays rapid series of time. * To see how often the system clock is updated. * Environment division. * Data division. Working-storage section. * * Change this value to test the following: * f = Move function current-date to ws-current-date. * a = Accept ws-current-time from time. 01 ws-switch pic x(01) value "a". 88 ws-switch-function value "f". 88 ws-switch-accept value "a". * 01 ws-current-date. 02 ws-current-date-year pic x(04). 02 ws-current-date-month pic x(02). 02 ws-current-date-day pic x(02). 02 ws-current-time. 03 ws-current-date-hour pic x(02). 03 ws-current-date-minute pic x(02). 03 ws-current-date-second pic x(02). 03 ws-current-date-millisecond pic x(02). 01 ws-x-30 pic x(30). * Procedure division. * sms-Master. ** Sample clock rapidly, display each. Perform sc-sample-clock thru sc-exit 300 times. * sms-finish. Exit program. sms-stop. Stop run. * ** Sample clock rapidly, display each. * sc-sample-clock. ** Sample clock. If ws-switch-function Move function current-date to ws-current-date else Accept ws-current-time from time end-if. ** Format for display. Move space to ws-x-30. String ws-current-date-hour delimited by size ":" delimited by size ws-current-date-minute delimited by size ":" delimited by size ws-current-date-second delimited by size "." delimited by size ws-current-date-millisecond delimited by size into ws-x-30 end-string. ** Display it. Display ws-x-30. sc-exit. Exit. * *@! End of file. [/code] ---------------------------------------------------------------- the opencobol C code is [code] void cob_accept_time (cob_field *f) { #ifdef _WIN32 SYSTEMTIME syst; #else time_t t; #if defined(HAVE_SYS_TIME_H) && defined(HAVE_GETTIMEOFDAY) struct timeval tmv; char buff2[8]; #endif #endif char s[12]; #ifdef _WIN32 GetLocalTime (&syst); sprintf (s, "%2.2d%2.2d%2.2d%2.2d", syst.wHour, syst.wMinute, syst.wSecond, syst.wMilliseconds / 10); #else #if defined(HAVE_SYS_TIME_H) && defined(HAVE_GETTIMEOFDAY) gettimeofday (&tmv, NULL); t = tmv.tv_sec; #else t = time (NULL); #endif strftime (s, 9, "%H%M%S00", localtime (&t)); #if defined(HAVE_SYS_TIME_H) && defined(HAVE_GETTIMEOFDAY) sprintf(buff2, "%2.2ld", tmv.tv_usec / 10000); memcpy (&s[6], buff2, 2); #endif #endif cob_memcpy (f, (ucharptr)s, 8); } [/code] the C GetLocalTime function returns [code] typedef struct _SYSTEMTIME { WORD wYear; WORD wMonth; WORD wDayOfWeek; WORD wDay; WORD wHour; WORD wMinute; WORD wSecond; WORD wMilliseconds; } SYSTEMTIME, *PSYSTEMTIME; [/code] here the values are: wDay: The day of the month. The valid values for this member are 1 through 31. wHour:The hour. The valid values for this member are 0 through 23. wMinute:The minute. The valid values for this member are 0 through 59. wSecond:The second. The valid values for this member are 0 through 59. wMilliseconds The millisecond. The valid values for this member are 0 through 999. So why opencobol divide it by 10 again ? Could this be a mistake ? Federico ---------------------------------------------------------------- OpenCobol works fine. At least it does on Suse. The platform that didn't work was Microsoft. And that was with a MF compiler. Or maybe it was CA-Realia I can't remember, it was so long ago. ---------------------------------------------------------------- Yes the C code I was talking about is for win [code] #ifdef _WIN32 GetLocalTime (&syst); sprintf (s, "%2.2d%2.2d%2.2d%2.2d", syst.wHour, syst.wMinute, syst.wSecond, syst.wMilliseconds / 10); [/code] Federico ---------------------------------------------------------------- Yes, that does look strange. Maybe someone could run a Windows test and let us know what happens. ---------------------------------------------------------------- I have already done the test by changing the Opencobol version for windows that I have. But also I realized that if you put the standard output into a file sms > file.txt it doesn't contains any change, if you run the sms with the output console you can see the changes after some (20)? or lines.. This is NOT a trouble I think. Since when you loop for 300 times this doesn't mean it will run a cycle for hundredths so one can think for a bug. Instead it is only performing it fastly...the operating system will update the video with other rules... if you look into the file.txt instead you can undestand. So I think this is the reason... :-) Federico ---------------------------------------------------------------- When it doesn't contain any change, that means the milliseconds are never updated for the whole test? I think your machine is way faster than mine. Try upping the perform loop from 300 times to maybe 1000 times. Or more. I don't think it matters if it goes to console, or redirected to a file. Although redirecting to a file might slow it down a bit. It will still show the millisecond get updated. At some point, the clock should reset the milliseconds. The question is: Does it happen in .01 milliseconds or in .20 milliseconds (or some number not .01)? ---------------------------------------------------------------- Yes after I changed the opencobol removing the / 10 statement I also tried by moving the 300 up to 3000 and 9000. I saw the correct changing for hundredths but they step after 1277 +/- lines.. Federico ---------------------------------------------------------------- Good. That will make it easier to verify timing tests. ---------------------------------------------------------------- Yes infact I was thinking your cobol code could be very useful to test that. However the Opencobol C code is correct since it divides for 10 the field from the Getlocaltime returns value from 0 to 999. There is NO other division but only the "effect" of the fast running.. Federico ---------------------------------------------------------------- I'd would suggest to insert [code] 01 ws-sav-time. 03 ws-sav-date-hour pic x(02). 03 ws-sav-date-minute pic x(02). 03 ws-sav-date-second pic x(02). 03 ws-sav-date-millisecond pic x(02). 77 ws-cnt-same pic 9(05).[/code] and change the display part to something like [code] If ws-current-time not = ws-sav-time Move space to ws-x-30 if ws-cnt-same not = 0 String " (stayed for " ws-cnt-same " loops)" delimited by size into ws-x-30 end-string move 0 to ws-cnt-same end-if ** Display cycles / line break Display ws-x-30 end-display move ws-current-time to ws-sav-time ** Format for display. Move space to ws-x-30 String ws-current-date-hour ":" ws-current-date-minute ":" ws-current-date-second "." ws-current-date-millisecond delimited by size into ws-x-30 end-string ** Display it. Display ws-x-30 with no advancing end-display else add 1 to ws-cnt-same end-add end-if continue. sc-exit. Exit. [/code] this should result in much less displays/write to >logfile. Simon 'human' Sobisch ---------------------------------------------------------------- These results with Opencobol 1.1 binary package on a Intel(R) Core(TM)2 Duo CPU E7500 @2.93.Ghz 3,24 GB RAM XP Pro Service pack 3 Opencobol GCC 3.4.5 Gary's version (It was built using Berkeley Database V5.0.26, GMP V5.0.1 and PDCurses V4.3. [code] Elapsed time 00 min:00 sec: 00 hundredths 27 for COMPUTE Elapsed time 00 min:00 sec: 00 hundredths 83 for UNSTRING Elapsed time 00 min:00 sec: 00 hundredths 39 for STRING Elapsed time 00 min:00 sec: 00 hundredths 37 for WRITE Elapsed time 00 min:00 sec: 00 hundredths 03 for READ Elapsed time 00 min:00 sec: 00 hundredths 30 for DELETE Elapsed time 00 min:00 sec: 02 hundredths 19 for COMPLETE TEST [/code] Opencobol Microsoft Visual Express C++ 2008 (built from me using the opencobol.org tarball with VISAM BMP and PDCurses kindly received from Human. [code] Elapsed time 00 min:00 sec: 00 hundredths 32 for COMPUTE Elapsed time 00 min:00 sec: 00 hundredths 42 for UNSTRING Elapsed time 00 min:00 sec: 00 hundredths 29 for STRING Elapsed time 00 min:00 sec: 00 hundredths 18 for WRITE Elapsed time 00 min:00 sec: 00 hundredths 06 for READ Elapsed time 00 min:00 sec: 00 hundredths 28 for DELETE Elapsed time 00 min:00 sec: 01 hundredths 55 for COMPLETE TEST [/code] RES COBOL TO JAVA translator C:\RES\cobol>java -cp .;classes12.jar;..\RES.jar cobolprogramclasses.Bench01 [code] Elapsed time 0 min:0 sec: 6 hundredths 19 for COMPUTE Elapsed time 0 min:0 sec: 30 hundredths 31 for UNSTRING Elapsed time 0 min:0 sec: 14 hundredths 42 for STRING Elapsed time 0 min:0 sec: 8 hundredths 77 for WRITE Elapsed time 0 min:0 sec: 4 hundredths 61 for READ Elapsed time 0 min:0 sec: 4 hundredths 55 for DELETE Elapsed time 0 min:1 sec: 8 hundredths 85 for COMPLETE TEST [/code] ps. unfortunately it goes in exception for I/O so I can suppose its time worse then normal...at least for the file isam test... the others are far from being comparable to opencobol performances. Of course, all test were executed at the same PC. Federico ---------------------------------------------------------------- According to [url=http://opencobol2java.sourceforge.net/#timings]http://opencobol2java.sourceforge.net/#timings[/url] one should use "-opt1"/"-opt2" when creating Bench.01. You may want to add 2 benchmarks with these compile switches (I suggest to edit your post and if you don't mind, surround the benchmarks with code tags for easier readability)? Simon 'human' Sobisch ---------------------------------------------------------------- The java version was compiled with this batch [code] java -jar ..\RES.jar -c3 -v -opt2 -dp1 -overwrite -free BENCH01.cob java -jar ..\RES.jar -opt2 -gendb -c3 -dp1 -overwrite BENCH01.COB javac -cp .;..\RES.jar cobolprogramclasses\Bench01.java java -cp .;classes12.jar;..\RES.jar cobolprogramclasses.Bench01 -createtables [/code] That seems to be the best version. However I would like to say that the programmer who wrote the RES utility did a great work ! I got really surprised looking the cobol moving to a java class so fine. :-) Of course since java is running into a VM it won't be faster then OpenCOBOL that is a optimized build. But the goeal of this benchmark is giving us and idea abot the global performance of it (in general). Federico ps. I [code]ed my previous message... ---------------------------------------------------------------- Results on same machine with with VC 2010 Express, [code]WIN7 x64 Pentium E6600 @ 3.06GHz OpenCOBOL 1.1CE_120905 x86 (on x64) Elapsed time 00 min:00 sec: 00 hundredths 23 for COMPUTE Elapsed time 00 min:00 sec: 00 hundredths 43 for UNSTRING Elapsed time 00 min:00 sec: 00 hundredths 29 for STRING Elapsed time 00 min:00 sec: 00 hundredths 31 for WRITE Elapsed time 00 min:00 sec: 00 hundredths 23 for READ Elapsed time 00 min:00 sec: 00 hundredths 61 for DELETE Elapsed time 00 min:00 sec: 02 hundredths 14 for COMPLETE TEST[/code] [code]WIN7 x64 Pentium E6600 @ 3.06GHz OpenCOBOL 1.1CE_120905 x64 Elapsed time 00 min:00 sec: 00 hundredths 21 for COMPUTE Elapsed time 00 min:00 sec: 00 hundredths 39 for UNSTRING Elapsed time 00 min:00 sec: 00 hundredths 28 for STRING Elapsed time 00 min:00 sec: 00 hundredths 31 for WRITE Elapsed time 00 min:00 sec: 00 hundredths 21 for READ Elapsed time 00 min:00 sec: 00 hundredths 55 for DELETE Elapsed time 00 min:00 sec: 01 hundredths 97 for COMPLETE TEST[/code] [code]WIN7 x64 Pentium E6600 @ 3.06GHz OpenCOBOL 2.0dev x86 (on x64) Elapsed time 00 min:00 sec: 00 hundredths 22 for COMPUTE Elapsed time 00 min:00 sec: 00 hundredths 42 for UNSTRING Elapsed time 00 min:00 sec: 00 hundredths 33 for STRING Elapsed time 00 min:00 sec: 00 hundredths 29 for WRITE Elapsed time 00 min:00 sec: 00 hundredths 29 for READ Elapsed time 00 min:00 sec: 00 hundredths 63 for DELETE Elapsed time 00 min:00 sec: 02 hundredths 18 for COMPLETE TEST[/code] [code]WIN7 x64 Pentium E6600 @ 3.06GHz OpenCOBOL 2.0dev x64 Elapsed time 00 min:00 sec: 00 hundredths 16 for COMPUTE Elapsed time 00 min:00 sec: 00 hundredths 38 for UNSTRING Elapsed time 00 min:00 sec: 00 hundredths 26 for STRING Elapsed time 00 min:00 sec: 00 hundredths 25 for WRITE Elapsed time 00 min:00 sec: 00 hundredths 23 for READ Elapsed time 00 min:00 sec: 00 hundredths 58 for DELETE Elapsed time 00 min:00 sec: 01 hundredths 86 for COMPLETE TEST[/code] There were no significant differences when cobc -O2 was used (bench.cbl is to simple to take effect). Compiled with runtime-checks (cobc -debug), what I always suggest to do: [code]WIN7 x64 Pentium E6600 @ 3.06GHz OpenCOBOL 1.1CE_120905 x86 (on x64), runtime-checks enabled Elapsed time 00 min:00 sec: 00 hundredths 86 for COMPUTE Elapsed time 00 min:00 sec: 00 hundredths 45 for UNSTRING Elapsed time 00 min:00 sec: 00 hundredths 34 for STRING Elapsed time 00 min:00 sec: 00 hundredths 36 for WRITE Elapsed time 00 min:00 sec: 00 hundredths 27 for READ Elapsed time 00 min:00 sec: 00 hundredths 61 for DELETE Elapsed time 00 min:00 sec: 02 hundredths 91 for COMPLETE TEST[/code] [code]WIN7 x64 Pentium E6600 @ 3.06GHz OpenCOBOL 1.1CE_120905 x64, runtime-checks enabled Elapsed time 00 min:00 sec: 00 hundredths 59 for COMPUTE Elapsed time 00 min:00 sec: 00 hundredths 42 for UNSTRING Elapsed time 00 min:00 sec: 00 hundredths 33 for STRING Elapsed time 00 min:00 sec: 00 hundredths 25 for WRITE Elapsed time 00 min:00 sec: 00 hundredths 24 for READ Elapsed time 00 min:00 sec: 00 hundredths 58 for DELETE Elapsed time 00 min:00 sec: 02 hundredths 42 for COMPLETE TEST[/code] [code]WIN7 x64 Pentium E6600 @ 3.06GHz OpenCOBOL 2.0dev x86 (on x64), runtime-checks enabled Elapsed time 00 min:00 sec: 00 hundredths 70 for COMPUTE Elapsed time 00 min:00 sec: 00 hundredths 49 for UNSTRING Elapsed time 00 min:00 sec: 00 hundredths 39 for STRING Elapsed time 00 min:00 sec: 00 hundredths 27 for WRITE Elapsed time 00 min:00 sec: 00 hundredths 30 for READ Elapsed time 00 min:00 sec: 00 hundredths 67 for DELETE Elapsed time 00 min:00 sec: 02 hundredths 85 for COMPLETE TEST[/code] [code]WIN7 x64 Pentium E6600 @ 3.06GHz OpenCOBOL 2.0dev x64, runtime-checks enabled Elapsed time 00 min:00 sec: 00 hundredths 53 for COMPUTE Elapsed time 00 min:00 sec: 00 hundredths 44 for UNSTRING Elapsed time 00 min:00 sec: 00 hundredths 33 for STRING Elapsed time 00 min:00 sec: 00 hundredths 23 for WRITE Elapsed time 00 min:00 sec: 00 hundredths 24 for READ Elapsed time 00 min:00 sec: 00 hundredths 59 for DELETE Elapsed time 00 min:00 sec: 02 hundredths 36 for COMPLETE TEST[/code] Simon 'human' Sobisch ---------------------------------------------------------------- Just my 2 cents Here is the data for AMD4800 - 8-years old PC (WinXP x64 which is basically 2003), but that's not the major point. OC 1.1 CE 32-bit my build native Windows VS2008 (MPIR,VBISAM): [code] Elapsed time 00 min:00 sec: 00 hundredths 64 for COMPUTE Elapsed time 00 min:00 sec: 00 hundredths 91 for UNSTRING Elapsed time 00 min:00 sec: 00 hundredths 62 for STRING Elapsed time 00 min:00 sec: 00 hundredths 36 for WRITE Elapsed time 00 min:00 sec: 00 hundredths 17 for READ Elapsed time 00 min:00 sec: 00 hundredths 41 for DELETE Elapsed time 00 min:00 sec: 03 hundredths 13 for COMPLETE TEST [/code] MERANT Micro Focus Net Express V3 Version 3.1.11 Copyright (C) 1984-2000 MERANT International Ltd. - very OLD version [code] Elapsed time 00 min:00 sec: 00 hundredths 08 for COMPUTE Elapsed time 00 min:00 sec: 00 hundredths 36 for UNSTRING Elapsed time 00 min:00 sec: 00 hundredths 41 for STRING Elapsed time 00 min:00 sec: 00 hundredths 17 for WRITE Elapsed time 00 min:00 sec: 00 hundredths 05 for READ Elapsed time 00 min:00 sec: 00 hundredths 11 for DELETE Elapsed time 00 min:00 sec: 01 hundredths 18 for COMPLETE TEST [/code] And that is first of all about the quality of the runtime libraries, and about COMP-3. I've said about 7 years ago that we need to move OC from C to pure C++ (in codegen) to be able to use COMP3 templates instead of slow GMP/MPIR ---------------------------------------------------------------- Subject: Open cobol Build (Win64, cross compiled via MinGW from Unix) On a Linux 64 bit machine, I could build open-cobol Linux 64 bit, Linux 32 bit versions. Tried to cross-compile using Mingw. for a Win64 bit version. [code] ./configure --host=x86_64-w64-mingw32 --build=i686-w64-mingw32 CC=amd64-mingw32msvc-gcc CPPFLAGS="-I/tmp/oc11/include" LDFLAGS="-L/tmp/oc11/lib"[/code] But it fails, complains about GMP 3 version. [quote] checking for ld used by GCC... /usr/amd64-mingw32msvc/bin/ld checking if the linker (/usr/amd64-mingw32msvc/bin/ld) is GNU ld... yes checking for shared library run path origin... done checking for iconv... no, consider installing GNU libiconv checking for nl_langinfo and CODESET... no checking for getopt_long_only... no checking gmp.h usability... yes checking gmp.h presence... yes checking for gmp.h... yes checking for __gmp_randinit in -lgmp... no configure: error: GMP 3 or later is required[/quote] Tried to build a GMP version, [code] ./configure --prefix=/tmp/gmp --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --disable-static --enable-shared [/code] but it results following error. The same error for mpir build. Any idea on building OC Win64 using Mingw Cross compiler. [quote] ../gmp.h:1356:1: error: expected declaration specifiers before '__declspec' ../gmp.h:1359:1: error: expected declaration specifiers before '__declspec' ../gmp.h:1362:1: error: expected declaration specifiers before '__declspec' ../gmp.h:1365:1: error: expected declaration specifiers before '__declspec'[/quote] ---------------------------------------------------------------- Despite of GMP you'll need to cross-compile every used lib before (libiconv, curses, ISAM [if not needed you'll save yourself a lot of trouble using --without-db on configuration of OC-build], ...). For correct cross compiling of these [insert search engine here] may help you. Please post a "how-to" here, when you're finished. Good luck. BTW: See [url=http://www.opencobol.org/modules/bwiki/index.php?Assorted%20Documents]Wiki->Assorted Documents[/url] on how to build OC on MinGW within Windows, if cross-compiling does not work for you. Simon 'human' Sobisch ---------------------------------------------------------------- Subject: Split Keys Human (and/or others) (follow on to the "porint Micro Focus" topic, but limited to split keys) My memory from when I last looked at it, was that Micro Focus and the ISO Standard's support for "split keys" is EXACTLY the sam functionally, but different in the syntax used. Is this correct (from what you have looked at) or are there any funcitonal differences between the two? ---------------------------------------------------------------- The only syntax difference for split keys is SOURCE IS in ISO: [code]ALTERNATE RECORD KEY IS record-key-name-1 SOURCE IS { data-name-2 } ...[/code] to = in MF/ACU [code]ALTERNATE RECORD KEY IS record-key-name-1 = { data-name-2 } ...[/code] Functional difference for alternate keys (including split keys or not): In ISO (and ACU) all keys have to be identical used in all programs, [quote]ISO/IEC 1989:20xx CD 1.2 (E), 12.4.4.5.3 [...] The number of alternate record keys for the file shall also be the same as that used when the physical file was created.[/quote] From the other thread I guesses it's not true for MF. This is the reason why I wrote that behaviour should NOT change by default but via an environment entry or config/compile flag. I just read the same rule in MF docs but there's a sentence added, [quote]This checking is configurable in some environments. (Look up the KEYCHECK parameter in your COBOL system documentation.)[/quote] --> This is the way it should be done in OC, too. Simon 'human' Sobisch ---------------------------------------------------------------- As you say, the "identical" thing is NOT limited to split keeys. In fact, IBM mainframes (which I think is still the largest base of COBOL programs) does NOT enforce the "same number and location of alternate keys" requirment. As I have (always?) read the STandard, it does (and HAS) defined how things work if the keys are identical (same number, location, etc) but does NOT define what happens if they are not. There are two (at least) possible behaviors when there are mismatches. 1) Get FS=39 on an OPEN when the keys don't match (for OPEN INPUT or I-O, maybe OUTPUT). However, FS=39 really is an implmentor defined condition as to WHICH "permanent file attributes" need to be checkede. 2) If you WRITE to a file in a program without one (or more than one) possible alternate keys, then it may or may not be possible to use them again in a program that DOES have them. On IBM mainframes "IDCAMS" and related software make certain that alternate keys that are defined for a file when it is defined, are ALWAYS available to any program using the file. However, I do not think this is "universal" among COBOL implementations. ---------------------------------------------------------------- Subject: OpenCOBOL enhancements? This was prompted by the Simple cobol benchmark thread. An entry from ska. [quote] And that is first of all about the quality of the runtime libraries, and about COMP-3. I've said about 7 years ago that we need to move OC from C to pure C++ (in codegen) to be able to use COMP3 templates instead of slow GMP/MPIR ---------------- Regards, Sergey[/quote] Sergey, when I found out how easy it was to plop OpenCOBOL on LLVM and clang, I posted to the LLVM IRC channel. A listener seemed quite intrigued with LLVM COBOL, and planned on looking over the sources to see if the C code generator couldn't be changed to an LLVM emitter. So, sans Roger While (I'm worried and have no clue) would it be possible to modify OpenCOBOL to support multiple code emmitters? C, LLVM, C++ and perhaps Java (source or byte-code)? By possible, I'm meaning is there the skill sets matched with motivations to take on such a task? Umm, that question is to everyone. If not multiple emitters, same question of "possible" for a C++ codebase conversion? If and when OC adds Object COBOL that'd make things easier to start. I'm pretty sure it would ease addition of XML support as well. Cheers, Brian ---------------------------------------------------------------- Hi Brian, I didn't thought about this before, but it's really a good idea to let the "old OC" do the parser stuff as it is the best free COBOL parser I know of (and likely that exists). To only change the code emitting sounds good AND doable. But don't forget one thing: we still have (and need) the runtime libcob. So everything that is emitted still needs to call that. - as C++ modules can call C modules - no problem (I'd drop the C emitter, once the C++ one is working - everyone that needs the C one can use OC 1.1) - LLVM should be fine too (let the LLVM people do this) - Java, especially byte-code would be interesting, but needs at least a Java wrapper for libcob - .NET, especially ILE-code would be interesting, too (same stuff needed as with Java) - we may could use some stuff from the [url=http://bazaar.launchpad.net/~sandy-dunlop/wildcatcobol/i18n/files/head:/src/]WildCat COBOL project[/url] As Roger did: I'd like to accept patches for that. The only emitter I think that is *necessary* for the medium-range is C++ - I'd PM'd ska about that already. I can offer a branch at CE for developing new code emmiters. Simon 'human' Sobisch ---------------------------------------------------------------- Subject: OC & Windows. I receive from michael@j3ksolutions.com the following email [code] Just makin a comment about my experience with OC on MS. I developed a Window software product using OpenCOBOL, although it wasn't a big hit, there are a handful of people using it everyday at one particular company. I built a "setup.exe" for my product and included the MS Re-distributable C run-time, as well as other dependencies. From Download to "up and running" is about 7 clicks. It links to SP2.dll for the GUI, and Tcl85.dll, QLite3.dllfor the database, and my own vue3.dll library for my V/Plus-View3000 emulation. It consisted of about 18,000 lines of COBOL code, and the vue3.dll was also written using OpenCOBOL and about 5000 lines of code. None of the COBOL in this product was ported from somewhere else, it was all written from scratch for Windows & COBOL SP2, using a simple editor called Programmer Studio. My point is that I'm not talking about some little test program, this is a full-blown application evolving multiple dependencies -- with user base. I didn't use Visual Studio at all, I agree that VS is unusable, however I chose cl.exe over gcc. Even on Windows you can still use the compile and link commands on the command-line, no need for Visual Studio, notepad will work in a pinch. For me, I used the cobc -c option to gen the C code, and ran that through the cl.exe, and then the linker. If more detail is needed I could boot-up the Windows box and get more detail syntax for you. Or look at how I used OC on Windows XP, Vista, and Window7. http://www.cloud3000.com This was not an easy lesson to learn, it involved much MS confusion, and debugging, debugging, debugging. At one point I download all the Windows XP symbols and put the entire OS into debug mode. I had a similar experience with OpenCOBOL on HPUX and gcc, and the moral of the story is: Use the C compiler that was designed for the platform that you are developing on. I understand the Gnu development environment is exceptionally good, much better than MS development environment. I went though all the various COBOL compilers Tiny Cobol, Kobol, Fujitsu Student Version, all of them failures. For Production I've always user MF and Acu, or Fujitsu. My first shot at OC was using CygWin, and MinGW, and what I learned from writing a real application and debugging -- Windows Development Environment is a train-wreck! And cl.exe was designed for just such a train-wreck! One of the strength of OpenCOBOL is that it doesn't require gcc, you can use the C compiler for what ever platform that you are running on. Therefore, it is really multi-platform. -- Mike. [/code] It might interest several of us. marcellom ---------------------------------------------------------------- Subject: SoureForge upgrade Anyone object to us upgrading the SourceForge project at http://sourceforge.net/projects/open-cobol/ ? Upside; New, shiny, getting the attention of the forge staff. Downside; Broken links, as the upgrade includes copying repositories to new homes, and broken checkouts, well, stale links to checkouts that may likely experience bitrot. Speak up if you are against as silence will be taken as an affirmative (or indifference) to upgrade. Thanks and Cheers, Brian ---------------------------------------------------------------- If you think about moving it to Allura (the new SF platform) don't forget that this is likely to kick the CVS (think twice if we need that and/or want to move something from it to SVN first). Apart from that, I'm fine with upgrading. Simon 'human' Sobisch ---------------------------------------------------------------- @btiffin @human For my part I don't know what this means. I do however trust and respect you guys. Maybe after you decide what to do you could post a note about the CVS or SVN that would help us newbies understand how it works and what the appropriate protocols are. For my part I have resisted participating because I do not know the who, what, when, and where. I understand that I could probably figure this out myself, but please recognize that by our very nature some of us older Cobolers are reluctant to experiment when we might do harm. jimc ---------------------------------------------------------------- I don't have anything that needs a check in right now. As far as I'm concerned it's ok to upgrade. As a side note, I did check in screenio changes. It went in as r47. But for some reason, it doesn't show up in svn log or svn info. This is the first time I've used svn with the command line interface, so I'm not sure if I've done something wrong. I might need to check out and commit again anyway, which can wait until any upgrade. ---------------------------------------------------------------- Offtopic@mrcool: It's in, see http://open-cobol.svn.sourceforge.net/viewvc/open-cobol/trunk/open-cobol-ce/libcob/screenio.c?view=log human ---------------------------------------------------------------- Jim, I'm going to try and write down my perception of the state of affairs. But, before it means much I'd like to get Roger's status, which is still a work in progress. I'll write more, [b]please know this is my personal take on things and not official[/b] Simon (human) and I have keys to the SourceForge project, along with Roger, Keisuke and Bernard. Keisuke is still the admin on opencobol.org but it now busy with another phase of life. I have an "on his behalf" to call for a DNS change of opencobol.org to a replacement system. opencobol.org forum needs replacing as the spambot fight drains too much time for a volunteer, new registrations may never get turned back on. SourceForge is an option, and I'm waiting to see if it can replace this forum. I, like many others it seems, like this place. Comfy, but now it's not allowing in new people and that's not really fair. To all; Are you willing to get SourceForge accounts to post? I tried with a phpBB forum, but even with shields up it is now at 5600 users (robots) and 12000 posts awaiting screening, so it's soon abandoned as unmaintainable. SVN is active and 1.1 community editions are up and growing. human has the keys to the source tree and had been doing a beautiful job keeping up quality. sf-mensch on the forge. There are a LOT of players in OpenCOBOL now not mentioned here. Lots. It's pretty cool. More coming. Cheers, Brian ---------------------------------------------------------------- [quote] To all; Are you willing to get SourceForge accounts to post?[/quote] It's ok by me to use SourceForge as the new forum. But, can we leave this opencobol.org forum as read only, so that we can search the old posts? ---------------------------------------------------------------- Opencobol site doesn't allow new interested users to get enrolled due some troubles (maybe of spamming type). Sourceforget shows us that hundreds (not one..but more than 300 !!) people at week use to download the opencobol tarball. I would like to vote for definetely closing the opencobol.org site with a forced link to sourceforge where people can obtain a new account to share their feedback about the compiler. Some has told us that Keisuke San has moved his interest above other topics and the actual project administrator Roger (also if working at the project) has missing to reply so many threads about him (Marcello from italy asked directly to him several times.. just to give an example) without any reply. Don't misunderstand me. They did a great work and for me the compiler at 1.1 is already a great gift. But why don't move at the source forge that allows us to grow up the community ?. Avoiding to close opencobol.org (for me) don't help who want continue with cobol. The only (serious) trouble is about the old forum but at least is possible move the index with the contest to a new forum... that is better than nothing.... I can only suggest a way but I think that who want really improve the project cannot approve to leave all thinks at the same state. So guys..let's move to sourceforge ! Federico ---------------------------------------------------------------- As CVS is upgraded now, too, I've started the upgrade and it's finished already. For everybody that wants to know about the new SF features see https://sourceforge.net/p/allura/wiki/Features. Currently there is no way to import forum entries, therefore I opened a FR. You can find it here: https://sourceforge.net/p/forge/feature-requests/10/ (and upvote :-) it) - if SF will get this in, we'll get all forum entries from this board imported at the SF-page. Brian, can you copy the Wiki entries to SF, please? Simon 'human' Sobisch ---------------------------------------------------------------- On copying the wiki; yep, but don't expect quick turnaround. I'm on a windows laptop for the next little while, and well, I don't find it conducive for processing text. Moved the Install Guide over as a test. Cheers, Brian ---------------------------------------------------------------- @human I am registered and am learning how to navigate. I hope that we keep this site up until the old posts are somehow transferred. Count me in! jimc ---------------------------------------------------------------- All my projects on SF have all been upgraded although I do need to do some work on them when the eyes have a bout of being clear enough. . Vince ---------------------------------------------------------------- Just a note; SourceForge seems to have fallen into adserver pitholes. When logged in the performance is orders of magnitude better. With the not logged in ads, it kinda blows. And it's the ads, not the forge per se. Hopefully this will be rectified as the forge goes through all the upgrades. And Vince, a "best of" with the vision issues. Luck, skill, circumstance, whatever it takes. Cheers, Brian ---------------------------------------------------------------- This site (sourceforge) is very complicated to use! I registered but ... How to fall directly on OpenCobol project ????? ---------------------------------------------------------------- Direct link again: https://sourceforge.net/projects/open-cobol/ for the Summary, http://sourceforge.net/p/open-cobol/discussion/ for the forums (currently interal server error...) Simon 'human' Sobisch ---------------------------------------------------------------- Subject: XML parser. Hi all, has someone knowledge about a cobol library or a code to manage a xml from cobol ? For example something able to import tags value for a specific name..or write a inside... Federico ---------------------------------------------------------------- Funny you should ask about this now. PL22/4 (the "ANSI-ish" group just received a note asking if we want to "renew" or note ISO/IEC TR 24716:2007 Information technology -- Programming languages, their environment and system See [url=http://www.cobolstandard.info/j4/files/07-0005.doc]http://www.cobolstandard.info/j4/files/07-0005.doc[/url] for a draft version. This is syntax for XML support SIMILAR to what Micro Focus originally offered. IBM has a TOTALLY different way of doing this. See: [url=http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/IGY3PG50/5.0?SHELF=igy3sh50&DT=20090820210412]http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/IGY3PG50/5.0[/url] This does NOT provide a real answer to your question, but may (or may not) be relevant. ---------------------------------------------------------------- Thanks for your reply. I think I'll write a library to manage them since there are no other 'open' solutions available... at moment.. Federico ---------------------------------------------------------------- Federico; I've had success linking to Expat, some struggles playing with Xerces (as it's C++) and honed in on libxml2 as what I would try and use with OpenCOBOL if I was going to continue. With only a few hours of experimentation to (not really) back up my opinions, most of the open XML dynamically loaded libraries are fairly easy to wield. Expat gives pretty fine grained control, with callbacks peppered throughout the parser, but I found I usually prefer the simplicity of loading a DOM, then library tools that provide a simple interface to get at elements. Just a suggestion, but take a peek at libxml2. It'll be the runtime dependency of choice if/when OC adds XML support, more than likely attempting to follow the PL22.4 spec Bill just mentioned. libxml2 integrates well with libxslt (same team) if anyone ever finds need to run XML transforms. http://www.xmlsoft.org/ Cheers, Brian P.S. [i]This note posted by a self proclaimed un-expert at XML processing[/i] ---------------------------------------------------------------- Hmm - libxml2 looks working :-) Here is the equivalent of "tree1.c" example: [code] Identification Division. PROGRAM-ID. PARS. DATA DIVISION. WORKING-STORAGE SECTION. 01 xmlDoc USAGE POINTER VALUE NULL. 01 root-element USAGE POINTER VALUE NULL. 01 FNAME. 05 FILLER PIC X(14) VALUE 'slashdot16.xml'. 05 FILLER PIC X VALUE LOW-VALUE. PROCEDURE DIVISION. MAIN SECTION. * parse the file and get the DOM CALL 'xmlReadFile' USING FNAME BY VALUE xmlDoc BY VALUE 0 RETURNING xmlDoc END-CALL. IF xmlDoc = NULL DISPLAY 'error: could not parse file ' GOBACK END-IF. * Get the root element node CALL 'xmlDocGetRootElement' USING BY VALUE xmlDoc RETURNING root-element END-CALL. CALL 'PRNT' USING BY VALUE root-element. * free the document CALL 'xmlFreeDoc' USING BY VALUE xmlDoc END-CALL. * Free the global variables that may * have been allocated by the parser. CALL 'xmlCleanupParser'. GOBACK. PROGRAM-ID. PRNT. DATA DIVISION. WORKING-STORAGE SECTION. 01 W-BYTES PIC X(20). LINKAGE SECTION. 01 bytearray PIC X(200). 01 xmlNode. * application data 05 private USAGE POINTER. * type number, must be second ! 05 xmlElementType PIC S9(9) COMP-5. 88 XML-ELEMENT-NODE VALUE 1. * the name of the node, or the entity 05 nodename USAGE POINTER. * parent->childs xmlNode link 05 children USAGE POINTER. * last child xmlNode link 05 lastchild USAGE POINTER. * child->parent xmlNode link 05 parent USAGE POINTER. * next sibling xmlNode link 05 nextlink USAGE POINTER. * previous sibling xmlNode link 05 prev USAGE POINTER. * the containing xmlDoc document 05 doc USAGE POINTER. * End of common part * pointer to the associated xmlNs namespace 05 ns USAGE POINTER. * the content xmlChar pointer 05 pcontent USAGE POINTER. * properties xmlAttr list 05 properties USAGE POINTER. * xmlNs namespace definitions on this node 05 nsDef USAGE POINTER. * for type/PSVI informations 05 psvi USAGE POINTER. * line number 05 lineno PIC 9(4) COMP-5. * extra data for XPath/XSLT 05 extra PIC 9(4) COMP-5. PROCEDURE DIVISION USING xmlNode. LOOP. IF XML-ELEMENT-NODE SET ADDRESS OF bytearray TO nodename UNSTRING bytearray DELIMITED BY LOW-VALUE INTO W-BYTES DISPLAY 'node type: Element, name: ' W-BYTES END-IF. IF children NOT = NULL CALL 'PRNT' USING BY VALUE children END-IF. IF nextlink NOT = NULL SET ADDRESS OF xmlNode TO nextlink GO TO LOOP END-IF. GOBACK. END PROGRAM PRNT. [/code] ---------------------------------------------------------------- Subject: SourceForge - for Forum I am starting a new topic so we don't "confuse" the topics of upgrades to the software in SourceForge versus using SourceForge as a forum "replacement". I am NOT thrilled with this move, but I can understand its motivation. I have registered to see what is required and it isn't too bad. For others easy access, the site to register is [url=https://sourceforge.net/user/registration]https://sourceforge.net/user/registration[/url] When you go thru it, remember that the Job Title and number of employee fields are REQUIRED. I first tried to omit them and received an error message. "Worse" it un-did my selection on receiving "junk emails". So if you do get any error message, make certain that you "unclick" anything you do NOT want to get So far, I canN OT find any "URL" that can be used to view (without signing on" the Forum in this system. If there is one, I would appreciate someone else providing it. If there is NOT such a thing, then I think this is a SERIOUS flaw in moving to this as the general forum. Currently, we get "lots" of visitors to the OpenCOBOL forum who never post or register, but do read the posts. I also couldn't find any way to get "notified" of new posts in the forum as I do today with the OpenCOBOL forum. If there is a way to do this, can someone tell me what it is? If not, again, I think this is a problem going to this as a replacement system. ---------------------------------------------------------------- Thanks for candor and info Bill. Yeah, I'm not thrilled either, no one is, which is partly why it's taking so long. Any forum run by an individual or small team is sooner or later swamped in robots. We WON'T lose this knowledge base, and there won't be a DNS transfer for some time to come. But, I would like to move some of the conversation to the forge, see how it gets followed and if there will be new registrations for posting. Help Getting Started on the forge is (for now) set to anonymous write permissions. I don't see any spam, but I'm not sure if that is due to obscurity, filters or human intervention at geeknet (now Dice I guess). As to a view on SourceForge, I just looked at http://sourceforge.net/p/open-cobol/discussion/ hopefully that will work. Cheers, Brian ---------------------------------------------------------------- @Bill: The read without login works fine for me (let's wait a week if it is crawled by search machines, too). The "no registration necessary" means that a Mod/Project Admins (one of us) has to approve the posts. Every other user (logged in or not) sees the post, but the content is only "Post awaiting moderation." Simon 'human' Sobisch ---------------------------------------------------------------- Subject: STOMP PRODUCER & CONSUMER FOR ACTIVEMQ IN OPENCOBOL - Debian 6.0 Hi. This is a small client for ActiveMQ-Stomp (producer & consumer) write in OpenCobol that interfaces with Stomp trougth some c-routines. Hope you find it, usefull. Comments an ideas to improve it, will be welcomed. https://github.com/jporras66/Stomp-producer-consumer-in-OpenCobol ---------------------------------------------------------------- Nice. I'll add a link and a blurb to the FAQ. That update might not show up for a bit, but it shouldn't be too long. Cheers, Brian ---------------------------------------------------------------- Subject: Ramblings on FILE SHARING While rewriting the fileio.c "module" of OpenCOBOL, I am having problems understanding the design intention and/or code implementation of (whole) file locking or sharing. (EMPHASISE: none of this relates to RECORD LOCKING.) Here are my notes - all corrections & comments welcomed!. 1. Relevant COBOL statements: [code] SELECT ... [ SHARING WITH ALL OTHER ] [ SHARING WITH NO OTHER ] [ SHARING READ ONLY ] OPEN ... [ SHARING WITH ALL OTHER ] [ SHARING WITH NO OTHER ] [ SHARING READ ONLY ] [/code] Alternate: [code] SELECT ... [ LOCK MODE IS EXCLUSIVE ] OPEN ... WITH LOCK [/code] 2. OpenCOBOL P-Guide documents FILE SHARING in: Section 6.1.9 Controlling Concurrent Access to Files [i][code] Sharing Effect Option ALL When your program opens a file in this manner, no restrictions will be placed on other programs OTHER attempting to OPEN the file after your program did. This is the default sharing mode. NO When your program opens a file in this manner, your program announces that it is unwilling to allow OTHER any other program to have any access to the file as long as you are using that file; OPEN attempts made in other programs will fail with a file status of 37 (“PERMISSION DENIED”) until such time as you CLOSE the file (see section 6.9). READ Opening a file in this manner indicates you are willing to allow other programs to OPEN the file for ONLY INPUT while you have it OPEN. If they attempt any other OPEN, their OPEN will fail with a file status of 37. [/code][/i] Section 6.31: OPEN [i] The WITH NO REWIND and WITH LOCK clauses are non-functional. [/i] 3. OpenCOBOL Compiler 3.1 Compiler generates: [code] 001180 open output sharing with all other file1. test34.CBL:118: Warning: 'SHARING ALL OTHER' not implemented [/code] This is strange! According to the manual: "This is the default sharing mode" (cf. 2 above). 3.2 cobc/parser.y [code] sharing_clause: SHARING _with sharing_option { current_file->sharing = $3; } ; sharing_option: ALL _other { $$ = NULL; PENDING ("SHARING ALL OTHER"); } | NO _other { $$ = cb_int1; } | READ ONLY { $$ = cb_int0; } ; [/code] This implies f->sharing is a binary: 0..SHARE_WITH_OTHER_READERS 1..EXCLUSIVE (3rd state NULL - the initialised default value - indicates NYI and is presumably converted to one of the other 2 values). 3.3 cobc/typeck.c [code] void cb_emit_open (cb_tree file, cb_tree mode, cb_tree sharing) ... if (sharing == NULL) { sharing = CB_FILE (file)->sharing ? CB_FILE (file)->sharing : cb_int0; } /* READ ONLY */ if (sharing == cb_int0 && CB_INTEGER (mode)->val != COB_OPEN_INPUT) { sharing = cb_int1; } cb_emit (cb_build_funcall_4 ("cob_open", file, mode, sharing, CB_FILE(file)->file_status)); [/code] I interpret this as: if this OPEN statement didn't use SHARING or used SHARING ALL then use the SHARING value from the SELECT. If the SELECT statement didn't use SHARING or used SHARING ALL then use SHARE_WITH_OTHER_READERS. If SHARE_WITH_OTHER_READERS and the OPEN mode is not INPUT convert to EXCLUSIVE. Now this is a worry: ONLY files opened INPUT can be shared? 4. OpenCOBOL run-time - fileio.c 4.1 RELATIVE & SEQUENTIAL Files. [code] static int cob_file_open (cob_file *f, char *filename, const int mode, const int sharing) ... #ifdef HAVE_FCNTL /* lock the file */ if (memcmp (filename, "/dev/", 5)) { memset ((unsigned char *)&lock, 0, sizeof (struct flock)); lock.l_type = (sharing || mode == COB_OPEN_OUTPUT) ? F_WRLCK : F_RDLCK; lock.l_whence = SEEK_SET; lock.l_start = 0; lock.l_len = 0; if (fcntl (fileno (fp), F_SETLK, &lock) < 0) { ret = errno; fclose (fp); return ret; } } #endif [/code] I interpret this as: if sharing is EXCLUSIVE or OPEN mode is OUTPUT then take a write-lock otherwise take a read-lock. Please note Problem 1: The man page for (Linux) fcntl states: "In order to place a read lock, fd must be open for reading. In order to place a write lock, fd must be open for writing. To place both types of lock, open a file read-write." So my guess is that: OPEN INPUT SHARING WITH NO OTHER will fail because fileio will attempt to take a write-lock on a file opened input. Sure enough, on test: this OPEN throws file-status = 30 (PERMANENT ERROR). Problem 2: The macros for COB_OPEN (see fileio.h) are NOT combinable "bit flags", they are distinct integer values. [code] #define COB_OPEN_CLOSED 0 #define COB_OPEN_INPUT 1 #define COB_OPEN_OUTPUT 2 #define COB_OPEN_I_O 3 #define COB_OPEN_EXTEND 4 [/code] The expression: "mode == COB_OPEN_OUTPUT" is not the same as "mode != COB_OPEN_INPUT". So we see cobc/typeck.c (cf. 3.3) decides that if a file is not opened input then it must be locked EXCLUSIVE. Whereas fileio.c implies that if a file is opened output then it must be locked EXCLUSIVE. Quoting MF COBOL/2 manual: "A file opened for OUTPUT is implicitly defined as a file with an exclusive lock, that is, it is not shareable." And ... "Only shareable files opened for I-O can acquire record locks.". So looks like fileio.c is correct - and cobc wrong. 4.2 INDEXED FILES [code] static int indexed_open (cob_file *f, char *filename, const int mode, const int sharing) ... if (!f->lock_mode) { if (mode != COB_OPEN_INPUT) { lmode = ISEXCLLOCK; } else { lmode = ISMANULOCK; } } else if ((f->lock_mode & COB_LOCK_EXCLUSIVE)) { lmode = ISEXCLLOCK; } else if ((f->lock_mode & COB_LOCK_AUTOMATIC) && mode != COB_OPEN_INPUT) { lmode = ISAUTOLOCK; } else { lmode = ISMANULOCK; } [/code] The sharing arg is NOT referenced at all in this function. This is surprising: ISAM files ignore SHARING entirely and interpret only the LOCK_MODE, determined in the SELECT statement. This explains why INDEXED files are not subject to the anomolies/restrictions described earlier. 5. EMPIRICAL RESULTS Program A opens a SEQUENTIAL file using INPUT OUTPUT or IO and a SHARING option. Program B attempts to open the same file, iterating through INPUT OUTPUT or IO and each SHARING option. The file-status is noted. Program A moves to the next OPEN and program B repeats the entire cycle. This continues until Program A and B have attempted every combination of OPEN / SHARING. In most cases we expect to get COB_STATUS_61_FILE_SHARING. For clarity, these are omitted in the results below. (Note: file-status 61 is returned, not 37 (“PERMISSION DENIED”) as stated in OpenCOBOL P-Guide.) Disputed results are annotated "?". [code] Program: A SHARING: WITH ALL OTHER READ ONLY WITH NO OTHER OPEN MODE: OUTPUT INPUT I-O OUTPUT INPUT I-O OUTPUT INPUT I-O Program: B SHARING DEFAULT OUTPUT -- DEFAULT INPUT 00 00 -- DEFAULT I-O 61? -- WITH ALL OTHER OUTPUT -- WITH ALL OTHER INPUT 00 61? 00 61? -- WITH ALL OTHER I-O 61? 61? -- READ ONLY OUTPUT -- READ ONLY INPUT 00 00 -- READ ONLY I-O 61? -- WITH NO OTHER OUTPUT -- WITH NO OTHER INPUT 30? 30? 30? 30? 30? 30? 30? -- 30? WITH NO OTHER I-O -- [/code] 6. CONCLUSION File level locking could be implemented at COBOL file level instead of relying on underlying interfaces that vary with file type (ORGANIZATION). This would provide a uniform, consistent solution. Any feature impossible to implement on a target platform could generate a warning and continue in a degraded mode. Would it be OK for a re-implementation to "work" only within the COBOL domain? ---------------------------------------------------------------- Big post Joe. :-) It might take awhile to develop responses, but in the meanwhile, thanks for the notes, there are some things to look through. Cheers, Brian ---------------------------------------------------------------- Subject: Patches for OpenCOBOL - SPLIT-KEYS The patches we made to OpenCOBOL to implement COBOL SPLIT-KEYs are documented here: http://www.bawtry.net/image/bawtry/split-keys-patch.html I believe these notes to be complete and accurate, but they were difficult to produce because we have changed much more in OpenCobol fileio.c. Our goal is to provide a complete rewrite of the fileio.c and offer this back to the community. Why? Because fileio.c: (1) is monolithic - unnecessarily muddling the underlying logic structures. (2) overuses (nested) conditional code inclusion (#if defined XYZ) to an extent that the code becomes opaque. (3) fails to implement some important features and desirable alternative options. (4) doesn't provide a clearly understood and solid platform for future enhancements. (4) is just plain wrong in some places! (5) doesn't match the quality of the parser/code-generator and some other modules. This is the personal opinion of the author and shouldn't etc etc. What do others think? ---------------------------------------------------------------- Thank you for your work. From a first glance it looks really good. Do you mind to include these patches you've documented at that page into CE (a sourceforge-account is needed) on your own? Please add a patch for some test cases (at least parsing of SPLIT-KEYS, runtime would be nice, too) - that way we have a simple possibility to test these in different environments. Concerning the rest of your "personal opinion": "the plain wrong" places should be fixed soon, please give us some details. The rest should be changed (and tested in different environments) one by one, that way we can fix changes (or roll them back if needed) more easy. What changes do you suggest for "fighting the monolith"? human ---------------------------------------------------------------- @all I had some difficulties in amending files from Joe's diff results. To make things easier to those of us who are interested, i post links to modified files. @Joe I've been busy on "microfocus invalid key" replacement in cobol sources. I'm near to test your patches with BDB. please see if I reported correctly your patches. I'll let forum know about results. http://www.formigasoft.com/usersftp/codegen.c http://www.formigasoft.com/usersftp/fileio.c http://www.formigasoft.com/usersftp/fileio.h http://www.formigasoft.com/usersftp/parser.y http://www.formigasoft.com/usersftp/tree.c http://www.formigasoft.com/usersftp/tree.h Marcellom ---------------------------------------------------------------- @all due to html to text conversion (when downloading from bawtry) some lines were cutted. New versions are available using previous links. @ Joe if you think it would be better, you could let your amended files be available. Marcellom ---------------------------------------------------------------- Started testing BSC/JR patches. I'm getting the following make errors [code] fileio.c:282:4: warning: 'struct indexfile' declared inside parameter list fileio.c:282:4: warning: its scope is only this definition or declaration, which is probably not what you want fileio.c:288:4: warning: 'struct indexfile' declared inside parameter list fileio.c: In function 'save_status': fileio.c:701:33: error: 'fh' undeclared (first use in this function) fileio.c:701:33: note: each undeclared identifier is reported only once for each function it appears in fileio.c: In function 'indexed_read_next': fileio.c:2807:37: error: 'fh' undeclared (first use in this function) fileio.c: At top level: fileio.c:5726:4: warning: 'struct indexfile' declared inside parameter list fileio.c:5722:12: error: conflicting types for 'extract_key' fileio.c:278:12: note: previous declaration of 'extract_key' was here fileio.c: In function 'extract_key': fileio.c:5729:29: error: dereferencing pointer to incomplete type fileio.c:5731:26: error: dereferencing pointer to incomplete type fileio.c:5733:25: error: dereferencing pointer to incomplete type fileio.c:5734:16: error: dereferencing pointer to incomplete type fileio.c:5735:18: error: dereferencing pointer to incomplete type fileio.c: At top level: fileio.c:5755:4: warning: 'struct indexfile' declared inside parameter list fileio.c:5751:12: error: conflicting types for 'keycmp' fileio.c:284:12: note: previous declaration of 'keycmp' was here fileio.c: In function 'keycmp': fileio.c:5759:21: error: dereferencing pointer to incomplete type fileio.c:5760:2: warning: passing argument 1 of 'extract_key' from incompatible pointer type fileio.c:5722:12: note: expected 'struct indexfile *' but argument is of type 'struct indexfile *' fileio.c:5761:34: error: dereferencing pointer to incomplete type fileio.c:5761:42: error: dereferencing pointer to incomplete type fileio.c: At top level: fileio.c:278:12: warning: 'extract_key' used but never defined fileio.c:5751:12: warning: 'keycmp' defined but not used make[2]: *** [libcob_la-fileio.lo] Errore 1 make[2]: Leaving directory `/usr/share/ocobol/open-cobol-1.1/libcob' make[1]: *** [all-recursive] Errore 1 make[1]: Leaving directory `/usr/share/ocobol/open-cobol-1.1' make: *** [all] Errore 2 [/code] marcellom ---------------------------------------------------------------- Just realised that email notification of new reply to posts originated by me are sent to my mail-box @ openCOBOL - not to my (remote) mailbox. So unless you log-in you don't notice what's been posted! The problem is the patches have not been applied as intended. The first error is because the 2 new forward method headers have been inserted too high: i.e. before struct indexfile has been declared. They need moving down to above declaration of function isretsts() around line 505. This also makes them conditionally included for C | D | VB ISAM only. Then I think there may be a problem with line numbering: the fileio.c source lodged here has this line: [code]cob_error_file = f;extract_key(fh, 0, fh->recwrk, fh->savekey); [/code] I have no idea why extract_key() is here. The error listing above reports line 701. My notes don't suggest an edit of any line within a 100 lines of 701. Rather than continuing through each syntax error, I'll try to submit the complete, clean, edited fileio.c here. ---------------------------------------------------------------- Ok, waiting for news. Marcellom ---------------------------------------------------------------- Subject: OC 1.1 floating point bug - FYI Hi Folks, With some of our latest development I've faced couple of issues: 1. I see display-numeric-float not implemented at all, i.e. [code] 01 FLOAT-PICOUT PIC -9.9(15)E+99.[/code] just producing error in 1.1 and even in pre-2.0 2. In 1.1 the following code does not work right: [code] 01 F USAGE COMP-2. ... CALL 'XXX' USING BY VALUE F. [/code] It is passing only 1 byte :-( But that one is okay in pre-2.0. Will look at it when I get a time :-) ---------------------------------------------------------------- Sergey; I'm not on a box with a compiler installed, but OC supports call with size override. I can't test, so I could be off base. (Haven't got source, nor notes so I'm not sure about parser.y ordering) [code] CALL 'XXX' USING SIZE AUTO or 1 2 (3?) 4 upto 8 I think BY VALUE F. [/code] Cheers, Brian ---------------------------------------------------------------- Thank you for this information and the upcoming fix for both in CE :-) Simon ---------------------------------------------------------------- Hi Brian, [code]CALL 'XXX' USING BY VALUE SIZE 8 F.[/code] Does not work. The same story. ---------------------------------------------------------------- Hi Human, So far it does not make a sense for CE, as CE parser is weak in floating point stuff: [code] MOVE 3.1415E21 TO F.[/code] does not compile... But for 1.1 in codegen.c in function output_call_by_value_args you can add [code] case CB_USAGE_FLOAT: output ("*(float *)("); output_data (x); output (")"); return; case CB_USAGE_DOUBLE: output ("*(double *)("); output_data (x); output (")"); return; [/code] before "default" at the end of the function. ---------------------------------------------------------------- Also, parsing of FP constants is not good even in pre-2 [code] 01 F USAGE COMP-2 VALUE .12E00.[/code] producing error. ---------------------------------------------------------------- Subject: OpenCOBOL reference on 3000 Newswire http://3000newswire.blogs.com/3000_newswire/2012/10/cobol-you-know-versus-cobol-you-dont.html ---------------------------------------------------------------- Thanks Jim, Especially for the comment on the original site. Yeah, the part about not getting help ... saddening. ;-( So, we gotta do better at getting these channels open. [b]Everyone, to the forge.[/b] ;-) Cheers, Brian ---------------------------------------------------------------- New users, to post questions and receive support, please go to our new site on SourceForge. Use the SourceForge link on the left under Development. Then click on Discussion. Register for free to post. Anonymous postings are allowed at this time. ---------------------------------------------------------------- I'm going to pester Keisuke again, try and get admin privs, and do just as mrcool suggests. Cheers, Brian ---------------------------------------------------------------- Subject: Moving to SourceForge With the upcoming push for a SourceForge Project Web, we have a place to go now. https://sourceforge.net/p/open-cobol/discussion/ https://sourceforge.net/p/open-cobol/discussion/109661/thread/2fcc390f/ It will take a while to make it as nice as this place, but it is time to [size=x-large][color=339933]Move to SourceForge[/color][/size] [b]Register[/b] at https://sourceforge.net/user/registration and [b]make noise[/b] at https://sourceforge.net/projects/open-cobol/ Cheers, Brian ---------------------------------------------------------------- bumping ---------------------------------------------------------------- Subject: AS/400 I received this and am posting it. Hi, I'm investigating on how to port more than 150 old cbl DPS programs to my AS400. I've found a couple of recent posts that refer to "opencobol-1.1-as400-bin.zip" and LIBCOB library. But unfortunately I can't find either the zip and the savf. Furthermore the OpenCobol forum does not accept new subscription and therefore I can't join the discussion. After reading your detailed response on feb.2012, I see that this should be what I'm looking for. Can you please help me ? Thanks. beppe. ---------------------------------------------------------------- Discussion at http://sourceforge.net/p/open-cobol/discussion/109661/thread/2f18a0d4/ If you want to join discussion use the source forge page. Simon 'human' Sobisch ----------------------------------------------------------------