Class mystery

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

Class mystery

Robert L Hamilton
[C:\Program Files\jEdit\ConstClass.nrx 3 8 10]  Error: 'Class ConstClass' instruction has already been implied for this program
Program index.nrx
Program multi.nrx
Program asktest.nrx
Program test.nrx
Program testbin.nrx
  === class testbin ===
    function main(String[])
Program iosample.nrx

Sometimes this msg appears and I don't know what it means by "implied for the program "  ???
Is this a case of jedit/netrexx locking horns??

thnx -- and enjoy the day.....

bobh

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Class mystery

George Hovey-2
I think this means that NetRexx thinks you are writing a "low boilerplate" (search for this in the NetRexx manual) class by omitting the Class instruction; in this case NetRexx silently supplies the Class and main methods ("implied") so that you can write a simple program without a lot of typing.

Of course you did write a Class instruction, but (I guess) preceded it with some other NetRexx statement which triggered the "implied class" mechanism.  The article "Program Structure" spells this out.

George

On Sat, Jul 10, 2010 at 9:49 AM, Robert Hamilton <[hidden email]> wrote:
[C:\Program Files\jEdit\ConstClass.nrx 3 8 10]  Error: 'Class ConstClass' instruction has already been implied for this program
Program index.nrx
Program multi.nrx
Program asktest.nrx
Program test.nrx
Program testbin.nrx
  === class testbin ===
    function main(String[])
Program iosample.nrx

Sometimes this msg appears and I don't know what it means by "implied for the program "  ???
Is this a case of jedit/netrexx locking horns??

thnx -- and enjoy the day.....

bobh

_______________________________________________
Ibm-netrexx mailing list
[hidden email]




_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Class mystery

Robert L Hamilton
I start with this from the ibm manual:
  /* A program with two classes */
import java.applet. -- for example
  class testclass extends Applet
properties public
state -- property of type 'Rexx'
i=int -- property of type 'int'
properties constant
j=int 3 -- property initialized to '3'
    method start
say 'I started'
state='start'
    method stop
say 'I stopped'
state='stop'
  class anotherclass
method testing
loop i=1 to 10
say '1, 2, 3, 4...'
if i=7 then return
end
return
    method anothertest
say '1, 2, 3, 4'

/* This program gives: */


NetRexxScript execute C:\Documents and Settings\BOB HAMILTON\.jedit\NetRexx\temp\current.nrx
NetRexx portable processor, version 2.05
Copyright (c) IBM Corporation, 2005. All rights reserved.
Program index.nrx
Program multi.nrx
Program asktest.nrx
Program test.nrx
Program current.nrx
[C:\Program Files\jEdit\Untitled-1 2 3 6] Error: IMPORT instruction must precede any classes

=== class testclass ===
method start
overrides Applet.start
method stop
overrides Applet.stop

=== class anotherclass ===
method testing
method anothertest
Program testbin.nrx
=== class testbin ===
function main(String[])
Program iosample.nrx


I am a first timer in JAVA, jEDIT and netREXX/JAVA so I don't know which is doing what.

Thanks for the help and Enjoy the day.

bob hamilton, Engineer







_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Class mystery

Kermit Kiser
Hi Bob --

That code contains a "class" instruction which technically makes it a NetRexx "program" rather than a NetRexx "script". (I define a NetRexx "program" as code that provides it's own class and main methods rather than letting NetRexx add them like a script does.)

NetRexxScript can still interpret your code but you need to do one of two things to let it know that you are running a program rather than a script:

1) Move the "import" instruction to the first line of your file.
or
2) Select jEdit menu "Plugins", then menu item "Plugin Options", then plugin item NetRexxScript, then uncheck the boxes labeled "preparse all scripts" and "add jEdit variables to all scripts", then click the "OK" button.

If you choose option (2), it will disable some of the provided sample scripts but it may work better for running NetRexx "programs".

Note that the code you have copied is an "Applet" which means that it is designed to run in a web browser and so it will not run under jEdit which is not a browser without some significant modifications.

-- Kermit


On 7/10/2010 8:02 AM, Robert Hamilton wrote:
I start with this from the ibm manual:
  /* A program with two classes */
  import java.applet.   -- for example
  class testclass extends Applet

    properties public
      state             -- property of type 'Rexx'
      i=int             -- property of type 'int'
    properties constant
      j=int 3           -- property initialized to '3'
    method start
      say 'I started'
      state='start'
    method stop
      say 'I stopped'
      state='stop'
  class anotherclass
    method testing
      loop i=1 to 10
        say '1, 2, 3, 4...'
        if i=7 then return
       end
      return
    method anothertest

      say '1, 2, 3, 4' 

/* This program gives:  */


NetRexxScript execute C:\Documents and Settings\BOB HAMILTON\.jedit\NetRexx\temp\current.nrx 
NetRexx portable processor, version 2.05
Copyright (c) IBM Corporation, 2005.  All rights reserved.

Program index.nrx
Program multi.nrx
Program asktest.nrx
Program test.nrx
Program current.nrx
[C:\Program Files\jEdit\Untitled-1 2 3 6]  Error: IMPORT instruction must precede any classes

  === class testclass ===

    method start
      overrides Applet.start
    method stop
      overrides Applet.stop

  === class anotherclass ===
    method testing
    method anothertest
Program testbin.nrx
  === class testbin ===

    function main(String[])
Program iosample.nrx


I am a first timer in JAVA, jEDIT and netREXX/JAVA so I don't know which is doing what.

Thanks for the help and Enjoy the day.


bob hamilton, Engineer






  

_______________________________________________ Ibm-netrexx mailing list [hidden email]

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Class mystery

Thomas.Schneider.Wien
*Very VALUABLE INFO*, again Kermit ...

I will still have to *learn* a Lot of NetRexx internals----- :-(

Have a nice day anyway ....

Tom. (www.thsitc.com)
======================================================================================
Am 10.07.2010 19:43, schrieb Kermit Kiser:
Hi Bob --

That code contains a "class" instruction which technically makes it a NetRexx "program" rather than a NetRexx "script". (I define a NetRexx "program" as code that provides it's own class and main methods rather than letting NetRexx add them like a script does.)

NetRexxScript can still interpret your code but you need to do one of two things to let it know that you are running a program rather than a script:

1) Move the "import" instruction to the first line of your file.
or
2) Select jEdit menu "Plugins", then menu item "Plugin Options", then plugin item NetRexxScript, then uncheck the boxes labeled "preparse all scripts" and "add jEdit variables to all scripts", then click the "OK" button.

If you choose option (2), it will disable some of the provided sample scripts but it may work better for running NetRexx "programs".

Note that the code you have copied is an "Applet" which means that it is designed to run in a web browser and so it will not run under jEdit which is not a browser without some significant modifications.

-- Kermit


On 7/10/2010 8:02 AM, Robert Hamilton wrote:
I start with this from the ibm manual:
  /* A program with two classes */
  import java.applet.   -- for example
  class testclass extends Applet

    properties public
      state             -- property of type 'Rexx'
      i=int             -- property of type 'int'
    properties constant
      j=int 3           -- property initialized to '3'
    method start
      say 'I started'
      state='start'
    method stop
      say 'I stopped'
      state='stop'
  class anotherclass
    method testing
      loop i=1 to 10
        say '1, 2, 3, 4...'
        if i=7 then return
       end
      return
    method anothertest

      say '1, 2, 3, 4' 

/* This program gives:  */


NetRexxScript execute C:\Documents and Settings\BOB HAMILTON\.jedit\NetRexx\temp\current.nrx 
NetRexx portable processor, version 2.05
Copyright (c) IBM Corporation, 2005.  All rights reserved.

Program index.nrx
Program multi.nrx
Program asktest.nrx
Program test.nrx
Program current.nrx
[C:\Program Files\jEdit\Untitled-1 2 3 6]  Error: IMPORT instruction must precede any classes

  === class testclass ===

    method start
      overrides Applet.start
    method stop
      overrides Applet.stop

  === class anotherclass ===
    method testing
    method anothertest
Program testbin.nrx
  === class testbin ===

    function main(String[])
Program iosample.nrx


I am a first timer in JAVA, jEDIT and netREXX/JAVA so I don't know which is doing what.

Thanks for the help and Enjoy the day.


bob hamilton, Engineer






  

