Howto embed SQL in oMega ------------------------ The following example is for mySQL, other types of SQL will need amending as appropriate. 1) Copy the following into a file named: /usr/local/M/mgr/rtns/%MYSQL INIT ; ZALIAS MYSQL Q ; MYSQL(PASS,DBASE,QUERY,.RES) ; N TMPFILE,ROW,I K RES S TMPFILE="/tmp/sqlres."_$J,I=0 ZCALL "mysql --password="_PASS_" --execute=""connect "_DBASE_";"_QUERY_";"" -E >"_TMPFILE C TMPFILE O TMPFILE U TMPFILE F D Q:ROW="" . R ROW Q:ROW="" . I $E(ROW)="*" S I=I+1 Q . S RES(I,$P(ROW,": ",1))=$P(ROW,": ",2) C TMPFILE:DELETE Q ; Make sure that there are no blank lines before the 'INIT' and that the s remain as s. Also, the file should be world readable. Now, in any routine, you can simply add the line: S $OBJFILE=%MYSQL @INIT and in that routine, or any routine called from there, you can now use the command: MYSQL(pass,data,query,array) ; <-- follow by 2 spaces where 'pass' is the password for database 'data', and 'query' is any mySQL query. 'array' can be any variable name. If there are any results, they will be returned as: array(1,col1) array(1,col2) ... array(n,col1) array(n,col2) etc. where col1, col2, etc will be replaced by the column names from mySQL. Note: array will be killed first before any results are placed in it. For further details on how this works, see the file EXTENSIONS included with the oMega distribution.