Working with multiple occurrence data structures

Working with multiple occurrence data structures

Postby timo_karvinen on Fri May 11, 2012 10:01 am

There seems to be a problem with occurrence ds's in cw/new toolkit.

Most of our RPG programs we use from PHP have multiple occurrence data structures as (*ENTRY) input (and output) values.
The old toolkit worked with these fine, in example we have some RPG program that has occurs 10 ds and when we make the program call the actual input value arrays can happily range anywhere from 0 to 10.

With the new toolkit (cw mode) when the call comes with say 2 arrays in ds, the rest 8 are left null, which is the problem.
The RPG program promptly crashes when there's a nulls in ds, the old toolkit didn't send null's in empty ds arrays but *BLANKS and *ZEROS and everything was peachy.

Now there's a way to fix this in cw, in cwclasses.php in method oldToNewDescriptionItem there already is option to add empty default values but apparently this is only applied if the whole ds is empty (output only).
What should be done is apply default values to all arrays up to count (occurrence amount described not count of real values) and then overwrite the values needed with real values coming in $inputValues.
Or apply the real values to call parameters and fill the rest of the occurrences (up to described amount) with empty values.

Ofcourse if there's a way to get the new toolkit to send *BLANKS and *ZEROS instead of NULLS with RPG-call, without initializing whole ds with empty values, it would be better solution.


Also there seems to be some problem (or discrepancy with old toolkit) with the way multiple occurrence ds's are returned from program call.
Our old programs don't work the way the used to in this regard either.
I'll get more on this when I have more relevant information available.


-Timo
timo_karvinen
 
Posts: 74
Joined: Wed Aug 12, 2009 7:58 am
Location: Tampere, Finland

Re: Working with multiple occurrence data structures

Postby erich_hieden on Fri May 11, 2012 2:27 pm

Hello Timo

Thanks for your in depth info on this problem. I'm in the same boat as you are and that's why Alan and me are currently doing a rebuild of the way CW treats ds with dim. Filling up with *ZEROS and *BLANKS is sort of a performance issue and that's why we are currently investigating another way to get things done. Still thanks for reminding me to test the new solution the way you'll use it.

Martin

P.S. Help is apreciated, so if you're interested in testing an early solution, let Alan know.
erich_hieden
 
Posts: 379
Joined: Tue Jul 07, 2009 9:01 am

Re: Working with multiple occurrence data structures

Postby timo_karvinen on Fri May 11, 2012 2:35 pm

Sure, I'm very willing to test it out, this really is a showstopper for us on switching to new Toolkit, which we really want to do.
timo_karvinen
 
Posts: 74
Joined: Wed Aug 12, 2009 7:58 am
Location: Tampere, Finland

Re: Working with multiple occurrence data structures

Postby erich_hieden on Fri May 11, 2012 2:44 pm

Great! I'm out of office next week, but will get back to you then.
erich_hieden
 
Posts: 379
Joined: Tue Jul 07, 2009 9:01 am

Re: Working with multiple occurrence data structures

Postby timo_karvinen on Mon May 14, 2012 9:16 am

Nevermind about my mention of output parameters, I found the culprit and it was not cw/new Toolkit.
timo_karvinen
 
Posts: 74
Joined: Wed Aug 12, 2009 7:58 am
Location: Tampere, Finland

Re: Working with multiple occurrence data structures

Postby timo_karvinen on Thu Jun 28, 2012 7:54 am

Has there been any progress regarding this problem?
timo_karvinen
 
Posts: 74
Joined: Wed Aug 12, 2009 7:58 am
Location: Tampere, Finland

Re: Working with multiple occurrence data structures

Postby erich_hieden on Thu Jun 28, 2012 5:03 pm

There's a new version available at http://www.youngiprofessionals.com/wiki/XMLSERVICE with new features/imporvements regarding multiple occurrence ds. We didn't have time to investigate your special use case (calling a program with only a few ds set) yet. But give it a try and maybe drop a note on how you succeed.

Best
erich_hieden
 
Posts: 379
Joined: Tue Jul 07, 2009 9:01 am

Re: Working with multiple occurrence data structures

Postby timo_karvinen on Tue Jul 31, 2012 10:27 am

I'm back from vacation and did a quick test on this.
I updated about everything to latest version.
Version information:
D PLUGVER c const('XML Toolkit 1.7.0')
define('CW_VERSION', '1.3.0');
PHP Version 5.3.14
IBM i V7R1

But the quick test would seem to indicate that my specific problem is still there. If I call multiple occurrence ds with all the occurrences set it works, if I call with less than maximum occurrences the rpg program crashes.

-Timo
timo_karvinen
 
Posts: 74
Joined: Wed Aug 12, 2009 7:58 am
Location: Tampere, Finland

Re: Working with multiple occurrence data structures

Postby aseiden on Wed Aug 01, 2012 4:43 am

Hi, Timo,

Yes, CW allows Count and CountRef, which will initialize an empty input array very efficiently.

If you need the array partially filled then you'll have to initialize the rest yourself, at least as things stand now.

If you have any good ideas of adapting the 'dim' idea, we'll be happy to listen.

Best,
Alan
aseiden
 
Posts: 836
Joined: Thu Apr 09, 2009 5:45 pm

Re: Working with multiple occurrence data structures

Postby timo_karvinen on Wed Aug 01, 2012 8:43 am

Well like I mentioned in my first post, changing cwclasses.php to accommodate "half empty" input arrays would be the quick and dirty solution.
Of course I can do the initialization of unused occurrences in the script I'm calling cw/toolkit from, but this would mean changes to hundreds of scripts in out case, so more efficient method would be to change cwclasses.php.
On the long run there's hopefully a better solution though, since this method (done either way) will create much unneeded overhead to calls, but I can't think of one now.

By the way, I used occurrence amount of 10 in example but usually our programs have occurrences of 200 or 500 or so on.

-Timo
timo_karvinen
 
Posts: 74
Joined: Wed Aug 12, 2009 7:58 am
Location: Tampere, Finland

Next

Return to New Toolkit

Who is online

Users browsing this forum: No registered users and 1 guest