#IBMi Java – Avoiding the QSH “Press ENTER to end terminal session” message 

 November 9, 2017

By  NickLitten

So, yesterday I added a neat little snippet to my Control Language Program on this #IBMi system, and re-awakened an irritating feature thats bitten me before. I slept badly last night with this problem niggling away in my brain. But awoke to a bright chilly Las Vegas morning with a steamy coffee and a solution in my brain. (shhh – dont tell anyone that I found it googling, while drinking the aforementioned coffee)

So, lets find how to remove that irritating message.


C:\Users\littenn\Downloads\Press ENTER to end terminal session.png

Running QSH from CL or from REXX — When the Java command completes in QSHELL we see:

Press ENTER to end terminal session.

This message appears after running a Java command using QSH and we must click Enter to continue…


Add a simple line setting the java environment code to discard this output:

/* Prevent the annoying "PRESS ENTER" message */

It’s as simple as that – the VALUE(NONE) means we want to discard all of the messages.

Now, running the command doesnt interrupt us with that annoying screen it just silently continues. #nice

But wait, that’s not the only option ๐Ÿ™‚

If we want capture the QSH messages into a file (so the program can continue without the need to hit the Enter key) but we can see what it was trying to say you tweak the VALUE parameter. The VALUE(NONE) means to discard all output, but we can also pipe the output to another file on the system like this:


Predictably, this will write the output to a stream file in the IFS when we run the QSH (or STRQSH) command.

The file= option replaces the file and we could also use fileappend= add to the existing file for lots of messages:


Now, everytime we run our QSH command, the output is added to the end of our IFS stream file.


IBM i Software Developer, Digital Dad, AS400 Anarchist, RPG Modernizer, Shameless Trekkie, Belligerent Nerd, Englishman Abroad and Passionate Eater of Cheese and Biscuits. Nick Litten Dot Com is a mixture of blog posts that can be sometimes serious, frequently playful and probably down-right pointless all in the space of a day. Enjoy your stay, feel free to comment and remember: If at first you don't succeed then skydiving probably isn't a hobby you should look into.

Nick Litten

related posts:

Swap Homes and Travel the World – Join Home Exchange
Surf the Web Securely with OPEN DNS
IBM i Software Change Management – CMS vs ALM – What’s in a Name?
Want to learn CL Programming?
{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Get In Touch

Iโ€™m always looking for awesome input, feedback and critique!


Snug CBD

 20% Discount

I have partnered with SNUG CBD givING you Organic CBD
20% discount code "NL20"