The Copyright, Designs and Patents Act 1988 has been amended a number of times (partly in response to EU Directives) to try and keep the law relevant to today's technology and needs.
A computer program is treated as if it was a literary work. That is to say if the code you have written exhibits sufficient originality then it is subject to copyright. Originality here does not mean that no-one else has done this before, merely that the work originated through your skill, judgement and effort. Merely cobbling together a set of library routines or scripts written by someone else probably wouldn't qualify unless the complete program showed a very distinct step forward in the utility of the program. It is worth pointing out that under UK law computer programs cannot normally be patented (ie give the creator a monopoly right over it) although this is an area where things are changing
. It is also worth noting that the definition of a 'program' is fairly woolly. It probably does not extend down to a macro or simple script, but it does not necessarily need to be a fully separate entity (such as a runtime application) and of course it can rely to a greater or lesser extent on the operation of other programs (like Excel or an operating system) to function correctly.
So chances are that what you have created is subject to copyright. As to who owns the copyright, the law says that something which is created 'in the course of employment' is owned by the employer unless there is an agreement to the contrary. Many employers reinforce this by putting an explicit clause in a contract of employment which assigns copyright (as well as other IP rights) to the employer. I assume you don't have such a clause in your contract. If you do, then it will entirely depend on the exact wording as to where you stand in this case. But assuming there is no such clause, as you have correctly identified, it all depends on what is meant by course of employment. The fact that writing programs may not be part of your job description, and the fact that you were not explicitly asked to write the program may not be sufficient to say this was not in the course of your employment. If by writing this program you achieved something which directly benefits or affects your actual job (say you work in the accounts department and you wrote a payroll management program) then this would probably be seen as being in the course of your employement. However if you were a lathe operator working on the factory floor and you wrote a payroll system, this would probably be sufficiently separate to be seen as not in the course of employment. Other factors to consider are the degree to which the management have encouraged, supported and sanctioned your work on the program, whether it was written and develpoped in company time, and if you have received any bonus etc for your work. If you are in a union it would be worth asking their legal department to advise you on your specific case.
If you own the copyright to your program, then it would be an infringement for someone else to alter or edit your code without your permission. It is permissable for someone else to de-compile your program in order to find out how other programs may interact with it, if this information cannot be obtained by another means.
And lastly, if your program interacts with the output
of another program, we encounter another facet of the law: database right. Previously a collection of data (ie facts) was not subject to copyright, but with the creation of evermore sophisticated databases, since 1998 a new right has been created to protect the intellectual effort and economic value which goes into creating and maintaining databases. A structured collection of data can attract database right if there has been a substantial investment in obtaining, verifying and presenting its contents. Investment can mean either in terms of money or human effort or both. The owner of the database (usually a company) must be based in or have an operating presence in a country within the Europena Economic Area to qualify. In other words a company based solely in the USA would not be able to claim database rights unless it had an office or computer centre etc within the EEA. The owner of the database right has the right to prevent extraction or re-utilisation of a substantial part of the contents of the database. Generally access to data will be controlled by a licence. This could be free or paid for (eg BT's database of subscriber's telephone numbers is free for indiviudal online queries, but you need to pay for their CDs). A substantial part may be defined in terms of sheer volume, or in terms of intrinsic value. For example Amazon might have a vast database of its customers and what they bought, but the use of one specific field of data (eg sales by book title) might be considered substantial due to its economic value to a rival. Extraction is fairly self-explanatory: it can be permanent or temporary and by any means (including manual copying). Re-utilisation means passing on the data to the public, either as is or in a modified form.
So if your program uses the output from a database which is not owned by you or your company, you need to make sure your use of the data is permitted and if an extraction licence is required. However there is no specific problem (as far as copyright and database right are concerned) with the output from your program feeding into someone elses's database or program. If this activity has not been authorised by the owner of the other system, you need to make sure that what you are doing does not contravene the Computer Misuse Act 1990