-
Record Formats on DSPF?
- Subfile Record Format
- - describes the fields that are to appear in the list
- A R SFLEXTSFL SFL
- Subfile Control Record Format
- - must immediately follow Subfile Record Format
- - controls the subfile records' display
- A R SFLEXTCTL SFLCTL(SFLEXTSFL)
- Footer Record Format
- - to display function keys and Errors
- A R SFLEXTBOT
-
Subfile Control Keywords
- SFLCTL
- - identifies a record as a subfile control record for SFL
- SFLDSP
- - displays SFL if active (*Ind = *On)
- SFLDSPCTL
- - enables the display of any fields described w/i the control record format
- SFLSIZ
- - indicates # of records in the SFL (up to 9,999)
- SFLPAG
- - defines how many records are to appear at once
- SFLCLR
- - clear the SFL if active (*Ind = *On)
- SFLEND
- - displays + sign or More... ind, so user can use page keys
- OVERLAY
- - for SF RF, so footer RF is not erased when SF is displayed
- PAGEDOWN
- - detect when user pressed Page Down key
- - usually in opposite indicator with SFLEND
- PAGEUP
- - detect when user pressed Page Up key
- SFLRCDNBR
- - to specify that the SF list page to display is one w the list entry whose RRN is in this variable
-
SFLCTL
- - Subfile Control Keyword
- - identifies a record as a subfile control record for SFL
- A R CUSTCTL SFLCTL(CUSTSFL)
-
SFLSIZ
- - indicates # of records in the SFL (up to 9,999)
- A SFLSIZ(0053)
-
SFLPAG
- - defines how many records are to appear at once
- A SFLPAG(0010)
-
SFLDSP
- - displays SFL if active (*Ind = *On)
- A 90 SFLDSP
-
SFLDSPCTL
- - enables the display of any fields described w/i the control record format
- A 91 SFLDSPCTL
-
SFLCLR
- - clear the SFL if active (*Ind = *On)
- A 92 SFLCLR
-
SFLEND
- - displays + sign or More... ind, so user can use page keys
- A 93 SFLEND(*MORE)
-
OVERLAY
- - for SF RF, so footer RF is not erased when SF is displayed
- A OVERLAY
-
PAGEDOWN
- - detect when user pressed Page Down key
- - usually in opposite indicator with SFLEND
- A N93 PAGEDOWN(94)
-
PAGEUP
- - detect when user pressed Page Up key
- A PAGEUP(95)
-
SFLRCDNBR
- to specify that the SF list page to display is one w the list entry whose RRN is in this variable
- SFLRCDNBR[([CURSOR] [*TOP])]
- - CURSOR
- - cursor is placed in the subfile record whose RRN is identified by the contents of this field
- - *TOP
- - subfile record whose RRN is identified by the contents of this field will display as the first record of the page
- - if S_RRN = 12
- - SF will display the page, that contains RRN = 12
- - if 2 pages of 7 records each are loaded (14 records), SF will display second page, which contains RRN = 12
A S_RRN 4S 0H SFLRCDNBR(CURSOR)
-
Steps to perform SFL
- 1) Clear Subfile
- - turn ON SflClear
- - write to Subfile Control
- - turn OFF SflClear
- 2) Position Subfile
- - position to selected row
- - clear selection field
- 3) Load Subfile
- - in loop read each record from the file
- - add 1 to Rrn
- - write Rrn record to SFL
- - out of loop
- - turn SflDsp ON if any records in SFL
- - turn SflDspCtl ON
- 4) Display Subfile
- - write Footer RF
- - Exfmt SFL Control RF (wait for user respond)
- - display current page (if user will not change it)
-
Types of SFL
- 1) Self-extending Subfile - SFLSIZ > SFLPAG
- - every Pagedown just adds records to the subfile w/o cleaning it
- 2) Subfile Partial - Load page-by-page - SFLSIZE = SFLPAGE
- - every Pagedown cleains SF before and than adds records
- - every Crawl Back process is performed
- 3) Subfile All - Loading the entire Subfile - SFLSIZE > SFLPAGE
- - clear SFL
- - load entire SFL
- - Display SFL
-
Clear Subfile
- SflClear = *On; // - turn ON SflClear
- Write SFLEXTCTL; // - write to Subfile Control
- SflClear = *Off; // - turn OFF SflClear
- Rrn = 0; // - clear Rrn of the SFL
- S_RRN = 1; // - preset SFLRCDNBR to display 1st record of SFL
-
Position Subfile
- Setll DCUSTNO CUSTSRECT; // - position to selected row
- Clear DCUSTNO; // - clear selection field
-
Load SFL ALL
- ClearSfl(); // clear SF before to load all records
- Dou %Eof(Customerst);
- Read CUSTSRECT; // read file to the end
-
- If %Eof(CUSTOMERST); // if end of file
- SflEnd = *on; // turn on SflEnd
- Leave; // leave the loop
- Endif;
- Rrn +=1; // add 1 to RRN
- Write SFLALLSFL; // write Rrn record to SFL
- Enddo;
- SflDsp = (Rrn > 0); // turn SflDsp ON if any records in SFL
- SflDspCtl = *on; // turn SflDspCtl ON
-
Load SFL Partial
Every Page Down
- ClearSfl(); // - every Page Down - clear SF every time before loading SF
- For X=1 To 7; // load 7 records to SFL
- Read CUSTSRECT;
-
- If %Eof(CUSTOMERST); // if end of file
- SflEnd = *on; // turn on SflEnd
- Leave; // leave the loop
- Endif;
- Rrn +=1; // add 1 to RRN
- Write SFLALLSFL; // write Rrn record to SFL
- Endfor;
- SflDsp = (Rrn > 0); // turn SflDsp ON if any records in SFL
- SflDspCtl = *on; // turn SflDspCtl ON
- Every Page Up
- If SflEnd; // if previous SF reached end of the file
- Setgt *Hival CUSTSRECT; // reposition file to the last record
- Rrn += 1;
- Endif;
- // reposition cursor to 2 pages up
- For X=1 To (Rrn + 7); // Rrn=7 (Rrn + 7)=14
- // cursor on 14th row (2nd page)
- Readp CUSTSRECT; // - read prior row 14 times (to previous page)
- If %Eof(CUSTOMERST); // - if Readp reached beginning of the file
- Setll *Loval CUSTSRECT; // reposition file to the first record
- Leave; // and leave
- Endif;
- Endfor;
-
Load Self-extending Subfile
- every Pagedown just adds records to the subfile w/o cleaning it
- For X=1 To 7; // load 7 records to SFL
- Read CUSTSRECT;
-
- If %Eof(CUSTOMERST); // if end of file
- SflEnd = *on; // turn on SflEnd
- Leave; // leave the loop
- Endif;
- Rrn +=1; // add 1 to RRN
- Write SFLALLSFL; // write Rrn record to SFL
- Endfor;
- SflDsp = (Rrn > 0); // turn SflDsp ON if any records in SFL
- SflDspCtl = *on; // turn SflDspCtl ON
-
Declaration of DSPF with SFL
- Dcl-f Sflext Workstn Sfile(SFLEXTSFL:Rrn) Indds(Indicators)
- Infds(Sflextinfo);
- - Sfile
- - to define internally the subfiles that are specified in an externally described WORKSTN file
- - Rrn
- - positon of the record within the SF (must be declare w/i the program)
- Dcl-s Rrn Zoned(4:0);
- - Infds(Sflextinfo)
- - Information DS (must be declare w/i the program)
- Dcl-ds Sflextinfo;
- MIN_RRN INT(5) POS(378);
- NUM_RCDS INT(5) POS(380);
- End-ds;
- - MIN_RRN
- - lowest RRN on the page of the SF
- - NUM_RCDS
- - numer of records in the subfile
- - after loading second page (7 records) SF has 14 records and first record of the second page is 8
- - MIN_RRN = 8
- - NUM_RCDS = 14
-
Window KW
- to specify that the record format you are defining will be displayed using
- a window.
- A WINDOW(8 19 7 38)
- - 8 - row position
- - 19 - column position
- - 7 - height - inside
- - 38 - length - inside
-
Keep KW
record-level keyword to keep the display from being deleted when the display file is closed.
A KEEP
-
Assume KW
to assume that the record is already shown on the display when the display file is opened.
A ASSUME
-
Overlay KW
to specify that the record format that you are defining should appear on the display without the entire display being deleted first.
A OVERLAY
-
WDWBORDER KW
- to specify the color, display attributes, and characters used to form
- the border of a window.
- WDWBORDER([color] [display-attribute] [characters])
- WDWBORDER((*COLOR YLW) (*DSPATR RI) (*CHAR ' '))
-
RTNCSRLOC KW
to return the location of the cursor to an application program.
- A RTNCSRLOC(&RCD &FLD &POS)
- A FLD 10A H
- A RCD 10A H
- A POS 4S 0H
|
|