Re: Command Processing Multiple Values with RPG
Brad Stone <[email protected]>
| Newsgroups | gmane.comp.lang.as400.rpg |
|---|---|
| Message-ID | <CAAGV8OfiP-U+UmjDNN9c8UazG-vc4rU1HYRMxR8czhLw08wPqA@mail.gmail.com> |
Thanks, Daniel ! I will give it shot! On Wed, Nov 12, 2025 at 7:20 AM Brad Stone <[email protected]> wrote: > Ah, that makes sense, Peter. Yes, there are 3. > > Im actually making a SNDDST clone for a couple customers that don't want > to change their programs when they need to move to OAuth. But that answers > that. > > I got a couple old CL manuals now to look at as well. > > On Tue, Nov 11, 2025 at 8:52 PM Daniel Gross <[email protected]> wrote: > >> P.S.: This is how the parameter should be defined in RPG in your case: >> >> dcl-ds address_parm qualified; >> entries uns(5); // actual number of addresses >> dcl-ds entry dim(10); >> elements uns(5); // in this case always 2 >> address char(100); >> state char(2); >> end-ds; >> end-ds; >> >> Now hopefully that makes sense. >> >> >> > Am 12.11.2025 um 03:21 schrieb Daniel Gross <[email protected]>: >> > >> > Hi Peter, >> > >> > when the CL manual is referring to a "mixed list" parameter, it means, >> that you have a parameter defined with multiple elements. >> > >> > For example something like the LOG parameter of the CHGJOB command: >> > >> > LOG(4 0 *SECLVL) >> > >> > This is already a mixed list with 3 elements. >> > >> > Therefore the like always has a binary prefix of 0x0003 - and then the >> elements as if they were defined as single parameters. That binary prefix >> is ALWAYS 0x0003 for an mixed list with 3 parts - it only changes to 0x0001 >> if you have the *SNGVAL option set for the parameter. >> > >> > Now in your case, you have a "list of mixed lists": >> > >> >> PARM KWD(...) TYPE(ADDDEF) MIN(1) MAX(10) >> >> >> >> ADDDEF: ELEM TYPE(*CHAR) LEN(100) ... >> >> ELEM TYPE(*CHAR) LEN(2) ... >> > >> > >> > You will receive a parameter consisting of: >> > >> > - binary number of actually list entries >> > example: 0x0002 = 2 entries >> > - 1st list entry >> > - binary number of mixed list elements >> > fix: 0x0002 = 2 elements in mixed list >> > - char(100) >> > - char(2) >> > - 2nd list entry >> > - binary number of mixed list elements >> > fixed: 0x0002 = 2 elements in mixed list >> > - char(100) >> > - char(2) >> > >> > So the list of mixed lists is prefixed with the actual number of values >> entered in the command. >> > >> > And wvery mixed list entry of that list is itself prefixed with the >> number of elements in the mixed list. >> > >> > I know this looks puzzling at first, but makes sense if the mixed list >> uses the *SNGVAL option. And it also makes sense, when you look at the >> actual command line: >> > >> > ADDRESS( ('...' '...') ('...' '...') ) >> > >> > This is a "list of lists" - as each entry itself is enclosed in ( ) - >> and the whole list parameter is enclosed in ( ). >> > >> > I hope this all makes some sense now. Here are the IC pages to read >> about "simple lists" and "mixed lists" - you have to combine both to get to >> the "list of mixed lists" type of parameter: >> > >> > -> >> https://www.ibm.com/docs/en/i/7.6.0?topic=dslcp-using-cl-other-hlls-simple-list-cl-command-parameters >> > >> > -> >> https://www.ibm.com/docs/en/i/7.6.0?topic=parameter-defining-mixed-list-cl-command >> > >> > HTH >> > Daniel >> > >> > >> >> Am 12.11.2025 um 02:05 schrieb Peter Dow <[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. >> >> >> > -- >> > 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. >> >> -- 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.