[MUSIC] In this next series of videos, we're going to take a closer look at some of the features of REXX. From logical expressions to looping structures, we're going to learn some of the basics for REXX programming. In REXX, the term instruction and statement are interchangeable. Instructions are made up of zero or more clauses. A blank line would contain zero clauses. Most instructions contain one clause each. But there are some like the if then else structure which could be considered an instruction made up of multiple clauses. Clauses are made up of tokens. Tokens are the basic building blocks of REXX execs. There are several types of tokens. There can be symbols, which include variables, labels, and functions. We haven't talked about all of these things yet but we will. There's literals which of course includes character or string literals, hexadecimal literals, and binary literals. There's comments from slash asterisk to asterisk slash. Numbers, any string which begins with a digit, period, plus sign, or minus sign. Note that this means that the string of 3D would qualify as a number though it cannot be used in an arithmetic expression. Special characters, these include the comma, the semi colon, the colon, which is used to identify a label, and the equal sign as used in variable assignment statements, and the left parentheses which is used to identify a function call. Operator characters, there are four types of operator characters. These include arithmetic operators, concatenation operators, comparison operators, and logical operators. The interpreter scans each instruction and recognizes the different tokens. It then resolves variables, performs functions, executes arithmetic and logical expressions. And in other words, REXX evaluates the instruction. REXX then determines the type of REXX instruction that needs to be executed, and there are five types of instruction. A null clause is either a blank line or a comment. A label is a symbol terminated by a colon. An assignment statement is used to assign a value to a variable. A REXX keyword is an instruction name that REXX recognizes like say pass or trace. And a command to the host environment is an instruction that REXX does not recognize and therefore parses outside the interpreter for execution. REXX allows you to do all the usual comparisons, equal, less than, greater than, and so on, of either numbers or strings. And REXX True is represented as 1, and False is represented as 0. REXX actually stores the 1 or the 0 values, it doesn't know about the words True or False. Thus, you can use this in REXX to do things such as multiplying by or adding the results of a comparison what a false and always true, if 1, always false, if 0, condition. REXX does some friendly things like treating two numbers that a human would think were the same, like 5 being equal to 5.0. This is called normal comparison. To turn off this feature, we use strict comparison. So comparisons are always either True or False. Let's take a look at string comparisons. You must be careful about the case sensitive nature of REXX string comparisons. The way to handle this is to always convert the data to be compared to uppercase and to compare uppercase literals. In normal comparisons leading or trailing blanks and either term being compared are ignored for the comparison purposes. The character collating sequence used by the operating system ASCII or episodic will be used to determine which characters are greater than others. Which of course means REXX uses the episodic collating sequence on ZOS and ZBM. In the example on screen where answer is set to uppercase YES with leading and trailing blanks, the first say instruction returns 1 for True. The variable answer does indeed match uppercase YES. The second say instruction returns 0 or False due to the comparison being case sensitive. Strict comparisons are always character comparisons even when the two terms being compared are actually numbers. They are coded by doubling one of the comparison operator characters. All of the bytes in both terms are significant, even the leading and trailing blanks. Each byte in both terms must match exactly, otherwise, the two terms are not equal. In this example, both say instructions return 0 for False, you probably won't see or use strict comparisons very often, but it's certainly a nice features to have when you need it. If both terms being compared are numeric and the comparison is not strict, then a numeric comparison is performed. Numeric Fuzz is a setting for the accuracy of the comparison. It determines how many digits in the terms being compared are allowed to be ignored for comparison purposes. The default value for Numeric Fuzz is 0, which means that all digits in the terms being compared are significant. These are the comparison operators. They may be used for both string and numeric comparisons. You must use the operator characters. The letter equivalents are not supported in REXX. So for example, you must use the greater than symbol and not gt. Or the less than symbol and equals not le. To perform strict comparisons, you simply double one of the comparison operators like = =. So that's comparisons. In the next video, we'll start looking at some of the instructions where REXX normally uses them. [MUSIC]