Author |
Message
|
yaakovd |
Posted: Mon Nov 30, 2009 9:17 am Post subject: Length not set while import C |
|
|
Partisan
Joined: 20 Jan 2003 Posts: 319 Location: Israel
|
Hi
While create a new message definition (CWF) file from a C header file, length of fields is not set.
Any explanation, solution, workaround?
I'm using Toolkit 6.1 with fix 4 _________________ Best regards.
Yaakov
SWG, IBM Commerce, Israel |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Nov 30, 2009 9:56 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Could you post a sample of the C header file? _________________ 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 |
|
 |
yaakovd |
Posted: Tue Dec 01, 2009 6:12 am Post subject: |
|
|
Partisan
Joined: 20 Jan 2003 Posts: 319 Location: Israel
|
It actually set part of lengths and even parse somehow, but result is completelly wrong....
Code: |
struct trans_tail_ //OFS Description
{
unsigned char nu; //44 Keep for high byte part offset
unsigned char TwoPO_checker_sign :1; //45 For 2 person operation
unsigned char opt_master_trans :1; //45 Master transaction of events (FSD14741)
unsigned char opt_fuel_test :1; //45 Pump Test ticket (FSD58636)
unsigned char nu_flags :5; //45 Not used
unsigned char ext_pos_no; //46 External POS number
unsigned char ext_device :4;//47 External device number
unsigned char quick_till :1;//47 QUICK POS (Tesco)
unsigned char dock_till :1;//47 QUICK docking (Tesco)
unsigned char opt_scanpoint_item_till:1;//47 SCANPOINT
unsigned char nu2 :1;//47
unsigned short ticket_no; //48 Ticket number
char date[6]; //50 Date (YYMMDD in BCD) Yaakov BCD change
char time[6]; //53 Time (HHMMSS in BCD) Yaakov BCD change
unsigned char opt_return_ticket :1; //56 Return ticket
unsigned char opt_training_mode :1; //56 Training mode ticket
unsigned char opt_pc_generated :1; //56 Record generated by MFS/LFS
unsigned char opt_pos_offline :1; //56 POS was offline
unsigned char opt_void_ticket :1; //56 Ticket was voided
unsigned char opt_bad_record :1; //56 Ignore record
unsigned char opt_store_count :1; //56 Store stock count TRS (Tesco)
unsigned char opt_wastage_mode :1; //56 Tesco
unsigned short cashier; //57 Cashier number
unsigned char pos_no; //59 POS number
unsigned short seq_no; //60 Record sequence number
unsigned char pc_no :4; //62 PC number (1 or 2) receiving TRS from POS
unsigned char trans_version :4; //62 TV number
unsigned char qdx; //63 QuickDex flags
}; //64
|
_________________ Best regards.
Yaakov
SWG, IBM Commerce, Israel |
|
Back to top |
|
 |
rekarm01 |
Posted: Wed Dec 02, 2009 5:10 pm Post subject: Re: Length not set while import C |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
The C struct contains bit fields. It's likely that MRM does not support a corresponding BIT data type.
The import wizard generates a *.report.txt file; check that for warnings or errors during import. |
|
Back to top |
|
 |
yaakovd |
Posted: Fri Dec 04, 2009 6:24 am Post subject: |
|
|
Partisan
Joined: 20 Jan 2003 Posts: 319 Location: Israel
|
no errors, no warnings
Code: |
Elapsed time processing this message definition file: 0.5 seconds
Number of warnings for this message definition file: 0
Number of files processed: 1
|
but still result is not correct  _________________ Best regards.
Yaakov
SWG, IBM Commerce, Israel |
|
Back to top |
|
 |
kimbert |
Posted: Fri Dec 04, 2009 8:16 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Looks like a defect -I suggest that you raise a PMR.
Please reference this thread in the PMR - it will provide useful background for the responder. |
|
Back to top |
|
 |
yaakovd |
Posted: Tue Dec 15, 2009 1:36 am Post subject: |
|
|
Partisan
Joined: 20 Jan 2003 Posts: 319 Location: Israel
|
PMR 63449,003,756
and answer given (unfortunatelly not really helps ):
meaning of all these open defects that MB cannot be used for project, where we need define about 1000 structures with 35-30 fields each since we will need fix C file of 17000 rows or create everything manually.  _________________ Best regards.
Yaakov
SWG, IBM Commerce, Israel |
|
Back to top |
|
 |
shanson |
Posted: Tue Dec 15, 2009 6:00 am Post subject: |
|
|
 Partisan
Joined: 17 Oct 2003 Posts: 344 Location: IBM Hursley
|
Before you get upset with the C importer, are you aware that the MRM parser does not support BIT fields either? So, even if you managed to import the header files, the MRM parser could not use them.
You need to create a script that pre-processes your C header files, and where it encounters bit fields, collapses them into a single unsigned char or unsigned int. Then the files will import, but more importantly the MRM can parse them. In your ESQL/Java logic, if you need to examine or set the value of bits, you need to break apart the byte and use bitwise operations. |
|
Back to top |
|
 |
yaakovd |
Posted: Tue Dec 15, 2009 2:00 pm Post subject: |
|
|
Partisan
Joined: 20 Jan 2003 Posts: 319 Location: Israel
|
thanks, already understood how deep the problem...
What is the best way to do that in ESQL? any short-cut? _________________ Best regards.
Yaakov
SWG, IBM Commerce, Israel |
|
Back to top |
|
 |
mgk |
Posted: Tue Dec 15, 2009 2:49 pm Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Hello,
There is no shortcut to writing the code I'm afraid. The ESQL functions of interest are BITAND, BITOR, BITNOT and BITXOR and these are documented in the infocenter.
Kind Regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
yaakovd |
Posted: Tue Dec 15, 2009 3:16 pm Post subject: |
|
|
Partisan
Joined: 20 Jan 2003 Posts: 319 Location: Israel
|
Of cource, but I mean for any sophisticate way to translate
for example hex string "A2" to bit-string "10100010" without running BITAND 8 times.
Code: |
CREATE FUNCTION FormatBits8(IN INDSET INT)
RETURNS CHAR
BEGIN
DECLARE bitStr CHAR '';
DECLARE J INT;
DECLARE I INT 0;
WHILE (I < 8) DO
SET J = CAST(POWER(2,I) AS INT);
SET bitStr = bitStr || CAST (BITAND(INDSET, J)/J AS CHAR);
SET I = I + 1;
END WHILE;
RETURN bitStr;
END;
|
_________________ Best regards.
Yaakov
SWG, IBM Commerce, Israel |
|
Back to top |
|
 |
mgk |
Posted: Wed Dec 16, 2009 2:35 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Quote: |
I mean for any sophisticate way to translate for example hex string "A2" to bit-string "10100010" without running BITAND 8 times. |
As it happens there is :
Code: |
DECLARE inputData INTEGER 0xA2;
SET OutputRoot.XMLNSC.Top.ResultCAST = RIGHT( CAST( inputData AS BIT ), 8); |
The CAST to BIT creates a BIT string of length 64 (as INTEGERS are 64bits in ESQL) so the RIGHT function is used to only take (in this case) the last 8 BITs. Another tip is that all the ESQL string functions operate on BIT strings as well as CHAR and BLOB strings.
So the output from this code is:
Code: |
<Top><ResultCAST>10100010</ResultCAST></Top> |
Hope this helps,
Kind Regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
|