XML "Size"

General discussion on Zend Server for IBM System i
Post Reply
cars2089
Posts: 5
Joined: Tue Oct 04, 2016 12:11 pm

XML "Size"

Post by cars2089 » Tue Oct 04, 2016 2:00 pm

Hello together,

next question :)

PHP >> RPG - Call via $ToolkitServiceObj

My RPG returns more or less a big data structure:

Code: Select all

       dcl-pr getCustomerEndPrices likeds(tmplDSOutPriceEndHeader);
           inData likeDS(tmplDSinPriceEndHeader) Const;
           inDataDim likeDS(tmplDSinPriceEndArticles) dim(99) Const;
       end-pr;  

Return =

       dcl-ds tmplDSOutPriceEndHeader template qualified ;
         TotalListPrice packed(12:2);
         TotalDiscountPrice packed(12:2);
         outDimData likeDS(tmplDSOutPriceEndArticles) dim(999);
       end-ds; 

       dcl-ds tmplDSOutPriceEndArticles template qualified;
         ArNr char(7);
         Avarar char(3);
         Found int(10);
         ErrorOcc int(10);
         Mng packed(6:1);
         DiscountPerc packed(5:2);
         DiscountPercCustomer packed(5:2);
         DiscountPercVoucher packed(5:2);
         ListPrice packed(12:2);
         DiscountPrice packed(12:2);
         DiscountCustomerPrice packed(12:2);
         PosListPrice packed(12:2);
         PosDiscountPrice packed(12:2);
         PosDiscountCustomerPrice packed(12:2);
         voucherCode char(32);
         SWD likeds(tmplDSOutPriceEndArticlesSWD) Dim(10);
         ErrMSGID char(7);
         ErrMSGDta char(255);
         ErrMsgTxt char(1024);
       end-ds; 

       dcl-ds tmplDSOutPriceEndArticlesSWD template qualified;
         SWArnr char(7);
         SWAvarar char(3);
         DiscountPerc packed(5:2);
         DiscountPercCustomer packed(5:2);
         ListPrice packed(12:2);
         DiscountPrice packed(12:2);
         DiscountPriceCustomer packed(12:2);
         SWValid int(10);
       end-ds;
I ignore the entry parms, they size / count are similar to the return valies.

