Link to home
Start Free TrialLog in
Avatar of j_powers
j_powers

asked on

Script printer restart in AS/400 from Windows

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?
Avatar of Member_2_276102
Member_2_276102

j_powers:

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.

Tom
Avatar of j_powers

ASKER

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.

Thanks.
j_powers:

>> ...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?

Tom
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.
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial