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


  • Subject: Re: Fastest way to delete record
  • From: Jim Langston <jimlangston@xxxxxxxxxxxxxxxx>
  • Date: Thu, 08 Feb 2001 10:55:24 -0800
  • Organization: Pacer International

One way I could think of doing this would be with 2 CPYF, 1 DLTF
and 1 RENOBJ, not using any RPG at all.

CPYF FromFile(OrigFile) ToFile(BKUPFILE) MBROPT(*ADD) 
      INCREL((*IF DATEFLD *LE '2001-01-01'))

CPYF FromFile(OrigFile) ToFile(TEMPFILE) MBROPT(*REPLACE)
      INCREL((*IF DATEFLD *GT '2001-01-01'))

DLTF FILE(OrigFile)

RNMOBJ OBJ(TEMPFILE) OBJTYPE(*FILE) NEWOBJ(ORIGFILE) 

You should get the drift of this.  I would guess, though, tht this method
would take at least 3 times longer than the RPG open on the logical by timestamp
and write and delete.

The above code is untested and not showing the library list, so please don't
get mad at me if you try this on your file and find this code does something
scimilar to a CLRPFM or something :)  And I'm not sure of the format for the
date field, but that *should* work.

Regards,

Jim Langston

D.BALE@handleman.com wrote:
> 
> A perfect KISS example!!!
> 
> Dan Bale
> IT - AS/400
> Handleman Company
> 248-362-4400  Ext. 4952
> 
> -------------------------- Original Message --------------------------
> 
> H
> FORIGFILE  UP   E           K DISK
> FBKUPFILE  O    E           K DISK
> C                   IF        TIMESTAMP <=  YYYYMMDD
> C                   WRITE     BKUPFILE
> C                   DELETE    ORIGFILE
> C                   ENDIF
> 
> It's not pretty, and it's not the fastest.   But if you compile it and run it
>  in batch, it will be done before everyone is finished
> discussing it.  <G>
+---
| 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 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.