P:8BzSօ @8BSB.app@4: @ @ @ @ @ @ @@ @0@ @P@ @p@ @ @ @ @ @ @ @ @B{R|S}T~U~U~U~U~UBQQ@``AD@D@@00AH@P@Bi ID_idpa   SB_0idtb 2fd  typ sizla 2 ord colliwirsfo vialsobditft 2heslix cllcaqy SB_1id FC_id fid typla 2ca cfo cba styqytb 2 FC_1id CL_id fidla 2 CL_1idCL_2 fid LI_li ( LI_1li( PA_la 2  PR_idtb 2cvscbditft 2heszsgfshk  PR_1id VA_idla va VA_1id RM_ idtb 2 idtal so RM_1id RM_2 idt! IX_ idtb 2la 2caix IX_1id"0OPLFunctions r0r1 r2 r3r4  @+AReturns the absolute value of a floating-point number that is, without any +/- sign for example ABS(-10.099) is 10.099If x is an integer, you wont get an error, but the result will be converted to floating-point for example ABS(-6) is 6.0. Use IABS to return the absolute value as a long integer.@Returns the arc cosine, or inverse cosine (COS-1) of x. x must be in the range -1 to +1. The number returned will be an angle in radians. To convert the angle to degrees, use the DEG function.4BReturns the address at which variable is stored in memory. The values of different types of variables are stored in bytes starting at ADDR(variable). See PEEK for details.The maximum address is guaranteed to be less than 64K on the Series 3c, while it is not on the Series 5. The return type therefore must be a long integer on the Series 5, but may be an integer on the Series 3c.(3) See SETFLAGS if you require the 64K limit to be enforced on the Series 5. If the flag is set to restrict the limit, a& is guaranteed to fit into an integer.See UADD, USUB.sCOpens or closes a gap at off& (off%) within the allocated cell pcell& (pcell%), returning the new cell address or zero if out of memory. off& (off%) is 0 for the first byte in the cell. Opens a gap if the amount am& (am%) is positive, and closes it if negative.The number of bytes allocated is restricted to 64K on the Series 3c, while it is not on the Series 5. The return type therefore must be a long integer on the Series 5, but may be an integer on the Series 3c.Cells are allocated lengths that are the smallest multiple of four greater than the size requested. An error will be raised if the cell address argument is not in the range known by the heap.See also SETFLAGS if you require the 64K limit to be enforced on the Series 5. If the flag is set to restrict the limit, pcelln& is guaranteed to fit into an integer.See ALLOC. See also the Advanced Topics chapter.BPresents an alert - a simple dialog - with the messages and keys specified, and waits for a response. m1$ is the message to be displayed on the first line, and m2$ on the second line. If m2$ is not supplied or if it is a null string, the second message line is left blank.Up to three keys may be used. b1$, b2$ and b3$ are the strings (usually words) to use over the keys. b1$ appears over an Esc key, b2$ over Enter, and b3$ over Space. This means you can have Esc, or Esc and Enter, or Esc, Enter and Space keys. If no key strings are supplied, the word CONTINUE is used above an Esc key.The key number 1 for Esc, 2 for Enter or 3 for Space is returned.Constants for these return values are supplied in Const.oph.BAllocates a cell on the heap of the specified size, returning the pointer to the cell or zero if there is not enough memory.The number of bytes allocated is restricted to 64K on the Series 3c, while it is not on the Series 5. The return type therefore must be a long integer on the Series 5, but may be an integer on the Series 3c.Cells are allocated lengths that are the smallest multiple of four greater than the size requested. An error will be raised if the cell address argument is not in the range known by the heap.See also SETFLAGS if you require the 64K limit to be enforced. If the flag is set to restrict the limit, pcelln& is guaranteed to fit into an integer.See ADJUSTALLOC, REALLOC, FREEALLOC.BBegins definition of an OPL application. caption is the applications name (or caption) in the machines default language. Note that although caption is a string, it is not enclosed in quotes.uid& is the applications UID. For distributed applications, official reserved UIDs must be used. These can be obtained by contacting Psion Software plc (see the OPL applications section in the Advanced Topics chapter for details of how to do this).All information included in the APP...ENDA structure will be used to generate an AIF file which specifies the applications caption in various languages, its icons for use on the System screen and its setting of FLAGS. See the Advanced Topics chapter for further details of this.See CAPTION, ICON, FLAGS.DAdds a new record to the end of the current data file. The record which was current is unaffected. The new record, the last in the file, becomes the current record.The record added is made from the current values of the field variables A.field1$, A.field2$, and so on, of the current data file. If a field has not been assigned a value, zero will be assigned to it if it is a numeric field, or a null string if it is a string field.Example:PROC add: OPEN address,A,f1$,f2$,f3$ PRINT ADD NEW RECORD PRINT Enter name:, INPUT A.f1$  PRINT Enter street:, INPUT A.f2$ PRINT Enter town:, INPUT A.f3$ APPEND CLOSEENDPTo overwrite the current record with new field values, use UPDATE.  On the Series 5, INSERT, PUT and CANCEL should be used in preference to APPEND and UPDATE, although APPEND and UPDATE are still supported for Series 3c compatibility. However, note that APPEND can generate a lot of extra (intermediate) erased records. COMPACT should be used to remove them, or alternatively use SETFLAGS to set auto-compaction on. See the Series 5 Database Handling chapter for more details. See also INSERT, MODIFY, PUT, CANCEL, SETFLAGSAReturns the character code of the first character of a$. For the Series 5, see Appendix D for the character set and for the Series 3c, see the character set in the back of the User Guide for the character codes. Alternatively, use A%=%char to find the code for char - e.g. %X for X.If a$ is a null string () ASC returns the value 0.Example: A%=ASC(hello) returns 104, the code for h.ALP`)XN@B(/]ПABS 6Q Usage: a=ABS(x)(/^蕥ПACOSM7  Usage: a=ACOS(x)0/_ ПADDR50Usage: a&=ADDR(variable)D/`BПADJUSTALLOC4yHpcelln&=ADJUSTALLOC(pcell&,off&,am&)/a]П ALERTI6qr%=ALERT(m1$,m2$,b1$,b2$,b3$)r%=ALERT(m1$,m2$,b1$,b2$)r%=ALERT(m1$,m2$,b1$)r%=ALERT(m1$,m2$)r%=ALERT(m1$)./bП ALLOC6A&pcell&=ALLOC(size&)(/cПAPP6 APP caption,uid& /dП APPENDQ$ APPEND"/eПASC8A a%=ASC(a$)@Returns the arc sine, or inverse sine (SIN-1) of x. x must be in the range -1 to +1. The number returned will be an angle in radians. To convert the angle to degrees, use the DEG function.UDPositions the cursor at x% characters across the text window and y% rows down. AT 1,1 always moves to the top left corner of the window. Initially, the window is the full size of the screen, but you can change its size and position with the SCREEN command.A common use of AT is to display strings at particular positions in the text window. For example:AT 5,2 :PRINT message. PRINT statements without an AT display at the left edge of the window on the line below the last PRINT statement (unless you use , or ;) and strings displayed at the top of the window eventually scroll off as more strings are displayed at the bottom of the window. Displayed strings always overwrite anything that is on the screen - they do not cause things below them on the screen to scroll down. Example:PROC records: LOCAL k% OPEN clients,A,name$,tel$ DO CLS AT 1,7 PRINT Press a key to PRINT step to next record PRINT or Q to quit AT 2,3 :PRINT A.name$ AT 2,4 :PRINT A.tel$ NEXT IF EOF AT 1,6 :PRINT EndOfFile FIRST ENDIF k%=GET UNTIL k%=%Q OR k%=%q CLOSEENDP@Returns the arc tangent, or inverse tangent (TAN-1) of x. The number returned will be an angle in radians. To convert the angle to degrees, use the DEG function.@Makes the previous record in the current data file the current record.If the current record is the first record in the file, then the current record does not change.DSounds the buzzer. The beep lasts for time%/32 seconds so for a beep a second long make time%=32, etc. The maximum is 3840 (2 minutes).The pitch (frequency) of the beep is 512/(pitch%+1) KHz.BEEP 5,300 gives a comfortably pitched beep.If you make time% negative, BEEP first checks whether the sound system is in use (perhaps by another OPL program), and returns if it is. Otherwise, BEEP waits until the sound system is free.Example a scale from middle C:PROC scale: LOCAL freq,n% REM n% relative to middle A n%=3 REM start at middle C WHILE n%<16 freq=440*2**(n%/12.0) REM middle A = freq 440Hz BEEP 8,512000/freq-1.0 n%=n%+1 IF n%=4 OR n%=6 OR n%=9 OR n%=11 OR n%=13 n%=n%+1 ENDIF ENDWHENDP Alternatively, sound the buzzer with this statement: PRINT CHR$(7). This produces a click sound.Note that on the Series 5 if your batteries are low BEEP may not produce the desired effect: the buzzer will be used instead to produce the beep. The buzzer produces a higher pitched sound.^ABegins a transaction on the current database. The purpose of this is to allow changes to a database to be committed in stages. Once a transaction has been started on a view (or table) then all database keywords will function as usual, but the changes to that view will not be made until COMMITTRANS is used. See also COMMITTRANS, ROLLBACK, INTRANS.@Puts a bookmark at the current record of the current database view. The value returned can be used in GOTOMARK to make the record current again. Use KILLMARK to delete the bookmark.@Makes a program performing a DO...UNTIL or WHILE...ENDWH loop exit the loop and immediately execute the line following the UNTIL or ENDWH statement.ECBUSY str$ displays str$ in the bottom left of the screen, until BUSY OFF is called. Use this to indicate Busy messages, usually when an OPL program is going to be unresponsive to keypresses for a while.If c% is given, it controls the corner in which the message appears:c%corner0top left1bottom left (default)2top right3bottom rightConstants for these corner values are supplied in Const.oph.delay% specifies a delay time (in half seconds) before the message should be shown. Use this to prevent Busy messages from continually appearing very briefly on the screen.Only one message can be shown at a time. The maximum string length of a BUSY message is 80 characters on the Series 5, and an Invalid argument error is returned for any value in excess of this. On the Series 3c, the maximum length is 19 characters.@Passes variable by reference to an OPX procedure when used in a procedure argument list. This means that the value of the variable may be changed by the procedure.See the Using OPXs on the Series 5 chapter for more details.ESpecifies an OPAs public name (or caption) for a particular language, which will appear below its icon on the Extras bar and in the list of Programs in the New File dialog (assuming the setting of FLAGS allows these) when the language is that used by the machine. CAPTION may only be used inside an APP...ENDA construct. The language code specifies for which language variant the caption should be used, so that the caption need not be changed when used on a different language machine. If used, for whatever language, CAPTION causes the default caption given in the APP declaration to be discarded. Therefore CAPTION statements must be supplied for every language in which the application is liable to be used, including the language of the machine on which the application is originally developed.The values of the language code should be one of the following:English 1French 2 German 3Spanish 4Italian 5Swedish 6Danish 7Norwegian 8Finnish 9American 10Swiss-French 11Swiss-German 12Portuguese 13Turkish 14Icelandic 15Russian 16Hungarian 17Dutch 18Belgian-Flemish 19Australian 20Belgian-French 21Austrian 22New Zealand 23International French 24Constants for the language codes are supplied in Const.oph.The maximum length of caption$ is 255 characters. However, you should bear in mind that a caption longer than around 8 characters will not fit neatly below the applications icon on the Extras bar.See APP.@Returns the character with character code x%. You can use it to display characters not easily available from the keyboard. For example, the instruction PRINT CHR$(133) displays an ellipsis (...).sACloses the current view on a database. If there are no other views open on the database then the database itself will be closed. See SETFLAGS for details of how to set auto-compaction on closing files.If youve used ERASE to remove some records, CLOSE recovers the memory used by the deleted records, provided it is held either in the internal memory, on a memory disk.@Clears the contents of the text window.The cursor then goes to the beginning of the top line. If you have used CURSOR OFF the cursor is still positioned there, but is not displayed.WCB%yENDP See also DOW.BReturns the number of days since 1/1/1900. Use this to find out the number of days between two dates.Example:PROC deadline:LOCAL a%,b%,c%,deadlin&LOCAL today&,togo%PRINT What day? (1-31)INPUT a%PRINT What month? (1-12)INPUT b%PRINT What year? (19??)INPUT c%deadlin&=DAYS(a%,b%,1900+c%)today&=DAYS(DAY,MONTH,YEAR)togo%=deadlin&-today&PRINT togo%,days to goGETENDPSee also dDATE, SECSTODATE.(The Date OPX provides a large set of procedures for manipulating dates and for accurate timing.AThis converts days&, the number of days since 1/1/1900, to the corresponding date, returning the day of the month to day%, the month to month% and the year to year%. This is useful for converting the value set by dDATE, which also gives days since 1/1/1900.%DFPtHNABrވFVp$/vaПCMD$I9(c$=CMD$(x%)?wϿПCOMMITTRANSCommits the transaction on the current view.See also BEGINTRANS, ROLLBACK, INTRANS.COMMITTRANS*/x ПCOMPACT< COMPACT file$CREATE tableSpec$,log,f1,f2,...l/ŨП CURSORI=9$CURSOR ONCURSOR OFFCURSOR id%,asc%,w%,h%CURSOR id%,asc%,w%,h%,type%CURSOR id%D/ƨПDATETOSECS=) Ls&=DATETOSECS(yr%,mo%,dy%,hr%,mn%,sc%)$/ǨП DATIM$ ?d$=DATIM$d?%ɨПDAYReturns the current day of the month (1 to 31) from the system clock. d%=DAY,/%ɨПDAYNAME$ >d$=DAYNAME$(x%)8/RMʨПDAYSI>@Usage:d&=DAYS(day%,month%,year%)@/vA˨ПDAYSTODATE>DDAYSTODATE days&,year%,month%,day%HDefines exit keys to go at the bottom or the side (see dINIT) of a dialog.Each pair of p$ and k% specifies an exit key; p$ is the text to be displayed on it, while k% is the keycode of the shortcut key. DIALOG returns the keycode of the key pressed (in lower case for letters).For alphabetic keys, use the % sign - %A means the code of A, and so on. The shortcut key is then Ctrl+alphabetic key on the Series 5. An appendix lists the codes for keys (such as Tab) which are not part of the character set. If you use the code for one of these keys, its name (e.g. Tab, or Enter) will be shown in the key.The following effects may be obtained by adding the appropriate constants to the shortcut key keycode:effect -- constant valuedisplay a button with no shortcut key label underneath it -- 256 ($100)use the key alone (without the Ctrl modification) as the shortcut key -- 512 ($200)Constants for these flags and keycodes for Esc and other keys are supplied in Const.oph.If you use a negative value for a k% argument, that key is a Cancel key. The corresponding positive value is used for the key to display and the value for DIALOG to return, but if you do press this key to exit, the var variables used in the commands like dEDIT, dTIME etc. will not be set. When using a negative shortcut to specify the cancel button, you must negate the shortcut together with any added flags.The Esc key will always cancel a dialog box, with DIALOG returning 0. If you want to show the Esc key as one of the exit keys, use -27 as the k% argument (its keycode is 27) so that the var variables will not be set if Esc is pressed.There can be only one dBUTTONS item per dialog.(The buttons take up two lines on the screen. dBUTTONS may be used anywhere between dINIT and DIALOG; the postion of its use does not affect the position of the buttons in the dialog.Some keypresses cannot be specified.This example presents a simple query, returning False for No, or True for Yes, providing shortcut keys of N and Y respectively and without labels beneath the keys.PROC query: dINIT dTEXT ,FORGET CHANGES,2 dTEXT ,Sure?,$202 dBUTTONS No,-(%N OR $100 OR $200),Yes,%Y OR $100 OR $200 RETURN DIALOG=%yENDPSee also dINIT.ACreates a dialog checkbox entry. This is similar to a choice list with two items, except that the list is replaced by a checkbox with the tick either on or off. The state of the checkbox is maintained across calls to the dialog.Initially you should set the live variable chk% to 0 to set the tick symbol off and to any other value to set it on. chk% is then automatically set to 0 if the box is unchecked or -1 if it is checked when the dialog is closed.See also dINIT.(DDefines a choice list to go in a dialog.p$ will be displayed on the left side of the line. list$ should contain the possible choices, separated by commas - for example, No,Yes. One of these will be displayed on the right side of the line, and arrow keys can be used to move between the choices.choice% must be a LOCAL or a GLOBAL variable. It specifies which choice should initially be shown - 1 for the first choice, 2 for the second, and so on. When you finish using the dialog, choice% is given a value indicating which choice was selected - again, 1 for the first choice, and so on.(On the Series 5, dCHOICE supports an unrestricted number of items (up to memory limits). To extend a dCHOICE list, add a comma after the last item on the line followed by ... (three full-stops), as shown in the usage above. choice% must be the same on all the lines, otherwise an error is raised. For example, the following specifies items i1, i2, i3, i4, i5, i6:dCHOICE ch%,prompt$,i1,i2,...dCHOICE ch%,,i3,14,...dCHOICE ch%,,i5,i6See also dINIT.BDefines an edit box for a date, to go in a dialog.p$ will be displayed on the left side of the line.lg&, which must be a LOCAL or a GLOBAL variable, specifies the date to be shown initially. Although it will appear on the screen like a normal date, for example 15/03/92, lg& must be specified as days since 1/1/1900.min& and max& give the minimum and maximum values which are to be allowed. Again, these are in days since 1/1/1900. An error is raised if min& is higher than max&. When you finish using the dialog, the date you entered is returned in lg&, in days since 1/1/1900.The system setting determines whether years, months or days are displayed first.See also DAYS, SECSTODATE,DAYSTODATE, dINIT.BCauses the translator to report an error if any variables or procedures are used before they are declared. It should be used at the beginning of the module to which it applies, before the first procedure. It is useful for detecting Undefined externals errors at translate-time rather than at runtime.For example, with DECLARE EXTERNAL commented out, the following translates and raises the error, Undefined externals, i at runtime. Adding the declaration causes the error to be detected at translate-time instead.REM DECLARE EXTERNALPROC main: LOCAL i% i%=10 PRINT i GETENDPIf you use this declaration, you will need to declare all subsequent variables and procedures used in the module, using EXTERNAL.See also EXTERNAL.@Declares an OPX. opxname is the name of the OPX, opxUid& its UID and opxVersion& its version number.Declarations of the OPXs preocedures should be made inside this structure.See the Using OPXs on the Series 5 chapter for more details.6BordEDIT var str$,p$Defines a string edit box, to go in a dialog.p$ will be displayed on the left side of the line.str$ is the string variable to edit. Its initial contents will appear in the dialog. The length used when str$ was defined is the maximum length you can type in.len%, if supplied, gives the width of the edit box (allowing for widest possible character in the font). The string will scroll inside the edit box, if necessary. If len% is not supplied, the edit box is made wide enough for the maximum width str$ could possibly be.See also dTEXT.@Defines a multi-line edit box to go into a dialog. Normally the resulting text would be used in a subsequent dialog, saved to file or printed using the Printer OPX (see the Using OPXs on the Series 5 chapter). It is also possible to paste text into the buffer from other applications and vice versa, although any formatting or embedded objects contained in text pasted in will be removed.ptrData& is the address of a buffer to take the }edited data. It could be the address of an array as returned by ADDR, or of a heap cell, as returned by ALLOC (see ADDR and ALLOC). The buffer may not be specified directly as a string and may not be read as such. Instead it should be peeked, byte by byte (see PEEK). The leading 4 bytes at ptrData& contain the initial number of bytes of data following. These bytes are also set by dEDITMULTI to the actual number of bytes edited. For this reason it is convenient to use a long integer array as the buffer, with at least 1+(maxLength%+3)/4 elements. The first element of the array then specifies the initial length.If an allocated cell is used (probably because more than 64K is required), the first 4 bytes of the cell must be set to the initial length of the data. If this length is not set then an error will be raised. For example if a cell of 100000 bytes is allocated, you would need to poke a zero long integer in the start to specify that there is initially no text in the cell. For example:p&=ALLOC(100000)POKEL p&,0REM Text starts at p&+4Special characters such as line breaks and tab characters may appear in the buffer. Constants for the codes of these are supplied in Const.oph.The prompt, p$ will be displayed on the left side of the edit box. widthInChars% specifies the width of the edit box within which the text is wrapped, using a notional average character width. The actual number of characters that will fit depends on the character widths, with e.g. more is fitting than ws. numberLines% specifies the number of full lines displayed. Any more lines will be scrolled. maxLength% specifies the length in bytes of the buffer provided (excluding the bytes used to store the length).The Enter key is used by a multi-line edit box which has the focus before being offered to any buttons. This means that Enter cant be used to exit the dialog, unless another item is provided that can take the focus without using the Enter key. Normal practice is to provide a button that does not use the Enter key to exit a dialog whenever it contains a multi-line edit box. The Esc key will always cancel a dialog however, even when it contains a multi-line edit box.The following example presents a three-line edit box which is about 10 characters wide and allows up to 399 characters:CONST KLenBuffer%=399PROC dEditM: LOCAL buffer&(101) REM 101=1+(399+3)/4 in integer arithmetic LOCAL pLen&,pText& LOCAL i% LOCAL c% pLen&=ADDR(buffer&(1)) pText&=ADDR(buffer&(2)) WHILE 1 dINIT Try dEditMulti dEDITMULTI pLen&,Prompt,10,3,KLenBuffer%dBUTTONS Done,%d REM button needed to exit dialog IF DIALOG=0 :BREAK :ENDIF PRINT Length:;buffer&(1) PRINT Text: i%=0 WHILE i%=32 PRINT CHR$(c%); ELSE PRINT .;REM just print a dot for special characters ENDIF i%=i%+1 ENDWH ENDWHENDPSee also dINIT.CChange the default window (ID=1) to change the colour mode.The default window uses 4-colour mode initially.mode%=1 just clears the screen, leaving the window in 4-colour mode. Clearing of the screen ensures compatibility with Series 3c. mode%=0 changes the screen to 2-colour mode (actually results in a mapping of greys to white or black).mode%=2 changes to 16-colour mode, as expected.Using DEFAULTWIN with either of these values also clears the screen.Using 4-colour mode uses more power than using 2-colour mode and using 16-colour mode uses more power that either of these.Constants for the modes of DEFAULTWIN are supplied in Const.oph. You are advised to call DEFAULTWIN once and for all near the start of your program if you need to change the colour mode of the default window on the Series 5 or use grey on the Series 3c. If it fails with Out of memory error, the program can then exit cleanly without losing vital information.See also gGREY, gCOLOR, gCREATE.BConverts from radians to degrees. Returns x, an angle in radians, as a number of degrees. The formula used is: 180*x/PIAll the trigonometric functions (SIN,COS etc.) work in radians, not degrees. You can use DEG to convert an angle returned by a trigonometric function back to degrees:Example:PROC xarctan: LOCAL arg,angle PRINT Enter argument:; INPUT arg PRINT ARCTAN of,arg,is angle=ATAN(arg) PRINT angle,radians PRINT DEG(angle),degrees GETENDPTo convert from degrees to radians, use RAD.ADeletes any type of file.(You can use wildcards for example, to delete all the files in D:\OPLDELETE D:\OPL\*(You can use wildcards for example, to delete all the OPL files in B:\OPLDELETE B:\OPL\*.OPLThe file type extensions are listed in the User Guide.See also RMDIR.@This deletes the table, table$, from the database, dbase$. To do this all views of the database, and hence the database itself, must be closed.gNDefines a filename edit box or selector, to go in a dialog. A Folder and Disk selector are automatically added on the following lines.By default no prompts are displayed for the file, folder and disk selectors. A comma-separated prompt list should be supplied. For example, for a filename editor with the standard prompts use:dFILE f$,File,Folder,Disk,1f% controls the type of file editor or selector, and the kind of input allowed. You can add together any of the following values: valuemeaning0 use a selector1 use an edit box2 allow directory names4 directory names only8 disallow existing files16 query existing files32 allow null string input64 invalid on Series 5128 obey/allow wildcards256 allow ROM files to be selected512 allow files in the System folder to be selectedThe first of the list is the most crucial. If you add 1 into f%, you will see a file edit box, as when creating a new file. If you do not add 1, you will see the matching file selector, used when choosing an existing file.The value 64 (to omit file extensions) is not valid on the Series 5 since file extensions are no longer treated as special components of the filename.If performing a copy to operation, you might use 1+2+16, to specify a file edit box, in which you can type the name of a directory to copy to, and which will produce a query if you type the name of an existing file.If asking for the name of a directory to remove, you might use 4, to allow an existing directory name only.Query existing is ignored if disallow existing is set. These two, as well as allow null string input, only work with file edit boxes, not matching file selectors.For file selectors, dFILE supports file restriction by UID, or by type from the users point of view. Documents are identified by three UIDs which identify which application created the document and what kind of file it is. Specifying all three UIDs will restrict the files as much as is possible, and specifying fewer will provide less restriction. You can supply 0 for uid1& and uid2& if you only want to restrict the list to uid3&. This may be useful when dealing with documents from one of your own applications: you can easily find out the third UID as it will be the UID you specified in the APP statement. Note that UIDs are ignored for editors. For example, if your application has UID KUidMyApp&, then the following will list only your application-specific documents:dFILE f$,p$,f%,0,KUidOplDoc&,KUidMyApp&REM KUidOplDoc& for OPL docsSome OPL-related UIDs are given in Const.oph. See the Calling Procedures for details of how to use this file and Appendix E for a listing of it.file$ is the string variable to edit. Its initial contents always control the initial drive and directory used. Any filename part of file$ is shown initially in the filename box. For a matching file selector, you can use wildcards in the filename part (such as *.tmp) to control which filenames are matched. To do this, you must add 128 to f%. 128 also allows wildcard specifications to be entered (returned in str$), for both matching and new file selectors.With a matching file selector (as opposed to an edit box) the value 8 restricts the selection to files which match the filename/extension in file$.You can always press Tab to produce the full file selector with a dFILE item.file$ must be declared to be 255 bytes long, since file names may be up to this length, and if it is shorter an error will be raised. On the Series 3c, it must be at least 128 bytes long.Constants for the flags used by dFILE and for some OPL-related UIDs are supplied in Const.oph.See also dINIT.ADefines an edit box for a floating-point number, to go in a dialog.p$ will be displayed on the left side of the line.min and max give the minimum and maximum values which are to be allowed. An error is raised if min is higher than max.fp must be a LOCAL or a GLOBAL variable. It specifies the value to be shown initially. When you finish using the dialog, the value you entered is returned in fp.See also dINIT.dBPresents the dialog prepared by dINIT and commands such as dTEXT and dCHOICE. If you complete the dialog by pressing Enter, your settings are stored in the variables specified in dLONG, dCHOICE etc., although you can prevent this with dBUTTONS.If you used dBUTTONS when preparing the dialog, the keycode which ended the dialog is returned. Otherwise, DIALOG returns the line number of the item which was current when Enter was pressed. The top item (or the title line, if present), has line number 1.If you cancel the dialog by pressing Esc, the variables are not changed, and 0 is returned.See also dINIT.EPrepares for definition of a dialog, cancelling any existing one. Use dTEXT, dCHOICE etc. to define each item in the dialog, then DIALOG to display the dialog.If title$ is supplied, it will be displayed at the top of the dialog.Any supplied title$ will be positioned in a grey box at the top of the dialog.flags% can be any added combination of the following constants to achieve the following effects,effectvaluebuttons on the right rather than at the bottom1no title bar (any title in dINIT is ignored)2use the full screen4dont allow the dialog box to be dragged8pack the dialog densely (not buttons though)16Constants for these flags are supplied in Const.oph.It should be noted that dialogs without titles cannot be dragged regardless of the No drag setting. Dense packing enables more lines to fit on the screen for larger dialogs. On the Series 5, if an error occurs when adding an item to a dialog, the dialog is deleted and dINIT needs calling again. This is necessary to avoid having partially specified dialog lines.In practical terms, this means that the following artificial example will raise a Structure fault error.dINITONERR e1 REM bad arg list gives argument errordCHOICE ch%,ChList,a,b,,,,c e1::ONERR OFFdLONG l&,Long,0,12345DIALOGD ^ffh^\>T\dF0/̨ПDBUTTONSI@F&dBUTTONS p1$,k1%...4/ϨПDCHECKBOXI?,dCHECKBOX chk%,prompt$/!ϨПDCHOICE= !YdCHOICE var choice%,p$,list$ or dCHOICE var choice%,p$,list1$+''...''dCHOICE var choice%,'''',list2$+''...''...dCHOICE var choice%,'''',listN$4/NШП DDATE?14dDATE var lg&,p$,min&,max&4/iѨП DECLARE EXTERNAL @ DECLARE EXTERNALX/hҨПDECLARE OPX?yvDECLARE OPXopxname,opxUid&,opxVersion&...ENDDECLARE0/\ӨП DEDIT@,dEDIT var str$,p$,len%^/PԨПDEDITMULTI@hdEDITMULTI var ptrData&,p$,widthInChars%,numberLines%,maxLength%./AjרПDEFAULTWIN A DEFAULTWIN mode% /e^بПDEGIAd=DEG(x)*/٨П DELETE B DELETE filename$./٨П DELETEAy(DELETE dbase$,table$`/ڨП DFILEBIrUsage:dFILE var file$,p$,f%or dFILE var file$,p$,f%,uid1&,uid2&,uid3&2/+ݨП DFLOATIB 0dFLOAT var fp,p$,min,max$/=ިП DIALOGA n%=DIALOG@/jHߨП DINITB(PdINITdINIT title$dINIT title$,flags%BLists filenames, including subdirectory names, matching a file specification. You can include wildcards in the file specification. If filespec$ is just a directory name, include the final backslash on the end for example, \TEMP\ . Use the function like this:DIR$(filespec$) returns the name of the first file matching the file specification. DIR$() then returns the name of the second file in the directory.DIR$() again returns the third, and so on.When there are no more matching files in the directory, DIR$() returns a null string.Example, listing all the files whose names begin with A in C:\ME\PROC dir: LOCAL d$(255) d$=DIR$(C:\ME\A*) WHILE d$<> PRINT d$ d$=DIR$() ENDWH GETENDPADefines an edit box for a long integer, to go in a dialog.p$ will be displayed on the left side of the line.min& and max& give the minimum and maximum values which are to be allowed. An error is raised if min& is higher than max&.lg& must be a LOCAL or a GLOBAL variable. It specifies the value to be shown initially. When you finish using the dialog, the value you entered is returned in lg&.See also dINIT.>BDO forces the set of statements which follow it to execute repeatedly until the condition specified by UNTIL is met.This is the easiest way to repeat an operation a certain number of times.Every DO must have its matching UNTIL to end the loop.If you set a condition which is never met, the program will go round and round, locked in the loop forever.You can escape by pressing Ctrl+Esc, provided you havent set ESCAPE OFF. If you have set ESCAPE OFF, you will have to return to go to the Task list, select your program in the list and click the Close file option.5AReturns the day of the week from 1 (Monday) to 7 (Sunday) given the date. day% must be between 1 and 31, month% from 1 to 12 and year% from 1900 to 2155.For example, D%=DOW(4,7,1992) returns 6, meaning Saturday.Constants for the numeric values assigned to the days of the week are supplied in Const.oph.BPositions a dialog. Use dPOSITION at any time between dINIT and DIALOG.dPOSITION uses two integer values. The first specifies the horizontal position, and the second, the vertical. dPOSITION -1,-1 positions to the top left of the screen; dPOSITION 1,1 to the bottom right; dPOSITION 0,0 to the centre, the usual position for dialogs.dPOSITION 1,0, for example, positions to the right-hand edge of the screen, and centres the dialog half way up the screen.Constants for the positions are supplied in Const.oph.See also dINIT."EDefines a line of text to be displayed in a dialog.p$ will be displayed on the left side of the line, and body$ on the right side. If you only want to display a single string, use a null string () for p$, and pass the desired string in body$. It will then have the whole width of the dialog to itself. An error is raised if body$ is a null string.body$ is normally displayed left aligned (although usually in the right column). You can override this by specifying t%:t% effect0 left align body$1 right align body$2 centre body$However, note that on the Series 5, alignment of body$ is only supported when p$ is null, with the body being left aligned otherwise. In addition, you can add any or all of the following three values to t%, for these effects:$200 draw a line below this item$400 allow this item to be selected$800 specify this item as a text separatorYou can display a line separator between any dialog items by setting the flag $800 on an item which has null p$ and body$. (If p$ and/or body$ are not null, then the flag is ignored and no separator is drawn.) The separator counts as an item in the value returned by DIALOG. The flag $400 only allows the prompt, and not the body, to be selected. Constants for the text types are supplied in Const.oph.See also dEDIT, dINIT@Defines an edit box for a time, to go in a dialog.p$ will be displayed on the left side of the line.lg&, which must be a LOCAL or a GLOBAL variable, specifies the time to be shown initially. Although it will appear on the screen like a normal time, for example 18:27, lg& must be specified as seconds after 00:00. A value of 60 means one minute past midnight; 3600 means one oclock, and so on.min& and max& give the minimum and maximum values which are to be allowed. Again, these are in seconds after 00:00. An error is raised if min& is higher than max&. When you finish using the dialog, the time you entered is returned in lg&, in seconds after 00:00.t% specifies the type of display required, as follows:t% time display0 absolute time no seconds1 absolute time with seconds2 duration no seconds3 duration with seconds4 time without hours8 absolute time in 24 hour clockConstants for dTIME types are supplied in Const.oph.For example, 03:45 represents an absolute time while 3 hours 45 minutes represents a duration.Absolute times are displayed in 24-hour or am/pm format according to the current system setting. 8 displays the time in 24 hour clock, regardless of the system setting.Absolute times always display am or pm as appropriate, unless 24 hour clock is being used. Durations never display am or pm. Note, however, that if you use the flag 4 (no hours) then the am/pm symbol will be displayed and the flag 2 must be added if you wish to hide it.See also dINIT.ADefines a secret string edit box, such as for a password, to go in a dialog.p$ will be displayed on the left side of the line.str$ is the string variable to take the string you type.str$ must be less than 16 characters long.Initially the dialog does not show any characters for the string; the initial contents of str$ are ignored. A special symbol will be displayed for each character you type, to preserve the secrecy of the string.See also dINIT.yCDisplays a string variable which you can edit directly on the screen. All the usual editing keys are available the arrow keys move along the line, Esc clears the line, and so on.When you have finished editing, press Enter to confirm the changes. If you press Enter before you have made any changes, then the string will be unaltered.If you use EDIT in conjunction with a PRINT statement, use a comma at the end of the PRINT statement, so that the string to be edited appears on the same line as the displayed string:...PRINT Edit address:,EDIT A.address$UPDATE....TRAP EDIT If the Esc key is pressed while no text is on the input line, the Escape key pressed error (number -114) will be returned by ERR provided that the EDIT has been trapped. You can use this feature to enable the user to press the Esc key to escape from inputting a string.See also INPUT, dEDIT.AFinds out whether youre at the end of a file yet. Returns -1 (true) if the end of the file has been reached, or 0 (false) if it hasnt. When reading records from a file, you should test whether there are still records left to read, otherwise you may get an error.Example:PROC eoftest: OPEN myfile,A,a$,b% DO PRINT A.a$ PRINT A.b% NEXT  PAUSE -40 UNTIL EOF PRINT The last record GET RETURNENDP@Erases the current record in the current file.The next record is then current. If the erased record was the last record in a file, then following this command the current record will be null and EOF will return true.AReturns the number of the last error which occurred, or 0 if there has been no error.Example:...PRINT Enter age in yearsage::TRAP INPUT age%IF ERR=-1 PRINT Number please: GOTO ageENDIF...You can set the value returned by ERR to 0 (or any other value) by using TRAP RAISE 0. This is useful for clearing ERR.See also ERR$,ERRX$. See the Error Handling chapter for full details, including the list of error numbers and messages.FAReturns the error message for the specified error code x%. ERR$(ERR) gives the message for the last error which occurred. Example:TRAP OPEN \FILE,A,field1$IF ERR PRINT ERR$(ERR) RETURNENDIFSee also ERR, ERRX$. See the Error Handling chapter for full details, including the list of error numbers and messages.dAReturns the current extended error message (when an error has been trapped), e.g.Error in MODULE\PROCEDURE,EXTERN1,EXTERN2,...which would have been presented as an alert if the error had not been trapped. This allows the list of missing externals, missing procedure names, etc. to be found when an error has been trapped by a handler.See ERR, ERR$.BESCAPE OFF stops Ctrl+Esc on the Series 5 or Psion-Esc on the Series 3c being used to break out of the program when it is running. ESCAPE ON enables this feature again.ESCAPE OFF takes effect only in the procedure in which it occurs, and in any sub-procedures that are called. Ctrl+Esc is always enabled when a program begins running.If your program enters a loop which has no logical exit, and ESCAPE OFF has been used, you will have to return to the System screen, move to the program name and select the ''Close file'' option.BEvaluates the mathematical string expression s$ and returns the floating-point result. s$ may include any mathematical function or operator. Note that floating-point arithmetic is always performed.On the Series 5, EVAL runs in the context of the current procedure, so globals and externals can be used in s$, procedures in loaded modules can be called and the current values of gX and gY, can be used etc. LOCAL variables cannot be used in s$ (because the translator cannot reference them).For example:DO AT 10,5 :PRINT Calc:, TRAP INPUT n$ IF n$= :CONTINUE :ENDIF IF ERR=-114 :BREAK :ENDIF CLS :AT 10,4 PRINT n$;=;EVAL(n$)UNTIL 0See also VAL.B"f`Xzl\>:<:FBPDB/ПDIR$CQTUsage:d$=DIR$(filespec$)then d$=DIR$()4/П DLONGC 4dLONG var lg&,p$,min&,max&D/aПDO...UNTILDRUsage:DOstatement...UNTIL condition2/ ПDOW D 2d%=DOW(day%,month%,year%)./ ПDPOSITIONIDdPOSITION x%,y%>/BП DTEXTD(HdTEXT p$,body$,t%or dTEXT p$,body$8/xoП DTIME F.:dTIME var lg&,p$,t%,min&,max&0/ПDXINPUTIC1&dXINPUT var str$,p$ /WПEDITIEyEDIT a$/KПEOFE e%=EOF /П ERASEE ERASE/ПERRIG e%=ERR$/>ПERR$IF e$=ERR$(x%)"/YeП ERRX$F x$=ERRX$(/kПESCAPE OFF EESCAPE OFF"/ПEVAL Gd=EVAL(s$)qAChecks to see that a file exists.Returns -1 (True) if the file exists and 0 (False) if it doesnt.Use this function when creating a file to check that a file of the same name does not already exist, or when opening a file to check that it has already been created:IF NOT EXIST(CLIENTS) CREATE CLIENTS,A,names$ELSE OPEN CLIENTS,A,names$ENDIF...FRequired if DECLARE EXTERNAL is specified in the module.The first usage declares a variable as external. For example, EXTERNAL screenHeight%The second usage declares the prototype of a procedure (prototype includes the final : and the argument list). The procedure may then be referred to before it is defined. This allows parameter type-checking to be performed at translate-time rather than at runtime and also provides the necessary information for the translator to coerce numeric argument types. This is reasonable because OPL does not support argument overloading. The same coercion occurs as when calling the built-in keywords.Following the example of C and C++, you would normally provide a header file declaring prototypes of all the procedures and INCLUDE this header file at the beginning of the module which defines the declared procedures to ensure consistency. The header file would also be INCLUDEd in any other modules which call these procedures. Then you should use DECLARE EXTERNAL at the beginning of modules which include the header file so that the translator can ensure that these procedures are called with correct parameter types or types which can be coerced. The following is an example of usage of DECLARE EXTERNAL and EXTERNAL:DECLARE EXTERNALEXTERNAL myProc%:(i%,l&)REM or INCLUDE myproc.oph that defines all your proceduresPROC test:LOCAL i%,j%,s$(10)REM j% is coerced to a long integer as specified by the prototype. myProc%:(i%,j%)REM translator Type mismatch error:REM string cant be coerced to numeric typemyProc%:(i%,s$)REM wrong argument count gives translator errormyProc%:(i%)ENDPPROC myProc%:(i%,l&)REM Translator checks consistency with prototype above...ENDPSee DECLARE EXTERNAL.BSearches the current data file (or view on the Series 5) for fields matching a$. The search starts from the current record, so use NEXT to progress to subsequent records. FIND makes the next record containing a$ the current record and returns the number of the record found. Capitals and lower-case letters match.You can use wildcards:? matches any single charactermatches any group of characters.To find a record with a field containing Dr and either BROWN or BRAUN, use:F%=FIND(*DR*BR??N*)FIND(BROWN) will find only those records with a field consisting solely of the string BROWN.You can only search string fields.See also FINDFIELD.dDLike FIND, finds a string, makes the record with this string the current record, and returns the number of this record.a$ is the string for which to search: the search will be carried out in no% fields in each record, starting at the field with number start% (1 is the number of the first field). start% and no% may refer to string fields only and other types will be ignored. The flag% argument specifies the type of search as explained below. If you want to search in all fields, use start%=1 and for no% use the number of fields you used in the OPEN/CREATE command.flags% should be specified as follows:search directionflags%backwards from current record 0forwards from current record 1backwards from end of file 2forwards from start of file 3Constants for these flags are supplied in Const.oph.Add 16 to the value of flag% given above to make the search case-dependent, where case-dependent means that the record will exactly match the search string in case as well as characters. Other wise the search will case-independent which means that upper case and lower case characters will match.3BReturns a string representation of the number x, to y% decimal places. The string will be up to z% characters long.Example: FIX$(123.456,2,7) returns 123.46.If z% is negative then the string is right-justified for example FIX$(1,2,-6) returns 1.00 where there are two spaces to the left of the 1.If z% is positive then no spaces are added for example FIX$(1,2,6) returns 1.00.If the number x will not fit in the width specified by z%, then the string will just be asterisks, for example FIX$(256.99,2,4) returns ****.See also GEN$, NUM$, SCI$.AReplaces TYPE on the Series 5. flags% values as follows:1 specifies an application which can create files. It will then be included in the list of applications offered when the user creates a new file from the System screen.2 prevents the application from appearing in the Extras bar. It is very unusual to have this flag set.Constants for these flags are supplied in Const.oph.FLAGS may only be used within the APP...ENDA construct.AConverts an integer expression (either integer or long integer) into a floating-point number. Example:PROC gamma:(v)LOCAL c c=3E8 RETURN 1/SQR(1-(v*v)/(c*c))ENDPYou could call this procedure like this: gamma:(FLT(a%)) if you wanted to pass it the value of an integer variable without having first to assign the integer value to a floating-point variable.See also INT and INTF.EDraws a one-pixel wide, black border around the edge of the current drawable. If width% and height% are supplied, a border shape of this size is drawn with the top left corner at the current position. If they are not supplied, the border is drawn around the whole of the current drawable.flags% controls three attributes of the border a shadow to the right and beneath, a one-pixel gap all around, and the type of corners used:flags% effect 1 single pixel shadow2 removes a single pixel shadow3 double pixel shadow4 removes a double pixel shadow (leaves a gap for double pixel shadow on Series 3c)$100 one-pixel gap all round$200 more rounded cornersConstants for the values of these flags are supplied in Const.oph.The shadows on the Series 5 will not appear in the same way as shadows on other objects such as dialogs and menu panes appear. To display such shadows on a window, you must specify them when using gCREATE. Hence you should use gCREATE (and gXBORDER) in preference to gBORDER on the Series 5.You can combine the values to control the three different effects. (1, 2, 3 and 4 are mutually exclusive you cannot use more than one of them.) For example, for rounded corners and a double pixel shadow, use flags%=$203.Set flags%=0 for no shadow, no gap, and sharper corners.For example, to de-emphasise a previously emphasised border, use gBORDER with the shadow turned off:gBORDER 3 REM show borderGETgBORDER 4 REM border off...See also gXBORDER.GDraws a 3-D black and grey button at the current position in a rectangle of the supplied width w% and height h%, which fully encloses the button in all its states. text$ specifies up to 64 characters to be drawn in the button in the current font and style. You must ensure that the text will fit in the button.type%=1 draws a Series 3c button; type%=2 specifies Series 5.state%=0 draws a raised button, state%=1 a semi-depressed (flat) button and state%=2 a fully-depressed (sunken) button.Bitmaps may be used on buttons. Three extra optional arguments can be passed which give the bitmap ID, the mask ID and the layout for the button respectively. maskId% can be 0 to specify no mask.The following constants should be used for layout% to specify relative positions of the text and icon on a button,position of text layout%right 0bottom 1top 2left 3The following constants can be added to the values above to specify how a buttons excess space is to be allocated,share 0to text $10to picture $20Constants for all these layout types and for the button states are supplied in Const.oph.When the layout is such that the text is at the top or the bottom, then text and picture are centred vertically and horizontally in the space allotted to them. If the layout has text to the left or right, then the text is left aligned in the space allotted to it and the picture is right or left aligned respectively. Both text and picture are centred vertically in this case.Examples: layout% description$13 creates a button with text on the left and left aligned in any excess space.$20 creates a button with text on the right and the picture left aligned in any excess space.$10 creates a standard toolbar button, putting the text on the right.For a picture only with no text use text$=.Invalid arguments error is raised if you use OPL windows for gBUTTON. Read-only bitmaps may also be loaded using the Bitmap OPX.ADraws a circle with the centre at the current position in the current drawable. If the value of radius% is negative then no circle is drawn.If fill% is supplied and if fill%<>0 then the circle is filled with the current pen colour.See gELLIPSE, gCOLOR.@%> Do not use gSCROLL to scroll the region containing a clock. When the time is updated, the old position would be used. The whole window may, however, be moved using gSETWIN.Digital clocks display in 24-hour or 12-hour mode according to the system-wide setting. offset& specifies an offset in minutes from the system time to the time displayed. This allows you to display a clock showing a time other than the system time.A flag, which has the value $100, may be ORed with mode% so that offset& may be specified in seconds rather than minutes. The offset is a long integer to enable a whole day to be specified when the offset is in seconds.If these arguments are not supplied, mode% is taken as 1, and offset& as 0.The system setting for the clock type (i.e. digital or analog) can be changed by an OPL program using the procedure LCSETCLOCKFORMAT: in Date OPX This is function should be used to implement, for example, tapping a toolbar clock to change its type as in the built-in Series 5 applications. See the Using OPXs on the Series 5 section for full details of this procedure.format$, font% and style% are used only for formatted digital clocks (mode% 10 on the Series 3c and 11 on the Series 5). The values for font& and style% are as for gFONT and gSTYLE. The default font for gCLOCK is the system font. The default style is normal (0).For the formatted digital clock, a format string (up to 255 characters long) specifies how the clock is to be displayed. The format string contains a number of format specifiers in the form of a % followed by a letter. (Upper or lower case may be used.)The format string may contain the following symbols to obtain the required effects:%%Insert a single % character in the string %*Abbreviate following item. (The asterisk should be inserted between the % and the number or letter, e.g. %*1). In most cases this amounts to omitting any leading zeros, for example if it is the first of the month %F %*M will display as 1 rather than 01.%:nInsert a system time separator character. n is an integer between zero and three inclusive which indicates which time separator character is to be used. For European time settings, only n=1 and n=2 are used, giving the hours/minutes separator and minutes/seconds separator respectively.%/nInsert a system date separator character. n is an integer between zero and three inclusive which indicates which date separator character is to be used. For European time settings, only n=1 and n=2 are used, giving the day/month separator and month/year separator respectively.%1Insert the first component of a three component date (i.e. a date including day, month and year) where the order of the components is determined by the system settings. The possibilities are: dd/mm/yyyy, (European), mm/dd/yyyy (American), yyyy/mm/dd (Japanese).%2Insert the second component of a three component date where the order has been determined by the system settings. See %1.%3Insert the third component of a three component date where the order has been determined by the system settings. See %1.%4Insert the first component of a two component date (i.e. a date including day and month only) where the order has been determined by system settings. The possibilities are: dd/mm, (European), mm/dd (American), mm/dd (Japanese).%5Insert the second component of a two component date where the order has been determined by the system settings. See %4.%AInsert am or pm according to the current language and time of day. Text is printed even if 24 hour clock is in use. Text may be specified to be printed before or after the time, and a trailing or leading space as appropriate will be added. The abbreviated version (%*A) removes this space.Optionally, a minus or plus sign may be inserted between the % and the A. This operates as follows: %-A causes am/pm text to be inserted only if the system setting of the am/pm symbol position is set to display before the time. Similarly, %+A causes am/pm text to be inserted only if the system setting of the am/pm symbol is set to display after the time. No am/pm text will be inserted before the time if a + is inserted in the string. For example you could use, %-A%H%:1%T%+A to insert the am/pm symbol either before or after the time, according to the system setting. %+A and %-A cannot be abbreviated.%BAs %A, except that the am/pm text is only inserted if the system clock setting is 12 hour. (This should be used in conjunction with %J. )%DInsert the two-digit day number in month (in conjunction with %1 etc.).%EInsert the day name. Abbreviation is language specific (3 letters in English).%FUse this at the beginning of a format string to make the date/time formatting independent of the system setting. This fixes the order of the following day/month/year component(s) in their given order, removing the need to use %1 to %5, allowing individual components of the date to be printed. (No abbreviation.)%HInsert the two-digit hour component of the time in 24 hour clock format.%IInsert the two-digit hour component of the time in 12 hour clock format. Any leading zero is automatically suppressed, regardless of whether an asterisk is inserted or not.%JInsert the two-digit hour component of time in either 12 or 24 hour clock format depending on the corresponding system setting. When the clock has been set to 12 hour format, the hours leading zero is automatically suppressed regardless of whether an asterisk has been inserted between the % and J.%MInsert the two-digit month number (in conjunction with %1 etc.).%NInsert the month name (in conjunction with %1 etc.). When using system settings (i.e. not using %F) this causes all months following %N in the string to be written in words. When using fixed format (i.e. when using %F) %N may be used alone to insert a month name. Abbreviation is language specific (3 letters in English).%SInsert the two-digit second component of the time.%TInsert the two-digit minute component of the time.%WInsert the two-digit week number in year, counting the first (part) week as week 1.%XInsert the date suffix. When using system settings (i.e. not using %F), this causes a suffix to be put on any date following %X in the string. When using fixed format (i.e. using %F), %X following any date appends a suffix for that particular date. Cannot be abbreviated.%YInsert the four digit year number (in conjunction with %1 etc.). The abbreviation is the last two digits of the year.%ZInsert the three digit day number in year.Some examples of the use of these format strings are as follows. The example use is 1:30:05 pm on Wednesday, 1st January 1997, with the system setting of European dates and with am/pm after the time:1. %-A%I:%T:%S%+A will print the time in 12 hour clock, including seconds, with the am/pm either inserted before or after the time, depending on the system setting. So the example time would appear as, 1:30:05 pm.2. %F%E %*D%X %N %Y will print the day of the week followed by the date with suffix, the month as a word and the year. For example, Wednesday 1st January 1997.3. %E %D%X%N%Y %1 %2 %3 will use the locale setting for ordering the elements of the date, but will use a suffix on the day and the month in words. For example, Wednesday 01st January 1997.4. %*E %*D%X%*N%*Y %1 %2 %3 will be similar to 3., but will abbreviate the day of the week, the day, the month and the year, so the example becomes Wed 1st Jan 97.5. %M%Y%D%1%/0%2%/0%3 will appear as 01/01/1997. This demonstrates that the ordering of the %D, %M and %Y is irrelevant when using locale-dependent formatting. Instead the ordering of the date components is determined by the order of the %1, %2, and %3 formatting commands.style% may take any of the values used to specify gSTYLE, other than 2 (underlined).A note should also be made that a General Failure error will result if you attempt to use an invalid format. Invalid formats include using %: and %/ followed by 0 or 3 when in European locale setting (when these separators are without meaning) and using %+ and %- followed by characters other than A or B.As a final example, assuming that the settings in the Time application are for day/month/year date format, am-pm time format and : time separator and that the time is 11:30:05 pm on 9th March 1993, %G%L%P%O%*E, %1 %2 %3 %6%:%T:%S% generates Tue, 9th Mar 1993 11:30:05pm. With the same setup except for month/day/year date format in 24-hour mode, the same string generates Tue, Mar 9th 1993 23:30:05.@Closes the specified drawable that was previously opened by gCREATE, gCREATEBIT or gLOADBIT.If the drawable closed was the current drawable, the default window (ID=1) becomes current.An error is raised if you try to close the default window.&ASets the pen colour of the current window. The red%,green%,blue% values specify a colour which will be mapped to white, black or one of the greys on non-colour screens. Note that if the values of red%, green% and blue% are equal, then a pure grey results, ranging from black (0) to white (255).}BCopies a rectangle of the specified size (width w%, height h%) from the point x%,y% in drawable id%, to the current position in the current drawable.It is unadvisable to use gCOPY to copy from windows as it is very slow. It should only be used for copying from bitmaps to windows or other bitmaps.As this command can copy both set and clear pixels, the same modes are available as when displaying text. Set mode% = 0 for set, 1 for clear, 2 for invert or 3 for replace. 0, 1 and 2 act only on set pixels in the pattern; 3 copies the entire rectangle, with set and clear pixels.The current position is not affected in either window.FCreates a window with specified position and size (width w%, height h%), and makes it both current and foreground. Sets the current position to 0,0, its top left corner. If v% is 1, the window will immediately be visible; if 0, it will be invisible.Returns id% which identifies this window for other keywords.flags% specifies the graphics mode to use and shadowing on the window. By default the graphics mode is 2-colour and there is no shadow.The least significant 4 bits of flags% gives the colour-mode as before 0 (2 colour-mode), 1 (4 colour-mode), 2 (16 colour-mode). The next 4 bits may be set to specify the shadowing on the window. If 0, the window has no shadow. The next 4 bits give the shadow height relative to the window behind it (a height of N units gives a shadow of N(2 pixels).The flags% argument is most easily specified in hexadecimal:flags% description$412 16 colour-mode ($2), shadowed window ($1), with height 4 units ($4) above the previous window with a shadow of 8 pixels.$010 2 colour-mode (black and white) shadowed window at the same height as the previous window.$101 4 colour mode window with no shadow (height ignored if shadow disabled).$111 4 colour mode window with shadow of 1 unit above window behind, i.e. 2 pixel shadow.Constants for specifying various of the arguments taken by gCREATE are given in Const.oph.Note that 63 windows may be open at any time and it is recommended that you use many small windows rather than a few large ones.See also gCLOSE, gGREY, DEFAULTWIN.ACreates a bitmap with the specified width and height, and makes it the current drawable. Sets the current position to 0,0, its top left corner.Returns id% which identifies this bitmap for other keywords.gCREATEBIT may be used with an optional third parameter which specifies the graphics mode of the bitmap to be created. The values of these are as given in gCREATE. By default the graphics mode of a bitmap is 2-colour.See also gCLOSE,gCREATEADraws an ellipse with the centre at the current position in the current drawable. hRadius% is the horizontal distance in pixels from the centre of the ellipse to the left (and right) of the ellipse. vRadius% is the vertical distance from the centre of the ellipse to the top (and bottom). If the length of either radius is less than zero, then no ellipse is drawn.If fill% is supplied and if fill%<>0 then the ellipse is filled with the current pen colour.See gCIRCLE, gCOLOR.4BReturns a string representation of the number x. The string will be up to y% characters long.Example GEN$(123.456,7) returns 123.456 and GEN$(243,5) returns 243.If y% is negative then the string is right-justified - for example GEN$(1,-6) returns 1 where there are five spaces to the left of the 1.If y% is positive then no spaces are added for example GEN$(1,6) returns 1.If the number x will not fit in the width specified by y%, then the string will just be asterisks, for example GEN$(256.99,4) returns ****.See also FIX$, NUM$, SCI$.AWaits for a key to be pressed and returns the character code for that key. For example, if the A key is pressed with Caps Lock off, the integer returned is 97 (a), or 65 (A) if A was pressed with the Shift key down. The character codes of special keys, such as Pg Dn, are given in Appendix D.You can use KMOD to check whether modifier keys (Shift, Control, Fn and Caps Lock) were used.See also KEY.AWaits until a key is pressed and then returns which key was pressed, as a string. For example, if the A key is pressed in lower case mode, the string returned is a.You can use KMOD to check whether any modifier keys (Shift, Control, Fn and Caps Lock) were used.See also KEY$.jBReturns new command-line arguments to an OPA, after a change files or quit event has occurred. The first character of the returned string is C, O or X. If the return is C or O, the rest of the string is a filename.The first character has the following meaning:C - close down the current file, and create the specified new file,O - close down the current file, and open the specified existing file,X - close down the current file (if any) and quit the OPA.Constants for these return values are supplied in Const.oph.You can only call GETCMD$ once for each system message.See also CMD$.@Gets all event types handled by GETEVENT ev%() and additionally pointer (pen) events. The latter are too large to fit into the array of integers provided for GETEVENT ev%(). ev&() must have at least 16 elements.All events return a 32-bit time stamp. The window ID mentioned below refers to the value returned by the gCREATE keyword. The modifier values and scancode values for a keypress (which specify a location on the keyboard) are given in the Advanced Topics chapter and Appendix D. GETEVENT32 returns more information than GETEVENT, as listed below:If a key has been pressed: (ev&(1) AND &400)=0 ev&(1) keycode ev&(2) time stamp ev&(3) scan code ev&(4) modifier ev&(5) repeatNote that unlike the repeat for GETEVENT, the repeat for GETEVENT32 is strictly a repeat, i.e. if there is only one keypress, then the value of ev&(5) is 0.For all the other event types, ev&(1) is greater than &400:If the program has moved toforeground: ev&(1)=&401 ev&(2) time stampIf the program has moved tobackground: ev&(1)=&402  ev&(2) time stampIf the machine is switched on:. ev&(1)=&403  ev&(2) time stampNote that this event is not enabled unless the appropriate flag is set (by default it is not): see SETFLAGS.If the Series 5 wants the OPLapplication to 8switch files or exit: ev&(1)=&404If this event is received, GETCMD$ should be called to find out what action should be taken: see GETCMD$.If a key is pressed down: ev&(1)=&406 ev&(2) time stamp ev&(3) scan code ev&(4) modifiersIf a key is released: ev&(1)=&407 ev&(2) time stamp ev&(3) scan code ev&(4) modifiersIf a pen event occurs: ev&(1)=&408 ev&(2) time stamp ev&(3) window ID ev&(4) pointer type (see below) ev&(5) modifiers ev&(6) x-co-ordinate ev&(7) y-co-ordinate ev&(8) x-co-ordinate relative to parent window ev&(9) y-co-ordinate relative to parent windowFor pen events, ev&(4) has one of the following values: 0 - pen down1 - pen up6 - dragIf a pen enters contact with thescreen: ev&(1)=&409 ev&(2) time stamp ev&(3) window IDIf a pen exits contact with the screen: ev&(1)=&40A  ev&(2) time stamp ev&(3) window IDConstants for the array subscripts and the return values are supplied in Const.oph.Some pointer events, and pointer enters and exits, can be filtered out to avoid being swamped by unwanted event types. See POINTERFILTER.Note that for other unknown events, ev&(1) contains &1400 added to the code returned by the window server. ev&(2) is the timestamp and ev&(3)is the window ID, and the rest of the data returned by the window server is put into ev&(4), ev&(5), etc.If a non-key event such as foreground occurs while a keyboard keyword such as GET, INPUT, MENU or DIALOG is being used, the event is discarded. So GETEVENT must be used if non-key events are to be monitored. If you need to use these keywords in OPAs, use LOCK ON / LOCK OFF around them, so that the System screen wont send messages to switch files or shutdown while the application cannot respond.See also GETEVENT, GETEVENTA32.@Asynchronous version of GETEVENT32. GETEVENTA32 returns the same codes to the array ev&() as GETEVENT32.See GETEVENTC, GETEVENT32, GETEVENT.[D)HdhrJ:>Jp\p/!П GCLOCKH#"gCLOCK ON/OFFgCLOCK ON,mode%gCLOCK ON,mode%,offset&gCLOCK ON,mode%,offset&,format$gCLOCK ON,mode%,offset&,format$,font%gCLOCK ON,mode%,offset&,format$,font%,style%$/HП GCLOSEgCLOSE id%?<ПGCLSClears the whole of the current drawable and sets the current position to 0,0, its top left corner.gCLS2/yП GCOLOR51 0gCOLOR red%,green%,blue%6/ nП GCOPY46gCOPY id%,x%,y%,w%,h%,mode%Z/.bПGCREATE4/~id%=gCREATE(x%,y%,w%,h%,v%)id%=gCREATE(x%,y%,w%,h%,v%,flags%):/m ПGCREATEBITE4 6id%=gCREATEBIT(w%,h%,mode%)Z/ПGELLIPSE2|gELLIPSE hRadius%,vRadius% or gELLIPSE hRadius%,vRadius%,fill%&/{ ПGEN$3yg$=gen$(x,y%)/2 ПGET3 g%=GET / ПGET$E3g$=GET$&/c ПGETCMD$3w$=GETCMD$f?X ПGETDOC$vReturns the name of the current document.See also SETDOC. docname$=GETDOC$XN>"/Z7ПICONq3ICON mbm$T/8ПIF...ENDIFQxIF condition1...ELSEIF condition2...ELSE...ENDIF*/9ПINCLUDEINCLUDE file$ПKEY k%=KEY / ?ПKEY$k$=KEY$??ПKEYAThis is an asynchronous keyboard read function.See the Advanced Topics chapter for details.Cancel with KEYC.@err%=KEYA(var stat%,var key%(1)),/?ПKEYCQ (err%=KEYC(var stat%)(/Q@ПKILLMARK)KILLMARK b% /AПKMODi)k%=KMODH?:BПLASTXPositions to the last record in a data file.LAST? wBП LCLOSECloses the device opened with LOPEN. (The device is also closed automatically when a program ends.) LCLOSE@Returns the leftmost x% characters from the string a$.For example if n$ has the value Charles, then b$=LEFT$(n$,3) assigns Cha to b$.@Returns the number of characters in a$.E.g. if a$ has the value 34 Kopechnie Drive then LEN(a$) returns 18. You might use this function to check that a data file string field is not empty before displaying:IF LEN(A.client$) PRINT A.client$ENDIFAReturns the length of the previously allocated cell at pcell&Cells are allocated lengths that are the smallest multiple of four greater than the size originally requested. An error will be raised if the cell address argument is not in the range known by the heap.See also SETFLAGS if you require the 64K limit to be enforced on the Series 5. If the flag is set to restrict the limit, len& is guaranteed to fit into an integer.AReturns the smallest of a list of numeric items. The list can be either:A list of variables, values and expressions, separated by commas orThe elements of a floating-point array. When operating on an array, the first argument must be the array name followed by (). The second argument, separated from the first by a comma, is the number of array elements you wish to operate on for example m=MIN(arr(),3) would return the minimum of elements arr(1), arr(2) and arr(3).uBLoads a translated OPL module so that procedures in that module can be called. Until a module is loaded with LOADM, calls to procedures in that module will give an error.module$ is a string containing the name of the module. Specify the full file name only where necessary.Example: LOADM MODUL2Up to 8 modules can be in memory at any one time, including the top level module; if you try to LOADM a ninth module, you get an error. Use UNLOADM to remove a module from memory so that you can load a different one.(By default, LOADM always uses the folder of the top level module. It is not affected by the SETPATH command.Aeturns an integer showing the position in a$ where b$ occurs, or zero if b$ doesnt occur in a$. The search matches upper and lower case.Example: LOC(STANDING,AND) would return the value 3 because the substring AND starts at the third character of the string STANDING.EUsed to declare variables which can be referenced only in the current procedure. Other procedures may use the same variable names to create new variables. Use GLOBAL to declare variables common to all called procedures.The variables may be of 4 types, depending on the symbol they end with:Variable names not ending with $, %, & or () are floating-point variables, for example price, xThose ending with a % are integer variables, for example x%, sales92%Those ending with an & are long integer variables, for example x&, sales92&.Those ending with a $ are string variables. String variable names must be followed by the maximum length of the string in brackets, for example names$(12), a$(3)Array variables have a number immediately following them in brackets which specifies the number of elements in the array. Array variables may be of any type, for example: x(6),y%(5),f$(5,12),z&(3)When declaring string arrays, you must give two numbers in the brackets. The first declares the number of elements, the second declares their maximum length. For example surname$(5,8) declares five elements, each up to 8 characters long.Variable names may be any combination of up to 32 numbers, alphabetic letters and the underscore character. They must start with a letter or an underscore. The length includes the %, & or $ sign, but not the () in string and array variables.More than one GLOBAL or LOCAL statement may be used, but they must be on separate lines, immediately after the procedure name.BMark an OPA (OPL application) as locked or unlocked. When an OPA is locked with LOCK ON, the System screen will not send it events to change files or quit.If, for example, you move to the task list or the document name in the System screen try to stop that running OPA by using the Close file button or Ctrl+E respectively, a message will appear, indicating that the OPA cannot close down at that moment.You should use LOCK ON if your OPA uses a command, such as EDIT, MENU or DIALOG, which accesses the keyboard. You might also use it when the OPA is about to go busy for a considerable length of time, or at any other point where a clean exit is not possible. Do not forget to use LOCK OFF as soon as possible afterwards.An OPA is initially unlocked.AOpens the device to which LPRINTs are to be sent.No LPRINTs can be sent until a device has been opened with LOPEN.You can open any of these devices:The serial port, with LOPEN TTY:AA file on the PsionAny existing file of the name given will be overwritten when you print to it.Only one device may be open at any one time. Use LCLOSE to close the device. (It also closes automatically when a program finishes running.)@Converts any upper case characters in the string a$ to lower case and returns the completely lower case string.E.g. if a$=CLARKE, LOWER$(a$) returns the string clarkeUse UPPER$ to convert a string to upper case.BPrints a list of items, in the same way as PRINT, except that the data is sent to the device most recently opened with LOPEN.The expressions may be quoted strings, variables, or the evaluated results of expressions. The punctuation of the LPRINT statement (commas, semicolons and new lines) determines the layout of the printed text, in the same way as PRINT statements.If no device has been opened with LOPEN you will get an error.See PRINT for displaying to the screen.See LOPEN for opening a device for LPRINT.See Appendix C for an overview of printing from OPL. See also Printer OPX in the Using OPXs on the Series 5 chapter for details of more advanced printing features.AReturns the greatest of a list of numeric items.The list can be either:A list of variables, values and expressions, separated by commas orThe elements of a floating-point array. When operating on an array, the first argument must be the array name followed by (). The second argument, separated from the first by a comma, is the number of array elements you wish to operate on for example m=MAX(arr(),3) would return the value of the largest of elements arr(1), arr(2) and arr(3).KDefines a menu. When you have defined all of the menus, use MENU to display them.title$ is the name of the menu. From one to eight items on the menu may be defined, each specified by two arguments. The first is the item name, and the second the keycode for a shortcut key. This specifies a key which, when pressed together with the Ctrl (Psion on the Series 3c) key, will select the option. If the keycode is for an upper case key, the shortcut key will use both the Shift and Ctrl (Psion) keys.The options can be divided into logical groups by displaying a separating line under the final option in a group. To do this, pass the negative value corresponding to the shortcut key keycode for the final option in the group. For example, -%A specifies shortcut key Ctrl+Shift+A (Shift-Psion-A in Series 3c) and displays a separating line under the associated option in the menu.Series 5 supports the following menu featuresMenu items without shortcuts, by specifying shortcut values between 1 and 32. For these items the value specified is still returned if the item is selected.Menu items which are dimmed, or which have checkboxes or option buttons (sometimes known as radio buttons). These extra properties are controlled by adding the following bits to the shortcut key keycode.effect valuemenu item dimmed $1000item has check-box $0800start of an option button list $0900middle of an option button list $0A00end of an option button list $0B00checkbox/option button symbol on $2000checkbox/option button symbol indeterminate $4000Constants for these flags are supplied in Const.oph.The start, middle and end option buttons are for specifying a group of related items that can be selected exclusively (i.e. if one item is selected then the others are deselected). The number of middle option buttons is variable. A single menu card can have more than one set of option buttons and checkboxes, but option buttons in a set should be kept together. For speed, OPL does not check the consistency of these items specification.If a separating line is required when any of these effects had been added, you must be sure to negate the whole value, not just the shortcut key keycode. In the example,mCARD Options,View1,%A OR $2900,View2,-(%B OR $B00), Another option,%Cthe second shortcut key keycode and its flag value is correctly negated to display a separating line.A Too wide error is raised if the menu title length is greater than or equal to 40. Shortcut values must be alphabetic character codes or numbers between the values of 1 and 32. Any other values will raise an Invalid arguments error.If any menu item fails to be added successfully, a menu is discarded. It is therefore incorrect to ignore mCARD errors by having an ONERR label around an mCARD call on the Series 5. If you do, the men