Question
running a 3GL application on AS400 (RPG or COBOL) using the AIS ACX APIs
it fails randomly with an error Too many open files!

Answer
check if your iSerise defaults the activation group defaults to *ENTMOD when creating the program.
If yes then change the activation group to *NEW and check your program again.
Some information about activation group
*ENTMOD
When ACTGRP(*ENTMOD) is specified, the program entry procedure module (ENTMOD parameter) is examined. If the module attribute is RPGLE, CBLLE, or CLLE, then
ACTGRP(QILE) or ACTGRP(QILETS) is used. QILE is used when STGMDL(*SNGLVL) is specified, and QILETS is used when STGMDL(*TERASPACE) is specified. If the module
attribute is not RPGLE, CBLLE, or CLLE, then ACTGRP(*NEW) is used.
CRTPGM PGM(SXRL100)
MODULE(SXRL100 ACX3GL)
ACTGRP(*ENTMOD)
*NEW
When this program gets called, a new activation group is created. This called program is then associated with the newly created activation group.
CRTPGM PGM(SXRL100)
MODULE(SXRL100 ACX3GL)
ACTGRP(*NEW)