QINACTITV message handling - IBM AS400

This is a discussion on QINACTITV message handling - IBM AS400 ; I am looking for some suggestions, QINACTITV system value will let me specify a time period, if a display station is idle, when used in conjunction with QINACTMSGQ, will take an action - endjob, dscjob or I can put a ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: QINACTITV message handling

  1. QINACTITV message handling

    I am looking for some suggestions,

    QINACTITV system value will let me specify a time period, if a display
    station is idle, when used in conjunction with QINACTMSGQ, will take
    an action - endjob, dscjob or I can put a message queue which will
    receive a message CPI1126 after the expired time has elapsed.

    I may or may not want to "end job" on the job that has been idle for
    more than the specified minutes. What I am wondering is, how would I
    monitor the message queue for the CPI1126 messages, and then,
    depending on whether it was for a certain display, end the job or
    ignore the message?

    Let's say I have 30 users/workstations I would "end job" on if that
    message is received, but I have say 15 that I don't want to. Or going
    a step further, maybe I only want to end the jobs that are at a menu
    that have been idle the specified amount o time in QINACTITV.

    I am thinking if I change the QINACTITV to be say 30 minutes and that
    it sends a message to message queue IDLEJOBS (I would create this),
    then how do I write a program to monitor that message queue, or read
    that message queue say every 5 minutes, and if the CPI1126 message
    shows up, make a decision whether to cancel the job or not. CPI1126
    will tell me the job, user and job number I believe.

    What I'd then like to do is compare it to a list of workstations/users
    to decide whether the message is ignored or the message is acted upon
    and the job is canceled, and then clear that message from the message
    queue.

    Can I read a message queue in an RPG program? QINACTITV is more
    "global" in scope than what I want; I'd like to use it, but only to
    actually cancel certain jobs and ignore the others.

    I'd appreciate any suggestions on how I might best go about this. I
    suspect I could use an API, although I've not worked with those very
    much. There is an API QMHRCVM - receive nonprogram message api and I
    am wondering if this would be the one to use or whether there is a
    simpler way. I only have about 85-80 jobs active.

    Appreciate any suggestions/ideas.

    thanks,
    ga
    George Applegate
    gappleg8@fscoop.com

  2. Re: QINACTITV message handling


    ga wrote:

    > I am looking for some suggestions,
    >
    > QINACTITV system value will let me specify a time period, if a display
    > station is idle, when used in conjunction with QINACTMSGQ, will take
    > an action - endjob, dscjob or I can put a message queue which will
    > receive a message CPI1126 after the expired time has elapsed.
    >
    > I may or may not want to "end job" on the job that has been idle for
    > more than the specified minutes. What I am wondering is, how would I
    > monitor the message queue for the CPI1126 messages, and then,
    > depending on whether it was for a certain display, end the job or
    > ignore the message?
    >
    > Let's say I have 30 users/workstations I would "end job" on if that
    > message is received, but I have say 15 that I don't want to. Or going
    > a step further, maybe I only want to end the jobs that are at a menu
    > that have been idle the specified amount o time in QINACTITV.
    >
    > I am thinking if I change the QINACTITV to be say 30 minutes and that
    > it sends a message to message queue IDLEJOBS (I would create this),
    > then how do I write a program to monitor that message queue, or read
    > that message queue say every 5 minutes, and if the CPI1126 message
    > shows up, make a decision whether to cancel the job or not. CPI1126
    > will tell me the job, user and job number I believe.
    >
    > What I'd then like to do is compare it to a list of workstations/users
    > to decide whether the message is ignored or the message is acted upon
    > and the job is canceled, and then clear that message from the message
    > queue.
    >
    > Can I read a message queue in an RPG program? QINACTITV is more
    > "global" in scope than what I want; I'd like to use it, but only to
    > actually cancel certain jobs and ignore the others.
    >
    > I'd appreciate any suggestions on how I might best go about this. I
    > suspect I could use an API, although I've not worked with those very
    > much. There is an API QMHRCVM - receive nonprogram message api and I
    > am wondering if this would be the one to use or whether there is a
    > simpler way. I only have about 85-80 jobs active.
    >
    > Appreciate any suggestions/ideas.
    >
    > thanks,
    > ga
    > George Applegate
    > gappleg8@fscoop.com

    I would use the rcvmsg command in CL. Unfortunately this means the
    program spends its time in msgw status which fools most people into
    believing its waiting for a reply. (IBM should have made that status to
    RPYW or something) There have been plenty of discussions on the rcvmsg
    topic mostly regarding the qsysopr message queue, but that has more
    impact on the system so your program will be much simpler. The manuals
    will explain the data sent in the message to the q but just writing a
    program to rcv the messages & setting the system values to a short
    timeout value should give you some test data to work on. The userid
    will be in the data sent so you can experiment by only killing your own
    jobs to start with. More complex selection might involve extracting the
    program stack of the job or maybe adjusting your menus or application
    to set/unset eligibility flags. If its just 1 program you can change
    that to use invite & waitrcd etc and fall back to the menu more
    gracefully than a simple endjob.
    You may want to take commitment control into account - I think the
    default is to rollback uncommitted changes so the data 'should' be
    sensible but the users may loose something.

    HTH
    Jonathan.


  3. Re: QINACTITV message handling

    >
    > I'd appreciate any suggestions on how I might best go about this. I
    > suspect I could use an API, although I've not worked with those very
    > much. There is an API QMHRCVM - receive nonprogram message api and I
    > am wondering if this would be the one to use or whether there is a
    > simpler way. I only have about 85-80 jobs active.
    >
    > Appreciate any suggestions/ideas.
    >
    > thanks,
    > ga
    > George Applegate
    > gappleg8@fscoop.com


    Here's a small CL program for your process:

    pgm
    dcl &msgdata *char (100)
    dcl &jobname *char (26)
    dcl &job *char (10)
    dcl &user *char (10)
    dcl &jobnbr *char (6 )
    dcl &endjob *char (50)
    loop:
    rcvmsg msgq(inactive) msgdta(&msgdata) wait(*max)
    chgvar &job (%sst(&msgdata 1 10))
    chgvar &user (%sst(&msgdata 11 10))
    chgvar &jobnbr (%sst(&msgdata 21 6 ))
    chgvar &jobname ( &jobnbr |< '/' || &user |< '/' || &job)
    chgvar &endjob ('endjob job(' || &jobname |< ')')
    sndpgmmsg msgid(cpf9898) tomsgq(qsysopr) msgdta('Ended inactive job '
    || &jobname) +
    msgf(qcpfmsg)
    call qcmdexc parm(&endjob 50)
    goto loop
    endpgm
    ****************** End of data*******************************

    You could also call an RPG wrapped up in this CL for more advanced
    processing.

    Dave



  4. Re: QINACTITV message handling

    Dave,

    Hey, thanks for the early Christmas present!!

    I appreciate you and Jonathan taking the time to give some suggestions
    and ideas!

    Thanks a ton and Happy Holidays!
    ga

    "Dave Shoff" wrote:

    >>
    >> I'd appreciate any suggestions on how I might best go about this. I
    >> suspect I could use an API, although I've not worked with those very
    >> much. There is an API QMHRCVM - receive nonprogram message api and I
    >> am wondering if this would be the one to use or whether there is a
    >> simpler way. I only have about 85-80 jobs active.
    >>
    >> Appreciate any suggestions/ideas.
    >>
    >> thanks,
    >> ga
    >> George Applegate
    >> gappleg8@fscoop.com

    >
    >Here's a small CL program for your process:
    >
    >pgm
    >dcl &msgdata *char (100)
    >dcl &jobname *char (26)
    >dcl &job *char (10)
    >dcl &user *char (10)
    >dcl &jobnbr *char (6 )
    >dcl &endjob *char (50)
    >loop:
    >rcvmsg msgq(inactive) msgdta(&msgdata) wait(*max)
    > chgvar &job (%sst(&msgdata 1 10))
    > chgvar &user (%sst(&msgdata 11 10))
    > chgvar &jobnbr (%sst(&msgdata 21 6 ))
    > chgvar &jobname ( &jobnbr |< '/' || &user |< '/' || &job)
    > chgvar &endjob ('endjob job(' || &jobname |< ')')
    > sndpgmmsg msgid(cpf9898) tomsgq(qsysopr) msgdta('Ended inactive job '
    >|| &jobname) +
    > msgf(qcpfmsg)
    > call qcmdexc parm(&endjob 50)
    > goto loop
    >endpgm
    >****************** End of data*******************************
    >
    >You could also call an RPG wrapped up in this CL for more advanced
    >processing.
    >
    >Dave
    >


    George Applegate
    gappleg8@fscoop.com

+ Reply to Thread