ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » require help in developing a coding logic

Post new topic  Reply to topic
 require help in developing a coding logic « View previous topic :: View next topic » 
Author Message
newbuddy
PostPosted: Mon May 16, 2011 8:22 pm    Post subject: require help in developing a coding logic Reply with quote

Newbie

Joined: 16 May 2011
Posts: 5

This is the basic coding done :

CREATE COMPUTE MODULE NA_DB2_Sync_Out_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN

SET OutputRoot.MQMD.Format = 'MQSTR ';
SET OutputRoot.MQMD.CodedCharSetId = 37;
SET OutputRoot.MQRFH2 = NULL;

SET OutputRoot.Properties.MessageDomain = 'MRM';
SET OutputRoot.Properties.MessageFormat = 'CWF1';

SET OutputRoot.Properties.MessageType = 'contact admin';

SET OutputRoot.Properties.MessageSet = 'LTVS4TO002001';

DECLARE CH_HRS_PART CHARACTER ' ';
DECLARE contact admin REFERENCE TO RF_EautoDealerLocator.contact admin;
DECLARE contact admin REFERENCE TO contact admin.contact admin;

DECLARE RF_OutDB2Sync REFERENCE TO OutputRoot.MRM;
CREATE FIELD OutputRoot.MRM AS RF_OutDB2Sync;
DECLARE reset CHARACTER '';
SET reset = InitMessageSet(RF_OutDB2Sync);

SET IN_COUNT = 1;
WHILE LASTMOVE(contact admin) DO
SET CH_ENDTIME = '';
IF (IN_COUNT <=5 AND RF_EautoDealerLocator.NAVAMLocatorLanguage = 'ENG') THEN
IF(LENGTH(FUNC_FormatHHMM(contact admin.PartsHoursEndTime)) > 0) THEN
SET CH_ENDTIME = ' to '||FUNC_FormatHHMM(contact admin.PartsHoursEndTime);
ELSE
SET CH_ENDTIME = ' ';
END IF;
SET CH_HRS_PART = COALESCE(CH_HRS_PART||' <br> '||COALESCE(Days_Translation(contact admin.PartsHoursStartDay),'')||' '||COALESCE(FUNC_FormatHHMM(contact admin.PartsHoursStartTime),'')||CH_ENDTIME||' '||COALESCE(TRIM(contact admin.PartsHoursComments),''),'');
SET IN_COUNT = IN_COUNT +1;
END IF;

IF (IN_COUNT <=5 AND RF_EautoDealerLocator.NAVAMLocatorLanguage = 'FRE') THEN

IF(LENGTH(FUNC_FormatHHMM_FR(contact admin.PartsHoursEndTime)) > 0) THEN

