We help IT Professionals succeed at work.

Script printer restart in AS/400 from Windows

j_powers asked
Last Modified: 2013-12-06
We are a shop that runs 19 hour days. I am pretty much a one man shop. One of my duties is to learn and work with AS/400. I am learning slowly, but getting the hang of it.

Anyway, one thing that I want to do is give everybody the ability to stop and start a printer queue. Especially to those printers that don't have native IPDS - for they are usually the most problematic. My understanding is for each user I can give them access to Job Control. However if I do that, I also give them access to control a lot more. Therefore that doesn't work.

I thought that maybe a simpler way would be to write a webpage where the user would go to and input the printer in question. The webpage would then turn around and run a script to log into the iseries and stop - then restart the printer.

My question(s) are
1) can this be done - write a script in a Windows environment to access the iseries and restart a print queue
and if yes
2) do you have a script or know of a place to get such a script?
Watch Question


One concept you'll want to learn well is the concept of "adopted authority". This is an attribute that can be assigned to a program through use of the CHGPGM command to specify the USRPRF() parameter. (The attribute can also be assigned at compile-time on various CRTxxxPGM commands.)

The simple story is like this:

1. Create a program that holds or releases the output queue. You might have parms that tell whether a hold or release is to be done and what queue to operate on.

2. Run the CHGPGM command to specify USRPRF(*OWNER) attribute.

3. Then use CHGOBJOWN to change the owner of the program to be a user profile with *JOBCTL special authority. You might create such a profile to use for this purpose. Whoever the 'owner' is, that profile will have sufficient authority to do what the program needs, because you will grant the authority to that profile.

4. Use EDTOBJAUT to grant authority to *USE the program to your users.

Now, when any user runs that program, the user doesn't need extra authority. The operating system will use authority of the program *OWNER to get the work done. Any authority taken from the *OWNER is 'adopted authority'.

You can encapsulate specific authorities within trivial programs in this way. The only authority any user needs is authority to use the program and the only action that can result is what's in the program.

Lots of possible security schemes. This forms the basis of many of them.



Finally got a chance to sit and read this. Sorry for the long wait, but my problem is that this is a low issue on my IT totem poll.

This is an interesting concept. the program will do a endwtr (printer) *immed then  strprtwtr (printer). I was even thinking of having it done every 30 minutes so there is no issue.

Nonetheless, I have to write the "Program", which is the key. Still learning the ins and outs of AS/400. So bear with me.


>> ...having it done every 30 minutes so there is no issue.

That makes it sound as if an actual 'issue' exists. Perhaps if we knew the real issue, an appropriate answer can be supplied.

As for writing the program, even for only 50 points, a program like what you described is easy. What version is the operating system?


I would be concerned about restarting it every 30 minutes also. Especially if you use *IMMED. What if the printer isn't having a problem and it's in the middle of a print job?

You might want your code to check the status of the writer first. If it is in *MSGW status, then have it restart. If it's *RDY, then don't.

This isn't an attempt to solve your problem. I'm sure Tom would do a better job at that :)

I'm just wanted to share the thoughts I had when I read your question.


The issue is that I want the users to be self-sufficient. If it's 6 in the morning and they are trying to run reports and the printer jams, the reports don't continue til the printer queue is stopped and restarted.

That is why I was thinking the webpage. They would go to the page, type in the printers' AS400 designation, then the webpage would run a script that would basically do the endwtr printer *immed then strprtwtr printer.

The every 30 minute thing is an interesting idea, but I agree about not wanting to cause a new problem.

Its all about the users being able to solve their own issues without having to give them full control.


After some work, we found another solution. It seemed that we had a setting that caused the printer to stop upon msg. We adjusted the printer to continue once the error was cleared, and we can now print without worrying about the printer stopping.

Thanks for any insight.
This one is on us!
(Get your first solution completely free - no credit card required)

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.