How to access PROC Input Buffers from BASIC program

When working with PROCs there are 2 different input buffers available: Primary and Secondary. There are different way to access these buffer from within your BASIC programs: PROCREAD and SYSTEM(10)

Primary Buffer

This buffer provides you access to information found at the TCL command line, and other inputs generated when 'SS' and 'STON' is not used within a PROC

PROCREAD PRIMARY.BUFFER.ITEM ELSE PRIMARY.BUFFERE.ITEM = ""

PROCREAD allows you to access the primary buffer. A common use for this is to get the TCL arguments from the PROC command line. In the example below, the ARG1 and ARG2 along with the TEST.PROC will be available in the PROCREAD statement.

TEST.PROC ARG1 ARG2

If you create a PROC like the following:

PQ
RI
S1
O Begin Date +
IP
S2
O End Date +
IP
HTEST.PROGRAM
P

This will cause all the input from the user to be placed in the Primary Buffer. PROCREAD can then read this information. The draw back to this is that the arguments supplied at the command prompt will be overwritten. So in the sample above, instead of saying "TEST.PROC ARG1 ARG2", it will be replaced with the input values with "Begin Date" and "End Date". The output will become "01/01/13 02/01/13 ARG2".

You will notice that the PROC name has been overwritten by the "Begin Date". This has to do with the "S1" and "S2" commands which dictate which argument the input will be placed into.

Here is an example of running the above PROC:

:TEST.PROC3 ARG1 ARG2
 Begin Date :01/01/13
 End Date :02/01/14
PROCREAD 01/01/13 02/01/14

Secondary Buffer (Stacked Data)

The secondary buffer is often used when stacking inputs, or passing Item Ids from an active select list to another TCL statement. Stacked Input data can be accessed with a SYSTEM(10). This will tell you if there is anything in the secondary buffer or not.

If you create a PROC like the following:

PQ
SS
S1
O Begin Date +
IP
S2
O End Date +
IP
HTEST.PROG
STON
A1
H<
A2
H<
P

Notice the "SS" and "STON" PROC commands. This will force the data being entered to be saved in the Secondary buffer, not the primary buffer. The STON will then allow you to create a "Stacked Input" that SYSTEM(10) can detect.

Here is an example of running the PROC with Stacked Input:

:TEST.PROC2 ARG1 ARG2
 Begin Date :01/01/13
 End Date :02/02/13
PROCREAD TEST.PROC2 ARG1 ARG2
STON 01/01/13
STON 02/02/13

Test BASIC program

The following is the BASIC program that is used to test the PROCS:

     * TEST.PROG
     PROCREAD TEST.VAR ELSE TEST.VAR = ""
     *
     *** Display what was found in the PROCREAD statement
     *
     CRT "PROCREAD ": TEST.VAR
     *
     *** Capture all STON statements
     *
     LOOP WHILE SYSTEM(10) DO
       INPUT STON1
       CRT "STON ": STON1
     REPEAT
END
Nathan Rector

Nathan Rector, President of International Spectrum, has been in the MultiValue marketplace as a consultant, author, and presenter since 1992. As a consultant, Nathan specialized in integrating MultiValue applications with other devices and non-MultiValue data, structures, and applications into existing MultiValue databases. During that time, Nathan worked with PDA, Mobile Device, Handheld scanners, POS, and other manufacturing and distribution interfaces.

In 2006, Nathan purchased International Spectrum Magazine and Conference and has been working with the MultiValue Community to expand its reach into current technologies and markets. During this time he has been providing mentorship training to people converting Console Applications (Green Screen/Text Driven) to GUI (Graphical User Interfaces), Mobile, and Web. He has also been working with new developers to the MultiValue Marketplace to train them in how MultiValue works and acts, as well as how it differs from the traditional Relational Database Model (SQL).

View more articles
menu
menu