BRANCHMSG Command | Basic Teradata Query - BRANCHMSG - Basic Teradata Query

Basic Teradata® Query Reference

Product
Basic Teradata Query
Release Number
17.10
Published
February 2022
Language
English (United States)
Last Update
2022-02-03
dita:mapPath
nnw1608578382132.ditamap
dita:ditavalPath
obe1474387269547.ditaval
dita:id
B035-2414
lifecycle
previous
Product Category
Teradata Tools and Utilities

Purpose

This control enables users to specify whether the generation of messages that explain input instruction branching for GOTO skipping and conditional block bypassing is to be verbose or terse.

If the BRANCHMSG command has not been used, its value is VERBOSE by default.

The command is valid only when used in scripts executed in batch mode. An error will be generated if is issued in interactive mode.

Syntax



Usage Notes

BTEQ produces informational messages when commands are used, such as IF and GOTO, that cause branching to occur while processing input instructions. When a GOTO is used, a "skipped" message will be generated for every instruction that will not be executed during the time that a matching LABEL command is not yet found. And when a conditional block of instructions associated with an IF construct does not get executed, a "bypassed" message will be generated for each of its instructions. The number of result blocks can be decreased by using the terse form of these branching messages. That form will only generate a minimal number of informational messages as sufficient to indicate skipping or bypassing is occurring and otherwise will omit generation of the result blocks associated with commands and requests not executed. So terse mode can substantially decrease overall output if the number of instructions potentially not executed is large or the text of those instructions is quite large. Suppression of result blocks include echoing of the instruction text.

When in terse mode, a LABEL will only get its own result block when it is a first step of an instruction.

It is recommended that ECHOREQ=ON be used in tandem with BRANCHMSG=VERBOSE for reflecting context.

When ECHOREQ is ON, terse mode causes all leading spaces and comments to be discarded except for the immediate leading spaces for an instruction.

Example – Result Block Reduction

Given the following script section where, since ERRORCODE does equal 0, only the REMARK command for 'C' will end up getting executed,
.GOTO mylabel
.REMARK 'A'
.REMARK 'B'
.LABEL mylabel
.IF ERRORCODE=0
.REMARK 'C'
.ELSEIF ERRORCODE=1
.REMARK 'D'
.ELSE
.REMARK 'E'
.ENDIF

with BRANCHMSG set to VERBOSE (the default state), batch mode result blocks will look as follows, with each instruction getting its own result block:

+---------+---------+---------+---------+---------+---------+---------+----
.GOTO mylabel
+---------+---------+---------+---------+---------+---------+---------+----
.REMARK 'A'
 *** Skipped.
+---------+---------+---------+---------+---------+---------+---------+----
.REMARK 'B'
 *** Skipped.
+---------+---------+---------+---------+---------+---------+---------+----
.LABEL mylabel
+---------+---------+---------+---------+---------+---------+---------+----
.IF ERRORCODE=0
 *** Level 1: IF condition is TRUE.
+---------+---------+---------+---------+---------+---------+---------+----
.REMARK 'C'
 C
+---------+---------+---------+---------+---------+---------+---------+----
.ELSEIF ERRORCODE=1
 *** Level 1: Bypassing ELSEIF block.
+---------+---------+---------+---------+---------+---------+---------+----
.REMARK 'D'
 *** Bypassed.
+---------+---------+---------+---------+---------+---------+---------+----
.ELSE
 *** Level 1: Bypassing ELSE block.
+---------+---------+---------+---------+---------+---------+---------+----
.REMARK 'E'
 *** Bypassed.
+---------+---------+---------+---------+---------+---------+---------+----
.ENDIF
 *** Level 1: Closed.
+---------+---------+---------+---------+---------+---------+---------+----

But with BRANCHMSG set to TERSE, the overall number of result blocks will be reduced:

+---------+---------+---------+---------+---------+---------+---------+----
.GOTO mylabel
 *** Skipping.
+---------+---------+---------+---------+---------+---------+---------+----
.LABEL mylabel
+---------+---------+---------+---------+---------+---------+---------+----
.IF ERRORCODE=0
 *** Level 1: IF condition is TRUE.
+---------+---------+---------+---------+---------+---------+---------+----
.REMARK 'C'
 C
+---------+---------+---------+---------+---------+---------+---------+----
.ELSEIF ERRORCODE=1
 *** Level 1: Bypassing the level's remaining blocks.
+---------+---------+---------+---------+---------+---------+---------+----
.ENDIF
 *** Level 1: Closed.
+---------+---------+---------+---------+---------+---------+---------+----