module ButlerMainframe::GenericFunctions
Public Instance Methods
abend?()
click to toggle source
Check if there was a malfunction on the mainframe
# File lib/mainframe/customization/generic_functions.rb, line 211 def abend? /DFHA/i === catch_abend end
catch_abend()
click to toggle source
Get the abend message
# File lib/mainframe/customization/generic_functions.rb, line 206 def catch_abend scan(:y1 => 23, :x1 => 1, :y2 => 23, :x2 => 80) end
catch_message(options={})
click to toggle source
Get the message line usually in the bottom of the screen You can define which rows provide the message:
:first_row => 22, :last_row => 23
# File lib/mainframe/customization/generic_functions.rb, line 197 def catch_message options={} options = { :first_row => 22, :last_row => 23 }.merge(options) scan(:y1 => options[:first_row], :x1 => 1, :y2 => options[:last_row], :x2 => 80).gsub(/\s+/, " ").strip end
catch_title(options={})
click to toggle source
Get the title usually the first row You can change default option :rows to get more lines starting from the first
# File lib/mainframe/customization/generic_functions.rb, line 217 def catch_title(options={}) options = { :rows => 1 }.merge(options) scan(:y1 => 1, :x1 => 1, :y2 => options[:rows], :x2 => 80) end
cics?()
click to toggle source
Check if we are the first blank cics screen
# File lib/mainframe/customization/generic_functions.rb, line 129 def cics? scan(:y1 => 1, :x1 => 1, :y2 => 22, :x2 => 80).strip.empty? end
cics_selection(ar_cics)
click to toggle source
On this map, we have to select the cics environment param1 cics(array) [text, y, x]
# File lib/mainframe/customization/generic_functions.rb, line 163 def cics_selection ar_cics puts "Starting selezione_cics..." if @debug cics, y_cics, x_cics = ar_cics raise "Check cics configuration! #{cics} #{y_cics} #{x_cics}" unless cics && y_cics && x_cics wait_session raise "It was waiting cics selezion map instead of: #{catch_title}, message: #{catch_message}" unless cics_selection? write(cics, :y => y_cics, :x => x_cics) do_enter wait_session 1 end
cics_selection?()
click to toggle source
Check the label to know when we are on the cics selection map
# File lib/mainframe/customization/generic_functions.rb, line 157 def cics_selection? /#{ButlerMainframe::Settings.cics_selection_tag}/i === catch_title end
destination_list()
click to toggle source
If you add your static screen you must add it in the navigation method to define how to manage it
# File lib/mainframe/customization/generic_functions.rb, line 6 def destination_list [:company_menu, :cics_selection, :session_login, :next, :back] end
do_confirm()
click to toggle source
# File lib/mainframe/customization/generic_functions.rb, line 235 def do_confirm; exec_command("PF3") end
do_enter()
click to toggle source
# File lib/mainframe/customization/generic_functions.rb, line 233 def do_enter; exec_command("ENTER") end
do_erase()
click to toggle source
# File lib/mainframe/customization/generic_functions.rb, line 237 def do_erase; exec_command("ERASE EOF") end
do_quit()
click to toggle source
# File lib/mainframe/customization/generic_functions.rb, line 236 def do_quit; exec_command("CLEAR") end
execute_cics(name)
click to toggle source
# File lib/mainframe/customization/generic_functions.rb, line 228 def execute_cics(name) write(name, :y => 1, :x => 2) do_enter end
go_back()
click to toggle source
# File lib/mainframe/customization/generic_functions.rb, line 234 def go_back; exec_command("PA2") end
screen_title(options={})
click to toggle source
# File lib/mainframe/customization/generic_functions.rb, line 223 def screen_title(options={}) show_deprecated_method 'catch_title' catch_title(options) end
session_login(ar_user, ar_password)
click to toggle source
Login to mainframe param1 user(array) [text, y, x] param2 password(array) [text, y, x]
# File lib/mainframe/customization/generic_functions.rb, line 141 def session_login(ar_user, ar_password) puts "Starting session login..." if @debug user, y_user, x_user = ar_user raise "Check session user configuration! #{user} #{y_user} #{x_user}" unless user && y_user && x_user password, y_password, x_password = ar_password raise "Check session password configuration! #{password} #{y_password} #{x_password}" unless password && y_password && x_password wait_session #inizializza_sessione raise "It was waiting session login map instead of: #{catch_title}" unless session_login? write(user, :y => y_user, :x => x_user) write(password, :y => y_password, :x => x_password, :sensible_data => true) do_enter end
session_login?()
click to toggle source
Check if we are on the login mainframe screen
# File lib/mainframe/customization/generic_functions.rb, line 134 def session_login? /#{ButlerMainframe::Settings.session_login_tag}/i === catch_title end