Need some java -> nrx help please...

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Need some java -> nrx help please...

Michael Dag

Struggling again with some java code (part of a larger conversion that sofar seems to work…) to convert to nrx:

 

mqcfh = new MQCFH(msg);

for (int i = 0; i < mqcfh.parameterCount; i++) {

  PCFParameter pcfParameter = PCFParameter.nextParameter(msg);

  Object o = pcfParameter.getValue();

  if (o instanceof String) {

     String srh = (String) o;

     System.out.println(/*

                         * pcfParameter.getClass().toString()

                         * +":" +

                         */srh);

     }                   

  }

 

I tried the ‘leave out the type’ and ‘new’ but, that doesn’t seem to do the trick here…

 

Any help is appreciated J

 

Michael


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Need some java -> nrx help please...

alansam
Letting java2nrx do most of the heavy lifting renders this:

        mqcfh_ = MQCFH

        mqcfh_ = MQCFH(msg)
        i = int
        loop i = 0 to i + 1 while i << mqcfh_.parameterCount 
            pcfParameter_ = PCFParameter
            pcfParameter_ = PCFParameter.nextParameter(msg)
            o = Object
            o = pcfParameter_.getValue()
            if o <= String then do 
                srh = String
                srh = String o
                System.out.println(pcfParameter_.getClass().toString() || ":" || srh)
            end

        end 

Note: NetRexx is still case insensitive (kind of) so it's not a big fan of things like mqcfh = MQCFH() etc.

Alan.
PS.  I faked out the dependent classes and got it to compile and run too.

On 16 June 2012 01:59, Michael Dag <[hidden email]> wrote:

Struggling again with some java code (part of a larger conversion that sofar seems to work…) to convert to nrx:

 

mqcfh = new MQCFH(msg);

for (int i = 0; i < mqcfh.parameterCount; i++) {

  PCFParameter pcfParameter = PCFParameter.nextParameter(msg);

  Object o = pcfParameter.getValue();

  if (o instanceof String) {

     String srh = (String) o;

     System.out.println(/*

                         * pcfParameter.getClass().toString()

                         * +":" +

                         */srh);

     }                   

  }

 

I tried the ‘leave out the type’ and ‘new’ but, that doesn’t seem to do the trick here…

 

Any help is appreciated J

 

Michael


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/





--
Can't tweet, won't tweet!

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Alan

--
Needs more cowbell.
Reply | Threaded
Open this post in threaded view
|

Re: Need some java -> nrx help please...

alansam
On reflection I think :

loop i = 0 to i + 1 while i << mqcfh_.parameterCount

should be changed to:

loop i = 0 by 1 while i << mqcfh_.parameterCount

A.

-- 
Can't tweet, won't tweet!

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Alan

--
Needs more cowbell.
Reply | Threaded
Open this post in threaded view
|

Re: Need some java -> nrx help please...

Michael Dag
In reply to this post by alansam

Alan,

Thanks! That did the trick!

I am completely lost when it comes to Java and structures like this, I googled java2nrx and found kenai with sources, but no simple ‘run’ command

to execute and find out… Did I miss something obvious? Would it be possible to put up a java2nrx web page where you can simply paste some java

code and have it converted to NetRexx?

 

I am sure I am not the only one running into this kind of problems…

things that seem simple and obvious to java programmers are not as clear to me…

That’s why I program in NetRexx ;-)

 

Michael

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Alan Sampson
Sent: Saturday, June 16, 2012 20:06
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] Need some java -> nrx help please...

 

Letting java2nrx do most of the heavy lifting renders this:

 

        mqcfh_ = MQCFH

 

        mqcfh_ = MQCFH(msg)

        i = int

        loop i = 0 to i + 1 while i << mqcfh_.parameterCount 

            pcfParameter_ = PCFParameter

            pcfParameter_ = PCFParameter.nextParameter(msg)

            o = Object

            o = pcfParameter_.getValue()

            if o <= String then do 

                srh = String

                srh = String o

                System.out.println(pcfParameter_.getClass().toString() || ":" || srh)

            end

 

        end 

 

