Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Scratching my head.

Posted on 2005-02-25
7
Medium Priority
?
2,246 Views
Last Modified: 2007-12-19
Would someone kindly tell me why the following will not compile?

H Debug  DftActGrp(*NO)  Bnddir('QC2LE') ActGrp('New')          
D GetProfile      PR                  ExtPgm('QSYGETPH')        
D   UserID                         10A   const                      
D   Password                      10A   const                      
D   Handle                          12A                              
D   ErrorCode                32766A   options(*varsize: *nopass)
                                                                 
 /Free                                                          
          GetProfile(UserID: PassWord: Handle: ErrorCode);      
                                                                 
          *InLR = *On;                                          
 /End-Free                            
The compiler messages are.
*RNF5410 30      1 The prototype for the call is not defined.          
*RNF7030 30      4 The name or indicator is not defined.                
*RNF7503 30      1 Expression contains an operand that is not defined.  
I've been fighting this all day.
Thaks in advance
                         
0
Comment
Question by:tcfrey
  • 2
  • 2
  • 2
6 Comments
 
LVL 14

Expert Comment

by:daveslater
ID: 13408007
Hi
you have only defined the prototype. This does not define the variables.

Define
D   UserID          s              10A            
D   Password      s               10A                  
D   Handle          s               12A                
 as stansd alone variables
and define error code as

D ErrorDS         ds            16                                                        
D   BytesProv                   10i 0 inz(%size(ErrorDS))                                  
D   BytesAvail                  10i 0                                                      
D   ExceptionID                  7            

it is best to deing the prototype as

D GetProfile      PR                  ExtPgm('QSYGETPH')        
D   UserID                         10A   const                      
D   Password                      10A   const                      
D   Handle                          12A                              
D   ErrorCode                         Like(ErrorDS)

have fun


Dave
0
 
LVL 14

Accepted Solution

by:
daveslater earned 1000 total points
ID: 13408027
Ps
What I Tend to do is

D GetProfile      PR                  ExtPgm('QSYGETPH')        
D   p_UserID                          Like(Userid) Const                      
D   p_Password                      Like(Password) Const                  
D   p_Handle                          Like(handel)
D   p_Errords                         Like(ErrorDS)

D   UserID          s              10A            
D   Password      s               10A                  
D   Handle          s               12A              

D ErrorDS         ds            16                                                        
D   BytesProv                   10i 0 inz(%size(ErrorDS))                                  
D   BytesAvail                  10i 0                                                      
D   ExceptionID                  7            

If there is an error BytesAvail of errords will not be 0

Ps
I have guessed the col positions - as/440 is being backed up.

Dave
0
 
LVL 27

Expert Comment

by:tliotta
ID: 13425980
Dave's right. (I haven't actually tried to compile the example, so there _could_ be detail differences; but just by looking, his explanation covers the compile errors.)

All that's happened for the four items that appear to be mentioned here --

RNF7030 30      4 The name or indicator is not defined.

-- is that the they've been given the same names as the items under the GetProfile prototype. But the items under GetProfile don't even need names; the fact that they're allowed names is maybe just an unfortunate judgment of the IBM compiler writers.

From the ILE RPG Reference: "For a prototype parameter definition, the name entry is optional. If a name is specified, the name is ignored."

The prototype, including its argument definitions, doesn't declare any memory. All it does is provide a template for the compiler. The compiler can use the prototype definitions to cross-check against the arguments you pass on the CALLP statement.

But the arguments on CALLP haven't been defined yet.

I know it seems confusing because the prototype sure makes it _look_ like they're defined.

To add to the confusion, when you create a PR/PI pair PR prototype and PI procedure interface) of specifications for the current program, you actually do define the arguments at that time -- kind of.

In this case, your prototype isn't for the current program; it's for an external program, the QSYGETPH API.

So why would a PR/PI pair for the current be allowed to define variables, but a PR for an external program (or procedure) not be allowed the same thing?

Well, generally you can think of it as being because when a parm value is accessed in the current program, the value is usually actually stored in the calling program's memory. You shouldn't need to declare space in the current program unless you need to make a copy of the value. The definitions in a PR/PI are nothing more than descriptions of memory that already is allocated. There is no need to declare any memory.

But when values are going to be passed to an external program, you need more than just definitions. You must create the variables themselves. The memory has to be somewhere when the called program tries to access it.

And as Dave shows, that requires a few additional specifications.

Tom
0
Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

 
LVL 1

Author Comment

by:tcfrey
ID: 13431847
Thanks to both of you.

Tom, thank you for the explination.  It will take me a little while to absorb it but, I do understand better.

Thanks Again
Thomas
0
 
LVL 27

Expert Comment

by:tliotta
ID: 13443128
Dave:

Not needed. Perhaps you've seen that I often add comments long after points have been awarded. I'm more interested in adding value to the AS/400 topic area as a whole.

In this case, most of what I added was purely personal interpretation of how I see procedure parm descriptions working. Maybe it helps illuminate for others; maybe it just makes it more confusing.

And maybe a discussion thread will expand and some real knowledge will get tacked on that will be useful to someone next year.

I'm just in it for the fun of it, I guess.

Tom
0
 
LVL 1

Author Comment

by:tcfrey
ID: 13461095
I found out after the fact. Sorry
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome to 2018! Exciting things lie ahead in the world of tech. To start things off, we compiled great member articles on how to stay safe, ways to learn, and much more! Read on to start your new year right.
If you try to migrate from Elastix to Issabel, you will face a lot of issues. These problems are inevitable but fortunately, you can fix them. In the guide below, I will explain how I performed the migration while keeping all data and successfully t…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question