× 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.



You guys are the best!  Thank you Bob, Scott....

-----Original Message-----
From: Scott Klement [mailto:rpg400-l@xxxxxxxxxxxxxxxx]
Sent: Tuesday, January 25, 2005 12:43 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: Using procedure in CL Getting this error...Pointer not set
for lo cation referenced. 



>> I am once again missing the boat...  This procedure works in rpg, but 
>> not cl... The procedure AUTOF is contained in my service program, 
>> binding directory... I think it's the way something is defined in the 
>> prototype?  Any ideas?

There's a difference in the way that CL programs treat one byte return 
values versus the way RPG does.

For some reason, a CL program thinks of a 1 byte return value as a binary 
numeric value, whereas RPG thinks of it as a character string. There's 
some routine under the covers where a pointer is used to represent a 
character field, but not a numeric field. That's what causes the "pointer 
not set" error.

You can solve the problem in two ways:

a) You can use EXTPROC(*CL) on your prototype. This will require that all 
of the RPG programs that call your subprocedure be recompiled to use the 
new prototype -- but it will tell RPG to treat 1 byte return values the 
same way that CL does.

         D AUTOF           PI             1A  EXTPROC(*CL: 'AUTOF')
         D InUsrId                       10A
         D InApp                          2A


b) The other alternative is to define the return value in the CL CALLPRC 
statement as a TYPE(*CHAR) LEN(2) field. In that case, CL will treat it as 
a character field and not conflict with RPG.  You can simply use %SST() in 
your CL code to only look at the first byte of the 2 character field -- 
since that's all the RPG will modify.

Since this does not require any changes to the RPG prototype or procedure 
interface, you will not have to recompile any existing programs.

               DCL        VAR(&AUTH) TYPE(*CHAR) LEN(2) /* Use LEN=2 */
               CALLPRC    PRC(AUTOF) PARM(&USER &APPL) RTNVAL(&AUTH)

               IF (%SST(&AUTH 1 1) *EQ 'Y') DO
                   /* hooray! */
               ENDDO

Good Luck

-- 
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.