For some time, SPFLite users have had the ability to enumerate columns of data, using the enumeration keyboard functions (Enum), (EnumHexLc) and (EnumHexUc). This feature is documented in Working with Enumerations in the Help. That enumeration process involves highlighting columns of data, and then sequencing them either directly, or under the control of the Power Typing primary command PTYPE (PT). That facility works fine if the sequence numbers you want to create are located in a fixed vertical column. If they are not, the enumeration keyboard functions are hard to apply to this task, or cannot be used at all.

Here are two examples where fixed enumerations are a problem:

  • Example: Suppose you have a block of “sentences” or “bullet points” in a text document, and you want to number each one. You can find the first “word” in each “sentence” but if these “sentences” don’t vertically line up, how will you get the numbers on them?

  • Another example:   Suppose you are editing a program and you have a list of “variables”. You want to append an ascending sequence number as a suffix like -1 or _1 to the end of each name, but the names are of varying sizes and locations.

Sequence items enable you to perform editing tasks like this. You will note that the syntax of SD and SX is the essentially same as the numeric conversion items DD, DX, XD and XX, except that SD and SX do not take a column reference operand.

A sequence item of SD and SX is only defined when the CHANGE command that has your mapping string includes the keyword ALL. If you execute your CHANGE command without an ALL keyword, and attempt to use a sequence item of SD and SX, the value is undefined, and use of these commands without the ALL keyword is not supported. In some contexts, the value of the sequence number when used out of context will be zero, but this cannot be guaranteed.

When you issue a CHANGE ALL command with a mapping string that contains SD or SX, the first string found by CHANGE will have a sequence number of 1, the second with 2, and so on. The reason for permitting SD and SX only on CHANGE ALL is to ensure that the “first” found string is accurately determined, so that the choice as to which particular found string gets sequence number 1, etc. is done correctly.

Syntax of a sequence item:

 {  SD | SX  }   [  format  ]  [  sign-code  ]   [  calculation-operand  ]

SD | SX:

Introduces the sequence item.

  • SD produces a formatted sequence number in decimal
  • SX produces a formatted sequence number in hex


Allows the resulting numeric value to be formatted. This has the same syntax and function as the format operand of the numeric conversion items DD, DX, XD and XX. Refer to those commands for information on the format operand.

If you issue a command such as SDF or SXF with no width field w, the implied number of digits (the implied w) will always be the same as the smallest number of digits needed to represent the value in decimal or hex, before any arithmetic calculations are performed by a calculation-operand, if you specify one. For example, suppose the value of the sequence number is 127 (hex value 7F):

  • If you specify an SDF command, the implied width is 3, since the decimal value 127 has 3 digits, and the command is processed as if SD3F were specified.

  • If you specify an SXF command, the implied width is 2, since the hex value 7F has 2 digits, and the command is processed as if SX2F were specified.

Since calculations could make the value larger than what is deduced for the implied width w, you should only rely on an implied width w if you are certain that no truncation will occur (or if truncation is acceptable) when you use a calculation-operand.


Manages the handing of a sign, in case the computed value is negative or if you want a “C” style 0x prefix  This has the same basic syntax and function as the format operand of the numeric conversion items DD, DX, XD and XX, except that SD and SX never scan for a numeric value, but only produce one. Refer to the DD, DX, XD and XX commands above for information on the format operand. When you use a sign code of C for SX, such as SX4FC, the resultant value will have a “C”-style prefix of 0x.


Allows arithmetic operations to be performed on the base numeric value before it is formatted. For a complete description of mapping string calculation operations, see Calculation Operands.

For example, to use the sequence value with 4 fixed digits, and have the value multiplied by 2 and then having 3 added to it, you would specify a command of SD4F'S*2+3' or  SD4F'*2+3'.

Specifying a calculation operand

For the sequence items SD and SX, and the numeric conversion items DD, DX, XD and XX, you are allowed to perform basic arithmetic operations on the value before it is formatted as a numeric value. This is done by specifying a calculation operand, which is a string operand containing an arithmetic expression.

For example, to modify a value acquired by a DD command, by multiplying it by 2 and adding 3, then format it as 4 digits, you would use  DD4F'X*2+3'  or  DD4F'*2+3'.

For a complete description of mapping string calculation operations, see Calculation Operands.

Created with the Personal Edition of HelpNDoc: Easily create Web Help sites