Skip to content

Environment Division

The Environment Division describes the program’s environment.

General Format:

       [ [ ENVIRONMENT DIVISION. ] 
       [ [ CONFIGURATION SECTION. ] 
              [ SOURCE-COMPUTER. source-computer-paragraph ] 
              [ OBJECT-COMPUTER. object-computer-paragraph ] 
              [ SPECIAL-NAMES. [ special-names-paragraph ] 
              [ REPOSITORY.    [ repository-paragraph ] ] ] 
       [ [ INPUT-OUTPUT SECTION. ] 
              [ FILE-CONTROL. ] { file-control-entry } ... 
              [ I-O-CONTROL. [ i-o-control-entry ] ] ] ]

Syntax:

The division header for the Environment Division is optional.

General Rules:

The General Rules for the Statements and Clauses of the Environment Division entries are described below.

Configuration Section

Source-computer

The SOURCE-COMPUTER paragraph describes the computer on which the source program is compiled.

General Format:

       SOURCE-COMPUTER. [ src-computer-name   ]. 
                        [ WITH DEBUGGING MODE ] .

Syntax:

  1. The SOURCE-COMPUTER clause is recognized, and syntax is validated. However, the SOURCE-COMPUTER clause is otherwise treated as commentary.
  2. The WITH DEBUGGING MODE clause is recognized, and syntax is validated. However, the WITH DEBUGGING MODE clause is otherwise treated as commentary.

General Rules:

  1. COBOL-IT supports conditional debugging lines with the use of the –fdebugging-line compiler flag.
  2. The effect of using the –fdebugging-line compiler flag is to treat conditional debugging lines as normal source lines. Conditional debugging lines are lines that contain a “D” in column 7.

Object-computer

The OBJECT-COMPUTER paragraph names the computer on which the program is to be run.

General Format:

       OBJECT-COMPUTER. [ obj-computer-name ] . 
              [ MEMORY SIZE integer {WORDS     } ] 
                                    {CHARACTERS} 
              [ PROGRAM COLLATING SEQUENCE IS alphabet-name ] 
              [ SEGMENT-LIMIT IS integer-literal ] .

Syntax:

  1. obj-computer-name is a user-defined word or sequence of words that identifies the computer on which the program is run.
  2. alphabet-name is an alphabet name that is described in Special-Names, or EBCDIC.
  3. obj-computer-name is treated as commentary.
  4. The MEMORY SIZE clause is treated as commentary.
  5. The PROGRAM COLLATING SEQUENCE clause causes the program to use the collating sequence of alphabet-name to determine the truth value of nonnumeric comparisons.
  6. The SEGMENT-LIMIT clause is recognized, and syntax is validated. However, the SEGMENT-LIMIT clause is otherwise treated as commentary.

General Rules:

The PROGRAM COLLATING SEQUENCE clause also applies to non-numeric sort and merge keys. However, the COLLATING SEQUENCE phrase in a SORT or MERGE statement takes precedence over the PROGRAM COLLATING SEQUENCE clause.

Special-names

The SPECIAL-NAMES paragraph describes different aspects of the operating environment.

General Format:

       SPECIAL-NAMES.
              [ {switch-name} [ IS mnemonic-name-1 ] 
                {system-name} 
              [ {ON } STATUS IS switch-status ] ... ] ... 
                {OFF} 
              [ {alphabet-entry } ... ] 
                     where alphabet-entry can have format: 

                     ALPHABET alphabet-name IS {NATIVE} 
                                               {STANDARD-1} 
                                               {STANDARD-2} 
                                               {EBCDIC} 
                     and alphabet-entry may also have format: 
                            ALPHABET alphabet-name IS 
                     {alphabet-literal-1 [ THRU alphabet-literal-2 ] } ... 
                                         [ {ALSO alphabet-literal-3 } ...] 
       [ LOCALE locale-name IS locale-reference ] 

       [ SYMBOLIC CHARACTERS 
              { {symbol-char}  {IS } (char-val}  }  
                                {ARE} 
              [ IN alphabet-name ]] 

       [ CLASS class-name IS 
              { [{THROUGH} literal-2 ]}...]... 
                            {THRU  } 
       [ CURRENCY SIGN IS currency-literal ] 
       [ DECIMAL-POINT IS COMMA ] 
       [ CALL-CONVENTION number IS mnemonic-name-1 ] 
       [ CURSOR IS cursor-pos ] 
       [ CRT STATUS IS crt-status-var ] 
       [ NUMERIC [ SIGN [IS] {LEADING} 
                             {TRAILING} 
                             {SEPARATE} ]].

Syntax:

  1. switch-name is one of the 36 system switches, SWITCH-1, SWITCH-2, SWITCH-3, SWITCH-4, SWITCH-5, SWITCH-6, SWITCH-7… SWITCH-36.
  2. system-name is one of the following: CONSOLE, CSP, SYSIN, SYSIPT, SYSOUT, SYSLIST, SYSLST, SYSERR, PRINTER, TERMINAL.
  3. mnemonic-name-1 a user-defined word. When associated with a switch, it is used to change the state of the switch. When used with a system-name, it is used in ACCEPT and DISPLAY statements to refer to the named device.
  4. switch-status is a user-defined word that represents the ON or OFF status of a program switch.
  5. alphabet-name is a user-defined word.
  6. alphabet-literal-n may be either numeric or alphanumeric. When numeric, it is restricted to the range of 1 through 256.
  7. locale-name is a user-defined word that refers to a locale.
  8. locale-reference is a mnemonic that can be used to refer to the locale-name.
  9. class-name is a user-defined word that describes a class, defined by the following VALUE-1 THROUGH VALUE-2 clause.
  10. literal-n is a numeric or alphanumeric literal.
  11. currency-literal is a one-character alphanumeric literal used to represent a currency.
  12. cursor-pos is the name of a numeric data item described in the working-storage section.
  13. crt-status-var is a numeric data item described as PIC 9(4) that is declared in the working-storage section.
  14. numeric defines a default sign storage convention, when the sign storage for a data item is not specified.
  15. symbol-char is a user-defined word that names the symbolic-character.
  16. char-val is an integer that indicates the ordinal position of a character in the native character set.

General Rules:

The General Rules for the SPECIAL-NAMES clauses are described below.

Switch name

Switches are condition tests that are associated with switch-statuses. A switch can be set to TRUE or FALSE, and the switch-status can be interrogated programmatically.

General Format:

       [ {switch-name} [ IS mnemonic-name-1 ] 
              {system-name} 
       [ {ON } STATUS IS switch-status ] ... ] ... 
              {OFF}

Syntax:

  1. mnemonic-name is a user-defined word.
  2. switch-status is a user-defined word that represents the ON or OFF status of a program switch.
  3. SW0 is an alias of SWITCH-1, SW1 an alias of SWITCH-2, …

General Rules:

  1. There is a limit of 36 switches that may be set in SPECIAL-NAMES, with ON STATUS and OFF STATUS condition names.
  2. [mnemonic-name-n] is used as the target of the SET statement to set the state of a switch.
  3. Switch-status is used as the target of the IF statement to test the state of a switch.
  4. SW0 to SW15 are supported as aliases of SWITCH-1 to SWITCH-16.
  5. S01 through S05 are supported.
  6. CSP is supported.

Code Sample:

      * 
       IDENTIFICATION DIVISION. 
       PROGRAM-ID. SWITCH-1. 
       ENVIRONMENT DIVISION. 
       CONFIGURATION SECTION. 
       SPECIAL-NAMES. 
              SWITCH 1 IS SWITCH-1 
                     ON STATUS IS SET-CHECK 
                     OFF STATUS IS SKIP-CHECK. 
       DATA DIVISION. 
       WORKING-STORAGE SECTION. 
       77 DUMMY PIC X. 
       PROCEDURE DIVISION. 
       MAIN. 
              SET SWITCH-1 TO ON. 
              IF SET-CHECK 
                     DISPLAY "SWITCH 1 SET" LINE 10 COL 10 
              END-IF. 

              DISPLAY "SWITCH-1 FINISHED!" LINE 12 COL 10. 
              ACCEPT DUMMY LINE 12 COL 30. 
              STOP RUN.

Alphabet

General Format:

[ {alphabet-entry } ... ]

where alphabet-entry can have format:

       ALPHABET alphabet-name IS {NATIVE} 
                                 {STANDARD-1} 
                                 {STANDARD-2} 
                                 {EBCDIC}

and alphabet-entry may also have format:

       ALPHABET alphabet-name IS 
              {alphabet-literal-1 [ THRU alphabet-literal-2 ] } ... 
              [ {ALSO alphabet-literal-3 } ...]

Syntax:

  1. alphabet-name is a user defined word.
  2. alphabet-literal-n may be e ither numeric or alphanumeric. When numeric, it is restricted to the range of 1 through 256.

General Rules:

  1. The Format 1 ALPHABET clause may be used for COLLATING SEQUENCES or character translations.
  2. ALPHABET clauses can be used in the following cases:
    • For COLLATING SEQUENCES
      • In the SELECT of an INDEXED file for ordering of indexed keys:
        COLLATING SEQUENCE is alphabet-name
      • In a SORT or MERGE statement for ordering of sort/merge keys:
        COLLATING SEQUENCE is alphabet-name
      • In the OBJECT COMPUTER paragraph for alphanumeric comparisons, and default collating sequence for SORT/MERGE statements:
        PROGRAM COLLATING SEQUENCE is alphabet-name
    • For character translations
      • In the FD of a SEQUENTIAL file:
        CODE SET is alphabet-name
  3. In an ALPHABET, the first character in the collating sequence is the LOW-VALUES character for that ALPHABET. The last character in the collating sequence is the HIGH-VALUES character for that ALPHABET.
  4. The Format 2 ALPHABET clause may be used only for COLLATING SEQUENCES.
    Characters are listed in the order of their position in the collating sequence.
  5. Characters not named are assigned a position greater than the listed characters, in native order.
  6. Numeric designations refer to a character’s ordinal position in the native character set.

THROUGH/THRU phrase

The THROUGH/THRU phrase designates a set of contiguous characters in the native character set, and assign them successive ascending positions in the alphabet.

ALSO phrase

The ALSO phrase assigns alphabet-literal-1 and alphabet-literal-3 the same position in the collating sequence.

CLASS

CLASS provides a user-defined name with defined parameters that can be used in conditional statements.

General Format:

       [ CLASS class-name IS 
              { literal-1 [ {THROUGH} literal-2 ] } ... ] ... 
                            {THRU   }

Syntax:

literal-n is a numeric or alphanumeric literal.

General Rules:

  1. The CLASS clause creates user-defined class-name, and describes the numeric and alphanumeric characters that are included in the CLASS.
  2. A data item belongs to the user-defined class-name if it consists entirely of the characters listed in the CLASS clause for class name.
  3. Literal-1 and literal-2 may be numeric, or alphanumeric.
  4. When literal-1 and literal-2 are numeric, they represent the ordinal position in the ASCII table of the character that they represent, with the first ordinal position representing null values “00”. As a further example, the number 1 (hex 31, decimal 49) would be represented by the literal 50.
  5. When using the THRU phrase, literal-1 and literal-2 must be represented numerically. The THRU phrase causes all of the contiguous characters between the ordinal position in the ASCII table marked by literal-1 and the ordinal position in the ASCII table marked by literal-2 to be included in the CLASS.
  6. THRU and THROUGH are synonyms.

Code sample:

       IDENTIFICATION DIVISION. 
       PROGRAM-ID. class-test. 
       ENVIRONMENT DIVISION. 
       CONFIGURATION SECTION. 
       SPECIAL-NAMES. 
              CLASS ALL-VOWELS IS "A", "E", "I", "O", "U", "Y" 
              CLASS ALL-DIGITS IS 49 THRU 58. 

       DATA DIVISION.
       WORKING-STORAGE SECTION. 
       77 TEST-LETTERS PIC X(6) VALUE "AEIOUY". 
       77 TEST-NUMBERS PIC 9(10) VALUE 1234567890. 
       77 WS-DUMMY PIC X. 

       PROCEDURE DIVISION. 
       0000-MAIN. 
              IF TEST-LETTERS IS ALL-VOWELS 
                     DISPLAY "Test letters are all vowels!" LINE 10 COL 10. 
              IF TEST-NUMBERS IS ALL-DIGITS 
                     DISPLAY "Test numbers are all digits!" LINE 12 COL 10. 
              ACCEPT ws-dummy line 12 col 40. 
              STOP RUN.

Currency sign

CURRENCY SIGN designates a 1-character literal to be used in numeric-edited variable declarations containing a currency symbol.

General Format:

[ CURRENCY SIGN IS currency-literal ]

Syntax:

currency-literal is a one character alphanumeric literal used to represent a currency.

General Rules:

  1. In the absence of any CURRENCY SIGN designation, the dollar sign “$” is recognized as the currency symbol.
  2. Currency-literal is the currency sign recognized as the currency symbol for purposes of numeric edited variables that contain a currency sign.

Call-convention

The CALL-CONVENTION syntax can be used to control which mechanisms the COBOL program should use when calling a subprogram, or which mechanisms it expects to have been used by the program which calls it. Each calling convention you want to use should be declared in the Special-Names paragraph. Here you can assign one of the call convention numbers, defined below, to a user-defined mnemonic name for later use.

General Format:

[CALL-CONVENTION number IS mnemonic]

Syntax:

  1. number is a numeric literal representing the call convention .
  2. mnemonic is a user-defined word used just after the CALL verb to modify the current call convention.

General Rules:

The call convention number is a 16-bit number defined as follows:

Bit Meaning
0-1 Unsupported
2 = 0 - RETURN-CODE is updated on exit
= 1 - RETURN-CODE is not updated on exit
3 = 0 –CALL is resolved dynamically at run time
= 1 –CALL is resolved statically at compilation time
4-5 Unsupported
6 Windows Only
= 0 –CALL use standard C call conventions.
= 1 –CALL use “STDCALL” WINAPI call conventions (used to call Windows standard API).

Typical values are:

  • 4
    Do not modify RETURN-CODE
  • 72
    Windows API Call.

CALL-CONVENTION is not supported with ENTRY declarations/.

Code sample:

       IDENTIFICATION DIVISION. 
       PROGRAM-ID. prog2. 
       ENVIRONMENT DIVISION. 
       CONFIGURATION SECTION. 
       SPECIAL-NAMES. 
              CALL-CONVENTION 4 IS VOIDCALL. 

       ... 

       PROCEDURE DIVISION. 
       A01. 
              MOVE 19 TO RETURN-CODE. 
              CALL VOIDCALL "callee" . 
      *RETURN-CODE Still equal to 19 what ever callee returns

Cursor

CURSOR returns information about the location of the cursor in an ACCEPT statement, through the variable cursor-pos.

General Format:

[ CURSOR IS cursor-pos ]

Syntax:

cursor-pos is the name of a numeric data item described in the working-storage section or local storage section of the program.

General Rules:

  1. cursor-pos can be declared as a PIC X or PIC 9 field, and can be declared to be either 4 bytes in length, or 6 bytes in length.
  2. cursor-pos must be declared in the WORKING-STORAGE SECTION, or LOCAL-STORAGE SECTION of the program.
  3. If cursor-pos is 4 bytes in length, bytes 1-2 store the line number of the cursor, and bytes 3-4 store the column number of the cursor.
  4. If cursor-pos is 6 bytes in length, bytes 1-3 store the line number of the cursor, and bytes 4-6 store the column number of the cursor.
  5. When using SPECIAL NAMES CURSOR and the SCREEN SECTION:
    If the program changes the value of cursor-pos, the next ACCEPT field or screen will move the cursor to the required position.
  6. ACCEPT SCREEN attempts to place the the cursor for purposes of input to the value stored in cursor-pos. If the value stored in cursor-pos does not correspond to the location of an input field, the cursor is moved to the best matching field.

Crt status

CRT STATUS returns information about the status of an ACCEPT [Screen] statement when an ON EXCEPTION statement is included in the ACCEPT [Screen] statement.

General Format:

[ CRT STATUS IS crt-status-var ].

Syntax:

crt-status-var can be described as either an alphanumeric data item described as PIC 9(X) or as a numeric data item described as UNSIGNED-INT, that is declared in the working-storage section.

General Rules:

The manner in which crt-status-var is updated can depend on the setting of certain environment variables, compiler flags, and compiler configuration flags. See the table below for default behaviors, for associated environment variables:

Condition Key-pressed CIT Value of CRT STATUS
Default [Enter]/[Return] 0
F1 1001
F2 1002
F3 1003
F4 1004
F5 1005
F6 1006
F7 1007
F8 1008
F9 1009
F10 1010
F11 1011
F12 1012
On ACCEPT <Screen> / <Field> where COB_SCREEN_EXCEPTIONS=Y Page Up 2001
Page Down 2002
Up Arrow 2003
Down Arrow 2004
Print 2006
Where COB_SCREEN_ESC=Y Esc 2005
Where COB_SCREEN_RAW_KEYS=Y Home 2007
End 2008
Ins 2009
Del 2010
Erase EOL 2011

Alternatively, it is possible to create your own CRT STATUS Map, using the compiler configuration flag crtstatus-map, as follows:

crtstatus-map: cit-value user-value

Note that the manner in which user-value is encoded depends on how the crt-status-var is declared. When crt-status-var is declared as UNSIGNED-INT, the runtime copies user-value directly into the crt-status-var. For this case, if you wish to remap the first four function keys, from CIT-Values of 1001 through 1004 to single digits 1 through 4, you would add the entries:

  • crtstatus-map: 1001 1
  • crtstatus-map: 1002 2
  • crtstatus-map: 1003 3
  • crtstatus-map: 1004 4

The use of hex notation (x00 through x127) to describe user-value is supported. For this case, if you wish to remap the first four function keys, from CIT-Values of 1001 through 1004 to single digits 1 through 4, you would add the entries:

  • crtstatus-map: 1001 x31
  • crtstatus-map: 1002 x32
  • crtstatus-map: 1003 x33
  • crtstatus-map: 1004 x34

Hex notations permit the user to use values that fall outside of the normal alphanumeric range. More than one character can be represented using hex notation. For example, if you wish to map the cit-value of 1004 to the user-value of 1234 using hex notation, you would add the entry:

crtstatus-map 1004 x31323334

In the example above, note that in the description of the user-value, after the “x”, the values “31”, “32”, “33”, “34” are concatenated to represent the string “1234”. When using hex notations, it is recommended that the receiving field be described as PIC X(4).

If no crtstatus-map is defined , CRT STATUS values are converted to PIC 9(4) and copied into the crt-status-var.

screenio.cpy

The file screenio.cpy is installed in the %COBOLITDIR%\copy folder in Windows and the $COBOLITDIR/share/cobol-it/copy directory for Linux/Unix. screenio.cpy contains a number of level-78 constant declarations that are useful in screen I-O handling, including constant declarations for the default CRT-STATUS values that are returned by function keys, and on certain screen errors, in addition to screen color values.

The contents of screenio.cpy:

      *> Colors as defined by the Cobol standard
       78 COB-COLOR-BLACK   VALUE 0.
       78 COB-COLOR-BLUE    VALUE 1.
       78 COB-COLOR-GREEN   VALUE 2.
       78 COB-COLOR-CYAN    VALUE 3.
       78 COB-COLOR-RED     VALUE 4.
       78 COB-COLOR-MAGENTA VALUE 5.
       78 COB-COLOR-YELLOW  VALUE 6.
       78 COB-COLOR-WHITE   VALUE 7.
      *>
      *> Values that may be returned in CRT STATUS (or COB-CRT-STATUS)
      *> Normal return - Value 0000
       78 COB-SCR-OK        VALUE 0.
      *> Function keys - Values 1xxx
       78 COB-SCR-F1        VALUE 1001.
       78 COB-SCR-F2        VALUE 1002.
       78 COB-SCR-F3        VALUE 1003.
       78 COB-SCR-F4        VALUE 1004.
       78 COB-SCR-F5        VALUE 1005.
       78 COB-SCR-F6        VALUE 1006.
       78 COB-SCR-F7        VALUE 1007.
       78 COB-SCR-F8        VALUE 1008.
       78 COB-SCR-F9        VALUE 1009.
       78 COB-SCR-F10       VALUE 1010.
       78 COB-SCR-F11       VALUE 1011.
       78 COB-SCR-F12       VALUE 1012.
       78 COB-SCR-F13       VALUE 1013.
       78 COB-SCR-F14       VALUE 1014.
       78 COB-SCR-F15       VALUE 1015.
       78 COB-SCR-F16       VALUE 1016.
       78 COB-SCR-F17       VALUE 1017.
       78 COB-SCR-F18       VALUE 1018.
       78 COB-SCR-F19       VALUE 1019.
       78 COB-SCR-F20       VALUE 1020.
       78 COB-SCR-F21       VALUE 1021.
       78 COB-SCR-F22       VALUE 1022.
       78 COB-SCR-F23       VALUE 1023.
       78 COB-SCR-F24       VALUE 1024.
       78 COB-SCR-F25       VALUE 1025.
       78 COB-SCR-F26       VALUE 1026.
       78 COB-SCR-F27       VALUE 1027.
       78 COB-SCR-F28       VALUE 1028.
       78 COB-SCR-F29       VALUE 1029.
       78 COB-SCR-F30       VALUE 1030.
       78 COB-SCR-F31       VALUE 1031.
       78 COB-SCR-F32       VALUE 1032.
       78 COB-SCR-F33       VALUE 1033.
       78 COB-SCR-F34       VALUE 1034.
       78 COB-SCR-F35       VALUE 1035.
       78 COB-SCR-F36       VALUE 1036.
       78 COB-SCR-F37       VALUE 1037.
       78 COB-SCR-F38       VALUE 1038.
       78 COB-SCR-F39       VALUE 1039.
       78 COB-SCR-F40       VALUE 1040.
       78 COB-SCR-F41       VALUE 1041.
       78 COB-SCR-F42       VALUE 1042.
       78 COB-SCR-F43       VALUE 1043.
       78 COB-SCR-F44       VALUE 1044.
       78 COB-SCR-F45       VALUE 1045.
       78 COB-SCR-F46       VALUE 1046.
       78 COB-SCR-F47       VALUE 1047.
       78 COB-SCR-F48       VALUE 1048.
       78 COB-SCR-F49       VALUE 1049.
       78 COB-SCR-F50       VALUE 1050.
       78 COB-SCR-F51       VALUE 1051.
       78 COB-SCR-F52       VALUE 1052.
       78 COB-SCR-F53       VALUE 1053.
       78 COB-SCR-F54       VALUE 1054.
       78 COB-SCR-F55       VALUE 1055.
       78 COB-SCR-F56       VALUE 1056.
       78 COB-SCR-F57       VALUE 1057.
       78 COB-SCR-F58       VALUE 1058.
       78 COB-SCR-F59       VALUE 1059.
       78 COB-SCR-F60       VALUE 1060.
       78 COB-SCR-F61       VALUE 1061.
       78 COB-SCR-F62       VALUE 1062.
       78 COB-SCR-F63       VALUE 1063.
       78 COB-SCR-F64       VALUE 1064.
      *> Exception keys - Values 2xxx
       78 COB-SCR-PAGE_UP   VALUE 2001.
       78 COB-SCR-PAGE_DOWN VALUE 2002.
       78 COB-SCR-KEY-UP    VALUE 2003.
       78 COB-SCR-KEY-DOWN  VALUE 2004.
       78 COB-SCR-ESC       VALUE 2005.
       78 COB-SCR-PRINT     VALUE 2006.
       78 COB-SCR-HOME-KEY  VALUE 2007.
       78 COB-SCR-END-KEY   VALUE 2008.
       78 COB-SCR-INS-KEY   VALUE 2009.
       78 COB-SCR-DEL-KEY   VALUE 2010.
       78 COB-SCR-FWD-TAB   VALUE 9.
       78 COB-SCR-BWD-TAB   VALUE 2012.
       78 COB-SCR-KEY-LEFT  VALUE 2013.
       78 COB-SCR-KEY-RIGHT VALUE 2014.
      *> Input validation - Values 8xxx
       78 COB-SCR-NO-FIELD  VALUE 8000.
      *> Other errors - Values 9xxx
       78 COB-SCR-FATAL     VALUE 9000.
       78 COB-SCR-TIMEOUT   VALUE 9001.

Numeric sign

The NUMERIC SIGN clause is used to define a default sign storage convention, when the sign storage for a data item is not specified.

General Format:

       [NUMERIC [SIGN [IS] [ (LEADING } [ SEPARATE ] 
                          {TRAILING}

General Rules:

The default sign storage may be set to LEADING, TRAILING, LEADING SEPARATE, or TRAILING SEPARATE. For details on the internal data storage, see the SIGN Clause section in the Data Description chapter.

Decimal-point

DECIMAL-POINT converts decimal-points associated with numeric edited data items to commas, and converts commas associated with numeric edited data items to decimal-points.

General Format:

[ DECIMAL-POINT IS COMMA ]

General Rules:

Numeric edited data items convert commas to decimal points, and decimal points to commas.

Repository

The REPOSITORY paragraph lists the intrinsic-function-names that may be used in the program without specifying the word FUNCTION.

General Format:

       REPOSITORY. 
              [ FUNCTION { { intrinsic-function-name } ... } INTRINSIC ].
                            { ALL                          }

Syntax:

intrinsic-function-name is the name of an intrinsic function that may be used without specifying the word FUNCTION. For a full list of intrinsic function names, see Appendix 6.4. LINK

General Rules:

  1. FUNCTION ALL indicates that all intrinsic functions may be used without specifying the word FUNCTION.
  2. The compiler flag -ffunctions-all has the same effect as the FUNCTION ALL clause, allowing all intrinsic functions to be used without specifying the word FUNCTION.
  3. In the absence of a designation in the REPOSITORY paragraph, or the use of the -ffunctions-all compiler flag, the FUNCTION keyword is required to use an intrinsic function. If it is not used, an error, such as: Error: 'SQRT' undefined is returned by the compiler.

Code Sample:

       IDENTIFICATION DIVISION. 
       PROGRAM-ID. repos-test. 
       ENVIRONMENT DIVISION. 
       CONFIGURATION SECTION. 
       REPOSITORY. 
              FUNCTION ALL INTRINSIC. 
       DATA DIVISION. 

       WORKING-STORAGE SECTION. 
       77 WS-DUMMY PIC X. 
       77 sqrt-fld PIC 99. 
       PROCEDURE DIVISION. 
       MAIN. 
              MOVE SQRT(225) TO sqrt-fld. 
              DISPLAY "Square Root of 225 is: " line 10 col 10. 
              DISPLAY sqrt-fld line 10 col 33. 
              ACCEPT ws-dummy line 10 col 40. 

              STOP RUN.
Back to top