Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1075388
  • 博文数量: 106
  • 博客积分: 9093
  • 博客等级: 中将
  • 技术积分: 2770
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-01 17:22
文章分类

全部博文(106)

文章存档

2014年(1)

2012年(29)

2011年(32)

2010年(20)

2008年(24)

分类:

2011-07-01 09:17:58

     h DFTACTGRP(*NO) ACTGRP(*NEW)
     d*
     d* Define a field to store the String object we wish to trim
     d string          s               O   CLASS(*JAVA:'java.lang.String')
     d*
     d* Prototype the constructor for the String class. The
     d* constructor expects a byte array.
     d MakeString      pr              O   EXTPROC(*JAVA:
     d                                             'java.lang.String':
     d                                             *CONSTRUCTOR)
     d                                     CLASS(*JAVA:'java.lang.String')      return type
     d    bytes                      30A   CONST VARYING
     d*
     d* Prototype the String method getBytes which converts a String to a byte
     d* array. We can then store this byte array in an alpha field.
     d GetBytes        pr            30A   EXTPROC(*JAVA:
     d                                             'java.lang.String':
     d                                             'getBytes') VARYING
     d*
     d* Prototype the String method trim. It doesnt take any parameters,
     d* but since it is not a static method, must be called using a String
     d* object.
     d trimstring      pr              o   EXTPROC(*JAVA:
     d                                             'java.lang.String':
     d                                             'trim')
     d                                     CLASS(*JAVA:'java.lang.String')      return type
     d*
     d result          s             30A   inz('   1234 5 ') varying
     d*
     C                   EVAL      string = makestring(result)
     C                   EVAL      string = trimstring(string)
     c                   eval      result = GetBytes(string)
     c     result        dsply
     C*
     C                   SETON                                        LR
     C                   RETURN

调用java的方法有什么好处,答案是:可以使用java的标准库。
当然也可以调用自己写的class,参照rpgle guide。
%2Fbooks_web%2Fc0925076172.htm
阅读(1159) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~