[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ftpapi] Crashing when using http_nextXmlAttr because of compiler problem



Hello,

 

as already has been found out, there seems to be a problem with http_nextXmlAttr. See http://www.scottklement.com/archives/ftpapi/201502/msg00089.html

It's supposed to be a problem with the compiler.

Today I ran into the same problem and started looking for a solution.

I found out, that the procedure interface has to be in fixed format, when you use ACTGRP(*NEW) or ACTGRP(*CALLER) or a named activation group. If the procedure interface is in free you would get an MCH0601.

Only if you use ACTGRP(*STGMDL) the procedure interface can be in free.

 

I will report the error to IBM. Just wanted to tell this to all users.

 

Greetings

 

Jens

 

 

 

Here's an example based on EXAMPLE11.

 

 

     H DFTACTGRP(*NO)

     H*ACTGRP(*NEW)

     H*ACTGRP(*CALLER)

     H ACTGRP(*STGMDL)

     H*ACTGRP('TEST')

 

       ctl-opt main(Main);

       CTL-OPT BNDDIR('LIBHTTP/HTTPAPI');

 

      /copy LIBHTTP/QRPGLESRC,HTTPAPI_H

 

       dcl-proc Main;

       dcl-pi *N extpgm('TEST');

       end-pi;

 

       dcl-s XML char(1000) inz;

 

       XML = '+

           <rss version="2.0">+

             <channel>+

               <title>Title of Newsfeed channel</title>+

                <link>http://www.blahblahblah.com</link>+

               <description>Whatever Headlines</description>+

               <language>en-US</language>+

               <item>+

                 <title>Title of first article</title>+

                 <link>link to first article</link>+

              </item>+

               <item>+

                 <title>Title of second article</title>+

                 <link>link to second article</link>+

               </item>+

             </channel>+

           </rss>';

 

       http_parse_xml_string(

         %addr(XML):

         %len(XML):

         0:

         %paddr(IncomingStartOld):

         *null:

         *null);

 

       http_parse_xml_string(

         %addr(XML):

         %len(XML):

         0:

         %paddr(IncomingStart):

         *null:

         *null);

       end-proc;

 

 

     p IncomingStartOld...

     p                 b

     d                 pi

     d  UserData                       *     value

     d  depth                        10i 0   value

     d  name                       1024a     const varying

     d  path                      24576a     const varying

     d  attrs                          *     Dim(32767)

     d                                       const Options(*VarSize)

 

       dcl-s count int(10);

       dcl-s attrname varchar(1024);

       dcl-s attrval varchar(65535);

 

       dcl-s DsplyChar char(52) inz;

 

       if (name = 'rss');

 

         DsplyChar = name;

         dsply 'Name';

         dsply DsplyChar;

 

         count = 1;

         dow http_nextXmlAttr(attrs: count: attrname: attrval);

           if (attrname = 'version');

             DsplyChar = attrname;

             dsply 'Attributname';

             dsply DsplyChar;

 

             DsplyChar = attrval;

             dsply 'Attributwert';

             dsply DsplyChar;

           endif;

         enddo;

       endif;

     p                 e

 

       dcl-proc IncomingStart;

       dcl-pi *n;

        userdata pointer value;

        depth int(10) value;

        name varchar(1024) const;

        path varchar(24576) const;

        attrs pointer dim(32767) const options(*varsize);

       end-pi;

 

       dcl-s count int(10);

       dcl-s attrname varchar(1024);

       dcl-s attrval varchar(65535);

 

       dcl-s DsplyChar char(52) inz;

 

       if (name = 'rss');

 

         DsplyChar = name;

         dsply 'Name';

         dsply DsplyChar;

 

         count = 1;

         dow http_nextXmlAttr(attrs: count: attrname: attrval);

           if (attrname = 'version');

             DsplyChar = attrname;

             dsply 'Attributname';

             dsply DsplyChar;

 

             DsplyChar = attrval;

             dsply 'Attributwert';

             dsply DsplyChar;

           endif;

         enddo;

       endif;

       end-proc;

 

-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi