Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Openai/694305e8-d7f8-800e-a8d8-fbf410be6545
(section)
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Assistant: OK、OSが Windows の場合に限定してきっちりまとめるね。 === OK、OSが Windows の場合に限定してきっちりまとめるね。 ==== : ==== つまり: <syntaxhighlight lang="cobol">"C:\data\input.txt" </syntaxhighlight> で 基本OK。 * \\ にしない * エスケープしない * \ はただの文字 ==== ### ==== <syntaxhighlight lang="cobol">SELECT INFILE ASSIGN TO "C:\data\input.txt". </syntaxhighlight> * NetCOBOL / Enterprise COBOL for Windows / GnuCOBOL(Windows) * ほぼ共通で動く ===== <syntaxhighlight lang="cobol">01 WS-PATH PIC X(256). ===== MOVE "C:\data\input.txt" TO WS-PATH. SELECT INFILE ASSIGN TO WS-PATH. </syntaxhighlight> * 可変パス * 環境差対応 ===== <syntaxhighlight lang="cobol">SELECT INFILE ASSIGN TO WS-PATH. ===== </syntaxhighlight> バッチ: <syntaxhighlight lang="bat">set PATH=C:\data\input.txt program.exe %PATH% </syntaxhighlight> ==== <syntaxhighlight lang="cobol">"C:/data/input.txt" ==== </syntaxhighlight> * 処理系依存 * Win32 API が解釈できても COBOLランタイムが弾くことあり 👉 実務では非推奨 ==== <syntaxhighlight lang="cobol">"\\server\share\file.txt" ==== </syntaxhighlight> * そのまま書ける * 2文字の \ × 2回 <syntaxhighlight lang="cobol">MOVE "\\server\share\file.txt" TO WS-PATH. </syntaxhighlight> ==== ### ==== <syntaxhighlight lang="cobol">"C:\\data\\input.txt" </syntaxhighlight> * COBOLでは \ が2文字 * 結果: <syntaxhighlight>C:\\data\\input.txt </syntaxhighlight> * ファイルが見つからない ===== <syntaxhighlight lang="cobol">"C:¥data¥input.txt" ===== </syntaxhighlight> * 見た目同じでも 別文字 * 実行時エラー ==== - \ は1個だけ? ==== * 全角¥が混ざってない? * UNCなら \\server\share ? * JSON等経由なら \\ 必要? ==== : ==== エスケープ地獄は 他言語側の問題。 次に行くなら * GnuCOBOL (Windows) の実際の挙動 * Visual COBOL / NetCOBOL の差 * PowerShell 連携時の注意 どこまで掘る?
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)