Aha. What does cobc --info says?
Not sure if this is the case (the information is missing) but values are only stored in cobc-crt-status if an "extend" ACCEPT is used. What did you do?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
cobc(GNUCobol)2.0.0Copyright(C)2001,2002,2003,2004,2005,2006,2007KeisukeNishidaCopyright(C)2006-2012RogerWhileCopyright(C)2009,2010,2012,2014,2015SimonSobischThisisfreesoftware;seethesourceforcopyingconditions.ThereisNOwarranty;notevenforMERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.BuiltJun15201611:56:04PackagedOct25201521:40:28UTCCversion"4.4.6 20120305 (Red Hat 4.4.6-4)"BuildinformationBuildenvironment:x86_64-pc-linux-gnuCC:gcc-std=gnu99CPPFLAGS:CFLAGS:-O2-pipe-finline-functions-fsigned-char-Wall-Wwrite-strings-Wmissing-prototypes-Wno-format-y2k-U_FORTIFY_SOURCELD:/usr/bin/ld-melf_x86_64LDFLAGS:-Wl,-z,relro,-z,now,-O1GNUCobolinformationCOB_CC:gcc-std=gnu99COB_CFLAGS:-I/usr/local/include-pipeCOB_LDFLAGS:COB_LIBS:-L/usr/local/lib-lcob-lm-lgmp-lncursesw-ldbCOB_CONFIG_DIR:/usr/local/share/gnu-cobol/configCOB_COPY_DIR:/usr/local/share/gnu-cobol/copyenv:COB_COPY_DIR:://home/rcs/fmtCOB_MSG_FORMAT:GCCCOB_MODULE_EXT:soCOB_EXEEXT:64bit-mode:yesBINARY-C-LONG:8bytesExtendedscreenI/O:ncurseswVariableformat:0Sequentialhandler:InternalISAMhandler:BDB[rcs@mdccobolprg]$
Source code "samplercs.cbl"
::cobolfree
IDENTIFICATIOn division.
PROGRAM-ID. sample.
ENVIRONMENT DIVISION.
configuration section.
source-computer. intel.
object-computer. intel.
special-names.
console is crt
crt status is COB-CRT-status.
DATA DIVISION.
working-storage section.
copy "screenio.cpy".
01 ws-eof pic x(1) value "N".
01 ws-status pic 9(4) value zeroes.
01 ws-ecode pic x(6) value spaces.
01 key-status.
05 key-code-1 pic 99.
05 key-code-2 pic 99.
screen section.
01 ws-scr1.
05 line 2 column 2 pic x(80) value " ABC".
05 line 10 column 2 pic 9(4) using key-status.
procedure division.
set environment "COB_SCREEN_ESC" TO "Y".
SET ENVIRONMENT "COB_SCREEN_EXCEPTIONS" TO "Y".
* display ws-scr1.
* accept ws-scr1.
accept ws-ecode.
accept key-status from escape key.
If cob-crt-status = cob-scr-f1
display " F1 key pressed".
display "key" key-status .
accept ws-ecode.
stop run.
cobcrun -i output ....
[rcs@mdccobolprg]$cobcrun-ilibcob(GNUCobol)2.0.0Copyright(C)2001,2002,2003,2004,2005,2006,2007KeisukeNishidaCopyright(C)2006-2012RogerWhileCopyright(C)2009,2010,2012,2014,2015SimonSobischThisisfreesoftware;seethesourceforcopyingconditions.ThereisNOwarranty;notevenforMERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.BuiltJun15201611:55:59PackagedOct25201521:40:28UTCBuildinformationBuildenvironment:x86_64-pc-linux-gnuCC:gcc-std=gnu99CPPFLAGS:(default)CFLAGS:-O2-pipe-finline-functions-fsigned-char-Wall-Wwrite-strings-Wmissing-prototypes-Wno-format-y2k-U_FORTIFY_SOURCELD:/usr/bin/ld-melf_x86_64LDFLAGS:-Wl,-z,relro,-z,now,-O1Cversion"4.4.6 20120305 (Red Hat 4.4.6-4)"GNUCobolinformationCOB_MODULE_EXT:soDynamicloading:System"CBL_"paramcheck:Disabled64bit-mode:yesBINARY-C-LONG:8bytesExtendedscreenI/O:ncurseswVariableformat:(default)Sequentialhandler:InternalISAMhandler:BDB[rcs@mdccobolprg]$
[rcs@mdccobolprg]$cobc-i-msamplercs.cblcobc(GNUCobol)2.0.0Copyright(C)2001,2002,2003,2004,2005,2006,2007KeisukeNishidaCopyright(C)2006-2012RogerWhileCopyright(C)2009,2010,2012,2014,2015SimonSobischThisisfreesoftware;seethesourceforcopyingconditions.ThereisNOwarranty;notevenforMERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.BuiltJun15201611:56:04PackagedOct25201521:40:28UTCCversion"4.4.6 20120305 (Red Hat 4.4.6-4)"BuildinformationBuildenvironment:x86_64-pc-linux-gnuCC:gcc-std=gnu99CPPFLAGS:CFLAGS:-O2-pipe-finline-functions-fsigned-char-Wall-Wwrite-strings-Wmissing-prototypes-Wno-format-y2k-U_FORTIFY_SOURCELD:/usr/bin/ld-melf_x86_64LDFLAGS:-Wl,-z,relro,-z,now,-O1GNUCobolinformationCOB_CC:gcc-std=gnu99COB_CFLAGS:-I/usr/local/include-pipeCOB_LDFLAGS:COB_LIBS:-L/usr/local/lib-lcob-lm-lgmp-lncursesw-ldbCOB_CONFIG_DIR:/usr/local/share/gnu-cobol/configCOB_COPY_DIR:/usr/local/share/gnu-cobol/copyenv:COB_COPY_DIR:://home/rcs/fmtCOB_MSG_FORMAT:GCCCOB_MODULE_EXT:soCOB_EXEEXT:64bit-mode:yesBINARY-C-LONG:8bytesExtendedscreenI/O:ncurseswVariableformat:0Sequentialhandler:InternalISAMhandler:BDB[rcs@mdccobolprg]$cobcrunsamplercslibcob:Cannotfindmodule'samplercs'[rcs@mdccobolprg]$
Have to map mf cobol accept key values to open cobol key values in online programs.
Request suggestions
Thanks
Last edit: Simon Sobisch 2016-12-02
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
the version you use is outdated, I highly suggest to either use rc2 or wait for rc3
cobc -i will always output the compiler information. If you want the version input while compiling use -vv instead. If you intended to run the program after compilation use -j.
With the current implementation (this may change with the next version, but not with GC 2.0) the output names (if none is given the sources file name is used) and PROGRAM-ID must match, otherwise you won't find them at run-time (-x goes around this, setting COB_PRE_LOAD can do, too). Therefore either rename the source, or the PROGRAM-ID or use cobc samplercs.cob -o sample.so && cobcrun sample or use cobc samplercs.cob && COB_PRE_LOAD=samplercs cobcrun sample.
If you explicit define a CRT STATUS the variable must be defined. You can use the pre-defined COB-CRT-STATUS when you don't explicit define it (the simple fix is to replace line 9 of the sample with a period). You may intended to use crt status is key-status?
BTW: Actual running the changed program (with current svn checkout) shows weird results here, I'll have to recheck this at home.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
::bash
tar -xvf gnu-cobol-2.0_rc-2.tar.gz
cd gnu-cobol-2.0
./configure # if some files are not found add --prefix=/usr/local
make
make checkall # test if the build works on your machine
If you want to install both and clean side-by-side you can change the --prefix during configure to point somewhere else - but when you want to call this version you need to use the full path, for example ./configure --prefix=/opt/gc2-tst and /opt/gc2-tst/bin/cobc -V.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2018-11-30
A few queries hopefully relted to this topic
how exactly do I change the config options i.e. which file do I edit and what editing has to be done e.g. are there lines to un-comment, be inserted etc?
cobcun -r tells me that COB_SCREEN_EXCEPTIONS and COB_SCREEN_ESC are off yet PFKEYS are returning values fine ?? (I use ACCEPT xxx FROM ESCAPE KEY). The ESCAPE, as per the comments above, does not but using SET ENVIRONMENT commands at the start of a program has no effect hence the need to manually set this.
I've just upgraded to cobc (GnuCOBOL) 3.0-rc1.0 which has addressed the "infinite loop with ACCEPT a single PIC X screen" . However when I now press FN with ESC - I have an HP pavilion and ESC is very close to F1 so easy to press - the programs crash with Windows telling me XXXXXXXX.exe has stopped working. Putting in a debug display immediately after an ACCEPT statement indicates that control is not returned to the program i.e. the ACCEPT statement is triggering the crash. (FN + ESC is the standard way of displaying HP (laptop) system info and caused no problems in the previous GnuCOBOL version).
Many thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
how exactly do I change the config options i.e. which file do I edit and what editing has to be done e.g. are there lines to un-comment, be inserted etc?
Did you read the runtime.cfg? It should be clear, otherwise we should tweak it.
I never heard of that the error with the extended function key. Please output infor of cobcrun --info to get a clearer picture of your environment.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2018-11-30
Simon, it would be great if you could give typical steps showing how to enable a particular option for example say COB_SCREEN_ESC.
Where is the SETENV command supposed to be issued? I've tried coding it as the first lines in the procedure division of a typical program but to no effect.
I personally think the best option would be to adjust runtime.cfg (just uncomment the options you want to set in, leave in the rest).
Doing this the only setenv you may need to use is either set COB_CONFIG_DIR=C:\Program Files (x86)\OpenCobolIDE\GnuCOBOL\config and change runtime.cfg or set COB_RUNTIME_CONFIG=C:\test\gc_config1.cfg to explicit name a configuration file if you don't want to change the "system defaults" (which you set in the runtime.cfg placed in COB_CONFIG_DIR).
If you compile your start program as module you can also just do: cobcrun -c C:\test\gc_config1.cfg YOURPROG which internally sets COB_RUNTIME_CONFIG.
You can see the actual options used (including the current path to the runtime configuration file) with cobcrun --runtime (or cobcrun -c C:\test\gc_config1.cfg --runtime.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2018-12-03
Changing the config options are now indeed recognised (cobcrun -info command shows this - see below) but the changes have no effect in that the function keys always work and the ESCAPE does not regardless of setting the options to true or false. Not a big problem as such but ESCAPE is useful key to have e.g. home / menu shortcut.
What is a problem is that running with GnuCOBOL version 3.0-rc1.0 , pressing FN + ESC or F2 or F3 without the FN extension causes a "Windows XXXXXXXX.exe has stopped working" abend (in addition to doing what they should do i.e. give HP laptop system info and adjust the brightness). This does not happen with GnuCOBOL version 2.0.0 although the side effect with that version is the "infinite loop with ACCEPT a single PIC X screen"
Looks like I'll either have to revert to version 2.0.0 and code double digit selection options on the menus or use version 3.0-rc1.0 and ask the users to make sure they don't adjust the brightness of their screens!
cobcrun -info confirms the change to runtime.cfg have been recognised:
I guess that's cobcrun --runtime. In any case: I cannot reproduce the crash using the same binaries, therefore I can't check why that chrash happens (I assume this is because the using screenio library gets "something" which it can't handle) but I don't know. I may be able to produce a new DLL for this PDCurses version with debug information (this may or may not help) and in any case a test of another variant like wingui would be also interesting...
I should be able to come back to this soon. In the meantime: please register / login to remove the need for a manual moderation step (currently a living person needs to "accept" your posts as "not spam").
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
View and moderate all "Help getting started" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
function keys and escape key not returning values in cob-crt-status
Aha. What does
cobc --info
says?Not sure if this is the case (the information is missing) but values are only stored in
cobc-crt-status
if an "extend"ACCEPT
is used. What did you do?View and moderate all "Help getting started" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Hi Simon,
cobc -i
output...Source code "samplercs.cbl"
cobcrun -i
output ....cobcrun -r
output....have run program as ....
./samplercs
Have to map mf cobol accept key values to open cobol key values in online programs.
Request suggestions
Thanks
Last edit: Simon Sobisch 2016-12-02
Some points here:
cobc -i
will always output the compiler information. If you want the version input while compiling use-vv
instead. If you intended to run the program after compilation use-j
.PROGRAM-ID
must match, otherwise you won't find them at run-time (-x
goes around this, settingCOB_PRE_LOAD
can do, too). Therefore either rename the source, or thePROGRAM-ID
or usecobc samplercs.cob -o sample.so && cobcrun sample
or usecobc samplercs.cob && COB_PRE_LOAD=samplercs cobcrun sample
.CRT STATUS
the variable must be defined. You can use the pre-definedCOB-CRT-STATUS
when you don't explicit define it (the simple fix is to replace line 9 of the sample with a period). You may intended to usecrt status is key-status
?BTW: Actual running the changed program (with current svn checkout) shows weird results here, I'll have to recheck this at home.
View and moderate all "Help getting started" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Thanks Simon.
where do i get rc2 version for rhel. and how do I upgrade the existing setup without disturbing the current setup on rhel?
You can get rc-2 from https://sourceforge.net/projects/open-cobol/files/gnu-cobol/2.0/gnu-cobol-2.0_rc-2.tar.gz/download
If you just want to test it:
Then you can test this "in-tree" with
If you want to install both and clean side-by-side you can change the
--prefix
during configure to point somewhere else - but when you want to call this version you need to use the full path, for example./configure --prefix=/opt/gc2-tst
and/opt/gc2-tst/bin/cobc -V
.A few queries hopefully relted to this topic
how exactly do I change the config options i.e. which file do I edit and what editing has to be done e.g. are there lines to un-comment, be inserted etc?
cobcun -r tells me that COB_SCREEN_EXCEPTIONS and COB_SCREEN_ESC are off yet PFKEYS are returning values fine ?? (I use ACCEPT xxx FROM ESCAPE KEY). The ESCAPE, as per the comments above, does not but using SET ENVIRONMENT commands at the start of a program has no effect hence the need to manually set this.
I've just upgraded to cobc (GnuCOBOL) 3.0-rc1.0 which has addressed the "infinite loop with ACCEPT a single PIC X screen" . However when I now press FN with ESC - I have an HP pavilion and ESC is very close to F1 so easy to press - the programs crash with Windows telling me XXXXXXXX.exe has stopped working. Putting in a debug display immediately after an ACCEPT statement indicates that control is not returned to the program i.e. the ACCEPT statement is triggering the crash. (FN + ESC is the standard way of displaying HP (laptop) system info and caused no problems in the previous GnuCOBOL version).
Many thanks
Did you read the runtime.cfg? It should be clear, otherwise we should tweak it.
I never heard of that the error with the extended function key. Please output infor of
cobcrun --info
to get a clearer picture of your environment.Simon, it would be great if you could give typical steps showing how to enable a particular option for example say COB_SCREEN_ESC.
Where is the SETENV command supposed to be issued? I've tried coding it as the first lines in the procedure division of a typical program but to no effect.
Is the runtime.cfg file supposed to be edited?
Re.
cobcrun --info
, is as follows....Last edit: Simon Sobisch 2018-12-01
I personally think the best option would be to adjust runtime.cfg (just uncomment the options you want to set in, leave in the rest).
Doing this the only setenv you may need to use is either
set COB_CONFIG_DIR=C:\Program Files (x86)\OpenCobolIDE\GnuCOBOL\config
and changeruntime.cfg
orset COB_RUNTIME_CONFIG=C:\test\gc_config1.cfg
to explicit name a configuration file if you don't want to change the "system defaults" (which you set in the runtime.cfg placed inCOB_CONFIG_DIR
).If you compile your start program as module you can also just do:
cobcrun -c C:\test\gc_config1.cfg YOURPROG
which internally setsCOB_RUNTIME_CONFIG
.You can see the actual options used (including the current path to the runtime configuration file) with
cobcrun --runtime
(orcobcrun -c C:\test\gc_config1.cfg --runtime
.Changing the config options are now indeed recognised (
cobcrun -info
command shows this - see below) but the changes have no effect in that the function keys always work and the ESCAPE does not regardless of setting the options to true or false. Not a big problem as such but ESCAPE is useful key to have e.g. home / menu shortcut.What is a problem is that running with GnuCOBOL version 3.0-rc1.0 , pressing FN + ESC or F2 or F3 without the FN extension causes a "Windows XXXXXXXX.exe has stopped working" abend (in addition to doing what they should do i.e. give HP laptop system info and adjust the brightness). This does not happen with GnuCOBOL version 2.0.0 although the side effect with that version is the "infinite loop with ACCEPT a single PIC X screen"
Looks like I'll either have to revert to version 2.0.0 and code double digit selection options on the menus or use version 3.0-rc1.0 and ask the users to make sure they don't adjust the brightness of their screens!
cobcrun -info
confirms the change to runtime.cfg have been recognised:Last edit: Simon Sobisch 2018-12-03
I guess that's
cobcrun --runtime
. In any case: I cannot reproduce the crash using the same binaries, therefore I can't check why that chrash happens (I assume this is because the using screenio library gets "something" which it can't handle) but I don't know. I may be able to produce a new DLL for this PDCurses version with debug information (this may or may not help) and in any case a test of another variant like wingui would be also interesting...I should be able to come back to this soon. In the meantime: please register / login to remove the need for a manual moderation step (currently a living person needs to "accept" your posts as "not spam").