Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Issue with RM\COBOL ver6.5 Accept Before Time

Status
Not open for further replies.

TrentJackson22

Programmer
May 5, 2005
6
US
I am using a Cherry Keyboard with some additional programmable keys. The programmable keys is what is causing me the trouble but I have to use them. Below is my code:

*******************************
* M A I N R O U T I N E *
*******************************
MAIN1.
TEST1.
ACCEPT X5 ON EXCEPTION EXC PERFORM EXCT
END-ACCEPT.
ACCEPT X10 NO BEEP BEFORE TIME 0150
CONTROL "OFF"
ON EXCEPTION EXC PERFORM EXCT.
DISPLAY "MADE IT".
GO TO TEST1.
EXCT.
DISPLAY "MADE IT TO EXCT".

My problem is when I press one of the extra programmable keys in the first Accept Statement it cancels the "Before Time" phrase in my second accept statement.

If anyone has any suggestions on how to check to see what extra is causing my "before Time" phrase to be canceled or how to clear it out before my second accept it would be greatly appreciated. The actual value I have programmed in the key is "~075 Enter". If I type "~075" and then press "Enter" in the first Accept statement the second works properly.

Thanks in Advance
 
My guess is that the programmable key is sending more than you think.

In the first ACCEPT, display the value returned in EXC to see what key is actually terminating the first ACCEPT.

Do the same on the second ACCEPT. In fact, you could modify EXCT as follows:
Code:
       EXCT.
           DISPLAY "MADE IT TO EXCT: " EXC CONVERT.
What results are obtained?

Tom Morrison
 
I agree with KTM. Your field X5 is probably too short to
handle all the control characters.
 
Mr Morrison,

Thanks for your reply. I tried what you suggested and when I press a regular Function Key I receive a "Made it to EXCT:2" and then my Accept before time executes correctly and then I receive a second "Made it to EXCT: 99" for the second Accept after the Before Time expires.

But When I press one of the extra programmable keys the only thing displayed on the screen is the value that I programmed into the key "~075" and I get hung on my second Accept statement.

Any suggestions?
 
My best guess from these symptoms is that nothing is terminating the first ACCEPT.

Put a BEFORE TIME phrase on the first ACCEPT and see if it times out; I think it probably will.

Tom Morrison
 
Mr. Morrison,

I am not understanding what you mean by the first Accept Statement is not being terminated. I did put the before time statement in the first accept statement and it does work properly if I do not press any keys but I still get hung up at the second accept if I press one of my programmed keys. I downloaded a hex editor to see exactly what the value was from my programmable key and it seems to be the equivilent of "~072 + Enter" "7E3037320D".

I am at a loss. Any other suggestions would be greatly appreciated.

Thanks

Trent
 
Trent,

first of all what is the OS and runtime version you are using?

Second what are you attempting to do. Program keys so that they cause an exception on the accept or so that they send a "text" string to the accept?


If an expection you will need to add that string to your configuration file, and I think (maybe wrong) that you will only be able to do that on a Unix like system.

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
TrentJackson22 said:
But When I press one of the extra programmable keys the only thing displayed on the screen is the value that I programmed into the key "~075" and I get hung on my second Accept statement.
My first question is, "How do you know that 'I get hung on my second Accept statement'?" The second ACCEPT statement specifies CONTROL "OFF" which will eliminate any echoing of characters. The symptoms you describe could be caused by have no character actually being sent that will cause the first ACCEPT to complete. What positive evidence do you have that the program is not waiting for the first ACCEPT to complete?

Second, exactly what data are you looking at with the 'hex editor' that you downloaded?

Perhaps you could put a DISPLAY between the two ACCEPTs to show program flow, and temporarily remove the CONTROL "OFF" from the second ACCEPT to see what it echoes back to the screen.

Tom Morrison
 
Frederico Fonseca:

The operating system that I am using is XP Pro version 2002 service pack 2 and the version of RM Cobol is ver 6.5.

All I am trying to do is find out what is causing the timer to be expired on my second accept statement above when I press one of the programmable keys on my Cherry POS Keyboard. I am having issues with this in several places in our current application.

Tom Morrison:

1. I have already inserted some display statements between the two accept statements to make sure I am getting past my first accept statement. I do understand that the control is off but I feel like I know that I am getting hung at the second accept statement because I can turn the control on and type in enough characters to equal the size of my second accept statement field and the program will finish successfully or press "Enter".

This is why I feel something extra is causing my timer to get canceled and me set at the accept until I press Enter or fill the field.

2. With the Hex Editor I was trying to see if their was some other (non visable) control or special character that was being sent when I pressed the programmable key.

Thanks
 
The light dawns! [idea]

I quote from the RM/COBOL User's Guide, Chapter 8, wherein the TIME phrase is described:
Once a key has been pressed, the time-out function is disabled.

So, yes, the programmable key is sending "something extra" which is indeed disabling the timer.

Try somnething like this:
Code:
01  the-character-code  pic 9(4) binary.
01  redefines the-character-code.
    02  pic x.
    02  the-character pic x.
...
    perform until 1 = 2
        accept the-character
          on exception exc
              display "on exception: ", 
                      the-character-code convert, " ",
                      exc convert
          not on exception
              display "not on exception: "
                      the-character-code convert
        end-accept
    end-perform

This code will grind through the characters it is being sent, one at a time, and should help you understand how many, and what, characters are really being transmitted.

And remember, Life is a Bowl of Cherries! [hairpull]

Tom Morrison
 
Mr. Morrison,

I tried what you suggested and this is what was returned from my troublesome programmable key!!

~
not on exception: 8318
0
not on exception: 8240
7
not on exception: 8247
2
not on exception: 8242

not on exception: 8224

Any sugesstions?

Thanks for your time in working with me through this issue.

Trent
 
Oh, drat!
Code:
01  the-character-code  pic 9(4) binary value 0.

That will make things a bit more readable.

So, your programmable key is sending five (5) characters:
tilde, digit zero, digit seven, digit two, space.

Is that what you expect?

Tom Morrison
 
Mr. Morrison,

Thanks for your help. By pointing out the extra space I was able to find a way to program the keyboard without the extra space and make the extra keys work.

Thanks for your time and suggestions.

Trent Jackson
 
Trent,

No problem. These are the fun ones to solve -- well, fun for me -- don't know how you feel about it!

BTW, RM/COBOL is at version 9, with many useful additional features. You should take a look when you get a chance. Visit our web site and download the latest User's Guide from our online documentation area. Check the What's New section of the book.

Tom Morrison
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top