Stexport adds Flexibility to Output,ascii

Have you ever noticed how Suprtool's Output,ASCII command does not let you control the format of the output? There is a way to get around this restriction, by using STExport to reformat the fields (another method, added in recent years, is to use the "$EDIT function to format a field with COBOL-type data edits).

When Suprtool formats numbers for Output,ASCII, it follows a simple rule: it right-justifies the number in a field that is big enough to hold the field's largest possible value, and it appends a trailing sign. For example, a J2 binary number with a value of 1,000 will be output as ^^^^^^1000^, and a minus 1,000 will be output as ^^^^^^1000- (where ^ represents a space). The number is always right-justified with leading spaces, and the sign is always trailing.

STExport gives you more control. The Sign command specifies the position of the sign, and the Zero command specifies whether a field is filled with zeros. Suprtool still determines the size of the output field based on the data-type of the input field.

Example: You want to produce the same effect as Output,ASCII, except that you want the numbers to have leading zeros instead of leading spaces. Suprtool's Output,ASCII for the J1 and J2 fields looks like this:

> output myfile,ascii
> xeq

	10020   19951004      22415
	10003   19951016      11207
	10003   19951016      16600-
	10003   19951016      21910
	10016   19951020       8411
	10016   19951020      15942
	10020   19951028      16713-
	10010   19951020       7970
In Suprtool, instead of Output,ASCII use Output,Link. Then format the resulting link file with the following STExport commands:

> output foo,link,temp
> xeq
> export input foo
> export columns fixed
> export date none
> export delimiter none
> export quote none
> export sign trailing
> export zero leading
> export output myfile
> export xeq

	00010020 0019951004 0000022415
	00010003 0019951016 0000011207
	00010003 0019951016 0000016600-
	00010003 0019951016 0000021910
	00010016 0019951020 0000008411
	00010003 0019951020 0000015942
	00010020 0019951028 0000016713-
	00010010 0019951020 0000007970

Most of the STExport commands shown above are to override STExport's default action of producing a variable-length, comma-delimited file that is formatted for a PC program, such as Microsoft Access or Lotus 1-2-3. Zero Leading is the command for filling numeric fields with leading zeros. The space seen between the fields is really the trailing sign of the preceding number.
[Mike Shumko]

....Back to the Suprtool Q&A Page