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 » Accessing Field in REDEFINES Not Working

Post new topic  Reply to topic
 Accessing Field in REDEFINES Not Working « View previous topic :: View next topic » 
Author Message
EricCox
PostPosted: Thu Nov 08, 2012 10:09 am    Post subject: Accessing Field in REDEFINES Not Working Reply with quote

Master

Joined: 08 Apr 2011
Posts: 292

To all,

I have a COBOL Structure that has three REDEFINES.

In one scenario I am able to reach REDEFINES number two, find the fields and build the xml/soap output.

But for some reason when I try to reach into REDEFINES number one I get the standard error:
An error occurred whilst navigating to the '3'th path element of the field reference at the given location

Here is the statement that is failing. TR_01_DATA is the REDEFINES section.

Code:

SET tr01Count = CAST(InputBody.SDAMSDIO_RESPONSE_MESSAGE.SDAMSDIO_TR_01_DATA.SDAMSDIO_TR_01_NUM_PMTS AS INTEGER);


I cast because the mainframers defines NUM_PMTS as a PIC S9(13)V99 COMP-3.

Can someone give me some hints as what to look for. The strange thing is that I have another REDEFINES at the same location in the COBOL as TR_19 and that works. I can't put my finger on why there is different behavior between the two REDEFINES.

What should I look for? Am I not referencing the REDEFINE correctly?

Here is the REDEFINES:
Code:

       03  SDAMSDIO-RESPONSE-MESSAGE.
         05  SDAMSDIO-TR-HIST-FMT              PIC S9(3) COMP-3.
         05  FILLER-SDAMSDIO                   PIC X(50).
         05  SDAMSDIO-TR-TRAN-DATA             PIC X(2048).
         05  SDAMSDIO-TR-01-DATA             
                              REDEFINES SDAMSDIO-TR-TRAN-DATA.
           10  SDAMSDIO-TR-01-NUM-PMTS         PIC S9(3) COMP-3.
           10  SDAMSDIO-TR-01-PMT-DATE         PIC X(8).
           10  FILLER                          PIC X(18).
           10  SDAMSDIO-TR-01-NUM-AMTS         PIC S9(3) COMP-3.
           10  SDAMSDIO-TR-01-POSTED-DATA OCCURS 20 TIMES.
             15  SDAMSDIO-TR-01-TYPE-ID        PIC X(5).
             15  SDAMSDIO-TR-01-AMT            PIC S9(13)V99 COMP-3.
             15  FILLER                        PIC X(10).
           10  FILLER                          PIC X(1558).
         05  SDAMSDIO-TR-19-DATA
                         REDEFINES SDAMSDIO-TR-TRAN-DATA.
           10  SDAMSDIO-TR-19-FEE-TYPE         PIC X(3).
           10  SDAMSDIO-TR-19-FEE-CD           PIC 99.
           10  SDAMSDIO-TR-19-FEE-DESC         PIC X(15).
           10  SDAMSDIO-TR-19-FEE-AMT          PIC S9(11)V99 COMP-3.
           10  SDAMSDIO-TR-19-FEE-EARN-TERM    PIC S9(3) COMP-3.
           10  SDAMSDIO-TR-19-REGZ-IND         PIC X.
           10  FILLER                          PIC X(2018).
         05  SDAMSDIO-TR-20-DATA
                         REDEFINES SDAMSDIO-TR-TRAN-DATA.
           10  SDAMSDIO-TR-20-NUM-AMTS         PIC S9(3) COMP-3.
           10  FILLER                          PIC X(48).
           10  SDAMSDIO-TR-20-ENTRY       OCCURS 48 TIMES.
             15  SDAMSDIO-TR-20-ID             PIC X(5).
             15  SDAMSDIO-TR-20-AMT            PIC  S9(13)V99 COMP-3.
             15  FILLER                        PIC X(25).
           10  FILLER                          PIC X(174).


Any help is greatly appreciated.

Thanks,
EMC
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Nov 08, 2012 2:47 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Which version of WMB, and which domain are you using ( MRM or DFDL presumably)?
Back to top
View user's profile Send private message
EricCox
PostPosted: Thu Nov 08, 2012 2:50 pm    Post subject: Version Reply with quote

