R:Style provides structural error checking, spelling assistance, and structural formatting to help debug your code prior to running it. For more details on what R:Style can do, please see What does R:Style do?
The R:Style Setup allows you to establish configuration settings based upon the characters used in your command files and how you want R:Style to format your code. Options for the R:Style configuration file(s), RSTYLEX5.CFG, consist of Global and Local locations.
•Global - forces R:Style to read or create the global configuration file in the default installation directory
•Local - forces R:Style to read or create a local configuration file in the working directory
•Set User-Defined Local R:Style Files Location – Assigns a user-defined folder for the location of the local R:Style files
•Reset Local R:Style Files Location – Resets the local R:Style files folder location to (always be) the current folder
R:Style uses a specific logic to determine what configuration file to use. The default is set to read the local file if it exists. If the local file does not exist then the global file is read. If neither exists a global file is created.
When launching the R:Style Setup, you will be presented with the following configuration screen:
Many R:Style features can be disabled if the results are unwanted for your code.
Configuration File
The current R:Style configuration file and path will be listed. The global configuration file in the default installation directory or a local configuration file will be displayed.
Character Settings
The QUOTES, BLANK, DELIMIT, and SEMI characters can be configured to match what is used within your command files. R:Style will not let you set the characters to duplicate values. So, if you want to change DELIMIT to ";" then you must change SEMI to something else first.
R:Style checks for the correct QUOTES setting to prevent users from incorrectly altering the code with an improper setting. In addition, R:Style tracks the SET QUOTES command, where if the QUOTES the value is changed, R:Style will expect the value to be restored within the same command file. It is good programming practice that any changes to SET QUOTES affects only code in that same command file.
Other Settings
•Semi - When enabled/checked to match when the SEMI operating condition is ON, all lines are considered one command until a semicolon (or the current semi setting) is encountered. No plus characters are used for continuation. SEMI OFF is the standard R:BASE setting.
•Ambiguity Checking – checks for commands that can have multiple meanings such as AUT, AUTO, CAS, CHD, COM, COMM, CON, DEF, DIS, FIL, NEW, NEX, NEXT, PRE, PREV, PRO, REC, RECO
•Command Word Checking – checks for valid commands. If this setting is not checked, then no command checks will be performed and invalid commands such as SETVAR (rather than SET VAR) will not be marked as an error line.
•Set Word Checking – Checks for ambiguous SET commands e.g. "SET AUT ON" will trigger an error because “AUT” can have multiple meanings. The words checked after SET are: AUT, AUTO, AUTOC, AUTOCO, AUTOR, AUTOS, AUTOU, AUTOUP, COL, COM, CUR, EXP, FAS, FAST, LIN, LINE, MAN
•SET VAR Splitting - splits a SET VAR statement with multiple variable definitions into separate SET VAR commands. The separate SET VAR commands can be are easier to debug with the Trace Debugger.
•LE Becomes <=, etc. - substitutes letter conditions with their character counterpart; <= for LE, <> for NE, >= for GE, etc.
•Split Multi-Commands - breaks up multi-command lines. If this option is used, indenting will not be preformed when the lines are broken. A second pass through R:Style will correct the indenting.
•Ignore 79 Character CodeLock Limit - specifies to ignore dash comments extending beyond 79 characters, which breaks CodeLock procedures
•RETURN Check at File End - specifies to "not" check for a RETURN at the end of the command file
Error Checking
Disabled - disables error checking
Enabled - performs error checking (default)
Read-Only - performs error checking, but does not alter the command file
Keyword Sizing
Disabled - disables keyword sizing
Abbreviated - maintains abbreviated keywords
Expanded - expands abbreviated keywords to the full word (default)
R:Style uses an abbreviation list to figure out how to expand keywords to their full length. All abbreviations of command keywords are unique, all abbreviations of SET keywords are unique, and all other keyword abbreviations are unique. Because of this, some of the abbreviations are not the very smallest allowable, In a couple of cases the expansion is not maximum either. One example is VARIABLES. There are some places VARIABLES is illegal but VARIABLE always works, so that is what R:Style uses. In addition, V expands only to VAR and VARI expands to VARIABLE. Because of these constraints, you can process your code all you want without breaking your applications.
Keyword Casing
Disabled - disables keyword casing
Lower - applies lower casing to keywords
Upper - applies upper casing to keywords (default)
If R:Style cases any words in your code as if they were keywords, this is an indication that you may run into trouble with that word usage for the application, when you upgrade R:BASE versions. The keyword may not have been a reserved word in a prior release, but is now. For example, the reserved word "over" was added in R:BASE 10.5. If a table or column in a database is named "over" the automatic casing to OVER will take place. It is wise to correct the name in the databases and within command files to avoid using such keywords.
Non-Keyword Casing
Disabled - disables non-keyword casing
Lower - applies lower casing to non-keywords, such as variables, table names, component IDs, etc. (default)
Upper - applies upper casing to non-keywords
Indenting - R:Style supports many combinations of indenting style. Structures can be indented, and continued lines can carry a different indenting style. Experiment with the configuration to see the various styles available. There is a great deal of flexibility built in to allow you to find a style that you like. Special case indenting can also be accomplished using --INDENT and --OUTDENT comment pairs within command file. These are treated just like WHILE and ENDWHILE pairs. This is useful when you have replaced a WHILE loop with GOTO's and LABEL's and you want the structure to retain it's indenting.
•Unwrapping (Before Wrap) - unwraps continued lines before wrapping them, allowing review of R:Style wrapping
•Indent LOAD Block - indents the lines of data to be loaded into a table
•Smart Code Wrapping - wraps command lines within single or double columns by specifying column widths, left as is with the option disabled. The double column code wrapping is for when where code is on the left and dash comments are on the right. You can even flag lines not to be wrapped by ending the code with a semicolon, before any comments.
•Structure Indenting - provides command structure indenting based upon the number of spaces (default is 2 spaces), code to be flush left, or structure may be left as is with the option disabled.
•Continued Line Indenting - spacing options are available with or without mixed double indenting, and exceptions after IF, WHILE, and ELSE structures. The Mixed Double Indenting works well on complex SQL statements to make them more readable.
•CASE Indenting - CASE structures may be indented or flush with the SWITCH command
•LABEL Outdenting - LABEL commands can be outdented, flushed left, instances can also be left as is with the option disabled
•ELSE Indenting - ELSE structures can be indented, or left as is with the option disabled
Saving the Configuration
Once you have adjusted the configuration to your preferences, selecting the OK button will save the configuration when you are done. Pressing OK will save the settings to the RSTYLEX5.CFG in the default installation directory. Please refer to this file as the Global configuration since R:Style will always be able to find it if a Local configuration has not been created. If a configuration file already exists, you will be asked if you wish to save the configuration. The path and file name will be displayed for your verification.
Testing R:Style
To test R:Style you can simply save any of your command files before running R:Style, then after the changes and formatting are made, you can close the file without saving the R:Style results. Also, the "Error Checking" option has a Read-Only option available. Use this if you never want your files restyled. This will also disable the hidden character scrubbing that R:Style does.
Preventing Alteration of Certain Words
In some cases, it is not just practical, but highly desirable, to change names used in your database so they do not match any possible keyword or reserved word. In this case you want to prevent R:Style from modifying those words or complaining about their existence. Place these words, one to a line, in the R:Style Setup under the "RStyle.PRE" tab. These words will be cased as they are entered, but will not be altered in any other way. A file, "RSTYLE.PRE", will be created in the directory. A RSTYLE.PRE file will be created in both the Global and Local directories for each R:Style configuration.
Customizing Mixed Case Table or Column Names
To custom case certain words, such as table or column names, place these words, one to a line, in the R:Style Setup under the "RStyle.CAS" tab. These words will be cased as they are entered, but will not be altered in any other way. A file, "RSTYLE.CAS", will be created in the directory. A RSTYLE.CAS file will be created in both the Global and Local directories for each R:Style configuration.
Customizing Mixed Case Variable Name
To custom case variable names, place these words, one to a line, in the R:Style Setup under the "RStyle.VAR" tab. These words will be cased as they are entered, but will not be altered in any other way. A file, "RSTYLE.VAR", will be created in the directory. A RSTYLE.VAR file will be created in both the Global and Local directories for each R:Style configuration. Since only the first word on each line of RSTYLE.VAR is used, you may also use this file to document your variables.
Simplifying Maintenance
If you do not want to maintain two files, simply keep all new words in either the RStyle.CAS or RStyle.VAR tabs.