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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to CNTL-C out of an executing program

Status
Not open for further replies.

gdalgarno

MIS
Oct 18, 2000
6
0
0
CA
We have (Fujitsu) COBOL program that doesn't respond to CNTL-C. This program doesn't require any user intervention or input, it just reports information from our database.

Occasionally, I need to abort the program before it's normally completes.

CNTL-C's can't interrupt it. Actually, most normal means of interrupting don't work. I'm forced to CNTL-ALT-DEL and "end task" it.

Has anybody else ran into this problem?
If so, did you find a solution?
 
Hi

You can trap the "KeyPress" event in the mainform, using one key like ESC or CTRL-C or what you like simply adding in this event the statement like below:
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 X PIC X.
LINKAGE SECTION.
01 POW-ARG-KEYASCII PIC S9(4) COMP-5.
PROCEDURE DIVISION USING POW-ARG-KEYASCII.
* pow-arg-keyascii = 3 for CTRL-C
* pow-arg-keyascii = 27 for ESCAPE

IF POW-ARG-KEYASCII = 3
OR = 27
*> do something
END-IF

Hope in this help.

Gianni
 
Gianni,

I've tried to apply your solution, but we're using Fujitsu COBOL not PowerCOBOL, and believe this may be causing a problem.

I created the program within Fujitsu Program Manager...

IDENTIFICATION DIVISION.
PROGRAM-ID. TEST2.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 X PIC X.

LINKAGE SECTION.
01 POW-ARG-KEYASCII PIC S9(4) COMP-5.

PROCEDURE DIVISION USING POW-ARG-KEYASCII.
* pow-arg-keyascii = 3 for CTRL-C
* pow-arg-keyascii = 27 for ESCAPE

IF POW-ARG-KEYASCII = 3
OR = 27
*> do something
END-IF

EXIT PROGRAM
STOP RUN
.

But receive this error message, during the build process.

on the <01 POW-ARG-KEYASCII PIC S9(4) COMP-5.> line

JMN5595I-S FOR THE MAIN PROGRAM, THE PARAMETER SPECIFED FOR USING PHRASE OF PROCEDURE DIVISION HEAD SHOULD BE ONLY ONE GROUP ITEM BY WHICH THE SIZE DOSE NOT EXCEED 102 BYTES, AND THE FIRST SUBORDINATE ELEMENTRAY ITEM BE A BINARY ITEM IN 2 BYTES.

After checking the PDF documentation, this appears to be PowerCOBOL feature?

Is there any workaround your aware of?


Garry D.
 
Hi Garry

Yes, this is a Powercobol features and using it you will be able to trap any key event.
I'm not using Fj Progr.Stuff, because i like to develop my applications using Netcobol for Windows (new brand of old Powercobol).
It depending on what kind of applications you are realizing, but i suggest you to jump to GUI interface, instead to use char mode.
You can also use P.Staff to create various routines and build them as a DLL, so you will be able to call and manage them from Netcobol too.

Hope in this help.

Gianni
 
Hi Tromba,

I have the same problem, Please can you tell me how to get it in the mainform ?? Any Time I use POW-ARG-KEYASCII I get a message that the programm has called an wrong site on windows. It compiles fine but doesn't work .

Thanks

Goetz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top