× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




How do I keep the console open after the data is displayed? I assume I can
use something like getchar(c) which (I hope) will wait for input from the
keyboard. But what I really need to know is: What is causing the console to
close (or how can I control when it closes)?

From a little experimenting, I think I may have discovered the answer to
this question. It appears that the console stops and waits for a keypress when you close it.

The reason your program doesn't stop and wait is that you're not closing it, and it thinks that there might still be more data coming.

Remember, the console isn't part of your program. You don't have an F-spec for it, and you don't use RPG opcodes to manipulate it. It's actually somethign that's opened in a service program in the ILE C runtime library.

When your program is activated, the ILE C service program is also activated. When you call printf(), it opens the console window and displays the output. However, you never do anything to end that service program or close it's console window. So, when your program ends, it returns control to the command line (or menu or whatever) and THAT program redraws the screen with it's own data, so the console seems to "disappear".

The solution, of course, is to end the service program that opened the console. And how you do you end a service program? By reclaiming the activation group that it's running in.

In other words, try running your RPG program (the one that calls printf) with ACTGRP(*NEW)

Whew. I'm out of breath now.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.