|
October 2003 Get the most
out of your Robelle Tools Now we are adding
$Edit, a function to format output fields with a COBOL-like
edit-mask. This means that you will be able to have floating dollar
signs and all the rest. Suprtools new edit-masks come in two
styles: one mask for byte-type fields and another mask for numeric
fields. An edit-mask
consists of placeholder characters, such as 9
for a numeric column, and format characters, such as
. for the decimal place. Sometimes an edit-mask character
acts as both a placeholder and a format character, such as the
$ in floating dollar signs. For example,
suppose you have data that is in ccyymmdd format in an X8 field. Here
is how you would use a xxxx/xx/xx mask to format the
data: As you see in the example above, the placeholder character is the x and the / is the format character. For byte-type fields, the only placeholder character is the x. The format characters are as follows: B (space) / (slash) , (comma) . (period) + (plus) - (minus) * (asterisk) and Space. You insert a
space either by specifying a B or by putting an actual
Space character in the edit-mask. An example of inserting a space
might be the formatting of Canadian postal codes (e.g., V3R 7K1): Our edit-masks for numeric fields are patterned after those in COBOL. We provide four placeholder characters, each with a slightly different effect: 9 Insert a digit from 0 to 9 in this position; if the value is small, there will be leading zeros. $ If you specify several dollar signs, you get a floating dollar sign. This means that there can be as many numeric positions as there are dollar signs, but if some positions are not needed because the value is small, the $ floats to the right next to the first digit and the preceding positions are blank. * If there are enough digits in the value, the * position is replaced by a numeric digit; if not, an asterisk is printed. Leading asterisks are often used for check writing, so that no one can insert a different value. z
Insert a numeric digit at this position; if the number is small,
there will be leading spaces, not leading zeroes. For example, As shown in the example above, there are also numerous format characters for numeric edits, including four ways to specify the sign. You can specify a
sign, with +, -, or the typical accounting specification of
CR and DB. You will note in the example above
that the cr in the mask was up-shifted to be
CR. This is because the entire mask is up-shifted as the
mask is being parsed. We have two small dilemmas in designing this new $edit feature. The first is the dollar sign. Not all countries use the US dollar symbol. However, most people we know who use COBOL, still use the dollar sign in the edit mask. So for our European friends, how do we use the Euro symbol in the output, when the $ sign is in the mask? Our current thought is to have a Set command that replaces the $ in the output with alternate character(s), after the mask has been applied to the data. If you wanted CDN to print instead of the dollar sign you could add the following to your task: >set dollarsign CDN This would mean that field a, in the above example would look as follows: CDN11.11- although it would probably make more sense to use a trailing $ sign in this case (e.g., zzzz.99-$), so the data would be formatted as 11.11- CDN Of course, we dont really need the Set command, since you could insert CDN to the output by specifying the following extract command: >extract CDN So, do you think we need to provide this Set Dollarsign functionality? The other question is, what to do when a data value overflows the size of the edit mask? Often edit masks are not large enough to hold the largest possible value for a numeric field, but the user knows that the actual values will never get that large. For example, many sites could assume that the sales-tax field will never overflow an edit mask like this: zz,zzz.99- But what if for some reason the sales tax field ends up being over 100 thousand dollars? What should Suprtool do? One thought is to fill the field with asterisks, as can be done with RPG and similar languages. However, our tech support department voted to have the default action of Suprtool be to stop and throw an error. Suprtool should also show the record/data that overflowed, so that you could take some action to resolve the problem. They also suggest a Set command, to fill the overflow field with asterisks and continue processing, but this would not be the default. This is our
current thinking and plan of attack, but what would you do? I will be
posting these design questions to our Robelle-L list server to see
what customers think we should do. Please send your comments to
neil@robelle.com. We will see what choice users favor when Suprtool
4.7.10 is released, which is the version that contains this
enhancement.
Copyright The 3000 NewsWire. All rights reserved. |