Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 4: IDENTIFICATION DIVISION & ENVIRONMENT DIVISION


CONFIGURATION SECTION

  • The CONFIGURATION SECTION is used to specify the computer system on which the COBOL source program will be compiled and executed.
  • All entries in CONFIGURATION SECTION must begin in Margin A and can be continued to Margin B of coding sheet
  • The CONFIGURATION SECTION is optional to specify
  • The CONFIGURATION SECTION must not be coded in program that is contained within another program. If CONFIGURATION SECTION entries are coded in a program that contains another program they apply to each contained program
  • The basic structure of CONFIGURATION SECTION is as follows:-

    [CONFIGURATION SECTION. [SOURCE-COMPUTER. source-computer-entry.] [OBJECT-COMPUTER. object-computer-entry.] [SPECIAL-NAMES. special-names-entry.]]

  • There are three paragraphs which can be coded within CONFIGURATION SECTION, namely SOURCE-COMPUTER, OBJECT-COMPUTER and SPECIAL-NAMES paragraph

SOURCE-COMPUTER paragraph

  • The SOURCE-COMPUTER paragraph is used to specify the computer system on which the COBOL source program will be compiled
  • The SOURCE-COMPUTER paragraph is optional to specify
  • Basic syntax with ‘WITH DEBUGGING MODE’ clause:-

    SOURCE-COMPUTER. source-computer-entry [WITH DEBUGGING MODE].

  • source-computer-entry is user-defined word that denotes name of the computer system
  • WITH DEBUGGING MODE clause:-
    • This enables compile-time switch for debugging lines written in the program
    • The debugging lines are lines in COBOL source program that is coded with character ‘D’ or ‘d’ in column 7 (Indicator field) of coding sheet.
    • This clause when coded, causes the debugging lines to get compiled and included in load module
    • This clause when not coded, the debugging lines will be ignored during compilation and treated as comments.
    • ‘WITH DEBUGGING MODE’ clause is optional to specify
    • This clause is very handy while debugging any program because it can help to check the value of the data-names at certain points in the execution, and it is also useful to monitor the flow of the program by displaying paragraphs.
    • Example:-
      COBOL Source program:-
      ********************** Top of Data ********************** 000100 IDENTIFICATION DIVISION. 000200 PROGRAM-ID. MFPROG1. 000300 ENVIRONMENT DIVISION. 000400 CONFIGURATION SECTION. 000500 SOURCE-COMPUTER. IBM-3090. 000600*SOURCE-COMPUTER. IBM-3090 WITH DEBUGGING MODE. 000700 OBJECT-COMPUTER. IBM-3090. 000800 SPECIAL-NAMES. 000900 PROCEDURE DIVISION. 001000 MAIN-PARA. 001100 DISPLAY 'CONGIGURATION SECTION EXAMPLE' 001200D DISPLAY 'DEBUGGING MODE ACTIVATED' 001300 STOP RUN. ********************* Bottom of Data ********************
      Output:-
      ********************** Top of Data ********************** CONGIGURATION SECTION EXAMPLE ********************* Bottom of Data ********************
    • Explanation:- In above COBOL Source program, on line ‘000500’ SOURCE-COMPUTER is coded without activating debugging mode and therefore when this program ran, in output it did not print display statement coded on line ‘001200’ as it was marked Debugging line using indicator ‘D’ on 7th column
    • When we modified above program, and commented out line ‘000500’ and uncommented line’000600’. So now we ran program with DEBUGGING MODE enabled and this time it print display statement coded on line ‘001200’ too. Below is output for same:-
      Output:-
      ********************** Top of Data ********************** CONGIGURATION SECTION EXAMPLE DEBUGGING MODE ACTIVATED ********************* Bottom of Data ********************

OBJECT-COMPUTER paragraph

  • The OBJECT-COMPUTER paragraph is used to specify the computer system on which the COBOL source program will be executed
  • The OBJECT-COMPUTER paragraph is optional to specify
  • Basic syntax:-

    OBJECT-COMPUTER. object-computer-entry.

  • object-computer-entry is user-defined word that denotes name of the computer system
  • The OBJECT-COMPUTER paragraph has no effect on the program execution
  • Example:-

    OBJECT-COMPUTER. IBM-3090.

SPECIAL-NAMES paragraph

  • The SPECIAL-NAMES paragraph is used to link IBM-system-defined names to user-defined mnemonic names
  • The SPECIAL-NAMES paragraph is optional to specify in all compilers
  • SPECIAL-NAMES paragraph can be used to
    • link IBM-system- defined name to user-defined mnemonic names
    • link Alphabet-names to character sets or collating sequence
    • link Class names to sets of character
    • create substitute character for currency-sign
    • allow comma to be used as a decimal point
    • change default collating sequence
  • Basic syntax:-

    SPECIAL-NAMES. [CURRENCY SIGN IS literal-1] [DECIMAL-POINT IS COMMA] [CLASS class-name IS { literal-2 [{THRU|THROUGH} literal-3]}… ].

  • Literal-1, literal-2, literal-3 are numeric or alpha-numeric literals and class-name is a user-defined word that defines a class name
  • Example:-

    SPECIAL-NAMES. CLASS WS-EVEN-NO-VALIDATION IS ‘0’ ‘2’ ‘4’ ‘6’ ‘8’ In PORCEDURE-DIVISION:- IF WS-INPUT-LAST-DIGIT IS WS-EVEN-NO-VALIDATION DISPLAY ‘INPUT NUMBER IS EVEN NUMBER’ ELSE DISPLAY ‘INPUT NUMBER ID ODD NUMBER’ END-IF.



Advertisements






© copyright mainframebug.com
Privacy Policy