_______________________________________________ Ibm-netrexx mailing list [hidden email]
_______________________________________________ Ibm-netrexx mailing list [hidden email]


--
Thomas Schneider Projects ReyC & LOGOS on www.KENAI.com

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Tom. (ths@db-123.com)
Reply | Threaded
Open this post in threaded view
|

Re: Class mystery

George Hovey-2
In reply to this post by Robert L Hamilton
Hi Bob,

I was just about to reply that since NetRexxScript is involved you'd better wait for Kermit to respond, when he did so.

Just some general comments.   Your approach to learning NetRexx -- jump in with both feet -- is my preferred way too, but it can be painful in the beginning!

You point out that it's difficult to figure out who is finding fault with your program: NetRexx, Java, NetRexxScript or jEdit.

It is not jEdit, because jEdit has no understanding of, or interest in, the meaning of your program.

Java is not much of a problem unless you are mishandling calls to its built-in class library, in which case you have to put up with its turgid error messages.  Otherwise NetRexx stands between you and Java and fields almost all (or maybe all) other syntactic problems.

NetRexxScript is not, strictly speaking, part of jEdit, and as Kermit explained there are some angles to using NetRexxScript that you won't find covered in the NetRexx manual, so it is a potential source of difficulty.  For my part, I use NetRexxScript primarily for scripts which need access to jEdit internals.  This almost certainly is not your goal (yet).

You might consider simplifying your life by experimenting within the confines of NetRexxC until you start to feel comfortable with NetRexx.  I don't know if you are using an IDE, but if so consider dropping it for the time being and work in the following spartan way.  Open a command window in your source directory and do all compiles from the command line using NetRexxC.  Redirect NetRexxC's output to a file, say ERRORS.NRX.  Open two jEdit windows, or a window with two panes. Use one to observe the source file whose syntax errors need correcting, and the other for ERRORS.NRX.

ERRORS.NRX is not a NetRexx source file, but giving it that type will produce useful, if somewhat peculiar, syntax coloring.  [If you are into jEdit modes, I can provide a mode file which will color ERRORS.NRX very effectively].

After a compile, peruse ERRORS.NRX and fix any errors in the source window.  Save it and recompile.  This may take several iterations because NetRexx bails out after only a few errors are detected - a wise policy since many additional errors will be the result of the errors shown.  This may require a number of iterations, but is very quick with today's computers.  And NetRexx's diagnostic messages are (mostly) very informative.

Working in this way, the answers to virtually all your problems will be found the the NetRexx manual.

On Sat, Jul 10, 2010 at 11:02 AM, Robert Hamilton <[hidden email]> wrote:
I start with this from the ibm manual:
  /* A program with two classes */
import java.applet. -- for example
  class testclass extends Applet
properties public
state -- property of type 'Rexx'
i=int -- property of type 'int'
properties constant
j=int 3 -- property initialized to '3'
    method start
say 'I started'
state='start'
    method stop
say 'I stopped'
state='stop'
  class anotherclass
method testing
loop i=1 to 10
say '1, 2, 3, 4...'
if i=7 then return
end
return
    method anothertest
say '1, 2, 3, 4'

/* This program gives: */


NetRexxScript execute C:\Documents and Settings\BOB HAMILTON\.jedit\NetRexx\temp\current.nrx
NetRexx portable processor, version 2.05
Copyright (c) IBM Corporation, 2005. All rights reserved.

Program index.nrx
Program multi.nrx
Program asktest.nrx
Program test.nrx
Program current.nrx
[C:\Program Files\jEdit\Untitled-1 2 3 6] Error: IMPORT instruction must precede any classes

=== class testclass ===
method start
overrides Applet.start
method stop
overrides Applet.stop

=== class anotherclass ===
method testing
method anothertest

Program testbin.nrx
=== class testbin ===
function main(String[])
Program iosample.nrx


I am a first timer in JAVA, jEDIT and netREXX/JAVA so I don't know which is doing what.

Thanks for the help and Enjoy the day.

bob hamilton, Engineer







_______________________________________________
Ibm-netrexx mailing list
[hidden email]




_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Class mystery

Thomas.Schneider.Wien
Hello George,,

     I would (currently) like to REPLY that your description (+AND+ *EDUCATIION)  *of* Bob Hamilton
