USE ARG databases., guiwindow
PARSE SOURCE . . script_name
full_path = FILESPEC('D', script_name) || FILESPEC('P', script_name)
filein = full_path"ODBC_connect_strings.txt"
rc = STATE(filein)
IF rc <> 0 THEN
RETURN -1
STREAM(filein, 'C', 'OPEN READ')
LOADTEXT('DB.', filein)
STREAM(filein, 'C', 'CLOSE')
sw_heading = 0
menu_item = 1
databases.0 = 0
DO i = 1 TO db.0
db.i = STRIP(db.i)
SELECT
WHEN LEFT(db.i,1) = '*' THEN
NOP
WHEN db.i == '' THEN
NOP
OTHERWISE
DO
databases.0 = databases.0 + 1
databases.[databases.0] = db.i
PARSE VAR db.i . '=' next_db':' .
IF sw_heading = 0 THEN
DO
err = guiaddmenu('DB2 Source', 'HEADING', 1)
sw_heading = 1
END
err = guiaddmenu(next_db, 'ITEM', 1 menu_item)
menu_item = menu_item + 1
END
END
END
menu_item = menu_item - 1
RETURN menu_item |