Menu

#8 Local variables in file structures

open
nobody
None
4
2010-04-18
2010-04-18
No

File structures that refer to local variables will convert to java okay - but the java will not compile.

Example:
----
importSMS procedure
logfilename string(100)
logfile file,driver('basic'),name(logfilename)
record record,pre()
time string(8)
.
code
----

Generates java, but will not compile.

Discussion

  • Andrew Barnham

    Andrew Barnham - 2010-04-18

    Suspect problem is in compiler, FileConstruct does not support notion of scope escalation. So it cannot discover the variable in question.

     
  • Andrew Barnham

    Andrew Barnham - 2010-04-18

    Workaround exists : use file{prop:name} instead of a variable reference.

     
  • Andrew Barnham

    Andrew Barnham - 2010-04-18

    Workaround 2: Make variable a global variable. That should work too.

     
  • David Jones

    David Jones - 2010-07-17

    I thought this was illegal in Clarion also. Don't names declared this was have to be global?

     
  • Andrew Barnham

    Andrew Barnham - 2010-07-17

    You are probably right this is illegal under clarion. I never actually tried to compile this under clarion. Yet I reckon this should work in the language. It would be useful if it could handle this. In my case I worked around it by declaring logfilename globally. But it should still work.

     

Log in to post a comment.