The below code is the extraction of my sales records from a multi-member file. Currently hard coded to member 04 for testing purposes. The member name as variable with EXTMBR( ).
I am thinking I could have combined this code with my extract and load program but decided to go with a two step process instead. I also thought about using SQL and creating a table but don't have the time to figure it out right now.
If anyone has a suggestions please pass them on.
*************************************************************************
Fvog012d3 if e disk usropn extmbr(@mbr)
Fmidslyrspfuf a e disk
D @mbr s 5a Member name
D mbrNum s 2a Member number
D mbrCnt s 2s 0 inz(04) Member number
************************************************************************
* Main Routine
************************************************************************
/free
// dou mbrCnt = 13;
mbrNum = %editc(mbrCnt:'X'); // Convert month counter to alpha
@mbr = 'R0M' + mbrNum; // Member name variable
if not %open(vog012d3);
open vog012d3; // Sales history open the file
endif;
read vog012d3; // Read all records
dow not %eof(vog012d3);
if dscde <> '3' or dscde <> '4'; // Exclude discount codes 3 and 4
vstr = str; // Store
vdte = date; // Transaction date
vseq = seq; // transaction sequece
vcls = cls; // Class code
vtr# = tran; // Register ID
vqty = qty; // Quantity
vpri = price; // Price
vdsc = dscnt; // Discount
vven = vend; // Vendor
vsty = styl; // Style
vclr = color; // Color
vsiz = size; // Size
write mdslsr;
endif;
read vog012d3;
enddo;
close vog012d3; // Close file
// mbrcnt = mbrCnt + 1; // Add 1 to counter to advance to next
// member
// enddo; // Loop through all the members
*inlr = *on; // See ya!
/end-free
Have a great Friday!
~Richard