Question

  Asked: Oct 24 2007   3:57 PM GMT
  Asked by: Wmfsr


Activation Groups and Open Query File use


OPNQRYF, Activation Groups, SHARED DATA PATHS, CLLE

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)
CLOF OPNID(PPJOBD)

Pertinent Code - RPGLE Program
===========================

***
* Prototype Definitions - Get PO related values
***
/COPY *Libl/QINCLUDE,P_MR826D

0342.00 *
0343.00 * get PO quantity
0344.00 *
0345.00 c eval SvCalcQ = CalPOQty(JD0REL:JD0ITMN)
0346.00 *

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



When you use the OVRDBF and OPNQRYF commands you can specify a file name that is different than the actual physical file name, you would use that file name in your program along with the actual physical/logical file name that you need to access.
The module would access the actual file name while the main program would access the override file name.
The idea is to create 2 access paths for the program to use independantly.
Kevin
  • AddThis Social Bookmark Button

Browse more Questions and Answers on AS/400.

Looking for relevant AS/400 Whitepapers? Visit the Search400.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register