spatters
19th January 2006, 21:02
I noticed in our Baan environment that the way code is maintained seems inefficient. I come from a UNIX background where revision control tools can be used to maintain code changes (ex: CVS, Subversion, etc).
Now, I contrast this with the Baan environment were the changelog is integrated into the source code as well as the old code that is now commented out due to some type of change. So, the source code ends up with a bunch of commented code after a few changes. Furthermore, backing out changes is tedious as it is a rather manual process.
Please tell me there is a better solution. Any documentation would help. Perhaps I just need to understand the Baan VRC better?
I've included an example below:
|******************************************************************************
|* tdssto151 0 VRC B40C c4 prod
|* Maintain Sales Plan Entry
|* 2000-08-08
|******************************************************************************
|* Main table tdsst950 Sales Plan Entry, Form Type 3
|******************************************************************************
|*
|* RDW 05/31/01 - Ticket DWAE-4WMN6P. All references of tccom953 were replaced
|* with tccom010. All fields in the tccom953 table were moved
|* to the tccom010 table.
|* dmw 07/05/02 - DWAE-4XEP93 - Update plan summary tables
|* mdm 10/27/05 - DWAE-6HHS33 - Plan numbers not in sysc
|****************************** declaration section ***************************
declaration:
table ttdsst950 | Sales Plan Entry
table ttiitm001 | Items
table ttdinv956 | Ship Points
table ttcmcs950 | Andersons parameters
|* table ttccom953 | Customer |RDW 05/31/01
table ttccom010 | Customer
table ttccom958 | Territory
table ttdsst954 | Plan Summary |dmw 070502
long company
long whse.comp
long exch.comp
long ddv.comp
extern domain tca.terr terr |dmw 071301
long test |dmw 070502
long add.flag |dmw 070502
long plan.changed |dmw 070502
domain tcqiv1 qua5.diff |dmw 070502
domain tcqiv1 qua6.diff |dmw 070502
domain tcqiv1 old.tdsst950.qua5 |dmw 070502
domain tcqiv1 old.tdsst950.qua6 |dmw 070502
#include "itccom0003" | check.search.argument
|****************************** PROGRAM SECTION ***************************
before.program:
import("terr",terr)
if terr <> 0 then
query.extension = "exists ( select tccom010.* from tccom010 "&
"where tccom010._index8 = {:terr,tdsst950.cuno})"
endif
company = get.compnr()
select tcmcs950.*
from tcmcs950
where tcmcs950._compnr = :company
selectdo
whse.comp = tcmcs950.a.whse
exch.comp = tcmcs950.a.exch
ddv.comp = tcmcs950.a.ddv
endselect
|****************************** form section **********************************
form.1:
init.form:
execute(find.data)
|***************************** field section **********************************
field.tccom958.a.name:
before.display:
select tccom958.*
from tccom958
where tccom958._index1 = {:tccom010.a.terr}
selectdo
selectempty
tccom958.a.name = "Unknown Terr Mgr"
endselect
field.tdsst950.cuno:
before.checks:
itccom0003.check.search.argument(tdsst950.cuno, "tccom010")
check.input:
select tccom010.* |RDW 05/31/01
from tccom010 |RDW 05/31/01
where tccom010._index1 = {:tdsst950.cuno} |RDW 05/31/01
selectdo |RDW 05/31/01
display("tccom010.nama") |RDW 05/31/01
selectempty |RDW 05/31/01
set.input.error("tca.com0031") |RDW 05/31/01
endselect |RDW 05/31/01
|* select tccom953.*,tccom010.* |RDW 05/31/01
|* from tccom953, tccom010 |RDW 05/31/01
|* where (tccom953._index1 = {:tdsst950.cuno} |RDW 05/31/01
|* and tccom953.a.terr = :tdsst950.terr) |RDW 05/31/01
|* and tccom010._index1 = {:tdsst950.cuno} |RDW 05/31/01
|* selectdo |RDW 05/31/01
|* display("tccom010.nama") |RDW 05/31/01
|* selectempty |RDW 05/31/01
|* set.input.error("tca.com0031") |RDW 05/31/01
|* endselect |RDW 05/31/01
field.tccom010.nama:
before.display:
select tccom010.*
from tccom010
where tccom010._index1 = {:tdsst950.cuno}
selectdo
endselect
field.tdsst950.citg:
check.input:
| if update.status = add.set then
select tcmcs023.*
from tcmcs023
where tcmcs023._index1 = {:tdsst950.citg}
selectdo
selectempty
set.input.error("tda.ilc0002")
endselect
| endif
field.tdsst950.comp:
check.input:
| if update.status = add.set then
select tccom000.*
from tccom000
where tccom000._index1 = {:tdsst950.comp}
selectdo
selectempty
set.input.error("tda.ilc0001")
endselect
| endif
field.tdsst950.shpt:
check.input:
if update.status = add.set then
select tdinv956.*
from tdinv956
where tdinv956._index1 = {:tdsst950.shpt}
selectdo
if tdsst950.comp <> ddv.comp
and tdsst950.comp <> exch.comp then
if tdsst950.shpt > 999 then
set.input.error("tda.inv0035")
else
if tdsst950.shpt <> tdsst950.comp then
set.input.error("tda.inv0010")
else
display("tdinv956.a.city")
endif
endif
else
display("tdinv956.a.city")
endif
selectempty
set.input.error("tda.inv0010")
endselect
endif
field.tdinv956.a.city:
before.display:
select tdinv956.a.city
from tdinv956
where tdinv956._index1 = {:tdsst950.shpt}
selectdo
selectempty
tdinv956.a.city = "Not found"
endselect
field.tdsst950.item:
check.input:
if update.status = add.set then
select tiitm001.*
from tiitm001
where tiitm001._index1 = {:tdsst950.item}
and tiitm001._compnr = :tdsst950.comp
selectdo
if tiitm001.cuni <> "ton" then
set.input.error("tia.itm0005")
else
if tiitm001.citg <> tdsst950.citg then
set.input.error("tda.ilc0005")
else
display("tiitm001.dsca")
tdsst950.ctyp = tiitm001.ctyp
tdsst950.cuni = tiitm001.cuni
endif
endif
selectempty
set.input.error("tia.itm0006")
endselect
endif
field.tiitm001.dsca:
before.display:
select tiitm001.dsca
from tiitm001
where tiitm001._index1 = {:tdsst950.item}
and tiitm001._compnr = :tdsst950.comp
selectdo
selectempty
tiitm001.dsca = "Not found"
endselect
field.tdsst950.qua5:
before.input:
old.tdsst950.qua5 = tdsst950.qua5
when.field.changes:
plan.changed = 1
after.input:
if plan.changed then
qua5.diff = tdsst950.qua5 - old.tdsst950.qua5
execute(update.db)
execute(find.data)
choice.again()
endif
field.tdsst950.qua6:
before.input:
old.tdsst950.qua6 = tdsst950.qua6
when.field.changes:
plan.changed = 1
after.input:
if plan.changed then
qua6.diff = tdsst950.qua6 - old.tdsst950.qua6
execute(update.db)
execute(find.data)
choice.again()
endif
|****************************** choice section ********************************
choice.add.set:
before.choice:
add.flag = 1 |dmw 070502
|************************* main table io section ******************************
main.table.io:
after.rewrite:
commit.transaction() |dmw 070502
update.summary() |dmw 070502
plan.changed = 0 |dmw 070502
qua5.diff = 0 |dmw 070502
qua6.diff = 0 |dmw 070502
before.delete:
delete.from.summary() |dmw 070502
|after.update.db.commit: |mdm 102705
after.write: |mdm 102705
if add.flag then |dmw 070502
commit.transaction() |mdm 102705
update.summary() |dmw 070502
add.flag = 0 |dmw 070502
qua5.diff = 0 |dmw 070502
qua6.diff = 0 |dmw 070502
endif
|**************************** function section ********************************
functions:
function delete.from.summary() |dmw 070502
{
select tdsst954.*
from tdsst954 for update
where tdsst954._index1 = {:tccom010.a.terr, :tdsst950.cuno,
:tdsst950.ctyp, :tdsst950.shpt}
selectdo
tdsst954.qua5 = tdsst954.qua5 - tdsst950.qua5
tdsst954.qua6 = tdsst954.qua6 - tdsst950.qua6
db.update(ttdsst954, db.retry)
endselect
}
function update.summary() |dmw 070502
{
db.retry.point()
select tdsst954.*
from tdsst954 for update
where tdsst954._index1 = {:tccom010.a.terr, :tdsst950.cuno,
:tdsst950.ctyp, :tdsst950.shpt}
selectdo
tdsst954.qua5 = tdsst954.qua5 + qua5.diff
tdsst954.qua6 = tdsst954.qua6 + qua6.diff
db.update(ttdsst954, db.retry)
commit.transaction()
selectempty
db.set.to.default(ttdsst954)
tdsst954.terr = tccom010.a.terr
tdsst954.cuno = tdsst950.cuno
tdsst954.ctyp = tdsst950.ctyp
tdsst954.shpt = tdsst950.shpt
tdsst954.qua5 = tdsst954.qua5 + tdsst950.qua5
tdsst954.qua6 = tdsst954.qua6 + tdsst950.qua6
db.insert(ttdsst954, db.retry)
commit.transaction()
endselect
}
Now, I contrast this with the Baan environment were the changelog is integrated into the source code as well as the old code that is now commented out due to some type of change. So, the source code ends up with a bunch of commented code after a few changes. Furthermore, backing out changes is tedious as it is a rather manual process.
Please tell me there is a better solution. Any documentation would help. Perhaps I just need to understand the Baan VRC better?
I've included an example below:
|******************************************************************************
|* tdssto151 0 VRC B40C c4 prod
|* Maintain Sales Plan Entry
|* 2000-08-08
|******************************************************************************
|* Main table tdsst950 Sales Plan Entry, Form Type 3
|******************************************************************************
|*
|* RDW 05/31/01 - Ticket DWAE-4WMN6P. All references of tccom953 were replaced
|* with tccom010. All fields in the tccom953 table were moved
|* to the tccom010 table.
|* dmw 07/05/02 - DWAE-4XEP93 - Update plan summary tables
|* mdm 10/27/05 - DWAE-6HHS33 - Plan numbers not in sysc
|****************************** declaration section ***************************
declaration:
table ttdsst950 | Sales Plan Entry
table ttiitm001 | Items
table ttdinv956 | Ship Points
table ttcmcs950 | Andersons parameters
|* table ttccom953 | Customer |RDW 05/31/01
table ttccom010 | Customer
table ttccom958 | Territory
table ttdsst954 | Plan Summary |dmw 070502
long company
long whse.comp
long exch.comp
long ddv.comp
extern domain tca.terr terr |dmw 071301
long test |dmw 070502
long add.flag |dmw 070502
long plan.changed |dmw 070502
domain tcqiv1 qua5.diff |dmw 070502
domain tcqiv1 qua6.diff |dmw 070502
domain tcqiv1 old.tdsst950.qua5 |dmw 070502
domain tcqiv1 old.tdsst950.qua6 |dmw 070502
#include "itccom0003" | check.search.argument
|****************************** PROGRAM SECTION ***************************
before.program:
import("terr",terr)
if terr <> 0 then
query.extension = "exists ( select tccom010.* from tccom010 "&
"where tccom010._index8 = {:terr,tdsst950.cuno})"
endif
company = get.compnr()
select tcmcs950.*
from tcmcs950
where tcmcs950._compnr = :company
selectdo
whse.comp = tcmcs950.a.whse
exch.comp = tcmcs950.a.exch
ddv.comp = tcmcs950.a.ddv
endselect
|****************************** form section **********************************
form.1:
init.form:
execute(find.data)
|***************************** field section **********************************
field.tccom958.a.name:
before.display:
select tccom958.*
from tccom958
where tccom958._index1 = {:tccom010.a.terr}
selectdo
selectempty
tccom958.a.name = "Unknown Terr Mgr"
endselect
field.tdsst950.cuno:
before.checks:
itccom0003.check.search.argument(tdsst950.cuno, "tccom010")
check.input:
select tccom010.* |RDW 05/31/01
from tccom010 |RDW 05/31/01
where tccom010._index1 = {:tdsst950.cuno} |RDW 05/31/01
selectdo |RDW 05/31/01
display("tccom010.nama") |RDW 05/31/01
selectempty |RDW 05/31/01
set.input.error("tca.com0031") |RDW 05/31/01
endselect |RDW 05/31/01
|* select tccom953.*,tccom010.* |RDW 05/31/01
|* from tccom953, tccom010 |RDW 05/31/01
|* where (tccom953._index1 = {:tdsst950.cuno} |RDW 05/31/01
|* and tccom953.a.terr = :tdsst950.terr) |RDW 05/31/01
|* and tccom010._index1 = {:tdsst950.cuno} |RDW 05/31/01
|* selectdo |RDW 05/31/01
|* display("tccom010.nama") |RDW 05/31/01
|* selectempty |RDW 05/31/01
|* set.input.error("tca.com0031") |RDW 05/31/01
|* endselect |RDW 05/31/01
field.tccom010.nama:
before.display:
select tccom010.*
from tccom010
where tccom010._index1 = {:tdsst950.cuno}
selectdo
endselect
field.tdsst950.citg:
check.input:
| if update.status = add.set then
select tcmcs023.*
from tcmcs023
where tcmcs023._index1 = {:tdsst950.citg}
selectdo
selectempty
set.input.error("tda.ilc0002")
endselect
| endif
field.tdsst950.comp:
check.input:
| if update.status = add.set then
select tccom000.*
from tccom000
where tccom000._index1 = {:tdsst950.comp}
selectdo
selectempty
set.input.error("tda.ilc0001")
endselect
| endif
field.tdsst950.shpt:
check.input:
if update.status = add.set then
select tdinv956.*
from tdinv956
where tdinv956._index1 = {:tdsst950.shpt}
selectdo
if tdsst950.comp <> ddv.comp
and tdsst950.comp <> exch.comp then
if tdsst950.shpt > 999 then
set.input.error("tda.inv0035")
else
if tdsst950.shpt <> tdsst950.comp then
set.input.error("tda.inv0010")
else
display("tdinv956.a.city")
endif
endif
else
display("tdinv956.a.city")
endif
selectempty
set.input.error("tda.inv0010")
endselect
endif
field.tdinv956.a.city:
before.display:
select tdinv956.a.city
from tdinv956
where tdinv956._index1 = {:tdsst950.shpt}
selectdo
selectempty
tdinv956.a.city = "Not found"
endselect
field.tdsst950.item:
check.input:
if update.status = add.set then
select tiitm001.*
from tiitm001
where tiitm001._index1 = {:tdsst950.item}
and tiitm001._compnr = :tdsst950.comp
selectdo
if tiitm001.cuni <> "ton" then
set.input.error("tia.itm0005")
else
if tiitm001.citg <> tdsst950.citg then
set.input.error("tda.ilc0005")
else
display("tiitm001.dsca")
tdsst950.ctyp = tiitm001.ctyp
tdsst950.cuni = tiitm001.cuni
endif
endif
selectempty
set.input.error("tia.itm0006")
endselect
endif
field.tiitm001.dsca:
before.display:
select tiitm001.dsca
from tiitm001
where tiitm001._index1 = {:tdsst950.item}
and tiitm001._compnr = :tdsst950.comp
selectdo
selectempty
tiitm001.dsca = "Not found"
endselect
field.tdsst950.qua5:
before.input:
old.tdsst950.qua5 = tdsst950.qua5
when.field.changes:
plan.changed = 1
after.input:
if plan.changed then
qua5.diff = tdsst950.qua5 - old.tdsst950.qua5
execute(update.db)
execute(find.data)
choice.again()
endif
field.tdsst950.qua6:
before.input:
old.tdsst950.qua6 = tdsst950.qua6
when.field.changes:
plan.changed = 1
after.input:
if plan.changed then
qua6.diff = tdsst950.qua6 - old.tdsst950.qua6
execute(update.db)
execute(find.data)
choice.again()
endif
|****************************** choice section ********************************
choice.add.set:
before.choice:
add.flag = 1 |dmw 070502
|************************* main table io section ******************************
main.table.io:
after.rewrite:
commit.transaction() |dmw 070502
update.summary() |dmw 070502
plan.changed = 0 |dmw 070502
qua5.diff = 0 |dmw 070502
qua6.diff = 0 |dmw 070502
before.delete:
delete.from.summary() |dmw 070502
|after.update.db.commit: |mdm 102705
after.write: |mdm 102705
if add.flag then |dmw 070502
commit.transaction() |mdm 102705
update.summary() |dmw 070502
add.flag = 0 |dmw 070502
qua5.diff = 0 |dmw 070502
qua6.diff = 0 |dmw 070502
endif
|**************************** function section ********************************
functions:
function delete.from.summary() |dmw 070502
{
select tdsst954.*
from tdsst954 for update
where tdsst954._index1 = {:tccom010.a.terr, :tdsst950.cuno,
:tdsst950.ctyp, :tdsst950.shpt}
selectdo
tdsst954.qua5 = tdsst954.qua5 - tdsst950.qua5
tdsst954.qua6 = tdsst954.qua6 - tdsst950.qua6
db.update(ttdsst954, db.retry)
endselect
}
function update.summary() |dmw 070502
{
db.retry.point()
select tdsst954.*
from tdsst954 for update
where tdsst954._index1 = {:tccom010.a.terr, :tdsst950.cuno,
:tdsst950.ctyp, :tdsst950.shpt}
selectdo
tdsst954.qua5 = tdsst954.qua5 + qua5.diff
tdsst954.qua6 = tdsst954.qua6 + qua6.diff
db.update(ttdsst954, db.retry)
commit.transaction()
selectempty
db.set.to.default(ttdsst954)
tdsst954.terr = tccom010.a.terr
tdsst954.cuno = tdsst950.cuno
tdsst954.ctyp = tdsst950.ctyp
tdsst954.shpt = tdsst950.shpt
tdsst954.qua5 = tdsst954.qua5 + tdsst950.qua5
tdsst954.qua6 = tdsst954.qua6 + tdsst950.qua6
db.insert(ttdsst954, db.retry)
commit.transaction()
endselect
}