<jsp:directive.page pageEncoding="UTF-8" />
<!-- GFM0008 DB定義 ⇒ ｼｽﾃﾑID,作成区分更新 -->

<!-- KBCLM 6:除外 7:共通 8:有閑 9:削除 は対象外 -->
<og:query command="{@command}" debug="{@debug}" maxRowCount="0">
	select '1' as WRITABLE,UPPER(TABLE_NAME) AS TABLE_NAME,UPPER(CLM) AS CLM,CLM_NAME as NAME_JA,
			UNIQ,
			case when SUBSYS='**' then '**' else '{@SYSTEM_ID_R}' end as SYSTEM_ID,KBSAKU
	from GE82
	where SYSTEM_ID = '{@SYSTEM_ID_D}'
	and   TBLSYU    = '{@TBLSYU}'
	<og:where startKey="and">
		<og:and value="TABLE_NAME like '{@TABLE_NAME}'"	/>
		<og:and value="CLM        like '{@CLM}'"		/>
	</og:where>
	and		KBCLM	< '6'
	and		FGJ		= '1'
	order by CLM,KBSAKU DESC,TABLE_NAME
</og:query>

<og:query command="{@command}" debug="{@debug}" dbid="{@DBID_R}" maxRowCount="0" scope="request">
	select '0' as WRITABLE,'' as TABLE_NAME,CLM,NAME_JA,
			UNIQ,SYSTEM_ID,KBSAKU
	from GEA03
	where SYSTEM_ID in ( '{@SYSTEM_ID_R}','**' )
	<og:where startKey="and">
		<og:and value="CLM like '{@CLM}'" />
	</og:where>
	and   FGJ       = '1'
	and   ( EDITOR in ('BITBOX','CHBOX2','DATALIST','INMENU','MENU','RADIO') OR RENDERER in ('BITBOX','CHBOX2','MENU','RADIO') )
	ORDER BY SYSTEM_ID DESC, KBSAKU DESC, CLM
</og:query>

<!-- グループ処理では、先行優先 -->
<og:tableMerge
	action        = "DIFFERENCE"
	masterScope   = "session"
	masterKeys    = "CLM"
	diffKeys      = "SYSTEM_ID,KBSAKU"
	modifyClms    = "UNIQ"
	slaveScope    = "request"
	display       = "true"
/>

<og:value key="lblKey" value="C" />

<!-- コードリソース(GEA04) をINSERT するので、既存のリソースを、削除(FGJ='9')する。 -->
<og:hidden name="SQL">
	UPDATE GEA03 SET
			SYSTEM_ID	= [SYSTEM_ID],
			KBSAKU		= [KBSAKU],
			DYUPD		= '{@USER.YMDH}',
			USRUPD		= '{@USER.ID}',
			PGUPD		= '{@GUI.KEY}'
	WHERE	UNIQ		= [UNIQ]
	AND		CLM			= [CLM]
</og:hidden>

<og:hidden name="DBID2" value="{@DBID_R}" />
