Re: Command Processing Multiple Values with RPG
Peter Dow <[email protected]>
| Newsgroups | gmane.comp.lang.as400.rpg |
|---|---|
| Message-ID | <[email protected]> |
What does the command look like? An "always 0003" before the data implies to me it's telling you how many elements there are in a parameter, e.g. JOB(nbr user name) has 3 elements, job number, job userid, and job name. -- *Peter Dow* / 909 793-9050 [email protected] / On 11/11/2025 1:10 PM, Brad Stone wrote: > Heres some example data I'm seeing and some notes There is always 0003 > before the data itself. It's messed up. More reading to do I guess. > > 1 parameter > 00010004 0003C2E5 E2E3D6D6 D3E2D2E2 - ......BVSTOOLSKS 4=Offset > after length ? > F1F1F340 4040D7A3 85A2A340 A689A388 - 113 Ptest with > > 2 parameters > 00020019 00060003 C2E5E2E3 D6D5C540 - ........BVSTONE 6=Offset > after length x19=25 offset to #2 after length > D2E2F1F1 F3404040 D70003C2 E5E2E3D6 - KS113 P..BVSTO > D6D3E2D2 E2F1F1F3 404040D7 A385A2A3 - OLSKS113 Ptest > > 3 parameters > 0003002E 001B0008 0003C1D5 D6E3C8C5 - ..........ANOTHE 8=Offset > after length x2E=46 offset to #3 after length x1B=27 offset to #2 after > length > D940D2D2 D2D2D240 4040D700 03C2E5E2 - R KKKKK P..BVS > E3D6D5C5 40D2E2F1 F1F34040 40D70003 - TONE KS113 P.. > C2E5E2E3 D6D6D3E2 D2E2F1F1 F3404040 - BVSTOOLSKS113 > > 4 parameters > 00040043 0030001D 000A0003 C6D6E4D9 - ...ä........FOUR > x0A/10=Offset after length x43=67 x30=48 x1D=16 > E3C84040 D6D5C540 40404040 D70003C1 - TH ONE P..A > D5D6E3C8 C5D940D2 D2D2D2D2 404040D7 - NOTHER KKKKK P > 0003C2E5 E2E3D6D5 C540D2E2 F1F1F340 - ..BVSTONE KS113 > 4040D700 03C2E5E2 E3D6D6D3 E2D2E2F1 - P..BVSTOOLSKS1 > F1F34040 40D7A385 A2A340A6 89A38840 - 13 Ptest with > > On Tue, Nov 11, 2025 at 3:08 PM Brad Stone<[email protected]> wrote: > >> 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 >>> athttps://archive.midrange.com/rpg400-l. >>> >>> Please [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.