SET CH_ENDTIME = ' à ' ||FUNC_FormatHHMM_FR(contact admin.PartsHoursEndTime);
ELSE
SET CH_ENDTIME = ' ';
END IF;
SET CH_HRS_PART = COALESCE(CH_HRS_PART||' <br> '||COALESCE(Days_Translation_FR(contact admin.PartsHoursStartDay),'')||'
'||COALESCE(FUNC_FormatHHMM_FR(contact admin.PartsHoursStartTime),'')||CH_ENDTIME||' '||COALESCE(TRIM(contact admin.PartsHoursComments),''),'');
SET IN_COUNT = IN_COUNT +1;
END IF;

IF (IN_COUNT <=5 AND RF_EautoDealerLocator.NAVAMLocatorLanguage = 'SPA') THEN
IF(LENGTH(FUNC_FormatHHMM(contact admin.PartsHoursEndTime)) > 0) THEN
SET CH_ENDTIME = ' a ' ||FUNC_FormatHHMM(contact admin.PartsHoursEndTime);
ELSE
SET CH_ENDTIME = ' ';
END IF;
SET CH_HRS_PART
= COALESCE(CH_HRS_PART||' <br> '||COALESCE(Days_Translation_SP(contact admin.PartsHoursStartDay),'')||' '||COALESCE(FUNC_FormatHHMM(contact admin.PartsHoursStartTime),'')||CH_ENDTIME||' '||COALESCE(TRIM(contact admin.PartsHoursComments),''),'');
SET IN_COUNT = IN_COUNT +1;
END IF;
MOVE contact admin NEXTSIBLING REPEAT TYPE NAME;
END WHILE;

SET RF_OutDB2Sync.contact admin.contact admin = COALESCE(ReplaceSpecialChars(SUBSTRING(CH_HRS_PART FROM 8 FOR 140)),'');
SET RF_OutDB2Sync.contact admin.contact admin = COALESCE(FUNC_FormatYYYYMMDDHHMMSS(contact admin.contact admin[1].NAVAMPartsHoursCreated),'');
SET RF_OutDB2Sync.contact admin.contact admin = COALESCE(FUNC_FormatYYYYMMDDHHMMSS(contact admin.contact admin[1].NAVAMPartsHoursLastUpdated),'');






CREATE FUNCTION FUNC_FormatHHMM_FR(CH_InputDate CHARACTER) RETURNS CHARACTER
BEGIN
DECLARE CH_TargetTime CHARACTER;
DECLARE CH_DateTemp CHARACTER;
DECLARE IN_TempHr_1 INTEGER;
DECLARE IN_TempHr_2 INTEGER;
DECLARE IN_TargetHr INTEGER;
DECLARE CH_TargetHr CHARACTER;

SET CH_DateTemp = CH_InputDate;

SET IN_TempHr_1 = CAST(SUBSTRING ( CH_DateTemp FROM 12 FOR 2 ) AS INTEGER);
SET IN_TempHr_2 = CAST(SUBSTRING ( CH_DateTemp FROM 15 FOR 2 ) AS INTEGER);

IF(IN_TempHr_1 = 00 AND IN_TempHr_2 = 00) THEN
SET CH_TargetHr = '12h Minuit';
ELSEIF(IN_TempHr_1 = 12 AND IN_TempHr_2 = 00) THEN
SET CH_TargetHr = '12h midi';
ELSEIF(IN_TempHr_1 = 12 AND IN_TempHr_2 <> 00) THEN
SET CH_TargetHr = '0'||'h'||SUBSTRING ( CH_DateTemp FROM 15 FOR 2 );
ELSE
SET CH_TargetHr = CAST(IN_TempHr_1 AS CHARACTER)||'h'||SUBSTRING ( CH_DateTemp FROM 15 FOR 2 );
END IF;

RETURN CH_TargetHr;
END;

In the above coding when the below condition is getting satisfied:-
IF (IN_COUNT <=5 AND RF_EautoDealerLocator.NAVAMLocatorLanguage = 'FRE') THEN

then the coding line in it

SET CH_HRS_PART = COALESCE(CH_HRS_PART||' <br> '||COALESCE(Days_Translation_FR(contact admin.PartsHoursStartDay),'')||'
'||COALESCE(FUNC_FormatHHMM_FR(contact admin.PartsHoursStartTime),'')||CH_ENDTIME||' '||COALESCE(TRIM(contact admin.PartsHoursComments),''),'');

is invoking a function

FUNC_FormatHHMM_FR(contact admin.PartsHoursStartTime) and in this function the below condition is getting satisfied eventhough
no data/value is being passed into the contact admin.PartsHoursStartTime from in put file.

IF(IN_TempHr_1 = 00 AND IN_TempHr_2 = 00) THEN
SET CH_TargetHr = '12h Minuit';


can you please help me with a logic which can take care of it?
Back to top
View user's profile Send private message
fschofer
PostPosted: Mon May 16, 2011 11:32 pm    Post subject: Reply with quote

Knight

Joined: 02 Jul 2001
Posts: 524
Location: Mainz, Germany

Hi,

have you tried running the code with message flow trace enabled on debug level.

This will show whats really happpening inside your functions.

Regards
Frank
Back to top
View user's profile Send private message Send e-mail
smdavies99
PostPosted: Tue May 17, 2011 12:35 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

It also helps the readability of your post if you use the code tags around your ESQL.
Try it. you maybe surprised at the difference.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Tue May 17, 2011 4:22 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

You could also instrument your code with log4j calls. Stepping through code using the debugger is nice at development time, and log4j calls also help in production.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Tue May 17, 2011 4:31 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

lancelotlinc wrote:
You could also instrument your code with log4j calls. Stepping through code using the debugger is nice at development time, and log4j calls also help in production.


But a user trace at debug level will already show the full execution of each and every ESQL statement, and so adding in a comprehensive set of calls to a static java method (the *least* invasive way to instrument this code with log4j) would significantly decrease the readability of this code and merely provide redundant capabilities...

as well as requiring at least basic working knowledge of Java in the first place, which there is no reason to assume.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Tue May 17, 2011 4:35 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

You have a good point mqjeff. There is always a balance that needs to be struck. I find that logging sometimes helps those new to structured programming because it gives them a concrete yes or no answer at a specified point in their code. Readability is also very important.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » require help in developing a coding logic
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.