Format |
Generated COBOL |
---|---|
9 |
PIC 9. |
99 |
PIC 99 |
999 |
PIC 999 |
9999 |
PIC 9999 |
9(n) |
PIC 9(n) |
9n |
PIC 9(n) |
9&variable |
PIC 9(&variable) |
A |
PIC A. |
AA |
PIC AA. |
AAA |
PIC AAA. |
A(n) |
PIC A(n). |
An |
PIC A(n). |
A&variable |
PIC A(&variable). |
C |
PIC S9 COMP. |
C(n) |
PIC S9(n) COMP. |
Cn |
PIC S9(n) COMP. |
C-3 |
PIC S9 COMP-3. |
Cn-3 |
PIC S9(n) COMP-3. |
C&variable |
PIC S9(&variable) COMP. |
C&variable+-3 |
PIC S9(&variable) COMP-3. |
F|FULL |
PIC S9(9) COMP. |
H|HALF |
PIC S9(4) COMP. |
I|INDEX |
INDEX. (For [USAGE IS] INDEX) |
N |
PIC 9. |
N(n) |
PIC 9(n). |
Nn |
PIC 9(n). |
N&variable |
PIC 9(&variable). |
P|POINTER |
POINTER. |
|
(For COBOL/2 only: [USAGE IS] POINTER.) |
R|REDEF| REDEFINES |
REDEFINES dataname. |
S |
PIC S9. |
S(n) |
PIC S9(n). |
Sn |
PIC S9(n). |
S&variable |
PIC S9(&variable). |
SYNC |
SYNCHRONIZED |
V(n) |
PIC V9(n). |
Vn |
PIC V9(n). |
V&variable |
PIC V9(&variable). |
Vvalueclause |
VALUE valueclause. |
X |
PIC X. |
XX |
PIC XX. |
XXX |
PIC XXX. |
XXXX |
PIC XXXX. |
Xn |
PIC X(n). |
X(n) |
PIC X(n). |
X&variable |
PIC X(&variable). |
... |
Continuation of a format |
A8 generates PIC A(8).
WORK1-FIELD1 X(13) ... V'13 CHARS LONG' WORK1-FIELD2 X(120) ... VALUE 'A LONG LITERAL MAY ... BE CONTINUED ON ONE OR ... MORE LINES'
9&variable+V5 generates PIC 9(&variable)V9(5).
N8V4 generates PIC 9(8) V9(4). N8 V4 generates PIC 9(8) VALUE 4.
The following illustrates using indentation to create level numbers:
Data Structure Editor code
000001 PROG-SPECIFIC-WORKING-DATA 000002 PGWS-FIELD1 000003 PGWS-FIELD2 000004 PGWS-FIELD3 000005 PGWS-FIELD4 000006 PGWS-FIELD5 000007 PGWS-FIELD6 000008 PGWS-FIELD7 X13 000009 ... V'ABCDEFGHIJKL' 000010 PGWS-FIELD8 000011 PGWS-FIELD9 000012 PGWS-FIELD10 N13
Generated COBOL code
01 PROG-SPECIFIC-WORKING-DATA. 05 PGWS-FIELD1. 10 PGWS-FIELD2. 15 PGWS-FIELD3. 20 PGWS-FIELD4. 25 PGWS-FIELD5. 30 PGWS-FIELD6. 35 PGWS-FIELD7 PIC X(13) VALUE 'ABCDEFGHIJKL'. 15 PGWS-FIELD8. 20 PGWS-FIELD9. 25 PGWS-FIELD10 PIC 9(13).