My winbatch script starts pulling data incorrectly from a certain line

Started by cseymore, April 28, 2017, 08:03:50 AM

Previous topic - Next topic


Here is my data from a notepad text file that I am importing into my EHR software system using winbatch.  The script that I have runs great until it gets to the line with "V394". It pulls the "V394", then pulls "01", pauses, and then attempts to pull "V182" totally passing the text (010715 Letter THRMCS4 TOO-HRMC S) next to it.  I have listed my winbatch script below.  The script should pull the data one line at a time and then when its finished with that line, proceed to pulling the data on the next line.  Could someone take look at this to see what could possibly be the problem?  Thanks!

   612          V4          010715 Letter THRMCS1 TOO-HRMC S
   612          V185      010715 1 LTR satisfied PL95
   612          V66        010715 Letter THRMCS1 TOO-HRMC S
   612          V66        010715 1 LTR updated for MADEUP N
   612          V328      010715 AME (POR)
   612          V396      010715 EBO MAILING STATEMENT TO
   612          V264      010715 GUARANTOR ADDRESS TODAY. N
   612          V97        010715 Put something here to fill space
   612          V394    010715 Letter THRMCS4 TOO-HRMC S
   612          V182      010715 4 LTR satisfied PL95
   612          V81        010715 Letter THRMCS4 TOO-HRMC S
TimeDelay (1)

while @TRUE
      acct = StrTrim(StrSub (line,16,10))
      comm = StrTrim(StrSub (line,27,300))





Your script has a basic flaw.  You do not test the return from FileRead for the "*EOF*" string.  Because you don't,  you have an infinite loop.

Since the file contents you show has had one or more cut and paste operations performed on it, you will have to figure out why your script isn't reading a line correctly.  You likely have embedded non printable characters that are causing issues for what ever method you are using to view the lines read from the file.  The offending characters could be the result of the file actually being UTF-8 instead of a Windows code page.     
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade