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



It looks like you have two distinct objects.  The main procedure and the
sub-procedure and are binding them together.  This makes the data file
fields in the sub-procedure available only to the sub-procedure.  They will
have to be passed back to the calling procedure.

Some examples would be:
As a parameter on the call
As a data structure in the return value
Place the data into another object like a user space that the calling
procedure would read after the call.

I'm sure there are other ways to achieve this also.

HTH

Rick

 -----Original Message-----
From:   fkany@averittexpress.com [mailto:fkany@averittexpress.com]
Sent:   Friday, November 22, 2002 10:36 AM
To:     rpg400-l@midrange.com
Subject:        RE: Main Proc for Subproc not compiling


With the changes Scott suggested the Main Procedure and the External
Subprocedure both compile and run as I would like.  In the Main Procedure,
I'd like to use the record information from the CHAIN operation in the
subprocedure.  What would be a good way to do this?  This is my first time
working with subprocedures so if anyone sees anything that I'm doing wrong
or anything that isn't necessary, please share some pointers to set me
straight so that I can code these things properly in the future.  Thanks
for all your time in helping me understand subprocedures.

Frank

UPDATED CODE:

> ==============
> Main Procedure
> ==============
> <snip>
>  *
>  * Procedure Prototype
> D AAL03_VAL       PR             4A
> D SRVCTR                         3A
> D STS_IN                         1A
>  *
   * Procedure PR fields
  D SVCCTR          S              3A
  D STS_IN          S              1A
<snip>
>   *
>   * Service Center entered
>  C                   IF        S01SVCCTR <> *BLANKS
>   *
>   * -----------------------
>   * Validate Service Center
>   * -----------------------
>   * Record Found
>  C                   IF        AAL03_VAL(SVCCTR : STS_IN) = '1'
>  C                   EVAL      S01CTRNME = CT1NAM
>  C
>   * Record NOT Found
>  C                   ELSE
>  C                   CLEAR                   S01CTRNME
    *
>  C                   ENDIF
    * IF AAL03_VAL(STS_IN)
> <snip>
> ==================
> End Main Procedure
> ==================
>
> =====================
> Complete Subprocedure
> =====================
> H NOMAIN
>  *
>  * Files
> FAAL03002  IF   E           K DISK
>  *
>  * Procedure Prototype
> D AAL03_VAL       PR             4A
> D SVCCTR                         3A
> D STS_IN                         1A
>  *
> P AAL03_VAL       B                   EXPORT
>  *
>  * Procedure Interface
> D AAL03_VAL       PI             4A
> D SVCCTR                         3A
> D STS_IN                         1A
>  *
>  * Validate against Terminal Control File(AAL03002)
> C     SVCCTR        CHAIN     AAL03002
>  *
>  * Record Found
  C                   IF        %FOUND(AAL03002)
> C                   EVAL      STS_IN = '1'
> C
>  *
   * Record NOT Found
> C                   ELSE
> C                   EVAL      STS_IN = '0'
>  *
  C                   ENDIF
>  * IF %FOUND(AAL03002)
   *
> C                   RETURN    STS_IN
>  *
> P AAL03_VAL       E





Scott Mildenberger <Smildenber@Washcorp.com>@midrange.com on 11/22/2002
08:43:02 AM

Please respond to rpg400-l@midrange.com

Sent by:  rpg400-l-admin@midrange.com


To:   "'rpg400-l@midrange.com'" <rpg400-l@midrange.com>
cc:

Subject:  RE: Main Proc for Subproc not compiling


1. The main procedure only needs the prototype(PR) for the subprocedure,
not
the procedure interface(PI).  One doing this for real use a /copy to bring
in the prototype so it is only defined once.

2. When you are calling the procedure you are only passing one parameter
but
the procedure requires two.

3.  You have defined the return value as being of size 4 although it looks
like you are only passing a size of 1 back.  This isn't causing an error
but
it looks inconsistent so I'm pointing it out.

4.  In your subprocedure, why have two different If statements?  Just use
the else for the second condition.

Scott Mildenberger

> -----Original Message-----
> From: fkany@averittexpress.com [mailto:fkany@averittexpress.com]
> Sent: Friday, November 22, 2002 7:40 AM
> To: RPG400-L@midrange.com
> Subject: Main Proc for Subproc not compiling
>
>
> I'm working on trying to compile my first subprocedure.  The
> subprocedure
> compiles fine.  The main procedure is not compiling.  Can
> anyone see what
> I'm doing wrong?  Thanks everyone.
>
> Frank
>
> ==============
> Main Procedure
> ==============
> <snip>
>  *
>  * Procedure Prototype
> ***Error from Compile:  External procedure on prototype for
> main procedure is not same as actual external name.
> D AAL03_VAL       PR             4A
> D SRVCTR                         3A
> D STS_IN                         1A
>  *
>  * Procedure Interface
> D AAL03_VAL       PI             4A
> D SRVCTR                         3A
> D STS_IN                         1A
>
> <snip>
>
>   *
>   * Service Center entered
>  C                   IF        S01SVCCTR <> *BLANKS
>   *
>   * -----------------------
>   * Validate Service Center
>   * -----------------------
>   * Record Found
>  C                   IF        AAL03_VAL(STS_IN) = '1'
> ***Errors from Compile: The call passed fewer parameters than
> the prototype indicates are required.
>                         The type and attributes of the
> parameter do not match those of the prototype.
>  C                   EVAL      S01CTRNME = CT1NAM
>  C                   ENDIF
>   * Record NOT Found
>  C                   IF        AAL03_VAL(STS_IN) = '0'
> ***Errors from Compile: The call passed fewer parameters than
> the prototype indicates are required.
>                         The type and attributes of the
> parameter do not match those of the prototype.
>  C                   CLEAR                   S01CTRNME
>  C                   ENDIF
>
> <snip>
> ==================
> End Main Procedure
> ==================
>
> =====================
> Complete Subprocedure
> =====================
> H NOMAIN
>  *
>  * Files
> FAAL03002  IF   E           K DISK
>  *
>  * Procedure Prototype
> D AAL03_VAL       PR             4A
> D SVCCTR                         3A
> D STS_IN                         1A
>  *
> P AAL03_VAL       B                   EXPORT
>  *
>  * Procedure Interface
> D AAL03_VAL       PI             4A
> D SVCCTR                         3A
> D STS_IN                         1A
>  *
>  * Validate against Terminal Control File(AAL03002)
> C     SVCCTR        CHAIN     AAL03002
>  *
> C                   IF        %FOUND(AAL03002)
> C                   EVAL      STS_IN = '1'
> C                   ENDIF
>  *
> C                   IF        NOT %FOUND(AAL03002)
> C                   EVAL      STS_IN = '0'
> C                   ENDIF
>  *
> C                   RETURN    STS_IN
>  *
> P AAL03_VAL       E
>
_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
or email: RPG400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.




_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
or email: RPG400-L-request@midrange.com
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.