<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://brwiki2.brulescorp.com/brwiki2/index.php?action=history&amp;feed=atom&amp;title=Libraries_Tutorial</id>
	<title>Libraries Tutorial - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://brwiki2.brulescorp.com/brwiki2/index.php?action=history&amp;feed=atom&amp;title=Libraries_Tutorial"/>
	<link rel="alternate" type="text/html" href="https://brwiki2.brulescorp.com/brwiki2/index.php?title=Libraries_Tutorial&amp;action=history"/>
	<updated>2026-04-29T23:22:49Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://brwiki2.brulescorp.com/brwiki2/index.php?title=Libraries_Tutorial&amp;diff=5662&amp;oldid=prev</id>
		<title>Laura at 21:08, 15 July 2013</title>
		<link rel="alternate" type="text/html" href="https://brwiki2.brulescorp.com/brwiki2/index.php?title=Libraries_Tutorial&amp;diff=5662&amp;oldid=prev"/>
		<updated>2013-07-15T21:08:03Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 21:08, 15 July 2013&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l62&quot;&gt;Line 62:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 62:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Next: [[Advanced array processing Tutorial|Advanced Array Processing]]&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Next: [[Advanced array processing Tutorial|Advanced Array Processing]]&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Back: [[Tutorial 2|Table of Contents]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Back: [[Tutorial 2|Table of Contents]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/noinclude&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;noinclude&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Tutorial]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/noinclude&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/noinclude&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Laura</name></author>
	</entry>
	<entry>
		<id>https://brwiki2.brulescorp.com/brwiki2/index.php?title=Libraries_Tutorial&amp;diff=5227&amp;oldid=prev</id>
		<title>Laura at 15:39, 11 July 2013</title>
		<link rel="alternate" type="text/html" href="https://brwiki2.brulescorp.com/brwiki2/index.php?title=Libraries_Tutorial&amp;diff=5227&amp;oldid=prev"/>
		<updated>2013-07-11T15:39:07Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:39, 11 July 2013&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l59&quot;&gt;Line 59:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 59:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Since functions in libraries can be accessed from other programs, it helps the programmer standardize activity across different programs while also shortening program length by removing repeated sections. Also, changes only need to be made to the library function instead of individually updating all programs when needed. For these reasons, many programmers choose to create a program that is solely used as a library, a single place to store all their functions and access them for use from each individual program when needed.  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Since functions in libraries can be accessed from other programs, it helps the programmer standardize activity across different programs while also shortening program length by removing repeated sections. Also, changes only need to be made to the library function instead of individually updating all programs when needed. For these reasons, many programmers choose to create a program that is solely used as a library, a single place to store all their functions and access them for use from each individual program when needed.  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Tutorial 2|Table of Contents]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;noinclude&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Next: [[Advanced array processing Tutorial|Advanced Array Processing]]&amp;lt;br&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Back: &lt;/ins&gt;[[Tutorial 2|Table of Contents]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/noinclude&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Laura</name></author>
	</entry>
	<entry>
		<id>https://brwiki2.brulescorp.com/brwiki2/index.php?title=Libraries_Tutorial&amp;diff=5165&amp;oldid=prev</id>
		<title>Laura: Created page with &quot;===Introduction to User-Defined Functions===  Internal functions are very useful, but what if you want to regularly repeat an action that isn&#039;t already built into BR? You can ...&quot;</title>
		<link rel="alternate" type="text/html" href="https://brwiki2.brulescorp.com/brwiki2/index.php?title=Libraries_Tutorial&amp;diff=5165&amp;oldid=prev"/>
		<updated>2013-07-11T14:10:56Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;===Introduction to User-Defined Functions===  Internal functions are very useful, but what if you want to regularly repeat an action that isn&amp;#039;t already built into BR? You can ...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;===Introduction to User-Defined Functions===&lt;br /&gt;
&lt;br /&gt;
Internal functions are very useful, but what if you want to regularly repeat an action that isn&amp;#039;t already built into BR? You can write your own functions, called user-defined functions. The special feature of BR is that, once defined accurately, these functions can be accessed and used from other programs too. This access is called the LIBRARY facility. Basically, all programs also become potential libraries of functions. &lt;br /&gt;
&lt;br /&gt;
===Sample User Defined Function===&lt;br /&gt;
&lt;br /&gt;
We&amp;#039;ll create a simple accounting program, called SALES1, containing a user-defined function entitled  FnTotalsales to calculate tax and sales commission for sales. &lt;br /&gt;
&lt;br /&gt;
 00030     print Newpage&lt;br /&gt;
 00040     print fields &amp;quot;2,2,cr 25; 3,2,cr 25&amp;quot;: &amp;quot;Total gross sales amount?&amp;quot;,&amp;quot;Commission rate?(%)&amp;quot;&lt;br /&gt;
 00050     input fields &amp;quot;2,28,n 10; 3,28,n 10.2&amp;quot;: Sales,Comrate&lt;br /&gt;
 00060  !&lt;br /&gt;
 00070     library : Fntotalsales&lt;br /&gt;
 00080     let Totalsales=Fntotalsales(Sales,Comrate,.0825,tax,commission)&lt;br /&gt;
 00090  !&lt;br /&gt;
 00100     print fields &amp;quot;6,4,cr 12;6,16,pic($$$$,$$$);8,4,cr 12;8,16,PIC($$$,$$$.##)&amp;quot; : &amp;quot;Tax:&amp;quot;,Tax,&amp;quot;Commission:&amp;quot;,Commission&lt;br /&gt;
 00110     print fields &amp;quot;10,4,cr 12;10,16,pic($$$$,$$$.##)&amp;quot;: &amp;quot;TOTAL:&amp;quot;,Totalsales&lt;br /&gt;
 00120  !&lt;br /&gt;
 00130     stop&lt;br /&gt;
 00140  !&lt;br /&gt;
 00170     def library Fntotalsales(Sales,Comrate,Taxrate;&amp;amp;Tax,&amp;amp;Commission)&lt;br /&gt;
 00180        let Tax = Sales*Taxrate&lt;br /&gt;
 00190        let Comrate=Comrate/100&lt;br /&gt;
 00200        let Commission=Sales*Comrate&lt;br /&gt;
 00210        let Fntotalsales=Sales-Commission+Tax&lt;br /&gt;
 00220     fnend&lt;br /&gt;
&lt;br /&gt;
Line 70 defines the function as a library, which means that other programs can find and use this function. Since the function is contained here in this program, only the function name is required after the colon. If the function was contained in another program, the program would be named (with its location if it&amp;#039;s not found in the same folder). For example:&lt;br /&gt;
&lt;br /&gt;
 library &amp;quot;sales1&amp;quot; : Fntotalsales&lt;br /&gt;
&lt;br /&gt;
Line 80 initiates the function and provides it with the variables necessary. Line 130 stops the program from continuing into the function again. The function has been placed outside of the main program for clarity and organization, in lines 170 to 220.  Note that line 170 specifies that this is a library function, the function name and the variables needed.&lt;br /&gt;
&lt;br /&gt;
Regarding variables: If the variables must be passed back to the program, the variable name must be preceded by an ampersand (&amp;amp;) symbol (line 170).  If the variables must be passed in and out sometimes, but not every time the function is called, they are listed after a semi-colon. If placed after the semicolon, variables by the same name that are mentioned elsewhere in the program will not be affected by the function. &lt;br /&gt;
&lt;br /&gt;
===Calling a Library Function===&lt;br /&gt;
&lt;br /&gt;
To demonstrate the LIBRARY facility, we will write a second program, called SALES2, to access the function from the first. This program determines sales, tax, and commission, based on how many subscriptions are sold. &lt;br /&gt;
&lt;br /&gt;
 00020     print Newpage&lt;br /&gt;
 00030     print fields &amp;quot;2,2,cr 25; 3,2,cr 25;4,2,cr 25&amp;quot;: &amp;quot;Total subscriptions sold?&amp;quot;,&amp;quot;Commission rate?(%)&amp;quot;,&amp;quot;Bonus commission?(%)&amp;quot;&lt;br /&gt;
 00040     input fields &amp;quot;2,28,n 10; 3,28,n 10.2; 4,28,n 10.2&amp;quot;: subscriptions,Comrate,bonusrate&lt;br /&gt;
 00050  !&lt;br /&gt;
 00060     let sales=subscriptions*150&lt;br /&gt;
 00070     let comrate=comrate+bonusrate&lt;br /&gt;
 00080  !&lt;br /&gt;
 00090     library &amp;quot;sales1&amp;quot; : Fntotalsales&lt;br /&gt;
 00100     let Totalsales=Fntotalsales(Sales,Comrate,.0825,tax,commission)&lt;br /&gt;
 00110  !&lt;br /&gt;
 00120     print fields &amp;quot;6,4,cr 12;6,16,pic($$$$,$$$);8,4,cr  12;8,16,PIC($$$,$$$.##)&amp;quot; : &amp;quot;Tax:&amp;quot;,Tax,&amp;quot;Commission:&amp;quot;,Commission&lt;br /&gt;
 00130     print fields &amp;quot;10,4,cr 12;10,16,pic($$$$,$$$.##)&amp;quot;: &amp;quot;TOTAL:&amp;quot;,Totalsales&lt;br /&gt;
 00140  !&lt;br /&gt;
 00150     stop&lt;br /&gt;
&lt;br /&gt;
In Line 90, the library and function are called. The program containing the function is named in quotations before the colon, while the function name is listed after the colon again. &lt;br /&gt;
&lt;br /&gt;
Line 100 initiates the function and provides the variables necessary. &lt;br /&gt;
&lt;br /&gt;
Since functions in libraries can be accessed from other programs, it helps the programmer standardize activity across different programs while also shortening program length by removing repeated sections. Also, changes only need to be made to the library function instead of individually updating all programs when needed. For these reasons, many programmers choose to create a program that is solely used as a library, a single place to store all their functions and access them for use from each individual program when needed. &lt;br /&gt;
&lt;br /&gt;
[[Tutorial 2|Table of Contents]]&lt;/div&gt;</summary>
		<author><name>Laura</name></author>
	</entry>
</feed>