Been a bad day, Tommy? I admit that I got in the habit of using *Zeros and
*Blanks back in the RPG II days because they aligned (or whatever) the field
sizes to what was needed resulting in smaller programs (very important when
limited to 64K - with overlays, of course). Not a consideration today
(heck, I don't even know *if* there is a maximum size to a program -
apparently not in the M$ world, anyway).
Anyway, I don't see the usage of *Zeros being unmodern (sic) or retro.
Personally, I prefer *Zeros and *Blanks because they are easier to see than
0 or ' '.
Jerry C. Adams
IBM i Programmer/Analyst
The more knowledge you gained, the less certain you are of it.
--
A&K Wholesale
Murfreesboro, TN
615-867-5070
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Tommy.Holden@xxxxxxxxxxxxxxxxxxxxx
Sent: Tuesday, July 10, 2012 12:08 PM
To: RPG programming on the IBM i / System i
Subject: RE: %Parms Test Problem
Not that is *should* make a difference but try using %parms() > 0
<semi-rant>BTW I HATE *Zeros in modern day code...if it's a numeric field
then danggit use a numeric value not *ZEROS!!!</semi-rant>
Thanks,
Tommy Holden
From: "Jerry C. Adams" <midrange@xxxxxxxx>
To: "'RPG programming on the IBM i / System i'"
<rpg400-l@xxxxxxxxxxxx>,
Date: 07/10/2012 12:05 PM
Subject: RE: %Parms Test Problem
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
Okay, now you're scaring me, Gary. First, I erred when I reported that
nbrParms was 0. D**nit, I checked the variable before the line was
executed.
Anyway, I changed the interface to:
D ARQ006 PI
D #Type 2a
D Options(*NoPass)
D #Code 3a
D Options(*NoPass)
so that it explicitly agrees with the prototype. Then I ran debug against
it again. This time I checked nbrParms *after* the line was executed; the
answer is 2 when I invoked it with: CALL ARQ006 PARM(XX XXX). However,
the
code:
IF %parms() > *Zeros;
dspOption = *On;
ENDIF;
still skipped over the dspOption line. By the way, I, also, tried it as
"IF
%parms > *Zeros;" (which is how I've always done it before) - same
results.
Jerry C. Adams
IBM i Programmer/Analyst
Group thinking and decision-making result in group grope. -George Lois,
Damn
Good Advice
--
A&K Wholesale
Murfreesboro, TN
615-867-5070
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Monnier, Gary
Sent: Tuesday, July 10, 2012 11:47 AM
To: RPG programming on the IBM i / System i
Subject: RE: %Parms Test Problem
What do the parameters contain when you use CALL ARQ006 PARM('X')?
What do the parameters contain when you use CALL ARQ006 PARM('X ')?
What do the parameters contain when you use CALL ARQ006 PARM(' X')?
I'm asking because I can't tell if the parameters on the procedure
definition (PR) match the parameters on the procedure interface (PI).
Gary Monnier
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Jerry C. Adams
Sent: Tuesday, July 10, 2012 9:28 AM
To: 'RPG programming on the IBM i / System i'
Subject: RE: %Parms Test Problem
Added the code and debugged. The answer, as expected, is 0. The
question,
also expected, I hope, is Why? I called it with: CALL ARQ006 PARM('X'). I
even tried passing both parameters: CALL ARQ006 PARM(XX XXX). Still 0.
Jerry C. Adams
IBM i Programmer/Analyst
Dobie's Dogma: If you are not thoroughly confused, you have not been
thoroughly informed.
--
A&K Wholesale
Murfreesboro, TN
615-867-5070
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Monnier, Gary
Sent: Tuesday, July 10, 2012 11:17 AM
To: RPG programming on the IBM i / System i
Subject: RE: %Parms Test Problem
So how many parms does %parm say are being passed in?
D nbrparms S 10I 0
nbrparms = %parms;
Gary Monnier
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Jerry C. Adams
Sent: Tuesday, July 10, 2012 8:51 AM
To: RPG400-L
Subject: %Parms Test Problem
I am having an issue with *NOPASS and %Parms. The issue is that, when I
pass the parm, %parms is not resolving correctly.
The prototype for the program is:
D ARQ006 PR ExtPgm('ARQ006')
D Type 2a Options(*NOPASS)
D Code 3a Options(*NOPASS)
The interface is:
D ARQ006 PI
D #Type Like(iftype)
D Options(*NoPass)
D #Code Like(ifcde)
D Options(*NoPass)
The program checks for parameters:
IF %parms > *Zeros;
dspOption = *On;
ENDIF;
I invoked the program via:
CALL ARQ006 PARM('X')
When I run the program under debug, the value of #Type = 'X'. But the
program skips right over the dspOption setting.
I have used *NOPASS before (typically when I added parameters to a program
later) and then checked for the extra parms, such as:
IF %parms >= 13;
[do something]
ENDIF;
The only difference that I see here is that I may not want to pass any
parms. By way of explanation, this was an attempt to write an inquiry
program with a subfile. The program could be called as a stand alone
program, or as a selector from another program. I.e., in the latter case
the calling program asks the called program [ARQ006] which records are
available, select one and return its key fields back to the caller. As a
stand alone inquiry, it doesn't care about parameters.
Why isn't the "IF %parms > *Zeros" resulting in a true result when I
invoke
it with "CALL ARQ006 PARM('X')"?
Thanks.
Jerry C. Adams
IBM i Programmer/Analyst
You can never tell which way the train went by looking at the track. Only
by the splatter of the blood stains
--
A&K Wholesale
Murfreesboro, TN
615-867-5070
--
This is the RPG programming on the IBM i / System i (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.
--
This is the RPG programming on the IBM i / System i (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.
--
This is the RPG programming on the IBM i / System i (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.
--
This is the RPG programming on the IBM i / System i (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.