=====Using DATA statements in libraries=====
//by Richard Russell, March 2011//\\ \\ Because you cannot use **line numbers** or **labels** in libraries (or other [[http://www.bbcbasic.co.uk/bbcwin/manual/bbcwin5.html#install|INSTALLed]] modules), the conventional forms of the [[http://www.bbcbasic.co.uk/bbcwin/manual/bbcwin7.html#restore|RESTORE]] statement cannot be used. At first sight it might appear that this precludes the use of [[http://www.bbcbasic.co.uk/bbcwin/manual/bbcwin4.html#data|DATA]] statements in libraries, but in fact they can be used by means of the //relative// version **RESTORE +**.\\ \\ For example the following code could be placed in a library:\\
DEF PROCrestore
RESTORE +1
ENDPROC
DATA Here,are,some,data,items,in,a,library
DATA Here,is,some,more,data
Calling **PROCrestore** moves the data pointer so that the next items to be [[http://www.bbcbasic.co.uk/bbcwin/manual/bbcwin7.html#read|READ]] will be taken from the subsequent DATA statements:\\
PROCrestore
READ A$,B$,C$,D$
(this code could be in the main program or in a library).\\ \\ Note the use of **RESTORE +1** rather than **RESTORE +2**, as might superficially seem more correct. This ensures that the code will work correctly even if the library is crunched using the **concatenate lines** option (resulting in the **ENDPROC** being moved onto the same line as the **RESTORE**).\\ \\ If you find that disconcerting you could always move the **ENDPROC** until after the **DATA** statements:\\
DEF PROCrestore
RESTORE +1
DATA Here,are,some,data,items,in,a,library
DATA Here,is,some,more,data
ENDPROC