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



The fastest way to get context count is specify MATCTX receiver length 8,
then subtract 96 from bytes needed, then divide by 32.  The number you
observe from associated space offsets is the library count, not the context
count.  The following code shows the difference.  On my machine this shows
QSYS context count 14277 and QSYS library count 14053.  This code runs
under 1/1000 second.  Fast enough?

DCL SYSPTR ?LIBRARY     AUTO INIT("QSYS", TYPE(CTX));
DCL SPCPTR ?OIR         BAS(?LIBRARY) POS(H"21");
DCL DD     RECEIVER     AUTO CHAR(128) BDRY(16);
DCL DD     AVAILABLE    DEF(RECEIVER) POS(1) BIN(4);
DCL DD     NEEDED       DEF(RECEIVER) POS(5) BIN(4);
DCL DD     INSERTS      DEF(RECEIVER) POS(102) BIN(4);
DCL DD     REMOVES      DEF(RECEIVER) POS(106) BIN(4);
DCL SPCPTR ?RECEIVER    AUTO INIT(RECEIVER);
DCL DD     CTX_TOTAL    AUTO BIN(4);
DCL DD     LIB_TOTAL    AUTO BIN(4);

/* calculate number of objects in context */

CPYNV      AVAILABLE, 8;
MATCTX     ?RECEIVER, ?LIBRARY, X"0500000000";
SUBN       CTX_TOTAL, NEEDED, 96;
DIV(S)     CTX_TOTAL, 32;

/* calculate number of objects in library */

SETSPPFP   ?LIBRARY, ?LIBRARY;
CPYNV      AVAILABLE, 128;
MATINXAT   ?RECEIVER, ?OIR;
SUBN       LIB_TOTAL, INSERTS, REMOVES;

/* compare CTX_TOTAL with LIB_TOTAL in debugger */

BRK        "LOOK";
PEND;


+---
| This is the MI Programmers Mailing List!
| To submit a new message, send your mail to MI400@midrange.com.
| To subscribe to this list send email to MI400-SUB@midrange.com.
| To unsubscribe from this list send email to MI400-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: dr2@cssas400.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.