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: いいところ来たね。 === いいところ来たね。 COBOL は C 系と発想が全然違うので、混乱しやすい。 ==== : ==== つまり: * <code>\</code> はただの1文字 * <code>\\</code> と書いても特別な意味はない * <code>'\'</code> も <code>"\"</code> も普通に書ける(処理系次第) ==== ### ==== <syntaxhighlight lang="cobol">MOVE "\" TO WS-CHAR. MOVE '\' TO WS-CHAR. </syntaxhighlight> * どちらも 1文字の <code>\</code> * エスケープ解釈はしない ※ ダブルクォート / シングルクォートは 同じ意味(文字列リテラル) ==== COBOLのルールは 重ね書き。 ==== <syntaxhighlight lang="cobol">MOVE "A""B" TO WS-TEXT. * → A"B MOVE 'A''B' TO WS-TEXT. * → A'B </syntaxhighlight> * \ は使わない * "" や '' で表す ==== <syntaxhighlight lang="cobol">01 WS-CHAR PIC X. ==== 01 WS-TEXT PIC X(10). </syntaxhighlight> * \ も普通の文字として格納 ==== <syntaxhighlight lang="cobol"> IDENTIFICATION DIVISION. ==== PROGRAM-ID. TEST. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-CHAR PIC X. 01 WS-TEXT PIC X(5). PROCEDURE DIVISION. MOVE "\" TO WS-CHAR MOVE "A\B" TO WS-TEXT DISPLAY WS-CHAR DISPLAY WS-TEXT STOP RUN. </syntaxhighlight> ==== - 古い処理系では - ダブルクォート非対応 - シングルクォートのみ ==== * EBCDIC環境 - \ 自体が無い / 位置が違うこともあった ==== | | | ==== | --- | --- | | | | | | | | | | | | | ==== : ==== もし次に行くなら * JCL / EBCDIC での <code>\</code> 問題 * COBOL 方言(IBM / 富士通 / 日立)の差 * JSON を COBOL で扱うときの地雷 どれ行く?
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)