Datasheet
Release Notes - New Features included in Release 2.4.0
Page 60 of 89
Scenario:
Given the following data file, containing ACCOUNT15 and SORDNO only, it is required to print
out the order lines (in descending sequence) with the associated product. It then prints out all of the
other orders on the database for the same product. Each group of [order line + product + other
orders] appears in its own DETAIL section.
Data file:
HEADER
ACCOUNT15 000010000100001
SORDNO SS000247
wppform.out file:
>CONTROL
>LOGIC
dbac3=select sorditem into :nd$sorditem \
from mbg140 \
where sordno_itm = :sordno \
and account15_itm = :account15 \
order by sorditem desc;
dbac1=select partno_sord into :d_partno \
from mbg140 \
where sordno_itm = :sordno \
and account15_itm = :account15 \
and sorditem = :nd$sorditem;
dbac2=select sordno_itm,sorditem \
into :d_sordno,:d_sorditem \
from mbg140 \
where partno_sord = :d_partno \
and account15_itm = :account15 \
and sordno_itm != :sordno; # ‘not=’ – to get the other orders
dbac=1 link=nd$sorditem # the 2nd read – get the items given the line number
dbac=2 link=d_partno # the 3rd read – get the other orders given the item number
dbac=3 link=sordno # the 1st read – get the order lines given the order number on the input file and
put each in a new DETAIL section (nd$...).
>HEADER
f.sordno=1,1
>DETAIL=4,50,50
t."--------------------------"=1,1 link=$sd
f.d_partno=2,4 reserve=1,60
f.d_sordno=r2,10
f.nd$sorditem=2,20