Re: Next generation COBOL?
- From: "James J. Gavan" <jgavandeletethis@xxxxxxx>
- Date: Tue, 29 Nov 2005 21:19:36 GMT
Oliver Wong wrote:
Depends on what you mean by "integral". Java 1.5, purely as a language (i.e. without the libraries typically bundled with the compile), has no concept of GUIs, but it does have special support for iterating through every element in a collection, like so:
for (ElementType element : collection) { doSomethingWith(element); }
I should have picked up on the above. The J4 intended Standard has an Iterator class, and here's a Net Express example using the class Callback,(aka Iterator) :-
** DBI = DataBase Interface - a go-between-class sitting between the BuisnessDriver class and either the COBOL file or SQL Table class.
*>-------------------------------------------------------------
Method-id. "deleteGroup".
*>-------------------------------------------------------------
*> Invoked from CountryDBI when a Country record is
*> to be deleted from the Treeview. Get collection of Cheeses
*> subordinate to Country. Delete individual chesse File/Table
*> records. Cheeses affected are removed from the Treeview when
*> the Parent Country label is 'destroyed'. Local-storage section.
01 ls-number pic x(4) comp-5.
01 ls-size pic x(4) comp-5.
01 ls-string object reference.01 ls-Callback object reference.
Linkage section.
01 lnk-TvCountry object reference.
copy "\copylib\sqlResult.cpy" replacing ==(tag)== by ==01 Lnk==. Procedure Division using lnk-TvCountry
returning lnk-SqlResult. move zeroes to lnk-SqlResult
invoke lnk-TvCountry "getItems" returning os-CountryCollection
invoke Callback "new"
using self "deleteGroup2 " returning ls-Callback
invoke os-CountryCollection "do" using ls-Callback
invoke ls-Callback "finalize" returning ls-Callback End Method "deleteGroup".
*>-------------------------------------------------------------
Method-id. "deleteGroup2". *> Callback Method
*>-------------------------------------------------------------
Linkage section.
01 lnk-CheeseElement object reference.Procedure Division using lnk-CheeseElement.
set CheeseLabel to true
invoke self "getTvLabel" using lnk-CheeseElement
move ws-OldCheeseKey to Cheese-PrimeKey
invoke os-CheeseFile "deleteRecord"
using Cheese-PrimeKey returning Cheese-SqlResult if FileError
invoke self "PB-Exit"
End-If End Method "deleteGroup2".
*>-------------------------------------------------------------Using method "do" the above is basic iteration; if comparison checking, within the callback method I can have :-
if <condition met> invoke MyCollection "quitIteration"
A la Smalltalk there are three other methods "select" "reject" and "collect" which I don't use - "select" if true put into a new sub-collection, "reject" if false put into a new sub-collection and "collect" - never quite figured this one - put into a new sub-collection, (obviously based on some selection criteria).
Jimmy .
- References:
- Next generation COBOL?
- From: Steve Richfie1d
- Re: Next generation COBOL?
- From: Richard
- Re: Next generation COBOL?
- From: Steve Richfie1d
- Re: Next generation COBOL?
- From: Herwig Huener & Josella Simone Playton
- Re: Next generation COBOL?
- From: Steve Richfie1d
- Re: Next generation COBOL?
- From: Herwig Huener
- Re: Next generation COBOL?
- From: Steve Richfie1d
- Re: Next generation COBOL?
- From: Herwig Huener & Josella Simone Playton
- Re: Next generation COBOL?
- From: Pete Dashwood
- Re: Next generation COBOL?
- From: Herwig Huener & Josella Simone Playton
- Re: Next generation COBOL?
- From: Oliver Wong
- Next generation COBOL?
- Prev by Date: Re: Making money from Java
- Next by Date: Re: Making money from Java
- Previous by thread: Re: Next generation COBOL?
- Next by thread: Re: Next generation COBOL?
- Index(es):