
craig_welton
Legendary Poster
Hello all and happy holidays,
I did a little research into using OSA as a mechanism for emailing UBE output upon completion of a batch job. The basic idea is to create an operating system library function (DLL, shared lib or service program) that is called by the UBE runtime engine when the PDF is complete. This was very easy to get built and worked like a charm when hooked up using the OSA app P986168.
So that leaves us with an O/S level function with all the info about the file. From here you could implement any O/S specific calls to a mail API but we don't know anything about who to email the output to. You could build an external repository to map UBE/versions to emails etc. and have the function lookup the info, but that seemed like a big project.
I ended up extending the OSA function and making it JDE "aware" by including jde.h and the libs. Then a simple call to JDB_InitEnv in the Finalize Document OSA event and you're connected to JDE as the user who ran the UBE. With a few BSFN calls you get the user's email and can send the output using JDE_SendEMailSMTPExt.
Initial development was done on a fat client and then tested on a Windows enterprise server (with a different compile of the function for byte alignment). That worked perfectly and so did a custom service program on the iSeries. I don't have access to a Unix enterprise server but I'm sure it will work as well.
Of course, this is just a simple extension. I know some companies store email distribution lists by UBE/version in custom tables so this function could do all the lookups required. There are a lot of possibilities here and not just emailing.
I hope this proves useful.
Craig
I did a little research into using OSA as a mechanism for emailing UBE output upon completion of a batch job. The basic idea is to create an operating system library function (DLL, shared lib or service program) that is called by the UBE runtime engine when the PDF is complete. This was very easy to get built and worked like a charm when hooked up using the OSA app P986168.
So that leaves us with an O/S level function with all the info about the file. From here you could implement any O/S specific calls to a mail API but we don't know anything about who to email the output to. You could build an external repository to map UBE/versions to emails etc. and have the function lookup the info, but that seemed like a big project.
I ended up extending the OSA function and making it JDE "aware" by including jde.h and the libs. Then a simple call to JDB_InitEnv in the Finalize Document OSA event and you're connected to JDE as the user who ran the UBE. With a few BSFN calls you get the user's email and can send the output using JDE_SendEMailSMTPExt.
Initial development was done on a fat client and then tested on a Windows enterprise server (with a different compile of the function for byte alignment). That worked perfectly and so did a custom service program on the iSeries. I don't have access to a Unix enterprise server but I'm sure it will work as well.
Of course, this is just a simple extension. I know some companies store email distribution lists by UBE/version in custom tables so this function could do all the lookups required. There are a lot of possibilities here and not just emailing.
I hope this proves useful.
Craig