码迷,mamicode.com
首页 > 其他好文 > 详细

一步步AS400-Cobol 上手自学入门教程01 - 基础概念(原创)

时间:2016-08-12 11:25:39      阅读:1852      评论:0      收藏:0      [点我收藏+]

标签:

先学习基础概念

1、COBOL字符:包含:

  1.  User-defined words 用户定义字符
  2. ?System-names
  3. ?Reserved words 关键字

2、用户定义字符User-defined words:合法的定义:

  1. ? A - Z
  2. ? a - z
  3. ? 0 - 9
  4. ? - (连字符).

3、系统名 System-names

  1.   Computer-names
  2. ?Language-names
  3. ?Implementor-names:
    1.  Environment-name
    2.  Assignment-name

4、关键词 Reserved words

技术分享
ACCEPT
ACCESS
ACQUIRE 
ADD
ADDRESS 
ADVANCING
AFTER
ALL
ALPHABET
ALPHABETIC
ALPHABETIC-LOWER
ALPHABETIC-UPPER
ALPHANUMERIC
ALPHANUMERIC-EDITED
ALSO
ALTER
ALTERNATE
AND
ANY 
ARE
AREA
AREAS
ARITHMETIC 
ASCENDING
ASSIGN
AT
AUTHOR
AUTO 
AUTO-SKIP 
BACKGROUND-COLOR 
BACKGROUND-COLOUR 
B-AND 
BEEP 
BEFORE
BELL 
B-EXOR 
BINARY
BIT 
BITS 
BLANK
B-LESS 
BLINK 
BLOCK
B-NOT 
BOOLEAN 
B-OR 
BOTTOM
BY
CALL
CANCEL
CD 
CF 
CH 
CHARACTER
CHARACTERS
CLASS
CLOCK-UNITS 
CLOSE
COBOL 
CODE 
CODE-SET
COL 
COLLATING
COLUMN  
COMMA
COMMIT 
COMMITMENT 
COMMON 
COMMUNICATION 
COMP
COMP-3
COMP-4
COMPUTATIONAL
COMPUTATIONAL-3
COMPUTATIONAL-4
COMPUTE
CONFIGURATION
CONNECT 
CONTAINED 
CONTAINS
CONTENT
CONTINUE
CONTROL
CONTROL-AREA 
CONTROLS
CONVERSION 
CONVERTING
COPY
CORR
CORRESPONDING
COUNT
CRT 
CRT-UNDER 
CURRENCY
CURRENT 
CURSOR 
DATA
DATE
DATE-COMPILED
DATE-WRITTEN
DAY
DAY-OF-WEEK 
DB 
DB-ACCESS-CONTROL-KEY 
DB-DATA-NAME 
DB-EXCEPTION 
DB-FORMAT-NAME 
DB-RECORD-NAME 
DB-SET-NAME 
DB-STATUS 
DBCS 
DE 
DEBUG-CONTENTS
DEBUG-ITEM
DEBUG-LINE
DEBUG-NAME
DEBUG-SUB-1
DEBUG-SUB-2
DEBUG-SUB-3
DEBUGGING
DECIMAL-POINT
DECLARATIVES
DEFAULT 
DELETE
DELIMITED
DELIMITER
DEPENDING
DESCENDING
DESTINATION 
DETAIL 
DISABLE 
DISCONNECT 
DISPLAY
DISPLAY-1 
DISPLAY-n 
DIVIDE
DIVISION
DOWN
DROP 
DUPLICATE 
DUPLICATES
DYNAMIC
EGI 
EJECT 
ELSE
EMI 
EMPTY-CHECK 
ENABLE 
END
END-ACCEPT 
END-ADD
END-CALL
END-COMPUTE
END-DELETE
END-DIVIDE
END-EVALUATE
END-IF
END-MULTIPLY
END-OF-PAGE
END-PERFORM
END-READ
END-RECEIVE 
END-RETURN
END-REWRITE
END-SEARCH
END-START
END-STRING
END-SUBTRACT
END-UNSTRING
END-WRITE
ENTER
ENVIRONMENT
EOP
EQUAL
EQUALS 
ERASE 
ERROR
ESI 
EVALUATE
EVERY
EXCEEDS 
EXCEPTION
EXCLUSIVE 
EXIT
EXOR 
EXTEND
EXTERNAL 
EXTERNALLY-DESCRIBED-KEY 
FALSE 
FD
FETCH 
FILE
FILE-CONTROL
FILES 
FILLER
FINAL 
FIND 
FINISH 
FIRST
FOOTING
FOR
FOREGROUND-COLOR 
FOREGROUND-COLOUR 
FORMAT 
FREE 
FROM
FULL 
FUNCTION 
GENERATE
GET 
GIVING
GLOBAL 
GO
GOBACK 
GREATER
GROUP 
HEADING 
HIGHLIGHT 
HIGH-VALUE

