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

when i try to compile this code i get the following error:

CPD5D02    Diagnostic              30   08.04.04  10:40:09,477792  QBNBIND      
QSYS        *STMT    QBNBIND 
                                     From module . . . . . . . . :   QBNBSYMR   
                             
                                     From procedure  . . . . . . :   
QBNBSYMR__UnresolvedReferenceIterator   
                                     Statement . . . . . . . . . :   31         
                             
                                     To module . . . . . . . . . :   QBNBSYMR   
                             
                                     To procedure  . . . . . . . :   
QBNBSYMR__SignalUnresolvedReferences    
                                     Statement . . . . . . . . . :   8          
                             
                                     Message . . . . :   Definition für Symbol 
'WRITE' nicht gefunden.       
                                     Ursache  . . . . :  Für Referenz WRITE in 
*MODULE Objekt BS_SUBS der    
Bibliothek QTEMP wurde keine Definition gefunden. Entweder ist die          
Definition nicht vorhanden, oder sie gehört nicht zu demselben Datentyp oder
derselben Prozedurart wie die Referenz.Fehlerbeseitigung:  Den Befehl CRTPGM
(Programm erstellen) wiederholen, wobei ein Objekt angegeben wird, das eine 
Definition für Symbol WRITE enthält.                                        

in english that would be something like:
Can't find symbol WRITE.
No definition found for the reference WRITE in *MODULE object BS_SUBS in 
library QTEMP.

i'm quite new to this so perhaps someone could help me with this.

> -----Ursprüngliche Nachricht-----
> Von: Scott Klement [mailto:klemscot@xxxxxxxxxxxx] 
> Gesendet: Donnerstag, 8. April 2004 09:59
> An: RPG programming on the AS400 / iSeries
> Betreff: Re: return value of a rpg program
> 
> 
> 
> Hello Mihael,
> 
> > is it possible in rpg to return a value from a program. i 
> don't mean to
> > get a return value of a procedure.
> 
> Actually, that's not what you're looking for.  Please read on...
> 
> > i like to do something in perl like this:
> > $myvar = `system myrpgprogram`;
> 
> 
> This code does not get the return value of your program.  
> Instead, what it
> does is load $myvar with any data that your program writes to STDOUT.
> Again, assuming that you're working with QShell which is a
> descriptor-based environment, you can write to STDOUT by 
> writing data to
> descriptor #1.
> 
> If you're not using QShell then you may have to use the QtmhWrStout to
> write to stdout, or else enable descriptor I/O by setting the 
> appropriate
> environment variable.  I haven't experimented with the environment
> variable, though...
> 
> Also the QShell "system" program is for running CL commands, 
> not calling
> programs.  You can call a program directly by using it's IFS 
> pathname, you
> don't need "system".  For example, to call a program called "MYPGM" in
> library "MYLIB" you'd specify:
>    /qsys.lib/MYLIB.lib/MYPGM.pgm
> 
> 
> > but i don't know how i should define my prototype in the 
> rpg program.
> > the rpg program name is BS_SUBS. it tried it like this:
> >
> > DMain             PR            10A   EXTPGM('BS_SUBS')
> > D  subname                      10A
> > D  sublib                       10A
> >  *
> >  *Entry list (parameter)
> > DMain             PI            10A
> > D  subname                      10A
> > D  sublib                       10A
> >
> > but it says that a return value is not supported with 
> EXTPGM key word.
> 
> That's correct.  RPG cannot return a value from a program.  
> However, the
> perl code that you've posted doesn't use the return value 
> anyway, so it
> doesn't matter.  It reads data from the program's stdout, as 
> I mentioned
> above.
> 
> Here's a sample ILE RPG program that writes data using descriptor I/O:
> 
>      H DFTACTGRP(*NO)
> 
>      DMain             PR                  EXTPGM('BS_SUBS')
>      D  subname                      10A
>      D  sublib                       10A
> 
>       *Entry list (parameter)
>      DMain             PI
>      D  subname                      10A
>      D  sublib                       10A
> 
>      D write           PR            10I 0 extproc('write')
>      D   fd                          10I 0 value
>      D   data                     32767A   options(*varsize) const
>      D   len                         10I 0 value
> 
>      D mydata          s            100A   varying
> 
>       *
>       *  QShell null-terminates it's parms.  Here we use the %str()
>       *  bif to extract the full parm into a string that we can
>       *  write to stdout:
> 
>      c                   if        %parms >= 2
> 
>      c                   eval      mydata = 'parms were '
>      c                                    + 
> %str(%addr(subname)) + ', '
>      c                                    + %str(%addr(sublib))
>      c                                    + x'0D25'
> 
>      c                   else
> 
>      c                   eval      mydata = 'no parameters 
> were passed!'
>      c                                    + x'0D25'
> 
>      c                   endif
> 
> 
>       *
>       * Write "mydata" to standard output.  It is assumed that we
>       * are using descriptor 1 for stdout, for compatibility with
>       * Qshell...
>       *
>      c                   callp     write(1: mydata: %len(mydata))
> 
> 
>      c                   eval      *inlr = *on
> 
> 
> I tested this program by calling it from the following trivial Perl
> script:
> 
>     $myvar = `/qsys.lib/MYLIBRARY.lib/bs_subs.pgm testparm1 
> testparm2`;
>     print $myvar
> 
> 
> When that perl script is run from QShell, it executes the 
> program called
> BS_SUBS in library MYLIBRARY.  It passed two parameters 
> "testparm1" and
> "testparm2"
> 
> If you run that perl script, the output looks like this:
> 
> --------------------------------------------------------------
> --------------
>                               QSH Command Entry
>   $
> > perl test.pl
>   parms were testparm1, testparm2
>   $
> 
> 
> --------------------------------------------------------------
> --------------
> 
> 
> Hope that helps...
> _______________________________________________
> 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-Ups:

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.