0% found this document useful (0 votes)
103 views2 pages

Subfile Synchronization

The document describes a technique for synchronizing records across multiple subfiles. It involves using the relative record number (RRN) of the last displayed subfile. When the user navigates between different subfile views using function keys, the last RRN is stored in a field to ensure the same group of records is displayed. The DDS and RPG code segments in Figure 4 show how to implement this by placing the last RRN in a hidden SFLRCDNBR field in each subfile record. This allows the subfiles to remain synchronized as the user views different parts of the customer records.

Uploaded by

alovana
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views2 pages

Subfile Synchronization

The document describes a technique for synchronizing records across multiple subfiles. It involves using the relative record number (RRN) of the last displayed subfile. When the user navigates between different subfile views using function keys, the last RRN is stored in a field to ensure the same group of records is displayed. The DDS and RPG code segments in Figure 4 show how to implement this by placing the last RRN in a hidden SFLRCDNBR field in each subfile record. This allows the subfiles to remain synchronized as the user views different parts of the customer records.

Uploaded by

alovana
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Subfile Synchronization

Written by Sunday, 30 April 1995 18:00 - Last Updated Sunday, 30 April 1995 18:00

Do you have a program that uses multiple subfiles? Do you want to keep the records in all of the subfiles synchronized? I have a simple technique to solve the problem.

Suppose you have a program that presents three views of a list of customer records-phone number, billing address, and shipping address. Each view is displayed through a different subfile. The program allows the user to rotate through the three different views by pressing a function key. If the user pages forward on the phone numbers view and then requests the billing address view, you want the program to display the same group of records that were displayed on the phone number view. If the user requests the shipping address view, you also want the same group of records to appear.

My technique uses the relative-record number (RRN) of the last subfile displayed. This RRN can be obtained through the File Information Data Structure (INFDS) in positions 378-379. In the example, whenever F11 is pressed, a counter called SCREEN increments. By placing the last RRN of the last display in the Subfile Record Number (SFLRCDNBR) field, the subfile records stay synchronized. (Make sure that the SFLRCDNBR field has a value when the subfile is first displayed. Otherwise, the program will issue a device error for trying to write a record with an RRN value of 0.) The last subfile displayed moves its value into the first subfile, so the view starts from the beginning again. The SCREEN field is also reset to 0.

4 contains DDS and RPG code segments for this technique.

Figure 4 contains DDS and RPG code segments for this technique.

- Michael Veit

Subfile Synchronization

DDS Required in Each Subfile Record *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 * * Subfile A's hidden field for subfile record positioning * A REC01 4S 0H SFLRCDNBR(CURSOR) * * Subfile B's hidden field for subfile record positioning * A REC02 4S 0H SFLRCDNBR(CURSOR) * * Subfile C's hidden field for subfile record positioning * A REC03 4S

Figure 4 DDS and RPG Code Segments for Subfile Synchronizat

1/2

Subfile Synchronization
Written by Sunday, 30 April 1995 18:00 - Last Updated Sunday, 30 April 1995 18:00

0H SFLRCDNBR(CURSOR) RPG Required to Synchronize Multiple Subfiles Records * * Relative record number of the lowest subfile record number * displayed on page * *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 IWSDS DS I B 378 3790RTNRRN * * F11 changes view (controls which subfile is displayed) C *IN11 IFEQ *ON C ADD 1 SCREEN C ENDIF * C SELEC * C SCREEN WHEQ 1 C EXFMTSUBFA C Z-ADDRTNRRN REC02 * C SCREEN WHEQ 2 C EXFMTSUBFB C Z-ADDRTNRRN REC03 * C SCREEN WHEQ 3 C EXFMTSUBFC C Z-ADDRTNRRN REC01 C Z-ADD0 SCREEN * C ENDSL *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7

2/2

You might also like