1
/*********************************************************************/
2
/* BACKWARD.FNC - Reverse the words in a string */
4
/* This program is called by CALLREXX.EXE. */
6
/* Input: A string of words */
8
/* Output: A string containing the same words but in opposite order */
10
/*********************************************************************/
12
Parse Arg Data /* get argument string */
13
OutString = '' /* initialize output to empty */
14
Count = Words(Data) /* find number of words */
15
Do i = Count To 1 By -1 /* for each word in string */
16
OutString = OutString Word(Data,i) /* add word to output string*/
18
Return Strip(OutString) /* return reversed string, */
19
/* removing any blanks on the */