Implementing Packed (IBM packed) Items in NetRexx.

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

Implementing Packed (IBM packed) Items in NetRexx.

ThSITC
For an Implementation to read REMOTE Files of an IBM Mainframe,
I did design a class Packed.

myint=Packed(5) -- IBM Packed with 5 Digits (Packed by 2 digits in each
half-Byte), where the
last Half-Byte contains HEX 'F' or 'C', as usual, for positivy values,
and Hex 'D' for negatives.

myDecimal=Packed(10,3) -- same as IBM PL/I Packed notation.

Detto, for interfacing COBOL Files, class Zoned, e.g:

myint=Zoned(7) --- 7 digits in Zoned format
myDecimal=Zoned(7,3) -- 7 Digits, 3 of them are decimals.

Both classes do have a toRexx method to convert them to the currently
implemented Rexx Class.

As all of you, who did ever use Rexx2Nrx, I call those "Number's" and
"Numeric's"
in all of my soft.

The idea behing this all is THAT the compiler can check at compile time
whether
those type of variables might be used in a Numeric Context.

What do you think?

UseFul? Ugly? Un-Necessary, at all?

Thomas.


--
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
Reply | Threaded
Open this post in threaded view
|

Customizing Focus Traversal

kenner

Does anyone have any experience with using this in Netrexx?

Can I just use the Java code as is:

Vector order = new Vector(7);
       order.add(tf1);
       order.add(tf2);
       order.add(tf3);
       order.add(tf4);
       order.add(tf5);
       order.add(tf6);
       order.add(table);
       newPolicy = new MyOwnFocusTraversalPolicy(order);


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

Reply | Threaded
Open this post in threaded view
|

RE: Customizing Focus Traversal

Dave Woodman

Hi

 

The NetRexx way would save you a little typing:-

 

order = Vector(7)
order.add(tf1)
order.add(tf2)
order.add(tf3)
order.add(tf4)
order.add(tf5)
order.add(tf6)
order.add(table)
newPolicy = MyOwnFocusTraversalPolicy(order)

 

I hope this helps

                Dave,

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of [hidden email]
Sent: 05 December 2011 21:40
To: IBM Netrexx
Subject: [Ibm-netrexx] Customizing Focus Traversal

 


Does anyone have any experience with using this in Netrexx?

Can I just use the Java code as is:

Vector order = new Vector(7);
       order.add(tf1);
       order.add(tf2);
       order.add(tf3);
       order.add(tf4);
       order.add(tf5);
       order.add(tf6);
       order.add(table);
       newPolicy = new MyOwnFocusTraversalPolicy(order);


TIA.


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

Reply | Threaded
Open this post in threaded view
|

RE: Customizing Focus Traversal

measel
In reply to this post by kenner

Skip to the bottom:   (from an old list post by Quique Britto)

 

/**************** */

/*    JTable Test  */

/* **************** */

import java.text.

import javax.swing.

 

class SimpleTableDemo extends JFrame  implements TableModelListener, ActionListener

-- properties inheritable

  -- general variables

 

 

  -- frame variables

  jt         = JTable()

  jp         = JPanel()

sp         = JScrollPane()

  mainwindow = JFrame()

 

 

method SimpleTableDemo()

  -- create frame

  mainwindow = JFrame()

  -- set properties for mainwindow

  mainwindow.addWindowListener( CloseWindowAdapter() )

 

  -- set frame characteristics

  mainwindow.setTitle( "Simple Table Demo" )

  mainwindow.setSize( 800,400 )

  -- center frame

  d = mainwindow.getToolkit().getScreenSize()

  s = mainwindow.getSize()

  mainwindow.setLocation((d.width - s.width) % 2, (d.height - s.height) % 2 )

 

  -- create out Table instance

  fm = FileModel()

  jt = JTable( fm )

 

  -- create jscrollpane

  sp = JScrollPane( jt )

 

  -- add scrollpane to the mainwindow

  mainwindow.getContentPane().add( sp, BorderLayout.CENTER )

 

  -- show window

  mainwindow.setVisible( 1 )

return

 

 

method main( args=String[] ) static 

  -- this is the first method (procedure) to be executed

  args = args

 

  -- window decorations

  JFrame.setDefaultLookAndFeelDecorated( 0 )

 

  -- create a table instance

  SimpleTableDemo()

 

return

 

class SimpleTableDemo.CloseWindowAdapter dependent extends WindowAdapter

  method windowClosing( e = WindowEvent )    

  exit 0

 

class FileModel extends AbstractTableModel

  properties inheritable

  -- general variables

  titles = Vector()

  row1 = Vector(0)

  row2 = Vector()

  data   = Vector()

 

 

  method FileModel()

  -- create column headers

  titles = Vector()

  titles.add( String( "Column 1" ))

  titles.add( String( "Column 2" ))

 

  -- create some data

  row1 = Vector()

  row1.add( String( "pepe" ))

  row1.add( String( "pepe2" ))

 

  row2 = Vector()

  row2.add( String( "javi" ))

  row2.add( String( "jave2" ))

 

  data = Vector()

  data.add( Vector( row1 ) )

  data.add( Vector( row2 ) )

 

