In Example 11.8, the subfile DISPLIST is activated and initialized when the SFLCTL subfile control-record format is written (line 5). The database file CUSTMAST is initially read (line 6). The data from the file CUSTMAST is written to the DISPLIST subfile (line 10) after the subfile record number (RRN) is incremented (line 9). The next CUSTMAST database record is read (line 11) and the DO loop branches to the top of the loop, increments the RRN field, and writes the next subfile record (line 10).
Example 11.8: Write a workstation subfile record.
.....FFileName++IFEASFRlen+LKeylnKFDevice+.Functions++++++++++++++++++++++++++++ 0001 FCUSTINQ CF E WORKSTN SFile(DispList : rrn) 0002 FCUSTMAST IF E K DISK .....CSRn01Factor1+++++++OpCode(ex)Factor2+++++++Result++++++++Len++DcHiLoEq.... 0003 C ACCT KLIST 0004 C KFLD CSTNBR 0005 C write SFLCTL 0006 C ACCT Chain CustRec 71 0007 C Eval EOF = *IN71 0008 C dow EOF = *OFF 0009 C add 1 RRN 5 0 0010 C write DISPLIST 0011 C ACCT ReadE CustRec 75 0012 C eval EOF = *IN75 0013 C endDo 0014 C If RRN > 0 0015 C eval *IN21 = *ON 0016 C write Heading 0017 C exfmt SFLCTL 0018 C endIf
The workstation format HEADING is written (line 16), and then the subfile control record and subfile are sent to, and read from, the workstation (line 17).