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



Right, the "when that field is referenced" is the key point.


-----Original Message-----
From: rpg400-l-admin@midrange.com [mailto:rpg400-l-admin@midrange.com]
On Behalf Of Bartell, Aaron L. (TC)
Sent: Monday, November 18, 2002 10:28 AM
To: 'rpg400-l@midrange.com'
Subject: RE: What's the difference?

I am right.    ;-)

I didn't say that it did the check at compile time, I was assuming
everyone
knew that it would be done at run-time(my fault for assuming).  I was
coming
from the stand point of if program A called program B with 0 (zero)
parameters, but program B was expecting 1 parameter then program B would
come up with a "pointer not set for location reference" error when that
field was referenced; similar to what you are describing below but a
little
different. . .

Aaron Bartell

-----Original Message-----
From: Bob Cozzi [mailto:cozzi@rpgiv.com]
Sent: Monday, November 18, 2002 10:17 AM
To: rpg400-l@midrange.com
Subject: RE: What's the difference?


You are wrong.
Procedures need to have the *NOPASS specified otherwise the compiler
will not let you call them with missing parameters. Which you obviously
already know.
Programs, on the other hand, work a little differently. When a program
calls another program and passes parameters, the parameters are not
checked to see if they match what is required by the called program.
As the called program runs, if it "touches" any of the parameters then
the check is performed. Now "touching" a parameter can take on many
forms. But if you use a simply *ENTRY/PLIST without mapping the parms
into a data structure, then you can also use %PARMS to check for
un-specified parameters and simply avoid touching them. This allows you
to call a program with 10 parameters defined and only pass 3.  Just
don't touch parms 4 through 10 and you can get away with anything.
Bob Cozzi

-----Original Message-----
From: rpg400-l-admin@midrange.com [mailto:rpg400-l-admin@midrange.com]
On Behalf Of Bartell, Aaron L. (TC)
Sent: Monday, November 18, 2002 10:08 AM
To: 'rpg400-l@midrange.com'
Subject: RE: What's the difference?

I should have given an example.  Below I have an example of a
sub-procedure
doing a chain to a file (DB separation concept).  If I want to lock the
file
I pass the last parameter.  If I don't want it locked I don't even have
to
know that there is a last parameter.  If I tried to do this from one
program
to another vs from a program to sub-procedure I would get a "pointer not
set. . ." type message.  Correct me if I am wrong.

     P chainFile01     B                   export
     D chainFile01     pi             1
     D  pKey1                         3  0 value
     D  pKey2                         3  0 value
     D  pKey3                        20    value
     D  pLock                         1    value options(*nopass)
      *------------------
     C     kFile01       klist
     C                   kfld                    pKey1
     C                   kfld                    pKey2
     C                   kfld                    pKey3

     C                   if        %parms = 3 or pLock = *off
     C     kFile01       chain(n)  File01
     C                   else
     C     kFile01       chain     File01
     C                   endif

     C                   return    %found(File01)
      *-------------------------------
     P chainFile01     E

Program that uses above sub-procedure:
 * lock the file
C          callp      chainFile01(Key1:Key2:Key3:*on)
 * dont lock the file
C          callp      chainFile01(Key1:Key2:Key3)


Aaron Bartell

-----Original Message-----
From: Buck Calabro [mailto:Buck.Calabro@commsoft.net]
Sent: Monday, November 18, 2002 9:56 AM
To: rpg400-l@midrange.com
Subject: RE: What's the difference?


>To add to Buck's list I also like the ability
>to NOT pass a parameter if it is not needed
>-- options(*nopass).

The called program can test %parms just like a subprocedure can, so I
think
this works for procs and progs.

c     *entry        plist
c                   parm                    inCount

c                   if        %parms < 1
c                   eval      loopLimit = 1000
c                   else
c                   eval      loopLimit = inCount
c                   endif

  --buck
_______________________________________________
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.



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

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.