.Tw explanatory and quoted text width

Top  Previous  Next

This attribute controls the width of explanatory text items, and set element names plus quoted text in the put output.  It is addressed using the syntax

 

Localfileidentifier.tw=number;

 

or in the example putex6.gms

 

my1.tw=12;

Example:

Using the example putex6.gms

 

set mine abcdefghijklmnopqrstuvwxyz

/a12345678901234567890  setaabcdefghijklmnopqrstuvwxyz

 b12345678901234567890  setbabcdefghijklmnopqrstuvwxyz

 small smallone/;

set small(mine) /small/;

scalar number regnumber /1.23456/

       smallnumber /0.00000001/

       largenumber /1000000000/;

put 'start quoted text here $':0 'Quotedabcedeghijklmnopqrstuvwxyz'

             '$ end here'//;

put 'start item explanatory text here $':0 mine.ts '$ end here'/;

put 'start item explanatory text here $':0 number.ts '$ end here'/;

put /;

loop(mine,

put 'start set element explanatory text here $':0 mine.te(mine) '$ end here'/;)

put /;

 

where the items in orange are explanatory or quoted text and the blue items are statements causing those to be output into the put file.  In turn, when we run this with the default for .tw of 0 we get

 

start quoted text here $Quotedabcedeghijklmnopqrstuvwxyz$ end here

 

start item explanatory text here $abcdefghijklmnopqrstuvwxyz$ end here

start item explanatory text here $regnumber$ end here

 

start set element explanatory text here $setaabcdefghijklmnopqrstuvwxyz$ end here

start set element explanatory text here $setbabcdefghijklmnopqrstuvwxyz$ end here

start set element explanatory text here $smallone$ end here

 

showing that by default the full length is always printed.

 

If we reset tw to 20 we get

 

start quoted text here $Quotedabcedeghijklmn$ end here

 

start item explanatory text here $abcdefghijklmnopqrst$ end here

start item explanatory text here $regnumber           $ end here

 

start set element explanatory text here $setaabcdefghijklmnop$ end here

start set element explanatory text here $setbabcdefghijklmnop$ end here

start set element explanatory text here $smallone            $ end here

 

where short text entries like smallone are padded with trailing blanks but the long names like Quotedabcedeghijklmnopqrstuvwxyz are truncated to their first 20 positions Quotedabcedeghijklmn compared to the output just above.