How to use WRKUSRJOB command in RPGLE

55 pts.
Tags:
AS/400
LPAR
RPGLE
How to check If the user has more than 1 session active on that LPAR?

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Splat
    WRKUSRJOB USER([user profile]) STATUS(*ACTIVE) works.

    Are you having trouble with the command?
    7,545 pointsBadges:
    report
  • bvining
    As the title suggests running WRKUSRJOB in a RPGLE program to check if more than one job is active I'm thinking Gopidada wants more than just the screen to be displayed. But if that is all that is needed then either call a CLLE that runs WRKUSRJOB or use the QCAPCMD API to run the WRKUSRJOB without needing a CL program.

    If you really want the RPGLE program to examine the number of jobs active for the user then you have a couple of options. One would be to specify OUTPUT(*PRINT) on the WRKUSRJOB, copy the resulting spool file to a database file, open the database file and then examine the records found. This is not recommended though as spooled reports are not considered a formal programming interface and can change over time (meaning you get to change your program). It's also a pain if the program has to run in multiple language environments as then the headings can change per national language environment.

    The recommended approach would be to use an API like List Jobs (QUSLJOB). The API provides the ability to only get jobs with a given user profile that are active (just like WRKUSRJOB) and return the information in a structured way to the RPGLE application. Using the API you con't have to worry about report changes, translations, copying the spool file, opening the resulting file, etc. And, not that it may matter, the API will also run faster :)

    Bruce Vining
    6,550 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following