Subfile:
- Load All Subfile (Click Here to see more about Load All Subfile with an example).
- Expandable Subfile
- Single Page Subfile
Expandable Subfile:
**Free
// ------------------------------------------------------------------------
// Expandable Subfile - Example Program
// ------------------------------------------------------------------------
// Input File
Dcl-F PPTESTFILE Keyed ;
// Expandable Subfile
Dcl-F PPEXPSFLD WorkStn Sfile(PPSFL01 : wRRN) ;
// Stand-Alone Variables Declaration
Dcl-S wNoOfRecords Packed(1 : 0) ;
Dcl-S wRrn Packed(4 : 0) ;
Dcl-S wError Ind ;
Dcl-S wNoOptions Packed(4 : 0) ;
// ------------------------------------------------------------------------
// Main Process
// ------------------------------------------------------------------------
ExSr SrInitializeSubfile ;
ExSr SrLoadSubfile ;
ExSr SrDisplaySubfile ;
ExSr SrFinalRoutine ;
// ------------------------------------------------------------------------
// Initialize Subfile Routine
// ------------------------------------------------------------------------
BegSr SrInitializeSubfile ;
*In25 = *Off ;
*In26 = *Off ;
*In27 = *On ;
wRrn = 0 ;
SRrn = 1 ;
Write PPCTL01 ;
*In26 = *On ;
*In27 = *Off ;
Setll *Start PPTESTFILE ;
EndSr;
// ------------------------------------------------------------------------
// Load Subfile Routine
// ------------------------------------------------------------------------
BegSr SrLoadSubfile ;
wNoOfRecords = 0 ;
Read PPTESTFILE ;
Dow Not %Eof(PPTESTFILE)
And wNoOfRecords < 8
And wRrn < 9999 ;
SFIELD1 = TFIELD1 ;
SFIELD2 = TFIELD2 ;
SFIELD3 = TFIELD3 ;
SFIELD4 = TFIELD4 ;
wRrn += 1 ;
wNoOfRecords += 1;
Write PPSFL01 ;
If wNoOfRecords < 8 ;
Read PPTESTFILE ;
EndIf ;
EndDo;
wNoOfRecords = 0 ;
If %Eof(PPTESTFILE) or wRRN = 9999 ;
*In40 = *On ;
EndIf;
EndSr;
// ------------------------------------------------------------------------
// Display Subfile Routine
// ------------------------------------------------------------------------
BegSr SrDisplaySubfile ;
Dow *In03 = *Off ;
If wRrn > 0 ;
*In25 = *On ;
EndIf;
If CsrRrn > 0 ;
SRrn = CsrRrn ;
EndIf ;
Write PPFTR01 ;
Exfmt PPCTL01 ;
Select ;
When *In03 = *On ;
Leave ;
When *In41 = *On ;
ExSr SrLoadSubfile ;
CsrRrn = 0 ;
SRrn += 8 ;
Other ;
ExSr SrValidateOptions ;
If wError ;
MESSAGE = 'Ivalid Options Selected.' ;
Else ;
ExSr SrProcessOptions ;
EndIf ;
EndSl;
EndDo;
EndSr;
// ------------------------------------------------------------------------
// Validate Subfile Options
// ------------------------------------------------------------------------
BegSr SrValidateOptions ;
wError = *Off ;
ReadC PPSFL01 ;
Dow Not %Eof(PPEXPSFLD) ;
If SOpt <> '5' And SOpt <> ' ' ;
wError = *On ;
*In60 = *On ;
Else ;
*In60 = *Off ;
EndIf;
*In70 = *On ;
Update PPSFL01 ;
ReadC PPSFL01 ;
EndDo;
EndSr;
// ------------------------------------------------------------------------
// Process Subfile Options
// ------------------------------------------------------------------------
BegSr SrProcessOptions ;
wNoOptions = 0 ;
ReadC PPSFL01 ;
Dow Not %Eof(PPEXPSFLD) ;
If SOpt = '5' ;
wNoOptions += 1 ;
EndIf ;
ReadC PPSFL01 ;
EndDo ;
If wNoOptions > 0 ;
MESSAGE = %Char(wNoOptions) + ' Records Selected.' ;
EndIf ;
EndSr;
// ------------------------------------------------------------------------
// Final Routine
// ------------------------------------------------------------------------
BegSr SrFinalRoutine ;
*InLr = *On;
EndSr;
Comments
Post a Comment