screen size device units # Use resolution of device
font "system" # Use system font
#
# INCLUDE FILE REFERENCE
#
include "eslcmsrv.inc" # ECS declarations file
include "accel.inc" # Include accelerator keys
include "message.inc" # Include message box
# subroutines
#
# VARIABLE DEFINITION
#
boolean variable More_BV is false
string variable ReplyIs_SV # contains reply
MessageIs_SV # contains message
SessionShortName_SV # contains session name
String_SV # contains input string
Watch1_SV # contains watch string
TextRegion_SV # contains name of text region
LineContents_SV # contains line contents
integer variable Top_IV # specifies top margin
Bottom_IV # specifies bottom # margin
Left_IV # specifies left margin
Right_IV # specifies right margin
Row_IV # specifies row number
SettleTime_IV # specifies time in sec.
KeyCode_IV # contains function key
TimeLimit_IV # specifies time in sec.
#
# ACTION BAR DEFINITION
#
action bar ActBar_AB is
pulldown File text " ~File"
disabled choice Open text " ~Open..."
disabled choice New text " ~New"
separator
disabled choice Save text " ~Save"
disabled choice SaveAs text "Save ~As..."
separator
choice Exit text "E~xit\tF3"
accelerator is KEY_F3
end pulldown
pulldown ReportList text " ~Reports"
choice Prodstat text " ~Production Stats" parameter is "PS4471"
choice Defect text " ~Defect Reports" parameter is "DF1678"
choice Warehouse text " ~Warehouse Inventory" parameter is "WI3672"
choice Manufacturing text " ~Manufacturing" parameter is "MF2599"
end pulldown
end action bar
#
# OBJECT DEFINITIONS
#
enabled white primary region Primary_GR size 500 350
at position 75 75
title bar "ABC Manufacturing Company"
system menu
action bar ActBar_AB
minimize button
maximize button
#
# Establish a class of items that includes Report choices:
#
item class RptSelect is Prodstat
Defect
Warehouse
Manufacturing
#
# Create a textual region to show the selected report:
#
invisible blue textual region Text_TR
window size 60 columns 17 lines
at position 120 5 in desktop
title bar "Requested Report"
system menu
vertical scroll bar
border
font "asc814"
#
# SUBROUTINES
#
# Copy current screen into Text textual region, and check if
# there are more screens to come:
subroutine ReadReportPage () is
copy 1 to Top_IV # Initialized margins of screen
copy 24 to Bottom_IV # buffer to be read into textual
copy 1 to Left_IV # region Text copy 80 to Right_IV
copy "Text_TR" to TextRegion_SV # Initialized input variable
# Reads current screen
call EcsReadScreen( Top_IV,Left_IV,Bottom_IV,Right_IV,TextRegion_SV )
copy 22 to Row_IV
call EcsReadLine( Row_IV, LineContents_SV )
switch LineContents_IV is
case char "- More -" is
copy true to More_BV
default is
copy false to More_BV
end switch
# At first page of report, read all pages into Text_TR textual
# region:
subroutine GetPages () is
call ReadReportPage()
call EcsClearWatch( Watch1_SV ) # Clear watch string
copy 4000 to SettleTime_IV # Reset watch string
call EcsWatchForIIOff( SettleTime_IV, Watch1_SV )
while ( More_BV) loop
copy ECS_CMD1 to KeyCode_IV # Get next page if "- More -"
call EcsPressKey( KeyCode_IV) # is displayed
call EcsWatchAndWait( TimeLimit_IV, Watch1_SV )
if ( EcsWaitGaveUp ) then
copy false to More_BV
else
call ReadReportPage()
end if
end loop
copy ECS_CMD7 to KeyCode_IV # Return to menu screen
call EcsPressKey( KeyCode_IV ) # Continued
#
# Log off from the AS/400:
#
subroutine Logoff () is
copy "Logging off.." String "." to MessageIs_SV
# Code to log off from AS/400 should be placed here.
#...
# # RESPONSE DEFINITIONS #
response to start
copy "A" to SessionShortName_SV
call EcsConnect( SessionShortName_SV )
# Code to log on to the AS/400 should be placed here.
#...
response to item RptSelect # Class of reports
call EcsClearWatch( Watch1_SV )
copy 7000 to TimeLimit_IV
copy 5000 to SettleTime_IV
call EcsWatchForIIOff( SettleTime_IV, Watch1_SV )
copy parameter to String_SV call EcsTypeString( String_SV )
call EcsPressENTER()
call EcsWatchAndWait( TimeLimit_IV, Watch1_SV )
if ( EcsWaitGaveUp ) then # Put up message box
copy "Could not get report " String "." to MessageIs_SV
copy ( ReplyToMessage("System Problems",
MessageIs,
MessageOK,
MessageOK,
MessageIconHand)) to ReplyIs_SV
make Text_TR invisible
else
call GetPages()
make Text_TR visible
end if
response to item Exit
call Logoff()
call EcsDisconnect()
exit
response to Primary_GR on close
call Logoff()
call EcsDisconnect()
exit