Examples of the LET statement
Following are examples of the LET statement:
LET MESSAGE = 'MY NAME IS'|| &SYSUID /*Example 2
LET COUNT = &COUNT+1 /*Example 3
LET DIM = DIMENSION (NAME_ARRAY,1) /*Example 4
LET DTYPE = DATATYPE (&VARIABLE) /*Example 5
LET LEN = LENGTH (&VARIABLE) /*Example 6
LET &DBD.FLAG ='Y' /*Example 7
LET &DBD|| 'FLAG' ='Y'
LET VARIABLE = 'COUNTER' /*Example 8
LET &VARIABLE = 1
Example 1 shows a simple variable assignment. Example 2 shows the use of concatenation bars to set the assigned value 'MY NAME IS' followed by the system variable SYSUID. Example 3 shows an arithmetic operation. Example 4 shows a method of returning the count of rows or columns within an array. Example 5 shows a method of determining whether a variable contains numeric or character data. Example 6 shows a method of determining the length of a variable or literal string. Example 7 shows two methods of constructing the receiving variable name by combining a variable value with a literal. Example 8 shows a method of specifying the receiving variable name by means of the contents of another variable.
Related topic