[英]Convert Informix 4gl to Genero to create and write to .4gl - error of Permission denied to write to .4gl
我在 Informix 4gl 中有一個代碼,用於創建和寫入 .4gl 文件。 簡而言之,它是生成新程序的代碼。 它在 Informix 中完美運行:**
let p_output = p_prog clipped,".4gl"
start report rpt1 to p_output
output to report rpt1()
finish report rpt1
let run_stmt = "fglpc ",p_prog clipped
run run_stmt returning p_status
if p_status != 0 then
error " Program Compilation failed "
sleep 1
end if
end if
我正在嘗試將代碼轉換為 Genero 以創建並寫入 .4gl 文件。
let p_output = "vi ",p_prog clipped,".4gl"
let p_binoutput = p_prog clipped,".4gl"
LET ch_in = base.Channel.create()
CALL ch_in.openFile(p_binoutput,"w")
start report rpt1 TO p_output
output to report rpt1()
finish report rpt1
--let run_stmt = "fglpc ",p_prog clipped
let run_stmt = "fglcomp ",p_prog clipped
run run_stmt returning p_status
if p_status != 0 then
error " Program Compilation failed "
sleep 1
end IF
CALL ch_in.close()
end if
但是我一直在 sqlca.sqlerrm 中收到錯誤消息:
p_prog.4gl: Permission denied.
或者
vi p_prog.4gl: Permission denied
我怎樣才能解決這個問題?
從 Informix-4gl 移動到 Genero 需要更改的唯一代碼是這行
let run_stmt = "fglpc ",p_prog clipped
到
let run_stmt = "fglcomp ",p_prog clipped
以便您的程序在其生成中使用 Genero 編譯器而不是 Informix 4gl 編譯器。
沒有必要引入 base.Channel 方法的使用。 這是前進到讀/寫文件的首選方式,特別是非分頁輸出,但老派的 START REPORT ... 沒有改變,應該像以前一樣工作。
您看到的錯誤消息會告訴您包裝盒上的內容。 我可以通過刪除對 p_prog.4gl 的寫訪問來獲得它,因此請檢查該文件是否存在以及您的用戶是否具有寫權限。
另一個可能的問題,fglcomp 和 fglrun 功能與它們的 Informix 等價物在當前工作目錄和在同一目錄中混合源和編譯對象相同。 如果使用 Genero Studio,它默認將源對象和編譯對象保存在不同的目錄中,因此要么將 TargetDirectory 更改為不使用 bin,要么注意您的權限、文件位置等,在運行時您可能位於 bin 目錄中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.