Master

Joined: 08 Apr 2011
Posts: 292

6.0.0.9 and MRM.

Yes, I know its not supported.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Nov 08, 2012 4:49 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20695
Location: LI,NY

Don't know why you are surprised that one works and the other doesn't.
This is the way the product works.
The redefines is translated as a CHOICE.
Once you have selected one branch on the choice you have chosen. There is no going back and saying, sorry I wanted the other one, or sorry I wanted a mix of 2 and 3....

Tell you what: keep it as tran Data and parse this (with a parse statement) 3 ways ) This way you should have access to all 3. However it might not work as the data may throw exceptions if a parsed field expects numeric and gets rubbish. Remember this is a GIGO system...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Fri Nov 09, 2012 1:16 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Aha! Thanks Vitor! I didn't realise that EricCox was attempting to access two different branches of the same choice in the same message tree.

@EricCox: Vitor is correct - if you really need to access the choice in two different ways ( why? ) then you will need to parse the input document twice.
Back to top
View user's profile Send private message
EricCox
PostPosted: Fri Nov 09, 2012 4:44 am    Post subject: Two Different Transactions Reply with quote

Master

Joined: 08 Apr 2011
Posts: 292

The scenario I spoke about is two different transactions with two different sections of the REDEFINES used in each one.

One transaction reaching to REDEFINES two works. One transaction reaching to REDEFINES one fails.

I can't figure out why.
Back to top
View user's profile Send private message
EricCox
PostPosted: Fri Nov 09, 2012 11:05 am    Post subject: Invalid Packed Decimal Makes Parser Bomb Reply with quote

Master

Joined: 08 Apr 2011
Posts: 292

Will this error make the whole COBOL message unusable?

In the scenario that works, with its REDEFINES, there are no OCCURS that have this error. In the scenarios that fail the parser throws errors.

Here is how rfhutil complains about it.

I am assuming this is fatal and makes the entire structure unreadable?

There are instances above #7 that hold valid data. But these unused instances seem to be initialized with invalid data.

Code:

10   970    23         7 SDAMSDIO-TR-01-POSTED-DATA

15   970     5 CHAR    7 SDAMSDIO-TR-01-TYPE-ID             

***** RFHUtil format error - Invalid Packed Decimal data in next field

15   975     8 PD      7 SDAMSDIO-TR-01-AMT             4040404040404040

15   983    10 CHAR    7 FILLER                                   

10   993    23         8 SDAMSDIO-TR-01-POSTED-DATA

15   993     5 CHAR    8 SDAMSDIO-TR-01-TYPE-ID             

***** RFHUtil format error - Invalid Packed Decimal data in next field

15   998     8 PD      8 SDAMSDIO-TR-01-AMT             4040404040404040

15  1006    10 CHAR    8 FILLER                                   



Here is how Message Broker complains about it:

Code:

 ConversionException  BIP5505E: Data conversion failed: data invalid. 
                                       Type of data being read : ''packed decimal, no sign found '' 
                                       Data                    : ''0x4040404040404040''
                                       A data conversion during reading or writing of a message failed because the input data was invalid for the output data type.


Thanks[/code]
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat Nov 10, 2012 1:13 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20695
Location: LI,NY

Cobol is tricky like that.
If you have say a set number of occurs (10) but only the 2 first ones are meaninful you can access your structure.

In XML parsing the whole structure (all 10 rows) needs to be correctly initialized otherwise it won't parse.

Tell your mainframe friends they need to initialize each row with an empty(initialized) structure before entering the relevant values...

Check also how your structure defines a null value for these fields.

Have fun

@kimbert do I need to get you a pair of glasses?
All Hail Vitor!
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Sat Nov 10, 2012 3:10 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

fjb_saper wrote:
@kimbert do I need to get you a pair of glasses?
All Hail Vitor!


Slightly worried now. My plan for world domination is supposed to be secret.

Or at least hopefully you're just obliquely referring to an email i got a while back on which I'm waiting to hear more.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Accessing Field in REDEFINES Not Working
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.