Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function module JOB_CLOSE throwing exception

Former Member
0 Likes
2,896

Hello,

We have a batch job which has 2 steps:

1) Step 1 uses job_open, job_submit and job_close and immediately schedules batch job A/P_ACCOUNTS which in turn creates batch input sessions A/P_ACCOUNTS.

2) Step 2 Processes A/P_ACCOUNTS sessions created yesterday or today.

In few cases, job_close is throwing exception job_close_failed. I believe that error is coming due to non availability of work processes. Job A/P_Accounts is defined as a class C batch job. There is a check in the FM job_close which does the following check:

- if the class of a batch job is B or C, it calculates the number of free work processes. If there are no work processes available then JOB_CLOSE throws JOB_CLOSE_FAILED exception.

- If the class is u2018Au2019, it skips this check.

We have an option of changing the class of batch job to A but there are some system critical jobs that are running as class A.

My question is:

In the code, JOB_CLOSE has been called for scheduling the job A/P_ACCOUNTS with parameter start immediately. Can anyone please let me know what will happen if function JOB_CLOSE is not called with start immediately option? Will the batch job A/P_ACCOUNTS wait till the time work processes are available?

Or, can anything else be done to solve the issue?

Regards,

Siddharth

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,604

Hi,

As you said that you are submitting the job with the class 'C' because there are some mission critical jobs with Class 'A' and 'B'

Put the code TRY CATCH Block.

So while trying if an exception occurs, because resource is not available handle the exception and re submit the job with an higher class.

Hope this helps you and correct me if I am wrong.

Regards,

Ranjith Nambiar

7 REPLIES 7
Read only

Former Member
0 Likes
1,604

Hi

let me know what will happen if function JOB_CLOSE is not called with start immediately option?

So? In which option you want to call the job?

I suppose u can insert a delayed, for example to schedule the job in order to start on certain hours: in this case if any backgroud process is available, the job'll wait for the first available PID

Max

Read only

0 Likes
1,604

Hi Max,

The intent behind my question was to know if we do not schedule the job immediately, will the batch job A/P_ACCOUNTS wait for the availability of a work process (if we schedule it to some other time). As i can see through debugging if we try to release the job immediately and if it does not find any work process, the job throws the exception.

If we schedule the job say after 5 hours than how batch will be released or if at that time also there are no other free processes available then how long can it wait in the queue?

Regards,

Siddharth

Read only

Former Member
0 Likes
1,604

Hi.. ven i faced this issue..

i tried to set the time and date for the job to start..

but didn't worked out..

So i made it start immediately..and it gets into Queue and once the proceessor is free..it starts running..

i think setting it to start immediately will not effect the system...system will queue the job

regards,

Yadesh

Read only

0 Likes
1,604

Hi Yadesh,

As far as i understood while debugging it, if there are no processes available it throws the dump immediately. This is based on a condition statement. If not available raise the exception. It does not go into any queue.

Please correct me if i am wrong and what i can make out from your post is calling the job without (start immediately) option will not change the way JOB_CLOSE works?

Regards,

Siddharth

Read only

0 Likes
1,604

HI,

This is my experience with job_close..

when i was working in zprograms then i was able to scedule it any time i wanted..

but in my standard program when i tried it didn't worked....

so i have to use that option of starting it immediately..

and then it is working fine..

now if i schedule 5 jobs... one after another..

its get queued up...and once the processor is free...its working..

my code of job close

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = job_count

jobname = job_name

strtimmed = yes " yes = 'X'

IMPORTING

job_was_released = job_released

EXCEPTIONS

cant_start_immediate = 1

invalid_startdate = 2

jobname_missing = 3

job_close_failed = 4

job_nosteps = 5

job_notex = 6

lock_failed = 7

invalid_target = 8

OTHERS = 9.

regards,

Yadesh

Read only

Former Member
0 Likes
1,605

Hi,

As you said that you are submitting the job with the class 'C' because there are some mission critical jobs with Class 'A' and 'B'

Put the code TRY CATCH Block.

So while trying if an exception occurs, because resource is not available handle the exception and re submit the job with an higher class.

Hope this helps you and correct me if I am wrong.

Regards,

Ranjith Nambiar

Read only

Former Member
0 Likes
1,604

Issue resolved.. changed class to A..