If they are SQL views then yes you can create a view over it
CREATE VIEW COGNOSVIEW/ACTBALRCD AS (
SELECT BLACT1,C.STORENUMBER AS BLACT2,C.COSTCENTER AS BLACT3,
FROM LIBD4201/IASCP032 A
LEFT JOIN WEBBUDGET/WEBASSIGN B
ON (TRIM(A.BLACT2) || TRIM(A.BLACT3)) =
LEFT JOIN WEBBUDGET/WEBASSIGN C
ON TRIM(B.ROLLUP) = TRIM(C.STORECODE)
WHERE BALTYP = '*ACTUAL'
AND BLACT1 BETWEEN '41000' AND '89999'
AND COMPNO = 1 AND PERIOD BETWEEN 1 AND 12
AND YEAR>=(YEAR(CURRENT DATE)-1)
AND (C.STORENUMBER IS NOT NULL)
AND (C.COSTCENTER IS NOT NULL)
) RCDFMT ACTBALRCDR;
CREATE VIEW COGNOSVIEW/ACTUAL12 AS (
SELECT A.*, CAST( ( A.YEAR * 100 ) + PERIOD AS INT ) AS PER_YEAR
FROM COGNOSVIEW/ACTBALRCD A
WHERE CAST( ( "YEAR" * 100 ) + PERIOD AS INT )
CAST( DIGITS( YEAR( CURRENT_DATE - 1 YEAR ) ) AS INT ) * 100
-- + CAST( DIGITS( MONTH( CURRENT_DATE - 1 YEAR ) + 1 ) AS INT )
+ CAST( DIGITS( MONTH( CURRENT_DATE - 1 YEAR ) ) AS INT )
CAST( DIGITS( YEAR( CURRENT_DATE ) ) AS INT )
* 100 + CAST( DIGITS( MONTH( CURRENT_DATE ) - 1 ) AS INT )
) RCDFMT ACT12R;
From: James Lampert <jamesl@xxxxxxxxxxxxxxxxx>
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>,
Date: 10/02/2012 11:35 AM
Subject: Joining to a join in SQL?
Sent by: midrange-l-bounces@xxxxxxxxxxxx
Consider this scenario:
You have a group of PFs, which in turn have a few LFs on them. You are
mainly doing native/RLA processing on them, but also some SQL, both
views and ad-hoc queries, all of which can potentially involve SQL
joins, and most of which involve programmatically-created SQL.
So far, so good.
But now, let's change the scenario:
Suppose you want to replace the PFs and LFs with join-logicals (or SQL
join-views), tying directly into data in other libraries.
But what about the aforementioned SQL views and queries, that involve
joins? Do they have to be built from the raw PFs? Or can they be built
on top of the existing joins?