In PHP I use this code (and it seems to work when I'm debugging via rdi)

Code: Select all

		foreach (array_chunk($entryValues->articleArray->item, $arrayDimensionRPG) as $batch)
		{
			$param = array();
            $headerDS = array();
            $inDS = array();
            $inDSSW = array();
			$outDS = array();
            $outDSArticles = array();
            $outDSArticlesSW = array();
            $resultServicePgm = array();

            // RPG Entry Parms
            $headerDS[] = $ToolkitServiceObj->AddParameterPackDec('both', 2, 0, 'firnr', 'firnr', $entryValues->company);
            $headerDS[] = $ToolkitServiceObj->AddParameterPackDec('both', 8, 0, 'kdnr', 'kdnr', $entryValues->customerNumber);
            $headerDS[] = $ToolkitServiceObj->AddParameterPackDec('both', 3, 0, 'kvnr', 'kvnr', $entryValues->customerDeliveryNumber);
            $headerDS[] = $ToolkitServiceObj->AddParameterInt32('both', 'eshopZone', 'ArrayCount', $entryValues->eshopZone);
            $headerDS[] = $ToolkitServiceObj->AddParameterInt64('both', 'lgid', 'lgid', $entryValues->lgid);
            $headerDS[] = $ToolkitServiceObj->AddParameterChar('both', 32, 'voucherCode', 'voucherCode', $entryValues->voucherCode);
            $headerDS[] = $ToolkitServiceObj->AddParameterInt32('both', 'ArrayCount', 'ArrayCount', count($batch));
            $param[] = $ToolkitServiceObj->AddDataStruct($headerDS);

            // "dynamic rpg array" >> level 1 >> ordered article
			foreach ($batch as $article)
			{
                $inDS[] = $ToolkitServiceObj->AddParameterChar('both', 7, 'arnr', 'arnr', $article->articleNumber);
                $inDS[] = $ToolkitServiceObj->AddParameterChar('both', 3, 'avarar', 'avarar', $article->articleVariationNumber);
                $inDS[] = $ToolkitServiceObj->AddParameterPackDec('both', 6, 1, 'mng', 'mng', $article->orderQuantity);
                // static rpg array >> level 2 = special wishes
                $inDSSW = array();
                foreach ($article->articleSpecialWishArray->item as $articleSpecialWish)
                {
                    $inDSSW[] = $ToolkitServiceObj->AddParameterChar('both', 7, 'arnr', 'arnr', $articleSpecialWish->articleNumberSpecialWish);
                    $inDSSW[] = $ToolkitServiceObj->AddParameterChar('both', 3, 'avarar', 'avarar', $articleSpecialWish->articleVariationNumberSpecialWish);
                    $inDSSW[] = $ToolkitServiceObj->AddParameterPackDec('both', 4, 1, 'wert1', 'wert1', $articleSpecialWish->specialWishValue1);
                    $inDSSW[] = $ToolkitServiceObj->AddParameterPackDec('both', 4, 1, 'wert2', 'wert2', $articleSpecialWish->specialWishValue2);
                    $inDSSW[] = $ToolkitServiceObj->AddParameterPackDec('both', 3, 0, 'menge', 'menge', $articleSpecialWish->orderQuantity);
                }
                for ($i = count($article->articleSpecialWishArray->item); $i < 10; $i++ ){
                    $inDSSW[] = $ToolkitServiceObj->AddParameterChar('both', 7, 'arnr', 'arnr', '       ');
                    $inDSSW[] = $ToolkitServiceObj->AddParameterChar('both', 3, 'avarar', 'avarar', '   ');
                    $inDSSW[] = $ToolkitServiceObj->AddParameterPackDec('both', 4, 1, 'wert1', 'wert1', 0);
                    $inDSSW[] = $ToolkitServiceObj->AddParameterPackDec('both', 4, 1, 'wert2', 'wert2', 0);
                    $inDSSW[] = $ToolkitServiceObj->AddParameterPackDec('both', 3, 0, 'menge', 'menge', 0);
                }
                //$inDS[] = $ToolkitServiceObj->AddDataStruct($inDSSW)->setParamDimension(1);
                $inDS[] = $ToolkitServiceObj->AddDataStruct($inDSSW);
   			}
            $param[] = $ToolkitServiceObj->AddDataStruct($inDS)->setParamDimension(1);

            // return array structure
            // main data structure
            $outDS[] = $ToolkitServiceObj->AddParameterPackDec('both', 12, 2 , 'TotalListPrice', 'TotalListPrice', 0);
            $outDS[] = $ToolkitServiceObj->AddParameterPackDec('both', 12, 2 , 'TotalDiscountPrice', 'TotalDiscountPrice', 0);
            // article data structure below main data structure
            $outDSArticles[] = $ToolkitServiceObj->AddParameterChar('both', 7, 'arnr', 'arnr', ' ');
            $outDSArticles[] = $ToolkitServiceObj->AddParameterChar('both', 3, 'avarar', 'avarar', ' ');
            $outDSArticles[] = $ToolkitServiceObj->AddParameterInt32('both', 'found', 'found', 0);
            $outDSArticles[] = $ToolkitServiceObj->AddParameterInt32('both', 'ErrorOrc', 'ErrorOrc', 0);
            $outDSArticles[] = $ToolkitServiceObj->AddParameterPackDec('both', 6, 1, 'mng', 'mng', 0);
            $outDSArticles[] = $ToolkitServiceObj->AddParameterPackDec('both', 5, 2 , 'DiscountPerc', 'DiscountPerc', 0);
            $outDSArticles[] = $ToolkitServiceObj->AddParameterPackDec('both', 5, 2 , 'DiscountPercCustomer', 'DiscountPercCustomer', 0);
            $outDSArticles[] = $ToolkitServiceObj->AddParameterPackDec('both', 5, 2 , 'DiscountPercVoucher', 'DiscountPercVoucher', 0);
            $outDSArticles[] = $ToolkitServiceObj->AddParameterPackDec('both', 12, 2 , 'ListPrice', 'ListPrice', 0);
            $outDSArticles[] = $ToolkitServiceObj->AddParameterPackDec('both', 12, 2 , 'DiscountPrice', 'DiscountPrice', 0);
            $outDSArticles[] = $ToolkitServiceObj->AddParameterPackDec('both', 12, 2 , 'DiscountCustomerPrice', 'DiscountCustomerPrice', 0);
            $outDSArticles[] = $ToolkitServiceObj->AddParameterPackDec('both', 12, 2 , 'PosListPrice', 'PosListPrice', 0);
            $outDSArticles[] = $ToolkitServiceObj->AddParameterPackDec('both', 12, 2 , 'PosDiscountPrice', 'PosDiscountPrice', 0);
            $outDSArticles[] = $ToolkitServiceObj->AddParameterPackDec('both', 12, 2 , 'PosDiscountCustomerPrice', 'PosDiscountCustomerPrice', 0);
            $outDSArticles[] = $ToolkitServiceObj->AddParameterChar('both', 32, 'voucherCode', 'voucherCode', ' ');
            // article special wish data structure in the moddle of the article data structure
            $outDSArticlesSW[] = $ToolkitServiceObj->AddParameterChar('both', 7, 'SWArnr', 'SWArnr', ' ');
            $outDSArticlesSW[] = $ToolkitServiceObj->AddParameterChar('both', 3, 'SWAvarar', 'SWAvarar', ' ');
            $outDSArticlesSW[] = $ToolkitServiceObj->AddParameterPackDec('both', 5, 2 , 'DiscountPerc', 'DiscountPerc', 0);
            $outDSArticlesSW[] = $ToolkitServiceObj->AddParameterPackDec('both', 5, 2 , 'DiscountPercCustomer', 'DiscountPercCustomer', 0);
            $outDSArticlesSW[] = $ToolkitServiceObj->AddParameterPackDec('both', 12, 2 , 'ListPrice', 'ListPrice', 0);
            $outDSArticlesSW[] = $ToolkitServiceObj->AddParameterPackDec('both', 12, 2 , 'DiscountPrice', 'DiscountPrice', 0);
            $outDSArticlesSW[] = $ToolkitServiceObj->AddParameterPackDec('both', 12, 2 , 'DiscountCustomerPrice', 'DiscountCustomerPrice', 0);
            $outDSArticlesSW[] = $ToolkitServiceObj->AddParameterInt32('both', 'SWValid', 'SWValid', 0);
            $outDSArticles[] = $ToolkitServiceObj->AddDataStruct($outDSArticlesSW)->setParamDimension(10);
            // rest of article data structure below main data structure
            $outDSArticles[] = $ToolkitServiceObj->AddParameterChar('both', 7, 'ErrMSGID', 'ErrMSGID', ' ');
            $outDSArticles[] = $ToolkitServiceObj->AddParameterChar('both', 255, 'ErrMSGDta', 'ErrMSGDta', ' ');
            $outDSArticles[] = $ToolkitServiceObj->AddParameterChar('both', 1024, 'ErrMsgTxt', 'ErrMsgTxt', ' ');
            $outDS[] = $ToolkitServiceObj->AddDataStruct($outDSArticles)->setParamDimension($arrayDimensionRPG);
            // complete data structure
            $resultServicePgm[] = $ToolkitServiceObj->AddDataStruct($outDS)->setParamDimension(1);

			$result = $ToolkitServiceObj->PgmCall("WSPRICESV2", "MEDIWS", $param, $resultServicePgm, array('func'=>"GETCUSTOMERENDPRICES"));
At the end I don't get a result.
In the debug file (=attached) it seems to stop, may be cause of size....

If I try with less dim-entries, it works.

Is here a size / border in the xml?
Or does I make something wrong?

Thanks a lot

Carsten
Attachments
tkit_debug.zip
(7.18 KiB) Downloaded 184 times

cars2089
Posts: 5
Joined: Tue Oct 04, 2016 12:11 pm

Re: XML "Size"

Post by cars2089 » Tue Oct 04, 2016 2:58 pm

Found it

'plug' => "iPLUG5M"

Thanks Michael!

Post Reply