SheerPower® 4GL
A Guide to the SheerPower Language


Previous Contents Index

~ character

The ~ (tilde) character marks the character following it as literal data.

Example 7-33 ~ character in PRINT USING

  print using '###~-###~-####': '5556667777' 
  end
 
        
555-666-7777 

$ character

The $ character prints a floating dollar sign. The dollar sign appears before the number. $ causes SheerPower to print '$-' for negative numbers and '$' for positive numbers. The minus sign appears immediately after the dollar sign and before the number.

Example 7-34 $ character in PRINT USING

  print "1st col 2nd col" 
  print using "$###.## $###.##": 11.93, -1.93 
  end
 
        
1st col 2nd col 
 $11.93  $-1.93 

$+ characters

$+ characters print a floating dollar sign. The dollar sign appears before the numeric expression. $+ causes SheerPower to print a minus sign before negative numbers, and a plus sign before positive numbers. The sign appears after the dollar sign and before the number.

Example 7-35 $+ characters in PRINT USING

  print "1st  col 2nd  col" 
  print using "$+###.## $+###.##": 11.93, -1.93 
  end
 
        
1st  col 2nd  col 
 $+11.93   $-1.93 

-$ characters

-$ characters print a floating dollar sign. The dollar sign appears immediately before the numeric expression. -$ causes SheerPower to print a minus sign before negative numbers and a space before positive numbers. The minus sign or space appears immediately before the dollar sign.

Example 7-36 -$ characters in PRINT USING

  print "1st  col 2nd  col" 
  print using "-$###.## -$###.##": 11.93, -1.93 
  end
 
        
1st  col 2nd  col 
  $11.93   -$1.93 

+$ characters

+$ causes SheerPower to print a floating dollar sign. The dollar sign appears immediately before the number. +$ causes SheerPower to print a plus sign before positive numbers and a minus sign before negative numbers. The plus or minus sign appears immediately before the dollar sign.

Example 7-37 +$ characters in PRINT USING

  print "1st  col 2nd  col" 
  print using "+$###.## +$###.##": 11.93, -1.93 
  end
 
        
1st  col 2nd  col 
 +$11.93   -$1.93 

Notice that +$ adds two character positions to the format. One position contains the dollar sign, the other contains the plus or minus sign.

$- characters

$- characters prints a floating dollar sign. The dollar sign appears before the number. $- causes SheerPower to print a minus sign before negative numbers and a space before positive numbers. The minus sign or space appears after the dollar sign and before the number.

Example 7-38 $- characters in PRINT USING

  print "1st  col 2nd  col" 
  print using "$-###.## $-###.##": 11.93, -1.93 
  end
 
        
1st  col 2nd  col 
 $ 11.93   $-1.93 

If your expression is too large to fit in a field, SheerPower gives an exception.

7.1.10 Directives

The directives used with the USING option of the PRINT statement tell SheerPower what to do with the text.

FORMAT:


        PRINT USING 'directive' : str_expr 

7.1.10.1 {UCASE}?

The UCASE directive converts the str_expr to uppercase characters.

Example 7-39 UCASE directive used with PRINT USING

  print using '{ucase}?' : 'march' 
  end
 
        
MARCH 

7.1.10.2 {LCASE}?

The LCASE directive converts the str_expr to lowercase characters.

Example 7-40 LCASE directive used with PRINT USING

  print using '{lcase}?' : 'MARCH' 
  end
 
        
march 

7.1.10.3 {HYPHEN}

The HYPHEN directive causes SheerPower to suppress the hyphen character if it is the last non-blank character after the format is applied.

Example 7-41 HYPHEN directive used with PRINT USING

  print using '<#####~-####' : '92123' 
  print using '{hyphen}<#####~-####' : '92123' 
  end 
 
        
92123 - 
92123 

7.1.10.4 {DATE [argument]}?

Given a str_expr that contains a date in the format YYMMDD or CCYYMMDD, the DATE directive converts the str_expr to a default or specified, optionally-masked date format.

