There are two ways to display two subfiles at once--one above the other or side by side. OS/400 directly supports the first method. The trick is in the way we read and write to the subfiles in the RPG program.
Here's the DDS for display file SFLDEMO1, which has two subfiles:
A DSPSIZ(24 80 *DS3)
A CA03 CA12
A
A R SFL1 SFL
A DATA1 20 2 2
A
A R CTL1 SFLCTL(SFL1)
A SFLDSP
A SFLDSPCTL
A N01 SFLEND(*MORE)
A SFLSIZ(9)
A SFLPAG(8)
A 1 5'SFL 1'
A RRN1 4S 0H
A
A R SFL2 SFL
A DATA2 20 12 2
A
A R CTL2 SFLCTL(SFL2)
A SFLDSP
A SFLDSPCTL
A N01 SFLEND(*MORE)
A SFLSIZ(9)
A SFLPAG(8)
A OVERLAY
A 11 5'SFL 2'
A RRN2 4S 0H
Here's the RPG program that drives it:
Fsfldemo1d cf e workstn sfile(sfl1: rrn1)
F sfile(sfl2: rrn2)
/free
for rrn1 = 1 to 27;
data1 = '1:' + %char(rrn1);
write sfl1;
endfor;
for rrn2 = 1 to 34;
data2 = '2:' + %char(rrn2);
write sfl2;
endfor;
write ctl1;
exfmt ctl2;
read ctl1;
*inlr = *on;
Notice the I/O operations. First write to the first subfile control format, use the EXFMT op code to write and read the second control format, and, finally, read the first control format. It works every time. Which subfile rolls, depends on where the cursor is located. To roll a certain subfile, place the cursor on the subfile or on its control record.
Side by side subfile has to be handled by programming as OS/400 will not handle it automatically.
Wednesday, October 17, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment