How to format a string/integer value on PIOE/VDE

Product Feature: General

ØAdd special characters, text or numbers to the contents of a variable. An example of this is putting a £, € or
ØSymbol in front of a currency value or to add a file extension.
ØChange the contents of a variable by appending it with the contents of other variables. Formats the data to be added to the document, a disk or an index. In addition, FORMAT allows you to:
The following diagram explains FORMAT, it shows how the contents of the variables are concatenated to create the contents of the new variable.


Printf conventions

Various printf conventions can be used in "formatstring" to identify how the contents of the variable are set up to hold new data. Some available standard conventions are described below:

Character Example Argument Type
 s  %s A string of alphanumeric characters.
 d  %n.nd A decimal integer to hold numeric values. The format of the variable can be initialized to specify how the format of the value within the variable, for example,%2.2d, this value of this variable can only consist of two digits. The formatting string %*.*d can also be used.
 f A floating point. The formatting string %*.*f can also be used.
 c %c A single‐byte character
NOTE: The limit to the number of characters in a P/I Output Enhancement script is in the LINE length and not the file length. The maximum line length is 514 characters.

NOTE: For the integer specifier %d, you get at least as many places in the final output, according to the number before the dot. So ‘%5d’ means ʺgive me at least five spaces for my integer”.
"%5.5f" of 12345.123456 = "12345.12346"
"%8.5f" of 12345.123456 = "12345.12346"
"%5.8f" of 12345.123456 = "12345.12345600"
"%05.5f" of 12345.123456 = "12345.12346"
"%08.5f" of 12345.123456 = "12345.12346"
The number after the dot is ʺin a field of this many characters”. The ‘padding’ is zeros (numbers). For floating specifiers (%f) things are quite different, since a floating value has both an integer and a fractional component. For Example: Note that the first number (before the dot) indicates that at least this many characters are used to represent the entire number. If the number starts with zero, then pad with zeros, otherwise pad with spaces. In each of the above examples, there were too many digits, so the ‘at least’ case was used, but in the following example the field of 18 characters specified could contain the number, and had to be padded: ʺ%018.5fʺ of 12345.123456 = ʺ000000012345.12346ʺ ʺ%18.5fʺ of 12345.123456 = ʺ12345.12346ʺ The number after the dot is the number of fraction digits to generate for the number.
This is the effective precision of the final value.
 Example 1:

[FORMAT_filename] FORMAT [VARIABLE_filename] FROM "%s_%s_%s_%s.DAT"
This would display: 823_VIP_FILEA_VIP2.DAT



UPDATED: April 12, 2017

Contact Us