in Basic. I have a program which calls a RESTApi and returns results and puts it into a txt file. When I read the test file with another basic program, an INDEX funtion that I need to perform doesn't appear to work (returns zero). When I put the file contents into a basic variable, the INDEX function works correctly. I’ve looked at the file for special or non-printable characters which might cause the INDEX function not to work, and the file itself is clean. What if anything else can I try (and I’ve tried a bunch)..
Solved
BASIC INDEX function does not appear to be working correctly
Best answer by Tyrel Marak
Mark,
I think it’s the .txt files you're consuming. When I look at it, each pair of normal printable characters is separated by a null character. All of the new-lines turn into field-marks and the file starts with a char(255) and a char(254). So it looks like there are 8 attributes in the .txt. You probably need to massage it a bit before trying to process.
I played with it a bit. If you do the following, I think it should work as you want:CONVERT CHAR(0) TO ‘’ IN RESPREC
CONVERT CHAR(13) TO @AM IN RESPREC
RESPREC = TRIM(RESPREC,@AM,’R’)
Sign up
Already have an account? Login
Welcome to the Rocket Forum!
Please log in or register:
Employee Login | Registration Member Login | RegistrationEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.
