If you want to use the full range of capabilities of modern printers from a DP4 program, then you should probably not be reading this page, but using the DFPRINT device instead!
Most printers will have capabilities such as printing text underlined or bold, and you will probably want to access such capabilities from your programs. There are various ways to achieve such effects:
You can define a second COD for the printer allowing you to create PODs that are "subdevices" of the printer. These CODs can have parameters that with appropriate escape sequences for the effect you want. This type of approach would be suitable for an effect that was applied globally to several lines or even complete pages of output. Note that although your program does not have to know much about the specific details of the printer, it does need to know that it has a POD capable of acting as a subdevice, and needs to select it, so changes may well be required to the program to get it to print to another printer - at the very least if you want the program to work with a different printer you would need to create a new device group and then change the PODs used by the program to access the new device group.
You can embed control sequences directly into the map. This approach will work with any release of DP4, however you will not be able to do this except by editing MAPPOST format output with a text editor capable of editing arbitrary hex characters to a file. An alternative is to include fields in the map into which your program prints escape sequences. This approach can be used from both C and QAB programs. However it has two drawbacks:
Your program is printer specific.
The third approach is only available with release 4.5xx maps but can work very well. Maps for printing are specially coloured. In the printed text the colours are not regarded as real colours, but as requests for various special print formats. For example, by convention, blue ink represents underlined text, bright ink represents bold text, blue paper, represents double height text, and green paper represents double width text (so dark grey ink on cyan paper requests bold double height double width text). Use the Additional attributes dialog from the Device Group Editing menu to set up suitable escape sequences to select these attributes in the printed text. If desired you could use other colours to select italic text or some similar attribute.
This is the best approach for 4.5xx releases. If you are using a 4.6xx release then you need to force your program to use 4.5xx maps when printing to take advantage of this facility. Depending on the 4.6xx release you are using there are different ways of doing this:
You can force a DP4 program to run as a 4.5xx program even if you are using 4.6xx by using the use600=0 DP4 Configuration setting, either in an INI file, or (in 4.620) via the command line for the program.
In this case your program must make do with the less sophisticated 4.5xx user interface in this release, or you must split the program so that the printing is in a separate executable. (You could even use this approach with QAB programs by copying progrun.exe to progr500.exe and adding a use600=0 setting in a [progr500] section of your DP4 configuration file.)
You can still use the technique that worked up to release 4.620, but from release 4.621 setting the "Force 4.500" property in Device Group Description) allows a program with a 4.6xx style user interface to print using 4.5xx maps. This means your program does not have to be slpit into separate executables, or use the old fashioned 4.5xx style user interface for interaction with the user.