从Java调用AS400 RPG [英] Invoking AS400 RPG From Java

查看:384
本文介绍了从Java调用AS400 RPG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对AS400和RPG有非常有限的(0)知识。但是我们迫切需要从java类调用RPG程序。所以我发现我们可以通过JTOpen实现它。但我坚持宣布ProgramParameter列表。我有关于RPG计划的以下信息

I have a very limitied (0) knowledge on AS400 and RPG. But we have a urgent requirement where we need to invoke a RPG program from a java class. So I found that we can achieve it through JTOpen. But I am stuck at declaring the ProgramParameter list. I have the following information about RPG Program

程序名称:ZM30000R
参数:
分支7,0(数字)

账户类型2(01支票,02支付)

账号20(字符)

错误代码7(字符)
DR / CR指示符1(字符D) ,C)

Program name: ZM30000R Parameters: Branch 7,0 (Numeric)
Account type 2 (01-cheque,02 savings)
Account Number 20 (character)
Error code 7 (character) DR/CR indicater 1 (character D,C)

但是没有关于什么是输入和输出的线索。如何声明ProgramParameter。我做了如下。我也无法测试,因为我没有这些系统的连接。

But no clue about what is the intput and output .How to declare the ProgramParameter. I have done as below. I cannot test as well because I dont have connectivity to these systems.

// Create AS400 Text objects for the different lengths
          // of parameters you are sending in.
          AS400Text branchTxt = new AS400Text(7);
          AS400Text accntTypeTxt = new AS400Text(2);
          AS400Text accntNumberTxt = new AS400Text(20);
          AS400Text errorCodeTxt = new AS400Text(7);
          AS400Text DCIndicatorTxt = new AS400Text(1);            

          // declare and instantiate  your parameter list.
          ProgramParameter[] parmList = new ProgramParameter[5];

          // assign values to your parameters using the AS400Text class to convert to bytes
          // the second parameter is an integer which sets the length of your parameter output
          parmList[0] = new ProgramParameter( branchTxt.toBytes(branch),7);
          parmList[1] = new ProgramParameter( accntTypeTxt.toBytes(accntTypeTxt),2);      
          parmList[2] = new ProgramParameter( accntNumberTxt.toBytes(accntNumberTxt),20);      
          parmList[3] = new ProgramParameter( errorCodeTxt.toBytes(""),7);      
          parmList[4] = new ProgramParameter( DCIndicatorTxt.toBytes(indicator),5);

任何帮助都非常有用。

谢谢和问候,

Srinivas

推荐答案

好吧,我通过参数的描述确实有线索。分行,帐户类型和帐号为IN。您需要该信息用于财务预订或交易。错误代码显然是OUT。根据我对金融系统的经验,API返回预订金额的方式是合理的。通常会使用这个符号,但在金融系统中,(D)ebit或(C)redit是更好的方法。

Well, I do have a clue just by the description of the parameters. Branch, account type and account number are IN. You need that information for a financial booking or transaction. The error code is appearently OUT. In my experience with financial systems it's reasonable normal that the API returns the way the amount is booked. Normally one would use the sign, but in financial systems the (D)ebit or (C)redit is the better way.

API很可能是API的API金融系统。如果这是真的,那么我就错过了金额。你确定你有完整的描述吗?

The API is very likely the API of a financial system. If that is true, then I'm missing the amount. Are you sure you've the complete description?

请注意,第一个参数是数字。你不幸运。 iSeries和RPG对数字的类型并不十分宽容。可以选择Bit,Zoned,Packed,Decimal,Integer,Float等。如果RPG真的是RPG而不是ILE RPG,那么你可以把它带到Zoned,Packed和Byte。

Notice that the first parameter is numeric. You're not in luck. The iSeries and RPG are not very forgiving about the type of a numeric. One can choose from Bit, Zoned, Packed, Decimal, Integer, Float and so on. If the RPG is really RPG instead of ILE RPG, then you can bring that down to Zoned, Packed and Byte.

我假设您可以访问iSeries。然后,您可以观看程序调用,调试信息和转储信息。如果你必须做反复试验,那将对你有所帮助。如果你没有访问权限,那么这条路将非常艰难。如果程序调用不成功,您将在java类中收到错误。但是如果没有来自iSeries的信息,很难确定真正的错误。因此,确实需要访问。

I assume you've access to the iSeries. Then you can watch the program call, debug information and dump information. That will help you if you have to do "trial and error". If you don't have access, the road will be very hard. You'll receive an error in your java class if the program call is not succesfull. But it will be hard to identify the real error without the information from the iSeries yourself. Therefore, access is really required.

这篇关于从Java调用AS400 RPG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