SEQUEL ViewPoint includes a scripting module that lets you run multiple SEQUEL and system commands together. Scripting gives you much of the capability of Command Language (CL) programming without requiring technical programming knowledge. The scripting interface allows you to easily enter commands on sequentially numbered command lines, run the script in step-mode, and debug. It is simple to save and run a SEQUEL script, because scripts don’t need to be compiled.

Advantage of scripts

Advantages of Scripting

Besides not needing to be compiled, SEQUEL scripts have other advantages. For example:

  • You can run a multi-step process with a single mouse click. You can run the script from the ViewPoint Explorer, the “green screen” interface, a command line, a job scheduler, a Web browser (using the SEQUEL Web Interface), or another program.
  • Variables from a single run-time prompt are available to every command in the script. you can prompt the user once for a value and use that value many times.
  • Run-time variables can be used for command parameters and SEQUEL values.

Enhancements added to Version 9

SEQUEL Version 9 introduced even more powerful scripting functionality. If you are using Version 9, you have much of the same functionality as a CL program. The enhanced commands allow you to create:

  • Code loops
  • Internal variable definitions
  • Variable modifications
  • Conditional expressions
  • Calculation expressions
  • Substring expressions
  • Concatenation expressions

You can access the internal commands in ViewPoint or green screen scripting.

Note: Although many commands share the same name as a CL command, they are syntactically different. Refer to the ViewPoint User Guide.

Here is a list of the commands added in SEQUEL Version 9:

  • CHGVAR
  • DCL
  • DO
  • DOLOOP
  • DOWHILE
  • ELSE
  • ENDDO
  • ENDIF
  • GOTO
  • IF
  • INIT
  • LEAVE
  • MONMSG
  • RETURN
  • [DLYJOB]

Let’s look at sample scripts that use some of these new enhanced features.

Conditional Logic with COND

 Perhaps the biggest change is support for conditional logic within a script. You can use either the COND or the CONDSQL command to create conditional logic. If you are setting up conditional logic on an SQL that is not file dependent, use COND. Otherwise, use CONDSQL.

In Example 1, the condition is based on the value of &U1—a prompted variable. Whenever you run this script, it prompts you to choose whether to run a detail or summary report for a date range. Because the condition is based on a prompt that is not file dependent, this is an ideal script for the COND command.

 src=

Conditional Logic with CONDSQL

You can use the CONDSQL command to automatically run different commands based on the number of records returned. The CONDSQL command returns a single piece of information that the script uses to determine if the data exists, where 1= true and 0 = false.

When you run the script in Example 2, it prompts you  for a state value. If there are records, a Microsoft Excel spreadsheet is e-mailed. If there are no records for the state, an e-mail with a simple statement is sent.

 src=

CHGVAR with VALUESQL

Variables are more powerful with the enhanced scripting features. There are two types of variables within a script—prompted and internal.

You define prompted variables in the Variables tab and they require input at runtime.

You can use internal script variables to read a value from a file and pass it to another command. (This is the equivalent of doing a receive file [RCVF] in CL.) To retrieve a value in a SEQUEL script, use the VALUESQL parameter of the CHGVAR command. VALUESQL returns a single piece of information that the script uses to change the variable (VAR). The maximum statement length is 512 characters.

In Example 3, the script retrieves the value of the REGON field, a one-record control file, CONTROLF, and stores it in the ®ION internal script variable. Then, the script uses this variable in the SETVAR parameter in line 3 to provide the region number to the DDCUSNO view.

 src=

 


Still have questions? We can help. Submit a case to Technical Support.

Last Modified On: April 21, 2017