|
Yes, I agree with you, but in this particular case this is a rather small
transmission
file (less than 1000 records) that will soon be cleared, and the operation as it
is
takes an unnoticeable amount of time.
This brings up a good point, though, as a lot of times I will have to mass
change
records, and since we don't have SQL I have to write a program to do it. And
a lot of times I will open the file UP and then just do something like:
if CMCONT = 'ABCD123456' or
CMCONT = 'BCDE234567' or
CMCONT = 'CDEF345677'
EVAL SomeDate = 990101
UPDATE CMFILE1
ENDIF
and I can see where there are problems with this. First, it is taking me a long
longer
than needed to cycled through all my records just to find some specific ones.
Second,
on the read of all those records, since I am opening it as UP, as someone
stated,
I am
putting a record lock on each record in the file, however briefly.
I really don't see that I should create a large program for these types of one
time updates
though. And, also, sometimes I may not have all the key information to build a
key to
SETLL and start from there. Building a logical that the AS/400 would have to
maintain
and I would probably not use for quite a while doesn't make much sense either.
Regards,
Jim Langston
Scott Mildenberger wrote:
> The code itself looks fine but a comment on how the program operates. The
> program reads through the whole file to update only a subset of records.
> Depending on the number of records in the file this could be very
> inefficient. It would be better to create a logical file keyed by BSXTRL
> and then use Trailer to SETLL and then use READE to only read the records
> from the file that you need to update. We always try and avoid reading
> through the entire file unless we are doing something to all (or most) of
> the records. If a program reads all the records in a file then it's
> performance will get worse as the file contains more records.
>
> Scott Mildenberger
>
> > -----Original Message-----
> > From: Jim Langston [SMTP:jlangston@conexfreight.com]
> > Sent: Friday, September 24, 1999 9:39 AM
> > To: RPG400-L@midrange.com
> > Subject: RPG IV program - comments requested
> >
> > This is a small update utility I just created for one of my users. All
> > it does is
> > goes through a file and changes one field (BSSCAC) when another filed is
> >
> > equal to an input value (BSXTRL).
> >
> > There are two input parameters, Trailer and SCACCode. Trailer is the
> > search
> > criteria.
> >
> > I would request critiquing of this program. That is, I am using D specs
> > to declare
> > my variables, I am using a PLIST to declare my entry parameters and I am
> > using
> > the RPG Cycle to cycle through all my records.
> >
> > Since I am just starting to program in RPGLE I do not want to get any
> > bad habits
> > started now. I would rather start of on the right foot.
> >
> > So I guess I am asking, if you were to write this same program, is this
> > the way you
> > would code it?
> >
> > Regards,
> >
> > Jim Langston
> >
> > FBSSHIPX UP E DISK
> >
> > DTrailer S 10A
> > DSCACCode S 4A
> >
> > C IF Trailer = BSXTRL
> > C EVAL BSSCAC = SCACCode
> > C UPDATE BSSHIPX1
> > C ENDIF
> >
> > *******************************
> > *** Set up Entry Parameters ***
> > *******************************
> > C *INZSR BEGSR
> > C
> > C *ENTRY PLIST
> > C PARM Trailer
> > C PARM SCACCode
> > C
> > C ENDSR
> >
> >
> > +---
> > | This is the RPG/400 Mailing List!
> > | To submit a new message, send your mail to RPG400-L@midrange.com.
> > | To subscribe to this list send email to RPG400-L-SUB@midrange.com.
> > | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
> > | Questions should be directed to the list owner/operator:
> > david@midrange.com
> > +---
> +---
> | This is the RPG/400 Mailing List!
> | To submit a new message, send your mail to RPG400-L@midrange.com.
> | To subscribe to this list send email to RPG400-L-SUB@midrange.com.
> | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator: david@midrange.com
> +---
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.