return

 

method getRowCount() returns int

return data.Size()

 

method getColumnCount() returns int

return titles.Size()

 

method getValueAt( r = int, c = int) returns java.lang.Object

return data

 

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of [hidden email]
Sent: Monday, December 05, 2011 3:40 PM
To: IBM Netrexx
Subject: [Ibm-netrexx] Customizing Focus Traversal

 


Does anyone have any experience with using this in Netrexx?

Can I just use the Java code as is:

Vector order = new Vector(7);
       order.add(tf1);
       order.add(tf2);
       order.add(tf3);
       order.add(tf4);
       order.add(tf5);
       order.add(tf6);
       order.add(table);
       newPolicy = new MyOwnFocusTraversalPolicy(order);


TIA.


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

Reply | Threaded
Open this post in threaded view
|

Re: Customizing Focus Traversal

alansam
In reply to this post by kenner


On 5 December 2011 13:40, <[hidden email]> wrote:

Does anyone have any experience with using this in Netrexx?

Can I just use the Java code as is:

Vector order = new Vector(7);
       order.add(tf1);
       order.add(tf2);
8X------ Snip

Almost.  The "new" keyword won't work and the datatype is placed o the right side of assignment statements.  Here's a slapped-together working example:

/* NetRexx */
options replace format comments java crossref symbols utf8

class KKFocusTraversal public final

  properties constant
    tf1 = 'tf1'
    tf2 = 'tf2'
    tf3 = 'tf3'
    tf4 = 'tf4'
    tf5 = 'tf5'
    tf6 = 'tf6'
    table = 'table'

method main(args = String[]) public static

  order = Vector(7);
  order.add(tf1);
  order.add(tf2);
  order.add(tf3);
  order.add(tf4);
  order.add(tf5);
  order.add(tf6);
  order.add(table);
  newPolicy = MyOwnFocusTraversalPolicy(order);
  say newPolicy.toString

  return

-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class MyOwnFocusTraversalPolicy private

  properties private
    policyOrder = Vector

method MyOwnFocusTraversalPolicy(order = Vector)

  this.policyOrder = order

  return

method toString public returns String

  toStr = ''
  oi = policyOrder.iterator
  loop label oiLoop while oi.hasNext
    toStr = toStr oi.next
    end oiLoop

  return toStr.strip.toString


Alan. 



--
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: Customizing Focus Traversal

ThSITC
In reply to this post by measel
Hello Mike,
   1.) thanks for forwarding this example :-)
   2.) I put it to my test-cases, but *cannot COMPILE it using current NetRexxC* !!

Any ideas what I did wrong ??
Thomas.
=====================================================================
As IBM-NetRexx does still NOt support ATTACHED Files (as other user groups do ;-)
I'm including here the NetRexxC.log of my attempt to compile you sample:
=====================================================================
NetRexx portable processor, version NetRexx 3.01RC2, build 54-20111013-0038
Copyright (c) RexxLA, 2011.  All rights reserved.
Parts Copyright (c) IBM Corporation, 1995,2008.
Program SimpleTableDemo.nrx
  === class SimpleTableDemo ===
    constructor SimpleTableDemo()
      overrides JFrame()
    function main(String[])
  16 +++ class SimpleTableDemo extends JFrame  implements TableModelListener, ActionListener
     +++       ^^^^^^^^^^^^^^^
     +++ Error: Class is not abstract, yet it does not implement method 'tableChanged(TableModelEvent)' from abstract class 'javax.swing.event.TableModelListener'
  16 +++ class SimpleTableDemo extends JFrame  implements TableModelListener, ActionListener
     +++       ^^^^^^^^^^^^^^^
     +++ Error: Class is not abstract, yet it does not implement method 'actionPerformed(ActionEvent)' from abstract class 'java.awt.event.ActionListener'

  === class SimpleTableDemo.CloseWindowAdapter ===
    method windowClosing(WindowEvent)
      overrides WindowAdapter.windowClosing(WindowEvent)

  === class FileModel ===
    constructor FileModel()
      overrides AbstractTableModel()
    method getRowCount
    method getColumnCount
    method getValueAt(int,int)
Compilation of 'SimpleTableDemo.nrx' failed [3 classes, 2 errors]

*********************************************************************************************************************
 
Am 05.12.2011 23:49, schrieb Measel, Mike:

Skip to the bottom:   (from an old list post by Quique Britto)

 

/**************** */

/*    JTable Test  */

/* **************** */

import java.text.

import javax.swing.

 

class SimpleTableDemo extends JFrame  implements TableModelListener, ActionListener

-- properties inheritable

  -- general variables

 

 

  -- frame variables

  jt         = JTable()

  jp         = JPanel()

sp         = JScrollPane()

  mainwindow = JFrame()

 

 

method SimpleTableDemo()

  -- create frame

  mainwindow = JFrame()

  -- set properties for mainwindow

  mainwindow.addWindowListener( CloseWindowAdapter() )

 

  -- set frame characteristics

  mainwindow.setTitle( "Simple Table Demo" )

  mainwindow.setSize( 800,400 )

  -- center frame

  d = mainwindow.getToolkit().getScreenSize()

  s = mainwindow.getSize()

  mainwindow.setLocation((d.width - s.width) % 2, (d.height - s.height) % 2 )

 

  -- create out Table instance

  fm = FileModel()

  jt = JTable( fm )

 

  -- create jscrollpane

  sp = JScrollPane( jt )

 

  -- add scrollpane to the mainwindow

  mainwindow.getContentPane().add( sp, BorderLayout.CENTER )

 

  -- show window

  mainwindow.setVisible( 1 )

return

 

 

method main( args=String[] ) static 

  -- this is the first method (procedure) to be executed

  args = args

 

  -- window decorations

  JFrame.setDefaultLookAndFeelDecorated( 0 )

 

  -- create a table instance

  SimpleTableDemo()

 

return

 

class SimpleTableDemo.CloseWindowAdapter dependent extends WindowAdapter

  method windowClosing( e = WindowEvent )    

  exit 0

 

class FileModel extends AbstractTableModel

  properties inheritable

  -- general variables

  titles = Vector()

  row1 = Vector(0)

  row2 = Vector()

  data   = Vector()

 

 

  method FileModel()

  -- create column headers

  titles = Vector()

  titles.add( String( "Column 1" ))

  titles.add( String( "Column 2" ))

 

  -- create some data

  row1 = Vector()

  row1.add( String( "pepe" ))

  row1.add( String( "pepe2" ))

 

  row2 = Vector()

  row2.add( String( "javi" ))

  row2.add( String( "jave2" ))

 

  data = Vector()

  data.add( Vector( row1 ) )

  data.add( Vector( row2 ) )

 

return

 

method getRowCount() returns int

return data.Size()

 

method getColumnCount() returns int

return titles.Size()

 

method getValueAt( r = int, c = int) returns java.lang.Object

return data

 

 

 

From: [hidden email] [[hidden email]] On Behalf Of [hidden email]
Sent: Monday, December 05, 2011 3:40 PM
To: IBM Netrexx
Subject: [Ibm-netrexx] Customizing Focus Traversal

 


Does anyone have any experience with using this in Netrexx?

Can I just use the Java code as is:

Vector order = new Vector(7);
       order.add(tf1);
       order.add(tf2);
       order.add(tf3);
       order.add(tf4);
       order.add(tf5);
       order.add(tf6);
       order.add(table);
       newPolicy = new MyOwnFocusTraversalPolicy(order);


TIA.



_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Customizing Focus Traversal

ThSITC
In reply to this post by alansam
Hello Alan, and all,
   also, a very interesting case. Thanks a lot, Alan! :-)

NetRexxC.log below!
=============================================================
NetRexx portable processor, version NetRexx 3.01RC2, build 54-20111013-0038
Copyright (c) RexxLA, 2011.  All rights reserved.
Parts Copyright (c) IBM Corporation, 1995,2008.
Program alan1.nrx
 2 +++ options replace format comments java crossref symbols utf8
   +++                                                                                                  ^^^^
   +++ Error: Any UTF8 option on the OPTIONS instruction must match the UTF8 setting passed to the processor
Compilation of 'alan1.nrx' failed [one error]
===========================================================
Question to the GURUS:

Where is the UTF8 requirement documented?

 *or*: Did I miss something?

Greetings from Vienna!
Thomas.
****************************************************************************************
Am 06.12.2011 00:14, schrieb Alan Sampson:


On 5 December 2011 13:40, <[hidden email]> wrote:

Does anyone have any experience with using this in Netrexx?

Can I just use the Java code as is:

Vector order = new Vector(7);
       order.add(tf1);
       order.add(tf2);
8X------ Snip

Almost.  The "new" keyword won't work and the datatype is placed o the right side of assignment statements.  Here's a slapped-together working example:

/* NetRexx */
options replace format comments java crossref symbols utf8

class KKFocusTraversal public final

  properties constant
    tf1 = 'tf1'
    tf2 = 'tf2'
    tf3 = 'tf3'
    tf4 = 'tf4'
    tf5 = 'tf5'
    tf6 = 'tf6'
    table = 'table'

method main(args = String[]) public static

  order = Vector(7);
  order.add(tf1);
  order.add(tf2);
  order.add(tf3);
  order.add(tf4);
  order.add(tf5);
  order.add(tf6);
  order.add(table);
  newPolicy = MyOwnFocusTraversalPolicy(order);
  say newPolicy.toString

  return

-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class MyOwnFocusTraversalPolicy private

  properties private
    policyOrder = Vector

method MyOwnFocusTraversalPolicy(order = Vector)

  this.policyOrder = order

  return

method toString public returns String

  toStr = ''
  oi = policyOrder.iterator
  loop label oiLoop while oi.hasNext
    toStr = toStr oi.next
    end oiLoop

  return toStr.strip.toString


Alan. 



--
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
Reply | Threaded
Open this post in threaded view
|

Re: Customizing Focus Traversal

alansam
utf8 isn't a requirement unless you want to exploit utf8 in your source code.  Either turn the option off (noutf8) in the OPTIONS directive or compile with the -utf8 switch.

Alan.




--
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.