This commit is contained in:
Ingy döt Net 2013-10-27 22:24:23 +00:00
parent 6f050a029e
commit 776bba907c
3887 changed files with 59894 additions and 7280 deletions

View file

@ -0,0 +1,5 @@
MOVE 5 TO x
MOVE FUNCTION SOME-FUNC(x) TO y
MOVE "foo" TO z
MOVE "values 1234" TO group-item
SET some-index TO 5

View file

@ -0,0 +1,18 @@
01 normal-date.
03 year PIC 9(4).
03 FILLER PIC X VALUE "-".
03 month PIC 99.
03 FILLER PIC X VALUE "-".
03 dday PIC 99. *> Misspelling is intentional; day is a reserved word.
01 reversed-date.
03 dday PIC 99.
03 FILLER PIC X VALUE "-".
03 month PIC 99.
03 FILLER PIC X VALUE "-".
03 year PIC 9(4).
...
PROCEDURE DIVISION.
MOVE "2012-11-10" TO normal-date
MOVE CORR normal-date TO reversed-date
DISPLAY reversed-date *> Shows '10-11-2012'

View file

@ -0,0 +1,4 @@
01 a PIC X(20). *> a is a string of 20 characters.
01 b PIC 9(10). *> b is a 10-digit integer.
01 c PIC 9(10)V9(5). *> c is a decimal number with a 10-digit integral part and a 5-digit fractional part.
01 d PIC 99/99/99. *> d is an edited number, with a slash between each pair of digits in a 6-digit integer.

View file

@ -0,0 +1,10 @@
*> Group data items do not have a picture clause.
01 group-item. *> The 'implied' PIC for group-item is PIC X(20).
03 sub-data PIC X(10).
03 more-sub-data PIC X(10).
*> Example use of FILLER.
01 formatted-data.
03 part-one PIC X(10).
03 FILLER PIC X.
03 part-two PIC X(10).

View file

@ -0,0 +1,11 @@
DATA DIVISION.
WORKING-STORAGE SECTION.
01 initialized-data PIC X(15) VALUE "Hello, World!".
01 other-data PIC X(15).
...
PROCEDURE DIVISION.
DISPLAY initialized-data *> Shows 'Hello, World!'
DISPLAY other-data *> Will probably show 15 spaces.
...
*> Sets initialized-data back to "Hello, World!" and fills other-data with spaces.
INITIALIZE initialized-data, other-data

View file

@ -0,0 +1,3 @@
01 group-item VALUE "Hello!12345".
03 a-string PIC X(6). *> Contains "Hello!"
03 a-number PIC 9(5). *> Contains '12345'.

View file

@ -0,0 +1,8 @@
some-str (1:1) *> Gets the first character from the string
some-num (1:3) *> Get the first three digits from the number
another-string (5:) *> Get everything from the 5th character/digit onwards.
*> To get a proper array slice, you must use reference modification on its parent data item:
some-table-area (4:6) *> Get 6 characters from the array after from the 4th char onwards
*> To reference modify an array element
some-table (1) (5:1) *> Get the 5th character from the 1st element in the table