|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
SELECT STATEMENT |
« View previous topic :: View next topic » |
Author |
Message
|
LearnMQSI |
Posted: Thu Dec 02, 2004 9:48 am Post subject: SELECT STATEMENT |
|
|
 Centurion
Joined: 20 Aug 2002 Posts: 137
|
Hi Folks,
Can somebody explain me the following SELECT Statement within
IF L1 <> oldL
condition
end if;
I need to know what exactly happening in SELECT Statement. Thanx a bunch in advance
Current Values in variables:
DECLARE ABC CHARACTER;
DECLARE XYZ CHARACTER;
DECLARE CON CHARACTER;
DECLARE DEF CHARACTER;
DECLARE V1 CHARACTER;
DECLARE refin REFERENCE TO "OutputRoot"."MRM"."TMP"."FIN"[1];
DECLARE refout REFERENCE TO "OutputRoot"."MRM"."TMPO"."FIN"[1];
SET ABC = 'DSF';
SET XYZ = 'DS';
SET CON = 'DSF';
SET L1 = 'FSD';
SET oldL1 = ' ';
SET DEF = 'N';
IF ABC = 'Temp' THEN
SET V1 = TRIM(' ' FROM DEF);
ELSE
IF XYZ = 'V' THEN
SET V1 = "Outpput"."MRM"."P"."V".{CAST(TRIM(' ' FROM ABC) AS
CHAR)};
ELSE
IF L1 <> oldL1 THEN
SET V1 = THE (SELECT ITEM T.{CAST(TRIM(' ' FROM ABC)
AS CHAR)} FROM "OutputRoot"."MRM"."P"."V".{CAST( TRIM(' '
FROM XYZ) AS CHAR)}[] AS T WHERE T.{CAST(TRIM(' ' FROM
CON) AS CHAR)} = L1);
ELSE
SET V1 = NULL;
END IF;
END IF; |
|
Back to top |
|
 |
JT |
Posted: Thu Dec 02, 2004 1:20 pm Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Reviewing the code as you provided it, and after all the substitutions have been made, the SELECT statement translates to:
Code: |
SET V1 = SELECT ITEM T.DSF FROM OutputRoot.MRM.P.V.DS[] AS T WHERE T.DSF = 'FSD' |
....so V1 is set to 'FSD'.
The first condition: IF ABC = 'Temp' returns FALSE, as ABC was originally set to 'DSF', and never modified
The next condition would then be: IF XYZ = 'V' returns FALSE, as XYZ was originally set to 'DS', and never modified
The next condition would then be: IF L1 <> oldL1 returns TRUE, as L1 was originally set to 'FSD', and oldL1 was originally set to a space, and never modified
Not sure if I have this correct or not (because it doesn't make sense in the example you provided), but it appears the SELECT statement is searching all occurrences of P.V.DS.DSF and returning the value that is assigned to a particular DSF element, when that DSF element has a value of 'FSD'.
Note: If you keep this code, I don't see a reason to do the casting/trimming in the SELECT statement since all of the variables were declared as CHARACTER. |
|
Back to top |
|
 |
LearnMQSI |
Posted: Sat Dec 04, 2004 1:25 pm Post subject: SELECT STATEMENT |
|
|
 Centurion
Joined: 20 Aug 2002 Posts: 137
|
Hi JT,
Thank you so much for your quick response. I really appreciate your help.
It helping me understanding the SELECT STATEMENT code.
Take Care
LEARNMQSI |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|