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



Here is my take. I changed the command definition to have the quantity as a
9/2 and without the hex character. My guess was that you put them in that
way because you thought you were going to have to search for the end of
item.

CMD PROMPT('test command')
PARM KWD(BOXING) TYPE(BOX_DATA) MAX(10) +
PROMPT('Boxing Data')
BOX_DATA: ELEM TYPE(*CHAR) LEN(20) PROMPT('LUCAS Box Id')
ELEM TYPE(*CHAR) LEN(1) PROMPT('Box Type')
ELEM TYPE(*DEC) LEN(9 2) PROMPT('Box Qty')


The trick is that you have the offsets at the beginning of the list and it
is a variable list. If you have three entries, it will six bytes long. If
you have 4 entries 8 bytes long so you have to process as a variable list.

**FREE
ctl-opt Option(*SrcStmt:*NoDebugIO:*NoUnRef);
ctl-opt Main(TestIt);

dcl-pr Testit ExtPgm('TESTCMD1');
PR_InList LikeDs(TD_List) Const;
end-pr;

dcl-ds TD_List Qualified;
FullList Char(352);
NumberOfEntries Int(5) Overlay(FullList);
Offsets Int(5) Dim(10) Overlay(FullList:*Next);
end-ds;

//* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//* Test Counter cost
//* Input - Number of loops to do
//* Out - None
//* Returns - None
//*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
dcl-proc TestIt;
dcl-pi *N;
InList LikeDs(TD_List) Const;
end-pi;

dcl-ds Item Qualified;
NumberOfElements Int(5);
BoxId Char(20);
BoxType Char(1);
BoxQty Packed(9:2);
end-ds;

dcl-s x Int(5);

For x = 1 To InList.NumberOfEntries;
Item = %Subst(InList.FullList:
InList.Offsets(x) + 1:
%Size(Item));
// Process Item
EndFor;

Return;

end-proc;

On Fri, Jan 13, 2017 at 1:46 PM, Jeff Young <jyoung0950@xxxxxxxxx> wrote:

Does anyone have an RPGLE example of processing this type of a list where
there can be multiple entries?


Jeff Young
Sr. Programmer Analyst

On Fri, Jan 13, 2017 at 4:28 PM, Brian Parkins <goodprophet.bp@xxxxxxxxx>
wrote:

This might help,

http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/rbam
6/defdlclhll.htm

Brian.

-----Original Message----- From: Jeff Young
Sent: Friday, January 13, 2017 8:26 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Processing a List from a command


All,
I have a command that defines a list consisting of a maximum of 10
entries
of 4 elements each as follows:
PARM KWD(BOXING) TYPE(BOX_DATA) MAX(10) +
PROMPT('Boxing Data')
BOX_DATA: ELEM TYPE(*CHAR) LEN(20) PROMPT('LUCAS Box Id')
ELEM TYPE(*CHAR) LEN(1) PROMPT('Box Type')
ELEM TYPE(*CHAR) LEN(9) PROMPT('Box Qty') +
CHOICE('ie. "000000100" is 1')
ELEM TYPE(*HEX) LEN(1) CONSTANT(X'25')

In my program, I define it as a 310 byte character field:
c Parm inBoxData 310
When I execute the command with a single entry, I get the following data
returned:
EVAL INBOXDATA :X
00000 00010004 0004F1F2 F4F5F4F5 F4C1C1C1 - ......1245454AAA
00010 40404040 40404040 4040C7F0 F0F0F0F0 - G00000
00020 F0F2F0F0 25404040 40404040 40404040 - 0200.
00030 40404040 40F04040 40404040 40404040 - 0
00040 40404040 40404040 40404040 40404040 -
00050 40404040 40404040 40404040 40404040 -
00060 40404040 40404040 40404040 40404040 -
00070 40404040 40404000 00000000 00000000 - .........

I know that the first 2 bytes are the number of entries, but what are the
next 4 bytes before the start of my data?

TIA


Jeff Young
Sr. Programmer Analyst
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (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.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (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.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (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.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD


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.