Source files are similar to database files, except that they are used to store the source code that programmers use for programs, commands, file definitions, and the like. Source files differ from database files in the following aspects:
You cannot use DDS to define a record format. The record format is predefined as having three fields: SRCSEQ (sequence number, six characters), SRCDAT (date the record was last maintained, six characters), and SRCDTA (source data, any number of characters).
You create a source file using the Create Source Physical File (CRTSRCPF) command instead of CRTPF. When you do so, you specify a record length in the RCDLEN parameter. If you want your source statements to allow n characters per statement, specify a record length of n+12. The record length defaults to 92, which lets you code statements up to 80 characters long.
When you create a source file, it defaults to *NOMAX for the maximum number of members and *NONE for the name of the first member, which means no members are created yet.
Source files are always of arrival sequence. They are never keyed. If you want to build a key, you need to create a logical file based on the source file. Use the Copy Source File (CPYSRCF) command instead of CPYF to copy from one source file to another, or from a database file to a source file or vice-versa. Also, CPYSRCF gives you a better printout than CPYF if you specify TOFILE(*PRINT).
For source files, you can use any of the other listed commands for database files.
You can name source files anything you want and put all typesof source members in them. For example, you could create a source file named source and it could contain RPG source members along with CL and DDS source members, too. The type of source member controls how the development tools work with the source member, not the name of the source file. IBM standard source file names include the following: