Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RPG SETLL or CHAIN Equivalent in Visual Basic 1

Status
Not open for further replies.

Skittle

ISP
Sep 10, 2002
1,528
US
This is a question I almost posted to the visual basic forum but then figured nobody would know what I am talking about.

I am stumbling my way through learning selected elements of Visual Basic to support my core I. T. knowledge of RPG and the AS400. In RPG you can access databases effiently by pointing to a start point on an indexed file using SETLL or CHAIN. In Visual Basic there does not seem to be an equivalent command. You have to perform an SQL statement via a connection. This must therefore consider every record in the database to return the record(s) you are interested in.

My questions are:-

1) Is there a CHAIN or SETLL equivalent for accessing an
SQL server or Access database? If there is, what is it?

2) If there is no command to do this in VB, wopuld you not
agree that VB is not as efficient for accessing indexed
files as RPG?

Many thanks.

 
You should be able to use the IBM Client Access Express Toolkit. Here is the link to the homepage:

IBM has some example VB programs here:

This one in particular may show what you want:

Here is an article you may want to read:

T. Bishop
 
This is all very useful informtion but it is a bit overwhelming. I'm really after a theoretical, top level clean cut answer.

If I were working in an environment that has no AS400 ( eg. SQL Server and VB ), would I be able to perform the equivalent of a SETLL or CHAIN with a command in VB against an SQL or Access database?.

 
Unfortunately, Skittle, I haven't seen this ability in VB.

As you noted, in VB we retrieve a set of records via a connection and work with that subset of the file's data - instead of pointing to a start-point in the file and working from that point forward dynamically. (Oh, I miss those simpler days!)

The closest we can get to RPG's file handling capabilities is to use a "dynaset" to contain the data we intend to update as we process. However, this functionality isn't currently available in .NET !!

As for agreeing "that VB is not as efficient..." - was there ever a question?!!


Good luck...
 
Thats what I thought.

I am the only programmer at my site and so there was nobody else to sound out the issue with. Its something that you never see spelled out anywhere, its between the lines knowledge if you know what I mean.

The more I investigate Visual Basic and SQL Server, the more I am surprised the good old IBM green screen clunkers have become so unpopular in the job market. I can only assume Visual Basic and SQL server are the weapons of choice for small organisations while AS400's quietly still rule in organisations with large databases.
 
You can use the .Find method on an ADODB recordset to find the first record for a specified criteria, then repeat .Find in a "Do While Not rst.EOF" loop but it is nowhere near as efficient as a SETLL/READE loop.

I love VB for the ease of coding - drag & drop of controls, IntelliSense and Object Explorer to find the properties and functions and, most of all, the ability to change code "on the fly" while you are running some code in debug mode!

--but--

like the other guys have said, the file handling in VB is crap compared with AS400/RPG. VB is faster writing the code but will never be as fast as AS400 at accessing the data so it is up to the individual IT shop to decide which is most important.

PeteJ
(Contract Code-monkey)

It's amazing how many ways there are to skin a cat
(apologies to the veggies)
 
Use SQL to retrieve only the records you need.

RPG:
Code:
SETLL 'California' SaleFile

SQL:
Code:
SELECT * From SaleFile WHERE State = 'California'

Hope this helps!

gtg.jpg

GTG
 
I have a situation where a windows web server, via ODBC/SQL, accesses an inventory database on the AS/400 via a SELECT statement issued by the server. It reads each record in the file, no such thing as a SETLL, CHAIN. I couldn't believe it. I've been told that, if I built a logical over the physical, OS/400 would find and use it. It dosen't. I don't know what people do with a large database.
 
Even with SETLL or CHAIN, the database file is still being read
record by record using the index relative records. AS400 has a very good database management system. It knows which better logical or views to use in accessing the file. I used to have a client who have Peoplesoft application installed in their AS400 and the files are accessed using SQR(sql), Cobol, C+ and RPGIV
and I find no difference between SETLL, CHAIN and SQL. The only difference is this application do treat the files as database and everything are normalized and journalled. We use SQR via client access to access the files from our PCs.

There are a lot of information in IBM about using views and how the DBMS select which fastest route to the database files.
 
Sounds like a discussion, between sql and microsoft,,, vs DB400 and IBM. Any "old timers", remeber when ISAM, was first used??
 
It is easier for me to see how the DBMS behave in AS400 using DB2400 or UDB databases because AS400 has a database tools where you can trace which views are being used. The tool is just like any database optimizer. We also have SQLservers but we only use then for small applications. For heavy volume and traffic we have both DB2/UDB interfaced with ORACLE databases.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top