WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: kle2 on February 06, 2025, 06:44:28 AM

Title: Expression continues past expected end
Post by: kle2 on February 06, 2025, 06:44:28 AM
Hello everyone,

I tried to get a strsub for the tring below but got the error "Expression continues past expected end".  What did I do wrong on the below code?

******************
Line = '"admprdopcd01","2748","VSP","02/05/25","","71","6064"'
1stPortion = StrSub(Line, 1, 22)
******************

Thanks advance!
kle2
Title: Re: Expression continues past expected end
Post by: td on February 06, 2025, 07:42:28 AM
You can't begin a variable name with a numeric digit, i.e. 0 through 9. From the documentation:

'All WinBatch variables must start with an alphabetic character. They may contain but not start with numeric digits. If you name a variable something like, "30DaysAgo", you'll get an error message that says "Expression continues past expected end."'

https://docs.winbatch.com/mergedProjects/WindowsInterfaceLanguage/html/HTMLWIL_V__002.htm (https://docs.winbatch.com/mergedProjects/WindowsInterfaceLanguage/html/HTMLWIL_V__002.htm)
Title: Re: Expression continues past expected end
Post by: kle2 on February 06, 2025, 08:16:13 AM
Quote from: td on February 06, 2025, 07:42:28 AMYou can't begin a variable name with a numeric digit, i.e. 0 through 9. From the documentation:

'All WinBatch variables must start with an alphabetic character. They may contain but not start with numeric digits. If you name a variable something like, "30DaysAgo", you'll get an error message that says "Expression continues past expected end."'

https://docs.winbatch.com/mergedProjects/WindowsInterfaceLanguage/html/HTMLWIL_V__002.htm (https://docs.winbatch.com/mergedProjects/WindowsInterfaceLanguage/html/HTMLWIL_V__002.htm)

Awesome!  Thanks again for your help, TD!
Title: Re: Expression continues past expected end
Post by: snowsnowsnow on February 06, 2025, 09:57:25 AM
The assignment to Line is wrong, too.  What are those commas there for?

BTW, in future, you really should report which line triggered the error.  That information *IS* available in the error box that WB displays.