These date arguments can be used: YMD, CYMD, MDY, MDCY, DMY, DMCY, DMONY, DMONCY, MONTHDY, MONTHDCY. If no argument is provided, the default is MDCY. (See Section 6.4.12, FORMAT$(expr, str_expr) for examples of date argument usage.)

To format the resulting data, include a ? in the print mask.

Example 7-42 DATE directive used with PRINT USING

  print using '{date}?': '990122' 
  print using '{date dmy}?': '990122' 
  print using '{date dmcy}?': '990122' 
  print
  print using '{date mdy}?': '20000115' 
  print using '{date mdy}##/##/##': '20000115' 
  print using '{date mdcy}##/##/####': '20000115' 
  end
  
 
01221999 
220199 
22011999 
 
011500 
01/15/00 
01/15/2000 

7.1.10.5 {ROTATE n}?

The ROTATE directive rotates the last n characters in a str_expr to the first position in the str_expr. Optionally, the resulting str_expr can be masked by replacing the ? with a print mask.

Example 7-43 ROTATE directive used with PRINT USING

  print using '{rotate 3}?': '5552527800' 
  print using '{rotate 3}###~ ###~-####': '5552527800' 
  print 
  print using '{rotate 5}?': 'TuneTommy' 
  print using '{rotate 5}#####~ ####': 'TuneTommy' 
  end 
 
        
8005552527 
800 555-2527 
 
TommyTune 
Tommy Tune 

7.1.10.6 {TIME}?

Given a str_expr containing a 4-digit time in HHMM or HH:MM format or a 6-digit time in HHMMSS or HH:MM:SS format, the TIME directive converts the str_expr to HH:MM AM/PM or HH:MM:SS AM/PM.

Example 7-44 TIME directive used with PRINT USING

  print using '{time}?': '1022' 
  print using '{time}?': '19:45' 
  print
  print using '{time}?': '102255' 
  print using '{time}?': '19:45:36' 
  end
 
        
10:22 AM 
07:45 PM 
 
10:22:55 AM 
07:45:36 PM 

7.1.10.7 {ZIPCODE}?

Given a str_expr containing a 5-, 6- or 9-digit Zip code, the ZIPCODE directive converts the str_expr to an appropriate Zip code format.

Example 7-45 ZIPCODE directive used with PRINT USING

  print '5 character zipcode : '; 
  print using '{zipcode}?': '92126' 
  print '6 character zipcode : '; 
  print using '{zipcode}?': 'K8A3P9' 
  print '9 character zipcode : '; 
  print using '{zipcode}?': '931327845' 
  end
 
        
5 character zipcode : 92126 
6 character zipcode : K8A 3P9 
9 character zipcode : 93132-7845 

7.2 MESSAGE

The MESSAGE statement prints a message at line 23 (the default line) on the screen.

FORMAT:


        MESSAGE [ERROR: | DELAY:] expr [; | , expr] 

EXAMPLE:

Example 7-46 MESSAGE statement

  print at 1,1: 
  do
    message 'Enter EXIT to exit' 
    input 'Please enter your name': name$ 
    if  _exit  then
      message 'The End' 
      exit do
    else
      print name$ 
      repeat do
    end if
  end do
  end
 
        
Please enter your name? 
 
               Enter EXIT to exit       (first message) 
 
Please enter your name? Tester 
Tester 
Please enter your name? exit 
 
                    The End             (second message) 

DESCRIPTION:

SheerPower displays messages at the bottom of the screen. Below the message line there is a scrollable MESSAGE HISTORY window. Error messages are displayed in red. The MESSAGE statement can be used to display your own messages and errors on this line.

The MESSAGE statement can print several items. Each item can be any SheerPower numeric or string expression. Multiple items must be separated with a comma or a semicolon. The separator determines where the next expression will be printed.

Semicolons

Separating message items with a semicolon causes the items to immediately follow one another. When the items are printed, no spaces appear between the items.

Commas

Separating items with a comma puts a space between each item.

SheerPower would display this message:


        MESSAGE 'number is', 123; 456; 789 

as:


        number is 123456789 


Previous Next Contents Index