Problem solve Get help with specific problems with your technologies, process and projects.

Use ABTOBJUSR command to eliminate batch job headache

This command allows you too warn users accessing a file and then end their session before you submit a batch job.

Have you ever submitted a batch job only to find out it has failed because there happened to be a user session accessing the file? This can be quite annoying.

Here is a command that I set up that allows you, the developer or administrator, to warn users accessing a file, program, data area, etc. and then end their session if needed.

The command is ABTOBJUSR (Abort Object User). It takes a snapshot of what sessions are accessing the file using the WRKOBJLCK (Work Object Lock) command and directs it to a spoolfile. The spoolfile is subsequently copied to a physical file and summarized by device, user profile and job number all within the CLP ABTOBJUSRN.

Once the file has been put together, program control is passed to the CLP ABTOBJUSRX, which then reads through the file and sends a message notifying the user to sign off within the time limit on the first pass. Once the allotted time has passed, the program will then initiate an ENDJOB on the second pass. The program will also check to make sure the user is indeed signed on before it issues the ENDJOB.

Hopefully this will assist you in your programming woes as it has me in the past.

Click here to get the program that allows you to end a user's session

The ABTOBJUSR command aborts users that are accessing the object in question.


About the author: Dwight is superintendent, application support, at Cameco Corp. in Saskatoon, Saskatchewan, Canada, where he manages the operation of the application support group supporting 35 business applications.


Other tips written by Dwight Beech:

Execute SQL statements from a text file
Enhanced method for displaying users' sessions
Display data in graph form on the 400

Dig Deeper on iSeries CL programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.