Syntax Error

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
cocoking
Posts: 46
Joined: Tue Jun 15, 2010 1:15 pm
Location: Malabang, Lanao del Sur

Syntax Error

Post by cocoking »

Why do I get these syntax errors:

Compiling 'reindex.prg'...
reindex.prg(28) Error E0030 Syntax error "syntax error at '@'"
reindex.prg(30) Error E0030 Syntax error "syntax error at '.'"
reindex.prg(63) Error E0030 Syntax error "syntax error at '.'"
reindex.prg(65) Error E0030 Syntax error "syntax error at '.'"
reindex.prg(67) Error E0030 Syntax error "syntax error at '.'"

from the following statements (with focus on lines 23-30):

14 #include "i_ini.ch" // define CRLF
15
16 ************************************************************************
17 function Reindex(nSubChoice)
18 *************************************************************************
19 // reindex system files
20 // 2010-08-01 revised to conform to hmg
21
22 // preparing the editbox
23 @ 10, 10 EDITBOX ebRein ;
24 OF PARENT MainForm ;
25 WIDTH 300 ;
26 HEIGHT 300 ;
27 VALUE "Reindexing files:" + CRLF ;
28 READONLY
29
30 MainForm.ebRein.Show
...
57 // reindex file 1
58 if file("sss&cyear..dbf")
59 if DbOpen(1, "sss&cyear", .F.)
60 index on empnumbr to sss&cyear
61 dbclosearea()
62 endif
63 MainForm.ebRein.Value += "SSS " + cYear + " file..." + CRLF
64 else
65 MainForm.ebRein.Value += "No SSS file for " + cYear + "." + CRLF
66 endif
67 MainForm.ebRein.Refresh

The purpose here is to display/log the indexing process into an editbox while indexing is going on (though I'm not sure if this will work as I can't get pass statements 23-30)
Any idea or suggestions?
User avatar
mol
Posts: 3774
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Syntax Error

Post by mol »

I think you need to declare window MainForm (isn't it defined in another module?).
Please, add this line to the top of module:

Code: Select all

declare window MainForm
cocoking
Posts: 46
Joined: Tue Jun 15, 2010 1:15 pm
Location: Malabang, Lanao del Sur

Re: Syntax Error

Post by cocoking »

Thank you for your reply.

I have this in the main program:

DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 750 ;
HEIGHT 700 ;
MAIN;
TITLE 'HMMGC Payroll System'

DEFINE MAIN MENU
...
END MENU
END WINDOW

The main form and the menu are working.
User avatar
Rathinagiri
Posts: 5480
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Syntax Error

Post by Rathinagiri »

Hi,

The problem may be in this line.

24 OF PARENT MainForm ;

You can use either "OF" or "PARENT" and not both!

So, it should be,

24 OF MainForm ;

or

24 PARENT MainForm ;
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
cocoking
Posts: 46
Joined: Tue Jun 15, 2010 1:15 pm
Location: Malabang, Lanao del Sur

Re: Syntax Error

Post by cocoking »

Thank you, Mr. Rathinagiri, your suggestion to use PARENT MainForm worked. I'm sorry I missed the vertical bar (|) in the syntax definition of EDITBOX.

The syntax errors in lines, 63, 65, 67 remain but I feel I'm progressing in my understanding of HMG and so is my confidence in using it.

TYVM
User avatar
Rathinagiri
Posts: 5480
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Syntax Error

Post by Rathinagiri »

Why can't you try


63:MainForm.ebRein.Value := MainForm.ebRein.Value + "SSS " + cYear + " file..." + CRLF

65:MainForm.ebRein.Value := MainForm.ebRein.Value + "No SSS file for " + cYear + "." + CRLF

67. You need not enter this line.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
cocoking
Posts: 46
Joined: Tue Jun 15, 2010 1:15 pm
Location: Malabang, Lanao del Sur

Re: Syntax Error

Post by cocoking »

Yes, Marek is correct in his suggestion to add DECLARE WINDOW when form is used in a different PRG from where it was defined.

Rathi is also right in his suggestion not to use += in the assignment statement but instead use :=.
Additionally, when I used =, it resulted in syntax error.

Thank you very much, Marek and Rathi for your help.

Sorry for the late reply, I just had an official business trip and wasn't able to work on it for a while.
Post Reply