Cobol program, COBOL Programming

Assignment Help:

Write a COBOL IF sentence to use the values of numeric variables EXAM and COURSEWORK, both assumed to be with format PIC 999 and in the range 0 to 100 and to move the value:

"FAIL",

"RC" ( resit coursework),

"RE" (resit examination"),

"RB" (resit both examination and coursework) or

"PASS"

to the variable RESULT with format PIC XXXX, according to this flowchart:.

625_COBOL program.png

Task 3

Explain the effect of the following pictures:

05 FIELD-1 PIC Z(5)9.

05 FIELD-2 PIC £(5)9.99.

05 FIELD-3 PIC £**,***.99.

05 FIELD-4 PIC £££,££9.99DB.

05 FIELD-5 PIC ZZZZ9+.

by showing the output that will be produced if each if the following values is moved to each of the above data-items:

12345678

0.2566

-180

 

Task 4

There are many errors in the following COBOL source code. Identify the errors and rewrite the program so that it contains no errors:

IDENTIFICATION DIVISION

PROGRAMID. ERRORS-EXAMPLE.

DATA DIVISION

77 ITEM-DESC PIC X20.

77 ITEM COST PIC 999V99.

77 VAT 999V99.

77 TOTAL PIC 999V99.

PROCEDURE-DIVISION.

BILL-SEQ

MOVE 0 TO TOTAL.

         INPUT ITEM-DESC

         INPUT ITEM-COST.

INPUT-ITER.

         IF ITEM-COST = 0 GOTO INPUT-END

                  ADD ITEM-COST TO TOTAL

                  ACCEPT ITEM-DESC

                  ACCEPT ITEM-COST

                  GO TO INPUT ITER.

         VAT = 0.15 X TOTAL

         ADD VAT TO TOTAL

         DISPLAY OUTPUT TOTAL

         STOP-RUN.

BILL-END

 

Task 5

The following data structure appears in a COBOL program used by a bureau de change:

01 AUXILAIRY-ITEMS.

         05 AMOUNT-REQUIRED PIC999V99.

         05 SUCCESS-INDICATOR PIC 9.

         88 SUCCESS VALUE 1.

 01 CURRENCY-TABLE.

         05 CURRENCY-RATE OCCURS 50 TIMES.

         10 CURRENCY-CODE PIC AAA.

         10 CURRENCY-RATE PIC 9(5)V9999.

         05 NUMBER-OF-CURRENCIES PIC 99.

Various foreign currencies are given ISO-standard three-letter codes (CURRENCY-CODE) and these are stored in the table (array) CURRENCY-TABLE together with the corresponding exchange rate (CURRENCY-RATE). The exchange rate is expressed as the amount of the foreign currency purchased for one pound (GBP).

The currencies are stored in elements 1 to NUMBER-OF-CURRENCIESof the table.

Assuming that all the relevant data items have been correctly initialised, write fragments of COBOL for each of the following tasks. In each case set the value of SUCCESS-INDICATOR such that the condition-name SUCCESS has the appropriate value after the operation.

i)  Update the exchange rate for "PLN" TO 4.637.

ii) Look up the currency rate for "EUR" and calculate the (rounded) amount of this currency that corresponds to the value of AMOUNT-REQUIRED.

iii) Add a new currency to the table with the value "KWD" and the exchange rate 0.4488.

Task 6

The COBOL ALTER statement was removed from the language after early versions. Briefly explain what the ALTER statement was and discuss why you think it was removed from the language.


Related Discussions:- Cobol program

Relative files, RELATIVE FILES: The Files that are stored on a direct ...

RELATIVE FILES: The Files that are stored on a direct access storage medium like magnetic disk are frequently known as direct access files. The COBOL supports three different

Program., calculate simple interest

calculate simple interest

Input-output section - cobol programming, INPUT-OUTPUT SECTION: This s...

INPUT-OUTPUT SECTION: This section holds information regarding the files to be used in the program. There are 2 paragraphs in this section- FILE-CONTROL & I-O-CONTROL. The

Rules for apply for the condition name, Rules for apply for the condition n...

Rules for apply for the condition name: The rules below apply for the condition name. (i) The Condition names should be explained at level 88. The level number starts in ma

Blank when zero - edit characters for numeric data, BLANK WHEN ZERO: ...

BLANK WHEN ZERO: BLANK WHEN ZERO is an editing clause that may be used along with a picture. This will set the whole data item to blanks of its value is equal to zero. Though,

Column and field in cobol program, Column and Field in COBOL program: ...

Column and Field in COBOL program: In COBOL there are 2 types of entries termed as margin A and margin B entries. The Margin A entries start from the column 8, 9, 10 or 11 and

Sequential files with the variable-length records, SEQUENTIAL FILES WITH TH...

SEQUENTIAL FILES WITH THE VARIABLE-LENGTH RECORDS: The Magnetic - tape or disk files can hold variable-length records. In this situation the file can have records with various

Example of redefines clause, Example of Redefines clause: This illustr...

Example of Redefines clause: This illustration describes a sales record that may either contain the total amount of sale or the quantity (QTY) and UNIT-PRICE. The aim of such

Picture specification - picture clause, PICTURE specification: The siz...

PICTURE specification: The size of a group item is equivalent to the total of the sizes of all the subordinate elementary items. The group item class is alphanumeric. The i

Illustration of search verb, Illustration of Search verb: To illustrat...

Illustration of Search verb: To illustrate the other use of SEARCH verb, assume we wish to search the similar tab to find the number of persons whose deposited amount is more

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd