I have a program that populates a data structure with various customer information and passes the DS to a print program. Right now this is all hard coded in the calling program. I want to externalize how the data structure is populated for each customer. Ideally, I want to have a file that contains the customer number and field names from an order file. This file will contain the from position and length within the data structure to place the value that is in the field. I am using the following code to populate data structure MRGDTA
The problem is after each iteration of the loop, MRGDTA contains the value ?ORCUST? instead of the value contained in the field ORCUST specified in C1FIELD. In other words if C1FROM = 1 and C1LENG contains 10 and C1FIELD contains ?ORCUST? and ORCUST = ?SMITH?, I want to place ?SMITH? in posn 1 ? 10 of MRGDTA
Can anyone think of a better/different way to do this
Code:
Setll wkCust Reffile; Dou %Eof(Reffile); Reade wkCust Reffile; If not %Eof(Reffile); %Subst(Mrgdta:C1from:C1Leng) = %CHAR(C1field); Endif; Enddo;
Can anyone think of a better/different way to do this
Comment