View previous topic :: View next topic
|
Author |
Message |
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 216 Location: USA
|
|
|
|
Hi All,
I have a requirement for restarting a job automatically when it abends. The job is abending only in the FTP step while placing the connection to a server. Please help me with code to auto restart a job. The requirement says that they don't need any fixes from the server side.
So the solution should be like if the job abends at the FTP step with return code 12 then the rexx should be invoked and try restarting the job form the FTP step. When it successful the REXX step should be ommitted.
Amar. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
the simplest and most effective solution ( NO CODING ) would be to use
any scheduler facilities..
split the job in three jobs...
put a serial dependency on them,
instruct the scheduler to keep executing the ftp ( the second one) job until success |
|
Back to top |
|
|
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 216 Location: USA
|
|
|
|
Thanks for your reply.
In fact I am trying to give a automated solution and we want the solution should be in coding formt which will be innovative if its coding to have an auto restart . So I need the coding way only.
Please
Thanks once again |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
solution should be in coding formt which will be innovative if its coding |
I disagree on the business effectiveness of writing code ( any type ) for this kind of task...
using a scheduler would be by any mean the most general approach
able to cope with any level of sophistication in your restart policy,
including the cleanup steps before a restart
If You / Your_organization have already made a choice it means that
every side of it has been evaluated, included the skills needed to carry on the choice taken...
If You need help on the coding, it means that somebody has taken the wrong decision |
|
Back to top |
|
|
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 216 Location: USA
|
|
|
|
They didnt ask for me to code to have an auto restart.
Look,
I will explain it simply. The job is abending in FTP step. Then we will go and restart that job from the abended step. It will go fine. So it creating lot of abends even say 4 abends in 24HRs. So to reduce it it has been assigned as a quality process and been assigned to application team who ever is supporting the job. So to have a slick solution it should be an auto restart which will not involve any body at anyc ost.
Regards
Amar |
|
Back to top |
|
|
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 216 Location: USA
|
|
|
|
Ok
I accept your words. But let it client's choice. Of course its always you know. Please leave about that and suggest me if you have coded previously these things. I am asking because I am very very new to REXX. Frankly I don't know abcd's of REXX. But I have very very small programs like doing a sum of 2 numbers and displaying using a "SAY".
So please let the discussion to move in coding way.
Thanks
Amar |
|
Back to top |
|
|
Douglas Wilder
Active User
Joined: 28 Nov 2006 Posts: 305 Location: Deerfield IL
|
|
|
|
It would be a good idea to put the FTP in a job by its self. Check to see if your scheduling package could resubmit the job if it ends with a bad return code. If the scheduling package can not do this, put a step in the FTP job JCL that will run only if the bad condition code is received (cond code checking), that will copy the JCL to the internal reader (ie. resubmit the job automatically). No REXX or other programming required, just JCL changes. In this shop they do not like this sort of thing but our scheduling package takes care of most of this type of thing. |
|
Back to top |
|
|
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 216 Location: USA
|
|
|
|
That's Good Idea!!!
But can you explain bit detail with code if possible. Because I am not fully aware of internal reader.
Regards
Amar |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
My experience with FTP has proven that it's best to run the FTP process from inside a control application where you can add program and logic control over the process. I think it helps to have a process where you can check for connection failures, take steps to restart the connection, and perform pre- and post- transfer file directory listings, all without having to have a job failure, at least until a pre-determined failure threshold has been reached. |
|
Back to top |
|
|
Douglas Wilder
Active User
Joined: 28 Nov 2006 Posts: 305 Location: Deerfield IL
|
|
|
|
Code: |
//**
// IF STEP10.FTP.RC GT 0 THEN
//**
//STEP20 EXEC PGM=ICEGENER
//SYSUT1 DD DSN=HLQ...JCLLIB(JOBNAME),DISP=SHR
//SYSUT2 DD SYSOUT=(A,INTRDR),DCB=BLKSIZE=80
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//**
//**
// ENDIF
//**
|
|
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
the one problem I see with resubmitting the FTP step in the event of a failure without a scheduling package is that you will need some smarts to stop the job from running after a number of attempts else you could end up in a loop if FTP continues to fail.
Gerry |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
I'll go with superk - process the FTP within a REXX or something with monitoring. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
And within that rexx, set a limit on how many times the attempt will be made. Be kinda ugly if the "next" run comes along while "this" run is still not done. . . |
|
Back to top |
|
|
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 216 Location: USA
|
|
|
|
Thank you all,
As gcicchet said if say the server is down then the job will continuously makes attempts to restart the job, instead it would be great if we have some number of times as limit. Can any one please help me on that.
Regards
Amar |
|
Back to top |
|
|
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 216 Location: USA
|
|
|
|
One more thing its not resubmitting I need to restart the job from the abended step. The step is around 6th or 7th step. So how can we do that if I use internal reader |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Just a question...
Are You trying to "GET" a dataset or to "PUT" ..
from/to this unreliable FTP site ??
If You are trying to "PUT" there is no reason to have the request syncronous
with Your JOB;
If You are trying to "GET" the dataset, the most effective way,
both from a resource consumption and human time to "CODE" point of view
would be to put the burden of FTP transmission on the other side
and use the scheduler facilities to start the JOB execution only when the
needed dataset has been successfully stored.
It is still a BAD scheduling practice to start executing a Job when
all the needed resources are not available.
You might use rexx to issue the FTP command,
in the same script You migh loop "N" times, but still You would need
some scheduler action to resubmit the job/part_of_it to complete the process.
the general flow of the rexx could be ...
Code: |
do n_times
/* prepare the FTP commands */
QUEUE "OPEN your_dest"
QUEUE "USER Your_user"
.... all the other commands needed to get/put the dataset
.... You could find out by running a TSP ftp session to find out
QUEUE ""
FTP
if RC = 0 then return 0
... find a way of sleeping for some time
... no use to have a strict loop
end
return any_return code to indicate failure
|
in case of failure use the scheduler |
|
Back to top |
|
|
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 216 Location: USA
|
|
|
|
Yes it is 'PUT' and it is executing to 'PUT' commands in the same single connection. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
Yes it is 'PUT' and it is executing to 'PUT' commands in the same single connection. |
since it is just a put why complicate your life for no reason..
the proc flow is confusing...
why force an ftp_put dependency on subsequent steps of a procedure ?? |
|
Back to top |
|
|
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 216 Location: USA
|
|
|
|
Even if it is just a 'PUT' we need to have the connection till the put operation completes successfully right?
here that is what is not happening(not always) say as I said in my previous discussion its abending for 4 times a day out of it will have runs say for every 30 minutes in 24 hours of a day.
now you might have got how severe the job is?
So the problem is when ever it abends an automatic will create a ticket and we will restart the job and it goes fine. So to stop abending a job I need an auto restart.
And its not a small system that a schedluer can monitor this job alone and can restart when ever it abends.
Its a dump and there will be hundreds of jobs running a day. So client is maintaining a huge team for only restarts and cancellation all CA-7 Handlings in another country.
Now I guess you have got an idea of the process. So instead of abending let's restart the job when it abends after sleeping for some 2 minutes and attempt the same for 3 itmes and lets abend the job at that time only when it abends for the third time.
That is what is the requirement. Please try to follow up the discussion and the requirement is like Quality if we achieve it make it ready for the client.
Why we need to think of changing the requirement it self? Let that be auto restart
Regards
Amar |
|
Back to top |
|
|
|