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



Njal Fisketjon wrote:

Jim Langston wrote:

> An example...
>
> Say I have a screen display that utilizes fields from a file, in this
> case I would use the external DS.  The user enters information into
> this screen, which changes the data structure.  When the user presses
> enter say I want to validate this data and make sure they are not
> duplicating data in another record.  Currently I would have to save
> a copy of the buffer then read through my records and do validation,
> and then restore the buffer and write it.
>

I hope you're not implying that you use the same field names in the
device files as in the database files?  If not I can't see why you
should need to save the display fields in a DS.

--- I have used the same field names in the device files as in the
database files.  Sometimes it makes more sense and cleaner code.

> With this new method, I would not have to save the buffer, but would
> just read the file into another data buffer and do my checking on
> that, then when I was finished I could simply write my data buffer
> that is shown on the screen.
>
> Many times I have found myself having to save record data buffers
> into a temp buffer so I could check other records in a file.  It
> has always been a pain to code and prone to bugs if I forget a
> variable or two.  This way would be much easier, IMO.
>

I use setll and/or service program procedure to check against records in
database files. "Normally" no need to do "inline reading" and overwrite buffers.

--- SETLL allows you to check for Keys, it does not allow you to check the
contents of a record without chaining to the file and retrieving the record.
There are some cases in a system I didn't write where the index number field
to write was retrieved from the first record in the key series.  Which means
you had to retrieve another record and get a field variable and use it to
create the key you were writing the record as.

No big deal really, if you find it useful, please use it. I just can't
think of one program I've ever needed this after converting to ILE.

Maybe it's too late in the evening :)







_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
or email: RPG400-L-request@midrange.com




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.