as400迁移至java,从Java调用AS400 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

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)

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);

Any help will be really highly useful.

Thanks and Regards,

Srinivas

解决方案

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.

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?

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.

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值