ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Convert dcl-pr from free to fixed format

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Convert dcl-pr from free to fixed format

    i would need to convert this free dcl-pr to fixed format .. can some show how do that ?

    dcl-pr myMethod object (*java:'java.lang.String')
    extproc(*java:'myXsd': 'validate')
    ;
    *n object (*java:'java.lang.String'); //
    *n object (*java:'java.lang.String'); //
    end-pr;

    i tried with

    myMethod ...
    D PR O EXTPROC(*JAVA:
    D 'myXsd':
    D 'validate')
    D O CLASS(*JAVA:'java.lang.String' )
    D O CLASS(*JAVA:'java.lang.String')

    but i receive error on compiling
    *RNF3951 30
    With data type O the keyword CLASS is required. can some help me ? thanks in advance

  • #2
    I've never tried to use Java objects in RPG before, so I am not certain. But...

    You have "CLASS(*JAVA:'java.lang.String' ) " for each parameter. I think you need it on the PR line as well, for the return value.

    The Free Format version has object(*java:'java.lang.String') for the parameters and the return value. If class() replaces object() for fixed format, it would make sense that the fixed format would need class for parameters and return as well.

    Comment


    • #3
      Originally posted by Vectorspace View Post
      I've never tried to use Java objects in RPG before, so I am not certain. But...

      You have "CLASS(*JAVA:'java.lang.String' ) " for each parameter. I think you need it on the PR line as well, for the return value.

      The Free Format version has object(*java:'java.lang.String') for the parameters and the return value. If class() replaces object() for fixed format, it would make sense that the fixed format would need class for parameters and return as well.
      Hi Vectorspace ..
      be patient but i did not undesrtand .. could you please post how to i would convert this PR in fixed format
      sorry but also me, is the first time that i try to use Java inside RPG
      thanks in advance

      Comment


      • #4
        Problem 1
        In your free format version, you specified "myMethod" as the name of the PR
        You have left this blank in your fixed format version.

        Problem 2
        In your free format, you had object(...) after the PR. This indicates that the return value is an object, and "..." is the class of that object
        In your fixed format version you had data type O to indicate the return valueObject, but no class(...) keyword to indicate the class of the return object. In contrast, you did add class(...) to the parameters

        I think, this is what you need:

        This was your version:
        Code:
             D                 PR              O    EXTPROC(*JAVA:'myXsd':'validate') 
             D *n                              O    CLASS(*JAVA:'java.lang.String')
             D *n                              O    CLASS(*JAVA:'java.lang.String')
        And I think this is what you needed to do:
        Code:
             D myMethod        PR              O    EXTPROC(*JAVA:'myXsd':'validate') 
             D                                      CLASS(*JAVA:'java.lang.String') 
             D *n                              O    CLASS(*JAVA:'java.lang.String')
             D *n                              O    CLASS(*JAVA:'java.lang.String')
        Notice that the PR line now includes a name for the procedure, and the class keyword

        If this doesn't work, then I don't know.

        Please not when posting fixed format code, that the spaces get messed up, You have to use code tags to keep your code intact:

        HTML Code:
        [code]place RPG code here[/code]

        Comment

        Working...
        X