drezzzz
19th December 2008, 15:26
Hi there,
I kinda get to the conclusion that programming in 3GL is the only way to get the result I wanted. I then search a lot on the forum to understand some core point about the language but some question stays unresolved or ambiguous like :
- Is 3GL a compiled only language, I hear "script" everywhere ?
- Where can I get a kickoff documentation ?

Thank you again for your time,
Fred

george7a
19th December 2008, 16:13
Hi,

- AFAIK, 3GL will work in all languages. However, some functions won't work with webtop/ThinERP
- In this site you have the BaanERP Programmer's Manual (http://www.baanboard.com/programmers_manual_baanerp). 3GL includes a lot of topics. If you need any specific question, feel free to ask ;)

- George

drezzzz
19th December 2008, 16:36
Hi george7a,
I want to find a way to make a script which will run from a unix shell and will query the Baan database and produce an exported file. This is my main motivation in learning 3GL.

I figure out that I could be able to do that with 3GL.
So where to begin ... I looked at the all the overview in "BaanERP Programmer's Manual" and checked out some function. I gather a small code from the forum to be my first step :

|* First program script - zmadmtest
extern long ret.val
function main()
{
long procid
procid = activate("ozmadmnp", "Hello", "World", "Testing")
message("Procid=%d", procid)
import("ret.val", ret.val)
message("Return value=%d", ret.val)
exit(0)
}


Now, what do I have to do with it, to make it execute by ba ?
I tryed compile with bic, it seems to have compiled... then I had no idea what it produce... lol

Still lost in concepts I think.
Thank you,
Fred

drezzzz
19th December 2008, 18:16
I think I figured out some things while reading post.

It seems that I could :
- write a file containing 3GL script
- compile it with "> bic6.0 -l ./my3GLscript -o ./myCompiledObject"
- (I am not sure but I tried anyway) Setting some environments variables like : USER, BSE and BSE_TMP
- then run my code using "> ba6.0 ./myCompiledObject"

Problem is, I got a "Segmentation fault(coredump)" when running the code...
The code used is the same.

Can somebody helps with the newbs I am ?

Thank in advance,
Fred

NPRao
19th December 2008, 20:48
Fred,

It looks like my example code. Here is the correct thread with that code and also the other replies where I gave the link to the command line execution.

