Can Notes trigger a MVS batch job?

Hi All,I have a request from one of my users that upon frist though is, it can’t be done, but I’m sure there must be a way. Here’s the situation:

This is the simple part.

The client has set up a mailbox which will receive e-mails worldwide.

These e-mails will contain a spreadsheet.

The notes client will then run an agent to extract/detach the spreadsheet to a server.

Now for the tricky part.

When the file appears on the server, they want to trigger an MVS process to go and pick up the file.

This is all dependant on notes receiving the e-mail with the attachment. That’s the trigger to the whole thing.

I’m having a hard time coming up with the link to the whole thing.

Does anyone know how to do this? or can anyone point me in the right direction?

Thanks,

Robert Tighe

Robert_F_Tighe@keane.com

Subject: Can Notes trigger a MVS batch job?

Robert,

You may be able to set up an FTP job from MVS that runs every 10 minutes (or whatever) and checks the folder to retrieve files that have appeared. The problem I have found is that MVS can’t do a GET or MGET with wildcard notation, so you have to provide a predictable file name. Maybe this changed in z/OS, but in OS/390 2.9 this was not the case.

Ken

Subject: RE: Can Notes trigger a MVS batch job?

Thanks Ken, I had actuall thought of that. However, until I have to use that as a last option, I’m looking for a way to trigger the process on the MVS once the file is detached to the server.

As for a wildcard, it does work in z/OS, but only with SSL FTP as far as I’m aware.

Thanks,

Robert

Subject: RE: Can Notes trigger a MVS batch job?

Robert,

The only other way I know of would be to build a whole WebSphere MQ (formerly “MQSeries”) solution. That way, you could send the Excel file to the mainframe immediately and a trigger program running in a CICS region on the mainframe would sense the incoming message and extract it from the queue, then direct it to a customized program that would know what to do with the Excel file. But this is a lot of work.

Come to think of it, what exactly are you planning to do with the Excel file? If it’s just a case of storing it in DB2, you can write a Java JDBC agent in Designer that could send the Excel file directly to DB2 as soon as it is ready.

Ken

Subject: RE: Can Notes trigger a MVS batch job?

Ken,

Your second solution seems to be much closer to what I’m doing. The file will be getting posted to a DB2 table, but I suspect that I will have to reformat first. If you ahve any ideas on how to set this up, or how to set up the JDBC agent that you were talking about, that would be fantastic.

Thanks,

Robert

Subject: RE: Can Notes trigger a MVS batch job?

Robert,

Why do you need to reformat the Excel file? You can store it as is in DB2 as a BLOB (binary large object). I use a Java agent that employs JDBC to store PDF files in a column of a table in a MS SQL Server database.

Your connectivity to DB2 will differ, but here is a snippet of code from my agent which should give you a sense of what is involved. It’s not a lot of code, it’s just tricky when you’re dealing with Java!

String query = “”;

Session session = getSession();

AgentContext agentContext = session.getAgentContext();

Agent agent = agentContext.getCurrentAgent();

Database db = agentContext.getCurrentDatabase();

Document doc = db.getDocumentByID(agent.getParameterDocID()); // NoteID passed to agent can be obtained in ParameterDocID property.

// Establish connection to SQL Server.

Connection con =

// Create a folder object using PATHNAMEPDF field in Notes doc.

File pathPDF = new File(doc.getItemValueString(“PATHNAMEPDF”));

// Get list of files in pathPDF folder object.

String filesPDF = pathPDF.list();

for (int i=0; i < filesPDF.length; i++) {

File pdfFile = new File(doc.getItemValueString(“PATHNAMEPDF”) + filesPDF[i]);

// ? in query below will be replaced by pdfFile object.

query = “INSERT INTO cust_acct_stmts(customer_id, process_date, batch_id, pdf)” +

“VALUES ('” + customerID + “', '” + processDate + “', '” + batchID + “', ?)”;

PreparedStatement pstmt = con.prepareStatement(query);

int fileLength = (int)pdfFile.length();

InputStream in = new FileInputStream(pdfFile);

pstmt.setBinaryStream(1, in, fileLength);

pstmt.executeUpdate();

in.close();

}

Good luck!

Ken

Subject: RE: Can Notes trigger a MVS batch job?

Hi Ken,

Thanks so much for the sample code. I’ll certainly give this a try. Hopefully it works because this would be exactly what we’re trying to do.

Thanks,

Robert

Subject: Can Notes trigger a MVS batch job?

Couldn’t you set up a scheduled job within MVS to go, pickup, then delete the old file. If there is no file have it record the action and reset to run again.

This seems more efficient since MVS appears to be the final destination of the file. Also, by recording the attempts, adjustments can then be made to the schedule.

Just a thought…