Home > AS/400 Tips > iSeries programmer tips > Accessing any job's QTEMP
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES PROGRAMMER TIPS

Accessing any job's QTEMP


David Ong
04.10.2002
Rating: -4.64- (out of 5) Hall of fame tip of the month winner


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


There have been numerous requests from programmers who want to access and manipulate with a job's QTEMP library. It is used for debugging and/or recovering from a job that has fallen over with a MSGW status. On occasion, the remedy would involve either investigating the contents in QTEMP or modifying the contents in it. Or the error may be also caused by an incorrect library list. The program may attempt to access objects that do not exist due to a missing library in the library list. Whichever the case, it is especially useful if we could remotely execute commands on a job as if it was the job itself that issued the command. Once the problem has been rectified, such as the missing library list scenario, then instead of answering "c" to cancel the request, you now answer "r" to retry the operation.

There have been earlier approaches to execute commands on another session that uses the message queue concept. It places the workstation message queue into *BREAK delivery mode and uses a break-handling program. When a message is received, the break handling program takes over and executes the command contained in the message. The problem with this approach is that it will not work with batch jobs. You cannot send messages to a batch job from another job. Moreover, the user profile also needs to be setup to run an initial program that will place the workstation message queue into break delivery mode. This approach is cumbersome and of limited use with only interactive jobs.

Finally there is a way to run commands on any job, batch or online and without any cumbersome pre-requisites. It consists of three parts, a command (RUNJOBCMD), a command processing program (SNDCMDCL) and an exit program (RCVCMDCL).

For this to work, you must have the f


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
iSeries CL programming
Checking in on your IBM i authorization lists
Running PHP open source applications: NOBODY needs authority
Simplify the process of converting a spool file from iSeries into an Excel spreadsheet
CL program for daily backups
An automated CL method of moving a query from AS/400 to Excel
Changing user password expiration
Eight steps for creating program documentation using AS/400 utilities
DAYSPAST CLLE program for AS/400: Compares object creation date with today's date
Advanced Job Scheduler help
How do I retrieve the source for an output queue description to put in to a CL program?

iSeries programmer tips
Groovy programming on IBM i
EGL Rich UI on IBM i: Do you Dojo?
Running PHP open source applications: NOBODY needs authority
Programming for the Web on the IBM i, what is possible
Using geocoding on AS/400 to enhance your Web presence
The best technologies and tools for System i programmers in 2009
Seven IBM i project lessons learned in 2008
Documenting nested program structures on the AS/400
What is an integrated database?
An automated CL method of moving a query from AS/400 to Excel

Application Development
iSeries calling an .exe
Top 10 programmer tips
Formatted work job scheduler
Convert system date and time
Mixing free format code with embedded SQL
SQL update a field in one file from a field in another file
Webcasts for iSeries programmers
Programming advice from the pros
Easy code copying via the drag and drop method
Setting FTP time-outs

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


ollowing:

1. *USE authority to the user profile where the command is intended to be executed.

2. *USE authority to STRSRVJOB, ENDSRVJOB and TRCJOB commands. These commands are normally shipped with *EXCLUDE authority.

3. Or have *SERVICE special authority in your user profile.



Code

This is the RUNJOBCMD command. It accepts two main parameters, the iSeries 400 job (where the command will be executed) and a command to be executed. Note: The command will be executed under the job that is being specified. It does not run under your current sign on session.

C This is the SNDCMDCL program which is the CPP for RUNJOBCMD. It will interrupt the iSeries 400 job by starting a service request. Then sends the command to be executed via data queues. When the command finishes executing, the messages (if any) are returned and displayed to the user.

This is the RCVCMDCL program. It is the exit program specified in the TRCJOB command. This program will run under the job being serviced. It accepts the commands to execute via data queues and returns the completion messages also through data queues.

Here I provide a hypothetical example of displaying the contents of QTEMP for a batch job named GLPOST, running under userid DAVIDONG and the job number is 123456.

RUNJOBCMD JOBNAME(GLPOST) JOBUSER(DAVIDONG) JOBNUMBER(123456) COMMAND('DSPOBJD OBJ(QTEMP/*ALL) OBJTYPE(*ALL) OUTPUT(*PRINT)')

Because the command runs under Davidong's user profile, then you will need to work with Davidong's spool files to view the report.


Rate this Tip
To rate tips, you must be a member of Search400.com.
Register now to start rating these tips. Log in if you are already a member.




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



iSeries Security - Security Tools, Physical Security and System Security
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts