Introduction to Proc

Introduction to PROC
PROC is a processor with its own programming language that allows users to link together statements. You can write procedures with PROC to reduce a series of complex UCL or VISION statements to a single command. Procs are useful for automating procedures carried out routinely. This help introduces the PROC processor and the use of its automated procedures called Procs. It covers the following topics: * The basic function and structure of the PROC processor. * Capabilities of a Proc produced with the PROC language. * A sample Proc with a description of the PROC commands used. Note the difference between the terms PROC and Proc. The term PROC, all capitals, refers to the PROC processor; the term Proc, initial capital s, refers to a procedure written for the PROC processor.

THE PROC PROCESSOR
The PROC processor allows you to link a sequence of operations, a procedure, invoked from the UCL prompt with a single command, together. You can include any statement in a PROC procedure, and in this way you can view it as similar to a job control language. However, PROC is more powerful than most job control languages because it: * Has conditional capabilities. * Can operate in an interactive mode with users. * Can test and verify input data. In addition, you can handle any operation handled in a PROC procedure by a UniVision BASIC program; however, you do not need to compile a Proc since UniVision interprets the PROC language each time. The basic function of a Proc is to move data between input and output buffers using arguments passed from the command line, user-prompted input, and stored data and commands to build a sentence. The PROC processor can submit this command to the UCL processor for execution. You can execute any command from a Proc. While a Proc is executing, you can send input to it from another processor, such as the Spooler, and PROC can send output to processors other than UCL, such as the Editor, or BASIC. There are PROC command that prompt users for information, test strings for certain conditions, execute subroutines within the Proc, link to other Procs, and send their own messages. You can execute multiple statements from the same Proc.

A PROC PROCEDURE
A procedure described by PROC commands is called a Proc. The 1st line must contain the code PQ or PQX that identifies it to the system as a Proc. The remaining lines contain PROC commands. You create a Proc as an item with the Editor. Generally, you should store all Procs in a file other than the Master Dictionary with a two-line Proc in the Master Dictionary that invokes it. When you enter the Proc's name at the UCL prompt, the Proc in the Master Dictionary invokes the required Proc and executes it. Procs can execute any command. You can execute the UCL stacker commands from a Proc. You can write Procs to perform the following functions:

y y

Execute long and intricate VISION statements, such as those with special headings or that generate data on pre-printed forms. Automate routine procedures such as backing up files or maintaining a printer.

y y y y

Prompt users for specific data, allowing you to use the same Proc in multiple situations. Format menu screens that simplify the user interface with the system. Automate night time processing. From a user's point of view, a Proc operates just like a UCL verb. You can execute it directly from the UCL prompt.

A SAMPLE PROC
A Proc builds commands and sends them to the UCL processor for processing. You build commands using literal strings and user input. The system stores literal strings in the Proc itself; and you enter input while the Proc is running. When you invoke a Proc, the system places the literal strings and user input in a reserved portion of memory, called a buffer, for temporary storage. The system places user input in an input buffer, and literal strings in an output buffer. Generally a buffer contains one or more parameters. A parameter is a string of characters surrounded by blank spaces or by quotes. Each buffer has a pointer that points to the current parameter. PROC commands address the current parameters in a buffer.

001 002 003 004 005 006 007

PQ HLIST CUSTOMERS WITH LAST -NAME = OINCLUDE CUSTOMERS WITH LAST NAME IP A" H LAST -NAME FIRST -NAME STREET CITY STATE P

This Proc prompts for the last name of customers you want to include in a report. The H in line 2 places the literal string LIST CUSTOMERS WITH LAST-NAME = in the output buffer, and the A in line 5 copies user input, in this case, the customer's last name, to the output buffer. It appen ds another literal string to the contents of the output buffer using the H on line 6. The P on line 7 sends the contents of the output buffer to the UCL processor. It uses two additional PROC commands in the example. The O on line 3 displays a string of text on the user's screen, and the Proc uses it to prompt the user for data. The IP on line 4 reads the information entered by the user into the input buffer. It prompts for the input with a colon (:). The following is a line-by-line explanation of the above Proc: Line 1 identifies the item as a Proc. PQ is the code that tells the system that an item is a Proc, and that it needs to be handled by the PROC processor. Line 2 uses H to place the string LIST CUSTOMERS WITH LAST-NAME = in the output buffer. Line 3 uses O to display the string INCLUDE CUSTOMERS WITH LAST-NAME on the screen. Line 4 uses IP to read any information entered at the keyboard into the input buffer. Line 5 uses A to copy the information placed in the input buffer by the IP on line 4 into the output buffer. The double quotes (") insert that information in double quotes. Line 6 uses H to place the string LAST-NAME FIRST-NAME STREET CITY STATE in the output buffer. Line 7 uses P to send the contents of the output buffer to the UCL processor.

y y y y y y y

If a user enters the name JOHNSON in response to the prompt sent to the screen by IP, the PROC processor combines input from the terminal with literal strings and sends the resulting statement to the UCL processor. At the user's terminal the Proc would look l ike this:

>CUST-LIST INCLUDE CUSTOMERS WITH LAST NAME :
When the user enters a last name and presses <RETURN>, the Proc produces a report similar to the following:

>CUST-LIST INCLUDE CUSTOMERS WITH LAST NAME :JOHNSON

PAGE 1993

1

10:37:23

27 JUN

CUSTOMERS... Last Name. First Name Street.......... City........ State AJOHN5396 HJOHN7265 JOHNSON JOH NSON ALICE HENRY 760 JEFFERSON ST LOUISVILLE 45 5OTH STREET OMAHA KY NB

2 ITEMS LISTED. >

When a Proc finishes executing, it returns control to the UCL processor by default. In addition, you can pass control to another Proc or to another processor such as the Editor or BASIC.

CREATING A PROC
A Proc is a procedure that constructs a command that the PROC eventually sends to the UCL processor. You can construct the command entirely of literal strings, or a combination of literal strings and variable input. To process an item as a Proc, its first line must contain the code PQ or PQX. This section of the help is a tutorial describing the basics of creating a Proc. It covers the following topics: The PQ/PQX code, and how to list the Procs on your system. How to place literal strings in the output buffer. How to include user input in a command constructed by a Proc. How to transfer control within a Proc. How to include comment lines in a Proc that describe its function. How to create linking Procs that point to Procs stored outside the Master Dictionary. Note: Throughout this help there is mention of two buffers, the input buffer and the output buffer. In fact the PROC processor uses four buffers: two for input and two for output. However, these introductory notes provide a simplified discussion of these buffers by focusing on the primary input and output buffers.

y y y y y y

THE PQ/PQX CODE
You create a Proc using the Editor, just like any other item, and you can store it in any file. However, it is recommended that there is a two-line linking Proc in the Master Dictionary that points to it rather than storing a large Proc in the Master Dictionary. The first line of a Proc must contain the code PQ/PQX to indicate that it is a Proc and that the PROC processor must interpret it. To list the Procs in the Master Dictionary, including linking Procs, enter the following command:

>SORT-ITEM MD WITH D/CODE = "PQ"
This command sorts and displays all items in the Master Dictionary whose first line is PQ. UVPROCS is a file containing Procs supplied with the system. Every Proc in UVPROCS has a linking Proc stored in the Master Dictionary. LISTPROCS lists all the Procs in the file UVPROCS in dictionary format. If you supply a filename, LISTPROCS lists all the Procs in that file dictiona ry. Within UVPROCS are Procs that are executable from a user account or via the SYSPROG account. There is a user Proc in every account on the system achieved by placing a two-line linking Proc in the Master Dictionary.

The system copies the linking Procs into every user account from the NEWAC file whenever you create an account using CREATE-ACCOUNT or update it using UPGRADE. In addition, UVPROCS contains a number of linking Procs copied into an account requiring SYSPROG capabilities.

>SORT SYSMD WITH D /CODE = "PQ"
SYSMD contains a number of linking Procs copied into an account requiring SYSPROG capabilities.

PLACING TEXT IN THE OUTPUT BUFFER
It is possible to construct Procs solely from literal strings. This can be a useful way or storing long, complicated commands. For example, the following Proc, called ORDER-SORT, sorts the ORDERS file in a special format:

001 002 003 004 005 006

PQ HSORT ORDERS BREAK -ON ORDER.NO H COMPANY.NAME PART.NO QTY PRICE H TOTAL EXTENDED.PRICE H GRAND -TOTAL "TOTAL OF ALL ORDERS" P

The PQ code on line 1 identifies the item as a Proc. The Hs on lines 2 to 5 construct the following statement in the output buffer:

SORT ORDERS BREAK -ON ORDER.NO COMPANY.NAME PARTNO QTY PRICE TOTAL EXTENDED.PRICE GRAND -TOTAL "TOTAL OF ALL ORDERS"
The H places the string directly following it, including any spaces, at the end of the output buffer. The Hs on line 3, 4 and 5 include a space directly after them to separate each string from the previous string in the output buffer. The P on line 6 sends the constructed command to the UCL processor.

INCLUDING USER INPUT IN A PROC
You can make Procs more flexible by adding user input. For example, you could write a Proc that asks the user to supply the name of the attribute by which to sort an intricate report, or the range of dates to include in the report, or the state to include in the report. The system holds everything entered at the UCL prompt when you invoke a Proc in the input buffer. The system uses A to copy a parameter from the input buffer to the output buffer. If you do not include any options with A, it copies the parameter indicated by the current position of the input buffer pointer. You can specify any parameter by including its position number with A. When copied to the output buffer spaces surround the parameter. You can specify a different surround character by using an option to A. If you do not require surround characters, including spaces, enter a backslash after the A. The following Proc, called CUST-STATE, produces a report from the CUSTOMERS file sorted in order by last name, but includes only those customers from the state specified by the user when the invoke the Proc:

001 002 003 004 005

PQ HSORT CUSTOMERS BY LAST -NAME WITH STATE = A"2 HLAST -NAME FIRST -NAME STREET CITY STATE P

The H on line 2 places the string SORT CUSTOMERS BY LAST-NAME WITH STATE = in the output buffer. The A on line 3 copies the 2nd parameter, the 1st parameter is the name of the Proc, the 2nd is the state, from the input buffer to the output buffer, and surrounds it in quotes.

The H on line 4 places the string LAST-NAME FIRST-NAME STREET CITY STATE in the output buffer. The A on line 3 puts surround characters, in this case double quotes, around the parameter that it copies automatically, so you do not need a space in the H on line 4. When the user enters CUST-STATE NH at the UCL prompt, the Proc places both CUST-STATE and NH in the input buffer. NH is the 2nd parameter, so the Proc would build the following statement: SORT CUST BY LASTNAME WITH STATE ="NH" LAST-NAME FIRST-NAME STREET CITY STATE The A uses double quote (") instead of spaces as the surround character because the Proc is to use the copied parameter as a literal value in a statement. The Proc produces a report like the following:

>CUSTSTATE NH PAGE 1

12:32:05

25 JUN 1993

CUSTOMERS... Last Name. First Name Street............ City...... State JKENN6196 KLAWL7129 KENNARD LAWLOR JANE KRISTA 34 STATE ST 42 MAPLE ST FRANKLIN PORTSMOUTH NH NH

2 ITEMS LISTED. >

PROMPTING FOR INPUT
In addition, a Proc can prompt users for input during its execution. You often find O and IP used together to prompt for specific information; the O, output, command displays text on the screen, and the IP, input, command copies any input from the keyboard into the input buffer. IP indicates the character used to prompt the user for input; it uses a colon (:) by default for PQ Procs and a question mark (?) for PQX/PQN Procs. You can use another character by including it with IP. For example IP! prompts with an exclamation mark. When you invoke a Proc, the system stores anything entered at the UCL prompt in the input buffer and sets the buffer pointer to the beginning of the buffer. IP copies additional user input into the input buffer. It replaces the parameter specified by the buffer pointer but does not move the input buffer pointer. An A following an IP directly, therefore, uses the parameter entered by the preceding IP. You can use another parameter by moving the input buffer pointer. You could add line to the CUST-STATE Proc that prompts the user for the state to include in the report. For example:

001 002 003 004 005 006 007

PQ HSORT CUST BY LAST -NAME WITH STATE = OINCLUDE WHICH STATE IP A" H LAST -NAME FIRST -NAME STREET CITY STATE P

The O on line 3 displays the string INCLUDE WHICH STATE on the screen. The IP on line 4 copies the input from the terminal into the input buffer, replacing the 1st parameter, the name of the Proc. The A on line 5 copies the parameter input with the IP on line 4 into the output buffer and surrounds it in double quotes. The above Proc prompts the user for the state to use and produces a report exactly like the previous example:

>CUST-STATE INCLUDE WHICH STATE

The PROC processor ignores any text following C. line 8. If there is a 2nd parameter. you could add a comment that explains the above Proc as follows: 001 002 003 004 005 PQ C C C C PROMPTS USER FOR THE STATE TO INCLUDE IN A CUSTOMER REPORT.. you cannot place any spaces before the C. and does not execute the commands on lines 8 to 10. the IF reads: if there is no 2nd parameter. . COMMENT LINES When Procs get long and involved. The following Proc uses IF to test for the presence of a 2nd parameter in the primary input buffer: 001 002 003 004 005 006 007 008 009 010 PQ IF #A2 G 10 20 HSORT CUST BY LAST -NAME WITH STATE = A"2 H LAST -NAME FIRST -NAME STREET CITY STATE P X 10 OINCLUDE WHICH STATE IP G 20 The IF on line 2 checks for the presence of a 2nd parameter. The IP on line 9 places the input in the input buffer..... State JKENN6196 KLAWL7129 KENNARD LAWLOR JANE KRISTA 34 STATE ST 42 MAPLE ST FRANKLIN PORTSMOUTH NH NH 2 ITEMS LISTED. it is useful to be able to identify the function of each Proc. IF provides for conditional branching... The GO on line 10 returns control to the command labelled 20. and to transfer control to that labelled command. For example. and returns control to the UCL processor. The Proc continues to execute from line 3 up to the X on line 7. go to the command labelled 10. line 3. or when there are a lot of them. City. When used with GO.. For example GO 10 transfers control to the command line labelled 10. In the above Proc. For example.. Therefore. PROC could prompt for information if you did not enter any when invoking the Proc. C. comment. outputs text that requests the state to include in the report.. First Name Street. which terminates the Proc. PROC uses IF to test an input buffer parameter for a certain condition before executing a command. The command labelled 10. A label consists of any numeric characters entered at the beginning of the line and separated from the rest of the line by exactly one space.:NH PAGE 1 13:29:05 25 JUN 1993 CUSTOMERS. > CONDITIONAL BRANCHING PROC allows you to identify a command line uniquely by a label. Note: C must be the first character on a comment line. The X on line 7 terminates the Proc and returns control to the UCL processor.. GO transfers control to a labelled command... The # sign is an option to IF that reverses the meaning of the test. the 2nd parameter is the state to include in the report... the Proc continues to execute with the next command. If you did not include a 2nd parameter when invoking the Proc it transfers control to the command labelled 10.. allows you to add explanatory text or other text to the body of a Proc explaining what a Proc does... Last Name.

you must create the following calling Proc in the Master Dictionary: 001 PQ 002 (UVPROCS CUST -SORT) The item ID of the calling Proc is usually the same as that of the Proc it calls. It describes such basic procedures as prompting the user for input. When you upgrade UniVision you lose any Procs stored in UVPROCS. to reference a Proc called CUST-SORT stored in the UVPROCS file. unconditional and conditional branching. y y . This help covers the following topics: How the system stores data in the PROC buffers. The () on line 2 transfers control to the Proc with item ID proc -name in file filename.line Proc CUST-SORT in the Master Dictionary. you must precede filename with DICT. which in turn links to the Proc CUST-SORT in the UVPROCS file. The system uses the file UVPROCS to store Procs supplied as part of the operating system. How to place or manipulate information in the input buffer. you can find descriptions of more advanced features of PROC such as subroutines. constructing a UCL command in the output buffer. The UVPROCS file is one of the system files replaced automatically every time you upgrade UniVision. STORING PROCS You invoke a Proc by entering its item ID at the UCL prompt. Additionally it is possible to store Procs in this file or in any other file as long as you link them to other Procs placed in the Master Dictionary. allowing the system to branch to it. For example. Whenever you enter CUST-SORT at the UCL prompt. it is not good practice to do so. Later in this help. formatting menus and the use of the secondary input and output buffers. it executes the two. () is a Proc command that transfers control from one Proc to another Proc. CREATING A LINKING PROC You can place a two-line linking Proc in the Master Dictionary that points to a longer Proc in another file. Note: It is a good idea to store Procs in a file other than UVPROCS. To enable the system to recognise an item ID as the name of a Proc there must be a Proc in the Master Dictionary with that item ID. The format of a linking Proc is as follows: 001 PQ 002 ([DICT] filename proc -name) PQ/PQX identifies the item as a Proc. changing the current parameter. Although it is possible to store an entire Proc in the Master Dictionary. PROC Commands This help introduces the fundamental PROC commands organised by function.006 007 008 009 010 011 012 013 014 IF #A2 G 10 20 HSORT CUST BY LAST -NAME WITH STATE = A"2 HLAST -NAME FIRST -NAME STREET CITY STATE P X 10 OINCLUDE WHICH STATE IP G 20 You can add empty Cs before and after the comment to make it more readable. It is possible to add a label to a comment line. because if the Master Dictionary gets too large it could become fragmented. and displaying the contents of the buffers. If you have stored the Proc in a file dictionary.

It is possible to place text strings directly in either buffer. The system always places strings added to the primary buffer at the end of the buffer. You can find a more detailed description later in this help. It expects the user to supply two amounts on the command line. you activate them by using specific PROC commands. the focus of this first section is on the use of the two primary buffers. the system places its name and any parameters included on the command line in the primary input buffer. the system stores the entire command line in the primary input buffer. The system does not move the pointer. How to construct a UCL command in the output buffer. In addition. The buffers store data in strings that comprise one or more parameters. When the Proc moves data between buffers. You delimit parameters using at least one space. where it is possible to test them or copy them directly to the primary output buffer for use in the UCL command constructed there. How to display the contents of both the input and output buffer. Although it is possible to use the commands described in this help to manipulate data in all four buffers. * the secondary output buffer. In addition. If an input string contains embedded spaces the system interprets the string as a group of multiple parameters. * the secondary input buffer. so it points to the beginning of the new string. The secondary input buffer holds input provided by the user or by system processors while the Proc is executing. The secondary output buffer can store data or a series of commands used by another processor invoked by the UCL command constructed by a Proc. one input and one output buffer are active.y y y y How to move the input buffer pointer to another parameter. the following command line for a Proc sorts orders within a certain range. PROC commands select and move elements from the input buffers to the output buffers in order to create a UCL command eventually submitted to the UCL processor. You can place responses to prompts displayed by the Proc during its execution in either input buffer. At any given time. The two most commonly used buffers are the two primary buffers. The secondary buffers have their own specific job functions and work slightly differently from the way the primary buffers work. while other commands require that you move the buffer pointer with an additional PROC command. the data goes from the currently active input buffer to the currently active output buffer. It is possible to use the secondary input buffer to hold input from the user in order to preserve the contents of the primary input buffer from job to job in a Proc. Strings placed in the primary input buffer replace the current parameter. For example. * the primary output buffer. How to send the contents of the output buffer to the UCL processor. When you enter a Proc statement at the UCL prompt. By moving the pointer you can designate any parameter as the current one. The system holds this UCL command in the primary output buffer until the Proc submits it to the UCL processor. it can hold messages sent in response to a command submitted to UCL. as shown below: >SORT-ORDER 50 100 . When you add strings to a buffer the system places them at the current position of the buffer pointer. STORING INPUT The primary and secondary input buffers hold any information entered by the user during the execution of a Proc. When you enter a Proc at the UCL prompt. UNDERSTANDING THE PROC BUFFERS PROC commands manipulate data held in four different buffers: * the primary input buffer. It is possible to use some commands to select a specified parameter. Commands operate on the current parameter referenced by a buffer pointer. the input buffers can hold literal strings or an entire tape label.

The B option to IP converts any spaces in an input string to backslashes. If you were to include a space between the O and INCLUDE. CUST-SELECT. including leading and trailing spaces. displays a line of text on the screen. output. Thus. PROMPTING FOR USER INPUT A Proc can prompt for input during its execution. It can identify each parameter by its position in the primary input buffer. and encloses it in quotes using the A on line 5. as follows: 001 002 003 004 005 006 007 PQ HSORT CUSTOMERS BY LAST -NAME WITH STATE = OWHICH STATE+ IP? A" HLAST -NAME FIRST -NAME CITY STATE ZIP P When you invoke the Proc. This option allows the system to store a multiple word string as a single parameter. 50. displays a one character prompt for user input. The system uses an A. on the line 4. the 1st argument. the parameter it places in the active input buffer becomes the current parameter. input. If the input string includes embedded spaces. becomes parameter 3. O. the command: IP? prompts with a question mark (?). A prompt character remains in effect until another IP or an IS changes it. CA becomes the current parameter and the system copies it immediately to the primary outpyt buffer. SORT-ORDER. in the primary input buffer. The O. becomes parameter 2. IP does not move the buffer pointer. The system uses this frequently with IP to describe the input expected from the user. the system would include a space before the word INCLUDE. IP replaces the current parameter in the primary input buffer with CA. and the second argument. . copy input. and copies what the user enters at this prompt into the active input buffer. a Proc called CUST-SELECT. to a single blank space. followed by a carriage return.The name of the Proc. IP. becomes parameter 1. prompts the user to enter the name of a state in a selection expression. the system places the command line. For example. The system converts consecutive blank spaces in the text. If a user entered CA at the prompt. The syntax is as follows: Otext[+] You should not include a space between the O and text unless you require a space explicitly in the text on the screen. For example. OINCLUDE ORDERS WITHIN WHAT RANGE displays INCLUDE ORDERS WITHIN WHAT RANGE on the screen. In addition it is useful for outputting status messages from a job stream. 100. A colon (:) is the default prompt displayed by IP. on line 3. The syntax is as follows: IP[B][character] IP replaces the current input parameter with the user's response to its prompt. places the users response in the primary input buffer. displays the text WHICH STATE. to copy the parameters to the primary output buffer. the system stores the string as multiple parameters in the active input buffer. and the IP?. You can change the prompt by specifying another character with IP.

IT does not convert multiple spaces to a single space. However. reads a tape label from an attached tape into the active input buffer. The + on line 3 adds 1 to that input parameter. move the buffer pointer one parameter backward or forward respectively. forward. The syntax is as follows: IT The tape label replaces the entire contents of the active input buffer and positions the pointer at the beginning of the buffer. PERFORMING ARITHMETIC OPERATIONS You can add an integer to or subtract an integer from any parameter in the active input buffer. the following Proc uses + to execute WHO five times : 001 PQ 002 IH0 003 10 +1 004 HWHO 005 P 006 IP 007 IF A = 5 X DONE 008 GO 10 The IH on line 2 places zero in the input buffer. the following sequence of commands: OINCLUDE ORDERS WITHIN WHAT RANGE+ IP? displays the following message and the prompt character. the system clears the input buffer. There is no need to input a space between the IH and the text unless you want to include a space explicitly. adds an integer to the current parameter in the input buffer.The + option suppresses the carriage return after the O. For example.numeric. B. PLACING TEXT STRINGS IN THE ACTIVE INPUT BUFFER IH. input text. If IT does not find a tape label. on the same line as the output text. places a fixed string in the active input buffer. the system assumes its value is 0. The syntax is as follows: IHtext IH replaces the current parameter in the input buffer with text. READING A TAPE LABEL INTO THE ACTIVE INPUT BUFFER IT. back and F. input tape. The Proc loops until the current input parameter is equal to five. you must move the buffer pointer to the correct parameter. The input parameter can be a negative number. subtracts an integer from this parameter. For example. Before you can add or subtract an integer from a parameter. a question mark. on the same line: INCLUDE ORDERS WITHIN WHAT RANGE? In addition the user enters their response on the same line. +. -. if it is non. It does not move the buffer pointer. CLEARING BOTH INPUT BUFFERS . subtract. the system ignores them. the system assumes it value is 0. If integer contains leading zeros. add. that often follows. The syntax is as follows: +integer -integer If integer is negative or non-numeric. This allows the system to display the prompt from an IP.

F moves the pointer to the end of the buffer. The system clears the entire secondary input buffer as well. It is possible to add text strings to this buffer with H. moves the input buffer pointer forward to the next parameter. Other commands require that you move the buffer pointer to the correct parameter. To clear only a portion of the primary input buffer. the command: RI3 clears from the beginning of the 3rd parameter to the end of the primary input buffer. Some PROC commands move to a specific parameter by including its position with the command. B has no effect. back. This section describes the method of selecting the current parameter. SETTING THE ACTIVE INPUT BUFFER POINTER S. If there is no parameter with the position indicated. For example. For example. moves the input buffer pointer backward one parameter. the command: S3 moves the primary input buffer pointer directly to the 3rd parameter. THE PRIMARY OUTPUT BUFFER The system holds the elements of a command you want to submit to the UCL processor in the primary output buffer. The syntax is as follows: Sparameter# The position of the parameter in the input buffer indicates the position to move to. the system moves the pointer to the end of the input buffer. moves the input buffer pointer to a specific parameter. reset input. clears the contents of both the primary and secondary input buffers and activates the primary input buffer. set. The syntax is as follows: F If the current position of the pointer is the last parameter. text. A2 copies the 2nd parameter from the active input buffer to the primary output buffer. forward. It is possible to copy parameters from either of the input buffers to the primary output buffer with A. The syntax is as follows: B If the current position of the pointer is the beginning of the buffer. specify the position number of a parameter. The syntax is as follows: RI[parameter#] RI without an option clears both input buffers. copy input.RI. MOVING THE ACTIVE INPUT BUFFER POINTER FORWARD F. MOVING THE ACTIVE INPUT BUFFER POINTER BACKWARD B. In addition. SPECIFYING THE CURRENT INPUT PARAMETER PROC commands operate on the current parameter. as well as the entire secondary input buffer. it is possible to move the . For example.

and surrounds it in double quotes. but you can assign a different surround character. The command: A2 copies the 2nd parameter in the active input buffer to the end of the active output buffer. For example. if you had not included a space. For example. COPYING INPUT TO THE ACTIVE OUTPUT BUFFER A. The syntax is as follows: A[surr-char][parameter#][. the command: HSORT CUSTOMERS places the string SORT CUSTOMERS in the primary output buffer. There is no need to input a space before the string because it is the 1st string placed in the buffer. . adds a text string to the active output buffer. you can surround it in quotes by specifying a quote (") as the surr-char. the system copies the parameter without surrounding spaces. It is possible to specify that you do not want to include surround characters or blank spaces by using a backslash (\) as the surr-char. A leading space is significant. and clear the entire contents of the buffer with RO.output buffer pointer back one parameter with BO. it copies the user input from that IP automatically. If you define the surround character as anything other than a space. the system surrounds an input parameter with spaces when copying it to the active output buffer. PLACING TEXT STRINGS IN THE ACTIVE OUTPUT BUFFER H. You can reference a parameter other than the current parameter by its position in the input buffer. If you specify A without any options. text. the system would have appended BY to CUSTOMERS. examine the following sequence of commands: OSORT BY WHICH ATTRIBUTE IP A The O displays a message on the screen. For example. OINCLUDE CUSTOMERS WITH LAST NAME IP A" A copies the response to the primary output buffer. The command: H BY LAST -NAME adds the string ' BY LAST-NAME' to the end of the buffer. If a parameter represents a literal value in a statement. this portion of a Proc prompts for the last name of customers. copies a parameter from active input buffer to the end of the active output buffer.#characters] A moves the buffer pointer to the end of the copied parameter and makes the next parameter in the input buffer the current parameter. The IP places the user's response to the message in the input buffer and the A copies that parameter to the output buffer. Normally. copy input. The surr-char option to A changes the surround character to any non-numeric character. The syntax is as follows: Htext H adds the specified text to the end of the active output buffer and positions the pointer at the end of the string. If it follows an IP directly. reset output. You need to include a space at the beginning of the string to separate it from the previous string. it copies the current parameter in the active input buffer.

after the system has copied a parameter. If you separated the parameters with semi-colons (. copies the 2nd parameter in the primary input buffer to the end of the primary output buffer. The 2nd A. on line 4. including any embedded blanks. both parameters are copied together with the delimiter that separates them. moved the buffer pointer forward automatically from the 2nd parameter to the beginning of the next parameter. copies it from the primary input buffer to the primary output buffer. places the user's response in the primary input buffer and the A. Thus. sorts orders whose amounts fall within a range. the system copies an entire string from this single quote to the next single quote in the input buffer. on line 7. The A. If the user entered TITLE at the prompt. and uses the same attribute as the BREAK-ON attribute: 001 002 003 004 005 006 007 008 009 PQ HSORT ORDERS BY -EXP OSORT BY WHICH ATTRIBUTE IP A HBREAK -ON A1 HTOTAL AMOUNT P The O. A assumes that you want to copy parameters in consecutive order. If the user entered the command SORT-ORDER 50 100. on line 4. For example.) it is possible to copy them as a single parameter with A. There is no need to specify the 3rd parameter because the first A. on line 5. copies the same parameter to the primary output buffer a second time. if the 1st A copies the 2nd parameter. the command: A2.It is possible to limit the number of characters copied. For example. If you want to copy the same parameter a second time. the following Proc. 001 002 003 004 005 006 007 008 PQ HSORT ORDERS BY AMOUNT H WITH AMOUNT GT A"2 HAND LT A" HAMOUNT DATE P The system holds three parameters in the input buffer when you invoke this Proc. on line 4. The 2nd A. the next A copies the 3rd parameter. The IP. the Proc constructs the following statement: . it moves the pointer forward to the next parameter. you must select it again. called SORT-ORDER.6 copies the first six characters from the start of the 2nd parameter. and the 2nd argument. on line 6. It assumes that the user has supplied two arguments for the range. During the copy operation. on line 3. copies the 3rd parameter to the primary output buffer. the name of the Proc. If the 1st character of the parameter you want to copy using A is a single quote. on the command line. the system converts the semi-colons to spaces or to the surround character specified by the surround-char specification. the 1st argument. the following Proc prompts for the attribute by which to sort the ORDERS file. If the 2nd parameter is only two characters and the 3rd parameter is three characters. the Proc constructs the following statement: SORT ORDERS BY AMOUNT WITH AMOUNT GT "50" AND LT "100" AMOUNT DATE The parameters use double quotes as surround characters. displays text that prompts for the attribute by which to sort. For example.

back output. You can include any number of Ps in a Proc. The options to P affect the way it operates: PH submits the UCL command. This command is useful for debugging a Proc and the section entitled 'Displaying Buffer Contents' later in this help describes it in more detail. reset output. but suppresses any output to the screen. The syntax is as follows: P[H|P|W|X] P without any options submits the contents of the primary output buffer directly to the UCL command processor. Each P clears both output buffers and thus they are ready to hold the next UCL command. actually submits the command to UCL for execution. PP displays the contents of both output buffers on the screen before submitting the UCL command. The syntax is as follows: BO If the active output buffer contains only one parameter. and returns control to the command immediately following the P. P. it moves the pointer back to the position following the last character of the previous parameter. the syntax is as follows: RO RO makes the primary output buffer active. . BO moves the pointer to the beginning of the buffer. effectively deletes the last parameter in the active output buffer. It is possible to submit a series of UCL commands from the same Proc. it is possible to clear the output buffers with RO. In addition. PX submits the UCL command and returns control to UCL instead of to the PROC processor. You must submit each command by its own P. PW displays the contents of both output buffers followed by a ? prompt and waits for response from the user before continuing. SUBMITTING A COMMAND TO THE UCL PROCESSOR The primary output buffer holds a command for the UCL processor. It makes the primary output buffer active. After execution of the UCL command. CLEARING BOTH OUTPUT BUFFERS The system clears both the primary and secondary output buffers automatically after a P. the PROC processor clears both output buffers and loads any error message numbers into the secondary input buffer. process.SORT ORDERS BY -EXP TITLE BREAK -ON TITLE TOTAL AMOUNT MOVING THE ACTIVE OUTPUT BUFFER POINTER BACK BO.

You can display the contents of both output buffers with options to P. the command: D2. DISPLAYING THE CONTENTS OF THE ACTIVE INPUT BUFFER D. call. You can display the contents of the active buffer with D. process. the following portion of a Proc includes a parameter from the active input buffer as part of a prompt: 010 011 012 013 ODO YOU WANT TO MAKE + D2+ O THE BREAK -ON ATTRIBUTE (Y/N)+ IP? D2+ displays the 2nd parameter in the active input buffer and suppresses the carriage return. displays one or more parameters from the active input buffer on the screen.Note: If you execute a Proc from a Proc using P. It is possible to insert PROC commands that display buffer contents and remove them once the Proc is running correctly. it can be helpful to examine the contents of the active input buffer and the two output buffers. To return control to the Proc. . Normally. displayed. specify its position with D. D without any options displays the current parameter. process. of the par ameter. instead. It is possible to suppress this carriage return with the + option. DISPLAYING THE CONTENTS OF BOTH OUTPUT BUFFERS P. display. D follows its display with a carriage return. use [].#characters][+] D does not change the position of the buffer pointer. For example. For example. DISPLAYING BUFFER COMMANDS When writing a Proc. For example. submits a command constructed in the primary output buffer to the UCL command processor. The command: D0 displays the entire contents of the active input buffer. The syntax is as follows: D[parameter#][. the command: D2 displays the 2nd parameter in the active input buffer. display. the system does not return control to the original Proc.4 displays only the first four characters of the 2nd parameter. The P and W options for P display the contents of the output buffers before submitting the UCL command: The syntax is as follows: P[P|W] PP displays the contents of both output buffers on the screen before submitting the UCL command. you can restrict the number of characters. In addition. To display a parameter other than the current parameter.

* X. and linking to another Proc. For example. and wait for user response. When you execute the Proc it looks like this: >CUST-SORT SORT BY WHICH ATTRIBUTE? CITY SORT CUSTOMERS BY CITY LASTNAME FIRSTNAME CITY STATE ZIP ? The Proc continues or aborts.PW displays the contents of both output buffers on the screen followed by a ? prompt. * (). The Section describes the following commands: * STON. Once you have debugged or tested the Proc. The Section describes the following commands: * GO. You can enter the following responses at the ? prompt. link. Y or <RETURN> submits the current UCL command and continues with the Proc. The system does not submit the UCL command in the primary output buffer to the UCL processor. on line 7. * STOFF. terminal. . * IF. S skips the UCL command and continues with the Proc. depending on the response entered by the user at the ? prompt. * How to use the secondary input and output buffers. * []. 001 002 003 004 005 006 007 PQ HSORT CUSTOMERS BY OSORT BY WHICH ATTRIBUTE+ IP? A HLASTNAME FIRSTNAME CITY STATE ZIP PW The PW. you can replace PW with a single P. ADDITIONAL PROC COMMANDS This section describes additional PROC commands that give more control over a Proc. stack on. The following topics are covered: * Unconditional and conditional branching. the following Proc prompts the user for the attribute by which to sort the CUSTOMER file. * How to format the screen and control the cursor with T. N or X aborts the Proc and returns control to UCL. The commands are organised by function. exit. call. displays the contents of the output buffer and waits for the user to respond to its prompt. stack off.

* SP. For example. * IS. GO transfers control to a line with a numeric label. the system only uses the 1st occurrence of the label. The following Proc prompts the user for a department number.* SS. The syntax is as follo ws: G[O] {label#|A[ parameter#]} It is possible to enter GO as G. the Proc continues to execute from that line. 10. TRANSFERRING CONTROL It is possible to transfer control of a Proc to a labelled line or subroutine. and you must separate it from the command line by at least one space. the command: G 70 transfers control to the line labelled 70. UNCONDITIONAL BRANCHING When used without IF. BRANCHING TO A LABELLED LINE GO transfers control of a Proc to a labelled line.DEVELOPMENT=3)+ 003 IP 004 IF A > 3 G 5 005 IF A < 1 G 5 006 OYOUR BILLING CODE IS + 007 G A1 . exit. for example 7. MARKETING=2. [] calls a subroutine starting at the labelled line and continues to execute until it encounters an X. select primary. If a Proc contains two command lines with the same label. the system uses GO and [] to branch unconditionally another line or a subroutine. A label comprises any number of numeric characters. the label is 70 and the command is H LAST-NAME. input secondary. () links to another Proc. In addition. the system does not check for duplicate labels. select secondary. and transfers control to the line labelled with that number. For example. GO transfers control to a labelled line that matches a parameter in the input buffer. Do not confuse command labels with the Editor line numbers. 001 PQ 002 OENTER YOUR DEPARTMENT NUMBER (SALES=1. the command: G A1 transfers control to the line with a label that matches the 1st parameter in the input buffer. For example. 013 70 H LASTNAME The line number is 013. 999. It is possible to precede a PROC command line with a numeric label to identify it uniquely.

the system executes all subsequent lines from that point on. if you use GO to select one of several commands to execute a 2nd GO is necessary to skip over commands that you do not want to execute. For example. the number of the department. 999 X 5 XTHE CODE MUST BE BETWEEN 1 AND 3! Prompts the user to identify a department by number. G 999 2 OMA6672. and so on. you can find a description of IF later in this help. the system transfers control to the 1st line in that Proc. and places the response in the input buffer. the Proc displays MA6672. When the subroutine is in the same Proc. it is only necessary to include a label with []. For example. DEVELOPMENT=3):3 YOUR BILLING CODE IS DE4463. if the users enters 1.008 009 010 011 012 013 014 1 OSA1259. the command: [] 100 transfers control to a subroutine that starts at the line labelled 100. Once control passes to the labelled line. lines 2 and 3. When the subroutine is in another Proc. on line 7. The system displays YOUR BILLING CODE IS and the GO. the Proc displays the billing code SA1259. MARKETING=2. The syntax for a subroutine in the same Proc is as follows: [] label# The syntax for a subroutine in a different Proc is as follows: [[DICT] filename [item -ID]] [label #] Subroutine execution continues from the labelled line to the next X. If you do not include a label number with a [] that calls another Proc. X returns control to the command immediately following the []. The following Proc transfers control to an internal subroutine twice: . the command: [MYPROCFILE SORT -CUST] 100 transfers control to the line labelled 100 in the Proc SORT-CUST in file MYPROCFILE. if the user enters 2. At execution the Proc looks like this: >BILLING-CODE ENTER YOUR DEPARTMENT NUMBER (SALES=1. G 999 3 ODE4463. > CALLING A SUBROUTINE [] transfers control to a subroutine in the same Proc or in a different Proc. It tests the input on lines 4 and 5. Normally. transfers control to the label that matches the 1st input parameter. you must include the name of the file containing the Proc and the item ID of the Proc.

line 5. on line 4. For example.001 002 003 004 005 006 007 008 009 010 011 012 PQ HSORT CUSTOMERS BY OSORT BY WHICH ATTRIBUTE [] 90 H BREAK -ON OBREAK -ON WHICH ATTRIBUTE [] 90 HLAST -NAME FIRST -NAME CITY STATE PX 90 IP A X The system displays text prompting for the attribute to use in a sort. starting at the line labelled 90. Do not submit the system supplied Proc to UCL with P. The subroutine executes until it encounters an X. The syntax is as follows: ([DICT] filename [item -ID]) [label# ] () transfers control to the 2nd line of the called Proc. for example LISTPROCS. A link differs from an external subroutine in that the system does not return control to the calling Proc. and transfers control to an internal subroutine. control returns to UCL. link. at which time it returns control to line 6 in the above Proc. it is possible to use it to share Procs across accounts. because the system does not return control to the original Proc. line 10. When CUST-SORT has finished executing. and continues to execute until the end of the Proc. the command: (MYPROCFILE FORMAT) 20 transfers control to the line labelled 20 in the Proc FORMAT in file MYPROCFILE. If you include a number. The system passes control to the subroutine a second time on line 7. The following Proc transfers control to an external subroutine: 001 002 003 004 005 006 PQ HSORT CUSTOMERS BY A2 H LAST -NAME FIRST -NAME STREET CITY STATE [MYPROCFILE FORMAT] 20 P The []. The subroutine continues to execute until it encounters an X. Note: Use [] when you want to execute a system supplied Proc. calls a subroutine starting at the line labelled 20 in the Proc FORMAT in file MYPROCFILE. on line 12. For example. LINKING TO ANOTHER PROC (). the command: (MYPROCFILE CUST -SORT) transfers control to the 2nd line of the Proc CUST-SORT in file MYPROCFILE. control transfers to the line in the called Proc with that label. on line 5. In addition. invokes another Proc from the Proc that is running currently. the 1st line contains the PQ code. and returns control to the line following the subroutine command. . Its most common use is to link short Procs stored in the Master Dictionary to longer Procs stored in another file. and return control to the Proc. on line 3.

For example: IF A3 G 50 tests for the presence of a 3rd parameter. shown in the following sections. Compare an input parameter to a pattern. The first three expressions use IF with a version of A. IF provides conditional branching. If false. but it does reposition the input buffer pointer. it does not move the specified parameter to the output buffer. The (). lines 15 and 16. The general syntax is as follows: IF condition command condition one of the five types of condition described in the following sections. TESTING FOR THE PRESENCE OF A PARAMETER This version of IF tests for the presence of a specified parameter in the input buffer. y y y y y Each of these conditional expressions has its own syntax. The syntax is as follows: IF [#]A[parameter#][. this version of IF tests a specified number of characters. it does not execute the PROC command. In addition. the system tests the entire parameter. For example: IF #A3 G 999 tests for the presence of a 3rd parameter. executes a specified PROC command. The following are types of conditional expression: Test for the presence of an input parameter.6 G 50 . Test for the presence of a select-list. but it transfers control to the command line labelled 999 only if there is no 3rd parameter. Compare an input parameter to a literal string. in the file TEST-PROCS. For example: .If you do not include an item ID. the system uses the current parameter in the input buffer. If you do not include parameter#. The # option for IF reverses the meaning of the test. command any PROC command. 012 013 014 015 016 017 ODO YOU WANT TO EXECUTE ANOTHER PROC FROM THIS FILE (Y/N) IP IF A = N X OENTER THE NAME OF THE PROC IP (TEST -PROCS) The above Proc prompts the user for the name of another Proc to execute and places the response in the input buffer. control passes to the command line labelled 50.#characters] command You indicate the parameter to test for by including its position in the input buffer with IF. For example: IF A3. the system uses the current parameter. if there is a 3rd parameter. on line 17 links to the Proc with the name indicated by the current input parameter. When used with GO and []. A operates differently when used with IF. the user's response. CONDITIONAL BRANCHING IF evaluates a condition and if true. If you do not specify the number of character you want to test. Test for a system error.

The system considers the character string with the higher ASCII equivalent greater. 02 is greater. If you do not select a parameter. Comparison Evaluation AAAA Testing stops at the 3rd pair of characters. the system uses the current parameter. SMITH Testing stops at the 3rd pair of characters. Some examples of how the comparison operator works are as follows. For example: IF A2 = DICT G 700 selects the 2nd parameter in the input buffer and tests that it is equal to the string DICT before transferring control to the command line labelled 700. JOHNSON Testing stops at the 3rd pair of characters. Since 2 is 005 greater than 0. Since B is AAB greater than A. Since Y is SMYTH greater than I. If it finds any characters.#characters] rel-op string command You can select any parameter in the input buffer by position. JONSON is greater. It is possible to test a parameter against a string using the relational operators listed below: Relational Operators = Equal to # Not equal to < Less than > Greater than [ Less than or equal to ] Greater than or equal to The system compares the ASCII values for each character in the specified parameter and in the literal string from left to right. COMPARING A PARAMETER WITH A LITERAL STRING This version of IF uses relational operators to test a specified input parameter against a literal string. it tran sfers control to the line labelled 50. SMYTH is greater. 02 Testing stops at the 2nd pair of characters. . AAB is greater. The syntax is as follows: IF A[parameter#][.tests up to six characters in the 3rd parameter. Since N is JONSON greater than H.

nA Parameter contains n alphabetic characters. If you do not specify the number of characters to test. In addition. If you do not specify the number of characters you want to test. it does not ignore them. For instance. For example: IF A3 # (2N/2N/2N) XINVALID DATE FORMAT tests the 3rd parameter to see if it is in the date format DD/MM/YY. 'string' Parameter matches string.4 > 1000 G 6 00 tests that the first four characters of the 3rd input parameter are greater than the string 1000 before transferring control to the command line labelled 600. placed in the input buffer when you use the B option of IP. For example: IF A3 = (0A) [] 20 tests to make sure the 3rd parameter contains only alphabetic characters before transferring control to an internal subroutine starting at the line labelled 20. the system considers the longer string to be greater. this version of IF can test a specified number of characters. . alphabetic. the system tests the entire parameter. IF tests to ensure that the parameter contains only characters of the specified type. or alphanumeric characters. but the shorter of the two is otherwise identical to the beginning of the longer string. If it is not. like any other character. the system tests the entire parameter.If the parameter and the string are not the same length. For example: IF A3.2 = (2N) G 500 This command tests the first two characters of the 3rd parameter to make sure that they are numbers before transferring control to the line labelled 500. this version of IF can test a specified number of characters. If you define the number of characters of a pattern as 0. you might want to test the first two characters of a part number to see if they are numeric. nX Parameter contains n alphanumeric characters. COMPARING A PARAMETER TO A PATTERN This version of IF uses relational operators to compare the specified input parameter with a pattern of alphanumeric characters. It is possible to test a parameter against a pattern using the relational operators. IF A3. In addition. The system compares backslashes (\). Pattern Specifications nN Parameter contains n numeric characters. The syntax is as follows: IF A[parameter#][. the Proc terminates with the message INVALID DATE FORMAT. For example: ABCD>ABC is true because the 1st string is longer than the second string. The pattern can comprise numeric.#characters] rel -op (pattern) command By including its position number with IF you can indicate the input parameter that you want to test.

If it finds one. For example: IF #S XNO SELECT -LIST PRESENT . or FIND. It is only appropriate to use this version of IF after a P. PLEASE TRY AGAIN. SAMPLE. for a specific error by error message number. PLEASE TRY AGAIN. Since a select-list is active only after a UCL command creates or retrieves it. The secondary input buffer is for temporary storage and its use as storage does not survive multiple process (P) commands. This version of IF tests the secondary input buffer for the presence of system messages. IF checks for the presence of any error in the secondary input buffer. For example: IF E XNO DATA MATCHES YOUR ENTRY. TESTING FOR THE PRESENCE OF A SELECT-LIST This version of IF tests for the presence of an active select-list. if it finds one. the system sends the error messages. from the ERRMSG file. to the secondary input buffer automatically. For example: IF E = 413 [] 500 branches to a subroutine if it finds error 413 THE FILE NAME ALREADY EXISTS IN THE MASTER DICTIONARY. this version of IF normally follows P. It is possible to test an error in the secondary input buffer against a single error message number or a range of error message numbers. It can test for unspecified errors. or retrieved a select-list with GETLIST. QSELECT. A select-list is active if the Proc created a select-list with SELECT. The syntax is as follows: IF [#]S command The # option to IF reverses the meaning of the test. The # option reverses the meaning of an error message test.TESTING FOR SYSTEM ERRORS If errors occur during the execution of a Proc-generated UCL command. SSAMPLE. SSELECT. or for a range of errors by error message number. For example: IF #E G 500 transfers control to the line labelled 500 only if it finds no error message in the secondary input buffer. The command: IF E < 99 IF E > 91 XTAPE ERROR tests for the presence of an error message number between 91 and 99. the Proc terminates with the message NO DATA MATCHES YOUR ENTRY. The system retains all error messages sent to the secondary buffer until you clear the buffer using IS. The syntax is as follows: IF [#]E [[rel -op] error] command If you do not specify an error message number. Note: The system resets the secondary input buffer to null before it performs any form of P. it terminates with the message TAPE ERROR. checks for any error message.

In converts an integer from 0 to 255.. clears the screen. The syntax is as follows: T option[. You need to return control to the Proc after invoking the select-list. to its equivalent ASCII character and displays it at the terminal.terminates the Proc and sends the message NO SELECT-LIST PRESENT if it does not find a select-list. You should separate the column and row option from the text option with a comma. The IF. (x[. You can display a line of text anywhere on the screen by including a specific column and row position with the text.option. T. line 6 and 7. For example: T C. to its equivalent ASCII character and displays it at the terminal. output user prompts. row 6. "text" displays the specified text at the current cursor position. (-m) causes the specified Cursor Function Code (-1 to -48) to take effect at the current cursor position. Option B C Function sounds a bell at the terminal. The following Proc prompts the user for the name of a select-list to retrieve.B clears the screen and sounds the bell at the terminal.6). terminal. . allows you to clear the screen. It is possible to continue a T onto multiple lines by ending the preceding line with a comma. You must enclose text in double quotes. For example: T (10. FORMATTING THE SCREEN You can create special formatted screens with PROC to simplify the user interface. on line 9.] T can contain one or more options. and display non-printable characters.. If it does not find one it terminates the Proc with the message 'ILLEGAL LIST NAME!'. Xnn converts a hexadecimal value from 00 to FF.y]) positions the cursor at column x and row y on the screen. tests for the presence of the select-list. separated by commas. before sending the UCL command that retrieves the select-list to the UCL processor. control the position of the cursor. line 8. and tests for its presence before continuing: 001 002 003 004 005 006 007 008 009 010 011 PQ HGET-LIST OENTER LIST NAME IP A STON H P IF #S XILLEGAL LIST NAME! HLIST CUST P The Proc places a carriage return in the stack. represented by nn. represented by n."ACTIVITIES:" displays ACTIVITIES: starting at column 10.

You can convert decimal and hexadecimal codes to the appropriate ASCII character with the I and X options. Begins reverse video field. Ends reverse video field. Ends protected field. Sets background colour. Sets background colour. Begins underlined field. Sets background colour. Sets background colour. Clears the screen from the cursor position to the end of the line. For example: T (0."CUSTOMERS MENU". Sets background colour. These options are useful for displaying non. For example: T (25. Cursor function codes control fields. Starts blinking field.3). Ends blinking field. Ends dimmed field. row 3.(-14) displays the text CUSTOMERS MENU at column 25. Sets foreground colour. row 8. Moves the cursor up one line. Sets back ground colour. Printer on Printer off Moves the cursor forward one space Moves the cursor down one line Sets background col our. [row] (-1) (-2) (-3) (-4) (-5) (-6) (-7) (-8) (-9) (-10) (-11) (-12) (-13) (-14) (-15) (-16) (-17) (-18) (-19) (-20) (-33) (-34) (-35) (-36) (-37) (-38) (-39) (-40) (-41) Clears the screen and positions cursor at upper left -hand corner (HOME). They are identical to the codes used by BASIC's @.printable characters.( -4) positions the cursor at column 0. Clears the screen from the cursor position to the bottom of the screen. Begins protected field. Positions cursor at HOME. For example: T I65 displays A at the terminal. T uses the terminal cursor specifications set by TERM. Cursor Function Codes Code Function (x. The cursor code -4 clears from the current cursor position to the end of the line. Moves the curs or back one space. The cursor code -13 begins a reverse video field and the code -14 and ends the reverse video field. Sets background colour. Ends underlined field.8).[x]) Cursor address column. .You can control the cursor with the cursor function codes.(-13). Begins dimmed field.

2.( -14) 004 T (10.10). and the cursor function code -14 ends the reverse video field. on lines 6 to 13 supply additional text for the menu. 005 "===================================================" 006 T (10. (-47) (-48) Sets foreground colour. Exit menu."CUSTOMERS MENU "."ACTIVITIES:" 007 T (20."2. 012 "===================================================" 013 T (25." 011 T (10.6). Sets foreground colour."1. The IP on line 14. The T on line 15 clears the screen before the IFs on the following lines branch to other Procs. Exit menu. ============================================================= MAKE A SELECTION : The T on line 2 sounds the bell and clears the screen. The Ts. Note: The colours set by @() depend in the particular terminal in use.3). The line label is 100 and the GO on line 20 references it. colour. it looks like this: CUSTOMERS MENU ===================================================== ACTIVITIES: 1. row 3." 008 T (20. and branches to another Proc depending on the function selected by the user: 001 PQ 002 100 T B. The following Proc displays a menu.( -13).( -13).9).C 003 T (25. The Proc includes spaces to make the field larger. displays its prompt at the end of the last displayed text and places the user's response in the input buffer.11). Most menu Procs have looping functions. colour.15). a line made up of equal signs (=).(-42) (-43) (-44) (-45) (-46) Sets Sets Sets Sets Sets foreground foreground foreground foreground foreground colour.13). The cursor function code -13 starts a reverse video field. Display information about a customer. 4. colour. Add a new customer. Delete an existing customer. Line 5 supplies the text." 010 T (20. colour. Display information about a customer.( -14) 014 IP: 015 T C 016 IF A = 1 [MYPROCLIB CUST -INFO] 017 IF A = 2 [MYPROCLIB CUST -ADD] 018 IF A = 3 [MYPROCLIB CUST -DELETE] 019 IF A = 4 X 020 GO 100 When you execute this Proc."MAKE A SELECTION".8)."3. The T starting on line 4 gives the column and row numbers for some text. Delete an existing customer. The T on line 3 displays CUSTOMERS MENU at column 25.4). ." 009 T (20. The line ends with a comma and continues on line 5. Add a new customer. 3."4.

process. The system makes the primary output and input buffers active again automatically whenever a P sends a command to UCL. any input placed in the secondary input buffer replaces the entire contents of the buffer. STON activates the secondary output buffer. and the primary input active with SP. PROC commands that place strings or parameters in the active output buffer place them in the stack. on line 20. Each command line in the secondary output buffer. control returns to line 2 by the GO. the system recognises < as a carriage return character. P adds a carriage return automatically to the last line in the stack. In the secondary output buffer. P submits the UCL command held in the primary output buffer. STOFF turns off the stack and makes the primary output buffer active. the system sends the prompt character to the screen and accepts data from the keyboard. If that command invokes a processor that requires input. This UCL command invokes the other processor. STORING DATA AND COMMANDS FOR ANOTHER PROCESSOR The system stores data and commands you want to pass to another processor in the secondary output buffer. If there is no more data in the secondary output buffer and the other processor keeps requesting da ta. The secondary input buffer is only a temporary storage place for input. such as BASIC or the Editor. the carriage return character (<) serves as a delimiter between the commands. You can make the primary output buffer active with STOFF. USING THE SECONDARY BUFFERS You use the secondary output buffer to store data or a series of commands for use b another processor y invoked by a Proc. A P. It places data in the secondary output buffer by making the buffer active and copying strings and input parameters to it with the appropriate PROC commands. The syntax is as follows: STON or ST ON Once you have activated the secondary output buffer. PROC commands operate on the active output or input buffer. and this then redisplays the menu. but i f placed at the end of the string. the primary output and input buffers are active by default. the system takes input from the secondary output buffer a line at a time. and the secondary input buffer active with SS.On completion of the execution of the called Procs. If embedded in a string the system recognises < as the less than character. in addition. Usually P turns off the secondary output buffer. The Proc then passes data or commands held in the secondary output buffer to the other processor one line at a time. but. When you invoke a Proc. and to hold input from the user when it is desirable to preserve the contents of the primary input buffer from job to job in a Proc. but in the string: HLAST-NAME< the system recognises the < character as a carriage return. You use the secondary input buffer to store messages from the system in response to a Proc-invoked UCL command. except for the last line. The secondary output buffer is sometimes called the 'stack' because you can place a stack of multiple commands in it. select primary. The < character has special meaning when placed in the stack. passes the command in the primary output buffer to the UCL processor. You manipulate the secondary buffers by making them active. stack on. The secondary buffers work somewhat differently from the way the primary buffers work. must end with a carriage return character. stack off. The syntax is as follows: . Note: Build a stack only for the UCL command you want to execute with the next P. For example: H AMOUNT < "100" The system recognises the < character as the less than character. P clears both output buffers on completion. select secondary. You make the secondary output buffer active with STON.

and uses the list in a SORT. you can use the secondary input buffer to store user input. 001 002 003 004 005 006 007 008 PQ HGET-LIST OENTER LIST NAME IP A STON HSORT CUSTOMERS P The STON. your 006 O initials. you lose the list. The P on line 13 invokes the Editor on the specified program and passes the two commands stored in the secondary ou tput buffer to the Editor. IS. if it is not.No program ID. The syntax is as follows: SS In addition. activates the secondary output buffer. The syntax is as follows: . The P.Please remember to make your log entry. The following Proc retrieves a select-list with GET-LIST. you expect that the next UCL command entered is a command that uses that list. GET-LIST listname. 007 O 008 HED BP 009 A2 010 STON 011 HL/*$LOG< 012 HI 013 P The H and A on lines 8 and 9 place the command ED BP progname in the primary output buffer. As described earlier. 004 O-. and executes both commands. and a brief description of the program change.STOFF or ST OFF The following Proc invokes the Editor and prompts the user to add a comment line to a program in the file BP: 001 PQ 002 C This Proc edits a basic program and requests a modification log entry. input secondary. enter a comment line sho wing date. to the UCL processor. on line 8. USING THE SECONDARY INPUT BUFFER The secondary input buffer stores any system messages sent in response to a Proc-invoked UCL command. and the system places the command SORT CUSTOMERS in it. followed by the contents of the secondary output buffer. makes the secondary input buffer active. SORT CUSTOMERS. and the two Hs on lines 11 and 12 place two Editor commands in it. 003 IF #A2 X -. USING THE SECONDARY OUTPUT BUFFER WITH A SELECT-LIST When you invoke a select-list. output buffer to the Editor. When you see the 005 O insert prompt. In addition. SS makes the secondary input buffer the active input buffer. sends the contents of the output buffer. you can use IF to check for the presence of a system message in the secondary input buffer without making it the active buffer. on line 6. It places user input directly in the secondary input buffer without requiring that you make the secondary input buffer active with SS. The STON on line 10 activates the secondary output buffer.

How to construct a UCL command in the output buffer. . FUNDAMENTAL PQX/PQN COMMANDS This help introduces the fundamental PQX/PQN commands organised by function. constructing a UCL command in the output buffer. you usually use it to store input used only once. you can preserve the contents by using SS to select the buffer. IS replaces the entire contents of the secondary input buffer. UNDERSTANDING THE BUFFERS PQX/PQN commands manipulate data held in four different buffers: . For example: IS? prompts with a question mark (?). SP makes the primary input buffer active again. the end portion of the following Proc. uses the secondary input buffer to store the response to a YES/NO question. so that it does not replace any of the parameters in the primary input buffer. How to send the contents of the output buffer to the UCL processor. and displaying the contents of the buffers. How to move the input buffer pointer. The syntax is as follows: SP Because the secondary input buffer's contents are volatile. It describes such basic procedures as prompting the user for input. As was mentioned earlier. The B option to IS converts any spaces in an input string to backslashes. . you can find descriptions of more advanced features of PQX/PQN as subroutine. How to place or manipula te information in the input buffer. changing the current parameter. F or S to position the pointer. For example. How to display the contents of both the input and output buffer.IS[B][character] A colon (:) is the default prompt displayed by IS. unconditional and conditional branching. Later in this help. You can change the prompt by specifying another character with IS. formatting menus and the use of the secondary input and output buffers. In this case input replaces only those parameters from the pointer to the end of the buffer. This help covers the following topics: y y y y y y How the system stores data in the PROC buffers. 027 028 029 030 031 032 033 ODO YOU WANT TO SEE THE NEW ITEM (Y/N)+ IS? IF A=N X HCT CUST SP A1 P It places the user's YES/NO response in the secondary input buffer with the IS on line 28. However. It makes the primary input buffer active again with the SP on line 31 so that the next A on line 32 copies the 1st parameter from the primary instead of the secondary input buffer. and IP to place input in the buffer. A prompt character remains in effect until another IP or an IS changes it.

The secondary buffers have their own specific job functions and work slightly differently from the way the primary buffers work. The system does not move the p ointer. where it is possible to test them or copy them directly to the primary output buffer for use in the UCL command cons tructed there. The secondary output buffer can store data or a series of commands used by another processor invoked by the UCL command constructed by a Proc. When you enter a Proc statement at the UCL prompt. It is possible to use some commands to select a specific parameter. When you enter a Proc at the UCL prompt. Strings placed in the primary input buffer replace the current parameter. the system places its name and any parameters included on the command line in the primary input buffer.* * * * primary input buffer. The buffers store data in strings that comprise one or more parameters. Although it is possible to use the commands described in this help to manipulate data in all four buffers. You delimiter parameters using at least one sapce. The secondary input buffer holds input provided by the user or by system processors while the Proc is executing. the foc us of this first section is on the use of the two primary buffers. By moving the pointer you can designate any parameter as the current one. It is possible to use the secondary input buffer to hold input from the user in order to preserve the contents of the primary input buffer from job to job in a Proc. It is possible to place text strings directly in either buffer. the system stores the . The system always places strings added to the primary buffer at the end of the buffer. When the Proc moves data between buffers. the input buffers can hold literal strings or an entire tape label. If an input string contains embedded spaces the system interprets the string as a group of multiple parameters. while other commands require that you move the buffer pointer with an additional command. In addition. one input and one output buffer are active. the data goes from the currently active input buffer to the currently active output buffer. The two most commonly used buffers are the two primary buffers. The system holds this UCL command in the primary output buffer until the Proc submits it to the UCL processor. PQX/PQN commands select and move elements from the input buffers to the output buffer in order to create a UCL command eventually submitted to the UCL processor. STORING INPUT The primary and secondary input buffers hold any information entered by the user during the execution of a Proc. In addition it can hold messages sent in response to a command submitted to UCL. secondary input buffer. Com mands operate on the current parameter referenced by a buffer pointer. At any given time. so it points to the beginning of the new string. secondary output buffer. primary output buffer. When you add strings to a buffer the system places them at the current position of the buffer pointer. You can find a more detailed description later in this help. you activate them using specific PQX/PQN commands. You can place responses to prompts displayed by the Proc during its execution in either input buffer.

It expects the user to supply two amounts on the command line. the 1st argument. and copies what the user enters at this prompt into the active buffer. The second form of IP places the input in the buffer or register specified. If a user entered CA at the prompt. and r is the buffer where you want to place the input. 50. For example: IP: prompts with the colon (:). the parameter it places in the active input buffer becomes the current parameter. You must always specify the prompt character before the register number. The syntax is as follows: I[B]P[c] I[B]Pcr where c is the prompt character. and the 2nd argument 100. . The O. becomes parameter 3. if omitted the system defaults to the last prompt character used.entire command line in the primary input buffer. For example. A question mark (?) is the default prompt displayed by IP. It is possible to change the prompt by specifyin g another character with IP. becom es parameter 2. PROMPTING FOR USER INPUT A Proc can prompt for input during its execution using one of two commands: * IP * IBP IP displays a one character prompt for user input. The system uses an A. on line 3. copy input. on the line 4. to copy the parameters to the primary output buffer. and encloses it in quotes using the A on line 5. IBP operates in the same way except that it leaves any blanks intact. The first form of IP replaces the current input parameter with the user's response to the prompt. and the IP:. It can identify each parameter by its position in the primary input buffer. A prompt character remains in effect until another command changes it. IP replaces the current parameter in the primary input buffer with CA. in the primary input buffer. displays the text WHICH STATE. For example. For example: IP:&1. CA becomes the current and the system copies it immediately to the primary output buffer. the following command line for a Proc sorts orders within a certain range. Thus. a Proc called CUST -SELECT prompts the user to enter the name of a state in a selection expression. CUST -SELECT. places the user's re sponse in the primary input buffer. as shown below: >SORT-ORDER 50 100 The name of the Proc.1 prompts with a colon. SORT -ORDER becomes parameter 1. IP does not move the buffer pointer. as follows: 001 PQX 002 HSORT CUSTOMERS BY LAST -NAME WITH STATE = 003 OWHICH STATE+ 004 IP: 005 A" 006 HLAST -NAME FIRST -NAME CITY STATE ZIP 007 P When you invoke the Proc. the system places the command line. replacing any blanks occurring within the string with attribute marks.

The syntax is as follows: IT The tape label replaces the entire contents of the active input buffer and positions the pointer at the beginning of the buffer. the system places the command line. IBH operates in the same way except that it leaves any blanks occurring in the string intact. displays a line of text on the screen. NAMES. on the same line. READING A TAPE LABEL INTO THE ACTIVE INPUT BUFFER IT. The s ystem uses this frequently with IP to describe the input expected from the user. It replaces any blanks occurring within the string with attribute marks. as follows: 001 PQX 002 OWHAT NAME+ 003 IP:&1. This allows the system to display the prompt for an IP. The syntax is as follows: Otext[+] You should not include a space between the O and text unless you require a space explicitly in the text on the screen. that often follows. the following sequence of commands: OINCLUDE ORDERS WITHIN WHAT RANGE+ IP: displays the following message and the prompt character. For example. The O. in the primary input buffer. In addition. places the user's response in attribute 1 of the 1st buffer.in-conv I[B]H:out -conv IH\ IH \ IHtext replaces an existing parameter or adds a new parameter at the end . reads a tape label from an attached tape into the active input buffer.1 004 P When you invoke the Proc. If IT does not find a tape label. For example. the system would include a space before th e word INCLUDE. on the same line as the output text. followed by a carriage return. a colon. create new null parameters. OINCLUDE ORDERS WITHIN WHAT RANGE displays INCLUDE ORDERS WITHIN WHAT RANGE on the screen. input tape. places a fixed text string in the active input buffer. and the IP: on line 3. The syntax is as follows: I[B]Htext I[B]H. on line 2 displays the text WHAT NAME. input text. prompts the user to enter the name you want to place in the buffer.IP makes the buffer specifie d the active buffer. The + option suppresses the carriage return after the O. a Proc called NAMES. In addition it is useful for outputting status messages from a job stream. IT does not convert multiple blanks into attribute marks. the system clears the input buffer. PLACING TEXT STRINGS IN THE ACTIVE INPUT BUFFER IH. O. and perform input and output conversions before placing the text string in the buffer. it allows you to null an existing parameter. output. If you were to include a space between the O and INCLUDE. INCLUDE ORDERS WITHIN WHAT RANGE? In addition the user enters their response on the same line.

and load it into selec t register n. If you use a buffer reference instead of a literal. the reference must follow IH immediately. Once the system has added the parameter the buffer pointer remains in the same position. SSELECT. without a leading attribute mark. invokes the ELSE condition. CLEARING AND OPENING A FILE F-OPEN clears and opens a file to allow reads and writes. otherwise the system loads it as a literal. For example: . The system references item -ids one at a time. and continues execution with the next line. or a direct or indirect buffer reference. otherwise the system skips the ELSE condition. loads the item list into select register 1. the replaces that parameter with text. that is. IHtext. IH \ creates a new null paramet er at the position pointed to by the input buffer pointer. GET -LIST. If the buff er pointer is in the middle of a parameter. from that point and replaces them with a null parameter.in -conv and IHtext:out -conv allows you to apply an input or output conversion to the text before placing it in the buffer. text a literal. IH\ nulls the current parameter. If the buffer pointer is at the end of the buffer. starting at the location of the pointer. you must place PQ -SELECT on the stack. and displays them one at a time. Any attempt to open a non -existent file. the system removes the remaining character. using the direct or indirect reference !n. depending on the position of the input buffer pointer. Once you have opened a file it remains open during the execution of the Proc. the system deletes the characters between the attribute marks. that is the line following the F-OPEN.of the can be If the system buffer. the system appends a new parameter. The syntax is as follows: PQ-SELECT n In order to process a selected list within a Proc. including Proc to Proc transfers. buffer pointer is at the beginning of an existing parameter. You ca n re-use file buffers by issuing another F -OPEN. The list might be the result of a SELECT. LOADING ITEM-IDS INTO A SELECT REGISTER PQ-SELECT loads a list of item -ids into a select -register. For example: 001 PQX 002 HSSELECT CUSTOMERS 003 STON 004 HPQ-SELECT 1 005 P 006 10 MV % 1 !1 007 IF %1 = " " X 008 T %1 009 GO 10 Selects all the items in the CUSTOMERS file. The syntax is as follows: F-O[PEN] n [DICT] filename Note: There is ALWAYS an ELSE condition associated with F -OPEN. If the pointer is in the middle of a parameter. to the original parameter. the system creates a new parameter. FORM -LIST or SEARCH.

that is the line following the F -READ. The syntax is as follows: F-R[EAD] n item -id Note: There is ALWAYS an ELSE condition associated with F -READ. READING RECORDS INTO THE 'FAST BUFFER' As with read ing items into a file. execution continues with the message FILE OPENED SUCCESSFULLY!. If the system cannot open the file represented by %1. If you do not specify an item -id. The syntax is as follows: F-UR[EAD] n item -id Note: There is ALWAYS an ELSE condition associated with F -UREAD. If the system cannot find the item. therefore the system destroys its contents with each subsequent use of the command. The syntax is as follows: FB [DICT] filename [item -id] Note: There is ALWAYS an ELSE condition associated with an FB. otherwise. the system uses the value in the active input buffer. For example: 001 PQX 002 F-READ 1 123 -AB 003 XITEM 123 -AB CANNOT BE FOUN D 004 OITEM 123 -AB FOUND Reads the item 123 -AB into file buffer 1. READING ITEMS FROM A FILE There a two commands that read items from a file: * F-READ * F-UREAD F-READ reads an item from a file into a file buffer. otherwise the system skips the ELSE condition. there are two commands that read records into the 'Fast Buffer': * FB * FBU There is only one 'fast buffer'. it displays CANNOT OPEN THE FILE and exits the Proc. To release the locks use F -FREE. and continues execution with the next line. If the system cannot find the specified item in the file. otherwise it displays ITEM 123 -AB FOUND and execution of the Proc continues. the system . If the system cannot find the specified item in the fil e.001 PQX 002 F-OPEN 1 %1 003 XCANNOT OPEN FILE 004 OFILE OPENED SUCCESSFULLY! . the system invokes the ELSE condition. otherwise the system terminates execution of the Proc and displays an error message. the system displays ITEM 123 -AB CANNOT BE FOUND and exits the Proc. FB reads a record into a 'fast bu ffer' without opening the file explicitly. thus preventing other processes from locking it. F-UREAD reads an item from a file into a file buffer and locks the specific item. You must have opened the file you want to read using F -OPEN. You should use F -UREAD whenever you want to perform a read and there is the possibility that more than one process might attempt to update the same item simultaneously.

F -FREE only unlo cks the specified item. &n. DELETING ITEMS There are two commands associated with deletion of items: * F-DELETE * MVD F-DELETE deletes the item specified in attribute zero. RELEASING ITEM LOCKS F-FREE releases an item lock set by F -UREAD or FBU. 001 PQX 002 FB STAFF 14324 003 XITEM NOT ON FILE 004 MV #3 &12 . the Proc exits and displays ITEM NOT ON FILE. F-FREE only unlocks the items in that file.0. execution of the Proc terminates and the system displays an error message. item -id in &1.0. The syntax is as follows: FBU [DICT] filename [item -id] Note: There is ALWAYS an ELSE condition associated with and FBU. F -DELETE does not alter the contents of the file buffer. F-DELETE or the termination of the Proc release item locks. The syntax is as follows: F-D[ELETE] n If you have not opened the file. If the system cannot find item 14324. F-DELETE 1 Deletes the item. thus preventing other p rocesses from locking it. To release the locks use F -FREE. FBU reads a record into a 'fast buffer' without opening the file explicitly and locks the item. Use LIST-ITEM-LOCKS to list all locked items. or a direct or indirect buffer reference. If you specify a file buffer reference number.invokes the ELSE condition. Reads item 14324 from the STAFF file into the 'fast buffer'. F-FREE 1 Unlocks all the items in the file defined by file buffer 1. Once an item is i n the 'fast buffer' you reference it as &a where a is an integer. MVD deletes the specified source value from a multi -valued attribute in the destination buffer. otherwise the system skips the ELSE condition. of the file buffer specified by n in the file opened previously. that is the line following the FB. from the file defined by file buffer 1. Note: F -WRITE. otherwise execution continues with line 4. You should use FBU whenever you want to perform a read and there is the possibility that more than one process might attempt to update the same item simultaneously. not a variable containing an integer. MVD destination source . F -FREE releases all item locks set by the Proc. If you specify both the item id and the file buffer reference number. . and continues execution with the next line. The file buffer reference can be a literal. The syntax is as follows: F-F[REE] [n[ item -id]] If you do not specify a file buffer reference number.

the system moves all parameters to the right. The item -id is in &3. the system takes no action. the system assumes it value is 0. F-WRITE 3 Writes the item contained in file buffer 3 to the last file opened for file buffer 3.0. If the number of characters in a parameter increases after execution of +.%1:C2: -.?%1 011 IFN %1 > 9 GO 20 012 D5 Builds a multi -valued attribute in %5 consisting of the numbers 10 to 20. the system assumes its value is 0. If &3. PERFORMING ARITHMETIC OPERATIONS You can add an integer to or subtract an integer from any parameter in the active input buffer. execution of the Proc terminates and the system displays an error message: There is no need to specify the item -id.. WRITING A FILE BUFFER TO DISK F-WRITE writes the contents of the specified file buffer to disk.%1:C1+. If integer contains leading zeros."" 003 10 MVA%5%1 004 F. +. the system ignores them. you must move the buffer pointer to the correct parameter. The input parameter can be a negative number.?%1 005 IFN %1 [20 GO 10 006 D5 007 S1 008 -1 009 20 MVD %5 %1 010 F. subtract.0 is null.. F-W[RITE] n If you hav e not opened the specified file buffer. since the system assumes it to be in attribute 0 of the file buffer. the system only deletes the 1st occurrence. 001 PQX 002 MV%1"10". subtracts an integer from this parameter. then deletes all the even numbered values.. Before you can perform any arithmetic on a parameter.If the value exists more than once in an att ribute. The syntax is as follows: +integer -integer If integer is negative or non -numeric. However. add. using B. F-WRITE does not change the co ntents of the file buffer. back and F. 001 PQX 002 OTHIS PROC SORTS ORDERS BY $100 INCREMENTS 003 HSORT ORDERS BY AMOUNT WITH AMOUNT < 004 OSTART AT WHAT DOLLAR SUM+ 005 IP? 006 A" . forward . adds an integer to the current parameter in the input buffer. -. if it is non numeric.

element]. Each operator performs its function on the top two entries in the stack. add top two stack entries together. F.007 HDATE AMOUNT 008 P 009 20 OPRESS P TO PROCEED.*. moves the pointer back one parameter. F. reverses the top two stack entries. Note: This is the reverse of how the VISION stack operates. The B. The syn tax is as follows: F:element[. places the value 20 on top of stack 1. deletes them and places the result on top of the stack. performs more complex arithmetic calculations. The system calculates all functions using fixed point. and you perform the following arithmetic calculation on it. on line 13.C20. Valid Operands Operand r [C]n + * / R _ ?P ?R Function stack function from location specified by reference r. on line 5.?%2. subtract stack 1 from stack 2. the system positions the input buffer pointer at the end of the buffer. divide stack 2 by stack 1. integer arithmetic. The following illustrates this: ---------| 20 | | 3 | | 60 | |----| |----| |----| | | | 20 | | | ---------The 1st element C20. multiplies the top two stack entries. Each operand places a value on top of the stack. store result at location specified by the reference R. PERFORMING ARITHMETIC CALCULATIONS Assume an input buffer contains XXX^322^ABCD^3^44. on line 14 adds 100 to that parameter. divide stack 2 by stack 1 and place the remainder on top of the stack. The next . XXX^60^ABCD^3^44. the +.%4. st ore result. After perform ing the IP. current value on top if the stack. at current position in the primary input buffer.. F. stack constant numeric value n. uses a stack processor similar to the one used in the F correlative. X TO EXIT 010 HSORT ORDERS BY AMOUNT WITH AMOUNT > 011 A" 012 HAND WITH AMOUNT < 013 B 014 +100 015 A" 016 HDATE AMOUNT 017 PW 018 GO 20 Sorts orders by $100 increments. The system processes the command from left to right.. after prompting for the sum at which to start. the result is as follows.

CLEARING INPUT BUFFERS There are two commands that clear the input buffers: * RI * F-CLEAR RI. This guarantees t hat the file buffer is empty prior to its use. Finally. on top of the stack. MOVING THE ACTIVE INPUT BUFFER POINTER BACKWARD B. For example. places the value in the 4th parameter of the primary input buffer. The syn tax is as follows: . Some PROC commands move to a specific parameter by including its position with the command. A2 copies the 2nd parameter from the active input buffer to the primary output buffer. The pointer remains on the attribute mark. Note: F -OPEN clears the specified file buffer. Other commands require that you move the buffer pointer to the correct parameter. ?%2 places the result. F-CLEAR clears a specified file buffer. The PROC processor does not allow a reference to a file buffer unless the file is clear or open. deletes them and puts the result. 60.. The syntax is as follows: RI[p][(n)] RI specified with no options clears both input buffers. MOVING THE ACTIVE INPUT BUFFER POINTER FORWARD F. in the 2nd parameter of the primary input buffer. RI(n) clears the buffer from the nth column. RI3 clears from the beginning of the 3rd parameter to the end of the primary input buffer. moves the input buffer forward until it encounters an attribute mark. RIp clears the buffer from the pth parameter. The syntax is as follows: F F. on top of the stack.1%1 Clears file buffer 1 prior to building a record in it. %4.. 001 PQX 002 F-CLEAR 1 003 MV &1. overwriting the old value.. SPECIFYING THE CURRENT INPUT PARAMETER PROC commands operate on the current parameter. You should use F -CLEAR prior to building a record in a file buffer. the system positions the input buffer pointer following the last parameter at the end of the buffer.element. 60. moves the inpu t buffer pointer forward to the next parameter. forward. The syntax is as follows: F-C[LEAR] n F-CLEAR clears the file referenced by n. moves the input buffer pointer backward one parameter. the next element multipl ies the top two values in the stack.1 "data. reset input. back." 004 MV &1. In addition. as well as the entire secondary input buffer. . 3. RI clears the entire secondary buffer. If the pointer reaches the end of the last parameter witho ut encountering an attribute mark. clears the contents of both the primary and secondary input buffers and activates the primary input buffer.

S(n) positions the pointer at the nth column in the primary input buffer. PLACING TEXT STRINGS IN THE ACTIVE OUTPUT BUFFER H. and moves the pointer back to the attribute mark preceding the previous parameter. move the output buffer pointer back one parameter and clear the entire contents of the buffer. For example. the system treats it as if it was on the preceding attribute mark. including leading an trailing blanks. copy input. THE PRIMARY OUTPUT BUFFER The system holds the elements of a command you want to submit to the UCL processor in the primary output bu ffer. SETTING THE ACTIVE INPUT BUFFER POINTER S.#characters] A positions the output buffer pointer at the attribute mark terminating . copies a parameter from active input buffer to the end of the active output buffer. text. If the pointer is at the 1st character of a parameter. B has no effect. A leading space is significant. moves the input buffer pointer backward until it encounters an attribute mark. set moves the input buffer pointer to a specific parameter or column. Note: If you pl ace the text string in the primary output buffer to be processed by P. COPYING INPUT TO THE ACTIVE OUTPUT BUFFER A. The < carriage return symbol is only necessary if you want to place the string in the secondary output buffer. adds a text string to the active output buffer. It is possible to add text strings to this buffer. p can be a literal. P replaces any attribute marks with spaces. The system replaces any blanks.B B. If the pointer is at the beginning of the buffer. and identifies MD and a separate parameter. copy parameters. with an attribute mark. The syntax is as follows: Htext[<] H adds the specified text to the end of the active output buffer and positions the pointer at the end of the string. The syntax is as follows: A[surr-char][parameter#][. The syntax is as follows: Sp|(n) Sp positions the pointer at the pth parameter in the active input buffer. or a direct or indirect buffer reference. LIST ONLY MD Note: The system preserved the space between ONLY and MD. The system supplies the carriage return automatically when placing output in the primary output buffer. the command: S3 moves the primary input buffer directly to the attribute mark preceding the 3rd parameter. 001 HLIST ONLY 002 H MD Loads the following string into the primary out put buffer.

it copies the current parameter in the active input buffer. A'3 and A'4 on lines 8 and 9 surround SORT and ERRMSG with single quotes and moves these values to #3 and #4. The A on line 11 moves the string "WITH *A1 =" into #5. The IF. positions the buffer pointer at %1. on line 13 locates the 35th character in the input buffer. The A. on line 12 surrounds the value in %6.7) 014 P The S1. This does NOT increment the pointer. into #7. If you specify A without any options. on line 5 moves the string LIST to the active output buffer. The A(35. this increments the pointer to %2. If the secondary output buffer is active. on line 6 verifies that %2 contains the string MD. The A on line 7 loads MD into #2. "MD". The system stores the new value in ascending ASCII sequence.7). . A continues copying until it encounters an attribute mark.the copied parameter for the primary output buffer. "DBL -SPCX" 004 S1 005 A 006 IF A # MD X%2 WAS NOT MD 007 A 008 A'4 009 A'3 010 S5 011 A 012 A"6 013 A(35. starting with the 35th character. on line 10 positions the pointer at %5. #1. starting at the L in LIST and counting. with double quotes and moves it to the end of the output b uffer. For example. source is the field you want to copy. A places data in the buffer as a separate parameter. The syntax is as follows: MVA destination source destination is the buffer into which you want to copy the field. for a length of 35 bytes. It moves 7 characters. "SORT" 003 MV %5 "WITH *A1 =". After line 3 the input buffer contains: LIST^MD^ERRMSG^SORT^WITH *A1 = ^Q^DDBL -SPCX The Proc produces the following command: LIST MD ERRMSG SORT WITH *A1 = "Q" DDBL -SPC PRIMARY INPUT BUFFER %1 %2 %3 %4 %5 %6 %7 LIST MD ERRMSG SORT WITH *A1 = Q DDBL -SPCX 12345 678 9012345 6789012345678901 23 456789012 0 1 2 3 4 ACTIVE OUTPUT BUFFER #1 #2 #3 #4 #5 #6 #7 LIST MD ERRMSG SORT WITH *A1 = Q DDBL -SPCX COPYING A VALUE FROM A FIELD STORING IT AS A MULTI-VALUE IN THE BUFFER MVA copies a value from a source field into a destination buffer and stores it as a multi -value. If the primary output buffer is active. and can be a direct or indirect buffer reference. The S5. "ERRMSG". NOT enclosed in quotes. and can be a literal. Q. "Q". including attribute marks. or at the end of the buffer for the secondary output buffer. or a direct or indirect buffer reference. on line 4. A concatenates the value to the previous parameter in the buffer. In addition. 001 PQX 002 MV %1 "LIST". The A"6.

and/or literal strings enclosed in quotes. If you want to change more than one attribute.assume file buffer 1 contains the following: 000 1494 001 DEF]GHI 002 JKL 003 FOR The following command: MVA %1. For example: MV%2 &1. thus destroying the ascending sequence. . source is the buffer from which you want to copy data. it cop ies the literal "ABC" into the 3rd attribute. the system con catenates the source value into one attribute in the destination file. and copies the result as a single attribute into the 2nd parameter of the input buffer. COPYING DATA BETWEEN BUFFERS MV copies data between. For example: MV%2&2. Care should be taken if the source value is multi -valued. since the system copies it as is. outp ut buffers.12 Copies the 7th attribute of file buffer 2 into the 2nd parameter of the primary input buffer. In addition. The syntax is as follows: MV destination source. and can be a direct or indirect buffer reference. it copies each subsequent value into successive locations in in the destination buffer. input buffers. the system nulls destination.7. If the attribute or parameter number in destination is larger than the current number of attributes or parameters. you should use commas in the source to preserve those attributes. the system copies the 1st va lue to destination.%4 Changes it to: TEST^TEST^X^X If you separate a series of values with asterisks instead of commas.1? &1. a series of values made up of direct or indirect references. without changing the attributes in between. assume the buffer contains: TEST^AB^12^X The following command: MV%2 %1.3 Changes the contents of file buffer 1 to: 000 1494 001 DEF]FOR]GHI 002 JKL 003 FOR Notes: If the source value is already in the buffer.7*"TEXT"*%4 Concatenates the 4th attribute of the input buffer to the literal string TEXT and concatenates this to the 7th attribute of file buffer 1. to the destination buffer and might create duplicate values. file buffers and select registers. data can be a single value. no duplication takes place."ABC". For example. If source is a literal string containing just two double quotes. and the next value from select register 2 into the 4th attribute of the primary input buffer. the system creates null values automatically to space out to the requested location.. If source is a series of values. destination is the buffer into which you want to copy the field.

The syntax is as follows: RO Note: P clears bo th output buffers automatically and selects the primary output buffer as the current active buffer. It makes the primary output buffer active. After execution of the UCL command. SPECIFYING A COMMENT IN A PROC C specifies a comment line in a Proc. process. it moves the pointer back to the position following the last character of the previous parameter. the PROC proce ssor clears both output buffers and loads any error message numbers into the secondary input buffer. actually submits the command to UCL for execution. F-READ. these are the lines that follow F -OPEN. Each P clears both output buffers and thus they are ready to hold the next UCL command. It is possible to submit a series of UCL commands from the same Proc. CLEARING BOTH OUTPUT BUFFERS The system clears both output buffers. so that anyone using the same Process cannot process it simultaneously. The syntax is as follows: P[H|Ln|P|W|X] P without any options submits the contents of the primary output buffer directly to the UCL command processor. This command is useful for debugging a Proc and the section entitled Displaying Buffer Contents later in . The syntax is as follows: Ctext text can be any string of characters. omitting it creates a blank comment line. PP displays the contents of both output buffers on the screen followed by a ? prompt before submitting the UCL command. n can be from 0 to 255. F-UREAD. FB or FBU. effectively deletes the last parameter in the active output buffer. back output. but suppresses any output to the screen. You must submit each command by its own P. The options to P affect the way it operates: PH submits the UCL command.MOVING THE ACTIVE OUTPUT BUFFER POINTER BACK BO. The syntax is as follows: BO If the active output buffer contains only one parameter. Notes: Too many comment lines placed at the beginning of the Proc slows down processing. positions the output buffer pointers at the beginning of their respective buffers and makes the primary output buffer active. Comments prove useful when modifying or debugging a Proc. SUBMITTING A COMMAND TO THE UCL PROCESSOR The primary output buf fer holds a command for the UCL processor. PLn sets execution lock n before submitting the command. Do not put comments on lines reserved for special purposes. and returns control to the command immediately following the P. BO moves the pointer to the beginning of the buffer. P. You can use C to document how a Proc works or what it does. PW displays the contents of both output buffers followed by a ? prompt and waits for response from the user before continuing.

The D. of to the PROC processor.this help describes it in more detai l. display. It is possible to insert PROC commands that display buffer contents and remove them once the Proc is running correctly. displays one or more parameters from the active input buffer on the screen. on line 13 reads the 3rd parameter into an output line that asks for confirmation of the ending point. instead. the system does not return control to the original Proc. To return control to the Proc. For example. You can include any number of Ps in a Proc. On execution the Proc produces an output similar to the following: >RANGE 1 100 START AT 1? (Y/N):Y END AT 100? (Y/N):Y . 001 PQX 002 HSORT ORDERS BY AMOUNT WITH AMOUNT GT 003 A"2 004 HAND LT 005 A"3 006 HAMOUNT DATE 007 OSTART AT+ 008 D2+ 009 O? (Y/N)+ 010 IP 011 IF A = N GO 1 012 OEND AT + 013 D3+ 014 O? (Y/N)+ 015 IP 016 IF A = N GO 1 017 P 018 1 X The D. process. Note: If you execute a Proc from a Proc using P. it can be helpful to examine the contents of the active input buffer and the two output buffers. the command: D2 displays the 2nd parameter in the active input buffer. use []. DISPLAYING THE CONTENTS OF THE ACTIVE INPUT BUFFER D. D follows its display with a carriage return. submits the UCL command and exits the Proc. D without any options display s the current parameter. It is possible to suppress this carriage return with the + option. PX DISPLAYING BUFFER COMMANDS When writing a Proc. display. You can display the contents of the active buffer with D. on line 8 reads the 2nd parameter from the input buffer into an output line that asks for confirmation of the starting point. You can display the contents of both output buffers with options to P. To display a parameter other than the current parameter. Normally. The syntax is as follows: D[n][+] D does not change the position of the buffer pointer. For example the following Proc sorts orders within a range specified by the user. The command: D0 displays the entire contents of the active input buffer. specify its position with D. call.

process.. PW displays the contents of both output buffers on the screen followed by a ? prompt. For example. submits a command constructed in the primary output buffer to the UCL command processor.00 10106 $60. N or X aborts the Proc and returns control to UCL. Y or <RETURN> submits the current UCL command and continues with the Proc. displays the contents of the output buffer and waits for the user to respond to its prompt.. depending on the response entered by the user at the ? prompt.00 10119 $40. Once you have debugged or tested the Proc.00 9 ITEMS LI STED > 14:40:04 01 JUL 1996 DATE OF ORDER 05/29/1996 06/23/1996 04/01/1996 04/13/1996 05/17/1996 01/29/1996 02/29/1996 03/25/1996 09/13/1996 DISPLAYING THE CONTENTS OF BOTH OUTPUT BUFFERS P.00 10121 $60.00 10102 $69. The system does not submit the UCL command in the primary output buffer to the UCL processor. you can replace PW with a single P. 10116 $40..PAGE 1 ORDERS.00 10123 $40. on line 7. The P and W options for P display the contents of the output buffers before submitting the UCL command: The syntax is as follows: P[P|W] PP displays the contents of both output buffers on the screen before submitting the UCL command. 001 PQ 002 HSORT CUSTOMERS BY 003 OSORT BY WHICH ATTRIBUTE+ 004 IP? 005 A 006 HLASTNAME FIRSTNAME CITY STATE ZIP 007 PW The PW..00 10114 $45.. and waits for user respon se.00 10124 $40. S skips the UCL command and cont inues with the Proc. AMOUNT. When you execute the Proc it looks like this: >CUST-SORT SORT BY WHICH ATTRIBUTE? CITY SORT CUSTOMERS BY CITY LASTNAME FIRSTNAME CITY STATE ZIP ? The Proc continues or abor ts. You can enter the following responses at the ? prompt. the following Proc prompts the user for the attribute by which to sort the CUSTOMER file. ADDITIONAL PQX/PQN COMMANDS . Any other key submits the current command and continues with the Proc.00 10122 $40..

TRANSFERRING CONTROL It is possible to transfer control of a Proc to a labelled line or subroutine. the label is 70 and the command is H LAST -NAME. or next mark. * the statement following the last mark. and you must separate it from the command lin e by at least one space. * IBN. () links to another Proc. link. * RTN. * RSUB. GO transfers control to a line with a numeric label. exit. and linking to another Proc. for example: 7. the system only uses the 1st occurrence of the label. * GOSUB. The syntax is as follows: G{[O]|[OTO]} label G[O] B G[O] F . * How to use the secondary input and output buffers. The commands are organised by function. the Proc continues execution from that line. * How to invoke a trace for a Proc with TR. 10. * X. If a Proc contains two command lines with the same label. * U. UniVision user exits. A label comprises any number of numeric characters. This section describes the following commands: * L. * IN. call. 999. * IFN. * the statement following the next mark. The help covers the following topics: * Unconditional and conditional branching. * M. * IF. * T. The Section describes the following commands: * GO. Do not confuse command labels with the Editor line numbers. For example . BRANCHING TO ANOTHE R LINE GO transfers control to: * a labelled statement. the system uses GO and [] to branch unconditionally another line or a subroutine. [] calls the subroutine starting at the labelled line. BRANCHING When used without IF. stack off. the system does not check for duplicate labels. stack on. previous mark. a nd continues execution until it encounters RTN. * (). * STOFF. 013 70 H LASTNAME The line number is 013. * How to format output and control the cursor. You can precede a PQX/PQN command line with a numeric label to identify it uniquely. * []. * MS. The Section describes the following commands: * STON.This section describes additional PQX/PQN commands that give more control over a Proc.

If the system cannot find a mark. it 001 PQX 002 MV %1 "0" 003 M 004 F. followed by labels separated by value marks.DEVELOPMENT=3)+ 003 IP 004 IF A > 3 G 5 005 IF A < 1 G 5 006 OYOUR BILLING CODE IS + 007 G A1 008 1 OSA1259. At execution the Proc looks like this: >BILLING-CODE ENTER YOUR D EPARTMENT NUMBER (SALES=1. It tests the input on lines 4 and 5. GO 70 GOTO 70 G 70 G 70 In the case of multi -valued comparisons.C1. Once control passes to the labelled line.+. on line 7. If the system cannot find a mark. Note: The last mark executed occurring in the Proc. For example the following commands all transfer control to the line labelled 70. > BRANCHING TO A MARK GO B. MARKETING=2. and transfers control to the line labelled with that number. the system executes all subsequent lines from that point on. instead of using one GO for each multi-valued command. 011 G 999 012 3 ODE4463. lines 2 and 3. 013 999 X 014 5 XTHE CODE MUST BE BETWEEN 1 AND 3! Prompts the user to identify a department by number. DEVELOPMENT=3):3 YOUR BILLING CODE IS DE4463.It is possible to enter GO as G or GOTO. transfers control to the label that matches the input parameter. use GO once. used in conjunction with Mark.%1:C1: -:?%1 transfers control to the statement might not be the last physical mark displays an error message. and places the response in the input buffer. 009 G 999 010 2 OMA6672. For example: IF A = A]B]25]50 G 10]20]30]40 The following Proc prompts the user for a department number. transfers control to the statement displays an error message. The system displays YOUR BILLING CODE IS and the G . . 001 PQX 002 OENTER YOUR DEPARTMENT NUMBER (SALES=1.%1. MARKETING=2. (X'FD'). following the last mark executed. it GO F.?%1 005 IFN %1 = 10 GO F 006 GO B 007 M 008 F. following the next mark executed. used in conjunction with Mark. using IF.

009 25 IFN %1 > 0 GO B 010 X-DONEThe system increments the contents of %1 from 1 to 10. The syntax is as follows: [[DICT] filename [item -ID]] [label #] Subroutine execution continues from the labelled line until it encounters an RTN. separated by value marks. on line 5 and the GO B. when it returns control to line 8 in the above Proc. CALLING A SUBROUTINE [] transfers control to a labelled local or external subroutine. Control returns to line 21 when the subroutine encounters R SUB. The subroutine continues to execute until it encounters an RTN. . The syntax is as follows: GOSUB label GOSUB transfers control to th e statement with the specified label and continues execution until it encounters an RSUB. (X'FD'). makes a branch to line 7. At line 7 it calls the Proc FORMAT in file MYPROCFILE and executes the subroutine identified by label 2. followed by the labels. RTN returns control to the command immedi ately following the []. 035 036 037 038 GOSUB 400 OENTER ACCOUNT NUMBER 400 O****ILLEGAL ENTRY **** PLEASE RETYPE RI IP? LINKING TO ANOTHER PROC . For multi -valued comparisons. RSUB transfers control back to the statement following the GOSUB that called the subroutine originally. Note: NEVER execute a subroutine via the output buffer. . ALWAYS use () or []. on line 9 use the mark on line 7. 020 021 . and decrements the contents back to 0. For example: IF A = 1]2]3]4 GOSUB 100]150]200]250 The following portion of a Proc transfers control to internal subroutine 400. you only need to specify GOSUB once. TRANSFERRING CONTROL TO A SUBROUTINE GOSUB transfers control to a subroutine with the specified label. 001 PQX 002 HSORT CUSTOMERS BY 003 A2 004 H LAST -NAME FIRST -NAME STREET CITY STATE 005 OSPECIAL FORMAT (Y/N)+ 006 IP? 007 IF A = Y [MYPROCFILE FORMAT] 2 008 P This example calls a subroutine from another item. Note: Both the GO F.

A link differs from an external subroutine in that the system does not return control to the calling Proc. When used with GO and []. the user's response. the command: (MYPROCFILE FORMAT) 20 transfers control to the line labelled 20 in the Proc FORMAT in file MYPROCFILE. control returns to UCL. If false. The (). lines 15 and 16. and continues to execute until the end of the Proc. 012 ODO YOU WANT TO EXECUTE ANOTHER PROC FROM THIS FILE (Y/N) 013 IP 014 IF A = N X 015 OENTER THE NAME OF THE PROC 016 IP 017 (TEST -PROCS) The above Proc prompts the user for the name of another Proc to execute and places the response in the input buffer. The syntax is as follows: IF [#] val command . For example. on line 17 links to the Proc with the name indicated by the current input parameter. * Multi-valued IFs. In addition. * Compare a value with a pattern. the command: . * Performing numeric comparisons. it is possible to use it to share Procs across accounts. TESTING FOR THE PRESENCE OF A VALUE This version o f IF tests for the presence of a specified value in a particular attribute. The general syntax is as follows: IF condition command condition one of the types of condition described in the following sections. CONDITIONAL BRANCHING IF evaluates a conditio n and if true. the system uses the current parameter in the input buffer. * Compare a value with a literal string. control transfers to the line in the called Proc with that label. * Compare two values. command any PROC command. it does not move the specified parameter to the output buffer. the 1st line contains the PQX code. shown in the following sections: The first four expressions use IF with a version of A. Each of these conditional expressions has its own syntax. in the file TEST -PROCS. executes a specified PROC command. A operates differently when used with IF. The most common use is to link short Procs stored in the Master Dictionary to longer Procs stored in another file. invokes another Proc from the Proc that is running currently. For example. the command: (MYPROCFILE CUST -SORT) transfers control to the 2nd line of the Proc CUST -SORT in the file MYPROCFILE. nor does it reposition the input buffer pointer. When CUST -SORT has finished executing. The syntax is as follows: ([DICT] filename [item -ID]) [label#] () transfers control to the 2nd line of the called Proc. The following are types of conditional expression: * Test for the presence of a value. If you do not include an item ID. link. IF provides conditional branching. it does not execute the PROC command. If you include a number. For examp le.(). * Test for a system error.

. control transfers to statement 200. left -to-right comparison. 035 30 OENTER NAME+ 036 IP:#3 .3 to the 3rd parameter of the active buffer. left -to-right comparison. if the strings are not identical. and 3 is greater the 132.2 G 200 152 MV #3 %1 . . otherwise the system moves the value to the 3rd parameter of the active input buffer.3 GO 30 021 MV #3 &2. 010 IF %3 = ABC OYES 011 RI . . . . The syntax is as follows: IF val1 rel -op val2 command The system carries out an ASCII character -by-character. COMPARING TWO VALUES This version of IF compares two values using relational op erators. IF no value exists in the 3rd attribute of file buffer 2. 190 200 OVALUE ALREADY EXISTS 191 OTRY AGAIN + 192 G 100 If the input value is the same as the 2nd attribute in file buffer 4. otherwise the system moves the value in &2. see later. control transfers to statement 30. IFN carries out strict numeric comparisons. For example AAB is greater than AAAB.For example: 020 IF # &2. The syntax is as follows: IF val rel -op string command The system carries out an ASCII character -by-character.3 . Relational Operators = Equal to # Not equal to < Less than > Greater than [ Less than or equal to ] Greater than or equal to 150 100 IP: 151 IF %1 = &4. COMPARING A VALUE WITH A LITERAL STRING This version of IF uses relational operat ors to compare a value with a literal. the system considers the string with the higher ASCII value the greater.

in the primary input COMPARING A PARAMETER WITH A PATTERN This version of IF uses relational operators to compare a value with a a pattern of alphanumeric characters. it resets the buffer. 'string' Parameter matches string. this means that the number of character is unimportant. TESTING FOR A SYSTEM ERROR This version of IF tests for the presence of a system error after processing a UCL command.. The system accepts any number of characters.2 = (2N3A) G 10 If the 2nd attribute of file buffer 4 is equal to two numeric followed by three alphabetic characters.NO BACK -ORDERED ITEMS If the result of the count shows that there are no back -ordered items.. For example. control transfers to label 10. but before an IF E might cause the IF E to fail. an asterisk. performing some operations in the primary i nput buffer after a P. If the system prints an error message with the same value as that being tested. This makes it difficult to test for null values using pattern matching. nX Parameter contains n alphanumeric characters. If n is 0.. IF E checks the error message in the secondary buffer. you should use: IF %1 = (3N" "3N" "4N) rather than IF %1 = (3N 3N 4 N) Note: You can enclose literal strings in single or double quotes. NO BACK -ORDERED ITEMS. or none. nA Parameter contains n alphabetic characters. because some commands destroy the contents of the secondary input buffer. you should use one of the following syntaxes: IF %n = ("") command IF %n command IF # %n command To look for parenthetical data. IF &4.Prints YES and resets the buffer if the 3rd parameter buffer is ABC. if the character are of the right type. The syntax is as follows: IF [#] E rel -op errno command This version of IF can follow a process command that causes execution of a UCL command stored in the primary output buffer. and any number of. IF A = (3N*2N"0N) G 33 If the current parameter is three numerics. two alphabetics.. The PH outputs the contents of the output buffer and suppresses any . otherwise. you should use the following syntax: IF %n = (() command You should not include spaces in a pattern matching string without enclosing them in double quotes. The syntax is as follows: IF val {=|#} (pattern) command Pattern Specifications nN Parameter contains n numeric characters. 004 HCOUNT ORDERS WITH STATUS "BO" 005 PH 006 IF E = 401 O. control passes to statement label 33. the condition is true. If you need to check for a null string using pattern matching. the system displa ys . A null value does not match any pattern. or no numerics. an asterisk.

You should separate multiple values with value marks (X'FD') and they can be any value that you can place after an operator. Note: Do not use O or X as com mands. control passes to label 10. 15. or C. The syntax is as follows: IFN condition command IFN allows you to sort numbers by their value. that is if the argument is equal to any value in the multi -valued string.1 = A]B[C G 10]15]20 If the 1st attribute in file buffer 3 equals A. the condition is true. or when there are no more commands left to execute: If you include any text following the X it should be informative.) command(]command]command. since they cause the system to ignore other commands in the series. IFN %2 > &2. INVOKING A UNIVISION USER EXIT U invokes a UniVision user exit. B. The syntax is as follows: U userexitname For example: U01AD HALTING EXECUTION AND RETURNING TO UCL X. C. the condition is true. B. which in this case is NO ITEMS PRESENT. if the 2nd condition is true. or D control transfers to the statement beginning with label 10. You should use IFN when you want to test for numerics and you are using operato rs other than = and #. that is if the argument does not equal any value in the multi -valued string.2 = A]B]C]D G 10 If the 2nd attribute of file buffer 4 is equal to A. .. not by their ASCII equivalents. control passes to label 33. and so on. Using = causes the system to perform a logical OR on the values. performs numeric comparisons and allows conditional execution of Proc commands. The syntax is as follows: X[text] Typically. IF &3. MULTI-VALUED IF Multi-valued IF compares a value with several different values and executes one of several commands: Note: Multi -valued IF is only meaningful when used with equals (=) or not equals (#).7 G 33 If the 2nd parameter of the current buffer is greater than the 7th attribute o f file buffer 2. IF &4.terminal output generated by the processed command. the system executes the 2nd command.. NUMERIC COMPARISONS IFN.) If the 1st condition is true. Using # causes the system to perform a logical AND on the values.. the system executes the 1st command. halts execution of the Proc and returns control to UCL. you use X to stop a Proc if an error occurs.. The syntax is as follows: IF condition(]condition]condition. or 20 respectively.

In addition..] prints the value obtained by reference r. 100 XEND OF PROCESSING Terminates the Proc and displays END OF PROCESSING on completion of all instructions. You can apply a VISION output conversion to the value prior to printing.T.. (c) sets the cursor to column c of the current line. HDR generates a page heading.L(15).%1 "text" . Option Function displays the specified text at the current cursor position. C closes the print file forcing printing of accumulated output. n skips n lines before printing. only used with HDR. only used with HDR. The syntax is as follows: L option[. r[."THE VALUE OF X IS: ". You cannot use C in HDR. "PARAMS1". For example: L(4). 010 F-OPEN 1 %1 011 X CANNOT OPEN FILE x Stops execution of the Proc if the system cannot open the file in %1. If you use N. + inhibits carriage return/line feed. N forces subsequent printer output to the terminal for debugging. You can apply a VISION input conversion to the value prior to printing. allows you to format the output sent to the printer. you must enclose text in double quotes.] L can contain one or more options separated by commas. 001 IH12 002 L HDR. . the command can continue on subsequent lines. n can be a direct or indirect reference.. r[:out:] prints the value obtained by reference r."PARAMS2" prints PARAMS1 beginning at column 4 and PARAMS2 beginning at column 15.(25)"PAGE ". There are two commands available to format output: * L formats printer output * T formats terminal output. You can construct a heading to be output in the report. If L ends with a comma. E ejects to top -of-form.option. . Z z eroes the current page number in a heading. T prints the current time and date in a heading.. only used with HDR. If used this must be the 1st option in L. E is not valid in HDR. eject the paper to the top -of-form and many other options. only used with HDR. FORMATTING PRINTER OUTPUT L. P prints the current page number in a heading. L produ ces a line feed in a heading.P 003 L 2. You cannot use n with HDR. it must be the only option in L. and displays CANNOT OPEN FILE x. FORMATTING OUTPUT You can create special formatted output with PQX/PQN to simplify the user interface.in.

terminates a loop started with the T option. The L option terminates the loop. represented by n. output the number of spaces specified by reference r. The system executes the options between T and L three times. inhibits the carriage return/line feed. print the value obtained by reference r..produces the following ou tput: 15:45:00 19 JUL THE VALUE OF X IS: 12 PAGE 1 FORMATTING THE SCREEN T. sounds a bell. represented by nn. and display non -printable characters. allows you to clear the screen. to its equivalent ASCII character and displays it at the terminal. [row] Clears the screen and positions cursor at upper left -hand corner (HOME). The system executes the options between T and L three times. Option Function "text" r[. row r. output the user prompt. to its equivalent ASCII character and displays it at the terminal.r) (c) (-n) + B C In L Sn Sr T U Xnn displays the specified text at the current cursor position.B clears the screen and sounds the bell at the terminal.in.] r[:out:] (c. sets up terminal independent cursor control or video effects. clears the screen. The syntax is as follows: T option[. c can be a direct or indirect reference.[x]) (-1) Function Cursor address column. Cursor Function Codes Code (x. sets the cursor to column c. separated by commas. or a direct or indirect reference. . converts a hexadecimal value from 00 to FF. For example: T C. sets the cursor to column c of the current line.option. n can be a literal. You can apply a VISION output conversion to the value prior to printing. print the value obtained by reference r.] T can contain one or more options. See below. n can be a literal.. converts an integer from 0 to 255. It is possible to continue a T onto multiple lines by ending the preceding line with a comma. move the cursor up one line. control the position of the cursor. You can apply a VISION input conversion to the value prior to printing. outputs n spaces. marks the beginning of a loop. You must enclose text in double quotes. or a direct or indirect reference.

(-40) Sets background colour. (-4) Clears the screen from the cursor position to the end of the line.( -13). (-10) Moves the cursor up one line. (-7) Begins dimmed field. and branches to another Proc d epending on the function selected by the user: 001 PQ 002 100 T B.Positions cursor at HOME.6)."4. (-34) Sets background colour."2.( -13). (-44) Sets foreground colour.( -14) 014 IP: 015 T C 016 IF A = 1 [MYPROCLIB CUST -INFO] 017 IF A = 2 [MYPROCLIB CUST -ADD] 018 IF A = 3 [MYPROCLIB CUST -DELETE] 019 IF A = 4 X 020 GO 100 When this Proc is executed.4). (-35) Sets background colour. (-45) Sets foreground colour."1." 009 T (20. (-39) Sets background colour. (-8) Ends dimmed field." 008 T (20.15). (-38) Sets background colour. (-48) Sets foreground colour. Delete an existing customer. (-36) Sets background colour. (-11) Begins protected field.11). (-46) Sets foreground colour. Exit menu."ACTIVITIES:" 007 T (20. (-42) Sets foreground colour. (-12) Ends protected field.C 003 T (25. (-15) Begins underlined field. (-5) Starts blinking field. (-47) Sets foreground colour. 005 "===================================================" 006 T (10. (-43) Sets foreground colour."MAKE A SELECTION"."3. Display information about a customer. (-41) Sets foreground colour.( -14) 004 T (10.8). it looks like this: CUSTOMERS MENU (-2) (-3) .9). Clears the screen from the cursor position to the bottom of the screen.10). 012 "======================================== ===========" 013 T (25.13). (-16) Ends underlined field."CUSTOMERS MENU ". The following Proc displays a menu. Add a new customer. (-6) Ends bl inking field. (-17) Printer on (-18) Printer off (-19) Moves the cursor forward one space (-20) Moves the cursor down one line (-33) Sets background colour. (-37) Sets background colour. (-14) Ends reverse video field." 010 T (20. (-9) Moves the cursor back one space.3). (-13) Begins reverse video field." 011 T (10.

When you invoke a Proc. Exit menu. PROC commands operate on the active buffer. You manipulate the secondary buffers by making them active. The system makes the primary buffer active again whenever a P sends a command to UCL. On completion of the execution of the called Procs. on lines 6 to 13 supply additional text for the menu. ==================================================== MAKE A SELECTION : The T on line 2 sounds the bell and clears the screen. 3. The system displays each command executed in the Proc on the screen as it executes it. a line made up of equal signs (=). The secondary buffers work somewhat differently from the way the primary buffers work. The T starting on line 4 gives the column and row numbers for some text. The line ends with a comma and continues on line 5. on line 20. The T on line 3 displays CUSTOMERS MENU at column 25. Line 5 supplies the text. and to hold input fro m the user when it is desirable to preserve the contents of the primary input buffer from job to job in a Proc. Add a new customer. row 3. The syntax is as follows: TR [ON] TR OFF TR is useful when troubleshooting aborts. The Ts. USING THE SECONDARY BUFFERS You use the secondary output buffer to store data or a series of commands for use by another processor invoked by a Proc. The secondary input buffer is only a temporary storage place for input. The cursor function code -13 starts a reverse video field. To activate the secondary buffer use STON. The T on line 15 clears the screen before the IFs on the following lines branch to other Procs.=================================================== ACTIVITIES: 1. displays its prompt at the end of the last displayed text and places the user's response in the input buffer. 4. In the secondary output buffer. the primary buffers are active by default. 2. and t he cursor function code -14 ends the reverse video field. and this then redisplays the menu. INVOKING A TRACE TR invokes a trace for a Proc. The Proc includes spaces to make the field larger. You use the secondary input buffer to store messages from the system in response to a Proc -invoked UCL command. The IP on line 14. You can make the primary output buffer active using STOFF. control returns to line 2 by the GO. Most menu Procs have looping functions. such as BASIC or the Editor. the carriage return character (<) serves as a delimiter between the commands. stack on. Delete an existing customer. The line label is 100 and the GO on line 20 references it. because it allows you to identify the statement causing the abort. . stack off. Display information about a customer.

The < character has special meaning when placed in the stack. in addition. Usually P turns off the secondary output buffer. P adds a carriage return automatically to the last line in the stack. the system takes input from the secondary output buffer a line at a time. If that command invokes a processor that requir es input. PROC commands that place strings or parameters in the active output buffer place them in the stack. except for the last line. P clears both output buffers on completion. The syntax is as follows: STON or ST ON Once you have activated the secondary output buffer. Each command line in the secondary output b uffer. This UCL command invokes the other processor. STOFF turns off the stack and makes the primary output buffer active. the system recognises < as a carriage return character. passes the command in the primary output buffer to the UCL processor. STON activates the secondary output buffer. It places data in the secondary output buffer by first making the buffer active and copying strings and i nput parameters to it with the appropriate PROC commands. process. If there is no more data in the secondary output buffer and the other processor keeps requesting data. ALSO (Y/N)+ IP? IF A = N G 30 .STORING DATA AND COMMANDS FOR ANOTHER PROCESSOR The system stores data and commands you want to pass to another processor in the secondary output buffer. must end with a carriage return character. The syntax is as follows: STOFF or ST OFF 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 PQX HSELECT CUSTOMERS WITH LAST -NAME = A"2 OWHAT IS THE NEW LAST -NAME+ IP? STON HED CUSTOMERS HGS< HR< A H< STOFF ODO YOU WANT TO CHANGE THE FIRST NAME. but if placed at the end of the string. but. For example: H AMOUNT < "100" The system recognises the < character as the less than character. Note: Build a stack only for the UCL command you want to execute with the next P. If embedded in a string the system recognises < as the less than character. but in the string: HLAST-NAME< the system recognises the < character as a carriage return. P submits the UCL command held in the primary output buffer. The Proc then passes data or commands held in the secondary output buffer to the other processor one line at a time. A P. the system sends the prompt character to the screen and accepts data from the keyboard.

the system prompts the user to find out if they want to change the first name. Both commands destroy the current contents of the secondary inpu t buffer and set the pointer to the beginning prior to placing data in the buffer. IN or IBN. PLACING TERMINAL INPUT IN THE SECONDARY INPUT BUFFER IBN and IN. make the secondary input buffer active. on line 12. the system re -opens the stack and adds more Editor commands. The prompt character remains in effect until you change it using IP. IBP. The STOFF. and inserts Editor commands to change the last name into the stack. The STON. If so. input secondary.016 OWHAT IS THE NEW FIRST NAME+ 017 IP? 018 STON 019 HF< 020 HG1< 021 HR< 022 A 023 H< 024 HFI 025 P 026 X 027 30 STON 028 HFI 029 P Allows the user to change customers' names in the file CUSTOMERS. closes the stack. replacing any blanks occurring within the string with attribute marks. The syntax is as follows: MS . on line 6 opens the stack. you can change this by specifying another character with the command. whereas IBN places terminal input into the secondary input buffer without replacing any blanks. COPYING DATA FROM THE SECONDARY INPUT BUFFER TO THE PRIMARY INPUT BUFFER MS copies the entire contents of the secondary input buffer to the primary input buffer. They place user input directly into the secondary input buffer. IN places terminal input into the secondary input buffer. on line 7 to 11. The syntax is as follows: I[B]N[c] A question mark is the default prompt displayed by these commands. For example: IBN: prompts with a colon.