开发者

Passing XML back and forth with RPG and .NET

开发者 https://www.devze.com 2022-12-13 03:23 出处:网络
I am at a loss here of a best-practice to pass XML back and forth with RPG and C#.NET. Originally, I was going to use a temp physical file in QTEMP, but it seems to be that there should be a better wa

I am at a loss here of a best-practice to pass XML back and forth with RPG and C#.NET. Originally, I was going to use a temp physical file in QTEMP, but it seems to be that there should be a better way. The temp file has one line of the document in one record of the file. To me this seems to add a lot of extra work that really shouldn't be needed. I am looking for a two-way communication.

One thought is to pass a 32000 char parameter back and forth, but is that really a good idea? What happens if the document happens to be bigger than that? I don't think I would hit that limit so maybe I would be fine?

What about creating a temp IFS file? That seems like more work than i开发者_开发问答s needed as well.

What are your thoughts?

Obviously, both the RPG and C# programs will be reading and processing the XML document.


DB2 supports XML in the database. Maybe your RPG can insert into the database (native program on the iSeries). Your C#.NET program can use ODBC to retrieve from the database. If you use the XML possibilities of DB2 then you won't loose the tags and xml structure. Otherwise you can always use the CLOB or BLOB columns of a DB2 table.

Creating the file in QTEMP will not work. That library is unique for every job. In other words, every job has his own QTEMP. You can see the QTEMP of jobs with DSPJOB, but you can not access the QTEMP. And I am quite sure that your C#.NET program does not run in the same iSeries job as your RPG ...

RPG do handle his parameters quite well. I don't know the exact maximum size from the top of my head, but it is reasonable big. So, you won't have a technical issue. But I think you will have a development issue. I've tried to debug program call with many, and/or big values for the parameters. Believe me, that was no fun in the native iSeries debugger 8-(

In my current job we do use MQ a lot to communicate between programs. MQ is available on many platforms and it has interfaces for many languages. It is messaging instead of direct calls (different then your question) but it works great. You can put any object (small, big, XML or binary file) into the queue and the program on the other side (e.g. your C# program) will receive it exactly the same.

At last, don't forget that the iSeries do have Java on board. Class libraries for XML including Xalan are available. Maybe that is the way to go. Gather the values in RPG, create and send the XML with Java. Java and RPG works together fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消