The A-Specs

DDS is coded by entering letters and numbers in the A-specifications ("A-specs"), which are like RPG's various specifications. The main difference is that the A-specs have an ‘A’ in column 6. If you are familiar with RPG, you probably would have guessed as much.


Throughout this chapter, a reference such as "1–5" means "columns 1 to 5." A simple "27" means "column 27."

The A-specs have the following structure:

  • Sequence number. 1–5 can contain an optional sequence number. This number is rarely (if ever) used because it does nothing but clutter the code with useless information (the compiler never uses it).

  • Specification type. 6 is where you code the letter "A" that identifies this statement as an A-spec. However, this entry is optional. You do not have to code an "A" because all specifications in a DDS source member are always A-specs. The compiler does not need this entry, but you still may want to code it for documentation.

  • Comments, AND, or OR. 7 can contain an asterisk (*) to indicate that the current line is a comment. If 7 contains an A (AND) or an O (OR), then the indicators coded in 8–16 of this line are logically connected (with AND or OR) to those of the previous line.

  • Conditioning indicators. 8–16 can contain one, two, or three indicators that condition the entire line for device files. Other types of files, such as physical and logical files, do not allow indicators.

  • Type. In some cases, 17 must contain a particular entry to identify records (R), key fields (K), or the conditions under which records are selected (S) or omitted (O) from a logical file. In join logical files, a J indicates the beginning of join specifications (how to join the files). In display files, an H marks the beginning of help specifications. The most common entry, however, is a blank. Blanks define fields within records.

  • Name. 19–28 define the name of a record or field within a record. Pay particular attention to the fact that you have 10 characters to name the record or field you are coding. You can always define records and fields with up to 10 characters in the name.

  • Reference. If you code an R in 29, it means that the field named in 19–28 (see above) is defined by referencing another field, usually a field of the same name in a different file (although this is not always the case). This eliminates the need to define the same field over again in many files. When you define by reference, you don't have to provide any other definition options unless you want to override some of them.

  • Length. 30–34 contain the length of the field named in 19–28.

  • Data type. 35 is used to indicate what type of data is associated with the field named in 19–28. For example, a P indicates packed decimal and an A indicates alphanumeric. Another frequent entry is S for zoned decimal.

  • Decimal positions. 36–37 are used for numeric fields only. From the number of digits indicated in 30–34, 36–37 indicate how many are to the right of the decimal mark. So, if 30–34 has a 7 and 36–37 has a 2, the field in 19–28 is defined as 7 digits long with 2 decimal places. Therefore, it can hold a number as large as 99,999.99.

  • Usage. 38 indicates how the field in 19–28 is used. It can be defined for input only ‘I’, output only ‘O,’ or both ‘B’.

  • Location. Display and printer files only require that you indicate where to place the field in 19–28. You can do this by coding a line number in 39–41 and a column number in 42–44.

  • Functions. 45–80 can contain constants or optional DDS keywords that give additional information about the fields or records being defined elsewhere. For example, if you define a numeric field that contains a date, you can code EDTCDE(Y) anywhere in the functions area to indicate that the field should be edited with an edit code Y.

IBM i5/iSeries Primer(c) Concepts and Techniques for Programmers, Administrators, and Sys[... ]ators
IBM i5/iSeries Primer(c) Concepts and Techniques for Programmers, Administrators, and Sys[... ]ators
Year: 2004
Pages: 245 © 2008-2017.
If you may any questions please contact us: