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 » CASTING CHARACTER to INTEGER for COMP-3 fields

Post new topic  Reply to topic
 CASTING CHARACTER to INTEGER for COMP-3 fields « View previous topic :: View next topic » 
Author Message
rdw
PostPosted: Thu Jan 16, 2003 10:56 am    Post subject: CASTING CHARACTER to INTEGER for COMP-3 fields Reply with quote

Newbie

Joined: 16 Jan 2003
Posts: 3

PROB
We are expected to handle a COBOL field that comes in a spaces or comes in COMP-3, because the program is using the INITIALIZE function in the COBOL program. Our strategy was to create a MRM layout of all CHARACTER datatypes, TRIM the field replacing spaces with zero then CAST to an INTEGER. CASTING is not working for us on the very first field that happens to be a valid number and not spaces.

Are the control characters causing the problem? If so, how should we handle these control character? Or do we have to go thru this byte by byte to handle High and Low byte values?

OS/390
XRF-SEG-LGTH-CD PIC S9(04) COMP.

MQSI 2.0.1 MRM type
MRM1
ALT-XRF-SEG-LGTH-CD PIC X(2). <----CHARACTER
MRM2
XRF-SEG-LGTH-CD PIC S9(04) COMP. <----INTEGER

ESQL
IF (LENGTH(TRIM(
InputRoot.MRM.WCIF103_ALT_XRF_AREA.ALT_XRF_ROOT_SEG.ALT_XRF_SEG_LGTH_CD)) > 0)

THEN
SET

OutputRoot.MRM.WCIF103_XRF_AREA.XRF_ROOT_SEG.XRF_SEG_LGTH_CD = CAST (TRIM(InputRoot.MRM.WCIF103_ALT_XRF_AREA.ALT_XRF_ROOT_SEG.ALT_XRF_SEG_LGTH_CD) AS INTEGER);
ELSE
SET OutputRoot.MRM.WCIF103_XRF_AREA.XRF_ROOT_SEG.XRF_SEG_LGTH_CD = 0;

END IF;

ERROR
2003-01-16 11:01:19.152274 18 RecoverableException BIP2521E: (66, 73) : Error casting a value from CHARACTER to INTEGER.
An error occurred when casting a value of data type CHARACTER to a value of data type INTEGER.
Subsequent messages will indicate the context of the error.

2003-01-16 11:01:19.152386 18 ConversionException BIP2595E: Error casting character string '^A00000000^B' to an integer.
An attempt was made to cast the character string '^A00000000^B' to an integer, but the string was of the wrong format.
_________________
rdw
Back to top
View user's profile Send private message
yaakovd
PostPosted: Mon Jan 20, 2003 5:29 am    Post subject: Reply with quote

Partisan

Joined: 20 Jan 2003
Posts: 319
Location: Israel

You can try to define local integer variable before - in this case you can remove TRIM, CASTING and IF from your code:

DEFINE ALT_XRF INT;
SET ALT_XRF = 0;
SET ALT_XRF = InputRoot.MRM.WCIF103_ALT_XRF_AREA.ALT_XRF_ROOT_SEG.ALT_XRF_SEG_LGTH_CD;

SET OutputRoot.MRM.WCIF103_XRF_AREA.XRF_ROOT_SEG.XRF_SEG_LGTH_CD = 0;

I didn't tested it with MRM, but it working when select from DB. But I guess it working same.
_________________
Best regards.
Yaakov
SWG, IBM Commerce, Israel
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 » CASTING CHARACTER to INTEGER for COMP-3 fields
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.