Note: NetRexx is still case insensitive (kind of) so it's not a big fan of things like mqcfh = MQCFH() etc.

 

Alan.

PS.  I faked out the dependent classes and got it to compile and run too.

On 16 June 2012 01:59, Michael Dag <[hidden email]> wrote:

Struggling again with some java code (part of a larger conversion that sofar seems to work…) to convert to nrx:

 

mqcfh = new MQCFH(msg);

for (int i = 0; i < mqcfh.parameterCount; i++) {

  PCFParameter pcfParameter = PCFParameter.nextParameter(msg);

  Object o = pcfParameter.getValue();

  if (o instanceof String) {

     String srh = (String) o;

     System.out.println(/*

                         * pcfParameter.getClass().toString()

                         * +":" +

                         */srh);

     }                   

  }

 

I tried the ‘leave out the type’ and ‘new’ but, that doesn’t seem to do the trick here…

 

Any help is appreciated J

 

Michael


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



 

--
Can't tweet, won't tweet!


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Need some java -> nrx help please...

alansam
I don't remember now where I got my copy of java2nrx (possibly from when I downloaded the NetRexx source from Kenai) but what I have is a command line tool.  It comes with a bash script and a Windows BAT file and is pretty easy to use.
Bear in mind that for anything but the simplest programs it does need a lot of post-conversion clean up.  Even the sample you sent wasn't valid NetRexx at first and as can be seen from my first attempt you need to scan through the resulting coe with a fine tooth comb to catch some gotchas; and its handling of Java anonymous inner classes can leave you scratching your head.

It still beats conversion by hand thouh so in the main it's worth it if you absolutely must have a NetRexx version of a program.

Alan.

PS  With regard the loop construct from the conversion.  Were I doing it by hand I wouldn't use:

loop i = 0 to i + 1 while i << mqcfh_.parameterCount
  ...
  end 

or

loop i = 0 by 1 while i << mqcfh_.parameterCount
  ...
  end

A more concise and Rexx-like construct would be:

loop for mqcfh_.parameterCount
  ...
  end

which allows you to drop the definition for the loop controlling variable i too.

On 17 June 2012 03:43, Michael Dag <[hidden email]> wrote:

Alan,

Thanks! That did the trick!

I am completely lost when it comes to Java and structures like this, I googled java2nrx and found kenai with sources, but no simple ‘run’ command

to execute and find out… Did I miss something obvious? Would it be possible to put up a java2nrx web page where you can simply paste some java

code and have it converted to NetRexx?

 

I am sure I am not the only one running into this kind of problems…

things that seem simple and obvious to java programmers are not as clear to me…

That’s why I program in NetRexx ;-)

 

Michael

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Alan Sampson
Sent: Saturday, June 16, 2012 20:06
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] Need some java -> nrx help please...

 

Letting java2nrx do most of the heavy lifting renders this:

 

        mqcfh_ = MQCFH

 

        mqcfh_ = MQCFH(msg)

        i = int

        loop i = 0 to i + 1 while i << mqcfh_.parameterCount 

            pcfParameter_ = PCFParameter

            pcfParameter_ = PCFParameter.nextParameter(msg)

            o = Object

            o = pcfParameter_.getValue()

            if o <= String then do 

                srh = String

                srh = String o

                System.out.println(pcfParameter_.getClass().toString() || ":" || srh)

            end

 

        end 

 

Note: NetRexx is still case insensitive (kind of) so it's not a big fan of things like mqcfh = MQCFH() etc.

 

Alan.

PS.  I faked out the dependent classes and got it to compile and run too.

On 16 June 2012 01:59, Michael Dag <[hidden email]> wrote:

Struggling again with some java code (part of a larger conversion that sofar seems to work…) to convert to nrx:

 

mqcfh = new MQCFH(msg);

for (int i = 0; i < mqcfh.parameterCount; i++) {

  PCFParameter pcfParameter = PCFParameter.nextParameter(msg);

  Object o = pcfParameter.getValue();

  if (o instanceof String) {

     String srh = (String) o;

     System.out.println(/*

                         * pcfParameter.getClass().toString()

                         * +":" +

                         */srh);

     }                   

  }

 