3GL parameter and return (http://www.baanboard.com/baanboard/showthread.php?t=9316&highlight=ba6.1)

It seems that I could :
- write a file containing 3GL script
- compile it with "> bic6.0 -l ./my3GLscript -o ./myCompiledObject"
- (I am not sure but I tried anyway) Setting some environments variables like : USER, BSE and BSE_TMP
- then run my code using "> ba6.0 ./myCompiledObject"
Instead of writing command line programs, go to the Program Scripts (ttadv2530m000) and create your 3-GL and compile from there. The command line options requires you to set all the environment variables, paths etc correctly.

drezzzz
23rd December 2008, 14:29
Thanks NPRao for the hint,
I figure out the way to compile but still have some troubles.

I successfully compile and run this example code :
|********************************************************
|* Run this from the Baan shell
|* By Stark Springs, 18th June 2002
|********************************************************
function main()
{
long wnd,i

wnd=new.window(22, 80, 1, 1)
scroll(wnd)
for i=99 to 1 step -1
print i, " bottle(s) of beer on the wall,", cr$(), lf$()
print i, " bottle(s) of beer.", cr$(), lf$()
print i-1, " bottle(s) of beer on the wall.", cr$(), lf$(2)
refresh(wnd)
endfor
message("")
}

Which is a good start for a beginner.
This morning I come back and get a message when running the script :
"Error: no permission for test.3 or is not defined to runtime"

Does someone knows something about that ?

raikar_raviraj
23rd December 2008, 20:11
the best way to test the 3gl program is to add the compiled object in BMS Mask, check mark the on boot option...
Login to Baan, and the object will get executed.

NPRao
23rd December 2008, 22:09
I kinda get to the conclusion that programming in 3GL is the only way to get the result I wanted.
Fred,

You need to clearly specify what are you trying to do? Instead of trying to build a 3-GL screen and event handling you can easily design the Session and use the standard program's event handling.
I tested your 3-gl code and it worked for me.
This morning I come back and get a message when running the script :
"Error: no permission for test.3 or is not defined to runtime"
Refer to my note:

It seems that I could :
- write a file containing 3GL script
- compile it with "> bic6.0 -l ./my3GLscript -o ./myCompiledObject"
- (I am not sure but I tried anyway) Setting some environments variables like : USER, BSE and BSE_TMP
- then run my code using "> ba6.0 ./myCompiledObject"
Instead of writing command line programs, go to the Program Scripts (ttadv2530m000) and create your 3-GL and compile from there. The command line options requires you to set all the environment variables, paths etc correctly.

drezzzz
23rd December 2008, 22:25
I don't really help since I don't understand... I know that I don't have any checkbox at the Baan boot ...
What is a BMS Mask ?

Sorry for my lack of understanding ... I really appreciate your help !

drezzzz
23rd December 2008, 22:35
Sorry NPRao, I don't have access to Program Scripts session ...

What I am trying to do, clearly, is to be able to gather data from the ISAM database. Since I didn't find any way to do it, I figured out, reading all the post here, that a 3GL script should get the job done.

So here I am, trying to understand the 3GL and even more, the way to execute it.

I feel like I am near since I wrote a file, compile it, and see the result yesterday, the bottle of beers thing. But I didn't get the same results this morning, with this message : "Error: no permission for test.3 or is not defined to runtime"

So I am stock again ...

Hitesh Shah
30th December 2008, 11:46
There are many ways to get the data from ISAM database .

1. USe the olesql functions in ttdllsql_query in olesql scripting languages .
2. Write a generic 4 GL program (very complex ) to extract data from any table as pre-defined criteria , schedule it in Baan job management and write to file the way u want. Writing 3GL program is not necessary .
3. Use qptool6.1 for the same . Check qptool on this forum for more information .

shah_bs
30th December 2008, 12:27
Sorry NPRao, I don't have access to Program Scripts session ...


Looks like you have a problem here --- if you do not have access to the development tools, then you need to get them established by having your BAAN Administrator set up the developer's authorizations for you. BAAN Tools development environment is so powerful, it seems strange you are struggling like this. Maybe you can even request an introduction programming course. [Still I admire the progress you have made.] Cannot help much more right now, since I am away from my BAAN access for a few days. Maybe catch with this later.

mark_h
30th December 2008, 16:01
Does mk have exchange schemes available? Exchange schemes can be used to export data - I am not sure they need a developers license.

drezzzz
5th January 2009, 20:19
Two related questions :
1. Does anyone have the documentation for qptool6.1 ?

2. Is there a SQL only way to use the INSERT and UPDATE command ?
As I read, I only see 4GL scripts that update or insert ... No direct SQL call.

I would like to use qptool to update fields.

Thank you guys,
Fred

PS.

mark_h : sorry really don't know

shah_bs: Thanks.

Hitesh Shah
6th January 2009, 05:39
1. Here is what qptool help is .

Usage : qptool script_with_query
or : qptool [options]
options: -c compnr
-q query
-a actions
p: parse query
e: execute query
f<nr>: fetch <nr> rows from query, '*' is all rows
b: break query
c: close query
t: commit
a: abort
d<nr>: set rds_full to <nr>
s: save retry point
r: retry query
m: get sql error message
n<nr>: set default company number to <nr>
o<nr>: set query timeout to <nr>
Default actions 'pef*bc'
-p parse mode
-f script_with_queries
Format: [ '@'<actions> ] <query> [ ';' [ '@'<actions> ] <query> .
.. ]
-r load references
-o output file for query result
-b size of rds full
-t set global query timeout

2. There are many ways to insert/update records ( viz exchange,import , embedded SQL , dynamic SQL , OLE scripting , db.* functions using db.bind etc ). This board is replete with umpteen illustrations on almost all . If u elaborate ur query with specific needs anyone in this forum will help u .

drezzzz
6th January 2009, 21:05
Thank you Hitesh Shah,

I tried to be generic in my questions since I discover the possibilities as we discuss. I tried to find the most efficient way to access read/write the Bisam DB, outside of the mk interface. It seems that the better solution for me for gathering data is 'qptool', yet. But I didn't succeed with any INSERT/UPDATE. The parser call for unexpected insert. I conclude that 'qptool' can not be use to insert/update ... right?

It seems to me that the better solution to insert/update is to use the db.* function which I understand is 4GL ...? Which is usable with 'qptool' via the -f parameter (I feel stupid...)...?

I didn't succeed to use the -a options, don't know why, someone as an example use ?

Thanks again, again,
Fred