Please help with syntax

Moderator: Rathinagiri

robbie73
Posts: 11
Joined: Sat Jan 05, 2013 6:59 pm

Please help with syntax

Post by robbie73 »

Hi everybody.
I am working my way through some old DOS programs and converting them to run in a windows 32/64 bit enviroment.
One program that I'm working on fixes any rogue rogue records in a database. It checks for blanks, duplicates and broken relationships and reports them in a log file and can fix them depending which option is selected.

I'm using HMG IDE Unicode 1.0.8 to compile into 32 bit. (64 bit won't compile at all, it just freezes HMG and has to be forced closed)

The program I'm converting currently works perfectly when run from dos in an XP or lower environment, but unfortunately this program falls over when run after being compiled in HMG.

The problem is the "ALLTRIM" function which is referred to several times in my program. It is critical that leading and trailing spaces are removed from records, as well as carriage returns etc. The record should just comtain the characters and nothing more.

My thought was to try to use LTrim, then RTrim on the same string before further processing, but i'm stuck with the syntax.
Can somebody please advise how i can do that in clipper? Here is some of my code.

Code: Select all

procedure blanks()
   select 1; use blank.dbf
   message(3,opy,mess,"Blank and Invalid Codes")
  do while !eof()
      vfile=file; vfield=field; vsize=size
      message(4,filey,mess,"Deleting "+(vfile))
      select 2; use &vfile; setbar()
      hold=4
     
     do while !eof()
         progress(recno(),lastrec())
         if len(alltrim(&vfield))<vsize
         //if len(alltrim(&vfield)) <-- how to use alternative to ALL TRIM?
         errortofile("Blank/Invalid",vfile,recno())
            if upper(delrep)="D"
               delete
            endif
         endif
         skip
      enddo
      select 1
      skip
   enddo
   close 1; close 2
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Please help with syntax

Post by Pablo César »

robbie73 wrote:I'm using HMG IDE Unicode 1.0.8 to compile into 32 bit. (64 bit won't compile at all, it just freezes HMG and has to be forced closed)
Hi Robbie,

Try this (I think it's same case like this message): viewtopic.php?p=39551#p39551
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Please help with syntax

Post by esgici »

Hi robbie

It's difficult saying anything about your problem without see you code and data :(

We need a SSW (Short, Simple and Working) sample;

FE you are using a "size" variable / field and we haven't possibility to check it's value :(

In other hand, ALLTRIM() is a Clipper / Harbour function and it is (almost ;) ) impossible different behaviour between different HMG versions :?

Happy HMG'ing :D
Viva INTERNATIONAL HMG :D
robbie73
Posts: 11
Joined: Sat Jan 05, 2013 6:59 pm

Re: Please help with syntax

Post by robbie73 »

Pablo César wrote:
robbie73 wrote:I'm using HMG IDE Unicode 1.0.8 to compile into 32 bit. (64 bit won't compile at all, it just freezes HMG and has to be forced closed)
Hi Robbie,

Try this (I think it's same case like this message): viewtopic.php?p=39551#p39551
Thank you for your quick repsonse Pablo :) I tried the new build.bat with 64 bit sleected but the result is:
'windres' is not recognized as an internal or external command, operable program or batch file. :?:

I am using windows home premium 64 bit fully updated if that helps?

32 bit compiles and runs fine, but then I have the other problem with ALLTRIM.
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Please help with syntax

Post by Pablo César »

robbie73 wrote:I tried the new build.bat with 64 bit sleected but the result is:
'windres' is not recognized as an internal or external command
Ohh yes, this build.bat it's for 32 bits. But take it as reference, probably you will find the error in build64.bat.
robbie73 wrote:32 bit compiles and runs fine, but then I have the other problem with ALLTRIM.
Robbie, you would have a lot of alltrim, this shoud it not be the problem. AllTrim and all commands/functions in Harbour are 100% compatible with Clipper.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
robbie73
Posts: 11
Joined: Sat Jan 05, 2013 6:59 pm

Re: Please help with syntax

Post by robbie73 »

esgici wrote:Hi robbie
It's difficult saying anything about your problem without see you code and data :(
We need a SSW (Short, Simple and Working) sample;
FE you are using a "size" variable / field and we haven't possibility to check it's value :(
Hi esgici. Thank you for replying. I was just wondering if it is possible to use LTrim and RTrim in the way I have mentioned?
using this pseudo code somehow?

Code: Select all

stringLen(Ltrim(Rtrim))<VSize 
I wonder if somebody could show me a code sample showing Ltrim and Rtrim on the same data?

I can provide a sample, but it must remain private. How can i send you the files esgici?
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Please help with syntax

Post by Pablo César »

robbie73 wrote:I was just wondering if it is possible to use LTrim and RTrim in the way I have mentioned?
If you're using hmg 3.4.0 (supposed to be due the build.bat problem, certainly you're working in UNICODE.
So in this case, manipulation strings must be use HMG adapted functions for proper UNICODE handle.

Please read this: viewtopic.php?p=23372#p23372
using this pseudo code somehow?

Code: Select all

stringLen(Ltrim(Rtrim))<VSize 
In HMG UNICODE, there is HMG_Len() function to see string's lenght
I can provide a sample, but it must remain private. How can i send you the files esgici?
You can post a simplified example, with further details.

Left and right space can be removed by alltrim, as in Clipper. Your main problem, I think you have probably left using HMG string function for UNICODE.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
robbie73
Posts: 11
Joined: Sat Jan 05, 2013 6:59 pm

Re: Please help with syntax

Post by robbie73 »

Pablo César wrote:
robbie73 wrote:I tried the new build.bat with 64 bit sleected but the result is:
'windres' is not recognized as an internal or external command
Ohh yes, this build.bat it's for 32 bits. But take it as reference, probably you will find the error in build64.bat.
robbie73 wrote:32 bit compiles and runs fine, but then I have the other problem with ALLTRIM.
Robbie, you would have a lot of alltrim, this shoud it not be the problem. AllTrim and all commands/functions in Harbour are 100% compatible with Clipper.
Then it's my syntax that is wrong. But the code in this program runs fine when compiled using dos version clipper/linker in XP. It's only broken after HMG compile :(
See the screenshot I took of the error: http://www.screencast.com/t/er0emms3
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Please help with syntax

Post by Pablo César »

Hi,
Screen6.png
Screen6.png (12.17 KiB) Viewed 6035 times
May you list the line line # 143 (ERRORTOFILE function) and # 69 (of Blanks function) ?

I believe this error, it is because there is nothing to make alltrim. Probably data type it is not data character type (Nil type, an array, date type or numeric type). Then it's not gonna works.
You can previously test it with Alert( ValType(cVar) ).

Are you using in console mode, right ?

Always be carful with error messages. It's saying: BASE/2022 Argument error: ALLTRIM

So, please read this :idea:

I hope be helful. :)
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Please help with syntax

Post by esgici »

robbie73 wrote: I can provide a sample, but it must remain private. How can i send you the files esgici?
esgici <at> gmail <dot> com
Viva INTERNATIONAL HMG :D
Post Reply