<jsp:directive.page pageEncoding="UTF-8" />
<!-- ﾗﾍﾞﾙ区分更新 -->
<!-- 画面ﾘｿｰｽの画面ﾚﾍﾞﾙ(GUILVL) が、3:通常 の場合は、ﾗﾍﾞﾙ区分(KBLBL)を、3:画面 にし、それ以外は、4:画面分類 にします。 -->
<og:query command="{@command}" debug="{@debug}" maxRowCount="{@maxRowCount}">
	select A.SYSTEM_ID,A.GUIKEY as CLM ,B.LANG ,
			case A.GUILVL when '3' then '3' else '4' end as KBLBL
	from   GEA11 A inner join GEA08 B
			on  A.SYSTEM_ID = B.SYSTEM_ID
			and A.GUIKEY    = B.CLM
			and case A.GUILVL when '3' then '3' else '4' end != B.KBLBL
	where  A.SYSTEM_ID = '{@SYSTEM_ID}'
	<og:where startKey="and">
		<og:and value = "A.GUIKEY like '{@CLM}'" />
	</og:where>
	and    A.FGJ	= '1'
	and    B.FGJ	= '1'
	union
	select A.SYSTEM_ID,A.CLM ,A.LANG ,
			case when A.CLM like 'ERR0%' or A.CLM like A.SYSTEM_ID || 'E0' then '8'
				 when A.CLM like 'MSG0%' or A.CLM like A.SYSTEM_ID || 'M0' then '7' end as KBLBL
	from   GEA08 A
	where  A.SYSTEM_ID = '{@SYSTEM_ID}'
	and		case when A.CLM like 'ERR0%' or A.CLM like A.SYSTEM_ID || 'E0' then '8'
				 when A.CLM like 'MSG0%' or A.CLM like A.SYSTEM_ID || 'M0' then '7' end != A.KBLBL
	and    A.FGJ	= '1'
	union
	select A.SYSTEM_ID,A.CLM || '.' || A.CODE as CLM ,B.LANG ,'6' as KBLBL
	from   GEA04 A inner join GEA08 B
			on  A.SYSTEM_ID            = B.SYSTEM_ID
			and A.CLM || '.' || A.CODE = B.CLM
			and '6' != B.KBLBL
			and not ( B.CLM like 'ERR0%' or B.CLM like A.SYSTEM_ID || 'E0' or
					  B.CLM like 'MSG0%' or B.CLM like A.SYSTEM_ID || 'M0' )
	where  A.SYSTEM_ID = '{@SYSTEM_ID}'
	<og:where startKey="and">
		<og:and value = "A.CLM like '{@CLM}'" />
	</og:where>
	and    A.FGJ	= '1'
	and    B.FGJ	= '1'
	order by 1,2
</og:query>

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

<og:hidden name="SQL">
	UPDATE GEA08 SET
			KBLBL   = [KBLBL],
			DYUPD   = '{@USER.YMDH}',
			USRUPD  = '{@USER.ID}',
			PGUPD   = '{@GUI.KEY}'
	WHERE SYSTEM_ID = [SYSTEM_ID]
	AND   CLM       = [CLM]
	AND   LANG      = [LANG]
</og:hidden>