I tried the ‘leave out the type’ and ‘new’ but, that doesn’t seem to do the trick here…

 

Any help is appreciated J

 

Michael


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



 

--
Can't tweet, won't tweet!


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/





--
Can't tweet, won't tweet!

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Alan

--
Needs more cowbell.
Reply | Threaded
Open this post in threaded view
|

Re: Need some java -> nrx help please...

ThSITC
Thanks for these Insights, Alan! :-)
Thomas. 
===================================================================
Am 17.06.2012 21:47, schrieb Alan Sampson:
I don't remember now where I got my copy of java2nrx (possibly from when I downloaded the NetRexx source from Kenai) but what I have is a command line tool.  It comes with a bash script and a Windows BAT file and is pretty easy to use.
Bear in mind that for anything but the simplest programs it does need a lot of post-conversion clean up.  Even the sample you sent wasn't valid NetRexx at first and as can be seen from my first attempt you need to scan through the resulting coe with a fine tooth comb to catch some gotchas; and its handling of Java anonymous inner classes can leave you scratching your head.

It still beats conversion by hand thouh so in the main it's worth it if you absolutely must have a NetRexx version of a program.

Alan.

PS  With regard the loop construct from the conversion.  Were I doing it by hand I wouldn't use:

loop i = 0 to i + 1 while i << mqcfh_.parameterCount
  ...
  end 

or

loop i = 0 by 1 while i << mqcfh_.parameterCount
  ...
  end

A more concise and Rexx-like construct would be:

loop for mqcfh_.parameterCount
  ...
  end

which allows you to drop the definition for the loop controlling variable i too.

On 17 June 2012 03:43, Michael Dag <[hidden email]> wrote:

Alan,

Thanks! That did the trick!

I am completely lost when it comes to Java and structures like this, I googled java2nrx and found kenai with sources, but no simple ‘run’ command

to execute and find out… Did I miss something obvious? Would it be possible to put up a java2nrx web page where you can simply paste some java

code and have it converted to NetRexx?

 

I am sure I am not the only one running into this kind of problems…

things that seem simple and obvious to java programmers are not as clear to me…

That’s why I program in NetRexx ;-)

 

Michael

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Alan Sampson
Sent: Saturday, June 16, 2012 20:06
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] Need some java -> nrx help please...

 

Letting java2nrx do most of the heavy lifting renders this:

 

        mqcfh_ = MQCFH

 

        mqcfh_ = MQCFH(msg)

        i = int

        loop i = 0 to i + 1 while i << mqcfh_.parameterCount 

            pcfParameter_ = PCFParameter

            pcfParameter_ = PCFParameter.nextParameter(msg)

            o = Object

            o = pcfParameter_.getValue()

            if o <= String then do 

                srh = String

                srh = String o

                System.out.println(pcfParameter_.getClass().toString() || ":" || srh)

            end

 

        end 

 

Note: NetRexx is still case insensitive (kind of) so it's not a big fan of things like mqcfh = MQCFH() etc.

 

Alan.

PS.  I faked out the dependent classes and got it to compile and run too.

On 16 June 2012 01:59, Michael Dag <[hidden email]> wrote:

Struggling again with some java code (part of a larger conversion that sofar seems to work…) to convert to nrx:

 

mqcfh = new MQCFH(msg);

for (int i = 0; i < mqcfh.parameterCount; i++) {

  PCFParameter pcfParameter = PCFParameter.nextParameter(msg);

  Object o = pcfParameter.getValue();

  if (o instanceof String) {

     String srh = (String) o;

     System.out.println(/*

                         * pcfParameter.getClass().toString()

                         * +":" +

                         */srh);

     }                   

  }

 

I tried the ‘leave out the type’ and ‘new’ but, that doesn’t seem to do the trick here…

 

Any help is appreciated J

 

Michael


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



 

--
Can't tweet, won't tweet!


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/





--
Can't tweet, won't tweet!


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



--
Thomas Schneider (Founder of www.thsitc.com) Member of the Rexx Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team (www.netrexx.org)

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Thomas Schneider, Vienna, Austria (Europe) :-)

www.thsitc.com
www.db-123.com