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



I mean...  yes you can do this, but...  if the only reason is to clear the file, wouldn't it be easier to just run CLRPFM prior to opening it?

On 1/9/2024 2:11 PM, Bryan Dietz wrote:
i scanned some source i accumlated for "_Ropen"

it can be used in RPGLE.  one random source

  **-------------------------------------------------------
  *  _Ropen -- open a record file for processing:
  *
  * _RFILE *_Ropen(const char * filename, const char * mode, ...);
  **-------------------------------------------------------
 D Ropen           PR              *   ExtProc('_Ropen')
 D   filename                      *   value options(*string)
 D   mode                          *   value options(*string)
----------------------------------------
<snip>
B01 c                   select
    c                   when      peRWFlag='R'
    c                              and (wwType='*FILE' or wwType='*MBR')
    c                   eval      wkRF = Ropen(%addr(wwRfile):
    c                                          %addr(wwRRflags))
</snip>

and from the same author in CL, Thanks Scott!
<snip>
DCL VAR(&FILEZ)   TYPE(*CHAR) LEN(33)
DCL VAR(&MODE)    TYPE(*CHAR) LEN(33)
DCL VAR(&HANDLE)  TYPE(*PTR)
/* This API opens the file in read-only mode (rr)  +
   and in RRN sequence (arrseq=Y)'                 */

CHGVAR VAR(&FILEZ)   VALUE(&FILE *TCAT &NULL)
CHGVAR VAR(&MODE)    VALUE('rr, arrseq=Y' *TCAT &NULL)
CALLPRC PRC('_Ropen') PARM((&FILEZ *BYREF)  +
                           (&MODE  *BYREF)) +
                      RTNVAL(&HANDLE)
</snip>


James H. H. Lampert via RPG400-L wrote on 1/9/2024 1:47 PM:
I must be getting old:

In ILE C, if you _Ropen a physical file with mode "rw," the file is cleared on open.

I can't recall whether there's anything equivalent to this in ILE RPG. Is there?

--
JHHL


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.