Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ending jobs in a CL program

Status
Not open for further replies.

cwolgamott

Programmer
May 29, 2002
69
US
Hello. :) I am creating a cl program to send a break message, pause for 5 minutes, end all jobs and then run a program. I was able to locate some code that is supposed to end jobs. However, when the code gets to this statement, it errors out:

CPYSPLF FILE(QPDSPSBJ) TOFILE(QGPL/QINTERJOBS) +
JOB(&JOBNUMBER/&USER/&JOBNAME) SPLNBR(*LAST)

It gives me the following error: File QPDSPSBJ not found in job (and then lists the job number, user and job name).

Here is some of the code prior to the previous statement:

PGM
DCL VAR(&JOBNAME) TYPE(*CHAR) LEN(10)
DCL VAR(&USER) TYPE(*CHAR) LEN(10)
DCL VAR(&JOBNUMBER) TYPE(*CHAR) LEN(10)
WRKSBSJOB SBS(QINTER) USER(*ALL)
RTVJOBA JOB(&JOBNAME) USER(&USER) NBR(&JOBNUMBER)
CPYSPLF FILE(QPDSPSBJ) TOFILE(QGPL/QINTERJOBS) +
JOB(&JOBNUMBER/&USER/&JOBNAME) SPLNBR(*LAST)
CALL PGM(QGPL/ENDJOBS)
DLTSPLF FILE(QPDSPSBJ) JOB(&JOBNUMBER/&USER/&JOBNAME)
ENDPGM

It also runs a RPG program and another cl program to end the selected jobs. I would greatly appreciate any help or suggestions. :) Thank you. :)
 
Thank you so much for your reply. :) That solved that problem. However, I am now getting an error that File QINTERJOBS does not exist in my library. I created a TXT file in my library with that name. I am not sure why it is not finding it. Am I supposed to give it a different type than TXT? I would greatly appreciate any help or suggestions. Thank again for your response. :)
 
I believe it should be a physical file, use the crtpf command.
 
Thank you so much for your response. I tried the crtpf command to create the QINTERJOBS file. However, I am not quite sure what needs to go into it. I am new to all of this. :) I would greatly appreciate any suggestions that you might have. :) Thanks again for your help. :)
 
Create your physical file with a length of 132 copy the spoolfile into it, You should then be able to read this file & determine which jobs to issue the endjob for. You said that there was already an rpg program written to do this, I would be curious to see it.
 
Thank you for all of your help and suggestions. I greatly appreciate it. Here is the source code for the rpg program:

0001.00 FQinterjobsIF F 256 Disk
0002.00 *
0003.00 IQinterjobsNS 01
0004.00 I 4 13 Job
0005.00 I 17 26 User
0006.00 I 30 35 Number
0007.00 I 39 43 Type
0008.00 I 49 54 Status
0009.00 I 68 73 Function
0010.00 *
0011.00 C Read Qinterjobs
0012.00 C DoW Not %EOF
0013.00 C If (User <> 'AnyUser ' And
0014.00 C User <> 'SomeUser ' And
0033.00 C Status = 'ACTIVE' And
0034.00 C Type = 'INTER'
0035.00 C Call 'EJQINTER02'
0036.00 C Parm Job
0037.00 C Parm User
0038.00 C Parm Number
0039.00 C EndIf
0040.00 C Read Qinterjobs
0041.00 C EndDo
0042.00 C Eval *InLR = *On

This rpg program calls another cl program to end the jobs. Thanks again for all of your help. :) It still isn't working but I believe that I am on the right track now. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top