FileOpenInLine

Get help with the installation and running of the Zeus IDE. Please do not post bug reports or feature requests here. When in doubt post your question here.
Post Reply
pwdiener
Posts: 134
Joined: Wed Jul 11, 2007 3:45 pm

FileOpenInLine

Post by pwdiener »

I'm trying to get open in line to work for me in a COBOL program, looking at COPY books. When I was doing PC-based COBOL, it was common for the line to read COPY "filename.CPY", which Zeus could parse to a file name easily. On the AS400 system I'm working on now, it's more common for the line to read COPY filename without any extension, which makes if more difficult to find filename.CBL as it exists on my disk.

I'll be writing a macro to bind to the appropriate key to do this. I'm assuming that I've got to parse the line (or marked area) to find the filename myself, right? Any other ideas than that approach? How does Zeus do that parsing, and is it possible for me to see (in my macro) what it thinks is the file name?

Also, what does FileOpenAssociateInLine do? It doesn't seem to be in the help file, but I see it in the keyboard mapping dialog.

Bill
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

How does Zeus do that parsing
Zeus uses a whole bunch of regular expressions to try and find the filename.
is it possible for me to see (in my macro) what it thinks is the file name?
You could try using the Lua pattern matching. The Lua code would look something like this:

Code: Select all

current_line = get_line_text()

local index, length, filebase = string.find(current_line, "COPY ([%w:]+)")

if filebase ~= nil then
    file_name = filebase .. ".CPY"
    message("File found in current line: " .. file_name)
    --file_open(file_name)
else
    message("No file found in current line.")
end
Also, what does FileOpenAssociateInLine do?

It opens the file in the associated Windows application.
It doesn't seem to be in the help file, but I see it in the keyboard mapping dialog.
I will look for fix that.

Cheers Jussi
Post Reply