Hi,
My company used to use progress and I have the task of converting old reports to use in SQL.
There reports at from 1997 and wondered if someone would be so kind to point me to the correct place for reading about these reports and how i can convert them to SQL.
Attached is an example of the report.
Regards.
-------------
{kk000.l01}
{km000.l01}
{km000.l02 "new"}
{kg05v.i}
{kr350.v}
{kr350a.v "new"}
{kr350a.f "new"}
def var lv-new-bus as log init true.
def buffer lb-sld for sldetail.
{kg03.i &key = sv-branch-no
&name = sv-br-name
&stream = "(ss-rep)"
&report-title = sv-func-name}
sv-any-data = false.
for each sldetail no-lock use-index sld-key where
(if sv-all-consult = true
then
sld.sla-code = sld.sla-code
else
sld.sla-code = sv-sla-code) and
(sld.ame-type = 20 or
sld.ame-type = 21 or
sld.ame-type = 400 or
sld.ame-type = 401 or
sld.ame-type = 404 or
sld.ame-type = 405 or
sld.ame-type = 406 or
sld.ame-type = 407 or
sld.ame-type = 409 or
sld.ame-type = 303 or /* Price change */
sld.ame-type = 314 or /* API */
sld.ame-type = 315 or /* Percentage price inc. */
sld.ame-type = 305 or
sld.ame-type = 307 or /* Frequency Increase */
sld.ame-type = 310 or
sld.ame-type = 312) and
sld.sld-date ge sv-date-from and
sld.sld-date le sv-date-to
break by sld.sla-code
by sld.con-num
by sld.sld-date:
if last-of(sld.sla-code)
and not first-of(sld.sla-code)
then
sv-cur-area = sld.sla-code.
if first-of(sld.sla-code)
then do:
if not first(sld.sla-code)
and sv-brnsin = "C"
then do:
/* Print out report for consultant - if all consultants */
run kr350a1.p.
end. /* if - do */
if last-of(sld.sla-code)
then
sv-cur-area = sld.sla-code.
if sv-brnsin = "C"
then do:
/* Clear out work records holding figures. */
for each sw-prod:
delete sw-prod.
end. /* if-do */
end. /* if-do */
if (sv-brnsin = "C"
and first-of(sld.sla-code))
or (sv-brnsin = "T"
and first(sld.sla-code))
or (sv-brnsin = "B"
and first(sld.sla-code))
then do:
/* Recreate work records with values set to zero */
for each units no-lock where uni.uni-sales = true
and uni.uni-calmic = false
and uni.uni-hig-mar = true
by uni.grp-num:
/* NOTE - The uni.uni-hig-mar field has been changed to be used
for this report ONLY. The high margin field was no longer used
in any of the reports. 13/03/2001 -Sandra Ebblewhite request. */
find grp of units no-lock.
if grp.grp-order = 0
then
next.
create sw-prod.
assign sw-prod.pro-code = uni.pro-code
sw-prod.grp-num = uni.grp-num
sw-prod.grp-order = grp.grp-order
sw-prod.grp-sani = grp.grp-sani
sw-prod.new-qty = 0
sw-prod.new-val = 0
sw-prod.exs-qty = 0
sw-prod.exs-val = 0
sw-prod.tot-qty = 0
sw-prod.tot-val = 0.
if sv-brnsin = "C"
then
sw-prod.emp-num = sld.emp-num.
else
sw-prod.emp-num = sv-tea-code.
end. /* for-each */
end. /* if-do */
end. /* if - do */
if sv-tea-code ne ""
then do:
if sld.tea-code ne ""
then
find first team where tea.tea-code = sld.tea-code no-lock no-error.
else
find first team where tea.emp-num = sld.emp-num no-lock no-error.
if not available team
then
next.
if tea.tea-code ne sv-tea-code
then
next.
end. /* if-do */
find units of sldetail no-lock no-error.
if not available units
then do:
find first history where substring(his.his-ref,1,8) = sld.con-num
and his.ame-type = 190
no-lock no-error.
if not available history
then
next.
if his.pro-code = ""
then
next.
find first units where uni.pro-code = his.pro-code no-lock no-error.
if not available units
then
next.
end. /* if-do */
find first sw-prod where sw-prod.pro-code = sld.pro-code no-error.
if not available sw-prod
then
next.
find grp of units no-lock no-error.
if not available grp
then
next.
find first employee where emp.emp-num = sld.emp-num no-lock no-error.
find contract of sldetail no-lock no-error.
if not available contract
then do:
find first cancel where can.can-con-num = sld.con-num
and can.can-pre-num = sld.pre-num
and can.can-pro-code = sld.pro-code
no-lock no-error.
if not available cancel
then do:
find first cancel where can.can-con-num = sld.con-num
and can.can-pre-num = sld.pre-num
no-lock no-error.
if not available cancel
then do:
find first cancel where can.can-con-num = sld.con-num
no-lock no-error.
end. /* if-do */
end. /* if-do */
end. /* if-do */
if not available contract
and not available cancel
then
next.
if available contract
then do:
if con.con-job = "J"
then
next.
end. /* if-do */
else
if can.can-job = "J"
then
next.
if sv-brnsin = "B"
or sv-brnsin = "T"
then do:
find first sw-cons where sw-cons.sla-code = sld.sla-code no-error.
if not available sw-cons
then do:
create sw-cons.
assign sw-cons.sla-code = slde.sla-code
sw-cons.emp-num = slde.emp-num.
end. /* if-do */
end. /* if-do */
status default "{process.t}" + "... " + sld.sla-code + sld.con-num.
if sld.ame-type = 406
or sld.ame-type = 407
or sld.ame-type = 409
or sld.ame-type = 310
or sld.ame-type = 312
or sld.ame-type = 404 /* Negative Sales Adjustment */
or sld.ame-type = 405 /* Positive Sales Adjustment */
then do: /* Cancellations */
find first lb-sld where lb-sld.con-num = sld.con-num
and lb-sld.pre-num = sld.pre-num
and lb-sld.pro-code = sld.pro-code
and lb-sld.sld-date ge sv-date-from
and lb-sld.sld-date le sv-date-to
and (lb-sld.ame-type = 20
or lb-sld.ame-type = 400)
no-lock no-error.
if available lb-sld
then
lv-new-bus = true.
else
lv-new-bus = false.
end. /* if-do */
else
lv-new-bus = sld.sld-new-bus.
if lv-new-bus = true
then do:
if sld.ame-type = 307
or sld.ame-type = 303
or sld.ame-type = 314 /* API */
or sld.ame-type = 315 /* Percentage price increase. */
then do:
assign sw-prod.inc-val = sw-prod.inc-val
+ (sld.sld-value - sld.sld-old-val).
end. /* if-do */
else do:
if emp.emp-comm = true
then
assign sw-prod.new-qty = sw-prod.new-qty
+ (sld.sld-qty - sld.sld-old-qty)
sw-prod.new-val = sw-prod.new-val
+ (sld.sld-value - sld.sld-old-val).
end. /* else-do */
if sv-brnsin = "B"
or sv-brnsin = "T"
then do:
if sld.ame-type = 307
or sld.ame-type = 303
or sld.ame-type = 314 /* API */
or sld.ame-type = 315 /* Percentage price increase */
then do:
assign sw-cons.inc-val = sw-cons.inc-val
+ (sld.sld-value - sld.sld-old-val).
end. /* if-do */
else do:
assign sw-cons.new-qty = sw-cons.new-qty
+ (sld.sld-qty - sld.sld-old-qty)
sw-cons.new-val = sw-cons.new-val
+ (sld.sld-value - sld.sld-old-val).
end. /* else-do */
end. /* if-do */
end. /* if-do */
else do:
if sld.ame-type = 307
or sld.ame-type = 303
or sld.ame-type = 314 /* API */
or sld.ame-type = 315 /* Percentage price increase */
then do:
assign sw-prod.inc-val = sw-prod.inc-val
+ (sld.sld-value - sld.sld-old-val).
end. /* if-do */
else do:
if emp.emp-comm = true
then
assign sw-prod.exs-qty = sw-prod.exs-qty
+ (sld.sld-qty - sld.sld-old-qty)
sw-prod.exs-val = sw-prod.exs-val
+ (sld.sld-value - sld.sld-old-val).
end. /* else-do */
if sv-brnsin = "B"
or sv-brnsin = "T"
then do:
if sld.ame-type = 307
or sld.ame-type = 303
or sld.ame-type = 314 /* API */
or sld.ame-type = 315 /* Percentage price increase */
then do:
assign sw-cons.inc-val = sw-cons.inc-val
+ (sld.sld-value - sld.sld-old-val).
end. /* if-do */
else do:
assign sw-cons.exs-qty = sw-cons.exs-qty
+ (sld.sld-qty - sld.sld-old-qty)
sw-cons.exs-val = sw-cons.exs-val
+ (sld.sld-value - sld.sld-old-val).
end. /* else-do */
end. /* if-do */
end. /* else-do */
if emp.emp-comm = true
then do:
if sld.ame-type ne 303
and sld.ame-type ne 307
and sld.ame-type ne 314 /* API */
and sld.ame-type ne 315 /* Percentage price increase */
then do:
assign sw-prod.tot-qty = sw-prod.tot-qty
+ (sld.sld-qty - sld.sld-old-qty)
sw-prod.tot-val = sw-prod.tot-val
+ (sld.sld-value - sld.sld-old-val).
end. /* else-do */
end. /* if-do */
if sv-brnsin = "B"
or sv-brnsin = "T"
then do:
if sld.ame-type ne 307
and sld.ame-type ne 303
and sld.ame-type ne 314 /* API */
and sld.ame-type ne 315 /* Percentage price increase */
then do:
assign sw-cons.tot-qty = sw-cons.tot-qty
+ (sld.sld-qty - sld.sld-old-qty)
sw-cons.tot-val = sw-cons.tot-val
+ (sld.sld-value - sld.sld-old-val).
end. /* else-do */
end. /* if-do */
end. /* for-each */
/* Print out totals for last consultant */
if sv-any-data = false
then do:
if sv-all-consult = false
then
sv-cur-area = sv-sla-code.
end. /* if-do */
run kr350a1.p.
put stream ss-rep skip(1) "{eor.t}".
{kg30.i &stream = "stream ss-rep" }
My company used to use progress and I have the task of converting old reports to use in SQL.
There reports at from 1997 and wondered if someone would be so kind to point me to the correct place for reading about these reports and how i can convert them to SQL.
Attached is an example of the report.
Regards.
-------------
{kk000.l01}
{km000.l01}
{km000.l02 "new"}
{kg05v.i}
{kr350.v}
{kr350a.v "new"}
{kr350a.f "new"}
def var lv-new-bus as log init true.
def buffer lb-sld for sldetail.
{kg03.i &key = sv-branch-no
&name = sv-br-name
&stream = "(ss-rep)"
&report-title = sv-func-name}
sv-any-data = false.
for each sldetail no-lock use-index sld-key where
(if sv-all-consult = true
then
sld.sla-code = sld.sla-code
else
sld.sla-code = sv-sla-code) and
(sld.ame-type = 20 or
sld.ame-type = 21 or
sld.ame-type = 400 or
sld.ame-type = 401 or
sld.ame-type = 404 or
sld.ame-type = 405 or
sld.ame-type = 406 or
sld.ame-type = 407 or
sld.ame-type = 409 or
sld.ame-type = 303 or /* Price change */
sld.ame-type = 314 or /* API */
sld.ame-type = 315 or /* Percentage price inc. */
sld.ame-type = 305 or
sld.ame-type = 307 or /* Frequency Increase */
sld.ame-type = 310 or
sld.ame-type = 312) and
sld.sld-date ge sv-date-from and
sld.sld-date le sv-date-to
break by sld.sla-code
by sld.con-num
by sld.sld-date:
if last-of(sld.sla-code)
and not first-of(sld.sla-code)
then
sv-cur-area = sld.sla-code.
if first-of(sld.sla-code)
then do:
if not first(sld.sla-code)
and sv-brnsin = "C"
then do:
/* Print out report for consultant - if all consultants */
run kr350a1.p.
end. /* if - do */
if last-of(sld.sla-code)
then
sv-cur-area = sld.sla-code.
if sv-brnsin = "C"
then do:
/* Clear out work records holding figures. */
for each sw-prod:
delete sw-prod.
end. /* if-do */
end. /* if-do */
if (sv-brnsin = "C"
and first-of(sld.sla-code))
or (sv-brnsin = "T"
and first(sld.sla-code))
or (sv-brnsin = "B"
and first(sld.sla-code))
then do:
/* Recreate work records with values set to zero */
for each units no-lock where uni.uni-sales = true
and uni.uni-calmic = false
and uni.uni-hig-mar = true
by uni.grp-num:
/* NOTE - The uni.uni-hig-mar field has been changed to be used
for this report ONLY. The high margin field was no longer used
in any of the reports. 13/03/2001 -Sandra Ebblewhite request. */
find grp of units no-lock.
if grp.grp-order = 0
then
next.
create sw-prod.
assign sw-prod.pro-code = uni.pro-code
sw-prod.grp-num = uni.grp-num
sw-prod.grp-order = grp.grp-order
sw-prod.grp-sani = grp.grp-sani
sw-prod.new-qty = 0
sw-prod.new-val = 0
sw-prod.exs-qty = 0
sw-prod.exs-val = 0
sw-prod.tot-qty = 0
sw-prod.tot-val = 0.
if sv-brnsin = "C"
then
sw-prod.emp-num = sld.emp-num.
else
sw-prod.emp-num = sv-tea-code.
end. /* for-each */
end. /* if-do */
end. /* if - do */
if sv-tea-code ne ""
then do:
if sld.tea-code ne ""
then
find first team where tea.tea-code = sld.tea-code no-lock no-error.
else
find first team where tea.emp-num = sld.emp-num no-lock no-error.
if not available team
then
next.
if tea.tea-code ne sv-tea-code
then
next.
end. /* if-do */
find units of sldetail no-lock no-error.
if not available units
then do:
find first history where substring(his.his-ref,1,8) = sld.con-num
and his.ame-type = 190
no-lock no-error.
if not available history
then
next.
if his.pro-code = ""
then
next.
find first units where uni.pro-code = his.pro-code no-lock no-error.
if not available units
then
next.
end. /* if-do */
find first sw-prod where sw-prod.pro-code = sld.pro-code no-error.
if not available sw-prod
then
next.
find grp of units no-lock no-error.
if not available grp
then
next.
find first employee where emp.emp-num = sld.emp-num no-lock no-error.
find contract of sldetail no-lock no-error.
if not available contract
then do:
find first cancel where can.can-con-num = sld.con-num
and can.can-pre-num = sld.pre-num
and can.can-pro-code = sld.pro-code
no-lock no-error.
if not available cancel
then do:
find first cancel where can.can-con-num = sld.con-num
and can.can-pre-num = sld.pre-num
no-lock no-error.
if not available cancel
then do:
find first cancel where can.can-con-num = sld.con-num
no-lock no-error.
end. /* if-do */
end. /* if-do */
end. /* if-do */
if not available contract
and not available cancel
then
next.
if available contract
then do:
if con.con-job = "J"
then
next.
end. /* if-do */
else
if can.can-job = "J"
then
next.
if sv-brnsin = "B"
or sv-brnsin = "T"
then do:
find first sw-cons where sw-cons.sla-code = sld.sla-code no-error.
if not available sw-cons
then do:
create sw-cons.
assign sw-cons.sla-code = slde.sla-code
sw-cons.emp-num = slde.emp-num.
end. /* if-do */
end. /* if-do */
status default "{process.t}" + "... " + sld.sla-code + sld.con-num.
if sld.ame-type = 406
or sld.ame-type = 407
or sld.ame-type = 409
or sld.ame-type = 310
or sld.ame-type = 312
or sld.ame-type = 404 /* Negative Sales Adjustment */
or sld.ame-type = 405 /* Positive Sales Adjustment */
then do: /* Cancellations */
find first lb-sld where lb-sld.con-num = sld.con-num
and lb-sld.pre-num = sld.pre-num
and lb-sld.pro-code = sld.pro-code
and lb-sld.sld-date ge sv-date-from
and lb-sld.sld-date le sv-date-to
and (lb-sld.ame-type = 20
or lb-sld.ame-type = 400)
no-lock no-error.
if available lb-sld
then
lv-new-bus = true.
else
lv-new-bus = false.
end. /* if-do */
else
lv-new-bus = sld.sld-new-bus.
if lv-new-bus = true
then do:
if sld.ame-type = 307
or sld.ame-type = 303
or sld.ame-type = 314 /* API */
or sld.ame-type = 315 /* Percentage price increase. */
then do:
assign sw-prod.inc-val = sw-prod.inc-val
+ (sld.sld-value - sld.sld-old-val).
end. /* if-do */
else do:
if emp.emp-comm = true
then
assign sw-prod.new-qty = sw-prod.new-qty
+ (sld.sld-qty - sld.sld-old-qty)
sw-prod.new-val = sw-prod.new-val
+ (sld.sld-value - sld.sld-old-val).
end. /* else-do */
if sv-brnsin = "B"
or sv-brnsin = "T"
then do:
if sld.ame-type = 307
or sld.ame-type = 303
or sld.ame-type = 314 /* API */
or sld.ame-type = 315 /* Percentage price increase */
then do:
assign sw-cons.inc-val = sw-cons.inc-val
+ (sld.sld-value - sld.sld-old-val).
end. /* if-do */
else do:
assign sw-cons.new-qty = sw-cons.new-qty
+ (sld.sld-qty - sld.sld-old-qty)
sw-cons.new-val = sw-cons.new-val
+ (sld.sld-value - sld.sld-old-val).
end. /* else-do */
end. /* if-do */
end. /* if-do */
else do:
if sld.ame-type = 307
or sld.ame-type = 303
or sld.ame-type = 314 /* API */
or sld.ame-type = 315 /* Percentage price increase */
then do:
assign sw-prod.inc-val = sw-prod.inc-val
+ (sld.sld-value - sld.sld-old-val).
end. /* if-do */
else do:
if emp.emp-comm = true
then
assign sw-prod.exs-qty = sw-prod.exs-qty
+ (sld.sld-qty - sld.sld-old-qty)
sw-prod.exs-val = sw-prod.exs-val
+ (sld.sld-value - sld.sld-old-val).
end. /* else-do */
if sv-brnsin = "B"
or sv-brnsin = "T"
then do:
if sld.ame-type = 307
or sld.ame-type = 303
or sld.ame-type = 314 /* API */
or sld.ame-type = 315 /* Percentage price increase */
then do:
assign sw-cons.inc-val = sw-cons.inc-val
+ (sld.sld-value - sld.sld-old-val).
end. /* if-do */
else do:
assign sw-cons.exs-qty = sw-cons.exs-qty
+ (sld.sld-qty - sld.sld-old-qty)
sw-cons.exs-val = sw-cons.exs-val
+ (sld.sld-value - sld.sld-old-val).
end. /* else-do */
end. /* if-do */
end. /* else-do */
if emp.emp-comm = true
then do:
if sld.ame-type ne 303
and sld.ame-type ne 307
and sld.ame-type ne 314 /* API */
and sld.ame-type ne 315 /* Percentage price increase */
then do:
assign sw-prod.tot-qty = sw-prod.tot-qty
+ (sld.sld-qty - sld.sld-old-qty)
sw-prod.tot-val = sw-prod.tot-val
+ (sld.sld-value - sld.sld-old-val).
end. /* else-do */
end. /* if-do */
if sv-brnsin = "B"
or sv-brnsin = "T"
then do:
if sld.ame-type ne 307
and sld.ame-type ne 303
and sld.ame-type ne 314 /* API */
and sld.ame-type ne 315 /* Percentage price increase */
then do:
assign sw-cons.tot-qty = sw-cons.tot-qty
+ (sld.sld-qty - sld.sld-old-qty)
sw-cons.tot-val = sw-cons.tot-val
+ (sld.sld-value - sld.sld-old-val).
end. /* else-do */
end. /* if-do */
end. /* for-each */
/* Print out totals for last consultant */
if sv-any-data = false
then do:
if sv-all-consult = false
then
sv-cur-area = sv-sla-code.
end. /* if-do */
run kr350a1.p.
put stream ss-rep skip(1) "{eor.t}".
{kg30.i &stream = "stream ss-rep" }