Author |
Message
|
djeripo |
Posted: Thu May 20, 2004 1:30 pm Post subject: COMP-3 PACKED DECIMAL |
|
|
 Master
Joined: 25 Jan 2004 Posts: 225
|
Hi,
Could you tell me how to convert a 11byte character into a,
PIC S9(9) V99 COMP-3
When I imported CobolCopyBook ,that element under CWF tab is displayed with the following attributes,
Physical Type Packed Decimal
Length Count 6
Virtual Decimal Point 2 .
Thanks in advance |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu May 20, 2004 1:45 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Please be more specific. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
djeripo |
Posted: Thu May 20, 2004 2:13 pm Post subject: |
|
|
 Master
Joined: 25 Jan 2004 Posts: 225
|
Sorry about that Jeff.
I am doing a conversion from TDS to CWF .
I am getting a 11 byte character something like ,
00000061200 (BILL_PREMIUM).
I need to convert it into an equivalent PIC S9(9) V99 COMP-3
I know , I have to cast that in compute node something like
CAST(BILL_PREMIUM AS FLOAT(9,2)??) .Not sure how to do that. |
|
Back to top |
|
 |
EddieA |
Posted: Thu May 20, 2004 3:31 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
If you've set up the TDS and CWF correctly:
Code: |
SET OutputRoot.MRM.OutputPD = InputBody.InputCHAR / 100; |
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
djeripo |
Posted: Thu May 20, 2004 3:39 pm Post subject: |
|
|
 Master
Joined: 25 Jan 2004 Posts: 225
|
Sorry, I did nt get that .Could you please elaborate. |
|
Back to top |
|
 |
wooda |
Posted: Fri May 21, 2004 12:27 am Post subject: |
|
|
 Master
Joined: 21 Nov 2003 Posts: 265 Location: UK
|
Why are you modelling the input as character and not decimal ?
00000061200
Looks like a decimal which is right justified and padded with 0.
If you model it as a decimal then conversion should not be necessary assuming that you want to output the same logical value but in the format described by your COBOL. |
|
Back to top |
|
 |
djeripo |
Posted: Fri May 21, 2004 7:05 am Post subject: |
|
|
 Master
Joined: 25 Jan 2004 Posts: 225
|
Alex,
I am getting a character of 11 bytes.
00000061200 (BILL_PREMIUM).
I would type cast it into Decimal after concatinating a period(.) to it .
Something like ,
CAST(SUBSTRING (BILL_PREMIUM FROM 1 FOR 9) || . || SUBSTRING(BILL_PREMIUM FROM 10 FOR 2) AS DECIMAL(11,2) ) .
The resultant would be ,
000000612.00
The thing which I dont understand is ,
The Length of Input Element is 12 bytes(After concatenation of period)whereas Output Element is 6.
Do you mean to say that, I can straight away assign this(000000612.00
) to a an element in cobol copy book of structure,
Physical Type Packed Decimal
Length Count 6
Virtual Decimal Point 2 .
This is first time I am doing something like this .Please excuse me if it is too basic . |
|
Back to top |
|
 |
kirani |
Posted: Sun May 23, 2004 2:23 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
What does your specification says about the input data? Will it always be 11 chars long? If you are getting data as 00000000011 then you want to assign 0.11 to the output field, correct?
Your output field is long enough to hold data of 9(9).9(2) size. Since its defined as COMP-3 field it is taking 6 bytes only.
The code you mentioned in above post will take care of moving data into output field correctly. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
djeripo |
Posted: Sun May 23, 2004 8:18 pm Post subject: |
|
|
 Master
Joined: 25 Jan 2004 Posts: 225
|
Thanks Kiran. It worked , without making any changes.My input is always fixed with 11 characters. |
|
Back to top |
|
 |
|