.lm .ifnot hlp .hl 1 Conditional text .ifnot small Sometimes you may wish to have 2 different copies of the same document. There are many ways to achieve this goal. Only 3 methods will be considered. .list .le .REQUIRE may be used to achieve this goal. You can break up the document into small sections, and then set up 2 master files which you might call DOCMNT1.RNO or DOCMNT2.RNO. Each master file would then require only those sections appropriate to generating each different document. .le SUBSTITUTIONS can be used to change a document. For example you may wish to generate different documents each personalized. You could define different substitutions which would generate different output. .le Finally you could use the _.IF, _.IF NOT, _.ELSE, _.ENDIF, _.VARIANT, and _.NO VARIANT statements to conditionlize sections of a document. These are shown below. .end list 2 .note The _.IF, _.IF NOT, _.ELSE, and _.ENDIF commands must be the first command on a line. .end note .endif small .endif hlp .helpc IF .q _.IF aaa [bbb] ... .p.x IF This statement causes the text following it to be ignored or processed depending on whether the labels are defined by a _.VARIANT command. .ifnot small The text is processed if any label has been defined, and ignored if none of the labels are defined. Each label may be up to 10 numbers or letters in upper or lower case. The case is ignored and ABC or abc are equivalent labels. No special symbols or blanks are allowed in labels. If the labels have not been defined text processing resumes when _.ENDIF or _.ELSE is encountered. .i5;(DSR supports only single labels) .if rsx.DHY.i5;ADDITIONAL HELP AVAILABLE: NOT ELSE END VARIANT IMMEDIATE Warning Aexample Bexample Cexample Dexample Eexample nesting restrictions .ehy .endif rsx .helpd NOT .endif small .q _.IF NOT aaa [bbb] ... .p.x IF>NOT This statement causes the text following it to be ignored if any label is defined. .ifnot small In other words if a _.VARIANT statement preceeds the _.IF NOT with the label aaa then the text is skipped. .helpd ELSE .endif small .q _.ELSE aaa .p.x ELSE This command changes true conditionals to false and false to true. .bb .ifnot small If it follows a _.IF it is the same as issuing _.IFNOT with the same label. If it follows a _.IFNOT it is equivalent to _.IF with the same label. Only a single _.ELSE may follow _.IF or _.IFNOT. .bb The label aaa must be the same as the previous _.IF or it must be *. This command must be the first command on a line. .eb .helpd END .endif small .q _.ENDIF aaa .p.x ENDIF This command terminates the range of the _.IF or _.IF NOT statements. .ifnot small .bb The label aaa must be the same as the previous _.IF or it must be *. .eb This command must be the first command on a line. This command must not be used inside a defined command, as RNO will not recognize it. If text is omitted all _.REQUIRE commands are not processed so an _.ENDIF inside one of the required files will not be seen. .note If a literal command is used inside an IF and the text is not processed, an _.ENDIF will still be recognized after the _.LITERAL. This is because the literal command is not recognized so that text following it will be recognized as normal text. .end note .helpd VARIANT .endif small .q _.VARIANT aaa [bbb] ... .qn _.NO VARIANT aaa [bbb] ... .x NO>VARIANT .p.x VARIANT _.VARIANT defines a label aaa which is used to control the action of subsequent _.IF commands. If the label is defined in the VARIANT statement then _.IF aaa will cause text to be printed and _.IF NOT aaa will suppress text. _.NO VARIANT undefines a label aaa which is used to control the action of subsequent _.IF commands. These commands only affect subsequent IF/IFNOT commands, and have no affect on previous IF/IFNOT commands. .bb Multiple labels may be specified with one variant command. .eb .helpd IMMEDIATE .bb .q _.IMMEDIATE IF label .qq _.IIF label .qn _.IMMEDIATE IFNOT label .qn _.IIFNOT label .p.x IMMEDIATE>IF .x IMMEDIATE>IF NOT These commands are similar to _.IF and _.IFNOT except that they are not followed by _.ELSE or _.ENDIF. These commands cause the rest of the line to be ignored or accepted. These commands may be used inside a defined command and they need not be the first command on a line. .helpd Warning .lm.note Warning If the IF/ELSE/ENDIF commands are not the first command on a line, or if they are inside a defined command, they will be ignored and an error message will result. The IMMEDIATE IF commands may be used in the middle of lines, or in defined commands. .en .eb .ifnot small .helpd Aexample .s.tt 4.c;Example: .s.nf.LM+5 _.VARIANT NOTES1 _.IF NOTES1 This line is printed _.ELSE NOTES1 This line is not printed _.ENDIF NOTES1 _.IF NOT NOTES1 This line is not printed _.ENDIF NOTES1 _.IF undefined This line is not printed _.ENDIF undefined _.IFNOT undefined This line is printed _.ELSE undefined This line is not printed _.ENDIF undefined .f.lm-5 .helpd Bexample .s.tt 4.c;Example: .s Another example of how to use _.IF statements is the following problem: You have a prefix file that you require at the top of each _.RNO file. The prefix file defines a bunch of substitutions and escapes. You make up MAIN.RNO which now requires all the other _.RNO files. Unfortunately each time the prefix file is required you get a string of error messages: .i5;RNO -- Substitution already defined .br;The way out of this problem is to only execute the prefix file once. This may be guaranteed by putting the following at the top of the file: .i5;_.IFNOT prefix .br;and the following at the end of the prefix file: .i5;_.VARIANT prefix .i5;_.ENDIF prefix .helpd Cexample .s.tt 4.c;Example .p;Here is an example of the _.NO VARIANT command: .s.nf.LM+5 _.VARIANT abc _.IF abc This line will appear _.ENDIF abc _.NO VARIANT abc _.IF abc This line will not appear _.ELSE abc This line will appear _.ENDIF abc .f.lm-5 .helpd Dexample .s.tt 4.c;Example .p;Here is an example of multiple labels: .s.nf.LM+5 _.Variant abc _.IF abc def This line appears _.ENDIF * _.IF abc This line appears _.ENDIF * _.IF def This line will not appear _.ENDIF * .f.lm-5 .helpd Eexample .s.tt 4.c;Immediate example .s The following illustrates the use of immediate if commands. .nf.LM+5 _.VARIANT A _.IIF A;This line appears. _.IIFNOT A;This line will not appear. _.IIF B;This line will appear. _.IIFNOT B;This line will not appear. .lm-5.f .helpd nesting .s.tt 4.c;Nesting .s The IF statements may be nested one inside each other. Of course once an _.IF#aaa or _.IFNOT#aaa has started skipping text, no further text will be processed until _.ENDIF#aaa. Only 32 levels of nesting are allowed. Here is a nesting example. .nf.lm+5 _.VARIANT B _.IF B This line is processed _.IF C This line is not _.ELSE C _.IF B This line is processed _.ELSE B This line is not _.ENDIF B _.ENDIF C _.ELSE B This line is not _.IFNOT C This line is not _.ENDIF C _.ENDIF B .i-5;Here is an example of improper nesting: _.IF B _.IF C _.ENDIF B _.ENDIF C .f .helpd restrictions .s.c;RESTRICTIONS .p Every time you use IF/IFNOT/VARIANT commands a label is added to the symbol table. This can cause you to run out of dynamic memory. If multiple labels are used with an IF command only the last one is added to the symbol table, so if the last one is always the same, you may safely use a large variety of labels before the last one. .endif small .lm