IMPRT O is used for retro periods - to import the old results.
In this case, if the PCR is called
a)with PORT to process data from ORT, it is not required to have AMT=O XXXX.
It is enough to code AMT= XXXX.
b)with PIT to process IT, then to get the ORT data the pcr needs AMT=O XXXX
To get the IT data for a w/t different from the header w/t that you bare processing, it is enough to use AMT= YYYY for the YYYY w/t from IT.
Similarly to process the LRT data, first IMPRT L, then process with PORT or PIT as above. However in the PCR called with PIT, you need AMT=L XXXX.
Note in any case, all splits need to match when you are getting data from another results table as compared to the current one being processed (or for another w/t in the same table as the current one). You will not get the data from a w/t entry with a different split combination.
To get the data from a different split, you need to save the w/t data in a VAR entry in one PCR. Then in the next PCR use the VAR entry for your processing.
For your purpose of getting the latest previous period occurrence of a w/t, use schema lines below: The loop below will ensure that the var 9ZZ1 is set to the latest RT data with the w/t 9ZZ1. The use of VAR also ensures splits will not cause a problem.
IF RETRO "RETRO ?
... " - YES, PROC FOR RETRO PERIOD
ELSE " - NO;
LPBEG
IMPRT L
PORT xxxx bbbb NOAB " - GET THE LATEST DATA FOR 9ZZ1 W/T
LPEND
ENDIF
PCR xxxx SAVE w/t 9ZZ1 in VAR table
*/9ZZ1
ZERO=&9ZZ1
ADDWT& 9ZZ1
After this PCR you can use var 9ZZ1 data for your processing.