I realise it's a strange topic header, but I'll try and describe the scenario. We use a product called Beyond Compare here. It allows you to define an exit so you can "massage" your file before it's shown. I use a reginald exe to change the contents of my mainframe files from EBCDIC to ANSI.
One of the problems is for fixed length files. They are simply a looooooooong string of data - you have to know the length of each record. To that end, my reginald exe discovers the file is fixed length and shows a window that prompts the user for the record length. All well and good, until .... there seems to be some sort of memory/code problem (or whatever) left over after the first time I run it (which runs with no problem).
If I run BC with my reginald exe exit too quickly consecutively, the reginald window is shown, but it's as if I'd pressed OK immediately (without my having done it).
Any suggestions ??
I include the relevant window code
general code TO check the file's record length etc
get_lrecl:
PROCEDURE EXPOSE lrecl_entry
ARG filename
LIBRARY rexxgui
guierr = "SYNTAX"
guiheading = 1
rc = pre_create_window()
IF rc <> 0 THEN
DO
rc = wdwsay.rex('Return code from pre_create_window, rc = 'rc)
RETURN 1
END
guicreatewindow('NORMAL')
guiaddctltext('filename_text', filename)
lrecl_entry = "?"
again:
DO FOREVER
guigetmsg()
IF EXISTS('GuiObject') == 0 THEN DO
IF EXISTS('GuiSignal') THEN DO
END
END
CATCH SYNTAX
CONDITION()
SIGNAL again
CATCH HALT
FINALLY
guidestroywindow()
END
RETURN 0
pre_create_window:
PARSE SOURCE . . guisay_header
UPPER guisay_header
guisay_header = FILESPEC('N', guisay_header)
PARSE VAR guisay_header guisay_header '.' .
registry_value = guisay_header
registry_key = "Software\SHBTOOLS\"||registry_value||'\'
user = TRANSLATE(USERID())
lrecl_entry = get_filename_lrecl()
RETURN 0
get_filename_lrecl:
converted_filename = TRANSLATE(filename,"_","\")
temp = "filename_lrecl\"converted_filename
rc = read_write_registry.rex(temp, lrecl_entry, "R")
IF lrecl_entry = '' THEN
lrecl_entry = "?"
RETURN lrecl_entry
save_last_filename_lrecl:
temp = "filename_lrecl\"converted_filename
rc = read_write_registry.rex(temp, lrecl_entry, "W")
RETURN 0
wm_click_ok_button:
rc = wdwsay.rex('OK button clicked')
guigetctlvalue('lrecl_entry')
SELECT
WHEN 0 = DATATYPE(lrecl_entry, "W") THEN
rc = wdwsay.rex("Not a valid LRECL", "STOP|")
WHEN lrecl_entry < 2 THEN
rc = wdwsay.rex("Enter a valid LRECL (2 or more)", "STOP|")
OTHERWISE
DO
rc = save_last_filename_lrecl()
guisendmsg(,'POST CLOSE')
END
END
RETURN
|