Midware Ltd.
|
Sign-up for e-mail notifications
|
Control (or Header) specification allow you specify global parameters for how your program functions and is compiled. RPG III allowed one H-spec per program with the positional parameters. RPG IV on the other hand uses free-form keywords for these parameters. Multiple H-specs may be used, and the keywords may be specified in any order. For example, an H-spec coded in RPG III to format UDATE as YYMMDD would look like this: *...1....+....2....+....3....+....4....+....5....+....6....+....7... The same H-spec in RPG IV looks like this (capitalization is up to you): *...1....+....2....+....3....+....4....+....5....+....6....+....7... New H-spec keywords are added to each release. A great deal of the newer keywords are compile-option keywords that override the default or specified options on the CRTBNDRPG and CRTRPGMOD commands. This is potentially a very valuable feature, especially when using the more advanced features of ILE. If a program requires special compile-time parameters, they can be included in an H-spec instead of relying on programmers to remember those options when compiling future changes. Some of the more useful H-spec keywords are described below. Many of these keywords deal with somewhat more advanced ILE functionality. Don't feel discouraged if you don't understand these yet - these ILE features will be covered in later sections. BNDDIR('binding-directory-name' {:'binding-directory-name'...}) DATEDIT(fmt{separator}) DATFMT(fmt{separator}) DEBUG{(*NO | *YES)} NOMAIN OPTION(*{NO}SRCSTMT *{NO}DEBUGIO) The *NODEBUGIO parameter is more of a convenience feature. If not specified, when stepping through a program using the interactive source debugger, a separate break will be inserted for each field returned from an I/O operation. When the *NODEBUGIO parameter is coded, the I/O statement only breaks once. Click here to see a complete list of the available H-spec keywords (as of V4R5) from IBM's online documentation. The minimum control specification that I personally use is as follows: *...1....+....2....+....3....+....4....+....5....+....6....+....7... Using more (or less) keywords is entirely up to you, depending on your requirements. Using a Data Area to create a default H-specInstead of relying on every programmer to include the appropriate H-spec in their programs, it is possible to create a data area with your default keywords that will be automatically be included at compile time. If an H-spec is included in the program, it will override any external H-specs in data areas. If no H-spec is included however, the compiler will look for a data area named RPGLEHSPEC in your library list. If it is found, the contents of the data area will be used as your H-spec. There can be multiple data areas with this name in different libraries. If RPGLEHSPEC is not found in the library list, the compiler will look for a data area named DFTLEHSPEC in library QRPGLE. If this if found, it's contents will be used as your H-spec. The data areas must be type character, and can be whatever length you need.
|
Send mail to midware@midwareservices.com
with questions or comments about this web site. Last Modified: August 30, 2000 |