Hello all,
I just started with TCC Version 9 about a month ago. I've not used a previous version of this software (unless you count the old 4DOS) so I'm still learning the new nomenclature.
Anyway, I'm working with batch scripts, not directly from the command line. I've been using CMD from Windows XP Pro SP2.
My existing batch program (a self-made, Checkbook-type program) appends transations to an existing text file. Fixed width fields are made by appending about 20 'spaces' (actual number of spaces is arbitrary) to the end of the variable and then extracting the first 20. This leaves the original vairable with the appropriate number of white space at the end. It's then written to a file and makes for a very nicely formatted line.
This does not apepar to work under TCC. It seems to strip any trailing white space from the variable. That's my first question, is there an option that I'm missing. Or is there a control char that I can insert that is invisible, but that 'set' would not strip out?
The next difficulty is harder to expain. I have this fragment from my script:
FOR /L %%A IN (1,1,8) DO IF NOT !DS%%A!==*EMPTY* SET DS%%A=!DS%%A! &&SET DS%%A=!DS%%A:~0,20!
(all one line)
SET DS%%A=!DS%%A:~0,20! under CMD this variable expands and then gets trimmed correctly. This is another one of those variables that need padded in the first question. In this case though, under TCC, I cannot get it to expand/trim correctly. Left alone I get: !DS%%A:~0,20! as output. I tried adding the brackets, etc and played considerably eventually settling on this:
FOR /L %%A IN (1,1,8) DO IF NOT %[DS%%A]==*EMPTY* ((SET DS%%A=%[DS%%A] _)&&((SET DS%%A=%@LEFT[20,%[DS%%A]]_))
(all one line)
which works (although with the final '_' to prevent the whitespace from dropping.) The only problem is that there are many lines like this and I would prefer not to have to rewrite the entire program just for TCC. I don't understand why it won't correctly work with the variable in the first sample. I would like the original line to work with TCC if at all possible!
I really hope that I'm missing something that will improve the compatibility. I feel a little disappointed as I was hoping that TCC would be "99%" compatibalbe and that existing batch scripts should work without difficuty!
Any help would be greatly appreciated!
Chris McKay
I just started with TCC Version 9 about a month ago. I've not used a previous version of this software (unless you count the old 4DOS) so I'm still learning the new nomenclature.
Anyway, I'm working with batch scripts, not directly from the command line. I've been using CMD from Windows XP Pro SP2.
My existing batch program (a self-made, Checkbook-type program) appends transations to an existing text file. Fixed width fields are made by appending about 20 'spaces' (actual number of spaces is arbitrary) to the end of the variable and then extracting the first 20. This leaves the original vairable with the appropriate number of white space at the end. It's then written to a file and makes for a very nicely formatted line.
This does not apepar to work under TCC. It seems to strip any trailing white space from the variable. That's my first question, is there an option that I'm missing. Or is there a control char that I can insert that is invisible, but that 'set' would not strip out?
The next difficulty is harder to expain. I have this fragment from my script:
FOR /L %%A IN (1,1,8) DO IF NOT !DS%%A!==*EMPTY* SET DS%%A=!DS%%A! &&SET DS%%A=!DS%%A:~0,20!
(all one line)
SET DS%%A=!DS%%A:~0,20! under CMD this variable expands and then gets trimmed correctly. This is another one of those variables that need padded in the first question. In this case though, under TCC, I cannot get it to expand/trim correctly. Left alone I get: !DS%%A:~0,20! as output. I tried adding the brackets, etc and played considerably eventually settling on this:
FOR /L %%A IN (1,1,8) DO IF NOT %[DS%%A]==*EMPTY* ((SET DS%%A=%[DS%%A] _)&&((SET DS%%A=%@LEFT[20,%[DS%%A]]_))
(all one line)
which works (although with the final '_' to prevent the whitespace from dropping.) The only problem is that there are many lines like this and I would prefer not to have to rewrite the entire program just for TCC. I don't understand why it won't correctly work with the variable in the first sample. I would like the original line to work with TCC if at all possible!
I really hope that I'm missing something that will improve the compatibility. I feel a little disappointed as I was hoping that TCC would be "99%" compatibalbe and that existing batch scripts should work without difficuty!
Any help would be greatly appreciated!
Chris McKay