Thanks Eric,
I'll take your suggestion. Nevertheless I'm curious why this works in
interactive mode and not in batch.
Johan Vangilbergen
YUSE
Phone : +32 16 74 50 80
Fax : +32 16 74 50 89
Email : jvg@xxxxxxx
Web : WWW.Yuse.be
Address : Bondgenotenlaan 138, B-3000 Leuven, Belgium
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[
mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of DeLong, Eric
Sent: donderdag 5 april 2007 15:35
To: RPG programming on the AS400 / iSeries
Subject: RE:
Well, when parameters are not passed, the address of the parameter
variable never gets assigned. Without a storage address, there's
nothing for the Clear opcode to work with, and you get the error you're
seeing.
The whole point of this is, if you know the parm wasn't passed, then
don't reference it at all in your program. It's common to make two
declarations of your parameter fields, say p_Date and l_Date. In your
initialization, when you determine a parm was passed, simply eval l_date
= p_date. When not passed, you may initialize l_date to whatever is
appropriate. At that point, you never refer to p_Date again.
Eric
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[
mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Johan Vangilbergen
Sent: Thursday, April 05, 2007 8:19 AM
To: RPG programming on the AS400 / iSeries
Subject:
I am puzzled !
I'm calling a subprocedure. This subprocedure has 4 parameters in its
procedure interface. Only the first is required, the three others have
the option *NOPASS.
D Patientadmit PI N
D Cazi Like(CaziDp) Const
D Date D Const Options(*Nopass)
D Key1 Like(Key1Dp) Const
Options(*Nopass)
D Key2 Like(Key2Dp) Const
Options(*Nopass)
D Datu S 8 0
/Free
If %Parms <= 2;
Clear Key1;
Clear Key2;
Endif;
If %Parms = 1;
Datu = %Int(%Char(%Date():*Iso0));
Else;
Datu = %Int(%Char(Date:*Iso0));
Endif ;
I'm calling this subprocedure in the following way :
C If PatientAdmit(CaziHo:%Date(DateHo:*Iso))
C ... Do some stuff
C EndIf
When I run this interactively, all goes well. However, if I run this in
batch, the procedure crashes on the "Clear Key2" statement, saying that
the pointer or location was not referenced.
What am I missing ?
Maybe, I have to say that the subprocedure is part of a service program
which is bound to the calling program.
Johan Vangilbergen
YUSE
Phone : +32 16 74 50 80
Fax : +32 16 74 50 89
Email : jvg@xxxxxxx <
mailto:jvg@xxxxxxx>
Web : WWW.Yuse.be <
http://www.Yuse.be>
Address : Bondgenotenlaan 138, B-3000 Leuven, Belgium
As an Amazon Associate we earn from qualifying purchases.