This is a version of the SHARE Program Library program "PL/I String Functions"
by P. LaCouture (360D-03.8.013).  The source has been run thru a reformatter,
and the called procedures have been changed to declare the parameters and
returned values 'CHAR(*) VARYING' instead of 'CHAR(255) VARYING', and to use
AUTOMATIC rather than STATIC storage for temporaries.  Other than this no changes 
have been made.  

NOTE: IBM PL/I compilers will not handle entries returning CHARACTER(*).  
In order to use these procedures with IBM compilers, change the procedure and 
entry statements to 'RETURNS( CHARACTER(<integer-value>) VARYING )', where
<integer-value> is some reasonable maximum string length up to 32767.

The procedures have been tested using the Iron Spring PL/I Compiler, version 0.5e,
but should work with any other modern compiler.  The code will not compile 
correctly with earlier versions of the compiler.  If you use PL/I(F) you will
need to use the original sources.

Unfortunately, the original SHARE documentation is not available at the present
time.  Use of the procedures should be self-explanatory.

The included procedures are (all arguments are character strings):

   BEFORE(a,b): Returns the contents of string a before the first occurrence
       of string b.  If b is not found in a sets 'fail' and returns the 
       null string.

   AFTER(a,b): Returns the contents of string a after the first occurrence
       of string b.  If b is not found in a sets 'fail' and returns the 
       null string.

   UPTO(a,b): Returns the contents of string a up to and including the first 
       occurrence of string b.  If b is not found in a sets 'fail' and returns 
       the null string.

   FROM(a,b): Returns the contents of string a including and after the first 
       occurrence of string b.  If b is not found in a sets 'fail' and returns 
       the null string.

   IN(a,b): If string b is contained in string a, returns the contents of string b.
       If b is not found in a sets 'fail' and returns the null string.

   FAIL: Returns '1'B if the most recently executed procedure failed, otherwise '0'B.

   SUC: Returns '1'B if the most recently executed procedure succeeded, otherwise '0'B.

   SCOUNT(a,b): Returns the number of times string b occurs non-overlapped in string a.

   REVERSE(a): Returns the contents of string a with the order of characters reversed.
       (Same as builtin function REVERSE in many compilers).

   REPLACE(a,b,c): Returns the contents of string a with the first occurrence of string b
       replaced by string c.  If b is not found in a, returns the contents of a unchanged.

   REPLS(a,b,c): Returns the contents of string a with all occurrences of string b
       replaced by string c.  If b is not found in a, returns the contents of a unchanged.

   DELETE(a,b): Returns the contents of string a with the first occurrence of string b
       deleted.  If b is not found in a, returns the contents of a unchanged.

   DELETS(a,b): Returns the contents of string a with all occurrences of string b
       deleted.  If b is not found in a, returns the contents of a unchanged.

   SAMPLE: A sample program showing how to use the string procedures.


The following additional material is provided:
  . 360D-03.8.013.txt - the program description from the Share Catalog of Programs,
    1977 ed., pp.30-31.
  . Rosin_StringsInPLI.pdf - an OCRd copy of Robert Rosin's original article from
    _PL/I Bulletin 4_, Sep 1967, pp.6-12.  I recommend Ghostscript for viewing
    this document as Adobe Postscript Reader has been known to have some problems.
  . SAMPLE.OUT is the output of the sample program.

Modifications:
  2008-05-05: Correct length of intermediate string for REPLS thanks to R. Vowels.

Peter Flass                                                     May, 2008.
