Occasionally it is necessary to add a literal segment to a key definition, usually to provide data for some tag field that has a fixed literal value in a related file. Even more occasionally, it may be necessary to specify a literal value that includes trailing spaces.
For example, if you are attempting to define a literal key segment to map to and provide a value for a tag field in another structure that is defined as an A3, and the value you need to specify is "1 " (the digit 1 followed by two spaces), then there can be a problem, because literal key segment values are stored in an A30 variable, and are trimmed by repository, which then considers the length of the literal key segment to be 1.
To get around this problem, CodeGen allows you to indicate significant trailing spaces in a literal key segment value using the tilde character (~). So in the previous example, the literal value could be specified as 1~~ (the digit one followed by two tilde characters).
Doing so will result in CodeGen considering the length of the key segment to be as defined by the string as stored (three in the example), but the tilde characters are replaced by spaces by expansion tokens such as <SEGMENT_LITVAL> and <LITERAL_SEGMENT_VALUE> that insert the literal value.
Copyright © 2021 Synergex International, Inc.