Top
NetCOBOL V11.0 Syntax Samples
FUJITSU Software

1.18 SYMBOLIC CHARACTERS Clause

The SYMBOLIC CHARACTERS clause is specified when assigning names to character codes. The SYMBOLIC CHARACTERS clause can be used for assigning names to control characters.

000010 @OPTIONS MAIN
000020*----------------------------------------------------------------------
000030* In this sample, the SYMBOLIC CHARACTERS clause is used to control the 
000035* TAB character code.
000040* Executing this sample creates a sequential file named SAMPLE.TXT in 
000050* the current folder (directory).
000060*----------------------------------------------------------------------
000070 IDENTIFICATION   DIVISION.
000080 PROGRAM-ID.      SAMPLE.
000090 ENVIRONMENT      DIVISION.
000100 CONFIGURATION    SECTION.
000110*----------------------------------------------------------------------
000120* The integer specified in the SYMBOLIC CHARACTERS clause is the 
000130* sequential position of a character in the character set.  That is, 
000135* the integer indicates the order of a character in the 
000140* list where X"00" in the ASCII code table is 1. Because the TAB code 
000145* is X"09", 10 is specified for the integer.
000150*----------------------------------------------------------------------
000160 SPECIAL-NAMES.
000170         SYMBOLIC CHARACTERS TAB IS 10.
000180*----------------------------------------------------------------------
000190 INPUT-OUTPUT     SECTION.
000200 FILE-CONTROL.
000210      SELECT TXT-FILE ASSIGN TO "SAMPLE.TXT"
000220                      ORGANIZATION IS LINE SEQUENTIAL.
000230 DATA             DIVISION.
000240 FILE             SECTION.
000250 FD TXT-FILE.
000260 01 TXT-REC       PIC X(80).
000270 PROCEDURE        DIVISION.
000280     OPEN OUTPUT TXT-FILE.
000290*----------------------------------------------------------------------
000300* The defined symbolic character can be used in the same way as a 
000305* nonnumeric literal.
000310* For this example, the symbolic character is used in a concatenation 
000315* expression.
000320*----------------------------------------------------------------------
000330     MOVE "Fujitsu Ltd." & TAB & "Sales department" & TAB & 
000335          "Fujitsu Taro" TO TXT-REC.
000340*----------------------------------------------------------------------
000350     WRITE TXT-REC.
000360     CLOSE TXT-FILE.
000370 END PROGRAM SAMPLE.