Hi
Env: Ubuntu 24.04 Gnucobol 3.2
Prb: I reproduce with this small pgm the problem i get using SEARCH
( in the main problem i need both CURSOR and AT clause)
here the code
IDENTIFICATIONDIVISION.PROGRAM-ID.searc.ENVIRONMENTDIVISION.CONFIGURATIONSECTION.SPECIAL-NAMES.DECIMAL-POINTISCOMMA.CURSORISCURS.INPUT-OUTPUTSECTION.FILE-CONTROL.DATADIVISION.FILESECTION.WORKING-STORAGESECTION.01CURS.02LINEAPIC99.02COLONNAPIC99.01DEBUG1PICX.01PGM-IDPICX(8).01MSGPICX(40)USAGEISDISPLAY.01CAUSALEPICX(04).01CAUSALI.05FILLERPICX(04)VALUE'0010'.05FILLERPICX(22)VALUE'CARICO DA FORNITORE'.05FILLERPICX(04)VALUE'0510'.05FILLERPICX(02).05FILLERPICX(04)VALUE'0020'.05FILLERPICX(22)VALUE'VENDITA A CLIENTE '.05FILLERPICX(04)VALUE'0520'.05FILLERPICX(02).01CAUSALI-TREDEFINESCAUSALI.05T-CAUSALIOCCURS002INDEXEDBYIDX1.10T-CAUSALE-CODEPICX(04).10T-CAUSALE-DESCPICX(22).10T-CAUSALE-STORNOPICX(04).10FILLERPICX(02).01LC0835PICX(22)VALUEALL'-'.LINKAGESECTION.SCREENSECTION.01S-CLEAR.02S-BLANKBLANKSCREEN.PROCEDUREDIVISION.MOVE'searc'TOPGM-ID.DISPLAYS-CLEAR.PERFORMACCETTA-CAUSALE.STOPRUN.ACCETTA-CAUSALE.MOVE'CODICE CAUSALE'TOMSG.DISPLAYMSGAT2441.ACCEPTCAUSALEAT0101.SETIDX1TO1SEARCHT-CAUSALIATENDDISPLAYLC0835AT0835*ACCEPTDEBUG1AT2480GOTOACCETTA-CAUSALEWHENCAUSALE=T-CAUSALE-CODE(IDX1)DISPLAYT-CAUSALE-DESC(IDX1)AT0835END-SEARCH.EXIT.DEBUG.ACCEPTDEBUG1AT2480.STOPRUN.EXIT.*EXITPROGRAM.ENDPROGRAMsearc.*
i describe the problem ...
if accepting a wrong value in the CAUSALE input field , different from 0010 or 0020 , SEARCH arrives at END and pull back again to ACCETTA-CAUSALE , but cursor instead to go at position 0101 goes to 0104
and also if you move cursor to 0101 , inserted input is blanked ...
I Bypass all inserting an ACCEPT DEBUG1 AT 2480, in this way program behave correctly...
I performed problem determination and The culprit is CURSOR IS CURS
if you do not use it , program behave correctly ... in this small pgm is not needed , but i need it in the main big program ... another bypass i tested succesfully without inserting ACCEPT DEBUG1
is to MOVE 0101 to CURS and then ACCEPT CAUSALE AT CURS
Let me know your opinion , if i do something wrong or it is a hole in the code
Regards
Maurizio
Last edit: Maurizio Bongini 2025-06-09
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
our native languages are different, so I will try to be clear in my explanation so as to not cause any misunderstanding.
The behavior you are encountering is not a bug but rather a function of the ACCEPT verb. Hopefully the following will make it more clear.
the "CURSOR IS" clause in the SPECIAL-NAMES area is used to to give access to the cursor position on the screen. One critical item to remember is that the DISPLAY statement does NOT move the position of the cursor.
Another thing to consider is that the ACCEPT verb has a TIME OUT capability which allows an ACCEPT verb to be interrupted after a time interval and then continued via another ACCEPT verb.
To accomplish this the ACCEPT statement first checks to see if the cursor position is within the bounds / scope of the AT clause and if so positions the cursor at the value of the CURSOR IS variable, if that variable is NOT within the bounds / scope, then the cursor is positioned at the location of the AT clause.
So when using an ACCEPT verb at the same position as a previous ACCEPT verb, you should set the value of the CURSOR IS variable outside of the AT clause to ensure that the cursor is positioned at the beginning of the AT clause position.
I have include a modified version of your program to demonstrate the behavior of the ACCEPT ... AT position verb.
If you have any questions, I will try to answer them.
deja vu.
been there before. (This happened to me while updating my version of Star_Trek)
I knew somebody other than me was going to have this happen to them too.
Michael :-(
Last edit: Michael F Gleason 2025-06-09
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Chuck
Thanks for the answer..
it works as designed
i downloaded your modified code .. and i will study it together with your answer ..
i open threads only to signl you potential problems and I'm happy that all misunderstandig is over .
Have a nice day
Maurizio
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Chuck
Thanks for spending your time to explain me with text and with a code example how the process works ... with this info i think the correct way to preceed is to modify code with the following instructions to all the accepts of my pgm
MOVE 0101 TO CURS.
ACCEPT CAUSALE AT CURS.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
PS, I'm working on the MicroFocus / Fujitsu CBL_xxx Screen callable functions which gives the programmer direct control of the screen and keyboard. Are you familiar with the ISPF editor on the IBM mainframes ? We are working on a GNUCOBOL clone of that.
Chuck Haatvedt
👍
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
Env: Ubuntu 24.04 Gnucobol 3.2
Prb: I reproduce with this small pgm the problem i get using SEARCH
( in the main problem i need both CURSOR and AT clause)
here the code
i describe the problem ...
if accepting a wrong value in the CAUSALE input field , different from 0010 or 0020 , SEARCH arrives at END and pull back again to ACCETTA-CAUSALE , but cursor instead to go at position 0101 goes to 0104
and also if you move cursor to 0101 , inserted input is blanked ...
I Bypass all inserting an ACCEPT DEBUG1 AT 2480, in this way program behave correctly...
I performed problem determination and The culprit is CURSOR IS CURS
if you do not use it , program behave correctly ... in this small pgm is not needed , but i need it in the main big program ... another bypass i tested succesfully without inserting ACCEPT DEBUG1
is to MOVE 0101 to CURS and then ACCEPT CAUSALE AT CURS
Let me know your opinion , if i do something wrong or it is a hole in the code
Regards
Maurizio
Last edit: Maurizio Bongini 2025-06-09
I attach here the code to reproduce prb
Hello Maurizio,
our native languages are different, so I will try to be clear in my explanation so as to not cause any misunderstanding.
The behavior you are encountering is not a bug but rather a function of the ACCEPT verb. Hopefully the following will make it more clear.
the "CURSOR IS" clause in the SPECIAL-NAMES area is used to to give access to the cursor position on the screen. One critical item to remember is that the DISPLAY statement does NOT move the position of the cursor.
Another thing to consider is that the ACCEPT verb has a TIME OUT capability which allows an ACCEPT verb to be interrupted after a time interval and then continued via another ACCEPT verb.
To accomplish this the ACCEPT statement first checks to see if the cursor position is within the bounds / scope of the AT clause and if so positions the cursor at the value of the CURSOR IS variable, if that variable is NOT within the bounds / scope, then the cursor is positioned at the location of the AT clause.
So when using an ACCEPT verb at the same position as a previous ACCEPT verb, you should set the value of the CURSOR IS variable outside of the AT clause to ensure that the cursor is positioned at the beginning of the AT clause position.
I have include a modified version of your program to demonstrate the behavior of the ACCEPT ... AT position verb.
If you have any questions, I will try to answer them.
Perfect explanation!
deja vu.
been there before. (This happened to me while updating my version of Star_Trek)
I knew somebody other than me was going to have this happen to them too.
Michael :-(
Last edit: Michael F Gleason 2025-06-09
Hi Chuck
Thanks for the answer..
it works as designed
i downloaded your modified code .. and i will study it together with your answer ..
i open threads only to signl you potential problems and I'm happy that all misunderstandig is over .
Have a nice day
Maurizio
Hi Chuck
Thanks for spending your time to explain me with text and with a code example how the process works ... with this info i think the correct way to preceed is to modify code with the following instructions to all the accepts of my pgm
Thanks Maurizio,
That is the change I would make
PS, I'm working on the MicroFocus / Fujitsu CBL_xxx Screen callable functions which gives the programmer direct control of the screen and keyboard. Are you familiar with the ISPF editor on the IBM mainframes ? We are working on a GNUCOBOL clone of that.
Hi Chuck
Yes, i worked many years with ISPF