HIGH-VALUES
I-O
I-O-CONTROL
ID 
IDENTIFICATION
IF
IN
INDEX
INDEXED
INDEX-N 
INDIC 
INDICATE
INDICATOR 
INDICATORS 
INITIAL
INITIALIZE
INITIATE
INPUT
INPUT-OUTPUT
INSPECT
INSTALLATION
INTO
INVALID
IS
JUST
JUSTIFIED
KEEP 
KEY
LABEL
LAST
LD 
LEADING
LEFT
LEFT-JUSTIFY 
LENGTH
LENGTH-CHECK 
LESS
LIKE 
LIMIT 
LIMITS 
LINAGE
LINAGE-COUNTER
LINE
LINE-COUNTER 
LINES
LINKAGE
LOCALLY 
LOCK
LOW-VALUE
LOW-VALUES
MEMBER 
MEMORY
MERGE
MESSAGE 
MODE
MODIFIED 
MODIFY 
MODULES
MOVE
MULTIPLE
MULTIPLY
NATIVE
NEGATIVE
NEXT
NO
NO-ECHO 
NONE 
NOT
NULL 
NULLS 
NUMBER  
NUMERIC
NUMERIC-EDITED
OBJECT-COMPUTER
OCCURS
OF
OFF
OMITTED
ON
ONLY 
OPEN
OPTIONAL
OR
ORDER
ORGANIZATION
OTHER 
OUTPUT
OVERFLOW
OWNER 
PACKED-DECIMAL
PADDING 
PAGE
PAGE-COUNTER 
PERFORM
PF 
PH 
PIC
PICTURE
PLUS 
POINTER
POSITION
POSITIVE
PRESENT 
PRINTING
PRIOR 
PROCEDURE
PROCEDURES
PROCEED
PROCESS 
PROGRAM
PROGRAM-ID
PROMPT 
PROTECTED 
PURGE 
QUEUE 
QUOTE
QUOTES
RANDOM
RD 
READ
READY 
REALM 
RECEIVE 
RECONNECT 
RECORD
RECORD-NAME 
RECORDS
REDEFINES
REEL
REFERENCE
REFERENCE-MONITOR 
REFERENCES
RELATION 
RELATIVE
RELEASE
REMAINDER
REMOVAL
RENAMES
REPEATED 
REPLACE 
REPLACING
REPORT 
REPORTING 
REPORTS 
REQUIRED 
RERUN
RESERVE
RESET 
RETAINING 
RETRIEVAL 
RETURN
RETURN-CODE 
REVERSED
REVERSE-VIDEO 
REWIND
REWRITE
RD 
RF 
RH 
RIGHT
RIGHT-JUSTIFY 
ROLLBACK 
ROLLING 
ROUNDED
RUN
SAME
SCREEN 
SD
SEARCH
SECTION
SECURE 
SECURITY
SEGMENT 
SEGMENT-LIMIT
SELECT
SEND 
SENTENCE
SEPARATE
SEQUENCE
SEQUENTIAL
SET
SHARED 
SIGN
SIZE
SKIP1 
SKIP2 
SKIP3 
SORT
SORT-MERGE
SORT-RETURN 
SOURCE 
SOURCE-COMPUTER
SPACE
SPACE-FILL 
SPACES
SPECIAL-NAMES
STANDARD
STANDARD-1
STANDARD-2
START
STARTING 
STATUS
STOP
STORE 
STRING
SUB-QUEUE-1 
SUB-QUEUE-2 
SUB-QUEUE-3 
SUB-SCHEMA 
SUBFILE 
SUBTRACT
SUM 
SUPPRESS
SYMBOLIC 
SYNC
SYNCHRONIZED
TABLE 
TALLYING
TAPE
TENANT 
TERMINAL
TERMINATE 
TEST
TEXT 
THAN
THEN
THROUGH
THRU
TIME
TIMES
TITLE 
TO
TOP
TRAILING
TRAILING-SIGN 
TRANSACTION 
TRUE
TYPE 
UNDERLINE 
UNEQUAL 
UNIT
UNSTRING
UNTIL
UP
UPDATE 
UPON
USAGE
USAGE-MODE 
USE
USING
VALID 
VALIDATE 
VALUE
VALUES
VARYING
WAIT 
WHEN
WHEN-COMPILED 
WITH
WITHIN 
WORDS
WORKING-STORAGE
WRITE
ZERO
ZEROES
ZERO-FILL 
ZEROS
<
< =
+
*
**
-
/
>
> =
=
View Code

近500个关键字.

5、节和段 Sections and Paragraphs

层次:

? Identification Division
  Paragraphs
    Entries
      Clauses
? Environment Division
  Sections
    Paragraphs
      Entries
        Clauses
          Phrases
? Data Division
  Sections
    Entries
      Clauses
        Phrases
? Procedure Division
  Sections
    Paragraphs
      Sentences
        Statements
          Phrases 

 备注:

4个部:

  •   1、标识部(IDENTIFICATIONDIVISION):用于标识程序名。
  •   2、环境部(ENVIRONMENTDIVISION):用于说明程序运行的环境。
  •   3、数据部(DATADIVISION):用于说明程序中涉及的所有数据。
  •   4、过程部(PROCEDUREDIVISION):是程序的核心部分,它决定计算机应进行什么操作。


部(Division)一部可包括若干节
节(Section)一节可包含若干段
段(Paragraph)一段可包含若干句子
句子(Sentence)一个句子可包含若干语句
语句(Statement)制定计算机完成一定的操作
子句(Clause)制定完成某一方面的功能

 

 6、Cobol 代码格式

技术分享

  第1至6列为”标号区”
    序列号是可选的。如果使用的话,序列号必须在列1到6
  第7列为”续行标志区”
  第8至此11列,称为”A区”。程序中有些内容如部头,节头,段头,层号01,层号77及文件描述符FD等应从A区开始写。
  第12至此72列,称为”B区”。写程序中的正文部分。如过程部中的句子只能从B区开始写。
  第73至80列,称为”注释区”。

 格式演示:

技术分享

一步步AS400-Cobol 上手自学入门教程01 - 基础概念(原创)

标签:

原文地址:http://www.cnblogs.com/starcrm/p/5763982.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!