Hi, Jack:

> On 6/15/2018 3:53 PM, Jack Woehr wrote:
Is there an IBM i equivalent of Unix 'sync', i.e., "write all cached changes to disk"?
Are you looking for something "system-wide"? e.g. such as just before you do a "flash copy" with PowerHA? Or, are you looking for something more job or application specific?

Also, are you dealing with the IFS, or mainly the library file system (QSYS.LIB, aka. the DB2 file system)?

This can be tricky with "high availability" products in the mix. For example, consider the following cases:

*

say you are running some C code in PASE and it uses mmap() or
mmap64() to map an entire streamfile into teraspace memory, and then
directly modifies the contents there.  This will not trigger any HA
product to replicate that streamfile, because it does not generate
any journal entries, even if that streamfile is journaled.

*

say you have an ILE (or OPM) application that uses *USRSPC and
*USRIDX and *USRQ objects (user spaces, user indexes and user
queues).  If your application uses an MI pointer into a user space
and directly stores (changes) data there, this will not trigger any
HA product to recognize that this *USRSPC has been changed, unless
you take "special action" ... (see below).  Similarly, if you use MI
instructions like INSINXEN, RMVINXEN, etc. to alter the contents of
a *USRIDX, no journal entries are generated and so no HA product
will detect that this object was ever "changed." Same for using the
ENQ and DEQ MI instructions to send messages to or remove messages
from a *USRQ.

* say you have a normal RPG application happily doing WRITEs and
UPDATEs to one or more database tables, those changes are not
immediately "flushed" to "backing store" (DASD for
single-level-storage), until some specific action triggers this,
either a FEOD (force end-of-data) or a CLOSE (unless your *FILE is
set up with FRCRATIO(1), which is not good for performance).  If you
have a long-running "transaction" or never-ending-program that keeps
files open "all day" this could be a problem, since, with modern IBM
i systems having vastly larger main storage memory sizes, into the
hundreds of GB and even TB range, it means that there is nothing to
"force" those pages to get "paged out" due to "pressure" from
demand-paging other objects into main storage, as there is no need
to "make room " by paging out other stuff.

For the IFS,  IBM i (OS/400)  does provide the "fsync()" API ... so that may help for IFS streamfiles ...

For single-level-storage, you may need to look into using some of the MI instructions as "built-in functions" from within an ILE language (CL, C, C++, COBOL or RPGLE) to issue RSLVSP to obtain a system pointer to the object, and then issue the ENSOBJ MI instruction to "ensure object" -- this ensures that all changed pages are written to "backing store" (DASD) for that object. /Lather, rinse, repeat for/ each object you are concerned about.

Does that help?

Mark S. Waterbury


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.