Welcome Guest | My Membership | Login

How to access PROC Input Buffers from BASIC program


Article

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

 

# # #          # # #          # # #

 

Related Articles

  • PodCast: Advantages of the MultiValue Data Structure

    Interview with Nathan Rector, President of International Spectrum, the MultiValue data Structure. He talks about what it is, and how business applications can take advantage of it to increase ROI and performance of the business application.

  • PodCast: MultiValue Databases - Advantages of using Built-in tools

    Interview with Nathan Rector, President of International Spectrum, on the advantanges of using the built-in tools that come with the MultiValue database.

  • PodCast: What is MultiValue?

    Company: International Spectrum

    5 Minute talk with Nathan Rector, President of International Spectrum, on what MultiValue is and why it is so popular.

  • Auditing Database Changes with UniVerse Indexing Subroutines

    Company: Modern MultiValue, LLC Database: UniVerse

    UniVerse has file triggers which can be used to call a subroutine whenever a new record is added, changed, or deleted from a file so that the change to the database can be recorded in an audit trail for IT governance and compliance requirements. But full blown triggers come with a certain amount of performance overhead. For simple auditing, using indexing suboutines with a new system variable available at release 11.1 is a lighter weight alternative.

  • Case Study: Dover Saddlery Powers Online Growth and Expansion

    Company: Rocket Software Database: mv*Base

    In the early 2000s, Dover began adding new stores and acquiring existing tack shops, ultimately expanding their presence to thirty-one stores in nineteen states. To support its rapid growth, Dover required a robust application database platform that could drive its expansion. This case study explores what Dover did to solve the problem.


Return to top