× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Arthur,

Your question has already been answered (looks like you're making a foray into both procedures & embedded sql), but I have some asides for you in regard to procedures:

If you're on IBM i 7.1, you don't need the prototype for your procedure if the procedure is not exported.

Since you're new to procedures, I suggest making sure you learn as much as possible on passing parameters.
http://publib.boulder.ibm.com/infocenter/iadthelp/v7r0/index.jsp?topic=/com.ibm.etools.iseries.pgmgd.doc/c0925076144.htm

You should be able to find some discussions on the use of Value vs Const in the archives. Here's one such thread:
http://archive.midrange.com/rpg400-l/201304/msg00277.html

Best of luck with procedures. I can't imagine coding without them.

-Kurt

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of arthur perkins
Sent: Friday, September 06, 2013 11:28 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Newbie To Procedures With Problem

Hi all,
 
I'm new to the world of procedures. I am in the process of learning to develop procedures on the Iseries and have run into the following problem:
 
I am developing a procedure that takes an alphanumeric field and converts it to numeric. My problem is that I defined the local variable in the procedure
yet the compile crashes because it says it can't find the object. The code in question is below:
 
d GetPostDate     pr                  like(postdate)         
d   org1                                     like(emporgun1) value  

 
 
GetPostDate     b                                                              
GetPostDate     pi                  like(postdate)                             
Org1                                      like(emporgun1) value                      
ReturnValue     s                   like(postdate)                             
OrgComp#        s              4  0                                            
free                                                                           
                                                                               
  // Convert the company# from character to numeric for the SQL exec command.  
                                                                               
    OrgComp# = %dec(Org1:4:0);                                                 
                                                                               
  // Retrieve the record from DBIFGLS for the company being processed.         
                                                                               
    exec sql select * into :ds_dbifgls from dbifgls where DGLSCMPNY =          
                            OrgComp#;                                          

Here is the error message from the compile below:
 
...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8
              exec sql set option commit = *none, naming = *sys;               
                                  OrgComp#;                                     
 
Position 36 Object ORGCOMP# in *LIBL not found.   

To me, everything looks ok and is a relativly simple procedure. What am I doing wrong or missing?
 
Thanks,
 
Arthur

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.