This example passes data entered on a screen to a report. The script includes the customer format, runs the input screen and then the report, and the report picks up the customer code by including the same format.

Report definition

ENTRY-SECTION
DN START-CODE(6)
! Include the format from the screen that holds the Customer Code
I101 FORMAT INCLUDE #I4FCUST, OPT="NONE"
I102 LET START-CODE = #I4FCUST.CUST-CODE
FILE-SECTION
! Customer Code different size in each file.
LN UTCUST SELECT WHEN CUST-CODE = START-CODE(1,4)
CONTROL-SECTION
REPORT-SECTION
H
H LL-RRRRRR XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
H MM/DD/YY
H
D XXXX $###,###.00
D XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
D XXXXXXXXXXXXXXXXXXXX
D XXXXXXXXXXXXXXXXXXXX, XX XXXXXXXXXX

Script source

MAINLINE
FORMAT INCLUDE #I4FCUST ! Include customer format
DIM SCREEN$[17] ! Dimension array
LET SCREEN$[9]=$01$ ! Fields to maintain
LET SCREEN$[13]="YY Y" ! Screen inicators
LET SCREEN$[15]="F" ! set to logical screen
CONNECT SCREEN "I4SCUST" ! Connect to the Screen for Input
CONNECT REPORT "I4RCUSTF" ! Connect to the Report

Notes

  • Both the script and the report include #I4FCUST. Because the script includes it first, the report sees the values entered on the screen. The report includes it with OPT=“NONE”.
  • The customer code is a different size in each file, so the report selects on START-CODE(1,4).

Search tbred.com