× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Isn't that what LF's, view's and UDF's are for?

Rob Berendt
-- 
Group Dekko Services, LLC
Dept 01.073
PO Box 2000
Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com





"Paul Morgan" <pmorgan@xxxxxxxxxxxxxx> 
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
02/02/2005 01:05 PM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>


To
rpg400-l@xxxxxxxxxxxx
cc

Subject
Re: Externalizing I/O was RPG read loops






Rob,

This is the way it's done with Java Beans.  Interesting article about this
at 
http://www.javaworld.com/javaworld/jw-05-2001/jw-0518-encapsulation.html.

I'm trying to apply these principles to ILE & RPGIV.  You never access the
data directly but do so through getters and setters.  Getters can do more
than just return a field value.  The returned value might not even be a 
data
field but could be derived from some other fields.  GetName( SSN ) could
return a formatted string derived from other fields.  It might actually be
stored in the record as first name, last name and middle initial.  As an 
end
developer I don't want to know the details about how the name is stored. I
just want to use the name.

If the fields aren't in the program you can't mess with them.  Having the
entire record's fields in the application program opens you up to all 
sorts
of errors.  You could change other fields in the record by mistake.  Using
getters and setters avoids those types of errors.

BTW, The code would be more like

Key = GetNextRecord();
MyWorkField1 = GetField1( Key );
MyWorkField2 = GetField2( Key );

than some generic GetField procedure.

That 'actually do some real work' might be another getter procedure 
provided
by the module instead of code in your application program.  Rather than:

SSN = GetNextEmployee();
MyFirstName = GetFirstName( SSN );
MyLastName = GetLastName( SSN );
Name = MyFirstName + " " + MyLastName;

You'd have

SSN = GetNextEmployee();
Name = GetName( SSN );

I'd rather code that that than

Read Employee;
Name = EMFNAM + " " + EMLNAM;

Paul

-- 
Paul Morgan
Senior Programmer Analyst - Retail
J. Jill Group
100 Birch Pond Drive, PO Box 2009
Tilton, NH 03276-2009
Phone: (603) 266-2117
Fax:   (603) 266-2333

> Paul,
>
> I think you're the first person that I heard of, that wasn't the person 
in
> charge of writing the access programs, that actually liked this 
scenario.
> Why an end developer would like to replace
>
> chain(e) myfile;
> // now actually do some real work with the fields
>
> with
> getFilename();
> MyWorkField1=GetField(field1);
> MyWorkField2=GetField(field2);
> ...
> // now actually do some real work with the fields
>
> rather escapes me.
>
> Rob Berendt
> -- 
> Group Dekko Services, LLC
> Dept 01.073
> PO Box 2000
> Dock 108
> 6928N 400E
> Kendallville, IN 46755
> http://www.dekko.com



-- 
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.