?
Solved

Scratching my head.

Posted on 2005-02-25
7
Medium Priority
?
2,096 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
7 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
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
What's worse than having your data encrypted by ransomware? Getting attacked by a so-called "wiper," which simply destroys the data and offers you no hope of ever seeing it again.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month12 days, 1 hour left to enroll

752 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