August 08, 2005, 01:58 AM
ClaudeError in trim command, focus 7.3..3. Z/Vm
I tried sending the a message with the subject "Remove leading and trailing spaces in a string". It was rejected so I am trying here. I need to remove leading and trailing blanks in a string. I wrote the following simple Maintain program.
MAINTAIN FILE PARKDATA
MODULE IMPORT (MNTUWS) ;
Compute
tbrownid/a9 ; -* brownid or plate (for non-permit violation or
-* a towed vechile
trimid/a9 ; -* brownid without leading and trailing blanks
lenid/i2 ; -* lenght of trimed brown id
compute tbrownid =3D ' 3 ' ;
lenid =3D LENGTH(tbrownid) ;
trimid =3D TRIM('B' , tbrownid , lenid , ' ' , 1 , 'A9' ) ;
type "id ..tbrownid lenght ..lenid trimed ..trimid "
END
(I used .. because other wise systems I am including am html tab)
If I run it I get the following error message
ERROR AT OR NEAR LINE 13 IN PROCEDURE YYY FOCEXEC *
(FOC03609) Wrong argument count in call to case TRIM. Got 5, expected
0.
id 3 lenght 9 trimed B
Why, line 13 is the line with the TRIM function giving an error message? It is right out of the manual. How do I fix it?
August 08, 2005, 08:05 AM
Tony AClaude,
There are two functions called TRIM, one for WebFOCUS reporting and the other for Maintain.
As you are using Maintain in your example you should use the appropriate TRIM function which has the syntax - TRIM(string).
Your example shows the TRIM function for reporting.
August 09, 2005, 02:02 PM
Claudeon Z/VM I could not find TRIM(string) function.
I copied the TRIM(...) syntax right out of the onleine manual.
I tried it anyway and it did not give the correct result.
August 09, 2005, 02:16 PM
Tony AClaude,
Unfortunately I don't have access to Z/VM and therefore can only relate what the difference is between the two TRIM functions.
Give your local IB support a call and get them to double check the syntax for you.
August 09, 2005, 06:18 PM
Maintain WizardClaude
The TRIM function, when used in Maintain, removes trailing blanks. Here is an example:
MAINTAIN
COMPUTE NAME/A0 = 'MARK1 ';
COMPUTE X/I3 = LENGTH(NAME);
COMPUTE NAME = TRIM(NAME);
COMPUTE Y/I3 = LENGTH(NAME);
TYPE "X = <<X Y = <<Y"
END
yields
X = 15 Y = 5
Trim is useful if you are using CONTAINS and don't want any trailing blanks. If this doesn't solve the problem, please let us know what you are trying to do.
Mark