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!
No account yet? Create an account
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.
