Matthew Roessner
asked on
End iSeries Job Programmtically
When I start up a job, two jobs start by default:
QBATCH QSYS SBS .0 DEQW
REDIS QSYSOPR BCH .1 PGM-sh THDW
REDIS QSYSOPR BCI .1 PGM-redis-serv SELW
The BCH job is not necessary and I would like to end it programatically. Does anyone know an easy way to end this job programmatically if I only know the information listed above?
Thanks!
QBATCH QSYS SBS .0 DEQW
REDIS QSYSOPR BCH .1 PGM-sh THDW
REDIS QSYSOPR BCI .1 PGM-redis-serv SELW
The BCH job is not necessary and I would like to end it programatically. Does anyone know an easy way to end this job programmatically if I only know the information listed above?
Thanks!
ASKER
This is what is in my shell script:
************Beginning of data**************
#!/usr/bin/sh
system "CHGDTAARA DTAARA(NEWDCLIB/REDISJOB *ALL) VALUE('$(getjobid -s $$)')"
I then start up my program. If I have the system command in there - the program does not execute properly. If I take that out...things work again, so I am thinking maybe my syntax is not quite right or something else is wrong.
Any ideas?
Thanks,
************Beginning of data**************
#!/usr/bin/sh
system "CHGDTAARA DTAARA(NEWDCLIB/REDISJOB *ALL) VALUE('$(getjobid -s $$)')"
I then start up my program. If I have the system command in there - the program does not execute properly. If I take that out...things work again, so I am thinking maybe my syntax is not quite right or something else is wrong.
Any ideas?
Thanks,
Runs OK on my system from PASE and from QSH.
What do you mean, exactly when you say "the program does not execute properly"?
Does the data area NEWDCLIB/REDISJOB exist?
Is it *CHAR 28 or greater?
What happens when you run the command manually? Here's what I get in QSH and PASE:
What do you mean, exactly when you say "the program does not execute properly"?
Does the data area NEWDCLIB/REDISJOB exist?
Is it *CHAR 28 or greater?
What happens when you run the command manually? Here's what I get in QSH and PASE:
$
> getjobid -s $$
807419/TESTUSER/QZSHSH
$
> system "CHGDTAARA DTAARA(TESTLIB/JOBNAME *ALL) VALUE('$(getjobid -s $$)')"
$
> system 'dspdtaara testlib/jobname'
5770SS1 V7R1M0 100423 Display Data Area
1
Data area . . . . . . . . . . . : DTAARA JOBNAME
Library . . . . . . . . . . . : TESTLIB
Type . . . . . . . . . . . . . : TYPE *CHAR
Length . . . . . . . . . . . . : LEN 28
Text description . . . . . . . : TEXT
Offset Value
*...+....1....+....2....+....3....+....4....+....5
0 '807419/TESTUSER/QZSHSH '
* * * * * E N D O F L I S T I N G * * * *
$
ASKER
I am able to get the data area to be created in the shell script now. Unfortunately, it is writing the job information for the interactive job that I have running, instead of the job that is started as a part of my process.
So i have my shell script called "startredis".
I do the following to submit the redis job:
SBMJOB CMD(CALL PGM(QP2SHELL) PARM('/redislog/startredis ')) JOB(REDIS) JOBQ(QGPL/QREDIS) USER(QSYSOPR)
When I look in the dataarea, it has my Interactive job listed instead of the new job named REDIS like I want...
Thanks for your help!
So i have my shell script called "startredis".
I do the following to submit the redis job:
SBMJOB CMD(CALL PGM(QP2SHELL) PARM('/redislog/startredis
When I look in the dataarea, it has my Interactive job listed instead of the new job named REDIS like I want...
Thanks for your help!
Please post your current /redislog/startredis shell script.
ASKER
************Beginning of data**************
#!/usr/bin/sh
system "CHGDTAARA DTAARA(NEWDCDATA/REDISJOB *ALL) VALUE('$(getjobid -s $$)')"
CD /QOPENSYS
/QOpensys/opt/freeware/sbi n/redis-se rver --logfile /redislog/redis-server.log --maxmemory 1GB
************End of Data********************
#!/usr/bin/sh
system "CHGDTAARA DTAARA(NEWDCDATA/REDISJOB *ALL) VALUE('$(getjobid -s $$)')"
CD /QOPENSYS
/QOpensys/opt/freeware/sbi
************End of Data********************
Does everything work correctly after you end the BCH job manually?
Tom
Tom
ASKER
Yes, after the BCH job is ended manually - everything works completely fine. I was just wanting to script something to end that job programmatically to keep things clean from a systems perspective and not to confuse our programmers/developers.
Tested it on my system, and it works file in QP2TERM and QSH, but not when called from QP2SHELL. Looks like some kind of problem with CCSID conversion or file redirection.
I'm afraid I just don't have time to troubleshoot it for you - maybe another expert can assist.
I remember when you set this up initially there was some reason you needed to submit it through QP2SHELL, but I can't remember why. Suspect this would work fine if you could get it kicked off from QSH instead.
Ultimately, that 'extra job' simply doesn't matter that much. I know it bugs you, but you really can just leave it alone.
Post back if you figure out a solution independently. I'd like to know the root cause.
I'm afraid I just don't have time to troubleshoot it for you - maybe another expert can assist.
I remember when you set this up initially there was some reason you needed to submit it through QP2SHELL, but I can't remember why. Suspect this would work fine if you could get it kicked off from QSH instead.
Ultimately, that 'extra job' simply doesn't matter that much. I know it bugs you, but you really can just leave it alone.
Post back if you figure out a solution independently. I'd like to know the root cause.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I don't have to start the job with QP2Shell (at least I don't think so)...how would I submit the job with QSH? Can I do that from a CL?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You just use the QSH command instead of CALL QP2SHELL. Thought from a previous thread that caused you a problem and you had to use QP2SHELL.
Create a 28-character data area to hold your job name
Open in new window
Add this line to the top of your shell script, before is starts the redis-server. It will use the PASE getjobid command to get the name of the PASE job and put it into the data area.Open in new window
Then you can just use RTVDTAARA and ENDJOB to end the offending job.