seems *perfect to me*   ...

     Needless to say, Bob,.  (I do hope) that you have:

1.) Read the available doc's (PDF's)
2.) and only afterwards you do Start programming in NetRexx ::-)

Kind regards from dark Vienna, Austria,

Tom (www.thcitc.com)


00000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Am 10.07.2010 21:50, schrieb George Hovey:
Hi Bob,

I was just about to reply that since NetRexxScript is involved you'd better wait for Kermit to respond, when he did so.

Just some general comments.   Your approach to learning NetRexx -- jump in with both feet -- is my preferred way too, but it can be painful in the beginning!

You point out that it's difficult to figure out who is finding fault with your program: NetRexx, Java, NetRexxScript or jEdit.

It is not jEdit, because jEdit has no understanding of, or interest in, the meaning of your program.

Java is not much of a problem unless you are mishandling calls to its built-in class library, in which case you have to put up with its turgid error messages.  Otherwise NetRexx stands between you and Java and fields almost all (or maybe all) other syntactic problems.

NetRexxScript is not, strictly speaking, part of jEdit, and as Kermit explained there are some angles to using NetRexxScript that you won't find covered in the NetRexx manual, so it is a potential source of difficulty.  For my part, I use NetRexxScript primarily for scripts which need access to jEdit internals.  This almost certainly is not your goal (yet).

You might consider simplifying your life by experimenting within the confines of NetRexxC until you start to feel comfortable with NetRexx.  I don't know if you are using an IDE, but if so consider dropping it for the time being and work in the following spartan way.  Open a command window in your source directory and do all compiles from the command line using NetRexxC.  Redirect NetRexxC's output to a file, say ERRORS.NRX.  Open two jEdit windows, or a window with two panes. Use one to observe the source file whose syntax errors need correcting, and the other for ERRORS.NRX.

ERRORS.NRX is not a NetRexx source file, but giving it that type will produce useful, if somewhat peculiar, syntax coloring.  [If you are into jEdit modes, I can provide a mode file which will color ERRORS.NRX very effectively].

After a compile, peruse ERRORS.NRX and fix any errors in the source window.  Save it and recompile.  This may take several iterations because NetRexx bails out after only a few errors are detected - a wise policy since many additional errors will be the result of the errors shown.  This may require a number of iterations, but is very quick with today's computers.  And NetRexx's diagnostic messages are (mostly) very informative.

Working in this way, the answers to virtually all your problems will be found the the NetRexx manual.

On Sat, Jul 10, 2010 at 11:02 AM, Robert Hamilton <[hidden email]> wrote:
I start with this from the ibm manual:
  /* A program with two classes */

  import java.applet.   -- for example
  class testclass extends Applet

    properties public
      state             -- property of type 'Rexx'
      i=int             -- property of type 'int'
    properties constant
      j=int 3           -- property initialized to '3'
    method start
      say 'I started'
      state='start'
    method stop
      say 'I stopped'
      state='stop'
  class anotherclass
    method testing
      loop i=1 to 10
        say '1, 2, 3, 4...'
        if i=7 then return
       end
      return
    method anothertest


      say '1, 2, 3, 4' 

/* This program gives:  */


NetRexxScript execute C:\Documents and Settings\BOB HAMILTON\.jedit\NetRexx\temp\current.nrx 
NetRexx portable processor, version 2.05
Copyright (c) IBM Corporation, 2005.  All rights reserved.
Program index.nrx Program multi.nrx Program asktest.nrx Program test.nrx
Program current.nrx [C:\Program Files\jEdit\Untitled-1 2 3 6] Error: IMPORT instruction must precede any classes === class testclass === method start overrides Applet.start method stop overrides Applet.stop === class anotherclass === method testing method anothertest
Program testbin.nrx === class testbin === function main(String[]) Program iosample.nrx
I am a first timer in JAVA, jEDIT and netREXX/JAVA so I don't know which is doing what. Thanks for the help and Enjoy the day. bob hamilton, Engineer

_______________________________________________
Ibm-netrexx mailing list
[hidden email]



_______________________________________________ Ibm-netrexx mailing list [hidden email]


--
Thomas Schneider Projects ReyC & LOGOS on www.KENAI.com

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Tom. (ths@db-123.com)