|
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.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.