Re: Command Processing Multiple Values with RPG

Brad Stone <[email protected]>
Newsgroups gmane.comp.lang.as400.rpg
Message-ID <CAAGV8OczdEsFObXFfbKsp3T1rTCf7N001KFhdqSvLsrjK9ck0g@mail.gmail.com>
Will do.

The first one appears to be close to what I am figuring out.  I'll dig
deeper.  Thanks again.

On Tue, Nov 11, 2025 at 3:07 PM Peter Dow <[email protected]> wrote:

> Hi Brad,
>
> Try the "CL Programming" manual, SC41-5721-05, the section on "Defining
> Lists for Parameters". It has examples on exactly what is passed to the
> CPP.
>
> --
> *Peter Dow* /
> 909 793-9050
> [email protected]
> /
>
> On 11/11/2025 12:37 PM, Brad Stone wrote:
> > I have a few RPG programs that are processing programs for CMD
> interfaces.
> >
> > Some have the option to send multiple values.  I've always just defined
> the
> > parameter as a data structure with a binary value to hold the "count" of
> > options.. For example:
> >
> > PARM       KWD(NAME) TYPE(*CHAR) LEN(60) MIN(1) +
> >               MAX(10) CASE(*MIXED) PROMPT('Name')
> >
> > dcl-ds NameDSDef Qualified;
> >    NumName Bindec(4) Pos(1);
> >    Name char(60) dim(10); //*NONE
> > end-ds;
> >
> > The the parameter is defined as:
> > NameList likeds(NameDSDef);
> >
> > This filles the Name.Name array as it should.
> >
> > But now I have parameters that have multiple parts to them and it's not
> > working quite the same way.
> > PARM       KWD(ADDRESS) TYPE(ADDDEF) MIN(1) +
> >               MAX(10) PROMPT('Address')
> >
> > ADDDEF:     ELEM       TYPE(*CHAR) LEN(100) CASE(*MIXED) +
> >                           PROMPT('Address')
> >                       ELEM       TYPE(*CHAR) LEN(2) +
> >                           PROMPT('State')
> >
> > dcl-ds AddressDSDef Qualified;
> >    NumAddress Bindec(4) Pos(1);
> >    Address char(100) dim(10);
> >    State char(2) dim(10);
> > end-ds;
> >
> > Then the parameter is defined as:
> > AddressList likeds(AddressDSDef);
> >
> > This seems to add more data in the front, not just the count.
> >
> > Let's say there are 3 items in the list.... The string appears to be
> > count, offset to item 3, offset to item 2, offset to item 1, x'0003',
> then
> > the data.... etc...
> >
> > So before each data item is x'0003' and the offsets appear to be the
> offset
> > AFTER the count value.
> >
> > I've been searching for some sort of documentation or examples for this,
> > but I've come up short.   AI is pretty useless when it comes to this.
> >
> > I'm sure I'm doing something wrong, but I can't find any docs or
> examples.
> > It's been years since I've done commands and yes, this has to be a
> > command.  :)
> >
> > Thanks!
> >
> >
> > Bradley V. Stone
> > www.bvstools.com
> > Native IBM i e-Mail solutions for Microsoft Office 365, Gmail, or any
> Cloud
> > Provider!
> --
> This is the RPG programming on IBM i (RPG400-L) mailing list
> To post a message email: [email protected]
> To subscribe, unsubscribe, or change list options,
> visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: [email protected]
> Before posting, please take a moment to review the archives
> at https://archive.midrange.com/rpg400-l.
>
> Please contact [email protected] for any subscription related
> questions.
>
>
-- 
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact [email protected] for any subscription related questions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.