<jsp:directive.page pageEncoding="UTF-8" />
<!-- GFM0031 ﾗﾍﾞﾙﾘｿｰｽ ⇒ DB定義(ﾃｰﾌﾞﾙ名)更新 -->

<!-- KBLBL 2:ﾃｰﾌﾞﾙ のみ対象とします -->
<og:query command="{@command}" debug="{@debug}" dbid="{@DBID_R}" maxRowCount="0">
	select '1' as WRITABLE, CLM, NAME_JA, UNIQ,SYSTEM_ID
	from GEA08
	where SYSTEM_ID in ( '{@SYSTEM_ID_R}','**' )
	<og:where startKey="and">
		<og:and value="CLM like '{@CLM}'" />
	</og:where>
	and   LANG		= 'ja'
	and   FGJ		= '1'
	and   KBLBL		= '2'
	order by SYSTEM_ID DESC, KBSAKU DESC, CLM
</og:query>

<!-- KBCLM 6:除外 7:共通 8:有閑 9:削除 は対象外 -->
<og:query command="{@command}" debug="{@debug}" maxRowCount="0" scope="request">
	select '0' as WRITABLE, UPPER(TABLE_NAME) AS CLM,NAME_JA,UNIQ,SYSTEM_ID
	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="KBSAKU		=    '{@KBSAKU}'"	/>
		<og:and value="SUBSYS		like '{@SUBSYS}'"	/>
	</og:where>
	and		KBCLM	< '6'
	and		FGJ		= '1'
	order by TABLE_NAME,SEQNO
</og:query>

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

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

<!-- UNIQ のみでユニークになるが、安全のため、SYSTEM_IDとTBLSYU,TABLE_NAME(CLM) だけは条件に加えておく -->
<og:hidden name="SQL" >
	UPDATE GE82 SET
		NAME_JA		= [NAME_JA],
		DYUPD		= '{@USER.YMDH}',
		USRUPD		= '{@USER.ID}',
		PGUPD		= '{@GUI.KEY}'
	WHERE	UNIQ		= [UNIQ]
	AND		SYSTEM_ID	= '{@SYSTEM_ID_D}'
	AND		TBLSYU		= '{@TBLSYU}'
	AND		TABLE_NAME	= [CLM]
</og:hidden>
