PreviousNextIndex

DEFINE STREAM statement

Defines a stream for use in one or more procedures, or within a single class. Use this statement when you want to use streams other than the two ABL built-in unnamed streams. Using additional streams allows you to get input from more than one source simultaneously or to send output to more than one destination simultaneously.

Syntax

DEFINE { [ [ NEW [ GLOBAL ] ] SHARED ] | [ PRIVATE ] } STREAM stream-name 

NEW SHARED STREAM stream-name
NEW GLOBAL SHARED STREAM stream-name
SHARED STREAM stream-name
[ PRIVATE ] STREAM stream-name
STREAM stream-name
Examples

This procedure, in a single pass through the item table, uses the rpt stream to create a report and the exceptions stream to create a list of exceptions:

r-dfstr.p
DEFINE VARIABLE fnr     AS CHARACTER NO-UNDO FORMAT "x(12)". 
DEFINE VARIABLE fne     AS CHARACTER NO-UNDO FORMAT "x(12)". 
DEFINE VARIABLE excount AS INTEGER   NO-UNDO 
  LABEL "Total Number of exceptions". 
DEFINE NEW SHARED BUFFER xitem FOR item. 
DEFINE NEW SHARED STREAM rpt. 
DEFINE STREAM exceptions. 
SET fnr LABEL "Enter filename for report output" SKIP(1) 
  fne LABEL "Enter filename for exception output" 
  WITH SIDE-LABELS FRAME fnames. 
OUTPUT STREAM rpt TO VALUE(fnr) PAGED. 
OUTPUT STREAM exceptions TO VALUE(fne) PAGED. 
FOR EACH xitem: 
  IF on-hand < alloc THEN DO: 
    DISPLAY STREAM exceptions  
      xitem.ItemNum xitem.ItemName xitem.OnHand xitem.Allocated 
      WITH FRAME exitem DOWN. 
    excount = excount + 1. 
  END. 
  RUN r-dfstr2.p. 
END. 
DISPLAY STREAM exceptions SKIP(1) excount WITH FRAME exc SIDE-LABELS. 
DISPLAY STREAM rpt WITH FRAME exc. 
OUTPUT STREAM rpt CLOSE. 
OUTPUT STREAM exceptions CLOSE. 

Include the DISPLAY statement in the r-dfstr2.p procedure in the r-dfstr.p procedure for efficiency. (It is in a separate procedure here to illustrate shared streams.)

r-dfstr2.p
DEFINE SHARED STREAM rpt. 
DEFINE SHARED BUFFER xitem FOR Item. 
DISPLAY STREAM rpt ItemNum ItemName WITH NO-LABELS NO-BOX. 

Notes
See also

Class-based data member access, DISPLAY statement, INPUT CLOSE statement, INPUT FROM statement, INPUT THROUGH statement, INPUT-OUTPUT THROUGH statement, OUTPUT CLOSE statement, OUTPUT THROUGH statement, OUTPUT TO statement, PROMPT-FOR statement, RUN statement, SEEK function, SEEK statement, SET statement, Stream object handle


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex