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



Evan,

Actually most any language could be used though it is a bit more
wordy in CL.  It's nothing fancy and I just threw it together
so there may be some minor bugs (but it does display the choices :-))
but here is a sample command and choices program to display the
valid language ids on a system  (I use this as an example because this API
will run on any reasonably current AS/400 and avoids having to hardcode
the choice text).

Command source
              CMD        PROMPT('Choices Command')
              PARM       KWD(CHOICE) TYPE(*CHAR) LEN(10) +
                           DFT('Default') CHOICE(*PGM) +
                           CHOICEPGM(VINING/CHOICES1) PROMPT('Choice +
                           Parameter')

Create command
              CRTCMD CMD(CHOICES) PGM(ABC)

And source for CHOICES1
             PGM        PARM(&PARM1 &PARM2)
             DCL        VAR(&PARM1) TYPE(*CHAR) LEN(21)
             DCL        VAR(&PARM2) TYPE(*CHAR) LEN(2000)
             DCL        VAR(&PGMTXT) TYPE(*CHAR) LEN(30) VALUE('The +
                          Choices program did this')
             DCL        VAR(&RCVVAR) TYPE(*CHAR) LEN(4096)
             DCL        VAR(&RCVVARLEN) TYPE(*CHAR) LEN(4) +
                          VALUE(X'00002000')
             DCL        VAR(&ERRCOD) TYPE(*CHAR) LEN(4) +
                          VALUE(X'00000000')
             DCL        VAR(&BIN2) TYPE(*CHAR) LEN(2) VALUE(X'0020')
             DCL        VAR(&BIN4) TYPE(*CHAR) LEN(4)
             DCL        VAR(&X) TYPE(*DEC) LEN(4 0) VALUE(3)
             DCL        VAR(&OFFSET) TYPE(*DEC) LEN(4 0)
             DCL        VAR(&NUMLANGS) TYPE(*DEC) LEN(3 0)
             IF         COND(%SST(&PARM1 1 10) = 'CHOICES   ' *AND +
                          %SST(&PARM1 11 10) = 'CHOICE    ' *AND +
                          %SST(&PARM1 21 1) = 'C') THEN(DO)
             CHGVAR     VAR(&PARM2) VALUE('AFR, SQI, ARA, ...')
                        ENDDO
             IF         COND(%SST(&PARM1 1 10) = 'CHOICES   ' *AND +
                          %SST(&PARM1 11 10) = 'CHOICE    ' *AND +
                          %SST(&PARM1 21 1) = 'P') THEN(DO)
                        /* Get list of language ids                 */
                        CALL PGM(QSYS/QLGRTVLI) PARM(&RCVVAR +
                          &RCVVARLEN 'RTVL0100' &ERRCOD)
                        CHGVAR VAR(&BIN4) VALUE(%SST(&RCVVAR 9 4))
                        CHGVAR VAR(&NUMLANGS) VALUE(%BIN(&BIN4))
                        CHGVAR VAR(%SST(&PARM2 1 2)) +
                               VALUE(%SST(&BIN4 3 2))
                        CHGVAR VAR(&BIN4) VALUE(%SST(&RCVVAR 17 4))
                        CHGVAR VAR(&OFFSET) VALUE(%BIN(&BIN4) + 1)
LOOP:                   IF (&NUMLANGS > 0) DO
                        CHGVAR VAR(%SST(&PARM2 &X 2)) VALUE(&BIN2)
                        CHGVAR VAR(&X) VALUE(&X + 2)
                        CHGVAR VAR(%SST(&PARM2 &X 3)) +
                               VALUE(%SST(&RCVVAR &OFFSET 3))
                        CHGVAR VAR(&X) VALUE(&X + 3)
                        CHGVAR VAR(%SST(&PARM2 &X 1)) VALUE(' ')
                        CHGVAR VAR(&X) VALUE(&X + 1)
                        CHGVAR VAR(&OFFSET) VALUE(&OFFSET + 3)
                        CHGVAR VAR(%SST(&PARM2 &X 28)) +
                               VALUE(%SST(&RCVVAR &OFFSET 28))
                        CHGVAR VAR(&X) VALUE(&X + 28)
                        CHGVAR VAR(&OFFSET) VALUE(&OFFSET + 40)
                        CHGVAR VAR(&NUMLANGS) VALUE(&NUMLANGS - 1)
                        IF (&X > 1968) GOTO OUT
                        GOTO LOOP
                        ENDDO
                        ENDDO
OUT:         ENDPGM

>
>People,
>
>Has anyone writtena choice program for a command ?
>
>I'm looking to write one for a couple of commands and I can't for the life
>of me figure out how to get a handle on it.
>
>The stumbling block is the 2000 character parameter - not how to populate
>it, but what language I can use to populate it. I really can't CL as the
>answer, I'm mystified as to how to do it in RPG and I haven't dabbled in
>RPGLE as yet, though I've been reading about  it with interest.
>
>Does anyone have any pointers or suggestions as to how to get started ?
>
>Thanks in advance.
>
>Evan Harris
>

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.