My requirement is to send an automatic email to support services by using a new program, when an abend occurs in an existing COBOL-DB2 program.
To be in detailed:
I have a table ABC_LOCATION with the fields location_id, capacity, locaton_name. All are CHAR(3) And the table contains 12 rows as of now.
In my COBOL-DB2 program, I am retrieving the corresponding location_id and capacity depends on location_name coming from a file which is producing by Up-stream system.
There is another table XYZ_LOCATION which is the base table contains many fields includes location_id and locaton_name.
When ever a new location details are added into the table XYZ_location in the upstream system then my program will give an SQLCODE +100 because there is no row correspond to that new location in the table ABC_LOCATION
OfCourse, they need to do the impact analasys and to inform our team to do necessary amendments in our relative tables.
In the worst case scenario, To avoid the abending of the batch job which impacts all other down-stream batches, we are looking for a solution to write a program to send an automatic mail to support services and inform them to insert a new row into the table ABC_LOCATION and then rerun the job again.
Please suggest me the way to do this. I couldn't get any sample program in our system.
This can very well be done thru JCL itself (and making a minor change in ur current program)...Now whenever there is a new location thats currently not existing i.e. SQLCODE = 100...after SQLCODE=100 set a RETURN-CODE in the program to end ur pgm with ur desired choice of return code (that indicates a new entry is reqd...say may be return code of 88 or 99).
Once u get ur desired return code...in the jcl after the step which runs ur pgm add a new step that will run only if the previous return code is 88 or 99 (or whatever return code u wanted).
Pls note that this additional step would be a SMTP mail step that would send the mailer to all the reqd users...SMTP step i think u can easily get by following few SMTP jcl's in ur system.
To achieve this I need to make the content of the mail with the Location_id and capacity values which are coming from an upstream system file.
To do this, I need to amend the existing program, with some piece of code to retrieve and store those values as a content of the mail.
How should I proceed to achieve this with the help of a new program without amending the actual program .
I think u can send the content of a file via SMTP mail job (that is the contents stored in the new file which u will make)...actually i dont have any sample SMTP job to refer right now but i am +ve that contents of a file could be sent via mail.
All u need to do is write the info required to a new file (in ur existing pgm itself) and use that file as a part of SMTP step added.
Say the new file says:
"This is to inform you that WS-LOCATION-ID and WS-CAPACITY-VAL1, WS-CAPACITY-VAL2, WS-CAPACITY-VAL3 was missing in XXX Table and should be added to ASAP"
U can fill the WS- variables with the known value and write the file to a mail.
So a new file in ur present jobstep and this new file in the next SMTP step.