I am executing a CLLE program that uses an OPNQRYF to select records from file "FILE1" which is a physical file containing in excess of 1 million records. I only need records with a specific date (about 5000 records) The file is opened for share = *yes and the program calls an RPGLE program that reads the records one record at a time.
Part of the RPG propgram executes a call to a module to retrieve a value from a file which happens to be "File1". To retrieve the data from the *module it uses a field from the Open Query file FldA to select and add the value from a group of records in "File1". It then returns that value to the first program.
Problem: Because the CLLE creates a share = *Yes on file "FILE1" and the CLLE Program defines the override as follows: "OVRDBF FILE(FILE1) OVRSCOPE(*JOB) SHARE(*YES), when I return to the first program and attempt to read the from the Open Query file , the pointer for the next record seems to be corrupted because both programs seem to be sharing the same open data path for "File1".
The answer seems to be to place the CLLE and First RPGLE program in one activation group and place the call to the *module in a seperate activation group where the open data path will not be shared.
I am not sure how to do this or if there is another option because the create module does not permit defining a seperate activation group to an object that is being bound to a program.
So how do I handle the OPNQRYF file if it is the exact same file as the one in the *module
Pertinent Code - CLLE Prog:
OVRDBF FILE(PPJOBD) OVRSCOPE(*JOB) SHARE(*YES)
OPNQRYF FILE((PPJOBD)) OPTION(*INP *UPD) +
QRYSLT('(YEAR4 *GE "' *CAT &SELYEAR *CAT +
'") & (MODAY4 *EQ "' *CAT &SELMODAY *CAT +
'")') KEYFLD((JDLC) (JDCCAT) (JDDTRQ) +
(JDREL)) MAPFLD((DATE8 'JDDTRQ' *ZONED 8) +
(DATE8A 'DATE8' *CHAR 8) (YEAR4 +
'%SST(DATE8A 1 4)') (MODAY4 '%SST(DATE8A +
5 4)')) OPNID(*FILE) OPNSCOPE(*JOB)
CALL PGM(MMR826D) PARM(&CUSTNO)
DLTOVR FILE(PPJOBD) LVL(*JOB)
Pertinent Code - RPGLE Program
* Prototype Definitions - Get PO related values
0343.00 * get PO quantity
0345.00 c eval SvCalcQ = CalPOQty(JD0REL:JD0ITMN)