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



Dare,

>Given the limitation of the CHOICEPGM, still how do u program it?

Choice programs are documented here:

http://publib.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/qb3auo03/9.4.6?ACTION=MATCHES&REQUEST=choicepgm&TYPE=FUZZY&SHELF=QB3AYC07&DT=19991014091328&searchTopic=&searchText=TEXT&searchIndex=INDEX&rank=RANK&ScrollTOP=FIRSTHIT#FIRSTHIT

Basically, in the PARM statement instead of coding:

        CHOICE('your text here')

you code:

        CHOICE(*PGM) CHOICEPGM(library/pgm)

Your program gets called under two different conditions:  when the command is
first prompted, and when the parameter itself is prompted.  In either case the
program gets two parameters:

  #1)  Passed by prompter to choice program, and always has 21 bytes:
                 1-10:  Command name being prompted
                11-20:  Keyword being prompted
                21:             Either 'C' or 'P' as described below

  #2) Value you return to the command prompter; either a 30-byte field or a
        variable length field depending on 'C' or 'P' status

When the user prompts the command (not the parameter), the choice program is
called with a 'C' in byte 21 of the first parameter.  This means the choice
program should return a 30-byte variable with the choice text to display on the
right side of the screen as all parameters are shown.  In your case, you may
want to pass back something like "Filename, F4=Prompt" or whatever.

When the user prompts the *keyword* (ie presses F4 at that keyword), the choice
program is called with a 'P' in byte 21 of the first parameter.  You have *no*
indication of the contents of *any* parameter.  That's why I said you'd also
need to create a Prompt Override Program and name the library a "key" parameter.
In the POP you'd store the library name in QTEMP; in the choice program you'd
retrieve it.

Then the choice program passes back a variable length field, documented as
having a 2000 byte limit.  In this field you first place a 2-byte binary count
of the number of entries you are returning.  After that you place each entry,
which itself is variable length from 1-32 bytes.  Each entry must have its own
2-byte binary length prefix.

For example, the string:

        x'0003'  x'0005' "ABCDE" x'0003' "FOO" x'0005' "SNAFU"

would indicate you are returning 3 entries:  ABCDE, FOO, and SNAFU

You can return as many as fit within the 2000 byte limitation.  If you always
passed back 10-character filenames (with trailing blanks), you could thus fit

         ( 2000 - 2 ) / ( 2 + 10 ) = 166

entries in the return parameter.  By dropping trailing blanks you may get up
around 200 or so, but that is still not close to what will be in lots of
libraries.

Some people have reported being able to exceed 2000 bytes, but that is still the
documented limit.  The command prompter can list up to 13 entries per column,
and two columns at a time.  Thus the user can see up to 26 entries, and roll
through them like a subfile.

Then they key whatever name they want at the top.

Doug


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.