Page 1 of 1

Problem with Edit when creating a Filename

Posted: April 30th, 2014, 8:27 am
by Nevillefc
main.zip
please check this out Gregory Martin

We are developing survey application for visitors to the country using tablets using 5.003 . A menu program is used to create the file for the interviewer and to pass relevant information to the survey program.

I use the EDIT command to convert the fields to string for the fields to be concatenated into the file name for the interviewer in the menu program, however the interviewer's code is blank in the filename after being concatenated. The funny thing is if the string interview's code is application's last variable in the filename it is blank but if it is the first variable in the concatenation it shows properly. The string variable that I put the interviewer code into is being correctly place against the operator id in the pff for running the survey program.

I have package the application for you to check it out. Please move the fields around in the concate to see what it shows.
I have used this method to create filenames from a menu system with cspro version 3.3 and 4.0 and had no problems.

CSO
TRinidad

Re: Problem with Edit when creating a Filename

Posted: April 30th, 2014, 12:52 pm
by noel
In the global procedure you have:
alpha isle;
alpha(4) yr;
alpha(2) mth;
ALPHA(2) op;
alpha(9) pname;
alpha(14) fname;

This syntax may be replaced by this one:
string isle;
string yr;
string mth;
string op;
string pname;
string fname;
file run_choice;

If you keep alpha in the global procedure, you should to replace the following procedure (pname = concat(mth,yr,isle,op)) by this other:
pname = concat(strip(mth),strip(yr),strip(isle),strip(op)).

In fact, if you declare a variable as "alpha" one, you should use "strip" to remove the blank after the variable. In your cas, "yr" as 4 characters, mth has 2, op has 2 and isle has 16 because you did not determine the length of this last. If you cancatenate these variables without using "strip", you will have a phrase with at least 24 characters. As pname cannot have more than characters, your word is truncated after the ninth character.