Error compiling http_String unrelated to library list

Discussions related to HTTPAPI (An HTTP Client Package for RPG programming.) http://www.scottklement.com/httpapi/
Post Reply
IBMi_Fan
Posts: 2
Joined: Thu Jul 07, 2022 5:21 pm

Error compiling http_String unrelated to library list

Post by IBMi_Fan »

Hello,
I have 2 questions that I am hoping to get assistance with:

#1. I am getting the following errors when I compile my program to post a basic 'hello_world' string to a REST service.

*RNF5409 00 1 The prototyped call returns a value which is lost when CALLP
is used.

*RNF3756 20 1 OPTIONS(*NOPASS) is missing for a parameter following an
optional parameter.

*RNF5346 30 4 The operation modifies the field, but the field cannot be
modified.

I have also attached a PDF of the compile listing from my spooled file and added a bookmark where my code starts (page 55, statement #2917). The version of HTTPAPI I am using is 1.41.

#2. Is anyone aware of a company that hosts access to an IBMI that allows modifications to the http server (not sure if that is the accurate terminology)?

I signed up for one
a couple of years ago with the goal of learning how to use this software and technology as I was unable to access the external targets used in the examples (GEOIP, Twitter, UPS, etc) because the security team at my company blocks access to those. However, I ran into issues installing or compiling (I can't recall which now) on the vendor IBMi because something in the HTTPAPI software was attempting to make a modification to the server and since the server was set up for general use by other users no one had the ability to make modifications to it.

Thank you in advance for any assistance!
IBMi_Fan
Posts: 2
Joined: Thu Jul 07, 2022 5:21 pm

Re: Error compiling http_String unrelated to library list

Post by IBMi_Fan »

I don't see the attachment that contains my compile listing and the errors that I uploaded. This is my first post so I may not have handled it correctly.

Here is my code:

0000.01 Ctl-Opt dftactgrp(*no) bnddir('HTTPAPI');
0000.02
0000.05 /copy qrpglesrc,httpapi_h
0039.03
0039.04
0039.05 d PI
0039.06 d Type 10a varying const
0039.07 d URL 32767A varying const
0039.08 d SendStr 100000a varying const
0039.09 d* options(*varsize:*omit:*nopass)
0039.10 d ContentType 16384a varying const
0039.11 d options(*varsize:*omit:*nopass)
0039.12
0039.13 d Message 100a varying const
0039.14
0039.15 Eval Type = 'POST';
0039.16
0040.00 Eval URL = 'http://10.90.32.141:8000/cicjis/api/rpgtestpost';
0041.00
0000.01 Ctl-Opt dftactgrp(*no) bnddir('HTTPAPI');
0000.02
0000.05 /copy qrpglesrc,httpapi_h
0039.03
0039.04
0039.05 d PI
0039.06 d Type 10a varying const
0039.07 d URL 32767A varying const
0039.08 d SendStr 100000a varying const
0039.09 d* options(*varsize:*omit:*nopass)
0039.10 d ContentType 16384a varying const
0039.11 d options(*varsize:*omit:*nopass)
0039.12
0039.13 d Message 100a varying const
0039.14
0039.15 Eval Type = 'POST';
0039.16
0040.00 Eval URL = 'http://10.90.32.141:8000/cicjis/api/rpgtestpost';
0041.00
0041.02
0041.03 Eval ContentType = '*OMIT';
0041.04
0041.05 callp http_String( Type: URL: SendStr: ContentType);
0043.00
0044.00 Eval *Inlr = *On;


And here are the errors I am getting:

*RNF3756 20 2925 003913 OPTIONS(*NOPASS) is missing for a parameter following an
optional parameter.
2927 Eval Type = 'POST';
======> aaaa
*RNF5346 30 a 003915 The operation modifies the field, but the field cannot b
modified.
2928
2929 Eval URL = 'http://10.90.32.141:8000/cicjis/api/rpgtestpost';
======> aaa
*RNF5346 30 a 004000 The operation modifies the field, but the field cannot b
modified.
2930
2931 Eval SendStr = 'Hello World';
======> aaaaaaa
*RNF5346 30 a 004101 The operation modifies the field, but the field cannot b
modified.
2932
2933 Eval ContentType = '*OMIT';
======> aaaaaaaaaaa
*RNF5346 30 a 004103 The operation modifies the field, but the field cannot be
modified.
2934


M e s s a g e S u m m a r y
Msg id Sv Number Message text
*RNF5409 00 1 The prototyped call returns a value which is lost when CALLP
is used.
*RNF7031 00 196 The name or indicator is not referenced.
*RNF3756 20 1 OPTIONS(*NOPASS) is missing for a parameter following an
optional parameter.
*RNF5346 30 4 The operation modifies the field, but the field cannot be
modified.
* * * * * E N D O F M E S S A G E S U M M A R Y * * * * *
jonboy49
Posts: 200
Joined: Wed Jul 28, 2021 8:18 pm

Re: Error compiling http_String unrelated to library list

Post by jonboy49 »

In future posts please use the code tags (the word code in square brackets - followed by /code (also in brackets) to end the code block. It is really hard to read the way you have done it. With the tags it looks like this (columns not corrected):

Code: Select all

     d PI 
     d   Type                10a varying const 
     d   SendStr         100000a varying const 
     d*                          options(*varsize:*omit:*nopass) 
     d   ContentType      16384a varying const 
     d                           options(*varsize:*omit:*nopass) 
     d   Message            100a varying const 
I have no idea why you commented out the options(*varsize:*omit:*nopass) line - in an attempt to force compile?

As to your errors - Error 1 the parameter ContentType is defined as optional (Options(*nopass)) - any subsequent parameters (in this case Message) must also be defined as optional. Them's the rules and if you think about it that makes sense.

Error 2 + e.g. Type = Post. (You know you don't need the EVAL right?) The error message is correct - the definition of Type in the PI says CONST. That says it is read only and can't be modified so the compiler is correct. The same applies to the other errors.

Excuse me if this sounds insulting - but it looks like you are a novice at RPG and are trying to use the HTTPAPI without really understanding the language. For example your whole PI really makes no sense. A PI is a definition of the parameters the program is to receive. If you were passing (say) Type as a parameter why would you modify the content in the code?

My best suggestion is that you should look at the code samples provided with HTTPAPI and see how APIs such as http_String are used.
jonboy49
Posts: 200
Joined: Wed Jul 28, 2021 8:18 pm

Re: Error compiling http_String unrelated to library list

Post by jonboy49 »

As to public systems. The only free one I know of is pub400 (https://pub400.com) - all the others have a fee.

You can do web stuff on that system but have to request the HTTP server changes you need. See their web page for details.
Post Reply