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



Oh Sh*t! I missed the VARY(*YES) on the Command Source!!!
When you use VARY(*YES) it passes an addition two-byte integer on the
beginning of each value sent to the parm, in this case, each item on
your list.

So either change the source for the command to avoid VARY(*YES) or add
more code to your RPG command processing program.  Remember, with a
command, all the values will be padded with blanks, so there's not a big
reason to use VARY(*YES) unless you need to know the length of the
parameter string passed to the command. Which for a parm such as an
Object name, seem like overkill to me.

Bob Cozzi
cozzi@rpgiv.com
Visit the new on-line iSeries Forums at: http://www.rpgiv.com/forum

> -----Original Message-----
> From: rpg400-l-admin@midrange.com [mailto:rpg400-l-admin@midrange.com]
On
> Behalf Of rob@dekko.com
> Sent: Tuesday, December 11, 2001 4:59 PM
> To: rpg400-l@midrange.com
> Subject: RE: Prototype for a command parameter.
>
>
> So now I've got:
>      D SROBJFTPR       PI
> *ENTRY
>      D  ObjList                            like(ObjListDS)
> ...
>      D ObjListDs       DS
>      D  NbrElem                       2b 0
>      D  Obj                          10a   dim(300)
> ...
>       /free
>        ObjListDS=ObjList;
>        *inlr=*on;
>        return;
>       /end-free
>
> In debug, a break on the *inlr line shows the following:
> ObjList=null
> While in hex it is equal to
> 00020001E74040404040404040400001E8404040404040404040
> Now, I passed it, and the two object names, X and Y,  or in hex E7 and
E8.
>
> I understand the 0002 is the number of elements.  Why does each
element
> begin with hex0001?
>
> Perhaps there is some strange bug in the Code/400 debugger that
assumes
> that if the first position is hex'00' then the whole variable is null.
>
>
> NbrElem=2
> OBJ(1), OBJ(2), OBJ(3) are all null
> OBJ(4, and on) start to show the values of the other parameters passed
in.
>
> So then I changed to:
> ...
>      D SROBJFTPR       PI
> *ENTRY
>      D  ObjList                            like(ObjListDs)
> ...
>      D ObjListDs       DS
>      D  eObjList                      2b 0
>      D  aObjList                     12a   dim(300)
>      D   eObj                         5i 0 overlay(aObjList)
>      D   Obj                         10a   overlay(aObjList:*next)
> ...
>
> Not very consistent on the 2b or 5i but it does show you they are
> interchangable.
>
> I tried to define ObjList as varying but the %len of it was always
equal to
> eObjList.  Two, which we know is the number of elements and not the
length
> of the variable.
>
>
> Rob Berendt
>
> ==================
> "They that can give up essential liberty to obtain a little temporary
> safety deserve neither liberty nor safety."
> Benjamin Franklin
>
>
>
>                     "Bob Cozzi
>                     \(RPGIV\)"              To:
<rpg400-l@midrange.com>
>                     <cozzi@rpgiv.com>       cc:
>                     Sent by:                Fax to:
>                     rpg400-l-admin@mi       Subject:     RE: Prototype
for a
> command parameter.
>                     drange.com
>
>
>                     12/11/2001 05:02
>                     PM
>                     Please respond to
>                     rpg400-l
>
>
>
>
>
>
> The parameter will be sent as a list value since you have MAX(300)
> specified.
> The first two bytes will contain a 2-byte binary (or "short" integer)
> value that identifies the number of elements sent on the list.
>
> Your parm will need to be MOVEL'd to a data structure that has
something
> like this defined:
>
> D List      DS
> D  nCount                  5I 0
> D  ObjectList             10A    DIM(300)
>
>
>
> Bob Cozzi
> cozzi@rpgiv.com
> Visit the new on-line iSeries Forums at: http://www.rpgiv.com/forum
>
> > -----Original Message-----
> > From: rpg400-l-admin@midrange.com
[mailto:rpg400-l-admin@midrange.com]
> On
> > Behalf Of rob@dekko.com
> > Sent: Tuesday, December 11, 2001 2:45 PM
> > To: rpg400-l@midrange.com
> > Subject: Prototype for a command parameter.
> >
> >
> > I have a command parameter set up like:
> >              PARM       KWD(OBJ) +
> >                         TYPE(*GENERIC) +
> >                         LEN(10) +
> >                         SNGVAL( +
> >                           (*ALL )) +
> >                         MIN(1) +
> >                         MAX(300) +
> >                         EXPR(*YES) +
> >                         VARY(*YES) +
> >                         PROMPT('Objects')
> >
> > On the screen it looks like:
> > Objects  . . . . . . . . . . . .  __________     Name, generic*,
*ALL
> >                + for more values  __________
> > How do I define this in my PR and PI?
> > I tried the following
> >      D  Obj                        3002a   options(*varsize)
> > and
> >      D  Obj                        3002a   varying
> > and in debug they were both null.
> >
> > Rob Berendt
> >
> > ==================
> > "They that can give up essential liberty to obtain a little
temporary
> > safety deserve neither liberty nor safety."
> > Benjamin Franklin
> >
> > _______________________________________________
> > 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.